yolkbot 1.5.9 → 1.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,93 @@
1
- var __defProp=Object.defineProperty;var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0,configurable:!0,set:__exportSetter.bind(all,name)})};var WWWebSocket=null;var iFetch=globalThis.fetch,fetch_default=iFetch;var globals={},isBrowser=typeof window<"u"&&typeof HTMLElement<"u",isWebWorker=typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope,isCloudflareWorker=typeof WebSocketPair<"u"&&typeof Cloudflare<"u",isUnsandboxedElectron=typeof process==="object"&&process.versions?.electron&&process.versions?.node&&typeof window<"u"&&typeof window.require<"u",isNode=typeof process<"u"&&process.moduleLoadList?.length>0,isDeno=typeof Deno<"u",isBun=typeof Bun<"u";if(!isBrowser&&!isCloudflareWorker&&!isWebWorker&&!isUnsandboxedElectron&&!isNode&&!isDeno&&!isBun)throw Error("yolkbot doesn't know how to run in this environment. report this at https://yolkbot.xyz/community");globals.isBrowser=isBrowser||isWebWorker;globals.isIsolated=!isNode&&!isDeno&&!isBun&&!isUnsandboxedElectron;globals.fetch=globals.isIsolated?(...args)=>globalThis.fetch(...args):fetch_default;globals.WebSocket=globals.isIsolated?globalThis.WebSocket:WWWebSocket;var globals_default=globals;var exports_constants={};__export(exports_constants,{findItemById:()=>findItemById,UserAgent:()=>UserAgent,Team:()=>Team,StateBufferSize:()=>StateBufferSize,SocialReward:()=>SocialReward,SocialMedia:()=>SocialMedia,ShellStreak:()=>ShellStreak,PlayType:()=>PlayType,Movement:()=>Movement,ItemType:()=>ItemType,GunList:()=>GunList,GunEquipTime:()=>GunEquipTime,GameOptionFlag:()=>GameOptionFlag,GameMode:()=>GameMode,GameAction:()=>GameAction,FramesBetweenSyncs:()=>FramesBetweenSyncs,FirebaseKey:()=>FirebaseKey,CoopState:()=>CoopState,CollectType:()=>CollectType,ChiknWinnerDailyLimit:()=>ChiknWinnerDailyLimit,ChatFlag:()=>ChatFlag,ChallengeType:()=>ChallengeType,ChallengeSubType:()=>ChallengeSubType,BanDuration:()=>BanDuration});var exports_guns={};__export(exports_guns,{SMG:()=>SMG,RPEGG:()=>RPEGG,M24:()=>M24,EggK47:()=>EggK47,DozenGauge:()=>DozenGauge,Cluck9mm:()=>Cluck9mm,CSG1:()=>CSG1,AUG:()=>AUG});var EggK47={ammo:{capacity:30,reload:30,store:240,pickup:30},longReloadTime:205,shortReloadTime:160,weaponName:"EggK-47",internalName:"Eggk47",standardMeshName:"eggk47",damage:30,range:20,rof:3,totalDamage:30,velocity:1.5},DozenGauge={ammo:{capacity:2,reload:2,store:24,pickup:8},longReloadTime:155,shortReloadTime:155,weaponName:"Scrambler",internalName:"Dozen Gauge",standardMeshName:"dozenGauge",damage:8.5,range:8,rof:8,totalDamage:170,velocity:1},CSG1={ammo:{capacity:15,reload:15,store:60,pickup:15},longReloadTime:225,shortReloadTime:165,weaponName:"Free Ranger",internalName:"CSG-1",standardMeshName:"csg1",damage:105,range:50,rof:13,totalDamage:105,velocity:1.75},Cluck9mm={ammo:{capacity:15,reload:15,store:60,pickup:15},longReloadTime:195,shortReloadTime:160,weaponName:"Cluck 9mm",internalName:"Cluck 9mm",standardMeshName:"cluck9mm",damage:26,range:15,rof:4,totalDamage:26,velocity:1},RPEGG={ammo:{capacity:1,reload:1,store:3,pickup:1},longReloadTime:170,shortReloadTime:170,weaponName:"RPEGG",internalName:"Eggsploder",standardMeshName:"rpegg",damage:140,range:45,rof:40,totalDamage:192.5,velocity:0.4},SMG={ammo:{capacity:40,reload:40,store:200,pickup:40},longReloadTime:225,shortReloadTime:190,weaponName:"Whipper",internalName:"SMEGG",standardMeshName:"smg",damage:23,range:20,rof:2,totalDamage:23,velocity:1.25},M24={ammo:{capacity:1,reload:1,store:12,pickup:4},longReloadTime:144,shortReloadTime:144,weaponName:"Crackshot",internalName:"M2DZ",standardMeshName:"m24",damage:170,range:60,rof:15,totalDamage:170,velocity:2},AUG={ammo:{capacity:24,reload:24,store:150,pickup:24},longReloadTime:205,shortReloadTime:160,weaponName:"Tri-Hard",internalName:"AUG",standardMeshName:"aug",damage:32,range:20,rof:15,totalDamage:34,velocity:1.5};var Items=[];var itemsMap=new Map(Items.map((item)=>[item.id,item])),findItemById=(id)=>itemsMap.get(id);var BanDuration={FiveMinutes:0,FifteenMinutes:1,OneHour:2},ChallengeSubType={Killstreak:0,KillWithWeapon:1,MovementDistance:3,Jumping:4,TimePlayed:6,TimeAlive:7,KillWithCondition:8,TotalKills:10,SpatulaKills:10,Collecting:18,FromTheCoop:20,SpecialOffensive:21,WinKOTC:23,KillWithSpatula:23},ChallengeType={Kill:0,Damage:1,Death:2,Movement:3,Collect:4,Time:5,KOTC:6,Spatula:7},ChatFlag={None:0,Pinned:2,Team:4,Mod:254,Server:255},ChiknWinnerDailyLimit=3,CollectType={Ammo:0,Grenade:1},CoopState={Start:0,Score:1,Win:2,Capturing:3,Contested:4,Takeover:5,Abandoned:6,Unclaimed:7},miniCodec=(s,k=42)=>s.split("").map((c)=>String.fromCharCode(c.charCodeAt(0)^k)).join(""),FirebaseKey=miniCodec("kcPKySnz\x1Eyc@aK]\x1Ck\x1EI\x07P\\LsRciZHo@D\x1BXxDd\x1F\x1A"),FramesBetweenSyncs=3,GameAction={Reset:1,Pause:2},GameMode={FFA:0,Team:1,Spatula:2,KOTC:3},GameOptionFlag={Locked:1,NoTeamChange:2,NoTeamShuffle:4},GunEquipTime=13,GunList=[EggK47,DozenGauge,CSG1,RPEGG,SMG,M24,AUG],ItemType={Hat:1,Stamp:2,Primary:3,Secondary:4,Grenade:6,Melee:7},Movement={Forward:1,Backward:2,Left:4,Right:8,Jump:16,Fire:32,Melee:64,Scope:128},PlayType={JoinPublic:0,CreatePrivate:1,JoinPrivate:2},ShellStreak={HardBoiled:1,EggBreaker:2,Restock:4,OverHeal:8,DoubleEggs:16,MiniEgg:32},SocialMedia={Facebook:0,Instagram:1,Tiktok:2,Discord:3,Youtube:4,Twitter:5,Twitch:6},SocialReward={Discord:"rew_1200",Tiktok:"rew_1208",Instagram:"rew_1219",Steam:"rew_1223",Facebook:"rew_1227",Twitter:"rew_1234",Twitch:"rew_twitch_social"},StateBufferSize=256,Team={Blue:1,Red:2},latestChromeVersion=143,latestFirefoxVersion=146,agents=[`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`,`Mozilla/5.0 (X11; Linux x86_64; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`,`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36 Edg/${latestChromeVersion}.0.0.0`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`],UserAgent=agents[Math.floor(Math.random()*agents.length)];class yolkws{connected=!1;autoReconnect=!1;url="";proxy="";binaryType="";connectionTimeout=5000;errorLogger=(...args)=>console.error(...args);onopen=()=>{};onmessage=()=>{};onclose=()=>{};onerror=()=>{};constructor(url,params={}){if(typeof params!=="object")params={};if(typeof process>"u"&&params.proxy)throw Error("You cannot pass a proxy to a WebSocket in this environment.");if(this.url=url,this.proxy=params.proxy,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger}async tryConnect(tries=1){let url=new URL(this.url),retryOrQuit=async()=>{if(tries===5)return!1;return await this.tryConnect(tries+1)};try{if(this.socket=typeof process>"u"?new globals_default.WebSocket(this.url):new globals_default.WebSocket(this.url,{proxy:this.proxy||null,headers:{"accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.9","cache-control":"no-cache",connection:"Upgrade",origin:url.origin.replace("ws","http"),pragma:"no-cache","user-agent":UserAgent}}),this.binaryType)this.socket.binaryType=this.binaryType}catch(e){return this.errorLogger(`Failed to connect on try ${tries}, trying again...`,e),await retryOrQuit()}if(this.onBeforeConnect)this.onBeforeConnect();return new Promise((resolve)=>{let timeout=setTimeout(async()=>{this.socket.close(),resolve(await retryOrQuit())},this.connectionTimeout),errorListener=async(e)=>{clearTimeout(timeout),this.errorLogger("WebSocket error",e),resolve(await retryOrQuit())};this.socket.addEventListener("open",async()=>{clearTimeout(timeout),this.connected=!0,this.onopen(),this.socket.removeEventListener("error",errorListener),this.socket.addEventListener("message",(messageEvent)=>this.onmessage(messageEvent)),this.socket.addEventListener("close",(closeEvent)=>!this.autoReconnect&&this.onclose(closeEvent)),this.socket.addEventListener("error",(event)=>this.onerror(event)),resolve(!0)}),this.socket.addEventListener("error",errorListener),this.socket.addEventListener("close",()=>{if(this.connected){if(this.connected=!1,this.autoReconnect)setTimeout(async()=>{if(!await this.tryConnect()){if(this.onclose)this.onclose();this.errorLogger("tryConnect: failed to reconnect to",this.url,"after 5 attempts."),this.errorLogger("tryConnect: please check your internet connection & ensure your IP isn't blocked.")}},250)}})})}send(data){return this.socket?.send(data)}close(data){if(!this.socket)return;if(this.autoReconnect=!1,this.socket.terminate)try{this.socket.terminate()}catch{}else this.socket.close(data)}}var socket_default=yolkws;var exports_enums={};__export(exports_enums,{ZoneLeaveReason:()=>ZoneLeaveReason,RedeemCodeError:()=>RedeemCodeError,PathfindError:()=>PathfindError,MatchmakerError:()=>MatchmakerError,LoginError:()=>LoginError,Intents:()=>Intents,GameJoinError:()=>GameJoinError,GameFindError:()=>GameFindError,CleanupLevel:()=>CleanupLevel,ClaimURLError:()=>ClaimURLError,ClaimSocialError:()=>ClaimSocialError,ChicknWinnerError:()=>ChicknWinnerError,ChallengeRerollError:()=>ChallengeRerollError,ChallengeClaimError:()=>ChallengeClaimError,BuyItemError:()=>BuyItemError,APIError:()=>APIError});var APIError={WebSocketConnectFail:"websocket_connect_fail",MissingParams:"missing_params",NetworkFail:"firebase_network_failed",ServicesClosedEarly:"services_closed_early",InternalError:"unknown_error",FirebaseRateLimited:"firebase_rate_limited"},LoginError={...APIError,AccountBanned:"account_banned"},BuyItemError={SessionExpired:"PLAYER_NOT_FOUND",ItemNotFound:"ITEM_NOT_FOUND",ItemAlreadyOwned:"ALREADY_OWNED",CannotAfford:"INSUFFICIENT_FUNDS",InternalError:"UNKNOWN_ERROR"},ChicknWinnerError={OnCooldown:"on_cooldown",HitDailyLimit:"hit_daily_limit",NotAtDailyLimit:"not_at_limit",NotEnoughResetEggs:"not_enough_eggs",SessionExpired:"session_expired",InternalError:"unknown_error"},GameFindError={MissingParams:"missing_params",InvalidRegion:"region_not_in_list",InvalidMode:"mode_not_in_list",InvalidMap:"map_not_in_list",GameNotFound:"game_not_found",SessionExpired:"session_expired",InternalError:"unknown_error"},GameJoinError={MissingParams:"missing_params",InvalidObject:"invalid_game_object",WebSocketConnectFail:"websocket_connect_fail",GameNotFound:"game_not_found",InternalError:"unknown_error"},MatchmakerError={WebSocketConnectFail:"websocket_connect_fail"},Intents={CHALLENGES:1,BOT_STATS:2,PATHFINDING:3,PING:5,COSMETIC_DATA:6,PLAYER_HEALTH:7,PACKET_HOOK:8,LOG_PACKETS:10,SKIP_LOGIN:11,DEBUG_BUFFER:12,NO_AFK_KICK:16,LOAD_MAP:17,OBSERVE_GAME:18,RENEW_SESSION:21,VIP_HIDE_BADGE:22,SIMULATION:23,MANUAL_UPDATE:24,FASTER_RESPAWN:25},RedeemCodeError={SessionExpired:"PLAYER_NOT_FOUND",CurrentlyRedeemingElsewhere:"CODE_DOUBLE_DOUBLE",AlreadyRedeemed:"CODE_PREV_REDEEMED",InvalidCode:"CODE_NOT_FOUND",Ratelimited:"RATE_LIMIT_REACHED",InternalError:"UNKNOWN_ERROR"},ClaimSocialError={SessionExpired:"reward_expired_session",InvalidReward:"REWARD_NOT_FOUND",AlreadyRedeemed:"REWARD_PREV_GIVEN",InternalError:"unknown_error"},ClaimURLError={SessionExpired:"urlRewardParams_expired_session",InvalidReward:"REWARD_NOT_FOUND",AlreadyRedeemed:"REWARD_PREV_GIVEN",InternalError:"unknown_error"},ChallengeRerollError={SessionExpired:"challengeRerollSlot_expired_session",ChallengeNotFound:"challenge_not_found",ChallengeNotAssigned:"challenge_reroll_not_found",NotEnoughEggs:"insufficient_eggs",InternalError:"unknown_error"},ChallengeClaimError={SessionExpired:"challengeClaimReward_expired_session",ChallengeNotFound:"challenge_claim_not_found",ChallengeNotCompleted:"challenge_not_completed",InternalError:"unknown_error"},PathfindError={NoPathFound:"no_path_found",PathTooShort:"path_too_short"},ZoneLeaveReason={Despawned:"despawned",Killed:"killed",WalkedOut:"exited",RoundEnded:"round_ended"},CleanupLevel={None:0,Partial:1,Full:2};var exports_util={};__export(exports_util,{isDoubleEggWeeknd:()=>isDoubleEggWeeknd,initKotcZones:()=>initKotcZones,fetchMap:()=>fetchMap,createGun:()=>createGun,createError:()=>createError});var createGun=(baseGun)=>{let gun=structuredClone(baseGun);return gun.ammo.rounds=gun.ammo.capacity,gun.ammo.storeMax=gun.ammo.store,gun},createError=(errorEnum)=>({ok:!1,error:errorEnum}),attemptFetch=async(url,options={},retries=3,backoff=300)=>{try{let response=await fetch(url,options);if(!response.ok)throw Error(`failed to fetch map; status: ${response.status}`);return response}catch(error){if(retries>0)return await new Promise((res)=>setTimeout(res,backoff)),attemptFetch(url,options,retries-1,backoff*2);else throw error}},fetchMap=async(name,hash)=>{if(typeof process<"u"){let{existsSync,mkdirSync,readFileSync,writeFileSync}=process.getBuiltinModule("node:fs"),{join}=process.getBuiltinModule("node:path"),{homedir}=process.getBuiltinModule("node:os"),yolkbotCache=join(homedir(),".yolkbot");if(!existsSync(yolkbotCache))mkdirSync(yolkbotCache);let mapCache=join(yolkbotCache,"maps");if(!existsSync(mapCache))mkdirSync(mapCache);let safeName=String(name).replace(/[^a-z0-9_-]/gi,"_"),safeHash=String(hash).replace(/[^a-z0-9_-]/gi,"_"),mapFile=join(mapCache,`${safeName}-${safeHash}.json`);if(existsSync(mapFile))return JSON.parse(readFileSync(mapFile,"utf-8"));let data2=await(await attemptFetch(`https://x.yolkbot.xyz/data/maps/full/${name}.json?${hash}`)).json();return writeFileSync(mapFile,JSON.stringify(data2,null,4),{flag:"w+"}),data2}return await(await attemptFetch(`https://x.yolkbot.xyz/data/maps/full/${name}.json?${hash}`)).json()},initKotcZones=(meshData)=>{let len=meshData.length;if(!len)return[];let minX=1/0,minY=1/0,minZ=1/0,maxX=-1/0,maxY=-1/0,maxZ=-1/0;for(let i=0;i<len;i++){let{x,y,z}=meshData[i];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}let sizeX=maxX-minX+1|0,sizeY=maxY-minY+1|0,sizeZ=maxZ-minZ+1|0,strideY=sizeX,strideZ=sizeX*sizeY,cellIndex=new Int32Array(sizeX*sizeY*sizeZ).fill(-1),zoneIds=new Uint16Array(len),queue=new Uint32Array(len);for(let i=0;i<len;i++){let{x,y,z}=meshData[i];cellIndex[(x-minX|0)+(y-minY|0)*strideY+(z-minZ|0)*strideZ]=i}let zones=[],zoneId=0;for(let i=0;i<len;i++){if(zoneIds[i])continue;let zone=++zoneId,activeZone=[],head=0,tail=0;queue[tail++]=i,zoneIds[i]=zone;while(head<tail){let idx=queue[head++],cell=meshData[idx];cell.zone=zone,activeZone[activeZone.length]=cell;let{x,y,z}=cell,flatIdx=(x-minX|0)+(y-minY|0)*strideY+(z-minZ|0)*strideZ,nIdx;if(x>minX&&(nIdx=cellIndex[flatIdx-1])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(x<maxX&&(nIdx=cellIndex[flatIdx+1])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(y>minY&&(nIdx=cellIndex[flatIdx-strideY])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(y<maxY&&(nIdx=cellIndex[flatIdx+strideY])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(z>minZ&&(nIdx=cellIndex[flatIdx-strideZ])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(z<maxZ&&(nIdx=cellIndex[flatIdx+strideZ])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx}zones[zones.length]=activeZone}return zones},isDoubleEggWeeknd=()=>{let day=new Date().getUTCDay();return day>=5&&new Date().getUTCHours()>=20||day===6||day===0};var baseHeaders={origin:"https://shellshock.io","user-agent":typeof process>"u"?null:UserAgent,"x-client-version":"Chrome/JsCore/9.17.2/FirebaseCore-web","x-firebase-locale":"en"};class API{errorLogger=(...args)=>console.error(...args);idToken=null;constructor(params={}){if(this.proxy=params.proxy,this.instance=params.instance||"shellshock.io",this.protocol=params.protocol||"wss",this.customKey=params.customKey||null,this.connectionTimeout=params.connectionTimeout||5000,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger}queryServices=async(request)=>{let ws=new socket_default(`${this.protocol}://${this.instance}/services/`,{proxy:this.proxy,errorLogger:this.errorLogger});if(ws.connectionTimeout=this.connectionTimeout,!await ws.tryConnect()||ws.socket.readyState!==1)return createError(APIError.WebSocketConnectFail);return new Promise((resolve)=>{let resolved=!1;ws.onmessage=(mes)=>{resolved=!0;try{let resp=JSON.parse(mes.data);resolve({ok:!0,...resp})}catch(e){this.errorLogger("queryServices: error! command:",request.cmd,"and data:",request,e),resolve(createError(APIError.InternalError))}ws.close()},ws.onerror=(error)=>{if(resolved)return;resolved=!0,this.errorLogger("queryServices: websocket error! command:",request.cmd,"and data:",request,"error:",error),resolve(createError(APIError.InternalError))},ws.onclose=()=>{if(resolved)return;resolved=!0,this.errorLogger("queryServices: services closed before sending back message"),this.errorLogger("queryServices: command:",request.cmd,"and data:",request),resolve(createError(APIError.ServicesClosedEarly))},ws.send(JSON.stringify(request))})};#authWithEmailPass=async(email,password,customServicesParams,endpoint)=>{if(!email||!password)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:${endpoint}?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({email,password,returnSecureToken:!0}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("authWithEmailPass: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ERR_BAD_REQUEST")return this.errorLogger("authWithEmailPass: bad request",body||error),createError(APIError.InternalError);else if(error.code==="ECONNREFUSED")return this.errorLogger("authWithEmailPass: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("authWithEmailPass: unknown error:",email,error),createError(APIError.InternalError)}if(!body.idToken)return this.errorLogger("authWithEmailPass: missing idToken",body),createError(APIError.InternalError);this.idToken=body.idToken;let servicesQuery=await this.queryServices({cmd:"auth",firebaseToken:body.idToken,...customServicesParams});return servicesQuery.ok?{firebase:body,...servicesQuery}:servicesQuery};createAccount=(email,password,customServicesParams)=>this.#authWithEmailPass(email,password,customServicesParams,"signUp");loginWithCredentials=(email,password,customServicesParams)=>this.#authWithEmailPass(email,password,customServicesParams,"signInWithPassword");loginWithRefreshToken=async(refreshToken,customServicesParams)=>{if(!refreshToken)return createError(APIError.MissingParams);let formData=new URLSearchParams;formData.append("grant_type","refresh_token"),formData.append("refresh_token",refreshToken);let body;try{body=await(await globals_default.fetch(`https://securetoken.googleapis.com/v1/token?key=${this.customKey||FirebaseKey}`,{method:"POST",body:formData.toString(),headers:{...baseHeaders,"content-type":"application/x-www-form-urlencoded"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("loginWithRefreshToken: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("loginWithRefreshToken: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("loginWithRefreshToken: unknown error:",body,error),createError(APIError.InternalError)}if(!body.id_token)return this.errorLogger("loginWithRefreshToken: missing idToken",body),createError(APIError.InternalError);this.idToken=body.id_token;let response=await this.queryServices({cmd:"auth",firebaseToken:body.id_token,...customServicesParams});return response.ok?{firebase:body,...response}:response};loginAnonymously=async(customServicesParams)=>{let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({returnSecureToken:!0}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="ECONNREFUSED")return this.errorLogger("loginAnonymously: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("loginAnonymously: unknown error:",body,error),createError(APIError.InternalError)}if(!body.idToken)return this.errorLogger("loginAnonymously: missing idToken",body),createError(APIError.InternalError);this.idToken=body.idToken;let query=await this.queryServices({cmd:"auth",firebaseToken:body.idToken,...customServicesParams});return query.ok?{firebase:body,...query}:query};sendEmailVerification=async(idToken=this.idToken)=>{if(!idToken)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({requestType:"VERIFY_EMAIL",idToken}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("sendEmailVerification: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("sendEmailVerification: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("sendEmailVerification: unknown error:",idToken,error),createError(APIError.InternalError)}if(body.kind!=="identitytoolkit#GetOobConfirmationCodeResponse")return this.errorLogger("sendEmailVerification: the game sent an invalid response",body),createError(APIError.InternalError);return{ok:!0,email:body.email}};verifyOobCode=async(oobCode)=>{if(!oobCode)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({oobCode}),headers:{...baseHeaders,"x-client-version":"Chrome/JsCore/3.7.5/FirebaseCore-web",referer:"https://shellshockio-181719.firebaseapp.com/","content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("verifyOobCode: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("verifyOobCode: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("verifyOobCode: unknown error:",oobCode,error),createError(APIError.InternalError)}if(!body.emailVerified)return this.errorLogger("verifyOobCode: the game sent an invalid response",body),createError(APIError.InternalError);return{ok:!0,email:body.email}}}var api_default=API;class CommIn{static buffer;static idx;static init(buf){this.buffer=new Uint8Array(buf),this.idx=0}static isMoreDataAvailable(){return this.buffer.length-this.idx}static unPackInt8U(){return this.buffer[this.idx++]}static unPackInt8(){return this.unPackInt8U()<<24>>24}static unPackInt16U(){let i2=this.idx;return this.idx+=2,this.buffer[i2]|this.buffer[i2+1]<<8}static unPackInt24U(){let i2=this.idx;return this.idx+=3,this.buffer[i2]|this.buffer[i2+1]<<8|this.buffer[i2+2]<<16}static unPackInt32U(){let i2=this.idx;return this.idx+=4,(this.buffer[i2]|this.buffer[i2+1]<<8|this.buffer[i2+2]<<16|this.buffer[i2+3]<<24)>>>0}static unPackInt16(){return this.unPackInt16U()<<16>>16}static unPackInt32(){return this.unPackInt32U()<<0}static unPackRadU(){return this.unPackInt24U()/2097152}static unPackRad(){return this.unPackInt16U()/8192-Math.PI}static unPackFloat(){return this.unPackInt16()/256}static unPackDouble(){return this.unPackInt32()/1048576}static unPackString(maxLen){maxLen=maxLen||255;let len=Math.min(this.unPackInt8U(),maxLen);return this.unPackStringHelper(len)}static unPackLongString(maxLen){maxLen=maxLen||16383;let len=Math.min(this.unPackInt16U(),maxLen);return this.unPackStringHelper(len)}static unPackStringHelper(len){if(this.isMoreDataAvailable()<len*2)return"";let chars=[];for(let i=0;i<len;i++){let c=this.unPackInt16U();if(c>0)chars.push(String.fromCodePoint(c))}return chars.join("")}}var CommIn_default=CommIn;class CommOut{constructor(size=16384){this.idx=0,this.arrayBuffer=new ArrayBuffer(size),this.view=new DataView(this.arrayBuffer),this.buffer=new Uint8Array(this.arrayBuffer)}send(ws2){let b2=new Uint8Array(this.arrayBuffer,0,this.idx);ws2.send(b2)}packInt8(val){this.view.setInt8(this.idx,val),this.idx++}packInt16(val){this.view.setInt16(this.idx,val,!0),this.idx+=2}packInt24(val){this.view.setInt16(this.idx,val&65535,!0),this.view.setInt8(this.idx+2,val>>16&255),this.idx+=3}packInt32(val){this.view.setInt32(this.idx,val,!0),this.idx+=4}packRadU(val){this.packInt24(val*2097152)}packRad(val){this.packInt16((val+Math.PI)*8192)}packFloat(val){this.packInt16(val*256)}packDouble(val){this.packInt32(val*1048576)}packString(str){if(typeof str!=="string")str="";if(str.length>255)console.trace("truncated packString to fit int8 (shell protocol); this should not happen"),console.log("report this issue at https://yolkbot.xyz/community"),str=str.slice(0,255);this.packInt8(str.length);for(let i=0;i<str.length;i++)this.packInt16(str.charCodeAt(i))}packLongString(str){if(typeof str!=="string")str="";this.packInt16(str.length);for(let i=0;i<str.length;i++)this.packInt16(str.charCodeAt(i))}}var CommOut_default=CommOut;var CloseCode={gameNotFound:4000,gameFull:4001,badName:4002,mainMenu:4003,gameIdleExceeded:4004,corruptedLoginData0:4005,corruptedLoginData1:4006,corruptedLoginData2:4007,corruptedLoginData3:4008,corruptedLoginData4:4009,corruptedLoginData5:4010,gameMaxPlayersExceeded:4011,gameDestroyUser:4012,joinGameOutOfOrder:4013,gameShuttingDown:4014,readyBeforeReady:4015,booted:4016,gameErrorOnUserSocket:4017,uuidNotFound:4018,sessionNotFound:4019,clusterFullCpu:4020,clusterFullMem:4021,noClustersAvailable:4022,locked:4023},CloseCode_default=CloseCode;var CommCode={swapWeapon:0,joinGame:1,refreshGameState:2,spawnItem:3,observeGame:4,ping:5,bootPlayer:6,banPlayer:7,loginRequired:8,gameLocked:9,reportPlayer:10,switchTeam:13,changeCharacter:14,pause:15,gameOptions:16,gameAction:17,requestGameOptions:18,gameJoined:19,socketReady:20,addPlayer:21,removePlayer:22,fire:23,melee:24,throwGrenade:25,eventModifier:27,hitThem:28,hitMe:29,collectItem:30,challengeResetInGame:31,chat:34,syncThem:35,die:37,beginShellStreak:38,endShellStreak:39,updateBalance:42,reload:43,respawn:44,respawnDenied:45,clientReady:47,requestRespawn:48,switchTeamFail:51,expireUpgrade:52,metaGameState:53,syncMe:54,explode:55,keepAlive:56,musicInfo:57,hitMeHardBoiled:58,playerInfo:59,challengeCompleted:60},CommCode_default=CommCode;var RSocialMedia=Object.fromEntries(Object.entries(SocialMedia).map(([key,value])=>[value,key.toLowerCase()]));class GamePlayer{constructor(playerData,activeZone=null){if(this.id=playerData.id,this.uniqueId=playerData.uniqueId,this.name=playerData.name,this.safeName=playerData.safeName,this.team=playerData.team,this.playing=playerData.playing,this.socials=[],typeof playerData.social==="string"&&playerData.social.length)try{let parsed=JSON.parse(playerData.social);if(Array.isArray(parsed))this.socials=parsed}catch(e){console.error("error parsing socials:",e),console.error("report this issue at https://yolkbot.xyz/community")}if(this.socials.forEach((social)=>social.type=RSocialMedia[social.id]),this.isVip=playerData.upgradeProductId>0,this.showBadge=!playerData.hideBadge||!1,this.streak=playerData.score,this.streakRewards=Object.values(ShellStreak).filter((streak)=>playerData.activeShellStreaks&streak),this.scale=this.streakRewards.includes(ShellStreak.MiniEgg)?0.5:1,this.position={x:playerData.x,y:playerData.y,z:playerData.z},this.jumping=playerData.$controlKeys&Movement.Jump,this.scoping=playerData.$controlKeys&Movement.Scope,this.climbing=!1,this.view={yaw:playerData.yaw,pitch:playerData.pitch},this.updateKotcZone(activeZone),this.character={eggColor:playerData.shellColor,primaryGun:playerData.primaryWeaponItem,secondaryGun:playerData.secondaryWeaponItem,stamp:playerData.stampItem,hat:playerData.hatItem,grenade:playerData.grenadeItem,melee:playerData.meleeItem,stampPos:{x:playerData.stampPosX,y:playerData.stampPosY}},this.stats={totalKills:playerData.totalKills,totalDeaths:playerData.totalDeaths,bestStreak:playerData.bestStreak},this.activeGun=playerData.weaponIdx,this.selectedGun=playerData.charClass,this.weapons=[],this.character.primaryGun)this.weapons[0]=createGun(GunList[this.selectedGun]),this.weapons[1]=createGun(Cluck9mm);this.grenades=1,this.hp=playerData.hp,this.hpShield=0,this.spawnShield=playerData.shield,this.randomSeed=0}updateKotcZone(activeZone){if(!activeZone)return this.inKotcZone=!1;let fx=Math.floor(this.position.x),fy=Math.floor(this.position.y),fz=Math.floor(this.position.z);this.inKotcZone=activeZone.some((coordSets)=>coordSets.x===fx&&coordSets.y===fy&&coordSets.z===fz)&&this.playing}}var GamePlayer_default=GamePlayer;var mod=(n,m)=>(n%m+m)%m,PI2=Math.PI*2,setPrecision=(value)=>Math.round(value*8192)/8192,calculateYaw=(pos)=>setPrecision(mod(Math.atan2(-pos.x,-pos.z),PI2)),calculatePitch=(pos)=>setPrecision(Math.atan2(pos.y,Math.hypot(pos.x,pos.z)));class LookAtPosDispatch{constructor(pos){this.pos=pos}validate(){return this.pos&&Number.isFinite(this.pos.x)&&Number.isFinite(this.pos.y)&&Number.isFinite(this.pos.z)}check(bot){return bot.me.playing}execute(bot){let directionVector={x:this.pos.x-bot.me.position.x,y:this.pos.y-bot.me.position.y,z:this.pos.z-bot.me.position.z},yaw=calculateYaw(directionVector),pitch=calculatePitch(directionVector);bot.state.yaw=yaw,bot.state.pitch=pitch}}var LookAtPosDispatch_default=LookAtPosDispatch;class MovementDispatch{constructor(inputKeys){if(typeof inputKeys==="number")this.inputKeys=inputKeys;else if(Array.isArray(inputKeys))this.inputKeys=inputKeys.reduce((a,b)=>a|b,0)}validate(){if(typeof this.inputKeys!=="number")return!1;if(this.inputKeys&Movement.Forward&&this.inputKeys&Movement.Backward)return!1;if(this.inputKeys&Movement.Left&&this.inputKeys&Movement.Right)return!1;return!0}check(bot){return bot.me.playing}execute(bot){bot.state.controlKeys=this.inputKeys}}var MovementDispatch_default=MovementDispatch;class BanPlayerDispatch{constructor(uniqueId,duration,reason=""){this.uniqueId=uniqueId,this.duration=duration,this.reason=reason}validate(bot){if(typeof this.uniqueId!=="string"||typeof this.reason!=="string")return!1;if(typeof this.duration!=="number"||!Object.values(BanDuration).some((d)=>this.duration===d))return!1;if(!(bot.account.adminRoles&4))return!1;return!0}check(){return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.banPlayer),out.packString(this.uniqueId),out.packString(this.reason),out.packInt8(this.duration),out.send(bot.game.socket)}}var BanPlayerDispatch_default=BanPlayerDispatch;class BootPlayerDispatch{constructor(uniqueId){this.uniqueId=uniqueId}validate(bot){return typeof this.uniqueId==="string"&&bot.game.isGameOwner&&Object.values(bot.players).find((player)=>player.uniqueId===this.uniqueId)}check(){return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.bootPlayer),out.packString(this.uniqueId),out.send(bot.game.socket)}}var BootPlayerDispatch_default=BootPlayerDispatch;class ChatDispatch{constructor(msg){this.msg=msg}validate(bot){if(typeof this.msg!=="string")return!1;if(this.msg.length<1||this.msg.length>64)return!1;if(!bot.game.isPrivate&&!bot.account.emailVerified&&!bot.account.isAged&&!bot.account.isCG)return!1;return!0}check(bot){if(!bot.state?.inGame)return!1;if(!bot.game.isPrivate&&!bot.account.adminRoles&&bot.state.chatLines>=2)return!1;return!0}execute(bot){bot.state.chatLines++;let out=new CommOut_default;out.packInt8(CommCode_default.chat),out.packString(this.msg),out.send(bot.game.socket)}}var ChatDispatch_default=ChatDispatch;class FireDispatch{constructor(amount){this.amount=amount||1}validate(){return this.amount>=1}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee&&bot.me.weapons[bot.me.activeGun].ammo.rounds>=this.amount}execute(bot){bot.state.shotsFired+=this.amount||1}}var FireDispatch_default=FireDispatch;var gravityScale=Array.from({length:4},(_,i)=>(i+1)*0.25),damageScale=Array.from({length:9},(_,i)=>i*0.25),regenScale=Array.from({length:17},(_,i)=>i*0.25),whichever=(arg1,arg2)=>typeof arg1>"u"?arg2:arg1;class GameOptionsDispatch{constructor(changes){this.changes=changes}#constructFinalOutput(bot){let output={};if(output.gravity=whichever(this.changes.gravity,bot.game.options.gravity),output.damage=whichever(this.changes.damage,bot.game.options.damage),output.healthRegen=whichever(this.changes.healthRegen,bot.game.options.healthRegen),output.locked=whichever(this.changes.locked,bot.game.options.locked),output.noTeamChange=whichever(this.changes.noTeamChange,bot.game.options.noTeamChange),output.noTeamShuffle=whichever(this.changes.noTeamShuffle,bot.game.options.noTeamShuffle),output.weaponsDisabled=[whichever(this.changes.disableEggk,bot.game.options.weaponsDisabled[0]),whichever(this.changes.disableScrambler,bot.game.options.weaponsDisabled[1]),whichever(this.changes.disableFreeRanger,bot.game.options.weaponsDisabled[2]),whichever(this.changes.disableRPG,bot.game.options.weaponsDisabled[3]),whichever(this.changes.disableWhipper,bot.game.options.weaponsDisabled[4]),whichever(this.changes.disableCrackshot,bot.game.options.weaponsDisabled[5]),whichever(this.changes.disableTriHard,bot.game.options.weaponsDisabled[6])],this.changes.toDisable&&Array.isArray(this.changes.toDisable))this.changes.toDisable.forEach((idx)=>output.weaponsDisabled[idx]=!0);if(this.changes.toEnable&&Array.isArray(this.changes.toEnable))this.changes.toEnable.forEach((idx)=>output.weaponsDisabled[idx]=!1);if(this.changes.rawWeaponsDisabled&&Array.isArray(this.changes.rawWeaponsDisabled)&&this.changes.rawWeaponsDisabled.length===7)output.weaponsDisabled=this.changes.rawWeaponsDisabled.map((v)=>!!v);return output.mustUseSecondary=output.weaponsDisabled.every((v)=>v),output}validate(bot){let wouldBe=this.#constructFinalOutput(bot);if(!gravityScale.includes(wouldBe.gravity))return!1;if(!damageScale.includes(wouldBe.damage))return!1;if(!regenScale.includes(wouldBe.healthRegen))return!1;if(typeof wouldBe.locked!=="number"&&typeof wouldBe.locked!=="boolean")return!1;if(typeof wouldBe.noTeamChange!=="number"&&typeof wouldBe.noTeamChange!=="boolean")return!1;if(typeof wouldBe.noTeamShuffle!=="number"&&typeof wouldBe.noTeamShuffle!=="boolean")return!1;if(!Array.isArray(wouldBe.weaponsDisabled))return!1;if(wouldBe.weaponsDisabled.length!==7)return!1;if(wouldBe.weaponsDisabled.some((weapon)=>typeof weapon!=="number"&&typeof weapon!=="boolean"))return!1;return!0}check(bot){return bot.game.isGameOwner}execute(bot){bot.game.options=this.#constructFinalOutput(bot),bot.updateGameOptions()}}var GameOptionsDispatch_default=GameOptionsDispatch;class GoToAmmoDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.collectibles[0].length}execute(bot){let minDistance=2000,closestAmmo=null;for(let ammo of bot.game.collectibles[0]){let dx=ammo.x-bot.me.position.x,dy=ammo.y-bot.me.position.y,dz=ammo.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestAmmo=ammo}if(!closestAmmo)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestAmmo),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToAmmoDispatch_default=GoToAmmoDispatch;class GoToCoopDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.kotc.zoneIdx&&bot.game.kotc.activeZone}execute(bot){let minDistance=20000,closestZone=null;for(let zoneCoords of bot.game.kotc.activeZone){let dx=zoneCoords.x-bot.me.position.x,dy=zoneCoords.y-bot.me.position.y,dz=zoneCoords.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestZone=zoneCoords}if(!closestZone)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestZone),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToCoopDispatch_default=GoToCoopDispatch;class GoToGrenadeDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.collectibles[1].length}execute(bot){let minDistance=2000,closestGrenade=null;for(let grenade of bot.game.collectibles[1]){let dx=grenade.x-bot.me.position.x,dy=grenade.y-bot.me.position.y,dz=grenade.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestGrenade=grenade}if(!closestGrenade)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestGrenade),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToGrenadeDispatch_default=GoToGrenadeDispatch;class GoToPlayerDispatch{idOrName;constructor(idOrName){this.idOrName=idOrName}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(bot){return bot.intents.includes(Intents.PATHFINDING)&&(typeof this.idOrName==="string"||typeof this.idOrName==="number")}check(bot){if(!bot.me.playing)return!1;let target=this.$grabPlayer(bot);return target&&target.playing&&target.position&&Number.isFinite(target.position.x)}execute(bot){let target=this.$grabPlayer(bot),myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(target.position),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToPlayerDispatch_default=GoToPlayerDispatch;class GoToSpatulaDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.spatula&&bot.game.spatula.coords&&Number.isFinite(bot.game.spatula.coords.x)}execute(bot){let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(bot.game.spatula.coords),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToSpatulaDispatch_default=GoToSpatulaDispatch;var mod2=(n,m)=>(n%m+m)%m,PI22=Math.PI*2,setPrecision2=(value)=>Math.round(value*8192)/8192,calculateYaw2=(pos)=>setPrecision2(mod2(Math.atan2(-pos.x,-pos.z),PI22)),calculatePitch2=(pos)=>setPrecision2(Math.atan2(pos.y,Math.hypot(pos.x,pos.z)));class LookAtDispatch{idOrName;constructor(idOrName){this.idOrName=idOrName}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(){return typeof this.idOrName==="string"||typeof this.idOrName==="number"}check(bot){if(!bot.me.playing)return!1;let target=this.$grabPlayer(bot);return target&&target.playing&&target.position&&Number.isFinite(target.position.x)}execute(bot){let target=this.$grabPlayer(bot),directionVector={x:target.position.x-bot.me.position.x,y:target.position.y-bot.me.position.y-0.05,z:target.position.z-bot.me.position.z},yaw=calculateYaw2(directionVector),pitch=calculatePitch2(directionVector);bot.state.yaw=yaw,bot.state.pitch=pitch}}var LookAtDispatch_default=LookAtDispatch;class MeleeDispatch{validate(){return!0}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.melee),out.send(bot.game.socket),bot.state.usingMelee=!0,setTimeout(()=>{bot.state.usingMelee=!1,bot.state.swappingGun=!0,setTimeout(()=>{bot.state.swappingGun=!1},0.5*GunEquipTime)},566.6666666666667)}}var MeleeDispatch_default=MeleeDispatch;class PauseDispatch{validate(){return!0}check(bot){return bot.me.playing}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.pause),out.send(bot.game.socket),setTimeout(()=>bot.me.playing=!1,3000)}}var PauseDispatch_default=PauseDispatch;class ReloadDispatch{validate(){return!0}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee&&bot.me.weapons[bot.me.activeGun].ammo?.rounds<bot.me.weapons[bot.me.activeGun].ammo?.capacity&&bot.me.weapons[bot.me.activeGun].ammo?.store>0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.reload),out.send(bot.game.socket);let playerActiveWeapon=bot.me.weapons[bot.me.activeGun],isEmpty=playerActiveWeapon.ammo.rounds<1;bot.$emit("playerStartReload",bot.me,playerActiveWeapon),bot.state.reloading=!0,setTimeout(()=>{if(!bot.me||bot.hasQuit)return;bot.state.reloading=!1;let latestWeapon=bot.me.weapons[bot.me.activeGun];if(latestWeapon.ammo){let maxLoad=Math.min(latestWeapon.ammo.capacity,latestWeapon.ammo.reload),needed=Math.max(0,maxLoad-latestWeapon.ammo.rounds),newRounds=Math.min(needed,latestWeapon.ammo.store);latestWeapon.ammo.rounds+=newRounds,latestWeapon.ammo.store-=newRounds}bot.$emit("playerEndReload",bot.me,latestWeapon)},isEmpty?playerActiveWeapon.longReloadTime:playerActiveWeapon.shortReloadTime)}}var ReloadDispatch_default=ReloadDispatch;class ReportPlayerDispatch{constructor(idOrName,reasons={}){if(this.idOrName=idOrName,this.reasons=[!!reasons.cheating,!!reasons.harassment,!!reasons.offensive,!!reasons.other],!this.reasons.includes(!0))this.reasons[3]=!0;for(let i=0;i<this.reasons.length;i++)if(this.reasons[i]===!0)this.reasonInt|=1<<i}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(){if(typeof this.idOrName!=="string"&&typeof this.idOrName!=="number")return!1;if(this.reasons.every((reason)=>reason===!1))return!1;return!0}check(bot){if(!bot.state.inGame)return!1;return!!this.$grabPlayer(bot)}execute(bot){let target=this.$grabPlayer(bot),out=new CommOut_default;out.packInt8(CommCode_default.reportPlayer),out.packString(target.uniqueId),out.packInt8(this.reasonInt),out.send(bot.game.socket)}}var ReportPlayerDispatch_default=ReportPlayerDispatch;class ResetGameDispatch{validate(){return!0}check(bot){return bot.game.isGameOwner}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.gameAction),out.packInt8(GameAction.Reset),out.send(bot.game.socket)}}var ResetGameDispatch_default=ResetGameDispatch;var isDefault=(itemId)=>findItemById(itemId)&&findItemById(itemId).unlock==="default",isType=(itemId,type)=>findItemById(itemId)&&findItemById(itemId).item_type_id===type;class SaveLoadoutDispatch{constructor(opts){this.changes={classIdx:opts.gunId,hatId:opts.hatId,stampId:opts.stampId,grenadeId:opts.grenadeId,meleeId:opts.meleeId,colorIdx:opts.eggColor,primaryId:opts.primaryIds,secondaryId:opts.secondaryIds},this.changes=Object.fromEntries(Object.entries(this.changes).filter(([,v])=>typeof v<"u"))}validate(bot){let load=this.changes;if(load.colorIdx&&load.colorIdx>=7&&!bot.account.vip)return!1;if(load.colorIdx&&load.colorIdx>=14)return!1;if(isType(load.hatId,ItemType.Hat)&&!isDefault(load.hatId)&&!bot.account.ownedItemIds.includes(load.hatId))return!1;if(isType(load.stampId,ItemType.Stamp)&&!isDefault(load.stampId)&&!bot.account.ownedItemIds.includes(load.stampId))return!1;if(isType(load.grenadeId,ItemType.Grenade)&&!isDefault(load.grenadeId)&&!bot.account.ownedItemIds.includes(load.grenadeId))return!1;if(isType(load.meleeId,ItemType.Melee)&&!isDefault(load.meleeId)&&!bot.account.ownedItemIds.includes(load.meleeId))return!1;if(typeof load.classIdx==="number"&&(load.classIdx>6||load.classIdx<0))return!1;if(this.changes.primaryId)for(let i=0;i<7;i++){let testingId=this.changes.primaryId[i];if(!isType(testingId,ItemType.Primary)||!isDefault(testingId)&&!bot.account.ownedItemIds.includes(testingId))return!1}if(this.changes.secondaryId)for(let i=0;i<7;i++){let testingId=this.changes.secondaryId[i];if(!isType(testingId,ItemType.Secondary)||!isDefault(testingId)&&!bot.account.ownedItemIds.includes(testingId))return!1}return!0}check(bot){return!bot.me.playing}execute(bot){if(bot.me&&typeof this.changes.classIdx<"u"&&this.changes.classIdx!==bot.me.selectedGun)bot.me.weapons[0]=createGun(GunList[this.changes.classIdx]);bot.state.weaponIdx=this.changes.classIdx??bot.state.weaponIdx;let loadout={...bot.account.loadout,...this.changes},saveLoadout=bot.api.queryServices({cmd:"saveLoadout",save:!0,firebaseId:bot.account.firebaseId,sessionId:bot.account.sessionId,loadout});if(bot.account.loadout=loadout,bot.me)saveLoadout.then(()=>{if(bot.state.inGame){let out=new CommOut_default;out.packInt8(CommCode_default.changeCharacter),out.packInt8(this.changes?.classIdx??bot.me.selectedGun),out.send(bot.game.socket)}let findCosmetics=bot.intents.includes(Intents.COSMETIC_DATA);Object.entries(this.changes).forEach(([changeKey,changeValue])=>{if(changeKey==="classIdx")bot.me.selectedGun=changeValue;else if(changeKey==="hatId")bot.me.character.hat=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="stampId")bot.me.character.stamp=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="grenadeId")bot.me.character.grenade=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="meleeId")bot.me.character.melee=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="colorIdx")bot.me.character.eggColor=changeValue;else if(changeKey==="primaryId")bot.me.character.primaryGun=findCosmetics?findItemById(changeValue[bot.me.selectedGun]):changeValue;else if(changeKey==="secondaryId")bot.me.character.secondaryGun=findCosmetics?findItemById(changeValue[bot.me.selectedGun]):changeValue})})}}var SaveLoadoutDispatch_default=SaveLoadoutDispatch;class SpawnDispatch{validate(){return!0}check(bot){let respawnTime=bot.intents.includes(Intents.FASTER_RESPAWN)?5000:6000;if(bot.me.playing)return!1;if(bot.intents.includes(Intents.OBSERVE_GAME))return!1;if(bot.lastDeathTime>0&&bot.lastDeathTime+respawnTime>Date.now())return!1;return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.requestRespawn),out.send(bot.game.socket),bot.state.buffer=[]}}var SpawnDispatch_default=SpawnDispatch;class SwapWeaponDispatch{constructor(manualWeapon){this.manualWeapon=manualWeapon}validate(){return[0,1].includes(this.manualWeapon)||typeof this.manualWeapon>"u"}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let chosenWeapon=+!bot.me.activeGun;if(typeof this.manualWeapon==="number")chosenWeapon=this.manualWeapon;bot.me.activeGun=chosenWeapon;let out=new CommOut_default;out.packInt8(CommCode_default.swapWeapon),out.packInt8(bot.me.activeGun),out.send(bot.game.socket)}}var SwapWeaponDispatch_default=SwapWeaponDispatch;class SwitchTeamDispatch{validate(){return!0}check(bot){if(!bot.state.inGame||bot.me.playing)return!1;if(bot.game.gameModeId===0)return!1;if(bot.intents.includes(Intents.OBSERVE_GAME))return!1;if(bot.game.isPrivate)return!bot.game.options.noTeamChange;let players=bot.players,myTeam=bot.me.team,playersWithMyTeam=Object.values(players).filter((player)=>player.team===myTeam).length,playersWithOtherTeam=Object.values(players).filter((player)=>player.team!==myTeam).length;if(playersWithOtherTeam>playersWithMyTeam)return!1;if(playersWithMyTeam===playersWithOtherTeam)return!1;return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.switchTeam),out.send(bot.game.socket)}}var SwitchTeamDispatch_default=SwitchTeamDispatch;class ThrowGrenadeDispatch{constructor(power=1){this.power=power}validate(){return typeof this.power==="number"&&this.power>=0&&this.power<=1}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.throwGrenade),out.packFloat(this.power),out.send(bot.game.socket)}}var ThrowGrenadeDispatch_default=ThrowGrenadeDispatch;var DispatchIndex={banPlayer:BanPlayerDispatch_default,bootPlayer:BootPlayerDispatch_default,chat:ChatDispatch_default,fire:FireDispatch_default,gameOptions:GameOptionsDispatch_default,goToAmmo:GoToAmmoDispatch_default,goToCoop:GoToCoopDispatch_default,goToGrenade:GoToGrenadeDispatch_default,goToPlayer:GoToPlayerDispatch_default,goToSpatula:GoToSpatulaDispatch_default,lookAt:LookAtDispatch_default,lookAtPos:LookAtPosDispatch_default,melee:MeleeDispatch_default,move:MovementDispatch_default,pause:PauseDispatch_default,reload:ReloadDispatch_default,reportPlayer:ReportPlayerDispatch_default,resetGame:ResetGameDispatch_default,saveLoadout:SaveLoadoutDispatch_default,spawn:SpawnDispatch_default,swapWeapon:SwapWeaponDispatch_default,switchTeam:SwitchTeamDispatch_default,throwGrenade:ThrowGrenadeDispatch_default},dispatches_default={BanPlayerDispatch:BanPlayerDispatch_default,BootPlayerDispatch:BootPlayerDispatch_default,ChatDispatch:ChatDispatch_default,FireDispatch:FireDispatch_default,GameOptionsDispatch:GameOptionsDispatch_default,GoToAmmoDispatch:GoToAmmoDispatch_default,GoToCoopDispatch:GoToCoopDispatch_default,GoToGrenadeDispatch:GoToGrenadeDispatch_default,GoToPlayerDispatch:GoToPlayerDispatch_default,GoToSpatulaDispatch:GoToSpatulaDispatch_default,LookAtDispatch:LookAtDispatch_default,LookAtPosDispatch:LookAtPosDispatch_default,MeleeDispatch:MeleeDispatch_default,MovementDispatch:MovementDispatch_default,PauseDispatch:PauseDispatch_default,ReloadDispatch:ReloadDispatch_default,ReportPlayerDispatch:ReportPlayerDispatch_default,ResetGameDispatch:ResetGameDispatch_default,SaveLoadoutDispatch:SaveLoadoutDispatch_default,SpawnDispatch:SpawnDispatch_default,SwapWeaponDispatch:SwapWeaponDispatch_default,SwitchTeamDispatch:SwitchTeamDispatch_default,ThrowGrenadeDispatch:ThrowGrenadeDispatch_default};var exports_direct={};__export(exports_direct,{validate:()=>validate,processJS:()=>processJS,coords:()=>coords});var hexToUint8Array=(hex)=>new Uint8Array(hex.match(/.{2}/g).map((b)=>parseInt(b,16))),encoder=new TextEncoder,validate=async(input)=>{if(typeof process<"u"&&typeof process.getBuiltinModule==="function"){let crypto2=process.getBuiltinModule("node:crypto"),salt2=Buffer.from("3496afa51f2a553ea1fc5211400c000b","hex");return crypto2.createHmac("sha256",salt2).update(input).digest("hex")}let salt=hexToUint8Array("3496afa51f2a553ea1fc5211400c000b"),key=await crypto.subtle.importKey("raw",salt,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),signature=await crypto.subtle.sign("HMAC",key,encoder.encode(input));return Array.from(new Uint8Array(signature)).map((b)=>b.toString(16).padStart(2,"0")).join("")},tableAt=(addr)=>{return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(addr)},coords=(yaw11,pitch10)=>{let local_9=Math.round(yaw11/(Math.PI*2)*65535),local_4=0,local_12=Math.round((pitch10+1.5)/3*32767),temp_yaw=local_9<0?0:local_9;local_9=temp_yaw>65535?65535:temp_yaw;let yaw_i32=Math.trunc(local_9);if(yaw_i32<0)yaw_i32=0;if(yaw_i32>4294967295)yaw_i32=4294967295;yaw_i32=local_9>=0?yaw_i32:0,yaw_i32=local_9>65535?0:yaw_i32;let local_5=yaw_i32;local_4^=local_5;let temp_pitch=local_12<0?0:local_12;local_9=temp_pitch,temp_pitch=local_9>32767?32767:local_9,local_9=temp_pitch;let pitch_i32=Math.trunc(local_9);if(pitch_i32<0)pitch_i32=0;if(pitch_i32>4294967295)pitch_i32=4294967295;pitch_i32=local_9>=0?pitch_i32:0,pitch_i32=local_9>65535?0:pitch_i32;let local_3=pitch_i32,local_6=(local_3^4294934528)&65535,local_01=local_4^local_6,pitch_low_byte=local_01&255,yaw_shifted=local_4<<8,yaw_byte_high=(local_4&65280)>>>8;local_3=(yaw_shifted|yaw_byte_high)>>>0;let local_7=pitch_low_byte^local_3;local_01=local_01<<8|(local_01&65280)>>>8,local_5^=local_6,local_6=local_01^local_5&255,local_5=local_5<<8|(local_5&65280)>>8,local_4=local_5^local_4&255;let letters=[];return letters[3]=tableAt(local_6&63),letters[7]=tableAt(local_3>>>8&63),letters[4]=tableAt(local_01>>>10&63),letters[0]=tableAt((local_4&252)>>>2),letters[5]=tableAt(local_01>>>4&48|local_7>>>4&15),letters[2]=tableAt(local_5>>>6&60|local_6>>>6&3),letters[6]=tableAt((local_3>>>14&3|local_7<<2)&63),letters[1]=tableAt((local_5>>>12&15|local_4<<4)&63),String.fromCharCode(...letters)};var processJS=(input)=>{let inputArray=new Uint8Array([...input].map((c)=>c.charCodeAt(0))),xorKeyStart=88,decoded=new Uint8Array(inputArray.length);for(let i=0;i<inputArray.length;i++)decoded[i]=inputArray[i]^88+i&127;let result="";for(let i=0;i<decoded.length;i+=65536){let chunk=decoded.subarray(i,Math.min(i+65536,decoded.length));result+=String.fromCharCode(...chunk)}return result};var Challenges=[{id:1,loc_ref:"chlg_kill_streak_five",type:0,subType:0,period:0,goal:1,reward:100,conditional:0,value:"5",valueTwo:null,tier:2,loc:{title:"Master Chef",desc:"Get a 5 killstreak"}},{id:2,loc_ref:"chlg_kill_streak_ten",type:0,subType:0,period:0,goal:1,reward:200,conditional:0,value:"10",valueTwo:null,tier:2,loc:{title:"Butcher",desc:"Get a 10 killstreak"}},{id:3,loc_ref:"chlg_kill_streak_fifteen",type:0,subType:0,period:0,goal:1,reward:500,conditional:0,value:"15",valueTwo:null,tier:3,loc:{title:"Eggsassin",desc:"Get a 15 killstreak"}},{id:4,loc_ref:"chlg_kill_streak_twenty",type:0,subType:0,period:0,goal:1,reward:1000,conditional:0,value:"20",valueTwo:null,tier:3,loc:{title:"Eggsecutioner",desc:"Get a 20 killstreak"}},{id:5,loc_ref:"chlg_kill_streak_fifty",type:0,subType:0,period:0,goal:1,reward:5000,conditional:0,value:"50",valueTwo:null,tier:3,loc:{title:"Shell Smasher",desc:"Get a 50 killstreak"}},{id:6,loc_ref:"chlg_kill_kills_ten",type:0,subType:10,period:0,goal:10,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Shell Shocker",desc:"Get 10 total kills"}},{id:7,loc_ref:"chlg_kill_kills_twenty",type:0,subType:10,period:0,goal:20,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Yolk Drinker",desc:"Get 20 total kills"}},{id:8,loc_ref:"chlg_kill_kills_fifty",type:0,subType:10,period:0,goal:50,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Clutch Master",desc:"Get 50 total kills"}},{id:9,loc_ref:"chlg_kill_kills_hundred",type:0,subType:10,period:0,goal:100,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Eggsterminator",desc:"Get 100 total kills"}},{id:10,loc_ref:"chlg_kill_kills_two_fifty",type:0,subType:10,period:0,goal:250,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Ovum Overlord",desc:"Get 250 total kills"}},{id:11,loc_ref:"chlg_kill_timePlayed_two",type:0,subType:6,period:0,goal:1,reward:100,conditional:null,value:"2",valueTwo:"60",tier:0,loc:{title:"Back to Back",desc:"Spawn and get 2 kills in 1 min"}},{id:12,loc_ref:"chlg_kill_timePlayed_four",type:0,subType:6,period:0,goal:1,reward:500,conditional:null,value:"4",valueTwo:"60",tier:2,loc:{title:"C-C-C-COMBO",desc:"Spawn and get 4 kills in 1 min"}},{id:13,loc_ref:"chlg_kill_timePlayed_seven",type:0,subType:6,period:0,goal:1,reward:1000,conditional:null,value:"7",valueTwo:"60",tier:3,loc:{title:"Eggcellerator",desc:"Spawn and get 7 kills in 1 min"}},{id:14,loc_ref:"chlg_kill_timePlayed_ten",type:0,subType:6,period:0,goal:1,reward:2500,conditional:null,value:"10",valueTwo:"60",tier:3,loc:{title:"Need for Speed",desc:"Spawn and get 10 kills in 1 min"}},{id:15,loc_ref:"chlg_kill_con_kill_one_shot",type:0,subType:8,period:0,goal:1,reward:100,conditional:11,value:"1",valueTwo:"1",tier:1,loc:{title:"Bullseye",desc:"Kill an egg with 1 shot"}},{id:16,loc_ref:"chlg_kill_con_kill_hp_ten",type:0,subType:8,period:0,goal:1,reward:500,conditional:12,value:"1",valueTwo:"10",tier:1,loc:{title:"Cutting it Close",desc:"Get a kill with less than 10 HP"}},{id:17,loc_ref:"chlg_kill_con_kill_five_streak",type:0,subType:8,period:0,goal:1,reward:1000,conditional:0,value:"0",valueTwo:"5",tier:2,loc:{title:"Soft Boiled",desc:"Kill an egg on a 5+ streak"}},{id:18,loc_ref:"chlg_kill_con_kill_ten_streak",type:0,subType:8,period:0,goal:1,reward:2500,conditional:0,value:"0",valueTwo:"10",tier:3,loc:{title:"Breaker-breaker",desc:"Kill an egg on a 10+ streak"}},{id:19,loc_ref:"chlg_kill_con_kill_scoped",type:0,subType:8,period:0,goal:1,reward:200,conditional:13,value:null,valueTwo:null,tier:2,loc:{title:"Eye 2 Eye",desc:"Snipe a zoomed-in sniper"}},{id:20,loc_ref:"chlg_kill_con_two_kills_one_shot",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:null,tier:2,loc:{title:"Collateral Damage",desc:"Kill two eggs at once"}},{id:21,loc_ref:"chlg_kill_con_reloading",type:0,subType:8,period:0,goal:1,reward:100,conditional:17,value:null,valueTwo:null,tier:1,loc:{title:"Owned",desc:"Kill an egg while they reload"}},{id:22,loc_ref:"chlg_kill_con_kill_scoped_melee",type:0,subType:8,period:0,goal:1,reward:200,conditional:13,value:null,valueTwo:"9",tier:2,loc:{title:"Behind You!",desc:"Melee kill a zoomed-in egg"}},{id:23,loc_ref:"chlg_kill_con_kill_two_grenade",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:"8",tier:2,loc:{title:"2 Birds 1 Stone",desc:"Kill 2 eggs with 1 Grenade"}},{id:24,loc_ref:"chlg_kill_con_kill_three_grenade",type:0,subType:8,period:0,goal:1,reward:1000,conditional:16,value:"3",valueTwo:"8",tier:3,loc:{title:"M-M-M-Multikill",desc:"Kill 3 eggs with 1 Grenade"}},{id:25,loc_ref:"chlg_kill_con_kill_two_rpegg",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:"4",tier:2,loc:{title:"Splash Damage",desc:"Kill 2 eggs with 1 RPEGG shot"}},{id:26,loc_ref:"chlg_kill_con_kill_three_rpegg",type:0,subType:8,period:0,goal:1,reward:1000,conditional:16,value:"3",valueTwo:"4",tier:3,loc:{title:"Big Boomer",desc:"Kill 3 eggs with 1 RPEGG shot"}},{id:27,loc_ref:"chlg_kill_weaponType_Cluck9mm_five",type:0,subType:1,period:0,goal:5,reward:200,conditional:null,value:null,valueTwo:"3",tier:1,loc:{title:"Pew Pew",desc:"Get 5 Cluck 9mm kills"}},{id:28,loc_ref:"chlg_kill_weaponType_Cluck9mm_ten",type:0,subType:1,period:0,goal:10,reward:500,conditional:null,value:null,valueTwo:"3",tier:1,loc:{title:"Trigger Happy",desc:"Get 10 Cluck 9mm kills"}},{id:29,loc_ref:"chlg_kill_weaponType_Cluck9mm_twenty",type:0,subType:1,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:"3",tier:2,loc:{title:"Sidearm Specialist",desc:"Get 20 Cluck 9mm kills"}},{id:30,loc_ref:"chlg_kill_weaponType_Cluck9mm_fifty",type:0,subType:1,period:0,goal:50,reward:2500,conditional:null,value:null,valueTwo:"3",tier:3,loc:{title:"9mm Master",desc:"Get 50 Cluck 9mm kills"}},{id:31,loc_ref:"chlg_kill_weaponType_Scrambler_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"1",tier:1,loc:{title:"Scrambled Eggs",desc:"Get 5 Scrambler kills"}},{id:32,loc_ref:"chlg_kill_weaponType_Scrambler_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"1",tier:1,loc:{title:"Hunting Wabbits",desc:"Get 10 Scrambler kills"}},{id:33,loc_ref:"chlg_kill_weaponType_Scrambler_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"1",tier:2,loc:{title:"Boomstick",desc:"Get 20 Scrambler kills"}},{id:34,loc_ref:"chlg_kill_weaponType_Scrambler_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"1",tier:3,loc:{title:"Splat-o-matic",desc:"Get 50 Scrambler kills"}},{id:35,loc_ref:"chlg_kill_weaponType_Rpegg_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Eggsploder",desc:"Get 5 RPEGG kills"}},{id:36,loc_ref:"chlg_kill_weaponType_Rpegg_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Arm Cannons",desc:"Get 10 RPEGG kills"}},{id:37,loc_ref:"chlg_kill_weaponType_Rpegg_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Bazooka Joe",desc:"Get 20 RPEGG kills"}},{id:38,loc_ref:"chlg_kill_weaponType_Rpegg_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"4",tier:3,loc:{title:"Master Eggsploder",desc:"Get 50 RPEGG kills"}},{id:39,loc_ref:"chlg_kill_weaponType_Whipper_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"5",tier:1,loc:{title:"Whip it Good",desc:"Get 5 Whipper kills"}},{id:40,loc_ref:"chlg_kill_weaponType_Whipper_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"5",tier:1,loc:{title:"Cool Whip",desc:"Get 10 Whipper kills"}},{id:41,loc_ref:"chlg_kill_weaponType_Whipper_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"5",tier:2,loc:{title:"Whip it REAL Good",desc:"Get 20 Whipper kills"}},{id:42,loc_ref:"chlg_kill_weaponType_Whipper_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"5",tier:3,loc:{title:"Whip up a Storm",desc:"Get 50 Whipper kills"}},{id:43,loc_ref:"chlg_kill_weaponType_Eggk47_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"0",tier:0,loc:{title:"Lock & Load",desc:"Get 5 EggK-47 kills"}},{id:44,loc_ref:"chlg_kill_weaponType_Eggk47_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"0",tier:1,loc:{title:"Almost a Dozen",desc:"Get 10 EggK-47 kills"}},{id:45,loc_ref:"chlg_kill_weaponType_Eggk47_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"0",tier:2,loc:{title:"Spray Down",desc:"Get 20 EggK-47 kills"}},{id:46,loc_ref:"chlg_kill_weaponType_Eggk47_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"0",tier:3,loc:{title:"Eggk-47 Eggspert",desc:"Get 50 EggK-47 kills"}},{id:47,loc_ref:"chlg_kill_weaponType_FreeRanger_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"2",tier:1,loc:{title:"Poacher",desc:"Get 5 Free Ranger kills"}},{id:48,loc_ref:"chlg_kill_weaponType_FreeRanger_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"2",tier:1,loc:{title:"Bounty Hunter",desc:"Get 10 Free Ranger kills"}},{id:49,loc_ref:"chlg_kill_weaponType_FreeRanger_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"2",tier:2,loc:{title:"Hired Gun",desc:"Get 20 Free Ranger kills"}},{id:50,loc_ref:"chlg_kill_weaponType_FreeRanger_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"2",tier:3,loc:{title:"Big-Game Hunter",desc:"Get 50 Free Ranger kills"}},{id:51,loc_ref:"chlg_kill_weaponType_Crackshot_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"6",tier:1,loc:{title:"Sniper",desc:"Get 5 Crackshot kills"}},{id:52,loc_ref:"chlg_kill_weaponType_Crackshot_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"6",tier:1,loc:{title:"Sharpshooter",desc:"Get 10 Crackshot kills"}},{id:53,loc_ref:"chlg_kill_weaponType_Crackshot_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"6",tier:2,loc:{title:"Marksman",desc:"Get 20 Crackshot kills"}},{id:54,loc_ref:"chlg_kill_weaponType_Crackshot_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"6",tier:3,loc:{title:"Cracked",desc:"Get 50 Crackshot kills"}},{id:55,loc_ref:"chlg_kill_weaponType_TriHard_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"7",tier:1,loc:{title:"Tri-Hard",desc:"Get 5 Tri-Hard kills"}},{id:56,loc_ref:"chlg_kill_weaponType_TriHard_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"7",tier:1,loc:{title:"Tri-Harder",desc:"Get 10 Tri-Hard kills"}},{id:57,loc_ref:"chlg_kill_weaponType_TriHard_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"7",tier:2,loc:{title:"Tri-Even-Harder",desc:"Get 20 Tri-Hard kills"}},{id:58,loc_ref:"chlg_kill_weaponType_TriHard_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"7",tier:3,loc:{title:"Tri-Hardest",desc:"Get 50 Tri-Hard kills"}},{id:59,loc_ref:"chlg_kill_weaponType_Melee_five",type:0,subType:1,period:0,goal:5,reward:200,conditional:null,value:null,valueTwo:"9",tier:2,loc:{title:"Whisky Business",desc:"Get 5 Melee kills"}},{id:60,loc_ref:"chlg_kill_weaponType_Melee_ten",type:0,subType:1,period:0,goal:10,reward:500,conditional:null,value:null,valueTwo:"9",tier:2,loc:{title:"Slap the Bass",desc:"Get 10 Melee kills"}},{id:61,loc_ref:"chlg_kill_weaponType_Melee_twenty",type:0,subType:1,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:"9",tier:3,loc:{title:"Whack & Slash",desc:"Get 20 Melee kills"}},{id:62,loc_ref:"chlg_kill_weaponType_Melee_fifty",type:0,subType:1,period:0,goal:50,reward:2500,conditional:null,value:null,valueTwo:"9",tier:3,loc:{title:"Melee Master",desc:"Get 50 Melee kills"}},{id:63,loc_ref:"chlg_damage_five_hundred",type:1,subType:null,period:0,goal:500,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Shattered Shells",desc:"Deal 500 damage"}},{id:64,loc_ref:"chlg_damage_one_thousand",type:1,subType:null,period:0,goal:1000,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Decimator",desc:"Deal 1000 damage"}},{id:65,loc_ref:"chlg_damage_twenty_five_hundred",type:1,subType:null,period:0,goal:2500,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Tormentor",desc:"Deal 2500 damage"}},{id:66,loc_ref:"chlg_damage_five_thousand",type:1,subType:null,period:0,goal:5000,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Devastator",desc:"Deal 5000 damage"}},{id:67,loc_ref:"chlg_damage_ten_thousand",type:1,subType:null,period:0,goal:1e4,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Boomsauce",desc:"Deal 10000 damage"}},{id:68,loc_ref:"chlg_damage_twenty_five_thousand",type:1,subType:null,period:0,goal:25000,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Maximum Damage",desc:"Deal 25000 damage"}},{id:69,loc_ref:"chlg_deaths_ten",type:2,subType:null,period:0,goal:10,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Cracked",desc:"Die 10 times"}},{id:70,loc_ref:"chlg_deaths_twenty",type:2,subType:null,period:0,goal:20,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Fried",desc:"Die 20 times"}},{id:71,loc_ref:"chlg_deaths_fifty",type:2,subType:null,period:0,goal:50,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Death Wish",desc:"Die 50 times"}},{id:72,loc_ref:"chlg_movement_distance_five_hunderd",type:3,subType:3,period:0,goal:500,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Runny Egg",desc:"Travel 500m"}},{id:73,loc_ref:"chlg_movement_distance_one_thousand",type:3,subType:3,period:0,goal:1000,reward:500,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Poultry in Motion",desc:"Travel 1000m"}},{id:74,loc_ref:"chlg_movement_distance_five_thousand",type:3,subType:3,period:0,goal:5000,reward:2500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Gaming Marathon",desc:"Travel 5000m"}},{id:75,loc_ref:"chlg_movement_jump_one_hundred",type:3,subType:4,period:0,goal:100,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Jumpman",desc:"Jump 100 times"}},{id:76,loc_ref:"chlg_movement_jump_five_hundred",type:3,subType:4,period:0,goal:500,reward:500,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Bouncing Bomb",desc:"Jump 500 times"}},{id:77,loc_ref:"chlg_kill_jump_one",type:0,subType:4,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Aerial Assault",desc:"Get a kill while jumping"}},{id:78,loc_ref:"chlg_kill_jump_five",type:0,subType:4,period:0,goal:5,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Do a Barrel Roll",desc:"Get 5 kills while airborne"}},{id:79,loc_ref:"chlg_kill_jump_victim_jump",type:0,subType:4,period:0,goal:1,reward:2500,conditional:4,value:null,valueTwo:null,tier:3,loc:{title:"Aerial Acrobatics",desc:"Kill an egg while both airborne"}},{id:80,loc_ref:"chlg_movement_collect_ammo_ten",type:4,subType:18,period:0,goal:10,reward:100,conditional:16,value:"0",valueTwo:null,tier:1,loc:{title:"We Need Supplies!",desc:"Collect 10 ammo boxes"}},{id:81,loc_ref:"chlg_movement_collect_ammo_twenty_five",type:4,subType:18,period:0,goal:25,reward:500,conditional:16,value:"0",valueTwo:null,tier:2,loc:{title:"Quartermaster",desc:"Collect 25 ammo boxes"}},{id:82,loc_ref:"chlg_movement_collect_ammo_fifty",type:4,subType:18,period:0,goal:50,reward:1000,conditional:16,value:"0",valueTwo:null,tier:3,loc:{title:"Locked & Loaded",desc:"Collect 50 ammo boxes"}},{id:83,loc_ref:"chlg_movement_collect_grenade_ten",type:4,subType:18,period:0,goal:10,reward:100,conditional:17,value:"1",valueTwo:null,tier:1,loc:{title:"Explosives expert",desc:"Collect 10 grenades"}},{id:84,loc_ref:"chlg_movement_collect_grenade_twenty_five",type:4,subType:18,period:0,goal:25,reward:500,conditional:17,value:"1",valueTwo:null,tier:2,loc:{title:"Bombardier",desc:"Collect 25 grenades"}},{id:85,loc_ref:"chlg_movement_collect_grenade_fifty",type:4,subType:18,period:0,goal:50,reward:1000,conditional:17,value:"1",valueTwo:null,tier:3,loc:{title:"Explosive Temper",desc:"Collect 50 grenades"}},{id:86,loc_ref:"chlg_timed_timeAlive_thirty",type:5,subType:7,period:0,goal:1,reward:100,conditional:7,value:"30",valueTwo:null,tier:1,loc:{title:"Running Scared",desc:"Stay alive for 30 sec"}},{id:87,loc_ref:"chlg_timed_timeAlive_sixty",type:5,subType:7,period:0,goal:1,reward:200,conditional:7,value:"60",valueTwo:null,tier:2,loc:{title:"Hard to Beat",desc:"Stay alive for 1 min"}},{id:88,loc_ref:"chlg_timed_timeAlive_three_hundred",type:5,subType:7,period:0,goal:1,reward:2500,conditional:7,value:"300",valueTwo:null,tier:3,loc:{title:"Happily Ever After",desc:"Stay alive for 5 min"}},{id:90,loc_ref:"chlg_timed_timePlayed_three_hundred",type:5,subType:6,period:0,goal:300,reward:200,conditional:6,value:"300",valueTwo:null,tier:0,loc:{title:"Shell Shocked!",desc:"Play for 5 min"}},{id:91,loc_ref:"chlg_timed_timePlayed_nine_hundred",type:5,subType:6,period:0,goal:900,reward:500,conditional:6,value:"900",valueTwo:null,tier:1,loc:{title:"Not so Noob",desc:"Play for 15 min"}},{id:92,loc_ref:"chlg_timed_timePlayed_eighteen_hundred",type:5,subType:6,period:0,goal:1800,reward:1000,conditional:6,value:"1800",valueTwo:null,tier:2,loc:{title:"Oval Office",desc:"Play for 30 min"}},{id:93,loc_ref:"chlg_timed_timePlayed_thirty_six_hundred",type:5,subType:6,period:0,goal:3600,reward:2500,conditional:6,value:"3600",valueTwo:null,tier:3,loc:{title:"On That Grind",desc:"Play for 60 min"}},{id:94,loc_ref:"chlg_kotc_capturing_timeAlive_twenty",type:6,subType:20,period:0,goal:1,reward:100,conditional:7,value:"10",valueTwo:null,tier:1,loc:{title:"Hold the Fort",desc:"Stand on Coop for 10 sec"}},{id:95,loc_ref:"chlg_kotc_capture",type:6,subType:21,period:0,goal:1,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Coop King",desc:"Capture a Coop"}},{id:96,loc_ref:"chlg_kotc_win_one",type:6,subType:23,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"King of the Coop",desc:"Win a KotC match"}},{id:97,loc_ref:"chlg_kotc_win_three",type:6,subType:23,period:0,goal:3,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Team Sports",desc:"Win 3 KotC matches"}},{id:98,loc_ref:"chlg_kotc_win_five",type:6,subType:23,period:0,goal:5,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Rule the Roost",desc:"Win 5 KotC matches"}},{id:99,loc_ref:"chlg_kotc_win_ten",type:6,subType:23,period:0,goal:10,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Coop Commander",desc:"Win 10 KotC matches"}},{id:100,loc_ref:"chlg_kotc_coop_kill",type:6,subType:20,period:0,goal:1,reward:200,conditional:10,value:null,valueTwo:null,tier:1,loc:{title:"Defender",desc:"Kill an egg from the Coop"}},{id:101,loc_ref:"chlg_kotc_coop_kill_victim_capturing",type:6,subType:20,period:0,goal:1,reward:200,conditional:10,value:"18",valueTwo:null,tier:1,loc:{title:"Offender",desc:"Kill an egg on a Coop"}},{id:102,loc_ref:"chlg_cts_pick_up",type:7,subType:21,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Fry Cook",desc:"CTS: Pick up the Spatula"}},{id:103,loc_ref:"chlg_cts_capture_timeAlive_thirty",type:7,subType:21,period:0,goal:1,reward:500,conditional:7,value:"30",valueTwo:null,tier:2,loc:{title:"Keepaway",desc:"CTS: Hold the Spatula for 30s"}},{id:104,loc_ref:"chlg_cts_win_ten",type:7,subType:23,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Sunny Side Up!",desc:"CTS: Gain 20+ kills holding the spatula"}},{id:105,loc_ref:"chlg_cts_win_twenty_five",type:7,subType:23,period:0,goal:50,reward:4000,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Flippin 'em",desc:"CTS: Gain 50+ kills holding the spatula"}},{id:106,loc_ref:"chlg_cts_win_fifty",type:7,subType:23,period:0,goal:100,reward:1e4,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Makin' Bacon",desc:"CTS: Gain 100+ kills holding the spatula"}},{id:107,loc_ref:"chlg_cts_kills_victim_spatula",type:7,subType:10,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Kill the Cook",desc:"CTS: Kill the Spatula holder"}},{id:108,loc_ref:"chlg_cts_kills_killstreak_five",type:7,subType:10,period:0,goal:1,reward:500,conditional:0,value:"5",valueTwo:null,tier:3,loc:{title:"Flippin' Dangerous",desc:"CTS: Get a 5 KS with the spatula"}}];var Maps=[{filename:"abduction",hash:"1ritt77g1fv",name:"Abduction",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"aqueduct",hash:"11dp765kifr",name:"Aqueduct",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"backstage",hash:"9dsromfqr1",name:"Backstage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"bastion",hash:"uuwh7401no",name:"Bastion",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"bedrock",hash:"yqbkimntiu",name:"Bedrock",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"biohazard",hash:"kzarr9ebqx",name:"BioHazard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"blender",hash:"1vvfxp9rt8u",name:"Blender",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"blue",hash:"2e7izzo70bk",name:"Blue",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"14"},{filename:"bridge",hash:"20vcy8e1ev0",name:"Bridge",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"canyon",hash:"2avqtv9ygk1",name:"Canyon",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"cash",hash:"1427gfre8ma",name:"Cash",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"castle",hash:"2d2tcz2mw7e",name:"Castle",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"castleArena",hash:"9dhs3kms6l",name:"Castle Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"8"},{filename:"catacombs",hash:"2el91jtcun0",name:"Catacombs",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"chickenItza",hash:"hyjqbat0i3",name:"Chicken Itza",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"cluckgrounds",hash:"1h9z3hj51g5",name:"Cluckgrounds",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"cobalt",hash:"1c9fg9re2mf",name:"Cobalt",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"courtyard",hash:"3b716ateol",name:"Courtyard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"creak",hash:"l2pzui2f6o",name:"Creak",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"crossed",hash:"ead3tcf30r",name:"Crossed",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"crowsnest",hash:"1ze2s5zr9bm",name:"Crowsnest",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"8"},{filename:"deathpit",hash:"1cc9cvjf607",name:"Death Pit",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"dirt",hash:"1u3k5nfvwuh",name:"Dirt",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"dirt2",hash:"494aka3mb4",name:"Dirt 2",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"dirtbase",hash:"6e9r2y7dxk",name:"Dirt Base",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"downfall",hash:"26g5aj8aruc",name:"Downfall",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"duelPyramid",hash:"vmg0rj2e3b",name:"Duel Pyramid",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"eggcrates",hash:"j0i36e808n",name:"Eggcrates",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"6"},{filename:"enchanted",hash:"1igxtcyetaw",name:"Enchanted",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"exposure",hash:"15hv3cme1fh",name:"Exposure",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"facility",hash:"18djbmo35ru",name:"Facility",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"feedlot",hash:"iuj8rc7kyh",name:"Feedlot",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"field",hash:"e4aszuch87",name:"Field",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"flux",hash:"2e9jbskip5u",name:"Flux",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"fortFlip",hash:"1w1b6dkalc2",name:"Fort Flip",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"foundation",hash:"11y636vc64b",name:"Foundation",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"fourQuarters",hash:"1a0w7vbz8is",name:"Four Quarters",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"gravelstomp",hash:"h2s7fdl8ke",name:"Gravel Stomp",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"greenhouse",hash:"1zx6pqgc23x",name:"Greenhouse",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"growler",hash:"1izyni7tb1e",name:"Growler",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"haunted",hash:"2dma8z1jdev",name:"Haunted",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"helix",hash:"i2sl4vsg3h",name:"Helix",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"hydro",hash:"8znnxbxfss",name:"Hydro",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"icebox",hash:"1mwbrjievwg",name:"Ice Box",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"indigo",hash:"1vrzzn6ym9q",name:"Indigo",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"inmates",hash:"19wzahko4nm",name:"Inmates",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"jailbreak",hash:"2a3blmd9hf4",name:"Jail Break",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"14"},{filename:"jinx",hash:"24u6pohagnj",name:"Jinx",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"junction",hash:"bkca8j2ppd",name:"Junction",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"kingsCourt",hash:"aq1t2lsjza",name:"King's Court",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"lunarmodule",hash:"1448aqjdqvl",name:"Lunar Module",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"mansion",hash:"nqhtvwj3fo",name:"Mansion",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"mazerunner",hash:"j16i30k9dz",name:"Maze Runner",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"metamorph",hash:"l9o69l8e1b",name:"Metamorph",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"14"},{filename:"moonbase",hash:"1yzocf1mex3",name:"Moonbase",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"mudGulch",hash:"kto278skze",name:"Mud Gulch",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"nextdoor",hash:"s2i5za1kx9",name:"Nextdoor",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"orbital",hash:"76g9ms7t5o",name:"Orbital",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"outer",hash:"w1biqokp89",name:"Outer Reach",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"overcooked",hash:"29ca98hgdeh",name:"Overcooked",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"palaceSiege",hash:"1enghs5hsxe",name:"Palace Siege",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"parkour1",hash:"1fwysuizmoy",name:"Parkour - Easy",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"parkour2",hash:"25n7k671t0e",name:"Parkour - Medium",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"parkour3",hash:"pm58s3bnil",name:"Parkour - Hard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"12"},{filename:"quarry",hash:"2crjk106pa",name:"Quarry",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"queenscourt",hash:"raudy4h9pv",name:"Queen's Court",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"raceway",hash:"1a3eo6xaoju",name:"Raceway",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"rameses",hash:"177jt4j8so9",name:"Rameses",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"rats",hash:"13r2oqql8se",name:"Rats",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"relic",hash:"lxzknz53a2",name:"Relic",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"rivals",hash:"26fkvcef2h6",name:"Rivals",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"road",hash:"2h312vlocd",name:"Road",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"ruins",hash:"3ycs8z9bcu",name:"Ruins",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"sanctuary",hash:"1evqx0d08e4",name:"Sanctuary",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"scales",hash:"101v5lpkv1s",name:"Scales",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"shadyglen",hash:"2d0d4bj7aq3",name:"Shady Glen",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"shellville",hash:"fdgmkbfe7n",name:"Shellville",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"shipyard",hash:"1n1sptszksq",name:"Shipyard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"skyScratcher",hash:"1th1c8epp95",name:"Sky Scratcher",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"spaceFactory",hash:"10802a2az0f",name:"Space Factory",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"10"},{filename:"spacearena",hash:"k9zf5lqzze",name:"Space Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"14"},{filename:"sparta",hash:"274wwdyll9w",name:"Sparta",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"spellbound",hash:"1curtd0i4ls",name:"Spellbound",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"stage",hash:"1zn44r9jb3t",name:"Stage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"starship",hash:"27xerc3smw5",name:"Starship",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"staxarena",hash:"1jid8ffda0z",name:"Stax Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"teggtris",hash:"1y4rswkkv3l",name:"Teggtris",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"temple",hash:"bp6twwct9v",name:"Temple",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"timetwist",hash:"1ad75xyk2rv",name:"Timetwist",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"trainyard",hash:"2e1w70fjqet",name:"Trainyard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"treefort",hash:"14a9akanqms",name:"Tree Fort",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"twoTowers",hash:"2asidv5c0ff",name:"Two Towers",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"uncovered",hash:"bxrd0zdvtn",name:"Uncovered",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"12"},{filename:"vert",hash:"25a9ikled77",name:"Vert",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"wimble",hash:"13smnxheae1",name:"Wimble",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"wonderland",hash:"5n6ixyepvy",name:"Wonderland",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"wreckage",hash:"nkiu4z6uj1",name:"Wreckage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"yolkido",hash:"pttsmqw7xj",name:"Yolkido Garrison",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"zoomies",hash:"3vitx32ce8",name:"Zoomies",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"}];var Regions=[{id:"germany",sub:"egs-static-live-germany-5t7y9re9"},{id:"santiago",sub:"egs-static-live-santiago-1s5w3rbn"},{id:"singapore",sub:"egs-static-live-singapore-451s6uaf"},{id:"sydney",sub:"egs-static-live-sydney-3v6080dx"},{id:"uscentral",sub:"egs-static-live-uscentral-2w7m7d9l"},{id:"useast",sub:"egs-static-live-useast-1u265wed"},{id:"uswest",sub:"egs-static-live-uswest-451s5eeo"}];var processAddPlayerPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),findCosmetics=bot.intents.includes(Intents.COSMETIC_DATA),playerData={id,uniqueId:CommIn_default.unPackString(),name:CommIn_default.unPackString(),safeName:CommIn_default.unPackString(),charClass:CommIn_default.unPackInt8U(),team:CommIn_default.unPackInt8U(),primaryWeaponItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),secondaryWeaponItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),shellColor:CommIn_default.unPackInt8U(),hatItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),stampItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),stampPosX:CommIn_default.unPackInt8(),stampPosY:CommIn_default.unPackInt8(),grenadeItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),meleeItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),x:CommIn_default.unPackFloat(),y:CommIn_default.unPackFloat(),z:CommIn_default.unPackFloat(),$dx:CommIn_default.unPackFloat(),$dy:CommIn_default.unPackFloat(),$dz:CommIn_default.unPackFloat(),yaw:CommIn_default.unPackRadU(),pitch:CommIn_default.unPackRad(),score:CommIn_default.unPackInt32U(),$kills:CommIn_default.unPackInt16U(),$deaths:CommIn_default.unPackInt16U(),$streak:CommIn_default.unPackInt16U(),totalKills:CommIn_default.unPackInt32U(),totalDeaths:CommIn_default.unPackInt32U(),bestStreak:CommIn_default.unPackInt16U(),$bestOverallStreak:CommIn_default.unPackInt16U(),shield:CommIn_default.unPackInt8U(),hp:CommIn_default.unPackInt8U(),playing:CommIn_default.unPackInt8U(),weaponIdx:CommIn_default.unPackInt8U(),$controlKeys:CommIn_default.unPackInt8U(),upgradeProductId:CommIn_default.unPackInt8U(),activeShellStreaks:CommIn_default.unPackInt8U(),social:CommIn_default.unPackLongString(),hideBadge:CommIn_default.unPackInt8U()};bot.game.mapIdx=CommIn_default.unPackInt8U(),bot.game.isPrivate=CommIn_default.unPackInt8U()===1,bot.game.gameModeId=CommIn_default.unPackInt8U();let player=new GamePlayer_default(playerData,bot.game.gameMode===GameMode.KOTC?bot.game.kotc.activeZone:null);if(!bot.players[playerData.id])bot.players[playerData.id]=player;if(bot.$emit("playerJoin",player),bot.me.id===playerData.id)bot.me=player,bot.$emit("botJoin",bot.me)},addPlayer_default=processAddPlayerPacket;var processBeginShellStreakPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),ksType=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;switch(ksType){case ShellStreak.HardBoiled:if(id===bot.me.id)bot.me.shieldHp=100;player.streakRewards.push(ShellStreak.HardBoiled);break;case ShellStreak.EggBreaker:player.streakRewards.push(ShellStreak.EggBreaker);break;case ShellStreak.Restock:{if(player.grenades=3,player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.rounds=player.weapons[0].ammo.capacity,player.weapons[0].ammo.store=player.weapons[0].ammo.storeMax;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.rounds=player.weapons[1].ammo.capacity,player.weapons[1].ammo.store=player.weapons[1].ammo.storeMax;break}case ShellStreak.OverHeal:player.hp=Math.min(200,player.hp+100),player.streakRewards.push(ShellStreak.OverHeal);break;case ShellStreak.DoubleEggs:player.streakRewards.push(ShellStreak.DoubleEggs);break;case ShellStreak.MiniEgg:player.scale=0.5,player.streakRewards.push(ShellStreak.MiniEgg);break}bot.$emit("playerBeginStreak",player,ksType)},beginShellStreak_default=processBeginShellStreakPacket;var processChallengeCompletedPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),challengeId=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;if(!bot.intents.includes(Intents.CHALLENGES))return bot.$emit("challengeComplete",player,challengeId);let challenge=bot.account.challenges.find((c)=>c.id===challengeId);if(bot.$emit("challengeComplete",player,challenge),player.id===bot.me.id)bot.refreshChallenges()},challengeCompleted_default=processChallengeCompletedPacket;var processChangeCharacterPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),weaponIndex=CommIn_default.unPackInt8U(),primaryWeaponIdx=CommIn_default.unPackInt16U(),secondaryWeaponIdx=CommIn_default.unPackInt16U(),shellColor=CommIn_default.unPackInt8U(),hatIdx=CommIn_default.unPackInt16U(),stampIdx=CommIn_default.unPackInt16U(),grenadeIdx=CommIn_default.unPackInt16U(),meleeIdx=CommIn_default.unPackInt16U(),stampPositionX=CommIn_default.unPackInt8(),stampPositionY=CommIn_default.unPackInt8(),findCosmetics=bot.intents.includes(Intents.COSMETIC_DATA),primaryWeaponItem=findCosmetics?findItemById(primaryWeaponIdx):primaryWeaponIdx,secondaryWeaponItem=findCosmetics?findItemById(secondaryWeaponIdx):secondaryWeaponIdx,hatItem=findCosmetics?findItemById(hatIdx):hatIdx,stampItem=findCosmetics?findItemById(stampIdx):stampIdx,grenadeItem=findCosmetics?findItemById(grenadeIdx):grenadeIdx,meleeItem=findCosmetics?findItemById(meleeIdx):meleeIdx,player=bot.players[id];if(player){let oldCharacter=structuredClone(player.character),oldWeaponIdx=player.selectedGun;if(player.character.eggColor=shellColor,player.character.primaryGun=primaryWeaponItem,player.character.secondaryGun=secondaryWeaponItem,player.character.stamp=stampItem,player.character.hat=hatItem,player.character.grenade=grenadeItem,player.character.melee=meleeItem,player.character.stampPos.x=stampPositionX,player.character.stampPos.y=stampPositionY,player.selectedGun=weaponIndex,player.weapons[0]=createGun(GunList[weaponIndex]),oldWeaponIdx!==player.selectedGun)bot.$emit("playerChangeGun",player,oldWeaponIdx,player.selectedGun);if(JSON.stringify(oldCharacter)!==JSON.stringify(player.character))bot.$emit("playerChangeCharacter",player,oldCharacter,player.character)}},changeCharacter_default=processChangeCharacterPacket;var processChatPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),msgFlags=CommIn_default.unPackInt8U(),text=CommIn_default.unPackString(),player=bot.players[id];if(player)bot.$emit("chat",player,text,msgFlags)},chat_default=processChatPacket;var processCollectItemPacket=(bot)=>{let playerId=CommIn_default.unPackInt8U(),type=CommIn_default.unPackInt8U(),applyToWeaponIdx=CommIn_default.unPackInt8U(),id=CommIn_default.unPackInt16U(),player=bot.players[playerId];if(!player)return;if(bot.game.collectibles[type]=bot.game.collectibles[type].filter((c)=>c.id!==id),type===CollectType.Ammo){let playerWeapon=player.weapons[applyToWeaponIdx];if(playerWeapon&&playerWeapon.ammo)playerWeapon.ammo.store=Math.min(playerWeapon.ammo.storeMax,playerWeapon.ammo.store+playerWeapon.ammo.pickup),bot.$emit("playerCollectAmmo",player,playerWeapon,id)}if(type===CollectType.Grenade){if(player.grenades++,player.grenades>3)player.grenades=3;bot.$emit("playerCollectGrenade",player,id)}},collectItem_default=processCollectItemPacket;var processDiePacket=(bot)=>{let killedId=CommIn_default.unPackInt8U(),killerId=CommIn_default.unPackInt8U();CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U();let damageCauseInt=CommIn_default.unPackInt8U(),killed=bot.players[killedId],killer=bot.players[killerId],oldKilled=killed?structuredClone(killed):null;if(bot.me&&killed){if(killed.id===bot.me.id){if(bot.lastDeathTime=Date.now(),bot.pathing.activePath)bot.pathing.activePath=null,bot.pathing.activeNode=null,bot.pathing.activeNodeIdx=0;bot.state.controlKeys=0}if(killed.playing=!1,killed.streak=0,killed.hp=100,killed.spawnShield=0,killed.stats.totalDeaths++,killed.inKotcZone)killed.inKotcZone=!1,bot.$emit("playerLeaveZone",killed,ZoneLeaveReason.Killed)}if(killer){if(killer.streak++,killer.stats.totalKills++,killer.streak>killer.stats.bestStreak)killer.stats.bestStreak=killer.streak}bot.$emit("playerDeath",killed,killer,oldKilled,damageCauseInt)},die_default=processDiePacket;var timedStreaks=[ShellStreak.EggBreaker,ShellStreak.OverHeal,ShellStreak.DoubleEggs,ShellStreak.MiniEgg],processEndShellStreakPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),ksType=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;if(timedStreaks.includes(ksType)&&player.streakRewards.includes(ksType))player.streakRewards=player.streakRewards.filter((r)=>r!==ksType);if(ksType===ShellStreak.MiniEgg)player.scale=1;bot.$emit("playerEndStreak",player,ksType)},endShellStreak_default=processEndShellStreakPacket;var processEventModifierPacket=(bot)=>{let out=new CommOut_default;out.packInt8(CommCode_default.eventModifier),out.send(bot.game.socket)},eventModifier_default=processEventModifierPacket;var processExplodePacket=(bot)=>{let itemType=CommIn_default.unPackInt8U(),item=CommIn_default.unPackInt16U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),damage=CommIn_default.unPackInt8U(),radius=CommIn_default.unPackFloat();if(bot.intents.includes(Intents.COSMETIC_DATA))item=findItemById(item);if(itemType===ItemType.Grenade)bot.$emit("grenadeExplode",item,{x,y,z},damage,radius);else bot.$emit("rocketHit",{x,y,z},damage,radius)},explode_default=processExplodePacket;var processFirePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),bullet={posX:CommIn_default.unPackFloat(),posY:CommIn_default.unPackFloat(),posZ:CommIn_default.unPackFloat(),dirX:CommIn_default.unPackFloat(),dirY:CommIn_default.unPackFloat(),dirZ:CommIn_default.unPackFloat()},player=bot.players[id];if(!player)return;let playerWeapon=player.weapons[player.activeGun];if(playerWeapon&&playerWeapon.ammo)playerWeapon.ammo.rounds--,bot.$emit("playerFire",player,playerWeapon,bullet)},fire_default=processFirePacket;var processGameActionPacket=(bot)=>{let action=CommIn_default.unPackInt8U();if(action===GameAction.Pause)bot.$emit("gameForcePause"),setTimeout(()=>{if(bot.me)bot.me.playing=!1},3000);if(action===GameAction.Reset){if(Object.values(bot.players).forEach((player)=>player.streak=0),bot.game.gameModeId!==GameMode.FFA)bot.game.teamScore=[0,0,0];if(bot.game.gameModeId===GameMode.Spatula)bot.game.spatula.controlledBy=0,bot.game.spatula.controlledByTeam=0,bot.game.spatula.coords={x:0,y:0,z:0};if(bot.game.gameModeId===GameMode.KOTC)bot.game.kotc.stage=CoopState.Capturing,bot.game.kotc.zoneIdx=0,bot.game.kotc.activeZone=null,bot.game.kotc.teamCapturing=0,bot.game.kotc.captureProgress=0,bot.game.kotc.numCapturing=0,bot.game.kotc.capturePercent=0;bot.$emit("gameReset")}},gameAction_default=processGameActionPacket;class AStar{constructor(list){this.list=list}heuristic(pos1,pos2){let dx=Math.abs(pos1.x-pos2.x),dy=Math.abs(pos1.y-pos2.y),dz=Math.abs(pos1.z-pos2.z),dxz=Math.max(dx,dz);return dy+dxz}reversePath(node){let path=[];while(node.parent)path.push(node),node=node.parent;return path.reverse(),path}path(start,end){this.list.clean();let openSet=[start],closedSet=new Set;start.h=this.heuristic(start,end),start.g=0,start.f=start.h,start.visited=!0;let current;while(openSet.length>0){let lowestIdx=0,lowestF=openSet[0].f,lowestG=openSet[0].g;for(let i=1;i<openSet.length;i++){let node=openSet[i];if(node.f<lowestF||node.f===lowestF&&node.g>lowestG)lowestF=node.f,lowestG=node.g,lowestIdx=i}if(current=openSet[lowestIdx],current===end)return this.reversePath(current);openSet[lowestIdx]=openSet[openSet.length-1],openSet.pop(),closedSet.add(current);let neighbors=current.links;for(let i=0;i<neighbors.length;i++){let neighbor=neighbors[i];if(closedSet.has(neighbor))continue;let tentativeGScore=current.g+1;if(!neighbor.visited||tentativeGScore<neighbor.g){let isNew=!neighbor.visited;if(neighbor.visited=!0,neighbor.parent=current,neighbor.g=tentativeGScore,neighbor.h=this.heuristic(neighbor,end),neighbor.f=neighbor.g+neighbor.h,isNew)openSet.push(neighbor)}}}return null}}var FORWARD_RY_WEDGE_MAPPING=Object.freeze({0:{x:0,z:-1},1:{x:-1,z:0},2:{x:0,z:1},3:{x:1,z:0}}),positionKey=(x,y,z)=>(x&255)<<16|(y&255)<<8|z&255;class MapNode{constructor(meshType,data){if(this.x=data.x,this.y=data.y,this.z=data.z,this.positionKey=positionKey(this.x,this.y,this.z),this.meshType=meshType.split(".").pop(),this.f=0,this.g=0,this.h=0,this.visited=null,this.parent=null,this.closed=null,this.links=[],this.flatCenter={x:this.x+0.5,y:this.y,z:this.z+0.5},this.meshType==="wedge")this.ry=data.ry??0}isFull(){return this.meshType==="full"}canWalkThrough(){return this.meshType==="none"||this.meshType==="ladder"}canWalkOn(){return this.meshType==="full"}isLadder(){return this.meshType==="ladder"}isStair(){return this.meshType==="wedge"}isAir(){return this.meshType==="none"}isJumpPad(){return this.meshType==="jump-pad"}canLink(node,list){let dx0=this.x-node.x,dz0=this.z-node.z,dy0=this.y-node.y,dx=Math.abs(dx0),dy=Math.abs(dy0),dz=Math.abs(dz0);if(dx+dy+dz===0||dx+dz>1&&!(dx===2&&dz===1||dx===1&&dz===2||dx===2&&dz===2)||this.isFull()||node.isFull())return!1;let belowMe=list.at(this.x,this.y-1,this.z),belowOther=list.at(node.x,node.y-1,node.z);if(!belowMe||!belowOther)return!1;if(dy===0&&belowMe.isFull()&&belowOther.isFull()){if(dx===2&&dz===0||dx===0&&dz===2){let midX=(this.x+node.x)/2,midZ=(this.z+node.z)/2,midNode=list.at(midX,this.y,midZ),midBelow=list.at(midX,this.y-1,midZ),midAbove=list.at(midX,this.y+1,midZ);if(midBelow&&midBelow.isAir()){if(midNode&&midNode.isAir()&&midAbove&&midAbove.isAir()){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}}else if(dx===2&&dz===1||dx===1&&dz===2){let xDir=dx0>0?-1:1,zDir=dz0>0?-1:1,checks=dx===2?[[this.x+xDir,this.y,this.z],[this.x+xDir,this.y,this.z+zDir]]:[[this.x,this.y,this.z+zDir],[this.x+xDir,this.y,this.z+zDir]],allClear=!0;for(let[x,y,z]of checks){let block=list.at(x,y,z),blockBelow=list.at(x,y-1,z),blockAbove=list.at(x,y+1,z);if(!block||!block.isAir()||!blockBelow||!blockBelow.isAir()||!blockAbove||!blockAbove.isAir()){allClear=!1;break}}if(allClear){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}else if(dx===2&&dz===2){let xDir=dx0>0?-1:1,zDir=dz0>0?-1:1,checks=[[this.x+xDir,this.y,this.z+zDir],[this.x+2*xDir,this.y,this.z+zDir],[this.x+2*xDir,this.y,this.z+2*zDir]],allClear=!0;for(let[x,y,z]of checks){let block=list.at(x,y,z),blockBelow=list.at(x,y-1,z),blockAbove=list.at(x,y+1,z);if(!block||!block.isAir()||!blockBelow||!blockBelow.isAir()||!blockAbove||!blockAbove.isAir()){allClear=!1;break}}if(allClear){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}}let meSupported=belowMe.isFull()||this.isStair(),otherSupported=belowOther.isFull()||belowOther.isStair()||node.isStair();if(dy<=2&&meSupported&&otherSupported){if(this.meshType==="none"){if(dy0===1&&node.canWalkThrough())return!0;if(belowMe.canWalkOn()||belowMe.isLadder()||belowMe.isStair()){if(node.meshType==="none"||node.meshType==="ladder"&&dy===0||node.meshType==="wedge"&&dy0===0&&dx0===-FORWARD_RY_WEDGE_MAPPING[node.ry].x&&dz0===-FORWARD_RY_WEDGE_MAPPING[node.ry].z)return!0}return!1}else if(this.meshType==="ladder"){if(dy===1&&node.canWalkThrough())return!0;if(dy===0&&belowMe.canWalkOn())return!0;return node.meshType==="ladder"&&(dy===1||belowMe.canWalkOn()&&belowOther.canWalkOn())}else if(this.meshType==="wedge"){let forward=FORWARD_RY_WEDGE_MAPPING[this.ry],backward={x:-forward.x,z:-forward.z};if(this.x+forward.x===node.x&&this.z+forward.z===node.z){if(this.y+1===node.y&&node.canWalkThrough())return!0;if(this.y===node.y&&node.meshType==="wedge")return!0;if(this.y+1===node.y&&node.meshType==="wedge")return!0}if(this.x+backward.x===node.x&&this.z+backward.z===node.z){if((this.y===node.y||this.y-1===node.y)&&node.canWalkThrough())return!0;if(this.y-1===node.y&&(node.meshType==="wedge"||node.meshType==="none"&&belowOther.isFull()))return!0}if(node.canWalkThrough()&&(belowOther.isFull()||belowOther.isStair()))return!0;if(node.isStair())return!0;return!1}}return!1}flatRadialDistance(position){return Math.hypot(this.flatCenter.x-position.x,this.flatCenter.z-position.z)}}var NEIGHBOR_OFFSETS=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1],[1,0,1],[1,0,-1],[-1,0,1],[-1,0,-1],[1,1,0],[-1,1,0],[0,1,1],[0,1,-1],[1,-1,0],[-1,-1,0],[0,-1,1],[0,-1,-1],[2,0,0],[-2,0,0],[0,0,2],[0,0,-2],[2,0,1],[2,0,-1],[-2,0,1],[-2,0,-1],[1,0,2],[1,0,-2],[-1,0,2],[-1,0,-2],[2,0,2],[2,0,-2],[-2,0,2],[-2,0,-2]];class NodeList{list=[];nodeMap=null;constructor(raw){let addedPositions=new Set;for(let meshName of Object.keys(raw.data))for(let nodeData of raw.data[meshName])addedPositions.add(positionKey(nodeData.x,nodeData.y,nodeData.z)),this.list.push(new MapNode(meshName,nodeData));for(let x=0;x<raw.width;x++)for(let y=0;y<raw.height;y++)for(let z=0;z<raw.depth;z++)if(!addedPositions.has(positionKey(x,y,z)))this.list.push(new MapNode("SPECIAL.air.none",{x,y,z}));this.nodeMap=new Map;for(let node of this.list)this.nodeMap.set(node.positionKey,node);for(let node of this.list)for(let[dx,dy,dz]of NEIGHBOR_OFFSETS){let neighborKey=positionKey(node.x+dx,node.y+dy,node.z+dz),neighborNode=this.nodeMap.get(neighborKey);if(neighborNode&&node.canLink(neighborNode,this))node.links.push(neighborNode)}}at(x,y,z){return this.nodeMap?.get(positionKey(x,y,z))}atObject({x,y,z}){return this.nodeMap?.get(positionKey(Math.floor(x),Math.floor(y),Math.floor(z)))}clean(){for(let node of this.list)node.f=0,node.g=0,node.h=0,node.visited=null,node.parent=null,node.closed=null}hasLineOfSight(bot,target){let dx=target.x-bot.x,dy=target.y-bot.y,dz=target.z-bot.z,steps=Math.max(Math.abs(dx),Math.abs(dy),Math.abs(dz)),xStep=dx/steps,yStep=dy/steps,zStep=dz/steps,x=bot.x,y=bot.y,z=bot.z;for(let i=0;i<=steps;i++){if(this.at(Math.round(x),Math.round(y),Math.round(z))?.isFull())return!1;x+=xStep,y+=yStep,z+=zStep}return!0}}var GameModeById=Object.fromEntries(Object.entries(GameMode).map(([key,value])=>[value,key])),processGameJoinedPacket=async(bot)=>{if(bot.me.id=CommIn_default.unPackInt8U(),bot.me.team=CommIn_default.unPackInt8U(),bot.game.gameModeId=CommIn_default.unPackInt8U(),bot.game.gameMode=GameModeById[bot.game.gameModeId],bot.game.mapIdx=CommIn_default.unPackInt8U(),bot.game.map=Maps[bot.game.mapIdx],bot.game.playerLimit=CommIn_default.unPackInt8U(),bot.game.isGameOwner=CommIn_default.unPackInt8U()===1,bot.game.isPrivate=CommIn_default.unPackInt8U()===1||bot.game.isGameOwner,CommIn_default.unPackInt8U(),bot.intents.includes(Intents.LOAD_MAP)||bot.intents.includes(Intents.PATHFINDING)){let map=await fetchMap(bot.game.map.filename,bot.game.map.hash);if(bot.game.map)bot.game.map.raw=map;if(bot.game.gameModeId===GameMode.KOTC){let meshData=bot.game.map.raw.data["DYNAMIC.capture-zone.none"];if(meshData){if(bot.game.map.zones=initKotcZones(meshData),!bot.game.kotc.activeZone)bot.game.kotc.activeZone=bot.game.map.zones[bot.game.kotc.zoneIdx-1]}else delete bot.game.map.zones}if(bot.intents.includes(Intents.PATHFINDING))bot.pathing.nodeList=new NodeList(bot.game.map.raw),bot.pathing.astar=new AStar(bot.pathing.nodeList);bot.$emit("mapLoad",bot.game.map.raw)}bot.state.inGame=!0,bot.lastDeathTime=Date.now();let out=new CommOut_default;if(out.packInt8(CommCode_default.clientReady),out.send(bot.game.socket),!bot.intents.includes(Intents.MANUAL_UPDATE))bot.updateIntervalId=setInterval(()=>bot.update(),33.333333333333336);if(bot.intents.includes(Intents.PING)){bot.lastPingTime=Date.now();let out2=new CommOut_default;out2.packInt8(CommCode_default.ping),out2.send(bot.game.socket)}if(bot.intents.includes(Intents.NO_AFK_KICK))bot.afkKickInterval=setInterval(()=>{if(bot.state.inGame&&!bot.me.playing&&Date.now()-bot.lastDeathTime>=15000){let out3=new CommOut_default;out3.packInt8(CommCode_default.keepAlive),out3.send(bot.game.socket)}},15000);bot.$emit("gameReady")},gameJoined_default=processGameJoinedPacket;var CCGameOptionFlag=Object.fromEntries(Object.entries(GameOptionFlag).map(([k,v])=>[k[0].toLowerCase()+k.slice(1),v])),processGameOptionsPacket=(bot)=>{let oldOptions=structuredClone(bot.game.options),gravity=CommIn_default.unPackInt8U(),damage=CommIn_default.unPackInt8U(),healthRegen=CommIn_default.unPackInt8U();if(gravity<1||gravity>4)gravity=4;if(damage<0||damage>8)damage=4;if(healthRegen>16)healthRegen=4;bot.game.options.gravity=gravity/4,bot.game.options.damage=damage/4,bot.game.options.healthRegen=healthRegen/4;let rawFlags=CommIn_default.unPackInt8U();Object.keys(CCGameOptionFlag).forEach((optionFlagName)=>{let value=rawFlags&CCGameOptionFlag[optionFlagName]?1:0;bot.game.options[optionFlagName]=value}),bot.game.options.weaponsDisabled=Array.from({length:7},()=>CommIn_default.unPackInt8U()===1),bot.game.options.mustUseSecondary=bot.game.options.weaponsDisabled.every((v)=>v),bot.$emit("gameOptionsChange",oldOptions,bot.game.options)},gameOptions_default=processGameOptionsPacket;var processHitMeHardBoiledPacket=(bot)=>{let shieldHealth=CommIn_default.unPackInt8U(),playerHealth=CommIn_default.unPackInt8U(),dx=CommIn_default.unPackFloat(),dz=CommIn_default.unPackFloat();if(!bot.me)return;if(bot.me.shieldHp=shieldHealth,bot.me.hp=playerHealth,bot.me.shieldHp<=0)bot.me.streakRewards=bot.me.streakRewards.filter((r)=>r!==ShellStreak.HardBoiled),bot.$emit("selfShieldLost",bot.me.hp,{dx,dz});else bot.$emit("selfShieldHit",bot.me.shieldHp,bot.me.hp,{dx,dz})},hitMeHardBoiled_default=processHitMeHardBoiledPacket;var processHitMePacket=(bot)=>{let hp=CommIn_default.unPackInt8U();if(CommIn_default.unPackFloat(),CommIn_default.unPackFloat(),bot.me){let oldHealth=bot.me.hp;bot.me.hp=hp,bot.$emit("playerDamage",bot.me,oldHealth,bot.me.hp)}},hitMe_default=processHitMePacket;var processHitThemPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),hp=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let oldHealth=player.hp;player.hp=hp,bot.$emit("playerDamage",player,oldHealth,player.hp)},hitThem_default=processHitThemPacket;var processMeleePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(player)bot.$emit("playerMelee",player)},melee_default=processMeleePacket;var processMetaGameStatePacket=(bot)=>{if(bot.game.gameModeId===GameMode.Spatula){let oldTeamScores=structuredClone(bot.game.teamScore),oldSpatula=structuredClone(bot.game.spatula);bot.game.teamScore[1]=CommIn_default.unPackInt16U(),bot.game.teamScore[2]=CommIn_default.unPackInt16U();let spatulaCoords={x:CommIn_default.unPackFloat(),y:CommIn_default.unPackFloat(),z:CommIn_default.unPackFloat()},controlledBy=CommIn_default.unPackInt8U(),controlledByTeam=CommIn_default.unPackInt8U();bot.game.spatula={coords:spatulaCoords,controlledBy,controlledByTeam},bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore},spatula:{before:oldSpatula,after:bot.game.spatula}})}else if(bot.game.gameModeId===GameMode.KOTC){let oldTeamScores=structuredClone(bot.game.teamScore),oldKOTC=structuredClone(bot.game.kotc),oldPlayersOnZone=Object.values(bot.players).filter((p)=>p.inKotcZone&&p.playing);if(bot.game.kotc.stage=CommIn_default.unPackInt8U(),bot.game.kotc.zoneIdx=CommIn_default.unPackInt8U(),bot.game.kotc.teamCapturing=CommIn_default.unPackInt8U(),bot.game.kotc.captureProgress=CommIn_default.unPackInt16U(),bot.game.kotc.numCapturing=CommIn_default.unPackInt8U(),bot.game.teamScore[1]=CommIn_default.unPackInt8U(),bot.game.teamScore[2]=CommIn_default.unPackInt8U(),bot.game.kotc.capturePercent=bot.game.kotc.captureProgress/1000,bot.game.kotc.activeZone=bot.game.map?.zones?bot.game.map.zones[bot.game.kotc.zoneIdx-1]:null,bot.game.kotc.activeZone)Object.values(bot.players).forEach((player)=>player.updateKotcZone(bot.game.kotc.activeZone));if(bot.game.kotc.numCapturing<=0)Object.values(bot.players).forEach((player)=>{if(player.inKotcZone)player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.RoundEnded)});let newPlayersOnZone=Object.values(bot.players).filter((p)=>p.inKotcZone&&p.playing);bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore},kotc:{before:oldKOTC,after:bot.game.kotc},playersOnZone:{before:oldPlayersOnZone,after:newPlayersOnZone}})}else if(bot.game.gameModeId===GameMode.Team){let oldTeamScores=structuredClone(bot.game.teamScore);bot.game.teamScore[1]=CommIn_default.unPackInt16U(),bot.game.teamScore[2]=CommIn_default.unPackInt16U(),bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore}})}if(bot.game.gameModeId!==GameMode.Spatula)delete bot.game.spatula;if(bot.game.gameModeId!==GameMode.KOTC)delete bot.game.kotc;if(bot.game.gameModeId===GameMode.FFA)delete bot.game.teamScore},metaGameState_default=processMetaGameStatePacket;var processPausePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(player){if(player.playing=!1,player.streakRewards)player.streakRewards=[];if(bot.$emit("playerPause",player),player.inKotcZone)player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.Despawned)}},pause_default=processPausePacket;var processPingPacket=(bot)=>{if(!bot.intents.includes(Intents.PING))return;if(bot.pingTimeoutId)clearTimeout(bot.pingTimeoutId);let oldPing=bot.ping??0;bot.ping=bot.lastPingTime?Date.now()-bot.lastPingTime:0,bot.$emit("pingUpdate",oldPing,bot.ping),bot.pingTimeoutId=setTimeout(()=>{let out=new CommOut_default;out.packInt8(CommCode_default.ping),out.send(bot.game.socket),bot.lastPingTime=Date.now()},1000)},ping_default=processPingPacket;var processPlayerInfoPacket=(bot)=>{let playerId=CommIn_default.unPackInt8U(),playerDBId=CommIn_default.unPackString(128),playerIp=CommIn_default.unPackString(32),player=bot.players[playerId];if(!player)return;player.admin={ip:playerIp,dbId:playerDBId},bot.$emit("playerInfo",player,playerIp,playerDBId)},playerInfo_default=processPlayerInfoPacket;var processReloadPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let playerActiveWeapon=player.weapons[player.activeGun];if(playerActiveWeapon.ammo){let maxLoad=Math.min(playerActiveWeapon.ammo.capacity,playerActiveWeapon.ammo.reload),needed=Math.max(0,maxLoad-playerActiveWeapon.ammo.rounds),newRounds=Math.min(needed,playerActiveWeapon.ammo.store);playerActiveWeapon.ammo.rounds+=newRounds,playerActiveWeapon.ammo.store-=newRounds}bot.$emit("playerReload",player,playerActiveWeapon)},reload_default=processReloadPacket;var processRemovePlayerPacket=(bot)=>{let id=CommIn_default.unPackInt8U();if(!bot.players[id])return;let removedPlayer=structuredClone(bot.players[id]);delete bot.players[id],bot.$emit("playerLeave",removedPlayer)},removePlayer_default=processRemovePlayerPacket;var processRespawnPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),seed=CommIn_default.unPackInt16U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),primaryRounds=CommIn_default.unPackInt8U(),primaryStore=CommIn_default.unPackInt8U(),secondaryRounds=CommIn_default.unPackInt8U(),secondaryStore=CommIn_default.unPackInt8U(),grenades=CommIn_default.unPackInt8U(),player=bot.players[id];if(player){if(player.playing=!0,player.randomSeed=seed,player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.rounds=primaryRounds;if(player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.store=primaryStore;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.rounds=secondaryRounds;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.store=secondaryStore;player.grenades=grenades,player.position={x,y,z},player.spawnShield=120,bot.$emit("playerRespawn",player)}},respawn_default=processRespawnPacket;var processSocketReadyPacket=(bot)=>{let out=new CommOut_default;out.packInt8(bot.intents.includes(Intents.OBSERVE_GAME)?CommCode_default.observeGame:CommCode_default.joinGame),out.packString(bot.game.raw.uuid),out.packInt8(+bot.intents.includes(Intents.VIP_HIDE_BADGE)),out.packInt8(bot.state.weaponIdx||bot.account.loadout?.classIdx||0),out.packString(bot.state.name),out.packInt32(bot.account.session),out.packString(bot.account.sessionId),out.packString(bot.account.firebaseId),out.send(bot.game.socket)},socketReady_default=processSocketReadyPacket;var processSpawnItemPacket=(bot)=>{let id=CommIn_default.unPackInt16U(),type=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat();bot.game.collectibles[type].push({id,x,y,z}),bot.$emit("spawnItem",type,{x,y,z},id)},spawnItem_default=processSpawnItemPacket;var processSwitchTeamPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),toTeam=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let oldTeam=player.team;player.team=toTeam,player.streak=0,bot.$emit("playerSwitchTeam",player,oldTeam,toTeam)},switchTeam_default=processSwitchTeamPacket;var processSyncMePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];CommIn_default.unPackInt8U();let serverStateIdx=CommIn_default.unPackInt8U(),newX=CommIn_default.unPackFloat(),newY=CommIn_default.unPackFloat(),newZ=CommIn_default.unPackFloat();if(bot.me.climbing=!!CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U(),!player)return;bot.state.serverStateIdx=serverStateIdx;let oldX=player.position.x,oldY=player.position.y,oldZ=player.position.z;if(player.position.x=newX,player.position.y=newY,player.position.z=newZ,oldX!==newX||oldY!==newY||oldZ!==newZ)bot.$emit("playerMove",player,{x:oldX,y:oldY,z:oldZ},{x:newX,y:newY,z:newZ})},syncMe_default=processSyncMePacket;var processSyncThemPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),climbing=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player||player.id===bot.me.id){for(let i2=0;i2<FramesBetweenSyncs;i2++)CommIn_default.unPackInt8U(),CommIn_default.unPackRadU(),CommIn_default.unPackRad(),CommIn_default.unPackInt8U();return}for(let i2=0;i2<FramesBetweenSyncs;i2++){let controlKeys=CommIn_default.unPackInt8U();player.jumping=!!(controlKeys&Movement.Jump),player.scoping=!!(controlKeys&Movement.Scope);let oldView=structuredClone(player.view);if(player.view.yaw=CommIn_default.unPackRadU(),player.view.pitch=CommIn_default.unPackRad(),player.view.yaw!==oldView.yaw||player.view.pitch!==oldView.pitch)bot.$emit("playerRotate",player,oldView,player.view);player.scale=CommIn_default.unPackInt8U()}let px=player.position,posChanged=px.x!==x||px.y!==y||px.z!==z,climbingChanged=player.climbing!==climbing,didChange=posChanged||climbingChanged,oldPosition=didChange?structuredClone(px):null;if(px.x!==x)px.x=x;if(px.z!==z)px.z=z;if(!player.jumping||Math.abs(px.y-y)>0.5)px.y=y;if(climbingChanged)player.climbing=climbing;if(!didChange)return;if(bot.$emit("playerMove",player,oldPosition,px),bot.game.gameModeId!==GameMode.KOTC)return;let zone=bot.game.kotc.activeZone,wasIn=!!player.inKotcZone;if(!zone&&wasIn){player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.RoundEnded);return}player.updateKotcZone(zone);let nowIn=!!player.inKotcZone;if(wasIn!==nowIn)player.inKotcZone=nowIn,bot.$emit(nowIn?"playerEnterZone":"playerLeaveZone",player,nowIn?null:ZoneLeaveReason.WalkedOut)},syncThem_default=processSyncThemPacket;var processThrowGrenadePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),dx=CommIn_default.unPackFloat(),dy=CommIn_default.unPackFloat(),dz=CommIn_default.unPackFloat(),player=bot.players[id];if(player){if(player.grenades>0)player.grenades--;bot.$emit("playerThrowGrenade",player,{x,y,z},{x:dx,y:dy,z:dz})}},throwGrenade_default=processThrowGrenadePacket;var processUpdateBalancePacket=(bot)=>{let newBalance=CommIn_default.unPackInt32U(),oldBalance=bot.account.eggBalance;bot.account.eggBalance=newBalance,bot.$emit("balanceUpdate",oldBalance,newBalance)},updateBalance_default=processUpdateBalancePacket;var processSwapWeaponPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),newWeaponId=CommIn_default.unPackInt8U(),player=bot.players[id];if(player)player.activeGun=newWeaponId,bot.$emit("playerSwapWeapon",player,newWeaponId)},swapWeapon_default=processSwapWeaponPacket;var mod3=(n,m)=>(n%m+m)%m;class Bot{intents=[];regionList=[];matchmakerListeners=[];#dispatches=[];#hooks={};#globalHooks=[];#initialAccount;#initialGame;errorLogger=(...args)=>console.error(...args);constructor(params={}){if(params.proxy&&typeof process>"u")throw Error("proxies do not work in this environment");if(this.intents=params.intents||[],this.intents.includes(Intents.COSMETIC_DATA)){if(!findItemById(1001))throw Error("you cannot use the COSMETIC_DATA intent inside of the browser bundles")}if(this.intents.includes(Intents.SIMULATION)&&!this.intents.includes(Intents.PATHFINDING))throw Error("the SIMULATION intent requires the PATHFINDING intent");if(this.instance=params.instance||"shellshock.io",this.protocol=params.protocol||"wss",this.proxy=params.proxy||"",this.connectionTimeout=params.connectionTimeout||5000,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger;if(this.state={name:"yolkbot",weaponIdx:0,useAltGameURL:!1,inGame:!1,chatLines:0,yaw:0,pitch:0,controlKeys:0,onGround:4,dx:0,dy:0,dz:0,reloading:!1,swappingGun:!1,usingMelee:!1,stateIdx:0,serverStateIdx:0,shotsFired:0,buffer:[]},this.players={},this.me=new GamePlayer_default({}),this.game={raw:{},code:"",region:"",socket:null,gameModeId:0,gameMode:"ffa",mapIdx:0,map:{filename:"",hash:"",name:"",modes:{FFA:!1,Teams:!1,Spatula:!1,King:!1},availability:"both",numPlayers:"18",raw:{},zones:[]},playerLimit:0,isGameOwner:!1,isPrivate:!0,options:{gravity:1,damage:1,healthRegen:1,locked:!1,noTeamChange:!1,noTeamShuffle:!1,weaponsDisabled:Array(7).fill(!1),mustUseSecondary:!1},collectibles:[[],[]],teamScore:[0,0,0],spatula:{coords:{x:0,y:0,z:0},controlledBy:0,controlledByTeam:0},kotc:{stage:CoopState.Capturing,zoneIdx:0,activeZone:[],teamCapturing:0,captureProgress:0,numCapturing:0,capturePercent:0}},this.#initialGame=JSON.parse(JSON.stringify(this.game)),this.account={id:0,firebase:{idToken:"",refreshToken:"",expiresIn:"3600",localId:""},firebaseId:"",sessionId:"",session:0,email:"",password:"",cw:{atLimit:!1,limit:0,secondsUntilPlay:0,canPlayAgain:Date.now()},loadout:{hatId:null,meleeId:0,stampId:null,classIdx:0,colorIdx:0,grenadeId:0,primaryId:[3100,3600,3400,3800,4000,4200,4500],secondaryId:[,,,,,,,].fill(3000),stampPositionX:0,stampPositionY:0},ownedItemIds:[],vip:!1,emailVerified:!1,isAged:!1,isCG:!1,adminRoles:0,rawLoginData:{},eggBalance:0},this.#initialAccount=JSON.parse(JSON.stringify(this.account)),this.api=new api_default({proxy:this.proxy,protocol:this.protocol,instance:this.instance,connectionTimeout:this.connectionTimeout}),this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.pathing={nodeList:null,activePath:null,activeNode:null,activeNodeIdx:0},this.hasQuit=!1,this.intents.includes(Intents.NO_AFK_KICK))this.afkKickInterval=0;if(this.intents.includes(Intents.RENEW_SESSION))this.renewSessionInterval=0}dispatch(dispatch,isEmit){if(dispatch.validate(this)){if(dispatch.check(this))dispatch.execute(this);else this.#dispatches.push(dispatch);return!0}return this.errorLogger(`${isEmit?"emit":"dispatch"}: validation failed for dispatch ${dispatch.constructor.name}`),this.errorLogger("this means the dispatch will NEVER RUN!"),this.errorLogger("make sure all parameters are valid and that any player IDs are in the game"),!1}async createAccount(email,pass){this.account=this.#initialAccount,this.account.email=email,this.account.password=pass;let loginData=await this.api.createAccount(email,pass);return this.processLoginData(loginData)}async login(email,pass){this.account=this.#initialAccount,this.account.email=email,this.account.password=pass;let loginData=await this.api.loginWithCredentials(email,pass);return this.processLoginData(loginData)}async loginWithRefreshToken(refreshToken){this.account=this.#initialAccount;let loginData=await this.api.loginWithRefreshToken(refreshToken);return this.processLoginData(loginData)}async loginAnonymously(){this.account=this.#initialAccount;let loginData=await this.api.loginAnonymously();return this.processLoginData(loginData)}processLoginData(loginData){if(!loginData.ok||!loginData.playerOutput){if(this.$emit("authFail",loginData),loginData.ok&&!loginData.playerOutput)this.errorLogger("processLoginData: missing playerOutput but is ok",loginData);return{...loginData,error:LoginError.InternalError,ok:!1}}if(loginData.banRemaining)return this.$emit("banned",loginData.banRemaining),createError(LoginError.AccountBanned);this.account.firebase=loginData.firebase;let output=loginData.playerOutput;if(this.account.rawLoginData=output,this.account.adminRoles=output.adminRoles||0,this.account.eggBalance=output.currentBalance,this.account.emailVerified=output.emailVerified,this.account.firebaseId=output.firebaseId,this.account.id=output.id,this.account.isAged=new Date(output.dateCreated).getTime()<1714546800000,this.account.isCG=output.cgAccountStatus?.hasAccount,this.account.loadout=output.loadout,this.account.ownedItemIds=output.ownedItemIds,this.account.session=output.session,this.account.sessionId=output.sessionId,this.account.vip=output.active_sub==="IsVIP",this.intents.includes(Intents.BOT_STATS))this.account.stats={lifetime:output.statsLifetime,monthly:output.statsCurrent};if(this.intents.includes(Intents.CHALLENGES))this.#importChallenges(output.challenges);if(this.$emit("authSuccess",this.account),this.intents.includes(Intents.RENEW_SESSION))this.renewSessionInterval=setInterval(async()=>{if(!this.account?.sessionId)return clearInterval(this.renewSessionInterval);if((await this.api.queryServices({cmd:"renewSession",sessionId:this.account.sessionId})).data!=="renewed")this.$emit("sessionExpired")},600000);return{ok:!0,account:this.account}}#importChallenges(challengeArray){this.account.challenges=[];for(let challengeData of challengeArray){let challengeInfo=Challenges.find((c)=>c.id===challengeData.challengeId);if(!challengeInfo)continue;delete challengeData.playerId,this.account.challenges.push({raw:{challengeInfo,challengeData},id:challengeData.challengeId,name:challengeInfo.loc.title,desc:challengeInfo.loc.desc,rewardEggs:challengeInfo.reward,isRerolled:!!challengeData.reset,isClaimed:!!challengeData.claimed,isCompleted:!!challengeData.completed,progressNum:challengeData.progress,goalNum:challengeInfo.goal})}}async createMatchmaker(){let matchmaker=new socket_default(`${this.protocol}://${this.instance}/matchmaker/`,{proxy:this.proxy,errorLogger:this.errorLogger});if(matchmaker.autoReconnect=!0,!await matchmaker.tryConnect())return createError(MatchmakerError.WebSocketConnectFail);this.matchmaker=matchmaker;let uuidTimeouts=[];return this.matchmaker.onmessage=async(e)=>{let data=JSON.parse(e.data);if(data.command==="validateUUID"){let timeout=setTimeout(()=>{console.error("createMatchmaker: the matchmaker did not respond to our validateUUID"),console.error("createMatchmaker: report this issue at https://yolkbot.xyz/community")},5000);return uuidTimeouts.push(timeout),this.matchmaker.send(JSON.stringify({command:"validateUUID",hash:await validate(data.uuid)}))}if(uuidTimeouts.length)uuidTimeouts.forEach((t)=>clearTimeout(t)),uuidTimeouts.length=0;this.matchmakerListeners.forEach((listener)=>listener(data))},{ok:!0}}async getRegions(){if(!this.matchmaker){let mmConnection=await this.createMatchmaker();if(!mmConnection.ok)return mmConnection}return new Promise((res)=>{let listener=(data)=>{if(data.command==="regionList")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),this.regionList=data.regionList,res({ok:!0,regionList:this.regionList})};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"regionList"}))})}async initSession(){if(!this.account.sessionId&&!this.intents.includes(Intents.SKIP_LOGIN)){let anonLogin=await this.loginAnonymously();if(!anonLogin.ok)return anonLogin}if(!this.matchmaker){let mmConnection=await this.createMatchmaker();if(!mmConnection.ok)return mmConnection}return{ok:!0}}async findPublicGame(region,mode){if(typeof region!=="string")return createError(GameFindError.MissingParams);if(!(this.regionList.length?this.regionList:Regions).find((r)=>r.id===region))return createError(GameFindError.InvalidRegion);let computedModeId;if(typeof mode==="number")if(Object.values(GameMode).indexOf(mode)>-1)computedModeId=mode;else return createError(GameFindError.InvalidMode);else if(typeof mode==="string"){let modeEntry=Object.keys(GameMode).find((key)=>key.toLowerCase()===mode.toLowerCase());if(modeEntry)computedModeId=GameMode[modeEntry];else return createError(GameFindError.InvalidMode)}else return createError(GameFindError.InvalidMode);let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;let game=await new Promise((resolve)=>{let listener=(msg)=>{if(msg.command==="notice")return;if(this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),msg.command==="gameFound"){if(msg.useAltGameURL)this.state.useAltGameURL=!0;return resolve(msg)}if(msg.error==="sessionNotFound")return resolve(createError(GameFindError.SessionExpired));this.errorLogger("findPublicGame: unknown matchmaker response",JSON.stringify(msg)),resolve(createError(GameFindError.InternalError))};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"findGame",region,playType:PlayType.JoinPublic,gameType:computedModeId,sessionId:this.account.sessionId}))});if(!game.id)return game;return{ok:!0,raw:game,id:game.id,uuid:game.uuid,region:game.region,private:game.private,subdomain:game.subdomain}}async createPrivateGame(region,mode,map){if(typeof region!=="string")return createError(GameFindError.MissingParams);if(!(this.regionList.length?this.regionList:Regions).find((r)=>r.id===region))return createError(GameFindError.InvalidRegion);let computedModeId;if(typeof mode==="number")if(Object.values(GameMode).indexOf(mode)>-1)computedModeId=mode;else return createError(GameFindError.InvalidMode);else if(typeof mode==="string"){let modeEntry=Object.keys(GameMode).find((key)=>key.toLowerCase()===mode.toLowerCase());if(modeEntry)computedModeId=GameMode[modeEntry];else return createError(GameFindError.InvalidMode)}else return createError(GameFindError.InvalidMode);let mapIdx=Maps.findIndex((m)=>m.name.toLowerCase()===map.toLowerCase());if(mapIdx===-1)return createError(GameFindError.InvalidMap);let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;let game=await new Promise((resolve)=>{let listener=(msg)=>{if(msg.command==="notice")return;if(this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),msg.command==="gameFound"){if(msg.useAltGameURL)this.state.useAltGameURL=!0;return resolve(msg)}if(msg.error==="sessionNotFound")return resolve(createError(GameFindError.SessionExpired));this.errorLogger("createPrivateGame: unknown matchmaker response",JSON.stringify(msg)),resolve(createError(GameFindError.InternalError))};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"findGame",region,playType:PlayType.CreatePrivate,gameType:computedModeId,sessionId:this.account.sessionId,noobLobby:!1,map:mapIdx}))});if(!game.id)return game;return{ok:!0,raw:game,id:game.id,uuid:game.uuid,region:game.region,private:game.private,subdomain:game.subdomain}}async join(name,data){if(this.state.name=name||"yolkbot",typeof data==="string"){if(data.includes("#"))data=data.split("#")[1];let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;if(await new Promise((resolve)=>{let listener=(message)=>{if(message.command==="gameFound")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),this.game.raw=message,this.game.code=message.id,this.game.region=message.region,resolve(message.id);if(message.error&&message.error==="gameNotFound")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),resolve("gameNotFound")};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"joinGame",id:data,observe:!1,sessionId:this.account.sessionId}))})==="gameNotFound")return createError(GameJoinError.GameNotFound);if(!this.game.raw.id)return this.errorLogger("join: invalid game data received from matchmaker:",this.game.raw),createError(GameJoinError.InternalError)}else if(typeof data==="object"){if(!data.id||!data.subdomain||!data.uuid||!data.region)return createError(GameJoinError.InvalidObject);if(this.account.id===0){let anonAttempt=await this.loginAnonymously();if(!anonAttempt.ok)return anonAttempt}this.game.raw=data,this.game.code=this.game.raw.id,this.game.region=this.game.raw.region}else return createError(GameJoinError.MissingParams);let host=this.state.useAltGameURL||this.instance==="proxy.yolkbot.xyz"?`${this.instance}/servers/${this.game.raw.subdomain}`:`${this.game.raw.subdomain}.${this.instance}`;if(this.game.socket=new socket_default(`${this.protocol}://${host}/game/${this.game.raw.id}`,{proxy:this.proxy,errorLogger:this.errorLogger}),this.game.socket.binaryType="arraybuffer",this.game.socket.connectionTimeout=this.connectionTimeout,this.game.socket.onBeforeConnect=()=>{this.game.socket.onmessage=(msg)=>this.processPacket(msg.data),this.game.socket.onclose=(e)=>{if(this.state?.inGame)this.$emit("close",e.code),this.leave(-1)}},!await this.game.socket.tryConnect())return createError(GameJoinError.WebSocketConnectFail);return{ok:!0}}#processMovement(ndx,ndy,ndz){this.state.onGround=Math.max(--this.state.onGround,0),this.me.position.x+=ndx,this.me.position.y+=ndy,this.me.position.z+=ndz;let thisBlockX=Math.floor(this.me.position.x),thisBlockY=Math.floor(this.me.position.y),thisBlockZ=Math.floor(this.me.position.z),blockInMyHitbox=this.pathing.nodeList.at(thisBlockX,thisBlockY,thisBlockZ);if(blockInMyHitbox&&!blockInMyHitbox.isAir()){if(!this.climbing&&blockInMyHitbox.isLadder());}if(this.me.climbing);else if(blockInMyHitbox&&blockInMyHitbox.isJumpPad())this.me.position.y+=0.26,this.me.jumping=!0,this.state.onGround=0}#processPathfinding(){let pathLen=this.pathing.activePath.length,lastNode=this.pathing.activePath[pathLen-1],myPos=this.me.position,myFloorY=Math.floor(myPos.y);if(Math.hypot(myPos.x-lastNode.flatCenter.x,myPos.z-lastNode.flatCenter.z)<0.3)this.pathing.activePath=null,this.pathing.activeNode=null,this.pathing.activeNodeIdx=0,this.dispatch(new MovementDispatch_default(0)),this.$emit("pathfindComplete");else{let shouldJump=!1;if(this.pathing.activeNodeIdx<pathLen-1){let currentNode=this.pathing.activePath[this.pathing.activeNodeIdx],nextNode=this.pathing.activePath[this.pathing.activeNodeIdx+1],dx=Math.abs(currentNode.x-nextNode.x),dz=Math.abs(currentNode.z-nextNode.z);if(dx===2&&dz===0||dx===0&&dz===2||dx===2&&dz===1||dx===1&&dz===2||dx===2&&dz===2){let localX=myPos.x-Math.floor(myPos.x),localZ=myPos.z-Math.floor(myPos.z),headingX=nextNode.x>currentNode.x?1:nextNode.x<currentNode.x?-1:0,headingZ=nextNode.z>currentNode.z?1:nextNode.z<currentNode.z?-1:0,distToEdge=0;if(headingX>0)distToEdge=1-localX;else if(headingX<0)distToEdge=localX;else if(headingZ>0)distToEdge=1-localZ;else if(headingZ<0)distToEdge=localZ;if(distToEdge<=0.04)shouldJump=!0}}if(this.pathing.activeNodeIdx<pathLen){let positionTarget=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter;if(this.state.onGround)this.dispatch(new LookAtPosDispatch_default(positionTarget))}for(let i=this.pathing.activeNodeIdx;i<pathLen;i++){let node=this.pathing.activePath[i];if(node.flatRadialDistance(myPos)<0.1&&node.y===myFloorY){this.pathing.activeNodeIdx=i+1,this.pathing.activeNode=this.pathing.activePath[this.pathing.activeNodeIdx];break}}let movementKeys=Movement.Forward|(shouldJump?Movement.Jump:0);this.dispatch(new MovementDispatch_default(movementKeys))}}update(){if(this.hasQuit)return;if(this.pathing.activePath&&this.intents.includes(Intents.PATHFINDING))this.#processPathfinding();for(let i=this.#dispatches.length-1;i>=0;i--){let disp=this.#dispatches[i];if(disp.check(this))disp.execute(this),this.#dispatches.splice(i,1)}if(this.state.chatLines=Math.max(0,this.state.chatLines-0.008333333333333333),this.me.playing){let currentIdx=this.state.stateIdx,isBufferDebug=this.intents.includes(Intents.DEBUG_BUFFER);if(isBufferDebug)console.log("setting buffer for idx",currentIdx);if(this.me.jumping=!!(this.state.controlKeys&Movement.Jump),this.state.buffer[currentIdx]={controlKeys:this.state.controlKeys,yaw:this.state.yaw,pitch:this.state.pitch,shotsFired:this.state.shotsFired,position:isBufferDebug?{...this.me.position}:{}},this.state.shotsFired=0,this.intents.includes(Intents.SIMULATION)){let dx=0,dy=0,dz=0,state=this.state.buffer[currentIdx];if(state.controlKeys&Movement.Left)dx-=Math.cos(state.yaw),dz+=Math.sin(state.yaw);if(state.controlKeys&Movement.Right)dx+=Math.cos(state.yaw),dz-=Math.sin(state.yaw);if(state.controlKeys&Movement.Forward)if(this.me.climbing)dy+=1;else dx-=Math.sin(state.yaw),dz-=Math.cos(state.yaw);if(state.controlKeys&Movement.Backward)if(this.me.climbing)dy-=1;else dx+=Math.sin(state.yaw),dz+=Math.cos(state.yaw);if(state.controlKeys&Movement.Jump)this.state.controlKeys^=this.state.controlKeys&Movement.Jump;if(this.me.climbing)this.me.jumping=!1,dy+=dy*0.028,this.me.position.y+=dy,dy*=0.5,this.#processMovement(0,dy,0);else{let mag=Math.sqrt(dx*dx+dy*dy+dz*dz);if(mag>0){let normDx=dx/mag,normDz=dz/mag;dx=this.state.dx+normDx*0.025,dz=this.state.dz+normDz*0.025}else dx=this.state.dx,dz=this.state.dz;dy=this.state.dy-this.game.options.gravity*0.012,dy=Math.max(-0.29,dy);let oldX=this.me.position.x,oldY=this.me.position.y,oldZ=this.me.position.z;if(this.#processMovement(dx,dy,dz),dx=this.me.position.x-oldX,dy=this.me.position.y-oldY,dz=this.me.position.z-oldZ,this.state.onGround&&dy>0){let n=1-(mag===0?0:dy/mag)*0.5;dx*=n,dz*=n}}if(dx*=0.64,dz*=0.64,this.me.climbing)dy*=0.64;this.state.dx=dx,this.state.dy=dy,this.state.dz=dz}if(this.state.stateIdx%FramesBetweenSyncs===0){this.$emit("tick");let out=new CommOut_default;out.packInt8(CommCode_default.syncMe),out.packInt8(this.state.stateIdx),out.packInt8(this.state.serverStateIdx);let startIdx=mod3(this.state.stateIdx-FramesBetweenSyncs+1,StateBufferSize);if(isBufferDebug)console.log("--- START THIS SYNC LOGGING ---");for(let i=0;i<FramesBetweenSyncs;i++){let idx=mod3(startIdx+i,StateBufferSize),frame=this.state.buffer[idx]||{},keys=frame.controlKeys||0,shots=frame.shotsFired||0,yaw=frame.yaw??this.state.yaw,pitch=frame.pitch??this.state.pitch;if(isBufferDebug)console.log("adding",this.state.stateIdx,startIdx,idx,frame);out.packInt8(keys),out.packInt8(shots),out.packString(coords(yaw,pitch)),out.packInt8(100)}if(out.send(this.game.socket),isBufferDebug)console.log("--- END SYNC LOGGING ---");this.state.buffer=[]}this.state.stateIdx=mod3(this.state.stateIdx+1,StateBufferSize)}if(!this.intents.includes(Intents.PLAYER_HEALTH))return;let regen=0.1*(this.game.isPrivate?this.game.options.healthRegen:1),players=Object.values(this.players);for(let i=0;i<players.length;i++){let player=players[i];if(player.playing&&player.hp>0){let hasOverHeal=player.streakRewards.includes(ShellStreak.OverHeal);player.hp+=hasOverHeal?-regen:regen,player.hp=hasOverHeal?Math.max(100,player.hp):Math.min(100,player.hp)}if(player.spawnShield>0)player.spawnShield-=6}}on(event,cb){if(Object.keys(this.#hooks).includes(event))this.#hooks[event].push(cb);else this.#hooks[event]=[cb]}onAny(cb){this.#globalHooks.push(cb)}off(event,cb){if(cb)this.#hooks[event]=this.#hooks[event].filter((hook)=>hook!==cb);else this.#hooks[event]=[]}$emit(event,...args){if(this.hasQuit)return;if(this.#hooks[event])for(let cb of this.#hooks[event])cb(...args);for(let cb of this.#globalHooks)cb(event,...args)}emit(event,...args){let dispatch=DispatchIndex[event];if(dispatch)this.dispatch(new dispatch(...args),!0);else throw Error(`no event found for "${event}"`)}updateGameOptions(){let out=new CommOut_default;out.packInt8(CommCode_default.gameOptions),out.packInt8(this.game.options.gravity*4),out.packInt8(this.game.options.damage*4),out.packInt8(this.game.options.healthRegen*4);let flags=(this.game.options.locked?1:0)|(this.game.options.noTeamChange?2:0)|(this.game.options.noTeamShuffle?4:0);out.packInt8(flags),this.game.options.weaponsDisabled.forEach((v)=>out.packInt8(v?1:0)),out.send(this.game.socket)}packetHandlers={[CommCode_default.syncThem]:syncThem_default.bind(null,this),[CommCode_default.fire]:fire_default.bind(null,this),[CommCode_default.hitThem]:hitThem_default.bind(null,this),[CommCode_default.syncMe]:syncMe_default.bind(null,this),[CommCode_default.hitMe]:hitMe_default.bind(null,this),[CommCode_default.swapWeapon]:swapWeapon_default.bind(null,this),[CommCode_default.collectItem]:collectItem_default.bind(null,this),[CommCode_default.respawn]:respawn_default.bind(null,this),[CommCode_default.die]:die_default.bind(null,this),[CommCode_default.pause]:pause_default.bind(null,this),[CommCode_default.chat]:chat_default.bind(null,this),[CommCode_default.addPlayer]:addPlayer_default.bind(null,this),[CommCode_default.removePlayer]:removePlayer_default.bind(null,this),[CommCode_default.eventModifier]:eventModifier_default.bind(null,this),[CommCode_default.metaGameState]:metaGameState_default.bind(null,this),[CommCode_default.beginShellStreak]:beginShellStreak_default.bind(null,this),[CommCode_default.endShellStreak]:endShellStreak_default.bind(null,this),[CommCode_default.hitMeHardBoiled]:hitMeHardBoiled_default.bind(null,this),[CommCode_default.gameOptions]:gameOptions_default.bind(null,this),[CommCode_default.ping]:ping_default.bind(null,this),[CommCode_default.switchTeam]:switchTeam_default.bind(null,this),[CommCode_default.changeCharacter]:changeCharacter_default.bind(null,this),[CommCode_default.reload]:reload_default.bind(null,this),[CommCode_default.explode]:explode_default.bind(null,this),[CommCode_default.throwGrenade]:throwGrenade_default.bind(null,this),[CommCode_default.spawnItem]:spawnItem_default.bind(null,this),[CommCode_default.melee]:melee_default.bind(null,this),[CommCode_default.updateBalance]:updateBalance_default.bind(null,this),[CommCode_default.challengeCompleted]:challengeCompleted_default.bind(null,this),[CommCode_default.gameAction]:gameAction_default.bind(null,this),[CommCode_default.socketReady]:socketReady_default.bind(null,this),[CommCode_default.gameJoined]:gameJoined_default.bind(null,this),[CommCode_default.playerInfo]:playerInfo_default.bind(null,this),[CommCode_default.respawnDenied]:()=>{this.me.playing=!1,this.$emit("respawnDenied")},[CommCode_default.requestGameOptions]:()=>{this.game.isPrivate=!0,this.updateGameOptions()},[CommCode_default.expireUpgrade]:()=>{},[CommCode_default.clientReady]:()=>{},[CommCode_default.musicInfo]:()=>CommIn_default.unPackLongString()};processPacket(packet){if(this.hasQuit)return;if(CommIn_default.init(packet),this.intents.includes(Intents.PACKET_HOOK))this.$emit("packet",packet);let lastCommand=0,lastCode=0;while(CommIn_default.isMoreDataAvailable()){let cmd=CommIn_default.unPackInt8U(),handler=this.packetHandlers[cmd];if(handler)handler();else{if(console.error(`processPacket: got but couldn't identify: ${Object.keys(CommCode_default).find((k)=>CommCode_default[k]===cmd)} ${cmd}`),lastCommand)console.error(`processPacket: it may be a result of the ${lastCommand} command (${lastCode}).`);break}if(lastCommand=Object.keys(CommCode_default).find((k)=>CommCode_default[k]===cmd),lastCode=cmd,this.intents.includes(Intents.LOG_PACKETS))console.log(`[LOG_PACKETS] packet ${lastCommand}: ${lastCode}`)}}async checkChiknWinner(){let response=await this.api.queryServices({cmd:"chicknWinnerReady",id:this.account.id,sessionId:this.account.sessionId});if(!response.ok)return response;return this.account.cw.limit=response.limit,this.account.cw.atLimit=response.limit>=4,this.account.cw.secondsUntilPlay=(this.account.cw.atLimit?response.period:response.span)||0,this.account.cw.canPlayAgain=Date.now()+this.account.cw.secondsUntilPlay*1000,{ok:!0,cw:this.account.cw}}async playChiknWinner(doPrematureCooldownCheck=!0){if(this.account.cw.atLimit||this.account.cw.limit>ChiknWinnerDailyLimit)return createError(ChicknWinnerError.HitDailyLimit);if(this.account.cw.canPlayAgain>Date.now()&&doPrematureCooldownCheck)return createError(ChicknWinnerError.OnCooldown);let response=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});if(!response.ok)return response;if(response.error){if(response.error==="RATELIMITED"||response.error==="RATELMITED")return await this.checkChiknWinner(),createError(ChicknWinnerError.OnCooldown);else if(response.error==="SESSION_EXPIRED")return this.$emit("sessionExpired"),createError(ChicknWinnerError.SessionExpired);return this.errorLogger("unknown Chikn Winner response:",response),this.errorLogger("report this issue at https://yolkbot.xyz/community"),createError(ChicknWinnerError.InternalError)}if(response.reward)return this.account.eggBalance+=response.reward.eggsGiven,response.reward.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),await this.checkChiknWinner(),{ok:!0,...response.reward};return this.errorLogger("unknown Chikn Winner response:",response),this.errorLogger("report this issue at https://yolkbot.xyz/community"),createError(ChicknWinnerError.InternalError)}async resetChiknWinner(){if(this.account.eggBalance<200)return createError(ChicknWinnerError.NotEnoughResetEggs);if(!this.account.cw.atLimit)return createError(ChicknWinnerError.NotAtDailyLimit);let response=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});if(!response.ok)return response;if(response.result!=="SUCCESS")return this.errorLogger("unknown Chikn Winner reset response:",response),this.errorLogger("report this issue at https://yolkbot.xyz/community"),createError(ChicknWinnerError.InternalError);return this.account.eggBalance-=200,await this.checkChiknWinner(),{ok:!0,cw:this.account.cw}}canSee(target){if(!this.intents.includes(Intents.PATHFINDING))throw Error("canSee: you need enable the PATHFINDING intent");return this.pathing.nodeList.hasLineOfSight(this.me.position,target.position)}getBestTarget(){let distancePlayers=Object.values(this.players).filter((player)=>player?.playing).filter((player)=>player.hp>0).filter((player)=>player.id!==this.me.id).filter((player)=>this.me.team===0||player.team!==this.me.team).map((player)=>({player,distance:(player.position.x-this.me.position.x)**2+5*(player.position.y-this.me.position.y)**2+(player.position.z-this.me.position.z)**2})).sort((a,b)=>a.distance-b.distance);if(distancePlayers.length)return distancePlayers[0].player;else return null}async refreshChallenges(){let result=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});if(!result.ok)return result;return this.#importChallenges(result),{ok:!0,challenges:this.account.challenges}}async rerollChallenge(challengeId){let result=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:challengeId});if(!result.ok)return result;if(result["0"])return this.#importChallenges(Object.values(result)),{ok:!0,challenges:this.account.challenges};if(Object.values(ChallengeRerollError).includes(result.error))return{ok:!1,error:result.error};return this.errorLogger("rerollChallenge: unknown error response",result),{ok:!1,error:ChallengeRerollError.InternalError}}async claimChallenge(challengeId){let result=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:challengeId});if(!result.ok)return result;if(result.reward){if(this.#importChallenges(result.challenges),result.reward>0)this.account.eggBalance+=result.reward;return{ok:!0,eggReward:result.reward,updatedChallenges:this.account.challenges}}if(Object.values(ChallengeClaimError).includes(result.error))return{ok:!1,error:result.error};return this.errorLogger("claimChallenge: unknown error response",result),{ok:!1,error:ChallengeClaimError.InternalError}}async refreshBalance(){let result=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});if(!result.ok)return result;return this.account.eggBalance=result.currentBalance,{ok:!0,currentBalance:result.currentBalance}}async redeemCode(code){let result=await this.api.queryServices({cmd:"redeem",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,id:this.account.id,code});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggs_given,result.item_ids.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggs_given,itemIds:result.item_ids};if(Object.values(RedeemCodeError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("redeemCode: unknown error response",result),{ok:!1,error:RedeemCodeError.InternalError}}async claimURLReward(reward){let result=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggsGiven,result.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggsGiven,itemIds:result.itemIds};if(Object.values(ClaimURLError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("claimURLReward: unknown error response",result),{ok:!1,error:ClaimURLError.InternalError}}async claimSocialReward(rewardTag){let result=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggsGiven,result.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggsGiven,itemIds:result.itemIds};if(Object.values(ClaimSocialError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("claimSocialReward: unknown error response",result),{ok:!1,error:ClaimSocialError.InternalError}}async buyItem(itemId){let result=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId,save:!0});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance=result.currentBalance,this.account.ownedItemIds.push(result.itemId),{ok:!0,itemId:result.itemId,currentBalance:result.currentBalance};if(Object.values(BuyItemError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("buyItem: unknown error response",result),{ok:!1,error:BuyItemError.InternalError}}leave(code=CloseCode_default.mainMenu){if(this.hasQuit)return;if(this.state.inGame=!1,code>-1)this.game?.socket?.close(code),this.$emit("leave",code);if(this.updateIntervalId)clearInterval(this.updateIntervalId);if(this.pingTimeoutId)clearTimeout(this.pingTimeoutId);this.#dispatches=[],this.state.chatLines=0,this.state.reloading=!1,this.state.swappingGun=!1,this.state.usingMelee=!1,this.state.stateIdx=0,this.state.serverStateIdx=0,this.state.shotsFired=0,this.state.buffer=[],this.players={},this.me=new GamePlayer_default({}),this.game=this.#initialGame,this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.pathing={nodeList:null,activePath:null,activeNode:null,activeNodeIdx:0}}logout(){if(this.account=this.#initialAccount,this.intents.includes(Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval)}quit(cleanupLevel=CleanupLevel.Partial){if(this.hasQuit)return;if(this.hasQuit=!0,this.leave(),this.matchmaker){try{this.matchmaker.close()}catch{}if(cleanupLevel>=CleanupLevel.Partial)this.matchmaker=null}if(this.intents.includes(Intents.NO_AFK_KICK))clearInterval(this.afkKickInterval);if(this.intents.includes(Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval);if(this.pingTimeoutId)clearTimeout(this.pingTimeoutId);if(cleanupLevel>=CleanupLevel.Partial){if(this.api=null,this.packetHandlers=null,this.pathing=null,this.#initialAccount={},this.#initialGame={},this.#hooks={},this.#globalHooks=[],this.#dispatches=[],this.matchmakerListeners=[],cleanupLevel>=CleanupLevel.Full)this.account=null,this.game=null,this.me=null,this.players=null,this.state=null}}}var yolkbot={API,Bot,Enums:exports_enums,yolkws,util:exports_util,GamePlayer,Comm:{CommIn,CommOut},Constants:exports_constants,Challenges,CloseCode,CommCode,Guns:exports_guns,Items:[],Maps,Regions,Dispatches:dispatches_default,WASM:exports_direct};window.yolkbot=yolkbot;
1
+ var{defineProperty:__defProp,getOwnPropertyNames:__getOwnPropNames,getOwnPropertyDescriptor:__getOwnPropDesc}=Object,__hasOwnProp=Object.prototype.hasOwnProperty;function __accessProp(key){return this[key]}var __toCommonJS=(from)=>{var entry=(__moduleCache??=new WeakMap).get(from),desc;if(entry)return entry;if(entry=__defProp({},"__esModule",{value:!0}),from&&typeof from==="object"||typeof from==="function"){for(var key of __getOwnPropNames(from))if(!__hasOwnProp.call(entry,key))__defProp(entry,key,{get:__accessProp.bind(from,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return __moduleCache.set(from,entry),entry},__moduleCache,__commonJS=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports);var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0,configurable:!0,set:__exportSetter.bind(all,name)})};var __esm=(fn,res)=>()=>(fn&&(res=fn(fn=0)),res);var __require=((x)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});var exports_buffer={};__export(exports_buffer,{transcode:()=>transcode,resolveObjectURL:()=>resolveObjectURL,kStringMaxLength:()=>kStringMaxLength,kMaxLength:()=>kMaxLength,isUtf8:()=>isUtf8,isAscii:()=>isAscii,default:()=>buffer_default,constants:()=>constants,btoa:()=>btoa,atob:()=>atob,INSPECT_MAX_BYTES:()=>INSPECT_MAX_BYTES,File:()=>File,Buffer:()=>Buffer2,Blob:()=>Blob});function getLens(b64){var len2=b64.length;if(len2%4>0)throw Error("Invalid string. Length must be a multiple of 4");var validLen=b64.indexOf("=");if(validLen===-1)validLen=len2;var placeHoldersLen=validLen===len2?0:4-validLen%4;return[validLen,placeHoldersLen]}function _byteLength(validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function toByteArray(b64){var tmp,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Uint8Array(_byteLength(validLen,placeHoldersLen)),curByte=0,len2=placeHoldersLen>0?validLen-4:validLen,i2;for(i2=0;i2<len2;i2+=4)tmp=revLookup[b64.charCodeAt(i2)]<<18|revLookup[b64.charCodeAt(i2+1)]<<12|revLookup[b64.charCodeAt(i2+2)]<<6|revLookup[b64.charCodeAt(i2+3)],arr[curByte++]=tmp>>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=tmp&255;if(placeHoldersLen===2)tmp=revLookup[b64.charCodeAt(i2)]<<2|revLookup[b64.charCodeAt(i2+1)]>>4,arr[curByte++]=tmp&255;if(placeHoldersLen===1)tmp=revLookup[b64.charCodeAt(i2)]<<10|revLookup[b64.charCodeAt(i2+1)]<<4|revLookup[b64.charCodeAt(i2+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=tmp&255;return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp,output=[];for(var i2=start;i2<end;i2+=3)tmp=(uint8[i2]<<16&16711680)+(uint8[i2+1]<<8&65280)+(uint8[i2+2]&255),output.push(tripletToBase64(tmp));return output.join("")}function fromByteArray(uint8){var tmp,len2=uint8.length,extraBytes=len2%3,parts=[],maxChunkLength=16383;for(var i2=0,len22=len2-extraBytes;i2<len22;i2+=maxChunkLength)parts.push(encodeChunk(uint8,i2,i2+maxChunkLength>len22?len22:i2+maxChunkLength));if(extraBytes===1)tmp=uint8[len2-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==");else if(extraBytes===2)tmp=(uint8[len2-2]<<8)+uint8[len2-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"=");return parts.join("")}function read(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i2=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i2];i2+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i2],i2+=d,nBits-=8);m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i2],i2+=d,nBits-=8);if(e===0)e=1-eBias;else if(e===eMax)return m?NaN:(s?-1:1)*(1/0);else m=m+Math.pow(2,mLen),e=e-eBias;return(s?-1:1)*m*Math.pow(2,e-mLen)}function write(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i2=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;if(value=Math.abs(value),isNaN(value)||value===1/0)m=isNaN(value)?1:0,e=eMax;else{if(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1)e--,c*=2;if(e+eBias>=1)value+=rt/c;else value+=rt*Math.pow(2,1-eBias);if(value*c>=2)e++,c/=2;if(e+eBias>=eMax)m=0,e=eMax;else if(e+eBias>=1)m=(value*c-1)*Math.pow(2,mLen),e=e+eBias;else m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0}for(;mLen>=8;buffer[offset+i2]=m&255,i2+=d,m/=256,mLen-=8);e=e<<mLen|m,eLen+=mLen;for(;eLen>0;buffer[offset+i2]=e&255,i2+=d,e/=256,eLen-=8);buffer[offset+i2-d]|=s*128}function createBuffer(length){if(length>kMaxLength)throw RangeError('The value "'+length+'" is invalid for option "size"');let buf=new Uint8Array(length);return Object.setPrototypeOf(buf,Buffer2.prototype),buf}function E(sym,getMessage,Base){return class extends Base{constructor(){super();Object.defineProperty(this,"message",{value:getMessage.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${sym}]`,this.stack,delete this.name}get code(){return sym}set code(value){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value,writable:!0})}toString(){return`${this.name} [${sym}]: ${this.message}`}}}function Buffer2(arg,encodingOrOffset,length){if(typeof arg==="number"){if(typeof encodingOrOffset==="string")throw TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}function from(value,encodingOrOffset,length){if(typeof value==="string")return fromString(value,encodingOrOffset);if(ArrayBuffer.isView(value))return fromArrayView(value);if(value==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof value);if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer))return fromArrayBuffer(value,encodingOrOffset,length);if(typeof SharedArrayBuffer<"u"&&(isInstance(value,SharedArrayBuffer)||value&&isInstance(value.buffer,SharedArrayBuffer)))return fromArrayBuffer(value,encodingOrOffset,length);if(typeof value==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let valueOf=value.valueOf&&value.valueOf();if(valueOf!=null&&valueOf!==value)return Buffer2.from(valueOf,encodingOrOffset,length);let b=fromObject(value);if(b)return b;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof value[Symbol.toPrimitive]==="function")return Buffer2.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof value)}function assertSize(size){if(typeof size!=="number")throw TypeError('"size" argument must be of type number');else if(size<0)throw RangeError('The value "'+size+'" is invalid for option "size"')}function alloc(size,fill,encoding){if(assertSize(size),size<=0)return createBuffer(size);if(fill!==void 0)return typeof encoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill);return createBuffer(size)}function allocUnsafe(size){return assertSize(size),createBuffer(size<0?0:checked(size)|0)}function fromString(string,encoding){if(typeof encoding!=="string"||encoding==="")encoding="utf8";if(!Buffer2.isEncoding(encoding))throw TypeError("Unknown encoding: "+encoding);let length=byteLength(string,encoding)|0,buf=createBuffer(length),actual=buf.write(string,encoding);if(actual!==length)buf=buf.slice(0,actual);return buf}function fromArrayLike(array){let length=array.length<0?0:checked(array.length)|0,buf=createBuffer(length);for(let i2=0;i2<length;i2+=1)buf[i2]=array[i2]&255;return buf}function fromArrayView(arrayView){if(isInstance(arrayView,Uint8Array)){let copy=new Uint8Array(arrayView);return fromArrayBuffer(copy.buffer,copy.byteOffset,copy.byteLength)}return fromArrayLike(arrayView)}function fromArrayBuffer(array,byteOffset,length){if(byteOffset<0||array.byteLength<byteOffset)throw RangeError('"offset" is outside of buffer bounds');if(array.byteLength<byteOffset+(length||0))throw RangeError('"length" is outside of buffer bounds');let buf;if(byteOffset===void 0&&length===void 0)buf=new Uint8Array(array);else if(length===void 0)buf=new Uint8Array(array,byteOffset);else buf=new Uint8Array(array,byteOffset,length);return Object.setPrototypeOf(buf,Buffer2.prototype),buf}function fromObject(obj){if(Buffer2.isBuffer(obj)){let len2=checked(obj.length)|0,buf=createBuffer(len2);if(buf.length===0)return buf;return obj.copy(buf,0,0,len2),buf}if(obj.length!==void 0){if(typeof obj.length!=="number"||Number.isNaN(obj.length))return createBuffer(0);return fromArrayLike(obj)}if(obj.type==="Buffer"&&Array.isArray(obj.data))return fromArrayLike(obj.data)}function checked(length){if(length>=kMaxLength)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength.toString(16)+" bytes");return length|0}function byteLength(string,encoding){if(Buffer2.isBuffer(string))return string.length;if(ArrayBuffer.isView(string)||isInstance(string,ArrayBuffer))return string.byteLength;if(typeof string!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof string);let len2=string.length,mustMatch=arguments.length>2&&arguments[2]===!0;if(!mustMatch&&len2===0)return 0;let loweredCase=!1;for(;;)switch(encoding){case"ascii":case"latin1":case"binary":return len2;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len2*2;case"hex":return len2>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return mustMatch?-1:utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){let loweredCase=!1;if(start===void 0||start<0)start=0;if(start>this.length)return"";if(end===void 0||end>this.length)end=this.length;if(end<=0)return"";if(end>>>=0,start>>>=0,end<=start)return"";if(!encoding)encoding="utf8";while(!0)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function swap(b,n,m){let i2=b[n];b[n]=b[m],b[m]=i2}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(buffer.length===0)return-1;if(typeof byteOffset==="string")encoding=byteOffset,byteOffset=0;else if(byteOffset>2147483647)byteOffset=2147483647;else if(byteOffset<-2147483648)byteOffset=-2147483648;if(byteOffset=+byteOffset,Number.isNaN(byteOffset))byteOffset=dir?0:buffer.length-1;if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length)if(dir)return-1;else byteOffset=buffer.length-1;else if(byteOffset<0)if(dir)byteOffset=0;else return-1;if(typeof val==="string")val=Buffer2.from(val,encoding);if(Buffer2.isBuffer(val)){if(val.length===0)return-1;return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){if(val=val&255,typeof Uint8Array.prototype.indexOf==="function")if(dir)return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset);else return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset);return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){let indexSize=1,arrLength=arr.length,valLength=val.length;if(encoding!==void 0){if(encoding=String(encoding).toLowerCase(),encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}}function read2(buf,i3){if(indexSize===1)return buf[i3];else return buf.readUInt16BE(i3*indexSize)}let i2;if(dir){let foundIndex=-1;for(i2=byteOffset;i2<arrLength;i2++)if(read2(arr,i2)===read2(val,foundIndex===-1?0:i2-foundIndex)){if(foundIndex===-1)foundIndex=i2;if(i2-foundIndex+1===valLength)return foundIndex*indexSize}else{if(foundIndex!==-1)i2-=i2-foundIndex;foundIndex=-1}}else{if(byteOffset+valLength>arrLength)byteOffset=arrLength-valLength;for(i2=byteOffset;i2>=0;i2--){let found=!0;for(let j=0;j<valLength;j++)if(read2(arr,i2+j)!==read2(val,j)){found=!1;break}if(found)return i2}}return-1}function hexWrite(buf,string,offset,length){offset=Number(offset)||0;let remaining=buf.length-offset;if(!length)length=remaining;else if(length=Number(length),length>remaining)length=remaining;let strLen=string.length;if(length>strLen/2)length=strLen/2;let i2;for(i2=0;i2<length;++i2){let parsed=parseInt(string.substr(i2*2,2),16);if(Number.isNaN(parsed))return i2;buf[offset+i2]=parsed}return i2}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){if(start===0&&end===buf.length)return fromByteArray(buf);else return fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);let res=[],i2=start;while(i2<end){let firstByte=buf[i2],codePoint=null,bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i2+bytesPerSequence<=end){let secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128)codePoint=firstByte;break;case 2:if(secondByte=buf[i2+1],(secondByte&192)===128){if(tempCodePoint=(firstByte&31)<<6|secondByte&63,tempCodePoint>127)codePoint=tempCodePoint}break;case 3:if(secondByte=buf[i2+1],thirdByte=buf[i2+2],(secondByte&192)===128&&(thirdByte&192)===128){if(tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63,tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343))codePoint=tempCodePoint}break;case 4:if(secondByte=buf[i2+1],thirdByte=buf[i2+2],fourthByte=buf[i2+3],(secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){if(tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63,tempCodePoint>65535&&tempCodePoint<1114112)codePoint=tempCodePoint}}}if(codePoint===null)codePoint=65533,bytesPerSequence=1;else if(codePoint>65535)codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|codePoint&1023;res.push(codePoint),i2+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){let len2=codePoints.length;if(len2<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);let res="",i2=0;while(i2<len2)res+=String.fromCharCode.apply(String,codePoints.slice(i2,i2+=MAX_ARGUMENTS_LENGTH));return res}function asciiSlice(buf,start,end){let ret="";end=Math.min(buf.length,end);for(let i2=start;i2<end;++i2)ret+=String.fromCharCode(buf[i2]&127);return ret}function latin1Slice(buf,start,end){let ret="";end=Math.min(buf.length,end);for(let i2=start;i2<end;++i2)ret+=String.fromCharCode(buf[i2]);return ret}function hexSlice(buf,start,end){let len2=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len2)end=len2;let out="";for(let i2=start;i2<end;++i2)out+=hexSliceLookupTable[buf[i2]];return out}function utf16leSlice(buf,start,end){let bytes=buf.slice(start,end),res="";for(let i2=0;i2<bytes.length-1;i2+=2)res+=String.fromCharCode(bytes[i2]+bytes[i2+1]*256);return res}function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw RangeError("offset is not uint");if(offset+ext>length)throw RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer2.isBuffer(buf))throw TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw RangeError("Index out of range")}function wrtBigUInt64LE(buf,value,offset,min,max){checkIntBI(value,min,max,buf,offset,7);let lo=Number(value&BigInt(4294967295));buf[offset++]=lo,lo=lo>>8,buf[offset++]=lo,lo=lo>>8,buf[offset++]=lo,lo=lo>>8,buf[offset++]=lo;let hi=Number(value>>BigInt(32)&BigInt(4294967295));return buf[offset++]=hi,hi=hi>>8,buf[offset++]=hi,hi=hi>>8,buf[offset++]=hi,hi=hi>>8,buf[offset++]=hi,offset}function wrtBigUInt64BE(buf,value,offset,min,max){checkIntBI(value,min,max,buf,offset,7);let lo=Number(value&BigInt(4294967295));buf[offset+7]=lo,lo=lo>>8,buf[offset+6]=lo,lo=lo>>8,buf[offset+5]=lo,lo=lo>>8,buf[offset+4]=lo;let hi=Number(value>>BigInt(32)&BigInt(4294967295));return buf[offset+3]=hi,hi=hi>>8,buf[offset+2]=hi,hi=hi>>8,buf[offset+1]=hi,hi=hi>>8,buf[offset]=hi,offset+8}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw RangeError("Index out of range");if(offset<0)throw RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkIEEE754(buf,value,offset,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkIEEE754(buf,value,offset,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return write(buf,value,offset,littleEndian,52,8),offset+8}function addNumericalSeparator(val){let res="",i2=val.length,start=val[0]==="-"?1:0;for(;i2>=start+4;i2-=3)res=`_${val.slice(i2-3,i2)}${res}`;return`${val.slice(0,i2)}${res}`}function checkBounds(buf,offset,byteLength2){if(validateNumber(offset,"offset"),buf[offset]===void 0||buf[offset+byteLength2]===void 0)boundsError(offset,buf.length-(byteLength2+1))}function checkIntBI(value,min,max,buf,offset,byteLength2){if(value>max||value<min){let n=typeof min==="bigint"?"n":"",range;if(byteLength2>3)if(min===0||min===BigInt(0))range=`>= 0${n} and < 2${n} ** ${(byteLength2+1)*8}${n}`;else range=`>= -(2${n} ** ${(byteLength2+1)*8-1}${n}) and < 2 ** ${(byteLength2+1)*8-1}${n}`;else range=`>= ${min}${n} and <= ${max}${n}`;throw new ERR_OUT_OF_RANGE("value",range,value)}checkBounds(buf,offset,byteLength2)}function validateNumber(value,name){if(typeof value!=="number")throw new ERR_INVALID_ARG_TYPE(name,"number",value)}function boundsError(value,length,type){if(Math.floor(value)!==value)throw validateNumber(value,type),new ERR_OUT_OF_RANGE(type||"offset","an integer",value);if(length<0)throw new ERR_BUFFER_OUT_OF_BOUNDS;throw new ERR_OUT_OF_RANGE(type||"offset",`>= ${type?1:0} and <= ${length}`,value)}function base64clean(str){if(str=str.split("=")[0],str=str.trim().replace(INVALID_BASE64_RE,""),str.length<2)return"";while(str.length%4!==0)str=str+"=";return str}function utf8ToBytes(string,units){units=units||1/0;let codePoint,length=string.length,leadSurrogate=null,bytes=[];for(let i2=0;i2<length;++i2){if(codePoint=string.charCodeAt(i2),codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i2+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else throw Error("Invalid code point")}return bytes}function asciiToBytes(str){let byteArray=[];for(let i2=0;i2<str.length;++i2)byteArray.push(str.charCodeAt(i2)&255);return byteArray}function utf16leToBytes(str,units){let c,hi,lo,byteArray=[];for(let i2=0;i2<str.length;++i2){if((units-=2)<0)break;c=str.charCodeAt(i2),hi=c>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi)}return byteArray}function base64ToBytes(str){return toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){let i2;for(i2=0;i2<length;++i2){if(i2+offset>=dst.length||i2>=src.length)break;dst[i2+offset]=src[i2]}return i2}function isInstance(obj,type){return obj instanceof type||obj!=null&&obj.constructor!=null&&obj.constructor.name!=null&&obj.constructor.name===type.name}function defineBigIntMethod(fn){return typeof BigInt>"u"?BufferBigIntNotDefined:fn}function BufferBigIntNotDefined(){throw Error("BigInt not supported")}function notimpl(name){return()=>{throw Error(name+" is not implemented for node:buffer browser polyfill")}}var lookup,revLookup,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i,len,customInspectSymbol,INSPECT_MAX_BYTES=50,kMaxLength=2147483647,kStringMaxLength=536870888,btoa,atob,File,Blob,constants,ERR_BUFFER_OUT_OF_BOUNDS,ERR_INVALID_ARG_TYPE,ERR_OUT_OF_RANGE,MAX_ARGUMENTS_LENGTH=4096,INVALID_BASE64_RE,hexSliceLookupTable,resolveObjectURL,isUtf8,isAscii=(str)=>{for(let char of str)if(char.charCodeAt(0)>127)return!1;return!0},transcode,buffer_default;var init_buffer=__esm(()=>{lookup=[],revLookup=[];for(i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup[45]=62;revLookup[95]=63;customInspectSymbol=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,btoa=globalThis.btoa,atob=globalThis.atob,File=globalThis.File,Blob=globalThis.Blob,constants={MAX_LENGTH:kMaxLength,MAX_STRING_LENGTH:kStringMaxLength};ERR_BUFFER_OUT_OF_BOUNDS=E("ERR_BUFFER_OUT_OF_BOUNDS",function(name){if(name)return`${name} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),ERR_INVALID_ARG_TYPE=E("ERR_INVALID_ARG_TYPE",function(name,actual){return`The "${name}" argument must be of type number. Received type ${typeof actual}`},TypeError),ERR_OUT_OF_RANGE=E("ERR_OUT_OF_RANGE",function(str,range,input){let msg=`The value of "${str}" is out of range.`,received=input;if(Number.isInteger(input)&&Math.abs(input)>4294967296)received=addNumericalSeparator(String(input));else if(typeof input==="bigint"){if(received=String(input),input>BigInt(2)**BigInt(32)||input<-(BigInt(2)**BigInt(32)))received=addNumericalSeparator(received);received+="n"}return msg+=` It must be ${range}. Received ${received}`,msg},RangeError);Object.defineProperty(Buffer2.prototype,"parent",{enumerable:!0,get:function(){if(!Buffer2.isBuffer(this))return;return this.buffer}});Object.defineProperty(Buffer2.prototype,"offset",{enumerable:!0,get:function(){if(!Buffer2.isBuffer(this))return;return this.byteOffset}});Buffer2.poolSize=8192;Buffer2.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)};Object.setPrototypeOf(Buffer2.prototype,Uint8Array.prototype);Object.setPrototypeOf(Buffer2,Uint8Array);Buffer2.alloc=function(size,fill,encoding){return alloc(size,fill,encoding)};Buffer2.allocUnsafe=function(size){return allocUnsafe(size)};Buffer2.allocUnsafeSlow=function(size){return allocUnsafe(size)};Buffer2.isBuffer=function(b){return b!=null&&b._isBuffer===!0&&b!==Buffer2.prototype};Buffer2.compare=function(a,b){if(isInstance(a,Uint8Array))a=Buffer2.from(a,a.offset,a.byteLength);if(isInstance(b,Uint8Array))b=Buffer2.from(b,b.offset,b.byteLength);if(!Buffer2.isBuffer(a)||!Buffer2.isBuffer(b))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===b)return 0;let x=a.length,y=b.length;for(let i2=0,len2=Math.min(x,y);i2<len2;++i2)if(a[i2]!==b[i2]){x=a[i2],y=b[i2];break}if(x<y)return-1;if(y<x)return 1;return 0};Buffer2.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};Buffer2.concat=function(list,length){if(!Array.isArray(list))throw TypeError('"list" argument must be an Array of Buffers');if(list.length===0)return Buffer2.alloc(0);let i2;if(length===void 0){length=0;for(i2=0;i2<list.length;++i2)length+=list[i2].length}let buffer=Buffer2.allocUnsafe(length),pos=0;for(i2=0;i2<list.length;++i2){let buf=list[i2];if(isInstance(buf,Uint8Array))if(pos+buf.length>buffer.length){if(!Buffer2.isBuffer(buf))buf=Buffer2.from(buf);buf.copy(buffer,pos)}else Uint8Array.prototype.set.call(buffer,buf,pos);else if(!Buffer2.isBuffer(buf))throw TypeError('"list" argument must be an Array of Buffers');else buf.copy(buffer,pos);pos+=buf.length}return buffer};Buffer2.byteLength=byteLength;Buffer2.prototype._isBuffer=!0;Buffer2.prototype.swap16=function(){let len2=this.length;if(len2%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let i2=0;i2<len2;i2+=2)swap(this,i2,i2+1);return this};Buffer2.prototype.swap32=function(){let len2=this.length;if(len2%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let i2=0;i2<len2;i2+=4)swap(this,i2,i2+3),swap(this,i2+1,i2+2);return this};Buffer2.prototype.swap64=function(){let len2=this.length;if(len2%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let i2=0;i2<len2;i2+=8)swap(this,i2,i2+7),swap(this,i2+1,i2+6),swap(this,i2+2,i2+5),swap(this,i2+3,i2+4);return this};Buffer2.prototype.toString=function(){let length=this.length;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer2.prototype.toLocaleString=Buffer2.prototype.toString;Buffer2.prototype.equals=function(b){if(!Buffer2.isBuffer(b))throw TypeError("Argument must be a Buffer");if(this===b)return!0;return Buffer2.compare(this,b)===0};Buffer2.prototype.inspect=function(){let str="",max=INSPECT_MAX_BYTES;if(str=this.toString("hex",0,max).replace(/(.{2})/g,"$1 ").trim(),this.length>max)str+=" ... ";return"<Buffer "+str+">"};if(customInspectSymbol)Buffer2.prototype[customInspectSymbol]=Buffer2.prototype.inspect;Buffer2.prototype.compare=function(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array))target=Buffer2.from(target,target.offset,target.byteLength);if(!Buffer2.isBuffer(target))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof target);if(start===void 0)start=0;if(end===void 0)end=target?target.length:0;if(thisStart===void 0)thisStart=0;if(thisEnd===void 0)thisEnd=this.length;if(start<0||end>target.length||thisStart<0||thisEnd>this.length)throw RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(start>>>=0,end>>>=0,thisStart>>>=0,thisEnd>>>=0,this===target)return 0;let x=thisEnd-thisStart,y=end-start,len2=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end);for(let i2=0;i2<len2;++i2)if(thisCopy[i2]!==targetCopy[i2]){x=thisCopy[i2],y=targetCopy[i2];break}if(x<y)return-1;if(y<x)return 1;return 0};Buffer2.prototype.includes=function(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1};Buffer2.prototype.indexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!0)};Buffer2.prototype.lastIndexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!1)};Buffer2.prototype.write=function(string,offset,length,encoding){if(offset===void 0)encoding="utf8",length=this.length,offset=0;else if(length===void 0&&typeof offset==="string")encoding=offset,length=this.length,offset=0;else if(isFinite(offset))if(offset=offset>>>0,isFinite(length)){if(length=length>>>0,encoding===void 0)encoding="utf8"}else encoding=length,length=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let remaining=this.length-offset;if(length===void 0||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!encoding)encoding="utf8";let loweredCase=!1;for(;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":case"latin1":case"binary":return asciiWrite(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}};Buffer2.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Buffer2.prototype.slice=function(start,end){let len2=this.length;if(start=~~start,end=end===void 0?len2:~~end,start<0){if(start+=len2,start<0)start=0}else if(start>len2)start=len2;if(end<0){if(end+=len2,end<0)end=0}else if(end>len2)end=len2;if(end<start)end=start;let newBuf=this.subarray(start,end);return Object.setPrototypeOf(newBuf,Buffer2.prototype),newBuf};Buffer2.prototype.readUintLE=Buffer2.prototype.readUIntLE=function(offset,byteLength2,noAssert){if(offset=offset>>>0,byteLength2=byteLength2>>>0,!noAssert)checkOffset(offset,byteLength2,this.length);let val=this[offset],mul=1,i2=0;while(++i2<byteLength2&&(mul*=256))val+=this[offset+i2]*mul;return val};Buffer2.prototype.readUintBE=Buffer2.prototype.readUIntBE=function(offset,byteLength2,noAssert){if(offset=offset>>>0,byteLength2=byteLength2>>>0,!noAssert)checkOffset(offset,byteLength2,this.length);let val=this[offset+--byteLength2],mul=1;while(byteLength2>0&&(mul*=256))val+=this[offset+--byteLength2]*mul;return val};Buffer2.prototype.readUint8=Buffer2.prototype.readUInt8=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer2.prototype.readUint16LE=Buffer2.prototype.readUInt16LE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer2.prototype.readUint16BE=Buffer2.prototype.readUInt16BE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer2.prototype.readUint32LE=Buffer2.prototype.readUInt32LE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer2.prototype.readUint32BE=Buffer2.prototype.readUInt32BE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer2.prototype.readBigUInt64LE=defineBigIntMethod(function(offset){offset=offset>>>0,validateNumber(offset,"offset");let first=this[offset],last=this[offset+7];if(first===void 0||last===void 0)boundsError(offset,this.length-8);let lo=first+this[++offset]*256+this[++offset]*65536+this[++offset]*16777216,hi=this[++offset]+this[++offset]*256+this[++offset]*65536+last*16777216;return BigInt(lo)+(BigInt(hi)<<BigInt(32))});Buffer2.prototype.readBigUInt64BE=defineBigIntMethod(function(offset){offset=offset>>>0,validateNumber(offset,"offset");let first=this[offset],last=this[offset+7];if(first===void 0||last===void 0)boundsError(offset,this.length-8);let hi=first*16777216+this[++offset]*65536+this[++offset]*256+this[++offset],lo=this[++offset]*16777216+this[++offset]*65536+this[++offset]*256+last;return(BigInt(hi)<<BigInt(32))+BigInt(lo)});Buffer2.prototype.readIntLE=function(offset,byteLength2,noAssert){if(offset=offset>>>0,byteLength2=byteLength2>>>0,!noAssert)checkOffset(offset,byteLength2,this.length);let val=this[offset],mul=1,i2=0;while(++i2<byteLength2&&(mul*=256))val+=this[offset+i2]*mul;if(mul*=128,val>=mul)val-=Math.pow(2,8*byteLength2);return val};Buffer2.prototype.readIntBE=function(offset,byteLength2,noAssert){if(offset=offset>>>0,byteLength2=byteLength2>>>0,!noAssert)checkOffset(offset,byteLength2,this.length);let i2=byteLength2,mul=1,val=this[offset+--i2];while(i2>0&&(mul*=256))val+=this[offset+--i2]*mul;if(mul*=128,val>=mul)val-=Math.pow(2,8*byteLength2);return val};Buffer2.prototype.readInt8=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer2.prototype.readInt16LE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,2,this.length);let val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer2.prototype.readInt16BE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,2,this.length);let val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer2.prototype.readInt32LE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer2.prototype.readInt32BE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer2.prototype.readBigInt64LE=defineBigIntMethod(function(offset){offset=offset>>>0,validateNumber(offset,"offset");let first=this[offset],last=this[offset+7];if(first===void 0||last===void 0)boundsError(offset,this.length-8);let val=this[offset+4]+this[offset+5]*256+this[offset+6]*65536+(last<<24);return(BigInt(val)<<BigInt(32))+BigInt(first+this[++offset]*256+this[++offset]*65536+this[++offset]*16777216)});Buffer2.prototype.readBigInt64BE=defineBigIntMethod(function(offset){offset=offset>>>0,validateNumber(offset,"offset");let first=this[offset],last=this[offset+7];if(first===void 0||last===void 0)boundsError(offset,this.length-8);let val=(first<<24)+this[++offset]*65536+this[++offset]*256+this[++offset];return(BigInt(val)<<BigInt(32))+BigInt(this[++offset]*16777216+this[++offset]*65536+this[++offset]*256+last)});Buffer2.prototype.readFloatLE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,4,this.length);return read(this,offset,!0,23,4)};Buffer2.prototype.readFloatBE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,4,this.length);return read(this,offset,!1,23,4)};Buffer2.prototype.readDoubleLE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,8,this.length);return read(this,offset,!0,52,8)};Buffer2.prototype.readDoubleBE=function(offset,noAssert){if(offset=offset>>>0,!noAssert)checkOffset(offset,8,this.length);return read(this,offset,!1,52,8)};Buffer2.prototype.writeUintLE=Buffer2.prototype.writeUIntLE=function(value,offset,byteLength2,noAssert){if(value=+value,offset=offset>>>0,byteLength2=byteLength2>>>0,!noAssert){let maxBytes=Math.pow(2,8*byteLength2)-1;checkInt(this,value,offset,byteLength2,maxBytes,0)}let mul=1,i2=0;this[offset]=value&255;while(++i2<byteLength2&&(mul*=256))this[offset+i2]=value/mul&255;return offset+byteLength2};Buffer2.prototype.writeUintBE=Buffer2.prototype.writeUIntBE=function(value,offset,byteLength2,noAssert){if(value=+value,offset=offset>>>0,byteLength2=byteLength2>>>0,!noAssert){let maxBytes=Math.pow(2,8*byteLength2)-1;checkInt(this,value,offset,byteLength2,maxBytes,0)}let i2=byteLength2-1,mul=1;this[offset+i2]=value&255;while(--i2>=0&&(mul*=256))this[offset+i2]=value/mul&255;return offset+byteLength2};Buffer2.prototype.writeUint8=Buffer2.prototype.writeUInt8=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,1,255,0);return this[offset]=value&255,offset+1};Buffer2.prototype.writeUint16LE=Buffer2.prototype.writeUInt16LE=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,2,65535,0);return this[offset]=value&255,this[offset+1]=value>>>8,offset+2};Buffer2.prototype.writeUint16BE=Buffer2.prototype.writeUInt16BE=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,2,65535,0);return this[offset]=value>>>8,this[offset+1]=value&255,offset+2};Buffer2.prototype.writeUint32LE=Buffer2.prototype.writeUInt32LE=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,4,4294967295,0);return this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=value&255,offset+4};Buffer2.prototype.writeUint32BE=Buffer2.prototype.writeUInt32BE=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,4,4294967295,0);return this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=value&255,offset+4};Buffer2.prototype.writeBigUInt64LE=defineBigIntMethod(function(value,offset=0){return wrtBigUInt64LE(this,value,offset,BigInt(0),BigInt("0xffffffffffffffff"))});Buffer2.prototype.writeBigUInt64BE=defineBigIntMethod(function(value,offset=0){return wrtBigUInt64BE(this,value,offset,BigInt(0),BigInt("0xffffffffffffffff"))});Buffer2.prototype.writeIntLE=function(value,offset,byteLength2,noAssert){if(value=+value,offset=offset>>>0,!noAssert){let limit=Math.pow(2,8*byteLength2-1);checkInt(this,value,offset,byteLength2,limit-1,-limit)}let i2=0,mul=1,sub=0;this[offset]=value&255;while(++i2<byteLength2&&(mul*=256)){if(value<0&&sub===0&&this[offset+i2-1]!==0)sub=1;this[offset+i2]=(value/mul>>0)-sub&255}return offset+byteLength2};Buffer2.prototype.writeIntBE=function(value,offset,byteLength2,noAssert){if(value=+value,offset=offset>>>0,!noAssert){let limit=Math.pow(2,8*byteLength2-1);checkInt(this,value,offset,byteLength2,limit-1,-limit)}let i2=byteLength2-1,mul=1,sub=0;this[offset+i2]=value&255;while(--i2>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i2+1]!==0)sub=1;this[offset+i2]=(value/mul>>0)-sub&255}return offset+byteLength2};Buffer2.prototype.writeInt8=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,1,127,-128);if(value<0)value=255+value+1;return this[offset]=value&255,offset+1};Buffer2.prototype.writeInt16LE=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,2,32767,-32768);return this[offset]=value&255,this[offset+1]=value>>>8,offset+2};Buffer2.prototype.writeInt16BE=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,2,32767,-32768);return this[offset]=value>>>8,this[offset+1]=value&255,offset+2};Buffer2.prototype.writeInt32LE=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);return this[offset]=value&255,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24,offset+4};Buffer2.prototype.writeInt32BE=function(value,offset,noAssert){if(value=+value,offset=offset>>>0,!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;return this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=value&255,offset+4};Buffer2.prototype.writeBigInt64LE=defineBigIntMethod(function(value,offset=0){return wrtBigUInt64LE(this,value,offset,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});Buffer2.prototype.writeBigInt64BE=defineBigIntMethod(function(value,offset=0){return wrtBigUInt64BE(this,value,offset,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});Buffer2.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)};Buffer2.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)};Buffer2.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)};Buffer2.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)};Buffer2.prototype.copy=function(target,targetStart,start,end){if(!Buffer2.isBuffer(target))throw TypeError("argument should be a Buffer");if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||this.length===0)return 0;if(targetStart<0)throw RangeError("targetStart out of bounds");if(start<0||start>=this.length)throw RangeError("Index out of range");if(end<0)throw RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart<end-start)end=target.length-targetStart+start;let len2=end-start;if(this===target&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(targetStart,start,end);else Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart);return len2};Buffer2.prototype.fill=function(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string")encoding=start,start=0,end=this.length;else if(typeof end==="string")encoding=end,end=this.length;if(encoding!==void 0&&typeof encoding!=="string")throw TypeError("encoding must be a string");if(typeof encoding==="string"&&!Buffer2.isEncoding(encoding))throw TypeError("Unknown encoding: "+encoding);if(val.length===1){let code2=val.charCodeAt(0);if(encoding==="utf8"&&code2<128||encoding==="latin1")val=code2}}else if(typeof val==="number")val=val&255;else if(typeof val==="boolean")val=Number(val);if(start<0||this.length<start||this.length<end)throw RangeError("Out of range index");if(end<=start)return this;if(start=start>>>0,end=end===void 0?this.length:end>>>0,!val)val=0;let i2;if(typeof val==="number")for(i2=start;i2<end;++i2)this[i2]=val;else{let bytes=Buffer2.isBuffer(val)?val:Buffer2.from(val,encoding),len2=bytes.length;if(len2===0)throw TypeError('The value "'+val+'" is invalid for argument "value"');for(i2=0;i2<end-start;++i2)this[i2+start]=bytes[i2%len2]}return this};INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;hexSliceLookupTable=function(){let table=Array(256);for(let i2=0;i2<16;++i2){let i16=i2*16;for(let j=0;j<16;++j)table[i16+j]="0123456789abcdef"[i2]+"0123456789abcdef"[j]}return table}();resolveObjectURL=notimpl("resolveObjectURL"),isUtf8=notimpl("isUtf8"),transcode=notimpl("transcode"),buffer_default=Buffer2});var exports_util={};__export(exports_util,{types:()=>types,promisify:()=>promisify,log:()=>log,isUndefined:()=>isUndefined,isSymbol:()=>isSymbol,isString:()=>isString,isRegExp:()=>isRegExp,isPrimitive:()=>isPrimitive,isObject:()=>isObject,isNumber:()=>isNumber,isNullOrUndefined:()=>isNullOrUndefined,isNull:()=>isNull,isFunction:()=>isFunction,isError:()=>isError,isDate:()=>isDate,isBuffer:()=>isBuffer,isBoolean:()=>isBoolean,isArray:()=>isArray,inspect:()=>inspect,inherits:()=>inherits,format:()=>format,deprecate:()=>deprecate,default:()=>util_default,debuglog:()=>debuglog,callbackifyOnRejected:()=>callbackifyOnRejected,callbackify:()=>callbackify,_extend:()=>_extend,TextEncoder:()=>TextEncoder2,TextDecoder:()=>TextDecoder});function format(f,...args){if(!isString(f)){var objects=[f];for(var i2=0;i2<args.length;i2++)objects.push(inspect(args[i2]));return objects.join(" ")}var i2=0,len2=args.length,str=String(f).replace(formatRegExp,function(x2){if(x2==="%%")return"%";if(i2>=len2)return x2;switch(x2){case"%s":return String(args[i2++]);case"%d":return Number(args[i2++]);case"%j":try{return JSON.stringify(args[i2++])}catch(_){return"[Circular]"}default:return x2}});for(var x=args[i2];i2<len2;x=args[++i2])if(isNull(x)||!isObject(x))str+=" "+x;else str+=" "+inspect(x);return str}function deprecate(fn,msg){if(typeof process>"u"||process?.noDeprecation===!0)return fn;var warned=!1;function deprecated(...args){if(!warned){if(process.throwDeprecation)throw Error(msg);else if(process.traceDeprecation)console.trace(msg);else console.error(msg);warned=!0}return fn.apply(this,...args)}return deprecated}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style)return"\x1B["+inspect.colors[style][0]+"m"+str+"\x1B["+inspect.colors[style][1]+"m";else return str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret))ret=formatValue(ctx,ret,recurseTimes);return ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden)keys=Object.getOwnPropertyNames(value);if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var base="",array=!1,braces=["{","}"];if(isArray(value))array=!0,braces=["[","]"];if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value))base=" "+RegExp.prototype.toString.call(value);if(isDate(value))base=" "+Date.prototype.toUTCString.call(value);if(isError(value))base=" "+formatError(value);if(keys.length===0&&(!array||value.length==0))return braces[0]+base+braces[1];if(recurseTimes<0)if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");else return ctx.stylize("[Object]","special");ctx.seen.push(value);var output;if(array)output=formatArray(ctx,value,recurseTimes,visibleKeys,keys);else output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)});return ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i2=0,l=value.length;i2<l;++i2)if(hasOwnProperty(value,String(i2)))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i2),!0));else output.push("");return keys.forEach(function(key){if(!key.match(/^\d+$/))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get)if(desc.set)str=ctx.stylize("[Getter/Setter]","special");else str=ctx.stylize("[Getter]","special");else if(desc.set)str=ctx.stylize("[Setter]","special");if(!hasOwnProperty(visibleKeys,key))name="["+key+"]";if(!str)if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes))str=formatValue(ctx,desc.value,null);else str=formatValue(ctx,desc.value,recurseTimes-1);if(str.indexOf(`
2
+ `)>-1)if(array)str=str.split(`
3
+ `).map(function(line){return" "+line}).join(`
4
+ `).slice(2);else str=`
5
+ `+str.split(`
6
+ `).map(function(line){return" "+line}).join(`
7
+ `)}else str=ctx.stylize("[Circular]","special");if(isUndefined(name)){if(array&&key.match(/^\d+$/))return str;if(name=JSON.stringify(""+key),name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))name=name.slice(1,-1),name=ctx.stylize(name,"name");else name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string")}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){if(numLinesEst++,cur.indexOf(`
8
+ `)>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60)return braces[0]+(base===""?"":base+`
9
+ `)+" "+output.join(`,
10
+ `)+" "+braces[1];return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return typeof arg==="boolean"}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}function isNumber(arg){return typeof arg==="number"}function isString(arg){return typeof arg==="string"}function isSymbol(arg){return typeof arg==="symbol"}function isUndefined(arg){return arg===void 0}function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}function isFunction(arg){return typeof arg==="function"}function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg>"u"}function isBuffer(arg){return arg instanceof Buffer}function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}function log(...args){console.log("%s - %s",timestamp(),format.apply(null,args))}function inherits(ctor,superCtor){if(superCtor)ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}function _extend(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add),i2=keys.length;while(i2--)origin[keys[i2]]=add[keys[i2]];return origin}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}function callbackifyOnRejected(reason,cb){if(!reason){var newReason=Error("Promise was rejected with a falsy value");newReason.reason=reason,reason=newReason}return cb(reason)}function callbackify(original){if(typeof original!=="function")throw TypeError('The "original" argument must be of type Function');function callbackified(...args){var maybeCb=args.pop();if(typeof maybeCb!=="function")throw TypeError("The last argument must be of type Function");var self2=this,cb=function(...args2){return maybeCb.apply(self2,...args2)};original.apply(this,args).then(function(ret){process.nextTick(cb.bind(null,null,ret))},function(rej){process.nextTick(callbackifyOnRejected.bind(null,rej,cb))})}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(original)),Object.defineProperties(callbackified,Object.getOwnPropertyDescriptors(original)),callbackified}var formatRegExp,debuglog,inspect,types=()=>{},months,promisify,TextEncoder2,TextDecoder,util_default;var init_util=__esm(()=>{formatRegExp=/%[sdj%]/g;debuglog=((debugs={},debugEnvRegex={},debugEnv)=>((debugEnv=typeof process<"u"&&!1)&&(debugEnv=debugEnv.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),debugEnvRegex=new RegExp("^"+debugEnv+"$","i"),(set)=>{if(set=set.toUpperCase(),!debugs[set])if(debugEnvRegex.test(set))debugs[set]=function(...args){console.error("%s: %s",set,pid,format.apply(null,...args))};else debugs[set]=function(){};return debugs[set]}))(),inspect=((i2)=>(i2.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i2.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},i2.custom=Symbol.for("nodejs.util.inspect.custom"),i2))(function(obj,opts,...rest){var ctx={seen:[],stylize:stylizeNoColor};if(rest.length>=1)ctx.depth=rest[0];if(rest.length>=2)ctx.colors=rest[1];if(isBoolean(opts))ctx.showHidden=opts;else if(opts)_extend(ctx,opts);if(isUndefined(ctx.showHidden))ctx.showHidden=!1;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=!1;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)});months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];promisify=((x)=>(x.custom=Symbol.for("nodejs.util.promisify.custom"),x))(function(original){if(typeof original!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&original[kCustomPromisifiedSymbol]){var fn=original[kCustomPromisifiedSymbol];if(typeof fn!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0}),fn}function fn(...args){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject});args.push(function(err,value){if(err)promiseReject(err);else promiseResolve(value)});try{original.apply(this,args)}catch(err){promiseReject(err)}return promise}if(Object.setPrototypeOf(fn,Object.getPrototypeOf(original)),kCustomPromisifiedSymbol)Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(fn,Object.getOwnPropertyDescriptors(original))});({TextEncoder:TextEncoder2,TextDecoder}=globalThis),util_default={TextEncoder:TextEncoder2,TextDecoder,promisify,log,inherits,_extend,callbackifyOnRejected,callbackify}});var exports_events={};__export(exports_events,{setMaxListeners:()=>setMaxListeners2,once:()=>once2,listenerCount:()=>listenerCount2,init:()=>EventEmitter,getMaxListeners:()=>getMaxListeners2,getEventListeners:()=>getEventListeners,default:()=>events_default,captureRejectionSymbol:()=>captureRejectionSymbol,addAbortListener:()=>addAbortListener,EventEmitter:()=>EventEmitter});function emitError(emitter,args){var{_events:events}=emitter;if(args[0]??=Error("Unhandled error."),!events)throw args[0];var errorMonitor=events[kErrorMonitor];if(errorMonitor)for(var handler of ArrayPrototypeSlice.call(errorMonitor))handler.apply(emitter,args);var handlers=events.error;if(!handlers)throw args[0];for(var handler of ArrayPrototypeSlice.call(handlers))handler.apply(emitter,args);return!0}function addCatch(emitter,promise,type,args){promise.then(void 0,function(err){queueMicrotask(()=>emitUnhandledRejectionOrErr(emitter,err,type,args))})}function emitUnhandledRejectionOrErr(emitter,err,type,args){if(typeof emitter[kRejection]==="function")emitter[kRejection](err,type,...args);else try{emitter[kCapture]=!1,emitter.emit("error",err)}finally{emitter[kCapture]=!0}}function overflowWarning(emitter,type,handlers){handlers.warned=!0;let warn=Error(`Possible EventEmitter memory leak detected. ${handlers.length} ${String(type)} listeners added to [${emitter.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);warn.name="MaxListenersExceededWarning",warn.emitter=emitter,warn.type=type,warn.count=handlers.length,console.warn(warn)}function onceWrapper(type,listener,...args){this.removeListener(type,listener),listener.apply(this,args)}function once2(emitter,type,options){var signal=options?.signal;if(validateAbortSignal(signal,"options.signal"),signal?.aborted)throw new AbortError(void 0,{cause:signal?.reason});let{resolve,reject,promise}=$newPromiseCapability(Promise),errorListener=(err)=>{if(emitter.removeListener(type,resolver),signal!=null)eventTargetAgnosticRemoveListener(signal,"abort",abortListener);reject(err)},resolver=(...args)=>{if(typeof emitter.removeListener==="function")emitter.removeListener("error",errorListener);if(signal!=null)eventTargetAgnosticRemoveListener(signal,"abort",abortListener);resolve(args)};if(eventTargetAgnosticAddListener(emitter,type,resolver,{once:!0}),type!=="error"&&typeof emitter.once==="function")emitter.once("error",errorListener);function abortListener(){eventTargetAgnosticRemoveListener(emitter,type,resolver),eventTargetAgnosticRemoveListener(emitter,"error",errorListener),reject(new AbortError(void 0,{cause:signal?.reason}))}if(signal!=null)eventTargetAgnosticAddListener(signal,"abort",abortListener,{once:!0});return promise}function getEventListeners(emitter,type){return emitter.listeners(type)}function setMaxListeners2(n,...eventTargets){validateNumber2(n,"setMaxListeners",0);var length;if(eventTargets&&(length=eventTargets.length))for(let i2=0;i2<length;i2++)eventTargets[i2].setMaxListeners(n);else defaultMaxListeners=n}function listenerCount2(emitter,type){return emitter.listenerCount(type)}function eventTargetAgnosticRemoveListener(emitter,name,listener,flags){if(typeof emitter.removeListener==="function")emitter.removeListener(name,listener);else emitter.removeEventListener(name,listener,flags)}function eventTargetAgnosticAddListener(emitter,name,listener,flags){if(typeof emitter.on==="function")if(flags.once)emitter.once(name,listener);else emitter.on(name,listener);else emitter.addEventListener(name,listener,flags)}function ERR_INVALID_ARG_TYPE2(name,type,value){let err=TypeError(`The "${name}" argument must be of type ${type}. Received ${value}`);return err.code="ERR_INVALID_ARG_TYPE",err}function ERR_OUT_OF_RANGE2(name,range,value){let err=RangeError(`The "${name}" argument is out of range. It must be ${range}. Received ${value}`);return err.code="ERR_OUT_OF_RANGE",err}function validateAbortSignal(signal,name){if(signal!==void 0&&(signal===null||typeof signal!=="object"||!("aborted"in signal)))throw ERR_INVALID_ARG_TYPE2(name,"AbortSignal",signal)}function validateNumber2(value,name,min,max){if(typeof value!=="number")throw ERR_INVALID_ARG_TYPE2(name,"number",value);if(min!=null&&value<min||max!=null&&value>max||(min!=null||max!=null)&&Number.isNaN(value))throw ERR_OUT_OF_RANGE2(name,`${min!=null?`>= ${min}`:""}${min!=null&&max!=null?" && ":""}${max!=null?`<= ${max}`:""}`,value)}function checkListener(listener){if(typeof listener!=="function")throw TypeError("The listener must be a function")}function validateBoolean(value,name){if(typeof value!=="boolean")throw ERR_INVALID_ARG_TYPE2(name,"boolean",value)}function getMaxListeners2(emitterOrTarget){return emitterOrTarget?._maxListeners??defaultMaxListeners}function addAbortListener(signal,listener){if(signal===void 0)throw ERR_INVALID_ARG_TYPE2("signal","AbortSignal",signal);if(validateAbortSignal(signal,"signal"),typeof listener!=="function")throw ERR_INVALID_ARG_TYPE2("listener","function",listener);let removeEventListener;if(signal.aborted)queueMicrotask(()=>listener());else signal.addEventListener("abort",listener,{__proto__:null,once:!0}),removeEventListener=()=>{signal.removeEventListener("abort",listener)};return{__proto__:null,[Symbol.dispose](){removeEventListener?.()}}}var SymbolFor,kCapture,kErrorMonitor,kMaxEventTargetListeners,kMaxEventTargetListenersWarned,kRejection,captureRejectionSymbol,ArrayPrototypeSlice,defaultMaxListeners=10,EventEmitter=function(opts){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[kCapture]=opts?.captureRejections?Boolean(opts?.captureRejections):EventEmitterPrototype[kCapture])this.emit=emitWithRejectionCapture},EventEmitterPrototype,emitWithoutRejectionCapture=function(type,...args){if(type==="error")return emitError(this,args);var{_events:events}=this;if(events===void 0)return!1;var handlers=events[type];if(handlers===void 0)return!1;let maybeClonedHandlers=handlers.length>1?handlers.slice():handlers;for(let i2=0,{length}=maybeClonedHandlers;i2<length;i2++){let handler=maybeClonedHandlers[i2];switch(args.length){case 0:handler.call(this);break;case 1:handler.call(this,args[0]);break;case 2:handler.call(this,args[0],args[1]);break;case 3:handler.call(this,args[0],args[1],args[2]);break;default:handler.apply(this,args);break}}return!0},emitWithRejectionCapture=function(type,...args){if(type==="error")return emitError(this,args);var{_events:events}=this;if(events===void 0)return!1;var handlers=events[type];if(handlers===void 0)return!1;let maybeClonedHandlers=handlers.length>1?handlers.slice():handlers;for(let i2=0,{length}=maybeClonedHandlers;i2<length;i2++){let handler=maybeClonedHandlers[i2],result;switch(args.length){case 0:result=handler.call(this);break;case 1:result=handler.call(this,args[0]);break;case 2:result=handler.call(this,args[0],args[1]);break;case 3:result=handler.call(this,args[0],args[1],args[2]);break;default:result=handler.apply(this,args);break}if(result!==void 0&&typeof result?.then==="function"&&result.then===Promise.prototype.then)addCatch(this,result,type,args)}return!0},AbortError,events_default;var init_events=__esm(()=>{SymbolFor=Symbol.for,kCapture=Symbol("kCapture"),kErrorMonitor=SymbolFor("events.errorMonitor"),kMaxEventTargetListeners=Symbol("events.maxEventTargetListeners"),kMaxEventTargetListenersWarned=Symbol("events.maxEventTargetListenersWarned"),kRejection=SymbolFor("nodejs.rejection"),captureRejectionSymbol=SymbolFor("nodejs.rejection"),ArrayPrototypeSlice=Array.prototype.slice,EventEmitterPrototype=EventEmitter.prototype={};EventEmitterPrototype._events=void 0;EventEmitterPrototype._eventsCount=0;EventEmitterPrototype._maxListeners=void 0;EventEmitterPrototype.setMaxListeners=function(n){return validateNumber2(n,"setMaxListeners",0),this._maxListeners=n,this};EventEmitterPrototype.constructor=EventEmitter;EventEmitterPrototype.getMaxListeners=function(){return this?._maxListeners??defaultMaxListeners};EventEmitterPrototype.emit=emitWithoutRejectionCapture;EventEmitterPrototype.addListener=function(type,fn){checkListener(fn);var events=this._events;if(!events)events=this._events={__proto__:null},this._eventsCount=0;else if(events.newListener)this.emit("newListener",type,fn.listener??fn);var handlers=events[type];if(!handlers)events[type]=[fn],this._eventsCount++;else{handlers.push(fn);var m=this._maxListeners??defaultMaxListeners;if(m>0&&handlers.length>m&&!handlers.warned)overflowWarning(this,type,handlers)}return this};EventEmitterPrototype.on=EventEmitterPrototype.addListener;EventEmitterPrototype.prependListener=function(type,fn){checkListener(fn);var events=this._events;if(!events)events=this._events={__proto__:null},this._eventsCount=0;else if(events.newListener)this.emit("newListener",type,fn.listener??fn);var handlers=events[type];if(!handlers)events[type]=[fn],this._eventsCount++;else{handlers.unshift(fn);var m=this._maxListeners??defaultMaxListeners;if(m>0&&handlers.length>m&&!handlers.warned)overflowWarning(this,type,handlers)}return this};EventEmitterPrototype.once=function(type,fn){checkListener(fn);let bound=onceWrapper.bind(this,type,fn);return bound.listener=fn,this.addListener(type,bound),this};EventEmitterPrototype.prependOnceListener=function(type,fn){checkListener(fn);let bound=onceWrapper.bind(this,type,fn);return bound.listener=fn,this.prependListener(type,bound),this};EventEmitterPrototype.removeListener=function(type,fn){checkListener(fn);var{_events:events}=this;if(!events)return this;var handlers=events[type];if(!handlers)return this;var length=handlers.length;let position=-1;for(let i2=length-1;i2>=0;i2--)if(handlers[i2]===fn||handlers[i2].listener===fn){position=i2;break}if(position<0)return this;if(position===0)handlers.shift();else handlers.splice(position,1);if(handlers.length===0)delete events[type],this._eventsCount--;return this};EventEmitterPrototype.off=EventEmitterPrototype.removeListener;EventEmitterPrototype.removeAllListeners=function(type){var{_events:events}=this;if(type&&events){if(events[type])delete events[type],this._eventsCount--}else this._events={__proto__:null};return this};EventEmitterPrototype.listeners=function(type){var{_events:events}=this;if(!events)return[];var handlers=events[type];if(!handlers)return[];return handlers.map((x)=>x.listener??x)};EventEmitterPrototype.rawListeners=function(type){var{_events}=this;if(!_events)return[];var handlers=_events[type];if(!handlers)return[];return handlers.slice()};EventEmitterPrototype.listenerCount=function(type){var{_events:events}=this;if(!events)return 0;return events[type]?.length??0};EventEmitterPrototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};EventEmitterPrototype[kCapture]=!1;AbortError=class AbortError extends Error{constructor(message="The operation was aborted",options=void 0){if(options!==void 0&&typeof options!=="object")throw ERR_INVALID_ARG_TYPE2("options","Object",options);super(message,options);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(EventEmitter,{captureRejections:{get(){return EventEmitterPrototype[kCapture]},set(value){validateBoolean(value,"EventEmitter.captureRejections"),EventEmitterPrototype[kCapture]=value},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return defaultMaxListeners},set:(arg)=>{validateNumber2(arg,"defaultMaxListeners",0),defaultMaxListeners=arg}},kMaxEventTargetListeners:{value:kMaxEventTargetListeners,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:kMaxEventTargetListenersWarned,enumerable:!1,configurable:!1,writable:!1}});Object.assign(EventEmitter,{once:once2,getEventListeners,getMaxListeners:getMaxListeners2,setMaxListeners:setMaxListeners2,EventEmitter,usingDomains:!1,captureRejectionSymbol,errorMonitor:kErrorMonitor,addAbortListener,init:EventEmitter,listenerCount:listenerCount2});events_default=EventEmitter});var require_stream=__commonJS((exports,module)=>{var __commonJS2=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports),require_primordials=__commonJS2((exports2,module2)=>{class AggregateError2 extends Error{constructor(errors){if(!Array.isArray(errors))throw TypeError(`Expected input to be an Array, got ${typeof errors}`);let message="";for(let i2=0;i2<errors.length;i2++)message+=` ${errors[i2].stack}
11
+ `;super(message);this.name="AggregateError",this.errors=errors}}module2.exports={AggregateError:AggregateError2,ArrayIsArray(self2){return Array.isArray(self2)},ArrayPrototypeIncludes(self2,el){return self2.includes(el)},ArrayPrototypeIndexOf(self2,el){return self2.indexOf(el)},ArrayPrototypeJoin(self2,sep){return self2.join(sep)},ArrayPrototypeMap(self2,fn){return self2.map(fn)},ArrayPrototypePop(self2,el){return self2.pop(el)},ArrayPrototypePush(self2,el){return self2.push(el)},ArrayPrototypeSlice(self2,start,end){return self2.slice(start,end)},Error,FunctionPrototypeCall(fn,thisArgs,...args){return fn.call(thisArgs,...args)},FunctionPrototypeSymbolHasInstance(self2,instance){return Function.prototype[Symbol.hasInstance].call(self2,instance)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(self2,props){return Object.defineProperties(self2,props)},ObjectDefineProperty(self2,name,prop){return Object.defineProperty(self2,name,prop)},ObjectGetOwnPropertyDescriptor(self2,name){return Object.getOwnPropertyDescriptor(self2,name)},ObjectKeys(obj){return Object.keys(obj)},ObjectSetPrototypeOf(target,proto){return Object.setPrototypeOf(target,proto)},Promise,PromisePrototypeCatch(self2,fn){return self2.catch(fn)},PromisePrototypeThen(self2,thenFn,catchFn){return self2.then(thenFn,catchFn)},PromiseReject(err){return Promise.reject(err)},PromiseResolve(val){return Promise.resolve(val)},ReflectApply:Reflect.apply,RegExpPrototypeTest(self2,value){return self2.test(value)},SafeSet:Set,String,StringPrototypeSlice(self2,start,end){return self2.slice(start,end)},StringPrototypeToLowerCase(self2){return self2.toLowerCase()},StringPrototypeToUpperCase(self2){return self2.toUpperCase()},StringPrototypeTrim(self2){return self2.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(self2,buf,len2){return self2.set(buf,len2)},Boolean,Uint8Array}}),require_inspect=__commonJS2((exports2,module2)=>{module2.exports={format(format2,...args){return format2.replace(/%([sdifj])/g,function(...[_unused,type]){let replacement=args.shift();if(type==="f")return replacement.toFixed(6);else if(type==="j")return JSON.stringify(replacement);else if(type==="s"&&typeof replacement==="object")return`${replacement.constructor!==Object?replacement.constructor.name:""} {}`.trim();else return replacement.toString()})},inspect(value){switch(typeof value){case"string":if(value.includes("'")){if(!value.includes('"'))return`"${value}"`;else if(!value.includes("`")&&!value.includes("${"))return`\`${value}\``}return`'${value}'`;case"number":if(isNaN(value))return"NaN";else if(Object.is(value,-0))return String(value);return value;case"bigint":return`${String(value)}n`;case"boolean":case"undefined":return String(value);case"object":return"{}"}}}}),require_errors=__commonJS2((exports2,module2)=>{var{format:format2,inspect:inspect2}=require_inspect(),{AggregateError:CustomAggregateError}=require_primordials(),AggregateError2=globalThis.AggregateError||CustomAggregateError,kIsNodeError=Symbol("kIsNodeError"),kTypes=["string","function","number","object","Function","Object","boolean","bigint","symbol"],classRegExp=/^([A-Z][a-z0-9]*)+$/,codes={};function assert(value,message){if(!value)throw new codes.ERR_INTERNAL_ASSERTION(message)}function addNumericalSeparator2(val){let res="",i2=val.length,start=val[0]==="-"?1:0;for(;i2>=start+4;i2-=3)res=`_${val.slice(i2-3,i2)}${res}`;return`${val.slice(0,i2)}${res}`}function getMessage(key,msg,args){if(typeof msg==="function")return assert(msg.length<=args.length,`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`),msg(...args);let expectedLength=(msg.match(/%[dfijoOs]/g)||[]).length;if(assert(expectedLength===args.length,`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`),args.length===0)return msg;return format2(msg,...args)}function E2(code2,message,Base){if(!Base)Base=Error;class NodeError extends Base{constructor(...args){super(getMessage(code2,message,args))}toString(){return`${this.name} [${code2}]: ${this.message}`}}Object.defineProperties(NodeError.prototype,{name:{value:Base.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${code2}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),NodeError.prototype.code=code2,NodeError.prototype[kIsNodeError]=!0,codes[code2]=NodeError}function hideStackFrames(fn){let hidden="__node_internal_"+fn.name;return Object.defineProperty(fn,"name",{value:hidden}),fn}function aggregateTwoErrors(innerError,outerError){if(innerError&&outerError&&innerError!==outerError){if(Array.isArray(outerError.errors))return outerError.errors.push(innerError),outerError;let err=new AggregateError2([outerError,innerError],outerError.message);return err.code=outerError.code,err}return innerError||outerError}class AbortError2 extends Error{constructor(message="The operation was aborted",options=void 0){if(options!==void 0&&typeof options!=="object")throw new codes.ERR_INVALID_ARG_TYPE("options","Object",options);super(message,options);this.code="ABORT_ERR",this.name="AbortError"}}E2("ERR_ASSERTION","%s",Error),E2("ERR_INVALID_ARG_TYPE",(name,expected,actual)=>{if(assert(typeof name==="string","'name' must be a string"),!Array.isArray(expected))expected=[expected];let msg="The ";if(name.endsWith(" argument"))msg+=`${name} `;else msg+=`"${name}" ${name.includes(".")?"property":"argument"} `;msg+="must be ";let types2=[],instances=[],other=[];for(let value of expected)if(assert(typeof value==="string","All expected entries have to be of type string"),kTypes.includes(value))types2.push(value.toLowerCase());else if(classRegExp.test(value))instances.push(value);else assert(value!=="object",'The value "object" should be written as "Object"'),other.push(value);if(instances.length>0){let pos=types2.indexOf("object");if(pos!==-1)types2.splice(types2,pos,1),instances.push("Object")}if(types2.length>0){switch(types2.length){case 1:msg+=`of type ${types2[0]}`;break;case 2:msg+=`one of type ${types2[0]} or ${types2[1]}`;break;default:{let last=types2.pop();msg+=`one of type ${types2.join(", ")}, or ${last}`}}if(instances.length>0||other.length>0)msg+=" or "}if(instances.length>0){switch(instances.length){case 1:msg+=`an instance of ${instances[0]}`;break;case 2:msg+=`an instance of ${instances[0]} or ${instances[1]}`;break;default:{let last=instances.pop();msg+=`an instance of ${instances.join(", ")}, or ${last}`}}if(other.length>0)msg+=" or "}switch(other.length){case 0:break;case 1:if(other[0].toLowerCase()!==other[0])msg+="an ";msg+=`${other[0]}`;break;case 2:msg+=`one of ${other[0]} or ${other[1]}`;break;default:{let last=other.pop();msg+=`one of ${other.join(", ")}, or ${last}`}}if(actual==null)msg+=`. Received ${actual}`;else if(typeof actual==="function"&&actual.name)msg+=`. Received function ${actual.name}`;else if(typeof actual==="object"){var _actual$constructor;if((_actual$constructor=actual.constructor)!==null&&_actual$constructor!==void 0&&_actual$constructor.name)msg+=`. Received an instance of ${actual.constructor.name}`;else{let inspected=inspect2(actual,{depth:-1});msg+=`. Received ${inspected}`}}else{let inspected=inspect2(actual,{colors:!1});if(inspected.length>25)inspected=`${inspected.slice(0,25)}...`;msg+=`. Received type ${typeof actual} (${inspected})`}return msg},TypeError),E2("ERR_INVALID_ARG_VALUE",(name,value,reason="is invalid")=>{let inspected=inspect2(value);if(inspected.length>128)inspected=inspected.slice(0,128)+"...";return`The ${name.includes(".")?"property":"argument"} '${name}' ${reason}. Received ${inspected}`},TypeError),E2("ERR_INVALID_RETURN_VALUE",(input,name,value)=>{var _value$constructor;let type=value!==null&&value!==void 0&&(_value$constructor=value.constructor)!==null&&_value$constructor!==void 0&&_value$constructor.name?`instance of ${value.constructor.name}`:`type ${typeof value}`;return`Expected ${input} to be returned from the "${name}" function but got ${type}.`},TypeError),E2("ERR_MISSING_ARGS",(...args)=>{assert(args.length>0,"At least one arg needs to be specified");let msg,len2=args.length;switch(args=(Array.isArray(args)?args:[args]).map((a)=>`"${a}"`).join(" or "),len2){case 1:msg+=`The ${args[0]} argument`;break;case 2:msg+=`The ${args[0]} and ${args[1]} arguments`;break;default:{let last=args.pop();msg+=`The ${args.join(", ")}, and ${last} arguments`}break}return`${msg} must be specified`},TypeError),E2("ERR_OUT_OF_RANGE",(str,range,input)=>{assert(range,'Missing "range" argument');let received;if(Number.isInteger(input)&&Math.abs(input)>4294967296)received=addNumericalSeparator2(String(input));else if(typeof input==="bigint"){received=String(input);let limit=BigInt(2)**BigInt(32);if(input>limit||input<-limit)received=addNumericalSeparator2(received);received+="n"}else received=inspect2(input);return`The value of "${str}" is out of range. It must be ${range}. Received ${received}`},RangeError),E2("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),E2("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),E2("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),E2("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),E2("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),E2("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),E2("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),E2("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),E2("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),E2("ERR_STREAM_WRITE_AFTER_END","write after end",Error),E2("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),module2.exports={AbortError:AbortError2,aggregateTwoErrors:hideStackFrames(aggregateTwoErrors),hideStackFrames,codes}}),require_event_target_shim=__commonJS2((exports2,module2)=>{Object.defineProperty(exports2,"__esModule",{value:!0});var privateData=new WeakMap,wrappers=new WeakMap;function pd(event){let retv=privateData.get(event);return console.assert(retv!=null,"'this' is expected an Event object, but got",event),retv}function setCancelFlag(data){if(data.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",data.passiveListener);return}if(!data.event.cancelable)return;if(data.canceled=!0,typeof data.event.preventDefault==="function")data.event.preventDefault()}function Event(eventTarget,event){privateData.set(this,{eventTarget,event,eventPhase:2,currentTarget:eventTarget,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:event.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let keys=Object.keys(event);for(let i2=0;i2<keys.length;++i2){let key=keys[i2];if(!(key in this))Object.defineProperty(this,key,defineRedirectDescriptor(key))}}if(Event.prototype={get type(){return pd(this).event.type},get target(){return pd(this).eventTarget},get currentTarget(){return pd(this).currentTarget},composedPath(){let currentTarget=pd(this).currentTarget;if(currentTarget==null)return[];return[currentTarget]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return pd(this).eventPhase},stopPropagation(){let data=pd(this);if(data.stopped=!0,typeof data.event.stopPropagation==="function")data.event.stopPropagation()},stopImmediatePropagation(){let data=pd(this);if(data.stopped=!0,data.immediateStopped=!0,typeof data.event.stopImmediatePropagation==="function")data.event.stopImmediatePropagation()},get bubbles(){return Boolean(pd(this).event.bubbles)},get cancelable(){return Boolean(pd(this).event.cancelable)},preventDefault(){setCancelFlag(pd(this))},get defaultPrevented(){return pd(this).canceled},get composed(){return Boolean(pd(this).event.composed)},get timeStamp(){return pd(this).timeStamp},get srcElement(){return pd(this).eventTarget},get cancelBubble(){return pd(this).stopped},set cancelBubble(value){if(!value)return;let data=pd(this);if(data.stopped=!0,typeof data.event.cancelBubble==="boolean")data.event.cancelBubble=!0},get returnValue(){return!pd(this).canceled},set returnValue(value){if(!value)setCancelFlag(pd(this))},initEvent(){}},Object.defineProperty(Event.prototype,"constructor",{value:Event,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.Event<"u")Object.setPrototypeOf(Event.prototype,window.Event.prototype),wrappers.set(window.Event.prototype,Event);function defineRedirectDescriptor(key){return{get(){return pd(this).event[key]},set(value){pd(this).event[key]=value},configurable:!0,enumerable:!0}}function defineCallDescriptor(key){return{value(){let event=pd(this).event;return event[key].apply(event,arguments)},configurable:!0,enumerable:!0}}function defineWrapper(BaseEvent,proto){let keys=Object.keys(proto);if(keys.length===0)return BaseEvent;function CustomEvent(eventTarget,event){BaseEvent.call(this,eventTarget,event)}CustomEvent.prototype=Object.create(BaseEvent.prototype,{constructor:{value:CustomEvent,configurable:!0,writable:!0}});for(let i2=0;i2<keys.length;++i2){let key=keys[i2];if(!(key in BaseEvent.prototype)){let isFunc=typeof Object.getOwnPropertyDescriptor(proto,key).value==="function";Object.defineProperty(CustomEvent.prototype,key,isFunc?defineCallDescriptor(key):defineRedirectDescriptor(key))}}return CustomEvent}function getWrapper(proto){if(proto==null||proto===Object.prototype)return Event;let wrapper=wrappers.get(proto);if(wrapper==null)wrapper=defineWrapper(getWrapper(Object.getPrototypeOf(proto)),proto),wrappers.set(proto,wrapper);return wrapper}function wrapEvent(eventTarget,event){return new(getWrapper(Object.getPrototypeOf(event)))(eventTarget,event)}function isStopped(event){return pd(event).immediateStopped}function setEventPhase(event,eventPhase){pd(event).eventPhase=eventPhase}function setCurrentTarget(event,currentTarget){pd(event).currentTarget=currentTarget}function setPassiveListener(event,passiveListener){pd(event).passiveListener=passiveListener}var listenersMap=new WeakMap,CAPTURE=1,BUBBLE=2,ATTRIBUTE=3;function isObject2(x){return x!==null&&typeof x==="object"}function getListeners(eventTarget){let listeners=listenersMap.get(eventTarget);if(listeners==null)throw TypeError("'this' is expected an EventTarget object, but got another value.");return listeners}function defineEventAttributeDescriptor(eventName){return{get(){let node=getListeners(this).get(eventName);while(node!=null){if(node.listenerType===ATTRIBUTE)return node.listener;node=node.next}return null},set(listener){if(typeof listener!=="function"&&!isObject2(listener))listener=null;let listeners=getListeners(this),prev=null,node=listeners.get(eventName);while(node!=null){if(node.listenerType===ATTRIBUTE)if(prev!==null)prev.next=node.next;else if(node.next!==null)listeners.set(eventName,node.next);else listeners.delete(eventName);else prev=node;node=node.next}if(listener!==null){let newNode={listener,listenerType:ATTRIBUTE,passive:!1,once:!1,next:null};if(prev===null)listeners.set(eventName,newNode);else prev.next=newNode}},configurable:!0,enumerable:!0}}function defineEventAttribute(eventTargetPrototype,eventName){Object.defineProperty(eventTargetPrototype,`on${eventName}`,defineEventAttributeDescriptor(eventName))}function defineCustomEventTarget(eventNames){function CustomEventTarget(){EventTarget.call(this)}CustomEventTarget.prototype=Object.create(EventTarget.prototype,{constructor:{value:CustomEventTarget,configurable:!0,writable:!0}});for(let i2=0;i2<eventNames.length;++i2)defineEventAttribute(CustomEventTarget.prototype,eventNames[i2]);return CustomEventTarget}function EventTarget(){if(this instanceof EventTarget){listenersMap.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return defineCustomEventTarget(arguments[0]);if(arguments.length>0){let types2=Array(arguments.length);for(let i2=0;i2<arguments.length;++i2)types2[i2]=arguments[i2];return defineCustomEventTarget(types2)}throw TypeError("Cannot call a class as a function")}if(EventTarget.prototype={addEventListener(eventName,listener,options){if(listener==null)return;if(typeof listener!=="function"&&!isObject2(listener))throw TypeError("'listener' should be a function or an object.");let listeners=getListeners(this),optionsIsObj=isObject2(options),listenerType=(optionsIsObj?Boolean(options.capture):Boolean(options))?CAPTURE:BUBBLE,newNode={listener,listenerType,passive:optionsIsObj&&Boolean(options.passive),once:optionsIsObj&&Boolean(options.once),next:null},node=listeners.get(eventName);if(node===void 0){listeners.set(eventName,newNode);return}let prev=null;while(node!=null){if(node.listener===listener&&node.listenerType===listenerType)return;prev=node,node=node.next}prev.next=newNode},removeEventListener(eventName,listener,options){if(listener==null)return;let listeners=getListeners(this),listenerType=(isObject2(options)?Boolean(options.capture):Boolean(options))?CAPTURE:BUBBLE,prev=null,node=listeners.get(eventName);while(node!=null){if(node.listener===listener&&node.listenerType===listenerType){if(prev!==null)prev.next=node.next;else if(node.next!==null)listeners.set(eventName,node.next);else listeners.delete(eventName);return}prev=node,node=node.next}},dispatchEvent(event){if(event==null||typeof event.type!=="string")throw TypeError('"event.type" should be a string.');let listeners=getListeners(this),eventName=event.type,node=listeners.get(eventName);if(node==null)return!0;let wrappedEvent=wrapEvent(this,event),prev=null;while(node!=null){if(node.once)if(prev!==null)prev.next=node.next;else if(node.next!==null)listeners.set(eventName,node.next);else listeners.delete(eventName);else prev=node;if(setPassiveListener(wrappedEvent,node.passive?node.listener:null),typeof node.listener==="function")try{node.listener.call(this,wrappedEvent)}catch(err){if(typeof console<"u"&&typeof console.error==="function")console.error(err)}else if(node.listenerType!==ATTRIBUTE&&typeof node.listener.handleEvent==="function")node.listener.handleEvent(wrappedEvent);if(isStopped(wrappedEvent))break;node=node.next}return setPassiveListener(wrappedEvent,null),setEventPhase(wrappedEvent,0),setCurrentTarget(wrappedEvent,null),!wrappedEvent.defaultPrevented}},Object.defineProperty(EventTarget.prototype,"constructor",{value:EventTarget,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.EventTarget<"u")Object.setPrototypeOf(EventTarget.prototype,window.EventTarget.prototype);exports2.defineEventAttribute=defineEventAttribute,exports2.EventTarget=EventTarget,exports2.default=EventTarget,module2.exports=EventTarget,module2.exports.EventTarget=module2.exports.default=EventTarget,module2.exports.defineEventAttribute=defineEventAttribute}),require_abort_controller=__commonJS2((exports2,module2)=>{Object.defineProperty(exports2,"__esModule",{value:!0});var eventTargetShim=require_event_target_shim();class AbortSignal extends eventTargetShim.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let aborted=abortedFlags.get(this);if(typeof aborted!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return aborted}}eventTargetShim.defineEventAttribute(AbortSignal.prototype,"abort");function createAbortSignal(){let signal=Object.create(AbortSignal.prototype);return eventTargetShim.EventTarget.call(signal),abortedFlags.set(signal,!1),signal}function abortSignal(signal){if(abortedFlags.get(signal)!==!1)return;abortedFlags.set(signal,!0),signal.dispatchEvent({type:"abort"})}var abortedFlags=new WeakMap;if(Object.defineProperties(AbortSignal.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(AbortSignal.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class AbortController{constructor(){signals.set(this,createAbortSignal())}get signal(){return getSignal(this)}abort(){abortSignal(getSignal(this))}}var signals=new WeakMap;function getSignal(controller){let signal=signals.get(controller);if(signal==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller===null?"null":typeof controller}`);return signal}if(Object.defineProperties(AbortController.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(AbortController.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});exports2.AbortController=AbortController,exports2.AbortSignal=AbortSignal,exports2.default=AbortController,module2.exports=AbortController,module2.exports.AbortController=module2.exports.default=AbortController,module2.exports.AbortSignal=AbortSignal}),require_util=__commonJS2((exports2,module2)=>{var bufferModule=(init_buffer(),__toCommonJS(exports_buffer)),{format:format2,inspect:inspect2}=require_inspect(),{codes:{ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3}}=require_errors(),{kResistStopPropagation,AggregateError:AggregateError2,SymbolDispose}=require_primordials(),AbortSignal=globalThis.AbortSignal||require_abort_controller().AbortSignal,AbortController=globalThis.AbortController||require_abort_controller().AbortController,AsyncFunction=Object.getPrototypeOf(async function(){}).constructor,Blob2=globalThis.Blob||bufferModule.Blob,isBlob=typeof Blob2<"u"?function(b){return b instanceof Blob2}:function(b){return!1},validateAbortSignal2=(signal,name)=>{if(signal!==void 0&&(signal===null||typeof signal!=="object"||!("aborted"in signal)))throw new ERR_INVALID_ARG_TYPE3(name,"AbortSignal",signal)},validateFunction=(value,name)=>{if(typeof value!=="function")throw new ERR_INVALID_ARG_TYPE3(name,"Function",value)};module2.exports={AggregateError:AggregateError2,kEmptyObject:Object.freeze({}),once(callback){let called=!1;return function(...args){if(called)return;called=!0,callback.apply(this,args)}},createDeferredPromise:function(){let resolve,reject;return{promise:new Promise((res,rej)=>{resolve=res,reject=rej}),resolve,reject}},promisify(fn){return new Promise((resolve,reject)=>{fn((err,...args)=>{if(err)return reject(err);return resolve(...args)})})},debuglog(){return function(){}},format:format2,inspect:inspect2,types:{isAsyncFunction(fn){return fn instanceof AsyncFunction},isArrayBufferView(arr){return ArrayBuffer.isView(arr)}},isBlob,deprecate(fn,message){return fn},addAbortListener:(init_events(),__toCommonJS(exports_events)).addAbortListener||function(signal,listener){if(signal===void 0)throw new ERR_INVALID_ARG_TYPE3("signal","AbortSignal",signal);validateAbortSignal2(signal,"signal"),validateFunction(listener,"listener");let removeEventListener;if(signal.aborted)queueMicrotask(()=>listener());else signal.addEventListener("abort",listener,{__proto__:null,once:!0,[kResistStopPropagation]:!0}),removeEventListener=()=>{signal.removeEventListener("abort",listener)};return{__proto__:null,[SymbolDispose](){var _removeEventListener;(_removeEventListener=removeEventListener)===null||_removeEventListener===void 0||_removeEventListener()}}},AbortSignalAny:AbortSignal.any||function(signals){if(signals.length===1)return signals[0];let ac=new AbortController,abort=()=>ac.abort();return signals.forEach((signal)=>{validateAbortSignal2(signal,"signals"),signal.addEventListener("abort",abort,{once:!0})}),ac.signal.addEventListener("abort",()=>{signals.forEach((signal)=>signal.removeEventListener("abort",abort))},{once:!0}),ac.signal}},module2.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),require_validators=__commonJS2((exports2,module2)=>{var{ArrayIsArray,ArrayPrototypeIncludes,ArrayPrototypeJoin,ArrayPrototypeMap,NumberIsInteger,NumberIsNaN,NumberMAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER,NumberParseInt,ObjectPrototypeHasOwnProperty,RegExpPrototypeExec,String:String2,StringPrototypeToUpperCase,StringPrototypeTrim}=require_primordials(),{hideStackFrames,codes:{ERR_SOCKET_BAD_PORT,ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3,ERR_INVALID_ARG_VALUE,ERR_OUT_OF_RANGE:ERR_OUT_OF_RANGE3,ERR_UNKNOWN_SIGNAL}}=require_errors(),{normalizeEncoding}=require_util(),{isAsyncFunction,isArrayBufferView}=require_util().types,signals={};function isInt32(value){return value===(value|0)}function isUint32(value){return value===value>>>0}var octalReg=/^[0-7]+$/,modeDesc="must be a 32-bit unsigned integer or an octal string";function parseFileMode(value,name,def){if(typeof value>"u")value=def;if(typeof value==="string"){if(RegExpPrototypeExec(octalReg,value)===null)throw new ERR_INVALID_ARG_VALUE(name,value,modeDesc);value=NumberParseInt(value,8)}return validateUint32(value,name),value}var validateInteger=hideStackFrames((value,name,min=NumberMIN_SAFE_INTEGER,max=NumberMAX_SAFE_INTEGER)=>{if(typeof value!=="number")throw new ERR_INVALID_ARG_TYPE3(name,"number",value);if(!NumberIsInteger(value))throw new ERR_OUT_OF_RANGE3(name,"an integer",value);if(value<min||value>max)throw new ERR_OUT_OF_RANGE3(name,`>= ${min} && <= ${max}`,value)}),validateInt32=hideStackFrames((value,name,min=-2147483648,max=2147483647)=>{if(typeof value!=="number")throw new ERR_INVALID_ARG_TYPE3(name,"number",value);if(!NumberIsInteger(value))throw new ERR_OUT_OF_RANGE3(name,"an integer",value);if(value<min||value>max)throw new ERR_OUT_OF_RANGE3(name,`>= ${min} && <= ${max}`,value)}),validateUint32=hideStackFrames((value,name,positive=!1)=>{if(typeof value!=="number")throw new ERR_INVALID_ARG_TYPE3(name,"number",value);if(!NumberIsInteger(value))throw new ERR_OUT_OF_RANGE3(name,"an integer",value);let min=positive?1:0,max=4294967295;if(value<min||value>max)throw new ERR_OUT_OF_RANGE3(name,`>= ${min} && <= ${max}`,value)});function validateString(value,name){if(typeof value!=="string")throw new ERR_INVALID_ARG_TYPE3(name,"string",value)}function validateNumber3(value,name,min=void 0,max){if(typeof value!=="number")throw new ERR_INVALID_ARG_TYPE3(name,"number",value);if(min!=null&&value<min||max!=null&&value>max||(min!=null||max!=null)&&NumberIsNaN(value))throw new ERR_OUT_OF_RANGE3(name,`${min!=null?`>= ${min}`:""}${min!=null&&max!=null?" && ":""}${max!=null?`<= ${max}`:""}`,value)}var validateOneOf=hideStackFrames((value,name,oneOf)=>{if(!ArrayPrototypeIncludes(oneOf,value)){let reason="must be one of: "+ArrayPrototypeJoin(ArrayPrototypeMap(oneOf,(v)=>typeof v==="string"?`'${v}'`:String2(v)),", ");throw new ERR_INVALID_ARG_VALUE(name,value,reason)}});function validateBoolean2(value,name){if(typeof value!=="boolean")throw new ERR_INVALID_ARG_TYPE3(name,"boolean",value)}function getOwnPropertyValueOrDefault(options,key,defaultValue){return options==null||!ObjectPrototypeHasOwnProperty(options,key)?defaultValue:options[key]}var validateObject=hideStackFrames((value,name,options=null)=>{let allowArray=getOwnPropertyValueOrDefault(options,"allowArray",!1),allowFunction=getOwnPropertyValueOrDefault(options,"allowFunction",!1);if(!getOwnPropertyValueOrDefault(options,"nullable",!1)&&value===null||!allowArray&&ArrayIsArray(value)||typeof value!=="object"&&(!allowFunction||typeof value!=="function"))throw new ERR_INVALID_ARG_TYPE3(name,"Object",value)}),validateDictionary=hideStackFrames((value,name)=>{if(value!=null&&typeof value!=="object"&&typeof value!=="function")throw new ERR_INVALID_ARG_TYPE3(name,"a dictionary",value)}),validateArray=hideStackFrames((value,name,minLength=0)=>{if(!ArrayIsArray(value))throw new ERR_INVALID_ARG_TYPE3(name,"Array",value);if(value.length<minLength){let reason=`must be longer than ${minLength}`;throw new ERR_INVALID_ARG_VALUE(name,value,reason)}});function validateStringArray(value,name){validateArray(value,name);for(let i2=0;i2<value.length;i2++)validateString(value[i2],`${name}[${i2}]`)}function validateBooleanArray(value,name){validateArray(value,name);for(let i2=0;i2<value.length;i2++)validateBoolean2(value[i2],`${name}[${i2}]`)}function validateAbortSignalArray(value,name){validateArray(value,name);for(let i2=0;i2<value.length;i2++){let signal=value[i2],indexedName=`${name}[${i2}]`;if(signal==null)throw new ERR_INVALID_ARG_TYPE3(indexedName,"AbortSignal",signal);validateAbortSignal2(signal,indexedName)}}function validateSignalName(signal,name="signal"){if(validateString(signal,name),signals[signal]===void 0){if(signals[StringPrototypeToUpperCase(signal)]!==void 0)throw new ERR_UNKNOWN_SIGNAL(signal+" (signals must use all capital letters)");throw new ERR_UNKNOWN_SIGNAL(signal)}}var validateBuffer=hideStackFrames((buffer,name="buffer")=>{if(!isArrayBufferView(buffer))throw new ERR_INVALID_ARG_TYPE3(name,["Buffer","TypedArray","DataView"],buffer)});function validateEncoding(data,encoding){let normalizedEncoding=normalizeEncoding(encoding),length=data.length;if(normalizedEncoding==="hex"&&length%2!==0)throw new ERR_INVALID_ARG_VALUE("encoding",encoding,`is invalid for data of length ${length}`)}function validatePort(port,name="Port",allowZero=!0){if(typeof port!=="number"&&typeof port!=="string"||typeof port==="string"&&StringPrototypeTrim(port).length===0||+port!==+port>>>0||port>65535||port===0&&!allowZero)throw new ERR_SOCKET_BAD_PORT(name,port,allowZero);return port|0}var validateAbortSignal2=hideStackFrames((signal,name)=>{if(signal!==void 0&&(signal===null||typeof signal!=="object"||!("aborted"in signal)))throw new ERR_INVALID_ARG_TYPE3(name,"AbortSignal",signal)}),validateFunction=hideStackFrames((value,name)=>{if(typeof value!=="function")throw new ERR_INVALID_ARG_TYPE3(name,"Function",value)}),validatePlainFunction=hideStackFrames((value,name)=>{if(typeof value!=="function"||isAsyncFunction(value))throw new ERR_INVALID_ARG_TYPE3(name,"Function",value)}),validateUndefined=hideStackFrames((value,name)=>{if(value!==void 0)throw new ERR_INVALID_ARG_TYPE3(name,"undefined",value)});function validateUnion(value,name,union){if(!ArrayPrototypeIncludes(union,value))throw new ERR_INVALID_ARG_TYPE3(name,`('${ArrayPrototypeJoin(union,"|")}')`,value)}var linkValueRegExp=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function validateLinkHeaderFormat(value,name){if(typeof value>"u"||!RegExpPrototypeExec(linkValueRegExp,value))throw new ERR_INVALID_ARG_VALUE(name,value,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function validateLinkHeaderValue(hints){if(typeof hints==="string")return validateLinkHeaderFormat(hints,"hints"),hints;else if(ArrayIsArray(hints)){let hintsLength=hints.length,result="";if(hintsLength===0)return result;for(let i2=0;i2<hintsLength;i2++){let link=hints[i2];if(validateLinkHeaderFormat(link,"hints"),result+=link,i2!==hintsLength-1)result+=", "}return result}throw new ERR_INVALID_ARG_VALUE("hints",hints,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}module2.exports={isInt32,isUint32,parseFileMode,validateArray,validateStringArray,validateBooleanArray,validateAbortSignalArray,validateBoolean:validateBoolean2,validateBuffer,validateDictionary,validateEncoding,validateFunction,validateInt32,validateInteger,validateNumber:validateNumber3,validateObject,validateOneOf,validatePlainFunction,validatePort,validateSignalName,validateString,validateUint32,validateUndefined,validateUnion,validateAbortSignal:validateAbortSignal2,validateLinkHeaderValue}}),require_process=__commonJS2((exports2,module2)=>{module2.exports=globalThis.process}),require_utils=__commonJS2((exports2,module2)=>{var{SymbolAsyncIterator,SymbolIterator,SymbolFor:SymbolFor2}=require_primordials(),kIsDestroyed=SymbolFor2("nodejs.stream.destroyed"),kIsErrored=SymbolFor2("nodejs.stream.errored"),kIsReadable=SymbolFor2("nodejs.stream.readable"),kIsWritable=SymbolFor2("nodejs.stream.writable"),kIsDisturbed=SymbolFor2("nodejs.stream.disturbed"),kIsClosedPromise=SymbolFor2("nodejs.webstream.isClosedPromise"),kControllerErrorFunction=SymbolFor2("nodejs.webstream.controllerErrorFunction");function isReadableNodeStream(obj,strict=!1){var _obj$_readableState;return!!(obj&&typeof obj.pipe==="function"&&typeof obj.on==="function"&&(!strict||typeof obj.pause==="function"&&typeof obj.resume==="function")&&(!obj._writableState||((_obj$_readableState=obj._readableState)===null||_obj$_readableState===void 0?void 0:_obj$_readableState.readable)!==!1)&&(!obj._writableState||obj._readableState))}function isWritableNodeStream(obj){var _obj$_writableState;return!!(obj&&typeof obj.write==="function"&&typeof obj.on==="function"&&(!obj._readableState||((_obj$_writableState=obj._writableState)===null||_obj$_writableState===void 0?void 0:_obj$_writableState.writable)!==!1))}function isDuplexNodeStream(obj){return!!(obj&&typeof obj.pipe==="function"&&obj._readableState&&typeof obj.on==="function"&&typeof obj.write==="function")}function isNodeStream(obj){return obj&&(obj._readableState||obj._writableState||typeof obj.write==="function"&&typeof obj.on==="function"||typeof obj.pipe==="function"&&typeof obj.on==="function")}function isReadableStream(obj){return!!(obj&&!isNodeStream(obj)&&typeof obj.pipeThrough==="function"&&typeof obj.getReader==="function"&&typeof obj.cancel==="function")}function isWritableStream(obj){return!!(obj&&!isNodeStream(obj)&&typeof obj.getWriter==="function"&&typeof obj.abort==="function")}function isTransformStream(obj){return!!(obj&&!isNodeStream(obj)&&typeof obj.readable==="object"&&typeof obj.writable==="object")}function isWebStream(obj){return isReadableStream(obj)||isWritableStream(obj)||isTransformStream(obj)}function isIterable(obj,isAsync){if(obj==null)return!1;if(isAsync===!0)return typeof obj[SymbolAsyncIterator]==="function";if(isAsync===!1)return typeof obj[SymbolIterator]==="function";return typeof obj[SymbolAsyncIterator]==="function"||typeof obj[SymbolIterator]==="function"}function isDestroyed(stream){if(!isNodeStream(stream))return null;let{_writableState:wState,_readableState:rState}=stream,state=wState||rState;return!!(stream.destroyed||stream[kIsDestroyed]||state!==null&&state!==void 0&&state.destroyed)}function isWritableEnded(stream){if(!isWritableNodeStream(stream))return null;if(stream.writableEnded===!0)return!0;let wState=stream._writableState;if(wState!==null&&wState!==void 0&&wState.errored)return!1;if(typeof(wState===null||wState===void 0?void 0:wState.ended)!=="boolean")return null;return wState.ended}function isWritableFinished(stream,strict){if(!isWritableNodeStream(stream))return null;if(stream.writableFinished===!0)return!0;let wState=stream._writableState;if(wState!==null&&wState!==void 0&&wState.errored)return!1;if(typeof(wState===null||wState===void 0?void 0:wState.finished)!=="boolean")return null;return!!(wState.finished||strict===!1&&wState.ended===!0&&wState.length===0)}function isReadableEnded(stream){if(!isReadableNodeStream(stream))return null;if(stream.readableEnded===!0)return!0;let rState=stream._readableState;if(!rState||rState.errored)return!1;if(typeof(rState===null||rState===void 0?void 0:rState.ended)!=="boolean")return null;return rState.ended}function isReadableFinished(stream,strict){if(!isReadableNodeStream(stream))return null;let rState=stream._readableState;if(rState!==null&&rState!==void 0&&rState.errored)return!1;if(typeof(rState===null||rState===void 0?void 0:rState.endEmitted)!=="boolean")return null;return!!(rState.endEmitted||strict===!1&&rState.ended===!0&&rState.length===0)}function isReadable(stream){if(stream&&stream[kIsReadable]!=null)return stream[kIsReadable];if(typeof(stream===null||stream===void 0?void 0:stream.readable)!=="boolean")return null;if(isDestroyed(stream))return!1;return isReadableNodeStream(stream)&&stream.readable&&!isReadableFinished(stream)}function isWritable(stream){if(stream&&stream[kIsWritable]!=null)return stream[kIsWritable];if(typeof(stream===null||stream===void 0?void 0:stream.writable)!=="boolean")return null;if(isDestroyed(stream))return!1;return isWritableNodeStream(stream)&&stream.writable&&!isWritableEnded(stream)}function isFinished(stream,opts){if(!isNodeStream(stream))return null;if(isDestroyed(stream))return!0;if((opts===null||opts===void 0?void 0:opts.readable)!==!1&&isReadable(stream))return!1;if((opts===null||opts===void 0?void 0:opts.writable)!==!1&&isWritable(stream))return!1;return!0}function isWritableErrored(stream){var _stream$_writableStat,_stream$_writableStat2;if(!isNodeStream(stream))return null;if(stream.writableErrored)return stream.writableErrored;return(_stream$_writableStat=(_stream$_writableStat2=stream._writableState)===null||_stream$_writableStat2===void 0?void 0:_stream$_writableStat2.errored)!==null&&_stream$_writableStat!==void 0?_stream$_writableStat:null}function isReadableErrored(stream){var _stream$_readableStat,_stream$_readableStat2;if(!isNodeStream(stream))return null;if(stream.readableErrored)return stream.readableErrored;return(_stream$_readableStat=(_stream$_readableStat2=stream._readableState)===null||_stream$_readableStat2===void 0?void 0:_stream$_readableStat2.errored)!==null&&_stream$_readableStat!==void 0?_stream$_readableStat:null}function isClosed(stream){if(!isNodeStream(stream))return null;if(typeof stream.closed==="boolean")return stream.closed;let{_writableState:wState,_readableState:rState}=stream;if(typeof(wState===null||wState===void 0?void 0:wState.closed)==="boolean"||typeof(rState===null||rState===void 0?void 0:rState.closed)==="boolean")return(wState===null||wState===void 0?void 0:wState.closed)||(rState===null||rState===void 0?void 0:rState.closed);if(typeof stream._closed==="boolean"&&isOutgoingMessage(stream))return stream._closed;return null}function isOutgoingMessage(stream){return typeof stream._closed==="boolean"&&typeof stream._defaultKeepAlive==="boolean"&&typeof stream._removedConnection==="boolean"&&typeof stream._removedContLen==="boolean"}function isServerResponse(stream){return typeof stream._sent100==="boolean"&&isOutgoingMessage(stream)}function isServerRequest(stream){var _stream$req;return typeof stream._consuming==="boolean"&&typeof stream._dumped==="boolean"&&((_stream$req=stream.req)===null||_stream$req===void 0?void 0:_stream$req.upgradeOrConnect)===void 0}function willEmitClose(stream){if(!isNodeStream(stream))return null;let{_writableState:wState,_readableState:rState}=stream,state=wState||rState;return!state&&isServerResponse(stream)||!!(state&&state.autoDestroy&&state.emitClose&&state.closed===!1)}function isDisturbed(stream){var _stream$kIsDisturbed;return!!(stream&&((_stream$kIsDisturbed=stream[kIsDisturbed])!==null&&_stream$kIsDisturbed!==void 0?_stream$kIsDisturbed:stream.readableDidRead||stream.readableAborted))}function isErrored(stream){var _ref,_ref2,_ref3,_ref4,_ref5,_stream$kIsErrored,_stream$_readableStat3,_stream$_writableStat3,_stream$_readableStat4,_stream$_writableStat4;return!!(stream&&((_ref=(_ref2=(_ref3=(_ref4=(_ref5=(_stream$kIsErrored=stream[kIsErrored])!==null&&_stream$kIsErrored!==void 0?_stream$kIsErrored:stream.readableErrored)!==null&&_ref5!==void 0?_ref5:stream.writableErrored)!==null&&_ref4!==void 0?_ref4:(_stream$_readableStat3=stream._readableState)===null||_stream$_readableStat3===void 0?void 0:_stream$_readableStat3.errorEmitted)!==null&&_ref3!==void 0?_ref3:(_stream$_writableStat3=stream._writableState)===null||_stream$_writableStat3===void 0?void 0:_stream$_writableStat3.errorEmitted)!==null&&_ref2!==void 0?_ref2:(_stream$_readableStat4=stream._readableState)===null||_stream$_readableStat4===void 0?void 0:_stream$_readableStat4.errored)!==null&&_ref!==void 0?_ref:(_stream$_writableStat4=stream._writableState)===null||_stream$_writableStat4===void 0?void 0:_stream$_writableStat4.errored))}module2.exports={isDestroyed,kIsDestroyed,isDisturbed,kIsDisturbed,isErrored,kIsErrored,isReadable,kIsReadable,kIsClosedPromise,kControllerErrorFunction,kIsWritable,isClosed,isDuplexNodeStream,isFinished,isIterable,isReadableNodeStream,isReadableStream,isReadableEnded,isReadableFinished,isReadableErrored,isNodeStream,isWebStream,isWritable,isWritableNodeStream,isWritableStream,isWritableEnded,isWritableFinished,isWritableErrored,isServerRequest,isServerResponse,willEmitClose,isTransformStream}}),require_end_of_stream=__commonJS2((exports2,module2)=>{var process2=require_process(),{AbortError:AbortError2,codes}=require_errors(),{ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3,ERR_STREAM_PREMATURE_CLOSE}=codes,{kEmptyObject,once}=require_util(),{validateAbortSignal:validateAbortSignal2,validateFunction,validateObject,validateBoolean:validateBoolean2}=require_validators(),{Promise:Promise2,PromisePrototypeThen,SymbolDispose}=require_primordials(),{isClosed,isReadable,isReadableNodeStream,isReadableStream,isReadableFinished,isReadableErrored,isWritable,isWritableNodeStream,isWritableStream,isWritableFinished,isWritableErrored,isNodeStream,willEmitClose:_willEmitClose,kIsClosedPromise}=require_utils(),addAbortListener2;function isRequest(stream){return stream.setHeader&&typeof stream.abort==="function"}var nop=()=>{};function eos(stream,options,callback){var _options$readable,_options$writable;if(arguments.length===2)callback=options,options=kEmptyObject;else if(options==null)options=kEmptyObject;else validateObject(options,"options");if(validateFunction(callback,"callback"),validateAbortSignal2(options.signal,"options.signal"),callback=once(callback),isReadableStream(stream)||isWritableStream(stream))return eosWeb(stream,options,callback);if(!isNodeStream(stream))throw new ERR_INVALID_ARG_TYPE3("stream",["ReadableStream","WritableStream","Stream"],stream);let readable=(_options$readable=options.readable)!==null&&_options$readable!==void 0?_options$readable:isReadableNodeStream(stream),writable=(_options$writable=options.writable)!==null&&_options$writable!==void 0?_options$writable:isWritableNodeStream(stream),wState=stream._writableState,rState=stream._readableState,onlegacyfinish=()=>{if(!stream.writable)onfinish()},willEmitClose=_willEmitClose(stream)&&isReadableNodeStream(stream)===readable&&isWritableNodeStream(stream)===writable,writableFinished=isWritableFinished(stream,!1),onfinish=()=>{if(writableFinished=!0,stream.destroyed)willEmitClose=!1;if(willEmitClose&&(!stream.readable||readable))return;if(!readable||readableFinished)callback.call(stream)},readableFinished=isReadableFinished(stream,!1),onend=()=>{if(readableFinished=!0,stream.destroyed)willEmitClose=!1;if(willEmitClose&&(!stream.writable||writable))return;if(!writable||writableFinished)callback.call(stream)},onerror=(err)=>{callback.call(stream,err)},closed=isClosed(stream),onclose=()=>{closed=!0;let errored=isWritableErrored(stream)||isReadableErrored(stream);if(errored&&typeof errored!=="boolean")return callback.call(stream,errored);if(readable&&!readableFinished&&isReadableNodeStream(stream,!0)){if(!isReadableFinished(stream,!1))return callback.call(stream,new ERR_STREAM_PREMATURE_CLOSE)}if(writable&&!writableFinished){if(!isWritableFinished(stream,!1))return callback.call(stream,new ERR_STREAM_PREMATURE_CLOSE)}callback.call(stream)},onclosed=()=>{closed=!0;let errored=isWritableErrored(stream)||isReadableErrored(stream);if(errored&&typeof errored!=="boolean")return callback.call(stream,errored);callback.call(stream)},onrequest=()=>{stream.req.on("finish",onfinish)};if(isRequest(stream)){if(stream.on("complete",onfinish),!willEmitClose)stream.on("abort",onclose);if(stream.req)onrequest();else stream.on("request",onrequest)}else if(writable&&!wState)stream.on("end",onlegacyfinish),stream.on("close",onlegacyfinish);if(!willEmitClose&&typeof stream.aborted==="boolean")stream.on("aborted",onclose);if(stream.on("end",onend),stream.on("finish",onfinish),options.error!==!1)stream.on("error",onerror);if(stream.on("close",onclose),closed)process2.nextTick(onclose);else if(wState!==null&&wState!==void 0&&wState.errorEmitted||rState!==null&&rState!==void 0&&rState.errorEmitted){if(!willEmitClose)process2.nextTick(onclosed)}else if(!readable&&(!willEmitClose||isReadable(stream))&&(writableFinished||isWritable(stream)===!1))process2.nextTick(onclosed);else if(!writable&&(!willEmitClose||isWritable(stream))&&(readableFinished||isReadable(stream)===!1))process2.nextTick(onclosed);else if(rState&&stream.req&&stream.aborted)process2.nextTick(onclosed);let cleanup=()=>{if(callback=nop,stream.removeListener("aborted",onclose),stream.removeListener("complete",onfinish),stream.removeListener("abort",onclose),stream.removeListener("request",onrequest),stream.req)stream.req.removeListener("finish",onfinish);stream.removeListener("end",onlegacyfinish),stream.removeListener("close",onlegacyfinish),stream.removeListener("finish",onfinish),stream.removeListener("end",onend),stream.removeListener("error",onerror),stream.removeListener("close",onclose)};if(options.signal&&!closed){let abort=()=>{let endCallback=callback;cleanup(),endCallback.call(stream,new AbortError2(void 0,{cause:options.signal.reason}))};if(options.signal.aborted)process2.nextTick(abort);else{addAbortListener2=addAbortListener2||require_util().addAbortListener;let disposable=addAbortListener2(options.signal,abort),originalCallback=callback;callback=once((...args)=>{disposable[SymbolDispose](),originalCallback.apply(stream,args)})}}return cleanup}function eosWeb(stream,options,callback){let isAborted=!1,abort=nop;if(options.signal)if(abort=()=>{isAborted=!0,callback.call(stream,new AbortError2(void 0,{cause:options.signal.reason}))},options.signal.aborted)process2.nextTick(abort);else{addAbortListener2=addAbortListener2||require_util().addAbortListener;let disposable=addAbortListener2(options.signal,abort),originalCallback=callback;callback=once((...args)=>{disposable[SymbolDispose](),originalCallback.apply(stream,args)})}let resolverFn=(...args)=>{if(!isAborted)process2.nextTick(()=>callback.apply(stream,args))};return PromisePrototypeThen(stream[kIsClosedPromise].promise,resolverFn,resolverFn),nop}function finished(stream,opts){var _opts;let autoCleanup=!1;if(opts===null)opts=kEmptyObject;if((_opts=opts)!==null&&_opts!==void 0&&_opts.cleanup)validateBoolean2(opts.cleanup,"cleanup"),autoCleanup=opts.cleanup;return new Promise2((resolve,reject)=>{let cleanup=eos(stream,opts,(err)=>{if(autoCleanup)cleanup();if(err)reject(err);else resolve()})})}module2.exports=eos,module2.exports.finished=finished}),require_destroy=__commonJS2((exports2,module2)=>{var process2=require_process(),{aggregateTwoErrors,codes:{ERR_MULTIPLE_CALLBACK},AbortError:AbortError2}=require_errors(),{Symbol:Symbol2}=require_primordials(),{kIsDestroyed,isDestroyed,isFinished,isServerRequest}=require_utils(),kDestroy=Symbol2("kDestroy"),kConstruct=Symbol2("kConstruct");function checkError(err,w,r){if(err){if(err.stack,w&&!w.errored)w.errored=err;if(r&&!r.errored)r.errored=err}}function destroy(err,cb){let r=this._readableState,w=this._writableState,s=w||r;if(w!==null&&w!==void 0&&w.destroyed||r!==null&&r!==void 0&&r.destroyed){if(typeof cb==="function")cb();return this}if(checkError(err,w,r),w)w.destroyed=!0;if(r)r.destroyed=!0;if(!s.constructed)this.once(kDestroy,function(er){_destroy(this,aggregateTwoErrors(er,err),cb)});else _destroy(this,err,cb);return this}function _destroy(self2,err,cb){let called=!1;function onDestroy(err2){if(called)return;called=!0;let{_readableState:r,_writableState:w}=self2;if(checkError(err2,w,r),w)w.closed=!0;if(r)r.closed=!0;if(typeof cb==="function")cb(err2);if(err2)process2.nextTick(emitErrorCloseNT,self2,err2);else process2.nextTick(emitCloseNT,self2)}try{self2._destroy(err||null,onDestroy)}catch(err2){onDestroy(err2)}}function emitErrorCloseNT(self2,err){emitErrorNT(self2,err),emitCloseNT(self2)}function emitCloseNT(self2){let{_readableState:r,_writableState:w}=self2;if(w)w.closeEmitted=!0;if(r)r.closeEmitted=!0;if(w!==null&&w!==void 0&&w.emitClose||r!==null&&r!==void 0&&r.emitClose)self2.emit("close")}function emitErrorNT(self2,err){let{_readableState:r,_writableState:w}=self2;if(w!==null&&w!==void 0&&w.errorEmitted||r!==null&&r!==void 0&&r.errorEmitted)return;if(w)w.errorEmitted=!0;if(r)r.errorEmitted=!0;self2.emit("error",err)}function undestroy(){let r=this._readableState,w=this._writableState;if(r)r.constructed=!0,r.closed=!1,r.closeEmitted=!1,r.destroyed=!1,r.errored=null,r.errorEmitted=!1,r.reading=!1,r.ended=r.readable===!1,r.endEmitted=r.readable===!1;if(w)w.constructed=!0,w.destroyed=!1,w.closed=!1,w.closeEmitted=!1,w.errored=null,w.errorEmitted=!1,w.finalCalled=!1,w.prefinished=!1,w.ended=w.writable===!1,w.ending=w.writable===!1,w.finished=w.writable===!1}function errorOrDestroy(stream,err,sync){let{_readableState:r,_writableState:w}=stream;if(w!==null&&w!==void 0&&w.destroyed||r!==null&&r!==void 0&&r.destroyed)return this;if(r!==null&&r!==void 0&&r.autoDestroy||w!==null&&w!==void 0&&w.autoDestroy)stream.destroy(err);else if(err){if(err.stack,w&&!w.errored)w.errored=err;if(r&&!r.errored)r.errored=err;if(sync)process2.nextTick(emitErrorNT,stream,err);else emitErrorNT(stream,err)}}function construct(stream,cb){if(typeof stream._construct!=="function")return;let{_readableState:r,_writableState:w}=stream;if(r)r.constructed=!1;if(w)w.constructed=!1;if(stream.once(kConstruct,cb),stream.listenerCount(kConstruct)>1)return;process2.nextTick(constructNT,stream)}function constructNT(stream){let called=!1;function onConstruct(err){if(called){errorOrDestroy(stream,err!==null&&err!==void 0?err:new ERR_MULTIPLE_CALLBACK);return}called=!0;let{_readableState:r,_writableState:w}=stream,s=w||r;if(r)r.constructed=!0;if(w)w.constructed=!0;if(s.destroyed)stream.emit(kDestroy,err);else if(err)errorOrDestroy(stream,err,!0);else process2.nextTick(emitConstructNT,stream)}try{stream._construct((err)=>{process2.nextTick(onConstruct,err)})}catch(err){process2.nextTick(onConstruct,err)}}function emitConstructNT(stream){stream.emit(kConstruct)}function isRequest(stream){return(stream===null||stream===void 0?void 0:stream.setHeader)&&typeof stream.abort==="function"}function emitCloseLegacy(stream){stream.emit("close")}function emitErrorCloseLegacy(stream,err){stream.emit("error",err),process2.nextTick(emitCloseLegacy,stream)}function destroyer(stream,err){if(!stream||isDestroyed(stream))return;if(!err&&!isFinished(stream))err=new AbortError2;if(isServerRequest(stream))stream.socket=null,stream.destroy(err);else if(isRequest(stream))stream.abort();else if(isRequest(stream.req))stream.req.abort();else if(typeof stream.destroy==="function")stream.destroy(err);else if(typeof stream.close==="function")stream.close();else if(err)process2.nextTick(emitErrorCloseLegacy,stream,err);else process2.nextTick(emitCloseLegacy,stream);if(!stream.destroyed)stream[kIsDestroyed]=!0}module2.exports={construct,destroyer,destroy,undestroy,errorOrDestroy}}),require_legacy=__commonJS2((exports2,module2)=>{var{ArrayIsArray,ObjectSetPrototypeOf}=require_primordials(),{EventEmitter:EE}=(init_events(),__toCommonJS(exports_events));function Stream(opts){EE.call(this,opts)}ObjectSetPrototypeOf(Stream.prototype,EE.prototype),ObjectSetPrototypeOf(Stream,EE),Stream.prototype.pipe=function(dest,options){let source=this;function ondata(chunk){if(dest.writable&&dest.write(chunk)===!1&&source.pause)source.pause()}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume)source.resume()}if(dest.on("drain",ondrain),!dest._isStdio&&(!options||options.end!==!1))source.on("end",onend),source.on("close",onclose);let didOnEnd=!1;function onend(){if(didOnEnd)return;didOnEnd=!0,dest.end()}function onclose(){if(didOnEnd)return;if(didOnEnd=!0,typeof dest.destroy==="function")dest.destroy()}function onerror(er){if(cleanup(),EE.listenerCount(this,"error")===0)this.emit("error",er)}prependListener(source,"error",onerror),prependListener(dest,"error",onerror);function cleanup(){source.removeListener("data",ondata),dest.removeListener("drain",ondrain),source.removeListener("end",onend),source.removeListener("close",onclose),source.removeListener("error",onerror),dest.removeListener("error",onerror),source.removeListener("end",cleanup),source.removeListener("close",cleanup),dest.removeListener("close",cleanup)}return source.on("end",cleanup),source.on("close",cleanup),dest.on("close",cleanup),dest.emit("pipe",source),dest};function prependListener(emitter,event,fn){if(typeof emitter.prependListener==="function")return emitter.prependListener(event,fn);if(!emitter._events||!emitter._events[event])emitter.on(event,fn);else if(ArrayIsArray(emitter._events[event]))emitter._events[event].unshift(fn);else emitter._events[event]=[fn,emitter._events[event]]}module2.exports={Stream,prependListener}}),require_add_abort_signal=__commonJS2((exports2,module2)=>{var{SymbolDispose}=require_primordials(),{AbortError:AbortError2,codes}=require_errors(),{isNodeStream,isWebStream,kControllerErrorFunction}=require_utils(),eos=require_end_of_stream(),{ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3}=codes,addAbortListener2,validateAbortSignal2=(signal,name)=>{if(typeof signal!=="object"||!("aborted"in signal))throw new ERR_INVALID_ARG_TYPE3(name,"AbortSignal",signal)};module2.exports.addAbortSignal=function(signal,stream){if(validateAbortSignal2(signal,"signal"),!isNodeStream(stream)&&!isWebStream(stream))throw new ERR_INVALID_ARG_TYPE3("stream",["ReadableStream","WritableStream","Stream"],stream);return module2.exports.addAbortSignalNoValidate(signal,stream)},module2.exports.addAbortSignalNoValidate=function(signal,stream){if(typeof signal!=="object"||!("aborted"in signal))return stream;let onAbort=isNodeStream(stream)?()=>{stream.destroy(new AbortError2(void 0,{cause:signal.reason}))}:()=>{stream[kControllerErrorFunction](new AbortError2(void 0,{cause:signal.reason}))};if(signal.aborted)onAbort();else{addAbortListener2=addAbortListener2||require_util().addAbortListener;let disposable=addAbortListener2(signal,onAbort);eos(stream,disposable[SymbolDispose])}return stream}}),require_buffer_list=__commonJS2((exports2,module2)=>{var{StringPrototypeSlice,SymbolIterator,TypedArrayPrototypeSet,Uint8Array:Uint8Array2}=require_primordials(),{Buffer:Buffer3}=(init_buffer(),__toCommonJS(exports_buffer)),{inspect:inspect2}=require_util();module2.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(v){let entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry,++this.length}unshift(v){let entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry,++this.length}shift(){if(this.length===0)return;let ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,ret}clear(){this.head=this.tail=null,this.length=0}join(s){if(this.length===0)return"";let p=this.head,ret=""+p.data;while((p=p.next)!==null)ret+=s+p.data;return ret}concat(n){if(this.length===0)return Buffer3.alloc(0);let ret=Buffer3.allocUnsafe(n>>>0),p=this.head,i2=0;while(p)TypedArrayPrototypeSet(ret,p.data,i2),i2+=p.data.length,p=p.next;return ret}consume(n,hasStrings){let data=this.head.data;if(n<data.length){let slice=data.slice(0,n);return this.head.data=data.slice(n),slice}if(n===data.length)return this.shift();return hasStrings?this._getString(n):this._getBuffer(n)}first(){return this.head.data}*[SymbolIterator](){for(let p=this.head;p;p=p.next)yield p.data}_getString(n){let ret="",p=this.head,c=0;do{let str=p.data;if(n>str.length)ret+=str,n-=str.length;else{if(n===str.length)if(ret+=str,++c,p.next)this.head=p.next;else this.head=this.tail=null;else ret+=StringPrototypeSlice(str,0,n),this.head=p,p.data=StringPrototypeSlice(str,n);break}++c}while((p=p.next)!==null);return this.length-=c,ret}_getBuffer(n){let ret=Buffer3.allocUnsafe(n),retLen=n,p=this.head,c=0;do{let buf=p.data;if(n>buf.length)TypedArrayPrototypeSet(ret,buf,retLen-n),n-=buf.length;else{if(n===buf.length)if(TypedArrayPrototypeSet(ret,buf,retLen-n),++c,p.next)this.head=p.next;else this.head=this.tail=null;else TypedArrayPrototypeSet(ret,new Uint8Array2(buf.buffer,buf.byteOffset,n),retLen-n),this.head=p,p.data=buf.slice(n);break}++c}while((p=p.next)!==null);return this.length-=c,ret}[Symbol.for("nodejs.util.inspect.custom")](_,options){return inspect2(this,{...options,depth:0,customInspect:!1})}}}),require_state=__commonJS2((exports2,module2)=>{var{MathFloor,NumberIsInteger}=require_primordials(),{validateInteger}=require_validators(),{ERR_INVALID_ARG_VALUE}=require_errors().codes,defaultHighWaterMarkBytes=16384,defaultHighWaterMarkObjectMode=16;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null}function getDefaultHighWaterMark(objectMode){return objectMode?defaultHighWaterMarkObjectMode:defaultHighWaterMarkBytes}function setDefaultHighWaterMark(objectMode,value){if(validateInteger(value,"value",0),objectMode)defaultHighWaterMarkObjectMode=value;else defaultHighWaterMarkBytes=value}function getHighWaterMark(state,options,duplexKey,isDuplex){let hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!NumberIsInteger(hwm)||hwm<0){let name=isDuplex?`options.${duplexKey}`:"options.highWaterMark";throw new ERR_INVALID_ARG_VALUE(name,hwm)}return MathFloor(hwm)}return getDefaultHighWaterMark(state.objectMode)}module2.exports={getHighWaterMark,getDefaultHighWaterMark,setDefaultHighWaterMark}}),require_safe_buffer=__commonJS2((exports2,module2)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var buffer=(init_buffer(),__toCommonJS(exports_buffer)),Buffer3=buffer.Buffer;function copyProps(src,dst){for(var key in src)dst[key]=src[key]}if(Buffer3.from&&Buffer3.alloc&&Buffer3.allocUnsafe&&Buffer3.allocUnsafeSlow)module2.exports=buffer;else copyProps(buffer,exports2),exports2.Buffer=SafeBuffer;function SafeBuffer(arg,encodingOrOffset,length){return Buffer3(arg,encodingOrOffset,length)}SafeBuffer.prototype=Object.create(Buffer3.prototype),copyProps(Buffer3,SafeBuffer),SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==="number")throw TypeError("Argument must not be a number");return Buffer3(arg,encodingOrOffset,length)},SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=="number")throw TypeError("Argument must be a number");var buf=Buffer3(size);if(fill!==void 0)if(typeof encoding==="string")buf.fill(fill,encoding);else buf.fill(fill);else buf.fill(0);return buf},SafeBuffer.allocUnsafe=function(size){if(typeof size!=="number")throw TypeError("Argument must be a number");return Buffer3(size)},SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=="number")throw TypeError("Argument must be a number");return buffer.SlowBuffer(size)}}),require_string_decoder=__commonJS2((exports2)=>{var Buffer3=require_safe_buffer().Buffer,isEncoding=Buffer3.isEncoding||function(encoding){switch(encoding=""+encoding,encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(enc){if(!enc)return"utf8";var retried;while(!0)switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase(),retried=!0}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!=="string"&&(Buffer3.isEncoding===isEncoding||!isEncoding(enc)))throw Error("Unknown encoding: "+enc);return nenc||enc}exports2.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,nb=4;break;case"utf8":this.fillLast=utf8FillLast,nb=4;break;case"base64":this.text=base64Text,this.end=base64End,nb=3;break;default:this.write=simpleWrite,this.end=simpleEnd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer3.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r,i2;if(this.lastNeed){if(r=this.fillLast(buf),r===void 0)return"";i2=this.lastNeed,this.lastNeed=0}else i2=0;if(i2<buf.length)return r?r+this.text(buf,i2):this.text(buf,i2);return r||""},StringDecoder.prototype.end=utf8End,StringDecoder.prototype.text=utf8Text,StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length),this.lastNeed-=buf.length};function utf8CheckByte(byte){if(byte<=127)return 0;else if(byte>>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return byte>>6===2?-1:-2}function utf8CheckIncomplete(self2,buf,i2){var j=buf.length-1;if(j<i2)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self2.lastNeed=nb-1;return nb}if(--j<i2||nb===-2)return 0;if(nb=utf8CheckByte(buf[j]),nb>=0){if(nb>0)self2.lastNeed=nb-2;return nb}if(--j<i2||nb===-2)return 0;if(nb=utf8CheckByte(buf[j]),nb>=0){if(nb>0)if(nb===2)nb=0;else self2.lastNeed=nb-3;return nb}return 0}function utf8CheckExtraBytes(self2,buf,p){if((buf[0]&192)!==128)return self2.lastNeed=0,"�";if(self2.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128)return self2.lastNeed=1,"�";if(self2.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128)return self2.lastNeed=2,"�"}}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed,r=utf8CheckExtraBytes(this,buf,p);if(r!==void 0)return r;if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,p,0,buf.length),this.lastNeed-=buf.length}function utf8Text(buf,i2){var total=utf8CheckIncomplete(this,buf,i2);if(!this.lastNeed)return buf.toString("utf8",i2);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);return buf.copy(this.lastChar,0,end),buf.toString("utf8",i2,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+"�";return r}function utf16Text(buf,i2){if((buf.length-i2)%2===0){var r=buf.toString("utf16le",i2);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=buf[buf.length-1],buf.toString("utf16le",i2,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i2){var n=(buf.length-i2)%3;if(n===0)return buf.toString("base64",i2);if(this.lastNeed=3-n,this.lastTotal=3,n===1)this.lastChar[0]=buf[buf.length-1];else this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1];return buf.toString("base64",i2,buf.length-n)}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+this.lastChar.toString("base64",0,3-this.lastNeed);return r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}}),require_from=__commonJS2((exports2,module2)=>{var process2=require_process(),{PromisePrototypeThen,SymbolAsyncIterator,SymbolIterator}=require_primordials(),{Buffer:Buffer3}=(init_buffer(),__toCommonJS(exports_buffer)),{ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3,ERR_STREAM_NULL_VALUES}=require_errors().codes;function from2(Readable,iterable,opts){let iterator;if(typeof iterable==="string"||iterable instanceof Buffer3)return new Readable({objectMode:!0,...opts,read(){this.push(iterable),this.push(null)}});let isAsync;if(iterable&&iterable[SymbolAsyncIterator])isAsync=!0,iterator=iterable[SymbolAsyncIterator]();else if(iterable&&iterable[SymbolIterator])isAsync=!1,iterator=iterable[SymbolIterator]();else throw new ERR_INVALID_ARG_TYPE3("iterable",["Iterable"],iterable);let readable=new Readable({objectMode:!0,highWaterMark:1,...opts}),reading=!1;readable._read=function(){if(!reading)reading=!0,next()},readable._destroy=function(error,cb){PromisePrototypeThen(close(error),()=>process2.nextTick(cb,error),(e)=>process2.nextTick(cb,e||error))};async function close(error){let hadError=error!==void 0&&error!==null,hasThrow=typeof iterator.throw==="function";if(hadError&&hasThrow){let{value,done}=await iterator.throw(error);if(await value,done)return}if(typeof iterator.return==="function"){let{value}=await iterator.return();await value}}async function next(){for(;;){try{let{value,done}=isAsync?await iterator.next():iterator.next();if(done)readable.push(null);else{let res=value&&typeof value.then==="function"?await value:value;if(res===null)throw reading=!1,new ERR_STREAM_NULL_VALUES;else if(readable.push(res))continue;else reading=!1}}catch(err){readable.destroy(err)}break}}return readable}module2.exports=from2}),require_readable=__commonJS2((exports2,module2)=>{var process2=require_process(),{ArrayPrototypeIndexOf,NumberIsInteger,NumberIsNaN,NumberParseInt,ObjectDefineProperties,ObjectKeys,ObjectSetPrototypeOf,Promise:Promise2,SafeSet,SymbolAsyncDispose,SymbolAsyncIterator,Symbol:Symbol2}=require_primordials();module2.exports=Readable,Readable.ReadableState=ReadableState;var{EventEmitter:EE}=(init_events(),__toCommonJS(exports_events)),{Stream,prependListener}=require_legacy(),{Buffer:Buffer3}=(init_buffer(),__toCommonJS(exports_buffer)),{addAbortSignal}=require_add_abort_signal(),eos=require_end_of_stream(),debug=require_util().debuglog("stream",(fn)=>{debug=fn}),BufferList=require_buffer_list(),destroyImpl=require_destroy(),{getHighWaterMark,getDefaultHighWaterMark}=require_state(),{aggregateTwoErrors,codes:{ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3,ERR_METHOD_NOT_IMPLEMENTED,ERR_OUT_OF_RANGE:ERR_OUT_OF_RANGE3,ERR_STREAM_PUSH_AFTER_EOF,ERR_STREAM_UNSHIFT_AFTER_END_EVENT},AbortError:AbortError2}=require_errors(),{validateObject}=require_validators(),kPaused=Symbol2("kPaused"),{StringDecoder}=require_string_decoder(),from2=require_from();ObjectSetPrototypeOf(Readable.prototype,Stream.prototype),ObjectSetPrototypeOf(Readable,Stream);var nop=()=>{},{errorOrDestroy}=destroyImpl,kObjectMode=1,kEnded=2,kEndEmitted=4,kReading=8,kConstructed=16,kSync=32,kNeedReadable=64,kEmittedReadable=128,kReadableListening=256,kResumeScheduled=512,kErrorEmitted=1024,kEmitClose=2048,kAutoDestroy=4096,kDestroyed=8192,kClosed=16384,kCloseEmitted=32768,kMultiAwaitDrain=65536,kReadingMore=131072,kDataEmitted=262144;function makeBitMapDescriptor(bit){return{enumerable:!1,get(){return(this.state&bit)!==0},set(value){if(value)this.state|=bit;else this.state&=~bit}}}ObjectDefineProperties(ReadableState.prototype,{objectMode:makeBitMapDescriptor(kObjectMode),ended:makeBitMapDescriptor(kEnded),endEmitted:makeBitMapDescriptor(kEndEmitted),reading:makeBitMapDescriptor(kReading),constructed:makeBitMapDescriptor(kConstructed),sync:makeBitMapDescriptor(kSync),needReadable:makeBitMapDescriptor(kNeedReadable),emittedReadable:makeBitMapDescriptor(kEmittedReadable),readableListening:makeBitMapDescriptor(kReadableListening),resumeScheduled:makeBitMapDescriptor(kResumeScheduled),errorEmitted:makeBitMapDescriptor(kErrorEmitted),emitClose:makeBitMapDescriptor(kEmitClose),autoDestroy:makeBitMapDescriptor(kAutoDestroy),destroyed:makeBitMapDescriptor(kDestroyed),closed:makeBitMapDescriptor(kClosed),closeEmitted:makeBitMapDescriptor(kCloseEmitted),multiAwaitDrain:makeBitMapDescriptor(kMultiAwaitDrain),readingMore:makeBitMapDescriptor(kReadingMore),dataEmitted:makeBitMapDescriptor(kDataEmitted)});function ReadableState(options,stream,isDuplex){if(typeof isDuplex!=="boolean")isDuplex=stream instanceof require_duplex();if(this.state=kEmitClose|kAutoDestroy|kConstructed|kSync,options&&options.objectMode)this.state|=kObjectMode;if(isDuplex&&options&&options.readableObjectMode)this.state|=kObjectMode;if(this.highWaterMark=options?getHighWaterMark(this,options,"readableHighWaterMark",isDuplex):getDefaultHighWaterMark(!1),this.buffer=new BufferList,this.length=0,this.pipes=[],this.flowing=null,this[kPaused]=null,options&&options.emitClose===!1)this.state&=~kEmitClose;if(options&&options.autoDestroy===!1)this.state&=~kAutoDestroy;if(this.errored=null,this.defaultEncoding=options&&options.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,options&&options.encoding)this.decoder=new StringDecoder(options.encoding),this.encoding=options.encoding}function Readable(options){if(!(this instanceof Readable))return new Readable(options);let isDuplex=this instanceof require_duplex();if(this._readableState=new ReadableState(options,this,isDuplex),options){if(typeof options.read==="function")this._read=options.read;if(typeof options.destroy==="function")this._destroy=options.destroy;if(typeof options.construct==="function")this._construct=options.construct;if(options.signal&&!isDuplex)addAbortSignal(options.signal,this)}Stream.call(this,options),destroyImpl.construct(this,()=>{if(this._readableState.needReadable)maybeReadMore(this,this._readableState)})}Readable.prototype.destroy=destroyImpl.destroy,Readable.prototype._undestroy=destroyImpl.undestroy,Readable.prototype._destroy=function(err,cb){cb(err)},Readable.prototype[EE.captureRejectionSymbol]=function(err){this.destroy(err)},Readable.prototype[SymbolAsyncDispose]=function(){let error;if(!this.destroyed)error=this.readableEnded?null:new AbortError2,this.destroy(error);return new Promise2((resolve,reject)=>eos(this,(err)=>err&&err!==error?reject(err):resolve(null)))},Readable.prototype.push=function(chunk,encoding){return readableAddChunk(this,chunk,encoding,!1)},Readable.prototype.unshift=function(chunk,encoding){return readableAddChunk(this,chunk,encoding,!0)};function readableAddChunk(stream,chunk,encoding,addToFront){debug("readableAddChunk",chunk);let state=stream._readableState,err;if((state.state&kObjectMode)===0){if(typeof chunk==="string"){if(encoding=encoding||state.defaultEncoding,state.encoding!==encoding)if(addToFront&&state.encoding)chunk=Buffer3.from(chunk,encoding).toString(state.encoding);else chunk=Buffer3.from(chunk,encoding),encoding=""}else if(chunk instanceof Buffer3)encoding="";else if(Stream._isUint8Array(chunk))chunk=Stream._uint8ArrayToBuffer(chunk),encoding="";else if(chunk!=null)err=new ERR_INVALID_ARG_TYPE3("chunk",["string","Buffer","Uint8Array"],chunk)}if(err)errorOrDestroy(stream,err);else if(chunk===null)state.state&=~kReading,onEofChunk(stream,state);else if((state.state&kObjectMode)!==0||chunk&&chunk.length>0)if(addToFront)if((state.state&kEndEmitted)!==0)errorOrDestroy(stream,new ERR_STREAM_UNSHIFT_AFTER_END_EVENT);else if(state.destroyed||state.errored)return!1;else addChunk(stream,state,chunk,!0);else if(state.ended)errorOrDestroy(stream,new ERR_STREAM_PUSH_AFTER_EOF);else if(state.destroyed||state.errored)return!1;else if(state.state&=~kReading,state.decoder&&!encoding)if(chunk=state.decoder.write(chunk),state.objectMode||chunk.length!==0)addChunk(stream,state,chunk,!1);else maybeReadMore(stream,state);else addChunk(stream,state,chunk,!1);else if(!addToFront)state.state&=~kReading,maybeReadMore(stream,state);return!state.ended&&(state.length<state.highWaterMark||state.length===0)}function addChunk(stream,state,chunk,addToFront){if(state.flowing&&state.length===0&&!state.sync&&stream.listenerCount("data")>0){if((state.state&kMultiAwaitDrain)!==0)state.awaitDrainWriters.clear();else state.awaitDrainWriters=null;state.dataEmitted=!0,stream.emit("data",chunk)}else{if(state.length+=state.objectMode?1:chunk.length,addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if((state.state&kNeedReadable)!==0)emitReadable(stream)}maybeReadMore(stream,state)}Readable.prototype.isPaused=function(){let state=this._readableState;return state[kPaused]===!0||state.flowing===!1},Readable.prototype.setEncoding=function(enc){let decoder=new StringDecoder(enc);this._readableState.decoder=decoder,this._readableState.encoding=this._readableState.decoder.encoding;let buffer=this._readableState.buffer,content="";for(let data of buffer)content+=decoder.write(data);if(buffer.clear(),content!=="")buffer.push(content);return this._readableState.length=content.length,this};var MAX_HWM=1073741824;function computeNewHighWaterMark(n){if(n>MAX_HWM)throw new ERR_OUT_OF_RANGE3("size","<= 1GiB",n);else n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++;return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if((state.state&kObjectMode)!==0)return 1;if(NumberIsNaN(n)){if(state.flowing&&state.length)return state.buffer.first().length;return state.length}if(n<=state.length)return n;return state.ended?state.length:0}Readable.prototype.read=function(n){if(debug("read",n),n===void 0)n=NaN;else if(!NumberIsInteger(n))n=NumberParseInt(n,10);let state=this._readableState,nOrig=n;if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n!==0)state.state&=~kEmittedReadable;if(n===0&&state.needReadable&&((state.highWaterMark!==0?state.length>=state.highWaterMark:state.length>0)||state.ended)){if(debug("read: emitReadable",state.length,state.ended),state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}if(n=howMuchToRead(n,state),n===0&&state.ended){if(state.length===0)endReadable(this);return null}let doRead=(state.state&kNeedReadable)!==0;if(debug("need readable",doRead),state.length===0||state.length-n<state.highWaterMark)doRead=!0,debug("length less than watermark",doRead);if(state.ended||state.reading||state.destroyed||state.errored||!state.constructed)doRead=!1,debug("reading, ended or constructing",doRead);else if(doRead){if(debug("do read"),state.state|=kReading|kSync,state.length===0)state.state|=kNeedReadable;try{this._read(state.highWaterMark)}catch(err){errorOrDestroy(this,err)}if(state.state&=~kSync,!state.reading)n=howMuchToRead(nOrig,state)}let ret;if(n>0)ret=fromList(n,state);else ret=null;if(ret===null)state.needReadable=state.length<=state.highWaterMark,n=0;else if(state.length-=n,state.multiAwaitDrain)state.awaitDrainWriters.clear();else state.awaitDrainWriters=null;if(state.length===0){if(!state.ended)state.needReadable=!0;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null&&!state.errorEmitted&&!state.closeEmitted)state.dataEmitted=!0,this.emit("data",ret);return ret};function onEofChunk(stream,state){if(debug("onEofChunk"),state.ended)return;if(state.decoder){let chunk=state.decoder.end();if(chunk&&chunk.length)state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length}if(state.ended=!0,state.sync)emitReadable(stream);else state.needReadable=!1,state.emittedReadable=!0,emitReadable_(stream)}function emitReadable(stream){let state=stream._readableState;if(debug("emitReadable",state.needReadable,state.emittedReadable),state.needReadable=!1,!state.emittedReadable)debug("emitReadable",state.flowing),state.emittedReadable=!0,process2.nextTick(emitReadable_,stream)}function emitReadable_(stream){let state=stream._readableState;if(debug("emitReadable_",state.destroyed,state.length,state.ended),!state.destroyed&&!state.errored&&(state.length||state.ended))stream.emit("readable"),state.emittedReadable=!1;state.needReadable=!state.flowing&&!state.ended&&state.length<=state.highWaterMark,flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore&&state.constructed)state.readingMore=!0,process2.nextTick(maybeReadMore_,stream,state)}function maybeReadMore_(stream,state){while(!state.reading&&!state.ended&&(state.length<state.highWaterMark||state.flowing&&state.length===0)){let len2=state.length;if(debug("maybeReadMore read 0"),stream.read(0),len2===state.length)break}state.readingMore=!1}Readable.prototype._read=function(n){throw new ERR_METHOD_NOT_IMPLEMENTED("_read()")},Readable.prototype.pipe=function(dest,pipeOpts){let src=this,state=this._readableState;if(state.pipes.length===1){if(!state.multiAwaitDrain)state.multiAwaitDrain=!0,state.awaitDrainWriters=new SafeSet(state.awaitDrainWriters?[state.awaitDrainWriters]:[])}state.pipes.push(dest),debug("pipe count=%d opts=%j",state.pipes.length,pipeOpts);let endFn=(!pipeOpts||pipeOpts.end!==!1)&&dest!==process2.stdout&&dest!==process2.stderr?onend:unpipe;if(state.endEmitted)process2.nextTick(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable,unpipeInfo){if(debug("onunpipe"),readable===src){if(unpipeInfo&&unpipeInfo.hasUnpiped===!1)unpipeInfo.hasUnpiped=!0,cleanup()}}function onend(){debug("onend"),dest.end()}let ondrain,cleanedUp=!1;function cleanup(){if(debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),ondrain)dest.removeListener("drain",ondrain);if(dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",unpipe),src.removeListener("data",ondata),cleanedUp=!0,ondrain&&state.awaitDrainWriters&&(!dest._writableState||dest._writableState.needDrain))ondrain()}function pause(){if(!cleanedUp){if(state.pipes.length===1&&state.pipes[0]===dest)debug("false write response, pause",0),state.awaitDrainWriters=dest,state.multiAwaitDrain=!1;else if(state.pipes.length>1&&state.pipes.includes(dest))debug("false write response, pause",state.awaitDrainWriters.size),state.awaitDrainWriters.add(dest);src.pause()}if(!ondrain)ondrain=pipeOnDrain(src,dest),dest.on("drain",ondrain)}src.on("data",ondata);function ondata(chunk){debug("ondata");let ret=dest.write(chunk);if(debug("dest.write",ret),ret===!1)pause()}function onerror(er){if(debug("onerror",er),unpipe(),dest.removeListener("error",onerror),dest.listenerCount("error")===0){let s=dest._writableState||dest._readableState;if(s&&!s.errorEmitted)errorOrDestroy(dest,er);else dest.emit("error",er)}}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish),unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe"),src.unpipe(dest)}if(dest.emit("pipe",src),dest.writableNeedDrain===!0)pause();else if(!state.flowing)debug("pipe resume"),src.resume();return dest};function pipeOnDrain(src,dest){return function(){let state=src._readableState;if(state.awaitDrainWriters===dest)debug("pipeOnDrain",1),state.awaitDrainWriters=null;else if(state.multiAwaitDrain)debug("pipeOnDrain",state.awaitDrainWriters.size),state.awaitDrainWriters.delete(dest);if((!state.awaitDrainWriters||state.awaitDrainWriters.size===0)&&src.listenerCount("data"))src.resume()}}Readable.prototype.unpipe=function(dest){let state=this._readableState,unpipeInfo={hasUnpiped:!1};if(state.pipes.length===0)return this;if(!dest){let dests=state.pipes;state.pipes=[],this.pause();for(let i2=0;i2<dests.length;i2++)dests[i2].emit("unpipe",this,{hasUnpiped:!1});return this}let index=ArrayPrototypeIndexOf(state.pipes,dest);if(index===-1)return this;if(state.pipes.splice(index,1),state.pipes.length===0)this.pause();return dest.emit("unpipe",this,unpipeInfo),this},Readable.prototype.on=function(ev,fn){let res=Stream.prototype.on.call(this,ev,fn),state=this._readableState;if(ev==="data"){if(state.readableListening=this.listenerCount("readable")>0,state.flowing!==!1)this.resume()}else if(ev==="readable"){if(!state.endEmitted&&!state.readableListening){if(state.readableListening=state.needReadable=!0,state.flowing=!1,state.emittedReadable=!1,debug("on readable",state.length,state.reading),state.length)emitReadable(this);else if(!state.reading)process2.nextTick(nReadingNextTick,this)}}return res},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(ev,fn){let res=Stream.prototype.removeListener.call(this,ev,fn);if(ev==="readable")process2.nextTick(updateReadableListening,this);return res},Readable.prototype.off=Readable.prototype.removeListener,Readable.prototype.removeAllListeners=function(ev){let res=Stream.prototype.removeAllListeners.apply(this,arguments);if(ev==="readable"||ev===void 0)process2.nextTick(updateReadableListening,this);return res};function updateReadableListening(self2){let state=self2._readableState;if(state.readableListening=self2.listenerCount("readable")>0,state.resumeScheduled&&state[kPaused]===!1)state.flowing=!0;else if(self2.listenerCount("data")>0)self2.resume();else if(!state.readableListening)state.flowing=null}function nReadingNextTick(self2){debug("readable nexttick read 0"),self2.read(0)}Readable.prototype.resume=function(){let state=this._readableState;if(!state.flowing)debug("resume"),state.flowing=!state.readableListening,resume(this,state);return state[kPaused]=!1,this};function resume(stream,state){if(!state.resumeScheduled)state.resumeScheduled=!0,process2.nextTick(resume_,stream,state)}function resume_(stream,state){if(debug("resume",state.reading),!state.reading)stream.read(0);if(state.resumeScheduled=!1,stream.emit("resume"),flow(stream),state.flowing&&!state.reading)stream.read(0)}Readable.prototype.pause=function(){if(debug("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)debug("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[kPaused]=!0,this};function flow(stream){let state=stream._readableState;debug("flow",state.flowing);while(state.flowing&&stream.read()!==null);}Readable.prototype.wrap=function(stream){let paused=!1;stream.on("data",(chunk)=>{if(!this.push(chunk)&&stream.pause)paused=!0,stream.pause()}),stream.on("end",()=>{this.push(null)}),stream.on("error",(err)=>{errorOrDestroy(this,err)}),stream.on("close",()=>{this.destroy()}),stream.on("destroy",()=>{this.destroy()}),this._read=()=>{if(paused&&stream.resume)paused=!1,stream.resume()};let streamKeys=ObjectKeys(stream);for(let j=1;j<streamKeys.length;j++){let i2=streamKeys[j];if(this[i2]===void 0&&typeof stream[i2]==="function")this[i2]=stream[i2].bind(stream)}return this},Readable.prototype[SymbolAsyncIterator]=function(){return streamToAsyncIterator(this)},Readable.prototype.iterator=function(options){if(options!==void 0)validateObject(options,"options");return streamToAsyncIterator(this,options)};function streamToAsyncIterator(stream,options){if(typeof stream.read!=="function")stream=Readable.wrap(stream,{objectMode:!0});let iter=createAsyncIterator(stream,options);return iter.stream=stream,iter}async function*createAsyncIterator(stream,options){let callback=nop;function next(resolve){if(this===stream)callback(),callback=nop;else callback=resolve}stream.on("readable",next);let error,cleanup=eos(stream,{writable:!1},(err)=>{error=err?aggregateTwoErrors(error,err):null,callback(),callback=nop});try{while(!0){let chunk=stream.destroyed?null:stream.read();if(chunk!==null)yield chunk;else if(error)throw error;else if(error===null)return;else await new Promise2(next)}}catch(err){throw error=aggregateTwoErrors(error,err),error}finally{if((error||(options===null||options===void 0?void 0:options.destroyOnReturn)!==!1)&&(error===void 0||stream._readableState.autoDestroy))destroyImpl.destroyer(stream,null);else stream.off("readable",next),cleanup()}}ObjectDefineProperties(Readable.prototype,{readable:{__proto__:null,get(){let r=this._readableState;return!!r&&r.readable!==!1&&!r.destroyed&&!r.errorEmitted&&!r.endEmitted},set(val){if(this._readableState)this._readableState.readable=!!val}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(state){if(this._readableState)this._readableState.flowing=state}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(value){if(!this._readableState)return;this._readableState.destroyed=value}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),ObjectDefineProperties(ReadableState.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[kPaused]!==!1},set(value){this[kPaused]=!!value}}}),Readable._fromList=fromList;function fromList(n,state){if(state.length===0)return null;let ret;if(state.objectMode)ret=state.buffer.shift();else if(!n||n>=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.first();else ret=state.buffer.concat(state.length);state.buffer.clear()}else ret=state.buffer.consume(n,state.decoder);return ret}function endReadable(stream){let state=stream._readableState;if(debug("endReadable",state.endEmitted),!state.endEmitted)state.ended=!0,process2.nextTick(endReadableNT,state,stream)}function endReadableNT(state,stream){if(debug("endReadableNT",state.endEmitted,state.length),!state.errored&&!state.closeEmitted&&!state.endEmitted&&state.length===0){if(state.endEmitted=!0,stream.emit("end"),stream.writable&&stream.allowHalfOpen===!1)process2.nextTick(endWritableNT,stream);else if(state.autoDestroy){let wState=stream._writableState;if(!wState||wState.autoDestroy&&(wState.finished||wState.writable===!1))stream.destroy()}}}function endWritableNT(stream){if(stream.writable&&!stream.writableEnded&&!stream.destroyed)stream.end()}Readable.from=function(iterable,opts){return from2(Readable,iterable,opts)};var webStreamsAdapters;function lazyWebStreams(){if(webStreamsAdapters===void 0)webStreamsAdapters={};return webStreamsAdapters}Readable.fromWeb=function(readableStream,options){return lazyWebStreams().newStreamReadableFromReadableStream(readableStream,options)},Readable.toWeb=function(streamReadable,options){return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable,options)},Readable.wrap=function(src,options){var _ref,_src$readableObjectMo;return new Readable({objectMode:(_ref=(_src$readableObjectMo=src.readableObjectMode)!==null&&_src$readableObjectMo!==void 0?_src$readableObjectMo:src.objectMode)!==null&&_ref!==void 0?_ref:!0,...options,destroy(err,callback){destroyImpl.destroyer(src,err),callback(err)}}).wrap(src)}}),require_writable=__commonJS2((exports2,module2)=>{var process2=require_process(),{ArrayPrototypeSlice:ArrayPrototypeSlice2,Error:Error2,FunctionPrototypeSymbolHasInstance,ObjectDefineProperty,ObjectDefineProperties,ObjectSetPrototypeOf,StringPrototypeToLowerCase,Symbol:Symbol2,SymbolHasInstance}=require_primordials();module2.exports=Writable,Writable.WritableState=WritableState;var{EventEmitter:EE}=(init_events(),__toCommonJS(exports_events)),Stream=require_legacy().Stream,{Buffer:Buffer3}=(init_buffer(),__toCommonJS(exports_buffer)),destroyImpl=require_destroy(),{addAbortSignal}=require_add_abort_signal(),{getHighWaterMark,getDefaultHighWaterMark}=require_state(),{ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3,ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK,ERR_STREAM_CANNOT_PIPE,ERR_STREAM_DESTROYED,ERR_STREAM_ALREADY_FINISHED,ERR_STREAM_NULL_VALUES,ERR_STREAM_WRITE_AFTER_END,ERR_UNKNOWN_ENCODING}=require_errors().codes,{errorOrDestroy}=destroyImpl;ObjectSetPrototypeOf(Writable.prototype,Stream.prototype),ObjectSetPrototypeOf(Writable,Stream);function nop(){}var kOnFinished=Symbol2("kOnFinished");function WritableState(options,stream,isDuplex){if(typeof isDuplex!=="boolean")isDuplex=stream instanceof require_duplex();if(this.objectMode=!!(options&&options.objectMode),isDuplex)this.objectMode=this.objectMode||!!(options&&options.writableObjectMode);this.highWaterMark=options?getHighWaterMark(this,options,"writableHighWaterMark",isDuplex):getDefaultHighWaterMark(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let noDecode=!!(options&&options.decodeStrings===!1);this.decodeStrings=!noDecode,this.defaultEncoding=options&&options.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=onwrite.bind(void 0,stream),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,resetBuffer(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!options||options.emitClose!==!1,this.autoDestroy=!options||options.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[kOnFinished]=[]}function resetBuffer(state){state.buffered=[],state.bufferedIndex=0,state.allBuffers=!0,state.allNoop=!0}WritableState.prototype.getBuffer=function(){return ArrayPrototypeSlice2(this.buffered,this.bufferedIndex)},ObjectDefineProperty(WritableState.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Writable(options){let isDuplex=this instanceof require_duplex();if(!isDuplex&&!FunctionPrototypeSymbolHasInstance(Writable,this))return new Writable(options);if(this._writableState=new WritableState(options,this,isDuplex),options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev;if(typeof options.destroy==="function")this._destroy=options.destroy;if(typeof options.final==="function")this._final=options.final;if(typeof options.construct==="function")this._construct=options.construct;if(options.signal)addAbortSignal(options.signal,this)}Stream.call(this,options),destroyImpl.construct(this,()=>{let state=this._writableState;if(!state.writing)clearBuffer(this,state);finishMaybe(this,state)})}ObjectDefineProperty(Writable,SymbolHasInstance,{__proto__:null,value:function(object){if(FunctionPrototypeSymbolHasInstance(this,object))return!0;if(this!==Writable)return!1;return object&&object._writableState instanceof WritableState}}),Writable.prototype.pipe=function(){errorOrDestroy(this,new ERR_STREAM_CANNOT_PIPE)};function _write(stream,chunk,encoding,cb){let state=stream._writableState;if(typeof encoding==="function")cb=encoding,encoding=state.defaultEncoding;else{if(!encoding)encoding=state.defaultEncoding;else if(encoding!=="buffer"&&!Buffer3.isEncoding(encoding))throw new ERR_UNKNOWN_ENCODING(encoding);if(typeof cb!=="function")cb=nop}if(chunk===null)throw new ERR_STREAM_NULL_VALUES;else if(!state.objectMode)if(typeof chunk==="string"){if(state.decodeStrings!==!1)chunk=Buffer3.from(chunk,encoding),encoding="buffer"}else if(chunk instanceof Buffer3)encoding="buffer";else if(Stream._isUint8Array(chunk))chunk=Stream._uint8ArrayToBuffer(chunk),encoding="buffer";else throw new ERR_INVALID_ARG_TYPE3("chunk",["string","Buffer","Uint8Array"],chunk);let err;if(state.ending)err=new ERR_STREAM_WRITE_AFTER_END;else if(state.destroyed)err=new ERR_STREAM_DESTROYED("write");if(err)return process2.nextTick(cb,err),errorOrDestroy(stream,err,!0),err;return state.pendingcb++,writeOrBuffer(stream,state,chunk,encoding,cb)}Writable.prototype.write=function(chunk,encoding,cb){return _write(this,chunk,encoding,cb)===!0},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){let state=this._writableState;if(state.corked){if(state.corked--,!state.writing)clearBuffer(this,state)}},Writable.prototype.setDefaultEncoding=function(encoding){if(typeof encoding==="string")encoding=StringPrototypeToLowerCase(encoding);if(!Buffer3.isEncoding(encoding))throw new ERR_UNKNOWN_ENCODING(encoding);return this._writableState.defaultEncoding=encoding,this};function writeOrBuffer(stream,state,chunk,encoding,callback){let len2=state.objectMode?1:chunk.length;state.length+=len2;let ret=state.length<state.highWaterMark;if(!ret)state.needDrain=!0;if(state.writing||state.corked||state.errored||!state.constructed){if(state.buffered.push({chunk,encoding,callback}),state.allBuffers&&encoding!=="buffer")state.allBuffers=!1;if(state.allNoop&&callback!==nop)state.allNoop=!1}else state.writelen=len2,state.writecb=callback,state.writing=!0,state.sync=!0,stream._write(chunk,encoding,state.onwrite),state.sync=!1;return ret&&!state.errored&&!state.destroyed}function doWrite(stream,state,writev,len2,chunk,encoding,cb){if(state.writelen=len2,state.writecb=cb,state.writing=!0,state.sync=!0,state.destroyed)state.onwrite(new ERR_STREAM_DESTROYED("write"));else if(writev)stream._writev(chunk,state.onwrite);else stream._write(chunk,encoding,state.onwrite);state.sync=!1}function onwriteError(stream,state,er,cb){--state.pendingcb,cb(er),errorBuffer(state),errorOrDestroy(stream,er)}function onwrite(stream,er){let state=stream._writableState,sync=state.sync,cb=state.writecb;if(typeof cb!=="function"){errorOrDestroy(stream,new ERR_MULTIPLE_CALLBACK);return}if(state.writing=!1,state.writecb=null,state.length-=state.writelen,state.writelen=0,er){if(er.stack,!state.errored)state.errored=er;if(stream._readableState&&!stream._readableState.errored)stream._readableState.errored=er;if(sync)process2.nextTick(onwriteError,stream,state,er,cb);else onwriteError(stream,state,er,cb)}else{if(state.buffered.length>state.bufferedIndex)clearBuffer(stream,state);if(sync)if(state.afterWriteTickInfo!==null&&state.afterWriteTickInfo.cb===cb)state.afterWriteTickInfo.count++;else state.afterWriteTickInfo={count:1,cb,stream,state},process2.nextTick(afterWriteTick,state.afterWriteTickInfo);else afterWrite(stream,state,1,cb)}}function afterWriteTick({stream,state,count,cb}){return state.afterWriteTickInfo=null,afterWrite(stream,state,count,cb)}function afterWrite(stream,state,count,cb){if(!state.ending&&!stream.destroyed&&state.length===0&&state.needDrain)state.needDrain=!1,stream.emit("drain");while(count-- >0)state.pendingcb--,cb();if(state.destroyed)errorBuffer(state);finishMaybe(stream,state)}function errorBuffer(state){if(state.writing)return;for(let n=state.bufferedIndex;n<state.buffered.length;++n){var _state$errored;let{chunk,callback}=state.buffered[n],len2=state.objectMode?1:chunk.length;state.length-=len2,callback((_state$errored=state.errored)!==null&&_state$errored!==void 0?_state$errored:new ERR_STREAM_DESTROYED("write"))}let onfinishCallbacks=state[kOnFinished].splice(0);for(let i2=0;i2<onfinishCallbacks.length;i2++){var _state$errored2;onfinishCallbacks[i2]((_state$errored2=state.errored)!==null&&_state$errored2!==void 0?_state$errored2:new ERR_STREAM_DESTROYED("end"))}resetBuffer(state)}function clearBuffer(stream,state){if(state.corked||state.bufferProcessing||state.destroyed||!state.constructed)return;let{buffered,bufferedIndex,objectMode}=state,bufferedLength=buffered.length-bufferedIndex;if(!bufferedLength)return;let i2=bufferedIndex;if(state.bufferProcessing=!0,bufferedLength>1&&stream._writev){state.pendingcb-=bufferedLength-1;let callback=state.allNoop?nop:(err)=>{for(let n=i2;n<buffered.length;++n)buffered[n].callback(err)},chunks=state.allNoop&&i2===0?buffered:ArrayPrototypeSlice2(buffered,i2);chunks.allBuffers=state.allBuffers,doWrite(stream,state,!0,state.length,chunks,"",callback),resetBuffer(state)}else{do{let{chunk,encoding,callback}=buffered[i2];buffered[i2++]=null;let len2=objectMode?1:chunk.length;doWrite(stream,state,!1,len2,chunk,encoding,callback)}while(i2<buffered.length&&!state.writing);if(i2===buffered.length)resetBuffer(state);else if(i2>256)buffered.splice(0,i2),state.bufferedIndex=0;else state.bufferedIndex=i2}state.bufferProcessing=!1}Writable.prototype._write=function(chunk,encoding,cb){if(this._writev)this._writev([{chunk,encoding}],cb);else throw new ERR_METHOD_NOT_IMPLEMENTED("_write()")},Writable.prototype._writev=null,Writable.prototype.end=function(chunk,encoding,cb){let state=this._writableState;if(typeof chunk==="function")cb=chunk,chunk=null,encoding=null;else if(typeof encoding==="function")cb=encoding,encoding=null;let err;if(chunk!==null&&chunk!==void 0){let ret=_write(this,chunk,encoding);if(ret instanceof Error2)err=ret}if(state.corked)state.corked=1,this.uncork();if(err);else if(!state.errored&&!state.ending)state.ending=!0,finishMaybe(this,state,!0),state.ended=!0;else if(state.finished)err=new ERR_STREAM_ALREADY_FINISHED("end");else if(state.destroyed)err=new ERR_STREAM_DESTROYED("end");if(typeof cb==="function")if(err||state.finished)process2.nextTick(cb,err);else state[kOnFinished].push(cb);return this};function needFinish(state){return state.ending&&!state.destroyed&&state.constructed&&state.length===0&&!state.errored&&state.buffered.length===0&&!state.finished&&!state.writing&&!state.errorEmitted&&!state.closeEmitted}function callFinal(stream,state){let called=!1;function onFinish(err){if(called){errorOrDestroy(stream,err!==null&&err!==void 0?err:ERR_MULTIPLE_CALLBACK());return}if(called=!0,state.pendingcb--,err){let onfinishCallbacks=state[kOnFinished].splice(0);for(let i2=0;i2<onfinishCallbacks.length;i2++)onfinishCallbacks[i2](err);errorOrDestroy(stream,err,state.sync)}else if(needFinish(state))state.prefinished=!0,stream.emit("prefinish"),state.pendingcb++,process2.nextTick(finish,stream,state)}state.sync=!0,state.pendingcb++;try{stream._final(onFinish)}catch(err){onFinish(err)}state.sync=!1}function prefinish(stream,state){if(!state.prefinished&&!state.finalCalled)if(typeof stream._final==="function"&&!state.destroyed)state.finalCalled=!0,callFinal(stream,state);else state.prefinished=!0,stream.emit("prefinish")}function finishMaybe(stream,state,sync){if(needFinish(state)){if(prefinish(stream,state),state.pendingcb===0){if(sync)state.pendingcb++,process2.nextTick((stream2,state2)=>{if(needFinish(state2))finish(stream2,state2);else state2.pendingcb--},stream,state);else if(needFinish(state))state.pendingcb++,finish(stream,state)}}}function finish(stream,state){state.pendingcb--,state.finished=!0;let onfinishCallbacks=state[kOnFinished].splice(0);for(let i2=0;i2<onfinishCallbacks.length;i2++)onfinishCallbacks[i2]();if(stream.emit("finish"),state.autoDestroy){let rState=stream._readableState;if(!rState||rState.autoDestroy&&(rState.endEmitted||rState.readable===!1))stream.destroy()}}ObjectDefineProperties(Writable.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(value){if(this._writableState)this._writableState.destroyed=value}},writable:{__proto__:null,get(){let w=this._writableState;return!!w&&w.writable!==!1&&!w.destroyed&&!w.errored&&!w.ending&&!w.ended},set(val){if(this._writableState)this._writableState.writable=!!val}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let wState=this._writableState;if(!wState)return!1;return!wState.destroyed&&!wState.ending&&wState.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var destroy=destroyImpl.destroy;Writable.prototype.destroy=function(err,cb){let state=this._writableState;if(!state.destroyed&&(state.bufferedIndex<state.buffered.length||state[kOnFinished].length))process2.nextTick(errorBuffer,state);return destroy.call(this,err,cb),this},Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(err,cb){cb(err)},Writable.prototype[EE.captureRejectionSymbol]=function(err){this.destroy(err)};var webStreamsAdapters;function lazyWebStreams(){if(webStreamsAdapters===void 0)webStreamsAdapters={};return webStreamsAdapters}Writable.fromWeb=function(writableStream,options){return lazyWebStreams().newStreamWritableFromWritableStream(writableStream,options)},Writable.toWeb=function(streamWritable){return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable)}}),require_duplexify=__commonJS2((exports2,module2)=>{var process2=require_process(),bufferModule=(init_buffer(),__toCommonJS(exports_buffer)),{isReadable,isWritable,isIterable,isNodeStream,isReadableNodeStream,isWritableNodeStream,isDuplexNodeStream,isReadableStream,isWritableStream}=require_utils(),eos=require_end_of_stream(),{AbortError:AbortError2,codes:{ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3,ERR_INVALID_RETURN_VALUE}}=require_errors(),{destroyer}=require_destroy(),Duplex=require_duplex(),Readable=require_readable(),Writable=require_writable(),{createDeferredPromise}=require_util(),from2=require_from(),Blob2=globalThis.Blob||bufferModule.Blob,isBlob=typeof Blob2<"u"?function(b){return b instanceof Blob2}:function(b){return!1},AbortController=globalThis.AbortController||require_abort_controller().AbortController,{FunctionPrototypeCall}=require_primordials();class Duplexify extends Duplex{constructor(options){super(options);if((options===null||options===void 0?void 0:options.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((options===null||options===void 0?void 0:options.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}module2.exports=function duplexify(body,name){if(isDuplexNodeStream(body))return body;if(isReadableNodeStream(body))return _duplexify({readable:body});if(isWritableNodeStream(body))return _duplexify({writable:body});if(isNodeStream(body))return _duplexify({writable:!1,readable:!1});if(isReadableStream(body))return _duplexify({readable:Readable.fromWeb(body)});if(isWritableStream(body))return _duplexify({writable:Writable.fromWeb(body)});if(typeof body==="function"){let{value,write:write2,final,destroy}=fromAsyncGen(body);if(isIterable(value))return from2(Duplexify,value,{objectMode:!0,write:write2,final,destroy});let then2=value===null||value===void 0?void 0:value.then;if(typeof then2==="function"){let d,promise=FunctionPrototypeCall(then2,value,(val)=>{if(val!=null)throw new ERR_INVALID_RETURN_VALUE("nully","body",val)},(err)=>{destroyer(d,err)});return d=new Duplexify({objectMode:!0,readable:!1,write:write2,final(cb){final(async()=>{try{await promise,process2.nextTick(cb,null)}catch(err){process2.nextTick(cb,err)}})},destroy})}throw new ERR_INVALID_RETURN_VALUE("Iterable, AsyncIterable or AsyncFunction",name,value)}if(isBlob(body))return duplexify(body.arrayBuffer());if(isIterable(body))return from2(Duplexify,body,{objectMode:!0,writable:!1});if(isReadableStream(body===null||body===void 0?void 0:body.readable)&&isWritableStream(body===null||body===void 0?void 0:body.writable))return Duplexify.fromWeb(body);if(typeof(body===null||body===void 0?void 0:body.writable)==="object"||typeof(body===null||body===void 0?void 0:body.readable)==="object"){let readable=body!==null&&body!==void 0&&body.readable?isReadableNodeStream(body===null||body===void 0?void 0:body.readable)?body===null||body===void 0?void 0:body.readable:duplexify(body.readable):void 0,writable=body!==null&&body!==void 0&&body.writable?isWritableNodeStream(body===null||body===void 0?void 0:body.writable)?body===null||body===void 0?void 0:body.writable:duplexify(body.writable):void 0;return _duplexify({readable,writable})}let then=body===null||body===void 0?void 0:body.then;if(typeof then==="function"){let d;return FunctionPrototypeCall(then,body,(val)=>{if(val!=null)d.push(val);d.push(null)},(err)=>{destroyer(d,err)}),d=new Duplexify({objectMode:!0,writable:!1,read(){}})}throw new ERR_INVALID_ARG_TYPE3(name,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],body)};function fromAsyncGen(fn){let{promise,resolve}=createDeferredPromise(),ac=new AbortController,signal=ac.signal;return{value:fn(async function*(){while(!0){let _promise=promise;promise=null;let{chunk,done,cb}=await _promise;if(process2.nextTick(cb),done)return;if(signal.aborted)throw new AbortError2(void 0,{cause:signal.reason});({promise,resolve}=createDeferredPromise()),yield chunk}}(),{signal}),write(chunk,encoding,cb){let _resolve=resolve;resolve=null,_resolve({chunk,done:!1,cb})},final(cb){let _resolve=resolve;resolve=null,_resolve({done:!0,cb})},destroy(err,cb){ac.abort(),cb(err)}}}function _duplexify(pair){let r=pair.readable&&typeof pair.readable.read!=="function"?Readable.wrap(pair.readable):pair.readable,w=pair.writable,readable=!!isReadable(r),writable=!!isWritable(w),ondrain,onfinish,onreadable,onclose,d;function onfinished(err){let cb=onclose;if(onclose=null,cb)cb(err);else if(err)d.destroy(err)}if(d=new Duplexify({readableObjectMode:!!(r!==null&&r!==void 0&&r.readableObjectMode),writableObjectMode:!!(w!==null&&w!==void 0&&w.writableObjectMode),readable,writable}),writable)eos(w,(err)=>{if(writable=!1,err)destroyer(r,err);onfinished(err)}),d._write=function(chunk,encoding,callback){if(w.write(chunk,encoding))callback();else ondrain=callback},d._final=function(callback){w.end(),onfinish=callback},w.on("drain",function(){if(ondrain){let cb=ondrain;ondrain=null,cb()}}),w.on("finish",function(){if(onfinish){let cb=onfinish;onfinish=null,cb()}});if(readable)eos(r,(err)=>{if(readable=!1,err)destroyer(r,err);onfinished(err)}),r.on("readable",function(){if(onreadable){let cb=onreadable;onreadable=null,cb()}}),r.on("end",function(){d.push(null)}),d._read=function(){while(!0){let buf=r.read();if(buf===null){onreadable=d._read;return}if(!d.push(buf))return}};return d._destroy=function(err,callback){if(!err&&onclose!==null)err=new AbortError2;if(onreadable=null,ondrain=null,onfinish=null,onclose===null)callback(err);else onclose=callback,destroyer(w,err),destroyer(r,err)},d}}),require_duplex=__commonJS2((exports2,module2)=>{var{ObjectDefineProperties,ObjectGetOwnPropertyDescriptor,ObjectKeys,ObjectSetPrototypeOf}=require_primordials();module2.exports=Duplex;var Readable=require_readable(),Writable=require_writable();ObjectSetPrototypeOf(Duplex.prototype,Readable.prototype),ObjectSetPrototypeOf(Duplex,Readable);{let keys=ObjectKeys(Writable.prototype);for(let i2=0;i2<keys.length;i2++){let method=keys[i2];if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method]}}function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);if(Readable.call(this,options),Writable.call(this,options),options){if(this.allowHalfOpen=options.allowHalfOpen!==!1,options.readable===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if(options.writable===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}else this.allowHalfOpen=!0}ObjectDefineProperties(Duplex.prototype,{writable:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writable")},writableHighWaterMark:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writableBuffer")},writableLength:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writableLength")},writableFinished:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writableFinished")},writableCorked:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writableCorked")},writableEnded:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...ObjectGetOwnPropertyDescriptor(Writable.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set(value){if(this._readableState&&this._writableState)this._readableState.destroyed=value,this._writableState.destroyed=value}}});var webStreamsAdapters;function lazyWebStreams(){if(webStreamsAdapters===void 0)webStreamsAdapters={};return webStreamsAdapters}Duplex.fromWeb=function(pair,options){return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair,options)},Duplex.toWeb=function(duplex){return lazyWebStreams().newReadableWritablePairFromDuplex(duplex)};var duplexify;Duplex.from=function(body){if(!duplexify)duplexify=require_duplexify();return duplexify(body,"body")}}),require_transform=__commonJS2((exports2,module2)=>{var{ObjectSetPrototypeOf,Symbol:Symbol2}=require_primordials();module2.exports=Transform;var{ERR_METHOD_NOT_IMPLEMENTED}=require_errors().codes,Duplex=require_duplex(),{getHighWaterMark}=require_state();ObjectSetPrototypeOf(Transform.prototype,Duplex.prototype),ObjectSetPrototypeOf(Transform,Duplex);var kCallback=Symbol2("kCallback");function Transform(options){if(!(this instanceof Transform))return new Transform(options);let readableHighWaterMark=options?getHighWaterMark(this,options,"readableHighWaterMark",!0):null;if(readableHighWaterMark===0)options={...options,highWaterMark:null,readableHighWaterMark,writableHighWaterMark:options.writableHighWaterMark||0};if(Duplex.call(this,options),this._readableState.sync=!1,this[kCallback]=null,options){if(typeof options.transform==="function")this._transform=options.transform;if(typeof options.flush==="function")this._flush=options.flush}this.on("prefinish",prefinish)}function final(cb){if(typeof this._flush==="function"&&!this.destroyed)this._flush((er,data)=>{if(er){if(cb)cb(er);else this.destroy(er);return}if(data!=null)this.push(data);if(this.push(null),cb)cb()});else if(this.push(null),cb)cb()}function prefinish(){if(this._final!==final)final.call(this)}Transform.prototype._final=final,Transform.prototype._transform=function(chunk,encoding,callback){throw new ERR_METHOD_NOT_IMPLEMENTED("_transform()")},Transform.prototype._write=function(chunk,encoding,callback){let rState=this._readableState,wState=this._writableState,length=rState.length;this._transform(chunk,encoding,(err,val)=>{if(err){callback(err);return}if(val!=null)this.push(val);if(wState.ended||length===rState.length||rState.length<rState.highWaterMark)callback();else this[kCallback]=callback})},Transform.prototype._read=function(){if(this[kCallback]){let callback=this[kCallback];this[kCallback]=null,callback()}}}),require_passthrough=__commonJS2((exports2,module2)=>{var{ObjectSetPrototypeOf}=require_primordials();module2.exports=PassThrough;var Transform=require_transform();ObjectSetPrototypeOf(PassThrough.prototype,Transform.prototype),ObjectSetPrototypeOf(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}}),require_pipeline=__commonJS2((exports2,module2)=>{var process2=require_process(),{ArrayIsArray,Promise:Promise2,SymbolAsyncIterator,SymbolDispose}=require_primordials(),eos=require_end_of_stream(),{once}=require_util(),destroyImpl=require_destroy(),Duplex=require_duplex(),{aggregateTwoErrors,codes:{ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3,ERR_INVALID_RETURN_VALUE,ERR_MISSING_ARGS,ERR_STREAM_DESTROYED,ERR_STREAM_PREMATURE_CLOSE},AbortError:AbortError2}=require_errors(),{validateFunction,validateAbortSignal:validateAbortSignal2}=require_validators(),{isIterable,isReadable,isReadableNodeStream,isNodeStream,isTransformStream,isWebStream,isReadableStream,isReadableFinished}=require_utils(),AbortController=globalThis.AbortController||require_abort_controller().AbortController,PassThrough,Readable,addAbortListener2;function destroyer(stream,reading,writing){let finished=!1;stream.on("close",()=>{finished=!0});let cleanup=eos(stream,{readable:reading,writable:writing},(err)=>{finished=!err});return{destroy:(err)=>{if(finished)return;finished=!0,destroyImpl.destroyer(stream,err||new ERR_STREAM_DESTROYED("pipe"))},cleanup}}function popCallback(streams){return validateFunction(streams[streams.length-1],"streams[stream.length - 1]"),streams.pop()}function makeAsyncIterable(val){if(isIterable(val))return val;else if(isReadableNodeStream(val))return fromReadable(val);throw new ERR_INVALID_ARG_TYPE3("val",["Readable","Iterable","AsyncIterable"],val)}async function*fromReadable(val){if(!Readable)Readable=require_readable();yield*Readable.prototype[SymbolAsyncIterator].call(val)}async function pumpToNode(iterable,writable,finish,{end}){let error,onresolve=null,resume=(err)=>{if(err)error=err;if(onresolve){let callback=onresolve;onresolve=null,callback()}},wait=()=>new Promise2((resolve,reject)=>{if(error)reject(error);else onresolve=()=>{if(error)reject(error);else resolve()}});writable.on("drain",resume);let cleanup=eos(writable,{readable:!1},resume);try{if(writable.writableNeedDrain)await wait();for await(let chunk of iterable)if(!writable.write(chunk))await wait();if(end)writable.end(),await wait();finish()}catch(err){finish(error!==err?aggregateTwoErrors(error,err):err)}finally{cleanup(),writable.off("drain",resume)}}async function pumpToWeb(readable,writable,finish,{end}){if(isTransformStream(writable))writable=writable.writable;let writer=writable.getWriter();try{for await(let chunk of readable)await writer.ready,writer.write(chunk).catch(()=>{});if(await writer.ready,end)await writer.close();finish()}catch(err){try{await writer.abort(err),finish(err)}catch(err2){finish(err2)}}}function pipeline(...streams){return pipelineImpl(streams,once(popCallback(streams)))}function pipelineImpl(streams,callback,opts){if(streams.length===1&&ArrayIsArray(streams[0]))streams=streams[0];if(streams.length<2)throw new ERR_MISSING_ARGS("streams");let ac=new AbortController,signal=ac.signal,outerSignal=opts===null||opts===void 0?void 0:opts.signal,lastStreamCleanup=[];validateAbortSignal2(outerSignal,"options.signal");function abort(){finishImpl(new AbortError2)}addAbortListener2=addAbortListener2||require_util().addAbortListener;let disposable;if(outerSignal)disposable=addAbortListener2(outerSignal,abort);let error,value,destroys=[],finishCount=0;function finish(err){finishImpl(err,--finishCount===0)}function finishImpl(err,final){var _disposable;if(err&&(!error||error.code==="ERR_STREAM_PREMATURE_CLOSE"))error=err;if(!error&&!final)return;while(destroys.length)destroys.shift()(error);if((_disposable=disposable)===null||_disposable===void 0||_disposable[SymbolDispose](),ac.abort(),final){if(!error)lastStreamCleanup.forEach((fn)=>fn());process2.nextTick(callback,error,value)}}let ret;for(let i2=0;i2<streams.length;i2++){let stream=streams[i2],reading=i2<streams.length-1,writing=i2>0,end=reading||(opts===null||opts===void 0?void 0:opts.end)!==!1,isLastStream=i2===streams.length-1;if(isNodeStream(stream)){let onError2=function(err){if(err&&err.name!=="AbortError"&&err.code!=="ERR_STREAM_PREMATURE_CLOSE")finish(err)};var onError=onError2;if(end){let{destroy,cleanup}=destroyer(stream,reading,writing);if(destroys.push(destroy),isReadable(stream)&&isLastStream)lastStreamCleanup.push(cleanup)}if(stream.on("error",onError2),isReadable(stream)&&isLastStream)lastStreamCleanup.push(()=>{stream.removeListener("error",onError2)})}if(i2===0)if(typeof stream==="function"){if(ret=stream({signal}),!isIterable(ret))throw new ERR_INVALID_RETURN_VALUE("Iterable, AsyncIterable or Stream","source",ret)}else if(isIterable(stream)||isReadableNodeStream(stream)||isTransformStream(stream))ret=stream;else ret=Duplex.from(stream);else if(typeof stream==="function"){if(isTransformStream(ret)){var _ret;ret=makeAsyncIterable((_ret=ret)===null||_ret===void 0?void 0:_ret.readable)}else ret=makeAsyncIterable(ret);if(ret=stream(ret,{signal}),reading){if(!isIterable(ret,!0))throw new ERR_INVALID_RETURN_VALUE("AsyncIterable",`transform[${i2-1}]`,ret)}else{var _ret2;if(!PassThrough)PassThrough=require_passthrough();let pt=new PassThrough({objectMode:!0}),then=(_ret2=ret)===null||_ret2===void 0?void 0:_ret2.then;if(typeof then==="function")finishCount++,then.call(ret,(val)=>{if(value=val,val!=null)pt.write(val);if(end)pt.end();process2.nextTick(finish)},(err)=>{pt.destroy(err),process2.nextTick(finish,err)});else if(isIterable(ret,!0))finishCount++,pumpToNode(ret,pt,finish,{end});else if(isReadableStream(ret)||isTransformStream(ret)){let toRead=ret.readable||ret;finishCount++,pumpToNode(toRead,pt,finish,{end})}else throw new ERR_INVALID_RETURN_VALUE("AsyncIterable or Promise","destination",ret);ret=pt;let{destroy,cleanup}=destroyer(ret,!1,!0);if(destroys.push(destroy),isLastStream)lastStreamCleanup.push(cleanup)}}else if(isNodeStream(stream)){if(isReadableNodeStream(ret)){finishCount+=2;let cleanup=pipe(ret,stream,finish,{end});if(isReadable(stream)&&isLastStream)lastStreamCleanup.push(cleanup)}else if(isTransformStream(ret)||isReadableStream(ret)){let toRead=ret.readable||ret;finishCount++,pumpToNode(toRead,stream,finish,{end})}else if(isIterable(ret))finishCount++,pumpToNode(ret,stream,finish,{end});else throw new ERR_INVALID_ARG_TYPE3("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ret);ret=stream}else if(isWebStream(stream)){if(isReadableNodeStream(ret))finishCount++,pumpToWeb(makeAsyncIterable(ret),stream,finish,{end});else if(isReadableStream(ret)||isIterable(ret))finishCount++,pumpToWeb(ret,stream,finish,{end});else if(isTransformStream(ret))finishCount++,pumpToWeb(ret.readable,stream,finish,{end});else throw new ERR_INVALID_ARG_TYPE3("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ret);ret=stream}else ret=Duplex.from(stream)}if(signal!==null&&signal!==void 0&&signal.aborted||outerSignal!==null&&outerSignal!==void 0&&outerSignal.aborted)process2.nextTick(abort);return ret}function pipe(src,dst,finish,{end}){let ended=!1;if(dst.on("close",()=>{if(!ended)finish(new ERR_STREAM_PREMATURE_CLOSE)}),src.pipe(dst,{end:!1}),end){let endFn2=function(){ended=!0,dst.end()};var endFn=endFn2;if(isReadableFinished(src))process2.nextTick(endFn2);else src.once("end",endFn2)}else finish();return eos(src,{readable:!0,writable:!1},(err)=>{let rState=src._readableState;if(err&&err.code==="ERR_STREAM_PREMATURE_CLOSE"&&rState&&rState.ended&&!rState.errored&&!rState.errorEmitted)src.once("end",finish).once("error",finish);else finish(err)}),eos(dst,{readable:!1,writable:!0},finish)}module2.exports={pipelineImpl,pipeline}}),require_compose=__commonJS2((exports2,module2)=>{var{pipeline}=require_pipeline(),Duplex=require_duplex(),{destroyer}=require_destroy(),{isNodeStream,isReadable,isWritable,isWebStream,isTransformStream,isWritableStream,isReadableStream}=require_utils(),{AbortError:AbortError2,codes:{ERR_INVALID_ARG_VALUE,ERR_MISSING_ARGS}}=require_errors(),eos=require_end_of_stream();module2.exports=function(...streams){if(streams.length===0)throw new ERR_MISSING_ARGS("streams");if(streams.length===1)return Duplex.from(streams[0]);let orgStreams=[...streams];if(typeof streams[0]==="function")streams[0]=Duplex.from(streams[0]);if(typeof streams[streams.length-1]==="function"){let idx=streams.length-1;streams[idx]=Duplex.from(streams[idx])}for(let n=0;n<streams.length;++n){if(!isNodeStream(streams[n])&&!isWebStream(streams[n]))continue;if(n<streams.length-1&&!(isReadable(streams[n])||isReadableStream(streams[n])||isTransformStream(streams[n])))throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`,orgStreams[n],"must be readable");if(n>0&&!(isWritable(streams[n])||isWritableStream(streams[n])||isTransformStream(streams[n])))throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`,orgStreams[n],"must be writable")}let ondrain,onfinish,onreadable,onclose,d;function onfinished(err){let cb=onclose;if(onclose=null,cb)cb(err);else if(err)d.destroy(err);else if(!readable&&!writable)d.destroy()}let head=streams[0],tail=pipeline(streams,onfinished),writable=!!(isWritable(head)||isWritableStream(head)||isTransformStream(head)),readable=!!(isReadable(tail)||isReadableStream(tail)||isTransformStream(tail));if(d=new Duplex({writableObjectMode:!!(head!==null&&head!==void 0&&head.writableObjectMode),readableObjectMode:!!(tail!==null&&tail!==void 0&&tail.readableObjectMode),writable,readable}),writable){if(isNodeStream(head))d._write=function(chunk,encoding,callback){if(head.write(chunk,encoding))callback();else ondrain=callback},d._final=function(callback){head.end(),onfinish=callback},head.on("drain",function(){if(ondrain){let cb=ondrain;ondrain=null,cb()}});else if(isWebStream(head)){let writer=(isTransformStream(head)?head.writable:head).getWriter();d._write=async function(chunk,encoding,callback){try{await writer.ready,writer.write(chunk).catch(()=>{}),callback()}catch(err){callback(err)}},d._final=async function(callback){try{await writer.ready,writer.close().catch(()=>{}),onfinish=callback}catch(err){callback(err)}}}let toRead=isTransformStream(tail)?tail.readable:tail;eos(toRead,()=>{if(onfinish){let cb=onfinish;onfinish=null,cb()}})}if(readable){if(isNodeStream(tail))tail.on("readable",function(){if(onreadable){let cb=onreadable;onreadable=null,cb()}}),tail.on("end",function(){d.push(null)}),d._read=function(){while(!0){let buf=tail.read();if(buf===null){onreadable=d._read;return}if(!d.push(buf))return}};else if(isWebStream(tail)){let reader=(isTransformStream(tail)?tail.readable:tail).getReader();d._read=async function(){while(!0)try{let{value,done}=await reader.read();if(!d.push(value))return;if(done){d.push(null);return}}catch{return}}}}return d._destroy=function(err,callback){if(!err&&onclose!==null)err=new AbortError2;if(onreadable=null,ondrain=null,onfinish=null,onclose===null)callback(err);else if(onclose=callback,isNodeStream(tail))destroyer(tail,err)},d}}),require_operators=__commonJS2((exports2,module2)=>{var AbortController=globalThis.AbortController||require_abort_controller().AbortController,{codes:{ERR_INVALID_ARG_VALUE,ERR_INVALID_ARG_TYPE:ERR_INVALID_ARG_TYPE3,ERR_MISSING_ARGS,ERR_OUT_OF_RANGE:ERR_OUT_OF_RANGE3},AbortError:AbortError2}=require_errors(),{validateAbortSignal:validateAbortSignal2,validateInteger,validateObject}=require_validators(),kWeakHandler=require_primordials().Symbol("kWeak"),kResistStopPropagation=require_primordials().Symbol("kResistStopPropagation"),{finished}=require_end_of_stream(),staticCompose=require_compose(),{addAbortSignalNoValidate}=require_add_abort_signal(),{isWritable,isNodeStream}=require_utils(),{deprecate:deprecate2}=require_util(),{ArrayPrototypePush,Boolean:Boolean2,MathFloor,Number:Number2,NumberIsNaN,Promise:Promise2,PromiseReject,PromiseResolve,PromisePrototypeThen,Symbol:Symbol2}=require_primordials(),kEmpty=Symbol2("kEmpty"),kEof=Symbol2("kEof");function compose(stream,options){if(options!=null)validateObject(options,"options");if((options===null||options===void 0?void 0:options.signal)!=null)validateAbortSignal2(options.signal,"options.signal");if(isNodeStream(stream)&&!isWritable(stream))throw new ERR_INVALID_ARG_VALUE("stream",stream,"must be writable");let composedStream=staticCompose(this,stream);if(options!==null&&options!==void 0&&options.signal)addAbortSignalNoValidate(options.signal,composedStream);return composedStream}function map(fn,options){if(typeof fn!=="function")throw new ERR_INVALID_ARG_TYPE3("fn",["Function","AsyncFunction"],fn);if(options!=null)validateObject(options,"options");if((options===null||options===void 0?void 0:options.signal)!=null)validateAbortSignal2(options.signal,"options.signal");let concurrency=1;if((options===null||options===void 0?void 0:options.concurrency)!=null)concurrency=MathFloor(options.concurrency);let highWaterMark=concurrency-1;if((options===null||options===void 0?void 0:options.highWaterMark)!=null)highWaterMark=MathFloor(options.highWaterMark);return validateInteger(concurrency,"options.concurrency",1),validateInteger(highWaterMark,"options.highWaterMark",0),highWaterMark+=concurrency,async function*(){let signal=require_util().AbortSignalAny([options===null||options===void 0?void 0:options.signal].filter(Boolean2)),stream=this,queue=[],signalOpt={signal},next,resume,done=!1,cnt=0;function onCatch(){done=!0,afterItemProcessed()}function afterItemProcessed(){cnt-=1,maybeResume()}function maybeResume(){if(resume&&!done&&cnt<concurrency&&queue.length<highWaterMark)resume(),resume=null}async function pump(){try{for await(let val of stream){if(done)return;if(signal.aborted)throw new AbortError2;try{if(val=fn(val,signalOpt),val===kEmpty)continue;val=PromiseResolve(val)}catch(err){val=PromiseReject(err)}if(cnt+=1,PromisePrototypeThen(val,afterItemProcessed,onCatch),queue.push(val),next)next(),next=null;if(!done&&(queue.length>=highWaterMark||cnt>=concurrency))await new Promise2((resolve)=>{resume=resolve})}queue.push(kEof)}catch(err){let val=PromiseReject(err);PromisePrototypeThen(val,afterItemProcessed,onCatch),queue.push(val)}finally{if(done=!0,next)next(),next=null}}pump();try{while(!0){while(queue.length>0){let val=await queue[0];if(val===kEof)return;if(signal.aborted)throw new AbortError2;if(val!==kEmpty)yield val;queue.shift(),maybeResume()}await new Promise2((resolve)=>{next=resolve})}}finally{if(done=!0,resume)resume(),resume=null}}.call(this)}function asIndexedPairs(options=void 0){if(options!=null)validateObject(options,"options");if((options===null||options===void 0?void 0:options.signal)!=null)validateAbortSignal2(options.signal,"options.signal");return async function*(){let index=0;for await(let val of this){var _options$signal;if(options!==null&&options!==void 0&&(_options$signal=options.signal)!==null&&_options$signal!==void 0&&_options$signal.aborted)throw new AbortError2({cause:options.signal.reason});yield[index++,val]}}.call(this)}async function some(fn,options=void 0){for await(let unused of filter.call(this,fn,options))return!0;return!1}async function every(fn,options=void 0){if(typeof fn!=="function")throw new ERR_INVALID_ARG_TYPE3("fn",["Function","AsyncFunction"],fn);return!await some.call(this,async(...args)=>{return!await fn(...args)},options)}async function find(fn,options){for await(let result of filter.call(this,fn,options))return result;return}async function forEach(fn,options){if(typeof fn!=="function")throw new ERR_INVALID_ARG_TYPE3("fn",["Function","AsyncFunction"],fn);async function forEachFn(value,options2){return await fn(value,options2),kEmpty}for await(let unused of map.call(this,forEachFn,options));}function filter(fn,options){if(typeof fn!=="function")throw new ERR_INVALID_ARG_TYPE3("fn",["Function","AsyncFunction"],fn);async function filterFn(value,options2){if(await fn(value,options2))return value;return kEmpty}return map.call(this,filterFn,options)}class ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function reduce(reducer,initialValue,options){var _options$signal2;if(typeof reducer!=="function")throw new ERR_INVALID_ARG_TYPE3("reducer",["Function","AsyncFunction"],reducer);if(options!=null)validateObject(options,"options");if((options===null||options===void 0?void 0:options.signal)!=null)validateAbortSignal2(options.signal,"options.signal");let hasInitialValue=arguments.length>1;if(options!==null&&options!==void 0&&(_options$signal2=options.signal)!==null&&_options$signal2!==void 0&&_options$signal2.aborted){let err=new AbortError2(void 0,{cause:options.signal.reason});throw this.once("error",()=>{}),await finished(this.destroy(err)),err}let ac=new AbortController,signal=ac.signal;if(options!==null&&options!==void 0&&options.signal){let opts={once:!0,[kWeakHandler]:this,[kResistStopPropagation]:!0};options.signal.addEventListener("abort",()=>ac.abort(),opts)}let gotAnyItemFromStream=!1;try{for await(let value of this){var _options$signal3;if(gotAnyItemFromStream=!0,options!==null&&options!==void 0&&(_options$signal3=options.signal)!==null&&_options$signal3!==void 0&&_options$signal3.aborted)throw new AbortError2;if(!hasInitialValue)initialValue=value,hasInitialValue=!0;else initialValue=await reducer(initialValue,value,{signal})}if(!gotAnyItemFromStream&&!hasInitialValue)throw new ReduceAwareErrMissingArgs}finally{ac.abort()}return initialValue}async function toArray(options){if(options!=null)validateObject(options,"options");if((options===null||options===void 0?void 0:options.signal)!=null)validateAbortSignal2(options.signal,"options.signal");let result=[];for await(let val of this){var _options$signal4;if(options!==null&&options!==void 0&&(_options$signal4=options.signal)!==null&&_options$signal4!==void 0&&_options$signal4.aborted)throw new AbortError2(void 0,{cause:options.signal.reason});ArrayPrototypePush(result,val)}return result}function flatMap(fn,options){let values=map.call(this,fn,options);return async function*(){for await(let val of values)yield*val}.call(this)}function toIntegerOrInfinity(number){if(number=Number2(number),NumberIsNaN(number))return 0;if(number<0)throw new ERR_OUT_OF_RANGE3("number",">= 0",number);return number}function drop(number,options=void 0){if(options!=null)validateObject(options,"options");if((options===null||options===void 0?void 0:options.signal)!=null)validateAbortSignal2(options.signal,"options.signal");return number=toIntegerOrInfinity(number),async function*(){var _options$signal5;if(options!==null&&options!==void 0&&(_options$signal5=options.signal)!==null&&_options$signal5!==void 0&&_options$signal5.aborted)throw new AbortError2;for await(let val of this){var _options$signal6;if(options!==null&&options!==void 0&&(_options$signal6=options.signal)!==null&&_options$signal6!==void 0&&_options$signal6.aborted)throw new AbortError2;if(number--<=0)yield val}}.call(this)}function take(number,options=void 0){if(options!=null)validateObject(options,"options");if((options===null||options===void 0?void 0:options.signal)!=null)validateAbortSignal2(options.signal,"options.signal");return number=toIntegerOrInfinity(number),async function*(){var _options$signal7;if(options!==null&&options!==void 0&&(_options$signal7=options.signal)!==null&&_options$signal7!==void 0&&_options$signal7.aborted)throw new AbortError2;for await(let val of this){var _options$signal8;if(options!==null&&options!==void 0&&(_options$signal8=options.signal)!==null&&_options$signal8!==void 0&&_options$signal8.aborted)throw new AbortError2;if(number-- >0)yield val;if(number<=0)return}}.call(this)}module2.exports.streamReturningOperators={asIndexedPairs:deprecate2(asIndexedPairs,"readable.asIndexedPairs will be removed in a future version."),drop,filter,flatMap,map,take,compose},module2.exports.promiseReturningOperators={every,forEach,reduce,toArray,some,find}}),require_promises=__commonJS2((exports2,module2)=>{var{ArrayPrototypePop,Promise:Promise2}=require_primordials(),{isIterable,isNodeStream,isWebStream}=require_utils(),{pipelineImpl:pl}=require_pipeline(),{finished}=require_end_of_stream();require_stream2();function pipeline(...streams){return new Promise2((resolve,reject)=>{let signal,end,lastArg=streams[streams.length-1];if(lastArg&&typeof lastArg==="object"&&!isNodeStream(lastArg)&&!isIterable(lastArg)&&!isWebStream(lastArg)){let options=ArrayPrototypePop(streams);signal=options.signal,end=options.end}pl(streams,(err,value)=>{if(err)reject(err);else resolve(value)},{signal,end})})}module2.exports={finished,pipeline}}),require_stream2=__commonJS2((exports2,module2)=>{var{Buffer:Buffer3}=(init_buffer(),__toCommonJS(exports_buffer)),{ObjectDefineProperty,ObjectKeys,ReflectApply}=require_primordials(),{promisify:{custom:customPromisify}}=require_util(),{streamReturningOperators,promiseReturningOperators}=require_operators(),{codes:{ERR_ILLEGAL_CONSTRUCTOR}}=require_errors(),compose=require_compose(),{setDefaultHighWaterMark,getDefaultHighWaterMark}=require_state(),{pipeline}=require_pipeline(),{destroyer}=require_destroy(),eos=require_end_of_stream(),promises=require_promises(),utils=require_utils(),Stream=module2.exports=require_legacy().Stream;Stream.isDestroyed=utils.isDestroyed,Stream.isDisturbed=utils.isDisturbed,Stream.isErrored=utils.isErrored,Stream.isReadable=utils.isReadable,Stream.isWritable=utils.isWritable,Stream.Readable=require_readable();for(let key of ObjectKeys(streamReturningOperators)){let fn=function(...args){if(new.target)throw ERR_ILLEGAL_CONSTRUCTOR();return Stream.Readable.from(ReflectApply(op,this,args))},op=streamReturningOperators[key];ObjectDefineProperty(fn,"name",{__proto__:null,value:op.name}),ObjectDefineProperty(fn,"length",{__proto__:null,value:op.length}),ObjectDefineProperty(Stream.Readable.prototype,key,{__proto__:null,value:fn,enumerable:!1,configurable:!0,writable:!0})}for(let key of ObjectKeys(promiseReturningOperators)){let fn=function(...args){if(new.target)throw ERR_ILLEGAL_CONSTRUCTOR();return ReflectApply(op,this,args)},op=promiseReturningOperators[key];ObjectDefineProperty(fn,"name",{__proto__:null,value:op.name}),ObjectDefineProperty(fn,"length",{__proto__:null,value:op.length}),ObjectDefineProperty(Stream.Readable.prototype,key,{__proto__:null,value:fn,enumerable:!1,configurable:!0,writable:!0})}Stream.Writable=require_writable(),Stream.Duplex=require_duplex(),Stream.Transform=require_transform(),Stream.PassThrough=require_passthrough(),Stream.pipeline=pipeline;var{addAbortSignal}=require_add_abort_signal();Stream.addAbortSignal=addAbortSignal,Stream.finished=eos,Stream.destroy=destroyer,Stream.compose=compose,Stream.setDefaultHighWaterMark=setDefaultHighWaterMark,Stream.getDefaultHighWaterMark=getDefaultHighWaterMark,ObjectDefineProperty(Stream,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return promises}}),ObjectDefineProperty(pipeline,customPromisify,{__proto__:null,enumerable:!0,get(){return promises.pipeline}}),ObjectDefineProperty(eos,customPromisify,{__proto__:null,enumerable:!0,get(){return promises.finished}}),Stream.Stream=Stream,Stream._isUint8Array=function(value){return value instanceof Uint8Array},Stream._uint8ArrayToBuffer=function(chunk){return Buffer3.from(chunk.buffer,chunk.byteOffset,chunk.byteLength)}}),require_ours=__commonJS2((exports2,module2)=>{var Stream=require_stream();{let CustomStream=require_stream2(),promises=require_promises(),originalDestroy=CustomStream.Readable.destroy;module2.exports=CustomStream.Readable,module2.exports._uint8ArrayToBuffer=CustomStream._uint8ArrayToBuffer,module2.exports._isUint8Array=CustomStream._isUint8Array,module2.exports.isDisturbed=CustomStream.isDisturbed,module2.exports.isErrored=CustomStream.isErrored,module2.exports.isReadable=CustomStream.isReadable,module2.exports.Readable=CustomStream.Readable,module2.exports.Writable=CustomStream.Writable,module2.exports.Duplex=CustomStream.Duplex,module2.exports.Transform=CustomStream.Transform,module2.exports.PassThrough=CustomStream.PassThrough,module2.exports.addAbortSignal=CustomStream.addAbortSignal,module2.exports.finished=CustomStream.finished,module2.exports.destroy=CustomStream.destroy,module2.exports.destroy=originalDestroy,module2.exports.pipeline=CustomStream.pipeline,module2.exports.compose=CustomStream.compose,Object.defineProperty(CustomStream,"promises",{configurable:!0,enumerable:!0,get(){return promises}}),module2.exports.Stream=CustomStream.Stream}module2.exports.default=module2.exports});module.exports=require_ours()});var exports_crypto={};__export(exports_crypto,{webcrypto:()=>webcrypto,rng:()=>rng2,randomUUID:()=>randomUUID,randomFillSync:()=>randomFillSync2,randomFill:()=>randomFill2,randomBytes:()=>randomBytes2,publicEncrypt:()=>publicEncrypt2,publicDecrypt:()=>publicDecrypt2,pseudoRandomBytes:()=>pseudoRandomBytes2,prng:()=>prng2,privateEncrypt:()=>privateEncrypt2,privateDecrypt:()=>privateDecrypt2,pbkdf2Sync:()=>pbkdf2Sync2,pbkdf2:()=>pbkdf22,listCiphers:()=>listCiphers2,getRandomValues:()=>getRandomValues,getHashes:()=>getHashes2,getDiffieHellman:()=>getDiffieHellman2,getCurves:()=>getCurves,getCiphers:()=>getCiphers2,default:()=>crypto_default,createVerify:()=>createVerify2,createSign:()=>createSign2,createHmac:()=>createHmac2,createHash:()=>createHash2,createECDH:()=>createECDH2,createDiffieHellmanGroup:()=>createDiffieHellmanGroup2,createDiffieHellman:()=>createDiffieHellman2,createDecipheriv:()=>createDecipheriv2,createDecipher:()=>createDecipher2,createCredentials:()=>createCredentials2,createCipheriv:()=>createCipheriv2,createCipher:()=>createCipher2,constants:()=>constants2,Verify:()=>Verify2,Sign:()=>Sign2,Hmac:()=>Hmac2,Hash:()=>Hash2,DiffieHellmanGroup:()=>DiffieHellmanGroup2,DiffieHellman:()=>DiffieHellman2,Decipheriv:()=>Decipheriv2,Decipher:()=>Decipher2,DEFAULT_ENCODING:()=>DEFAULT_ENCODING,Cipheriv:()=>Cipheriv2,Cipher:()=>Cipher2});function getCurves(){return hardcoded_curves}var __create,__getProtoOf,__defProp2,__getOwnPropNames2,__hasOwnProp2,__toESM=(mod,isNodeMode,target)=>{target=mod!=null?__create(__getProtoOf(mod)):{};let to=isNodeMode||!mod||!mod.__esModule?__defProp2(target,"default",{value:mod,enumerable:!0}):target;for(let key of __getOwnPropNames2(mod))if(!__hasOwnProp2.call(to,key))__defProp2(to,key,{get:()=>mod[key],enumerable:!0});return to},__commonJS2=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports),require_randombytes,require_create_hash,require_create_hmac,require_algorithms,require_precondition,require_default_encoding,require_safe_buffer,require_isarray,require_type,require_es_object_atoms,require_es_errors,require_eval,require_range,require_ref,require_syntax,require_uri,require_abs,require_floor,require_max,require_min,require_pow,require_round,require_isNaN,require_sign,require_gOPD,require_gopd,require_es_define_property,require_shams,require_has_symbols,require_Reflect_getPrototypeOf,require_Object_getPrototypeOf,require_implementation,require_function_bind,require_functionCall,require_functionApply,require_reflectApply,require_actualApply,require_call_bind_apply_helpers,require_get,require_get_proto,require_hasown,require_get_intrinsic,require_call_bound,require_is_callable,require_for_each,require_possible_typed_array_names,require_available_typed_arrays,require_define_data_property,require_has_property_descriptors,require_set_function_length,require_applyBind,require_call_bind,require_shams2,require_which_typed_array,require_is_typed_array,require_typed_array_buffer,require_to_buffer,require_to_buffer2,require_sync,require_async,require_pbkdf2,require_browserify_cipher,require_diffie_hellman,require_browserify_sign,require_package,require_bn,require_minimalistic_assert,require_utils,require_utils2,require_brorand,require_base,require_inherits_browser,require_inherits,require_short,require_mont,require_edwards,require_curve,require_utils3,require_common,require_common2,require_1,require_256,require_224,require_512,require_384,require_sha,require_ripemd,require_hmac,require_hash,require_secp256k1,require_curves,require_hmac_drbg,require_key,require_signature,require_ec,require_key2,require_signature2,require_eddsa,require_elliptic,require_bn2,require_browser,require_create_ecdh,require_bn3,require_api,require_reporter,require_buffer,require_node,require_base2,require_der,require_constants,require_der2,require_pem,require_decoders,require_der3,require_pem2,require_encoders,require_asn1,require_certificate,require_asn12,require_aesid,require_hash_base,require_md5,require_evp_bytestokey,require_browserify_aes,require_fixProc,require_parse_asn1,require_mgf,require_xor,require_bn4,require_withPublic,require_bn5,require_browserify_rsa,require_publicEncrypt,require_privateDecrypt,require_browser2,require_public_encrypt,require_browser3,require_randomfill,require_crypto_browserify,cryptoBrowserify,prng2,pseudoRandomBytes2,rng2,randomBytes2,Hash2,createHash2,Hmac2,createHmac2,getHashes2,pbkdf22,pbkdf2Sync2,Cipher2,createCipher2,Cipheriv2,createCipheriv2,Decipher2,createDecipher2,Decipheriv2,createDecipheriv2,getCiphers2,listCiphers2,DiffieHellmanGroup2,createDiffieHellmanGroup2,getDiffieHellman2,createDiffieHellman2,DiffieHellman2,createSign2,Sign2,createVerify2,Verify2,createECDH2,publicEncrypt2,privateEncrypt2,publicDecrypt2,privateDecrypt2,randomFill2,randomFillSync2,createCredentials2,constants2,DEFAULT_ENCODING="buffer",getRandomValues=(array)=>{return crypto.getRandomValues(array)},randomUUID=()=>{return crypto.randomUUID()},hardcoded_curves,webcrypto,crypto_default;var init_crypto=__esm(()=>{__create=Object.create,{getPrototypeOf:__getProtoOf,defineProperty:__defProp2,getOwnPropertyNames:__getOwnPropNames2}=Object,__hasOwnProp2=Object.prototype.hasOwnProperty,require_randombytes=__commonJS2((exports,module)=>{module.exports=(init_crypto(),__toCommonJS(exports_crypto)).randomBytes}),require_create_hash=__commonJS2((exports,module)=>{module.exports=(init_crypto(),__toCommonJS(exports_crypto)).createHash}),require_create_hmac=__commonJS2((exports,module)=>{module.exports=(init_crypto(),__toCommonJS(exports_crypto)).createHmac}),require_algorithms=__commonJS2((exports,module)=>{module.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}}),require_precondition=__commonJS2((exports,module)=>{var $isFinite=isFinite,MAX_ALLOC=Math.pow(2,30)-1;module.exports=function(iterations,keylen){if(typeof iterations!=="number")throw TypeError("Iterations not a number");if(iterations<0||!$isFinite(iterations))throw TypeError("Bad iterations");if(typeof keylen!=="number")throw TypeError("Key length not a number");if(keylen<0||keylen>MAX_ALLOC||keylen!==keylen)throw TypeError("Bad key length")}}),require_default_encoding=__commonJS2((exports,module)=>{var defaultEncoding;if(globalThis.process&&globalThis.process.browser)defaultEncoding="utf-8";else if(globalThis.process&&globalThis.process.version)pVersionMajor=parseInt(process.version.split(".")[0].slice(1),10),defaultEncoding=pVersionMajor>=6?"utf-8":"binary";else defaultEncoding="utf-8";var pVersionMajor;module.exports=defaultEncoding}),require_safe_buffer=__commonJS2((exports,module)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var buffer=(init_buffer(),__toCommonJS(exports_buffer)),Buffer22=buffer.Buffer;function copyProps(src,dst){for(var key in src)dst[key]=src[key]}if(Buffer22.from&&Buffer22.alloc&&Buffer22.allocUnsafe&&Buffer22.allocUnsafeSlow)module.exports=buffer;else copyProps(buffer,exports),exports.Buffer=SafeBuffer;function SafeBuffer(arg,encodingOrOffset,length){return Buffer22(arg,encodingOrOffset,length)}SafeBuffer.prototype=Object.create(Buffer22.prototype),copyProps(Buffer22,SafeBuffer),SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==="number")throw TypeError("Argument must not be a number");return Buffer22(arg,encodingOrOffset,length)},SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=="number")throw TypeError("Argument must be a number");var buf=Buffer22(size);if(fill!==void 0)if(typeof encoding==="string")buf.fill(fill,encoding);else buf.fill(fill);else buf.fill(0);return buf},SafeBuffer.allocUnsafe=function(size){if(typeof size!=="number")throw TypeError("Argument must be a number");return Buffer22(size)},SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=="number")throw TypeError("Argument must be a number");return buffer.SlowBuffer(size)}}),require_isarray=__commonJS2((exports,module)=>{var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}}),require_type=__commonJS2((exports,module)=>{module.exports=TypeError}),require_es_object_atoms=__commonJS2((exports,module)=>{module.exports=Object}),require_es_errors=__commonJS2((exports,module)=>{module.exports=Error}),require_eval=__commonJS2((exports,module)=>{module.exports=EvalError}),require_range=__commonJS2((exports,module)=>{module.exports=RangeError}),require_ref=__commonJS2((exports,module)=>{module.exports=ReferenceError}),require_syntax=__commonJS2((exports,module)=>{module.exports=SyntaxError}),require_uri=__commonJS2((exports,module)=>{module.exports=URIError}),require_abs=__commonJS2((exports,module)=>{module.exports=Math.abs}),require_floor=__commonJS2((exports,module)=>{module.exports=Math.floor}),require_max=__commonJS2((exports,module)=>{module.exports=Math.max}),require_min=__commonJS2((exports,module)=>{module.exports=Math.min}),require_pow=__commonJS2((exports,module)=>{module.exports=Math.pow}),require_round=__commonJS2((exports,module)=>{module.exports=Math.round}),require_isNaN=__commonJS2((exports,module)=>{module.exports=Number.isNaN||function(a){return a!==a}}),require_sign=__commonJS2((exports,module)=>{var $isNaN=require_isNaN();module.exports=function(number){if($isNaN(number)||number===0)return number;return number<0?-1:1}}),require_gOPD=__commonJS2((exports,module)=>{module.exports=Object.getOwnPropertyDescriptor}),require_gopd=__commonJS2((exports,module)=>{var $gOPD=require_gOPD();if($gOPD)try{$gOPD([],"length")}catch(e){$gOPD=null}module.exports=$gOPD}),require_es_define_property=__commonJS2((exports,module)=>{var $defineProperty=Object.defineProperty||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}module.exports=$defineProperty}),require_shams=__commonJS2((exports,module)=>{module.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var obj={},sym=Symbol("test"),symObj=Object(sym);if(typeof sym==="string")return!1;if(Object.prototype.toString.call(sym)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(symObj)!=="[object Symbol]")return!1;var symVal=42;obj[sym]=symVal;for(var _ in obj)return!1;if(typeof Object.keys==="function"&&Object.keys(obj).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(obj).length!==0)return!1;var syms=Object.getOwnPropertySymbols(obj);if(syms.length!==1||syms[0]!==sym)return!1;if(!Object.prototype.propertyIsEnumerable.call(obj,sym))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var descriptor=Object.getOwnPropertyDescriptor(obj,sym);if(descriptor.value!==symVal||descriptor.enumerable!==!0)return!1}return!0}}),require_has_symbols=__commonJS2((exports,module)=>{var origSymbol=typeof Symbol<"u"&&Symbol,hasSymbolSham=require_shams();module.exports=function(){if(typeof origSymbol!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof origSymbol("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return hasSymbolSham()}}),require_Reflect_getPrototypeOf=__commonJS2((exports,module)=>{module.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),require_Object_getPrototypeOf=__commonJS2((exports,module)=>{var $Object=require_es_object_atoms();module.exports=$Object.getPrototypeOf||null}),require_implementation=__commonJS2((exports,module)=>{var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function(a,b){var arr=[];for(var i2=0;i2<a.length;i2+=1)arr[i2]=a[i2];for(var j=0;j<b.length;j+=1)arr[j+a.length]=b[j];return arr},slicy=function(arrLike,offset){var arr=[];for(var i2=offset||0,j=0;i2<arrLike.length;i2+=1,j+=1)arr[j]=arrLike[i2];return arr},joiny=function(arr,joiner){var str="";for(var i2=0;i2<arr.length;i2+=1)if(str+=arr[i2],i2+1<arr.length)str+=joiner;return str};module.exports=function(that){var target=this;if(typeof target!=="function"||toStr.apply(target)!==funcType)throw TypeError(ERROR_MESSAGE+target);var args=slicy(arguments,1),bound,binder=function(){if(this instanceof bound){var result=target.apply(this,concatty(args,arguments));if(Object(result)===result)return result;return this}return target.apply(that,concatty(args,arguments))},boundLength=max(0,target.length-args.length),boundArgs=[];for(var i2=0;i2<boundLength;i2++)boundArgs[i2]="$"+i2;if(bound=Function("binder","return function ("+joiny(boundArgs,",")+"){ return binder.apply(this,arguments); }")(binder),target.prototype){var Empty=function(){};Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null}return bound}}),require_function_bind=__commonJS2((exports,module)=>{var implementation=require_implementation();module.exports=Function.prototype.bind||implementation}),require_functionCall=__commonJS2((exports,module)=>{module.exports=Function.prototype.call}),require_functionApply=__commonJS2((exports,module)=>{module.exports=Function.prototype.apply}),require_reflectApply=__commonJS2((exports,module)=>{module.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),require_actualApply=__commonJS2((exports,module)=>{var bind=require_function_bind(),$apply=require_functionApply(),$call=require_functionCall(),$reflectApply=require_reflectApply();module.exports=$reflectApply||bind.call($call,$apply)}),require_call_bind_apply_helpers=__commonJS2((exports,module)=>{var bind=require_function_bind(),$TypeError=require_type(),$call=require_functionCall(),$actualApply=require_actualApply();module.exports=function(args){if(args.length<1||typeof args[0]!=="function")throw new $TypeError("a function is required");return $actualApply(bind,$call,args)}}),require_get=__commonJS2((exports,module)=>{var callBind=require_call_bind_apply_helpers(),gOPD=require_gopd(),hasProtoAccessor;try{hasProtoAccessor=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var desc=!!hasProtoAccessor&&gOPD&&gOPD(Object.prototype,"__proto__"),$Object=Object,$getPrototypeOf=$Object.getPrototypeOf;module.exports=desc&&typeof desc.get==="function"?callBind([desc.get]):typeof $getPrototypeOf==="function"?function(value){return $getPrototypeOf(value==null?value:$Object(value))}:!1}),require_get_proto=__commonJS2((exports,module)=>{var reflectGetProto=require_Reflect_getPrototypeOf(),originalGetProto=require_Object_getPrototypeOf(),getDunderProto=require_get();module.exports=reflectGetProto?function(O){return reflectGetProto(O)}:originalGetProto?function(O){if(!O||typeof O!=="object"&&typeof O!=="function")throw TypeError("getProto: not an object");return originalGetProto(O)}:getDunderProto?function(O){return getDunderProto(O)}:null}),require_hasown=__commonJS2((exports,module)=>{var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require_function_bind();module.exports=bind.call(call,$hasOwn)}),require_get_intrinsic=__commonJS2((exports,module)=>{var undefined2,$Object=require_es_object_atoms(),$Error=require_es_errors(),$EvalError=require_eval(),$RangeError=require_range(),$ReferenceError=require_ref(),$SyntaxError=require_syntax(),$TypeError=require_type(),$URIError=require_uri(),abs=require_abs(),floor=require_floor(),max=require_max(),min=require_min(),pow=require_pow(),round=require_round(),sign=require_sign(),$Function=Function,getEvalledConstructor=function(expressionSyntax){try{return $Function('"use strict"; return ('+expressionSyntax+").constructor;")()}catch(e){}},$gOPD=require_gopd(),$defineProperty=require_es_define_property(),throwTypeError=function(){throw new $TypeError},ThrowTypeError=$gOPD?function(){try{return arguments.callee,throwTypeError}catch(calleeThrows){try{return $gOPD(arguments,"callee").get}catch(gOPDthrows){return throwTypeError}}}():throwTypeError,hasSymbols=require_has_symbols()(),getProto=require_get_proto(),$ObjectGPO=require_Object_getPrototypeOf(),$ReflectGPO=require_Reflect_getPrototypeOf(),$apply=require_functionApply(),$call=require_functionCall(),needsEval={},TypedArray=typeof Uint8Array>"u"||!getProto?undefined2:getProto(Uint8Array),INTRINSICS={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?undefined2:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined2:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined2,"%AsyncFromSyncIteratorPrototype%":undefined2,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined2:Atomics,"%BigInt%":typeof BigInt>"u"?undefined2:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined2:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined2:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined2:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float16Array%":typeof Float16Array>"u"?undefined2:Float16Array,"%Float32Array%":typeof Float32Array>"u"?undefined2:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined2:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined2:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined2:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined2:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined2:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined2,"%JSON%":typeof JSON==="object"?JSON:undefined2,"%Map%":typeof Map>"u"?undefined2:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto?undefined2:getProto(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":$Object,"%Object.getOwnPropertyDescriptor%":$gOPD,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined2:Promise,"%Proxy%":typeof Proxy>"u"?undefined2:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined2:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined2:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto?undefined2:getProto(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined2:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined2,"%Symbol%":hasSymbols?Symbol:undefined2,"%SyntaxError%":$SyntaxError,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError,"%Uint8Array%":typeof Uint8Array>"u"?undefined2:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined2:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined2:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined2:Uint32Array,"%URIError%":$URIError,"%WeakMap%":typeof WeakMap>"u"?undefined2:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined2:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined2:WeakSet,"%Function.prototype.call%":$call,"%Function.prototype.apply%":$apply,"%Object.defineProperty%":$defineProperty,"%Object.getPrototypeOf%":$ObjectGPO,"%Math.abs%":abs,"%Math.floor%":floor,"%Math.max%":max,"%Math.min%":min,"%Math.pow%":pow,"%Math.round%":round,"%Math.sign%":sign,"%Reflect.getPrototypeOf%":$ReflectGPO};if(getProto)try{null.error}catch(e){errorProto=getProto(getProto(e)),INTRINSICS["%Error.prototype%"]=errorProto}var errorProto,doEval=function doEval2(name){var value;if(name==="%AsyncFunction%")value=getEvalledConstructor("async function () {}");else if(name==="%GeneratorFunction%")value=getEvalledConstructor("function* () {}");else if(name==="%AsyncGeneratorFunction%")value=getEvalledConstructor("async function* () {}");else if(name==="%AsyncGenerator%"){var fn=doEval2("%AsyncGeneratorFunction%");if(fn)value=fn.prototype}else if(name==="%AsyncIteratorPrototype%"){var gen=doEval2("%AsyncGenerator%");if(gen&&getProto)value=getProto(gen.prototype)}return INTRINSICS[name]=value,value},LEGACY_ALIASES={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=require_function_bind(),hasOwn=require_hasown(),$concat=bind.call($call,Array.prototype.concat),$spliceApply=bind.call($apply,Array.prototype.splice),$replace=bind.call($call,String.prototype.replace),$strSlice=bind.call($call,String.prototype.slice),$exec=bind.call($call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(string){var first=$strSlice(string,0,1),last=$strSlice(string,-1);if(first==="%"&&last!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");else if(last==="%"&&first!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var result=[];return $replace(string,rePropName,function(match,number,quote,subString){result[result.length]=quote?$replace(subString,reEscapeChar,"$1"):number||match}),result},getBaseIntrinsic=function(name,allowMissing){var intrinsicName=name,alias;if(hasOwn(LEGACY_ALIASES,intrinsicName))alias=LEGACY_ALIASES[intrinsicName],intrinsicName="%"+alias[0]+"%";if(hasOwn(INTRINSICS,intrinsicName)){var value=INTRINSICS[intrinsicName];if(value===needsEval)value=doEval(intrinsicName);if(typeof value>"u"&&!allowMissing)throw new $TypeError("intrinsic "+name+" exists, but is not available. Please file an issue!");return{alias,name:intrinsicName,value}}throw new $SyntaxError("intrinsic "+name+" does not exist!")};module.exports=function(name,allowMissing){if(typeof name!=="string"||name.length===0)throw new $TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof allowMissing!=="boolean")throw new $TypeError('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,name)===null)throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var parts=stringToPath(name),intrinsicBaseName=parts.length>0?parts[0]:"",intrinsic=getBaseIntrinsic("%"+intrinsicBaseName+"%",allowMissing),intrinsicRealName=intrinsic.name,value=intrinsic.value,skipFurtherCaching=!1,alias=intrinsic.alias;if(alias)intrinsicBaseName=alias[0],$spliceApply(parts,$concat([0,1],alias));for(var i2=1,isOwn=!0;i2<parts.length;i2+=1){var part=parts[i2],first=$strSlice(part,0,1),last=$strSlice(part,-1);if((first==='"'||first==="'"||first==="`"||(last==='"'||last==="'"||last==="`"))&&first!==last)throw new $SyntaxError("property names with quotes must have matching quotes");if(part==="constructor"||!isOwn)skipFurtherCaching=!0;if(intrinsicBaseName+="."+part,intrinsicRealName="%"+intrinsicBaseName+"%",hasOwn(INTRINSICS,intrinsicRealName))value=INTRINSICS[intrinsicRealName];else if(value!=null){if(!(part in value)){if(!allowMissing)throw new $TypeError("base intrinsic for "+name+" exists, but the property is not available.");return}if($gOPD&&i2+1>=parts.length){var desc=$gOPD(value,part);if(isOwn=!!desc,isOwn&&"get"in desc&&!("originalValue"in desc.get))value=desc.get;else value=value[part]}else isOwn=hasOwn(value,part),value=value[part];if(isOwn&&!skipFurtherCaching)INTRINSICS[intrinsicRealName]=value}}return value}}),require_call_bound=__commonJS2((exports,module)=>{var GetIntrinsic=require_get_intrinsic(),callBindBasic=require_call_bind_apply_helpers(),$indexOf=callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);module.exports=function(name,allowMissing){var intrinsic=GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==="function"&&$indexOf(name,".prototype.")>-1)return callBindBasic([intrinsic]);return intrinsic}}),require_is_callable=__commonJS2((exports,module)=>{var fnToStr=Function.prototype.toString,reflectApply=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,badArrayLike,isCallableMarker;if(typeof reflectApply==="function"&&typeof Object.defineProperty==="function")try{badArrayLike=Object.defineProperty({},"length",{get:function(){throw isCallableMarker}}),isCallableMarker={},reflectApply(function(){throw 42},null,badArrayLike)}catch(_){if(_!==isCallableMarker)reflectApply=null}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(value){try{var fnStr=fnToStr.call(value);return constructorRegex.test(fnStr)}catch(e){return!1}},tryFunctionObject=function(value){try{if(isES6ClassFn(value))return!1;return fnToStr.call(value),!0}catch(e){return!1}},toStr=Object.prototype.toString,objectClass="[object Object]",fnClass="[object Function]",genClass="[object GeneratorFunction]",ddaClass="[object HTMLAllCollection]",ddaClass2="[object HTML document.all class]",ddaClass3="[object HTMLCollection]",hasToStringTag=typeof Symbol==="function"&&!!Symbol.toStringTag,isIE68=!(0 in[,]),isDDA=function(){return!1};if(typeof document==="object"){if(all=document.all,toStr.call(all)===toStr.call(document.all))isDDA=function(value){if((isIE68||!value)&&(typeof value>"u"||typeof value==="object"))try{var str=toStr.call(value);return(str===ddaClass||str===ddaClass2||str===ddaClass3||str===objectClass)&&value("")==null}catch(e){}return!1}}var all;module.exports=reflectApply?function(value){if(isDDA(value))return!0;if(!value)return!1;if(typeof value!=="function"&&typeof value!=="object")return!1;try{reflectApply(value,null,badArrayLike)}catch(e){if(e!==isCallableMarker)return!1}return!isES6ClassFn(value)&&tryFunctionObject(value)}:function(value){if(isDDA(value))return!0;if(!value)return!1;if(typeof value!=="function"&&typeof value!=="object")return!1;if(hasToStringTag)return tryFunctionObject(value);if(isES6ClassFn(value))return!1;var strClass=toStr.call(value);if(strClass!==fnClass&&strClass!==genClass&&!/^\[object HTML/.test(strClass))return!1;return tryFunctionObject(value)}}),require_for_each=__commonJS2((exports,module)=>{var isCallable=require_is_callable(),toStr=Object.prototype.toString,hasOwnProperty2=Object.prototype.hasOwnProperty,forEachArray=function(array,iterator,receiver){for(var i2=0,len2=array.length;i2<len2;i2++)if(hasOwnProperty2.call(array,i2))if(receiver==null)iterator(array[i2],i2,array);else iterator.call(receiver,array[i2],i2,array)},forEachString=function(string,iterator,receiver){for(var i2=0,len2=string.length;i2<len2;i2++)if(receiver==null)iterator(string.charAt(i2),i2,string);else iterator.call(receiver,string.charAt(i2),i2,string)},forEachObject=function(object,iterator,receiver){for(var k in object)if(hasOwnProperty2.call(object,k))if(receiver==null)iterator(object[k],k,object);else iterator.call(receiver,object[k],k,object)};function isArray2(x){return toStr.call(x)==="[object Array]"}module.exports=function(list,iterator,thisArg){if(!isCallable(iterator))throw TypeError("iterator must be a function");var receiver;if(arguments.length>=3)receiver=thisArg;if(isArray2(list))forEachArray(list,iterator,receiver);else if(typeof list==="string")forEachString(list,iterator,receiver);else forEachObject(list,iterator,receiver)}}),require_possible_typed_array_names=__commonJS2((exports,module)=>{module.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),require_available_typed_arrays=__commonJS2((exports,module)=>{var possibleNames=require_possible_typed_array_names(),g=typeof globalThis>"u"?globalThis:globalThis;module.exports=function(){var out=[];for(var i2=0;i2<possibleNames.length;i2++)if(typeof g[possibleNames[i2]]==="function")out[out.length]=possibleNames[i2];return out}}),require_define_data_property=__commonJS2((exports,module)=>{var $defineProperty=require_es_define_property(),$SyntaxError=require_syntax(),$TypeError=require_type(),gopd=require_gopd();module.exports=function(obj,property,value){if(!obj||typeof obj!=="object"&&typeof obj!=="function")throw new $TypeError("`obj` must be an object or a function`");if(typeof property!=="string"&&typeof property!=="symbol")throw new $TypeError("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new $TypeError("`loose`, if provided, must be a boolean");var nonEnumerable=arguments.length>3?arguments[3]:null,nonWritable=arguments.length>4?arguments[4]:null,nonConfigurable=arguments.length>5?arguments[5]:null,loose=arguments.length>6?arguments[6]:!1,desc=!!gopd&&gopd(obj,property);if($defineProperty)$defineProperty(obj,property,{configurable:nonConfigurable===null&&desc?desc.configurable:!nonConfigurable,enumerable:nonEnumerable===null&&desc?desc.enumerable:!nonEnumerable,value,writable:nonWritable===null&&desc?desc.writable:!nonWritable});else if(loose||!nonEnumerable&&!nonWritable&&!nonConfigurable)obj[property]=value;else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),require_has_property_descriptors=__commonJS2((exports,module)=>{var $defineProperty=require_es_define_property(),hasPropertyDescriptors=function(){return!!$defineProperty};hasPropertyDescriptors.hasArrayLengthDefineBug=function(){if(!$defineProperty)return null;try{return $defineProperty([],"length",{value:1}).length!==1}catch(e){return!0}},module.exports=hasPropertyDescriptors}),require_set_function_length=__commonJS2((exports,module)=>{var GetIntrinsic=require_get_intrinsic(),define=require_define_data_property(),hasDescriptors=require_has_property_descriptors()(),gOPD=require_gopd(),$TypeError=require_type(),$floor=GetIntrinsic("%Math.floor%");module.exports=function(fn,length){if(typeof fn!=="function")throw new $TypeError("`fn` is not a function");if(typeof length!=="number"||length<0||length>4294967295||$floor(length)!==length)throw new $TypeError("`length` must be a positive 32-bit integer");var loose=arguments.length>2&&!!arguments[2],functionLengthIsConfigurable=!0,functionLengthIsWritable=!0;if("length"in fn&&gOPD){var desc=gOPD(fn,"length");if(desc&&!desc.configurable)functionLengthIsConfigurable=!1;if(desc&&!desc.writable)functionLengthIsWritable=!1}if(functionLengthIsConfigurable||functionLengthIsWritable||!loose)if(hasDescriptors)define(fn,"length",length,!0,!0);else define(fn,"length",length);return fn}}),require_applyBind=__commonJS2((exports,module)=>{var bind=require_function_bind(),$apply=require_functionApply(),actualApply=require_actualApply();module.exports=function(){return actualApply(bind,$apply,arguments)}}),require_call_bind=__commonJS2((exports,module)=>{var setFunctionLength=require_set_function_length(),$defineProperty=require_es_define_property(),callBindBasic=require_call_bind_apply_helpers(),applyBind=require_applyBind();if(module.exports=function(originalFunction){var func=callBindBasic(arguments),adjustedLength=originalFunction.length-(arguments.length-1);return setFunctionLength(func,1+(adjustedLength>0?adjustedLength:0),!0)},$defineProperty)$defineProperty(module.exports,"apply",{value:applyBind});else module.exports.apply=applyBind}),require_shams2=__commonJS2((exports,module)=>{var hasSymbols=require_shams();module.exports=function(){return hasSymbols()&&!!Symbol.toStringTag}}),require_which_typed_array=__commonJS2((exports,module)=>{var forEach=require_for_each(),availableTypedArrays=require_available_typed_arrays(),callBind=require_call_bind(),callBound=require_call_bound(),gOPD=require_gopd(),getProto=require_get_proto(),$toString=callBound("Object.prototype.toString"),hasToStringTag=require_shams2()(),g=typeof globalThis>"u"?globalThis:globalThis,typedArrays=availableTypedArrays(),$slice=callBound("String.prototype.slice"),$indexOf=callBound("Array.prototype.indexOf",!0)||function(array,value){for(var i2=0;i2<array.length;i2+=1)if(array[i2]===value)return i2;return-1},cache={__proto__:null};if(hasToStringTag&&gOPD&&getProto)forEach(typedArrays,function(typedArray){var arr=new g[typedArray];if(Symbol.toStringTag in arr&&getProto){var proto=getProto(arr),descriptor=gOPD(proto,Symbol.toStringTag);if(!descriptor&&proto){var superProto=getProto(proto);descriptor=gOPD(superProto,Symbol.toStringTag)}cache["$"+typedArray]=callBind(descriptor.get)}});else forEach(typedArrays,function(typedArray){var arr=new g[typedArray],fn=arr.slice||arr.set;if(fn)cache["$"+typedArray]=callBind(fn)});var tryTypedArrays=function(value){var found=!1;return forEach(cache,function(getter,typedArray){if(!found)try{if("$"+getter(value)===typedArray)found=$slice(typedArray,1)}catch(e){}}),found},trySlices=function(value){var found=!1;return forEach(cache,function(getter,name){if(!found)try{getter(value),found=$slice(name,1)}catch(e){}}),found};module.exports=function(value){if(!value||typeof value!=="object")return!1;if(!hasToStringTag){var tag=$slice($toString(value),8,-1);if($indexOf(typedArrays,tag)>-1)return tag;if(tag!=="Object")return!1;return trySlices(value)}if(!gOPD)return null;return tryTypedArrays(value)}}),require_is_typed_array=__commonJS2((exports,module)=>{var whichTypedArray=require_which_typed_array();module.exports=function(value){return!!whichTypedArray(value)}}),require_typed_array_buffer=__commonJS2((exports,module)=>{var $TypeError=require_type(),callBound=require_call_bound(),$typedArrayBuffer=callBound("TypedArray.prototype.buffer",!0),isTypedArray=require_is_typed_array();module.exports=$typedArrayBuffer||function(x){if(!isTypedArray(x))throw new $TypeError("Not a Typed Array");return x.buffer}}),require_to_buffer=__commonJS2((exports,module)=>{var Buffer22=require_safe_buffer().Buffer,isArray2=require_isarray(),typedArrayBuffer=require_typed_array_buffer(),isView=ArrayBuffer.isView||function(obj){try{return typedArrayBuffer(obj),!0}catch(e){return!1}},useUint8Array=typeof Uint8Array<"u",useArrayBuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",useFromArrayBuffer=useArrayBuffer&&(Buffer22.prototype instanceof Uint8Array||Buffer22.TYPED_ARRAY_SUPPORT);module.exports=function(data,encoding){if(Buffer22.isBuffer(data)){if(data.constructor&&!("isBuffer"in data))return Buffer22.from(data);return data}if(typeof data==="string")return Buffer22.from(data,encoding);if(useArrayBuffer&&isView(data)){if(data.byteLength===0)return Buffer22.alloc(0);if(useFromArrayBuffer){var res=Buffer22.from(data.buffer,data.byteOffset,data.byteLength);if(res.byteLength===data.byteLength)return res}var uint8=data instanceof Uint8Array?data:new Uint8Array(data.buffer,data.byteOffset,data.byteLength),result=Buffer22.from(uint8);if(result.length===data.byteLength)return result}if(useUint8Array&&data instanceof Uint8Array)return Buffer22.from(data);var isArr=isArray2(data);if(isArr)for(var i2=0;i2<data.length;i2+=1){var x=data[i2];if(typeof x!=="number"||x<0||x>255||~~x!==x)throw RangeError("Array items must be numbers in the range 0-255.")}if(isArr||Buffer22.isBuffer(data)&&data.constructor&&typeof data.constructor.isBuffer==="function"&&data.constructor.isBuffer(data))return Buffer22.from(data);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}}),require_to_buffer2=__commonJS2((exports,module)=>{var Buffer22=require_safe_buffer().Buffer,toBuffer=require_to_buffer(),useUint8Array=typeof Uint8Array<"u",useArrayBuffer=useUint8Array&&typeof ArrayBuffer<"u",isView=useArrayBuffer&&ArrayBuffer.isView;module.exports=function(thing,encoding,name){if(typeof thing==="string"||Buffer22.isBuffer(thing)||useUint8Array&&thing instanceof Uint8Array||isView&&isView(thing))return toBuffer(thing,encoding);throw TypeError(name+" must be a string, a Buffer, a Uint8Array, or a DataView")}}),require_sync=__commonJS2((exports,module)=>{var sizes={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,rmd160:20,ripemd160:20},mapping={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"},createHmac=require_create_hmac(),Buffer22=require_safe_buffer().Buffer,checkParameters=require_precondition(),defaultEncoding=require_default_encoding(),toBuffer=require_to_buffer2();function pbkdf2(password,salt,iterations,keylen,digest){checkParameters(iterations,keylen),password=toBuffer(password,defaultEncoding,"Password"),salt=toBuffer(salt,defaultEncoding,"Salt");var lowerDigest=(digest||"sha1").toLowerCase(),mappedDigest=mapping[lowerDigest]||lowerDigest,size=sizes[mappedDigest];if(typeof size!=="number"||!size)throw TypeError("Digest algorithm not supported: "+digest);var DK=Buffer22.allocUnsafe(keylen),block1=Buffer22.allocUnsafe(salt.length+4);salt.copy(block1,0,0,salt.length);var destPos=0,hLen=size,l=Math.ceil(keylen/hLen);for(var i2=1;i2<=l;i2++){block1.writeUInt32BE(i2,salt.length);var T=createHmac(mappedDigest,password).update(block1).digest(),U=T;for(var j=1;j<iterations;j++){U=createHmac(mappedDigest,password).update(U).digest();for(var k=0;k<hLen;k++)T[k]^=U[k]}T.copy(DK,destPos),destPos+=hLen}return DK}module.exports=pbkdf2}),require_async=__commonJS2((exports,module)=>{var Buffer22=require_safe_buffer().Buffer,checkParameters=require_precondition(),defaultEncoding=require_default_encoding(),sync=require_sync(),toBuffer=require_to_buffer2(),ZERO_BUF,subtle=globalThis.crypto&&globalThis.crypto.subtle,toBrowser={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},checks=[],nextTick;function getNextTick(){if(nextTick)return nextTick;if(globalThis.process&&globalThis.process.nextTick)nextTick=globalThis.process.nextTick;else if(globalThis.queueMicrotask)nextTick=globalThis.queueMicrotask;else if(globalThis.setImmediate)nextTick=globalThis.setImmediate;else nextTick=globalThis.setTimeout;return nextTick}function browserPbkdf2(password,salt,iterations,length,algo){return subtle.importKey("raw",password,{name:"PBKDF2"},!1,["deriveBits"]).then(function(key){return subtle.deriveBits({name:"PBKDF2",salt,iterations,hash:{name:algo}},key,length<<3)}).then(function(res){return Buffer22.from(res)})}function checkNative(algo){if(globalThis.process&&!globalThis.process.browser)return Promise.resolve(!1);if(!subtle||!subtle.importKey||!subtle.deriveBits)return Promise.resolve(!1);if(checks[algo]!==void 0)return checks[algo];ZERO_BUF=ZERO_BUF||Buffer22.alloc(8);var prom=browserPbkdf2(ZERO_BUF,ZERO_BUF,10,128,algo).then(function(){return!0},function(){return!1});return checks[algo]=prom,prom}function resolvePromise(promise,callback){promise.then(function(out){getNextTick()(function(){callback(null,out)})},function(e){getNextTick()(function(){callback(e)})})}module.exports=function(password,salt,iterations,keylen,digest,callback){if(typeof digest==="function")callback=digest,digest=void 0;if(checkParameters(iterations,keylen),password=toBuffer(password,defaultEncoding,"Password"),salt=toBuffer(salt,defaultEncoding,"Salt"),typeof callback!=="function")throw Error("No callback provided to pbkdf2");digest=digest||"sha1";var algo=toBrowser[digest.toLowerCase()];if(!algo||typeof globalThis.Promise!=="function"){getNextTick()(function(){var out;try{out=sync(password,salt,iterations,keylen,digest)}catch(e){callback(e);return}callback(null,out)});return}resolvePromise(checkNative(algo).then(function(resp){if(resp)return browserPbkdf2(password,salt,iterations,keylen,algo);return sync(password,salt,iterations,keylen,digest)}),callback)}}),require_pbkdf2=__commonJS2((exports)=>{var nativeImpl=(init_crypto(),__toCommonJS(exports_crypto)),checkParameters=require_precondition(),defaultEncoding=require_default_encoding(),toBuffer=require_to_buffer2();function nativePBKDF2(password,salt,iterations,keylen,digest,callback){if(checkParameters(iterations,keylen),password=toBuffer(password,defaultEncoding,"Password"),salt=toBuffer(salt,defaultEncoding,"Salt"),typeof digest==="function")callback=digest,digest="sha1";if(typeof callback!=="function")throw Error("No callback provided to pbkdf2");return nativeImpl.pbkdf2(password,salt,iterations,keylen,digest,callback)}function nativePBKDF2Sync(password,salt,iterations,keylen,digest){return checkParameters(iterations,keylen),password=toBuffer(password,defaultEncoding,"Password"),salt=toBuffer(salt,defaultEncoding,"Salt"),digest=digest||"sha1",nativeImpl.pbkdf2Sync(password,salt,iterations,keylen,digest)}if(!nativeImpl.pbkdf2Sync||nativeImpl.pbkdf2Sync.toString().indexOf("keylen, digest")===-1)exports.pbkdf2Sync=require_sync(),exports.pbkdf2=require_async();else exports.pbkdf2Sync=nativePBKDF2Sync,exports.pbkdf2=nativePBKDF2}),require_browserify_cipher=__commonJS2((exports)=>{var crypto2=(init_crypto(),__toCommonJS(exports_crypto));exports.createCipher=exports.Cipher=crypto2.createCipher,exports.createCipheriv=exports.Cipheriv=crypto2.createCipheriv,exports.createDecipher=exports.Decipher=crypto2.createDecipher,exports.createDecipheriv=exports.Decipheriv=crypto2.createDecipheriv,exports.listCiphers=exports.getCiphers=crypto2.getCiphers}),require_diffie_hellman=__commonJS2((exports)=>{var crypto2=(init_crypto(),__toCommonJS(exports_crypto));exports.DiffieHellmanGroup=crypto2.DiffieHellmanGroup,exports.createDiffieHellmanGroup=crypto2.createDiffieHellmanGroup,exports.getDiffieHellman=crypto2.getDiffieHellman,exports.createDiffieHellman=crypto2.createDiffieHellman,exports.DiffieHellman=crypto2.DiffieHellman}),require_browserify_sign=__commonJS2((exports)=>{var crypto2=(init_crypto(),__toCommonJS(exports_crypto));exports.createSign=crypto2.createSign,exports.Sign=crypto2.Sign,exports.createVerify=crypto2.createVerify,exports.Verify=crypto2.Verify}),require_package=__commonJS2((exports,module)=>{module.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}}),require_bn=__commonJS2((exports,module)=>{(function(module2,exports2){function assert(val,msg){if(!val)throw Error(msg||"Assertion failed")}function inherits2(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}function BN(number,base,endian){if(BN.isBN(number))return number;if(this.negative=0,this.words=null,this.length=0,this.red=null,number!==null){if(base==="le"||base==="be")endian=base,base=10;this._init(number||0,base||10,endian||"be")}}if(typeof module2==="object")module2.exports=BN;else exports2.BN=BN;BN.BN=BN,BN.wordSize=26;var Buffer22;try{if(typeof window<"u"&&typeof window.Buffer<"u")Buffer22=window.Buffer;else Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer}catch(e){}BN.isBN=function(num){if(num instanceof BN)return!0;return num!==null&&typeof num==="object"&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)},BN.max=function(left,right){if(left.cmp(right)>0)return left;return right},BN.min=function(left,right){if(left.cmp(right)<0)return left;return right},BN.prototype._init=function(number,base,endian){if(typeof number==="number")return this._initNumber(number,base,endian);if(typeof number==="object")return this._initArray(number,base,endian);if(base==="hex")base=16;assert(base===(base|0)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,"");var start=0;if(number[0]==="-")start++,this.negative=1;if(start<number.length){if(base===16)this._parseHex(number,start,endian);else if(this._parseBase(number,base,start),endian==="le")this._initArray(this.toArray(),base,endian)}},BN.prototype._initNumber=function(number,base,endian){if(number<0)this.negative=1,number=-number;if(number<67108864)this.words=[number&67108863],this.length=1;else if(number<4503599627370496)this.words=[number&67108863,number/67108864&67108863],this.length=2;else assert(number<9007199254740992),this.words=[number&67108863,number/67108864&67108863,1],this.length=3;if(endian!=="le")return;this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert(typeof number.length==="number"),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var j,w,off=0;if(endian==="be"){for(i2=number.length-1,j=0;i2>=0;i2-=3)if(w=number[i2]|number[i2-1]<<8|number[i2-2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}else if(endian==="le"){for(i2=0,j=0;i2<number.length;i2+=3)if(w=number[i2]|number[i2+1]<<8|number[i2+2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}return this.strip()};function parseHex4Bits(string,index){var c=string.charCodeAt(index);if(c>=65&&c<=70)return c-55;else if(c>=97&&c<=102)return c-87;else return c-48&15}function parseHexByte(string,lowerBound,index){var r=parseHex4Bits(string,index);if(index-1>=lowerBound)r|=parseHex4Bits(string,index-1)<<4;return r}BN.prototype._parseHex=function(number,start,endian){this.length=Math.ceil((number.length-start)/6),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var off=0,j=0,w;if(endian==="be")for(i2=number.length-1;i2>=start;i2-=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8;else{var parseLength=number.length-start;for(i2=parseLength%2===0?start+1:start;i2<number.length;i2+=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8}this.strip()};function parseBase(str,start,end,mul){var r=0,len2=Math.min(str.length,end);for(var i2=start;i2<len2;i2++){var c=str.charCodeAt(i2)-48;if(r*=mul,c>=49)r+=c-49+10;else if(c>=17)r+=c-17+10;else r+=c}return r}BN.prototype._parseBase=function(number,base,start){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;var total=number.length-start,mod=total%limbLen,end=Math.min(total,total-mod)+start,word=0;for(var i2=start;i2<end;i2+=limbLen)if(word=parseBase(number,i2,i2+limbLen,base),this.imuln(limbPow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word);if(mod!==0){var pow=1;word=parseBase(number,i2,number.length,base);for(i2=0;i2<mod;i2++)pow*=base;if(this.imuln(pow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word)}this.strip()},BN.prototype.copy=function(dest){dest.words=Array(this.length);for(var i2=0;i2<this.length;i2++)dest.words[i2]=this.words[i2];dest.length=this.length,dest.negative=this.negative,dest.red=this.red},BN.prototype.clone=function(){var r=new BN(null);return this.copy(r),r},BN.prototype._expand=function(size){while(this.length<size)this.words[this.length++]=0;return this},BN.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},BN.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},BN.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var zeros=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(BN.prototype.toString=function(base,padding){base=base||10,padding=padding|0||1;var out;if(base===16||base==="hex"){out="";var off=0,carry=0;for(var i2=0;i2<this.length;i2++){var w=this.words[i2],word=((w<<off|carry)&16777215).toString(16);if(carry=w>>>24-off&16777215,off+=2,off>=26)off-=26,i2--;if(carry!==0||i2!==this.length-1)out=zeros[6-word.length]+word+out;else out=word+out}if(carry!==0)out=carry.toString(16)+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base];out="";var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modn(groupBase).toString(base);if(c=c.idivn(groupBase),!c.isZero())out=zeros[groupSize-r.length]+r+out;else out=r+out}if(this.isZero())out="0"+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function(){var ret=this.words[0];if(this.length===2)ret+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)ret+=4503599627370496+this.words[1]*67108864;else if(this.length>2)assert(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-ret:ret},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toBuffer=function(endian,length){return assert(typeof Buffer22<"u"),this.toArrayLike(Buffer22,endian,length)},BN.prototype.toArray=function(endian,length){return this.toArrayLike(Array,endian,length)},BN.prototype.toArrayLike=function(ArrayType,endian,length){var byteLength2=this.byteLength(),reqLength=length||Math.max(1,byteLength2);assert(byteLength2<=reqLength,"byte array longer than desired length"),assert(reqLength>0,"Requested array length <= 0"),this.strip();var littleEndian=endian==="le",res=new ArrayType(reqLength),b,i2,q=this.clone();if(!littleEndian){for(i2=0;i2<reqLength-byteLength2;i2++)res[i2]=0;for(i2=0;!q.isZero();i2++)b=q.andln(255),q.iushrn(8),res[reqLength-i2-1]=b}else{for(i2=0;!q.isZero();i2++)b=q.andln(255),q.iushrn(8),res[i2]=b;for(;i2<reqLength;i2++)res[i2]=0}return res},Math.clz32)BN.prototype._countBits=function(w){return 32-Math.clz32(w)};else BN.prototype._countBits=function(w){var t=w,r=0;if(t>=4096)r+=13,t>>>=13;if(t>=64)r+=7,t>>>=7;if(t>=8)r+=4,t>>>=4;if(t>=2)r+=2,t>>>=2;return r+t};BN.prototype._zeroBits=function(w){if(w===0)return 26;var t=w,r=0;if((t&8191)===0)r+=13,t>>>=13;if((t&127)===0)r+=7,t>>>=7;if((t&15)===0)r+=4,t>>>=4;if((t&3)===0)r+=2,t>>>=2;if((t&1)===0)r++;return r},BN.prototype.bitLength=function(){var w=this.words[this.length-1],hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){var w=Array(num.bitLength());for(var bit=0;bit<w.length;bit++){var off=bit/26|0,wbit=bit%26;w[bit]=(num.words[off]&1<<wbit)>>>wbit}return w}BN.prototype.zeroBits=function(){if(this.isZero())return 0;var r=0;for(var i2=0;i2<this.length;i2++){var b=this._zeroBits(this.words[i2]);if(r+=b,b!==26)break}return r},BN.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function(width){if(this.negative!==0)return this.abs().inotn(width).iaddn(1);return this.clone()},BN.prototype.fromTwos=function(width){if(this.testn(width-1))return this.notn(width).iaddn(1).ineg();return this.clone()},BN.prototype.isNeg=function(){return this.negative!==0},BN.prototype.neg=function(){return this.clone().ineg()},BN.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},BN.prototype.iuor=function(num){while(this.length<num.length)this.words[this.length++]=0;for(var i2=0;i2<num.length;i2++)this.words[i2]=this.words[i2]|num.words[i2];return this.strip()},BN.prototype.ior=function(num){return assert((this.negative|num.negative)===0),this.iuor(num)},BN.prototype.or=function(num){if(this.length>num.length)return this.clone().ior(num);return num.clone().ior(this)},BN.prototype.uor=function(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this)},BN.prototype.iuand=function(num){var b;if(this.length>num.length)b=num;else b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=this.words[i2]&num.words[i2];return this.length=b.length,this.strip()},BN.prototype.iand=function(num){return assert((this.negative|num.negative)===0),this.iuand(num)},BN.prototype.and=function(num){if(this.length>num.length)return this.clone().iand(num);return num.clone().iand(this)},BN.prototype.uand=function(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this)},BN.prototype.iuxor=function(num){var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=a.words[i2]^b.words[i2];if(this!==a)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this.length=a.length,this.strip()},BN.prototype.ixor=function(num){return assert((this.negative|num.negative)===0),this.iuxor(num)},BN.prototype.xor=function(num){if(this.length>num.length)return this.clone().ixor(num);return num.clone().ixor(this)},BN.prototype.uxor=function(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this)},BN.prototype.inotn=function(width){assert(typeof width==="number"&&width>=0);var bytesNeeded=Math.ceil(width/26)|0,bitsLeft=width%26;if(this._expand(bytesNeeded),bitsLeft>0)bytesNeeded--;for(var i2=0;i2<bytesNeeded;i2++)this.words[i2]=~this.words[i2]&67108863;if(bitsLeft>0)this.words[i2]=~this.words[i2]&67108863>>26-bitsLeft;return this.strip()},BN.prototype.notn=function(width){return this.clone().inotn(width)},BN.prototype.setn=function(bit,val){assert(typeof bit==="number"&&bit>=0);var off=bit/26|0,wbit=bit%26;if(this._expand(off+1),val)this.words[off]=this.words[off]|1<<wbit;else this.words[off]=this.words[off]&~(1<<wbit);return this.strip()},BN.prototype.iadd=function(num){var r;if(this.negative!==0&&num.negative===0)return this.negative=0,r=this.isub(num),this.negative^=1,this._normSign();else if(this.negative===0&&num.negative!==0)return num.negative=0,r=this.isub(num),num.negative=1,r._normSign();var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)+(b.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;if(this.length=a.length,carry!==0)this.words[this.length]=carry,this.length++;else if(a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this},BN.prototype.add=function(num){var res;if(num.negative!==0&&this.negative===0)return num.negative=0,res=this.sub(num),num.negative^=1,res;else if(num.negative===0&&this.negative!==0)return this.negative=0,res=num.sub(this),this.negative=1,res;if(this.length>num.length)return this.clone().iadd(num);return num.clone().iadd(this)},BN.prototype.isub=function(num){if(num.negative!==0){num.negative=0;var r=this.iadd(num);return num.negative=1,r._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(num),this.negative=1,this._normSign();var cmp=this.cmp(num);if(cmp===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,b;if(cmp>0)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)-(b.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;if(carry===0&&i2<a.length&&a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];if(this.length=Math.max(this.length,i2),a!==this)this.negative=1;return this.strip()},BN.prototype.sub=function(num){return this.clone().isub(num)};function smallMulTo(self2,num,out){out.negative=num.negative^self2.negative;var len2=self2.length+num.length|0;out.length=len2,len2=len2-1|0;var a=self2.words[0]|0,b=num.words[0]|0,r=a*b,lo=r&67108863,carry=r/67108864|0;out.words[0]=lo;for(var k=1;k<len2;k++){var ncarry=carry>>>26,rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j|0;a=self2.words[i2]|0,b=num.words[j]|0,r=a*b+rword,ncarry+=r/67108864|0,rword=r&67108863}out.words[k]=rword|0,carry=ncarry|0}if(carry!==0)out.words[k]=carry|0;else out.length--;return out.strip()}var comb10MulTo=function(self2,num,out){var a=self2.words,b=num.words,o=out.words,c=0,lo,mid,hi,a0=a[0]|0,al0=a0&8191,ah0=a0>>>13,a1=a[1]|0,al1=a1&8191,ah1=a1>>>13,a2=a[2]|0,al2=a2&8191,ah2=a2>>>13,a3=a[3]|0,al3=a3&8191,ah3=a3>>>13,a4=a[4]|0,al4=a4&8191,ah4=a4>>>13,a5=a[5]|0,al5=a5&8191,ah5=a5>>>13,a6=a[6]|0,al6=a6&8191,ah6=a6>>>13,a7=a[7]|0,al7=a7&8191,ah7=a7>>>13,a8=a[8]|0,al8=a8&8191,ah8=a8>>>13,a9=a[9]|0,al9=a9&8191,ah9=a9>>>13,b0=b[0]|0,bl0=b0&8191,bh0=b0>>>13,b1=b[1]|0,bl1=b1&8191,bh1=b1>>>13,b2=b[2]|0,bl2=b2&8191,bh2=b2>>>13,b3=b[3]|0,bl3=b3&8191,bh3=b3>>>13,b4=b[4]|0,bl4=b4&8191,bh4=b4>>>13,b5=b[5]|0,bl5=b5&8191,bh5=b5>>>13,b6=b[6]|0,bl6=b6&8191,bh6=b6>>>13,b7=b[7]|0,bl7=b7&8191,bh7=b7>>>13,b8=b[8]|0,bl8=b8&8191,bh8=b8>>>13,b9=b[9]|0,bl9=b9&8191,bh9=b9>>>13;out.negative=self2.negative^num.negative,out.length=19,lo=Math.imul(al0,bl0),mid=Math.imul(al0,bh0),mid=mid+Math.imul(ah0,bl0)|0,hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0,w0&=67108863,lo=Math.imul(al1,bl0),mid=Math.imul(al1,bh0),mid=mid+Math.imul(ah1,bl0)|0,hi=Math.imul(ah1,bh0),lo=lo+Math.imul(al0,bl1)|0,mid=mid+Math.imul(al0,bh1)|0,mid=mid+Math.imul(ah0,bl1)|0,hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0,w1&=67108863,lo=Math.imul(al2,bl0),mid=Math.imul(al2,bh0),mid=mid+Math.imul(ah2,bl0)|0,hi=Math.imul(ah2,bh0),lo=lo+Math.imul(al1,bl1)|0,mid=mid+Math.imul(al1,bh1)|0,mid=mid+Math.imul(ah1,bl1)|0,hi=hi+Math.imul(ah1,bh1)|0,lo=lo+Math.imul(al0,bl2)|0,mid=mid+Math.imul(al0,bh2)|0,mid=mid+Math.imul(ah0,bl2)|0,hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0,w2&=67108863,lo=Math.imul(al3,bl0),mid=Math.imul(al3,bh0),mid=mid+Math.imul(ah3,bl0)|0,hi=Math.imul(ah3,bh0),lo=lo+Math.imul(al2,bl1)|0,mid=mid+Math.imul(al2,bh1)|0,mid=mid+Math.imul(ah2,bl1)|0,hi=hi+Math.imul(ah2,bh1)|0,lo=lo+Math.imul(al1,bl2)|0,mid=mid+Math.imul(al1,bh2)|0,mid=mid+Math.imul(ah1,bl2)|0,hi=hi+Math.imul(ah1,bh2)|0,lo=lo+Math.imul(al0,bl3)|0,mid=mid+Math.imul(al0,bh3)|0,mid=mid+Math.imul(ah0,bl3)|0,hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0,w3&=67108863,lo=Math.imul(al4,bl0),mid=Math.imul(al4,bh0),mid=mid+Math.imul(ah4,bl0)|0,hi=Math.imul(ah4,bh0),lo=lo+Math.imul(al3,bl1)|0,mid=mid+Math.imul(al3,bh1)|0,mid=mid+Math.imul(ah3,bl1)|0,hi=hi+Math.imul(ah3,bh1)|0,lo=lo+Math.imul(al2,bl2)|0,mid=mid+Math.imul(al2,bh2)|0,mid=mid+Math.imul(ah2,bl2)|0,hi=hi+Math.imul(ah2,bh2)|0,lo=lo+Math.imul(al1,bl3)|0,mid=mid+Math.imul(al1,bh3)|0,mid=mid+Math.imul(ah1,bl3)|0,hi=hi+Math.imul(ah1,bh3)|0,lo=lo+Math.imul(al0,bl4)|0,mid=mid+Math.imul(al0,bh4)|0,mid=mid+Math.imul(ah0,bl4)|0,hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0,w4&=67108863,lo=Math.imul(al5,bl0),mid=Math.imul(al5,bh0),mid=mid+Math.imul(ah5,bl0)|0,hi=Math.imul(ah5,bh0),lo=lo+Math.imul(al4,bl1)|0,mid=mid+Math.imul(al4,bh1)|0,mid=mid+Math.imul(ah4,bl1)|0,hi=hi+Math.imul(ah4,bh1)|0,lo=lo+Math.imul(al3,bl2)|0,mid=mid+Math.imul(al3,bh2)|0,mid=mid+Math.imul(ah3,bl2)|0,hi=hi+Math.imul(ah3,bh2)|0,lo=lo+Math.imul(al2,bl3)|0,mid=mid+Math.imul(al2,bh3)|0,mid=mid+Math.imul(ah2,bl3)|0,hi=hi+Math.imul(ah2,bh3)|0,lo=lo+Math.imul(al1,bl4)|0,mid=mid+Math.imul(al1,bh4)|0,mid=mid+Math.imul(ah1,bl4)|0,hi=hi+Math.imul(ah1,bh4)|0,lo=lo+Math.imul(al0,bl5)|0,mid=mid+Math.imul(al0,bh5)|0,mid=mid+Math.imul(ah0,bl5)|0,hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0,w5&=67108863,lo=Math.imul(al6,bl0),mid=Math.imul(al6,bh0),mid=mid+Math.imul(ah6,bl0)|0,hi=Math.imul(ah6,bh0),lo=lo+Math.imul(al5,bl1)|0,mid=mid+Math.imul(al5,bh1)|0,mid=mid+Math.imul(ah5,bl1)|0,hi=hi+Math.imul(ah5,bh1)|0,lo=lo+Math.imul(al4,bl2)|0,mid=mid+Math.imul(al4,bh2)|0,mid=mid+Math.imul(ah4,bl2)|0,hi=hi+Math.imul(ah4,bh2)|0,lo=lo+Math.imul(al3,bl3)|0,mid=mid+Math.imul(al3,bh3)|0,mid=mid+Math.imul(ah3,bl3)|0,hi=hi+Math.imul(ah3,bh3)|0,lo=lo+Math.imul(al2,bl4)|0,mid=mid+Math.imul(al2,bh4)|0,mid=mid+Math.imul(ah2,bl4)|0,hi=hi+Math.imul(ah2,bh4)|0,lo=lo+Math.imul(al1,bl5)|0,mid=mid+Math.imul(al1,bh5)|0,mid=mid+Math.imul(ah1,bl5)|0,hi=hi+Math.imul(ah1,bh5)|0,lo=lo+Math.imul(al0,bl6)|0,mid=mid+Math.imul(al0,bh6)|0,mid=mid+Math.imul(ah0,bl6)|0,hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0,w6&=67108863,lo=Math.imul(al7,bl0),mid=Math.imul(al7,bh0),mid=mid+Math.imul(ah7,bl0)|0,hi=Math.imul(ah7,bh0),lo=lo+Math.imul(al6,bl1)|0,mid=mid+Math.imul(al6,bh1)|0,mid=mid+Math.imul(ah6,bl1)|0,hi=hi+Math.imul(ah6,bh1)|0,lo=lo+Math.imul(al5,bl2)|0,mid=mid+Math.imul(al5,bh2)|0,mid=mid+Math.imul(ah5,bl2)|0,hi=hi+Math.imul(ah5,bh2)|0,lo=lo+Math.imul(al4,bl3)|0,mid=mid+Math.imul(al4,bh3)|0,mid=mid+Math.imul(ah4,bl3)|0,hi=hi+Math.imul(ah4,bh3)|0,lo=lo+Math.imul(al3,bl4)|0,mid=mid+Math.imul(al3,bh4)|0,mid=mid+Math.imul(ah3,bl4)|0,hi=hi+Math.imul(ah3,bh4)|0,lo=lo+Math.imul(al2,bl5)|0,mid=mid+Math.imul(al2,bh5)|0,mid=mid+Math.imul(ah2,bl5)|0,hi=hi+Math.imul(ah2,bh5)|0,lo=lo+Math.imul(al1,bl6)|0,mid=mid+Math.imul(al1,bh6)|0,mid=mid+Math.imul(ah1,bl6)|0,hi=hi+Math.imul(ah1,bh6)|0,lo=lo+Math.imul(al0,bl7)|0,mid=mid+Math.imul(al0,bh7)|0,mid=mid+Math.imul(ah0,bl7)|0,hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0,w7&=67108863,lo=Math.imul(al8,bl0),mid=Math.imul(al8,bh0),mid=mid+Math.imul(ah8,bl0)|0,hi=Math.imul(ah8,bh0),lo=lo+Math.imul(al7,bl1)|0,mid=mid+Math.imul(al7,bh1)|0,mid=mid+Math.imul(ah7,bl1)|0,hi=hi+Math.imul(ah7,bh1)|0,lo=lo+Math.imul(al6,bl2)|0,mid=mid+Math.imul(al6,bh2)|0,mid=mid+Math.imul(ah6,bl2)|0,hi=hi+Math.imul(ah6,bh2)|0,lo=lo+Math.imul(al5,bl3)|0,mid=mid+Math.imul(al5,bh3)|0,mid=mid+Math.imul(ah5,bl3)|0,hi=hi+Math.imul(ah5,bh3)|0,lo=lo+Math.imul(al4,bl4)|0,mid=mid+Math.imul(al4,bh4)|0,mid=mid+Math.imul(ah4,bl4)|0,hi=hi+Math.imul(ah4,bh4)|0,lo=lo+Math.imul(al3,bl5)|0,mid=mid+Math.imul(al3,bh5)|0,mid=mid+Math.imul(ah3,bl5)|0,hi=hi+Math.imul(ah3,bh5)|0,lo=lo+Math.imul(al2,bl6)|0,mid=mid+Math.imul(al2,bh6)|0,mid=mid+Math.imul(ah2,bl6)|0,hi=hi+Math.imul(ah2,bh6)|0,lo=lo+Math.imul(al1,bl7)|0,mid=mid+Math.imul(al1,bh7)|0,mid=mid+Math.imul(ah1,bl7)|0,hi=hi+Math.imul(ah1,bh7)|0,lo=lo+Math.imul(al0,bl8)|0,mid=mid+Math.imul(al0,bh8)|0,mid=mid+Math.imul(ah0,bl8)|0,hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0,w8&=67108863,lo=Math.imul(al9,bl0),mid=Math.imul(al9,bh0),mid=mid+Math.imul(ah9,bl0)|0,hi=Math.imul(ah9,bh0),lo=lo+Math.imul(al8,bl1)|0,mid=mid+Math.imul(al8,bh1)|0,mid=mid+Math.imul(ah8,bl1)|0,hi=hi+Math.imul(ah8,bh1)|0,lo=lo+Math.imul(al7,bl2)|0,mid=mid+Math.imul(al7,bh2)|0,mid=mid+Math.imul(ah7,bl2)|0,hi=hi+Math.imul(ah7,bh2)|0,lo=lo+Math.imul(al6,bl3)|0,mid=mid+Math.imul(al6,bh3)|0,mid=mid+Math.imul(ah6,bl3)|0,hi=hi+Math.imul(ah6,bh3)|0,lo=lo+Math.imul(al5,bl4)|0,mid=mid+Math.imul(al5,bh4)|0,mid=mid+Math.imul(ah5,bl4)|0,hi=hi+Math.imul(ah5,bh4)|0,lo=lo+Math.imul(al4,bl5)|0,mid=mid+Math.imul(al4,bh5)|0,mid=mid+Math.imul(ah4,bl5)|0,hi=hi+Math.imul(ah4,bh5)|0,lo=lo+Math.imul(al3,bl6)|0,mid=mid+Math.imul(al3,bh6)|0,mid=mid+Math.imul(ah3,bl6)|0,hi=hi+Math.imul(ah3,bh6)|0,lo=lo+Math.imul(al2,bl7)|0,mid=mid+Math.imul(al2,bh7)|0,mid=mid+Math.imul(ah2,bl7)|0,hi=hi+Math.imul(ah2,bh7)|0,lo=lo+Math.imul(al1,bl8)|0,mid=mid+Math.imul(al1,bh8)|0,mid=mid+Math.imul(ah1,bl8)|0,hi=hi+Math.imul(ah1,bh8)|0,lo=lo+Math.imul(al0,bl9)|0,mid=mid+Math.imul(al0,bh9)|0,mid=mid+Math.imul(ah0,bl9)|0,hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0,w9&=67108863,lo=Math.imul(al9,bl1),mid=Math.imul(al9,bh1),mid=mid+Math.imul(ah9,bl1)|0,hi=Math.imul(ah9,bh1),lo=lo+Math.imul(al8,bl2)|0,mid=mid+Math.imul(al8,bh2)|0,mid=mid+Math.imul(ah8,bl2)|0,hi=hi+Math.imul(ah8,bh2)|0,lo=lo+Math.imul(al7,bl3)|0,mid=mid+Math.imul(al7,bh3)|0,mid=mid+Math.imul(ah7,bl3)|0,hi=hi+Math.imul(ah7,bh3)|0,lo=lo+Math.imul(al6,bl4)|0,mid=mid+Math.imul(al6,bh4)|0,mid=mid+Math.imul(ah6,bl4)|0,hi=hi+Math.imul(ah6,bh4)|0,lo=lo+Math.imul(al5,bl5)|0,mid=mid+Math.imul(al5,bh5)|0,mid=mid+Math.imul(ah5,bl5)|0,hi=hi+Math.imul(ah5,bh5)|0,lo=lo+Math.imul(al4,bl6)|0,mid=mid+Math.imul(al4,bh6)|0,mid=mid+Math.imul(ah4,bl6)|0,hi=hi+Math.imul(ah4,bh6)|0,lo=lo+Math.imul(al3,bl7)|0,mid=mid+Math.imul(al3,bh7)|0,mid=mid+Math.imul(ah3,bl7)|0,hi=hi+Math.imul(ah3,bh7)|0,lo=lo+Math.imul(al2,bl8)|0,mid=mid+Math.imul(al2,bh8)|0,mid=mid+Math.imul(ah2,bl8)|0,hi=hi+Math.imul(ah2,bh8)|0,lo=lo+Math.imul(al1,bl9)|0,mid=mid+Math.imul(al1,bh9)|0,mid=mid+Math.imul(ah1,bl9)|0,hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0,w10&=67108863,lo=Math.imul(al9,bl2),mid=Math.imul(al9,bh2),mid=mid+Math.imul(ah9,bl2)|0,hi=Math.imul(ah9,bh2),lo=lo+Math.imul(al8,bl3)|0,mid=mid+Math.imul(al8,bh3)|0,mid=mid+Math.imul(ah8,bl3)|0,hi=hi+Math.imul(ah8,bh3)|0,lo=lo+Math.imul(al7,bl4)|0,mid=mid+Math.imul(al7,bh4)|0,mid=mid+Math.imul(ah7,bl4)|0,hi=hi+Math.imul(ah7,bh4)|0,lo=lo+Math.imul(al6,bl5)|0,mid=mid+Math.imul(al6,bh5)|0,mid=mid+Math.imul(ah6,bl5)|0,hi=hi+Math.imul(ah6,bh5)|0,lo=lo+Math.imul(al5,bl6)|0,mid=mid+Math.imul(al5,bh6)|0,mid=mid+Math.imul(ah5,bl6)|0,hi=hi+Math.imul(ah5,bh6)|0,lo=lo+Math.imul(al4,bl7)|0,mid=mid+Math.imul(al4,bh7)|0,mid=mid+Math.imul(ah4,bl7)|0,hi=hi+Math.imul(ah4,bh7)|0,lo=lo+Math.imul(al3,bl8)|0,mid=mid+Math.imul(al3,bh8)|0,mid=mid+Math.imul(ah3,bl8)|0,hi=hi+Math.imul(ah3,bh8)|0,lo=lo+Math.imul(al2,bl9)|0,mid=mid+Math.imul(al2,bh9)|0,mid=mid+Math.imul(ah2,bl9)|0,hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0,w11&=67108863,lo=Math.imul(al9,bl3),mid=Math.imul(al9,bh3),mid=mid+Math.imul(ah9,bl3)|0,hi=Math.imul(ah9,bh3),lo=lo+Math.imul(al8,bl4)|0,mid=mid+Math.imul(al8,bh4)|0,mid=mid+Math.imul(ah8,bl4)|0,hi=hi+Math.imul(ah8,bh4)|0,lo=lo+Math.imul(al7,bl5)|0,mid=mid+Math.imul(al7,bh5)|0,mid=mid+Math.imul(ah7,bl5)|0,hi=hi+Math.imul(ah7,bh5)|0,lo=lo+Math.imul(al6,bl6)|0,mid=mid+Math.imul(al6,bh6)|0,mid=mid+Math.imul(ah6,bl6)|0,hi=hi+Math.imul(ah6,bh6)|0,lo=lo+Math.imul(al5,bl7)|0,mid=mid+Math.imul(al5,bh7)|0,mid=mid+Math.imul(ah5,bl7)|0,hi=hi+Math.imul(ah5,bh7)|0,lo=lo+Math.imul(al4,bl8)|0,mid=mid+Math.imul(al4,bh8)|0,mid=mid+Math.imul(ah4,bl8)|0,hi=hi+Math.imul(ah4,bh8)|0,lo=lo+Math.imul(al3,bl9)|0,mid=mid+Math.imul(al3,bh9)|0,mid=mid+Math.imul(ah3,bl9)|0,hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0,w12&=67108863,lo=Math.imul(al9,bl4),mid=Math.imul(al9,bh4),mid=mid+Math.imul(ah9,bl4)|0,hi=Math.imul(ah9,bh4),lo=lo+Math.imul(al8,bl5)|0,mid=mid+Math.imul(al8,bh5)|0,mid=mid+Math.imul(ah8,bl5)|0,hi=hi+Math.imul(ah8,bh5)|0,lo=lo+Math.imul(al7,bl6)|0,mid=mid+Math.imul(al7,bh6)|0,mid=mid+Math.imul(ah7,bl6)|0,hi=hi+Math.imul(ah7,bh6)|0,lo=lo+Math.imul(al6,bl7)|0,mid=mid+Math.imul(al6,bh7)|0,mid=mid+Math.imul(ah6,bl7)|0,hi=hi+Math.imul(ah6,bh7)|0,lo=lo+Math.imul(al5,bl8)|0,mid=mid+Math.imul(al5,bh8)|0,mid=mid+Math.imul(ah5,bl8)|0,hi=hi+Math.imul(ah5,bh8)|0,lo=lo+Math.imul(al4,bl9)|0,mid=mid+Math.imul(al4,bh9)|0,mid=mid+Math.imul(ah4,bl9)|0,hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0,w13&=67108863,lo=Math.imul(al9,bl5),mid=Math.imul(al9,bh5),mid=mid+Math.imul(ah9,bl5)|0,hi=Math.imul(ah9,bh5),lo=lo+Math.imul(al8,bl6)|0,mid=mid+Math.imul(al8,bh6)|0,mid=mid+Math.imul(ah8,bl6)|0,hi=hi+Math.imul(ah8,bh6)|0,lo=lo+Math.imul(al7,bl7)|0,mid=mid+Math.imul(al7,bh7)|0,mid=mid+Math.imul(ah7,bl7)|0,hi=hi+Math.imul(ah7,bh7)|0,lo=lo+Math.imul(al6,bl8)|0,mid=mid+Math.imul(al6,bh8)|0,mid=mid+Math.imul(ah6,bl8)|0,hi=hi+Math.imul(ah6,bh8)|0,lo=lo+Math.imul(al5,bl9)|0,mid=mid+Math.imul(al5,bh9)|0,mid=mid+Math.imul(ah5,bl9)|0,hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0,w14&=67108863,lo=Math.imul(al9,bl6),mid=Math.imul(al9,bh6),mid=mid+Math.imul(ah9,bl6)|0,hi=Math.imul(ah9,bh6),lo=lo+Math.imul(al8,bl7)|0,mid=mid+Math.imul(al8,bh7)|0,mid=mid+Math.imul(ah8,bl7)|0,hi=hi+Math.imul(ah8,bh7)|0,lo=lo+Math.imul(al7,bl8)|0,mid=mid+Math.imul(al7,bh8)|0,mid=mid+Math.imul(ah7,bl8)|0,hi=hi+Math.imul(ah7,bh8)|0,lo=lo+Math.imul(al6,bl9)|0,mid=mid+Math.imul(al6,bh9)|0,mid=mid+Math.imul(ah6,bl9)|0,hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0,w15&=67108863,lo=Math.imul(al9,bl7),mid=Math.imul(al9,bh7),mid=mid+Math.imul(ah9,bl7)|0,hi=Math.imul(ah9,bh7),lo=lo+Math.imul(al8,bl8)|0,mid=mid+Math.imul(al8,bh8)|0,mid=mid+Math.imul(ah8,bl8)|0,hi=hi+Math.imul(ah8,bh8)|0,lo=lo+Math.imul(al7,bl9)|0,mid=mid+Math.imul(al7,bh9)|0,mid=mid+Math.imul(ah7,bl9)|0,hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0,w16&=67108863,lo=Math.imul(al9,bl8),mid=Math.imul(al9,bh8),mid=mid+Math.imul(ah9,bl8)|0,hi=Math.imul(ah9,bh8),lo=lo+Math.imul(al8,bl9)|0,mid=mid+Math.imul(al8,bh9)|0,mid=mid+Math.imul(ah8,bl9)|0,hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0,w17&=67108863,lo=Math.imul(al9,bl9),mid=Math.imul(al9,bh9),mid=mid+Math.imul(ah9,bl9)|0,hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&8191)<<13)|0;if(c=(hi+(mid>>>13)|0)+(w18>>>26)|0,w18&=67108863,o[0]=w0,o[1]=w1,o[2]=w2,o[3]=w3,o[4]=w4,o[5]=w5,o[6]=w6,o[7]=w7,o[8]=w8,o[9]=w9,o[10]=w10,o[11]=w11,o[12]=w12,o[13]=w13,o[14]=w14,o[15]=w15,o[16]=w16,o[17]=w17,o[18]=w18,c!==0)o[19]=c,out.length++;return out};if(!Math.imul)comb10MulTo=smallMulTo;function bigMulTo(self2,num,out){out.negative=num.negative^self2.negative,out.length=self2.length+num.length;var carry=0,hncarry=0;for(var k=0;k<out.length-1;k++){var ncarry=hncarry;hncarry=0;var rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j,a=self2.words[i2]|0,b=num.words[j]|0,r=a*b,lo=r&67108863;ncarry=ncarry+(r/67108864|0)|0,lo=lo+rword|0,rword=lo&67108863,ncarry=ncarry+(lo>>>26)|0,hncarry+=ncarry>>>26,ncarry&=67108863}out.words[k]=rword,carry=ncarry,ncarry=hncarry}if(carry!==0)out.words[k]=carry;else out.length--;return out.strip()}function jumboMulTo(self2,num,out){var fftm=new FFTM;return fftm.mulp(self2,num,out)}BN.prototype.mulTo=function(num,out){var res,len2=this.length+num.length;if(this.length===10&&num.length===10)res=comb10MulTo(this,num,out);else if(len2<63)res=smallMulTo(this,num,out);else if(len2<1024)res=bigMulTo(this,num,out);else res=jumboMulTo(this,num,out);return res};function FFTM(x,y){this.x=x,this.y=y}FFTM.prototype.makeRBT=function(N){var t=Array(N),l=BN.prototype._countBits(N)-1;for(var i2=0;i2<N;i2++)t[i2]=this.revBin(i2,l,N);return t},FFTM.prototype.revBin=function(x,l,N){if(x===0||x===N-1)return x;var rb=0;for(var i2=0;i2<l;i2++)rb|=(x&1)<<l-i2-1,x>>=1;return rb},FFTM.prototype.permute=function(rbt,rws,iws,rtws,itws,N){for(var i2=0;i2<N;i2++)rtws[i2]=rws[rbt[i2]],itws[i2]=iws[rbt[i2]]},FFTM.prototype.transform=function(rws,iws,rtws,itws,N,rbt){this.permute(rbt,rws,iws,rtws,itws,N);for(var s=1;s<N;s<<=1){var l=s<<1,rtwdf=Math.cos(2*Math.PI/l),itwdf=Math.sin(2*Math.PI/l);for(var p=0;p<N;p+=l){var rtwdf_=rtwdf,itwdf_=itwdf;for(var j=0;j<s;j++){var re=rtws[p+j],ie=itws[p+j],ro=rtws[p+j+s],io=itws[p+j+s],rx=rtwdf_*ro-itwdf_*io;if(io=rtwdf_*io+itwdf_*ro,ro=rx,rtws[p+j]=re+ro,itws[p+j]=ie+io,rtws[p+j+s]=re-ro,itws[p+j+s]=ie-io,j!==l)rx=rtwdf*rtwdf_-itwdf*itwdf_,itwdf_=rtwdf*itwdf_+itwdf*rtwdf_,rtwdf_=rx}}}},FFTM.prototype.guessLen13b=function(n,m){var N=Math.max(m,n)|1,odd=N&1,i2=0;for(N=N/2|0;N;N=N>>>1)i2++;return 1<<i2+1+odd},FFTM.prototype.conjugate=function(rws,iws,N){if(N<=1)return;for(var i2=0;i2<N/2;i2++){var t=rws[i2];rws[i2]=rws[N-i2-1],rws[N-i2-1]=t,t=iws[i2],iws[i2]=-iws[N-i2-1],iws[N-i2-1]=-t}},FFTM.prototype.normalize13b=function(ws,N){var carry=0;for(var i2=0;i2<N/2;i2++){var w=Math.round(ws[2*i2+1]/N)*8192+Math.round(ws[2*i2]/N)+carry;if(ws[i2]=w&67108863,w<67108864)carry=0;else carry=w/67108864|0}return ws},FFTM.prototype.convert13b=function(ws,len2,rws,N){var carry=0;for(var i2=0;i2<len2;i2++)carry=carry+(ws[i2]|0),rws[2*i2]=carry&8191,carry=carry>>>13,rws[2*i2+1]=carry&8191,carry=carry>>>13;for(i2=2*len2;i2<N;++i2)rws[i2]=0;assert(carry===0),assert((carry&-8192)===0)},FFTM.prototype.stub=function(N){var ph=Array(N);for(var i2=0;i2<N;i2++)ph[i2]=0;return ph},FFTM.prototype.mulp=function(x,y,out){var N=2*this.guessLen13b(x.length,y.length),rbt=this.makeRBT(N),_=this.stub(N),rws=Array(N),rwst=Array(N),iwst=Array(N),nrws=Array(N),nrwst=Array(N),niwst=Array(N),rmws=out.words;rmws.length=N,this.convert13b(x.words,x.length,rws,N),this.convert13b(y.words,y.length,nrws,N),this.transform(rws,_,rwst,iwst,N,rbt),this.transform(nrws,_,nrwst,niwst,N,rbt);for(var i2=0;i2<N;i2++){var rx=rwst[i2]*nrwst[i2]-iwst[i2]*niwst[i2];iwst[i2]=rwst[i2]*niwst[i2]+iwst[i2]*nrwst[i2],rwst[i2]=rx}return this.conjugate(rwst,iwst,N),this.transform(rwst,iwst,rmws,_,N,rbt),this.conjugate(rmws,_,N),this.normalize13b(rmws,N),out.negative=x.negative^y.negative,out.length=x.length+y.length,out.strip()},BN.prototype.mul=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),this.mulTo(num,out)},BN.prototype.mulf=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),jumboMulTo(this,num,out)},BN.prototype.imul=function(num){return this.clone().mulTo(num,this)},BN.prototype.imuln=function(num){assert(typeof num==="number"),assert(num<67108864);var carry=0;for(var i2=0;i2<this.length;i2++){var w=(this.words[i2]|0)*num,lo=(w&67108863)+(carry&67108863);carry>>=26,carry+=w/67108864|0,carry+=lo>>>26,this.words[i2]=lo&67108863}if(carry!==0)this.words[i2]=carry,this.length++;return this.length=num===0?1:this.length,this},BN.prototype.muln=function(num){return this.clone().imuln(num)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.imul(this.clone())},BN.prototype.pow=function(num){var w=toBitArray(num);if(w.length===0)return new BN(1);var res=this;for(var i2=0;i2<w.length;i2++,res=res.sqr())if(w[i2]!==0)break;if(++i2<w.length)for(var q=res.sqr();i2<w.length;i2++,q=q.sqr()){if(w[i2]===0)continue;res=res.mul(q)}return res},BN.prototype.iushln=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26,carryMask=67108863>>>26-r<<26-r,i2;if(r!==0){var carry=0;for(i2=0;i2<this.length;i2++){var newCarry=this.words[i2]&carryMask,c=(this.words[i2]|0)-newCarry<<r;this.words[i2]=c|carry,carry=newCarry>>>26-r}if(carry)this.words[i2]=carry,this.length++}if(s!==0){for(i2=this.length-1;i2>=0;i2--)this.words[i2+s]=this.words[i2];for(i2=0;i2<s;i2++)this.words[i2]=0;this.length+=s}return this.strip()},BN.prototype.ishln=function(bits){return assert(this.negative===0),this.iushln(bits)},BN.prototype.iushrn=function(bits,hint,extended){assert(typeof bits==="number"&&bits>=0);var h;if(hint)h=(hint-hint%26)/26;else h=0;var r=bits%26,s=Math.min((bits-r)/26,this.length),mask=67108863^67108863>>>r<<r,maskedWords=extended;if(h-=s,h=Math.max(0,h),maskedWords){for(var i2=0;i2<s;i2++)maskedWords.words[i2]=this.words[i2];maskedWords.length=s}if(s===0);else if(this.length>s){this.length-=s;for(i2=0;i2<this.length;i2++)this.words[i2]=this.words[i2+s]}else this.words[0]=0,this.length=1;var carry=0;for(i2=this.length-1;i2>=0&&(carry!==0||i2>=h);i2--){var word=this.words[i2]|0;this.words[i2]=carry<<26-r|word>>>r,carry=word&mask}if(maskedWords&&carry!==0)maskedWords.words[maskedWords.length++]=carry;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},BN.prototype.ishrn=function(bits,hint,extended){return assert(this.negative===0),this.iushrn(bits,hint,extended)},BN.prototype.shln=function(bits){return this.clone().ishln(bits)},BN.prototype.ushln=function(bits){return this.clone().iushln(bits)},BN.prototype.shrn=function(bits){return this.clone().ishrn(bits)},BN.prototype.ushrn=function(bits){return this.clone().iushrn(bits)},BN.prototype.testn=function(bit){assert(typeof bit==="number"&&bit>=0);var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return!1;var w=this.words[s];return!!(w&q)},BN.prototype.imaskn=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26;if(assert(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(r!==0)s++;if(this.length=Math.min(s,this.length),r!==0){var mask=67108863^67108863>>>r<<r;this.words[this.length-1]&=mask}return this.strip()},BN.prototype.maskn=function(bits){return this.clone().imaskn(bits)},BN.prototype.iaddn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.isubn(-num);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<num)return this.words[0]=num-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(num),this.negative=1,this}return this._iaddn(num)},BN.prototype._iaddn=function(num){this.words[0]+=num;for(var i2=0;i2<this.length&&this.words[i2]>=67108864;i2++)if(this.words[i2]-=67108864,i2===this.length-1)this.words[i2+1]=1;else this.words[i2+1]++;return this.length=Math.max(this.length,i2+1),this},BN.prototype.isubn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.iaddn(-num);if(this.negative!==0)return this.negative=0,this.iaddn(num),this.negative=1,this;if(this.words[0]-=num,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i2=0;i2<this.length&&this.words[i2]<0;i2++)this.words[i2]+=67108864,this.words[i2+1]-=1;return this.strip()},BN.prototype.addn=function(num){return this.clone().iaddn(num)},BN.prototype.subn=function(num){return this.clone().isubn(num)},BN.prototype.iabs=function(){return this.negative=0,this},BN.prototype.abs=function(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function(num,mul,shift){var len2=num.length+shift,i2;this._expand(len2);var w,carry=0;for(i2=0;i2<num.length;i2++){w=(this.words[i2+shift]|0)+carry;var right=(num.words[i2]|0)*mul;w-=right&67108863,carry=(w>>26)-(right/67108864|0),this.words[i2+shift]=w&67108863}for(;i2<this.length-shift;i2++)w=(this.words[i2+shift]|0)+carry,carry=w>>26,this.words[i2+shift]=w&67108863;if(carry===0)return this.strip();assert(carry===-1),carry=0;for(i2=0;i2<this.length;i2++)w=-(this.words[i2]|0)+carry,carry=w>>26,this.words[i2]=w&67108863;return this.negative=1,this.strip()},BN.prototype._wordDiv=function(num,mode){var shift=this.length-num.length,a=this.clone(),b=num,bhi=b.words[b.length-1]|0,bhiBits=this._countBits(bhi);if(shift=26-bhiBits,shift!==0)b=b.ushln(shift),a.iushln(shift),bhi=b.words[b.length-1]|0;var m=a.length-b.length,q;if(mode!=="mod"){q=new BN(null),q.length=m+1,q.words=Array(q.length);for(var i2=0;i2<q.length;i2++)q.words[i2]=0}var diff=a.clone()._ishlnsubmul(b,1,m);if(diff.negative===0){if(a=diff,q)q.words[m]=1}for(var j=m-1;j>=0;j--){var qj=(a.words[b.length+j]|0)*67108864+(a.words[b.length+j-1]|0);qj=Math.min(qj/bhi|0,67108863),a._ishlnsubmul(b,qj,j);while(a.negative!==0)if(qj--,a.negative=0,a._ishlnsubmul(b,1,j),!a.isZero())a.negative^=1;if(q)q.words[j]=qj}if(q)q.strip();if(a.strip(),mode!=="div"&&shift!==0)a.iushrn(shift);return{div:q||null,mod:a}},BN.prototype.divmod=function(num,mode,positive){if(assert(!num.isZero()),this.isZero())return{div:new BN(0),mod:new BN(0)};var div,mod,res;if(this.negative!==0&&num.negative===0){if(res=this.neg().divmod(num,mode),mode!=="mod")div=res.div.neg();if(mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.iadd(num)}return{div,mod}}if(this.negative===0&&num.negative!==0){if(res=this.divmod(num.neg(),mode),mode!=="mod")div=res.div.neg();return{div,mod:res.mod}}if((this.negative&num.negative)!==0){if(res=this.neg().divmod(num.neg(),mode),mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.isub(num)}return{div:res.div,mod}}if(num.length>this.length||this.cmp(num)<0)return{div:new BN(0),mod:this};if(num.length===1){if(mode==="div")return{div:this.divn(num.words[0]),mod:null};if(mode==="mod")return{div:null,mod:new BN(this.modn(num.words[0]))};return{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}}return this._wordDiv(num,mode)},BN.prototype.div=function(num){return this.divmod(num,"div",!1).div},BN.prototype.mod=function(num){return this.divmod(num,"mod",!1).mod},BN.prototype.umod=function(num){return this.divmod(num,"mod",!0).mod},BN.prototype.divRound=function(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod,half=num.ushrn(1),r2=num.andln(1),cmp=mod.cmp(half);if(cmp<0||r2===1&&cmp===0)return dm.div;return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1)},BN.prototype.modn=function(num){assert(num<=67108863);var p=67108864%num,acc=0;for(var i2=this.length-1;i2>=0;i2--)acc=(p*acc+(this.words[i2]|0))%num;return acc},BN.prototype.idivn=function(num){assert(num<=67108863);var carry=0;for(var i2=this.length-1;i2>=0;i2--){var w=(this.words[i2]|0)+carry*67108864;this.words[i2]=w/num|0,carry=w%num}return this.strip()},BN.prototype.divn=function(num){return this.clone().idivn(num)},BN.prototype.egcd=function(p){assert(p.negative===0),assert(!p.isZero());var x=this,y=p.clone();if(x.negative!==0)x=x.umod(p);else x=x.clone();var A=new BN(1),B=new BN(0),C=new BN(0),D=new BN(1),g=0;while(x.isEven()&&y.isEven())x.iushrn(1),y.iushrn(1),++g;var yp=y.clone(),xp=x.clone();while(!x.isZero()){for(var i2=0,im=1;(x.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){x.iushrn(i2);while(i2-- >0){if(A.isOdd()||B.isOdd())A.iadd(yp),B.isub(xp);A.iushrn(1),B.iushrn(1)}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){y.iushrn(j);while(j-- >0){if(C.isOdd()||D.isOdd())C.iadd(yp),D.isub(xp);C.iushrn(1),D.iushrn(1)}}if(x.cmp(y)>=0)x.isub(y),A.isub(C),B.isub(D);else y.isub(x),C.isub(A),D.isub(B)}return{a:C,b:D,gcd:y.iushln(g)}},BN.prototype._invmp=function(p){assert(p.negative===0),assert(!p.isZero());var a=this,b=p.clone();if(a.negative!==0)a=a.umod(p);else a=a.clone();var x1=new BN(1),x2=new BN(0),delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i2=0,im=1;(a.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){a.iushrn(i2);while(i2-- >0){if(x1.isOdd())x1.iadd(delta);x1.iushrn(1)}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){b.iushrn(j);while(j-- >0){if(x2.isOdd())x2.iadd(delta);x2.iushrn(1)}}if(a.cmp(b)>=0)a.isub(b),x1.isub(x2);else b.isub(a),x2.isub(x1)}var res;if(a.cmpn(1)===0)res=x1;else res=x2;if(res.cmpn(0)<0)res.iadd(p);return res},BN.prototype.gcd=function(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone(),b=num.clone();a.negative=0,b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++)a.iushrn(1),b.iushrn(1);do{while(a.isEven())a.iushrn(1);while(b.isEven())b.iushrn(1);var r=a.cmp(b);if(r<0){var t=a;a=b,b=t}else if(r===0||b.cmpn(1)===0)break;a.isub(b)}while(!0);return b.iushln(shift)},BN.prototype.invm=function(num){return this.egcd(num).a.umod(num)},BN.prototype.isEven=function(){return(this.words[0]&1)===0},BN.prototype.isOdd=function(){return(this.words[0]&1)===1},BN.prototype.andln=function(num){return this.words[0]&num},BN.prototype.bincn=function(bit){assert(typeof bit==="number");var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return this._expand(s+1),this.words[s]|=q,this;var carry=q;for(var i2=s;carry!==0&&i2<this.length;i2++){var w=this.words[i2]|0;w+=carry,carry=w>>>26,w&=67108863,this.words[i2]=w}if(carry!==0)this.words[i2]=carry,this.length++;return this},BN.prototype.isZero=function(){return this.length===1&&this.words[0]===0},BN.prototype.cmpn=function(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this.strip();var res;if(this.length>1)res=1;else{if(negative)num=-num;assert(num<=67108863,"Number is too big");var w=this.words[0]|0;res=w===num?0:w<num?-1:1}if(this.negative!==0)return-res|0;return res},BN.prototype.cmp=function(num){if(this.negative!==0&&num.negative===0)return-1;if(this.negative===0&&num.negative!==0)return 1;var res=this.ucmp(num);if(this.negative!==0)return-res|0;return res},BN.prototype.ucmp=function(num){if(this.length>num.length)return 1;if(this.length<num.length)return-1;var res=0;for(var i2=this.length-1;i2>=0;i2--){var a=this.words[i2]|0,b=num.words[i2]|0;if(a===b)continue;if(a<b)res=-1;else if(a>b)res=1;break}return res},BN.prototype.gtn=function(num){return this.cmpn(num)===1},BN.prototype.gt=function(num){return this.cmp(num)===1},BN.prototype.gten=function(num){return this.cmpn(num)>=0},BN.prototype.gte=function(num){return this.cmp(num)>=0},BN.prototype.ltn=function(num){return this.cmpn(num)===-1},BN.prototype.lt=function(num){return this.cmp(num)===-1},BN.prototype.lten=function(num){return this.cmpn(num)<=0},BN.prototype.lte=function(num){return this.cmp(num)<=0},BN.prototype.eqn=function(num){return this.cmpn(num)===0},BN.prototype.eq=function(num){return this.cmp(num)===0},BN.red=function(num){return new Red(num)},BN.prototype.toRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),assert(this.negative===0,"red works only with positives"),ctx.convertTo(this)._forceRed(ctx)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(ctx){return this.red=ctx,this},BN.prototype.forceRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),this._forceRed(ctx)},BN.prototype.redAdd=function(num){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,num)},BN.prototype.redIAdd=function(num){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,num)},BN.prototype.redSub=function(num){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,num)},BN.prototype.redISub=function(num){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,num)},BN.prototype.redShl=function(num){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,num)},BN.prototype.redMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.mul(this,num)},BN.prototype.redIMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.imul(this,num)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(num){return assert(this.red&&!num.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};function MPrime(name,p){this.name=name,this.p=new BN(p,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}MPrime.prototype._tmp=function(){var tmp=new BN(null);return tmp.words=Array(Math.ceil(this.n/13)),tmp},MPrime.prototype.ireduce=function(num){var r=num,rlen;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),rlen=r.bitLength();while(rlen>this.n);var cmp=rlen<this.n?-1:r.ucmp(this.p);if(cmp===0)r.words[0]=0,r.length=1;else if(cmp>0)r.isub(this.p);else if(r.strip!==void 0)r.strip();else r._strip();return r},MPrime.prototype.split=function(input,out){input.iushrn(this.n,0,out)},MPrime.prototype.imulK=function(num){return num.imul(this.k)};function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}inherits2(K256,MPrime),K256.prototype.split=function(input,output){var mask=4194303,outLen=Math.min(input.length,9);for(var i2=0;i2<outLen;i2++)output.words[i2]=input.words[i2];if(output.length=outLen,input.length<=9){input.words[0]=0,input.length=1;return}var prev=input.words[9];output.words[output.length++]=prev&mask;for(i2=10;i2<input.length;i2++){var next=input.words[i2]|0;input.words[i2-10]=(next&mask)<<4|prev>>>22,prev=next}if(prev>>>=22,input.words[i2-10]=prev,prev===0&&input.length>10)input.length-=10;else input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;var lo=0;for(var i2=0;i2<num.length;i2++){var w=num.words[i2]|0;lo+=w*977,num.words[i2]=lo&67108863,lo=w*64+(lo/67108864|0)}if(num.words[num.length-1]===0){if(num.length--,num.words[num.length-1]===0)num.length--}return num};function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}inherits2(P224,MPrime);function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}inherits2(P192,MPrime);function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}inherits2(P25519,MPrime),P25519.prototype.imulK=function(num){var carry=0;for(var i2=0;i2<num.length;i2++){var hi=(num.words[i2]|0)*19+carry,lo=hi&67108863;hi>>>=26,num.words[i2]=lo,carry=hi}if(carry!==0)num.words[num.length++]=carry;return num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if(name==="k256")prime=new K256;else if(name==="p224")prime=new P224;else if(name==="p192")prime=new P192;else if(name==="p25519")prime=new P25519;else throw Error("Unknown prime "+name);return primes[name]=prime,prime};function Red(m){if(typeof m==="string"){var prime=BN._prime(m);this.m=prime.p,this.prime=prime}else assert(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}Red.prototype._verify1=function(a){assert(a.negative===0,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert((a.negative|b.negative)===0,"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return a.umod(this.m)._forceRed(this)},Red.prototype.neg=function(a){if(a.isZero())return a.clone();return this.m.sub(a)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.ushln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a.clone())},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2===1),mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}var q=this.m.subn(1),s=0;while(!q.isZero()&&q.andln(1)===0)s++,q.iushrn(1);assert(!q.isZero());var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).iushrn(1),z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0)z.redIAdd(nOne);var c=this.pow(z,q),r=this.pow(a,q.addn(1).iushrn(1)),t=this.pow(a,q),m=s;while(t.cmp(one)!==0){var tmp=t;for(var i2=0;tmp.cmp(one)!==0;i2++)tmp=tmp.redSqr();assert(i2<m);var b=this.pow(c,new BN(1).iushln(m-i2-1));r=r.redMul(b),c=b.redSqr(),t=t.redMul(c),m=i2}return r},Red.prototype.invm=function(a){var inv=a._invmp(this.m);if(inv.negative!==0)return inv.negative=0,this.imod(inv).redNeg();else return this.imod(inv)},Red.prototype.pow=function(a,num){if(num.isZero())return new BN(1).toRed(this);if(num.cmpn(1)===0)return a.clone();var windowSize=4,wnd=Array(1<<windowSize);wnd[0]=new BN(1).toRed(this),wnd[1]=a;for(var i2=2;i2<wnd.length;i2++)wnd[i2]=this.mul(wnd[i2-1],a);var res=wnd[0],current=0,currentLen=0,start=num.bitLength()%26;if(start===0)start=26;for(i2=num.length-1;i2>=0;i2--){var word=num.words[i2];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0])res=this.sqr(res);if(bit===0&&current===0){currentLen=0;continue}if(current<<=1,current|=bit,currentLen++,currentLen!==windowSize&&(i2!==0||j!==0))continue;res=this.mul(res,wnd[current]),currentLen=0,current=0}start=26}return res},Red.prototype.convertTo=function(num){var r=num.umod(this.m);return r===num?r.clone():r},Red.prototype.convertFrom=function(num){var res=num.clone();return res.red=null,res},BN.mont=function(num){return new Mont(num)};function Mont(m){if(Red.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}inherits2(Mont,Red),Mont.prototype.convertTo=function(num){return this.imod(num.ushln(this.shift))},Mont.prototype.convertFrom=function(num){var r=this.imod(num.mul(this.rinv));return r.red=null,r},Mont.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var t=a.imul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.invm=function(a){var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this)}})(typeof module>"u"||module,exports)}),require_minimalistic_assert=__commonJS2((exports,module)=>{module.exports=assert;function assert(val,msg){if(!val)throw Error(msg||"Assertion failed")}assert.equal=function(l,r,msg){if(l!=r)throw Error(msg||"Assertion failed: "+l+" != "+r)}}),require_utils=__commonJS2((exports)=>{var utils=exports;function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg!=="string"){for(var i2=0;i2<msg.length;i2++)res[i2]=msg[i2]|0;return res}if(enc==="hex"){if(msg=msg.replace(/[^a-z0-9]+/ig,""),msg.length%2!==0)msg="0"+msg;for(var i2=0;i2<msg.length;i2+=2)res.push(parseInt(msg[i2]+msg[i2+1],16))}else for(var i2=0;i2<msg.length;i2++){var c=msg.charCodeAt(i2),hi=c>>8,lo=c&255;if(hi)res.push(hi,lo);else res.push(lo)}return res}utils.toArray=toArray;function zero2(word){if(word.length===1)return"0"+word;else return word}utils.zero2=zero2;function toHex(msg){var res="";for(var i2=0;i2<msg.length;i2++)res+=zero2(msg[i2].toString(16));return res}utils.toHex=toHex,utils.encode=function(arr,enc){if(enc==="hex")return toHex(arr);else return arr}}),require_utils2=__commonJS2((exports)=>{var utils=exports,BN=require_bn(),minAssert=require_minimalistic_assert(),minUtils=require_utils();utils.assert=minAssert,utils.toArray=minUtils.toArray,utils.zero2=minUtils.zero2,utils.toHex=minUtils.toHex,utils.encode=minUtils.encode;function getNAF(num,w,bits){var naf=Array(Math.max(num.bitLength(),bits)+1),i2;for(i2=0;i2<naf.length;i2+=1)naf[i2]=0;var ws=1<<w+1,k=num.clone();for(i2=0;i2<naf.length;i2++){var z,mod=k.andln(ws-1);if(k.isOdd()){if(mod>(ws>>1)-1)z=(ws>>1)-mod;else z=mod;k.isubn(z)}else z=0;naf[i2]=z,k.iushrn(1)}return naf}utils.getNAF=getNAF;function getJSF(k1,k2){var jsf=[[],[]];k1=k1.clone(),k2=k2.clone();var d1=0,d2=0,m8;while(k1.cmpn(-d1)>0||k2.cmpn(-d2)>0){var m14=k1.andln(3)+d1&3,m24=k2.andln(3)+d2&3;if(m14===3)m14=-1;if(m24===3)m24=-1;var u1;if((m14&1)===0)u1=0;else if(m8=k1.andln(7)+d1&7,(m8===3||m8===5)&&m24===2)u1=-m14;else u1=m14;jsf[0].push(u1);var u2;if((m24&1)===0)u2=0;else if(m8=k2.andln(7)+d2&7,(m8===3||m8===5)&&m14===2)u2=-m24;else u2=m24;if(jsf[1].push(u2),2*d1===u1+1)d1=1-d1;if(2*d2===u2+1)d2=1-d2;k1.iushrn(1),k2.iushrn(1)}return jsf}utils.getJSF=getJSF;function cachedProperty(obj,name,computer){var key="_"+name;obj.prototype[name]=function(){return this[key]!==void 0?this[key]:this[key]=computer.call(this)}}utils.cachedProperty=cachedProperty;function parseBytes(bytes){return typeof bytes==="string"?utils.toArray(bytes,"hex"):bytes}utils.parseBytes=parseBytes;function intFromLE(bytes){return new BN(bytes,"hex","le")}utils.intFromLE=intFromLE}),require_brorand=__commonJS2((exports,module)=>{var r;module.exports=function(len2){if(!r)r=new Rand(null);return r.generate(len2)};function Rand(rand){this.rand=rand}if(module.exports.Rand=Rand,Rand.prototype.generate=function(len2){return this._rand(len2)},Rand.prototype._rand=function(n){if(this.rand.getBytes)return this.rand.getBytes(n);var res=new Uint8Array(n);for(var i2=0;i2<res.length;i2++)res[i2]=this.rand.getByte();return res},typeof self==="object"){if(self.crypto&&self.crypto.getRandomValues)Rand.prototype._rand=function(n){var arr=new Uint8Array(n);return self.crypto.getRandomValues(arr),arr};else if(self.msCrypto&&self.msCrypto.getRandomValues)Rand.prototype._rand=function(n){var arr=new Uint8Array(n);return self.msCrypto.getRandomValues(arr),arr};else if(typeof window==="object")Rand.prototype._rand=function(){throw Error("Not implemented yet")}}else try{if(crypto2=(init_crypto(),__toCommonJS(exports_crypto)),typeof crypto2.randomBytes!=="function")throw Error("Not supported");Rand.prototype._rand=function(n){return crypto2.randomBytes(n)}}catch(e){}var crypto2}),require_base=__commonJS2((exports,module)=>{var BN=require_bn(),utils=require_utils2(),getNAF=utils.getNAF,getJSF=utils.getJSF,assert=utils.assert;function BaseCurve(type,conf){this.type=type,this.p=new BN(conf.p,16),this.red=conf.prime?BN.red(conf.prime):BN.mont(this.p),this.zero=new BN(0).toRed(this.red),this.one=new BN(1).toRed(this.red),this.two=new BN(2).toRed(this.red),this.n=conf.n&&new BN(conf.n,16),this.g=conf.g&&this.pointFromJSON(conf.g,conf.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var adjustCount=this.n&&this.p.div(this.n);if(!adjustCount||adjustCount.cmpn(100)>0)this.redN=null;else this._maxwellTrick=!0,this.redN=this.n.toRed(this.red)}module.exports=BaseCurve,BaseCurve.prototype.point=function(){throw Error("Not implemented")},BaseCurve.prototype.validate=function(){throw Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(p,k){assert(p.precomputed);var doubles=p._getDoubles(),naf=getNAF(k,1,this._bitLength),I=(1<<doubles.step+1)-(doubles.step%2===0?2:1);I/=3;var repr=[],j,nafW;for(j=0;j<naf.length;j+=doubles.step){nafW=0;for(var l=j+doubles.step-1;l>=j;l--)nafW=(nafW<<1)+naf[l];repr.push(nafW)}var a=this.jpoint(null,null,null),b=this.jpoint(null,null,null);for(var i2=I;i2>0;i2--){for(j=0;j<repr.length;j++)if(nafW=repr[j],nafW===i2)b=b.mixedAdd(doubles.points[j]);else if(nafW===-i2)b=b.mixedAdd(doubles.points[j].neg());a=a.add(b)}return a.toP()},BaseCurve.prototype._wnafMul=function(p,k){var w=4,nafPoints=p._getNAFPoints(w);w=nafPoints.wnd;var wnd=nafPoints.points,naf=getNAF(k,w,this._bitLength),acc=this.jpoint(null,null,null);for(var i2=naf.length-1;i2>=0;i2--){for(var l=0;i2>=0&&naf[i2]===0;i2--)l++;if(i2>=0)l++;if(acc=acc.dblp(l),i2<0)break;var z=naf[i2];if(assert(z!==0),p.type==="affine")if(z>0)acc=acc.mixedAdd(wnd[z-1>>1]);else acc=acc.mixedAdd(wnd[-z-1>>1].neg());else if(z>0)acc=acc.add(wnd[z-1>>1]);else acc=acc.add(wnd[-z-1>>1].neg())}return p.type==="affine"?acc.toP():acc},BaseCurve.prototype._wnafMulAdd=function(defW,points,coeffs,len2,jacobianResult){var wndWidth=this._wnafT1,wnd=this._wnafT2,naf=this._wnafT3,max=0,i2,j,p;for(i2=0;i2<len2;i2++){p=points[i2];var nafPoints=p._getNAFPoints(defW);wndWidth[i2]=nafPoints.wnd,wnd[i2]=nafPoints.points}for(i2=len2-1;i2>=1;i2-=2){var a=i2-1,b=i2;if(wndWidth[a]!==1||wndWidth[b]!==1){naf[a]=getNAF(coeffs[a],wndWidth[a],this._bitLength),naf[b]=getNAF(coeffs[b],wndWidth[b],this._bitLength),max=Math.max(naf[a].length,max),max=Math.max(naf[b].length,max);continue}var comb=[points[a],null,null,points[b]];if(points[a].y.cmp(points[b].y)===0)comb[1]=points[a].add(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg());else if(points[a].y.cmp(points[b].y.redNeg())===0)comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].add(points[b].neg());else comb[1]=points[a].toJ().mixedAdd(points[b]),comb[2]=points[a].toJ().mixedAdd(points[b].neg());var index=[-3,-1,-5,-7,0,7,5,1,3],jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max),naf[a]=Array(max),naf[b]=Array(max);for(j=0;j<max;j++){var ja=jsf[0][j]|0,jb=jsf[1][j]|0;naf[a][j]=index[(ja+1)*3+(jb+1)],naf[b][j]=0,wnd[a]=comb}}var acc=this.jpoint(null,null,null),tmp=this._wnafT4;for(i2=max;i2>=0;i2--){var k=0;while(i2>=0){var zero=!0;for(j=0;j<len2;j++)if(tmp[j]=naf[j][i2]|0,tmp[j]!==0)zero=!1;if(!zero)break;k++,i2--}if(i2>=0)k++;if(acc=acc.dblp(k),i2<0)break;for(j=0;j<len2;j++){var z=tmp[j];if(z===0)continue;else if(z>0)p=wnd[j][z-1>>1];else if(z<0)p=wnd[j][-z-1>>1].neg();if(p.type==="affine")acc=acc.mixedAdd(p);else acc=acc.add(p)}}for(i2=0;i2<len2;i2++)wnd[i2]=null;if(jacobianResult)return acc;else return acc.toP()};function BasePoint(curve,type){this.curve=curve,this.type=type,this.precomputed=null}BaseCurve.BasePoint=BasePoint,BasePoint.prototype.eq=function(){throw Error("Not implemented")},BasePoint.prototype.validate=function(){return this.curve.validate(this)},BaseCurve.prototype.decodePoint=function(bytes,enc){bytes=utils.toArray(bytes,enc);var len2=this.p.byteLength();if((bytes[0]===4||bytes[0]===6||bytes[0]===7)&&bytes.length-1===2*len2){if(bytes[0]===6)assert(bytes[bytes.length-1]%2===0);else if(bytes[0]===7)assert(bytes[bytes.length-1]%2===1);var res=this.point(bytes.slice(1,1+len2),bytes.slice(1+len2,1+2*len2));return res}else if((bytes[0]===2||bytes[0]===3)&&bytes.length-1===len2)return this.pointFromX(bytes.slice(1,1+len2),bytes[0]===3);throw Error("Unknown point format")},BasePoint.prototype.encodeCompressed=function(enc){return this.encode(enc,!0)},BasePoint.prototype._encode=function(compact){var len2=this.curve.p.byteLength(),x=this.getX().toArray("be",len2);if(compact)return[this.getY().isEven()?2:3].concat(x);return[4].concat(x,this.getY().toArray("be",len2))},BasePoint.prototype.encode=function(enc,compact){return utils.encode(this._encode(compact),enc)},BasePoint.prototype.precompute=function(power){if(this.precomputed)return this;var precomputed={doubles:null,naf:null,beta:null};return precomputed.naf=this._getNAFPoints(8),precomputed.doubles=this._getDoubles(4,power),precomputed.beta=this._getBeta(),this.precomputed=precomputed,this},BasePoint.prototype._hasDoubles=function(k){if(!this.precomputed)return!1;var doubles=this.precomputed.doubles;if(!doubles)return!1;return doubles.points.length>=Math.ceil((k.bitLength()+1)/doubles.step)},BasePoint.prototype._getDoubles=function(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var doubles=[this],acc=this;for(var i2=0;i2<power;i2+=step){for(var j=0;j<step;j++)acc=acc.dbl();doubles.push(acc)}return{step,points:doubles}},BasePoint.prototype._getNAFPoints=function(wnd){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;var res=[this],max=(1<<wnd)-1,dbl=max===1?null:this.dbl();for(var i2=1;i2<max;i2++)res[i2]=res[i2-1].add(dbl);return{wnd,points:res}},BasePoint.prototype._getBeta=function(){return null},BasePoint.prototype.dblp=function(k){var r=this;for(var i2=0;i2<k;i2++)r=r.dbl();return r}}),require_inherits_browser=__commonJS2((exports,module)=>{if(typeof Object.create==="function")module.exports=function(ctor,superCtor){if(superCtor)ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})};else module.exports=function(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}}}),require_inherits=__commonJS2((exports,module)=>{try{if(util=(init_util(),__toCommonJS(exports_util)),typeof util.inherits!=="function")throw"";module.exports=util.inherits}catch(e){module.exports=require_inherits_browser()}var util}),require_short=__commonJS2((exports,module)=>{var utils=require_utils2(),BN=require_bn(),inherits2=require_inherits(),Base=require_base(),assert=utils.assert;function ShortCurve(conf){Base.call(this,"short",conf),this.a=new BN(conf.a,16).toRed(this.red),this.b=new BN(conf.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(conf),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}inherits2(ShortCurve,Base),module.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(conf){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var beta,lambda;if(conf.beta)beta=new BN(conf.beta,16).toRed(this.red);else{var betas=this._getEndoRoots(this.p);beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1],beta=beta.toRed(this.red)}if(conf.lambda)lambda=new BN(conf.lambda,16);else{var lambdas=this._getEndoRoots(this.n);if(this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))===0)lambda=lambdas[0];else lambda=lambdas[1],assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))===0)}var basis;if(conf.basis)basis=conf.basis.map(function(vec){return{a:new BN(vec.a,16),b:new BN(vec.b,16)}});else basis=this._getEndoBasis(lambda);return{beta,lambda,basis}},ShortCurve.prototype._getEndoRoots=function(num){var red=num===this.p?this.red:BN.mont(num),tinv=new BN(2).toRed(red).redInvm(),ntinv=tinv.redNeg(),s=new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv),l1=ntinv.redAdd(s).fromRed(),l2=ntinv.redSub(s).fromRed();return[l1,l2]},ShortCurve.prototype._getEndoBasis=function(lambda){var aprxSqrt=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=lambda,v=this.n.clone(),x1=new BN(1),y1=new BN(0),x2=new BN(0),y2=new BN(1),a0,b0,a1,b1,a2,b2,prevR,i2=0,r,x;while(u.cmpn(0)!==0){var q=v.div(u);r=v.sub(q.mul(u)),x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0)a0=prevR.neg(),b0=x1,a1=r.neg(),b1=x;else if(a1&&++i2===2)break;prevR=r,v=u,u=r,x2=x1,x1=x,y2=y1,y1=y}a2=r.neg(),b2=x;var len1=a1.sqr().add(b1.sqr()),len2=a2.sqr().add(b2.sqr());if(len2.cmp(len1)>=0)a2=a0,b2=b0;if(a1.negative)a1=a1.neg(),b1=b1.neg();if(a2.negative)a2=a2.neg(),b2=b2.neg();return[{a:a1,b:b1},{a:a2,b:b2}]},ShortCurve.prototype._endoSplit=function(k){var basis=this.endo.basis,v1=basis[0],v2=basis[1],c1=v2.b.mul(k).divRound(this.n),c2=v1.b.neg().mul(k).divRound(this.n),p1=c1.mul(v1.a),p2=c2.mul(v2.a),q1=c1.mul(v1.b),q2=c2.mul(v2.b),k1=k.sub(p1).sub(p2),k2=q1.add(q2).neg();return{k1,k2}},ShortCurve.prototype.pointFromX=function(x,odd){if(x=new BN(x,16),!x.red)x=x.toRed(this.red);var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b),y=y2.redSqrt();if(y.redSqr().redSub(y2).cmp(this.zero)!==0)throw Error("invalid point");var isOdd=y.fromRed().isOdd();if(odd&&!isOdd||!odd&&isOdd)y=y.redNeg();return this.point(x,y)},ShortCurve.prototype.validate=function(point){if(point.inf)return!0;var{x,y}=point,ax=this.a.redMul(x),rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return y.redSqr().redISub(rhs).cmpn(0)===0},ShortCurve.prototype._endoWnafMulAdd=function(points,coeffs,jacobianResult){var npoints=this._endoWnafT1,ncoeffs=this._endoWnafT2;for(var i2=0;i2<points.length;i2++){var split=this._endoSplit(coeffs[i2]),p=points[i2],beta=p._getBeta();if(split.k1.negative)split.k1.ineg(),p=p.neg(!0);if(split.k2.negative)split.k2.ineg(),beta=beta.neg(!0);npoints[i2*2]=p,npoints[i2*2+1]=beta,ncoeffs[i2*2]=split.k1,ncoeffs[i2*2+1]=split.k2}var res=this._wnafMulAdd(1,npoints,ncoeffs,i2*2,jacobianResult);for(var j=0;j<i2*2;j++)npoints[j]=null,ncoeffs[j]=null;return res};function Point(curve,x,y,isRed){if(Base.BasePoint.call(this,curve,"affine"),x===null&&y===null)this.x=null,this.y=null,this.inf=!0;else{if(this.x=new BN(x,16),this.y=new BN(y,16),isRed)this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);this.inf=!1}}inherits2(Point,Base.BasePoint),ShortCurve.prototype.point=function(x,y,isRed){return new Point(this,x,y,isRed)},ShortCurve.prototype.pointFromJSON=function(obj,red){return Point.fromJSON(this,obj,red)},Point.prototype._getBeta=function(){if(!this.curve.endo)return;var pre=this.precomputed;if(pre&&pre.beta)return pre.beta;var beta=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(pre){var curve=this.curve,endoMul=function(p){return curve.point(p.x.redMul(curve.endo.beta),p.y)};pre.beta=beta,beta.precomputed={beta:null,naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(endoMul)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(endoMul)}}}return beta},Point.prototype.toJSON=function(){if(!this.precomputed)return[this.x,this.y];return[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]},Point.fromJSON=function(curve,obj,red){if(typeof obj==="string")obj=JSON.parse(obj);var res=curve.point(obj[0],obj[1],red);if(!obj[2])return res;function obj2point(obj2){return curve.point(obj2[0],obj2[1],red)}var pre=obj[2];return res.precomputed={beta:null,doubles:pre.doubles&&{step:pre.doubles.step,points:[res].concat(pre.doubles.points.map(obj2point))},naf:pre.naf&&{wnd:pre.naf.wnd,points:[res].concat(pre.naf.points.map(obj2point))}},res},Point.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function(){return this.inf},Point.prototype.add=function(p){if(this.inf)return p;if(p.inf)return this;if(this.eq(p))return this.dbl();if(this.neg().eq(p))return this.curve.point(null,null);if(this.x.cmp(p.x)===0)return this.curve.point(null,null);var c=this.y.redSub(p.y);if(c.cmpn(0)!==0)c=c.redMul(this.x.redSub(p.x).redInvm());var nx=c.redSqr().redISub(this.x).redISub(p.x),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.dbl=function(){if(this.inf)return this;var ys1=this.y.redAdd(this.y);if(ys1.cmpn(0)===0)return this.curve.point(null,null);var a=this.curve.a,x2=this.x.redSqr(),dyinv=ys1.redInvm(),c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv),nx=c.redSqr().redISub(this.x.redAdd(this.x)),ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)},Point.prototype.getX=function(){return this.x.fromRed()},Point.prototype.getY=function(){return this.y.fromRed()},Point.prototype.mul=function(k){if(k=new BN(k,16),this.isInfinity())return this;else if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[k]);else return this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p2,k2){var points=[this,p2],coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs);else return this.curve._wnafMulAdd(1,points,coeffs,2)},Point.prototype.jmulAdd=function(k1,p2,k2){var points=[this,p2],coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs,!0);else return this.curve._wnafMulAdd(1,points,coeffs,2,!0)},Point.prototype.eq=function(p){return this===p||this.inf===p.inf&&(this.inf||this.x.cmp(p.x)===0&&this.y.cmp(p.y)===0)},Point.prototype.neg=function(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed,negate=function(p){return p.neg()};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate)}}}return res},Point.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var res=this.curve.jpoint(this.x,this.y,this.curve.one);return res};function JPoint(curve,x,y,z){if(Base.BasePoint.call(this,curve,"jacobian"),x===null&&y===null&&z===null)this.x=this.curve.one,this.y=this.curve.one,this.z=new BN(0);else this.x=new BN(x,16),this.y=new BN(y,16),this.z=new BN(z,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);this.zOne=this.z===this.curve.one}inherits2(JPoint,Base.BasePoint),ShortCurve.prototype.jpoint=function(x,y,z){return new JPoint(this,x,y,z)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm(),zinv2=zinv.redSqr(),ax=this.x.redMul(zinv2),ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(p){if(this.isInfinity())return p;if(p.isInfinity())return this;var pz2=p.z.redSqr(),z2=this.z.redSqr(),u1=this.x.redMul(pz2),u2=p.x.redMul(z2),s1=this.y.redMul(pz2.redMul(p.z)),s2=p.y.redMul(z2.redMul(this.z)),h=u1.redSub(u2),r=s1.redSub(s2);if(h.cmpn(0)===0)if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.mixedAdd=function(p){if(this.isInfinity())return p.toJ();if(p.isInfinity())return this;var z2=this.z.redSqr(),u1=this.x,u2=p.x.redMul(z2),s1=this.y,s2=p.y.redMul(z2).redMul(this.z),h=u1.redSub(u2),r=s1.redSub(s2);if(h.cmpn(0)===0)if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var h2=h.redSqr(),h3=h2.redMul(h),v=u1.redMul(h2),nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v),ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)),nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.dblp=function(pow){if(pow===0)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();var i2;if(this.curve.zeroA||this.curve.threeA){var r=this;for(i2=0;i2<pow;i2++)r=r.dbl();return r}var a=this.curve.a,tinv=this.curve.tinv,jx=this.x,jy=this.y,jz=this.z,jz4=jz.redSqr().redSqr(),jyd=jy.redAdd(jy);for(i2=0;i2<pow;i2++){var jx2=jx.redSqr(),jyd2=jyd.redSqr(),jyd4=jyd2.redSqr(),c=jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)),t1=jx.redMul(jyd2),nx=c.redSqr().redISub(t1.redAdd(t1)),t2=t1.redISub(nx),dny=c.redMul(t2);dny=dny.redIAdd(dny).redISub(jyd4);var nz=jyd.redMul(jz);if(i2+1<pow)jz4=jz4.redMul(jyd4);jx=nx,jz=nz,jyd=dny}return this.curve.jpoint(jx,jyd.redMul(tinv),jz)},JPoint.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.zeroA)return this._zeroDbl();else if(this.curve.threeA)return this._threeDbl();else return this._dbl()},JPoint.prototype._zeroDbl=function(){var nx,ny,nz;if(this.zOne){var xx=this.x.redSqr(),yy=this.y.redSqr(),yyyy=yy.redSqr(),s=this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);s=s.redIAdd(s);var m=xx.redAdd(xx).redIAdd(xx),t=m.redSqr().redISub(s).redISub(s),yyyy8=yyyy.redIAdd(yyyy);yyyy8=yyyy8.redIAdd(yyyy8),yyyy8=yyyy8.redIAdd(yyyy8),nx=t,ny=m.redMul(s.redISub(t)).redISub(yyyy8),nz=this.y.redAdd(this.y)}else{var a=this.x.redSqr(),b=this.y.redSqr(),c=b.redSqr(),d=this.x.redAdd(b).redSqr().redISub(a).redISub(c);d=d.redIAdd(d);var e=a.redAdd(a).redIAdd(a),f=e.redSqr(),c8=c.redIAdd(c);c8=c8.redIAdd(c8),c8=c8.redIAdd(c8),nx=f.redISub(d).redISub(d),ny=e.redMul(d.redISub(nx)).redISub(c8),nz=this.y.redMul(this.z),nz=nz.redIAdd(nz)}return this.curve.jpoint(nx,ny,nz)},JPoint.prototype._threeDbl=function(){var nx,ny,nz;if(this.zOne){var xx=this.x.redSqr(),yy=this.y.redSqr(),yyyy=yy.redSqr(),s=this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);s=s.redIAdd(s);var m=xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a),t=m.redSqr().redISub(s).redISub(s);nx=t;var yyyy8=yyyy.redIAdd(yyyy);yyyy8=yyyy8.redIAdd(yyyy8),yyyy8=yyyy8.redIAdd(yyyy8),ny=m.redMul(s.redISub(t)).redISub(yyyy8),nz=this.y.redAdd(this.y)}else{var delta=this.z.redSqr(),gamma=this.y.redSqr(),beta=this.x.redMul(gamma),alpha=this.x.redSub(delta).redMul(this.x.redAdd(delta));alpha=alpha.redAdd(alpha).redIAdd(alpha);var beta4=beta.redIAdd(beta);beta4=beta4.redIAdd(beta4);var beta8=beta4.redAdd(beta4);nx=alpha.redSqr().redISub(beta8),nz=this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);var ggamma8=gamma.redSqr();ggamma8=ggamma8.redIAdd(ggamma8),ggamma8=ggamma8.redIAdd(ggamma8),ggamma8=ggamma8.redIAdd(ggamma8),ny=alpha.redMul(beta4.redISub(nx)).redISub(ggamma8)}return this.curve.jpoint(nx,ny,nz)},JPoint.prototype._dbl=function(){var a=this.curve.a,jx=this.x,jy=this.y,jz=this.z,jz4=jz.redSqr().redSqr(),jx2=jx.redSqr(),jy2=jy.redSqr(),c=jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)),jxd4=jx.redAdd(jx);jxd4=jxd4.redIAdd(jxd4);var t1=jxd4.redMul(jy2),nx=c.redSqr().redISub(t1.redAdd(t1)),t2=t1.redISub(nx),jyd8=jy2.redSqr();jyd8=jyd8.redIAdd(jyd8),jyd8=jyd8.redIAdd(jyd8),jyd8=jyd8.redIAdd(jyd8);var ny=c.redMul(t2).redISub(jyd8),nz=jy.redAdd(jy).redMul(jz);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var xx=this.x.redSqr(),yy=this.y.redSqr(),zz=this.z.redSqr(),yyyy=yy.redSqr(),m=xx.redAdd(xx).redIAdd(xx),mm=m.redSqr(),e=this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);e=e.redIAdd(e),e=e.redAdd(e).redIAdd(e),e=e.redISub(mm);var ee=e.redSqr(),t=yyyy.redIAdd(yyyy);t=t.redIAdd(t),t=t.redIAdd(t),t=t.redIAdd(t);var u=m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t),yyu4=yy.redMul(u);yyu4=yyu4.redIAdd(yyu4),yyu4=yyu4.redIAdd(yyu4);var nx=this.x.redMul(ee).redISub(yyu4);nx=nx.redIAdd(nx),nx=nx.redIAdd(nx);var ny=this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));ny=ny.redIAdd(ny),ny=ny.redIAdd(ny),ny=ny.redIAdd(ny);var nz=this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);return this.curve.jpoint(nx,ny,nz)},JPoint.prototype.mul=function(k,kbase){return k=new BN(k,kbase),this.curve._wnafMul(this,k)},JPoint.prototype.eq=function(p){if(p.type==="affine")return this.eq(p.toJ());if(this===p)return!0;var z2=this.z.redSqr(),pz2=p.z.redSqr();if(this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0)!==0)return!1;var z3=z2.redMul(this.z),pz3=pz2.redMul(p.z);return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0)===0},JPoint.prototype.eqXToP=function(x){var zs=this.z.redSqr(),rx=x.toRed(this.curve.red).redMul(zs);if(this.x.cmp(rx)===0)return!0;var xc=x.clone(),t=this.curve.redN.redMul(zs);for(;;){if(xc.iadd(this.curve.n),xc.cmp(this.curve.p)>=0)return!1;if(rx.redIAdd(t),this.x.cmp(rx)===0)return!0}},JPoint.prototype.inspect=function(){if(this.isInfinity())return"<EC JPoint Infinity>";return"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),require_mont=__commonJS2((exports,module)=>{var BN=require_bn(),inherits2=require_inherits(),Base=require_base(),utils=require_utils2();function MontCurve(conf){Base.call(this,"mont",conf),this.a=new BN(conf.a,16).toRed(this.red),this.b=new BN(conf.b,16).toRed(this.red),this.i4=new BN(4).toRed(this.red).redInvm(),this.two=new BN(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits2(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.validate=function(point){var x=point.normalize().x,x2=x.redSqr(),rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x),y=rhs.redSqrt();return y.redSqr().cmp(rhs)===0};function Point(curve,x,z){if(Base.BasePoint.call(this,curve,"projective"),x===null&&z===null)this.x=this.curve.one,this.z=this.curve.zero;else{if(this.x=new BN(x,16),this.z=new BN(z,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red)}}inherits2(Point,Base.BasePoint),MontCurve.prototype.decodePoint=function(bytes,enc){return this.point(utils.toArray(bytes,enc),1)},MontCurve.prototype.point=function(x,z){return new Point(this,x,z)},MontCurve.prototype.pointFromJSON=function(obj){return Point.fromJSON(this,obj)},Point.prototype.precompute=function(){},Point.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point.fromJSON=function(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one)},Point.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Point.prototype.dbl=function(){var a=this.x.redAdd(this.z),aa=a.redSqr(),b=this.x.redSub(this.z),bb=b.redSqr(),c=aa.redSub(bb),nx=aa.redMul(bb),nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz)},Point.prototype.add=function(){throw Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(p,diff){var a=this.x.redAdd(this.z),b=this.x.redSub(this.z),c=p.x.redAdd(p.z),d=p.x.redSub(p.z),da=d.redMul(a),cb=c.redMul(b),nx=diff.z.redMul(da.redAdd(cb).redSqr()),nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz)},Point.prototype.mul=function(k){var t=k.clone(),a=this,b=this.curve.point(null,null),c=this;for(var bits=[];t.cmpn(0)!==0;t.iushrn(1))bits.push(t.andln(1));for(var i2=bits.length-1;i2>=0;i2--)if(bits[i2]===0)a=a.diffAdd(b,c),b=b.dbl();else b=a.diffAdd(b,c),a=a.dbl();return b},Point.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},Point.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},Point.prototype.eq=function(other){return this.getX().cmp(other.getX())===0},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),require_edwards=__commonJS2((exports,module)=>{var utils=require_utils2(),BN=require_bn(),inherits2=require_inherits(),Base=require_base(),assert=utils.assert;function EdwardsCurve(conf){this.twisted=(conf.a|0)!==1,this.mOneA=this.twisted&&(conf.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",conf),this.a=new BN(conf.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN(conf.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN(conf.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(conf.c|0)===1}inherits2(EdwardsCurve,Base),module.exports=EdwardsCurve,EdwardsCurve.prototype._mulA=function(num){if(this.mOneA)return num.redNeg();else return this.a.redMul(num)},EdwardsCurve.prototype._mulC=function(num){if(this.oneC)return num;else return this.c.redMul(num)},EdwardsCurve.prototype.jpoint=function(x,y,z,t){return this.point(x,y,z,t)},EdwardsCurve.prototype.pointFromX=function(x,odd){if(x=new BN(x,16),!x.red)x=x.toRed(this.red);var x2=x.redSqr(),rhs=this.c2.redSub(this.a.redMul(x2)),lhs=this.one.redSub(this.c2.redMul(this.d).redMul(x2)),y2=rhs.redMul(lhs.redInvm()),y=y2.redSqrt();if(y.redSqr().redSub(y2).cmp(this.zero)!==0)throw Error("invalid point");var isOdd=y.fromRed().isOdd();if(odd&&!isOdd||!odd&&isOdd)y=y.redNeg();return this.point(x,y)},EdwardsCurve.prototype.pointFromY=function(y,odd){if(y=new BN(y,16),!y.red)y=y.toRed(this.red);var y2=y.redSqr(),lhs=y2.redSub(this.c2),rhs=y2.redMul(this.d).redMul(this.c2).redSub(this.a),x2=lhs.redMul(rhs.redInvm());if(x2.cmp(this.zero)===0)if(odd)throw Error("invalid point");else return this.point(this.zero,y);var x=x2.redSqrt();if(x.redSqr().redSub(x2).cmp(this.zero)!==0)throw Error("invalid point");if(x.fromRed().isOdd()!==odd)x=x.redNeg();return this.point(x,y)},EdwardsCurve.prototype.validate=function(point){if(point.isInfinity())return!0;point.normalize();var x2=point.x.redSqr(),y2=point.y.redSqr(),lhs=x2.redMul(this.a).redAdd(y2),rhs=this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));return lhs.cmp(rhs)===0};function Point(curve,x,y,z,t){if(Base.BasePoint.call(this,curve,"projective"),x===null&&y===null&&z===null)this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0;else{if(this.x=new BN(x,16),this.y=new BN(y,16),this.z=z?new BN(z,16):this.curve.one,this.t=t&&new BN(t,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);if(this.t&&!this.t.red)this.t=this.t.toRed(this.curve.red);if(this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t){if(this.t=this.x.redMul(this.y),!this.zOne)this.t=this.t.redMul(this.z.redInvm())}}}inherits2(Point,Base.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(obj){return Point.fromJSON(this,obj)},EdwardsCurve.prototype.point=function(x,y,z,t){return new Point(this,x,y,z,t)},Point.fromJSON=function(curve,obj){return new Point(curve,obj[0],obj[1],obj[2])},Point.prototype.inspect=function(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Point.prototype._extDbl=function(){var a=this.x.redSqr(),b=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a),e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b),g=d.redAdd(b),f=g.redSub(c),h=d.redSub(b),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projDbl=function(){var b=this.x.redAdd(this.y).redSqr(),c=this.x.redSqr(),d=this.y.redSqr(),nx,ny,nz,e,h,j;if(this.curve.twisted){e=this.curve._mulA(c);var f=e.redAdd(d);if(this.zOne)nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)),ny=f.redMul(e.redSub(d)),nz=f.redSqr().redSub(f).redSub(f);else h=this.z.redSqr(),j=f.redSub(h).redISub(h),nx=b.redSub(c).redISub(d).redMul(j),ny=f.redMul(e.redSub(d)),nz=f.redMul(j)}else e=c.redAdd(d),h=this.curve._mulC(this.z).redSqr(),j=e.redSub(h).redSub(h),nx=this.curve._mulC(b.redISub(e)).redMul(j),ny=this.curve._mulC(e).redMul(c.redISub(d)),nz=e.redMul(j);return this.curve.point(nx,ny,nz)},Point.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()},Point.prototype._extAdd=function(p){var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x)),b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)),c=this.t.redMul(this.curve.dd).redMul(p.t),d=this.z.redMul(p.z.redAdd(p.z)),e=b.redSub(a),f=d.redSub(c),g=d.redAdd(c),h=b.redAdd(a),nx=e.redMul(f),ny=g.redMul(h),nt=e.redMul(h),nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)},Point.prototype._projAdd=function(p){var a=this.z.redMul(p.z),b=a.redSqr(),c=this.x.redMul(p.x),d=this.y.redMul(p.y),e=this.curve.d.redMul(c).redMul(d),f=b.redSub(e),g=b.redAdd(e),tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d),nx=a.redMul(f).redMul(tmp),ny,nz;if(this.curve.twisted)ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c))),nz=f.redMul(g);else ny=a.redMul(g).redMul(d.redSub(c)),nz=this.curve._mulC(f).redMul(g);return this.curve.point(nx,ny,nz)},Point.prototype.add=function(p){if(this.isInfinity())return p;if(p.isInfinity())return this;if(this.curve.extended)return this._extAdd(p);else return this._projAdd(p)},Point.prototype.mul=function(k){if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else return this.curve._wnafMul(this,k)},Point.prototype.mulAdd=function(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,!1)},Point.prototype.jmulAdd=function(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,!0)},Point.prototype.normalize=function(){if(this.zOne)return this;var zi=this.z.redInvm();if(this.x=this.x.redMul(zi),this.y=this.y.redMul(zi),this.t)this.t=this.t.redMul(zi);return this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(other){return this===other||this.getX().cmp(other.getX())===0&&this.getY().cmp(other.getY())===0},Point.prototype.eqXToP=function(x){var rx=x.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(rx)===0)return!0;var xc=x.clone(),t=this.curve.redN.redMul(this.z);for(;;){if(xc.iadd(this.curve.n),xc.cmp(this.curve.p)>=0)return!1;if(rx.redIAdd(t),this.x.cmp(rx)===0)return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add}),require_curve=__commonJS2((exports)=>{var curve=exports;curve.base=require_base(),curve.short=require_short(),curve.mont=require_mont(),curve.edwards=require_edwards()}),require_utils3=__commonJS2((exports)=>{var assert=require_minimalistic_assert(),inherits2=require_inherits();exports.inherits=inherits2;function isSurrogatePair(msg,i2){if((msg.charCodeAt(i2)&64512)!==55296)return!1;if(i2<0||i2+1>=msg.length)return!1;return(msg.charCodeAt(i2+1)&64512)===56320}function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg==="string"){if(!enc){var p=0;for(var i2=0;i2<msg.length;i2++){var c=msg.charCodeAt(i2);if(c<128)res[p++]=c;else if(c<2048)res[p++]=c>>6|192,res[p++]=c&63|128;else if(isSurrogatePair(msg,i2))c=65536+((c&1023)<<10)+(msg.charCodeAt(++i2)&1023),res[p++]=c>>18|240,res[p++]=c>>12&63|128,res[p++]=c>>6&63|128,res[p++]=c&63|128;else res[p++]=c>>12|224,res[p++]=c>>6&63|128,res[p++]=c&63|128}}else if(enc==="hex"){if(msg=msg.replace(/[^a-z0-9]+/ig,""),msg.length%2!==0)msg="0"+msg;for(i2=0;i2<msg.length;i2+=2)res.push(parseInt(msg[i2]+msg[i2+1],16))}}else for(i2=0;i2<msg.length;i2++)res[i2]=msg[i2]|0;return res}exports.toArray=toArray;function toHex(msg){var res="";for(var i2=0;i2<msg.length;i2++)res+=zero2(msg[i2].toString(16));return res}exports.toHex=toHex;function htonl(w){var res=w>>>24|w>>>8&65280|w<<8&16711680|(w&255)<<24;return res>>>0}exports.htonl=htonl;function toHex32(msg,endian){var res="";for(var i2=0;i2<msg.length;i2++){var w=msg[i2];if(endian==="little")w=htonl(w);res+=zero8(w.toString(16))}return res}exports.toHex32=toHex32;function zero2(word){if(word.length===1)return"0"+word;else return word}exports.zero2=zero2;function zero8(word){if(word.length===7)return"0"+word;else if(word.length===6)return"00"+word;else if(word.length===5)return"000"+word;else if(word.length===4)return"0000"+word;else if(word.length===3)return"00000"+word;else if(word.length===2)return"000000"+word;else if(word.length===1)return"0000000"+word;else return word}exports.zero8=zero8;function join32(msg,start,end,endian){var len2=end-start;assert(len2%4===0);var res=Array(len2/4);for(var i2=0,k=start;i2<res.length;i2++,k+=4){var w;if(endian==="big")w=msg[k]<<24|msg[k+1]<<16|msg[k+2]<<8|msg[k+3];else w=msg[k+3]<<24|msg[k+2]<<16|msg[k+1]<<8|msg[k];res[i2]=w>>>0}return res}exports.join32=join32;function split32(msg,endian){var res=Array(msg.length*4);for(var i2=0,k=0;i2<msg.length;i2++,k+=4){var m=msg[i2];if(endian==="big")res[k]=m>>>24,res[k+1]=m>>>16&255,res[k+2]=m>>>8&255,res[k+3]=m&255;else res[k+3]=m>>>24,res[k+2]=m>>>16&255,res[k+1]=m>>>8&255,res[k]=m&255}return res}exports.split32=split32;function rotr32(w,b){return w>>>b|w<<32-b}exports.rotr32=rotr32;function rotl32(w,b){return w<<b|w>>>32-b}exports.rotl32=rotl32;function sum32(a,b){return a+b>>>0}exports.sum32=sum32;function sum32_3(a,b,c){return a+b+c>>>0}exports.sum32_3=sum32_3;function sum32_4(a,b,c,d){return a+b+c+d>>>0}exports.sum32_4=sum32_4;function sum32_5(a,b,c,d,e){return a+b+c+d+e>>>0}exports.sum32_5=sum32_5;function sum64(buf,pos,ah,al){var bh=buf[pos],bl=buf[pos+1],lo=al+bl>>>0,hi=(lo<al?1:0)+ah+bh;buf[pos]=hi>>>0,buf[pos+1]=lo}exports.sum64=sum64;function sum64_hi(ah,al,bh,bl){var lo=al+bl>>>0,hi=(lo<al?1:0)+ah+bh;return hi>>>0}exports.sum64_hi=sum64_hi;function sum64_lo(ah,al,bh,bl){var lo=al+bl;return lo>>>0}exports.sum64_lo=sum64_lo;function sum64_4_hi(ah,al,bh,bl,ch,cl,dh,dl){var carry=0,lo=al;lo=lo+bl>>>0,carry+=lo<al?1:0,lo=lo+cl>>>0,carry+=lo<cl?1:0,lo=lo+dl>>>0,carry+=lo<dl?1:0;var hi=ah+bh+ch+dh+carry;return hi>>>0}exports.sum64_4_hi=sum64_4_hi;function sum64_4_lo(ah,al,bh,bl,ch,cl,dh,dl){var lo=al+bl+cl+dl;return lo>>>0}exports.sum64_4_lo=sum64_4_lo;function sum64_5_hi(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var carry=0,lo=al;lo=lo+bl>>>0,carry+=lo<al?1:0,lo=lo+cl>>>0,carry+=lo<cl?1:0,lo=lo+dl>>>0,carry+=lo<dl?1:0,lo=lo+el>>>0,carry+=lo<el?1:0;var hi=ah+bh+ch+dh+eh+carry;return hi>>>0}exports.sum64_5_hi=sum64_5_hi;function sum64_5_lo(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var lo=al+bl+cl+dl+el;return lo>>>0}exports.sum64_5_lo=sum64_5_lo;function rotr64_hi(ah,al,num){var r=al<<32-num|ah>>>num;return r>>>0}exports.rotr64_hi=rotr64_hi;function rotr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.rotr64_lo=rotr64_lo;function shr64_hi(ah,al,num){return ah>>>num}exports.shr64_hi=shr64_hi;function shr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.shr64_lo=shr64_lo}),require_common=__commonJS2((exports)=>{var utils=require_utils3(),assert=require_minimalistic_assert();function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}exports.BlockHash=BlockHash,BlockHash.prototype.update=function(msg,enc){if(msg=utils.toArray(msg,enc),!this.pending)this.pending=msg;else this.pending=this.pending.concat(msg);if(this.pendingTotal+=msg.length,this.pending.length>=this._delta8){msg=this.pending;var r=msg.length%this._delta8;if(this.pending=msg.slice(msg.length-r,msg.length),this.pending.length===0)this.pending=null;msg=utils.join32(msg,0,msg.length-r,this.endian);for(var i2=0;i2<msg.length;i2+=this._delta32)this._update(msg,i2,i2+this._delta32)}return this},BlockHash.prototype.digest=function(enc){return this.update(this._pad()),assert(this.pending===null),this._digest(enc)},BlockHash.prototype._pad=function(){var len2=this.pendingTotal,bytes=this._delta8,k=bytes-(len2+this.padLength)%bytes,res=Array(k+this.padLength);res[0]=128;for(var i2=1;i2<k;i2++)res[i2]=0;if(len2<<=3,this.endian==="big"){for(var t=8;t<this.padLength;t++)res[i2++]=0;res[i2++]=0,res[i2++]=0,res[i2++]=0,res[i2++]=0,res[i2++]=len2>>>24&255,res[i2++]=len2>>>16&255,res[i2++]=len2>>>8&255,res[i2++]=len2&255}else{res[i2++]=len2&255,res[i2++]=len2>>>8&255,res[i2++]=len2>>>16&255,res[i2++]=len2>>>24&255,res[i2++]=0,res[i2++]=0,res[i2++]=0,res[i2++]=0;for(t=8;t<this.padLength;t++)res[i2++]=0}return res}}),require_common2=__commonJS2((exports)=>{var utils=require_utils3(),rotr32=utils.rotr32;function ft_1(s,x,y,z){if(s===0)return ch32(x,y,z);if(s===1||s===3)return p32(x,y,z);if(s===2)return maj32(x,y,z)}exports.ft_1=ft_1;function ch32(x,y,z){return x&y^~x&z}exports.ch32=ch32;function maj32(x,y,z){return x&y^x&z^y&z}exports.maj32=maj32;function p32(x,y,z){return x^y^z}exports.p32=p32;function s0_256(x){return rotr32(x,2)^rotr32(x,13)^rotr32(x,22)}exports.s0_256=s0_256;function s1_256(x){return rotr32(x,6)^rotr32(x,11)^rotr32(x,25)}exports.s1_256=s1_256;function g0_256(x){return rotr32(x,7)^rotr32(x,18)^x>>>3}exports.g0_256=g0_256;function g1_256(x){return rotr32(x,17)^rotr32(x,19)^x>>>10}exports.g1_256=g1_256}),require_1=__commonJS2((exports,module)=>{var utils=require_utils3(),common=require_common(),shaCommon=require_common2(),rotl32=utils.rotl32,sum32=utils.sum32,sum32_5=utils.sum32_5,ft_1=shaCommon.ft_1,BlockHash=common.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}utils.inherits(SHA1,BlockHash),module.exports=SHA1,SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.padLength=64,SHA1.prototype._update=function(msg,start){var W=this.W;for(var i2=0;i2<16;i2++)W[i2]=msg[start+i2];for(;i2<W.length;i2++)W[i2]=rotl32(W[i2-3]^W[i2-8]^W[i2-14]^W[i2-16],1);var a=this.h[0],b=this.h[1],c=this.h[2],d=this.h[3],e=this.h[4];for(i2=0;i2<W.length;i2++){var s=~~(i2/20),t=sum32_5(rotl32(a,5),ft_1(s,b,c,d),e,W[i2],sha1_K[s]);e=d,d=c,c=rotl32(b,30),b=a,a=t}this.h[0]=sum32(this.h[0],a),this.h[1]=sum32(this.h[1],b),this.h[2]=sum32(this.h[2],c),this.h[3]=sum32(this.h[3],d),this.h[4]=sum32(this.h[4],e)},SHA1.prototype._digest=function(enc){if(enc==="hex")return utils.toHex32(this.h,"big");else return utils.split32(this.h,"big")}}),require_256=__commonJS2((exports,module)=>{var utils=require_utils3(),common=require_common(),shaCommon=require_common2(),assert=require_minimalistic_assert(),sum32=utils.sum32,sum32_4=utils.sum32_4,sum32_5=utils.sum32_5,ch32=shaCommon.ch32,maj32=shaCommon.maj32,s0_256=shaCommon.s0_256,s1_256=shaCommon.s1_256,g0_256=shaCommon.g0_256,g1_256=shaCommon.g1_256,BlockHash=common.BlockHash,sha256_K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256(){if(!(this instanceof SHA256))return new SHA256;BlockHash.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sha256_K,this.W=Array(64)}utils.inherits(SHA256,BlockHash),module.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function(msg,start){var W=this.W;for(var i2=0;i2<16;i2++)W[i2]=msg[start+i2];for(;i2<W.length;i2++)W[i2]=sum32_4(g1_256(W[i2-2]),W[i2-7],g0_256(W[i2-15]),W[i2-16]);var a=this.h[0],b=this.h[1],c=this.h[2],d=this.h[3],e=this.h[4],f=this.h[5],g=this.h[6],h=this.h[7];assert(this.k.length===W.length);for(i2=0;i2<W.length;i2++){var T1=sum32_5(h,s1_256(e),ch32(e,f,g),this.k[i2],W[i2]),T2=sum32(s0_256(a),maj32(a,b,c));h=g,g=f,f=e,e=sum32(d,T1),d=c,c=b,b=a,a=sum32(T1,T2)}this.h[0]=sum32(this.h[0],a),this.h[1]=sum32(this.h[1],b),this.h[2]=sum32(this.h[2],c),this.h[3]=sum32(this.h[3],d),this.h[4]=sum32(this.h[4],e),this.h[5]=sum32(this.h[5],f),this.h[6]=sum32(this.h[6],g),this.h[7]=sum32(this.h[7],h)},SHA256.prototype._digest=function(enc){if(enc==="hex")return utils.toHex32(this.h,"big");else return utils.split32(this.h,"big")}}),require_224=__commonJS2((exports,module)=>{var utils=require_utils3(),SHA256=require_256();function SHA224(){if(!(this instanceof SHA224))return new SHA224;SHA256.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils.inherits(SHA224,SHA256),module.exports=SHA224,SHA224.blockSize=512,SHA224.outSize=224,SHA224.hmacStrength=192,SHA224.padLength=64,SHA224.prototype._digest=function(enc){if(enc==="hex")return utils.toHex32(this.h.slice(0,7),"big");else return utils.split32(this.h.slice(0,7),"big")}}),require_512=__commonJS2((exports,module)=>{var utils=require_utils3(),common=require_common(),assert=require_minimalistic_assert(),rotr64_hi=utils.rotr64_hi,rotr64_lo=utils.rotr64_lo,shr64_hi=utils.shr64_hi,shr64_lo=utils.shr64_lo,sum64=utils.sum64,sum64_hi=utils.sum64_hi,sum64_lo=utils.sum64_lo,sum64_4_hi=utils.sum64_4_hi,sum64_4_lo=utils.sum64_4_lo,sum64_5_hi=utils.sum64_5_hi,sum64_5_lo=utils.sum64_5_lo,BlockHash=common.BlockHash,sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512(){if(!(this instanceof SHA512))return new SHA512;BlockHash.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=sha512_K,this.W=Array(160)}utils.inherits(SHA512,BlockHash),module.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function(msg,start){var W=this.W;for(var i2=0;i2<32;i2++)W[i2]=msg[start+i2];for(;i2<W.length;i2+=2){var c0_hi=g1_512_hi(W[i2-4],W[i2-3]),c0_lo=g1_512_lo(W[i2-4],W[i2-3]),c1_hi=W[i2-14],c1_lo=W[i2-13],c2_hi=g0_512_hi(W[i2-30],W[i2-29]),c2_lo=g0_512_lo(W[i2-30],W[i2-29]),c3_hi=W[i2-32],c3_lo=W[i2-31];W[i2]=sum64_4_hi(c0_hi,c0_lo,c1_hi,c1_lo,c2_hi,c2_lo,c3_hi,c3_lo),W[i2+1]=sum64_4_lo(c0_hi,c0_lo,c1_hi,c1_lo,c2_hi,c2_lo,c3_hi,c3_lo)}},SHA512.prototype._update=function(msg,start){this._prepareBlock(msg,start);var W=this.W,ah=this.h[0],al=this.h[1],bh=this.h[2],bl=this.h[3],ch=this.h[4],cl=this.h[5],dh=this.h[6],dl=this.h[7],eh=this.h[8],el=this.h[9],fh=this.h[10],fl=this.h[11],gh=this.h[12],gl=this.h[13],hh=this.h[14],hl=this.h[15];assert(this.k.length===W.length);for(var i2=0;i2<W.length;i2+=2){var c0_hi=hh,c0_lo=hl,c1_hi=s1_512_hi(eh,el),c1_lo=s1_512_lo(eh,el),c2_hi=ch64_hi(eh,el,fh,fl,gh,gl),c2_lo=ch64_lo(eh,el,fh,fl,gh,gl),c3_hi=this.k[i2],c3_lo=this.k[i2+1],c4_hi=W[i2],c4_lo=W[i2+1],T1_hi=sum64_5_hi(c0_hi,c0_lo,c1_hi,c1_lo,c2_hi,c2_lo,c3_hi,c3_lo,c4_hi,c4_lo),T1_lo=sum64_5_lo(c0_hi,c0_lo,c1_hi,c1_lo,c2_hi,c2_lo,c3_hi,c3_lo,c4_hi,c4_lo);c0_hi=s0_512_hi(ah,al),c0_lo=s0_512_lo(ah,al),c1_hi=maj64_hi(ah,al,bh,bl,ch,cl),c1_lo=maj64_lo(ah,al,bh,bl,ch,cl);var T2_hi=sum64_hi(c0_hi,c0_lo,c1_hi,c1_lo),T2_lo=sum64_lo(c0_hi,c0_lo,c1_hi,c1_lo);hh=gh,hl=gl,gh=fh,gl=fl,fh=eh,fl=el,eh=sum64_hi(dh,dl,T1_hi,T1_lo),el=sum64_lo(dl,dl,T1_hi,T1_lo),dh=ch,dl=cl,ch=bh,cl=bl,bh=ah,bl=al,ah=sum64_hi(T1_hi,T1_lo,T2_hi,T2_lo),al=sum64_lo(T1_hi,T1_lo,T2_hi,T2_lo)}sum64(this.h,0,ah,al),sum64(this.h,2,bh,bl),sum64(this.h,4,ch,cl),sum64(this.h,6,dh,dl),sum64(this.h,8,eh,el),sum64(this.h,10,fh,fl),sum64(this.h,12,gh,gl),sum64(this.h,14,hh,hl)},SHA512.prototype._digest=function(enc){if(enc==="hex")return utils.toHex32(this.h,"big");else return utils.split32(this.h,"big")};function ch64_hi(xh,xl,yh,yl,zh){var r=xh&yh^~xh&zh;if(r<0)r+=4294967296;return r}function ch64_lo(xh,xl,yh,yl,zh,zl){var r=xl&yl^~xl&zl;if(r<0)r+=4294967296;return r}function maj64_hi(xh,xl,yh,yl,zh){var r=xh&yh^xh&zh^yh&zh;if(r<0)r+=4294967296;return r}function maj64_lo(xh,xl,yh,yl,zh,zl){var r=xl&yl^xl&zl^yl&zl;if(r<0)r+=4294967296;return r}function s0_512_hi(xh,xl){var c0_hi=rotr64_hi(xh,xl,28),c1_hi=rotr64_hi(xl,xh,2),c2_hi=rotr64_hi(xl,xh,7),r=c0_hi^c1_hi^c2_hi;if(r<0)r+=4294967296;return r}function s0_512_lo(xh,xl){var c0_lo=rotr64_lo(xh,xl,28),c1_lo=rotr64_lo(xl,xh,2),c2_lo=rotr64_lo(xl,xh,7),r=c0_lo^c1_lo^c2_lo;if(r<0)r+=4294967296;return r}function s1_512_hi(xh,xl){var c0_hi=rotr64_hi(xh,xl,14),c1_hi=rotr64_hi(xh,xl,18),c2_hi=rotr64_hi(xl,xh,9),r=c0_hi^c1_hi^c2_hi;if(r<0)r+=4294967296;return r}function s1_512_lo(xh,xl){var c0_lo=rotr64_lo(xh,xl,14),c1_lo=rotr64_lo(xh,xl,18),c2_lo=rotr64_lo(xl,xh,9),r=c0_lo^c1_lo^c2_lo;if(r<0)r+=4294967296;return r}function g0_512_hi(xh,xl){var c0_hi=rotr64_hi(xh,xl,1),c1_hi=rotr64_hi(xh,xl,8),c2_hi=shr64_hi(xh,xl,7),r=c0_hi^c1_hi^c2_hi;if(r<0)r+=4294967296;return r}function g0_512_lo(xh,xl){var c0_lo=rotr64_lo(xh,xl,1),c1_lo=rotr64_lo(xh,xl,8),c2_lo=shr64_lo(xh,xl,7),r=c0_lo^c1_lo^c2_lo;if(r<0)r+=4294967296;return r}function g1_512_hi(xh,xl){var c0_hi=rotr64_hi(xh,xl,19),c1_hi=rotr64_hi(xl,xh,29),c2_hi=shr64_hi(xh,xl,6),r=c0_hi^c1_hi^c2_hi;if(r<0)r+=4294967296;return r}function g1_512_lo(xh,xl){var c0_lo=rotr64_lo(xh,xl,19),c1_lo=rotr64_lo(xl,xh,29),c2_lo=shr64_lo(xh,xl,6),r=c0_lo^c1_lo^c2_lo;if(r<0)r+=4294967296;return r}}),require_384=__commonJS2((exports,module)=>{var utils=require_utils3(),SHA512=require_512();function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils.inherits(SHA384,SHA512),module.exports=SHA384,SHA384.blockSize=1024,SHA384.outSize=384,SHA384.hmacStrength=192,SHA384.padLength=128,SHA384.prototype._digest=function(enc){if(enc==="hex")return utils.toHex32(this.h.slice(0,12),"big");else return utils.split32(this.h.slice(0,12),"big")}}),require_sha=__commonJS2((exports)=>{exports.sha1=require_1(),exports.sha224=require_224(),exports.sha256=require_256(),exports.sha384=require_384(),exports.sha512=require_512()}),require_ripemd=__commonJS2((exports)=>{var utils=require_utils3(),common=require_common(),rotl32=utils.rotl32,sum32=utils.sum32,sum32_3=utils.sum32_3,sum32_4=utils.sum32_4,BlockHash=common.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}utils.inherits(RIPEMD160,BlockHash),exports.ripemd160=RIPEMD160,RIPEMD160.blockSize=512,RIPEMD160.outSize=160,RIPEMD160.hmacStrength=192,RIPEMD160.padLength=64,RIPEMD160.prototype._update=function(msg,start){var A=this.h[0],B=this.h[1],C=this.h[2],D=this.h[3],E2=this.h[4],Ah=A,Bh=B,Ch=C,Dh=D,Eh=E2;for(var j=0;j<80;j++){var T=sum32(rotl32(sum32_4(A,f(j,B,C,D),msg[r[j]+start],K(j)),s[j]),E2);A=E2,E2=D,D=rotl32(C,10),C=B,B=T,T=sum32(rotl32(sum32_4(Ah,f(79-j,Bh,Ch,Dh),msg[rh[j]+start],Kh(j)),sh[j]),Eh),Ah=Eh,Eh=Dh,Dh=rotl32(Ch,10),Ch=Bh,Bh=T}T=sum32_3(this.h[1],C,Dh),this.h[1]=sum32_3(this.h[2],D,Eh),this.h[2]=sum32_3(this.h[3],E2,Ah),this.h[3]=sum32_3(this.h[4],A,Bh),this.h[4]=sum32_3(this.h[0],B,Ch),this.h[0]=T},RIPEMD160.prototype._digest=function(enc){if(enc==="hex")return utils.toHex32(this.h,"little");else return utils.split32(this.h,"little")};function f(j,x,y,z){if(j<=15)return x^y^z;else if(j<=31)return x&y|~x&z;else if(j<=47)return(x|~y)^z;else if(j<=63)return x&z|y&~z;else return x^(y|~z)}function K(j){if(j<=15)return 0;else if(j<=31)return 1518500249;else if(j<=47)return 1859775393;else if(j<=63)return 2400959708;else return 2840853838}function Kh(j){if(j<=15)return 1352829926;else if(j<=31)return 1548603684;else if(j<=47)return 1836072691;else if(j<=63)return 2053994217;else return 0}var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),require_hmac=__commonJS2((exports,module)=>{var utils=require_utils3(),assert=require_minimalistic_assert();function Hmac(hash,key,enc){if(!(this instanceof Hmac))return new Hmac(hash,key,enc);this.Hash=hash,this.blockSize=hash.blockSize/8,this.outSize=hash.outSize/8,this.inner=null,this.outer=null,this._init(utils.toArray(key,enc))}module.exports=Hmac,Hmac.prototype._init=function(key){if(key.length>this.blockSize)key=new this.Hash().update(key).digest();assert(key.length<=this.blockSize);for(var i2=key.length;i2<this.blockSize;i2++)key.push(0);for(i2=0;i2<key.length;i2++)key[i2]^=54;this.inner=new this.Hash().update(key);for(i2=0;i2<key.length;i2++)key[i2]^=106;this.outer=new this.Hash().update(key)},Hmac.prototype.update=function(msg,enc){return this.inner.update(msg,enc),this},Hmac.prototype.digest=function(enc){return this.outer.update(this.inner.digest()),this.outer.digest(enc)}}),require_hash=__commonJS2((exports)=>{var hash=exports;hash.utils=require_utils3(),hash.common=require_common(),hash.sha=require_sha(),hash.ripemd=require_ripemd(),hash.hmac=require_hmac(),hash.sha1=hash.sha.sha1,hash.sha256=hash.sha.sha256,hash.sha224=hash.sha.sha224,hash.sha384=hash.sha.sha384,hash.sha512=hash.sha.sha512,hash.ripemd160=hash.ripemd.ripemd160}),require_secp256k1=__commonJS2((exports,module)=>{module.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}}),require_curves=__commonJS2((exports)=>{var curves=exports,hash=require_hash(),curve=require_curve(),utils=require_utils2(),assert=utils.assert;function PresetCurve(options){if(options.type==="short")this.curve=new curve.short(options);else if(options.type==="edwards")this.curve=new curve.edwards(options);else this.curve=new curve.mont(options);this.g=this.curve.g,this.n=this.curve.n,this.hash=options.hash,assert(this.g.validate(),"Invalid curve"),assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}curves.PresetCurve=PresetCurve;function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,get:function(){var curve2=new PresetCurve(options);return Object.defineProperty(curves,name,{configurable:!0,enumerable:!0,value:curve2}),curve2}})}defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var pre;try{pre=require_secp256k1()}catch(e){pre=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]})}),require_hmac_drbg=__commonJS2((exports,module)=>{var hash=require_hash(),utils=require_utils(),assert=require_minimalistic_assert();function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash,this.predResist=!!options.predResist,this.outLen=this.hash.outSize,this.minEntropy=options.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc||"hex"),nonce=utils.toArray(options.nonce,options.nonceEnc||"hex"),pers=utils.toArray(options.pers,options.persEnc||"hex");assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(entropy,nonce,pers)}module.exports=HmacDRBG,HmacDRBG.prototype._init=function(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var i2=0;i2<this.V.length;i2++)this.K[i2]=0,this.V[i2]=1;this._update(seed),this._reseed=1,this.reseedInterval=281474976710656},HmacDRBG.prototype._hmac=function(){return new hash.hmac(this.hash,this.K)},HmacDRBG.prototype._update=function(seed){var kmac=this._hmac().update(this.V).update([0]);if(seed)kmac=kmac.update(seed);if(this.K=kmac.digest(),this.V=this._hmac().update(this.V).digest(),!seed)return;this.K=this._hmac().update(this.V).update([1]).update(seed).digest(),this.V=this._hmac().update(this.V).digest()},HmacDRBG.prototype.reseed=function(entropy,entropyEnc,add,addEnc){if(typeof entropyEnc!=="string")addEnc=add,add=entropyEnc,entropyEnc=null;entropy=utils.toArray(entropy,entropyEnc),add=utils.toArray(add,addEnc),assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(entropy.concat(add||[])),this._reseed=1},HmacDRBG.prototype.generate=function(len2,enc,add,addEnc){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");if(typeof enc!=="string")addEnc=add,add=enc,enc=null;if(add)add=utils.toArray(add,addEnc||"hex"),this._update(add);var temp=[];while(temp.length<len2)this.V=this._hmac().update(this.V).digest(),temp=temp.concat(this.V);var res=temp.slice(0,len2);return this._update(add),this._reseed++,utils.encode(res,enc)}}),require_key=__commonJS2((exports,module)=>{var BN=require_bn(),utils=require_utils2(),assert=utils.assert;function KeyPair(ec,options){if(this.ec=ec,this.priv=null,this.pub=null,options.priv)this._importPrivate(options.priv,options.privEnc);if(options.pub)this._importPublic(options.pub,options.pubEnc)}module.exports=KeyPair,KeyPair.fromPublic=function(ec,pub,enc){if(pub instanceof KeyPair)return pub;return new KeyPair(ec,{pub,pubEnc:enc})},KeyPair.fromPrivate=function(ec,priv,enc){if(priv instanceof KeyPair)return priv;return new KeyPair(ec,{priv,privEnc:enc})},KeyPair.prototype.validate=function(){var pub=this.getPublic();if(pub.isInfinity())return{result:!1,reason:"Invalid public key"};if(!pub.validate())return{result:!1,reason:"Public key is not a point"};if(!pub.mul(this.ec.curve.n).isInfinity())return{result:!1,reason:"Public key * N != O"};return{result:!0,reason:null}},KeyPair.prototype.getPublic=function(compact,enc){if(typeof compact==="string")enc=compact,compact=null;if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!enc)return this.pub;return this.pub.encode(enc,compact)},KeyPair.prototype.getPrivate=function(enc){if(enc==="hex")return this.priv.toString(16,2);else return this.priv},KeyPair.prototype._importPrivate=function(key,enc){this.priv=new BN(key,enc||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(key,enc){if(key.x||key.y){if(this.ec.curve.type==="mont")assert(key.x,"Need x coordinate");else if(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")assert(key.x&&key.y,"Need both x and y coordinate");this.pub=this.ec.curve.point(key.x,key.y);return}this.pub=this.ec.curve.decodePoint(key,enc)},KeyPair.prototype.derive=function(pub){if(!pub.validate())assert(pub.validate(),"public point not validated");return pub.mul(this.priv).getX()},KeyPair.prototype.sign=function(msg,enc,options){return this.ec.sign(msg,this,enc,options)},KeyPair.prototype.verify=function(msg,signature,options){return this.ec.verify(msg,signature,this,void 0,options)},KeyPair.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}}),require_signature=__commonJS2((exports,module)=>{var BN=require_bn(),utils=require_utils2(),assert=utils.assert;function Signature(options,enc){if(options instanceof Signature)return options;if(this._importDER(options,enc))return;if(assert(options.r&&options.s,"Signature without r or s"),this.r=new BN(options.r,16),this.s=new BN(options.s,16),options.recoveryParam===void 0)this.recoveryParam=null;else this.recoveryParam=options.recoveryParam}module.exports=Signature;function Position(){this.place=0}function getLength(buf,p){var initial=buf[p.place++];if(!(initial&128))return initial;var octetLen=initial&15;if(octetLen===0||octetLen>4)return!1;if(buf[p.place]===0)return!1;var val=0;for(var i2=0,off=p.place;i2<octetLen;i2++,off++)val<<=8,val|=buf[off],val>>>=0;if(val<=127)return!1;return p.place=off,val}function rmPadding(buf){var i2=0,len2=buf.length-1;while(!buf[i2]&&!(buf[i2+1]&128)&&i2<len2)i2++;if(i2===0)return buf;return buf.slice(i2)}Signature.prototype._importDER=function(data,enc){data=utils.toArray(data,enc);var p=new Position;if(data[p.place++]!==48)return!1;var len2=getLength(data,p);if(len2===!1)return!1;if(len2+p.place!==data.length)return!1;if(data[p.place++]!==2)return!1;var rlen=getLength(data,p);if(rlen===!1)return!1;if((data[p.place]&128)!==0)return!1;var r=data.slice(p.place,rlen+p.place);if(p.place+=rlen,data[p.place++]!==2)return!1;var slen=getLength(data,p);if(slen===!1)return!1;if(data.length!==slen+p.place)return!1;if((data[p.place]&128)!==0)return!1;var s=data.slice(p.place,slen+p.place);if(r[0]===0)if(r[1]&128)r=r.slice(1);else return!1;if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;return this.r=new BN(r),this.s=new BN(s),this.recoveryParam=null,!0};function constructLength(arr,len2){if(len2<128){arr.push(len2);return}var octets=1+(Math.log(len2)/Math.LN2>>>3);arr.push(octets|128);while(--octets)arr.push(len2>>>(octets<<3)&255);arr.push(len2)}Signature.prototype.toDER=function(enc){var r=this.r.toArray(),s=this.s.toArray();if(r[0]&128)r=[0].concat(r);if(s[0]&128)s=[0].concat(s);r=rmPadding(r),s=rmPadding(s);while(!s[0]&&!(s[1]&128))s=s.slice(1);var arr=[2];constructLength(arr,r.length),arr=arr.concat(r),arr.push(2),constructLength(arr,s.length);var backHalf=arr.concat(s),res=[48];return constructLength(res,backHalf.length),res=res.concat(backHalf),utils.encode(res,enc)}}),require_ec=__commonJS2((exports,module)=>{var BN=require_bn(),HmacDRBG=require_hmac_drbg(),utils=require_utils2(),curves=require_curves(),rand=require_brorand(),assert=utils.assert,KeyPair=require_key(),Signature=require_signature();function EC(options){if(!(this instanceof EC))return new EC(options);if(typeof options==="string")assert(Object.prototype.hasOwnProperty.call(curves,options),"Unknown curve "+options),options=curves[options];if(options instanceof curves.PresetCurve)options={curve:options};this.curve=options.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=options.curve.g,this.g.precompute(options.curve.n.bitLength()+1),this.hash=options.hash||options.curve.hash}module.exports=EC,EC.prototype.keyPair=function(options){return new KeyPair(this,options)},EC.prototype.keyFromPrivate=function(priv,enc){return KeyPair.fromPrivate(this,priv,enc)},EC.prototype.keyFromPublic=function(pub,enc){return KeyPair.fromPublic(this,pub,enc)},EC.prototype.genKeyPair=function(options){if(!options)options={};var drbg=new HmacDRBG({hash:this.hash,pers:options.pers,persEnc:options.persEnc||"utf8",entropy:options.entropy||rand(this.hash.hmacStrength),entropyEnc:options.entropy&&options.entropyEnc||"utf8",nonce:this.n.toArray()}),bytes=this.n.byteLength(),ns2=this.n.sub(new BN(2));for(;;){var priv=new BN(drbg.generate(bytes));if(priv.cmp(ns2)>0)continue;return priv.iaddn(1),this.keyFromPrivate(priv)}},EC.prototype._truncateToN=function(msg,truncOnly,bitLength){var byteLength2;if(BN.isBN(msg)||typeof msg==="number")msg=new BN(msg,16),byteLength2=msg.byteLength();else if(typeof msg==="object")byteLength2=msg.length,msg=new BN(msg,16);else{var str=msg.toString();byteLength2=str.length+1>>>1,msg=new BN(str,16)}if(typeof bitLength!=="number")bitLength=byteLength2*8;var delta=bitLength-this.n.bitLength();if(delta>0)msg=msg.ushrn(delta);if(!truncOnly&&msg.cmp(this.n)>=0)return msg.sub(this.n);else return msg},EC.prototype.sign=function(msg,key,enc,options){if(typeof enc==="object")options=enc,enc=null;if(!options)options={};if(typeof msg!=="string"&&typeof msg!=="number"&&!BN.isBN(msg)){assert(typeof msg==="object"&&msg&&typeof msg.length==="number","Expected message to be an array-like, a hex string, or a BN instance"),assert(msg.length>>>0===msg.length);for(var i2=0;i2<msg.length;i2++)assert((msg[i2]&255)===msg[i2])}key=this.keyFromPrivate(key,enc),msg=this._truncateToN(msg,!1,options.msgBitLength),assert(!msg.isNeg(),"Can not sign a negative message");var bytes=this.n.byteLength(),bkey=key.getPrivate().toArray("be",bytes),nonce=msg.toArray("be",bytes);assert(new BN(nonce).eq(msg),"Can not sign message");var drbg=new HmacDRBG({hash:this.hash,entropy:bkey,nonce,pers:options.pers,persEnc:options.persEnc||"utf8"}),ns1=this.n.sub(new BN(1));for(var iter=0;;iter++){var k=options.k?options.k(iter):new BN(drbg.generate(this.n.byteLength()));if(k=this._truncateToN(k,!0),k.cmpn(1)<=0||k.cmp(ns1)>=0)continue;var kp=this.g.mul(k);if(kp.isInfinity())continue;var kpX=kp.getX(),r=kpX.umod(this.n);if(r.cmpn(0)===0)continue;var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));if(s=s.umod(this.n),s.cmpn(0)===0)continue;var recoveryParam=(kp.getY().isOdd()?1:0)|(kpX.cmp(r)!==0?2:0);if(options.canonical&&s.cmp(this.nh)>0)s=this.n.sub(s),recoveryParam^=1;return new Signature({r,s,recoveryParam})}},EC.prototype.verify=function(msg,signature,key,enc,options){if(!options)options={};msg=this._truncateToN(msg,!1,options.msgBitLength),key=this.keyFromPublic(key,enc),signature=new Signature(signature,"hex");var{r,s}=signature;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var sinv=s.invm(this.n),u1=sinv.mul(msg).umod(this.n),u2=sinv.mul(r).umod(this.n),p;if(!this.curve._maxwellTrick){if(p=this.g.mulAdd(u1,key.getPublic(),u2),p.isInfinity())return!1;return p.getX().umod(this.n).cmp(r)===0}if(p=this.g.jmulAdd(u1,key.getPublic(),u2),p.isInfinity())return!1;return p.eqXToP(r)},EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,"The recovery param is more than two bits"),signature=new Signature(signature,enc);var n=this.n,e=new BN(msg),r=signature.r,s=signature.s,isYOdd=j&1,isSecondKey=j>>1;if(r.cmp(this.curve.p.umod(this.curve.n))>=0&&isSecondKey)throw Error("Unable to find sencond key candinate");if(isSecondKey)r=this.curve.pointFromX(r.add(this.curve.n),isYOdd);else r=this.curve.pointFromX(r,isYOdd);var rInv=signature.r.invm(n),s1=n.sub(e).mul(rInv).umod(n),s2=s.mul(rInv).umod(n);return this.g.mulAdd(s1,r,s2)},EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){if(signature=new Signature(signature,enc),signature.recoveryParam!==null)return signature.recoveryParam;for(var i2=0;i2<4;i2++){var Qprime;try{Qprime=this.recoverPubKey(e,signature,i2)}catch(e2){continue}if(Qprime.eq(Q))return i2}throw Error("Unable to find valid recovery factor")}}),require_key2=__commonJS2((exports,module)=>{var utils=require_utils2(),assert=utils.assert,parseBytes=utils.parseBytes,cachedProperty=utils.cachedProperty;function KeyPair(eddsa,params){if(this.eddsa=eddsa,this._secret=parseBytes(params.secret),eddsa.isPoint(params.pub))this._pub=params.pub;else this._pubBytes=parseBytes(params.pub)}KeyPair.fromPublic=function(eddsa,pub){if(pub instanceof KeyPair)return pub;return new KeyPair(eddsa,{pub})},KeyPair.fromSecret=function(eddsa,secret){if(secret instanceof KeyPair)return secret;return new KeyPair(eddsa,{secret})},KeyPair.prototype.secret=function(){return this._secret},cachedProperty(KeyPair,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),cachedProperty(KeyPair,"pub",function(){if(this._pubBytes)return this.eddsa.decodePoint(this._pubBytes);return this.eddsa.g.mul(this.priv())}),cachedProperty(KeyPair,"privBytes",function(){var eddsa=this.eddsa,hash=this.hash(),lastIx=eddsa.encodingLength-1,a=hash.slice(0,eddsa.encodingLength);return a[0]&=248,a[lastIx]&=127,a[lastIx]|=64,a}),cachedProperty(KeyPair,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),cachedProperty(KeyPair,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),cachedProperty(KeyPair,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),KeyPair.prototype.sign=function(message){return assert(this._secret,"KeyPair can only verify"),this.eddsa.sign(message,this)},KeyPair.prototype.verify=function(message,sig){return this.eddsa.verify(message,sig,this)},KeyPair.prototype.getSecret=function(enc){return assert(this._secret,"KeyPair is public only"),utils.encode(this.secret(),enc)},KeyPair.prototype.getPublic=function(enc){return utils.encode(this.pubBytes(),enc)},module.exports=KeyPair}),require_signature2=__commonJS2((exports,module)=>{var BN=require_bn(),utils=require_utils2(),assert=utils.assert,cachedProperty=utils.cachedProperty,parseBytes=utils.parseBytes;function Signature(eddsa,sig){if(this.eddsa=eddsa,typeof sig!=="object")sig=parseBytes(sig);if(Array.isArray(sig))assert(sig.length===eddsa.encodingLength*2,"Signature has invalid size"),sig={R:sig.slice(0,eddsa.encodingLength),S:sig.slice(eddsa.encodingLength)};if(assert(sig.R&&sig.S,"Signature without R or S"),eddsa.isPoint(sig.R))this._R=sig.R;if(sig.S instanceof BN)this._S=sig.S;this._Rencoded=Array.isArray(sig.R)?sig.R:sig.Rencoded,this._Sencoded=Array.isArray(sig.S)?sig.S:sig.Sencoded}cachedProperty(Signature,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),cachedProperty(Signature,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),cachedProperty(Signature,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),cachedProperty(Signature,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Signature.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Signature.prototype.toHex=function(){return utils.encode(this.toBytes(),"hex").toUpperCase()},module.exports=Signature}),require_eddsa=__commonJS2((exports,module)=>{var hash=require_hash(),curves=require_curves(),utils=require_utils2(),assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=require_key2(),Signature=require_signature2();function EDDSA(curve){if(assert(curve==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(curve);curve=curves[curve].curve,this.curve=curve,this.g=curve.g,this.g.precompute(curve.n.bitLength()+1),this.pointClass=curve.point().constructor,this.encodingLength=Math.ceil(curve.n.bitLength()/8),this.hash=hash.sha512}module.exports=EDDSA,EDDSA.prototype.sign=function(message,secret){message=parseBytes(message);var key=this.keyFromSecret(secret),r=this.hashInt(key.messagePrefix(),message),R=this.g.mul(r),Rencoded=this.encodePoint(R),s_=this.hashInt(Rencoded,key.pubBytes(),message).mul(key.priv()),S=r.add(s_).umod(this.curve.n);return this.makeSignature({R,S,Rencoded})},EDDSA.prototype.verify=function(message,sig,pub){if(message=parseBytes(message),sig=this.makeSignature(sig),sig.S().gte(sig.eddsa.curve.n)||sig.S().isNeg())return!1;var key=this.keyFromPublic(pub),h=this.hashInt(sig.Rencoded(),key.pubBytes(),message),SG=this.g.mul(sig.S()),RplusAh=sig.R().add(key.pub().mul(h));return RplusAh.eq(SG)},EDDSA.prototype.hashInt=function(){var hash2=this.hash();for(var i2=0;i2<arguments.length;i2++)hash2.update(arguments[i2]);return utils.intFromLE(hash2.digest()).umod(this.curve.n)},EDDSA.prototype.keyFromPublic=function(pub){return KeyPair.fromPublic(this,pub)},EDDSA.prototype.keyFromSecret=function(secret){return KeyPair.fromSecret(this,secret)},EDDSA.prototype.makeSignature=function(sig){if(sig instanceof Signature)return sig;return new Signature(this,sig)},EDDSA.prototype.encodePoint=function(point){var enc=point.getY().toArray("le",this.encodingLength);return enc[this.encodingLength-1]|=point.getX().isOdd()?128:0,enc},EDDSA.prototype.decodePoint=function(bytes){bytes=utils.parseBytes(bytes);var lastIx=bytes.length-1,normed=bytes.slice(0,lastIx).concat(bytes[lastIx]&-129),xIsOdd=(bytes[lastIx]&128)!==0,y=utils.intFromLE(normed);return this.curve.pointFromY(y,xIsOdd)},EDDSA.prototype.encodeInt=function(num){return num.toArray("le",this.encodingLength)},EDDSA.prototype.decodeInt=function(bytes){return utils.intFromLE(bytes)},EDDSA.prototype.isPoint=function(val){return val instanceof this.pointClass}}),require_elliptic=__commonJS2((exports)=>{var elliptic=exports;elliptic.version=require_package().version,elliptic.utils=require_utils2(),elliptic.rand=require_brorand(),elliptic.curve=require_curve(),elliptic.curves=require_curves(),elliptic.ec=require_ec(),elliptic.eddsa=require_eddsa()}),require_bn2=__commonJS2((exports,module)=>{(function(module2,exports2){function assert(val,msg){if(!val)throw Error(msg||"Assertion failed")}function inherits2(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}function BN(number,base,endian){if(BN.isBN(number))return number;if(this.negative=0,this.words=null,this.length=0,this.red=null,number!==null){if(base==="le"||base==="be")endian=base,base=10;this._init(number||0,base||10,endian||"be")}}if(typeof module2==="object")module2.exports=BN;else exports2.BN=BN;BN.BN=BN,BN.wordSize=26;var Buffer22;try{if(typeof window<"u"&&typeof window.Buffer<"u")Buffer22=window.Buffer;else Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer}catch(e){}BN.isBN=function(num){if(num instanceof BN)return!0;return num!==null&&typeof num==="object"&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)},BN.max=function(left,right){if(left.cmp(right)>0)return left;return right},BN.min=function(left,right){if(left.cmp(right)<0)return left;return right},BN.prototype._init=function(number,base,endian){if(typeof number==="number")return this._initNumber(number,base,endian);if(typeof number==="object")return this._initArray(number,base,endian);if(base==="hex")base=16;assert(base===(base|0)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,"");var start=0;if(number[0]==="-")start++,this.negative=1;if(start<number.length){if(base===16)this._parseHex(number,start,endian);else if(this._parseBase(number,base,start),endian==="le")this._initArray(this.toArray(),base,endian)}},BN.prototype._initNumber=function(number,base,endian){if(number<0)this.negative=1,number=-number;if(number<67108864)this.words=[number&67108863],this.length=1;else if(number<4503599627370496)this.words=[number&67108863,number/67108864&67108863],this.length=2;else assert(number<9007199254740992),this.words=[number&67108863,number/67108864&67108863,1],this.length=3;if(endian!=="le")return;this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert(typeof number.length==="number"),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var j,w,off=0;if(endian==="be"){for(i2=number.length-1,j=0;i2>=0;i2-=3)if(w=number[i2]|number[i2-1]<<8|number[i2-2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}else if(endian==="le"){for(i2=0,j=0;i2<number.length;i2+=3)if(w=number[i2]|number[i2+1]<<8|number[i2+2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}return this.strip()};function parseHex4Bits(string,index){var c=string.charCodeAt(index);if(c>=65&&c<=70)return c-55;else if(c>=97&&c<=102)return c-87;else return c-48&15}function parseHexByte(string,lowerBound,index){var r=parseHex4Bits(string,index);if(index-1>=lowerBound)r|=parseHex4Bits(string,index-1)<<4;return r}BN.prototype._parseHex=function(number,start,endian){this.length=Math.ceil((number.length-start)/6),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var off=0,j=0,w;if(endian==="be")for(i2=number.length-1;i2>=start;i2-=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8;else{var parseLength=number.length-start;for(i2=parseLength%2===0?start+1:start;i2<number.length;i2+=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8}this.strip()};function parseBase(str,start,end,mul){var r=0,len2=Math.min(str.length,end);for(var i2=start;i2<len2;i2++){var c=str.charCodeAt(i2)-48;if(r*=mul,c>=49)r+=c-49+10;else if(c>=17)r+=c-17+10;else r+=c}return r}BN.prototype._parseBase=function(number,base,start){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;var total=number.length-start,mod=total%limbLen,end=Math.min(total,total-mod)+start,word=0;for(var i2=start;i2<end;i2+=limbLen)if(word=parseBase(number,i2,i2+limbLen,base),this.imuln(limbPow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word);if(mod!==0){var pow=1;word=parseBase(number,i2,number.length,base);for(i2=0;i2<mod;i2++)pow*=base;if(this.imuln(pow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word)}this.strip()},BN.prototype.copy=function(dest){dest.words=Array(this.length);for(var i2=0;i2<this.length;i2++)dest.words[i2]=this.words[i2];dest.length=this.length,dest.negative=this.negative,dest.red=this.red},BN.prototype.clone=function(){var r=new BN(null);return this.copy(r),r},BN.prototype._expand=function(size){while(this.length<size)this.words[this.length++]=0;return this},BN.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},BN.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},BN.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var zeros=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(BN.prototype.toString=function(base,padding){base=base||10,padding=padding|0||1;var out;if(base===16||base==="hex"){out="";var off=0,carry=0;for(var i2=0;i2<this.length;i2++){var w=this.words[i2],word=((w<<off|carry)&16777215).toString(16);if(carry=w>>>24-off&16777215,off+=2,off>=26)off-=26,i2--;if(carry!==0||i2!==this.length-1)out=zeros[6-word.length]+word+out;else out=word+out}if(carry!==0)out=carry.toString(16)+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base];out="";var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modn(groupBase).toString(base);if(c=c.idivn(groupBase),!c.isZero())out=zeros[groupSize-r.length]+r+out;else out=r+out}if(this.isZero())out="0"+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function(){var ret=this.words[0];if(this.length===2)ret+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)ret+=4503599627370496+this.words[1]*67108864;else if(this.length>2)assert(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-ret:ret},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toBuffer=function(endian,length){return assert(typeof Buffer22<"u"),this.toArrayLike(Buffer22,endian,length)},BN.prototype.toArray=function(endian,length){return this.toArrayLike(Array,endian,length)},BN.prototype.toArrayLike=function(ArrayType,endian,length){var byteLength2=this.byteLength(),reqLength=length||Math.max(1,byteLength2);assert(byteLength2<=reqLength,"byte array longer than desired length"),assert(reqLength>0,"Requested array length <= 0"),this.strip();var littleEndian=endian==="le",res=new ArrayType(reqLength),b,i2,q=this.clone();if(!littleEndian){for(i2=0;i2<reqLength-byteLength2;i2++)res[i2]=0;for(i2=0;!q.isZero();i2++)b=q.andln(255),q.iushrn(8),res[reqLength-i2-1]=b}else{for(i2=0;!q.isZero();i2++)b=q.andln(255),q.iushrn(8),res[i2]=b;for(;i2<reqLength;i2++)res[i2]=0}return res},Math.clz32)BN.prototype._countBits=function(w){return 32-Math.clz32(w)};else BN.prototype._countBits=function(w){var t=w,r=0;if(t>=4096)r+=13,t>>>=13;if(t>=64)r+=7,t>>>=7;if(t>=8)r+=4,t>>>=4;if(t>=2)r+=2,t>>>=2;return r+t};BN.prototype._zeroBits=function(w){if(w===0)return 26;var t=w,r=0;if((t&8191)===0)r+=13,t>>>=13;if((t&127)===0)r+=7,t>>>=7;if((t&15)===0)r+=4,t>>>=4;if((t&3)===0)r+=2,t>>>=2;if((t&1)===0)r++;return r},BN.prototype.bitLength=function(){var w=this.words[this.length-1],hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){var w=Array(num.bitLength());for(var bit=0;bit<w.length;bit++){var off=bit/26|0,wbit=bit%26;w[bit]=(num.words[off]&1<<wbit)>>>wbit}return w}BN.prototype.zeroBits=function(){if(this.isZero())return 0;var r=0;for(var i2=0;i2<this.length;i2++){var b=this._zeroBits(this.words[i2]);if(r+=b,b!==26)break}return r},BN.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function(width){if(this.negative!==0)return this.abs().inotn(width).iaddn(1);return this.clone()},BN.prototype.fromTwos=function(width){if(this.testn(width-1))return this.notn(width).iaddn(1).ineg();return this.clone()},BN.prototype.isNeg=function(){return this.negative!==0},BN.prototype.neg=function(){return this.clone().ineg()},BN.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},BN.prototype.iuor=function(num){while(this.length<num.length)this.words[this.length++]=0;for(var i2=0;i2<num.length;i2++)this.words[i2]=this.words[i2]|num.words[i2];return this.strip()},BN.prototype.ior=function(num){return assert((this.negative|num.negative)===0),this.iuor(num)},BN.prototype.or=function(num){if(this.length>num.length)return this.clone().ior(num);return num.clone().ior(this)},BN.prototype.uor=function(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this)},BN.prototype.iuand=function(num){var b;if(this.length>num.length)b=num;else b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=this.words[i2]&num.words[i2];return this.length=b.length,this.strip()},BN.prototype.iand=function(num){return assert((this.negative|num.negative)===0),this.iuand(num)},BN.prototype.and=function(num){if(this.length>num.length)return this.clone().iand(num);return num.clone().iand(this)},BN.prototype.uand=function(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this)},BN.prototype.iuxor=function(num){var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=a.words[i2]^b.words[i2];if(this!==a)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this.length=a.length,this.strip()},BN.prototype.ixor=function(num){return assert((this.negative|num.negative)===0),this.iuxor(num)},BN.prototype.xor=function(num){if(this.length>num.length)return this.clone().ixor(num);return num.clone().ixor(this)},BN.prototype.uxor=function(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this)},BN.prototype.inotn=function(width){assert(typeof width==="number"&&width>=0);var bytesNeeded=Math.ceil(width/26)|0,bitsLeft=width%26;if(this._expand(bytesNeeded),bitsLeft>0)bytesNeeded--;for(var i2=0;i2<bytesNeeded;i2++)this.words[i2]=~this.words[i2]&67108863;if(bitsLeft>0)this.words[i2]=~this.words[i2]&67108863>>26-bitsLeft;return this.strip()},BN.prototype.notn=function(width){return this.clone().inotn(width)},BN.prototype.setn=function(bit,val){assert(typeof bit==="number"&&bit>=0);var off=bit/26|0,wbit=bit%26;if(this._expand(off+1),val)this.words[off]=this.words[off]|1<<wbit;else this.words[off]=this.words[off]&~(1<<wbit);return this.strip()},BN.prototype.iadd=function(num){var r;if(this.negative!==0&&num.negative===0)return this.negative=0,r=this.isub(num),this.negative^=1,this._normSign();else if(this.negative===0&&num.negative!==0)return num.negative=0,r=this.isub(num),num.negative=1,r._normSign();var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)+(b.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;if(this.length=a.length,carry!==0)this.words[this.length]=carry,this.length++;else if(a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this},BN.prototype.add=function(num){var res;if(num.negative!==0&&this.negative===0)return num.negative=0,res=this.sub(num),num.negative^=1,res;else if(num.negative===0&&this.negative!==0)return this.negative=0,res=num.sub(this),this.negative=1,res;if(this.length>num.length)return this.clone().iadd(num);return num.clone().iadd(this)},BN.prototype.isub=function(num){if(num.negative!==0){num.negative=0;var r=this.iadd(num);return num.negative=1,r._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(num),this.negative=1,this._normSign();var cmp=this.cmp(num);if(cmp===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,b;if(cmp>0)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)-(b.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;if(carry===0&&i2<a.length&&a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];if(this.length=Math.max(this.length,i2),a!==this)this.negative=1;return this.strip()},BN.prototype.sub=function(num){return this.clone().isub(num)};function smallMulTo(self2,num,out){out.negative=num.negative^self2.negative;var len2=self2.length+num.length|0;out.length=len2,len2=len2-1|0;var a=self2.words[0]|0,b=num.words[0]|0,r=a*b,lo=r&67108863,carry=r/67108864|0;out.words[0]=lo;for(var k=1;k<len2;k++){var ncarry=carry>>>26,rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j|0;a=self2.words[i2]|0,b=num.words[j]|0,r=a*b+rword,ncarry+=r/67108864|0,rword=r&67108863}out.words[k]=rword|0,carry=ncarry|0}if(carry!==0)out.words[k]=carry|0;else out.length--;return out.strip()}var comb10MulTo=function(self2,num,out){var a=self2.words,b=num.words,o=out.words,c=0,lo,mid,hi,a0=a[0]|0,al0=a0&8191,ah0=a0>>>13,a1=a[1]|0,al1=a1&8191,ah1=a1>>>13,a2=a[2]|0,al2=a2&8191,ah2=a2>>>13,a3=a[3]|0,al3=a3&8191,ah3=a3>>>13,a4=a[4]|0,al4=a4&8191,ah4=a4>>>13,a5=a[5]|0,al5=a5&8191,ah5=a5>>>13,a6=a[6]|0,al6=a6&8191,ah6=a6>>>13,a7=a[7]|0,al7=a7&8191,ah7=a7>>>13,a8=a[8]|0,al8=a8&8191,ah8=a8>>>13,a9=a[9]|0,al9=a9&8191,ah9=a9>>>13,b0=b[0]|0,bl0=b0&8191,bh0=b0>>>13,b1=b[1]|0,bl1=b1&8191,bh1=b1>>>13,b2=b[2]|0,bl2=b2&8191,bh2=b2>>>13,b3=b[3]|0,bl3=b3&8191,bh3=b3>>>13,b4=b[4]|0,bl4=b4&8191,bh4=b4>>>13,b5=b[5]|0,bl5=b5&8191,bh5=b5>>>13,b6=b[6]|0,bl6=b6&8191,bh6=b6>>>13,b7=b[7]|0,bl7=b7&8191,bh7=b7>>>13,b8=b[8]|0,bl8=b8&8191,bh8=b8>>>13,b9=b[9]|0,bl9=b9&8191,bh9=b9>>>13;out.negative=self2.negative^num.negative,out.length=19,lo=Math.imul(al0,bl0),mid=Math.imul(al0,bh0),mid=mid+Math.imul(ah0,bl0)|0,hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0,w0&=67108863,lo=Math.imul(al1,bl0),mid=Math.imul(al1,bh0),mid=mid+Math.imul(ah1,bl0)|0,hi=Math.imul(ah1,bh0),lo=lo+Math.imul(al0,bl1)|0,mid=mid+Math.imul(al0,bh1)|0,mid=mid+Math.imul(ah0,bl1)|0,hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0,w1&=67108863,lo=Math.imul(al2,bl0),mid=Math.imul(al2,bh0),mid=mid+Math.imul(ah2,bl0)|0,hi=Math.imul(ah2,bh0),lo=lo+Math.imul(al1,bl1)|0,mid=mid+Math.imul(al1,bh1)|0,mid=mid+Math.imul(ah1,bl1)|0,hi=hi+Math.imul(ah1,bh1)|0,lo=lo+Math.imul(al0,bl2)|0,mid=mid+Math.imul(al0,bh2)|0,mid=mid+Math.imul(ah0,bl2)|0,hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0,w2&=67108863,lo=Math.imul(al3,bl0),mid=Math.imul(al3,bh0),mid=mid+Math.imul(ah3,bl0)|0,hi=Math.imul(ah3,bh0),lo=lo+Math.imul(al2,bl1)|0,mid=mid+Math.imul(al2,bh1)|0,mid=mid+Math.imul(ah2,bl1)|0,hi=hi+Math.imul(ah2,bh1)|0,lo=lo+Math.imul(al1,bl2)|0,mid=mid+Math.imul(al1,bh2)|0,mid=mid+Math.imul(ah1,bl2)|0,hi=hi+Math.imul(ah1,bh2)|0,lo=lo+Math.imul(al0,bl3)|0,mid=mid+Math.imul(al0,bh3)|0,mid=mid+Math.imul(ah0,bl3)|0,hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0,w3&=67108863,lo=Math.imul(al4,bl0),mid=Math.imul(al4,bh0),mid=mid+Math.imul(ah4,bl0)|0,hi=Math.imul(ah4,bh0),lo=lo+Math.imul(al3,bl1)|0,mid=mid+Math.imul(al3,bh1)|0,mid=mid+Math.imul(ah3,bl1)|0,hi=hi+Math.imul(ah3,bh1)|0,lo=lo+Math.imul(al2,bl2)|0,mid=mid+Math.imul(al2,bh2)|0,mid=mid+Math.imul(ah2,bl2)|0,hi=hi+Math.imul(ah2,bh2)|0,lo=lo+Math.imul(al1,bl3)|0,mid=mid+Math.imul(al1,bh3)|0,mid=mid+Math.imul(ah1,bl3)|0,hi=hi+Math.imul(ah1,bh3)|0,lo=lo+Math.imul(al0,bl4)|0,mid=mid+Math.imul(al0,bh4)|0,mid=mid+Math.imul(ah0,bl4)|0,hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0,w4&=67108863,lo=Math.imul(al5,bl0),mid=Math.imul(al5,bh0),mid=mid+Math.imul(ah5,bl0)|0,hi=Math.imul(ah5,bh0),lo=lo+Math.imul(al4,bl1)|0,mid=mid+Math.imul(al4,bh1)|0,mid=mid+Math.imul(ah4,bl1)|0,hi=hi+Math.imul(ah4,bh1)|0,lo=lo+Math.imul(al3,bl2)|0,mid=mid+Math.imul(al3,bh2)|0,mid=mid+Math.imul(ah3,bl2)|0,hi=hi+Math.imul(ah3,bh2)|0,lo=lo+Math.imul(al2,bl3)|0,mid=mid+Math.imul(al2,bh3)|0,mid=mid+Math.imul(ah2,bl3)|0,hi=hi+Math.imul(ah2,bh3)|0,lo=lo+Math.imul(al1,bl4)|0,mid=mid+Math.imul(al1,bh4)|0,mid=mid+Math.imul(ah1,bl4)|0,hi=hi+Math.imul(ah1,bh4)|0,lo=lo+Math.imul(al0,bl5)|0,mid=mid+Math.imul(al0,bh5)|0,mid=mid+Math.imul(ah0,bl5)|0,hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0,w5&=67108863,lo=Math.imul(al6,bl0),mid=Math.imul(al6,bh0),mid=mid+Math.imul(ah6,bl0)|0,hi=Math.imul(ah6,bh0),lo=lo+Math.imul(al5,bl1)|0,mid=mid+Math.imul(al5,bh1)|0,mid=mid+Math.imul(ah5,bl1)|0,hi=hi+Math.imul(ah5,bh1)|0,lo=lo+Math.imul(al4,bl2)|0,mid=mid+Math.imul(al4,bh2)|0,mid=mid+Math.imul(ah4,bl2)|0,hi=hi+Math.imul(ah4,bh2)|0,lo=lo+Math.imul(al3,bl3)|0,mid=mid+Math.imul(al3,bh3)|0,mid=mid+Math.imul(ah3,bl3)|0,hi=hi+Math.imul(ah3,bh3)|0,lo=lo+Math.imul(al2,bl4)|0,mid=mid+Math.imul(al2,bh4)|0,mid=mid+Math.imul(ah2,bl4)|0,hi=hi+Math.imul(ah2,bh4)|0,lo=lo+Math.imul(al1,bl5)|0,mid=mid+Math.imul(al1,bh5)|0,mid=mid+Math.imul(ah1,bl5)|0,hi=hi+Math.imul(ah1,bh5)|0,lo=lo+Math.imul(al0,bl6)|0,mid=mid+Math.imul(al0,bh6)|0,mid=mid+Math.imul(ah0,bl6)|0,hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0,w6&=67108863,lo=Math.imul(al7,bl0),mid=Math.imul(al7,bh0),mid=mid+Math.imul(ah7,bl0)|0,hi=Math.imul(ah7,bh0),lo=lo+Math.imul(al6,bl1)|0,mid=mid+Math.imul(al6,bh1)|0,mid=mid+Math.imul(ah6,bl1)|0,hi=hi+Math.imul(ah6,bh1)|0,lo=lo+Math.imul(al5,bl2)|0,mid=mid+Math.imul(al5,bh2)|0,mid=mid+Math.imul(ah5,bl2)|0,hi=hi+Math.imul(ah5,bh2)|0,lo=lo+Math.imul(al4,bl3)|0,mid=mid+Math.imul(al4,bh3)|0,mid=mid+Math.imul(ah4,bl3)|0,hi=hi+Math.imul(ah4,bh3)|0,lo=lo+Math.imul(al3,bl4)|0,mid=mid+Math.imul(al3,bh4)|0,mid=mid+Math.imul(ah3,bl4)|0,hi=hi+Math.imul(ah3,bh4)|0,lo=lo+Math.imul(al2,bl5)|0,mid=mid+Math.imul(al2,bh5)|0,mid=mid+Math.imul(ah2,bl5)|0,hi=hi+Math.imul(ah2,bh5)|0,lo=lo+Math.imul(al1,bl6)|0,mid=mid+Math.imul(al1,bh6)|0,mid=mid+Math.imul(ah1,bl6)|0,hi=hi+Math.imul(ah1,bh6)|0,lo=lo+Math.imul(al0,bl7)|0,mid=mid+Math.imul(al0,bh7)|0,mid=mid+Math.imul(ah0,bl7)|0,hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0,w7&=67108863,lo=Math.imul(al8,bl0),mid=Math.imul(al8,bh0),mid=mid+Math.imul(ah8,bl0)|0,hi=Math.imul(ah8,bh0),lo=lo+Math.imul(al7,bl1)|0,mid=mid+Math.imul(al7,bh1)|0,mid=mid+Math.imul(ah7,bl1)|0,hi=hi+Math.imul(ah7,bh1)|0,lo=lo+Math.imul(al6,bl2)|0,mid=mid+Math.imul(al6,bh2)|0,mid=mid+Math.imul(ah6,bl2)|0,hi=hi+Math.imul(ah6,bh2)|0,lo=lo+Math.imul(al5,bl3)|0,mid=mid+Math.imul(al5,bh3)|0,mid=mid+Math.imul(ah5,bl3)|0,hi=hi+Math.imul(ah5,bh3)|0,lo=lo+Math.imul(al4,bl4)|0,mid=mid+Math.imul(al4,bh4)|0,mid=mid+Math.imul(ah4,bl4)|0,hi=hi+Math.imul(ah4,bh4)|0,lo=lo+Math.imul(al3,bl5)|0,mid=mid+Math.imul(al3,bh5)|0,mid=mid+Math.imul(ah3,bl5)|0,hi=hi+Math.imul(ah3,bh5)|0,lo=lo+Math.imul(al2,bl6)|0,mid=mid+Math.imul(al2,bh6)|0,mid=mid+Math.imul(ah2,bl6)|0,hi=hi+Math.imul(ah2,bh6)|0,lo=lo+Math.imul(al1,bl7)|0,mid=mid+Math.imul(al1,bh7)|0,mid=mid+Math.imul(ah1,bl7)|0,hi=hi+Math.imul(ah1,bh7)|0,lo=lo+Math.imul(al0,bl8)|0,mid=mid+Math.imul(al0,bh8)|0,mid=mid+Math.imul(ah0,bl8)|0,hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0,w8&=67108863,lo=Math.imul(al9,bl0),mid=Math.imul(al9,bh0),mid=mid+Math.imul(ah9,bl0)|0,hi=Math.imul(ah9,bh0),lo=lo+Math.imul(al8,bl1)|0,mid=mid+Math.imul(al8,bh1)|0,mid=mid+Math.imul(ah8,bl1)|0,hi=hi+Math.imul(ah8,bh1)|0,lo=lo+Math.imul(al7,bl2)|0,mid=mid+Math.imul(al7,bh2)|0,mid=mid+Math.imul(ah7,bl2)|0,hi=hi+Math.imul(ah7,bh2)|0,lo=lo+Math.imul(al6,bl3)|0,mid=mid+Math.imul(al6,bh3)|0,mid=mid+Math.imul(ah6,bl3)|0,hi=hi+Math.imul(ah6,bh3)|0,lo=lo+Math.imul(al5,bl4)|0,mid=mid+Math.imul(al5,bh4)|0,mid=mid+Math.imul(ah5,bl4)|0,hi=hi+Math.imul(ah5,bh4)|0,lo=lo+Math.imul(al4,bl5)|0,mid=mid+Math.imul(al4,bh5)|0,mid=mid+Math.imul(ah4,bl5)|0,hi=hi+Math.imul(ah4,bh5)|0,lo=lo+Math.imul(al3,bl6)|0,mid=mid+Math.imul(al3,bh6)|0,mid=mid+Math.imul(ah3,bl6)|0,hi=hi+Math.imul(ah3,bh6)|0,lo=lo+Math.imul(al2,bl7)|0,mid=mid+Math.imul(al2,bh7)|0,mid=mid+Math.imul(ah2,bl7)|0,hi=hi+Math.imul(ah2,bh7)|0,lo=lo+Math.imul(al1,bl8)|0,mid=mid+Math.imul(al1,bh8)|0,mid=mid+Math.imul(ah1,bl8)|0,hi=hi+Math.imul(ah1,bh8)|0,lo=lo+Math.imul(al0,bl9)|0,mid=mid+Math.imul(al0,bh9)|0,mid=mid+Math.imul(ah0,bl9)|0,hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0,w9&=67108863,lo=Math.imul(al9,bl1),mid=Math.imul(al9,bh1),mid=mid+Math.imul(ah9,bl1)|0,hi=Math.imul(ah9,bh1),lo=lo+Math.imul(al8,bl2)|0,mid=mid+Math.imul(al8,bh2)|0,mid=mid+Math.imul(ah8,bl2)|0,hi=hi+Math.imul(ah8,bh2)|0,lo=lo+Math.imul(al7,bl3)|0,mid=mid+Math.imul(al7,bh3)|0,mid=mid+Math.imul(ah7,bl3)|0,hi=hi+Math.imul(ah7,bh3)|0,lo=lo+Math.imul(al6,bl4)|0,mid=mid+Math.imul(al6,bh4)|0,mid=mid+Math.imul(ah6,bl4)|0,hi=hi+Math.imul(ah6,bh4)|0,lo=lo+Math.imul(al5,bl5)|0,mid=mid+Math.imul(al5,bh5)|0,mid=mid+Math.imul(ah5,bl5)|0,hi=hi+Math.imul(ah5,bh5)|0,lo=lo+Math.imul(al4,bl6)|0,mid=mid+Math.imul(al4,bh6)|0,mid=mid+Math.imul(ah4,bl6)|0,hi=hi+Math.imul(ah4,bh6)|0,lo=lo+Math.imul(al3,bl7)|0,mid=mid+Math.imul(al3,bh7)|0,mid=mid+Math.imul(ah3,bl7)|0,hi=hi+Math.imul(ah3,bh7)|0,lo=lo+Math.imul(al2,bl8)|0,mid=mid+Math.imul(al2,bh8)|0,mid=mid+Math.imul(ah2,bl8)|0,hi=hi+Math.imul(ah2,bh8)|0,lo=lo+Math.imul(al1,bl9)|0,mid=mid+Math.imul(al1,bh9)|0,mid=mid+Math.imul(ah1,bl9)|0,hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0,w10&=67108863,lo=Math.imul(al9,bl2),mid=Math.imul(al9,bh2),mid=mid+Math.imul(ah9,bl2)|0,hi=Math.imul(ah9,bh2),lo=lo+Math.imul(al8,bl3)|0,mid=mid+Math.imul(al8,bh3)|0,mid=mid+Math.imul(ah8,bl3)|0,hi=hi+Math.imul(ah8,bh3)|0,lo=lo+Math.imul(al7,bl4)|0,mid=mid+Math.imul(al7,bh4)|0,mid=mid+Math.imul(ah7,bl4)|0,hi=hi+Math.imul(ah7,bh4)|0,lo=lo+Math.imul(al6,bl5)|0,mid=mid+Math.imul(al6,bh5)|0,mid=mid+Math.imul(ah6,bl5)|0,hi=hi+Math.imul(ah6,bh5)|0,lo=lo+Math.imul(al5,bl6)|0,mid=mid+Math.imul(al5,bh6)|0,mid=mid+Math.imul(ah5,bl6)|0,hi=hi+Math.imul(ah5,bh6)|0,lo=lo+Math.imul(al4,bl7)|0,mid=mid+Math.imul(al4,bh7)|0,mid=mid+Math.imul(ah4,bl7)|0,hi=hi+Math.imul(ah4,bh7)|0,lo=lo+Math.imul(al3,bl8)|0,mid=mid+Math.imul(al3,bh8)|0,mid=mid+Math.imul(ah3,bl8)|0,hi=hi+Math.imul(ah3,bh8)|0,lo=lo+Math.imul(al2,bl9)|0,mid=mid+Math.imul(al2,bh9)|0,mid=mid+Math.imul(ah2,bl9)|0,hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0,w11&=67108863,lo=Math.imul(al9,bl3),mid=Math.imul(al9,bh3),mid=mid+Math.imul(ah9,bl3)|0,hi=Math.imul(ah9,bh3),lo=lo+Math.imul(al8,bl4)|0,mid=mid+Math.imul(al8,bh4)|0,mid=mid+Math.imul(ah8,bl4)|0,hi=hi+Math.imul(ah8,bh4)|0,lo=lo+Math.imul(al7,bl5)|0,mid=mid+Math.imul(al7,bh5)|0,mid=mid+Math.imul(ah7,bl5)|0,hi=hi+Math.imul(ah7,bh5)|0,lo=lo+Math.imul(al6,bl6)|0,mid=mid+Math.imul(al6,bh6)|0,mid=mid+Math.imul(ah6,bl6)|0,hi=hi+Math.imul(ah6,bh6)|0,lo=lo+Math.imul(al5,bl7)|0,mid=mid+Math.imul(al5,bh7)|0,mid=mid+Math.imul(ah5,bl7)|0,hi=hi+Math.imul(ah5,bh7)|0,lo=lo+Math.imul(al4,bl8)|0,mid=mid+Math.imul(al4,bh8)|0,mid=mid+Math.imul(ah4,bl8)|0,hi=hi+Math.imul(ah4,bh8)|0,lo=lo+Math.imul(al3,bl9)|0,mid=mid+Math.imul(al3,bh9)|0,mid=mid+Math.imul(ah3,bl9)|0,hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0,w12&=67108863,lo=Math.imul(al9,bl4),mid=Math.imul(al9,bh4),mid=mid+Math.imul(ah9,bl4)|0,hi=Math.imul(ah9,bh4),lo=lo+Math.imul(al8,bl5)|0,mid=mid+Math.imul(al8,bh5)|0,mid=mid+Math.imul(ah8,bl5)|0,hi=hi+Math.imul(ah8,bh5)|0,lo=lo+Math.imul(al7,bl6)|0,mid=mid+Math.imul(al7,bh6)|0,mid=mid+Math.imul(ah7,bl6)|0,hi=hi+Math.imul(ah7,bh6)|0,lo=lo+Math.imul(al6,bl7)|0,mid=mid+Math.imul(al6,bh7)|0,mid=mid+Math.imul(ah6,bl7)|0,hi=hi+Math.imul(ah6,bh7)|0,lo=lo+Math.imul(al5,bl8)|0,mid=mid+Math.imul(al5,bh8)|0,mid=mid+Math.imul(ah5,bl8)|0,hi=hi+Math.imul(ah5,bh8)|0,lo=lo+Math.imul(al4,bl9)|0,mid=mid+Math.imul(al4,bh9)|0,mid=mid+Math.imul(ah4,bl9)|0,hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0,w13&=67108863,lo=Math.imul(al9,bl5),mid=Math.imul(al9,bh5),mid=mid+Math.imul(ah9,bl5)|0,hi=Math.imul(ah9,bh5),lo=lo+Math.imul(al8,bl6)|0,mid=mid+Math.imul(al8,bh6)|0,mid=mid+Math.imul(ah8,bl6)|0,hi=hi+Math.imul(ah8,bh6)|0,lo=lo+Math.imul(al7,bl7)|0,mid=mid+Math.imul(al7,bh7)|0,mid=mid+Math.imul(ah7,bl7)|0,hi=hi+Math.imul(ah7,bh7)|0,lo=lo+Math.imul(al6,bl8)|0,mid=mid+Math.imul(al6,bh8)|0,mid=mid+Math.imul(ah6,bl8)|0,hi=hi+Math.imul(ah6,bh8)|0,lo=lo+Math.imul(al5,bl9)|0,mid=mid+Math.imul(al5,bh9)|0,mid=mid+Math.imul(ah5,bl9)|0,hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0,w14&=67108863,lo=Math.imul(al9,bl6),mid=Math.imul(al9,bh6),mid=mid+Math.imul(ah9,bl6)|0,hi=Math.imul(ah9,bh6),lo=lo+Math.imul(al8,bl7)|0,mid=mid+Math.imul(al8,bh7)|0,mid=mid+Math.imul(ah8,bl7)|0,hi=hi+Math.imul(ah8,bh7)|0,lo=lo+Math.imul(al7,bl8)|0,mid=mid+Math.imul(al7,bh8)|0,mid=mid+Math.imul(ah7,bl8)|0,hi=hi+Math.imul(ah7,bh8)|0,lo=lo+Math.imul(al6,bl9)|0,mid=mid+Math.imul(al6,bh9)|0,mid=mid+Math.imul(ah6,bl9)|0,hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0,w15&=67108863,lo=Math.imul(al9,bl7),mid=Math.imul(al9,bh7),mid=mid+Math.imul(ah9,bl7)|0,hi=Math.imul(ah9,bh7),lo=lo+Math.imul(al8,bl8)|0,mid=mid+Math.imul(al8,bh8)|0,mid=mid+Math.imul(ah8,bl8)|0,hi=hi+Math.imul(ah8,bh8)|0,lo=lo+Math.imul(al7,bl9)|0,mid=mid+Math.imul(al7,bh9)|0,mid=mid+Math.imul(ah7,bl9)|0,hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0,w16&=67108863,lo=Math.imul(al9,bl8),mid=Math.imul(al9,bh8),mid=mid+Math.imul(ah9,bl8)|0,hi=Math.imul(ah9,bh8),lo=lo+Math.imul(al8,bl9)|0,mid=mid+Math.imul(al8,bh9)|0,mid=mid+Math.imul(ah8,bl9)|0,hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0,w17&=67108863,lo=Math.imul(al9,bl9),mid=Math.imul(al9,bh9),mid=mid+Math.imul(ah9,bl9)|0,hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&8191)<<13)|0;if(c=(hi+(mid>>>13)|0)+(w18>>>26)|0,w18&=67108863,o[0]=w0,o[1]=w1,o[2]=w2,o[3]=w3,o[4]=w4,o[5]=w5,o[6]=w6,o[7]=w7,o[8]=w8,o[9]=w9,o[10]=w10,o[11]=w11,o[12]=w12,o[13]=w13,o[14]=w14,o[15]=w15,o[16]=w16,o[17]=w17,o[18]=w18,c!==0)o[19]=c,out.length++;return out};if(!Math.imul)comb10MulTo=smallMulTo;function bigMulTo(self2,num,out){out.negative=num.negative^self2.negative,out.length=self2.length+num.length;var carry=0,hncarry=0;for(var k=0;k<out.length-1;k++){var ncarry=hncarry;hncarry=0;var rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j,a=self2.words[i2]|0,b=num.words[j]|0,r=a*b,lo=r&67108863;ncarry=ncarry+(r/67108864|0)|0,lo=lo+rword|0,rword=lo&67108863,ncarry=ncarry+(lo>>>26)|0,hncarry+=ncarry>>>26,ncarry&=67108863}out.words[k]=rword,carry=ncarry,ncarry=hncarry}if(carry!==0)out.words[k]=carry;else out.length--;return out.strip()}function jumboMulTo(self2,num,out){var fftm=new FFTM;return fftm.mulp(self2,num,out)}BN.prototype.mulTo=function(num,out){var res,len2=this.length+num.length;if(this.length===10&&num.length===10)res=comb10MulTo(this,num,out);else if(len2<63)res=smallMulTo(this,num,out);else if(len2<1024)res=bigMulTo(this,num,out);else res=jumboMulTo(this,num,out);return res};function FFTM(x,y){this.x=x,this.y=y}FFTM.prototype.makeRBT=function(N){var t=Array(N),l=BN.prototype._countBits(N)-1;for(var i2=0;i2<N;i2++)t[i2]=this.revBin(i2,l,N);return t},FFTM.prototype.revBin=function(x,l,N){if(x===0||x===N-1)return x;var rb=0;for(var i2=0;i2<l;i2++)rb|=(x&1)<<l-i2-1,x>>=1;return rb},FFTM.prototype.permute=function(rbt,rws,iws,rtws,itws,N){for(var i2=0;i2<N;i2++)rtws[i2]=rws[rbt[i2]],itws[i2]=iws[rbt[i2]]},FFTM.prototype.transform=function(rws,iws,rtws,itws,N,rbt){this.permute(rbt,rws,iws,rtws,itws,N);for(var s=1;s<N;s<<=1){var l=s<<1,rtwdf=Math.cos(2*Math.PI/l),itwdf=Math.sin(2*Math.PI/l);for(var p=0;p<N;p+=l){var rtwdf_=rtwdf,itwdf_=itwdf;for(var j=0;j<s;j++){var re=rtws[p+j],ie=itws[p+j],ro=rtws[p+j+s],io=itws[p+j+s],rx=rtwdf_*ro-itwdf_*io;if(io=rtwdf_*io+itwdf_*ro,ro=rx,rtws[p+j]=re+ro,itws[p+j]=ie+io,rtws[p+j+s]=re-ro,itws[p+j+s]=ie-io,j!==l)rx=rtwdf*rtwdf_-itwdf*itwdf_,itwdf_=rtwdf*itwdf_+itwdf*rtwdf_,rtwdf_=rx}}}},FFTM.prototype.guessLen13b=function(n,m){var N=Math.max(m,n)|1,odd=N&1,i2=0;for(N=N/2|0;N;N=N>>>1)i2++;return 1<<i2+1+odd},FFTM.prototype.conjugate=function(rws,iws,N){if(N<=1)return;for(var i2=0;i2<N/2;i2++){var t=rws[i2];rws[i2]=rws[N-i2-1],rws[N-i2-1]=t,t=iws[i2],iws[i2]=-iws[N-i2-1],iws[N-i2-1]=-t}},FFTM.prototype.normalize13b=function(ws,N){var carry=0;for(var i2=0;i2<N/2;i2++){var w=Math.round(ws[2*i2+1]/N)*8192+Math.round(ws[2*i2]/N)+carry;if(ws[i2]=w&67108863,w<67108864)carry=0;else carry=w/67108864|0}return ws},FFTM.prototype.convert13b=function(ws,len2,rws,N){var carry=0;for(var i2=0;i2<len2;i2++)carry=carry+(ws[i2]|0),rws[2*i2]=carry&8191,carry=carry>>>13,rws[2*i2+1]=carry&8191,carry=carry>>>13;for(i2=2*len2;i2<N;++i2)rws[i2]=0;assert(carry===0),assert((carry&-8192)===0)},FFTM.prototype.stub=function(N){var ph=Array(N);for(var i2=0;i2<N;i2++)ph[i2]=0;return ph},FFTM.prototype.mulp=function(x,y,out){var N=2*this.guessLen13b(x.length,y.length),rbt=this.makeRBT(N),_=this.stub(N),rws=Array(N),rwst=Array(N),iwst=Array(N),nrws=Array(N),nrwst=Array(N),niwst=Array(N),rmws=out.words;rmws.length=N,this.convert13b(x.words,x.length,rws,N),this.convert13b(y.words,y.length,nrws,N),this.transform(rws,_,rwst,iwst,N,rbt),this.transform(nrws,_,nrwst,niwst,N,rbt);for(var i2=0;i2<N;i2++){var rx=rwst[i2]*nrwst[i2]-iwst[i2]*niwst[i2];iwst[i2]=rwst[i2]*niwst[i2]+iwst[i2]*nrwst[i2],rwst[i2]=rx}return this.conjugate(rwst,iwst,N),this.transform(rwst,iwst,rmws,_,N,rbt),this.conjugate(rmws,_,N),this.normalize13b(rmws,N),out.negative=x.negative^y.negative,out.length=x.length+y.length,out.strip()},BN.prototype.mul=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),this.mulTo(num,out)},BN.prototype.mulf=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),jumboMulTo(this,num,out)},BN.prototype.imul=function(num){return this.clone().mulTo(num,this)},BN.prototype.imuln=function(num){assert(typeof num==="number"),assert(num<67108864);var carry=0;for(var i2=0;i2<this.length;i2++){var w=(this.words[i2]|0)*num,lo=(w&67108863)+(carry&67108863);carry>>=26,carry+=w/67108864|0,carry+=lo>>>26,this.words[i2]=lo&67108863}if(carry!==0)this.words[i2]=carry,this.length++;return this.length=num===0?1:this.length,this},BN.prototype.muln=function(num){return this.clone().imuln(num)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.imul(this.clone())},BN.prototype.pow=function(num){var w=toBitArray(num);if(w.length===0)return new BN(1);var res=this;for(var i2=0;i2<w.length;i2++,res=res.sqr())if(w[i2]!==0)break;if(++i2<w.length)for(var q=res.sqr();i2<w.length;i2++,q=q.sqr()){if(w[i2]===0)continue;res=res.mul(q)}return res},BN.prototype.iushln=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26,carryMask=67108863>>>26-r<<26-r,i2;if(r!==0){var carry=0;for(i2=0;i2<this.length;i2++){var newCarry=this.words[i2]&carryMask,c=(this.words[i2]|0)-newCarry<<r;this.words[i2]=c|carry,carry=newCarry>>>26-r}if(carry)this.words[i2]=carry,this.length++}if(s!==0){for(i2=this.length-1;i2>=0;i2--)this.words[i2+s]=this.words[i2];for(i2=0;i2<s;i2++)this.words[i2]=0;this.length+=s}return this.strip()},BN.prototype.ishln=function(bits){return assert(this.negative===0),this.iushln(bits)},BN.prototype.iushrn=function(bits,hint,extended){assert(typeof bits==="number"&&bits>=0);var h;if(hint)h=(hint-hint%26)/26;else h=0;var r=bits%26,s=Math.min((bits-r)/26,this.length),mask=67108863^67108863>>>r<<r,maskedWords=extended;if(h-=s,h=Math.max(0,h),maskedWords){for(var i2=0;i2<s;i2++)maskedWords.words[i2]=this.words[i2];maskedWords.length=s}if(s===0);else if(this.length>s){this.length-=s;for(i2=0;i2<this.length;i2++)this.words[i2]=this.words[i2+s]}else this.words[0]=0,this.length=1;var carry=0;for(i2=this.length-1;i2>=0&&(carry!==0||i2>=h);i2--){var word=this.words[i2]|0;this.words[i2]=carry<<26-r|word>>>r,carry=word&mask}if(maskedWords&&carry!==0)maskedWords.words[maskedWords.length++]=carry;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},BN.prototype.ishrn=function(bits,hint,extended){return assert(this.negative===0),this.iushrn(bits,hint,extended)},BN.prototype.shln=function(bits){return this.clone().ishln(bits)},BN.prototype.ushln=function(bits){return this.clone().iushln(bits)},BN.prototype.shrn=function(bits){return this.clone().ishrn(bits)},BN.prototype.ushrn=function(bits){return this.clone().iushrn(bits)},BN.prototype.testn=function(bit){assert(typeof bit==="number"&&bit>=0);var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return!1;var w=this.words[s];return!!(w&q)},BN.prototype.imaskn=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26;if(assert(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(r!==0)s++;if(this.length=Math.min(s,this.length),r!==0){var mask=67108863^67108863>>>r<<r;this.words[this.length-1]&=mask}return this.strip()},BN.prototype.maskn=function(bits){return this.clone().imaskn(bits)},BN.prototype.iaddn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.isubn(-num);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<num)return this.words[0]=num-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(num),this.negative=1,this}return this._iaddn(num)},BN.prototype._iaddn=function(num){this.words[0]+=num;for(var i2=0;i2<this.length&&this.words[i2]>=67108864;i2++)if(this.words[i2]-=67108864,i2===this.length-1)this.words[i2+1]=1;else this.words[i2+1]++;return this.length=Math.max(this.length,i2+1),this},BN.prototype.isubn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.iaddn(-num);if(this.negative!==0)return this.negative=0,this.iaddn(num),this.negative=1,this;if(this.words[0]-=num,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i2=0;i2<this.length&&this.words[i2]<0;i2++)this.words[i2]+=67108864,this.words[i2+1]-=1;return this.strip()},BN.prototype.addn=function(num){return this.clone().iaddn(num)},BN.prototype.subn=function(num){return this.clone().isubn(num)},BN.prototype.iabs=function(){return this.negative=0,this},BN.prototype.abs=function(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function(num,mul,shift){var len2=num.length+shift,i2;this._expand(len2);var w,carry=0;for(i2=0;i2<num.length;i2++){w=(this.words[i2+shift]|0)+carry;var right=(num.words[i2]|0)*mul;w-=right&67108863,carry=(w>>26)-(right/67108864|0),this.words[i2+shift]=w&67108863}for(;i2<this.length-shift;i2++)w=(this.words[i2+shift]|0)+carry,carry=w>>26,this.words[i2+shift]=w&67108863;if(carry===0)return this.strip();assert(carry===-1),carry=0;for(i2=0;i2<this.length;i2++)w=-(this.words[i2]|0)+carry,carry=w>>26,this.words[i2]=w&67108863;return this.negative=1,this.strip()},BN.prototype._wordDiv=function(num,mode){var shift=this.length-num.length,a=this.clone(),b=num,bhi=b.words[b.length-1]|0,bhiBits=this._countBits(bhi);if(shift=26-bhiBits,shift!==0)b=b.ushln(shift),a.iushln(shift),bhi=b.words[b.length-1]|0;var m=a.length-b.length,q;if(mode!=="mod"){q=new BN(null),q.length=m+1,q.words=Array(q.length);for(var i2=0;i2<q.length;i2++)q.words[i2]=0}var diff=a.clone()._ishlnsubmul(b,1,m);if(diff.negative===0){if(a=diff,q)q.words[m]=1}for(var j=m-1;j>=0;j--){var qj=(a.words[b.length+j]|0)*67108864+(a.words[b.length+j-1]|0);qj=Math.min(qj/bhi|0,67108863),a._ishlnsubmul(b,qj,j);while(a.negative!==0)if(qj--,a.negative=0,a._ishlnsubmul(b,1,j),!a.isZero())a.negative^=1;if(q)q.words[j]=qj}if(q)q.strip();if(a.strip(),mode!=="div"&&shift!==0)a.iushrn(shift);return{div:q||null,mod:a}},BN.prototype.divmod=function(num,mode,positive){if(assert(!num.isZero()),this.isZero())return{div:new BN(0),mod:new BN(0)};var div,mod,res;if(this.negative!==0&&num.negative===0){if(res=this.neg().divmod(num,mode),mode!=="mod")div=res.div.neg();if(mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.iadd(num)}return{div,mod}}if(this.negative===0&&num.negative!==0){if(res=this.divmod(num.neg(),mode),mode!=="mod")div=res.div.neg();return{div,mod:res.mod}}if((this.negative&num.negative)!==0){if(res=this.neg().divmod(num.neg(),mode),mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.isub(num)}return{div:res.div,mod}}if(num.length>this.length||this.cmp(num)<0)return{div:new BN(0),mod:this};if(num.length===1){if(mode==="div")return{div:this.divn(num.words[0]),mod:null};if(mode==="mod")return{div:null,mod:new BN(this.modn(num.words[0]))};return{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}}return this._wordDiv(num,mode)},BN.prototype.div=function(num){return this.divmod(num,"div",!1).div},BN.prototype.mod=function(num){return this.divmod(num,"mod",!1).mod},BN.prototype.umod=function(num){return this.divmod(num,"mod",!0).mod},BN.prototype.divRound=function(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod,half=num.ushrn(1),r2=num.andln(1),cmp=mod.cmp(half);if(cmp<0||r2===1&&cmp===0)return dm.div;return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1)},BN.prototype.modn=function(num){assert(num<=67108863);var p=67108864%num,acc=0;for(var i2=this.length-1;i2>=0;i2--)acc=(p*acc+(this.words[i2]|0))%num;return acc},BN.prototype.idivn=function(num){assert(num<=67108863);var carry=0;for(var i2=this.length-1;i2>=0;i2--){var w=(this.words[i2]|0)+carry*67108864;this.words[i2]=w/num|0,carry=w%num}return this.strip()},BN.prototype.divn=function(num){return this.clone().idivn(num)},BN.prototype.egcd=function(p){assert(p.negative===0),assert(!p.isZero());var x=this,y=p.clone();if(x.negative!==0)x=x.umod(p);else x=x.clone();var A=new BN(1),B=new BN(0),C=new BN(0),D=new BN(1),g=0;while(x.isEven()&&y.isEven())x.iushrn(1),y.iushrn(1),++g;var yp=y.clone(),xp=x.clone();while(!x.isZero()){for(var i2=0,im=1;(x.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){x.iushrn(i2);while(i2-- >0){if(A.isOdd()||B.isOdd())A.iadd(yp),B.isub(xp);A.iushrn(1),B.iushrn(1)}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){y.iushrn(j);while(j-- >0){if(C.isOdd()||D.isOdd())C.iadd(yp),D.isub(xp);C.iushrn(1),D.iushrn(1)}}if(x.cmp(y)>=0)x.isub(y),A.isub(C),B.isub(D);else y.isub(x),C.isub(A),D.isub(B)}return{a:C,b:D,gcd:y.iushln(g)}},BN.prototype._invmp=function(p){assert(p.negative===0),assert(!p.isZero());var a=this,b=p.clone();if(a.negative!==0)a=a.umod(p);else a=a.clone();var x1=new BN(1),x2=new BN(0),delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i2=0,im=1;(a.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){a.iushrn(i2);while(i2-- >0){if(x1.isOdd())x1.iadd(delta);x1.iushrn(1)}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){b.iushrn(j);while(j-- >0){if(x2.isOdd())x2.iadd(delta);x2.iushrn(1)}}if(a.cmp(b)>=0)a.isub(b),x1.isub(x2);else b.isub(a),x2.isub(x1)}var res;if(a.cmpn(1)===0)res=x1;else res=x2;if(res.cmpn(0)<0)res.iadd(p);return res},BN.prototype.gcd=function(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone(),b=num.clone();a.negative=0,b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++)a.iushrn(1),b.iushrn(1);do{while(a.isEven())a.iushrn(1);while(b.isEven())b.iushrn(1);var r=a.cmp(b);if(r<0){var t=a;a=b,b=t}else if(r===0||b.cmpn(1)===0)break;a.isub(b)}while(!0);return b.iushln(shift)},BN.prototype.invm=function(num){return this.egcd(num).a.umod(num)},BN.prototype.isEven=function(){return(this.words[0]&1)===0},BN.prototype.isOdd=function(){return(this.words[0]&1)===1},BN.prototype.andln=function(num){return this.words[0]&num},BN.prototype.bincn=function(bit){assert(typeof bit==="number");var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return this._expand(s+1),this.words[s]|=q,this;var carry=q;for(var i2=s;carry!==0&&i2<this.length;i2++){var w=this.words[i2]|0;w+=carry,carry=w>>>26,w&=67108863,this.words[i2]=w}if(carry!==0)this.words[i2]=carry,this.length++;return this},BN.prototype.isZero=function(){return this.length===1&&this.words[0]===0},BN.prototype.cmpn=function(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this.strip();var res;if(this.length>1)res=1;else{if(negative)num=-num;assert(num<=67108863,"Number is too big");var w=this.words[0]|0;res=w===num?0:w<num?-1:1}if(this.negative!==0)return-res|0;return res},BN.prototype.cmp=function(num){if(this.negative!==0&&num.negative===0)return-1;if(this.negative===0&&num.negative!==0)return 1;var res=this.ucmp(num);if(this.negative!==0)return-res|0;return res},BN.prototype.ucmp=function(num){if(this.length>num.length)return 1;if(this.length<num.length)return-1;var res=0;for(var i2=this.length-1;i2>=0;i2--){var a=this.words[i2]|0,b=num.words[i2]|0;if(a===b)continue;if(a<b)res=-1;else if(a>b)res=1;break}return res},BN.prototype.gtn=function(num){return this.cmpn(num)===1},BN.prototype.gt=function(num){return this.cmp(num)===1},BN.prototype.gten=function(num){return this.cmpn(num)>=0},BN.prototype.gte=function(num){return this.cmp(num)>=0},BN.prototype.ltn=function(num){return this.cmpn(num)===-1},BN.prototype.lt=function(num){return this.cmp(num)===-1},BN.prototype.lten=function(num){return this.cmpn(num)<=0},BN.prototype.lte=function(num){return this.cmp(num)<=0},BN.prototype.eqn=function(num){return this.cmpn(num)===0},BN.prototype.eq=function(num){return this.cmp(num)===0},BN.red=function(num){return new Red(num)},BN.prototype.toRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),assert(this.negative===0,"red works only with positives"),ctx.convertTo(this)._forceRed(ctx)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(ctx){return this.red=ctx,this},BN.prototype.forceRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),this._forceRed(ctx)},BN.prototype.redAdd=function(num){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,num)},BN.prototype.redIAdd=function(num){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,num)},BN.prototype.redSub=function(num){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,num)},BN.prototype.redISub=function(num){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,num)},BN.prototype.redShl=function(num){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,num)},BN.prototype.redMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.mul(this,num)},BN.prototype.redIMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.imul(this,num)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(num){return assert(this.red&&!num.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};function MPrime(name,p){this.name=name,this.p=new BN(p,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}MPrime.prototype._tmp=function(){var tmp=new BN(null);return tmp.words=Array(Math.ceil(this.n/13)),tmp},MPrime.prototype.ireduce=function(num){var r=num,rlen;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),rlen=r.bitLength();while(rlen>this.n);var cmp=rlen<this.n?-1:r.ucmp(this.p);if(cmp===0)r.words[0]=0,r.length=1;else if(cmp>0)r.isub(this.p);else if(r.strip!==void 0)r.strip();else r._strip();return r},MPrime.prototype.split=function(input,out){input.iushrn(this.n,0,out)},MPrime.prototype.imulK=function(num){return num.imul(this.k)};function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}inherits2(K256,MPrime),K256.prototype.split=function(input,output){var mask=4194303,outLen=Math.min(input.length,9);for(var i2=0;i2<outLen;i2++)output.words[i2]=input.words[i2];if(output.length=outLen,input.length<=9){input.words[0]=0,input.length=1;return}var prev=input.words[9];output.words[output.length++]=prev&mask;for(i2=10;i2<input.length;i2++){var next=input.words[i2]|0;input.words[i2-10]=(next&mask)<<4|prev>>>22,prev=next}if(prev>>>=22,input.words[i2-10]=prev,prev===0&&input.length>10)input.length-=10;else input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;var lo=0;for(var i2=0;i2<num.length;i2++){var w=num.words[i2]|0;lo+=w*977,num.words[i2]=lo&67108863,lo=w*64+(lo/67108864|0)}if(num.words[num.length-1]===0){if(num.length--,num.words[num.length-1]===0)num.length--}return num};function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}inherits2(P224,MPrime);function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}inherits2(P192,MPrime);function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}inherits2(P25519,MPrime),P25519.prototype.imulK=function(num){var carry=0;for(var i2=0;i2<num.length;i2++){var hi=(num.words[i2]|0)*19+carry,lo=hi&67108863;hi>>>=26,num.words[i2]=lo,carry=hi}if(carry!==0)num.words[num.length++]=carry;return num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if(name==="k256")prime=new K256;else if(name==="p224")prime=new P224;else if(name==="p192")prime=new P192;else if(name==="p25519")prime=new P25519;else throw Error("Unknown prime "+name);return primes[name]=prime,prime};function Red(m){if(typeof m==="string"){var prime=BN._prime(m);this.m=prime.p,this.prime=prime}else assert(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}Red.prototype._verify1=function(a){assert(a.negative===0,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert((a.negative|b.negative)===0,"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return a.umod(this.m)._forceRed(this)},Red.prototype.neg=function(a){if(a.isZero())return a.clone();return this.m.sub(a)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.ushln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a.clone())},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2===1),mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}var q=this.m.subn(1),s=0;while(!q.isZero()&&q.andln(1)===0)s++,q.iushrn(1);assert(!q.isZero());var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).iushrn(1),z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0)z.redIAdd(nOne);var c=this.pow(z,q),r=this.pow(a,q.addn(1).iushrn(1)),t=this.pow(a,q),m=s;while(t.cmp(one)!==0){var tmp=t;for(var i2=0;tmp.cmp(one)!==0;i2++)tmp=tmp.redSqr();assert(i2<m);var b=this.pow(c,new BN(1).iushln(m-i2-1));r=r.redMul(b),c=b.redSqr(),t=t.redMul(c),m=i2}return r},Red.prototype.invm=function(a){var inv=a._invmp(this.m);if(inv.negative!==0)return inv.negative=0,this.imod(inv).redNeg();else return this.imod(inv)},Red.prototype.pow=function(a,num){if(num.isZero())return new BN(1).toRed(this);if(num.cmpn(1)===0)return a.clone();var windowSize=4,wnd=Array(1<<windowSize);wnd[0]=new BN(1).toRed(this),wnd[1]=a;for(var i2=2;i2<wnd.length;i2++)wnd[i2]=this.mul(wnd[i2-1],a);var res=wnd[0],current=0,currentLen=0,start=num.bitLength()%26;if(start===0)start=26;for(i2=num.length-1;i2>=0;i2--){var word=num.words[i2];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0])res=this.sqr(res);if(bit===0&&current===0){currentLen=0;continue}if(current<<=1,current|=bit,currentLen++,currentLen!==windowSize&&(i2!==0||j!==0))continue;res=this.mul(res,wnd[current]),currentLen=0,current=0}start=26}return res},Red.prototype.convertTo=function(num){var r=num.umod(this.m);return r===num?r.clone():r},Red.prototype.convertFrom=function(num){var res=num.clone();return res.red=null,res},BN.mont=function(num){return new Mont(num)};function Mont(m){if(Red.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}inherits2(Mont,Red),Mont.prototype.convertTo=function(num){return this.imod(num.ushln(this.shift))},Mont.prototype.convertFrom=function(num){var r=this.imod(num.mul(this.rinv));return r.red=null,r},Mont.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var t=a.imul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.invm=function(a){var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this)}})(typeof module>"u"||module,exports)}),require_browser=__commonJS2((exports,module)=>{var elliptic=require_elliptic(),BN=require_bn2();module.exports=function(curve){return new ECDH(curve)};var aliases={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};aliases.p224=aliases.secp224r1,aliases.p256=aliases.secp256r1=aliases.prime256v1,aliases.p192=aliases.secp192r1=aliases.prime192v1,aliases.p384=aliases.secp384r1,aliases.p521=aliases.secp521r1;function ECDH(curve){if(this.curveType=aliases[curve],!this.curveType)this.curveType={name:curve};this.curve=new elliptic.ec(this.curveType.name),this.keys=void 0}ECDH.prototype.generateKeys=function(enc,format2){return this.keys=this.curve.genKeyPair(),this.getPublicKey(enc,format2)},ECDH.prototype.computeSecret=function(other,inenc,enc){if(inenc=inenc||"utf8",!Buffer.isBuffer(other))other=new Buffer(other,inenc);var otherPub=this.curve.keyFromPublic(other).getPublic(),out=otherPub.mul(this.keys.getPrivate()).getX();return formatReturnValue(out,enc,this.curveType.byteLength)},ECDH.prototype.getPublicKey=function(enc,format2){var key=this.keys.getPublic(format2==="compressed",!0);if(format2==="hybrid")if(key[key.length-1]%2)key[0]=7;else key[0]=6;return formatReturnValue(key,enc)},ECDH.prototype.getPrivateKey=function(enc){return formatReturnValue(this.keys.getPrivate(),enc)},ECDH.prototype.setPublicKey=function(pub,enc){if(enc=enc||"utf8",!Buffer.isBuffer(pub))pub=new Buffer(pub,enc);return this.keys._importPublic(pub),this},ECDH.prototype.setPrivateKey=function(priv,enc){if(enc=enc||"utf8",!Buffer.isBuffer(priv))priv=new Buffer(priv,enc);var _priv=new BN(priv);return _priv=_priv.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(_priv),this};function formatReturnValue(bn,enc,len2){if(!Array.isArray(bn))bn=bn.toArray();var buf=new Buffer(bn);if(len2&&buf.length<len2){var zeros=new Buffer(len2-buf.length);zeros.fill(0),buf=Buffer.concat([zeros,buf])}if(!enc)return buf;else return buf.toString(enc)}}),require_create_ecdh=__commonJS2((exports,module)=>{var createECDH=(init_crypto(),__toCommonJS(exports_crypto)).createECDH;module.exports=createECDH||require_browser()}),require_bn3=__commonJS2((exports,module)=>{(function(module2,exports2){function assert(val,msg){if(!val)throw Error(msg||"Assertion failed")}function inherits2(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}function BN(number,base,endian){if(BN.isBN(number))return number;if(this.negative=0,this.words=null,this.length=0,this.red=null,number!==null){if(base==="le"||base==="be")endian=base,base=10;this._init(number||0,base||10,endian||"be")}}if(typeof module2==="object")module2.exports=BN;else exports2.BN=BN;BN.BN=BN,BN.wordSize=26;var Buffer22;try{if(typeof window<"u"&&typeof window.Buffer<"u")Buffer22=window.Buffer;else Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer}catch(e){}BN.isBN=function(num){if(num instanceof BN)return!0;return num!==null&&typeof num==="object"&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)},BN.max=function(left,right){if(left.cmp(right)>0)return left;return right},BN.min=function(left,right){if(left.cmp(right)<0)return left;return right},BN.prototype._init=function(number,base,endian){if(typeof number==="number")return this._initNumber(number,base,endian);if(typeof number==="object")return this._initArray(number,base,endian);if(base==="hex")base=16;assert(base===(base|0)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,"");var start=0;if(number[0]==="-")start++,this.negative=1;if(start<number.length){if(base===16)this._parseHex(number,start,endian);else if(this._parseBase(number,base,start),endian==="le")this._initArray(this.toArray(),base,endian)}},BN.prototype._initNumber=function(number,base,endian){if(number<0)this.negative=1,number=-number;if(number<67108864)this.words=[number&67108863],this.length=1;else if(number<4503599627370496)this.words=[number&67108863,number/67108864&67108863],this.length=2;else assert(number<9007199254740992),this.words=[number&67108863,number/67108864&67108863,1],this.length=3;if(endian!=="le")return;this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert(typeof number.length==="number"),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var j,w,off=0;if(endian==="be"){for(i2=number.length-1,j=0;i2>=0;i2-=3)if(w=number[i2]|number[i2-1]<<8|number[i2-2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}else if(endian==="le"){for(i2=0,j=0;i2<number.length;i2+=3)if(w=number[i2]|number[i2+1]<<8|number[i2+2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}return this.strip()};function parseHex4Bits(string,index){var c=string.charCodeAt(index);if(c>=65&&c<=70)return c-55;else if(c>=97&&c<=102)return c-87;else return c-48&15}function parseHexByte(string,lowerBound,index){var r=parseHex4Bits(string,index);if(index-1>=lowerBound)r|=parseHex4Bits(string,index-1)<<4;return r}BN.prototype._parseHex=function(number,start,endian){this.length=Math.ceil((number.length-start)/6),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var off=0,j=0,w;if(endian==="be")for(i2=number.length-1;i2>=start;i2-=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8;else{var parseLength=number.length-start;for(i2=parseLength%2===0?start+1:start;i2<number.length;i2+=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8}this.strip()};function parseBase(str,start,end,mul){var r=0,len2=Math.min(str.length,end);for(var i2=start;i2<len2;i2++){var c=str.charCodeAt(i2)-48;if(r*=mul,c>=49)r+=c-49+10;else if(c>=17)r+=c-17+10;else r+=c}return r}BN.prototype._parseBase=function(number,base,start){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;var total=number.length-start,mod=total%limbLen,end=Math.min(total,total-mod)+start,word=0;for(var i2=start;i2<end;i2+=limbLen)if(word=parseBase(number,i2,i2+limbLen,base),this.imuln(limbPow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word);if(mod!==0){var pow=1;word=parseBase(number,i2,number.length,base);for(i2=0;i2<mod;i2++)pow*=base;if(this.imuln(pow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word)}this.strip()},BN.prototype.copy=function(dest){dest.words=Array(this.length);for(var i2=0;i2<this.length;i2++)dest.words[i2]=this.words[i2];dest.length=this.length,dest.negative=this.negative,dest.red=this.red},BN.prototype.clone=function(){var r=new BN(null);return this.copy(r),r},BN.prototype._expand=function(size){while(this.length<size)this.words[this.length++]=0;return this},BN.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},BN.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},BN.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var zeros=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(BN.prototype.toString=function(base,padding){base=base||10,padding=padding|0||1;var out;if(base===16||base==="hex"){out="";var off=0,carry=0;for(var i2=0;i2<this.length;i2++){var w=this.words[i2],word=((w<<off|carry)&16777215).toString(16);if(carry=w>>>24-off&16777215,off+=2,off>=26)off-=26,i2--;if(carry!==0||i2!==this.length-1)out=zeros[6-word.length]+word+out;else out=word+out}if(carry!==0)out=carry.toString(16)+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base];out="";var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modn(groupBase).toString(base);if(c=c.idivn(groupBase),!c.isZero())out=zeros[groupSize-r.length]+r+out;else out=r+out}if(this.isZero())out="0"+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function(){var ret=this.words[0];if(this.length===2)ret+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)ret+=4503599627370496+this.words[1]*67108864;else if(this.length>2)assert(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-ret:ret},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toBuffer=function(endian,length){return assert(typeof Buffer22<"u"),this.toArrayLike(Buffer22,endian,length)},BN.prototype.toArray=function(endian,length){return this.toArrayLike(Array,endian,length)},BN.prototype.toArrayLike=function(ArrayType,endian,length){var byteLength2=this.byteLength(),reqLength=length||Math.max(1,byteLength2);assert(byteLength2<=reqLength,"byte array longer than desired length"),assert(reqLength>0,"Requested array length <= 0"),this.strip();var littleEndian=endian==="le",res=new ArrayType(reqLength),b,i2,q=this.clone();if(!littleEndian){for(i2=0;i2<reqLength-byteLength2;i2++)res[i2]=0;for(i2=0;!q.isZero();i2++)b=q.andln(255),q.iushrn(8),res[reqLength-i2-1]=b}else{for(i2=0;!q.isZero();i2++)b=q.andln(255),q.iushrn(8),res[i2]=b;for(;i2<reqLength;i2++)res[i2]=0}return res},Math.clz32)BN.prototype._countBits=function(w){return 32-Math.clz32(w)};else BN.prototype._countBits=function(w){var t=w,r=0;if(t>=4096)r+=13,t>>>=13;if(t>=64)r+=7,t>>>=7;if(t>=8)r+=4,t>>>=4;if(t>=2)r+=2,t>>>=2;return r+t};BN.prototype._zeroBits=function(w){if(w===0)return 26;var t=w,r=0;if((t&8191)===0)r+=13,t>>>=13;if((t&127)===0)r+=7,t>>>=7;if((t&15)===0)r+=4,t>>>=4;if((t&3)===0)r+=2,t>>>=2;if((t&1)===0)r++;return r},BN.prototype.bitLength=function(){var w=this.words[this.length-1],hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){var w=Array(num.bitLength());for(var bit=0;bit<w.length;bit++){var off=bit/26|0,wbit=bit%26;w[bit]=(num.words[off]&1<<wbit)>>>wbit}return w}BN.prototype.zeroBits=function(){if(this.isZero())return 0;var r=0;for(var i2=0;i2<this.length;i2++){var b=this._zeroBits(this.words[i2]);if(r+=b,b!==26)break}return r},BN.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function(width){if(this.negative!==0)return this.abs().inotn(width).iaddn(1);return this.clone()},BN.prototype.fromTwos=function(width){if(this.testn(width-1))return this.notn(width).iaddn(1).ineg();return this.clone()},BN.prototype.isNeg=function(){return this.negative!==0},BN.prototype.neg=function(){return this.clone().ineg()},BN.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},BN.prototype.iuor=function(num){while(this.length<num.length)this.words[this.length++]=0;for(var i2=0;i2<num.length;i2++)this.words[i2]=this.words[i2]|num.words[i2];return this.strip()},BN.prototype.ior=function(num){return assert((this.negative|num.negative)===0),this.iuor(num)},BN.prototype.or=function(num){if(this.length>num.length)return this.clone().ior(num);return num.clone().ior(this)},BN.prototype.uor=function(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this)},BN.prototype.iuand=function(num){var b;if(this.length>num.length)b=num;else b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=this.words[i2]&num.words[i2];return this.length=b.length,this.strip()},BN.prototype.iand=function(num){return assert((this.negative|num.negative)===0),this.iuand(num)},BN.prototype.and=function(num){if(this.length>num.length)return this.clone().iand(num);return num.clone().iand(this)},BN.prototype.uand=function(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this)},BN.prototype.iuxor=function(num){var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=a.words[i2]^b.words[i2];if(this!==a)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this.length=a.length,this.strip()},BN.prototype.ixor=function(num){return assert((this.negative|num.negative)===0),this.iuxor(num)},BN.prototype.xor=function(num){if(this.length>num.length)return this.clone().ixor(num);return num.clone().ixor(this)},BN.prototype.uxor=function(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this)},BN.prototype.inotn=function(width){assert(typeof width==="number"&&width>=0);var bytesNeeded=Math.ceil(width/26)|0,bitsLeft=width%26;if(this._expand(bytesNeeded),bitsLeft>0)bytesNeeded--;for(var i2=0;i2<bytesNeeded;i2++)this.words[i2]=~this.words[i2]&67108863;if(bitsLeft>0)this.words[i2]=~this.words[i2]&67108863>>26-bitsLeft;return this.strip()},BN.prototype.notn=function(width){return this.clone().inotn(width)},BN.prototype.setn=function(bit,val){assert(typeof bit==="number"&&bit>=0);var off=bit/26|0,wbit=bit%26;if(this._expand(off+1),val)this.words[off]=this.words[off]|1<<wbit;else this.words[off]=this.words[off]&~(1<<wbit);return this.strip()},BN.prototype.iadd=function(num){var r;if(this.negative!==0&&num.negative===0)return this.negative=0,r=this.isub(num),this.negative^=1,this._normSign();else if(this.negative===0&&num.negative!==0)return num.negative=0,r=this.isub(num),num.negative=1,r._normSign();var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)+(b.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;if(this.length=a.length,carry!==0)this.words[this.length]=carry,this.length++;else if(a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this},BN.prototype.add=function(num){var res;if(num.negative!==0&&this.negative===0)return num.negative=0,res=this.sub(num),num.negative^=1,res;else if(num.negative===0&&this.negative!==0)return this.negative=0,res=num.sub(this),this.negative=1,res;if(this.length>num.length)return this.clone().iadd(num);return num.clone().iadd(this)},BN.prototype.isub=function(num){if(num.negative!==0){num.negative=0;var r=this.iadd(num);return num.negative=1,r._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(num),this.negative=1,this._normSign();var cmp=this.cmp(num);if(cmp===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,b;if(cmp>0)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)-(b.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;if(carry===0&&i2<a.length&&a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];if(this.length=Math.max(this.length,i2),a!==this)this.negative=1;return this.strip()},BN.prototype.sub=function(num){return this.clone().isub(num)};function smallMulTo(self2,num,out){out.negative=num.negative^self2.negative;var len2=self2.length+num.length|0;out.length=len2,len2=len2-1|0;var a=self2.words[0]|0,b=num.words[0]|0,r=a*b,lo=r&67108863,carry=r/67108864|0;out.words[0]=lo;for(var k=1;k<len2;k++){var ncarry=carry>>>26,rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j|0;a=self2.words[i2]|0,b=num.words[j]|0,r=a*b+rword,ncarry+=r/67108864|0,rword=r&67108863}out.words[k]=rword|0,carry=ncarry|0}if(carry!==0)out.words[k]=carry|0;else out.length--;return out.strip()}var comb10MulTo=function(self2,num,out){var a=self2.words,b=num.words,o=out.words,c=0,lo,mid,hi,a0=a[0]|0,al0=a0&8191,ah0=a0>>>13,a1=a[1]|0,al1=a1&8191,ah1=a1>>>13,a2=a[2]|0,al2=a2&8191,ah2=a2>>>13,a3=a[3]|0,al3=a3&8191,ah3=a3>>>13,a4=a[4]|0,al4=a4&8191,ah4=a4>>>13,a5=a[5]|0,al5=a5&8191,ah5=a5>>>13,a6=a[6]|0,al6=a6&8191,ah6=a6>>>13,a7=a[7]|0,al7=a7&8191,ah7=a7>>>13,a8=a[8]|0,al8=a8&8191,ah8=a8>>>13,a9=a[9]|0,al9=a9&8191,ah9=a9>>>13,b0=b[0]|0,bl0=b0&8191,bh0=b0>>>13,b1=b[1]|0,bl1=b1&8191,bh1=b1>>>13,b2=b[2]|0,bl2=b2&8191,bh2=b2>>>13,b3=b[3]|0,bl3=b3&8191,bh3=b3>>>13,b4=b[4]|0,bl4=b4&8191,bh4=b4>>>13,b5=b[5]|0,bl5=b5&8191,bh5=b5>>>13,b6=b[6]|0,bl6=b6&8191,bh6=b6>>>13,b7=b[7]|0,bl7=b7&8191,bh7=b7>>>13,b8=b[8]|0,bl8=b8&8191,bh8=b8>>>13,b9=b[9]|0,bl9=b9&8191,bh9=b9>>>13;out.negative=self2.negative^num.negative,out.length=19,lo=Math.imul(al0,bl0),mid=Math.imul(al0,bh0),mid=mid+Math.imul(ah0,bl0)|0,hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0,w0&=67108863,lo=Math.imul(al1,bl0),mid=Math.imul(al1,bh0),mid=mid+Math.imul(ah1,bl0)|0,hi=Math.imul(ah1,bh0),lo=lo+Math.imul(al0,bl1)|0,mid=mid+Math.imul(al0,bh1)|0,mid=mid+Math.imul(ah0,bl1)|0,hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0,w1&=67108863,lo=Math.imul(al2,bl0),mid=Math.imul(al2,bh0),mid=mid+Math.imul(ah2,bl0)|0,hi=Math.imul(ah2,bh0),lo=lo+Math.imul(al1,bl1)|0,mid=mid+Math.imul(al1,bh1)|0,mid=mid+Math.imul(ah1,bl1)|0,hi=hi+Math.imul(ah1,bh1)|0,lo=lo+Math.imul(al0,bl2)|0,mid=mid+Math.imul(al0,bh2)|0,mid=mid+Math.imul(ah0,bl2)|0,hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0,w2&=67108863,lo=Math.imul(al3,bl0),mid=Math.imul(al3,bh0),mid=mid+Math.imul(ah3,bl0)|0,hi=Math.imul(ah3,bh0),lo=lo+Math.imul(al2,bl1)|0,mid=mid+Math.imul(al2,bh1)|0,mid=mid+Math.imul(ah2,bl1)|0,hi=hi+Math.imul(ah2,bh1)|0,lo=lo+Math.imul(al1,bl2)|0,mid=mid+Math.imul(al1,bh2)|0,mid=mid+Math.imul(ah1,bl2)|0,hi=hi+Math.imul(ah1,bh2)|0,lo=lo+Math.imul(al0,bl3)|0,mid=mid+Math.imul(al0,bh3)|0,mid=mid+Math.imul(ah0,bl3)|0,hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0,w3&=67108863,lo=Math.imul(al4,bl0),mid=Math.imul(al4,bh0),mid=mid+Math.imul(ah4,bl0)|0,hi=Math.imul(ah4,bh0),lo=lo+Math.imul(al3,bl1)|0,mid=mid+Math.imul(al3,bh1)|0,mid=mid+Math.imul(ah3,bl1)|0,hi=hi+Math.imul(ah3,bh1)|0,lo=lo+Math.imul(al2,bl2)|0,mid=mid+Math.imul(al2,bh2)|0,mid=mid+Math.imul(ah2,bl2)|0,hi=hi+Math.imul(ah2,bh2)|0,lo=lo+Math.imul(al1,bl3)|0,mid=mid+Math.imul(al1,bh3)|0,mid=mid+Math.imul(ah1,bl3)|0,hi=hi+Math.imul(ah1,bh3)|0,lo=lo+Math.imul(al0,bl4)|0,mid=mid+Math.imul(al0,bh4)|0,mid=mid+Math.imul(ah0,bl4)|0,hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0,w4&=67108863,lo=Math.imul(al5,bl0),mid=Math.imul(al5,bh0),mid=mid+Math.imul(ah5,bl0)|0,hi=Math.imul(ah5,bh0),lo=lo+Math.imul(al4,bl1)|0,mid=mid+Math.imul(al4,bh1)|0,mid=mid+Math.imul(ah4,bl1)|0,hi=hi+Math.imul(ah4,bh1)|0,lo=lo+Math.imul(al3,bl2)|0,mid=mid+Math.imul(al3,bh2)|0,mid=mid+Math.imul(ah3,bl2)|0,hi=hi+Math.imul(ah3,bh2)|0,lo=lo+Math.imul(al2,bl3)|0,mid=mid+Math.imul(al2,bh3)|0,mid=mid+Math.imul(ah2,bl3)|0,hi=hi+Math.imul(ah2,bh3)|0,lo=lo+Math.imul(al1,bl4)|0,mid=mid+Math.imul(al1,bh4)|0,mid=mid+Math.imul(ah1,bl4)|0,hi=hi+Math.imul(ah1,bh4)|0,lo=lo+Math.imul(al0,bl5)|0,mid=mid+Math.imul(al0,bh5)|0,mid=mid+Math.imul(ah0,bl5)|0,hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0,w5&=67108863,lo=Math.imul(al6,bl0),mid=Math.imul(al6,bh0),mid=mid+Math.imul(ah6,bl0)|0,hi=Math.imul(ah6,bh0),lo=lo+Math.imul(al5,bl1)|0,mid=mid+Math.imul(al5,bh1)|0,mid=mid+Math.imul(ah5,bl1)|0,hi=hi+Math.imul(ah5,bh1)|0,lo=lo+Math.imul(al4,bl2)|0,mid=mid+Math.imul(al4,bh2)|0,mid=mid+Math.imul(ah4,bl2)|0,hi=hi+Math.imul(ah4,bh2)|0,lo=lo+Math.imul(al3,bl3)|0,mid=mid+Math.imul(al3,bh3)|0,mid=mid+Math.imul(ah3,bl3)|0,hi=hi+Math.imul(ah3,bh3)|0,lo=lo+Math.imul(al2,bl4)|0,mid=mid+Math.imul(al2,bh4)|0,mid=mid+Math.imul(ah2,bl4)|0,hi=hi+Math.imul(ah2,bh4)|0,lo=lo+Math.imul(al1,bl5)|0,mid=mid+Math.imul(al1,bh5)|0,mid=mid+Math.imul(ah1,bl5)|0,hi=hi+Math.imul(ah1,bh5)|0,lo=lo+Math.imul(al0,bl6)|0,mid=mid+Math.imul(al0,bh6)|0,mid=mid+Math.imul(ah0,bl6)|0,hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0,w6&=67108863,lo=Math.imul(al7,bl0),mid=Math.imul(al7,bh0),mid=mid+Math.imul(ah7,bl0)|0,hi=Math.imul(ah7,bh0),lo=lo+Math.imul(al6,bl1)|0,mid=mid+Math.imul(al6,bh1)|0,mid=mid+Math.imul(ah6,bl1)|0,hi=hi+Math.imul(ah6,bh1)|0,lo=lo+Math.imul(al5,bl2)|0,mid=mid+Math.imul(al5,bh2)|0,mid=mid+Math.imul(ah5,bl2)|0,hi=hi+Math.imul(ah5,bh2)|0,lo=lo+Math.imul(al4,bl3)|0,mid=mid+Math.imul(al4,bh3)|0,mid=mid+Math.imul(ah4,bl3)|0,hi=hi+Math.imul(ah4,bh3)|0,lo=lo+Math.imul(al3,bl4)|0,mid=mid+Math.imul(al3,bh4)|0,mid=mid+Math.imul(ah3,bl4)|0,hi=hi+Math.imul(ah3,bh4)|0,lo=lo+Math.imul(al2,bl5)|0,mid=mid+Math.imul(al2,bh5)|0,mid=mid+Math.imul(ah2,bl5)|0,hi=hi+Math.imul(ah2,bh5)|0,lo=lo+Math.imul(al1,bl6)|0,mid=mid+Math.imul(al1,bh6)|0,mid=mid+Math.imul(ah1,bl6)|0,hi=hi+Math.imul(ah1,bh6)|0,lo=lo+Math.imul(al0,bl7)|0,mid=mid+Math.imul(al0,bh7)|0,mid=mid+Math.imul(ah0,bl7)|0,hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0,w7&=67108863,lo=Math.imul(al8,bl0),mid=Math.imul(al8,bh0),mid=mid+Math.imul(ah8,bl0)|0,hi=Math.imul(ah8,bh0),lo=lo+Math.imul(al7,bl1)|0,mid=mid+Math.imul(al7,bh1)|0,mid=mid+Math.imul(ah7,bl1)|0,hi=hi+Math.imul(ah7,bh1)|0,lo=lo+Math.imul(al6,bl2)|0,mid=mid+Math.imul(al6,bh2)|0,mid=mid+Math.imul(ah6,bl2)|0,hi=hi+Math.imul(ah6,bh2)|0,lo=lo+Math.imul(al5,bl3)|0,mid=mid+Math.imul(al5,bh3)|0,mid=mid+Math.imul(ah5,bl3)|0,hi=hi+Math.imul(ah5,bh3)|0,lo=lo+Math.imul(al4,bl4)|0,mid=mid+Math.imul(al4,bh4)|0,mid=mid+Math.imul(ah4,bl4)|0,hi=hi+Math.imul(ah4,bh4)|0,lo=lo+Math.imul(al3,bl5)|0,mid=mid+Math.imul(al3,bh5)|0,mid=mid+Math.imul(ah3,bl5)|0,hi=hi+Math.imul(ah3,bh5)|0,lo=lo+Math.imul(al2,bl6)|0,mid=mid+Math.imul(al2,bh6)|0,mid=mid+Math.imul(ah2,bl6)|0,hi=hi+Math.imul(ah2,bh6)|0,lo=lo+Math.imul(al1,bl7)|0,mid=mid+Math.imul(al1,bh7)|0,mid=mid+Math.imul(ah1,bl7)|0,hi=hi+Math.imul(ah1,bh7)|0,lo=lo+Math.imul(al0,bl8)|0,mid=mid+Math.imul(al0,bh8)|0,mid=mid+Math.imul(ah0,bl8)|0,hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0,w8&=67108863,lo=Math.imul(al9,bl0),mid=Math.imul(al9,bh0),mid=mid+Math.imul(ah9,bl0)|0,hi=Math.imul(ah9,bh0),lo=lo+Math.imul(al8,bl1)|0,mid=mid+Math.imul(al8,bh1)|0,mid=mid+Math.imul(ah8,bl1)|0,hi=hi+Math.imul(ah8,bh1)|0,lo=lo+Math.imul(al7,bl2)|0,mid=mid+Math.imul(al7,bh2)|0,mid=mid+Math.imul(ah7,bl2)|0,hi=hi+Math.imul(ah7,bh2)|0,lo=lo+Math.imul(al6,bl3)|0,mid=mid+Math.imul(al6,bh3)|0,mid=mid+Math.imul(ah6,bl3)|0,hi=hi+Math.imul(ah6,bh3)|0,lo=lo+Math.imul(al5,bl4)|0,mid=mid+Math.imul(al5,bh4)|0,mid=mid+Math.imul(ah5,bl4)|0,hi=hi+Math.imul(ah5,bh4)|0,lo=lo+Math.imul(al4,bl5)|0,mid=mid+Math.imul(al4,bh5)|0,mid=mid+Math.imul(ah4,bl5)|0,hi=hi+Math.imul(ah4,bh5)|0,lo=lo+Math.imul(al3,bl6)|0,mid=mid+Math.imul(al3,bh6)|0,mid=mid+Math.imul(ah3,bl6)|0,hi=hi+Math.imul(ah3,bh6)|0,lo=lo+Math.imul(al2,bl7)|0,mid=mid+Math.imul(al2,bh7)|0,mid=mid+Math.imul(ah2,bl7)|0,hi=hi+Math.imul(ah2,bh7)|0,lo=lo+Math.imul(al1,bl8)|0,mid=mid+Math.imul(al1,bh8)|0,mid=mid+Math.imul(ah1,bl8)|0,hi=hi+Math.imul(ah1,bh8)|0,lo=lo+Math.imul(al0,bl9)|0,mid=mid+Math.imul(al0,bh9)|0,mid=mid+Math.imul(ah0,bl9)|0,hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0,w9&=67108863,lo=Math.imul(al9,bl1),mid=Math.imul(al9,bh1),mid=mid+Math.imul(ah9,bl1)|0,hi=Math.imul(ah9,bh1),lo=lo+Math.imul(al8,bl2)|0,mid=mid+Math.imul(al8,bh2)|0,mid=mid+Math.imul(ah8,bl2)|0,hi=hi+Math.imul(ah8,bh2)|0,lo=lo+Math.imul(al7,bl3)|0,mid=mid+Math.imul(al7,bh3)|0,mid=mid+Math.imul(ah7,bl3)|0,hi=hi+Math.imul(ah7,bh3)|0,lo=lo+Math.imul(al6,bl4)|0,mid=mid+Math.imul(al6,bh4)|0,mid=mid+Math.imul(ah6,bl4)|0,hi=hi+Math.imul(ah6,bh4)|0,lo=lo+Math.imul(al5,bl5)|0,mid=mid+Math.imul(al5,bh5)|0,mid=mid+Math.imul(ah5,bl5)|0,hi=hi+Math.imul(ah5,bh5)|0,lo=lo+Math.imul(al4,bl6)|0,mid=mid+Math.imul(al4,bh6)|0,mid=mid+Math.imul(ah4,bl6)|0,hi=hi+Math.imul(ah4,bh6)|0,lo=lo+Math.imul(al3,bl7)|0,mid=mid+Math.imul(al3,bh7)|0,mid=mid+Math.imul(ah3,bl7)|0,hi=hi+Math.imul(ah3,bh7)|0,lo=lo+Math.imul(al2,bl8)|0,mid=mid+Math.imul(al2,bh8)|0,mid=mid+Math.imul(ah2,bl8)|0,hi=hi+Math.imul(ah2,bh8)|0,lo=lo+Math.imul(al1,bl9)|0,mid=mid+Math.imul(al1,bh9)|0,mid=mid+Math.imul(ah1,bl9)|0,hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0,w10&=67108863,lo=Math.imul(al9,bl2),mid=Math.imul(al9,bh2),mid=mid+Math.imul(ah9,bl2)|0,hi=Math.imul(ah9,bh2),lo=lo+Math.imul(al8,bl3)|0,mid=mid+Math.imul(al8,bh3)|0,mid=mid+Math.imul(ah8,bl3)|0,hi=hi+Math.imul(ah8,bh3)|0,lo=lo+Math.imul(al7,bl4)|0,mid=mid+Math.imul(al7,bh4)|0,mid=mid+Math.imul(ah7,bl4)|0,hi=hi+Math.imul(ah7,bh4)|0,lo=lo+Math.imul(al6,bl5)|0,mid=mid+Math.imul(al6,bh5)|0,mid=mid+Math.imul(ah6,bl5)|0,hi=hi+Math.imul(ah6,bh5)|0,lo=lo+Math.imul(al5,bl6)|0,mid=mid+Math.imul(al5,bh6)|0,mid=mid+Math.imul(ah5,bl6)|0,hi=hi+Math.imul(ah5,bh6)|0,lo=lo+Math.imul(al4,bl7)|0,mid=mid+Math.imul(al4,bh7)|0,mid=mid+Math.imul(ah4,bl7)|0,hi=hi+Math.imul(ah4,bh7)|0,lo=lo+Math.imul(al3,bl8)|0,mid=mid+Math.imul(al3,bh8)|0,mid=mid+Math.imul(ah3,bl8)|0,hi=hi+Math.imul(ah3,bh8)|0,lo=lo+Math.imul(al2,bl9)|0,mid=mid+Math.imul(al2,bh9)|0,mid=mid+Math.imul(ah2,bl9)|0,hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0,w11&=67108863,lo=Math.imul(al9,bl3),mid=Math.imul(al9,bh3),mid=mid+Math.imul(ah9,bl3)|0,hi=Math.imul(ah9,bh3),lo=lo+Math.imul(al8,bl4)|0,mid=mid+Math.imul(al8,bh4)|0,mid=mid+Math.imul(ah8,bl4)|0,hi=hi+Math.imul(ah8,bh4)|0,lo=lo+Math.imul(al7,bl5)|0,mid=mid+Math.imul(al7,bh5)|0,mid=mid+Math.imul(ah7,bl5)|0,hi=hi+Math.imul(ah7,bh5)|0,lo=lo+Math.imul(al6,bl6)|0,mid=mid+Math.imul(al6,bh6)|0,mid=mid+Math.imul(ah6,bl6)|0,hi=hi+Math.imul(ah6,bh6)|0,lo=lo+Math.imul(al5,bl7)|0,mid=mid+Math.imul(al5,bh7)|0,mid=mid+Math.imul(ah5,bl7)|0,hi=hi+Math.imul(ah5,bh7)|0,lo=lo+Math.imul(al4,bl8)|0,mid=mid+Math.imul(al4,bh8)|0,mid=mid+Math.imul(ah4,bl8)|0,hi=hi+Math.imul(ah4,bh8)|0,lo=lo+Math.imul(al3,bl9)|0,mid=mid+Math.imul(al3,bh9)|0,mid=mid+Math.imul(ah3,bl9)|0,hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0,w12&=67108863,lo=Math.imul(al9,bl4),mid=Math.imul(al9,bh4),mid=mid+Math.imul(ah9,bl4)|0,hi=Math.imul(ah9,bh4),lo=lo+Math.imul(al8,bl5)|0,mid=mid+Math.imul(al8,bh5)|0,mid=mid+Math.imul(ah8,bl5)|0,hi=hi+Math.imul(ah8,bh5)|0,lo=lo+Math.imul(al7,bl6)|0,mid=mid+Math.imul(al7,bh6)|0,mid=mid+Math.imul(ah7,bl6)|0,hi=hi+Math.imul(ah7,bh6)|0,lo=lo+Math.imul(al6,bl7)|0,mid=mid+Math.imul(al6,bh7)|0,mid=mid+Math.imul(ah6,bl7)|0,hi=hi+Math.imul(ah6,bh7)|0,lo=lo+Math.imul(al5,bl8)|0,mid=mid+Math.imul(al5,bh8)|0,mid=mid+Math.imul(ah5,bl8)|0,hi=hi+Math.imul(ah5,bh8)|0,lo=lo+Math.imul(al4,bl9)|0,mid=mid+Math.imul(al4,bh9)|0,mid=mid+Math.imul(ah4,bl9)|0,hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0,w13&=67108863,lo=Math.imul(al9,bl5),mid=Math.imul(al9,bh5),mid=mid+Math.imul(ah9,bl5)|0,hi=Math.imul(ah9,bh5),lo=lo+Math.imul(al8,bl6)|0,mid=mid+Math.imul(al8,bh6)|0,mid=mid+Math.imul(ah8,bl6)|0,hi=hi+Math.imul(ah8,bh6)|0,lo=lo+Math.imul(al7,bl7)|0,mid=mid+Math.imul(al7,bh7)|0,mid=mid+Math.imul(ah7,bl7)|0,hi=hi+Math.imul(ah7,bh7)|0,lo=lo+Math.imul(al6,bl8)|0,mid=mid+Math.imul(al6,bh8)|0,mid=mid+Math.imul(ah6,bl8)|0,hi=hi+Math.imul(ah6,bh8)|0,lo=lo+Math.imul(al5,bl9)|0,mid=mid+Math.imul(al5,bh9)|0,mid=mid+Math.imul(ah5,bl9)|0,hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0,w14&=67108863,lo=Math.imul(al9,bl6),mid=Math.imul(al9,bh6),mid=mid+Math.imul(ah9,bl6)|0,hi=Math.imul(ah9,bh6),lo=lo+Math.imul(al8,bl7)|0,mid=mid+Math.imul(al8,bh7)|0,mid=mid+Math.imul(ah8,bl7)|0,hi=hi+Math.imul(ah8,bh7)|0,lo=lo+Math.imul(al7,bl8)|0,mid=mid+Math.imul(al7,bh8)|0,mid=mid+Math.imul(ah7,bl8)|0,hi=hi+Math.imul(ah7,bh8)|0,lo=lo+Math.imul(al6,bl9)|0,mid=mid+Math.imul(al6,bh9)|0,mid=mid+Math.imul(ah6,bl9)|0,hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0,w15&=67108863,lo=Math.imul(al9,bl7),mid=Math.imul(al9,bh7),mid=mid+Math.imul(ah9,bl7)|0,hi=Math.imul(ah9,bh7),lo=lo+Math.imul(al8,bl8)|0,mid=mid+Math.imul(al8,bh8)|0,mid=mid+Math.imul(ah8,bl8)|0,hi=hi+Math.imul(ah8,bh8)|0,lo=lo+Math.imul(al7,bl9)|0,mid=mid+Math.imul(al7,bh9)|0,mid=mid+Math.imul(ah7,bl9)|0,hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0,w16&=67108863,lo=Math.imul(al9,bl8),mid=Math.imul(al9,bh8),mid=mid+Math.imul(ah9,bl8)|0,hi=Math.imul(ah9,bh8),lo=lo+Math.imul(al8,bl9)|0,mid=mid+Math.imul(al8,bh9)|0,mid=mid+Math.imul(ah8,bl9)|0,hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0,w17&=67108863,lo=Math.imul(al9,bl9),mid=Math.imul(al9,bh9),mid=mid+Math.imul(ah9,bl9)|0,hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&8191)<<13)|0;if(c=(hi+(mid>>>13)|0)+(w18>>>26)|0,w18&=67108863,o[0]=w0,o[1]=w1,o[2]=w2,o[3]=w3,o[4]=w4,o[5]=w5,o[6]=w6,o[7]=w7,o[8]=w8,o[9]=w9,o[10]=w10,o[11]=w11,o[12]=w12,o[13]=w13,o[14]=w14,o[15]=w15,o[16]=w16,o[17]=w17,o[18]=w18,c!==0)o[19]=c,out.length++;return out};if(!Math.imul)comb10MulTo=smallMulTo;function bigMulTo(self2,num,out){out.negative=num.negative^self2.negative,out.length=self2.length+num.length;var carry=0,hncarry=0;for(var k=0;k<out.length-1;k++){var ncarry=hncarry;hncarry=0;var rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j,a=self2.words[i2]|0,b=num.words[j]|0,r=a*b,lo=r&67108863;ncarry=ncarry+(r/67108864|0)|0,lo=lo+rword|0,rword=lo&67108863,ncarry=ncarry+(lo>>>26)|0,hncarry+=ncarry>>>26,ncarry&=67108863}out.words[k]=rword,carry=ncarry,ncarry=hncarry}if(carry!==0)out.words[k]=carry;else out.length--;return out.strip()}function jumboMulTo(self2,num,out){var fftm=new FFTM;return fftm.mulp(self2,num,out)}BN.prototype.mulTo=function(num,out){var res,len2=this.length+num.length;if(this.length===10&&num.length===10)res=comb10MulTo(this,num,out);else if(len2<63)res=smallMulTo(this,num,out);else if(len2<1024)res=bigMulTo(this,num,out);else res=jumboMulTo(this,num,out);return res};function FFTM(x,y){this.x=x,this.y=y}FFTM.prototype.makeRBT=function(N){var t=Array(N),l=BN.prototype._countBits(N)-1;for(var i2=0;i2<N;i2++)t[i2]=this.revBin(i2,l,N);return t},FFTM.prototype.revBin=function(x,l,N){if(x===0||x===N-1)return x;var rb=0;for(var i2=0;i2<l;i2++)rb|=(x&1)<<l-i2-1,x>>=1;return rb},FFTM.prototype.permute=function(rbt,rws,iws,rtws,itws,N){for(var i2=0;i2<N;i2++)rtws[i2]=rws[rbt[i2]],itws[i2]=iws[rbt[i2]]},FFTM.prototype.transform=function(rws,iws,rtws,itws,N,rbt){this.permute(rbt,rws,iws,rtws,itws,N);for(var s=1;s<N;s<<=1){var l=s<<1,rtwdf=Math.cos(2*Math.PI/l),itwdf=Math.sin(2*Math.PI/l);for(var p=0;p<N;p+=l){var rtwdf_=rtwdf,itwdf_=itwdf;for(var j=0;j<s;j++){var re=rtws[p+j],ie=itws[p+j],ro=rtws[p+j+s],io=itws[p+j+s],rx=rtwdf_*ro-itwdf_*io;if(io=rtwdf_*io+itwdf_*ro,ro=rx,rtws[p+j]=re+ro,itws[p+j]=ie+io,rtws[p+j+s]=re-ro,itws[p+j+s]=ie-io,j!==l)rx=rtwdf*rtwdf_-itwdf*itwdf_,itwdf_=rtwdf*itwdf_+itwdf*rtwdf_,rtwdf_=rx}}}},FFTM.prototype.guessLen13b=function(n,m){var N=Math.max(m,n)|1,odd=N&1,i2=0;for(N=N/2|0;N;N=N>>>1)i2++;return 1<<i2+1+odd},FFTM.prototype.conjugate=function(rws,iws,N){if(N<=1)return;for(var i2=0;i2<N/2;i2++){var t=rws[i2];rws[i2]=rws[N-i2-1],rws[N-i2-1]=t,t=iws[i2],iws[i2]=-iws[N-i2-1],iws[N-i2-1]=-t}},FFTM.prototype.normalize13b=function(ws,N){var carry=0;for(var i2=0;i2<N/2;i2++){var w=Math.round(ws[2*i2+1]/N)*8192+Math.round(ws[2*i2]/N)+carry;if(ws[i2]=w&67108863,w<67108864)carry=0;else carry=w/67108864|0}return ws},FFTM.prototype.convert13b=function(ws,len2,rws,N){var carry=0;for(var i2=0;i2<len2;i2++)carry=carry+(ws[i2]|0),rws[2*i2]=carry&8191,carry=carry>>>13,rws[2*i2+1]=carry&8191,carry=carry>>>13;for(i2=2*len2;i2<N;++i2)rws[i2]=0;assert(carry===0),assert((carry&-8192)===0)},FFTM.prototype.stub=function(N){var ph=Array(N);for(var i2=0;i2<N;i2++)ph[i2]=0;return ph},FFTM.prototype.mulp=function(x,y,out){var N=2*this.guessLen13b(x.length,y.length),rbt=this.makeRBT(N),_=this.stub(N),rws=Array(N),rwst=Array(N),iwst=Array(N),nrws=Array(N),nrwst=Array(N),niwst=Array(N),rmws=out.words;rmws.length=N,this.convert13b(x.words,x.length,rws,N),this.convert13b(y.words,y.length,nrws,N),this.transform(rws,_,rwst,iwst,N,rbt),this.transform(nrws,_,nrwst,niwst,N,rbt);for(var i2=0;i2<N;i2++){var rx=rwst[i2]*nrwst[i2]-iwst[i2]*niwst[i2];iwst[i2]=rwst[i2]*niwst[i2]+iwst[i2]*nrwst[i2],rwst[i2]=rx}return this.conjugate(rwst,iwst,N),this.transform(rwst,iwst,rmws,_,N,rbt),this.conjugate(rmws,_,N),this.normalize13b(rmws,N),out.negative=x.negative^y.negative,out.length=x.length+y.length,out.strip()},BN.prototype.mul=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),this.mulTo(num,out)},BN.prototype.mulf=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),jumboMulTo(this,num,out)},BN.prototype.imul=function(num){return this.clone().mulTo(num,this)},BN.prototype.imuln=function(num){assert(typeof num==="number"),assert(num<67108864);var carry=0;for(var i2=0;i2<this.length;i2++){var w=(this.words[i2]|0)*num,lo=(w&67108863)+(carry&67108863);carry>>=26,carry+=w/67108864|0,carry+=lo>>>26,this.words[i2]=lo&67108863}if(carry!==0)this.words[i2]=carry,this.length++;return this.length=num===0?1:this.length,this},BN.prototype.muln=function(num){return this.clone().imuln(num)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.imul(this.clone())},BN.prototype.pow=function(num){var w=toBitArray(num);if(w.length===0)return new BN(1);var res=this;for(var i2=0;i2<w.length;i2++,res=res.sqr())if(w[i2]!==0)break;if(++i2<w.length)for(var q=res.sqr();i2<w.length;i2++,q=q.sqr()){if(w[i2]===0)continue;res=res.mul(q)}return res},BN.prototype.iushln=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26,carryMask=67108863>>>26-r<<26-r,i2;if(r!==0){var carry=0;for(i2=0;i2<this.length;i2++){var newCarry=this.words[i2]&carryMask,c=(this.words[i2]|0)-newCarry<<r;this.words[i2]=c|carry,carry=newCarry>>>26-r}if(carry)this.words[i2]=carry,this.length++}if(s!==0){for(i2=this.length-1;i2>=0;i2--)this.words[i2+s]=this.words[i2];for(i2=0;i2<s;i2++)this.words[i2]=0;this.length+=s}return this.strip()},BN.prototype.ishln=function(bits){return assert(this.negative===0),this.iushln(bits)},BN.prototype.iushrn=function(bits,hint,extended){assert(typeof bits==="number"&&bits>=0);var h;if(hint)h=(hint-hint%26)/26;else h=0;var r=bits%26,s=Math.min((bits-r)/26,this.length),mask=67108863^67108863>>>r<<r,maskedWords=extended;if(h-=s,h=Math.max(0,h),maskedWords){for(var i2=0;i2<s;i2++)maskedWords.words[i2]=this.words[i2];maskedWords.length=s}if(s===0);else if(this.length>s){this.length-=s;for(i2=0;i2<this.length;i2++)this.words[i2]=this.words[i2+s]}else this.words[0]=0,this.length=1;var carry=0;for(i2=this.length-1;i2>=0&&(carry!==0||i2>=h);i2--){var word=this.words[i2]|0;this.words[i2]=carry<<26-r|word>>>r,carry=word&mask}if(maskedWords&&carry!==0)maskedWords.words[maskedWords.length++]=carry;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},BN.prototype.ishrn=function(bits,hint,extended){return assert(this.negative===0),this.iushrn(bits,hint,extended)},BN.prototype.shln=function(bits){return this.clone().ishln(bits)},BN.prototype.ushln=function(bits){return this.clone().iushln(bits)},BN.prototype.shrn=function(bits){return this.clone().ishrn(bits)},BN.prototype.ushrn=function(bits){return this.clone().iushrn(bits)},BN.prototype.testn=function(bit){assert(typeof bit==="number"&&bit>=0);var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return!1;var w=this.words[s];return!!(w&q)},BN.prototype.imaskn=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26;if(assert(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(r!==0)s++;if(this.length=Math.min(s,this.length),r!==0){var mask=67108863^67108863>>>r<<r;this.words[this.length-1]&=mask}return this.strip()},BN.prototype.maskn=function(bits){return this.clone().imaskn(bits)},BN.prototype.iaddn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.isubn(-num);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<num)return this.words[0]=num-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(num),this.negative=1,this}return this._iaddn(num)},BN.prototype._iaddn=function(num){this.words[0]+=num;for(var i2=0;i2<this.length&&this.words[i2]>=67108864;i2++)if(this.words[i2]-=67108864,i2===this.length-1)this.words[i2+1]=1;else this.words[i2+1]++;return this.length=Math.max(this.length,i2+1),this},BN.prototype.isubn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.iaddn(-num);if(this.negative!==0)return this.negative=0,this.iaddn(num),this.negative=1,this;if(this.words[0]-=num,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i2=0;i2<this.length&&this.words[i2]<0;i2++)this.words[i2]+=67108864,this.words[i2+1]-=1;return this.strip()},BN.prototype.addn=function(num){return this.clone().iaddn(num)},BN.prototype.subn=function(num){return this.clone().isubn(num)},BN.prototype.iabs=function(){return this.negative=0,this},BN.prototype.abs=function(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function(num,mul,shift){var len2=num.length+shift,i2;this._expand(len2);var w,carry=0;for(i2=0;i2<num.length;i2++){w=(this.words[i2+shift]|0)+carry;var right=(num.words[i2]|0)*mul;w-=right&67108863,carry=(w>>26)-(right/67108864|0),this.words[i2+shift]=w&67108863}for(;i2<this.length-shift;i2++)w=(this.words[i2+shift]|0)+carry,carry=w>>26,this.words[i2+shift]=w&67108863;if(carry===0)return this.strip();assert(carry===-1),carry=0;for(i2=0;i2<this.length;i2++)w=-(this.words[i2]|0)+carry,carry=w>>26,this.words[i2]=w&67108863;return this.negative=1,this.strip()},BN.prototype._wordDiv=function(num,mode){var shift=this.length-num.length,a=this.clone(),b=num,bhi=b.words[b.length-1]|0,bhiBits=this._countBits(bhi);if(shift=26-bhiBits,shift!==0)b=b.ushln(shift),a.iushln(shift),bhi=b.words[b.length-1]|0;var m=a.length-b.length,q;if(mode!=="mod"){q=new BN(null),q.length=m+1,q.words=Array(q.length);for(var i2=0;i2<q.length;i2++)q.words[i2]=0}var diff=a.clone()._ishlnsubmul(b,1,m);if(diff.negative===0){if(a=diff,q)q.words[m]=1}for(var j=m-1;j>=0;j--){var qj=(a.words[b.length+j]|0)*67108864+(a.words[b.length+j-1]|0);qj=Math.min(qj/bhi|0,67108863),a._ishlnsubmul(b,qj,j);while(a.negative!==0)if(qj--,a.negative=0,a._ishlnsubmul(b,1,j),!a.isZero())a.negative^=1;if(q)q.words[j]=qj}if(q)q.strip();if(a.strip(),mode!=="div"&&shift!==0)a.iushrn(shift);return{div:q||null,mod:a}},BN.prototype.divmod=function(num,mode,positive){if(assert(!num.isZero()),this.isZero())return{div:new BN(0),mod:new BN(0)};var div,mod,res;if(this.negative!==0&&num.negative===0){if(res=this.neg().divmod(num,mode),mode!=="mod")div=res.div.neg();if(mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.iadd(num)}return{div,mod}}if(this.negative===0&&num.negative!==0){if(res=this.divmod(num.neg(),mode),mode!=="mod")div=res.div.neg();return{div,mod:res.mod}}if((this.negative&num.negative)!==0){if(res=this.neg().divmod(num.neg(),mode),mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.isub(num)}return{div:res.div,mod}}if(num.length>this.length||this.cmp(num)<0)return{div:new BN(0),mod:this};if(num.length===1){if(mode==="div")return{div:this.divn(num.words[0]),mod:null};if(mode==="mod")return{div:null,mod:new BN(this.modn(num.words[0]))};return{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}}return this._wordDiv(num,mode)},BN.prototype.div=function(num){return this.divmod(num,"div",!1).div},BN.prototype.mod=function(num){return this.divmod(num,"mod",!1).mod},BN.prototype.umod=function(num){return this.divmod(num,"mod",!0).mod},BN.prototype.divRound=function(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod,half=num.ushrn(1),r2=num.andln(1),cmp=mod.cmp(half);if(cmp<0||r2===1&&cmp===0)return dm.div;return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1)},BN.prototype.modn=function(num){assert(num<=67108863);var p=67108864%num,acc=0;for(var i2=this.length-1;i2>=0;i2--)acc=(p*acc+(this.words[i2]|0))%num;return acc},BN.prototype.idivn=function(num){assert(num<=67108863);var carry=0;for(var i2=this.length-1;i2>=0;i2--){var w=(this.words[i2]|0)+carry*67108864;this.words[i2]=w/num|0,carry=w%num}return this.strip()},BN.prototype.divn=function(num){return this.clone().idivn(num)},BN.prototype.egcd=function(p){assert(p.negative===0),assert(!p.isZero());var x=this,y=p.clone();if(x.negative!==0)x=x.umod(p);else x=x.clone();var A=new BN(1),B=new BN(0),C=new BN(0),D=new BN(1),g=0;while(x.isEven()&&y.isEven())x.iushrn(1),y.iushrn(1),++g;var yp=y.clone(),xp=x.clone();while(!x.isZero()){for(var i2=0,im=1;(x.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){x.iushrn(i2);while(i2-- >0){if(A.isOdd()||B.isOdd())A.iadd(yp),B.isub(xp);A.iushrn(1),B.iushrn(1)}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){y.iushrn(j);while(j-- >0){if(C.isOdd()||D.isOdd())C.iadd(yp),D.isub(xp);C.iushrn(1),D.iushrn(1)}}if(x.cmp(y)>=0)x.isub(y),A.isub(C),B.isub(D);else y.isub(x),C.isub(A),D.isub(B)}return{a:C,b:D,gcd:y.iushln(g)}},BN.prototype._invmp=function(p){assert(p.negative===0),assert(!p.isZero());var a=this,b=p.clone();if(a.negative!==0)a=a.umod(p);else a=a.clone();var x1=new BN(1),x2=new BN(0),delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i2=0,im=1;(a.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){a.iushrn(i2);while(i2-- >0){if(x1.isOdd())x1.iadd(delta);x1.iushrn(1)}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){b.iushrn(j);while(j-- >0){if(x2.isOdd())x2.iadd(delta);x2.iushrn(1)}}if(a.cmp(b)>=0)a.isub(b),x1.isub(x2);else b.isub(a),x2.isub(x1)}var res;if(a.cmpn(1)===0)res=x1;else res=x2;if(res.cmpn(0)<0)res.iadd(p);return res},BN.prototype.gcd=function(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone(),b=num.clone();a.negative=0,b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++)a.iushrn(1),b.iushrn(1);do{while(a.isEven())a.iushrn(1);while(b.isEven())b.iushrn(1);var r=a.cmp(b);if(r<0){var t=a;a=b,b=t}else if(r===0||b.cmpn(1)===0)break;a.isub(b)}while(!0);return b.iushln(shift)},BN.prototype.invm=function(num){return this.egcd(num).a.umod(num)},BN.prototype.isEven=function(){return(this.words[0]&1)===0},BN.prototype.isOdd=function(){return(this.words[0]&1)===1},BN.prototype.andln=function(num){return this.words[0]&num},BN.prototype.bincn=function(bit){assert(typeof bit==="number");var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return this._expand(s+1),this.words[s]|=q,this;var carry=q;for(var i2=s;carry!==0&&i2<this.length;i2++){var w=this.words[i2]|0;w+=carry,carry=w>>>26,w&=67108863,this.words[i2]=w}if(carry!==0)this.words[i2]=carry,this.length++;return this},BN.prototype.isZero=function(){return this.length===1&&this.words[0]===0},BN.prototype.cmpn=function(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this.strip();var res;if(this.length>1)res=1;else{if(negative)num=-num;assert(num<=67108863,"Number is too big");var w=this.words[0]|0;res=w===num?0:w<num?-1:1}if(this.negative!==0)return-res|0;return res},BN.prototype.cmp=function(num){if(this.negative!==0&&num.negative===0)return-1;if(this.negative===0&&num.negative!==0)return 1;var res=this.ucmp(num);if(this.negative!==0)return-res|0;return res},BN.prototype.ucmp=function(num){if(this.length>num.length)return 1;if(this.length<num.length)return-1;var res=0;for(var i2=this.length-1;i2>=0;i2--){var a=this.words[i2]|0,b=num.words[i2]|0;if(a===b)continue;if(a<b)res=-1;else if(a>b)res=1;break}return res},BN.prototype.gtn=function(num){return this.cmpn(num)===1},BN.prototype.gt=function(num){return this.cmp(num)===1},BN.prototype.gten=function(num){return this.cmpn(num)>=0},BN.prototype.gte=function(num){return this.cmp(num)>=0},BN.prototype.ltn=function(num){return this.cmpn(num)===-1},BN.prototype.lt=function(num){return this.cmp(num)===-1},BN.prototype.lten=function(num){return this.cmpn(num)<=0},BN.prototype.lte=function(num){return this.cmp(num)<=0},BN.prototype.eqn=function(num){return this.cmpn(num)===0},BN.prototype.eq=function(num){return this.cmp(num)===0},BN.red=function(num){return new Red(num)},BN.prototype.toRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),assert(this.negative===0,"red works only with positives"),ctx.convertTo(this)._forceRed(ctx)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(ctx){return this.red=ctx,this},BN.prototype.forceRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),this._forceRed(ctx)},BN.prototype.redAdd=function(num){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,num)},BN.prototype.redIAdd=function(num){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,num)},BN.prototype.redSub=function(num){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,num)},BN.prototype.redISub=function(num){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,num)},BN.prototype.redShl=function(num){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,num)},BN.prototype.redMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.mul(this,num)},BN.prototype.redIMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.imul(this,num)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(num){return assert(this.red&&!num.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};function MPrime(name,p){this.name=name,this.p=new BN(p,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}MPrime.prototype._tmp=function(){var tmp=new BN(null);return tmp.words=Array(Math.ceil(this.n/13)),tmp},MPrime.prototype.ireduce=function(num){var r=num,rlen;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),rlen=r.bitLength();while(rlen>this.n);var cmp=rlen<this.n?-1:r.ucmp(this.p);if(cmp===0)r.words[0]=0,r.length=1;else if(cmp>0)r.isub(this.p);else if(r.strip!==void 0)r.strip();else r._strip();return r},MPrime.prototype.split=function(input,out){input.iushrn(this.n,0,out)},MPrime.prototype.imulK=function(num){return num.imul(this.k)};function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}inherits2(K256,MPrime),K256.prototype.split=function(input,output){var mask=4194303,outLen=Math.min(input.length,9);for(var i2=0;i2<outLen;i2++)output.words[i2]=input.words[i2];if(output.length=outLen,input.length<=9){input.words[0]=0,input.length=1;return}var prev=input.words[9];output.words[output.length++]=prev&mask;for(i2=10;i2<input.length;i2++){var next=input.words[i2]|0;input.words[i2-10]=(next&mask)<<4|prev>>>22,prev=next}if(prev>>>=22,input.words[i2-10]=prev,prev===0&&input.length>10)input.length-=10;else input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;var lo=0;for(var i2=0;i2<num.length;i2++){var w=num.words[i2]|0;lo+=w*977,num.words[i2]=lo&67108863,lo=w*64+(lo/67108864|0)}if(num.words[num.length-1]===0){if(num.length--,num.words[num.length-1]===0)num.length--}return num};function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}inherits2(P224,MPrime);function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}inherits2(P192,MPrime);function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}inherits2(P25519,MPrime),P25519.prototype.imulK=function(num){var carry=0;for(var i2=0;i2<num.length;i2++){var hi=(num.words[i2]|0)*19+carry,lo=hi&67108863;hi>>>=26,num.words[i2]=lo,carry=hi}if(carry!==0)num.words[num.length++]=carry;return num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if(name==="k256")prime=new K256;else if(name==="p224")prime=new P224;else if(name==="p192")prime=new P192;else if(name==="p25519")prime=new P25519;else throw Error("Unknown prime "+name);return primes[name]=prime,prime};function Red(m){if(typeof m==="string"){var prime=BN._prime(m);this.m=prime.p,this.prime=prime}else assert(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}Red.prototype._verify1=function(a){assert(a.negative===0,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert((a.negative|b.negative)===0,"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return a.umod(this.m)._forceRed(this)},Red.prototype.neg=function(a){if(a.isZero())return a.clone();return this.m.sub(a)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.ushln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a.clone())},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2===1),mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}var q=this.m.subn(1),s=0;while(!q.isZero()&&q.andln(1)===0)s++,q.iushrn(1);assert(!q.isZero());var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).iushrn(1),z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0)z.redIAdd(nOne);var c=this.pow(z,q),r=this.pow(a,q.addn(1).iushrn(1)),t=this.pow(a,q),m=s;while(t.cmp(one)!==0){var tmp=t;for(var i2=0;tmp.cmp(one)!==0;i2++)tmp=tmp.redSqr();assert(i2<m);var b=this.pow(c,new BN(1).iushln(m-i2-1));r=r.redMul(b),c=b.redSqr(),t=t.redMul(c),m=i2}return r},Red.prototype.invm=function(a){var inv=a._invmp(this.m);if(inv.negative!==0)return inv.negative=0,this.imod(inv).redNeg();else return this.imod(inv)},Red.prototype.pow=function(a,num){if(num.isZero())return new BN(1).toRed(this);if(num.cmpn(1)===0)return a.clone();var windowSize=4,wnd=Array(1<<windowSize);wnd[0]=new BN(1).toRed(this),wnd[1]=a;for(var i2=2;i2<wnd.length;i2++)wnd[i2]=this.mul(wnd[i2-1],a);var res=wnd[0],current=0,currentLen=0,start=num.bitLength()%26;if(start===0)start=26;for(i2=num.length-1;i2>=0;i2--){var word=num.words[i2];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0])res=this.sqr(res);if(bit===0&&current===0){currentLen=0;continue}if(current<<=1,current|=bit,currentLen++,currentLen!==windowSize&&(i2!==0||j!==0))continue;res=this.mul(res,wnd[current]),currentLen=0,current=0}start=26}return res},Red.prototype.convertTo=function(num){var r=num.umod(this.m);return r===num?r.clone():r},Red.prototype.convertFrom=function(num){var res=num.clone();return res.red=null,res},BN.mont=function(num){return new Mont(num)};function Mont(m){if(Red.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}inherits2(Mont,Red),Mont.prototype.convertTo=function(num){return this.imod(num.ushln(this.shift))},Mont.prototype.convertFrom=function(num){var r=this.imod(num.mul(this.rinv));return r.red=null,r},Mont.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var t=a.imul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.invm=function(a){var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this)}})(typeof module>"u"||module,exports)}),require_api=__commonJS2((exports)=>{var asn1=require_asn1(),inherits2=require_inherits(),api=exports;api.define=function(name,body){return new Entity(name,body)};function Entity(name,body){this.name=name,this.body=body,this.decoders={},this.encoders={}}Entity.prototype._createNamed=function(base){var named;try{named=(()=>{throw new Error("Cannot require module "+"vm");})().runInThisContext("(function "+this.name+`(entity) {
12
+ this._initNamed(entity);
13
+ })`)}catch(e){named=function(entity){this._initNamed(entity)}}return inherits2(named,base),named.prototype._initNamed=function(entity){base.call(this,entity)},new named(this)},Entity.prototype._getDecoder=function(enc){if(enc=enc||"der",!this.decoders.hasOwnProperty(enc))this.decoders[enc]=this._createNamed(asn1.decoders[enc]);return this.decoders[enc]},Entity.prototype.decode=function(data,enc,options){return this._getDecoder(enc).decode(data,options)},Entity.prototype._getEncoder=function(enc){if(enc=enc||"der",!this.encoders.hasOwnProperty(enc))this.encoders[enc]=this._createNamed(asn1.encoders[enc]);return this.encoders[enc]},Entity.prototype.encode=function(data,enc,reporter){return this._getEncoder(enc).encode(data,reporter)}}),require_reporter=__commonJS2((exports)=>{var inherits2=require_inherits();function Reporter(options){this._reporterState={obj:null,path:[],options:options||{},errors:[]}}exports.Reporter=Reporter,Reporter.prototype.isError=function(obj){return obj instanceof ReporterError},Reporter.prototype.save=function(){var state=this._reporterState;return{obj:state.obj,pathLen:state.path.length}},Reporter.prototype.restore=function(data){var state=this._reporterState;state.obj=data.obj,state.path=state.path.slice(0,data.pathLen)},Reporter.prototype.enterKey=function(key){return this._reporterState.path.push(key)},Reporter.prototype.exitKey=function(index){var state=this._reporterState;state.path=state.path.slice(0,index-1)},Reporter.prototype.leaveKey=function(index,key,value){var state=this._reporterState;if(this.exitKey(index),state.obj!==null)state.obj[key]=value},Reporter.prototype.path=function(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function(){var state=this._reporterState,prev=state.obj;return state.obj={},prev},Reporter.prototype.leaveObject=function(prev){var state=this._reporterState,now=state.obj;return state.obj=prev,now},Reporter.prototype.error=function(msg){var err,state=this._reporterState,inherited=msg instanceof ReporterError;if(inherited)err=msg;else err=new ReporterError(state.path.map(function(elem){return"["+JSON.stringify(elem)+"]"}).join(""),msg.message||msg,msg.stack);if(!state.options.partial)throw err;if(!inherited)state.errors.push(err);return err},Reporter.prototype.wrapResult=function(result){var state=this._reporterState;if(!state.options.partial)return result;return{result:this.isError(result)?null:result,errors:state.errors}};function ReporterError(path,msg){this.path=path,this.rethrow(msg)}inherits2(ReporterError,Error),ReporterError.prototype.rethrow=function(msg){if(this.message=msg+" at: "+(this.path||"(shallow)"),Error.captureStackTrace)Error.captureStackTrace(this,ReporterError);if(!this.stack)try{throw Error(this.message)}catch(e){this.stack=e.stack}return this}}),require_buffer=__commonJS2((exports)=>{var inherits2=require_inherits(),Reporter=require_base2().Reporter,Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer;function DecoderBuffer(base,options){if(Reporter.call(this,options),!Buffer22.isBuffer(base)){this.error("Input not Buffer");return}this.base=base,this.offset=0,this.length=base.length}inherits2(DecoderBuffer,Reporter),exports.DecoderBuffer=DecoderBuffer,DecoderBuffer.prototype.save=function(){return{offset:this.offset,reporter:Reporter.prototype.save.call(this)}},DecoderBuffer.prototype.restore=function(save){var res=new DecoderBuffer(this.base);return res.offset=save.offset,res.length=this.offset,this.offset=save.offset,Reporter.prototype.restore.call(this,save.reporter),res},DecoderBuffer.prototype.isEmpty=function(){return this.offset===this.length},DecoderBuffer.prototype.readUInt8=function(fail){if(this.offset+1<=this.length)return this.base.readUInt8(this.offset++,!0);else return this.error(fail||"DecoderBuffer overrun")},DecoderBuffer.prototype.skip=function(bytes,fail){if(!(this.offset+bytes<=this.length))return this.error(fail||"DecoderBuffer overrun");var res=new DecoderBuffer(this.base);return res._reporterState=this._reporterState,res.offset=this.offset,res.length=this.offset+bytes,this.offset+=bytes,res},DecoderBuffer.prototype.raw=function(save){return this.base.slice(save?save.offset:this.offset,this.length)};function EncoderBuffer(value,reporter){if(Array.isArray(value))this.length=0,this.value=value.map(function(item){if(!(item instanceof EncoderBuffer))item=new EncoderBuffer(item,reporter);return this.length+=item.length,item},this);else if(typeof value==="number"){if(!(0<=value&&value<=255))return reporter.error("non-byte EncoderBuffer value");this.value=value,this.length=1}else if(typeof value==="string")this.value=value,this.length=Buffer22.byteLength(value);else if(Buffer22.isBuffer(value))this.value=value,this.length=value.length;else return reporter.error("Unsupported type: "+typeof value)}exports.EncoderBuffer=EncoderBuffer,EncoderBuffer.prototype.join=function(out,offset){if(!out)out=new Buffer22(this.length);if(!offset)offset=0;if(this.length===0)return out;if(Array.isArray(this.value))this.value.forEach(function(item){item.join(out,offset),offset+=item.length});else{if(typeof this.value==="number")out[offset]=this.value;else if(typeof this.value==="string")out.write(this.value,offset);else if(Buffer22.isBuffer(this.value))this.value.copy(out,offset);offset+=this.length}return out}}),require_node=__commonJS2((exports,module)=>{var Reporter=require_base2().Reporter,EncoderBuffer=require_base2().EncoderBuffer,DecoderBuffer=require_base2().DecoderBuffer,assert=require_minimalistic_assert(),tags=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],methods=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(tags),overrided=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function Node(enc,parent){var state={};if(this._baseState=state,state.enc=enc,state.parent=parent||null,state.children=null,state.tag=null,state.args=null,state.reverseArgs=null,state.choice=null,state.optional=!1,state.any=!1,state.obj=!1,state.use=null,state.useDecoder=null,state.key=null,state.default=null,state.explicit=null,state.implicit=null,state.contains=null,!state.parent)state.children=[],this._wrap()}module.exports=Node;var stateProps=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Node.prototype.clone=function(){var state=this._baseState,cstate={};stateProps.forEach(function(prop){cstate[prop]=state[prop]});var res=new this.constructor(cstate.parent);return res._baseState=cstate,res},Node.prototype._wrap=function(){var state=this._baseState;methods.forEach(function(method){this[method]=function(){var clone=new this.constructor(this);return state.children.push(clone),clone[method].apply(clone,arguments)}},this)},Node.prototype._init=function(body){var state=this._baseState;assert(state.parent===null),body.call(this),state.children=state.children.filter(function(child){return child._baseState.parent===this},this),assert.equal(state.children.length,1,"Root node can have only one child")},Node.prototype._useArgs=function(args){var state=this._baseState,children=args.filter(function(arg){return arg instanceof this.constructor},this);if(args=args.filter(function(arg){return!(arg instanceof this.constructor)},this),children.length!==0)assert(state.children===null),state.children=children,children.forEach(function(child){child._baseState.parent=this},this);if(args.length!==0)assert(state.args===null),state.args=args,state.reverseArgs=args.map(function(arg){if(typeof arg!=="object"||arg.constructor!==Object)return arg;var res={};return Object.keys(arg).forEach(function(key){if(key==(key|0))key|=0;var value=arg[key];res[value]=key}),res})},overrided.forEach(function(method){Node.prototype[method]=function(){var state=this._baseState;throw Error(method+" not implemented for encoding: "+state.enc)}}),tags.forEach(function(tag){Node.prototype[tag]=function(){var state=this._baseState,args=Array.prototype.slice.call(arguments);return assert(state.tag===null),state.tag=tag,this._useArgs(args),this}}),Node.prototype.use=function(item){assert(item);var state=this._baseState;return assert(state.use===null),state.use=item,this},Node.prototype.optional=function(){var state=this._baseState;return state.optional=!0,this},Node.prototype.def=function(val){var state=this._baseState;return assert(state.default===null),state.default=val,state.optional=!0,this},Node.prototype.explicit=function(num){var state=this._baseState;return assert(state.explicit===null&&state.implicit===null),state.explicit=num,this},Node.prototype.implicit=function(num){var state=this._baseState;return assert(state.explicit===null&&state.implicit===null),state.implicit=num,this},Node.prototype.obj=function(){var state=this._baseState,args=Array.prototype.slice.call(arguments);if(state.obj=!0,args.length!==0)this._useArgs(args);return this},Node.prototype.key=function(newKey){var state=this._baseState;return assert(state.key===null),state.key=newKey,this},Node.prototype.any=function(){var state=this._baseState;return state.any=!0,this},Node.prototype.choice=function(obj){var state=this._baseState;return assert(state.choice===null),state.choice=obj,this._useArgs(Object.keys(obj).map(function(key){return obj[key]})),this},Node.prototype.contains=function(item){var state=this._baseState;return assert(state.use===null),state.contains=item,this},Node.prototype._decode=function(input,options){var state=this._baseState;if(state.parent===null)return input.wrapResult(state.children[0]._decode(input,options));var result=state.default,present=!0,prevKey=null;if(state.key!==null)prevKey=input.enterKey(state.key);if(state.optional){var tag=null;if(state.explicit!==null)tag=state.explicit;else if(state.implicit!==null)tag=state.implicit;else if(state.tag!==null)tag=state.tag;if(tag===null&&!state.any){var save=input.save();try{if(state.choice===null)this._decodeGeneric(state.tag,input,options);else this._decodeChoice(input,options);present=!0}catch(e){present=!1}input.restore(save)}else if(present=this._peekTag(input,tag,state.any),input.isError(present))return present}var prevObj;if(state.obj&&present)prevObj=input.enterObject();if(present){if(state.explicit!==null){var explicit=this._decodeTag(input,state.explicit);if(input.isError(explicit))return explicit;input=explicit}var start=input.offset;if(state.use===null&&state.choice===null){if(state.any)var save=input.save();var body=this._decodeTag(input,state.implicit!==null?state.implicit:state.tag,state.any);if(input.isError(body))return body;if(state.any)result=input.raw(save);else input=body}if(options&&options.track&&state.tag!==null)options.track(input.path(),start,input.length,"tagged");if(options&&options.track&&state.tag!==null)options.track(input.path(),input.offset,input.length,"content");if(state.any)result=result;else if(state.choice===null)result=this._decodeGeneric(state.tag,input,options);else result=this._decodeChoice(input,options);if(input.isError(result))return result;if(!state.any&&state.choice===null&&state.children!==null)state.children.forEach(function(child){child._decode(input,options)});if(state.contains&&(state.tag==="octstr"||state.tag==="bitstr")){var data=new DecoderBuffer(result);result=this._getUse(state.contains,input._reporterState.obj)._decode(data,options)}}if(state.obj&&present)result=input.leaveObject(prevObj);if(state.key!==null&&(result!==null||present===!0))input.leaveKey(prevKey,state.key,result);else if(prevKey!==null)input.exitKey(prevKey);return result},Node.prototype._decodeGeneric=function(tag,input,options){var state=this._baseState;if(tag==="seq"||tag==="set")return null;if(tag==="seqof"||tag==="setof")return this._decodeList(input,tag,state.args[0],options);else if(/str$/.test(tag))return this._decodeStr(input,tag,options);else if(tag==="objid"&&state.args)return this._decodeObjid(input,state.args[0],state.args[1],options);else if(tag==="objid")return this._decodeObjid(input,null,null,options);else if(tag==="gentime"||tag==="utctime")return this._decodeTime(input,tag,options);else if(tag==="null_")return this._decodeNull(input,options);else if(tag==="bool")return this._decodeBool(input,options);else if(tag==="objDesc")return this._decodeStr(input,tag,options);else if(tag==="int"||tag==="enum")return this._decodeInt(input,state.args&&state.args[0],options);if(state.use!==null)return this._getUse(state.use,input._reporterState.obj)._decode(input,options);else return input.error("unknown tag: "+tag)},Node.prototype._getUse=function(entity,obj){var state=this._baseState;if(state.useDecoder=this._use(entity,obj),assert(state.useDecoder._baseState.parent===null),state.useDecoder=state.useDecoder._baseState.children[0],state.implicit!==state.useDecoder._baseState.implicit)state.useDecoder=state.useDecoder.clone(),state.useDecoder._baseState.implicit=state.implicit;return state.useDecoder},Node.prototype._decodeChoice=function(input,options){var state=this._baseState,result=null,match=!1;if(Object.keys(state.choice).some(function(key){var save=input.save(),node=state.choice[key];try{var value=node._decode(input,options);if(input.isError(value))return!1;result={type:key,value},match=!0}catch(e){return input.restore(save),!1}return!0},this),!match)return input.error("Choice not matched");return result},Node.prototype._createEncoderBuffer=function(data){return new EncoderBuffer(data,this.reporter)},Node.prototype._encode=function(data,reporter,parent){var state=this._baseState;if(state.default!==null&&state.default===data)return;var result=this._encodeValue(data,reporter,parent);if(result===void 0)return;if(this._skipDefault(result,reporter,parent))return;return result},Node.prototype._encodeValue=function(data,reporter,parent){var state=this._baseState;if(state.parent===null)return state.children[0]._encode(data,reporter||new Reporter);var result=null;if(this.reporter=reporter,state.optional&&data===void 0)if(state.default!==null)data=state.default;else return;var content=null,primitive=!1;if(state.any)result=this._createEncoderBuffer(data);else if(state.choice)result=this._encodeChoice(data,reporter);else if(state.contains)content=this._getUse(state.contains,parent)._encode(data,reporter),primitive=!0;else if(state.children)content=state.children.map(function(child2){if(child2._baseState.tag==="null_")return child2._encode(null,reporter,data);if(child2._baseState.key===null)return reporter.error("Child should have a key");var prevKey=reporter.enterKey(child2._baseState.key);if(typeof data!=="object")return reporter.error("Child expected, but input is not object");var res=child2._encode(data[child2._baseState.key],reporter,data);return reporter.leaveKey(prevKey),res},this).filter(function(child2){return child2}),content=this._createEncoderBuffer(content);else if(state.tag==="seqof"||state.tag==="setof"){if(!(state.args&&state.args.length===1))return reporter.error("Too many args for : "+state.tag);if(!Array.isArray(data))return reporter.error("seqof/setof, but data is not Array");var child=this.clone();child._baseState.implicit=null,content=this._createEncoderBuffer(data.map(function(item){var state2=this._baseState;return this._getUse(state2.args[0],data)._encode(item,reporter)},child))}else if(state.use!==null)result=this._getUse(state.use,parent)._encode(data,reporter);else content=this._encodePrimitive(state.tag,data),primitive=!0;var result;if(!state.any&&state.choice===null){var tag=state.implicit!==null?state.implicit:state.tag,cls=state.implicit===null?"universal":"context";if(tag===null){if(state.use===null)reporter.error("Tag could be omitted only for .use()")}else if(state.use===null)result=this._encodeComposite(tag,primitive,cls,content)}if(state.explicit!==null)result=this._encodeComposite(state.explicit,!1,"context",result);return result},Node.prototype._encodeChoice=function(data,reporter){var state=this._baseState,node=state.choice[data.type];if(!node)assert(!1,data.type+" not found in "+JSON.stringify(Object.keys(state.choice)));return node._encode(data.value,reporter)},Node.prototype._encodePrimitive=function(tag,data){var state=this._baseState;if(/str$/.test(tag))return this._encodeStr(data,tag);else if(tag==="objid"&&state.args)return this._encodeObjid(data,state.reverseArgs[0],state.args[1]);else if(tag==="objid")return this._encodeObjid(data,null,null);else if(tag==="gentime"||tag==="utctime")return this._encodeTime(data,tag);else if(tag==="null_")return this._encodeNull();else if(tag==="int"||tag==="enum")return this._encodeInt(data,state.args&&state.reverseArgs[0]);else if(tag==="bool")return this._encodeBool(data);else if(tag==="objDesc")return this._encodeStr(data,tag);else throw Error("Unsupported tag: "+tag)},Node.prototype._isNumstr=function(str){return/^[0-9 ]*$/.test(str)},Node.prototype._isPrintstr=function(str){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str)}}),require_base2=__commonJS2((exports)=>{var base=exports;base.Reporter=require_reporter().Reporter,base.DecoderBuffer=require_buffer().DecoderBuffer,base.EncoderBuffer=require_buffer().EncoderBuffer,base.Node=require_node()}),require_der=__commonJS2((exports)=>{var constants2=require_constants();exports.tagClass={0:"universal",1:"application",2:"context",3:"private"},exports.tagClassByName=constants2._reverse(exports.tagClass),exports.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},exports.tagByName=constants2._reverse(exports.tag)}),require_constants=__commonJS2((exports)=>{var constants2=exports;constants2._reverse=function(map){var res={};return Object.keys(map).forEach(function(key){if((key|0)==key)key=key|0;var value=map[key];res[value]=key}),res},constants2.der=require_der()}),require_der2=__commonJS2((exports,module)=>{var inherits2=require_inherits(),asn1=require_asn1(),base=asn1.base,bignum=asn1.bignum,der=asn1.constants.der;function DERDecoder(entity){this.enc="der",this.name=entity.name,this.entity=entity,this.tree=new DERNode,this.tree._init(entity.body)}module.exports=DERDecoder,DERDecoder.prototype.decode=function(data,options){if(!(data instanceof base.DecoderBuffer))data=new base.DecoderBuffer(data,options);return this.tree._decode(data,options)};function DERNode(parent){base.Node.call(this,"der",parent)}inherits2(DERNode,base.Node),DERNode.prototype._peekTag=function(buffer,tag,any){if(buffer.isEmpty())return!1;var state=buffer.save(),decodedTag=derDecodeTag(buffer,'Failed to peek tag: "'+tag+'"');if(buffer.isError(decodedTag))return decodedTag;return buffer.restore(state),decodedTag.tag===tag||decodedTag.tagStr===tag||decodedTag.tagStr+"of"===tag||any},DERNode.prototype._decodeTag=function(buffer,tag,any){var decodedTag=derDecodeTag(buffer,'Failed to decode tag of "'+tag+'"');if(buffer.isError(decodedTag))return decodedTag;var len2=derDecodeLen(buffer,decodedTag.primitive,'Failed to get length of "'+tag+'"');if(buffer.isError(len2))return len2;if(!any&&decodedTag.tag!==tag&&decodedTag.tagStr!==tag&&decodedTag.tagStr+"of"!==tag)return buffer.error('Failed to match tag: "'+tag+'"');if(decodedTag.primitive||len2!==null)return buffer.skip(len2,'Failed to match body of: "'+tag+'"');var state=buffer.save(),res=this._skipUntilEnd(buffer,'Failed to skip indefinite length body: "'+this.tag+'"');if(buffer.isError(res))return res;return len2=buffer.offset-state.offset,buffer.restore(state),buffer.skip(len2,'Failed to match body of: "'+tag+'"')},DERNode.prototype._skipUntilEnd=function(buffer,fail){while(!0){var tag=derDecodeTag(buffer,fail);if(buffer.isError(tag))return tag;var len2=derDecodeLen(buffer,tag.primitive,fail);if(buffer.isError(len2))return len2;var res;if(tag.primitive||len2!==null)res=buffer.skip(len2);else res=this._skipUntilEnd(buffer,fail);if(buffer.isError(res))return res;if(tag.tagStr==="end")break}},DERNode.prototype._decodeList=function(buffer,tag,decoder,options){var result=[];while(!buffer.isEmpty()){var possibleEnd=this._peekTag(buffer,"end");if(buffer.isError(possibleEnd))return possibleEnd;var res=decoder.decode(buffer,"der",options);if(buffer.isError(res)&&possibleEnd)break;result.push(res)}return result},DERNode.prototype._decodeStr=function(buffer,tag){if(tag==="bitstr"){var unused=buffer.readUInt8();if(buffer.isError(unused))return unused;return{unused,data:buffer.raw()}}else if(tag==="bmpstr"){var raw=buffer.raw();if(raw.length%2===1)return buffer.error("Decoding of string type: bmpstr length mismatch");var str="";for(var i2=0;i2<raw.length/2;i2++)str+=String.fromCharCode(raw.readUInt16BE(i2*2));return str}else if(tag==="numstr"){var numstr=buffer.raw().toString("ascii");if(!this._isNumstr(numstr))return buffer.error("Decoding of string type: numstr unsupported characters");return numstr}else if(tag==="octstr")return buffer.raw();else if(tag==="objDesc")return buffer.raw();else if(tag==="printstr"){var printstr=buffer.raw().toString("ascii");if(!this._isPrintstr(printstr))return buffer.error("Decoding of string type: printstr unsupported characters");return printstr}else if(/str$/.test(tag))return buffer.raw().toString();else return buffer.error("Decoding of string type: "+tag+" unsupported")},DERNode.prototype._decodeObjid=function(buffer,values,relative){var result,identifiers=[],ident=0;while(!buffer.isEmpty()){var subident=buffer.readUInt8();if(ident<<=7,ident|=subident&127,(subident&128)===0)identifiers.push(ident),ident=0}if(subident&128)identifiers.push(ident);var first=identifiers[0]/40|0,second=identifiers[0]%40;if(relative)result=identifiers;else result=[first,second].concat(identifiers.slice(1));if(values){var tmp=values[result.join(" ")];if(tmp===void 0)tmp=values[result.join(".")];if(tmp!==void 0)result=tmp}return result},DERNode.prototype._decodeTime=function(buffer,tag){var str=buffer.raw().toString();if(tag==="gentime")var year=str.slice(0,4)|0,mon=str.slice(4,6)|0,day=str.slice(6,8)|0,hour=str.slice(8,10)|0,min=str.slice(10,12)|0,sec=str.slice(12,14)|0;else if(tag==="utctime"){var year=str.slice(0,2)|0,mon=str.slice(2,4)|0,day=str.slice(4,6)|0,hour=str.slice(6,8)|0,min=str.slice(8,10)|0,sec=str.slice(10,12)|0;if(year<70)year=2000+year;else year=1900+year}else return buffer.error("Decoding "+tag+" time is not supported yet");return Date.UTC(year,mon-1,day,hour,min,sec,0)},DERNode.prototype._decodeNull=function(buffer){return null},DERNode.prototype._decodeBool=function(buffer){var res=buffer.readUInt8();if(buffer.isError(res))return res;else return res!==0},DERNode.prototype._decodeInt=function(buffer,values){var raw=buffer.raw(),res=new bignum(raw);if(values)res=values[res.toString(10)]||res;return res},DERNode.prototype._use=function(entity,obj){if(typeof entity==="function")entity=entity(obj);return entity._getDecoder("der").tree};function derDecodeTag(buf,fail){var tag=buf.readUInt8(fail);if(buf.isError(tag))return tag;var cls=der.tagClass[tag>>6],primitive=(tag&32)===0;if((tag&31)===31){var oct=tag;tag=0;while((oct&128)===128){if(oct=buf.readUInt8(fail),buf.isError(oct))return oct;tag<<=7,tag|=oct&127}}else tag&=31;var tagStr=der.tag[tag];return{cls,primitive,tag,tagStr}}function derDecodeLen(buf,primitive,fail){var len2=buf.readUInt8(fail);if(buf.isError(len2))return len2;if(!primitive&&len2===128)return null;if((len2&128)===0)return len2;var num=len2&127;if(num>4)return buf.error("length octect is too long");len2=0;for(var i2=0;i2<num;i2++){len2<<=8;var j=buf.readUInt8(fail);if(buf.isError(j))return j;len2|=j}return len2}}),require_pem=__commonJS2((exports,module)=>{var inherits2=require_inherits(),Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer,DERDecoder=require_der2();function PEMDecoder(entity){DERDecoder.call(this,entity),this.enc="pem"}inherits2(PEMDecoder,DERDecoder),module.exports=PEMDecoder,PEMDecoder.prototype.decode=function(data,options){var lines=data.toString().split(/[\r\n]+/g),label=options.label.toUpperCase(),re=/^-----(BEGIN|END) ([^-]+)-----$/,start=-1,end=-1;for(var i2=0;i2<lines.length;i2++){var match=lines[i2].match(re);if(match===null)continue;if(match[2]!==label)continue;if(start===-1){if(match[1]!=="BEGIN")break;start=i2}else{if(match[1]!=="END")break;end=i2;break}}if(start===-1||end===-1)throw Error("PEM section not found for: "+label);var base64=lines.slice(start+1,end).join("");base64.replace(/[^a-z0-9\+\/=]+/gi,"");var input=new Buffer22(base64,"base64");return DERDecoder.prototype.decode.call(this,input,options)}}),require_decoders=__commonJS2((exports)=>{var decoders=exports;decoders.der=require_der2(),decoders.pem=require_pem()}),require_der3=__commonJS2((exports,module)=>{var inherits2=require_inherits(),Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer,asn1=require_asn1(),base=asn1.base,der=asn1.constants.der;function DEREncoder(entity){this.enc="der",this.name=entity.name,this.entity=entity,this.tree=new DERNode,this.tree._init(entity.body)}module.exports=DEREncoder,DEREncoder.prototype.encode=function(data,reporter){return this.tree._encode(data,reporter).join()};function DERNode(parent){base.Node.call(this,"der",parent)}inherits2(DERNode,base.Node),DERNode.prototype._encodeComposite=function(tag,primitive,cls,content){var encodedTag=encodeTag(tag,primitive,cls,this.reporter);if(content.length<128){var header=new Buffer22(2);return header[0]=encodedTag,header[1]=content.length,this._createEncoderBuffer([header,content])}var lenOctets=1;for(var i2=content.length;i2>=256;i2>>=8)lenOctets++;var header=new Buffer22(2+lenOctets);header[0]=encodedTag,header[1]=128|lenOctets;for(var i2=1+lenOctets,j=content.length;j>0;i2--,j>>=8)header[i2]=j&255;return this._createEncoderBuffer([header,content])},DERNode.prototype._encodeStr=function(str,tag){if(tag==="bitstr")return this._createEncoderBuffer([str.unused|0,str.data]);else if(tag==="bmpstr"){var buf=new Buffer22(str.length*2);for(var i2=0;i2<str.length;i2++)buf.writeUInt16BE(str.charCodeAt(i2),i2*2);return this._createEncoderBuffer(buf)}else if(tag==="numstr"){if(!this._isNumstr(str))return this.reporter.error("Encoding of string type: numstr supports only digits and space");return this._createEncoderBuffer(str)}else if(tag==="printstr"){if(!this._isPrintstr(str))return this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark");return this._createEncoderBuffer(str)}else if(/str$/.test(tag))return this._createEncoderBuffer(str);else if(tag==="objDesc")return this._createEncoderBuffer(str);else return this.reporter.error("Encoding of string type: "+tag+" unsupported")},DERNode.prototype._encodeObjid=function(id,values,relative){if(typeof id==="string"){if(!values)return this.reporter.error("string objid given, but no values map found");if(!values.hasOwnProperty(id))return this.reporter.error("objid not found in values map");id=values[id].split(/[\s\.]+/g);for(var i2=0;i2<id.length;i2++)id[i2]|=0}else if(Array.isArray(id)){id=id.slice();for(var i2=0;i2<id.length;i2++)id[i2]|=0}if(!Array.isArray(id))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(id));if(!relative){if(id[1]>=40)return this.reporter.error("Second objid identifier OOB");id.splice(0,2,id[0]*40+id[1])}var size=0;for(var i2=0;i2<id.length;i2++){var ident=id[i2];for(size++;ident>=128;ident>>=7)size++}var objid=new Buffer22(size),offset=objid.length-1;for(var i2=id.length-1;i2>=0;i2--){var ident=id[i2];objid[offset--]=ident&127;while((ident>>=7)>0)objid[offset--]=128|ident&127}return this._createEncoderBuffer(objid)};function two(num){if(num<10)return"0"+num;else return num}DERNode.prototype._encodeTime=function(time,tag){var str,date=new Date(time);if(tag==="gentime")str=[two(date.getFullYear()),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),"Z"].join("");else if(tag==="utctime")str=[two(date.getFullYear()%100),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),"Z"].join("");else this.reporter.error("Encoding "+tag+" time is not supported yet");return this._encodeStr(str,"octstr")},DERNode.prototype._encodeNull=function(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function(num,values){if(typeof num==="string"){if(!values)return this.reporter.error("String int or enum given, but no values map");if(!values.hasOwnProperty(num))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(num));num=values[num]}if(typeof num!=="number"&&!Buffer22.isBuffer(num)){var numArray=num.toArray();if(!num.sign&&numArray[0]&128)numArray.unshift(0);num=new Buffer22(numArray)}if(Buffer22.isBuffer(num)){var size=num.length;if(num.length===0)size++;var out=new Buffer22(size);if(num.copy(out),num.length===0)out[0]=0;return this._createEncoderBuffer(out)}if(num<128)return this._createEncoderBuffer(num);if(num<256)return this._createEncoderBuffer([0,num]);var size=1;for(var i2=num;i2>=256;i2>>=8)size++;var out=Array(size);for(var i2=out.length-1;i2>=0;i2--)out[i2]=num&255,num>>=8;if(out[0]&128)out.unshift(0);return this._createEncoderBuffer(new Buffer22(out))},DERNode.prototype._encodeBool=function(value){return this._createEncoderBuffer(value?255:0)},DERNode.prototype._use=function(entity,obj){if(typeof entity==="function")entity=entity(obj);return entity._getEncoder("der").tree},DERNode.prototype._skipDefault=function(dataBuffer,reporter,parent){var state=this._baseState,i2;if(state.default===null)return!1;var data=dataBuffer.join();if(state.defaultBuffer===void 0)state.defaultBuffer=this._encodeValue(state.default,reporter,parent).join();if(data.length!==state.defaultBuffer.length)return!1;for(i2=0;i2<data.length;i2++)if(data[i2]!==state.defaultBuffer[i2])return!1;return!0};function encodeTag(tag,primitive,cls,reporter){var res;if(tag==="seqof")tag="seq";else if(tag==="setof")tag="set";if(der.tagByName.hasOwnProperty(tag))res=der.tagByName[tag];else if(typeof tag==="number"&&(tag|0)===tag)res=tag;else return reporter.error("Unknown tag: "+tag);if(res>=31)return reporter.error("Multi-octet tag encoding unsupported");if(!primitive)res|=32;return res|=der.tagClassByName[cls||"universal"]<<6,res}}),require_pem2=__commonJS2((exports,module)=>{var inherits2=require_inherits(),DEREncoder=require_der3();function PEMEncoder(entity){DEREncoder.call(this,entity),this.enc="pem"}inherits2(PEMEncoder,DEREncoder),module.exports=PEMEncoder,PEMEncoder.prototype.encode=function(data,options){var buf=DEREncoder.prototype.encode.call(this,data),p=buf.toString("base64"),out=["-----BEGIN "+options.label+"-----"];for(var i2=0;i2<p.length;i2+=64)out.push(p.slice(i2,i2+64));return out.push("-----END "+options.label+"-----"),out.join(`
14
+ `)}}),require_encoders=__commonJS2((exports)=>{var encoders=exports;encoders.der=require_der3(),encoders.pem=require_pem2()}),require_asn1=__commonJS2((exports)=>{var asn1=exports;asn1.bignum=require_bn3(),asn1.define=require_api().define,asn1.base=require_base2(),asn1.constants=require_constants(),asn1.decoders=require_decoders(),asn1.encoders=require_encoders()}),require_certificate=__commonJS2((exports,module)=>{var asn=require_asn1(),Time=asn.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),AttributeTypeValue=asn.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),AlgorithmIdentifier=asn.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),SubjectPublicKeyInfo=asn.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())}),RelativeDistinguishedName=asn.define("RelativeDistinguishedName",function(){this.setof(AttributeTypeValue)}),RDNSequence=asn.define("RDNSequence",function(){this.seqof(RelativeDistinguishedName)}),Name=asn.define("Name",function(){this.choice({rdnSequence:this.use(RDNSequence)})}),Validity=asn.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Time),this.key("notAfter").use(Time))}),Extension=asn.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),TBSCertificate=asn.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(AlgorithmIdentifier),this.key("issuer").use(Name),this.key("validity").use(Validity),this.key("subject").use(Name),this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Extension).optional())}),X509Certificate=asn.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(TBSCertificate),this.key("signatureAlgorithm").use(AlgorithmIdentifier),this.key("signatureValue").bitstr())});module.exports=X509Certificate}),require_asn12=__commonJS2((exports)=>{var asn1=require_asn1();exports.certificate=require_certificate();var RSAPrivateKey=asn1.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});exports.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=asn1.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});exports.RSAPublicKey=RSAPublicKey;var AlgorithmIdentifier=asn1.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),PublicKey=asn1.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())});exports.PublicKey=PublicKey;var PrivateKeyInfo=asn1.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPrivateKey").octstr())});exports.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=asn1.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});exports.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=asn1.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});exports.DSAPrivateKey=DSAPrivateKey,exports.DSAparam=asn1.define("DSAparam",function(){this.int()});var ECParameters=asn1.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),ECPrivateKey=asn1.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(ECParameters),this.key("publicKey").optional().explicit(1).bitstr())});exports.ECPrivateKey=ECPrivateKey,exports.signature=asn1.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})}),require_aesid=__commonJS2((exports,module)=>{module.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}}),require_hash_base=__commonJS2((exports,module)=>{var Buffer22=require_safe_buffer().Buffer,Transform=require_stream().Transform,inherits2=require_inherits();function HashBase(blockSize){Transform.call(this),this._block=Buffer22.allocUnsafe(blockSize),this._blockSize=blockSize,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits2(HashBase,Transform),HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{this.update(chunk,encoding)}catch(err){error=err}callback(error)},HashBase.prototype._flush=function(callback){var error=null;try{this.push(this.digest())}catch(err){error=err}callback(error)};var useUint8Array=typeof Uint8Array<"u",useArrayBuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(Buffer22.prototype instanceof Uint8Array||Buffer22.TYPED_ARRAY_SUPPORT);function toBuffer(data,encoding){if(data instanceof Buffer22)return data;if(typeof data==="string")return Buffer22.from(data,encoding);if(useArrayBuffer&&ArrayBuffer.isView(data)){if(data.byteLength===0)return Buffer22.alloc(0);var res=Buffer22.from(data.buffer,data.byteOffset,data.byteLength);if(res.byteLength===data.byteLength)return res}if(useUint8Array&&data instanceof Uint8Array)return Buffer22.from(data);if(Buffer22.isBuffer(data)&&data.constructor&&typeof data.constructor.isBuffer==="function"&&data.constructor.isBuffer(data))return Buffer22.from(data);throw TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}HashBase.prototype.update=function(data,encoding){if(this._finalized)throw Error("Digest already called");data=toBuffer(data,encoding);var block=this._block,offset=0;while(this._blockOffset+data.length-offset>=this._blockSize){for(var i2=this._blockOffset;i2<this._blockSize;)block[i2++]=data[offset++];this._update(),this._blockOffset=0}while(offset<data.length)block[this._blockOffset++]=data[offset++];for(var j=0,carry=data.length*8;carry>0;++j)if(this._length[j]+=carry,carry=this._length[j]/4294967296|0,carry>0)this._length[j]-=4294967296*carry;return this},HashBase.prototype._update=function(){throw Error("_update is not implemented")},HashBase.prototype.digest=function(encoding){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var digest=this._digest();if(encoding!==void 0)digest=digest.toString(encoding);this._block.fill(0),this._blockOffset=0;for(var i2=0;i2<4;++i2)this._length[i2]=0;return digest},HashBase.prototype._digest=function(){throw Error("_digest is not implemented")},module.exports=HashBase}),require_md5=__commonJS2((exports,module)=>{var inherits2=require_inherits(),HashBase=require_hash_base(),Buffer22=require_safe_buffer().Buffer,ARRAY16=Array(16);function MD5(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}inherits2(MD5,HashBase),MD5.prototype._update=function(){var M=ARRAY16;for(var i2=0;i2<16;++i2)M[i2]=this._block.readInt32LE(i2*4);var a=this._a,b=this._b,c=this._c,d=this._d;a=fnF(a,b,c,d,M[0],3614090360,7),d=fnF(d,a,b,c,M[1],3905402710,12),c=fnF(c,d,a,b,M[2],606105819,17),b=fnF(b,c,d,a,M[3],3250441966,22),a=fnF(a,b,c,d,M[4],4118548399,7),d=fnF(d,a,b,c,M[5],1200080426,12),c=fnF(c,d,a,b,M[6],2821735955,17),b=fnF(b,c,d,a,M[7],4249261313,22),a=fnF(a,b,c,d,M[8],1770035416,7),d=fnF(d,a,b,c,M[9],2336552879,12),c=fnF(c,d,a,b,M[10],4294925233,17),b=fnF(b,c,d,a,M[11],2304563134,22),a=fnF(a,b,c,d,M[12],1804603682,7),d=fnF(d,a,b,c,M[13],4254626195,12),c=fnF(c,d,a,b,M[14],2792965006,17),b=fnF(b,c,d,a,M[15],1236535329,22),a=fnG(a,b,c,d,M[1],4129170786,5),d=fnG(d,a,b,c,M[6],3225465664,9),c=fnG(c,d,a,b,M[11],643717713,14),b=fnG(b,c,d,a,M[0],3921069994,20),a=fnG(a,b,c,d,M[5],3593408605,5),d=fnG(d,a,b,c,M[10],38016083,9),c=fnG(c,d,a,b,M[15],3634488961,14),b=fnG(b,c,d,a,M[4],3889429448,20),a=fnG(a,b,c,d,M[9],568446438,5),d=fnG(d,a,b,c,M[14],3275163606,9),c=fnG(c,d,a,b,M[3],4107603335,14),b=fnG(b,c,d,a,M[8],1163531501,20),a=fnG(a,b,c,d,M[13],2850285829,5),d=fnG(d,a,b,c,M[2],4243563512,9),c=fnG(c,d,a,b,M[7],1735328473,14),b=fnG(b,c,d,a,M[12],2368359562,20),a=fnH(a,b,c,d,M[5],4294588738,4),d=fnH(d,a,b,c,M[8],2272392833,11),c=fnH(c,d,a,b,M[11],1839030562,16),b=fnH(b,c,d,a,M[14],4259657740,23),a=fnH(a,b,c,d,M[1],2763975236,4),d=fnH(d,a,b,c,M[4],1272893353,11),c=fnH(c,d,a,b,M[7],4139469664,16),b=fnH(b,c,d,a,M[10],3200236656,23),a=fnH(a,b,c,d,M[13],681279174,4),d=fnH(d,a,b,c,M[0],3936430074,11),c=fnH(c,d,a,b,M[3],3572445317,16),b=fnH(b,c,d,a,M[6],76029189,23),a=fnH(a,b,c,d,M[9],3654602809,4),d=fnH(d,a,b,c,M[12],3873151461,11),c=fnH(c,d,a,b,M[15],530742520,16),b=fnH(b,c,d,a,M[2],3299628645,23),a=fnI(a,b,c,d,M[0],4096336452,6),d=fnI(d,a,b,c,M[7],1126891415,10),c=fnI(c,d,a,b,M[14],2878612391,15),b=fnI(b,c,d,a,M[5],4237533241,21),a=fnI(a,b,c,d,M[12],1700485571,6),d=fnI(d,a,b,c,M[3],2399980690,10),c=fnI(c,d,a,b,M[10],4293915773,15),b=fnI(b,c,d,a,M[1],2240044497,21),a=fnI(a,b,c,d,M[8],1873313359,6),d=fnI(d,a,b,c,M[15],4264355552,10),c=fnI(c,d,a,b,M[6],2734768916,15),b=fnI(b,c,d,a,M[13],1309151649,21),a=fnI(a,b,c,d,M[4],4149444226,6),d=fnI(d,a,b,c,M[11],3174756917,10),c=fnI(c,d,a,b,M[2],718787259,15),b=fnI(b,c,d,a,M[9],3951481745,21),this._a=this._a+a|0,this._b=this._b+b|0,this._c=this._c+c|0,this._d=this._d+d|0},MD5.prototype._digest=function(){if(this._block[this._blockOffset++]=128,this._blockOffset>56)this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0;this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var buffer=Buffer22.allocUnsafe(16);return buffer.writeInt32LE(this._a,0),buffer.writeInt32LE(this._b,4),buffer.writeInt32LE(this._c,8),buffer.writeInt32LE(this._d,12),buffer};function rotl(x,n){return x<<n|x>>>32-n}function fnF(a,b,c,d,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+b|0}function fnG(a,b,c,d,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+b|0}function fnH(a,b,c,d,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+b|0}function fnI(a,b,c,d,m,k,s){return rotl(a+(c^(b|~d))+m+k|0,s)+b|0}module.exports=MD5}),require_evp_bytestokey=__commonJS2((exports,module)=>{var Buffer22=require_safe_buffer().Buffer,MD5=require_md5();function EVP_BytesToKey(password,salt,keyBits,ivLen){if(!Buffer22.isBuffer(password))password=Buffer22.from(password,"binary");if(salt){if(!Buffer22.isBuffer(salt))salt=Buffer22.from(salt,"binary");if(salt.length!==8)throw RangeError("salt should be Buffer with 8 byte length")}var keyLen=keyBits/8,key=Buffer22.alloc(keyLen),iv=Buffer22.alloc(ivLen||0),tmp=Buffer22.alloc(0);while(keyLen>0||ivLen>0){var hash=new MD5;if(hash.update(tmp),hash.update(password),salt)hash.update(salt);tmp=hash.digest();var used=0;if(keyLen>0){var keyStart=key.length-keyLen;used=Math.min(keyLen,tmp.length),tmp.copy(key,keyStart,0,used),keyLen-=used}if(used<tmp.length&&ivLen>0){var ivStart=iv.length-ivLen,length=Math.min(ivLen,tmp.length-used);tmp.copy(iv,ivStart,used,used+length),ivLen-=length}}return tmp.fill(0),{key,iv}}module.exports=EVP_BytesToKey}),require_browserify_aes=__commonJS2((exports)=>{var crypto2=(init_crypto(),__toCommonJS(exports_crypto));exports.createCipher=exports.Cipher=crypto2.createCipher,exports.createCipheriv=exports.Cipheriv=crypto2.createCipheriv,exports.createDecipher=exports.Decipher=crypto2.createDecipher,exports.createDecipheriv=exports.Decipheriv=crypto2.createDecipheriv,exports.listCiphers=exports.getCiphers=crypto2.getCiphers}),require_fixProc=__commonJS2((exports,module)=>{var findProc=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,evp=require_evp_bytestokey(),ciphers=require_browserify_aes(),Buffer22=require_safe_buffer().Buffer;module.exports=function(okey,password){var key=okey.toString(),match=key.match(findProc),decrypted;if(!match){var match2=key.match(fullRegex);decrypted=Buffer22.from(match2[2].replace(/[\r\n]/g,""),"base64")}else{var suite="aes"+match[1],iv=Buffer22.from(match[2],"hex"),cipherText=Buffer22.from(match[3].replace(/[\r\n]/g,""),"base64"),cipherKey=evp(password,iv.slice(0,8),parseInt(match[1],10)).key,out=[],cipher=ciphers.createDecipheriv(suite,cipherKey,iv);out.push(cipher.update(cipherText)),out.push(cipher.final()),decrypted=Buffer22.concat(out)}var tag=key.match(startRegex)[1];return{tag,data:decrypted}}}),require_parse_asn1=__commonJS2((exports,module)=>{var asn1=require_asn12(),aesid=require_aesid(),fixProc=require_fixProc(),ciphers=require_browserify_aes(),pbkdf2Sync=require_pbkdf2().pbkdf2Sync,Buffer22=require_safe_buffer().Buffer;function decrypt(data,password){var salt=data.algorithm.decrypt.kde.kdeparams.salt,iters=parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(),10),algo=aesid[data.algorithm.decrypt.cipher.algo.join(".")],iv=data.algorithm.decrypt.cipher.iv,cipherText=data.subjectPrivateKey,keylen=parseInt(algo.split("-")[1],10)/8,key=pbkdf2Sync(password,salt,iters,keylen,"sha1"),cipher=ciphers.createDecipheriv(algo,key,iv),out=[];return out.push(cipher.update(cipherText)),out.push(cipher.final()),Buffer22.concat(out)}function parseKeys(buffer){var password;if(typeof buffer==="object"&&!Buffer22.isBuffer(buffer))password=buffer.passphrase,buffer=buffer.key;if(typeof buffer==="string")buffer=Buffer22.from(buffer);var stripped=fixProc(buffer,password),type=stripped.tag,data=stripped.data,subtype,ndata;switch(type){case"CERTIFICATE":ndata=asn1.certificate.decode(data,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":if(!ndata)ndata=asn1.PublicKey.decode(data,"der");switch(subtype=ndata.algorithm.algorithm.join("."),subtype){case"1.2.840.113549.1.1.1":return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return ndata.subjectPrivateKey=ndata.subjectPublicKey,{type:"ec",data:ndata};case"1.2.840.10040.4.1":return ndata.algorithm.params.pub_key=asn1.DSAparam.decode(ndata.subjectPublicKey.data,"der"),{type:"dsa",data:ndata.algorithm.params};default:throw Error("unknown key id "+subtype)}case"ENCRYPTED PRIVATE KEY":data=asn1.EncryptedPrivateKey.decode(data,"der"),data=decrypt(data,password);case"PRIVATE KEY":switch(ndata=asn1.PrivateKey.decode(data,"der"),subtype=ndata.algorithm.algorithm.join("."),subtype){case"1.2.840.113549.1.1.1":return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:ndata.algorithm.curve,privateKey:asn1.ECPrivateKey.decode(ndata.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return ndata.algorithm.params.priv_key=asn1.DSAparam.decode(ndata.subjectPrivateKey,"der"),{type:"dsa",params:ndata.algorithm.params};default:throw Error("unknown key id "+subtype)}case"RSA PUBLIC KEY":return asn1.RSAPublicKey.decode(data,"der");case"RSA PRIVATE KEY":return asn1.RSAPrivateKey.decode(data,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:asn1.DSAPrivateKey.decode(data,"der")};case"EC PRIVATE KEY":return data=asn1.ECPrivateKey.decode(data,"der"),{curve:data.parameters.value,privateKey:data.privateKey};default:throw Error("unknown key type "+type)}}parseKeys.signature=asn1.signature,module.exports=parseKeys}),require_mgf=__commonJS2((exports,module)=>{var createHash=require_create_hash(),Buffer22=require_safe_buffer().Buffer;module.exports=function(seed,len2){var t=Buffer22.alloc(0),i2=0,c;while(t.length<len2)c=i2ops(i2++),t=Buffer22.concat([t,createHash("sha1").update(seed).update(c).digest()]);return t.slice(0,len2)};function i2ops(c){var out=Buffer22.allocUnsafe(4);return out.writeUInt32BE(c,0),out}}),require_xor=__commonJS2((exports,module)=>{module.exports=function(a,b){var len2=a.length,i2=-1;while(++i2<len2)a[i2]^=b[i2];return a}}),require_bn4=__commonJS2((exports,module)=>{(function(module2,exports2){function assert(val,msg){if(!val)throw Error(msg||"Assertion failed")}function inherits2(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}function BN(number,base,endian){if(BN.isBN(number))return number;if(this.negative=0,this.words=null,this.length=0,this.red=null,number!==null){if(base==="le"||base==="be")endian=base,base=10;this._init(number||0,base||10,endian||"be")}}if(typeof module2==="object")module2.exports=BN;else exports2.BN=BN;BN.BN=BN,BN.wordSize=26;var Buffer22;try{if(typeof window<"u"&&typeof window.Buffer<"u")Buffer22=window.Buffer;else Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer}catch(e){}BN.isBN=function(num){if(num instanceof BN)return!0;return num!==null&&typeof num==="object"&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)},BN.max=function(left,right){if(left.cmp(right)>0)return left;return right},BN.min=function(left,right){if(left.cmp(right)<0)return left;return right},BN.prototype._init=function(number,base,endian){if(typeof number==="number")return this._initNumber(number,base,endian);if(typeof number==="object")return this._initArray(number,base,endian);if(base==="hex")base=16;assert(base===(base|0)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,"");var start=0;if(number[0]==="-")start++,this.negative=1;if(start<number.length){if(base===16)this._parseHex(number,start,endian);else if(this._parseBase(number,base,start),endian==="le")this._initArray(this.toArray(),base,endian)}},BN.prototype._initNumber=function(number,base,endian){if(number<0)this.negative=1,number=-number;if(number<67108864)this.words=[number&67108863],this.length=1;else if(number<4503599627370496)this.words=[number&67108863,number/67108864&67108863],this.length=2;else assert(number<9007199254740992),this.words=[number&67108863,number/67108864&67108863,1],this.length=3;if(endian!=="le")return;this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert(typeof number.length==="number"),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var j,w,off=0;if(endian==="be"){for(i2=number.length-1,j=0;i2>=0;i2-=3)if(w=number[i2]|number[i2-1]<<8|number[i2-2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}else if(endian==="le"){for(i2=0,j=0;i2<number.length;i2+=3)if(w=number[i2]|number[i2+1]<<8|number[i2+2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}return this.strip()};function parseHex4Bits(string,index){var c=string.charCodeAt(index);if(c>=65&&c<=70)return c-55;else if(c>=97&&c<=102)return c-87;else return c-48&15}function parseHexByte(string,lowerBound,index){var r=parseHex4Bits(string,index);if(index-1>=lowerBound)r|=parseHex4Bits(string,index-1)<<4;return r}BN.prototype._parseHex=function(number,start,endian){this.length=Math.ceil((number.length-start)/6),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var off=0,j=0,w;if(endian==="be")for(i2=number.length-1;i2>=start;i2-=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8;else{var parseLength=number.length-start;for(i2=parseLength%2===0?start+1:start;i2<number.length;i2+=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8}this.strip()};function parseBase(str,start,end,mul){var r=0,len2=Math.min(str.length,end);for(var i2=start;i2<len2;i2++){var c=str.charCodeAt(i2)-48;if(r*=mul,c>=49)r+=c-49+10;else if(c>=17)r+=c-17+10;else r+=c}return r}BN.prototype._parseBase=function(number,base,start){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;var total=number.length-start,mod=total%limbLen,end=Math.min(total,total-mod)+start,word=0;for(var i2=start;i2<end;i2+=limbLen)if(word=parseBase(number,i2,i2+limbLen,base),this.imuln(limbPow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word);if(mod!==0){var pow=1;word=parseBase(number,i2,number.length,base);for(i2=0;i2<mod;i2++)pow*=base;if(this.imuln(pow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word)}this.strip()},BN.prototype.copy=function(dest){dest.words=Array(this.length);for(var i2=0;i2<this.length;i2++)dest.words[i2]=this.words[i2];dest.length=this.length,dest.negative=this.negative,dest.red=this.red},BN.prototype.clone=function(){var r=new BN(null);return this.copy(r),r},BN.prototype._expand=function(size){while(this.length<size)this.words[this.length++]=0;return this},BN.prototype.strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},BN.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},BN.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var zeros=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(BN.prototype.toString=function(base,padding){base=base||10,padding=padding|0||1;var out;if(base===16||base==="hex"){out="";var off=0,carry=0;for(var i2=0;i2<this.length;i2++){var w=this.words[i2],word=((w<<off|carry)&16777215).toString(16);if(carry=w>>>24-off&16777215,off+=2,off>=26)off-=26,i2--;if(carry!==0||i2!==this.length-1)out=zeros[6-word.length]+word+out;else out=word+out}if(carry!==0)out=carry.toString(16)+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base];out="";var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modn(groupBase).toString(base);if(c=c.idivn(groupBase),!c.isZero())out=zeros[groupSize-r.length]+r+out;else out=r+out}if(this.isZero())out="0"+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function(){var ret=this.words[0];if(this.length===2)ret+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)ret+=4503599627370496+this.words[1]*67108864;else if(this.length>2)assert(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-ret:ret},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toBuffer=function(endian,length){return assert(typeof Buffer22<"u"),this.toArrayLike(Buffer22,endian,length)},BN.prototype.toArray=function(endian,length){return this.toArrayLike(Array,endian,length)},BN.prototype.toArrayLike=function(ArrayType,endian,length){var byteLength2=this.byteLength(),reqLength=length||Math.max(1,byteLength2);assert(byteLength2<=reqLength,"byte array longer than desired length"),assert(reqLength>0,"Requested array length <= 0"),this.strip();var littleEndian=endian==="le",res=new ArrayType(reqLength),b,i2,q=this.clone();if(!littleEndian){for(i2=0;i2<reqLength-byteLength2;i2++)res[i2]=0;for(i2=0;!q.isZero();i2++)b=q.andln(255),q.iushrn(8),res[reqLength-i2-1]=b}else{for(i2=0;!q.isZero();i2++)b=q.andln(255),q.iushrn(8),res[i2]=b;for(;i2<reqLength;i2++)res[i2]=0}return res},Math.clz32)BN.prototype._countBits=function(w){return 32-Math.clz32(w)};else BN.prototype._countBits=function(w){var t=w,r=0;if(t>=4096)r+=13,t>>>=13;if(t>=64)r+=7,t>>>=7;if(t>=8)r+=4,t>>>=4;if(t>=2)r+=2,t>>>=2;return r+t};BN.prototype._zeroBits=function(w){if(w===0)return 26;var t=w,r=0;if((t&8191)===0)r+=13,t>>>=13;if((t&127)===0)r+=7,t>>>=7;if((t&15)===0)r+=4,t>>>=4;if((t&3)===0)r+=2,t>>>=2;if((t&1)===0)r++;return r},BN.prototype.bitLength=function(){var w=this.words[this.length-1],hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){var w=Array(num.bitLength());for(var bit=0;bit<w.length;bit++){var off=bit/26|0,wbit=bit%26;w[bit]=(num.words[off]&1<<wbit)>>>wbit}return w}BN.prototype.zeroBits=function(){if(this.isZero())return 0;var r=0;for(var i2=0;i2<this.length;i2++){var b=this._zeroBits(this.words[i2]);if(r+=b,b!==26)break}return r},BN.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function(width){if(this.negative!==0)return this.abs().inotn(width).iaddn(1);return this.clone()},BN.prototype.fromTwos=function(width){if(this.testn(width-1))return this.notn(width).iaddn(1).ineg();return this.clone()},BN.prototype.isNeg=function(){return this.negative!==0},BN.prototype.neg=function(){return this.clone().ineg()},BN.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},BN.prototype.iuor=function(num){while(this.length<num.length)this.words[this.length++]=0;for(var i2=0;i2<num.length;i2++)this.words[i2]=this.words[i2]|num.words[i2];return this.strip()},BN.prototype.ior=function(num){return assert((this.negative|num.negative)===0),this.iuor(num)},BN.prototype.or=function(num){if(this.length>num.length)return this.clone().ior(num);return num.clone().ior(this)},BN.prototype.uor=function(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this)},BN.prototype.iuand=function(num){var b;if(this.length>num.length)b=num;else b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=this.words[i2]&num.words[i2];return this.length=b.length,this.strip()},BN.prototype.iand=function(num){return assert((this.negative|num.negative)===0),this.iuand(num)},BN.prototype.and=function(num){if(this.length>num.length)return this.clone().iand(num);return num.clone().iand(this)},BN.prototype.uand=function(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this)},BN.prototype.iuxor=function(num){var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=a.words[i2]^b.words[i2];if(this!==a)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this.length=a.length,this.strip()},BN.prototype.ixor=function(num){return assert((this.negative|num.negative)===0),this.iuxor(num)},BN.prototype.xor=function(num){if(this.length>num.length)return this.clone().ixor(num);return num.clone().ixor(this)},BN.prototype.uxor=function(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this)},BN.prototype.inotn=function(width){assert(typeof width==="number"&&width>=0);var bytesNeeded=Math.ceil(width/26)|0,bitsLeft=width%26;if(this._expand(bytesNeeded),bitsLeft>0)bytesNeeded--;for(var i2=0;i2<bytesNeeded;i2++)this.words[i2]=~this.words[i2]&67108863;if(bitsLeft>0)this.words[i2]=~this.words[i2]&67108863>>26-bitsLeft;return this.strip()},BN.prototype.notn=function(width){return this.clone().inotn(width)},BN.prototype.setn=function(bit,val){assert(typeof bit==="number"&&bit>=0);var off=bit/26|0,wbit=bit%26;if(this._expand(off+1),val)this.words[off]=this.words[off]|1<<wbit;else this.words[off]=this.words[off]&~(1<<wbit);return this.strip()},BN.prototype.iadd=function(num){var r;if(this.negative!==0&&num.negative===0)return this.negative=0,r=this.isub(num),this.negative^=1,this._normSign();else if(this.negative===0&&num.negative!==0)return num.negative=0,r=this.isub(num),num.negative=1,r._normSign();var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)+(b.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;if(this.length=a.length,carry!==0)this.words[this.length]=carry,this.length++;else if(a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this},BN.prototype.add=function(num){var res;if(num.negative!==0&&this.negative===0)return num.negative=0,res=this.sub(num),num.negative^=1,res;else if(num.negative===0&&this.negative!==0)return this.negative=0,res=num.sub(this),this.negative=1,res;if(this.length>num.length)return this.clone().iadd(num);return num.clone().iadd(this)},BN.prototype.isub=function(num){if(num.negative!==0){num.negative=0;var r=this.iadd(num);return num.negative=1,r._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(num),this.negative=1,this._normSign();var cmp=this.cmp(num);if(cmp===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,b;if(cmp>0)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)-(b.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;if(carry===0&&i2<a.length&&a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];if(this.length=Math.max(this.length,i2),a!==this)this.negative=1;return this.strip()},BN.prototype.sub=function(num){return this.clone().isub(num)};function smallMulTo(self2,num,out){out.negative=num.negative^self2.negative;var len2=self2.length+num.length|0;out.length=len2,len2=len2-1|0;var a=self2.words[0]|0,b=num.words[0]|0,r=a*b,lo=r&67108863,carry=r/67108864|0;out.words[0]=lo;for(var k=1;k<len2;k++){var ncarry=carry>>>26,rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j|0;a=self2.words[i2]|0,b=num.words[j]|0,r=a*b+rword,ncarry+=r/67108864|0,rword=r&67108863}out.words[k]=rword|0,carry=ncarry|0}if(carry!==0)out.words[k]=carry|0;else out.length--;return out.strip()}var comb10MulTo=function(self2,num,out){var a=self2.words,b=num.words,o=out.words,c=0,lo,mid,hi,a0=a[0]|0,al0=a0&8191,ah0=a0>>>13,a1=a[1]|0,al1=a1&8191,ah1=a1>>>13,a2=a[2]|0,al2=a2&8191,ah2=a2>>>13,a3=a[3]|0,al3=a3&8191,ah3=a3>>>13,a4=a[4]|0,al4=a4&8191,ah4=a4>>>13,a5=a[5]|0,al5=a5&8191,ah5=a5>>>13,a6=a[6]|0,al6=a6&8191,ah6=a6>>>13,a7=a[7]|0,al7=a7&8191,ah7=a7>>>13,a8=a[8]|0,al8=a8&8191,ah8=a8>>>13,a9=a[9]|0,al9=a9&8191,ah9=a9>>>13,b0=b[0]|0,bl0=b0&8191,bh0=b0>>>13,b1=b[1]|0,bl1=b1&8191,bh1=b1>>>13,b2=b[2]|0,bl2=b2&8191,bh2=b2>>>13,b3=b[3]|0,bl3=b3&8191,bh3=b3>>>13,b4=b[4]|0,bl4=b4&8191,bh4=b4>>>13,b5=b[5]|0,bl5=b5&8191,bh5=b5>>>13,b6=b[6]|0,bl6=b6&8191,bh6=b6>>>13,b7=b[7]|0,bl7=b7&8191,bh7=b7>>>13,b8=b[8]|0,bl8=b8&8191,bh8=b8>>>13,b9=b[9]|0,bl9=b9&8191,bh9=b9>>>13;out.negative=self2.negative^num.negative,out.length=19,lo=Math.imul(al0,bl0),mid=Math.imul(al0,bh0),mid=mid+Math.imul(ah0,bl0)|0,hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0,w0&=67108863,lo=Math.imul(al1,bl0),mid=Math.imul(al1,bh0),mid=mid+Math.imul(ah1,bl0)|0,hi=Math.imul(ah1,bh0),lo=lo+Math.imul(al0,bl1)|0,mid=mid+Math.imul(al0,bh1)|0,mid=mid+Math.imul(ah0,bl1)|0,hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0,w1&=67108863,lo=Math.imul(al2,bl0),mid=Math.imul(al2,bh0),mid=mid+Math.imul(ah2,bl0)|0,hi=Math.imul(ah2,bh0),lo=lo+Math.imul(al1,bl1)|0,mid=mid+Math.imul(al1,bh1)|0,mid=mid+Math.imul(ah1,bl1)|0,hi=hi+Math.imul(ah1,bh1)|0,lo=lo+Math.imul(al0,bl2)|0,mid=mid+Math.imul(al0,bh2)|0,mid=mid+Math.imul(ah0,bl2)|0,hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0,w2&=67108863,lo=Math.imul(al3,bl0),mid=Math.imul(al3,bh0),mid=mid+Math.imul(ah3,bl0)|0,hi=Math.imul(ah3,bh0),lo=lo+Math.imul(al2,bl1)|0,mid=mid+Math.imul(al2,bh1)|0,mid=mid+Math.imul(ah2,bl1)|0,hi=hi+Math.imul(ah2,bh1)|0,lo=lo+Math.imul(al1,bl2)|0,mid=mid+Math.imul(al1,bh2)|0,mid=mid+Math.imul(ah1,bl2)|0,hi=hi+Math.imul(ah1,bh2)|0,lo=lo+Math.imul(al0,bl3)|0,mid=mid+Math.imul(al0,bh3)|0,mid=mid+Math.imul(ah0,bl3)|0,hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0,w3&=67108863,lo=Math.imul(al4,bl0),mid=Math.imul(al4,bh0),mid=mid+Math.imul(ah4,bl0)|0,hi=Math.imul(ah4,bh0),lo=lo+Math.imul(al3,bl1)|0,mid=mid+Math.imul(al3,bh1)|0,mid=mid+Math.imul(ah3,bl1)|0,hi=hi+Math.imul(ah3,bh1)|0,lo=lo+Math.imul(al2,bl2)|0,mid=mid+Math.imul(al2,bh2)|0,mid=mid+Math.imul(ah2,bl2)|0,hi=hi+Math.imul(ah2,bh2)|0,lo=lo+Math.imul(al1,bl3)|0,mid=mid+Math.imul(al1,bh3)|0,mid=mid+Math.imul(ah1,bl3)|0,hi=hi+Math.imul(ah1,bh3)|0,lo=lo+Math.imul(al0,bl4)|0,mid=mid+Math.imul(al0,bh4)|0,mid=mid+Math.imul(ah0,bl4)|0,hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0,w4&=67108863,lo=Math.imul(al5,bl0),mid=Math.imul(al5,bh0),mid=mid+Math.imul(ah5,bl0)|0,hi=Math.imul(ah5,bh0),lo=lo+Math.imul(al4,bl1)|0,mid=mid+Math.imul(al4,bh1)|0,mid=mid+Math.imul(ah4,bl1)|0,hi=hi+Math.imul(ah4,bh1)|0,lo=lo+Math.imul(al3,bl2)|0,mid=mid+Math.imul(al3,bh2)|0,mid=mid+Math.imul(ah3,bl2)|0,hi=hi+Math.imul(ah3,bh2)|0,lo=lo+Math.imul(al2,bl3)|0,mid=mid+Math.imul(al2,bh3)|0,mid=mid+Math.imul(ah2,bl3)|0,hi=hi+Math.imul(ah2,bh3)|0,lo=lo+Math.imul(al1,bl4)|0,mid=mid+Math.imul(al1,bh4)|0,mid=mid+Math.imul(ah1,bl4)|0,hi=hi+Math.imul(ah1,bh4)|0,lo=lo+Math.imul(al0,bl5)|0,mid=mid+Math.imul(al0,bh5)|0,mid=mid+Math.imul(ah0,bl5)|0,hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0,w5&=67108863,lo=Math.imul(al6,bl0),mid=Math.imul(al6,bh0),mid=mid+Math.imul(ah6,bl0)|0,hi=Math.imul(ah6,bh0),lo=lo+Math.imul(al5,bl1)|0,mid=mid+Math.imul(al5,bh1)|0,mid=mid+Math.imul(ah5,bl1)|0,hi=hi+Math.imul(ah5,bh1)|0,lo=lo+Math.imul(al4,bl2)|0,mid=mid+Math.imul(al4,bh2)|0,mid=mid+Math.imul(ah4,bl2)|0,hi=hi+Math.imul(ah4,bh2)|0,lo=lo+Math.imul(al3,bl3)|0,mid=mid+Math.imul(al3,bh3)|0,mid=mid+Math.imul(ah3,bl3)|0,hi=hi+Math.imul(ah3,bh3)|0,lo=lo+Math.imul(al2,bl4)|0,mid=mid+Math.imul(al2,bh4)|0,mid=mid+Math.imul(ah2,bl4)|0,hi=hi+Math.imul(ah2,bh4)|0,lo=lo+Math.imul(al1,bl5)|0,mid=mid+Math.imul(al1,bh5)|0,mid=mid+Math.imul(ah1,bl5)|0,hi=hi+Math.imul(ah1,bh5)|0,lo=lo+Math.imul(al0,bl6)|0,mid=mid+Math.imul(al0,bh6)|0,mid=mid+Math.imul(ah0,bl6)|0,hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0,w6&=67108863,lo=Math.imul(al7,bl0),mid=Math.imul(al7,bh0),mid=mid+Math.imul(ah7,bl0)|0,hi=Math.imul(ah7,bh0),lo=lo+Math.imul(al6,bl1)|0,mid=mid+Math.imul(al6,bh1)|0,mid=mid+Math.imul(ah6,bl1)|0,hi=hi+Math.imul(ah6,bh1)|0,lo=lo+Math.imul(al5,bl2)|0,mid=mid+Math.imul(al5,bh2)|0,mid=mid+Math.imul(ah5,bl2)|0,hi=hi+Math.imul(ah5,bh2)|0,lo=lo+Math.imul(al4,bl3)|0,mid=mid+Math.imul(al4,bh3)|0,mid=mid+Math.imul(ah4,bl3)|0,hi=hi+Math.imul(ah4,bh3)|0,lo=lo+Math.imul(al3,bl4)|0,mid=mid+Math.imul(al3,bh4)|0,mid=mid+Math.imul(ah3,bl4)|0,hi=hi+Math.imul(ah3,bh4)|0,lo=lo+Math.imul(al2,bl5)|0,mid=mid+Math.imul(al2,bh5)|0,mid=mid+Math.imul(ah2,bl5)|0,hi=hi+Math.imul(ah2,bh5)|0,lo=lo+Math.imul(al1,bl6)|0,mid=mid+Math.imul(al1,bh6)|0,mid=mid+Math.imul(ah1,bl6)|0,hi=hi+Math.imul(ah1,bh6)|0,lo=lo+Math.imul(al0,bl7)|0,mid=mid+Math.imul(al0,bh7)|0,mid=mid+Math.imul(ah0,bl7)|0,hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0,w7&=67108863,lo=Math.imul(al8,bl0),mid=Math.imul(al8,bh0),mid=mid+Math.imul(ah8,bl0)|0,hi=Math.imul(ah8,bh0),lo=lo+Math.imul(al7,bl1)|0,mid=mid+Math.imul(al7,bh1)|0,mid=mid+Math.imul(ah7,bl1)|0,hi=hi+Math.imul(ah7,bh1)|0,lo=lo+Math.imul(al6,bl2)|0,mid=mid+Math.imul(al6,bh2)|0,mid=mid+Math.imul(ah6,bl2)|0,hi=hi+Math.imul(ah6,bh2)|0,lo=lo+Math.imul(al5,bl3)|0,mid=mid+Math.imul(al5,bh3)|0,mid=mid+Math.imul(ah5,bl3)|0,hi=hi+Math.imul(ah5,bh3)|0,lo=lo+Math.imul(al4,bl4)|0,mid=mid+Math.imul(al4,bh4)|0,mid=mid+Math.imul(ah4,bl4)|0,hi=hi+Math.imul(ah4,bh4)|0,lo=lo+Math.imul(al3,bl5)|0,mid=mid+Math.imul(al3,bh5)|0,mid=mid+Math.imul(ah3,bl5)|0,hi=hi+Math.imul(ah3,bh5)|0,lo=lo+Math.imul(al2,bl6)|0,mid=mid+Math.imul(al2,bh6)|0,mid=mid+Math.imul(ah2,bl6)|0,hi=hi+Math.imul(ah2,bh6)|0,lo=lo+Math.imul(al1,bl7)|0,mid=mid+Math.imul(al1,bh7)|0,mid=mid+Math.imul(ah1,bl7)|0,hi=hi+Math.imul(ah1,bh7)|0,lo=lo+Math.imul(al0,bl8)|0,mid=mid+Math.imul(al0,bh8)|0,mid=mid+Math.imul(ah0,bl8)|0,hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0,w8&=67108863,lo=Math.imul(al9,bl0),mid=Math.imul(al9,bh0),mid=mid+Math.imul(ah9,bl0)|0,hi=Math.imul(ah9,bh0),lo=lo+Math.imul(al8,bl1)|0,mid=mid+Math.imul(al8,bh1)|0,mid=mid+Math.imul(ah8,bl1)|0,hi=hi+Math.imul(ah8,bh1)|0,lo=lo+Math.imul(al7,bl2)|0,mid=mid+Math.imul(al7,bh2)|0,mid=mid+Math.imul(ah7,bl2)|0,hi=hi+Math.imul(ah7,bh2)|0,lo=lo+Math.imul(al6,bl3)|0,mid=mid+Math.imul(al6,bh3)|0,mid=mid+Math.imul(ah6,bl3)|0,hi=hi+Math.imul(ah6,bh3)|0,lo=lo+Math.imul(al5,bl4)|0,mid=mid+Math.imul(al5,bh4)|0,mid=mid+Math.imul(ah5,bl4)|0,hi=hi+Math.imul(ah5,bh4)|0,lo=lo+Math.imul(al4,bl5)|0,mid=mid+Math.imul(al4,bh5)|0,mid=mid+Math.imul(ah4,bl5)|0,hi=hi+Math.imul(ah4,bh5)|0,lo=lo+Math.imul(al3,bl6)|0,mid=mid+Math.imul(al3,bh6)|0,mid=mid+Math.imul(ah3,bl6)|0,hi=hi+Math.imul(ah3,bh6)|0,lo=lo+Math.imul(al2,bl7)|0,mid=mid+Math.imul(al2,bh7)|0,mid=mid+Math.imul(ah2,bl7)|0,hi=hi+Math.imul(ah2,bh7)|0,lo=lo+Math.imul(al1,bl8)|0,mid=mid+Math.imul(al1,bh8)|0,mid=mid+Math.imul(ah1,bl8)|0,hi=hi+Math.imul(ah1,bh8)|0,lo=lo+Math.imul(al0,bl9)|0,mid=mid+Math.imul(al0,bh9)|0,mid=mid+Math.imul(ah0,bl9)|0,hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0,w9&=67108863,lo=Math.imul(al9,bl1),mid=Math.imul(al9,bh1),mid=mid+Math.imul(ah9,bl1)|0,hi=Math.imul(ah9,bh1),lo=lo+Math.imul(al8,bl2)|0,mid=mid+Math.imul(al8,bh2)|0,mid=mid+Math.imul(ah8,bl2)|0,hi=hi+Math.imul(ah8,bh2)|0,lo=lo+Math.imul(al7,bl3)|0,mid=mid+Math.imul(al7,bh3)|0,mid=mid+Math.imul(ah7,bl3)|0,hi=hi+Math.imul(ah7,bh3)|0,lo=lo+Math.imul(al6,bl4)|0,mid=mid+Math.imul(al6,bh4)|0,mid=mid+Math.imul(ah6,bl4)|0,hi=hi+Math.imul(ah6,bh4)|0,lo=lo+Math.imul(al5,bl5)|0,mid=mid+Math.imul(al5,bh5)|0,mid=mid+Math.imul(ah5,bl5)|0,hi=hi+Math.imul(ah5,bh5)|0,lo=lo+Math.imul(al4,bl6)|0,mid=mid+Math.imul(al4,bh6)|0,mid=mid+Math.imul(ah4,bl6)|0,hi=hi+Math.imul(ah4,bh6)|0,lo=lo+Math.imul(al3,bl7)|0,mid=mid+Math.imul(al3,bh7)|0,mid=mid+Math.imul(ah3,bl7)|0,hi=hi+Math.imul(ah3,bh7)|0,lo=lo+Math.imul(al2,bl8)|0,mid=mid+Math.imul(al2,bh8)|0,mid=mid+Math.imul(ah2,bl8)|0,hi=hi+Math.imul(ah2,bh8)|0,lo=lo+Math.imul(al1,bl9)|0,mid=mid+Math.imul(al1,bh9)|0,mid=mid+Math.imul(ah1,bl9)|0,hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0,w10&=67108863,lo=Math.imul(al9,bl2),mid=Math.imul(al9,bh2),mid=mid+Math.imul(ah9,bl2)|0,hi=Math.imul(ah9,bh2),lo=lo+Math.imul(al8,bl3)|0,mid=mid+Math.imul(al8,bh3)|0,mid=mid+Math.imul(ah8,bl3)|0,hi=hi+Math.imul(ah8,bh3)|0,lo=lo+Math.imul(al7,bl4)|0,mid=mid+Math.imul(al7,bh4)|0,mid=mid+Math.imul(ah7,bl4)|0,hi=hi+Math.imul(ah7,bh4)|0,lo=lo+Math.imul(al6,bl5)|0,mid=mid+Math.imul(al6,bh5)|0,mid=mid+Math.imul(ah6,bl5)|0,hi=hi+Math.imul(ah6,bh5)|0,lo=lo+Math.imul(al5,bl6)|0,mid=mid+Math.imul(al5,bh6)|0,mid=mid+Math.imul(ah5,bl6)|0,hi=hi+Math.imul(ah5,bh6)|0,lo=lo+Math.imul(al4,bl7)|0,mid=mid+Math.imul(al4,bh7)|0,mid=mid+Math.imul(ah4,bl7)|0,hi=hi+Math.imul(ah4,bh7)|0,lo=lo+Math.imul(al3,bl8)|0,mid=mid+Math.imul(al3,bh8)|0,mid=mid+Math.imul(ah3,bl8)|0,hi=hi+Math.imul(ah3,bh8)|0,lo=lo+Math.imul(al2,bl9)|0,mid=mid+Math.imul(al2,bh9)|0,mid=mid+Math.imul(ah2,bl9)|0,hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0,w11&=67108863,lo=Math.imul(al9,bl3),mid=Math.imul(al9,bh3),mid=mid+Math.imul(ah9,bl3)|0,hi=Math.imul(ah9,bh3),lo=lo+Math.imul(al8,bl4)|0,mid=mid+Math.imul(al8,bh4)|0,mid=mid+Math.imul(ah8,bl4)|0,hi=hi+Math.imul(ah8,bh4)|0,lo=lo+Math.imul(al7,bl5)|0,mid=mid+Math.imul(al7,bh5)|0,mid=mid+Math.imul(ah7,bl5)|0,hi=hi+Math.imul(ah7,bh5)|0,lo=lo+Math.imul(al6,bl6)|0,mid=mid+Math.imul(al6,bh6)|0,mid=mid+Math.imul(ah6,bl6)|0,hi=hi+Math.imul(ah6,bh6)|0,lo=lo+Math.imul(al5,bl7)|0,mid=mid+Math.imul(al5,bh7)|0,mid=mid+Math.imul(ah5,bl7)|0,hi=hi+Math.imul(ah5,bh7)|0,lo=lo+Math.imul(al4,bl8)|0,mid=mid+Math.imul(al4,bh8)|0,mid=mid+Math.imul(ah4,bl8)|0,hi=hi+Math.imul(ah4,bh8)|0,lo=lo+Math.imul(al3,bl9)|0,mid=mid+Math.imul(al3,bh9)|0,mid=mid+Math.imul(ah3,bl9)|0,hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0,w12&=67108863,lo=Math.imul(al9,bl4),mid=Math.imul(al9,bh4),mid=mid+Math.imul(ah9,bl4)|0,hi=Math.imul(ah9,bh4),lo=lo+Math.imul(al8,bl5)|0,mid=mid+Math.imul(al8,bh5)|0,mid=mid+Math.imul(ah8,bl5)|0,hi=hi+Math.imul(ah8,bh5)|0,lo=lo+Math.imul(al7,bl6)|0,mid=mid+Math.imul(al7,bh6)|0,mid=mid+Math.imul(ah7,bl6)|0,hi=hi+Math.imul(ah7,bh6)|0,lo=lo+Math.imul(al6,bl7)|0,mid=mid+Math.imul(al6,bh7)|0,mid=mid+Math.imul(ah6,bl7)|0,hi=hi+Math.imul(ah6,bh7)|0,lo=lo+Math.imul(al5,bl8)|0,mid=mid+Math.imul(al5,bh8)|0,mid=mid+Math.imul(ah5,bl8)|0,hi=hi+Math.imul(ah5,bh8)|0,lo=lo+Math.imul(al4,bl9)|0,mid=mid+Math.imul(al4,bh9)|0,mid=mid+Math.imul(ah4,bl9)|0,hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0,w13&=67108863,lo=Math.imul(al9,bl5),mid=Math.imul(al9,bh5),mid=mid+Math.imul(ah9,bl5)|0,hi=Math.imul(ah9,bh5),lo=lo+Math.imul(al8,bl6)|0,mid=mid+Math.imul(al8,bh6)|0,mid=mid+Math.imul(ah8,bl6)|0,hi=hi+Math.imul(ah8,bh6)|0,lo=lo+Math.imul(al7,bl7)|0,mid=mid+Math.imul(al7,bh7)|0,mid=mid+Math.imul(ah7,bl7)|0,hi=hi+Math.imul(ah7,bh7)|0,lo=lo+Math.imul(al6,bl8)|0,mid=mid+Math.imul(al6,bh8)|0,mid=mid+Math.imul(ah6,bl8)|0,hi=hi+Math.imul(ah6,bh8)|0,lo=lo+Math.imul(al5,bl9)|0,mid=mid+Math.imul(al5,bh9)|0,mid=mid+Math.imul(ah5,bl9)|0,hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0,w14&=67108863,lo=Math.imul(al9,bl6),mid=Math.imul(al9,bh6),mid=mid+Math.imul(ah9,bl6)|0,hi=Math.imul(ah9,bh6),lo=lo+Math.imul(al8,bl7)|0,mid=mid+Math.imul(al8,bh7)|0,mid=mid+Math.imul(ah8,bl7)|0,hi=hi+Math.imul(ah8,bh7)|0,lo=lo+Math.imul(al7,bl8)|0,mid=mid+Math.imul(al7,bh8)|0,mid=mid+Math.imul(ah7,bl8)|0,hi=hi+Math.imul(ah7,bh8)|0,lo=lo+Math.imul(al6,bl9)|0,mid=mid+Math.imul(al6,bh9)|0,mid=mid+Math.imul(ah6,bl9)|0,hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0,w15&=67108863,lo=Math.imul(al9,bl7),mid=Math.imul(al9,bh7),mid=mid+Math.imul(ah9,bl7)|0,hi=Math.imul(ah9,bh7),lo=lo+Math.imul(al8,bl8)|0,mid=mid+Math.imul(al8,bh8)|0,mid=mid+Math.imul(ah8,bl8)|0,hi=hi+Math.imul(ah8,bh8)|0,lo=lo+Math.imul(al7,bl9)|0,mid=mid+Math.imul(al7,bh9)|0,mid=mid+Math.imul(ah7,bl9)|0,hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0,w16&=67108863,lo=Math.imul(al9,bl8),mid=Math.imul(al9,bh8),mid=mid+Math.imul(ah9,bl8)|0,hi=Math.imul(ah9,bh8),lo=lo+Math.imul(al8,bl9)|0,mid=mid+Math.imul(al8,bh9)|0,mid=mid+Math.imul(ah8,bl9)|0,hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0,w17&=67108863,lo=Math.imul(al9,bl9),mid=Math.imul(al9,bh9),mid=mid+Math.imul(ah9,bl9)|0,hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&8191)<<13)|0;if(c=(hi+(mid>>>13)|0)+(w18>>>26)|0,w18&=67108863,o[0]=w0,o[1]=w1,o[2]=w2,o[3]=w3,o[4]=w4,o[5]=w5,o[6]=w6,o[7]=w7,o[8]=w8,o[9]=w9,o[10]=w10,o[11]=w11,o[12]=w12,o[13]=w13,o[14]=w14,o[15]=w15,o[16]=w16,o[17]=w17,o[18]=w18,c!==0)o[19]=c,out.length++;return out};if(!Math.imul)comb10MulTo=smallMulTo;function bigMulTo(self2,num,out){out.negative=num.negative^self2.negative,out.length=self2.length+num.length;var carry=0,hncarry=0;for(var k=0;k<out.length-1;k++){var ncarry=hncarry;hncarry=0;var rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j,a=self2.words[i2]|0,b=num.words[j]|0,r=a*b,lo=r&67108863;ncarry=ncarry+(r/67108864|0)|0,lo=lo+rword|0,rword=lo&67108863,ncarry=ncarry+(lo>>>26)|0,hncarry+=ncarry>>>26,ncarry&=67108863}out.words[k]=rword,carry=ncarry,ncarry=hncarry}if(carry!==0)out.words[k]=carry;else out.length--;return out.strip()}function jumboMulTo(self2,num,out){var fftm=new FFTM;return fftm.mulp(self2,num,out)}BN.prototype.mulTo=function(num,out){var res,len2=this.length+num.length;if(this.length===10&&num.length===10)res=comb10MulTo(this,num,out);else if(len2<63)res=smallMulTo(this,num,out);else if(len2<1024)res=bigMulTo(this,num,out);else res=jumboMulTo(this,num,out);return res};function FFTM(x,y){this.x=x,this.y=y}FFTM.prototype.makeRBT=function(N){var t=Array(N),l=BN.prototype._countBits(N)-1;for(var i2=0;i2<N;i2++)t[i2]=this.revBin(i2,l,N);return t},FFTM.prototype.revBin=function(x,l,N){if(x===0||x===N-1)return x;var rb=0;for(var i2=0;i2<l;i2++)rb|=(x&1)<<l-i2-1,x>>=1;return rb},FFTM.prototype.permute=function(rbt,rws,iws,rtws,itws,N){for(var i2=0;i2<N;i2++)rtws[i2]=rws[rbt[i2]],itws[i2]=iws[rbt[i2]]},FFTM.prototype.transform=function(rws,iws,rtws,itws,N,rbt){this.permute(rbt,rws,iws,rtws,itws,N);for(var s=1;s<N;s<<=1){var l=s<<1,rtwdf=Math.cos(2*Math.PI/l),itwdf=Math.sin(2*Math.PI/l);for(var p=0;p<N;p+=l){var rtwdf_=rtwdf,itwdf_=itwdf;for(var j=0;j<s;j++){var re=rtws[p+j],ie=itws[p+j],ro=rtws[p+j+s],io=itws[p+j+s],rx=rtwdf_*ro-itwdf_*io;if(io=rtwdf_*io+itwdf_*ro,ro=rx,rtws[p+j]=re+ro,itws[p+j]=ie+io,rtws[p+j+s]=re-ro,itws[p+j+s]=ie-io,j!==l)rx=rtwdf*rtwdf_-itwdf*itwdf_,itwdf_=rtwdf*itwdf_+itwdf*rtwdf_,rtwdf_=rx}}}},FFTM.prototype.guessLen13b=function(n,m){var N=Math.max(m,n)|1,odd=N&1,i2=0;for(N=N/2|0;N;N=N>>>1)i2++;return 1<<i2+1+odd},FFTM.prototype.conjugate=function(rws,iws,N){if(N<=1)return;for(var i2=0;i2<N/2;i2++){var t=rws[i2];rws[i2]=rws[N-i2-1],rws[N-i2-1]=t,t=iws[i2],iws[i2]=-iws[N-i2-1],iws[N-i2-1]=-t}},FFTM.prototype.normalize13b=function(ws,N){var carry=0;for(var i2=0;i2<N/2;i2++){var w=Math.round(ws[2*i2+1]/N)*8192+Math.round(ws[2*i2]/N)+carry;if(ws[i2]=w&67108863,w<67108864)carry=0;else carry=w/67108864|0}return ws},FFTM.prototype.convert13b=function(ws,len2,rws,N){var carry=0;for(var i2=0;i2<len2;i2++)carry=carry+(ws[i2]|0),rws[2*i2]=carry&8191,carry=carry>>>13,rws[2*i2+1]=carry&8191,carry=carry>>>13;for(i2=2*len2;i2<N;++i2)rws[i2]=0;assert(carry===0),assert((carry&-8192)===0)},FFTM.prototype.stub=function(N){var ph=Array(N);for(var i2=0;i2<N;i2++)ph[i2]=0;return ph},FFTM.prototype.mulp=function(x,y,out){var N=2*this.guessLen13b(x.length,y.length),rbt=this.makeRBT(N),_=this.stub(N),rws=Array(N),rwst=Array(N),iwst=Array(N),nrws=Array(N),nrwst=Array(N),niwst=Array(N),rmws=out.words;rmws.length=N,this.convert13b(x.words,x.length,rws,N),this.convert13b(y.words,y.length,nrws,N),this.transform(rws,_,rwst,iwst,N,rbt),this.transform(nrws,_,nrwst,niwst,N,rbt);for(var i2=0;i2<N;i2++){var rx=rwst[i2]*nrwst[i2]-iwst[i2]*niwst[i2];iwst[i2]=rwst[i2]*niwst[i2]+iwst[i2]*nrwst[i2],rwst[i2]=rx}return this.conjugate(rwst,iwst,N),this.transform(rwst,iwst,rmws,_,N,rbt),this.conjugate(rmws,_,N),this.normalize13b(rmws,N),out.negative=x.negative^y.negative,out.length=x.length+y.length,out.strip()},BN.prototype.mul=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),this.mulTo(num,out)},BN.prototype.mulf=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),jumboMulTo(this,num,out)},BN.prototype.imul=function(num){return this.clone().mulTo(num,this)},BN.prototype.imuln=function(num){assert(typeof num==="number"),assert(num<67108864);var carry=0;for(var i2=0;i2<this.length;i2++){var w=(this.words[i2]|0)*num,lo=(w&67108863)+(carry&67108863);carry>>=26,carry+=w/67108864|0,carry+=lo>>>26,this.words[i2]=lo&67108863}if(carry!==0)this.words[i2]=carry,this.length++;return this.length=num===0?1:this.length,this},BN.prototype.muln=function(num){return this.clone().imuln(num)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.imul(this.clone())},BN.prototype.pow=function(num){var w=toBitArray(num);if(w.length===0)return new BN(1);var res=this;for(var i2=0;i2<w.length;i2++,res=res.sqr())if(w[i2]!==0)break;if(++i2<w.length)for(var q=res.sqr();i2<w.length;i2++,q=q.sqr()){if(w[i2]===0)continue;res=res.mul(q)}return res},BN.prototype.iushln=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26,carryMask=67108863>>>26-r<<26-r,i2;if(r!==0){var carry=0;for(i2=0;i2<this.length;i2++){var newCarry=this.words[i2]&carryMask,c=(this.words[i2]|0)-newCarry<<r;this.words[i2]=c|carry,carry=newCarry>>>26-r}if(carry)this.words[i2]=carry,this.length++}if(s!==0){for(i2=this.length-1;i2>=0;i2--)this.words[i2+s]=this.words[i2];for(i2=0;i2<s;i2++)this.words[i2]=0;this.length+=s}return this.strip()},BN.prototype.ishln=function(bits){return assert(this.negative===0),this.iushln(bits)},BN.prototype.iushrn=function(bits,hint,extended){assert(typeof bits==="number"&&bits>=0);var h;if(hint)h=(hint-hint%26)/26;else h=0;var r=bits%26,s=Math.min((bits-r)/26,this.length),mask=67108863^67108863>>>r<<r,maskedWords=extended;if(h-=s,h=Math.max(0,h),maskedWords){for(var i2=0;i2<s;i2++)maskedWords.words[i2]=this.words[i2];maskedWords.length=s}if(s===0);else if(this.length>s){this.length-=s;for(i2=0;i2<this.length;i2++)this.words[i2]=this.words[i2+s]}else this.words[0]=0,this.length=1;var carry=0;for(i2=this.length-1;i2>=0&&(carry!==0||i2>=h);i2--){var word=this.words[i2]|0;this.words[i2]=carry<<26-r|word>>>r,carry=word&mask}if(maskedWords&&carry!==0)maskedWords.words[maskedWords.length++]=carry;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},BN.prototype.ishrn=function(bits,hint,extended){return assert(this.negative===0),this.iushrn(bits,hint,extended)},BN.prototype.shln=function(bits){return this.clone().ishln(bits)},BN.prototype.ushln=function(bits){return this.clone().iushln(bits)},BN.prototype.shrn=function(bits){return this.clone().ishrn(bits)},BN.prototype.ushrn=function(bits){return this.clone().iushrn(bits)},BN.prototype.testn=function(bit){assert(typeof bit==="number"&&bit>=0);var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return!1;var w=this.words[s];return!!(w&q)},BN.prototype.imaskn=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26;if(assert(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(r!==0)s++;if(this.length=Math.min(s,this.length),r!==0){var mask=67108863^67108863>>>r<<r;this.words[this.length-1]&=mask}return this.strip()},BN.prototype.maskn=function(bits){return this.clone().imaskn(bits)},BN.prototype.iaddn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.isubn(-num);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<num)return this.words[0]=num-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(num),this.negative=1,this}return this._iaddn(num)},BN.prototype._iaddn=function(num){this.words[0]+=num;for(var i2=0;i2<this.length&&this.words[i2]>=67108864;i2++)if(this.words[i2]-=67108864,i2===this.length-1)this.words[i2+1]=1;else this.words[i2+1]++;return this.length=Math.max(this.length,i2+1),this},BN.prototype.isubn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.iaddn(-num);if(this.negative!==0)return this.negative=0,this.iaddn(num),this.negative=1,this;if(this.words[0]-=num,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i2=0;i2<this.length&&this.words[i2]<0;i2++)this.words[i2]+=67108864,this.words[i2+1]-=1;return this.strip()},BN.prototype.addn=function(num){return this.clone().iaddn(num)},BN.prototype.subn=function(num){return this.clone().isubn(num)},BN.prototype.iabs=function(){return this.negative=0,this},BN.prototype.abs=function(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function(num,mul,shift){var len2=num.length+shift,i2;this._expand(len2);var w,carry=0;for(i2=0;i2<num.length;i2++){w=(this.words[i2+shift]|0)+carry;var right=(num.words[i2]|0)*mul;w-=right&67108863,carry=(w>>26)-(right/67108864|0),this.words[i2+shift]=w&67108863}for(;i2<this.length-shift;i2++)w=(this.words[i2+shift]|0)+carry,carry=w>>26,this.words[i2+shift]=w&67108863;if(carry===0)return this.strip();assert(carry===-1),carry=0;for(i2=0;i2<this.length;i2++)w=-(this.words[i2]|0)+carry,carry=w>>26,this.words[i2]=w&67108863;return this.negative=1,this.strip()},BN.prototype._wordDiv=function(num,mode){var shift=this.length-num.length,a=this.clone(),b=num,bhi=b.words[b.length-1]|0,bhiBits=this._countBits(bhi);if(shift=26-bhiBits,shift!==0)b=b.ushln(shift),a.iushln(shift),bhi=b.words[b.length-1]|0;var m=a.length-b.length,q;if(mode!=="mod"){q=new BN(null),q.length=m+1,q.words=Array(q.length);for(var i2=0;i2<q.length;i2++)q.words[i2]=0}var diff=a.clone()._ishlnsubmul(b,1,m);if(diff.negative===0){if(a=diff,q)q.words[m]=1}for(var j=m-1;j>=0;j--){var qj=(a.words[b.length+j]|0)*67108864+(a.words[b.length+j-1]|0);qj=Math.min(qj/bhi|0,67108863),a._ishlnsubmul(b,qj,j);while(a.negative!==0)if(qj--,a.negative=0,a._ishlnsubmul(b,1,j),!a.isZero())a.negative^=1;if(q)q.words[j]=qj}if(q)q.strip();if(a.strip(),mode!=="div"&&shift!==0)a.iushrn(shift);return{div:q||null,mod:a}},BN.prototype.divmod=function(num,mode,positive){if(assert(!num.isZero()),this.isZero())return{div:new BN(0),mod:new BN(0)};var div,mod,res;if(this.negative!==0&&num.negative===0){if(res=this.neg().divmod(num,mode),mode!=="mod")div=res.div.neg();if(mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.iadd(num)}return{div,mod}}if(this.negative===0&&num.negative!==0){if(res=this.divmod(num.neg(),mode),mode!=="mod")div=res.div.neg();return{div,mod:res.mod}}if((this.negative&num.negative)!==0){if(res=this.neg().divmod(num.neg(),mode),mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.isub(num)}return{div:res.div,mod}}if(num.length>this.length||this.cmp(num)<0)return{div:new BN(0),mod:this};if(num.length===1){if(mode==="div")return{div:this.divn(num.words[0]),mod:null};if(mode==="mod")return{div:null,mod:new BN(this.modn(num.words[0]))};return{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}}return this._wordDiv(num,mode)},BN.prototype.div=function(num){return this.divmod(num,"div",!1).div},BN.prototype.mod=function(num){return this.divmod(num,"mod",!1).mod},BN.prototype.umod=function(num){return this.divmod(num,"mod",!0).mod},BN.prototype.divRound=function(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod,half=num.ushrn(1),r2=num.andln(1),cmp=mod.cmp(half);if(cmp<0||r2===1&&cmp===0)return dm.div;return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1)},BN.prototype.modn=function(num){assert(num<=67108863);var p=67108864%num,acc=0;for(var i2=this.length-1;i2>=0;i2--)acc=(p*acc+(this.words[i2]|0))%num;return acc},BN.prototype.idivn=function(num){assert(num<=67108863);var carry=0;for(var i2=this.length-1;i2>=0;i2--){var w=(this.words[i2]|0)+carry*67108864;this.words[i2]=w/num|0,carry=w%num}return this.strip()},BN.prototype.divn=function(num){return this.clone().idivn(num)},BN.prototype.egcd=function(p){assert(p.negative===0),assert(!p.isZero());var x=this,y=p.clone();if(x.negative!==0)x=x.umod(p);else x=x.clone();var A=new BN(1),B=new BN(0),C=new BN(0),D=new BN(1),g=0;while(x.isEven()&&y.isEven())x.iushrn(1),y.iushrn(1),++g;var yp=y.clone(),xp=x.clone();while(!x.isZero()){for(var i2=0,im=1;(x.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){x.iushrn(i2);while(i2-- >0){if(A.isOdd()||B.isOdd())A.iadd(yp),B.isub(xp);A.iushrn(1),B.iushrn(1)}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){y.iushrn(j);while(j-- >0){if(C.isOdd()||D.isOdd())C.iadd(yp),D.isub(xp);C.iushrn(1),D.iushrn(1)}}if(x.cmp(y)>=0)x.isub(y),A.isub(C),B.isub(D);else y.isub(x),C.isub(A),D.isub(B)}return{a:C,b:D,gcd:y.iushln(g)}},BN.prototype._invmp=function(p){assert(p.negative===0),assert(!p.isZero());var a=this,b=p.clone();if(a.negative!==0)a=a.umod(p);else a=a.clone();var x1=new BN(1),x2=new BN(0),delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i2=0,im=1;(a.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){a.iushrn(i2);while(i2-- >0){if(x1.isOdd())x1.iadd(delta);x1.iushrn(1)}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){b.iushrn(j);while(j-- >0){if(x2.isOdd())x2.iadd(delta);x2.iushrn(1)}}if(a.cmp(b)>=0)a.isub(b),x1.isub(x2);else b.isub(a),x2.isub(x1)}var res;if(a.cmpn(1)===0)res=x1;else res=x2;if(res.cmpn(0)<0)res.iadd(p);return res},BN.prototype.gcd=function(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone(),b=num.clone();a.negative=0,b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++)a.iushrn(1),b.iushrn(1);do{while(a.isEven())a.iushrn(1);while(b.isEven())b.iushrn(1);var r=a.cmp(b);if(r<0){var t=a;a=b,b=t}else if(r===0||b.cmpn(1)===0)break;a.isub(b)}while(!0);return b.iushln(shift)},BN.prototype.invm=function(num){return this.egcd(num).a.umod(num)},BN.prototype.isEven=function(){return(this.words[0]&1)===0},BN.prototype.isOdd=function(){return(this.words[0]&1)===1},BN.prototype.andln=function(num){return this.words[0]&num},BN.prototype.bincn=function(bit){assert(typeof bit==="number");var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return this._expand(s+1),this.words[s]|=q,this;var carry=q;for(var i2=s;carry!==0&&i2<this.length;i2++){var w=this.words[i2]|0;w+=carry,carry=w>>>26,w&=67108863,this.words[i2]=w}if(carry!==0)this.words[i2]=carry,this.length++;return this},BN.prototype.isZero=function(){return this.length===1&&this.words[0]===0},BN.prototype.cmpn=function(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this.strip();var res;if(this.length>1)res=1;else{if(negative)num=-num;assert(num<=67108863,"Number is too big");var w=this.words[0]|0;res=w===num?0:w<num?-1:1}if(this.negative!==0)return-res|0;return res},BN.prototype.cmp=function(num){if(this.negative!==0&&num.negative===0)return-1;if(this.negative===0&&num.negative!==0)return 1;var res=this.ucmp(num);if(this.negative!==0)return-res|0;return res},BN.prototype.ucmp=function(num){if(this.length>num.length)return 1;if(this.length<num.length)return-1;var res=0;for(var i2=this.length-1;i2>=0;i2--){var a=this.words[i2]|0,b=num.words[i2]|0;if(a===b)continue;if(a<b)res=-1;else if(a>b)res=1;break}return res},BN.prototype.gtn=function(num){return this.cmpn(num)===1},BN.prototype.gt=function(num){return this.cmp(num)===1},BN.prototype.gten=function(num){return this.cmpn(num)>=0},BN.prototype.gte=function(num){return this.cmp(num)>=0},BN.prototype.ltn=function(num){return this.cmpn(num)===-1},BN.prototype.lt=function(num){return this.cmp(num)===-1},BN.prototype.lten=function(num){return this.cmpn(num)<=0},BN.prototype.lte=function(num){return this.cmp(num)<=0},BN.prototype.eqn=function(num){return this.cmpn(num)===0},BN.prototype.eq=function(num){return this.cmp(num)===0},BN.red=function(num){return new Red(num)},BN.prototype.toRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),assert(this.negative===0,"red works only with positives"),ctx.convertTo(this)._forceRed(ctx)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(ctx){return this.red=ctx,this},BN.prototype.forceRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),this._forceRed(ctx)},BN.prototype.redAdd=function(num){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,num)},BN.prototype.redIAdd=function(num){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,num)},BN.prototype.redSub=function(num){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,num)},BN.prototype.redISub=function(num){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,num)},BN.prototype.redShl=function(num){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,num)},BN.prototype.redMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.mul(this,num)},BN.prototype.redIMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.imul(this,num)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(num){return assert(this.red&&!num.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};function MPrime(name,p){this.name=name,this.p=new BN(p,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}MPrime.prototype._tmp=function(){var tmp=new BN(null);return tmp.words=Array(Math.ceil(this.n/13)),tmp},MPrime.prototype.ireduce=function(num){var r=num,rlen;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),rlen=r.bitLength();while(rlen>this.n);var cmp=rlen<this.n?-1:r.ucmp(this.p);if(cmp===0)r.words[0]=0,r.length=1;else if(cmp>0)r.isub(this.p);else if(r.strip!==void 0)r.strip();else r._strip();return r},MPrime.prototype.split=function(input,out){input.iushrn(this.n,0,out)},MPrime.prototype.imulK=function(num){return num.imul(this.k)};function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}inherits2(K256,MPrime),K256.prototype.split=function(input,output){var mask=4194303,outLen=Math.min(input.length,9);for(var i2=0;i2<outLen;i2++)output.words[i2]=input.words[i2];if(output.length=outLen,input.length<=9){input.words[0]=0,input.length=1;return}var prev=input.words[9];output.words[output.length++]=prev&mask;for(i2=10;i2<input.length;i2++){var next=input.words[i2]|0;input.words[i2-10]=(next&mask)<<4|prev>>>22,prev=next}if(prev>>>=22,input.words[i2-10]=prev,prev===0&&input.length>10)input.length-=10;else input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;var lo=0;for(var i2=0;i2<num.length;i2++){var w=num.words[i2]|0;lo+=w*977,num.words[i2]=lo&67108863,lo=w*64+(lo/67108864|0)}if(num.words[num.length-1]===0){if(num.length--,num.words[num.length-1]===0)num.length--}return num};function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}inherits2(P224,MPrime);function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}inherits2(P192,MPrime);function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}inherits2(P25519,MPrime),P25519.prototype.imulK=function(num){var carry=0;for(var i2=0;i2<num.length;i2++){var hi=(num.words[i2]|0)*19+carry,lo=hi&67108863;hi>>>=26,num.words[i2]=lo,carry=hi}if(carry!==0)num.words[num.length++]=carry;return num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if(name==="k256")prime=new K256;else if(name==="p224")prime=new P224;else if(name==="p192")prime=new P192;else if(name==="p25519")prime=new P25519;else throw Error("Unknown prime "+name);return primes[name]=prime,prime};function Red(m){if(typeof m==="string"){var prime=BN._prime(m);this.m=prime.p,this.prime=prime}else assert(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}Red.prototype._verify1=function(a){assert(a.negative===0,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert((a.negative|b.negative)===0,"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return a.umod(this.m)._forceRed(this)},Red.prototype.neg=function(a){if(a.isZero())return a.clone();return this.m.sub(a)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.ushln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a.clone())},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2===1),mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}var q=this.m.subn(1),s=0;while(!q.isZero()&&q.andln(1)===0)s++,q.iushrn(1);assert(!q.isZero());var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).iushrn(1),z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0)z.redIAdd(nOne);var c=this.pow(z,q),r=this.pow(a,q.addn(1).iushrn(1)),t=this.pow(a,q),m=s;while(t.cmp(one)!==0){var tmp=t;for(var i2=0;tmp.cmp(one)!==0;i2++)tmp=tmp.redSqr();assert(i2<m);var b=this.pow(c,new BN(1).iushln(m-i2-1));r=r.redMul(b),c=b.redSqr(),t=t.redMul(c),m=i2}return r},Red.prototype.invm=function(a){var inv=a._invmp(this.m);if(inv.negative!==0)return inv.negative=0,this.imod(inv).redNeg();else return this.imod(inv)},Red.prototype.pow=function(a,num){if(num.isZero())return new BN(1).toRed(this);if(num.cmpn(1)===0)return a.clone();var windowSize=4,wnd=Array(1<<windowSize);wnd[0]=new BN(1).toRed(this),wnd[1]=a;for(var i2=2;i2<wnd.length;i2++)wnd[i2]=this.mul(wnd[i2-1],a);var res=wnd[0],current=0,currentLen=0,start=num.bitLength()%26;if(start===0)start=26;for(i2=num.length-1;i2>=0;i2--){var word=num.words[i2];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0])res=this.sqr(res);if(bit===0&&current===0){currentLen=0;continue}if(current<<=1,current|=bit,currentLen++,currentLen!==windowSize&&(i2!==0||j!==0))continue;res=this.mul(res,wnd[current]),currentLen=0,current=0}start=26}return res},Red.prototype.convertTo=function(num){var r=num.umod(this.m);return r===num?r.clone():r},Red.prototype.convertFrom=function(num){var res=num.clone();return res.red=null,res},BN.mont=function(num){return new Mont(num)};function Mont(m){if(Red.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}inherits2(Mont,Red),Mont.prototype.convertTo=function(num){return this.imod(num.ushln(this.shift))},Mont.prototype.convertFrom=function(num){var r=this.imod(num.mul(this.rinv));return r.red=null,r},Mont.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var t=a.imul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.invm=function(a){var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this)}})(typeof module>"u"||module,exports)}),require_withPublic=__commonJS2((exports,module)=>{var BN=require_bn4(),Buffer22=require_safe_buffer().Buffer;function withPublic(paddedMsg,key){return Buffer22.from(paddedMsg.toRed(BN.mont(key.modulus)).redPow(new BN(key.publicExponent)).fromRed().toArray())}module.exports=withPublic}),require_bn5=__commonJS2((exports,module)=>{(function(module2,exports2){function assert(val,msg){if(!val)throw Error(msg||"Assertion failed")}function inherits2(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}function BN(number,base,endian){if(BN.isBN(number))return number;if(this.negative=0,this.words=null,this.length=0,this.red=null,number!==null){if(base==="le"||base==="be")endian=base,base=10;this._init(number||0,base||10,endian||"be")}}if(typeof module2==="object")module2.exports=BN;else exports2.BN=BN;BN.BN=BN,BN.wordSize=26;var Buffer22;try{if(typeof window<"u"&&typeof window.Buffer<"u")Buffer22=window.Buffer;else Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer}catch(e){}BN.isBN=function(num){if(num instanceof BN)return!0;return num!==null&&typeof num==="object"&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)},BN.max=function(left,right){if(left.cmp(right)>0)return left;return right},BN.min=function(left,right){if(left.cmp(right)<0)return left;return right},BN.prototype._init=function(number,base,endian){if(typeof number==="number")return this._initNumber(number,base,endian);if(typeof number==="object")return this._initArray(number,base,endian);if(base==="hex")base=16;assert(base===(base|0)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,"");var start=0;if(number[0]==="-")start++,this.negative=1;if(start<number.length){if(base===16)this._parseHex(number,start,endian);else if(this._parseBase(number,base,start),endian==="le")this._initArray(this.toArray(),base,endian)}},BN.prototype._initNumber=function(number,base,endian){if(number<0)this.negative=1,number=-number;if(number<67108864)this.words=[number&67108863],this.length=1;else if(number<4503599627370496)this.words=[number&67108863,number/67108864&67108863],this.length=2;else assert(number<9007199254740992),this.words=[number&67108863,number/67108864&67108863,1],this.length=3;if(endian!=="le")return;this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert(typeof number.length==="number"),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var j,w,off=0;if(endian==="be"){for(i2=number.length-1,j=0;i2>=0;i2-=3)if(w=number[i2]|number[i2-1]<<8|number[i2-2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}else if(endian==="le"){for(i2=0,j=0;i2<number.length;i2+=3)if(w=number[i2]|number[i2+1]<<8|number[i2+2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26)off-=26,j++}return this._strip()};function parseHex4Bits(string,index){var c=string.charCodeAt(index);if(c>=48&&c<=57)return c-48;else if(c>=65&&c<=70)return c-55;else if(c>=97&&c<=102)return c-87;else assert(!1,"Invalid character in "+string)}function parseHexByte(string,lowerBound,index){var r=parseHex4Bits(string,index);if(index-1>=lowerBound)r|=parseHex4Bits(string,index-1)<<4;return r}BN.prototype._parseHex=function(number,start,endian){this.length=Math.ceil((number.length-start)/6),this.words=Array(this.length);for(var i2=0;i2<this.length;i2++)this.words[i2]=0;var off=0,j=0,w;if(endian==="be")for(i2=number.length-1;i2>=start;i2-=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8;else{var parseLength=number.length-start;for(i2=parseLength%2===0?start+1:start;i2<number.length;i2+=2)if(w=parseHexByte(number,start,i2)<<off,this.words[j]|=w&67108863,off>=18)off-=18,j+=1,this.words[j]|=w>>>26;else off+=8}this._strip()};function parseBase(str,start,end,mul){var r=0,b=0,len2=Math.min(str.length,end);for(var i2=start;i2<len2;i2++){var c=str.charCodeAt(i2)-48;if(r*=mul,c>=49)b=c-49+10;else if(c>=17)b=c-17+10;else b=c;assert(c>=0&&b<mul,"Invalid character"),r+=b}return r}BN.prototype._parseBase=function(number,base,start){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;var total=number.length-start,mod=total%limbLen,end=Math.min(total,total-mod)+start,word=0;for(var i2=start;i2<end;i2+=limbLen)if(word=parseBase(number,i2,i2+limbLen,base),this.imuln(limbPow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word);if(mod!==0){var pow=1;word=parseBase(number,i2,number.length,base);for(i2=0;i2<mod;i2++)pow*=base;if(this.imuln(pow),this.words[0]+word<67108864)this.words[0]+=word;else this._iaddn(word)}this._strip()},BN.prototype.copy=function(dest){dest.words=Array(this.length);for(var i2=0;i2<this.length;i2++)dest.words[i2]=this.words[i2];dest.length=this.length,dest.negative=this.negative,dest.red=this.red};function move(dest,src){dest.words=src.words,dest.length=src.length,dest.negative=src.negative,dest.red=src.red}if(BN.prototype._move=function(dest){move(dest,this)},BN.prototype.clone=function(){var r=new BN(null);return this.copy(r),r},BN.prototype._expand=function(size){while(this.length<size)this.words[this.length++]=0;return this},BN.prototype._strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},BN.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},typeof Symbol<"u"&&typeof Symbol.for==="function")try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect2}catch(e){BN.prototype.inspect=inspect2}else BN.prototype.inspect=inspect2;function inspect2(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var zeros=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(BN.prototype.toString=function(base,padding){base=base||10,padding=padding|0||1;var out;if(base===16||base==="hex"){out="";var off=0,carry=0;for(var i2=0;i2<this.length;i2++){var w=this.words[i2],word=((w<<off|carry)&16777215).toString(16);if(carry=w>>>24-off&16777215,off+=2,off>=26)off-=26,i2--;if(carry!==0||i2!==this.length-1)out=zeros[6-word.length]+word+out;else out=word+out}if(carry!==0)out=carry.toString(16)+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base];out="";var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modrn(groupBase).toString(base);if(c=c.idivn(groupBase),!c.isZero())out=zeros[groupSize-r.length]+r+out;else out=r+out}if(this.isZero())out="0"+out;while(out.length%padding!==0)out="0"+out;if(this.negative!==0)out="-"+out;return out}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function(){var ret=this.words[0];if(this.length===2)ret+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)ret+=4503599627370496+this.words[1]*67108864;else if(this.length>2)assert(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-ret:ret},BN.prototype.toJSON=function(){return this.toString(16,2)},Buffer22)BN.prototype.toBuffer=function(endian,length){return this.toArrayLike(Buffer22,endian,length)};BN.prototype.toArray=function(endian,length){return this.toArrayLike(Array,endian,length)};var allocate=function(ArrayType,size){if(ArrayType.allocUnsafe)return ArrayType.allocUnsafe(size);return new ArrayType(size)};if(BN.prototype.toArrayLike=function(ArrayType,endian,length){this._strip();var byteLength2=this.byteLength(),reqLength=length||Math.max(1,byteLength2);assert(byteLength2<=reqLength,"byte array longer than desired length"),assert(reqLength>0,"Requested array length <= 0");var res=allocate(ArrayType,reqLength),postfix=endian==="le"?"LE":"BE";return this["_toArrayLike"+postfix](res,byteLength2),res},BN.prototype._toArrayLikeLE=function(res,byteLength2){var position=0,carry=0;for(var i2=0,shift=0;i2<this.length;i2++){var word=this.words[i2]<<shift|carry;if(res[position++]=word&255,position<res.length)res[position++]=word>>8&255;if(position<res.length)res[position++]=word>>16&255;if(shift===6){if(position<res.length)res[position++]=word>>24&255;carry=0,shift=0}else carry=word>>>24,shift+=2}if(position<res.length){res[position++]=carry;while(position<res.length)res[position++]=0}},BN.prototype._toArrayLikeBE=function(res,byteLength2){var position=res.length-1,carry=0;for(var i2=0,shift=0;i2<this.length;i2++){var word=this.words[i2]<<shift|carry;if(res[position--]=word&255,position>=0)res[position--]=word>>8&255;if(position>=0)res[position--]=word>>16&255;if(shift===6){if(position>=0)res[position--]=word>>24&255;carry=0,shift=0}else carry=word>>>24,shift+=2}if(position>=0){res[position--]=carry;while(position>=0)res[position--]=0}},Math.clz32)BN.prototype._countBits=function(w){return 32-Math.clz32(w)};else BN.prototype._countBits=function(w){var t=w,r=0;if(t>=4096)r+=13,t>>>=13;if(t>=64)r+=7,t>>>=7;if(t>=8)r+=4,t>>>=4;if(t>=2)r+=2,t>>>=2;return r+t};BN.prototype._zeroBits=function(w){if(w===0)return 26;var t=w,r=0;if((t&8191)===0)r+=13,t>>>=13;if((t&127)===0)r+=7,t>>>=7;if((t&15)===0)r+=4,t>>>=4;if((t&3)===0)r+=2,t>>>=2;if((t&1)===0)r++;return r},BN.prototype.bitLength=function(){var w=this.words[this.length-1],hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){var w=Array(num.bitLength());for(var bit=0;bit<w.length;bit++){var off=bit/26|0,wbit=bit%26;w[bit]=num.words[off]>>>wbit&1}return w}BN.prototype.zeroBits=function(){if(this.isZero())return 0;var r=0;for(var i2=0;i2<this.length;i2++){var b=this._zeroBits(this.words[i2]);if(r+=b,b!==26)break}return r},BN.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function(width){if(this.negative!==0)return this.abs().inotn(width).iaddn(1);return this.clone()},BN.prototype.fromTwos=function(width){if(this.testn(width-1))return this.notn(width).iaddn(1).ineg();return this.clone()},BN.prototype.isNeg=function(){return this.negative!==0},BN.prototype.neg=function(){return this.clone().ineg()},BN.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},BN.prototype.iuor=function(num){while(this.length<num.length)this.words[this.length++]=0;for(var i2=0;i2<num.length;i2++)this.words[i2]=this.words[i2]|num.words[i2];return this._strip()},BN.prototype.ior=function(num){return assert((this.negative|num.negative)===0),this.iuor(num)},BN.prototype.or=function(num){if(this.length>num.length)return this.clone().ior(num);return num.clone().ior(this)},BN.prototype.uor=function(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this)},BN.prototype.iuand=function(num){var b;if(this.length>num.length)b=num;else b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=this.words[i2]&num.words[i2];return this.length=b.length,this._strip()},BN.prototype.iand=function(num){return assert((this.negative|num.negative)===0),this.iuand(num)},BN.prototype.and=function(num){if(this.length>num.length)return this.clone().iand(num);return num.clone().iand(this)},BN.prototype.uand=function(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this)},BN.prototype.iuxor=function(num){var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;for(var i2=0;i2<b.length;i2++)this.words[i2]=a.words[i2]^b.words[i2];if(this!==a)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this.length=a.length,this._strip()},BN.prototype.ixor=function(num){return assert((this.negative|num.negative)===0),this.iuxor(num)},BN.prototype.xor=function(num){if(this.length>num.length)return this.clone().ixor(num);return num.clone().ixor(this)},BN.prototype.uxor=function(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this)},BN.prototype.inotn=function(width){assert(typeof width==="number"&&width>=0);var bytesNeeded=Math.ceil(width/26)|0,bitsLeft=width%26;if(this._expand(bytesNeeded),bitsLeft>0)bytesNeeded--;for(var i2=0;i2<bytesNeeded;i2++)this.words[i2]=~this.words[i2]&67108863;if(bitsLeft>0)this.words[i2]=~this.words[i2]&67108863>>26-bitsLeft;return this._strip()},BN.prototype.notn=function(width){return this.clone().inotn(width)},BN.prototype.setn=function(bit,val){assert(typeof bit==="number"&&bit>=0);var off=bit/26|0,wbit=bit%26;if(this._expand(off+1),val)this.words[off]=this.words[off]|1<<wbit;else this.words[off]=this.words[off]&~(1<<wbit);return this._strip()},BN.prototype.iadd=function(num){var r;if(this.negative!==0&&num.negative===0)return this.negative=0,r=this.isub(num),this.negative^=1,this._normSign();else if(this.negative===0&&num.negative!==0)return num.negative=0,r=this.isub(num),num.negative=1,r._normSign();var a,b;if(this.length>num.length)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)+(b.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,this.words[i2]=r&67108863,carry=r>>>26;if(this.length=a.length,carry!==0)this.words[this.length]=carry,this.length++;else if(a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];return this},BN.prototype.add=function(num){var res;if(num.negative!==0&&this.negative===0)return num.negative=0,res=this.sub(num),num.negative^=1,res;else if(num.negative===0&&this.negative!==0)return this.negative=0,res=num.sub(this),this.negative=1,res;if(this.length>num.length)return this.clone().iadd(num);return num.clone().iadd(this)},BN.prototype.isub=function(num){if(num.negative!==0){num.negative=0;var r=this.iadd(num);return num.negative=1,r._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(num),this.negative=1,this._normSign();var cmp=this.cmp(num);if(cmp===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,b;if(cmp>0)a=this,b=num;else a=num,b=this;var carry=0;for(var i2=0;i2<b.length;i2++)r=(a.words[i2]|0)-(b.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;for(;carry!==0&&i2<a.length;i2++)r=(a.words[i2]|0)+carry,carry=r>>26,this.words[i2]=r&67108863;if(carry===0&&i2<a.length&&a!==this)for(;i2<a.length;i2++)this.words[i2]=a.words[i2];if(this.length=Math.max(this.length,i2),a!==this)this.negative=1;return this._strip()},BN.prototype.sub=function(num){return this.clone().isub(num)};function smallMulTo(self2,num,out){out.negative=num.negative^self2.negative;var len2=self2.length+num.length|0;out.length=len2,len2=len2-1|0;var a=self2.words[0]|0,b=num.words[0]|0,r=a*b,lo=r&67108863,carry=r/67108864|0;out.words[0]=lo;for(var k=1;k<len2;k++){var ncarry=carry>>>26,rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j|0;a=self2.words[i2]|0,b=num.words[j]|0,r=a*b+rword,ncarry+=r/67108864|0,rword=r&67108863}out.words[k]=rword|0,carry=ncarry|0}if(carry!==0)out.words[k]=carry|0;else out.length--;return out._strip()}var comb10MulTo=function(self2,num,out){var a=self2.words,b=num.words,o=out.words,c=0,lo,mid,hi,a0=a[0]|0,al0=a0&8191,ah0=a0>>>13,a1=a[1]|0,al1=a1&8191,ah1=a1>>>13,a2=a[2]|0,al2=a2&8191,ah2=a2>>>13,a3=a[3]|0,al3=a3&8191,ah3=a3>>>13,a4=a[4]|0,al4=a4&8191,ah4=a4>>>13,a5=a[5]|0,al5=a5&8191,ah5=a5>>>13,a6=a[6]|0,al6=a6&8191,ah6=a6>>>13,a7=a[7]|0,al7=a7&8191,ah7=a7>>>13,a8=a[8]|0,al8=a8&8191,ah8=a8>>>13,a9=a[9]|0,al9=a9&8191,ah9=a9>>>13,b0=b[0]|0,bl0=b0&8191,bh0=b0>>>13,b1=b[1]|0,bl1=b1&8191,bh1=b1>>>13,b2=b[2]|0,bl2=b2&8191,bh2=b2>>>13,b3=b[3]|0,bl3=b3&8191,bh3=b3>>>13,b4=b[4]|0,bl4=b4&8191,bh4=b4>>>13,b5=b[5]|0,bl5=b5&8191,bh5=b5>>>13,b6=b[6]|0,bl6=b6&8191,bh6=b6>>>13,b7=b[7]|0,bl7=b7&8191,bh7=b7>>>13,b8=b[8]|0,bl8=b8&8191,bh8=b8>>>13,b9=b[9]|0,bl9=b9&8191,bh9=b9>>>13;out.negative=self2.negative^num.negative,out.length=19,lo=Math.imul(al0,bl0),mid=Math.imul(al0,bh0),mid=mid+Math.imul(ah0,bl0)|0,hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0,w0&=67108863,lo=Math.imul(al1,bl0),mid=Math.imul(al1,bh0),mid=mid+Math.imul(ah1,bl0)|0,hi=Math.imul(ah1,bh0),lo=lo+Math.imul(al0,bl1)|0,mid=mid+Math.imul(al0,bh1)|0,mid=mid+Math.imul(ah0,bl1)|0,hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0,w1&=67108863,lo=Math.imul(al2,bl0),mid=Math.imul(al2,bh0),mid=mid+Math.imul(ah2,bl0)|0,hi=Math.imul(ah2,bh0),lo=lo+Math.imul(al1,bl1)|0,mid=mid+Math.imul(al1,bh1)|0,mid=mid+Math.imul(ah1,bl1)|0,hi=hi+Math.imul(ah1,bh1)|0,lo=lo+Math.imul(al0,bl2)|0,mid=mid+Math.imul(al0,bh2)|0,mid=mid+Math.imul(ah0,bl2)|0,hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0,w2&=67108863,lo=Math.imul(al3,bl0),mid=Math.imul(al3,bh0),mid=mid+Math.imul(ah3,bl0)|0,hi=Math.imul(ah3,bh0),lo=lo+Math.imul(al2,bl1)|0,mid=mid+Math.imul(al2,bh1)|0,mid=mid+Math.imul(ah2,bl1)|0,hi=hi+Math.imul(ah2,bh1)|0,lo=lo+Math.imul(al1,bl2)|0,mid=mid+Math.imul(al1,bh2)|0,mid=mid+Math.imul(ah1,bl2)|0,hi=hi+Math.imul(ah1,bh2)|0,lo=lo+Math.imul(al0,bl3)|0,mid=mid+Math.imul(al0,bh3)|0,mid=mid+Math.imul(ah0,bl3)|0,hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0,w3&=67108863,lo=Math.imul(al4,bl0),mid=Math.imul(al4,bh0),mid=mid+Math.imul(ah4,bl0)|0,hi=Math.imul(ah4,bh0),lo=lo+Math.imul(al3,bl1)|0,mid=mid+Math.imul(al3,bh1)|0,mid=mid+Math.imul(ah3,bl1)|0,hi=hi+Math.imul(ah3,bh1)|0,lo=lo+Math.imul(al2,bl2)|0,mid=mid+Math.imul(al2,bh2)|0,mid=mid+Math.imul(ah2,bl2)|0,hi=hi+Math.imul(ah2,bh2)|0,lo=lo+Math.imul(al1,bl3)|0,mid=mid+Math.imul(al1,bh3)|0,mid=mid+Math.imul(ah1,bl3)|0,hi=hi+Math.imul(ah1,bh3)|0,lo=lo+Math.imul(al0,bl4)|0,mid=mid+Math.imul(al0,bh4)|0,mid=mid+Math.imul(ah0,bl4)|0,hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0,w4&=67108863,lo=Math.imul(al5,bl0),mid=Math.imul(al5,bh0),mid=mid+Math.imul(ah5,bl0)|0,hi=Math.imul(ah5,bh0),lo=lo+Math.imul(al4,bl1)|0,mid=mid+Math.imul(al4,bh1)|0,mid=mid+Math.imul(ah4,bl1)|0,hi=hi+Math.imul(ah4,bh1)|0,lo=lo+Math.imul(al3,bl2)|0,mid=mid+Math.imul(al3,bh2)|0,mid=mid+Math.imul(ah3,bl2)|0,hi=hi+Math.imul(ah3,bh2)|0,lo=lo+Math.imul(al2,bl3)|0,mid=mid+Math.imul(al2,bh3)|0,mid=mid+Math.imul(ah2,bl3)|0,hi=hi+Math.imul(ah2,bh3)|0,lo=lo+Math.imul(al1,bl4)|0,mid=mid+Math.imul(al1,bh4)|0,mid=mid+Math.imul(ah1,bl4)|0,hi=hi+Math.imul(ah1,bh4)|0,lo=lo+Math.imul(al0,bl5)|0,mid=mid+Math.imul(al0,bh5)|0,mid=mid+Math.imul(ah0,bl5)|0,hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0,w5&=67108863,lo=Math.imul(al6,bl0),mid=Math.imul(al6,bh0),mid=mid+Math.imul(ah6,bl0)|0,hi=Math.imul(ah6,bh0),lo=lo+Math.imul(al5,bl1)|0,mid=mid+Math.imul(al5,bh1)|0,mid=mid+Math.imul(ah5,bl1)|0,hi=hi+Math.imul(ah5,bh1)|0,lo=lo+Math.imul(al4,bl2)|0,mid=mid+Math.imul(al4,bh2)|0,mid=mid+Math.imul(ah4,bl2)|0,hi=hi+Math.imul(ah4,bh2)|0,lo=lo+Math.imul(al3,bl3)|0,mid=mid+Math.imul(al3,bh3)|0,mid=mid+Math.imul(ah3,bl3)|0,hi=hi+Math.imul(ah3,bh3)|0,lo=lo+Math.imul(al2,bl4)|0,mid=mid+Math.imul(al2,bh4)|0,mid=mid+Math.imul(ah2,bl4)|0,hi=hi+Math.imul(ah2,bh4)|0,lo=lo+Math.imul(al1,bl5)|0,mid=mid+Math.imul(al1,bh5)|0,mid=mid+Math.imul(ah1,bl5)|0,hi=hi+Math.imul(ah1,bh5)|0,lo=lo+Math.imul(al0,bl6)|0,mid=mid+Math.imul(al0,bh6)|0,mid=mid+Math.imul(ah0,bl6)|0,hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0,w6&=67108863,lo=Math.imul(al7,bl0),mid=Math.imul(al7,bh0),mid=mid+Math.imul(ah7,bl0)|0,hi=Math.imul(ah7,bh0),lo=lo+Math.imul(al6,bl1)|0,mid=mid+Math.imul(al6,bh1)|0,mid=mid+Math.imul(ah6,bl1)|0,hi=hi+Math.imul(ah6,bh1)|0,lo=lo+Math.imul(al5,bl2)|0,mid=mid+Math.imul(al5,bh2)|0,mid=mid+Math.imul(ah5,bl2)|0,hi=hi+Math.imul(ah5,bh2)|0,lo=lo+Math.imul(al4,bl3)|0,mid=mid+Math.imul(al4,bh3)|0,mid=mid+Math.imul(ah4,bl3)|0,hi=hi+Math.imul(ah4,bh3)|0,lo=lo+Math.imul(al3,bl4)|0,mid=mid+Math.imul(al3,bh4)|0,mid=mid+Math.imul(ah3,bl4)|0,hi=hi+Math.imul(ah3,bh4)|0,lo=lo+Math.imul(al2,bl5)|0,mid=mid+Math.imul(al2,bh5)|0,mid=mid+Math.imul(ah2,bl5)|0,hi=hi+Math.imul(ah2,bh5)|0,lo=lo+Math.imul(al1,bl6)|0,mid=mid+Math.imul(al1,bh6)|0,mid=mid+Math.imul(ah1,bl6)|0,hi=hi+Math.imul(ah1,bh6)|0,lo=lo+Math.imul(al0,bl7)|0,mid=mid+Math.imul(al0,bh7)|0,mid=mid+Math.imul(ah0,bl7)|0,hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0,w7&=67108863,lo=Math.imul(al8,bl0),mid=Math.imul(al8,bh0),mid=mid+Math.imul(ah8,bl0)|0,hi=Math.imul(ah8,bh0),lo=lo+Math.imul(al7,bl1)|0,mid=mid+Math.imul(al7,bh1)|0,mid=mid+Math.imul(ah7,bl1)|0,hi=hi+Math.imul(ah7,bh1)|0,lo=lo+Math.imul(al6,bl2)|0,mid=mid+Math.imul(al6,bh2)|0,mid=mid+Math.imul(ah6,bl2)|0,hi=hi+Math.imul(ah6,bh2)|0,lo=lo+Math.imul(al5,bl3)|0,mid=mid+Math.imul(al5,bh3)|0,mid=mid+Math.imul(ah5,bl3)|0,hi=hi+Math.imul(ah5,bh3)|0,lo=lo+Math.imul(al4,bl4)|0,mid=mid+Math.imul(al4,bh4)|0,mid=mid+Math.imul(ah4,bl4)|0,hi=hi+Math.imul(ah4,bh4)|0,lo=lo+Math.imul(al3,bl5)|0,mid=mid+Math.imul(al3,bh5)|0,mid=mid+Math.imul(ah3,bl5)|0,hi=hi+Math.imul(ah3,bh5)|0,lo=lo+Math.imul(al2,bl6)|0,mid=mid+Math.imul(al2,bh6)|0,mid=mid+Math.imul(ah2,bl6)|0,hi=hi+Math.imul(ah2,bh6)|0,lo=lo+Math.imul(al1,bl7)|0,mid=mid+Math.imul(al1,bh7)|0,mid=mid+Math.imul(ah1,bl7)|0,hi=hi+Math.imul(ah1,bh7)|0,lo=lo+Math.imul(al0,bl8)|0,mid=mid+Math.imul(al0,bh8)|0,mid=mid+Math.imul(ah0,bl8)|0,hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0,w8&=67108863,lo=Math.imul(al9,bl0),mid=Math.imul(al9,bh0),mid=mid+Math.imul(ah9,bl0)|0,hi=Math.imul(ah9,bh0),lo=lo+Math.imul(al8,bl1)|0,mid=mid+Math.imul(al8,bh1)|0,mid=mid+Math.imul(ah8,bl1)|0,hi=hi+Math.imul(ah8,bh1)|0,lo=lo+Math.imul(al7,bl2)|0,mid=mid+Math.imul(al7,bh2)|0,mid=mid+Math.imul(ah7,bl2)|0,hi=hi+Math.imul(ah7,bh2)|0,lo=lo+Math.imul(al6,bl3)|0,mid=mid+Math.imul(al6,bh3)|0,mid=mid+Math.imul(ah6,bl3)|0,hi=hi+Math.imul(ah6,bh3)|0,lo=lo+Math.imul(al5,bl4)|0,mid=mid+Math.imul(al5,bh4)|0,mid=mid+Math.imul(ah5,bl4)|0,hi=hi+Math.imul(ah5,bh4)|0,lo=lo+Math.imul(al4,bl5)|0,mid=mid+Math.imul(al4,bh5)|0,mid=mid+Math.imul(ah4,bl5)|0,hi=hi+Math.imul(ah4,bh5)|0,lo=lo+Math.imul(al3,bl6)|0,mid=mid+Math.imul(al3,bh6)|0,mid=mid+Math.imul(ah3,bl6)|0,hi=hi+Math.imul(ah3,bh6)|0,lo=lo+Math.imul(al2,bl7)|0,mid=mid+Math.imul(al2,bh7)|0,mid=mid+Math.imul(ah2,bl7)|0,hi=hi+Math.imul(ah2,bh7)|0,lo=lo+Math.imul(al1,bl8)|0,mid=mid+Math.imul(al1,bh8)|0,mid=mid+Math.imul(ah1,bl8)|0,hi=hi+Math.imul(ah1,bh8)|0,lo=lo+Math.imul(al0,bl9)|0,mid=mid+Math.imul(al0,bh9)|0,mid=mid+Math.imul(ah0,bl9)|0,hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0,w9&=67108863,lo=Math.imul(al9,bl1),mid=Math.imul(al9,bh1),mid=mid+Math.imul(ah9,bl1)|0,hi=Math.imul(ah9,bh1),lo=lo+Math.imul(al8,bl2)|0,mid=mid+Math.imul(al8,bh2)|0,mid=mid+Math.imul(ah8,bl2)|0,hi=hi+Math.imul(ah8,bh2)|0,lo=lo+Math.imul(al7,bl3)|0,mid=mid+Math.imul(al7,bh3)|0,mid=mid+Math.imul(ah7,bl3)|0,hi=hi+Math.imul(ah7,bh3)|0,lo=lo+Math.imul(al6,bl4)|0,mid=mid+Math.imul(al6,bh4)|0,mid=mid+Math.imul(ah6,bl4)|0,hi=hi+Math.imul(ah6,bh4)|0,lo=lo+Math.imul(al5,bl5)|0,mid=mid+Math.imul(al5,bh5)|0,mid=mid+Math.imul(ah5,bl5)|0,hi=hi+Math.imul(ah5,bh5)|0,lo=lo+Math.imul(al4,bl6)|0,mid=mid+Math.imul(al4,bh6)|0,mid=mid+Math.imul(ah4,bl6)|0,hi=hi+Math.imul(ah4,bh6)|0,lo=lo+Math.imul(al3,bl7)|0,mid=mid+Math.imul(al3,bh7)|0,mid=mid+Math.imul(ah3,bl7)|0,hi=hi+Math.imul(ah3,bh7)|0,lo=lo+Math.imul(al2,bl8)|0,mid=mid+Math.imul(al2,bh8)|0,mid=mid+Math.imul(ah2,bl8)|0,hi=hi+Math.imul(ah2,bh8)|0,lo=lo+Math.imul(al1,bl9)|0,mid=mid+Math.imul(al1,bh9)|0,mid=mid+Math.imul(ah1,bl9)|0,hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0,w10&=67108863,lo=Math.imul(al9,bl2),mid=Math.imul(al9,bh2),mid=mid+Math.imul(ah9,bl2)|0,hi=Math.imul(ah9,bh2),lo=lo+Math.imul(al8,bl3)|0,mid=mid+Math.imul(al8,bh3)|0,mid=mid+Math.imul(ah8,bl3)|0,hi=hi+Math.imul(ah8,bh3)|0,lo=lo+Math.imul(al7,bl4)|0,mid=mid+Math.imul(al7,bh4)|0,mid=mid+Math.imul(ah7,bl4)|0,hi=hi+Math.imul(ah7,bh4)|0,lo=lo+Math.imul(al6,bl5)|0,mid=mid+Math.imul(al6,bh5)|0,mid=mid+Math.imul(ah6,bl5)|0,hi=hi+Math.imul(ah6,bh5)|0,lo=lo+Math.imul(al5,bl6)|0,mid=mid+Math.imul(al5,bh6)|0,mid=mid+Math.imul(ah5,bl6)|0,hi=hi+Math.imul(ah5,bh6)|0,lo=lo+Math.imul(al4,bl7)|0,mid=mid+Math.imul(al4,bh7)|0,mid=mid+Math.imul(ah4,bl7)|0,hi=hi+Math.imul(ah4,bh7)|0,lo=lo+Math.imul(al3,bl8)|0,mid=mid+Math.imul(al3,bh8)|0,mid=mid+Math.imul(ah3,bl8)|0,hi=hi+Math.imul(ah3,bh8)|0,lo=lo+Math.imul(al2,bl9)|0,mid=mid+Math.imul(al2,bh9)|0,mid=mid+Math.imul(ah2,bl9)|0,hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0,w11&=67108863,lo=Math.imul(al9,bl3),mid=Math.imul(al9,bh3),mid=mid+Math.imul(ah9,bl3)|0,hi=Math.imul(ah9,bh3),lo=lo+Math.imul(al8,bl4)|0,mid=mid+Math.imul(al8,bh4)|0,mid=mid+Math.imul(ah8,bl4)|0,hi=hi+Math.imul(ah8,bh4)|0,lo=lo+Math.imul(al7,bl5)|0,mid=mid+Math.imul(al7,bh5)|0,mid=mid+Math.imul(ah7,bl5)|0,hi=hi+Math.imul(ah7,bh5)|0,lo=lo+Math.imul(al6,bl6)|0,mid=mid+Math.imul(al6,bh6)|0,mid=mid+Math.imul(ah6,bl6)|0,hi=hi+Math.imul(ah6,bh6)|0,lo=lo+Math.imul(al5,bl7)|0,mid=mid+Math.imul(al5,bh7)|0,mid=mid+Math.imul(ah5,bl7)|0,hi=hi+Math.imul(ah5,bh7)|0,lo=lo+Math.imul(al4,bl8)|0,mid=mid+Math.imul(al4,bh8)|0,mid=mid+Math.imul(ah4,bl8)|0,hi=hi+Math.imul(ah4,bh8)|0,lo=lo+Math.imul(al3,bl9)|0,mid=mid+Math.imul(al3,bh9)|0,mid=mid+Math.imul(ah3,bl9)|0,hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0,w12&=67108863,lo=Math.imul(al9,bl4),mid=Math.imul(al9,bh4),mid=mid+Math.imul(ah9,bl4)|0,hi=Math.imul(ah9,bh4),lo=lo+Math.imul(al8,bl5)|0,mid=mid+Math.imul(al8,bh5)|0,mid=mid+Math.imul(ah8,bl5)|0,hi=hi+Math.imul(ah8,bh5)|0,lo=lo+Math.imul(al7,bl6)|0,mid=mid+Math.imul(al7,bh6)|0,mid=mid+Math.imul(ah7,bl6)|0,hi=hi+Math.imul(ah7,bh6)|0,lo=lo+Math.imul(al6,bl7)|0,mid=mid+Math.imul(al6,bh7)|0,mid=mid+Math.imul(ah6,bl7)|0,hi=hi+Math.imul(ah6,bh7)|0,lo=lo+Math.imul(al5,bl8)|0,mid=mid+Math.imul(al5,bh8)|0,mid=mid+Math.imul(ah5,bl8)|0,hi=hi+Math.imul(ah5,bh8)|0,lo=lo+Math.imul(al4,bl9)|0,mid=mid+Math.imul(al4,bh9)|0,mid=mid+Math.imul(ah4,bl9)|0,hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0,w13&=67108863,lo=Math.imul(al9,bl5),mid=Math.imul(al9,bh5),mid=mid+Math.imul(ah9,bl5)|0,hi=Math.imul(ah9,bh5),lo=lo+Math.imul(al8,bl6)|0,mid=mid+Math.imul(al8,bh6)|0,mid=mid+Math.imul(ah8,bl6)|0,hi=hi+Math.imul(ah8,bh6)|0,lo=lo+Math.imul(al7,bl7)|0,mid=mid+Math.imul(al7,bh7)|0,mid=mid+Math.imul(ah7,bl7)|0,hi=hi+Math.imul(ah7,bh7)|0,lo=lo+Math.imul(al6,bl8)|0,mid=mid+Math.imul(al6,bh8)|0,mid=mid+Math.imul(ah6,bl8)|0,hi=hi+Math.imul(ah6,bh8)|0,lo=lo+Math.imul(al5,bl9)|0,mid=mid+Math.imul(al5,bh9)|0,mid=mid+Math.imul(ah5,bl9)|0,hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0,w14&=67108863,lo=Math.imul(al9,bl6),mid=Math.imul(al9,bh6),mid=mid+Math.imul(ah9,bl6)|0,hi=Math.imul(ah9,bh6),lo=lo+Math.imul(al8,bl7)|0,mid=mid+Math.imul(al8,bh7)|0,mid=mid+Math.imul(ah8,bl7)|0,hi=hi+Math.imul(ah8,bh7)|0,lo=lo+Math.imul(al7,bl8)|0,mid=mid+Math.imul(al7,bh8)|0,mid=mid+Math.imul(ah7,bl8)|0,hi=hi+Math.imul(ah7,bh8)|0,lo=lo+Math.imul(al6,bl9)|0,mid=mid+Math.imul(al6,bh9)|0,mid=mid+Math.imul(ah6,bl9)|0,hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0,w15&=67108863,lo=Math.imul(al9,bl7),mid=Math.imul(al9,bh7),mid=mid+Math.imul(ah9,bl7)|0,hi=Math.imul(ah9,bh7),lo=lo+Math.imul(al8,bl8)|0,mid=mid+Math.imul(al8,bh8)|0,mid=mid+Math.imul(ah8,bl8)|0,hi=hi+Math.imul(ah8,bh8)|0,lo=lo+Math.imul(al7,bl9)|0,mid=mid+Math.imul(al7,bh9)|0,mid=mid+Math.imul(ah7,bl9)|0,hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0,w16&=67108863,lo=Math.imul(al9,bl8),mid=Math.imul(al9,bh8),mid=mid+Math.imul(ah9,bl8)|0,hi=Math.imul(ah9,bh8),lo=lo+Math.imul(al8,bl9)|0,mid=mid+Math.imul(al8,bh9)|0,mid=mid+Math.imul(ah8,bl9)|0,hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0,w17&=67108863,lo=Math.imul(al9,bl9),mid=Math.imul(al9,bh9),mid=mid+Math.imul(ah9,bl9)|0,hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&8191)<<13)|0;if(c=(hi+(mid>>>13)|0)+(w18>>>26)|0,w18&=67108863,o[0]=w0,o[1]=w1,o[2]=w2,o[3]=w3,o[4]=w4,o[5]=w5,o[6]=w6,o[7]=w7,o[8]=w8,o[9]=w9,o[10]=w10,o[11]=w11,o[12]=w12,o[13]=w13,o[14]=w14,o[15]=w15,o[16]=w16,o[17]=w17,o[18]=w18,c!==0)o[19]=c,out.length++;return out};if(!Math.imul)comb10MulTo=smallMulTo;function bigMulTo(self2,num,out){out.negative=num.negative^self2.negative,out.length=self2.length+num.length;var carry=0,hncarry=0;for(var k=0;k<out.length-1;k++){var ncarry=hncarry;hncarry=0;var rword=carry&67108863,maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self2.length+1);j<=maxJ;j++){var i2=k-j,a=self2.words[i2]|0,b=num.words[j]|0,r=a*b,lo=r&67108863;ncarry=ncarry+(r/67108864|0)|0,lo=lo+rword|0,rword=lo&67108863,ncarry=ncarry+(lo>>>26)|0,hncarry+=ncarry>>>26,ncarry&=67108863}out.words[k]=rword,carry=ncarry,ncarry=hncarry}if(carry!==0)out.words[k]=carry;else out.length--;return out._strip()}function jumboMulTo(self2,num,out){return bigMulTo(self2,num,out)}BN.prototype.mulTo=function(num,out){var res,len2=this.length+num.length;if(this.length===10&&num.length===10)res=comb10MulTo(this,num,out);else if(len2<63)res=smallMulTo(this,num,out);else if(len2<1024)res=bigMulTo(this,num,out);else res=jumboMulTo(this,num,out);return res};function FFTM(x,y){this.x=x,this.y=y}FFTM.prototype.makeRBT=function(N){var t=Array(N),l=BN.prototype._countBits(N)-1;for(var i2=0;i2<N;i2++)t[i2]=this.revBin(i2,l,N);return t},FFTM.prototype.revBin=function(x,l,N){if(x===0||x===N-1)return x;var rb=0;for(var i2=0;i2<l;i2++)rb|=(x&1)<<l-i2-1,x>>=1;return rb},FFTM.prototype.permute=function(rbt,rws,iws,rtws,itws,N){for(var i2=0;i2<N;i2++)rtws[i2]=rws[rbt[i2]],itws[i2]=iws[rbt[i2]]},FFTM.prototype.transform=function(rws,iws,rtws,itws,N,rbt){this.permute(rbt,rws,iws,rtws,itws,N);for(var s=1;s<N;s<<=1){var l=s<<1,rtwdf=Math.cos(2*Math.PI/l),itwdf=Math.sin(2*Math.PI/l);for(var p=0;p<N;p+=l){var rtwdf_=rtwdf,itwdf_=itwdf;for(var j=0;j<s;j++){var re=rtws[p+j],ie=itws[p+j],ro=rtws[p+j+s],io=itws[p+j+s],rx=rtwdf_*ro-itwdf_*io;if(io=rtwdf_*io+itwdf_*ro,ro=rx,rtws[p+j]=re+ro,itws[p+j]=ie+io,rtws[p+j+s]=re-ro,itws[p+j+s]=ie-io,j!==l)rx=rtwdf*rtwdf_-itwdf*itwdf_,itwdf_=rtwdf*itwdf_+itwdf*rtwdf_,rtwdf_=rx}}}},FFTM.prototype.guessLen13b=function(n,m){var N=Math.max(m,n)|1,odd=N&1,i2=0;for(N=N/2|0;N;N=N>>>1)i2++;return 1<<i2+1+odd},FFTM.prototype.conjugate=function(rws,iws,N){if(N<=1)return;for(var i2=0;i2<N/2;i2++){var t=rws[i2];rws[i2]=rws[N-i2-1],rws[N-i2-1]=t,t=iws[i2],iws[i2]=-iws[N-i2-1],iws[N-i2-1]=-t}},FFTM.prototype.normalize13b=function(ws,N){var carry=0;for(var i2=0;i2<N/2;i2++){var w=Math.round(ws[2*i2+1]/N)*8192+Math.round(ws[2*i2]/N)+carry;if(ws[i2]=w&67108863,w<67108864)carry=0;else carry=w/67108864|0}return ws},FFTM.prototype.convert13b=function(ws,len2,rws,N){var carry=0;for(var i2=0;i2<len2;i2++)carry=carry+(ws[i2]|0),rws[2*i2]=carry&8191,carry=carry>>>13,rws[2*i2+1]=carry&8191,carry=carry>>>13;for(i2=2*len2;i2<N;++i2)rws[i2]=0;assert(carry===0),assert((carry&-8192)===0)},FFTM.prototype.stub=function(N){var ph=Array(N);for(var i2=0;i2<N;i2++)ph[i2]=0;return ph},FFTM.prototype.mulp=function(x,y,out){var N=2*this.guessLen13b(x.length,y.length),rbt=this.makeRBT(N),_=this.stub(N),rws=Array(N),rwst=Array(N),iwst=Array(N),nrws=Array(N),nrwst=Array(N),niwst=Array(N),rmws=out.words;rmws.length=N,this.convert13b(x.words,x.length,rws,N),this.convert13b(y.words,y.length,nrws,N),this.transform(rws,_,rwst,iwst,N,rbt),this.transform(nrws,_,nrwst,niwst,N,rbt);for(var i2=0;i2<N;i2++){var rx=rwst[i2]*nrwst[i2]-iwst[i2]*niwst[i2];iwst[i2]=rwst[i2]*niwst[i2]+iwst[i2]*nrwst[i2],rwst[i2]=rx}return this.conjugate(rwst,iwst,N),this.transform(rwst,iwst,rmws,_,N,rbt),this.conjugate(rmws,_,N),this.normalize13b(rmws,N),out.negative=x.negative^y.negative,out.length=x.length+y.length,out._strip()},BN.prototype.mul=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),this.mulTo(num,out)},BN.prototype.mulf=function(num){var out=new BN(null);return out.words=Array(this.length+num.length),jumboMulTo(this,num,out)},BN.prototype.imul=function(num){return this.clone().mulTo(num,this)},BN.prototype.imuln=function(num){var isNegNum=num<0;if(isNegNum)num=-num;assert(typeof num==="number"),assert(num<67108864);var carry=0;for(var i2=0;i2<this.length;i2++){var w=(this.words[i2]|0)*num,lo=(w&67108863)+(carry&67108863);carry>>=26,carry+=w/67108864|0,carry+=lo>>>26,this.words[i2]=lo&67108863}if(carry!==0)this.words[i2]=carry,this.length++;return this.length=num===0?1:this.length,isNegNum?this.ineg():this},BN.prototype.muln=function(num){return this.clone().imuln(num)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.imul(this.clone())},BN.prototype.pow=function(num){var w=toBitArray(num);if(w.length===0)return new BN(1);var res=this;for(var i2=0;i2<w.length;i2++,res=res.sqr())if(w[i2]!==0)break;if(++i2<w.length)for(var q=res.sqr();i2<w.length;i2++,q=q.sqr()){if(w[i2]===0)continue;res=res.mul(q)}return res},BN.prototype.iushln=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26,carryMask=67108863>>>26-r<<26-r,i2;if(r!==0){var carry=0;for(i2=0;i2<this.length;i2++){var newCarry=this.words[i2]&carryMask,c=(this.words[i2]|0)-newCarry<<r;this.words[i2]=c|carry,carry=newCarry>>>26-r}if(carry)this.words[i2]=carry,this.length++}if(s!==0){for(i2=this.length-1;i2>=0;i2--)this.words[i2+s]=this.words[i2];for(i2=0;i2<s;i2++)this.words[i2]=0;this.length+=s}return this._strip()},BN.prototype.ishln=function(bits){return assert(this.negative===0),this.iushln(bits)},BN.prototype.iushrn=function(bits,hint,extended){assert(typeof bits==="number"&&bits>=0);var h;if(hint)h=(hint-hint%26)/26;else h=0;var r=bits%26,s=Math.min((bits-r)/26,this.length),mask=67108863^67108863>>>r<<r,maskedWords=extended;if(h-=s,h=Math.max(0,h),maskedWords){for(var i2=0;i2<s;i2++)maskedWords.words[i2]=this.words[i2];maskedWords.length=s}if(s===0);else if(this.length>s){this.length-=s;for(i2=0;i2<this.length;i2++)this.words[i2]=this.words[i2+s]}else this.words[0]=0,this.length=1;var carry=0;for(i2=this.length-1;i2>=0&&(carry!==0||i2>=h);i2--){var word=this.words[i2]|0;this.words[i2]=carry<<26-r|word>>>r,carry=word&mask}if(maskedWords&&carry!==0)maskedWords.words[maskedWords.length++]=carry;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},BN.prototype.ishrn=function(bits,hint,extended){return assert(this.negative===0),this.iushrn(bits,hint,extended)},BN.prototype.shln=function(bits){return this.clone().ishln(bits)},BN.prototype.ushln=function(bits){return this.clone().iushln(bits)},BN.prototype.shrn=function(bits){return this.clone().ishrn(bits)},BN.prototype.ushrn=function(bits){return this.clone().iushrn(bits)},BN.prototype.testn=function(bit){assert(typeof bit==="number"&&bit>=0);var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return!1;var w=this.words[s];return!!(w&q)},BN.prototype.imaskn=function(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26,s=(bits-r)/26;if(assert(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(r!==0)s++;if(this.length=Math.min(s,this.length),r!==0){var mask=67108863^67108863>>>r<<r;this.words[this.length-1]&=mask}return this._strip()},BN.prototype.maskn=function(bits){return this.clone().imaskn(bits)},BN.prototype.iaddn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.isubn(-num);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<=num)return this.words[0]=num-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(num),this.negative=1,this}return this._iaddn(num)},BN.prototype._iaddn=function(num){this.words[0]+=num;for(var i2=0;i2<this.length&&this.words[i2]>=67108864;i2++)if(this.words[i2]-=67108864,i2===this.length-1)this.words[i2+1]=1;else this.words[i2+1]++;return this.length=Math.max(this.length,i2+1),this},BN.prototype.isubn=function(num){if(assert(typeof num==="number"),assert(num<67108864),num<0)return this.iaddn(-num);if(this.negative!==0)return this.negative=0,this.iaddn(num),this.negative=1,this;if(this.words[0]-=num,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i2=0;i2<this.length&&this.words[i2]<0;i2++)this.words[i2]+=67108864,this.words[i2+1]-=1;return this._strip()},BN.prototype.addn=function(num){return this.clone().iaddn(num)},BN.prototype.subn=function(num){return this.clone().isubn(num)},BN.prototype.iabs=function(){return this.negative=0,this},BN.prototype.abs=function(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function(num,mul,shift){var len2=num.length+shift,i2;this._expand(len2);var w,carry=0;for(i2=0;i2<num.length;i2++){w=(this.words[i2+shift]|0)+carry;var right=(num.words[i2]|0)*mul;w-=right&67108863,carry=(w>>26)-(right/67108864|0),this.words[i2+shift]=w&67108863}for(;i2<this.length-shift;i2++)w=(this.words[i2+shift]|0)+carry,carry=w>>26,this.words[i2+shift]=w&67108863;if(carry===0)return this._strip();assert(carry===-1),carry=0;for(i2=0;i2<this.length;i2++)w=-(this.words[i2]|0)+carry,carry=w>>26,this.words[i2]=w&67108863;return this.negative=1,this._strip()},BN.prototype._wordDiv=function(num,mode){var shift=this.length-num.length,a=this.clone(),b=num,bhi=b.words[b.length-1]|0,bhiBits=this._countBits(bhi);if(shift=26-bhiBits,shift!==0)b=b.ushln(shift),a.iushln(shift),bhi=b.words[b.length-1]|0;var m=a.length-b.length,q;if(mode!=="mod"){q=new BN(null),q.length=m+1,q.words=Array(q.length);for(var i2=0;i2<q.length;i2++)q.words[i2]=0}var diff=a.clone()._ishlnsubmul(b,1,m);if(diff.negative===0){if(a=diff,q)q.words[m]=1}for(var j=m-1;j>=0;j--){var qj=(a.words[b.length+j]|0)*67108864+(a.words[b.length+j-1]|0);qj=Math.min(qj/bhi|0,67108863),a._ishlnsubmul(b,qj,j);while(a.negative!==0)if(qj--,a.negative=0,a._ishlnsubmul(b,1,j),!a.isZero())a.negative^=1;if(q)q.words[j]=qj}if(q)q._strip();if(a._strip(),mode!=="div"&&shift!==0)a.iushrn(shift);return{div:q||null,mod:a}},BN.prototype.divmod=function(num,mode,positive){if(assert(!num.isZero()),this.isZero())return{div:new BN(0),mod:new BN(0)};var div,mod,res;if(this.negative!==0&&num.negative===0){if(res=this.neg().divmod(num,mode),mode!=="mod")div=res.div.neg();if(mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.iadd(num)}return{div,mod}}if(this.negative===0&&num.negative!==0){if(res=this.divmod(num.neg(),mode),mode!=="mod")div=res.div.neg();return{div,mod:res.mod}}if((this.negative&num.negative)!==0){if(res=this.neg().divmod(num.neg(),mode),mode!=="div"){if(mod=res.mod.neg(),positive&&mod.negative!==0)mod.isub(num)}return{div:res.div,mod}}if(num.length>this.length||this.cmp(num)<0)return{div:new BN(0),mod:this};if(num.length===1){if(mode==="div")return{div:this.divn(num.words[0]),mod:null};if(mode==="mod")return{div:null,mod:new BN(this.modrn(num.words[0]))};return{div:this.divn(num.words[0]),mod:new BN(this.modrn(num.words[0]))}}return this._wordDiv(num,mode)},BN.prototype.div=function(num){return this.divmod(num,"div",!1).div},BN.prototype.mod=function(num){return this.divmod(num,"mod",!1).mod},BN.prototype.umod=function(num){return this.divmod(num,"mod",!0).mod},BN.prototype.divRound=function(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod,half=num.ushrn(1),r2=num.andln(1),cmp=mod.cmp(half);if(cmp<0||r2===1&&cmp===0)return dm.div;return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1)},BN.prototype.modrn=function(num){var isNegNum=num<0;if(isNegNum)num=-num;assert(num<=67108863);var p=67108864%num,acc=0;for(var i2=this.length-1;i2>=0;i2--)acc=(p*acc+(this.words[i2]|0))%num;return isNegNum?-acc:acc},BN.prototype.modn=function(num){return this.modrn(num)},BN.prototype.idivn=function(num){var isNegNum=num<0;if(isNegNum)num=-num;assert(num<=67108863);var carry=0;for(var i2=this.length-1;i2>=0;i2--){var w=(this.words[i2]|0)+carry*67108864;this.words[i2]=w/num|0,carry=w%num}return this._strip(),isNegNum?this.ineg():this},BN.prototype.divn=function(num){return this.clone().idivn(num)},BN.prototype.egcd=function(p){assert(p.negative===0),assert(!p.isZero());var x=this,y=p.clone();if(x.negative!==0)x=x.umod(p);else x=x.clone();var A=new BN(1),B=new BN(0),C=new BN(0),D=new BN(1),g=0;while(x.isEven()&&y.isEven())x.iushrn(1),y.iushrn(1),++g;var yp=y.clone(),xp=x.clone();while(!x.isZero()){for(var i2=0,im=1;(x.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){x.iushrn(i2);while(i2-- >0){if(A.isOdd()||B.isOdd())A.iadd(yp),B.isub(xp);A.iushrn(1),B.iushrn(1)}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){y.iushrn(j);while(j-- >0){if(C.isOdd()||D.isOdd())C.iadd(yp),D.isub(xp);C.iushrn(1),D.iushrn(1)}}if(x.cmp(y)>=0)x.isub(y),A.isub(C),B.isub(D);else y.isub(x),C.isub(A),D.isub(B)}return{a:C,b:D,gcd:y.iushln(g)}},BN.prototype._invmp=function(p){assert(p.negative===0),assert(!p.isZero());var a=this,b=p.clone();if(a.negative!==0)a=a.umod(p);else a=a.clone();var x1=new BN(1),x2=new BN(0),delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i2=0,im=1;(a.words[0]&im)===0&&i2<26;++i2,im<<=1);if(i2>0){a.iushrn(i2);while(i2-- >0){if(x1.isOdd())x1.iadd(delta);x1.iushrn(1)}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){b.iushrn(j);while(j-- >0){if(x2.isOdd())x2.iadd(delta);x2.iushrn(1)}}if(a.cmp(b)>=0)a.isub(b),x1.isub(x2);else b.isub(a),x2.isub(x1)}var res;if(a.cmpn(1)===0)res=x1;else res=x2;if(res.cmpn(0)<0)res.iadd(p);return res},BN.prototype.gcd=function(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone(),b=num.clone();a.negative=0,b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++)a.iushrn(1),b.iushrn(1);do{while(a.isEven())a.iushrn(1);while(b.isEven())b.iushrn(1);var r=a.cmp(b);if(r<0){var t=a;a=b,b=t}else if(r===0||b.cmpn(1)===0)break;a.isub(b)}while(!0);return b.iushln(shift)},BN.prototype.invm=function(num){return this.egcd(num).a.umod(num)},BN.prototype.isEven=function(){return(this.words[0]&1)===0},BN.prototype.isOdd=function(){return(this.words[0]&1)===1},BN.prototype.andln=function(num){return this.words[0]&num},BN.prototype.bincn=function(bit){assert(typeof bit==="number");var r=bit%26,s=(bit-r)/26,q=1<<r;if(this.length<=s)return this._expand(s+1),this.words[s]|=q,this;var carry=q;for(var i2=s;carry!==0&&i2<this.length;i2++){var w=this.words[i2]|0;w+=carry,carry=w>>>26,w&=67108863,this.words[i2]=w}if(carry!==0)this.words[i2]=carry,this.length++;return this},BN.prototype.isZero=function(){return this.length===1&&this.words[0]===0},BN.prototype.cmpn=function(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this._strip();var res;if(this.length>1)res=1;else{if(negative)num=-num;assert(num<=67108863,"Number is too big");var w=this.words[0]|0;res=w===num?0:w<num?-1:1}if(this.negative!==0)return-res|0;return res},BN.prototype.cmp=function(num){if(this.negative!==0&&num.negative===0)return-1;if(this.negative===0&&num.negative!==0)return 1;var res=this.ucmp(num);if(this.negative!==0)return-res|0;return res},BN.prototype.ucmp=function(num){if(this.length>num.length)return 1;if(this.length<num.length)return-1;var res=0;for(var i2=this.length-1;i2>=0;i2--){var a=this.words[i2]|0,b=num.words[i2]|0;if(a===b)continue;if(a<b)res=-1;else if(a>b)res=1;break}return res},BN.prototype.gtn=function(num){return this.cmpn(num)===1},BN.prototype.gt=function(num){return this.cmp(num)===1},BN.prototype.gten=function(num){return this.cmpn(num)>=0},BN.prototype.gte=function(num){return this.cmp(num)>=0},BN.prototype.ltn=function(num){return this.cmpn(num)===-1},BN.prototype.lt=function(num){return this.cmp(num)===-1},BN.prototype.lten=function(num){return this.cmpn(num)<=0},BN.prototype.lte=function(num){return this.cmp(num)<=0},BN.prototype.eqn=function(num){return this.cmpn(num)===0},BN.prototype.eq=function(num){return this.cmp(num)===0},BN.red=function(num){return new Red(num)},BN.prototype.toRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),assert(this.negative===0,"red works only with positives"),ctx.convertTo(this)._forceRed(ctx)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(ctx){return this.red=ctx,this},BN.prototype.forceRed=function(ctx){return assert(!this.red,"Already a number in reduction context"),this._forceRed(ctx)},BN.prototype.redAdd=function(num){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,num)},BN.prototype.redIAdd=function(num){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,num)},BN.prototype.redSub=function(num){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,num)},BN.prototype.redISub=function(num){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,num)},BN.prototype.redShl=function(num){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,num)},BN.prototype.redMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.mul(this,num)},BN.prototype.redIMul=function(num){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,num),this.red.imul(this,num)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(num){return assert(this.red&&!num.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};function MPrime(name,p){this.name=name,this.p=new BN(p,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}MPrime.prototype._tmp=function(){var tmp=new BN(null);return tmp.words=Array(Math.ceil(this.n/13)),tmp},MPrime.prototype.ireduce=function(num){var r=num,rlen;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),rlen=r.bitLength();while(rlen>this.n);var cmp=rlen<this.n?-1:r.ucmp(this.p);if(cmp===0)r.words[0]=0,r.length=1;else if(cmp>0)r.isub(this.p);else if(r.strip!==void 0)r.strip();else r._strip();return r},MPrime.prototype.split=function(input,out){input.iushrn(this.n,0,out)},MPrime.prototype.imulK=function(num){return num.imul(this.k)};function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}inherits2(K256,MPrime),K256.prototype.split=function(input,output){var mask=4194303,outLen=Math.min(input.length,9);for(var i2=0;i2<outLen;i2++)output.words[i2]=input.words[i2];if(output.length=outLen,input.length<=9){input.words[0]=0,input.length=1;return}var prev=input.words[9];output.words[output.length++]=prev&mask;for(i2=10;i2<input.length;i2++){var next=input.words[i2]|0;input.words[i2-10]=(next&mask)<<4|prev>>>22,prev=next}if(prev>>>=22,input.words[i2-10]=prev,prev===0&&input.length>10)input.length-=10;else input.length-=9},K256.prototype.imulK=function(num){num.words[num.length]=0,num.words[num.length+1]=0,num.length+=2;var lo=0;for(var i2=0;i2<num.length;i2++){var w=num.words[i2]|0;lo+=w*977,num.words[i2]=lo&67108863,lo=w*64+(lo/67108864|0)}if(num.words[num.length-1]===0){if(num.length--,num.words[num.length-1]===0)num.length--}return num};function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}inherits2(P224,MPrime);function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}inherits2(P192,MPrime);function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}inherits2(P25519,MPrime),P25519.prototype.imulK=function(num){var carry=0;for(var i2=0;i2<num.length;i2++){var hi=(num.words[i2]|0)*19+carry,lo=hi&67108863;hi>>>=26,num.words[i2]=lo,carry=hi}if(carry!==0)num.words[num.length++]=carry;return num},BN._prime=function(name){if(primes[name])return primes[name];var prime;if(name==="k256")prime=new K256;else if(name==="p224")prime=new P224;else if(name==="p192")prime=new P192;else if(name==="p25519")prime=new P25519;else throw Error("Unknown prime "+name);return primes[name]=prime,prime};function Red(m){if(typeof m==="string"){var prime=BN._prime(m);this.m=prime.p,this.prime=prime}else assert(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}Red.prototype._verify1=function(a){assert(a.negative===0,"red works only with positives"),assert(a.red,"red works only with red numbers")},Red.prototype._verify2=function(a,b){assert((a.negative|b.negative)===0,"red works only with positives"),assert(a.red&&a.red===b.red,"red works only with red numbers")},Red.prototype.imod=function(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return move(a,a.umod(this.m)._forceRed(this)),a},Red.prototype.neg=function(a){if(a.isZero())return a.clone();return this.m.sub(a)._forceRed(this)},Red.prototype.add=function(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res._forceRed(this)},Red.prototype.iadd=function(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0)res.isub(this.m);return res},Red.prototype.sub=function(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res._forceRed(this)},Red.prototype.isub=function(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0)res.iadd(this.m);return res},Red.prototype.shl=function(a,num){return this._verify1(a),this.imod(a.ushln(num))},Red.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},Red.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},Red.prototype.isqr=function(a){return this.imul(a,a.clone())},Red.prototype.sqr=function(a){return this.mul(a,a)},Red.prototype.sqrt=function(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);if(assert(mod3%2===1),mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}var q=this.m.subn(1),s=0;while(!q.isZero()&&q.andln(1)===0)s++,q.iushrn(1);assert(!q.isZero());var one=new BN(1).toRed(this),nOne=one.redNeg(),lpow=this.m.subn(1).iushrn(1),z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0)z.redIAdd(nOne);var c=this.pow(z,q),r=this.pow(a,q.addn(1).iushrn(1)),t=this.pow(a,q),m=s;while(t.cmp(one)!==0){var tmp=t;for(var i2=0;tmp.cmp(one)!==0;i2++)tmp=tmp.redSqr();assert(i2<m);var b=this.pow(c,new BN(1).iushln(m-i2-1));r=r.redMul(b),c=b.redSqr(),t=t.redMul(c),m=i2}return r},Red.prototype.invm=function(a){var inv=a._invmp(this.m);if(inv.negative!==0)return inv.negative=0,this.imod(inv).redNeg();else return this.imod(inv)},Red.prototype.pow=function(a,num){if(num.isZero())return new BN(1).toRed(this);if(num.cmpn(1)===0)return a.clone();var windowSize=4,wnd=Array(1<<windowSize);wnd[0]=new BN(1).toRed(this),wnd[1]=a;for(var i2=2;i2<wnd.length;i2++)wnd[i2]=this.mul(wnd[i2-1],a);var res=wnd[0],current=0,currentLen=0,start=num.bitLength()%26;if(start===0)start=26;for(i2=num.length-1;i2>=0;i2--){var word=num.words[i2];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0])res=this.sqr(res);if(bit===0&&current===0){currentLen=0;continue}if(current<<=1,current|=bit,currentLen++,currentLen!==windowSize&&(i2!==0||j!==0))continue;res=this.mul(res,wnd[current]),currentLen=0,current=0}start=26}return res},Red.prototype.convertTo=function(num){var r=num.umod(this.m);return r===num?r.clone():r},Red.prototype.convertFrom=function(num){var res=num.clone();return res.red=null,res},BN.mont=function(num){return new Mont(num)};function Mont(m){if(Red.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}inherits2(Mont,Red),Mont.prototype.convertTo=function(num){return this.imod(num.ushln(this.shift))},Mont.prototype.convertFrom=function(num){var r=this.imod(num.mul(this.rinv));return r.red=null,r},Mont.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var t=a.imul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b),c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=t.isub(c).iushrn(this.shift),res=u;if(u.cmp(this.m)>=0)res=u.isub(this.m);else if(u.cmpn(0)<0)res=u.iadd(this.m);return res._forceRed(this)},Mont.prototype.invm=function(a){var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this)}})(typeof module>"u"||module,exports)}),require_browserify_rsa=__commonJS2((exports,module)=>{var BN=require_bn5(),randomBytes=require_randombytes(),Buffer22=require_safe_buffer().Buffer;function getr(priv){var len2=priv.modulus.byteLength(),r;do r=new BN(randomBytes(len2));while(r.cmp(priv.modulus)>=0||!r.umod(priv.prime1)||!r.umod(priv.prime2));return r}function blind(priv){var r=getr(priv),blinder=r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed();return{blinder,unblinder:r.invm(priv.modulus)}}function crt(msg,priv){var blinds=blind(priv),len2=priv.modulus.byteLength(),blinded=new BN(msg).mul(blinds.blinder).umod(priv.modulus),c1=blinded.toRed(BN.mont(priv.prime1)),c2=blinded.toRed(BN.mont(priv.prime2)),qinv=priv.coefficient,p=priv.prime1,q=priv.prime2,m1=c1.redPow(priv.exponent1).fromRed(),m2=c2.redPow(priv.exponent2).fromRed(),h=m1.isub(m2).imul(qinv).umod(p).imul(q);return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer22,"be",len2)}crt.getr=getr,module.exports=crt}),require_publicEncrypt=__commonJS2((exports,module)=>{var parseKeys=require_parse_asn1(),randomBytes=require_randombytes(),createHash=require_create_hash(),mgf=require_mgf(),xor=require_xor(),BN=require_bn4(),withPublic=require_withPublic(),crt=require_browserify_rsa(),Buffer22=require_safe_buffer().Buffer;module.exports=function(publicKey,msg,reverse){var padding;if(publicKey.padding)padding=publicKey.padding;else if(reverse)padding=1;else padding=4;var key=parseKeys(publicKey),paddedMsg;if(padding===4)paddedMsg=oaep(key,msg);else if(padding===1)paddedMsg=pkcs1(key,msg,reverse);else if(padding===3){if(paddedMsg=new BN(msg),paddedMsg.cmp(key.modulus)>=0)throw Error("data too long for modulus")}else throw Error("unknown padding");if(reverse)return crt(paddedMsg,key);else return withPublic(paddedMsg,key)};function oaep(key,msg){var k=key.modulus.byteLength(),mLen=msg.length,iHash=createHash("sha1").update(Buffer22.alloc(0)).digest(),hLen=iHash.length,hLen2=2*hLen;if(mLen>k-hLen2-2)throw Error("message too long");var ps=Buffer22.alloc(k-mLen-hLen2-2),dblen=k-hLen-1,seed=randomBytes(hLen),maskedDb=xor(Buffer22.concat([iHash,ps,Buffer22.alloc(1,1),msg],dblen),mgf(seed,dblen)),maskedSeed=xor(seed,mgf(maskedDb,hLen));return new BN(Buffer22.concat([Buffer22.alloc(1),maskedSeed,maskedDb],k))}function pkcs1(key,msg,reverse){var mLen=msg.length,k=key.modulus.byteLength();if(mLen>k-11)throw Error("message too long");var ps;if(reverse)ps=Buffer22.alloc(k-mLen-3,255);else ps=nonZero(k-mLen-3);return new BN(Buffer22.concat([Buffer22.from([0,reverse?1:2]),ps,Buffer22.alloc(1),msg],k))}function nonZero(len2){var out=Buffer22.allocUnsafe(len2),i2=0,cache=randomBytes(len2*2),cur=0,num;while(i2<len2){if(cur===cache.length)cache=randomBytes(len2*2),cur=0;if(num=cache[cur++],num)out[i2++]=num}return out}}),require_privateDecrypt=__commonJS2((exports,module)=>{var parseKeys=require_parse_asn1(),mgf=require_mgf(),xor=require_xor(),BN=require_bn4(),crt=require_browserify_rsa(),createHash=require_create_hash(),withPublic=require_withPublic(),Buffer22=require_safe_buffer().Buffer;module.exports=function(privateKey,enc,reverse){var padding;if(privateKey.padding)padding=privateKey.padding;else if(reverse)padding=1;else padding=4;var key=parseKeys(privateKey),k=key.modulus.byteLength();if(enc.length>k||new BN(enc).cmp(key.modulus)>=0)throw Error("decryption error");var msg;if(reverse)msg=withPublic(new BN(enc),key);else msg=crt(enc,key);var zBuffer=Buffer22.alloc(k-msg.length);if(msg=Buffer22.concat([zBuffer,msg],k),padding===4)return oaep(key,msg);else if(padding===1)return pkcs1(key,msg,reverse);else if(padding===3)return msg;else throw Error("unknown padding")};function oaep(key,msg){var k=key.modulus.byteLength(),iHash=createHash("sha1").update(Buffer22.alloc(0)).digest(),hLen=iHash.length;if(msg[0]!==0)throw Error("decryption error");var maskedSeed=msg.slice(1,hLen+1),maskedDb=msg.slice(hLen+1),seed=xor(maskedSeed,mgf(maskedDb,hLen)),db=xor(maskedDb,mgf(seed,k-hLen-1));if(compare(iHash,db.slice(0,hLen)))throw Error("decryption error");var i2=hLen;while(db[i2]===0)i2++;if(db[i2++]!==1)throw Error("decryption error");return db.slice(i2)}function pkcs1(key,msg,reverse){var p1=msg.slice(0,2),i2=2,status=0;while(msg[i2++]!==0)if(i2>=msg.length){status++;break}var ps=msg.slice(2,i2-1);if(p1.toString("hex")!=="0002"&&!reverse||p1.toString("hex")!=="0001"&&reverse)status++;if(ps.length<8)status++;if(status)throw Error("decryption error");return msg.slice(i2)}function compare(a,b){a=Buffer22.from(a),b=Buffer22.from(b);var dif=0,len2=a.length;if(a.length!==b.length)dif++,len2=Math.min(a.length,b.length);var i2=-1;while(++i2<len2)dif+=a[i2]^b[i2];return dif}}),require_browser2=__commonJS2((exports)=>{exports.publicEncrypt=require_publicEncrypt(),exports.privateDecrypt=require_privateDecrypt(),exports.privateEncrypt=function(key,buf){return exports.publicEncrypt(key,buf,!0)},exports.publicDecrypt=function(key,buf){return exports.privateDecrypt(key,buf,!0)}}),require_public_encrypt=__commonJS2((exports)=>{var crypto2=(init_crypto(),__toCommonJS(exports_crypto));if(typeof crypto2.publicEncrypt!=="function")crypto2=require_browser2();if(exports.publicEncrypt=crypto2.publicEncrypt,exports.privateDecrypt=crypto2.privateDecrypt,typeof crypto2.privateEncrypt!=="function")exports.privateEncrypt=require_browser2().privateEncrypt;else exports.privateEncrypt=crypto2.privateEncrypt;if(typeof crypto2.publicDecrypt!=="function")exports.publicDecrypt=require_browser2().publicDecrypt;else exports.publicDecrypt=crypto2.publicDecrypt}),require_browser3=__commonJS2((exports)=>{var safeBuffer=require_safe_buffer(),randombytes=require_randombytes(),Buffer22=safeBuffer.Buffer,kBufferMaxLength=safeBuffer.kMaxLength,crypto2=globalThis.crypto||globalThis.msCrypto,kMaxUint32=Math.pow(2,32)-1;function assertOffset(offset,length){if(typeof offset!=="number"||offset!==offset)throw TypeError("offset must be a number");if(offset>kMaxUint32||offset<0)throw TypeError("offset must be a uint32");if(offset>kBufferMaxLength||offset>length)throw RangeError("offset out of range")}function assertSize2(size,offset,length){if(typeof size!=="number"||size!==size)throw TypeError("size must be a number");if(size>kMaxUint32||size<0)throw TypeError("size must be a uint32");if(size+offset>length||size>kBufferMaxLength)throw RangeError("buffer too small")}crypto2&&crypto2.getRandomValues,exports.randomFill=randomFill,exports.randomFillSync=randomFillSync;function randomFill(buf,offset,size,cb){if(!Buffer22.isBuffer(buf)&&!(buf instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof offset==="function")cb=offset,offset=0,size=buf.length;else if(typeof size==="function")cb=size,size=buf.length-offset;else if(typeof cb!=="function")throw TypeError('"cb" argument must be a function');return assertOffset(offset,buf.length),assertSize2(size,offset,buf.length),actualFill(buf,offset,size,cb)}function actualFill(buf,offset,size,cb){if(!1)var ourBuf,uint;if(cb){randombytes(size,function(err,bytes2){if(err)return cb(err);bytes2.copy(buf,offset),cb(null,buf)});return}var bytes=randombytes(size);return bytes.copy(buf,offset),buf}function randomFillSync(buf,offset,size){if(typeof offset>"u")offset=0;if(!Buffer22.isBuffer(buf)&&!(buf instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(assertOffset(offset,buf.length),size===void 0)size=buf.length-offset;return assertSize2(size,offset,buf.length),actualFill(buf,offset,size)}}),require_randomfill=__commonJS2((exports,module)=>{var crypto2=(init_crypto(),__toCommonJS(exports_crypto));if(typeof crypto2.randomFill==="function"&&typeof crypto2.randomFillSync==="function")exports.randomFill=crypto2.randomFill,exports.randomFillSync=crypto2.randomFillSync;else module.exports=require_browser3()}),require_crypto_browserify=__commonJS2((exports)=>{exports.randomBytes=exports.rng=exports.pseudoRandomBytes=exports.prng=require_randombytes(),exports.createHash=exports.Hash=require_create_hash(),exports.createHmac=exports.Hmac=require_create_hmac();var algos=require_algorithms(),algoKeys=Object.keys(algos),hashes=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(algoKeys);exports.getHashes=function(){return hashes};var p=require_pbkdf2();exports.pbkdf2=p.pbkdf2,exports.pbkdf2Sync=p.pbkdf2Sync;var aes=require_browserify_cipher();exports.Cipher=aes.Cipher,exports.createCipher=aes.createCipher,exports.Cipheriv=aes.Cipheriv,exports.createCipheriv=aes.createCipheriv,exports.Decipher=aes.Decipher,exports.createDecipher=aes.createDecipher,exports.Decipheriv=aes.Decipheriv,exports.createDecipheriv=aes.createDecipheriv,exports.getCiphers=aes.getCiphers,exports.listCiphers=aes.listCiphers;var dh=require_diffie_hellman();exports.DiffieHellmanGroup=dh.DiffieHellmanGroup,exports.createDiffieHellmanGroup=dh.createDiffieHellmanGroup,exports.getDiffieHellman=dh.getDiffieHellman,exports.createDiffieHellman=dh.createDiffieHellman,exports.DiffieHellman=dh.DiffieHellman;var sign=require_browserify_sign();exports.createSign=sign.createSign,exports.Sign=sign.Sign,exports.createVerify=sign.createVerify,exports.Verify=sign.Verify,exports.createECDH=require_create_ecdh();var publicEncrypt=require_public_encrypt();exports.publicEncrypt=publicEncrypt.publicEncrypt,exports.privateEncrypt=publicEncrypt.privateEncrypt,exports.publicDecrypt=publicEncrypt.publicDecrypt,exports.privateDecrypt=publicEncrypt.privateDecrypt;var rf=require_randomfill();exports.randomFill=rf.randomFill,exports.randomFillSync=rf.randomFillSync,exports.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet
15
+ we accept pull requests
16
+ https://github.com/browserify/crypto-browserify`)},exports.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}}),cryptoBrowserify=__toESM(require_crypto_browserify(),1),prng2=cryptoBrowserify.prng,pseudoRandomBytes2=cryptoBrowserify.pseudoRandomBytes,rng2=cryptoBrowserify.rng,randomBytes2=cryptoBrowserify.randomBytes,Hash2=cryptoBrowserify.Hash,createHash2=cryptoBrowserify.createHash,Hmac2=cryptoBrowserify.Hmac,createHmac2=cryptoBrowserify.createHmac,getHashes2=cryptoBrowserify.getHashes,pbkdf22=cryptoBrowserify.pbkdf2,pbkdf2Sync2=cryptoBrowserify.pbkdf2Sync,Cipher2=cryptoBrowserify.Cipher,createCipher2=cryptoBrowserify.createCipher,Cipheriv2=cryptoBrowserify.Cipheriv,createCipheriv2=cryptoBrowserify.createCipheriv,Decipher2=cryptoBrowserify.Decipher,createDecipher2=cryptoBrowserify.createDecipher,Decipheriv2=cryptoBrowserify.Decipheriv,createDecipheriv2=cryptoBrowserify.createDecipheriv,getCiphers2=cryptoBrowserify.getCiphers,listCiphers2=cryptoBrowserify.listCiphers,DiffieHellmanGroup2=cryptoBrowserify.DiffieHellmanGroup,createDiffieHellmanGroup2=cryptoBrowserify.createDiffieHellmanGroup,getDiffieHellman2=cryptoBrowserify.getDiffieHellman,createDiffieHellman2=cryptoBrowserify.createDiffieHellman,DiffieHellman2=cryptoBrowserify.DiffieHellman,createSign2=cryptoBrowserify.createSign,Sign2=cryptoBrowserify.Sign,createVerify2=cryptoBrowserify.createVerify,Verify2=cryptoBrowserify.Verify,createECDH2=cryptoBrowserify.createECDH,publicEncrypt2=cryptoBrowserify.publicEncrypt,privateEncrypt2=cryptoBrowserify.privateEncrypt,publicDecrypt2=cryptoBrowserify.publicDecrypt,privateDecrypt2=cryptoBrowserify.privateDecrypt,randomFill2=cryptoBrowserify.randomFill,randomFillSync2=cryptoBrowserify.randomFillSync,createCredentials2=cryptoBrowserify.createCredentials,constants2=cryptoBrowserify.constants,hardcoded_curves=["p192","p224","p256","p384","p521","curve25519","ed25519","secp256k1","secp224r1","prime256v1","prime192v1","ed25519","secp384r1","secp521r1"];webcrypto=crypto,crypto_default=crypto});var exports_assert={};__export(exports_assert,{throws:()=>throws,strictEqual:()=>strictEqual,strict:()=>strict,rejects:()=>rejects,ok:()=>ok,notStrictEqual:()=>notStrictEqual,notEqual:()=>notEqual,notDeepStrictEqual:()=>notDeepStrictEqual,notDeepEqual:()=>notDeepEqual,match:()=>match,ifError:()=>ifError,fail:()=>fail,equal:()=>equal,doesNotThrow:()=>doesNotThrow,doesNotReject:()=>doesNotReject,doesNotMatch:()=>doesNotMatch,default:()=>assert_default,deepStrictEqual:()=>deepStrictEqual,deepEqual:()=>deepEqual,CallTracker:()=>CallTracker,AssertionError:()=>AssertionError});var __create2,__getProtoOf2,__defProp3,__getOwnPropNames3,__hasOwnProp3,__toESM2=(mod,isNodeMode,target)=>{target=mod!=null?__create2(__getProtoOf2(mod)):{};let to=isNodeMode||!mod||!mod.__esModule?__defProp3(target,"default",{value:mod,enumerable:!0}):target;for(let key of __getOwnPropNames3(mod))if(!__hasOwnProp3.call(to,key))__defProp3(to,key,{get:()=>mod[key],enumerable:!0});return to},__commonJS3=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports),require_shams3,require_shams22,require_es_object_atoms2,require_es_errors2,require_eval2,require_range2,require_ref2,require_syntax2,require_type2,require_uri2,require_abs2,require_floor2,require_max2,require_min2,require_pow2,require_round2,require_isNaN2,require_sign2,require_gOPD2,require_gopd2,require_es_define_property2,require_has_symbols2,require_Reflect_getPrototypeOf2,require_Object_getPrototypeOf2,require_implementation2,require_function_bind2,require_functionCall2,require_functionApply2,require_reflectApply2,require_actualApply2,require_call_bind_apply_helpers2,require_get2,require_get_proto2,require_hasown2,require_get_intrinsic2,require_call_bound2,require_is_arguments,require_is_regex,require_safe_regex_test,require_generator_function,require_is_generator_function,require_is_callable2,require_for_each2,require_possible_typed_array_names2,require_available_typed_arrays2,require_define_data_property2,require_has_property_descriptors2,require_set_function_length2,require_applyBind2,require_call_bind2,require_which_typed_array2,require_is_typed_array2,require_types,require_isBuffer,require_inherits_browser2,require_inherits2,require_util,require_errors,require_assertion_error,require_isArguments,require_implementation22,require_object_keys,require_implementation3,require_polyfill,require_implementation4,require_polyfill2,require_callBound,require_define_properties,require_shim,require_object_is,require_implementation5,require_polyfill3,require_shim2,require_is_nan,require_comparisons,require_assert,assert,AssertionError,CallTracker,deepEqual,deepStrictEqual,doesNotMatch,doesNotReject,doesNotThrow,equal,fail,ifError,match,notDeepEqual,notDeepStrictEqual,notEqual,notStrictEqual,ok,rejects,strict,strictEqual,throws,assert_default;var init_assert=__esm(()=>{__create2=Object.create,{getPrototypeOf:__getProtoOf2,defineProperty:__defProp3,getOwnPropertyNames:__getOwnPropNames3}=Object,__hasOwnProp3=Object.prototype.hasOwnProperty,require_shams3=__commonJS3((exports,module)=>{module.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var obj={},sym=Symbol("test"),symObj=Object(sym);if(typeof sym==="string")return!1;if(Object.prototype.toString.call(sym)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(symObj)!=="[object Symbol]")return!1;var symVal=42;obj[sym]=symVal;for(var _ in obj)return!1;if(typeof Object.keys==="function"&&Object.keys(obj).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(obj).length!==0)return!1;var syms=Object.getOwnPropertySymbols(obj);if(syms.length!==1||syms[0]!==sym)return!1;if(!Object.prototype.propertyIsEnumerable.call(obj,sym))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var descriptor=Object.getOwnPropertyDescriptor(obj,sym);if(descriptor.value!==symVal||descriptor.enumerable!==!0)return!1}return!0}}),require_shams22=__commonJS3((exports,module)=>{var hasSymbols=require_shams3();module.exports=function(){return hasSymbols()&&!!Symbol.toStringTag}}),require_es_object_atoms2=__commonJS3((exports,module)=>{module.exports=Object}),require_es_errors2=__commonJS3((exports,module)=>{module.exports=Error}),require_eval2=__commonJS3((exports,module)=>{module.exports=EvalError}),require_range2=__commonJS3((exports,module)=>{module.exports=RangeError}),require_ref2=__commonJS3((exports,module)=>{module.exports=ReferenceError}),require_syntax2=__commonJS3((exports,module)=>{module.exports=SyntaxError}),require_type2=__commonJS3((exports,module)=>{module.exports=TypeError}),require_uri2=__commonJS3((exports,module)=>{module.exports=URIError}),require_abs2=__commonJS3((exports,module)=>{module.exports=Math.abs}),require_floor2=__commonJS3((exports,module)=>{module.exports=Math.floor}),require_max2=__commonJS3((exports,module)=>{module.exports=Math.max}),require_min2=__commonJS3((exports,module)=>{module.exports=Math.min}),require_pow2=__commonJS3((exports,module)=>{module.exports=Math.pow}),require_round2=__commonJS3((exports,module)=>{module.exports=Math.round}),require_isNaN2=__commonJS3((exports,module)=>{module.exports=Number.isNaN||function(a){return a!==a}}),require_sign2=__commonJS3((exports,module)=>{var $isNaN=require_isNaN2();module.exports=function(number){if($isNaN(number)||number===0)return number;return number<0?-1:1}}),require_gOPD2=__commonJS3((exports,module)=>{module.exports=Object.getOwnPropertyDescriptor}),require_gopd2=__commonJS3((exports,module)=>{var $gOPD=require_gOPD2();if($gOPD)try{$gOPD([],"length")}catch(e){$gOPD=null}module.exports=$gOPD}),require_es_define_property2=__commonJS3((exports,module)=>{var $defineProperty=Object.defineProperty||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}module.exports=$defineProperty}),require_has_symbols2=__commonJS3((exports,module)=>{var origSymbol=typeof Symbol<"u"&&Symbol,hasSymbolSham=require_shams3();module.exports=function(){if(typeof origSymbol!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof origSymbol("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return hasSymbolSham()}}),require_Reflect_getPrototypeOf2=__commonJS3((exports,module)=>{module.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),require_Object_getPrototypeOf2=__commonJS3((exports,module)=>{var $Object=require_es_object_atoms2();module.exports=$Object.getPrototypeOf||null}),require_implementation2=__commonJS3((exports,module)=>{var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function(a,b){var arr=[];for(var i2=0;i2<a.length;i2+=1)arr[i2]=a[i2];for(var j=0;j<b.length;j+=1)arr[j+a.length]=b[j];return arr},slicy=function(arrLike,offset){var arr=[];for(var i2=offset||0,j=0;i2<arrLike.length;i2+=1,j+=1)arr[j]=arrLike[i2];return arr},joiny=function(arr,joiner){var str="";for(var i2=0;i2<arr.length;i2+=1)if(str+=arr[i2],i2+1<arr.length)str+=joiner;return str};module.exports=function(that){var target=this;if(typeof target!=="function"||toStr.apply(target)!==funcType)throw TypeError(ERROR_MESSAGE+target);var args=slicy(arguments,1),bound,binder=function(){if(this instanceof bound){var result=target.apply(this,concatty(args,arguments));if(Object(result)===result)return result;return this}return target.apply(that,concatty(args,arguments))},boundLength=max(0,target.length-args.length),boundArgs=[];for(var i2=0;i2<boundLength;i2++)boundArgs[i2]="$"+i2;if(bound=Function("binder","return function ("+joiny(boundArgs,",")+"){ return binder.apply(this,arguments); }")(binder),target.prototype){var Empty=function(){};Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null}return bound}}),require_function_bind2=__commonJS3((exports,module)=>{var implementation=require_implementation2();module.exports=Function.prototype.bind||implementation}),require_functionCall2=__commonJS3((exports,module)=>{module.exports=Function.prototype.call}),require_functionApply2=__commonJS3((exports,module)=>{module.exports=Function.prototype.apply}),require_reflectApply2=__commonJS3((exports,module)=>{module.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),require_actualApply2=__commonJS3((exports,module)=>{var bind=require_function_bind2(),$apply=require_functionApply2(),$call=require_functionCall2(),$reflectApply=require_reflectApply2();module.exports=$reflectApply||bind.call($call,$apply)}),require_call_bind_apply_helpers2=__commonJS3((exports,module)=>{var bind=require_function_bind2(),$TypeError=require_type2(),$call=require_functionCall2(),$actualApply=require_actualApply2();module.exports=function(args){if(args.length<1||typeof args[0]!=="function")throw new $TypeError("a function is required");return $actualApply(bind,$call,args)}}),require_get2=__commonJS3((exports,module)=>{var callBind=require_call_bind_apply_helpers2(),gOPD=require_gopd2(),hasProtoAccessor;try{hasProtoAccessor=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var desc=!!hasProtoAccessor&&gOPD&&gOPD(Object.prototype,"__proto__"),$Object=Object,$getPrototypeOf=$Object.getPrototypeOf;module.exports=desc&&typeof desc.get==="function"?callBind([desc.get]):typeof $getPrototypeOf==="function"?function(value){return $getPrototypeOf(value==null?value:$Object(value))}:!1}),require_get_proto2=__commonJS3((exports,module)=>{var reflectGetProto=require_Reflect_getPrototypeOf2(),originalGetProto=require_Object_getPrototypeOf2(),getDunderProto=require_get2();module.exports=reflectGetProto?function(O){return reflectGetProto(O)}:originalGetProto?function(O){if(!O||typeof O!=="object"&&typeof O!=="function")throw TypeError("getProto: not an object");return originalGetProto(O)}:getDunderProto?function(O){return getDunderProto(O)}:null}),require_hasown2=__commonJS3((exports,module)=>{var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require_function_bind2();module.exports=bind.call(call,$hasOwn)}),require_get_intrinsic2=__commonJS3((exports,module)=>{var undefined2,$Object=require_es_object_atoms2(),$Error=require_es_errors2(),$EvalError=require_eval2(),$RangeError=require_range2(),$ReferenceError=require_ref2(),$SyntaxError=require_syntax2(),$TypeError=require_type2(),$URIError=require_uri2(),abs=require_abs2(),floor=require_floor2(),max=require_max2(),min=require_min2(),pow=require_pow2(),round=require_round2(),sign=require_sign2(),$Function=Function,getEvalledConstructor=function(expressionSyntax){try{return $Function('"use strict"; return ('+expressionSyntax+").constructor;")()}catch(e){}},$gOPD=require_gopd2(),$defineProperty=require_es_define_property2(),throwTypeError=function(){throw new $TypeError},ThrowTypeError=$gOPD?function(){try{return arguments.callee,throwTypeError}catch(calleeThrows){try{return $gOPD(arguments,"callee").get}catch(gOPDthrows){return throwTypeError}}}():throwTypeError,hasSymbols=require_has_symbols2()(),getProto=require_get_proto2(),$ObjectGPO=require_Object_getPrototypeOf2(),$ReflectGPO=require_Reflect_getPrototypeOf2(),$apply=require_functionApply2(),$call=require_functionCall2(),needsEval={},TypedArray=typeof Uint8Array>"u"||!getProto?undefined2:getProto(Uint8Array),INTRINSICS={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?undefined2:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined2:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined2,"%AsyncFromSyncIteratorPrototype%":undefined2,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined2:Atomics,"%BigInt%":typeof BigInt>"u"?undefined2:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined2:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined2:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined2:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float16Array%":typeof Float16Array>"u"?undefined2:Float16Array,"%Float32Array%":typeof Float32Array>"u"?undefined2:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined2:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined2:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined2:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined2:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined2:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined2,"%JSON%":typeof JSON==="object"?JSON:undefined2,"%Map%":typeof Map>"u"?undefined2:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto?undefined2:getProto(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":$Object,"%Object.getOwnPropertyDescriptor%":$gOPD,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined2:Promise,"%Proxy%":typeof Proxy>"u"?undefined2:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined2:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined2:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto?undefined2:getProto(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined2:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined2,"%Symbol%":hasSymbols?Symbol:undefined2,"%SyntaxError%":$SyntaxError,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError,"%Uint8Array%":typeof Uint8Array>"u"?undefined2:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined2:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined2:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined2:Uint32Array,"%URIError%":$URIError,"%WeakMap%":typeof WeakMap>"u"?undefined2:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined2:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined2:WeakSet,"%Function.prototype.call%":$call,"%Function.prototype.apply%":$apply,"%Object.defineProperty%":$defineProperty,"%Object.getPrototypeOf%":$ObjectGPO,"%Math.abs%":abs,"%Math.floor%":floor,"%Math.max%":max,"%Math.min%":min,"%Math.pow%":pow,"%Math.round%":round,"%Math.sign%":sign,"%Reflect.getPrototypeOf%":$ReflectGPO};if(getProto)try{null.error}catch(e){errorProto=getProto(getProto(e)),INTRINSICS["%Error.prototype%"]=errorProto}var errorProto,doEval=function doEval2(name){var value;if(name==="%AsyncFunction%")value=getEvalledConstructor("async function () {}");else if(name==="%GeneratorFunction%")value=getEvalledConstructor("function* () {}");else if(name==="%AsyncGeneratorFunction%")value=getEvalledConstructor("async function* () {}");else if(name==="%AsyncGenerator%"){var fn=doEval2("%AsyncGeneratorFunction%");if(fn)value=fn.prototype}else if(name==="%AsyncIteratorPrototype%"){var gen=doEval2("%AsyncGenerator%");if(gen&&getProto)value=getProto(gen.prototype)}return INTRINSICS[name]=value,value},LEGACY_ALIASES={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=require_function_bind2(),hasOwn=require_hasown2(),$concat=bind.call($call,Array.prototype.concat),$spliceApply=bind.call($apply,Array.prototype.splice),$replace=bind.call($call,String.prototype.replace),$strSlice=bind.call($call,String.prototype.slice),$exec=bind.call($call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(string){var first=$strSlice(string,0,1),last=$strSlice(string,-1);if(first==="%"&&last!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");else if(last==="%"&&first!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var result=[];return $replace(string,rePropName,function(match,number,quote,subString){result[result.length]=quote?$replace(subString,reEscapeChar,"$1"):number||match}),result},getBaseIntrinsic=function(name,allowMissing){var intrinsicName=name,alias;if(hasOwn(LEGACY_ALIASES,intrinsicName))alias=LEGACY_ALIASES[intrinsicName],intrinsicName="%"+alias[0]+"%";if(hasOwn(INTRINSICS,intrinsicName)){var value=INTRINSICS[intrinsicName];if(value===needsEval)value=doEval(intrinsicName);if(typeof value>"u"&&!allowMissing)throw new $TypeError("intrinsic "+name+" exists, but is not available. Please file an issue!");return{alias,name:intrinsicName,value}}throw new $SyntaxError("intrinsic "+name+" does not exist!")};module.exports=function(name,allowMissing){if(typeof name!=="string"||name.length===0)throw new $TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof allowMissing!=="boolean")throw new $TypeError('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,name)===null)throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var parts=stringToPath(name),intrinsicBaseName=parts.length>0?parts[0]:"",intrinsic=getBaseIntrinsic("%"+intrinsicBaseName+"%",allowMissing),intrinsicRealName=intrinsic.name,value=intrinsic.value,skipFurtherCaching=!1,alias=intrinsic.alias;if(alias)intrinsicBaseName=alias[0],$spliceApply(parts,$concat([0,1],alias));for(var i2=1,isOwn=!0;i2<parts.length;i2+=1){var part=parts[i2],first=$strSlice(part,0,1),last=$strSlice(part,-1);if((first==='"'||first==="'"||first==="`"||(last==='"'||last==="'"||last==="`"))&&first!==last)throw new $SyntaxError("property names with quotes must have matching quotes");if(part==="constructor"||!isOwn)skipFurtherCaching=!0;if(intrinsicBaseName+="."+part,intrinsicRealName="%"+intrinsicBaseName+"%",hasOwn(INTRINSICS,intrinsicRealName))value=INTRINSICS[intrinsicRealName];else if(value!=null){if(!(part in value)){if(!allowMissing)throw new $TypeError("base intrinsic for "+name+" exists, but the property is not available.");return}if($gOPD&&i2+1>=parts.length){var desc=$gOPD(value,part);if(isOwn=!!desc,isOwn&&"get"in desc&&!("originalValue"in desc.get))value=desc.get;else value=value[part]}else isOwn=hasOwn(value,part),value=value[part];if(isOwn&&!skipFurtherCaching)INTRINSICS[intrinsicRealName]=value}}return value}}),require_call_bound2=__commonJS3((exports,module)=>{var GetIntrinsic=require_get_intrinsic2(),callBindBasic=require_call_bind_apply_helpers2(),$indexOf=callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);module.exports=function(name,allowMissing){var intrinsic=GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==="function"&&$indexOf(name,".prototype.")>-1)return callBindBasic([intrinsic]);return intrinsic}}),require_is_arguments=__commonJS3((exports,module)=>{var hasToStringTag=require_shams22()(),callBound=require_call_bound2(),$toString=callBound("Object.prototype.toString"),isStandardArguments=function(value){if(hasToStringTag&&value&&typeof value==="object"&&Symbol.toStringTag in value)return!1;return $toString(value)==="[object Arguments]"},isLegacyArguments=function(value){if(isStandardArguments(value))return!0;return value!==null&&typeof value==="object"&&"length"in value&&typeof value.length==="number"&&value.length>=0&&$toString(value)!=="[object Array]"&&"callee"in value&&$toString(value.callee)==="[object Function]"},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments,module.exports=supportsStandardArguments?isStandardArguments:isLegacyArguments}),require_is_regex=__commonJS3((exports,module)=>{var callBound=require_call_bound2(),hasToStringTag=require_shams22()(),hasOwn=require_hasown2(),gOPD=require_gopd2(),fn;if(hasToStringTag){if($exec=callBound("RegExp.prototype.exec"),isRegexMarker={},throwRegexMarker=function(){throw isRegexMarker},badStringifier={toString:throwRegexMarker,valueOf:throwRegexMarker},typeof Symbol.toPrimitive==="symbol")badStringifier[Symbol.toPrimitive]=throwRegexMarker;fn=function(value){if(!value||typeof value!=="object")return!1;var descriptor=gOPD(value,"lastIndex"),hasLastIndexDataProperty=descriptor&&hasOwn(descriptor,"value");if(!hasLastIndexDataProperty)return!1;try{$exec(value,badStringifier)}catch(e){return e===isRegexMarker}}}else $toString=callBound("Object.prototype.toString"),regexClass="[object RegExp]",fn=function(value){if(!value||typeof value!=="object"&&typeof value!=="function")return!1;return $toString(value)===regexClass};var $exec,isRegexMarker,throwRegexMarker,badStringifier,$toString,regexClass;module.exports=fn}),require_safe_regex_test=__commonJS3((exports,module)=>{var callBound=require_call_bound2(),isRegex=require_is_regex(),$exec=callBound("RegExp.prototype.exec"),$TypeError=require_type2();module.exports=function(regex){if(!isRegex(regex))throw new $TypeError("`regex` must be a RegExp");return function(s){return $exec(regex,s)!==null}}}),require_generator_function=__commonJS3((exports,module)=>{var cached=function*(){}.constructor;module.exports=()=>cached}),require_is_generator_function=__commonJS3((exports,module)=>{var callBound=require_call_bound2(),safeRegexTest=require_safe_regex_test(),isFnRegex=safeRegexTest(/^\s*(?:function)?\*/),hasToStringTag=require_shams22()(),getProto=require_get_proto2(),toStr=callBound("Object.prototype.toString"),fnToStr=callBound("Function.prototype.toString"),getGeneratorFunction=require_generator_function();module.exports=function(fn){if(typeof fn!=="function")return!1;if(isFnRegex(fnToStr(fn)))return!0;if(!hasToStringTag){var str=toStr(fn);return str==="[object GeneratorFunction]"}if(!getProto)return!1;var GeneratorFunction=getGeneratorFunction();return GeneratorFunction&&getProto(fn)===GeneratorFunction.prototype}}),require_is_callable2=__commonJS3((exports,module)=>{var fnToStr=Function.prototype.toString,reflectApply=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,badArrayLike,isCallableMarker;if(typeof reflectApply==="function"&&typeof Object.defineProperty==="function")try{badArrayLike=Object.defineProperty({},"length",{get:function(){throw isCallableMarker}}),isCallableMarker={},reflectApply(function(){throw 42},null,badArrayLike)}catch(_){if(_!==isCallableMarker)reflectApply=null}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(value){try{var fnStr=fnToStr.call(value);return constructorRegex.test(fnStr)}catch(e){return!1}},tryFunctionObject=function(value){try{if(isES6ClassFn(value))return!1;return fnToStr.call(value),!0}catch(e){return!1}},toStr=Object.prototype.toString,objectClass="[object Object]",fnClass="[object Function]",genClass="[object GeneratorFunction]",ddaClass="[object HTMLAllCollection]",ddaClass2="[object HTML document.all class]",ddaClass3="[object HTMLCollection]",hasToStringTag=typeof Symbol==="function"&&!!Symbol.toStringTag,isIE68=!(0 in[,]),isDDA=function(){return!1};if(typeof document==="object"){if(all=document.all,toStr.call(all)===toStr.call(document.all))isDDA=function(value){if((isIE68||!value)&&(typeof value>"u"||typeof value==="object"))try{var str=toStr.call(value);return(str===ddaClass||str===ddaClass2||str===ddaClass3||str===objectClass)&&value("")==null}catch(e){}return!1}}var all;module.exports=reflectApply?function(value){if(isDDA(value))return!0;if(!value)return!1;if(typeof value!=="function"&&typeof value!=="object")return!1;try{reflectApply(value,null,badArrayLike)}catch(e){if(e!==isCallableMarker)return!1}return!isES6ClassFn(value)&&tryFunctionObject(value)}:function(value){if(isDDA(value))return!0;if(!value)return!1;if(typeof value!=="function"&&typeof value!=="object")return!1;if(hasToStringTag)return tryFunctionObject(value);if(isES6ClassFn(value))return!1;var strClass=toStr.call(value);if(strClass!==fnClass&&strClass!==genClass&&!/^\[object HTML/.test(strClass))return!1;return tryFunctionObject(value)}}),require_for_each2=__commonJS3((exports,module)=>{var isCallable=require_is_callable2(),toStr=Object.prototype.toString,hasOwnProperty2=Object.prototype.hasOwnProperty,forEachArray=function(array,iterator,receiver){for(var i2=0,len2=array.length;i2<len2;i2++)if(hasOwnProperty2.call(array,i2))if(receiver==null)iterator(array[i2],i2,array);else iterator.call(receiver,array[i2],i2,array)},forEachString=function(string,iterator,receiver){for(var i2=0,len2=string.length;i2<len2;i2++)if(receiver==null)iterator(string.charAt(i2),i2,string);else iterator.call(receiver,string.charAt(i2),i2,string)},forEachObject=function(object,iterator,receiver){for(var k in object)if(hasOwnProperty2.call(object,k))if(receiver==null)iterator(object[k],k,object);else iterator.call(receiver,object[k],k,object)};function isArray2(x){return toStr.call(x)==="[object Array]"}module.exports=function(list,iterator,thisArg){if(!isCallable(iterator))throw TypeError("iterator must be a function");var receiver;if(arguments.length>=3)receiver=thisArg;if(isArray2(list))forEachArray(list,iterator,receiver);else if(typeof list==="string")forEachString(list,iterator,receiver);else forEachObject(list,iterator,receiver)}}),require_possible_typed_array_names2=__commonJS3((exports,module)=>{module.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),require_available_typed_arrays2=__commonJS3((exports,module)=>{var possibleNames=require_possible_typed_array_names2(),g=typeof globalThis>"u"?globalThis:globalThis;module.exports=function(){var out=[];for(var i2=0;i2<possibleNames.length;i2++)if(typeof g[possibleNames[i2]]==="function")out[out.length]=possibleNames[i2];return out}}),require_define_data_property2=__commonJS3((exports,module)=>{var $defineProperty=require_es_define_property2(),$SyntaxError=require_syntax2(),$TypeError=require_type2(),gopd=require_gopd2();module.exports=function(obj,property,value){if(!obj||typeof obj!=="object"&&typeof obj!=="function")throw new $TypeError("`obj` must be an object or a function`");if(typeof property!=="string"&&typeof property!=="symbol")throw new $TypeError("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new $TypeError("`loose`, if provided, must be a boolean");var nonEnumerable=arguments.length>3?arguments[3]:null,nonWritable=arguments.length>4?arguments[4]:null,nonConfigurable=arguments.length>5?arguments[5]:null,loose=arguments.length>6?arguments[6]:!1,desc=!!gopd&&gopd(obj,property);if($defineProperty)$defineProperty(obj,property,{configurable:nonConfigurable===null&&desc?desc.configurable:!nonConfigurable,enumerable:nonEnumerable===null&&desc?desc.enumerable:!nonEnumerable,value,writable:nonWritable===null&&desc?desc.writable:!nonWritable});else if(loose||!nonEnumerable&&!nonWritable&&!nonConfigurable)obj[property]=value;else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),require_has_property_descriptors2=__commonJS3((exports,module)=>{var $defineProperty=require_es_define_property2(),hasPropertyDescriptors=function(){return!!$defineProperty};hasPropertyDescriptors.hasArrayLengthDefineBug=function(){if(!$defineProperty)return null;try{return $defineProperty([],"length",{value:1}).length!==1}catch(e){return!0}},module.exports=hasPropertyDescriptors}),require_set_function_length2=__commonJS3((exports,module)=>{var GetIntrinsic=require_get_intrinsic2(),define=require_define_data_property2(),hasDescriptors=require_has_property_descriptors2()(),gOPD=require_gopd2(),$TypeError=require_type2(),$floor=GetIntrinsic("%Math.floor%");module.exports=function(fn,length){if(typeof fn!=="function")throw new $TypeError("`fn` is not a function");if(typeof length!=="number"||length<0||length>4294967295||$floor(length)!==length)throw new $TypeError("`length` must be a positive 32-bit integer");var loose=arguments.length>2&&!!arguments[2],functionLengthIsConfigurable=!0,functionLengthIsWritable=!0;if("length"in fn&&gOPD){var desc=gOPD(fn,"length");if(desc&&!desc.configurable)functionLengthIsConfigurable=!1;if(desc&&!desc.writable)functionLengthIsWritable=!1}if(functionLengthIsConfigurable||functionLengthIsWritable||!loose)if(hasDescriptors)define(fn,"length",length,!0,!0);else define(fn,"length",length);return fn}}),require_applyBind2=__commonJS3((exports,module)=>{var bind=require_function_bind2(),$apply=require_functionApply2(),actualApply=require_actualApply2();module.exports=function(){return actualApply(bind,$apply,arguments)}}),require_call_bind2=__commonJS3((exports,module)=>{var setFunctionLength=require_set_function_length2(),$defineProperty=require_es_define_property2(),callBindBasic=require_call_bind_apply_helpers2(),applyBind=require_applyBind2();if(module.exports=function(originalFunction){var func=callBindBasic(arguments),adjustedLength=originalFunction.length-(arguments.length-1);return setFunctionLength(func,1+(adjustedLength>0?adjustedLength:0),!0)},$defineProperty)$defineProperty(module.exports,"apply",{value:applyBind});else module.exports.apply=applyBind}),require_which_typed_array2=__commonJS3((exports,module)=>{var forEach=require_for_each2(),availableTypedArrays=require_available_typed_arrays2(),callBind=require_call_bind2(),callBound=require_call_bound2(),gOPD=require_gopd2(),getProto=require_get_proto2(),$toString=callBound("Object.prototype.toString"),hasToStringTag=require_shams22()(),g=typeof globalThis>"u"?globalThis:globalThis,typedArrays=availableTypedArrays(),$slice=callBound("String.prototype.slice"),$indexOf=callBound("Array.prototype.indexOf",!0)||function(array,value){for(var i2=0;i2<array.length;i2+=1)if(array[i2]===value)return i2;return-1},cache={__proto__:null};if(hasToStringTag&&gOPD&&getProto)forEach(typedArrays,function(typedArray){var arr=new g[typedArray];if(Symbol.toStringTag in arr&&getProto){var proto=getProto(arr),descriptor=gOPD(proto,Symbol.toStringTag);if(!descriptor&&proto){var superProto=getProto(proto);descriptor=gOPD(superProto,Symbol.toStringTag)}cache["$"+typedArray]=callBind(descriptor.get)}});else forEach(typedArrays,function(typedArray){var arr=new g[typedArray],fn=arr.slice||arr.set;if(fn)cache["$"+typedArray]=callBind(fn)});var tryTypedArrays=function(value){var found=!1;return forEach(cache,function(getter,typedArray){if(!found)try{if("$"+getter(value)===typedArray)found=$slice(typedArray,1)}catch(e){}}),found},trySlices=function(value){var found=!1;return forEach(cache,function(getter,name){if(!found)try{getter(value),found=$slice(name,1)}catch(e){}}),found};module.exports=function(value){if(!value||typeof value!=="object")return!1;if(!hasToStringTag){var tag=$slice($toString(value),8,-1);if($indexOf(typedArrays,tag)>-1)return tag;if(tag!=="Object")return!1;return trySlices(value)}if(!gOPD)return null;return tryTypedArrays(value)}}),require_is_typed_array2=__commonJS3((exports,module)=>{var whichTypedArray=require_which_typed_array2();module.exports=function(value){return!!whichTypedArray(value)}}),require_types=__commonJS3((exports)=>{var isArgumentsObject=require_is_arguments(),isGeneratorFunction=require_is_generator_function(),whichTypedArray=require_which_typed_array2(),isTypedArray=require_is_typed_array2();function uncurryThis(f){return f.call.bind(f)}var BigIntSupported=typeof BigInt<"u",SymbolSupported=typeof Symbol<"u",ObjectToString=uncurryThis(Object.prototype.toString),numberValue=uncurryThis(Number.prototype.valueOf),stringValue=uncurryThis(String.prototype.valueOf),booleanValue=uncurryThis(Boolean.prototype.valueOf);if(BigIntSupported)bigIntValue=uncurryThis(BigInt.prototype.valueOf);var bigIntValue;if(SymbolSupported)symbolValue=uncurryThis(Symbol.prototype.valueOf);var symbolValue;function checkBoxedPrimitive(value,prototypeValueOf){if(typeof value!=="object")return!1;try{return prototypeValueOf(value),!0}catch(e){return!1}}exports.isArgumentsObject=isArgumentsObject,exports.isGeneratorFunction=isGeneratorFunction,exports.isTypedArray=isTypedArray;function isPromise(input){return typeof Promise<"u"&&input instanceof Promise||input!==null&&typeof input==="object"&&typeof input.then==="function"&&typeof input.catch==="function"}exports.isPromise=isPromise;function isArrayBufferView(value){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(value);return isTypedArray(value)||isDataView(value)}exports.isArrayBufferView=isArrayBufferView;function isUint8Array(value){return whichTypedArray(value)==="Uint8Array"}exports.isUint8Array=isUint8Array;function isUint8ClampedArray(value){return whichTypedArray(value)==="Uint8ClampedArray"}exports.isUint8ClampedArray=isUint8ClampedArray;function isUint16Array(value){return whichTypedArray(value)==="Uint16Array"}exports.isUint16Array=isUint16Array;function isUint32Array(value){return whichTypedArray(value)==="Uint32Array"}exports.isUint32Array=isUint32Array;function isInt8Array(value){return whichTypedArray(value)==="Int8Array"}exports.isInt8Array=isInt8Array;function isInt16Array(value){return whichTypedArray(value)==="Int16Array"}exports.isInt16Array=isInt16Array;function isInt32Array(value){return whichTypedArray(value)==="Int32Array"}exports.isInt32Array=isInt32Array;function isFloat32Array(value){return whichTypedArray(value)==="Float32Array"}exports.isFloat32Array=isFloat32Array;function isFloat64Array(value){return whichTypedArray(value)==="Float64Array"}exports.isFloat64Array=isFloat64Array;function isBigInt64Array(value){return whichTypedArray(value)==="BigInt64Array"}exports.isBigInt64Array=isBigInt64Array;function isBigUint64Array(value){return whichTypedArray(value)==="BigUint64Array"}exports.isBigUint64Array=isBigUint64Array;function isMapToString(value){return ObjectToString(value)==="[object Map]"}isMapToString.working=typeof Map<"u"&&isMapToString(new Map);function isMap(value){if(typeof Map>"u")return!1;return isMapToString.working?isMapToString(value):value instanceof Map}exports.isMap=isMap;function isSetToString(value){return ObjectToString(value)==="[object Set]"}isSetToString.working=typeof Set<"u"&&isSetToString(new Set);function isSet(value){if(typeof Set>"u")return!1;return isSetToString.working?isSetToString(value):value instanceof Set}exports.isSet=isSet;function isWeakMapToString(value){return ObjectToString(value)==="[object WeakMap]"}isWeakMapToString.working=typeof WeakMap<"u"&&isWeakMapToString(new WeakMap);function isWeakMap(value){if(typeof WeakMap>"u")return!1;return isWeakMapToString.working?isWeakMapToString(value):value instanceof WeakMap}exports.isWeakMap=isWeakMap;function isWeakSetToString(value){return ObjectToString(value)==="[object WeakSet]"}isWeakSetToString.working=typeof WeakSet<"u"&&isWeakSetToString(new WeakSet);function isWeakSet(value){return isWeakSetToString(value)}exports.isWeakSet=isWeakSet;function isArrayBufferToString(value){return ObjectToString(value)==="[object ArrayBuffer]"}isArrayBufferToString.working=typeof ArrayBuffer<"u"&&isArrayBufferToString(new ArrayBuffer);function isArrayBuffer(value){if(typeof ArrayBuffer>"u")return!1;return isArrayBufferToString.working?isArrayBufferToString(value):value instanceof ArrayBuffer}exports.isArrayBuffer=isArrayBuffer;function isDataViewToString(value){return ObjectToString(value)==="[object DataView]"}isDataViewToString.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&isDataViewToString(new DataView(new ArrayBuffer(1),0,1));function isDataView(value){if(typeof DataView>"u")return!1;return isDataViewToString.working?isDataViewToString(value):value instanceof DataView}exports.isDataView=isDataView;var SharedArrayBufferCopy=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function isSharedArrayBufferToString(value){return ObjectToString(value)==="[object SharedArrayBuffer]"}function isSharedArrayBuffer(value){if(typeof SharedArrayBufferCopy>"u")return!1;if(typeof isSharedArrayBufferToString.working>"u")isSharedArrayBufferToString.working=isSharedArrayBufferToString(new SharedArrayBufferCopy);return isSharedArrayBufferToString.working?isSharedArrayBufferToString(value):value instanceof SharedArrayBufferCopy}exports.isSharedArrayBuffer=isSharedArrayBuffer;function isAsyncFunction(value){return ObjectToString(value)==="[object AsyncFunction]"}exports.isAsyncFunction=isAsyncFunction;function isMapIterator(value){return ObjectToString(value)==="[object Map Iterator]"}exports.isMapIterator=isMapIterator;function isSetIterator(value){return ObjectToString(value)==="[object Set Iterator]"}exports.isSetIterator=isSetIterator;function isGeneratorObject(value){return ObjectToString(value)==="[object Generator]"}exports.isGeneratorObject=isGeneratorObject;function isWebAssemblyCompiledModule(value){return ObjectToString(value)==="[object WebAssembly.Module]"}exports.isWebAssemblyCompiledModule=isWebAssemblyCompiledModule;function isNumberObject(value){return checkBoxedPrimitive(value,numberValue)}exports.isNumberObject=isNumberObject;function isStringObject(value){return checkBoxedPrimitive(value,stringValue)}exports.isStringObject=isStringObject;function isBooleanObject(value){return checkBoxedPrimitive(value,booleanValue)}exports.isBooleanObject=isBooleanObject;function isBigIntObject(value){return BigIntSupported&&checkBoxedPrimitive(value,bigIntValue)}exports.isBigIntObject=isBigIntObject;function isSymbolObject(value){return SymbolSupported&&checkBoxedPrimitive(value,symbolValue)}exports.isSymbolObject=isSymbolObject;function isBoxedPrimitive(value){return isNumberObject(value)||isStringObject(value)||isBooleanObject(value)||isBigIntObject(value)||isSymbolObject(value)}exports.isBoxedPrimitive=isBoxedPrimitive;function isAnyArrayBuffer(value){return typeof Uint8Array<"u"&&(isArrayBuffer(value)||isSharedArrayBuffer(value))}exports.isAnyArrayBuffer=isAnyArrayBuffer,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(method){Object.defineProperty(exports,method,{enumerable:!1,value:function(){throw Error(method+" is not supported in userland")}})})}),require_isBuffer=__commonJS3((exports,module)=>{module.exports=function(arg){return arg instanceof Buffer}}),require_inherits_browser2=__commonJS3((exports,module)=>{if(typeof Object.create==="function")module.exports=function(ctor,superCtor){if(superCtor)ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})};else module.exports=function(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}}}),require_inherits2=__commonJS3((exports,module)=>{try{if(util=(init_util(),__toCommonJS(exports_util)),typeof util.inherits!=="function")throw"";module.exports=util.inherits}catch(e){module.exports=require_inherits_browser2()}var util}),require_util=__commonJS3((exports)=>{var getOwnPropertyDescriptors=Object.getOwnPropertyDescriptors||function(obj){var keys=Object.keys(obj),descriptors={};for(var i2=0;i2<keys.length;i2++)descriptors[keys[i2]]=Object.getOwnPropertyDescriptor(obj,keys[i2]);return descriptors},formatRegExp2=/%[sdj%]/g;exports.format=function(f){if(!isString2(f)){var objects=[];for(var i2=0;i2<arguments.length;i2++)objects.push(inspect2(arguments[i2]));return objects.join(" ")}var i2=1,args=arguments,len2=args.length,str=String(f).replace(formatRegExp2,function(x2){if(x2==="%%")return"%";if(i2>=len2)return x2;switch(x2){case"%s":return String(args[i2++]);case"%d":return Number(args[i2++]);case"%j":try{return JSON.stringify(args[i2++])}catch(_){return"[Circular]"}default:return x2}});for(var x=args[i2];i2<len2;x=args[++i2])if(isNull2(x)||!isObject2(x))str+=" "+x;else str+=" "+inspect2(x);return str},exports.deprecate=function(fn,msg){if(typeof process<"u"&&process.noDeprecation===!0)return fn;if(typeof process>"u")return function(){return exports.deprecate(fn,msg).apply(this,arguments)};var warned=!1;function deprecated(){if(!warned){if(process.throwDeprecation)throw Error(msg);else if(process.traceDeprecation)console.trace(msg);else console.error(msg);warned=!0}return fn.apply(this,arguments)}return deprecated};var debugs={},debugEnvRegex=/^$/;exports.debuglog=function(set){if(set=set.toUpperCase(),!debugs[set])if(debugEnvRegex.test(set)){var pid2=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid2,msg)}}else debugs[set]=function(){};return debugs[set]};function inspect2(obj,opts){var ctx={seen:[],stylize:stylizeNoColor2};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean2(opts))ctx.showHidden=opts;else if(opts)exports._extend(ctx,opts);if(isUndefined2(ctx.showHidden))ctx.showHidden=!1;if(isUndefined2(ctx.depth))ctx.depth=2;if(isUndefined2(ctx.colors))ctx.colors=!1;if(isUndefined2(ctx.customInspect))ctx.customInspect=!0;if(ctx.colors)ctx.stylize=stylizeWithColor2;return formatValue2(ctx,obj,ctx.depth)}exports.inspect=inspect2,inspect2.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect2.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor2(str,styleType){var style=inspect2.styles[styleType];if(style)return"\x1B["+inspect2.colors[style][0]+"m"+str+"\x1B["+inspect2.colors[style][1]+"m";else return str}function stylizeNoColor2(str,styleType){return str}function arrayToHash2(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue2(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction2(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString2(ret))ret=formatValue2(ctx,ret,recurseTimes);return ret}var primitive=formatPrimitive2(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash2(keys);if(ctx.showHidden)keys=Object.getOwnPropertyNames(value);if(isError2(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError2(value);if(keys.length===0){if(isFunction2(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp2(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate2(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError2(value))return formatError2(value)}var base="",array=!1,braces=["{","}"];if(isArray2(value))array=!0,braces=["[","]"];if(isFunction2(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp2(value))base=" "+RegExp.prototype.toString.call(value);if(isDate2(value))base=" "+Date.prototype.toUTCString.call(value);if(isError2(value))base=" "+formatError2(value);if(keys.length===0&&(!array||value.length==0))return braces[0]+base+braces[1];if(recurseTimes<0)if(isRegExp2(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");else return ctx.stylize("[Object]","special");ctx.seen.push(value);var output;if(array)output=formatArray2(ctx,value,recurseTimes,visibleKeys,keys);else output=keys.map(function(key){return formatProperty2(ctx,value,recurseTimes,visibleKeys,key,array)});return ctx.seen.pop(),reduceToSingleString2(output,base,braces)}function formatPrimitive2(ctx,value){if(isUndefined2(value))return ctx.stylize("undefined","undefined");if(isString2(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber2(value))return ctx.stylize(""+value,"number");if(isBoolean2(value))return ctx.stylize(""+value,"boolean");if(isNull2(value))return ctx.stylize("null","null")}function formatError2(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray2(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i2=0,l=value.length;i2<l;++i2)if(hasOwnProperty2(value,String(i2)))output.push(formatProperty2(ctx,value,recurseTimes,visibleKeys,String(i2),!0));else output.push("");return keys.forEach(function(key){if(!key.match(/^\d+$/))output.push(formatProperty2(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty2(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get)if(desc.set)str=ctx.stylize("[Getter/Setter]","special");else str=ctx.stylize("[Getter]","special");else if(desc.set)str=ctx.stylize("[Setter]","special");if(!hasOwnProperty2(visibleKeys,key))name="["+key+"]";if(!str)if(ctx.seen.indexOf(desc.value)<0){if(isNull2(recurseTimes))str=formatValue2(ctx,desc.value,null);else str=formatValue2(ctx,desc.value,recurseTimes-1);if(str.indexOf(`
17
+ `)>-1)if(array)str=str.split(`
18
+ `).map(function(line){return" "+line}).join(`
19
+ `).slice(2);else str=`
20
+ `+str.split(`
21
+ `).map(function(line){return" "+line}).join(`
22
+ `)}else str=ctx.stylize("[Circular]","special");if(isUndefined2(name)){if(array&&key.match(/^\d+$/))return str;if(name=JSON.stringify(""+key),name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))name=name.slice(1,-1),name=ctx.stylize(name,"name");else name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string")}return name+": "+str}function reduceToSingleString2(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){if(numLinesEst++,cur.indexOf(`
23
+ `)>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60)return braces[0]+(base===""?"":base+`
24
+ `)+" "+output.join(`,
25
+ `)+" "+braces[1];return braces[0]+base+" "+output.join(", ")+" "+braces[1]}exports.types=require_types();function isArray2(ar){return Array.isArray(ar)}exports.isArray=isArray2;function isBoolean2(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean2;function isNull2(arg){return arg===null}exports.isNull=isNull2;function isNullOrUndefined2(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined2;function isNumber2(arg){return typeof arg==="number"}exports.isNumber=isNumber2;function isString2(arg){return typeof arg==="string"}exports.isString=isString2;function isSymbol2(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol2;function isUndefined2(arg){return arg===void 0}exports.isUndefined=isUndefined2;function isRegExp2(re){return isObject2(re)&&objectToString2(re)==="[object RegExp]"}exports.isRegExp=isRegExp2,exports.types.isRegExp=isRegExp2;function isObject2(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject2;function isDate2(d){return isObject2(d)&&objectToString2(d)==="[object Date]"}exports.isDate=isDate2,exports.types.isDate=isDate2;function isError2(e){return isObject2(e)&&(objectToString2(e)==="[object Error]"||e instanceof Error)}exports.isError=isError2,exports.types.isNativeError=isError2;function isFunction2(arg){return typeof arg==="function"}exports.isFunction=isFunction2;function isPrimitive2(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg>"u"}exports.isPrimitive=isPrimitive2,exports.isBuffer=require_isBuffer();function objectToString2(o){return Object.prototype.toString.call(o)}function pad2(n){return n<10?"0"+n.toString(10):n.toString(10)}var months2=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp2(){var d=new Date,time=[pad2(d.getHours()),pad2(d.getMinutes()),pad2(d.getSeconds())].join(":");return[d.getDate(),months2[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp2(),exports.format.apply(exports,arguments))},exports.inherits=require_inherits2(),exports._extend=function(origin,add){if(!add||!isObject2(add))return origin;var keys=Object.keys(add),i2=keys.length;while(i2--)origin[keys[i2]]=add[keys[i2]];return origin};function hasOwnProperty2(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var kCustomPromisifiedSymbol2=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;exports.promisify=function(original){if(typeof original!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol2&&original[kCustomPromisifiedSymbol2]){var fn=original[kCustomPromisifiedSymbol2];if(typeof fn!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(fn,kCustomPromisifiedSymbol2,{value:fn,enumerable:!1,writable:!1,configurable:!0}),fn}function fn(){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject}),args=[];for(var i2=0;i2<arguments.length;i2++)args.push(arguments[i2]);args.push(function(err,value){if(err)promiseReject(err);else promiseResolve(value)});try{original.apply(this,args)}catch(err){promiseReject(err)}return promise}if(Object.setPrototypeOf(fn,Object.getPrototypeOf(original)),kCustomPromisifiedSymbol2)Object.defineProperty(fn,kCustomPromisifiedSymbol2,{value:fn,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(fn,getOwnPropertyDescriptors(original))},exports.promisify.custom=kCustomPromisifiedSymbol2;function callbackifyOnRejected2(reason,cb){if(!reason){var newReason=Error("Promise was rejected with a falsy value");newReason.reason=reason,reason=newReason}return cb(reason)}function callbackify2(original){if(typeof original!=="function")throw TypeError('The "original" argument must be of type Function');function callbackified(){var args=[];for(var i2=0;i2<arguments.length;i2++)args.push(arguments[i2]);var maybeCb=args.pop();if(typeof maybeCb!=="function")throw TypeError("The last argument must be of type Function");var self2=this,cb=function(){return maybeCb.apply(self2,arguments)};original.apply(this,args).then(function(ret){process.nextTick(cb.bind(null,null,ret))},function(rej){process.nextTick(callbackifyOnRejected2.bind(null,rej,cb))})}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(original)),Object.defineProperties(callbackified,getOwnPropertyDescriptors(original)),callbackified}exports.callbackify=callbackify2}),require_errors=__commonJS3((exports,module)=>{function _typeof(o){return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},_typeof(o)}function _defineProperties(target,props){for(var i2=0;i2<props.length;i2++){var descriptor=props[i2];if(descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor)descriptor.writable=!0;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key)}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null)throw TypeError("Super expression must either be null or a function");if(subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o2,p2){return o2.__proto__=p2,o2},_setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self2,call){if(call&&(_typeof(call)==="object"||typeof call==="function"))return call;else if(call!==void 0)throw TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(self2)}function _assertThisInitialized(self2){if(self2===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return self2}function _isNativeReflectConstruct(){if(typeof Reflect>"u"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy==="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o2){return o2.__proto__||Object.getPrototypeOf(o2)},_getPrototypeOf(o)}var codes={},assert,util;function createErrorType(code2,message,Base){if(!Base)Base=Error;function getMessage(arg1,arg2,arg3){if(typeof message==="string")return message;else return message(arg1,arg2,arg3)}var NodeError=function(_Base){_inherits(NodeError2,_Base);var _super=_createSuper(NodeError2);function NodeError2(arg1,arg2,arg3){var _this;return _classCallCheck(this,NodeError2),_this=_super.call(this,getMessage(arg1,arg2,arg3)),_this.code=code2,_this}return _createClass(NodeError2)}(Base);codes[code2]=NodeError}function oneOf(expected,thing){if(Array.isArray(expected)){var len2=expected.length;if(expected=expected.map(function(i2){return String(i2)}),len2>2)return"one of ".concat(thing," ").concat(expected.slice(0,len2-1).join(", "),", or ")+expected[len2-1];else if(len2===2)return"one of ".concat(thing," ").concat(expected[0]," or ").concat(expected[1]);else return"of ".concat(thing," ").concat(expected[0])}else return"of ".concat(thing," ").concat(String(expected))}function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search}function endsWith(str,search,this_len){if(this_len===void 0||this_len>str.length)this_len=str.length;return str.substring(this_len-search.length,this_len)===search}function includes(str,search,start){if(typeof start!=="number")start=0;if(start+search.length>str.length)return!1;else return str.indexOf(search,start)!==-1}createErrorType("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),createErrorType("ERR_INVALID_ARG_TYPE",function(name,expected,actual){if(assert===void 0)assert=require_assert();assert(typeof name==="string","'name' must be a string");var determiner;if(typeof expected==="string"&&startsWith(expected,"not "))determiner="must not be",expected=expected.replace(/^not /,"");else determiner="must be";var msg;if(endsWith(name," argument"))msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,"type"));else{var type=includes(name,".")?"property":"argument";msg='The "'.concat(name,'" ').concat(type," ").concat(determiner," ").concat(oneOf(expected,"type"))}return msg+=". Received type ".concat(_typeof(actual)),msg},TypeError),createErrorType("ERR_INVALID_ARG_VALUE",function(name,value){var reason=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";if(util===void 0)util=require_util();var inspected=util.inspect(value);if(inspected.length>128)inspected="".concat(inspected.slice(0,128),"...");return"The argument '".concat(name,"' ").concat(reason,". Received ").concat(inspected)},TypeError,RangeError),createErrorType("ERR_INVALID_RETURN_VALUE",function(input,name,value){var type;if(value&&value.constructor&&value.constructor.name)type="instance of ".concat(value.constructor.name);else type="type ".concat(_typeof(value));return"Expected ".concat(input,' to be returned from the "').concat(name,'"')+" function but got ".concat(type,".")},TypeError),createErrorType("ERR_MISSING_ARGS",function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];if(assert===void 0)assert=require_assert();assert(args.length>0,"At least one arg needs to be specified");var msg="The ",len2=args.length;switch(args=args.map(function(a){return'"'.concat(a,'"')}),len2){case 1:msg+="".concat(args[0]," argument");break;case 2:msg+="".concat(args[0]," and ").concat(args[1]," arguments");break;default:msg+=args.slice(0,len2-1).join(", "),msg+=", and ".concat(args[len2-1]," arguments");break}return"".concat(msg," must be specified")},TypeError),exports.codes=codes}),require_assertion_error=__commonJS3((exports,module)=>{function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r2){return Object.getOwnPropertyDescriptor(e,r2).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r2){_defineProperty(e,r2,t[r2])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r2){Object.defineProperty(e,r2,Object.getOwnPropertyDescriptor(t,r2))})}return e}function _defineProperty(obj,key,value){if(key=_toPropertyKey(key),key in obj)Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0});else obj[key]=value;return obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i2=0;i2<props.length;i2++){var descriptor=props[i2];if(descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor)descriptor.writable=!0;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key)}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null)throw TypeError("Super expression must either be null or a function");if(subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass)_setPrototypeOf(subClass,superClass)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self2,call){if(call&&(_typeof(call)==="object"||typeof call==="function"))return call;else if(call!==void 0)throw TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(self2)}function _assertThisInitialized(self2){if(self2===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return self2}function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map:void 0;return _wrapNativeSuper=function(Class2){if(Class2===null||!_isNativeFunction(Class2))return Class2;if(typeof Class2!=="function")throw TypeError("Super expression must either be null or a function");if(typeof _cache<"u"){if(_cache.has(Class2))return _cache.get(Class2);_cache.set(Class2,Wrapper)}function Wrapper(){return _construct(Class2,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(Class2.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,Class2)},_wrapNativeSuper(Class)}function _construct(Parent,args,Class){if(_isNativeReflectConstruct())_construct=Reflect.construct.bind();else _construct=function(Parent2,args2,Class2){var a=[null];a.push.apply(a,args2);var Constructor=Function.bind.apply(Parent2,a),instance=new Constructor;if(Class2)_setPrototypeOf(instance,Class2.prototype);return instance};return _construct.apply(null,arguments)}function _isNativeReflectConstruct(){if(typeof Reflect>"u"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy==="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o2,p2){return o2.__proto__=p2,o2},_setPrototypeOf(o,p)}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o2){return o2.__proto__||Object.getPrototypeOf(o2)},_getPrototypeOf(o)}function _typeof(o){return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},_typeof(o)}var _require=require_util(),inspect2=_require.inspect,_require2=require_errors(),ERR_INVALID_ARG_TYPE3=_require2.codes.ERR_INVALID_ARG_TYPE;function endsWith(str,search,this_len){if(this_len===void 0||this_len>str.length)this_len=str.length;return str.substring(this_len-search.length,this_len)===search}function repeat(str,count){if(count=Math.floor(count),str.length==0||count==0)return"";var maxCount=str.length*count;count=Math.floor(Math.log(count)/Math.log(2));while(count)str+=str,count--;return str+=str.substring(0,maxCount-str.length),str}var blue="",green="",red="",white="",kReadableOperator={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},kMaxShortLength=10;function copyError(source){var keys=Object.keys(source),target=Object.create(Object.getPrototypeOf(source));return keys.forEach(function(key){target[key]=source[key]}),Object.defineProperty(target,"message",{value:source.message}),target}function inspectValue(val){return inspect2(val,{compact:!1,customInspect:!1,depth:1000,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function createErrDiff(actual,expected,operator){var other="",res="",lastPos=0,end="",skipped=!1,actualInspected=inspectValue(actual),actualLines=actualInspected.split(`
26
+ `),expectedLines=inspectValue(expected).split(`
27
+ `),i2=0,indicator="";if(operator==="strictEqual"&&_typeof(actual)==="object"&&_typeof(expected)==="object"&&actual!==null&&expected!==null)operator="strictEqualObject";if(actualLines.length===1&&expectedLines.length===1&&actualLines[0]!==expectedLines[0]){var inputLength=actualLines[0].length+expectedLines[0].length;if(inputLength<=kMaxShortLength){if((_typeof(actual)!=="object"||actual===null)&&(_typeof(expected)!=="object"||expected===null)&&(actual!==0||expected!==0))return"".concat(kReadableOperator[operator],`
28
+
29
+ `)+"".concat(actualLines[0]," !== ").concat(expectedLines[0],`
30
+ `)}else if(operator!=="strictEqualObject"){var maxLength=process.stderr&&process.stderr.isTTY?process.stderr.columns:80;if(inputLength<maxLength){while(actualLines[0][i2]===expectedLines[0][i2])i2++;if(i2>2)indicator=`
31
+ `.concat(repeat(" ",i2),"^"),i2=0}}}var a=actualLines[actualLines.length-1],b=expectedLines[expectedLines.length-1];while(a===b){if(i2++<2)end=`
32
+ `.concat(a).concat(end);else other=a;if(actualLines.pop(),expectedLines.pop(),actualLines.length===0||expectedLines.length===0)break;a=actualLines[actualLines.length-1],b=expectedLines[expectedLines.length-1]}var maxLines=Math.max(actualLines.length,expectedLines.length);if(maxLines===0){var _actualLines=actualInspected.split(`
33
+ `);if(_actualLines.length>30){_actualLines[26]="".concat(blue,"...").concat(white);while(_actualLines.length>27)_actualLines.pop()}return"".concat(kReadableOperator.notIdentical,`
34
+
35
+ `).concat(_actualLines.join(`
36
+ `),`
37
+ `)}if(i2>3)end=`
38
+ `.concat(blue,"...").concat(white).concat(end),skipped=!0;if(other!=="")end=`
39
+ `.concat(other).concat(end),other="";var printedLines=0,msg=kReadableOperator[operator]+`
40
+ `.concat(green,"+ actual").concat(white," ").concat(red,"- expected").concat(white),skippedMsg=" ".concat(blue,"...").concat(white," Lines skipped");for(i2=0;i2<maxLines;i2++){var cur=i2-lastPos;if(actualLines.length<i2+1){if(cur>1&&i2>2){if(cur>4)res+=`
41
+ `.concat(blue,"...").concat(white),skipped=!0;else if(cur>3)res+=`
42
+ `.concat(expectedLines[i2-2]),printedLines++;res+=`
43
+ `.concat(expectedLines[i2-1]),printedLines++}lastPos=i2,other+=`
44
+ `.concat(red,"-").concat(white," ").concat(expectedLines[i2]),printedLines++}else if(expectedLines.length<i2+1){if(cur>1&&i2>2){if(cur>4)res+=`
45
+ `.concat(blue,"...").concat(white),skipped=!0;else if(cur>3)res+=`
46
+ `.concat(actualLines[i2-2]),printedLines++;res+=`
47
+ `.concat(actualLines[i2-1]),printedLines++}lastPos=i2,res+=`
48
+ `.concat(green,"+").concat(white," ").concat(actualLines[i2]),printedLines++}else{var expectedLine=expectedLines[i2],actualLine=actualLines[i2],divergingLines=actualLine!==expectedLine&&(!endsWith(actualLine,",")||actualLine.slice(0,-1)!==expectedLine);if(divergingLines&&endsWith(expectedLine,",")&&expectedLine.slice(0,-1)===actualLine)divergingLines=!1,actualLine+=",";if(divergingLines){if(cur>1&&i2>2){if(cur>4)res+=`
49
+ `.concat(blue,"...").concat(white),skipped=!0;else if(cur>3)res+=`
50
+ `.concat(actualLines[i2-2]),printedLines++;res+=`
51
+ `.concat(actualLines[i2-1]),printedLines++}lastPos=i2,res+=`
52
+ `.concat(green,"+").concat(white," ").concat(actualLine),other+=`
53
+ `.concat(red,"-").concat(white," ").concat(expectedLine),printedLines+=2}else if(res+=other,other="",cur===1||i2===0)res+=`
54
+ `.concat(actualLine),printedLines++}if(printedLines>20&&i2<maxLines-2)return"".concat(msg).concat(skippedMsg,`
55
+ `).concat(res,`
56
+ `).concat(blue,"...").concat(white).concat(other,`
57
+ `)+"".concat(blue,"...").concat(white)}return"".concat(msg).concat(skipped?skippedMsg:"",`
58
+ `).concat(res).concat(other).concat(end).concat(indicator)}var AssertionError=function(_Error,_inspect$custom){_inherits(AssertionError2,_Error);var _super=_createSuper(AssertionError2);function AssertionError2(options){var _this;if(_classCallCheck(this,AssertionError2),_typeof(options)!=="object"||options===null)throw new ERR_INVALID_ARG_TYPE3("options","Object",options);var{message,operator,stackStartFn,actual,expected}=options,limit=Error.stackTraceLimit;if(Error.stackTraceLimit=0,message!=null)_this=_super.call(this,String(message));else{if(process.stderr&&process.stderr.isTTY)if(process.stderr&&process.stderr.getColorDepth&&process.stderr.getColorDepth()!==1)blue="\x1B[34m",green="\x1B[32m",white="\x1B[39m",red="\x1B[31m";else blue="",green="",white="",red="";if(_typeof(actual)==="object"&&actual!==null&&_typeof(expected)==="object"&&expected!==null&&"stack"in actual&&actual instanceof Error&&"stack"in expected&&expected instanceof Error)actual=copyError(actual),expected=copyError(expected);if(operator==="deepStrictEqual"||operator==="strictEqual")_this=_super.call(this,createErrDiff(actual,expected,operator));else if(operator==="notDeepStrictEqual"||operator==="notStrictEqual"){var base=kReadableOperator[operator],res=inspectValue(actual).split(`
59
+ `);if(operator==="notStrictEqual"&&_typeof(actual)==="object"&&actual!==null)base=kReadableOperator.notStrictEqualObject;if(res.length>30){res[26]="".concat(blue,"...").concat(white);while(res.length>27)res.pop()}if(res.length===1)_this=_super.call(this,"".concat(base," ").concat(res[0]));else _this=_super.call(this,"".concat(base,`
60
+
61
+ `).concat(res.join(`
62
+ `),`
63
+ `))}else{var _res=inspectValue(actual),other="",knownOperators=kReadableOperator[operator];if(operator==="notDeepEqual"||operator==="notEqual"){if(_res="".concat(kReadableOperator[operator],`
64
+
65
+ `).concat(_res),_res.length>1024)_res="".concat(_res.slice(0,1021),"...")}else{if(other="".concat(inspectValue(expected)),_res.length>512)_res="".concat(_res.slice(0,509),"...");if(other.length>512)other="".concat(other.slice(0,509),"...");if(operator==="deepEqual"||operator==="equal")_res="".concat(knownOperators,`
66
+
67
+ `).concat(_res,`
68
+
69
+ should equal
70
+
71
+ `);else other=" ".concat(operator," ").concat(other)}_this=_super.call(this,"".concat(_res).concat(other))}}if(Error.stackTraceLimit=limit,_this.generatedMessage=!message,Object.defineProperty(_assertThisInitialized(_this),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),_this.code="ERR_ASSERTION",_this.actual=actual,_this.expected=expected,_this.operator=operator,Error.captureStackTrace)Error.captureStackTrace(_assertThisInitialized(_this),stackStartFn);return _this.stack,_this.name="AssertionError",_possibleConstructorReturn(_this)}return _createClass(AssertionError2,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:_inspect$custom,value:function(recurseTimes,ctx){return inspect2(this,_objectSpread(_objectSpread({},ctx),{},{customInspect:!1,depth:0}))}}]),AssertionError2}(_wrapNativeSuper(Error),inspect2.custom);module.exports=AssertionError}),require_isArguments=__commonJS3((exports,module)=>{var toStr=Object.prototype.toString;module.exports=function(value){var str=toStr.call(value),isArgs=str==="[object Arguments]";if(!isArgs)isArgs=str!=="[object Array]"&&value!==null&&typeof value==="object"&&typeof value.length==="number"&&value.length>=0&&toStr.call(value.callee)==="[object Function]";return isArgs}}),require_implementation22=__commonJS3((exports,module)=>{var keysShim;if(!Object.keys)has=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,isArgs=require_isArguments(),isEnumerable=Object.prototype.propertyIsEnumerable,hasDontEnumBug=!isEnumerable.call({toString:null},"toString"),hasProtoEnumBug=isEnumerable.call(function(){},"prototype"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o},excludedKeys={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},hasAutomationEqualityBug=function(){if(typeof window>"u")return!1;for(var k in window)try{if(!excludedKeys["$"+k]&&has.call(window,k)&&window[k]!==null&&typeof window[k]==="object")try{equalsConstructorPrototype(window[k])}catch(e){return!0}}catch(e){return!0}return!1}(),equalsConstructorPrototypeIfNotBuggy=function(o){if(typeof window>"u"||!hasAutomationEqualityBug)return equalsConstructorPrototype(o);try{return equalsConstructorPrototype(o)}catch(e){return!1}},keysShim=function(object){var isObject2=object!==null&&typeof object==="object",isFunction2=toStr.call(object)==="[object Function]",isArguments=isArgs(object),isString2=isObject2&&toStr.call(object)==="[object String]",theKeys=[];if(!isObject2&&!isFunction2&&!isArguments)throw TypeError("Object.keys called on a non-object");var skipProto=hasProtoEnumBug&&isFunction2;if(isString2&&object.length>0&&!has.call(object,0))for(var i2=0;i2<object.length;++i2)theKeys.push(String(i2));if(isArguments&&object.length>0)for(var j=0;j<object.length;++j)theKeys.push(String(j));else for(var name in object)if(!(skipProto&&name==="prototype")&&has.call(object,name))theKeys.push(String(name));if(hasDontEnumBug){var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object);for(var k=0;k<dontEnums.length;++k)if(!(skipConstructor&&dontEnums[k]==="constructor")&&has.call(object,dontEnums[k]))theKeys.push(dontEnums[k])}return theKeys};var has,toStr,isArgs,isEnumerable,hasDontEnumBug,hasProtoEnumBug,dontEnums,equalsConstructorPrototype,excludedKeys,hasAutomationEqualityBug,equalsConstructorPrototypeIfNotBuggy;module.exports=keysShim}),require_object_keys=__commonJS3((exports,module)=>{var slice=Array.prototype.slice,isArgs=require_isArguments(),origKeys=Object.keys,keysShim=origKeys?function(o){return origKeys(o)}:require_implementation22(),originalKeys=Object.keys;keysShim.shim=function(){if(Object.keys){var keysWorksWithArguments=function(){var args=Object.keys(arguments);return args&&args.length===arguments.length}(1,2);if(!keysWorksWithArguments)Object.keys=function(object){if(isArgs(object))return originalKeys(slice.call(object));return originalKeys(object)}}else Object.keys=keysShim;return Object.keys||keysShim},module.exports=keysShim}),require_implementation3=__commonJS3((exports,module)=>{var objectKeys=require_object_keys(),hasSymbols=require_shams3()(),callBound=require_call_bound2(),$Object=require_es_object_atoms2(),$push=callBound("Array.prototype.push"),$propIsEnumerable=callBound("Object.prototype.propertyIsEnumerable"),originalGetSymbols=hasSymbols?$Object.getOwnPropertySymbols:null;module.exports=function(target,source1){if(target==null)throw TypeError("target must be an object");var to=$Object(target);if(arguments.length===1)return to;for(var s=1;s<arguments.length;++s){var from2=$Object(arguments[s]),keys=objectKeys(from2),getSymbols=hasSymbols&&($Object.getOwnPropertySymbols||originalGetSymbols);if(getSymbols){var syms=getSymbols(from2);for(var j=0;j<syms.length;++j){var key=syms[j];if($propIsEnumerable(from2,key))$push(keys,key)}}for(var i2=0;i2<keys.length;++i2){var nextKey=keys[i2];if($propIsEnumerable(from2,nextKey)){var propValue=from2[nextKey];to[nextKey]=propValue}}}return to}}),require_polyfill=__commonJS3((exports,module)=>{var implementation=require_implementation3(),lacksProperEnumerationOrder=function(){if(!Object.assign)return!1;var str="abcdefghijklmnopqrst",letters=str.split(""),map={};for(var i2=0;i2<letters.length;++i2)map[letters[i2]]=letters[i2];var obj=Object.assign({},map),actual="";for(var k in obj)actual+=k;return str!==actual},assignHasPendingExceptions=function(){if(!Object.assign||!Object.preventExtensions)return!1;var thrower=Object.preventExtensions({1:2});try{Object.assign(thrower,"xy")}catch(e){return thrower[1]==="y"}return!1};module.exports=function(){if(!Object.assign)return implementation;if(lacksProperEnumerationOrder())return implementation;if(assignHasPendingExceptions())return implementation;return Object.assign}}),require_implementation4=__commonJS3((exports,module)=>{var numberIsNaN=function(value){return value!==value};module.exports=function(a,b){if(a===0&&b===0)return 1/a===1/b;if(a===b)return!0;if(numberIsNaN(a)&&numberIsNaN(b))return!0;return!1}}),require_polyfill2=__commonJS3((exports,module)=>{var implementation=require_implementation4();module.exports=function(){return typeof Object.is==="function"?Object.is:implementation}}),require_callBound=__commonJS3((exports,module)=>{var GetIntrinsic=require_get_intrinsic2(),callBind=require_call_bind2(),$indexOf=callBind(GetIntrinsic("String.prototype.indexOf"));module.exports=function(name,allowMissing){var intrinsic=GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==="function"&&$indexOf(name,".prototype.")>-1)return callBind(intrinsic);return intrinsic}}),require_define_properties=__commonJS3((exports,module)=>{var keys=require_object_keys(),hasSymbols=typeof Symbol==="function"&&typeof Symbol("foo")==="symbol",toStr=Object.prototype.toString,concat=Array.prototype.concat,defineDataProperty=require_define_data_property2(),isFunction2=function(fn){return typeof fn==="function"&&toStr.call(fn)==="[object Function]"},supportsDescriptors=require_has_property_descriptors2()(),defineProperty=function(object,name,value,predicate){if(name in object){if(predicate===!0){if(object[name]===value)return}else if(!isFunction2(predicate)||!predicate())return}if(supportsDescriptors)defineDataProperty(object,name,value,!0);else defineDataProperty(object,name,value)},defineProperties=function(object,map){var predicates=arguments.length>2?arguments[2]:{},props=keys(map);if(hasSymbols)props=concat.call(props,Object.getOwnPropertySymbols(map));for(var i2=0;i2<props.length;i2+=1)defineProperty(object,props[i2],map[props[i2]],predicates[props[i2]])};defineProperties.supportsDescriptors=!!supportsDescriptors,module.exports=defineProperties}),require_shim=__commonJS3((exports,module)=>{var getPolyfill=require_polyfill2(),define=require_define_properties();module.exports=function(){var polyfill=getPolyfill();return define(Object,{is:polyfill},{is:function(){return Object.is!==polyfill}}),polyfill}}),require_object_is=__commonJS3((exports,module)=>{var define=require_define_properties(),callBind=require_call_bind2(),implementation=require_implementation4(),getPolyfill=require_polyfill2(),shim=require_shim(),polyfill=callBind(getPolyfill(),Object);define(polyfill,{getPolyfill,implementation,shim}),module.exports=polyfill}),require_implementation5=__commonJS3((exports,module)=>{module.exports=function(value){return value!==value}}),require_polyfill3=__commonJS3((exports,module)=>{var implementation=require_implementation5();module.exports=function(){if(Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a"))return Number.isNaN;return implementation}}),require_shim2=__commonJS3((exports,module)=>{var define=require_define_properties(),getPolyfill=require_polyfill3();module.exports=function(){var polyfill=getPolyfill();return define(Number,{isNaN:polyfill},{isNaN:function(){return Number.isNaN!==polyfill}}),polyfill}}),require_is_nan=__commonJS3((exports,module)=>{var callBind=require_call_bind2(),define=require_define_properties(),implementation=require_implementation5(),getPolyfill=require_polyfill3(),shim=require_shim2(),polyfill=callBind(getPolyfill(),Number);define(polyfill,{getPolyfill,implementation,shim}),module.exports=polyfill}),require_comparisons=__commonJS3((exports,module)=>{function _slicedToArray(arr,i2){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i2)||_unsupportedIterableToArray(arr,i2)||_nonIterableRest()}function _nonIterableRest(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
72
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len2){if(len2==null||len2>arr.length)len2=arr.length;for(var i2=0,arr2=Array(len2);i2<len2;i2++)arr2[i2]=arr[i2];return arr2}function _iterableToArrayLimit(r,l){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var e,n,i2,u,a=[],f=!0,o=!1;try{if(i2=(t=t.call(r)).next,l===0){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i2.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r2){o=!0,n=r2}finally{try{if(!f&&t.return!=null&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _typeof(o){return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},_typeof(o)}var regexFlagsSupported=/a/g.flags!==void 0,arrayFromSet=function(set){var array=[];return set.forEach(function(value){return array.push(value)}),array},arrayFromMap=function(map){var array=[];return map.forEach(function(value,key){return array.push([key,value])}),array},objectIs=Object.is?Object.is:require_object_is(),objectGetOwnPropertySymbols=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},numberIsNaN=Number.isNaN?Number.isNaN:require_is_nan();function uncurryThis(f){return f.call.bind(f)}var hasOwnProperty2=uncurryThis(Object.prototype.hasOwnProperty),propertyIsEnumerable=uncurryThis(Object.prototype.propertyIsEnumerable),objectToString2=uncurryThis(Object.prototype.toString),_require$types=require_util().types,isAnyArrayBuffer=_require$types.isAnyArrayBuffer,isArrayBufferView=_require$types.isArrayBufferView,isDate2=_require$types.isDate,isMap=_require$types.isMap,isRegExp2=_require$types.isRegExp,isSet=_require$types.isSet,isNativeError=_require$types.isNativeError,isBoxedPrimitive=_require$types.isBoxedPrimitive,isNumberObject=_require$types.isNumberObject,isStringObject=_require$types.isStringObject,isBooleanObject=_require$types.isBooleanObject,isBigIntObject=_require$types.isBigIntObject,isSymbolObject=_require$types.isSymbolObject,isFloat32Array=_require$types.isFloat32Array,isFloat64Array=_require$types.isFloat64Array;function isNonIndex(key){if(key.length===0||key.length>10)return!0;for(var i2=0;i2<key.length;i2++){var code2=key.charCodeAt(i2);if(code2<48||code2>57)return!0}return key.length===10&&key>=Math.pow(2,32)}function getOwnNonIndexProperties(value){return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)))}/*!
73
+ * The buffer module from node.js, for the browser.
74
+ *
75
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
76
+ * @license MIT
77
+ */function compare(a,b){if(a===b)return 0;var x=a.length,y=b.length;for(var i2=0,len2=Math.min(x,y);i2<len2;++i2)if(a[i2]!==b[i2]){x=a[i2],y=b[i2];break}if(x<y)return-1;if(y<x)return 1;return 0}var ONLY_ENUMERABLE=void 0,kStrict=!0,kLoose=!1,kNoIterator=0,kIsArray=1,kIsSet=2,kIsMap=3;function areSimilarRegExps(a,b){return regexFlagsSupported?a.source===b.source&&a.flags===b.flags:RegExp.prototype.toString.call(a)===RegExp.prototype.toString.call(b)}function areSimilarFloatArrays(a,b){if(a.byteLength!==b.byteLength)return!1;for(var offset=0;offset<a.byteLength;offset++)if(a[offset]!==b[offset])return!1;return!0}function areSimilarTypedArrays(a,b){if(a.byteLength!==b.byteLength)return!1;return compare(new Uint8Array(a.buffer,a.byteOffset,a.byteLength),new Uint8Array(b.buffer,b.byteOffset,b.byteLength))===0}function areEqualArrayBuffers(buf1,buf2){return buf1.byteLength===buf2.byteLength&&compare(new Uint8Array(buf1),new Uint8Array(buf2))===0}function isEqualBoxedPrimitive(val1,val2){if(isNumberObject(val1))return isNumberObject(val2)&&objectIs(Number.prototype.valueOf.call(val1),Number.prototype.valueOf.call(val2));if(isStringObject(val1))return isStringObject(val2)&&String.prototype.valueOf.call(val1)===String.prototype.valueOf.call(val2);if(isBooleanObject(val1))return isBooleanObject(val2)&&Boolean.prototype.valueOf.call(val1)===Boolean.prototype.valueOf.call(val2);if(isBigIntObject(val1))return isBigIntObject(val2)&&BigInt.prototype.valueOf.call(val1)===BigInt.prototype.valueOf.call(val2);return isSymbolObject(val2)&&Symbol.prototype.valueOf.call(val1)===Symbol.prototype.valueOf.call(val2)}function innerDeepEqual(val1,val2,strict,memos){if(val1===val2){if(val1!==0)return!0;return strict?objectIs(val1,val2):!0}if(strict){if(_typeof(val1)!=="object")return typeof val1==="number"&&numberIsNaN(val1)&&numberIsNaN(val2);if(_typeof(val2)!=="object"||val1===null||val2===null)return!1;if(Object.getPrototypeOf(val1)!==Object.getPrototypeOf(val2))return!1}else{if(val1===null||_typeof(val1)!=="object"){if(val2===null||_typeof(val2)!=="object")return val1==val2;return!1}if(val2===null||_typeof(val2)!=="object")return!1}var val1Tag=objectToString2(val1),val2Tag=objectToString2(val2);if(val1Tag!==val2Tag)return!1;if(Array.isArray(val1)){if(val1.length!==val2.length)return!1;var keys1=getOwnNonIndexProperties(val1,ONLY_ENUMERABLE),keys2=getOwnNonIndexProperties(val2,ONLY_ENUMERABLE);if(keys1.length!==keys2.length)return!1;return keyCheck(val1,val2,strict,memos,kIsArray,keys1)}if(val1Tag==="[object Object]"){if(!isMap(val1)&&isMap(val2)||!isSet(val1)&&isSet(val2))return!1}if(isDate2(val1)){if(!isDate2(val2)||Date.prototype.getTime.call(val1)!==Date.prototype.getTime.call(val2))return!1}else if(isRegExp2(val1)){if(!isRegExp2(val2)||!areSimilarRegExps(val1,val2))return!1}else if(isNativeError(val1)||val1 instanceof Error){if(val1.message!==val2.message||val1.name!==val2.name)return!1}else if(isArrayBufferView(val1)){if(!strict&&(isFloat32Array(val1)||isFloat64Array(val1))){if(!areSimilarFloatArrays(val1,val2))return!1}else if(!areSimilarTypedArrays(val1,val2))return!1;var _keys=getOwnNonIndexProperties(val1,ONLY_ENUMERABLE),_keys2=getOwnNonIndexProperties(val2,ONLY_ENUMERABLE);if(_keys.length!==_keys2.length)return!1;return keyCheck(val1,val2,strict,memos,kNoIterator,_keys)}else if(isSet(val1)){if(!isSet(val2)||val1.size!==val2.size)return!1;return keyCheck(val1,val2,strict,memos,kIsSet)}else if(isMap(val1)){if(!isMap(val2)||val1.size!==val2.size)return!1;return keyCheck(val1,val2,strict,memos,kIsMap)}else if(isAnyArrayBuffer(val1)){if(!areEqualArrayBuffers(val1,val2))return!1}else if(isBoxedPrimitive(val1)&&!isEqualBoxedPrimitive(val1,val2))return!1;return keyCheck(val1,val2,strict,memos,kNoIterator)}function getEnumerables(val,keys){return keys.filter(function(k){return propertyIsEnumerable(val,k)})}function keyCheck(val1,val2,strict,memos,iterationType,aKeys){if(arguments.length===5){aKeys=Object.keys(val1);var bKeys=Object.keys(val2);if(aKeys.length!==bKeys.length)return!1}var i2=0;for(;i2<aKeys.length;i2++)if(!hasOwnProperty2(val2,aKeys[i2]))return!1;if(strict&&arguments.length===5){var symbolKeysA=objectGetOwnPropertySymbols(val1);if(symbolKeysA.length!==0){var count=0;for(i2=0;i2<symbolKeysA.length;i2++){var key=symbolKeysA[i2];if(propertyIsEnumerable(val1,key)){if(!propertyIsEnumerable(val2,key))return!1;aKeys.push(key),count++}else if(propertyIsEnumerable(val2,key))return!1}var symbolKeysB=objectGetOwnPropertySymbols(val2);if(symbolKeysA.length!==symbolKeysB.length&&getEnumerables(val2,symbolKeysB).length!==count)return!1}else{var _symbolKeysB=objectGetOwnPropertySymbols(val2);if(_symbolKeysB.length!==0&&getEnumerables(val2,_symbolKeysB).length!==0)return!1}}if(aKeys.length===0&&(iterationType===kNoIterator||iterationType===kIsArray&&val1.length===0||val1.size===0))return!0;if(memos===void 0)memos={val1:new Map,val2:new Map,position:0};else{var val2MemoA=memos.val1.get(val1);if(val2MemoA!==void 0){var val2MemoB=memos.val2.get(val2);if(val2MemoB!==void 0)return val2MemoA===val2MemoB}memos.position++}memos.val1.set(val1,memos.position),memos.val2.set(val2,memos.position);var areEq=objEquiv(val1,val2,strict,aKeys,memos,iterationType);return memos.val1.delete(val1),memos.val2.delete(val2),areEq}function setHasEqualElement(set,val1,strict,memo){var setValues=arrayFromSet(set);for(var i2=0;i2<setValues.length;i2++){var val2=setValues[i2];if(innerDeepEqual(val1,val2,strict,memo))return set.delete(val2),!0}return!1}function findLooseMatchingPrimitives(prim){switch(_typeof(prim)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":prim=+prim;case"number":if(numberIsNaN(prim))return!1}return!0}function setMightHaveLoosePrim(a,b,prim){var altValue=findLooseMatchingPrimitives(prim);if(altValue!=null)return altValue;return b.has(altValue)&&!a.has(altValue)}function mapMightHaveLoosePrim(a,b,prim,item,memo){var altValue=findLooseMatchingPrimitives(prim);if(altValue!=null)return altValue;var curB=b.get(altValue);if(curB===void 0&&!b.has(altValue)||!innerDeepEqual(item,curB,!1,memo))return!1;return!a.has(altValue)&&innerDeepEqual(item,curB,!1,memo)}function setEquiv(a,b,strict,memo){var set=null,aValues=arrayFromSet(a);for(var i2=0;i2<aValues.length;i2++){var val=aValues[i2];if(_typeof(val)==="object"&&val!==null){if(set===null)set=new Set;set.add(val)}else if(!b.has(val)){if(strict)return!1;if(!setMightHaveLoosePrim(a,b,val))return!1;if(set===null)set=new Set;set.add(val)}}if(set!==null){var bValues=arrayFromSet(b);for(var _i=0;_i<bValues.length;_i++){var _val=bValues[_i];if(_typeof(_val)==="object"&&_val!==null){if(!setHasEqualElement(set,_val,strict,memo))return!1}else if(!strict&&!a.has(_val)&&!setHasEqualElement(set,_val,strict,memo))return!1}return set.size===0}return!0}function mapHasEqualEntry(set,map,key1,item1,strict,memo){var setValues=arrayFromSet(set);for(var i2=0;i2<setValues.length;i2++){var key2=setValues[i2];if(innerDeepEqual(key1,key2,strict,memo)&&innerDeepEqual(item1,map.get(key2),strict,memo))return set.delete(key2),!0}return!1}function mapEquiv(a,b,strict,memo){var set=null,aEntries=arrayFromMap(a);for(var i2=0;i2<aEntries.length;i2++){var _aEntries$i=_slicedToArray(aEntries[i2],2),key=_aEntries$i[0],item1=_aEntries$i[1];if(_typeof(key)==="object"&&key!==null){if(set===null)set=new Set;set.add(key)}else{var item2=b.get(key);if(item2===void 0&&!b.has(key)||!innerDeepEqual(item1,item2,strict,memo)){if(strict)return!1;if(!mapMightHaveLoosePrim(a,b,key,item1,memo))return!1;if(set===null)set=new Set;set.add(key)}}}if(set!==null){var bEntries=arrayFromMap(b);for(var _i2=0;_i2<bEntries.length;_i2++){var _bEntries$_i=_slicedToArray(bEntries[_i2],2),_key=_bEntries$_i[0],item=_bEntries$_i[1];if(_typeof(_key)==="object"&&_key!==null){if(!mapHasEqualEntry(set,a,_key,item,strict,memo))return!1}else if(!strict&&(!a.has(_key)||!innerDeepEqual(a.get(_key),item,!1,memo))&&!mapHasEqualEntry(set,a,_key,item,!1,memo))return!1}return set.size===0}return!0}function objEquiv(a,b,strict,keys,memos,iterationType){var i2=0;if(iterationType===kIsSet){if(!setEquiv(a,b,strict,memos))return!1}else if(iterationType===kIsMap){if(!mapEquiv(a,b,strict,memos))return!1}else if(iterationType===kIsArray)for(;i2<a.length;i2++)if(hasOwnProperty2(a,i2)){if(!hasOwnProperty2(b,i2)||!innerDeepEqual(a[i2],b[i2],strict,memos))return!1}else if(hasOwnProperty2(b,i2))return!1;else{var keysA=Object.keys(a);for(;i2<keysA.length;i2++){var key=keysA[i2];if(!hasOwnProperty2(b,key)||!innerDeepEqual(a[key],b[key],strict,memos))return!1}if(keysA.length!==Object.keys(b).length)return!1;return!0}for(i2=0;i2<keys.length;i2++){var _key2=keys[i2];if(!innerDeepEqual(a[_key2],b[_key2],strict,memos))return!1}return!0}function isDeepEqual(val1,val2){return innerDeepEqual(val1,val2,kLoose)}function isDeepStrictEqual(val1,val2){return innerDeepEqual(val1,val2,kStrict)}module.exports={isDeepEqual,isDeepStrictEqual}}),require_assert=__commonJS3((exports,module)=>{function _typeof(o){return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},_typeof(o)}function _defineProperties(target,props){for(var i2=0;i2<props.length;i2++){var descriptor=props[i2];if(descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor)descriptor.writable=!0;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key)}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw TypeError("Cannot call a class as a function")}var _require=require_errors(),_require$codes=_require.codes,ERR_AMBIGUOUS_ARGUMENT=_require$codes.ERR_AMBIGUOUS_ARGUMENT,ERR_INVALID_ARG_TYPE3=_require$codes.ERR_INVALID_ARG_TYPE,ERR_INVALID_ARG_VALUE=_require$codes.ERR_INVALID_ARG_VALUE,ERR_INVALID_RETURN_VALUE=_require$codes.ERR_INVALID_RETURN_VALUE,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,AssertionError=require_assertion_error(),_require2=require_util(),inspect2=_require2.inspect,_require$types=require_util().types,isPromise=_require$types.isPromise,isRegExp2=_require$types.isRegExp,objectAssign=require_polyfill()(),objectIs=require_polyfill2()(),RegExpPrototypeTest=require_callBound()("RegExp.prototype.test"),isDeepEqual,isDeepStrictEqual;function lazyLoadComparison(){var comparison=require_comparisons();isDeepEqual=comparison.isDeepEqual,isDeepStrictEqual=comparison.isDeepStrictEqual}var warned=!1,assert=module.exports=ok,NO_EXCEPTION_SENTINEL={};function innerFail(obj){if(obj.message instanceof Error)throw obj.message;throw new AssertionError(obj)}function fail(actual,expected,message,operator,stackStartFn){var argsLen=arguments.length,internalMessage;if(argsLen===0)internalMessage="Failed";else if(argsLen===1)message=actual,actual=void 0;else{if(warned===!1){warned=!0;var warn=process.emitWarning?process.emitWarning:console.warn.bind(console);warn("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")}if(argsLen===2)operator="!="}if(message instanceof Error)throw message;var errArgs={actual,expected,operator:operator===void 0?"fail":operator,stackStartFn:stackStartFn||fail};if(message!==void 0)errArgs.message=message;var err=new AssertionError(errArgs);if(internalMessage)err.message=internalMessage,err.generatedMessage=!0;throw err}assert.fail=fail,assert.AssertionError=AssertionError;function innerOk(fn,argLen,value,message){if(!value){var generatedMessage=!1;if(argLen===0)generatedMessage=!0,message="No value argument passed to `assert.ok()`";else if(message instanceof Error)throw message;var err=new AssertionError({actual:value,expected:!0,message,operator:"==",stackStartFn:fn});throw err.generatedMessage=generatedMessage,err}}function ok(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];innerOk.apply(void 0,[ok,args.length].concat(args))}assert.ok=ok,assert.equal=function equal(actual,expected,message){if(arguments.length<2)throw new ERR_MISSING_ARGS("actual","expected");if(actual!=expected)innerFail({actual,expected,message,operator:"==",stackStartFn:equal})},assert.notEqual=function notEqual(actual,expected,message){if(arguments.length<2)throw new ERR_MISSING_ARGS("actual","expected");if(actual==expected)innerFail({actual,expected,message,operator:"!=",stackStartFn:notEqual})},assert.deepEqual=function deepEqual(actual,expected,message){if(arguments.length<2)throw new ERR_MISSING_ARGS("actual","expected");if(isDeepEqual===void 0)lazyLoadComparison();if(!isDeepEqual(actual,expected))innerFail({actual,expected,message,operator:"deepEqual",stackStartFn:deepEqual})},assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(arguments.length<2)throw new ERR_MISSING_ARGS("actual","expected");if(isDeepEqual===void 0)lazyLoadComparison();if(isDeepEqual(actual,expected))innerFail({actual,expected,message,operator:"notDeepEqual",stackStartFn:notDeepEqual})},assert.deepStrictEqual=function deepStrictEqual(actual,expected,message){if(arguments.length<2)throw new ERR_MISSING_ARGS("actual","expected");if(isDeepEqual===void 0)lazyLoadComparison();if(!isDeepStrictEqual(actual,expected))innerFail({actual,expected,message,operator:"deepStrictEqual",stackStartFn:deepStrictEqual})},assert.notDeepStrictEqual=notDeepStrictEqual;function notDeepStrictEqual(actual,expected,message){if(arguments.length<2)throw new ERR_MISSING_ARGS("actual","expected");if(isDeepEqual===void 0)lazyLoadComparison();if(isDeepStrictEqual(actual,expected))innerFail({actual,expected,message,operator:"notDeepStrictEqual",stackStartFn:notDeepStrictEqual})}assert.strictEqual=function strictEqual(actual,expected,message){if(arguments.length<2)throw new ERR_MISSING_ARGS("actual","expected");if(!objectIs(actual,expected))innerFail({actual,expected,message,operator:"strictEqual",stackStartFn:strictEqual})},assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(arguments.length<2)throw new ERR_MISSING_ARGS("actual","expected");if(objectIs(actual,expected))innerFail({actual,expected,message,operator:"notStrictEqual",stackStartFn:notStrictEqual})};var Comparison=_createClass(function Comparison2(obj,keys,actual){var _this=this;_classCallCheck(this,Comparison2),keys.forEach(function(key){if(key in obj)if(actual!==void 0&&typeof actual[key]==="string"&&isRegExp2(obj[key])&&RegExpPrototypeTest(obj[key],actual[key]))_this[key]=actual[key];else _this[key]=obj[key]})});function compareExceptionKey(actual,expected,key,message,keys,fn){if(!(key in actual)||!isDeepStrictEqual(actual[key],expected[key])){if(!message){var a=new Comparison(actual,keys),b=new Comparison(expected,keys,actual),err=new AssertionError({actual:a,expected:b,operator:"deepStrictEqual",stackStartFn:fn});throw err.actual=actual,err.expected=expected,err.operator=fn.name,err}innerFail({actual,expected,message,operator:fn.name,stackStartFn:fn})}}function expectedException(actual,expected,msg,fn){if(typeof expected!=="function"){if(isRegExp2(expected))return RegExpPrototypeTest(expected,actual);if(arguments.length===2)throw new ERR_INVALID_ARG_TYPE3("expected",["Function","RegExp"],expected);if(_typeof(actual)!=="object"||actual===null){var err=new AssertionError({actual,expected,message:msg,operator:"deepStrictEqual",stackStartFn:fn});throw err.operator=fn.name,err}var keys=Object.keys(expected);if(expected instanceof Error)keys.push("name","message");else if(keys.length===0)throw new ERR_INVALID_ARG_VALUE("error",expected,"may not be an empty object");if(isDeepEqual===void 0)lazyLoadComparison();return keys.forEach(function(key){if(typeof actual[key]==="string"&&isRegExp2(expected[key])&&RegExpPrototypeTest(expected[key],actual[key]))return;compareExceptionKey(actual,expected,key,msg,keys,fn)}),!0}if(expected.prototype!==void 0&&actual instanceof expected)return!0;if(Error.isPrototypeOf(expected))return!1;return expected.call({},actual)===!0}function getActual(fn){if(typeof fn!=="function")throw new ERR_INVALID_ARG_TYPE3("fn","Function",fn);try{fn()}catch(e){return e}return NO_EXCEPTION_SENTINEL}function checkIsPromise(obj){return isPromise(obj)||obj!==null&&_typeof(obj)==="object"&&typeof obj.then==="function"&&typeof obj.catch==="function"}function waitForActual(promiseFn){return Promise.resolve().then(function(){var resultPromise;if(typeof promiseFn==="function"){if(resultPromise=promiseFn(),!checkIsPromise(resultPromise))throw new ERR_INVALID_RETURN_VALUE("instance of Promise","promiseFn",resultPromise)}else if(checkIsPromise(promiseFn))resultPromise=promiseFn;else throw new ERR_INVALID_ARG_TYPE3("promiseFn",["Function","Promise"],promiseFn);return Promise.resolve().then(function(){return resultPromise}).then(function(){return NO_EXCEPTION_SENTINEL}).catch(function(e){return e})})}function expectsError(stackStartFn,actual,error,message){if(typeof error==="string"){if(arguments.length===4)throw new ERR_INVALID_ARG_TYPE3("error",["Object","Error","Function","RegExp"],error);if(_typeof(actual)==="object"&&actual!==null){if(actual.message===error)throw new ERR_AMBIGUOUS_ARGUMENT("error/message",'The error message "'.concat(actual.message,'" is identical to the message.'))}else if(actual===error)throw new ERR_AMBIGUOUS_ARGUMENT("error/message",'The error "'.concat(actual,'" is identical to the message.'));message=error,error=void 0}else if(error!=null&&_typeof(error)!=="object"&&typeof error!=="function")throw new ERR_INVALID_ARG_TYPE3("error",["Object","Error","Function","RegExp"],error);if(actual===NO_EXCEPTION_SENTINEL){var details="";if(error&&error.name)details+=" (".concat(error.name,")");details+=message?": ".concat(message):".";var fnType=stackStartFn.name==="rejects"?"rejection":"exception";innerFail({actual:void 0,expected:error,operator:stackStartFn.name,message:"Missing expected ".concat(fnType).concat(details),stackStartFn})}if(error&&!expectedException(actual,error,message,stackStartFn))throw actual}function expectsNoError(stackStartFn,actual,error,message){if(actual===NO_EXCEPTION_SENTINEL)return;if(typeof error==="string")message=error,error=void 0;if(!error||expectedException(actual,error)){var details=message?": ".concat(message):".",fnType=stackStartFn.name==="doesNotReject"?"rejection":"exception";innerFail({actual,expected:error,operator:stackStartFn.name,message:"Got unwanted ".concat(fnType).concat(details,`
78
+ `)+'Actual message: "'.concat(actual&&actual.message,'"'),stackStartFn})}throw actual}assert.throws=function throws(promiseFn){for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];expectsError.apply(void 0,[throws,getActual(promiseFn)].concat(args))},assert.rejects=function rejects(promiseFn){for(var _len3=arguments.length,args=Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++)args[_key3-1]=arguments[_key3];return waitForActual(promiseFn).then(function(result){return expectsError.apply(void 0,[rejects,result].concat(args))})},assert.doesNotThrow=function doesNotThrow(fn){for(var _len4=arguments.length,args=Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++)args[_key4-1]=arguments[_key4];expectsNoError.apply(void 0,[doesNotThrow,getActual(fn)].concat(args))},assert.doesNotReject=function doesNotReject(fn){for(var _len5=arguments.length,args=Array(_len5>1?_len5-1:0),_key5=1;_key5<_len5;_key5++)args[_key5-1]=arguments[_key5];return waitForActual(fn).then(function(result){return expectsNoError.apply(void 0,[doesNotReject,result].concat(args))})},assert.ifError=function ifError(err){if(err!==null&&err!==void 0){var message="ifError got unwanted exception: ";if(_typeof(err)==="object"&&typeof err.message==="string")if(err.message.length===0&&err.constructor)message+=err.constructor.name;else message+=err.message;else message+=inspect2(err);var newErr=new AssertionError({actual:err,expected:null,operator:"ifError",message,stackStartFn:ifError}),origStack=err.stack;if(typeof origStack==="string"){var tmp2=origStack.split(`
79
+ `);tmp2.shift();var tmp1=newErr.stack.split(`
80
+ `);for(var i2=0;i2<tmp2.length;i2++){var pos=tmp1.indexOf(tmp2[i2]);if(pos!==-1){tmp1=tmp1.slice(0,pos);break}}newErr.stack="".concat(tmp1.join(`
81
+ `),`
82
+ `).concat(tmp2.join(`
83
+ `))}throw newErr}};function internalMatch(string,regexp,message,fn,fnName){if(!isRegExp2(regexp))throw new ERR_INVALID_ARG_TYPE3("regexp","RegExp",regexp);var match=fnName==="match";if(typeof string!=="string"||RegExpPrototypeTest(regexp,string)!==match){if(message instanceof Error)throw message;var generatedMessage=!message;message=message||(typeof string!=="string"?'The "string" argument must be of type string. Received type '+"".concat(_typeof(string)," (").concat(inspect2(string),")"):(match?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(inspect2(regexp),`. Input:
84
+
85
+ `).concat(inspect2(string),`
86
+ `));var err=new AssertionError({actual:string,expected:regexp,message,operator:fnName,stackStartFn:fn});throw err.generatedMessage=generatedMessage,err}}assert.match=function match(string,regexp,message){internalMatch(string,regexp,message,match,"match")},assert.doesNotMatch=function doesNotMatch(string,regexp,message){internalMatch(string,regexp,message,doesNotMatch,"doesNotMatch")};function strict(){for(var _len6=arguments.length,args=Array(_len6),_key6=0;_key6<_len6;_key6++)args[_key6]=arguments[_key6];innerOk.apply(void 0,[strict,args.length].concat(args))}assert.strict=objectAssign(strict,assert,{equal:assert.strictEqual,deepEqual:assert.deepStrictEqual,notEqual:assert.notStrictEqual,notDeepEqual:assert.notDeepStrictEqual}),assert.strict.strict=assert.strict}),assert=__toESM2(require_assert(),1),{AssertionError,CallTracker,deepEqual,deepStrictEqual,doesNotMatch,doesNotReject,doesNotThrow,equal,fail,ifError,match,notDeepEqual,notDeepStrictEqual,notEqual,notStrictEqual,ok,rejects,strict,strictEqual,throws}=assert,assert_default=assert});var IPv4Reg=new RegExp("^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$"),IPv6Reg=new RegExp("^(?:(?:(?:[0-9a-fA-F]{1,4}):){7}(?:(?:[0-9a-fA-F]{1,4})|:)|(?:(?:[0-9a-fA-F]{1,4}):){6}(?:(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|:(?:[0-9a-fA-F]{1,4})|:)|(?:(?:[0-9a-fA-F]{1,4}):){5}(?::(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|(?::(?:[0-9a-fA-F]{1,4})){1,2}|:)|(?:(?:[0-9a-fA-F]{1,4}):){4}(?:(?::(?:[0-9a-fA-F]{1,4})){0,1}:(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|(?::(?:[0-9a-fA-F]{1,4})){1,3}|:)|(?:(?:[0-9a-fA-F]{1,4}):){3}(?:(?::(?:[0-9a-fA-F]{1,4})){0,2}:(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|(?::(?:[0-9a-fA-F]{1,4})){1,4}|:)|(?:(?:[0-9a-fA-F]{1,4}):){2}(?:(?::(?:[0-9a-fA-F]{1,4})){0,3}:(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|(?::(?:[0-9a-fA-F]{1,4})){1,5}|:)|(?:(?:[0-9a-fA-F]{1,4}):){1}(?:(?::(?:[0-9a-fA-F]{1,4})){0,4}:(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|(?::(?:[0-9a-fA-F]{1,4})){1,6}|:)|(?::(?:(?::(?:[0-9a-fA-F]{1,4})){0,5}:(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|(?::(?:[0-9a-fA-F]{1,4})){1,7}|:)))(?:%[0-9a-zA-Z-.:]{1,})?$");function isIPv4(s){return IPv4Reg.test(s)}function isIPv6(s){return IPv6Reg.test(s)}function isIP(s){if(isIPv4(s))return 4;if(isIPv6(s))return 6;return 0}var net_default={isIPv4,isIPv6,isIP};var{default:tls}=(()=>({}));var{default:dns}=(()=>({}));var socksConnect=({proxy,destHost,destPort,useTLS=!1,resolveDnsLocally=!1,rejectUnauthorized=!0})=>new Promise((resolve,reject)=>{let connectWithHost=(hostToUse)=>{let methods=proxy.username&&proxy.password?[0,2]:[0],socket=net_default.connect(proxy.port,proxy.hostname,()=>{socket.write(Buffer.from([5,methods.length,...methods]))}),sendConnect=()=>{let req;if(resolveDnsLocally){let ipParts=hostToUse.split(".").map(Number);req=Buffer.concat([Buffer.from([5,1,0,1]),Buffer.from(ipParts),Buffer.from([destPort>>8&255,destPort&255])])}else{let hostBuf=Buffer.from(hostToUse);req=Buffer.concat([Buffer.from([5,1,0,3,hostBuf.length]),hostBuf,Buffer.from([destPort>>8&255,destPort&255])])}socket.write(req),socket.once("data",(connRes)=>{if(connRes[1]!==0)return reject(Error("SOCKS5 connect failed"));if(useTLS)resolve(tls.connect({socket,servername:destHost,rejectUnauthorized}));else resolve(socket)})};socket.once("data",(res)=>{if(res[0]!==5)return reject(Error("Not SOCKS5"));if(res[1]===0)sendConnect();else if(res[1]===2&&proxy.username&&proxy.password){let uBuf=Buffer.from(proxy.username),pBuf=Buffer.from(proxy.password);socket.write(Buffer.from([1,uBuf.length,...uBuf,pBuf.length,...pBuf])),socket.once("data",(authRes)=>{if(authRes[1]!==0)return reject(Error("SOCKS5 auth failed"));sendConnect()})}else return reject(Error("SOCKS5 handshake failed (unsupported method)"))}),socket.on("error",reject)};if(resolveDnsLocally)dns.lookup(destHost,{family:4},(err,address)=>{if(err)return reject(err);connectWithHost(address)});else connectWithHost(destHost)});init_crypto();var{default:tls2}=(()=>({}));var __create3=Object.create,{getPrototypeOf:__getProtoOf3,defineProperty:__defProp4,getOwnPropertyNames:__getOwnPropNames4}=Object,__hasOwnProp4=Object.prototype.hasOwnProperty,__reExport=(target,mod,secondTarget)=>{for(let key of __getOwnPropNames4(mod))if(!__hasOwnProp4.call(target,key)&&key!=="default")__defProp4(target,key,{get:()=>mod[key],enumerable:!0});if(secondTarget){for(let key of __getOwnPropNames4(mod))if(!__hasOwnProp4.call(secondTarget,key)&&key!=="default")__defProp4(secondTarget,key,{get:()=>mod[key],enumerable:!0});return secondTarget}},__toESM3=(mod,isNodeMode,target)=>{target=mod!=null?__create3(__getProtoOf3(mod)):{};let to=isNodeMode||!mod||!mod.__esModule?__defProp4(target,"default",{value:mod,enumerable:!0}):target;for(let key of __getOwnPropNames4(mod))if(!__hasOwnProp4.call(to,key))__defProp4(to,key,{get:()=>mod[key],enumerable:!0});return to},__commonJS4=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports),__export2=(target,all)=>{for(var name in all)__defProp4(target,name,{get:all[name],enumerable:!0,configurable:!0,set:(newValue)=>all[name]=()=>newValue})};var require_zstream=__commonJS4((exports,module)=>{function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}module.exports=ZStream}),require_common3=__commonJS4((exports)=>{var TYPED_OK=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function _has(obj,key){return Object.prototype.hasOwnProperty.call(obj,key)}exports.assign=function(obj){var sources=Array.prototype.slice.call(arguments,1);while(sources.length){var source=sources.shift();if(!source)continue;if(typeof source!=="object")throw TypeError(source+"must be non-object");for(var p in source)if(_has(source,p))obj[p]=source[p]}return obj},exports.shrinkBuf=function(buf,size){if(buf.length===size)return buf;if(buf.subarray)return buf.subarray(0,size);return buf.length=size,buf};var fnTyped={arraySet:function(dest,src,src_offs,len2,dest_offs){if(src.subarray&&dest.subarray){dest.set(src.subarray(src_offs,src_offs+len2),dest_offs);return}for(var i2=0;i2<len2;i2++)dest[dest_offs+i2]=src[src_offs+i2]},flattenChunks:function(chunks){var i2,l,len2,pos,chunk,result;len2=0;for(i2=0,l=chunks.length;i2<l;i2++)len2+=chunks[i2].length;result=new Uint8Array(len2),pos=0;for(i2=0,l=chunks.length;i2<l;i2++)chunk=chunks[i2],result.set(chunk,pos),pos+=chunk.length;return result}},fnUntyped={arraySet:function(dest,src,src_offs,len2,dest_offs){for(var i2=0;i2<len2;i2++)dest[dest_offs+i2]=src[src_offs+i2]},flattenChunks:function(chunks){return[].concat.apply([],chunks)}};exports.setTyped=function(on){if(on)exports.Buf8=Uint8Array,exports.Buf16=Uint16Array,exports.Buf32=Int32Array,exports.assign(exports,fnTyped);else exports.Buf8=Array,exports.Buf16=Array,exports.Buf32=Array,exports.assign(exports,fnUntyped)},exports.setTyped(TYPED_OK)}),require_trees=__commonJS4((exports)=>{var utils=require_common3(),Z_FIXED=4,Z_BINARY=0,Z_TEXT=1,Z_UNKNOWN=2;function zero(buf){var len2=buf.length;while(--len2>=0)buf[len2]=0}var STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH=3,MAX_MATCH=258,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],DIST_CODE_LEN=512,static_ltree=Array((L_CODES+2)*2);zero(static_ltree);var static_dtree=Array(D_CODES*2);zero(static_dtree);var _dist_code=Array(DIST_CODE_LEN);zero(_dist_code);var _length_code=Array(MAX_MATCH-MIN_MATCH+1);zero(_length_code);var base_length=Array(LENGTH_CODES);zero(base_length);var base_dist=Array(D_CODES);zero(base_dist);function StaticTreeDesc(static_tree,extra_bits,extra_base,elems,max_length){this.static_tree=static_tree,this.extra_bits=extra_bits,this.extra_base=extra_base,this.elems=elems,this.max_length=max_length,this.has_stree=static_tree&&static_tree.length}var static_l_desc,static_d_desc,static_bl_desc;function TreeDesc(dyn_tree,stat_desc){this.dyn_tree=dyn_tree,this.max_code=0,this.stat_desc=stat_desc}function d_code(dist){return dist<256?_dist_code[dist]:_dist_code[256+(dist>>>7)]}function put_short(s,w){s.pending_buf[s.pending++]=w&255,s.pending_buf[s.pending++]=w>>>8&255}function send_bits(s,value,length){if(s.bi_valid>Buf_size-length)s.bi_buf|=value<<s.bi_valid&65535,put_short(s,s.bi_buf),s.bi_buf=value>>Buf_size-s.bi_valid,s.bi_valid+=length-Buf_size;else s.bi_buf|=value<<s.bi_valid&65535,s.bi_valid+=length}function send_code(s,c,tree){send_bits(s,tree[c*2],tree[c*2+1])}function bi_reverse(code2,len2){var res=0;do res|=code2&1,code2>>>=1,res<<=1;while(--len2>0);return res>>>1}function bi_flush(s){if(s.bi_valid===16)put_short(s,s.bi_buf),s.bi_buf=0,s.bi_valid=0;else if(s.bi_valid>=8)s.pending_buf[s.pending++]=s.bi_buf&255,s.bi_buf>>=8,s.bi_valid-=8}function gen_bitlen(s,desc){var{dyn_tree:tree,max_code}=desc,stree=desc.stat_desc.static_tree,has_stree=desc.stat_desc.has_stree,extra=desc.stat_desc.extra_bits,base=desc.stat_desc.extra_base,max_length=desc.stat_desc.max_length,h,n,m,bits,xbits,f,overflow=0;for(bits=0;bits<=MAX_BITS;bits++)s.bl_count[bits]=0;tree[s.heap[s.heap_max]*2+1]=0;for(h=s.heap_max+1;h<HEAP_SIZE;h++){if(n=s.heap[h],bits=tree[tree[n*2+1]*2+1]+1,bits>max_length)bits=max_length,overflow++;if(tree[n*2+1]=bits,n>max_code)continue;if(s.bl_count[bits]++,xbits=0,n>=base)xbits=extra[n-base];if(f=tree[n*2],s.opt_len+=f*(bits+xbits),has_stree)s.static_len+=f*(stree[n*2+1]+xbits)}if(overflow===0)return;do{bits=max_length-1;while(s.bl_count[bits]===0)bits--;s.bl_count[bits]--,s.bl_count[bits+1]+=2,s.bl_count[max_length]--,overflow-=2}while(overflow>0);for(bits=max_length;bits!==0;bits--){n=s.bl_count[bits];while(n!==0){if(m=s.heap[--h],m>max_code)continue;if(tree[m*2+1]!==bits)s.opt_len+=(bits-tree[m*2+1])*tree[m*2],tree[m*2+1]=bits;n--}}}function gen_codes(tree,max_code,bl_count){var next_code=Array(MAX_BITS+1),code2=0,bits,n;for(bits=1;bits<=MAX_BITS;bits++)next_code[bits]=code2=code2+bl_count[bits-1]<<1;for(n=0;n<=max_code;n++){var len2=tree[n*2+1];if(len2===0)continue;tree[n*2]=bi_reverse(next_code[len2]++,len2)}}function tr_static_init(){var n,bits,length,code2,dist,bl_count=Array(MAX_BITS+1);length=0;for(code2=0;code2<LENGTH_CODES-1;code2++){base_length[code2]=length;for(n=0;n<1<<extra_lbits[code2];n++)_length_code[length++]=code2}_length_code[length-1]=code2,dist=0;for(code2=0;code2<16;code2++){base_dist[code2]=dist;for(n=0;n<1<<extra_dbits[code2];n++)_dist_code[dist++]=code2}dist>>=7;for(;code2<D_CODES;code2++){base_dist[code2]=dist<<7;for(n=0;n<1<<extra_dbits[code2]-7;n++)_dist_code[256+dist++]=code2}for(bits=0;bits<=MAX_BITS;bits++)bl_count[bits]=0;n=0;while(n<=143)static_ltree[n*2+1]=8,n++,bl_count[8]++;while(n<=255)static_ltree[n*2+1]=9,n++,bl_count[9]++;while(n<=279)static_ltree[n*2+1]=7,n++,bl_count[7]++;while(n<=287)static_ltree[n*2+1]=8,n++,bl_count[8]++;gen_codes(static_ltree,L_CODES+1,bl_count);for(n=0;n<D_CODES;n++)static_dtree[n*2+1]=5,static_dtree[n*2]=bi_reverse(n,5);static_l_desc=new StaticTreeDesc(static_ltree,extra_lbits,LITERALS+1,L_CODES,MAX_BITS),static_d_desc=new StaticTreeDesc(static_dtree,extra_dbits,0,D_CODES,MAX_BITS),static_bl_desc=new StaticTreeDesc([],extra_blbits,0,BL_CODES,MAX_BL_BITS)}function init_block(s){var n;for(n=0;n<L_CODES;n++)s.dyn_ltree[n*2]=0;for(n=0;n<D_CODES;n++)s.dyn_dtree[n*2]=0;for(n=0;n<BL_CODES;n++)s.bl_tree[n*2]=0;s.dyn_ltree[END_BLOCK*2]=1,s.opt_len=s.static_len=0,s.last_lit=s.matches=0}function bi_windup(s){if(s.bi_valid>8)put_short(s,s.bi_buf);else if(s.bi_valid>0)s.pending_buf[s.pending++]=s.bi_buf;s.bi_buf=0,s.bi_valid=0}function copy_block(s,buf,len2,header){if(bi_windup(s),header)put_short(s,len2),put_short(s,~len2);utils.arraySet(s.pending_buf,s.window,buf,len2,s.pending),s.pending+=len2}function smaller(tree,n,m,depth){var _n2=n*2,_m2=m*2;return tree[_n2]<tree[_m2]||tree[_n2]===tree[_m2]&&depth[n]<=depth[m]}function pqdownheap(s,tree,k){var v=s.heap[k],j=k<<1;while(j<=s.heap_len){if(j<s.heap_len&&smaller(tree,s.heap[j+1],s.heap[j],s.depth))j++;if(smaller(tree,v,s.heap[j],s.depth))break;s.heap[k]=s.heap[j],k=j,j<<=1}s.heap[k]=v}function compress_block(s,ltree,dtree){var dist,lc,lx=0,code2,extra;if(s.last_lit!==0)do if(dist=s.pending_buf[s.d_buf+lx*2]<<8|s.pending_buf[s.d_buf+lx*2+1],lc=s.pending_buf[s.l_buf+lx],lx++,dist===0)send_code(s,lc,ltree);else{if(code2=_length_code[lc],send_code(s,code2+LITERALS+1,ltree),extra=extra_lbits[code2],extra!==0)lc-=base_length[code2],send_bits(s,lc,extra);if(dist--,code2=d_code(dist),send_code(s,code2,dtree),extra=extra_dbits[code2],extra!==0)dist-=base_dist[code2],send_bits(s,dist,extra)}while(lx<s.last_lit);send_code(s,END_BLOCK,ltree)}function build_tree(s,desc){var tree=desc.dyn_tree,stree=desc.stat_desc.static_tree,has_stree=desc.stat_desc.has_stree,elems=desc.stat_desc.elems,n,m,max_code=-1,node;s.heap_len=0,s.heap_max=HEAP_SIZE;for(n=0;n<elems;n++)if(tree[n*2]!==0)s.heap[++s.heap_len]=max_code=n,s.depth[n]=0;else tree[n*2+1]=0;while(s.heap_len<2)if(node=s.heap[++s.heap_len]=max_code<2?++max_code:0,tree[node*2]=1,s.depth[node]=0,s.opt_len--,has_stree)s.static_len-=stree[node*2+1];desc.max_code=max_code;for(n=s.heap_len>>1;n>=1;n--)pqdownheap(s,tree,n);node=elems;do n=s.heap[1],s.heap[1]=s.heap[s.heap_len--],pqdownheap(s,tree,1),m=s.heap[1],s.heap[--s.heap_max]=n,s.heap[--s.heap_max]=m,tree[node*2]=tree[n*2]+tree[m*2],s.depth[node]=(s.depth[n]>=s.depth[m]?s.depth[n]:s.depth[m])+1,tree[n*2+1]=tree[m*2+1]=node,s.heap[1]=node++,pqdownheap(s,tree,1);while(s.heap_len>=2);s.heap[--s.heap_max]=s.heap[1],gen_bitlen(s,desc),gen_codes(tree,max_code,s.bl_count)}function scan_tree(s,tree,max_code){var n,prevlen=-1,curlen,nextlen=tree[1],count=0,max_count=7,min_count=4;if(nextlen===0)max_count=138,min_count=3;tree[(max_code+1)*2+1]=65535;for(n=0;n<=max_code;n++){if(curlen=nextlen,nextlen=tree[(n+1)*2+1],++count<max_count&&curlen===nextlen)continue;else if(count<min_count)s.bl_tree[curlen*2]+=count;else if(curlen!==0){if(curlen!==prevlen)s.bl_tree[curlen*2]++;s.bl_tree[REP_3_6*2]++}else if(count<=10)s.bl_tree[REPZ_3_10*2]++;else s.bl_tree[REPZ_11_138*2]++;if(count=0,prevlen=curlen,nextlen===0)max_count=138,min_count=3;else if(curlen===nextlen)max_count=6,min_count=3;else max_count=7,min_count=4}}function send_tree(s,tree,max_code){var n,prevlen=-1,curlen,nextlen=tree[1],count=0,max_count=7,min_count=4;if(nextlen===0)max_count=138,min_count=3;for(n=0;n<=max_code;n++){if(curlen=nextlen,nextlen=tree[(n+1)*2+1],++count<max_count&&curlen===nextlen)continue;else if(count<min_count)do send_code(s,curlen,s.bl_tree);while(--count!==0);else if(curlen!==0){if(curlen!==prevlen)send_code(s,curlen,s.bl_tree),count--;send_code(s,REP_3_6,s.bl_tree),send_bits(s,count-3,2)}else if(count<=10)send_code(s,REPZ_3_10,s.bl_tree),send_bits(s,count-3,3);else send_code(s,REPZ_11_138,s.bl_tree),send_bits(s,count-11,7);if(count=0,prevlen=curlen,nextlen===0)max_count=138,min_count=3;else if(curlen===nextlen)max_count=6,min_count=3;else max_count=7,min_count=4}}function build_bl_tree(s){var max_blindex;scan_tree(s,s.dyn_ltree,s.l_desc.max_code),scan_tree(s,s.dyn_dtree,s.d_desc.max_code),build_tree(s,s.bl_desc);for(max_blindex=BL_CODES-1;max_blindex>=3;max_blindex--)if(s.bl_tree[bl_order[max_blindex]*2+1]!==0)break;return s.opt_len+=3*(max_blindex+1)+5+5+4,max_blindex}function send_all_trees(s,lcodes,dcodes,blcodes){var rank;send_bits(s,lcodes-257,5),send_bits(s,dcodes-1,5),send_bits(s,blcodes-4,4);for(rank=0;rank<blcodes;rank++)send_bits(s,s.bl_tree[bl_order[rank]*2+1],3);send_tree(s,s.dyn_ltree,lcodes-1),send_tree(s,s.dyn_dtree,dcodes-1)}function detect_data_type(s){var black_mask=4093624447,n;for(n=0;n<=31;n++,black_mask>>>=1)if(black_mask&1&&s.dyn_ltree[n*2]!==0)return Z_BINARY;if(s.dyn_ltree[18]!==0||s.dyn_ltree[20]!==0||s.dyn_ltree[26]!==0)return Z_TEXT;for(n=32;n<LITERALS;n++)if(s.dyn_ltree[n*2]!==0)return Z_TEXT;return Z_BINARY}var static_init_done=!1;function _tr_init(s){if(!static_init_done)tr_static_init(),static_init_done=!0;s.l_desc=new TreeDesc(s.dyn_ltree,static_l_desc),s.d_desc=new TreeDesc(s.dyn_dtree,static_d_desc),s.bl_desc=new TreeDesc(s.bl_tree,static_bl_desc),s.bi_buf=0,s.bi_valid=0,init_block(s)}function _tr_stored_block(s,buf,stored_len,last){send_bits(s,(STORED_BLOCK<<1)+(last?1:0),3),copy_block(s,buf,stored_len,!0)}function _tr_align(s){send_bits(s,STATIC_TREES<<1,3),send_code(s,END_BLOCK,static_ltree),bi_flush(s)}function _tr_flush_block(s,buf,stored_len,last){var opt_lenb,static_lenb,max_blindex=0;if(s.level>0){if(s.strm.data_type===Z_UNKNOWN)s.strm.data_type=detect_data_type(s);if(build_tree(s,s.l_desc),build_tree(s,s.d_desc),max_blindex=build_bl_tree(s),opt_lenb=s.opt_len+3+7>>>3,static_lenb=s.static_len+3+7>>>3,static_lenb<=opt_lenb)opt_lenb=static_lenb}else opt_lenb=static_lenb=stored_len+5;if(stored_len+4<=opt_lenb&&buf!==-1)_tr_stored_block(s,buf,stored_len,last);else if(s.strategy===Z_FIXED||static_lenb===opt_lenb)send_bits(s,(STATIC_TREES<<1)+(last?1:0),3),compress_block(s,static_ltree,static_dtree);else send_bits(s,(DYN_TREES<<1)+(last?1:0),3),send_all_trees(s,s.l_desc.max_code+1,s.d_desc.max_code+1,max_blindex+1),compress_block(s,s.dyn_ltree,s.dyn_dtree);if(init_block(s),last)bi_windup(s)}function _tr_tally(s,dist,lc){if(s.pending_buf[s.d_buf+s.last_lit*2]=dist>>>8&255,s.pending_buf[s.d_buf+s.last_lit*2+1]=dist&255,s.pending_buf[s.l_buf+s.last_lit]=lc&255,s.last_lit++,dist===0)s.dyn_ltree[lc*2]++;else s.matches++,dist--,s.dyn_ltree[(_length_code[lc]+LITERALS+1)*2]++,s.dyn_dtree[d_code(dist)*2]++;return s.last_lit===s.lit_bufsize-1}exports._tr_init=_tr_init,exports._tr_stored_block=_tr_stored_block,exports._tr_flush_block=_tr_flush_block,exports._tr_tally=_tr_tally,exports._tr_align=_tr_align}),require_adler32=__commonJS4((exports,module)=>{function adler32(adler,buf,len2,pos){var s1=adler&65535|0,s2=adler>>>16&65535|0,n=0;while(len2!==0){n=len2>2000?2000:len2,len2-=n;do s1=s1+buf[pos++]|0,s2=s2+s1|0;while(--n);s1%=65521,s2%=65521}return s1|s2<<16|0}module.exports=adler32}),require_crc32=__commonJS4((exports,module)=>{function makeTable(){var c,table=[];for(var n=0;n<256;n++){c=n;for(var k=0;k<8;k++)c=c&1?3988292384^c>>>1:c>>>1;table[n]=c}return table}var crcTable=makeTable();function crc32(crc,buf,len2,pos){var t=crcTable,end=pos+len2;crc^=-1;for(var i2=pos;i2<end;i2++)crc=crc>>>8^t[(crc^buf[i2])&255];return crc^-1}module.exports=crc32}),require_messages=__commonJS4((exports,module)=>{module.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}}),require_deflate=__commonJS4((exports)=>{var utils=require_common3(),trees=require_trees(),adler32=require_adler32(),crc32=require_crc32(),msg=require_messages(),Z_NO_FLUSH=0,Z_PARTIAL_FLUSH=1,Z_FULL_FLUSH=3,Z_FINISH=4,Z_BLOCK=5,Z_OK=0,Z_STREAM_END=1,Z_STREAM_ERROR=-2,Z_DATA_ERROR=-3,Z_BUF_ERROR=-5,Z_DEFAULT_COMPRESSION=-1,Z_FILTERED=1,Z_HUFFMAN_ONLY=2,Z_RLE=3,Z_FIXED=4,Z_DEFAULT_STRATEGY=0,Z_UNKNOWN=2,Z_DEFLATED=8,MAX_MEM_LEVEL=9,MAX_WBITS=15,DEF_MEM_LEVEL=8,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1,PRESET_DICT=32,INIT_STATE=42,EXTRA_STATE=69,NAME_STATE=73,COMMENT_STATE=91,HCRC_STATE=103,BUSY_STATE=113,FINISH_STATE=666,BS_NEED_MORE=1,BS_BLOCK_DONE=2,BS_FINISH_STARTED=3,BS_FINISH_DONE=4,OS_CODE=3;function err(strm,errorCode){return strm.msg=msg[errorCode],errorCode}function rank(f){return(f<<1)-(f>4?9:0)}function zero(buf){var len2=buf.length;while(--len2>=0)buf[len2]=0}function flush_pending(strm){var s=strm.state,len2=s.pending;if(len2>strm.avail_out)len2=strm.avail_out;if(len2===0)return;if(utils.arraySet(strm.output,s.pending_buf,s.pending_out,len2,strm.next_out),strm.next_out+=len2,s.pending_out+=len2,strm.total_out+=len2,strm.avail_out-=len2,s.pending-=len2,s.pending===0)s.pending_out=0}function flush_block_only(s,last){trees._tr_flush_block(s,s.block_start>=0?s.block_start:-1,s.strstart-s.block_start,last),s.block_start=s.strstart,flush_pending(s.strm)}function put_byte(s,b){s.pending_buf[s.pending++]=b}function putShortMSB(s,b){s.pending_buf[s.pending++]=b>>>8&255,s.pending_buf[s.pending++]=b&255}function read_buf(strm,buf,start,size){var len2=strm.avail_in;if(len2>size)len2=size;if(len2===0)return 0;if(strm.avail_in-=len2,utils.arraySet(buf,strm.input,strm.next_in,len2,start),strm.state.wrap===1)strm.adler=adler32(strm.adler,buf,len2,start);else if(strm.state.wrap===2)strm.adler=crc32(strm.adler,buf,len2,start);return strm.next_in+=len2,strm.total_in+=len2,len2}function longest_match(s,cur_match){var{max_chain_length:chain_length,strstart:scan}=s,match2,len2,best_len=s.prev_length,nice_match=s.nice_match,limit=s.strstart>s.w_size-MIN_LOOKAHEAD?s.strstart-(s.w_size-MIN_LOOKAHEAD):0,_win=s.window,wmask=s.w_mask,prev=s.prev,strend=s.strstart+MAX_MATCH,scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len];if(s.prev_length>=s.good_match)chain_length>>=2;if(nice_match>s.lookahead)nice_match=s.lookahead;do{if(match2=cur_match,_win[match2+best_len]!==scan_end||_win[match2+best_len-1]!==scan_end1||_win[match2]!==_win[scan]||_win[++match2]!==_win[scan+1])continue;scan+=2,match2++;do;while(_win[++scan]===_win[++match2]&&_win[++scan]===_win[++match2]&&_win[++scan]===_win[++match2]&&_win[++scan]===_win[++match2]&&_win[++scan]===_win[++match2]&&_win[++scan]===_win[++match2]&&_win[++scan]===_win[++match2]&&_win[++scan]===_win[++match2]&&scan<strend);if(len2=MAX_MATCH-(strend-scan),scan=strend-MAX_MATCH,len2>best_len){if(s.match_start=cur_match,best_len=len2,len2>=nice_match)break;scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len]}}while((cur_match=prev[cur_match&wmask])>limit&&--chain_length!==0);if(best_len<=s.lookahead)return best_len;return s.lookahead}function fill_window(s){var _w_size=s.w_size,p,n,m,more,str;do{if(more=s.window_size-s.lookahead-s.strstart,s.strstart>=_w_size+(_w_size-MIN_LOOKAHEAD)){utils.arraySet(s.window,s.window,_w_size,_w_size,0),s.match_start-=_w_size,s.strstart-=_w_size,s.block_start-=_w_size,n=s.hash_size,p=n;do m=s.head[--p],s.head[p]=m>=_w_size?m-_w_size:0;while(--n);n=_w_size,p=n;do m=s.prev[--p],s.prev[p]=m>=_w_size?m-_w_size:0;while(--n);more+=_w_size}if(s.strm.avail_in===0)break;if(n=read_buf(s.strm,s.window,s.strstart+s.lookahead,more),s.lookahead+=n,s.lookahead+s.insert>=MIN_MATCH){str=s.strstart-s.insert,s.ins_h=s.window[str],s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+1])&s.hash_mask;while(s.insert)if(s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+MIN_MATCH-1])&s.hash_mask,s.prev[str&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=str,str++,s.insert--,s.lookahead+s.insert<MIN_MATCH)break}}while(s.lookahead<MIN_LOOKAHEAD&&s.strm.avail_in!==0)}function deflate_stored(s,flush){var max_block_size=65535;if(max_block_size>s.pending_buf_size-5)max_block_size=s.pending_buf_size-5;for(;;){if(s.lookahead<=1){if(fill_window(s),s.lookahead===0&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(s.lookahead===0)break}s.strstart+=s.lookahead,s.lookahead=0;var max_start=s.block_start+max_block_size;if(s.strstart===0||s.strstart>=max_start){if(s.lookahead=s.strstart-max_start,s.strstart=max_start,flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}if(s.strstart-s.block_start>=s.w_size-MIN_LOOKAHEAD){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}}if(s.insert=0,flush===Z_FINISH){if(flush_block_only(s,!0),s.strm.avail_out===0)return BS_FINISH_STARTED;return BS_FINISH_DONE}if(s.strstart>s.block_start){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}return BS_NEED_MORE}function deflate_fast(s,flush){var hash_head,bflush;for(;;){if(s.lookahead<MIN_LOOKAHEAD){if(fill_window(s),s.lookahead<MIN_LOOKAHEAD&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(s.lookahead===0)break}if(hash_head=0,s.lookahead>=MIN_MATCH)s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask,hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=s.strstart;if(hash_head!==0&&s.strstart-hash_head<=s.w_size-MIN_LOOKAHEAD)s.match_length=longest_match(s,hash_head);if(s.match_length>=MIN_MATCH)if(bflush=trees._tr_tally(s,s.strstart-s.match_start,s.match_length-MIN_MATCH),s.lookahead-=s.match_length,s.match_length<=s.max_lazy_match&&s.lookahead>=MIN_MATCH){s.match_length--;do s.strstart++,s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask,hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=s.strstart;while(--s.match_length!==0);s.strstart++}else s.strstart+=s.match_length,s.match_length=0,s.ins_h=s.window[s.strstart],s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+1])&s.hash_mask;else bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++;if(bflush){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}}if(s.insert=s.strstart<MIN_MATCH-1?s.strstart:MIN_MATCH-1,flush===Z_FINISH){if(flush_block_only(s,!0),s.strm.avail_out===0)return BS_FINISH_STARTED;return BS_FINISH_DONE}if(s.last_lit){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}return BS_BLOCK_DONE}function deflate_slow(s,flush){var hash_head,bflush,max_insert;for(;;){if(s.lookahead<MIN_LOOKAHEAD){if(fill_window(s),s.lookahead<MIN_LOOKAHEAD&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(s.lookahead===0)break}if(hash_head=0,s.lookahead>=MIN_MATCH)s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask,hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=s.strstart;if(s.prev_length=s.match_length,s.prev_match=s.match_start,s.match_length=MIN_MATCH-1,hash_head!==0&&s.prev_length<s.max_lazy_match&&s.strstart-hash_head<=s.w_size-MIN_LOOKAHEAD){if(s.match_length=longest_match(s,hash_head),s.match_length<=5&&(s.strategy===Z_FILTERED||s.match_length===MIN_MATCH&&s.strstart-s.match_start>4096))s.match_length=MIN_MATCH-1}if(s.prev_length>=MIN_MATCH&&s.match_length<=s.prev_length){max_insert=s.strstart+s.lookahead-MIN_MATCH,bflush=trees._tr_tally(s,s.strstart-1-s.prev_match,s.prev_length-MIN_MATCH),s.lookahead-=s.prev_length-1,s.prev_length-=2;do if(++s.strstart<=max_insert)s.ins_h=(s.ins_h<<s.hash_shift^s.window[s.strstart+MIN_MATCH-1])&s.hash_mask,hash_head=s.prev[s.strstart&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=s.strstart;while(--s.prev_length!==0);if(s.match_available=0,s.match_length=MIN_MATCH-1,s.strstart++,bflush){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}}else if(s.match_available){if(bflush=trees._tr_tally(s,0,s.window[s.strstart-1]),bflush)flush_block_only(s,!1);if(s.strstart++,s.lookahead--,s.strm.avail_out===0)return BS_NEED_MORE}else s.match_available=1,s.strstart++,s.lookahead--}if(s.match_available)bflush=trees._tr_tally(s,0,s.window[s.strstart-1]),s.match_available=0;if(s.insert=s.strstart<MIN_MATCH-1?s.strstart:MIN_MATCH-1,flush===Z_FINISH){if(flush_block_only(s,!0),s.strm.avail_out===0)return BS_FINISH_STARTED;return BS_FINISH_DONE}if(s.last_lit){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}return BS_BLOCK_DONE}function deflate_rle(s,flush){var bflush,prev,scan,strend,_win=s.window;for(;;){if(s.lookahead<=MAX_MATCH){if(fill_window(s),s.lookahead<=MAX_MATCH&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(s.lookahead===0)break}if(s.match_length=0,s.lookahead>=MIN_MATCH&&s.strstart>0){if(scan=s.strstart-1,prev=_win[scan],prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]){strend=s.strstart+MAX_MATCH;do;while(prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&scan<strend);if(s.match_length=MAX_MATCH-(strend-scan),s.match_length>s.lookahead)s.match_length=s.lookahead}}if(s.match_length>=MIN_MATCH)bflush=trees._tr_tally(s,1,s.match_length-MIN_MATCH),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0;else bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++;if(bflush){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}}if(s.insert=0,flush===Z_FINISH){if(flush_block_only(s,!0),s.strm.avail_out===0)return BS_FINISH_STARTED;return BS_FINISH_DONE}if(s.last_lit){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}return BS_BLOCK_DONE}function deflate_huff(s,flush){var bflush;for(;;){if(s.lookahead===0){if(fill_window(s),s.lookahead===0){if(flush===Z_NO_FLUSH)return BS_NEED_MORE;break}}if(s.match_length=0,bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,bflush){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}}if(s.insert=0,flush===Z_FINISH){if(flush_block_only(s,!0),s.strm.avail_out===0)return BS_FINISH_STARTED;return BS_FINISH_DONE}if(s.last_lit){if(flush_block_only(s,!1),s.strm.avail_out===0)return BS_NEED_MORE}return BS_BLOCK_DONE}function Config(good_length,max_lazy,nice_length,max_chain,func){this.good_length=good_length,this.max_lazy=max_lazy,this.nice_length=nice_length,this.max_chain=max_chain,this.func=func}var configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)];function lm_init(s){s.window_size=2*s.w_size,zero(s.head),s.max_lazy_match=configuration_table[s.level].max_lazy,s.good_match=configuration_table[s.level].good_length,s.nice_match=configuration_table[s.level].nice_length,s.max_chain_length=configuration_table[s.level].max_chain,s.strstart=0,s.block_start=0,s.lookahead=0,s.insert=0,s.match_length=s.prev_length=MIN_MATCH-1,s.match_available=0,s.ins_h=0}function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Z_DEFLATED,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new utils.Buf16(HEAP_SIZE*2),this.dyn_dtree=new utils.Buf16((2*D_CODES+1)*2),this.bl_tree=new utils.Buf16((2*BL_CODES+1)*2),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new utils.Buf16(MAX_BITS+1),this.heap=new utils.Buf16(2*L_CODES+1),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new utils.Buf16(2*L_CODES+1),zero(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function deflateResetKeep(strm){var s;if(!strm||!strm.state)return err(strm,Z_STREAM_ERROR);if(strm.total_in=strm.total_out=0,strm.data_type=Z_UNKNOWN,s=strm.state,s.pending=0,s.pending_out=0,s.wrap<0)s.wrap=-s.wrap;return s.status=s.wrap?INIT_STATE:BUSY_STATE,strm.adler=s.wrap===2?0:1,s.last_flush=Z_NO_FLUSH,trees._tr_init(s),Z_OK}function deflateReset(strm){var ret=deflateResetKeep(strm);if(ret===Z_OK)lm_init(strm.state);return ret}function deflateSetHeader(strm,head){if(!strm||!strm.state)return Z_STREAM_ERROR;if(strm.state.wrap!==2)return Z_STREAM_ERROR;return strm.state.gzhead=head,Z_OK}function deflateInit2(strm,level,method,windowBits,memLevel,strategy){if(!strm)return Z_STREAM_ERROR;var wrap=1;if(level===Z_DEFAULT_COMPRESSION)level=6;if(windowBits<0)wrap=0,windowBits=-windowBits;else if(windowBits>15)wrap=2,windowBits-=16;if(memLevel<1||memLevel>MAX_MEM_LEVEL||method!==Z_DEFLATED||windowBits<8||windowBits>15||level<0||level>9||strategy<0||strategy>Z_FIXED)return err(strm,Z_STREAM_ERROR);if(windowBits===8)windowBits=9;var s=new DeflateState;return strm.state=s,s.strm=strm,s.wrap=wrap,s.gzhead=null,s.w_bits=windowBits,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=memLevel+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+MIN_MATCH-1)/MIN_MATCH),s.window=new utils.Buf8(s.w_size*2),s.head=new utils.Buf16(s.hash_size),s.prev=new utils.Buf16(s.w_size),s.lit_bufsize=1<<memLevel+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new utils.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=level,s.strategy=strategy,s.method=method,deflateReset(strm)}function deflateInit(strm,level){return deflateInit2(strm,level,Z_DEFLATED,MAX_WBITS,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY)}function deflate(strm,flush){var old_flush,s,beg,val;if(!strm||!strm.state||flush>Z_BLOCK||flush<0)return strm?err(strm,Z_STREAM_ERROR):Z_STREAM_ERROR;if(s=strm.state,!strm.output||!strm.input&&strm.avail_in!==0||s.status===FINISH_STATE&&flush!==Z_FINISH)return err(strm,strm.avail_out===0?Z_BUF_ERROR:Z_STREAM_ERROR);if(s.strm=strm,old_flush=s.last_flush,s.last_flush=flush,s.status===INIT_STATE)if(s.wrap===2)if(strm.adler=0,put_byte(s,31),put_byte(s,139),put_byte(s,8),!s.gzhead)put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,s.level===9?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0),put_byte(s,OS_CODE),s.status=BUSY_STATE;else{if(put_byte(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(!s.gzhead.extra?0:4)+(!s.gzhead.name?0:8)+(!s.gzhead.comment?0:16)),put_byte(s,s.gzhead.time&255),put_byte(s,s.gzhead.time>>8&255),put_byte(s,s.gzhead.time>>16&255),put_byte(s,s.gzhead.time>>24&255),put_byte(s,s.level===9?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0),put_byte(s,s.gzhead.os&255),s.gzhead.extra&&s.gzhead.extra.length)put_byte(s,s.gzhead.extra.length&255),put_byte(s,s.gzhead.extra.length>>8&255);if(s.gzhead.hcrc)strm.adler=crc32(strm.adler,s.pending_buf,s.pending,0);s.gzindex=0,s.status=EXTRA_STATE}else{var header=Z_DEFLATED+(s.w_bits-8<<4)<<8,level_flags=-1;if(s.strategy>=Z_HUFFMAN_ONLY||s.level<2)level_flags=0;else if(s.level<6)level_flags=1;else if(s.level===6)level_flags=2;else level_flags=3;if(header|=level_flags<<6,s.strstart!==0)header|=PRESET_DICT;if(header+=31-header%31,s.status=BUSY_STATE,putShortMSB(s,header),s.strstart!==0)putShortMSB(s,strm.adler>>>16),putShortMSB(s,strm.adler&65535);strm.adler=1}if(s.status===EXTRA_STATE)if(s.gzhead.extra){beg=s.pending;while(s.gzindex<(s.gzhead.extra.length&65535)){if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg)strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg);if(flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size)break}put_byte(s,s.gzhead.extra[s.gzindex]&255),s.gzindex++}if(s.gzhead.hcrc&&s.pending>beg)strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg);if(s.gzindex===s.gzhead.extra.length)s.gzindex=0,s.status=NAME_STATE}else s.status=NAME_STATE;if(s.status===NAME_STATE)if(s.gzhead.name){beg=s.pending;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg)strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg);if(flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size){val=1;break}}if(s.gzindex<s.gzhead.name.length)val=s.gzhead.name.charCodeAt(s.gzindex++)&255;else val=0;put_byte(s,val)}while(val!==0);if(s.gzhead.hcrc&&s.pending>beg)strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg);if(val===0)s.gzindex=0,s.status=COMMENT_STATE}else s.status=COMMENT_STATE;if(s.status===COMMENT_STATE)if(s.gzhead.comment){beg=s.pending;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>beg)strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg);if(flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size){val=1;break}}if(s.gzindex<s.gzhead.comment.length)val=s.gzhead.comment.charCodeAt(s.gzindex++)&255;else val=0;put_byte(s,val)}while(val!==0);if(s.gzhead.hcrc&&s.pending>beg)strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg);if(val===0)s.status=HCRC_STATE}else s.status=HCRC_STATE;if(s.status===HCRC_STATE)if(s.gzhead.hcrc){if(s.pending+2>s.pending_buf_size)flush_pending(strm);if(s.pending+2<=s.pending_buf_size)put_byte(s,strm.adler&255),put_byte(s,strm.adler>>8&255),strm.adler=0,s.status=BUSY_STATE}else s.status=BUSY_STATE;if(s.pending!==0){if(flush_pending(strm),strm.avail_out===0)return s.last_flush=-1,Z_OK}else if(strm.avail_in===0&&rank(flush)<=rank(old_flush)&&flush!==Z_FINISH)return err(strm,Z_BUF_ERROR);if(s.status===FINISH_STATE&&strm.avail_in!==0)return err(strm,Z_BUF_ERROR);if(strm.avail_in!==0||s.lookahead!==0||flush!==Z_NO_FLUSH&&s.status!==FINISH_STATE){var bstate=s.strategy===Z_HUFFMAN_ONLY?deflate_huff(s,flush):s.strategy===Z_RLE?deflate_rle(s,flush):configuration_table[s.level].func(s,flush);if(bstate===BS_FINISH_STARTED||bstate===BS_FINISH_DONE)s.status=FINISH_STATE;if(bstate===BS_NEED_MORE||bstate===BS_FINISH_STARTED){if(strm.avail_out===0)s.last_flush=-1;return Z_OK}if(bstate===BS_BLOCK_DONE){if(flush===Z_PARTIAL_FLUSH)trees._tr_align(s);else if(flush!==Z_BLOCK){if(trees._tr_stored_block(s,0,0,!1),flush===Z_FULL_FLUSH){if(zero(s.head),s.lookahead===0)s.strstart=0,s.block_start=0,s.insert=0}}if(flush_pending(strm),strm.avail_out===0)return s.last_flush=-1,Z_OK}}if(flush!==Z_FINISH)return Z_OK;if(s.wrap<=0)return Z_STREAM_END;if(s.wrap===2)put_byte(s,strm.adler&255),put_byte(s,strm.adler>>8&255),put_byte(s,strm.adler>>16&255),put_byte(s,strm.adler>>24&255),put_byte(s,strm.total_in&255),put_byte(s,strm.total_in>>8&255),put_byte(s,strm.total_in>>16&255),put_byte(s,strm.total_in>>24&255);else putShortMSB(s,strm.adler>>>16),putShortMSB(s,strm.adler&65535);if(flush_pending(strm),s.wrap>0)s.wrap=-s.wrap;return s.pending!==0?Z_OK:Z_STREAM_END}function deflateEnd(strm){var status;if(!strm||!strm.state)return Z_STREAM_ERROR;if(status=strm.state.status,status!==INIT_STATE&&status!==EXTRA_STATE&&status!==NAME_STATE&&status!==COMMENT_STATE&&status!==HCRC_STATE&&status!==BUSY_STATE&&status!==FINISH_STATE)return err(strm,Z_STREAM_ERROR);return strm.state=null,status===BUSY_STATE?err(strm,Z_DATA_ERROR):Z_OK}function deflateSetDictionary(strm,dictionary){var dictLength=dictionary.length,s,str,n,wrap,avail,next,input,tmpDict;if(!strm||!strm.state)return Z_STREAM_ERROR;if(s=strm.state,wrap=s.wrap,wrap===2||wrap===1&&s.status!==INIT_STATE||s.lookahead)return Z_STREAM_ERROR;if(wrap===1)strm.adler=adler32(strm.adler,dictionary,dictLength,0);if(s.wrap=0,dictLength>=s.w_size){if(wrap===0)zero(s.head),s.strstart=0,s.block_start=0,s.insert=0;tmpDict=new utils.Buf8(s.w_size),utils.arraySet(tmpDict,dictionary,dictLength-s.w_size,s.w_size,0),dictionary=tmpDict,dictLength=s.w_size}avail=strm.avail_in,next=strm.next_in,input=strm.input,strm.avail_in=dictLength,strm.next_in=0,strm.input=dictionary,fill_window(s);while(s.lookahead>=MIN_MATCH){str=s.strstart,n=s.lookahead-(MIN_MATCH-1);do s.ins_h=(s.ins_h<<s.hash_shift^s.window[str+MIN_MATCH-1])&s.hash_mask,s.prev[str&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=str,str++;while(--n);s.strstart=str,s.lookahead=MIN_MATCH-1,fill_window(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=MIN_MATCH-1,s.match_available=0,strm.next_in=next,strm.input=input,strm.avail_in=avail,s.wrap=wrap,Z_OK}exports.deflateInit=deflateInit,exports.deflateInit2=deflateInit2,exports.deflateReset=deflateReset,exports.deflateResetKeep=deflateResetKeep,exports.deflateSetHeader=deflateSetHeader,exports.deflate=deflate,exports.deflateEnd=deflateEnd,exports.deflateSetDictionary=deflateSetDictionary,exports.deflateInfo="pako deflate (from Nodeca project)"}),require_inffast=__commonJS4((exports,module)=>{var BAD=30,TYPE=12;module.exports=function(strm,start){var state,_in,last,_out,beg,end,dmax,wsize,whave,wnext,s_window,hold,bits,lcode,dcode,lmask,dmask,here,op,len2,dist,from2,from_source,input,output;state=strm.state,_in=strm.next_in,input=strm.input,last=_in+(strm.avail_in-5),_out=strm.next_out,output=strm.output,beg=_out-(start-strm.avail_out),end=_out+(strm.avail_out-257),dmax=state.dmax,wsize=state.wsize,whave=state.whave,wnext=state.wnext,s_window=state.window,hold=state.hold,bits=state.bits,lcode=state.lencode,dcode=state.distcode,lmask=(1<<state.lenbits)-1,dmask=(1<<state.distbits)-1;top:do{if(bits<15)hold+=input[_in++]<<bits,bits+=8,hold+=input[_in++]<<bits,bits+=8;here=lcode[hold&lmask];dolen:for(;;){if(op=here>>>24,hold>>>=op,bits-=op,op=here>>>16&255,op===0)output[_out++]=here&65535;else if(op&16){if(len2=here&65535,op&=15,op){if(bits<op)hold+=input[_in++]<<bits,bits+=8;len2+=hold&(1<<op)-1,hold>>>=op,bits-=op}if(bits<15)hold+=input[_in++]<<bits,bits+=8,hold+=input[_in++]<<bits,bits+=8;here=dcode[hold&dmask];dodist:for(;;){if(op=here>>>24,hold>>>=op,bits-=op,op=here>>>16&255,op&16){if(dist=here&65535,op&=15,bits<op){if(hold+=input[_in++]<<bits,bits+=8,bits<op)hold+=input[_in++]<<bits,bits+=8}if(dist+=hold&(1<<op)-1,dist>dmax){strm.msg="invalid distance too far back",state.mode=BAD;break top}if(hold>>>=op,bits-=op,op=_out-beg,dist>op){if(op=dist-op,op>whave){if(state.sane){strm.msg="invalid distance too far back",state.mode=BAD;break top}}if(from2=0,from_source=s_window,wnext===0){if(from2+=wsize-op,op<len2){len2-=op;do output[_out++]=s_window[from2++];while(--op);from2=_out-dist,from_source=output}}else if(wnext<op){if(from2+=wsize+wnext-op,op-=wnext,op<len2){len2-=op;do output[_out++]=s_window[from2++];while(--op);if(from2=0,wnext<len2){op=wnext,len2-=op;do output[_out++]=s_window[from2++];while(--op);from2=_out-dist,from_source=output}}}else if(from2+=wnext-op,op<len2){len2-=op;do output[_out++]=s_window[from2++];while(--op);from2=_out-dist,from_source=output}while(len2>2)output[_out++]=from_source[from2++],output[_out++]=from_source[from2++],output[_out++]=from_source[from2++],len2-=3;if(len2){if(output[_out++]=from_source[from2++],len2>1)output[_out++]=from_source[from2++]}}else{from2=_out-dist;do output[_out++]=output[from2++],output[_out++]=output[from2++],output[_out++]=output[from2++],len2-=3;while(len2>2);if(len2){if(output[_out++]=output[from2++],len2>1)output[_out++]=output[from2++]}}}else if((op&64)===0){here=dcode[(here&65535)+(hold&(1<<op)-1)];continue dodist}else{strm.msg="invalid distance code",state.mode=BAD;break top}break}}else if((op&64)===0){here=lcode[(here&65535)+(hold&(1<<op)-1)];continue dolen}else if(op&32){state.mode=TYPE;break top}else{strm.msg="invalid literal/length code",state.mode=BAD;break top}break}}while(_in<last&&_out<end);len2=bits>>3,_in-=len2,bits-=len2<<3,hold&=(1<<bits)-1,strm.next_in=_in,strm.next_out=_out,strm.avail_in=_in<last?5+(last-_in):5-(_in-last),strm.avail_out=_out<end?257+(end-_out):257-(_out-end),state.hold=hold,state.bits=bits;return}}),require_inftrees=__commonJS4((exports,module)=>{var utils=require_common3(),MAXBITS=15,ENOUGH_LENS=852,ENOUGH_DISTS=592,CODES=0,LENS=1,DISTS=2,lbase=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],lext=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],dbase=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],dext=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];module.exports=function(type,lens,lens_index,codes,table,table_index,work,opts){var bits=opts.bits,len2=0,sym=0,min=0,max=0,root=0,curr=0,drop=0,left=0,used=0,huff=0,incr,fill,low,mask,next,base=null,base_index=0,end,count=new utils.Buf16(MAXBITS+1),offs=new utils.Buf16(MAXBITS+1),extra=null,extra_index=0,here_bits,here_op,here_val;for(len2=0;len2<=MAXBITS;len2++)count[len2]=0;for(sym=0;sym<codes;sym++)count[lens[lens_index+sym]]++;root=bits;for(max=MAXBITS;max>=1;max--)if(count[max]!==0)break;if(root>max)root=max;if(max===0)return table[table_index++]=20971520,table[table_index++]=20971520,opts.bits=1,0;for(min=1;min<max;min++)if(count[min]!==0)break;if(root<min)root=min;left=1;for(len2=1;len2<=MAXBITS;len2++)if(left<<=1,left-=count[len2],left<0)return-1;if(left>0&&(type===CODES||max!==1))return-1;offs[1]=0;for(len2=1;len2<MAXBITS;len2++)offs[len2+1]=offs[len2]+count[len2];for(sym=0;sym<codes;sym++)if(lens[lens_index+sym]!==0)work[offs[lens[lens_index+sym]]++]=sym;if(type===CODES)base=extra=work,end=19;else if(type===LENS)base=lbase,base_index-=257,extra=lext,extra_index-=257,end=256;else base=dbase,extra=dext,end=-1;if(huff=0,sym=0,len2=min,next=table_index,curr=root,drop=0,low=-1,used=1<<root,mask=used-1,type===LENS&&used>ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS)return 1;for(;;){if(here_bits=len2-drop,work[sym]<end)here_op=0,here_val=work[sym];else if(work[sym]>end)here_op=extra[extra_index+work[sym]],here_val=base[base_index+work[sym]];else here_op=96,here_val=0;incr=1<<len2-drop,fill=1<<curr,min=fill;do fill-=incr,table[next+(huff>>drop)+fill]=here_bits<<24|here_op<<16|here_val|0;while(fill!==0);incr=1<<len2-1;while(huff&incr)incr>>=1;if(incr!==0)huff&=incr-1,huff+=incr;else huff=0;if(sym++,--count[len2]===0){if(len2===max)break;len2=lens[lens_index+work[sym]]}if(len2>root&&(huff&mask)!==low){if(drop===0)drop=root;next+=min,curr=len2-drop,left=1<<curr;while(curr+drop<max){if(left-=count[curr+drop],left<=0)break;curr++,left<<=1}if(used+=1<<curr,type===LENS&&used>ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS)return 1;low=huff&mask,table[low]=root<<24|curr<<16|next-table_index|0}}if(huff!==0)table[next+huff]=len2-drop<<24|4194304|0;return opts.bits=root,0}}),require_inflate=__commonJS4((exports)=>{var utils=require_common3(),adler32=require_adler32(),crc32=require_crc32(),inflate_fast=require_inffast(),inflate_table=require_inftrees(),CODES=0,LENS=1,DISTS=2,Z_FINISH=4,Z_BLOCK=5,Z_TREES=6,Z_OK=0,Z_STREAM_END=1,Z_NEED_DICT=2,Z_STREAM_ERROR=-2,Z_DATA_ERROR=-3,Z_MEM_ERROR=-4,Z_BUF_ERROR=-5,Z_DEFLATED=8,HEAD=1,FLAGS=2,TIME=3,OS=4,EXLEN=5,EXTRA=6,NAME=7,COMMENT=8,HCRC=9,DICTID=10,DICT=11,TYPE=12,TYPEDO=13,STORED=14,COPY_=15,COPY=16,TABLE=17,LENLENS=18,CODELENS=19,LEN_=20,LEN=21,LENEXT=22,DIST=23,DISTEXT=24,MATCH=25,LIT=26,CHECK=27,LENGTH=28,DONE=29,BAD=30,MEM=31,SYNC=32,ENOUGH_LENS=852,ENOUGH_DISTS=592,MAX_WBITS=15,DEF_WBITS=MAX_WBITS;function zswap32(q){return(q>>>24&255)+(q>>>8&65280)+((q&65280)<<8)+((q&255)<<24)}function InflateState(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new utils.Buf16(320),this.work=new utils.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function inflateResetKeep(strm){var state;if(!strm||!strm.state)return Z_STREAM_ERROR;if(state=strm.state,strm.total_in=strm.total_out=state.total=0,strm.msg="",state.wrap)strm.adler=state.wrap&1;return state.mode=HEAD,state.last=0,state.havedict=0,state.dmax=32768,state.head=null,state.hold=0,state.bits=0,state.lencode=state.lendyn=new utils.Buf32(ENOUGH_LENS),state.distcode=state.distdyn=new utils.Buf32(ENOUGH_DISTS),state.sane=1,state.back=-1,Z_OK}function inflateReset(strm){var state;if(!strm||!strm.state)return Z_STREAM_ERROR;return state=strm.state,state.wsize=0,state.whave=0,state.wnext=0,inflateResetKeep(strm)}function inflateReset2(strm,windowBits){var wrap,state;if(!strm||!strm.state)return Z_STREAM_ERROR;if(state=strm.state,windowBits<0)wrap=0,windowBits=-windowBits;else if(wrap=(windowBits>>4)+1,windowBits<48)windowBits&=15;if(windowBits&&(windowBits<8||windowBits>15))return Z_STREAM_ERROR;if(state.window!==null&&state.wbits!==windowBits)state.window=null;return state.wrap=wrap,state.wbits=windowBits,inflateReset(strm)}function inflateInit2(strm,windowBits){var ret,state;if(!strm)return Z_STREAM_ERROR;if(state=new InflateState,strm.state=state,state.window=null,ret=inflateReset2(strm,windowBits),ret!==Z_OK)strm.state=null;return ret}function inflateInit(strm){return inflateInit2(strm,DEF_WBITS)}var virgin=!0,lenfix,distfix;function fixedtables(state){if(virgin){var sym;lenfix=new utils.Buf32(512),distfix=new utils.Buf32(32),sym=0;while(sym<144)state.lens[sym++]=8;while(sym<256)state.lens[sym++]=9;while(sym<280)state.lens[sym++]=7;while(sym<288)state.lens[sym++]=8;inflate_table(LENS,state.lens,0,288,lenfix,0,state.work,{bits:9}),sym=0;while(sym<32)state.lens[sym++]=5;inflate_table(DISTS,state.lens,0,32,distfix,0,state.work,{bits:5}),virgin=!1}state.lencode=lenfix,state.lenbits=9,state.distcode=distfix,state.distbits=5}function updatewindow(strm,src,end,copy){var dist,state=strm.state;if(state.window===null)state.wsize=1<<state.wbits,state.wnext=0,state.whave=0,state.window=new utils.Buf8(state.wsize);if(copy>=state.wsize)utils.arraySet(state.window,src,end-state.wsize,state.wsize,0),state.wnext=0,state.whave=state.wsize;else{if(dist=state.wsize-state.wnext,dist>copy)dist=copy;if(utils.arraySet(state.window,src,end-copy,dist,state.wnext),copy-=dist,copy)utils.arraySet(state.window,src,end-copy,copy,0),state.wnext=copy,state.whave=state.wsize;else{if(state.wnext+=dist,state.wnext===state.wsize)state.wnext=0;if(state.whave<state.wsize)state.whave+=dist}}return 0}function inflate(strm,flush){var state,input,output,next,put,have,left,hold,bits,_in,_out,copy,from2,from_source,here=0,here_bits,here_op,here_val,last_bits,last_op,last_val,len2,ret,hbuf=new utils.Buf8(4),opts,n,order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!strm||!strm.state||!strm.output||!strm.input&&strm.avail_in!==0)return Z_STREAM_ERROR;if(state=strm.state,state.mode===TYPE)state.mode=TYPEDO;put=strm.next_out,output=strm.output,left=strm.avail_out,next=strm.next_in,input=strm.input,have=strm.avail_in,hold=state.hold,bits=state.bits,_in=have,_out=left,ret=Z_OK;inf_leave:for(;;)switch(state.mode){case HEAD:if(state.wrap===0){state.mode=TYPEDO;break}while(bits<16){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(state.wrap&2&&hold===35615){state.check=0,hbuf[0]=hold&255,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0),hold=0,bits=0,state.mode=FLAGS;break}if(state.flags=0,state.head)state.head.done=!1;if(!(state.wrap&1)||(((hold&255)<<8)+(hold>>8))%31){strm.msg="incorrect header check",state.mode=BAD;break}if((hold&15)!==Z_DEFLATED){strm.msg="unknown compression method",state.mode=BAD;break}if(hold>>>=4,bits-=4,len2=(hold&15)+8,state.wbits===0)state.wbits=len2;else if(len2>state.wbits){strm.msg="invalid window size",state.mode=BAD;break}state.dmax=1<<len2,strm.adler=state.check=1,state.mode=hold&512?DICTID:TYPE,hold=0,bits=0;break;case FLAGS:while(bits<16){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(state.flags=hold,(state.flags&255)!==Z_DEFLATED){strm.msg="unknown compression method",state.mode=BAD;break}if(state.flags&57344){strm.msg="unknown header flags set",state.mode=BAD;break}if(state.head)state.head.text=hold>>8&1;if(state.flags&512)hbuf[0]=hold&255,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0);hold=0,bits=0,state.mode=TIME;case TIME:while(bits<32){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(state.head)state.head.time=hold;if(state.flags&512)hbuf[0]=hold&255,hbuf[1]=hold>>>8&255,hbuf[2]=hold>>>16&255,hbuf[3]=hold>>>24&255,state.check=crc32(state.check,hbuf,4,0);hold=0,bits=0,state.mode=OS;case OS:while(bits<16){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(state.head)state.head.xflags=hold&255,state.head.os=hold>>8;if(state.flags&512)hbuf[0]=hold&255,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0);hold=0,bits=0,state.mode=EXLEN;case EXLEN:if(state.flags&1024){while(bits<16){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(state.length=hold,state.head)state.head.extra_len=hold;if(state.flags&512)hbuf[0]=hold&255,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0);hold=0,bits=0}else if(state.head)state.head.extra=null;state.mode=EXTRA;case EXTRA:if(state.flags&1024){if(copy=state.length,copy>have)copy=have;if(copy){if(state.head){if(len2=state.head.extra_len-state.length,!state.head.extra)state.head.extra=Array(state.head.extra_len);utils.arraySet(state.head.extra,input,next,copy,len2)}if(state.flags&512)state.check=crc32(state.check,input,copy,next);have-=copy,next+=copy,state.length-=copy}if(state.length)break inf_leave}state.length=0,state.mode=NAME;case NAME:if(state.flags&2048){if(have===0)break inf_leave;copy=0;do if(len2=input[next+copy++],state.head&&len2&&state.length<65536)state.head.name+=String.fromCharCode(len2);while(len2&&copy<have);if(state.flags&512)state.check=crc32(state.check,input,copy,next);if(have-=copy,next+=copy,len2)break inf_leave}else if(state.head)state.head.name=null;state.length=0,state.mode=COMMENT;case COMMENT:if(state.flags&4096){if(have===0)break inf_leave;copy=0;do if(len2=input[next+copy++],state.head&&len2&&state.length<65536)state.head.comment+=String.fromCharCode(len2);while(len2&&copy<have);if(state.flags&512)state.check=crc32(state.check,input,copy,next);if(have-=copy,next+=copy,len2)break inf_leave}else if(state.head)state.head.comment=null;state.mode=HCRC;case HCRC:if(state.flags&512){while(bits<16){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(hold!==(state.check&65535)){strm.msg="header crc mismatch",state.mode=BAD;break}hold=0,bits=0}if(state.head)state.head.hcrc=state.flags>>9&1,state.head.done=!0;strm.adler=state.check=0,state.mode=TYPE;break;case DICTID:while(bits<32){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}strm.adler=state.check=zswap32(hold),hold=0,bits=0,state.mode=DICT;case DICT:if(state.havedict===0)return strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,Z_NEED_DICT;strm.adler=state.check=1,state.mode=TYPE;case TYPE:if(flush===Z_BLOCK||flush===Z_TREES)break inf_leave;case TYPEDO:if(state.last){hold>>>=bits&7,bits-=bits&7,state.mode=CHECK;break}while(bits<3){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}switch(state.last=hold&1,hold>>>=1,bits-=1,hold&3){case 0:state.mode=STORED;break;case 1:if(fixedtables(state),state.mode=LEN_,flush===Z_TREES){hold>>>=2,bits-=2;break inf_leave}break;case 2:state.mode=TABLE;break;case 3:strm.msg="invalid block type",state.mode=BAD}hold>>>=2,bits-=2;break;case STORED:hold>>>=bits&7,bits-=bits&7;while(bits<32){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if((hold&65535)!==(hold>>>16^65535)){strm.msg="invalid stored block lengths",state.mode=BAD;break}if(state.length=hold&65535,hold=0,bits=0,state.mode=COPY_,flush===Z_TREES)break inf_leave;case COPY_:state.mode=COPY;case COPY:if(copy=state.length,copy){if(copy>have)copy=have;if(copy>left)copy=left;if(copy===0)break inf_leave;utils.arraySet(output,input,next,copy,put),have-=copy,next+=copy,left-=copy,put+=copy,state.length-=copy;break}state.mode=TYPE;break;case TABLE:while(bits<14){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(state.nlen=(hold&31)+257,hold>>>=5,bits-=5,state.ndist=(hold&31)+1,hold>>>=5,bits-=5,state.ncode=(hold&15)+4,hold>>>=4,bits-=4,state.nlen>286||state.ndist>30){strm.msg="too many length or distance symbols",state.mode=BAD;break}state.have=0,state.mode=LENLENS;case LENLENS:while(state.have<state.ncode){while(bits<3){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.lens[order[state.have++]]=hold&7,hold>>>=3,bits-=3}while(state.have<19)state.lens[order[state.have++]]=0;if(state.lencode=state.lendyn,state.lenbits=7,opts={bits:state.lenbits},ret=inflate_table(CODES,state.lens,0,19,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid code lengths set",state.mode=BAD;break}state.have=0,state.mode=CODELENS;case CODELENS:while(state.have<state.nlen+state.ndist){for(;;){if(here=state.lencode[hold&(1<<state.lenbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=here&65535,here_bits<=bits)break;if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(here_val<16)hold>>>=here_bits,bits-=here_bits,state.lens[state.have++]=here_val;else{if(here_val===16){n=here_bits+2;while(bits<n){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(hold>>>=here_bits,bits-=here_bits,state.have===0){strm.msg="invalid bit length repeat",state.mode=BAD;break}len2=state.lens[state.have-1],copy=3+(hold&3),hold>>>=2,bits-=2}else if(here_val===17){n=here_bits+3;while(bits<n){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=here_bits,bits-=here_bits,len2=0,copy=3+(hold&7),hold>>>=3,bits-=3}else{n=here_bits+7;while(bits<n){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=here_bits,bits-=here_bits,len2=0,copy=11+(hold&127),hold>>>=7,bits-=7}if(state.have+copy>state.nlen+state.ndist){strm.msg="invalid bit length repeat",state.mode=BAD;break}while(copy--)state.lens[state.have++]=len2}}if(state.mode===BAD)break;if(state.lens[256]===0){strm.msg="invalid code -- missing end-of-block",state.mode=BAD;break}if(state.lenbits=9,opts={bits:state.lenbits},ret=inflate_table(LENS,state.lens,0,state.nlen,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid literal/lengths set",state.mode=BAD;break}if(state.distbits=6,state.distcode=state.distdyn,opts={bits:state.distbits},ret=inflate_table(DISTS,state.lens,state.nlen,state.ndist,state.distcode,0,state.work,opts),state.distbits=opts.bits,ret){strm.msg="invalid distances set",state.mode=BAD;break}if(state.mode=LEN_,flush===Z_TREES)break inf_leave;case LEN_:state.mode=LEN;case LEN:if(have>=6&&left>=258){if(strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,inflate_fast(strm,_out),put=strm.next_out,output=strm.output,left=strm.avail_out,next=strm.next_in,input=strm.input,have=strm.avail_in,hold=state.hold,bits=state.bits,state.mode===TYPE)state.back=-1;break}state.back=0;for(;;){if(here=state.lencode[hold&(1<<state.lenbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=here&65535,here_bits<=bits)break;if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(here_op&&(here_op&240)===0){last_bits=here_bits,last_op=here_op,last_val=here_val;for(;;){if(here=state.lencode[last_val+((hold&(1<<last_bits+last_op)-1)>>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=here&65535,last_bits+here_bits<=bits)break;if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,state.length=here_val,here_op===0){state.mode=LIT;break}if(here_op&32){state.back=-1,state.mode=TYPE;break}if(here_op&64){strm.msg="invalid literal/length code",state.mode=BAD;break}state.extra=here_op&15,state.mode=LENEXT;case LENEXT:if(state.extra){n=state.extra;while(bits<n){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.length+=hold&(1<<state.extra)-1,hold>>>=state.extra,bits-=state.extra,state.back+=state.extra}state.was=state.length,state.mode=DIST;case DIST:for(;;){if(here=state.distcode[hold&(1<<state.distbits)-1],here_bits=here>>>24,here_op=here>>>16&255,here_val=here&65535,here_bits<=bits)break;if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if((here_op&240)===0){last_bits=here_bits,last_op=here_op,last_val=here_val;for(;;){if(here=state.distcode[last_val+((hold&(1<<last_bits+last_op)-1)>>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=here&65535,last_bits+here_bits<=bits)break;if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}hold>>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,here_op&64){strm.msg="invalid distance code",state.mode=BAD;break}state.offset=here_val,state.extra=here_op&15,state.mode=DISTEXT;case DISTEXT:if(state.extra){n=state.extra;while(bits<n){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}state.offset+=hold&(1<<state.extra)-1,hold>>>=state.extra,bits-=state.extra,state.back+=state.extra}if(state.offset>state.dmax){strm.msg="invalid distance too far back",state.mode=BAD;break}state.mode=MATCH;case MATCH:if(left===0)break inf_leave;if(copy=_out-left,state.offset>copy){if(copy=state.offset-copy,copy>state.whave){if(state.sane){strm.msg="invalid distance too far back",state.mode=BAD;break}}if(copy>state.wnext)copy-=state.wnext,from2=state.wsize-copy;else from2=state.wnext-copy;if(copy>state.length)copy=state.length;from_source=state.window}else from_source=output,from2=put-state.offset,copy=state.length;if(copy>left)copy=left;left-=copy,state.length-=copy;do output[put++]=from_source[from2++];while(--copy);if(state.length===0)state.mode=LEN;break;case LIT:if(left===0)break inf_leave;output[put++]=state.length,left--,state.mode=LEN;break;case CHECK:if(state.wrap){while(bits<32){if(have===0)break inf_leave;have--,hold|=input[next++]<<bits,bits+=8}if(_out-=left,strm.total_out+=_out,state.total+=_out,_out)strm.adler=state.check=state.flags?crc32(state.check,output,_out,put-_out):adler32(state.check,output,_out,put-_out);if(_out=left,(state.flags?hold:zswap32(hold))!==state.check){strm.msg="incorrect data check",state.mode=BAD;break}hold=0,bits=0}state.mode=LENGTH;case LENGTH:if(state.wrap&&state.flags){while(bits<32){if(have===0)break inf_leave;have--,hold+=input[next++]<<bits,bits+=8}if(hold!==(state.total&4294967295)){strm.msg="incorrect length check",state.mode=BAD;break}hold=0,bits=0}state.mode=DONE;case DONE:ret=Z_STREAM_END;break inf_leave;case BAD:ret=Z_DATA_ERROR;break inf_leave;case MEM:return Z_MEM_ERROR;case SYNC:default:return Z_STREAM_ERROR}if(strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,state.wsize||_out!==strm.avail_out&&state.mode<BAD&&(state.mode<CHECK||flush!==Z_FINISH)){if(updatewindow(strm,strm.output,strm.next_out,_out-strm.avail_out))return state.mode=MEM,Z_MEM_ERROR}if(_in-=strm.avail_in,_out-=strm.avail_out,strm.total_in+=_in,strm.total_out+=_out,state.total+=_out,state.wrap&&_out)strm.adler=state.check=state.flags?crc32(state.check,output,_out,strm.next_out-_out):adler32(state.check,output,_out,strm.next_out-_out);if(strm.data_type=state.bits+(state.last?64:0)+(state.mode===TYPE?128:0)+(state.mode===LEN_||state.mode===COPY_?256:0),(_in===0&&_out===0||flush===Z_FINISH)&&ret===Z_OK)ret=Z_BUF_ERROR;return ret}function inflateEnd(strm){if(!strm||!strm.state)return Z_STREAM_ERROR;var state=strm.state;if(state.window)state.window=null;return strm.state=null,Z_OK}function inflateGetHeader(strm,head){var state;if(!strm||!strm.state)return Z_STREAM_ERROR;if(state=strm.state,(state.wrap&2)===0)return Z_STREAM_ERROR;return state.head=head,head.done=!1,Z_OK}function inflateSetDictionary(strm,dictionary){var dictLength=dictionary.length,state,dictid,ret;if(!strm||!strm.state)return Z_STREAM_ERROR;if(state=strm.state,state.wrap!==0&&state.mode!==DICT)return Z_STREAM_ERROR;if(state.mode===DICT){if(dictid=1,dictid=adler32(dictid,dictionary,dictLength,0),dictid!==state.check)return Z_DATA_ERROR}if(ret=updatewindow(strm,dictionary,dictLength,dictLength),ret)return state.mode=MEM,Z_MEM_ERROR;return state.havedict=1,Z_OK}exports.inflateReset=inflateReset,exports.inflateReset2=inflateReset2,exports.inflateResetKeep=inflateResetKeep,exports.inflateInit=inflateInit,exports.inflateInit2=inflateInit2,exports.inflate=inflate,exports.inflateEnd=inflateEnd,exports.inflateGetHeader=inflateGetHeader,exports.inflateSetDictionary=inflateSetDictionary,exports.inflateInfo="pako inflate (from Nodeca project)"}),require_constants2=__commonJS4((exports,module)=>{module.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}}),require_binding=__commonJS4((exports)=>{var assert2=(init_assert(),__toCommonJS(exports_assert)),Zstream=require_zstream(),zlib_deflate=require_deflate(),zlib_inflate=require_inflate(),constants3=require_constants2();for(key in constants3)exports[key]=constants3[key];var key;exports.NONE=0,exports.DEFLATE=1,exports.INFLATE=2,exports.GZIP=3,exports.GUNZIP=4,exports.DEFLATERAW=5,exports.INFLATERAW=6,exports.UNZIP=7;var GZIP_HEADER_ID1=31,GZIP_HEADER_ID2=139;function Zlib(mode){if(typeof mode!=="number"||mode<exports.DEFLATE||mode>exports.UNZIP)throw TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=mode,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}Zlib.prototype.close=function(){if(this.write_in_progress){this.pending_close=!0;return}if(this.pending_close=!1,assert2(this.init_done,"close before init"),assert2(this.mode<=exports.UNZIP),this.mode===exports.DEFLATE||this.mode===exports.GZIP||this.mode===exports.DEFLATERAW)zlib_deflate.deflateEnd(this.strm);else if(this.mode===exports.INFLATE||this.mode===exports.GUNZIP||this.mode===exports.INFLATERAW||this.mode===exports.UNZIP)zlib_inflate.inflateEnd(this.strm);this.mode=exports.NONE,this.dictionary=null},Zlib.prototype.write=function(flush,input,in_off,in_len,out,out_off,out_len){return this._write(!0,flush,input,in_off,in_len,out,out_off,out_len)},Zlib.prototype.writeSync=function(flush,input,in_off,in_len,out,out_off,out_len){return this._write(!1,flush,input,in_off,in_len,out,out_off,out_len)},Zlib.prototype._write=function(async,flush,input,in_off,in_len,out,out_off,out_len){if(assert2.equal(arguments.length,8),assert2(this.init_done,"write before init"),assert2(this.mode!==exports.NONE,"already finalized"),assert2.equal(!1,this.write_in_progress,"write already in progress"),assert2.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,assert2.equal(!1,flush===void 0,"must provide flush value"),this.write_in_progress=!0,flush!==exports.Z_NO_FLUSH&&flush!==exports.Z_PARTIAL_FLUSH&&flush!==exports.Z_SYNC_FLUSH&&flush!==exports.Z_FULL_FLUSH&&flush!==exports.Z_FINISH&&flush!==exports.Z_BLOCK)throw Error("Invalid flush value");if(input==null)input=Buffer.alloc(0),in_len=0,in_off=0;if(this.strm.avail_in=in_len,this.strm.input=input,this.strm.next_in=in_off,this.strm.avail_out=out_len,this.strm.output=out,this.strm.next_out=out_off,this.flush=flush,!async){if(this._process(),this._checkError())return this._afterSync();return}var self2=this;return process.nextTick(function(){self2._process(),self2._after()}),this},Zlib.prototype._afterSync=function(){var avail_out=this.strm.avail_out,avail_in=this.strm.avail_in;return this.write_in_progress=!1,[avail_in,avail_out]},Zlib.prototype._process=function(){var next_expected_header_byte=null;switch(this.mode){case exports.DEFLATE:case exports.GZIP:case exports.DEFLATERAW:this.err=zlib_deflate.deflate(this.strm,this.flush);break;case exports.UNZIP:if(this.strm.avail_in>0)next_expected_header_byte=this.strm.next_in;switch(this.gzip_id_bytes_read){case 0:if(next_expected_header_byte===null)break;if(this.strm.input[next_expected_header_byte]===GZIP_HEADER_ID1){if(this.gzip_id_bytes_read=1,next_expected_header_byte++,this.strm.avail_in===1)break}else{this.mode=exports.INFLATE;break}case 1:if(next_expected_header_byte===null)break;if(this.strm.input[next_expected_header_byte]===GZIP_HEADER_ID2)this.gzip_id_bytes_read=2,this.mode=exports.GUNZIP;else this.mode=exports.INFLATE;break;default:throw Error("invalid number of gzip magic number bytes read")}case exports.INFLATE:case exports.GUNZIP:case exports.INFLATERAW:if(this.err=zlib_inflate.inflate(this.strm,this.flush),this.err===exports.Z_NEED_DICT&&this.dictionary){if(this.err=zlib_inflate.inflateSetDictionary(this.strm,this.dictionary),this.err===exports.Z_OK)this.err=zlib_inflate.inflate(this.strm,this.flush);else if(this.err===exports.Z_DATA_ERROR)this.err=exports.Z_NEED_DICT}while(this.strm.avail_in>0&&this.mode===exports.GUNZIP&&this.err===exports.Z_STREAM_END&&this.strm.next_in[0]!==0)this.reset(),this.err=zlib_inflate.inflate(this.strm,this.flush);break;default:throw Error("Unknown mode "+this.mode)}},Zlib.prototype._checkError=function(){switch(this.err){case exports.Z_OK:case exports.Z_BUF_ERROR:if(this.strm.avail_out!==0&&this.flush===exports.Z_FINISH)return this._error("unexpected end of file"),!1;break;case exports.Z_STREAM_END:break;case exports.Z_NEED_DICT:if(this.dictionary==null)this._error("Missing dictionary");else this._error("Bad dictionary");return!1;default:return this._error("Zlib error"),!1}return!0},Zlib.prototype._after=function(){if(!this._checkError())return;var avail_out=this.strm.avail_out,avail_in=this.strm.avail_in;if(this.write_in_progress=!1,this.callback(avail_in,avail_out),this.pending_close)this.close()},Zlib.prototype._error=function(message){if(this.strm.msg)message=this.strm.msg;if(this.onerror(message,this.err),this.write_in_progress=!1,this.pending_close)this.close()},Zlib.prototype.init=function(windowBits,level,memLevel,strategy,dictionary){assert2(arguments.length===4||arguments.length===5,"init(windowBits, level, memLevel, strategy, [dictionary])"),assert2(windowBits>=8&&windowBits<=15,"invalid windowBits"),assert2(level>=-1&&level<=9,"invalid compression level"),assert2(memLevel>=1&&memLevel<=9,"invalid memlevel"),assert2(strategy===exports.Z_FILTERED||strategy===exports.Z_HUFFMAN_ONLY||strategy===exports.Z_RLE||strategy===exports.Z_FIXED||strategy===exports.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(level,windowBits,memLevel,strategy,dictionary),this._setDictionary()},Zlib.prototype.params=function(){throw Error("deflateParams Not supported")},Zlib.prototype.reset=function(){this._reset(),this._setDictionary()},Zlib.prototype._init=function(level,windowBits,memLevel,strategy,dictionary){if(this.level=level,this.windowBits=windowBits,this.memLevel=memLevel,this.strategy=strategy,this.flush=exports.Z_NO_FLUSH,this.err=exports.Z_OK,this.mode===exports.GZIP||this.mode===exports.GUNZIP)this.windowBits+=16;if(this.mode===exports.UNZIP)this.windowBits+=32;if(this.mode===exports.DEFLATERAW||this.mode===exports.INFLATERAW)this.windowBits=-1*this.windowBits;switch(this.strm=new Zstream,this.mode){case exports.DEFLATE:case exports.GZIP:case exports.DEFLATERAW:this.err=zlib_deflate.deflateInit2(this.strm,this.level,exports.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case exports.INFLATE:case exports.GUNZIP:case exports.INFLATERAW:case exports.UNZIP:this.err=zlib_inflate.inflateInit2(this.strm,this.windowBits);break;default:throw Error("Unknown mode "+this.mode)}if(this.err!==exports.Z_OK)this._error("Init error");this.dictionary=dictionary,this.write_in_progress=!1,this.init_done=!0},Zlib.prototype._setDictionary=function(){if(this.dictionary==null)return;switch(this.err=exports.Z_OK,this.mode){case exports.DEFLATE:case exports.DEFLATERAW:this.err=zlib_deflate.deflateSetDictionary(this.strm,this.dictionary);break;default:break}if(this.err!==exports.Z_OK)this._error("Failed to set dictionary")},Zlib.prototype._reset=function(){switch(this.err=exports.Z_OK,this.mode){case exports.DEFLATE:case exports.DEFLATERAW:case exports.GZIP:this.err=zlib_deflate.deflateReset(this.strm);break;case exports.INFLATE:case exports.INFLATERAW:case exports.GUNZIP:this.err=zlib_inflate.inflateReset(this.strm);break;default:break}if(this.err!==exports.Z_OK)this._error("Failed to reset stream")},exports.Zlib=Zlib}),require_lib=__commonJS4((exports)=>{var Buffer22=(init_buffer(),__toCommonJS(exports_buffer)).Buffer,Transform=require_stream().Transform,binding=require_binding(),util=(init_util(),__toCommonJS(exports_util)),assert2=(init_assert(),__toCommonJS(exports_assert)).ok,kMaxLength2=(init_buffer(),__toCommonJS(exports_buffer)).kMaxLength,kRangeErrorMessage="Cannot create final Buffer. It would be larger than 0x"+kMaxLength2.toString(16)+" bytes";binding.Z_MIN_WINDOWBITS=8,binding.Z_MAX_WINDOWBITS=15,binding.Z_DEFAULT_WINDOWBITS=15,binding.Z_MIN_CHUNK=64,binding.Z_MAX_CHUNK=1/0,binding.Z_DEFAULT_CHUNK=16384,binding.Z_MIN_MEMLEVEL=1,binding.Z_MAX_MEMLEVEL=9,binding.Z_DEFAULT_MEMLEVEL=8,binding.Z_MIN_LEVEL=-1,binding.Z_MAX_LEVEL=9,binding.Z_DEFAULT_LEVEL=binding.Z_DEFAULT_COMPRESSION;var bkeys=Object.keys(binding);for(bk=0;bk<bkeys.length;bk++)if(bkey=bkeys[bk],bkey.match(/^Z/))Object.defineProperty(exports,bkey,{enumerable:!0,value:binding[bkey],writable:!1});var bkey,bk,codes={Z_OK:binding.Z_OK,Z_STREAM_END:binding.Z_STREAM_END,Z_NEED_DICT:binding.Z_NEED_DICT,Z_ERRNO:binding.Z_ERRNO,Z_STREAM_ERROR:binding.Z_STREAM_ERROR,Z_DATA_ERROR:binding.Z_DATA_ERROR,Z_MEM_ERROR:binding.Z_MEM_ERROR,Z_BUF_ERROR:binding.Z_BUF_ERROR,Z_VERSION_ERROR:binding.Z_VERSION_ERROR},ckeys=Object.keys(codes);for(ck=0;ck<ckeys.length;ck++)ckey=ckeys[ck],codes[codes[ckey]]=ckey;var ckey,ck;Object.defineProperty(exports,"codes",{enumerable:!0,value:Object.freeze(codes),writable:!1}),exports.Deflate=Deflate,exports.Inflate=Inflate,exports.Gzip=Gzip,exports.Gunzip=Gunzip,exports.DeflateRaw=DeflateRaw,exports.InflateRaw=InflateRaw,exports.Unzip=Unzip,exports.createDeflate=function(o){return new Deflate(o)},exports.createInflate=function(o){return new Inflate(o)},exports.createDeflateRaw=function(o){return new DeflateRaw(o)},exports.createInflateRaw=function(o){return new InflateRaw(o)},exports.createGzip=function(o){return new Gzip(o)},exports.createGunzip=function(o){return new Gunzip(o)},exports.createUnzip=function(o){return new Unzip(o)},exports.deflate=function(buffer,opts,callback){if(typeof opts==="function")callback=opts,opts={};return zlibBuffer(new Deflate(opts),buffer,callback)},exports.deflateSync=function(buffer,opts){return zlibBufferSync(new Deflate(opts),buffer)},exports.gzip=function(buffer,opts,callback){if(typeof opts==="function")callback=opts,opts={};return zlibBuffer(new Gzip(opts),buffer,callback)},exports.gzipSync=function(buffer,opts){return zlibBufferSync(new Gzip(opts),buffer)},exports.deflateRaw=function(buffer,opts,callback){if(typeof opts==="function")callback=opts,opts={};return zlibBuffer(new DeflateRaw(opts),buffer,callback)},exports.deflateRawSync=function(buffer,opts){return zlibBufferSync(new DeflateRaw(opts),buffer)},exports.unzip=function(buffer,opts,callback){if(typeof opts==="function")callback=opts,opts={};return zlibBuffer(new Unzip(opts),buffer,callback)},exports.unzipSync=function(buffer,opts){return zlibBufferSync(new Unzip(opts),buffer)},exports.inflate=function(buffer,opts,callback){if(typeof opts==="function")callback=opts,opts={};return zlibBuffer(new Inflate(opts),buffer,callback)},exports.inflateSync=function(buffer,opts){return zlibBufferSync(new Inflate(opts),buffer)},exports.gunzip=function(buffer,opts,callback){if(typeof opts==="function")callback=opts,opts={};return zlibBuffer(new Gunzip(opts),buffer,callback)},exports.gunzipSync=function(buffer,opts){return zlibBufferSync(new Gunzip(opts),buffer)},exports.inflateRaw=function(buffer,opts,callback){if(typeof opts==="function")callback=opts,opts={};return zlibBuffer(new InflateRaw(opts),buffer,callback)},exports.inflateRawSync=function(buffer,opts){return zlibBufferSync(new InflateRaw(opts),buffer)};function zlibBuffer(engine,buffer,callback){var buffers=[],nread=0;engine.on("error",onError),engine.on("end",onEnd),engine.end(buffer),flow();function flow(){var chunk;while((chunk=engine.read())!==null)buffers.push(chunk),nread+=chunk.length;engine.once("readable",flow)}function onError(err){engine.removeListener("end",onEnd),engine.removeListener("readable",flow),callback(err)}function onEnd(){var buf,err=null;if(nread>=kMaxLength2)err=RangeError(kRangeErrorMessage);else buf=Buffer22.concat(buffers,nread);buffers=[],engine.close(),callback(err,buf)}}function zlibBufferSync(engine,buffer){if(typeof buffer==="string")buffer=Buffer22.from(buffer);if(!Buffer22.isBuffer(buffer))throw TypeError("Not a string or buffer");var flushFlag=engine._finishFlushFlag;return engine._processChunk(buffer,flushFlag)}function Deflate(opts){if(!(this instanceof Deflate))return new Deflate(opts);Zlib.call(this,opts,binding.DEFLATE)}function Inflate(opts){if(!(this instanceof Inflate))return new Inflate(opts);Zlib.call(this,opts,binding.INFLATE)}function Gzip(opts){if(!(this instanceof Gzip))return new Gzip(opts);Zlib.call(this,opts,binding.GZIP)}function Gunzip(opts){if(!(this instanceof Gunzip))return new Gunzip(opts);Zlib.call(this,opts,binding.GUNZIP)}function DeflateRaw(opts){if(!(this instanceof DeflateRaw))return new DeflateRaw(opts);Zlib.call(this,opts,binding.DEFLATERAW)}function InflateRaw(opts){if(!(this instanceof InflateRaw))return new InflateRaw(opts);Zlib.call(this,opts,binding.INFLATERAW)}function Unzip(opts){if(!(this instanceof Unzip))return new Unzip(opts);Zlib.call(this,opts,binding.UNZIP)}function isValidFlushFlag(flag){return flag===binding.Z_NO_FLUSH||flag===binding.Z_PARTIAL_FLUSH||flag===binding.Z_SYNC_FLUSH||flag===binding.Z_FULL_FLUSH||flag===binding.Z_FINISH||flag===binding.Z_BLOCK}function Zlib(opts,mode){var _this=this;if(this._opts=opts=opts||{},this._chunkSize=opts.chunkSize||exports.Z_DEFAULT_CHUNK,Transform.call(this,opts),opts.flush&&!isValidFlushFlag(opts.flush))throw Error("Invalid flush flag: "+opts.flush);if(opts.finishFlush&&!isValidFlushFlag(opts.finishFlush))throw Error("Invalid flush flag: "+opts.finishFlush);if(this._flushFlag=opts.flush||binding.Z_NO_FLUSH,this._finishFlushFlag=typeof opts.finishFlush<"u"?opts.finishFlush:binding.Z_FINISH,opts.chunkSize){if(opts.chunkSize<exports.Z_MIN_CHUNK||opts.chunkSize>exports.Z_MAX_CHUNK)throw Error("Invalid chunk size: "+opts.chunkSize)}if(opts.windowBits){if(opts.windowBits<exports.Z_MIN_WINDOWBITS||opts.windowBits>exports.Z_MAX_WINDOWBITS)throw Error("Invalid windowBits: "+opts.windowBits)}if(opts.level){if(opts.level<exports.Z_MIN_LEVEL||opts.level>exports.Z_MAX_LEVEL)throw Error("Invalid compression level: "+opts.level)}if(opts.memLevel){if(opts.memLevel<exports.Z_MIN_MEMLEVEL||opts.memLevel>exports.Z_MAX_MEMLEVEL)throw Error("Invalid memLevel: "+opts.memLevel)}if(opts.strategy){if(opts.strategy!=exports.Z_FILTERED&&opts.strategy!=exports.Z_HUFFMAN_ONLY&&opts.strategy!=exports.Z_RLE&&opts.strategy!=exports.Z_FIXED&&opts.strategy!=exports.Z_DEFAULT_STRATEGY)throw Error("Invalid strategy: "+opts.strategy)}if(opts.dictionary){if(!Buffer22.isBuffer(opts.dictionary))throw Error("Invalid dictionary: it should be a Buffer instance")}this._handle=new binding.Zlib(mode);var self2=this;this._hadError=!1,this._handle.onerror=function(message,errno){_close(self2),self2._hadError=!0;var error=Error(message);error.errno=errno,error.code=exports.codes[errno],self2.emit("error",error)};var level=exports.Z_DEFAULT_COMPRESSION;if(typeof opts.level==="number")level=opts.level;var strategy=exports.Z_DEFAULT_STRATEGY;if(typeof opts.strategy==="number")strategy=opts.strategy;this._handle.init(opts.windowBits||exports.Z_DEFAULT_WINDOWBITS,level,opts.memLevel||exports.Z_DEFAULT_MEMLEVEL,strategy,opts.dictionary),this._buffer=Buffer22.allocUnsafe(this._chunkSize),this._offset=0,this._level=level,this._strategy=strategy,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!_this._handle},configurable:!0,enumerable:!0})}util.inherits(Zlib,Transform),Zlib.prototype.params=function(level,strategy,callback){if(level<exports.Z_MIN_LEVEL||level>exports.Z_MAX_LEVEL)throw RangeError("Invalid compression level: "+level);if(strategy!=exports.Z_FILTERED&&strategy!=exports.Z_HUFFMAN_ONLY&&strategy!=exports.Z_RLE&&strategy!=exports.Z_FIXED&&strategy!=exports.Z_DEFAULT_STRATEGY)throw TypeError("Invalid strategy: "+strategy);if(this._level!==level||this._strategy!==strategy){var self2=this;this.flush(binding.Z_SYNC_FLUSH,function(){if(assert2(self2._handle,"zlib binding closed"),self2._handle.params(level,strategy),!self2._hadError){if(self2._level=level,self2._strategy=strategy,callback)callback()}})}else process.nextTick(callback)},Zlib.prototype.reset=function(){return assert2(this._handle,"zlib binding closed"),this._handle.reset()},Zlib.prototype._flush=function(callback){this._transform(Buffer22.alloc(0),"",callback)},Zlib.prototype.flush=function(kind,callback){var _this2=this,ws=this._writableState;if(typeof kind==="function"||kind===void 0&&!callback)callback=kind,kind=binding.Z_FULL_FLUSH;if(ws.ended){if(callback)process.nextTick(callback)}else if(ws.ending){if(callback)this.once("end",callback)}else if(ws.needDrain){if(callback)this.once("drain",function(){return _this2.flush(kind,callback)})}else this._flushFlag=kind,this.write(Buffer22.alloc(0),"",callback)},Zlib.prototype.close=function(callback){_close(this,callback),process.nextTick(emitCloseNT,this)};function _close(engine,callback){if(callback)process.nextTick(callback);if(!engine._handle)return;engine._handle.close(),engine._handle=null}function emitCloseNT(self2){self2.emit("close")}Zlib.prototype._transform=function(chunk,encoding,cb){var flushFlag,ws=this._writableState,ending=ws.ending||ws.ended,last=ending&&(!chunk||ws.length===chunk.length);if(chunk!==null&&!Buffer22.isBuffer(chunk))return cb(Error("invalid input"));if(!this._handle)return cb(Error("zlib binding closed"));if(last)flushFlag=this._finishFlushFlag;else if(flushFlag=this._flushFlag,chunk.length>=ws.length)this._flushFlag=this._opts.flush||binding.Z_NO_FLUSH;this._processChunk(chunk,flushFlag,cb)},Zlib.prototype._processChunk=function(chunk,flushFlag,cb){var availInBefore=chunk&&chunk.length,availOutBefore=this._chunkSize-this._offset,inOff=0,self2=this,async=typeof cb==="function";if(!async){var buffers=[],nread=0,error;this.on("error",function(er){error=er}),assert2(this._handle,"zlib binding closed");do var res=this._handle.writeSync(flushFlag,chunk,inOff,availInBefore,this._buffer,this._offset,availOutBefore);while(!this._hadError&&callback(res[0],res[1]));if(this._hadError)throw error;if(nread>=kMaxLength2)throw _close(this),RangeError(kRangeErrorMessage);var buf=Buffer22.concat(buffers,nread);return _close(this),buf}assert2(this._handle,"zlib binding closed");var req=this._handle.write(flushFlag,chunk,inOff,availInBefore,this._buffer,this._offset,availOutBefore);req.buffer=chunk,req.callback=callback;function callback(availInAfter,availOutAfter){if(this)this.buffer=null,this.callback=null;if(self2._hadError)return;var have=availOutBefore-availOutAfter;if(assert2(have>=0,"have should not go down"),have>0){var out=self2._buffer.slice(self2._offset,self2._offset+have);if(self2._offset+=have,async)self2.push(out);else buffers.push(out),nread+=out.length}if(availOutAfter===0||self2._offset>=self2._chunkSize)availOutBefore=self2._chunkSize,self2._offset=0,self2._buffer=Buffer22.allocUnsafe(self2._chunkSize);if(availOutAfter===0){if(inOff+=availInBefore-availInAfter,availInBefore=availInAfter,!async)return!0;var newReq=self2._handle.write(flushFlag,chunk,inOff,availInBefore,self2._buffer,self2._offset,self2._chunkSize);newReq.callback=callback,newReq.buffer=chunk;return}if(!async)return!1;cb()}},util.inherits(Deflate,Zlib),util.inherits(Inflate,Zlib),util.inherits(Gzip,Zlib),util.inherits(Gunzip,Zlib),util.inherits(DeflateRaw,Zlib),util.inherits(InflateRaw,Zlib),util.inherits(Unzip,Zlib)}),exports_zlib={};__export2(exports_zlib,{default:()=>import_browserify_zlib.default});__reExport(exports_zlib,__toESM3(require_lib(),1));var import_browserify_zlib=__toESM3(require_lib(),1),export_default=import_browserify_zlib.default;var WWWebSocket=class WWWebSocket2{static CONNECTING=0;static OPEN=1;static CLOSING=2;static CLOSED=3;binaryType="nodebuffer";readyState=WWWebSocket2.CONNECTING;rejectUnauthorized=!0;url="";onopen=null;onerror=null;onclose=null;onmessage=null;$socket=null;$connectionHeaders={};$perMessageDeflate=!1;$listeners;constructor(wsUrl,options={}){if(typeof options!=="object")options={};if(options.agent){let proxyUrl=`${options.agent.shouldLookup?"socks5":"socks5h"}://${options.agent.proxy.userId?`${options.agent.proxy.userId}:${options.agent.proxy.password}@`:""}${options.agent.proxy.host}:${options.agent.proxy.port}`;options.proxy=proxyUrl}this.url=wsUrl,this.readyState=WWWebSocket2.CONNECTING,this.rejectUnauthorized=options.rejectUnauthorized??!0,this.$listeners={open:[],message:[],error:[],close:[]},this.$socket=null,this.$connect(wsUrl,options.headers||{},options.proxy)}async $connect(wsUrl,headerObject,proxyUrl){try{let ws=new URL(wsUrl),useTLS=ws.protocol==="wss:",destHost=ws.hostname,destPort=ws.port?Number(ws.port):useTLS?443:80;if(proxyUrl){let proxy=new URL(proxyUrl),scheme=proxy.protocol.replace(":",""),resolveDnsLocally=scheme==="socks5";if(!["socks5","socks5h"].includes(scheme))throw Error(`Unsupported proxy protocol: ${scheme}`);this.$socket=await socksConnect({proxy:{hostname:proxy.hostname,port:Number(proxy.port),username:proxy.username,password:proxy.password},destHost,destPort,useTLS,resolveDnsLocally,rejectUnauthorized:this.rejectUnauthorized})}else if(useTLS){let tlsOptions={host:destHost,port:destPort,rejectUnauthorized:this.rejectUnauthorized};if(!(/^(\d+\.){3}\d+$/.test(destHost)||destHost==="::1"||/^::/.test(destHost)))tlsOptions.servername=destHost;this.$socket=tls2.connect(tlsOptions)}else this.$socket=net_default.connect(destPort,destHost);if(!this.$socket)throw Error("Failed to create socket");let key=crypto_default.randomBytes(16).toString("base64"),headers={...Object.fromEntries(Object.entries(headerObject).filter(([k,v])=>k&&v).map(([k,v])=>[k.toLowerCase(),v])),host:destHost,upgrade:"websocket",connection:"Upgrade","sec-websocket-key":key,"sec-websocket-version":"13"};this.$connectionHeaders=headers,this.$socket.write(`GET ${ws.pathname}${ws.search} HTTP/1.1`+Object.entries(headers).filter(([k,v])=>k&&v).map(([k,v])=>`\r
87
+ ${k}: ${v}`).join("")+`\r
88
+ \r
89
+ `);let handshake="";this.$socket.on("data",(chunk)=>{if(this.readyState!==WWWebSocket2.CONNECTING||!this.$socket)return;if(handshake+=chunk.toString(),handshake.includes(`\r
90
+ \r
91
+ `)){if(!handshake.includes("101 Switching Protocols")){this.$emit("error",Error("WebSocket handshake failed")),this.close();return}this.$perMessageDeflate=handshake.toLowerCase().includes("sec-websocket-extensions")&&handshake.toLowerCase().includes("permessage-deflate"),this.readyState=WWWebSocket2.OPEN,this.$emit("open");let leftover=chunk.slice(chunk.indexOf(`\r
92
+ \r
93
+ `)+4);if(leftover.length>0)this.$readFrame(leftover);this.$socket.on("data",(data)=>this.$readFrame(data)),this.$socket.on("close",(info)=>this.$emit("close",info)),this.$socket.on("error",(err)=>this.$emit("error",err))}})}catch(err){console.error(err),this.$emit("error",err),this.close()}}$readFrame(data){let offset=0;while(offset<data.length){if(offset+2>data.length)return;let byte1=data[offset++],opcode=byte1&15,rsv1=(byte1&64)!==0,byte2=data[offset++],mask=(byte2&128)!==0,len2=byte2&127;if(len2===126){if(offset+2>data.length)return;len2=data.readUInt16BE(offset),offset+=2}else if(len2===127){if(offset+8>data.length)return;len2=Number(data.readBigUInt64BE(offset)),offset+=8}let maskingKey;if(mask){if(offset+4>data.length)return;maskingKey=data.slice(offset,offset+4),offset+=4}if(offset+len2>data.length)return;let payload=data.slice(offset,offset+len2);if(offset+=len2,mask&&maskingKey)payload=Buffer.from(payload.map((b,i2)=>b^maskingKey[i2%4]));if((opcode===1||opcode===2)&&this.$connectionHeaders["sec-websocket-extensions"]?.includes("permessage-deflate")&&rsv1)export_default.inflateRaw(payload,(err,result)=>{if(err)return this.$emit("error",err);if(opcode===1)this.$emit("message",{data:result.toString()});else{let dataOut;if(this.binaryType==="arraybuffer")dataOut=result.buffer.slice(result.byteOffset,result.byteOffset+result.byteLength);else dataOut=result;this.$emit("message",{data:dataOut})}});else if(opcode===1)this.$emit("message",{data:payload.toString()});else if(opcode===2){let dataOut;if(this.binaryType==="arraybuffer")dataOut=payload.buffer.slice(payload.byteOffset,payload.byteOffset+payload.byteLength);else dataOut=payload;this.$emit("message",{data:dataOut})}else if(opcode===8){let code2,reason;if(payload.length>=2)code2=payload.readUInt16BE(0),reason=payload.slice(2).toString();if(this.$emit("close",{code:code2,reason}),this.readyState===WWWebSocket2.CLOSING)this.$socket?.end(),this.readyState=WWWebSocket2.CLOSED;else this.close(code2,reason)}else if(opcode===9)this.pong(payload),this.$emit("ping",{data:payload});else if(opcode===10)this.$emit("pong",{data:payload})}}ping(data=""){if(this.readyState!==WWWebSocket2.OPEN||!this.$socket)throw Error("WebSocket not open");let payload=Buffer.from(data),header=Buffer.alloc(2);header[0]=137,header[1]=payload.length|128;let maskingKey=crypto_default.randomBytes(4),masked=Buffer.from(payload.map((b,i2)=>b^maskingKey[i2%4]));this.$socket.write(Buffer.concat([header,maskingKey,masked]))}pong(data=""){if(this.readyState!==WWWebSocket2.OPEN||!this.$socket)throw Error("WebSocket not open");let payload=Buffer.from(data),header=Buffer.alloc(2);header[0]=138,header[1]=payload.length|128;let maskingKey=crypto_default.randomBytes(4),masked=Buffer.from(payload.map((b,i2)=>b^maskingKey[i2%4]));this.$socket.write(Buffer.concat([header,maskingKey,masked]))}send(data){if(this.readyState!==1||!this.$socket)throw Error("WebSocket not open");let payload=Buffer.from(data),isText=typeof data==="string",opcode=isText?1:2,compress=this.$perMessageDeflate&&isText,sendFrame=(finalPayload,useRsv1=!1)=>{let header=Buffer.alloc(2);if(header[0]=128|(useRsv1?64:0)|opcode,finalPayload.length<126)header[1]=finalPayload.length|128;else if(finalPayload.length<65536)header=Buffer.alloc(4),header[0]=128|(useRsv1?64:0)|opcode,header[1]=254,header.writeUInt16BE(finalPayload.length,2);else header=Buffer.alloc(10),header[0]=128|(useRsv1?64:0)|opcode,header[1]=255,header.writeBigUInt64BE(BigInt(finalPayload.length),2);let maskingKey=crypto_default.randomBytes(4),masked=Buffer.from(finalPayload.map((b,i2)=>b^maskingKey[i2%4]));this.$socket.write(Buffer.concat([header,maskingKey,masked]))};if(compress)export_default.deflateRaw(payload,(err,compressed)=>{if(err){this.$emit("error",err);return}sendFrame(compressed,!0)});else sendFrame(payload,!1)}close(code2,reason){if(this.readyState===WWWebSocket2.CLOSING)return;if(this.readyState=WWWebSocket2.CLOSING,this.$socket){let payload;if(code2){if(payload=Buffer.alloc(2+(reason?Buffer.byteLength(reason):0)),payload.writeUInt16BE(code2,0),reason)payload.write(reason,2)}else payload=Buffer.alloc(0);let header=Buffer.alloc(2);header[0]=136,header[1]=payload.length|128;let maskingKey=crypto_default.randomBytes(4),masked=Buffer.from(payload.map((b,i2)=>b^maskingKey[i2%4]));this.$socket.write(Buffer.concat([header,maskingKey,masked]))}}addEventListener(event,listener){if(this.$listeners[event])this.$listeners[event].push(listener)}removeEventListener(event,listener){if(!this.$listeners[event])return;this.$listeners[event]=this.$listeners[event].filter((l)=>l!==listener)}$emit(event,arg=null){if(event==="message"&&typeof this.onmessage==="function")this.onmessage(arg);if(event==="close"&&typeof this.onclose==="function")this.onclose(arg);if(event==="error"&&typeof this.onerror==="function")this.onerror(arg);if(event==="open"&&typeof this.onopen==="function")this.onopen(arg);this.$listeners[event].forEach((l)=>l(arg))}};var iFetch=globalThis.fetch,fetch_default=iFetch;var globals={},isBrowser=typeof window<"u"&&typeof HTMLElement<"u",isWebWorker=typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope,isCloudflareWorker=typeof WebSocketPair<"u"&&typeof Cloudflare<"u",isUnsandboxedElectron=typeof process==="object"&&process.versions?.electron&&process.versions?.node&&typeof window<"u"&&typeof window.require<"u",isNode=typeof process<"u"&&process.moduleLoadList?.length>0,isDeno=typeof Deno<"u",isBun=typeof Bun<"u";if(!isBrowser&&!isCloudflareWorker&&!isWebWorker&&!isUnsandboxedElectron&&!isNode&&!isDeno&&!isBun)throw Error("yolkbot doesn't know how to run in this environment. report this at https://yolkbot.xyz/community");globals.isBrowser=isBrowser||isWebWorker;globals.isIsolated=!isNode&&!isDeno&&!isBun&&!isUnsandboxedElectron;globals.fetch=globals.isIsolated?(...args)=>globalThis.fetch(...args):fetch_default;globals.WebSocket=globals.isIsolated?globalThis.WebSocket:WWWebSocket;var globals_default=globals;var exports_constants={};__export(exports_constants,{findItemById:()=>findItemById,UserAgent:()=>UserAgent,Team:()=>Team,StateBufferSize:()=>StateBufferSize,SocialReward:()=>SocialReward,SocialMedia:()=>SocialMedia,ShellStreak:()=>ShellStreak,PlayType:()=>PlayType,Movement:()=>Movement,ItemType:()=>ItemType,GunList:()=>GunList,GunEquipTime:()=>GunEquipTime,GameOptionFlag:()=>GameOptionFlag,GameMode:()=>GameMode,GameAction:()=>GameAction,FramesBetweenSyncs:()=>FramesBetweenSyncs,FirebaseKey:()=>FirebaseKey,CoopState:()=>CoopState,CollectType:()=>CollectType,ChiknWinnerDailyLimit:()=>ChiknWinnerDailyLimit,ChatFlag:()=>ChatFlag,ChallengeType:()=>ChallengeType,ChallengeSubType:()=>ChallengeSubType,BanDuration:()=>BanDuration});var exports_guns={};__export(exports_guns,{SMG:()=>SMG,RPEGG:()=>RPEGG,M24:()=>M24,EggK47:()=>EggK47,DozenGauge:()=>DozenGauge,Cluck9mm:()=>Cluck9mm,CSG1:()=>CSG1,AUG:()=>AUG});var EggK47={ammo:{capacity:30,reload:30,store:240,pickup:30},longReloadTime:205,shortReloadTime:160,weaponName:"EggK-47",internalName:"Eggk47",standardMeshName:"eggk47",damage:30,range:20,rof:3,totalDamage:30,velocity:1.5},DozenGauge={ammo:{capacity:2,reload:2,store:24,pickup:8},longReloadTime:155,shortReloadTime:155,weaponName:"Scrambler",internalName:"Dozen Gauge",standardMeshName:"dozenGauge",damage:8.5,range:8,rof:8,totalDamage:170,velocity:1},CSG1={ammo:{capacity:15,reload:15,store:60,pickup:15},longReloadTime:225,shortReloadTime:165,weaponName:"Free Ranger",internalName:"CSG-1",standardMeshName:"csg1",damage:105,range:50,rof:13,totalDamage:105,velocity:1.75},Cluck9mm={ammo:{capacity:15,reload:15,store:60,pickup:15},longReloadTime:195,shortReloadTime:160,weaponName:"Cluck 9mm",internalName:"Cluck 9mm",standardMeshName:"cluck9mm",damage:26,range:15,rof:4,totalDamage:26,velocity:1},RPEGG={ammo:{capacity:1,reload:1,store:3,pickup:1},longReloadTime:170,shortReloadTime:170,weaponName:"RPEGG",internalName:"Eggsploder",standardMeshName:"rpegg",damage:140,range:45,rof:40,totalDamage:192.5,velocity:0.4},SMG={ammo:{capacity:40,reload:40,store:200,pickup:40},longReloadTime:225,shortReloadTime:190,weaponName:"Whipper",internalName:"SMEGG",standardMeshName:"smg",damage:23,range:20,rof:2,totalDamage:23,velocity:1.25},M24={ammo:{capacity:1,reload:1,store:12,pickup:4},longReloadTime:144,shortReloadTime:144,weaponName:"Crackshot",internalName:"M2DZ",standardMeshName:"m24",damage:170,range:60,rof:15,totalDamage:170,velocity:2},AUG={ammo:{capacity:24,reload:24,store:150,pickup:24},longReloadTime:205,shortReloadTime:160,weaponName:"Tri-Hard",internalName:"AUG",standardMeshName:"aug",damage:32,range:20,rof:15,totalDamage:34,velocity:1.5};var Items=[];var itemsMap=new Map(Items.map((item)=>[item.id,item])),findItemById=(id)=>itemsMap.get(id);var BanDuration={FiveMinutes:0,FifteenMinutes:1,OneHour:2},ChallengeSubType={Killstreak:0,KillWithWeapon:1,MovementDistance:3,Jumping:4,TimePlayed:6,TimeAlive:7,KillWithCondition:8,TotalKills:10,SpatulaKills:10,Collecting:18,FromTheCoop:20,SpecialOffensive:21,WinKOTC:23,KillWithSpatula:23},ChallengeType={Kill:0,Damage:1,Death:2,Movement:3,Collect:4,Time:5,KOTC:6,Spatula:7},ChatFlag={None:0,Pinned:2,Team:4,Mod:254,Server:255},ChiknWinnerDailyLimit=3,CollectType={Ammo:0,Grenade:1},CoopState={Start:0,Score:1,Win:2,Capturing:3,Contested:4,Takeover:5,Abandoned:6,Unclaimed:7},miniCodec=(s,k=42)=>s.split("").map((c)=>String.fromCharCode(c.charCodeAt(0)^k)).join(""),FirebaseKey=miniCodec("kcPKySnz\x1Eyc@aK]\x1Ck\x1EI\x07P\\LsRciZHo@D\x1BXxDd\x1F\x1A"),FramesBetweenSyncs=3,GameAction={Reset:1,Pause:2},GameMode={FFA:0,Team:1,Spatula:2,KOTC:3},GameOptionFlag={Locked:1,NoTeamChange:2,NoTeamShuffle:4},GunEquipTime=13,GunList=[EggK47,DozenGauge,CSG1,RPEGG,SMG,M24,AUG],ItemType={Hat:1,Stamp:2,Primary:3,Secondary:4,Grenade:6,Melee:7},Movement={Forward:1,Backward:2,Left:4,Right:8,Jump:16,Fire:32,Melee:64,Scope:128},PlayType={JoinPublic:0,CreatePrivate:1,JoinPrivate:2},ShellStreak={HardBoiled:1,EggBreaker:2,Restock:4,OverHeal:8,DoubleEggs:16,MiniEgg:32},SocialMedia={Facebook:0,Instagram:1,Tiktok:2,Discord:3,Youtube:4,Twitter:5,Twitch:6},SocialReward={Discord:"rew_1200",Tiktok:"rew_1208",Instagram:"rew_1219",Steam:"rew_1223",Facebook:"rew_1227",Twitter:"rew_1234",Twitch:"rew_twitch_social"},StateBufferSize=256,Team={Blue:1,Red:2},latestChromeVersion=143,latestFirefoxVersion=146,agents=[`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`,`Mozilla/5.0 (X11; Linux x86_64; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`,`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${latestChromeVersion}.0.0.0 Safari/537.36 Edg/${latestChromeVersion}.0.0.0`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:${latestFirefoxVersion}.0) Gecko/20100101 Firefox/${latestFirefoxVersion}.0`],UserAgent=agents[Math.floor(Math.random()*agents.length)];class yolkws{connected=!1;autoReconnect=!1;url="";proxy="";binaryType="";connectionTimeout=5000;errorLogger=(...args)=>console.error(...args);onopen=()=>{};onmessage=()=>{};onclose=()=>{};onerror=()=>{};constructor(url,params={}){if(typeof params!=="object")params={};if(typeof process>"u"&&params.proxy)throw Error("You cannot pass a proxy to a WebSocket in this environment.");if(this.url=url,this.proxy=params.proxy,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger}async tryConnect(tries=1){let url=new URL(this.url),retryOrQuit=async()=>{if(tries===5)return!1;return await this.tryConnect(tries+1)};try{if(this.socket=typeof process>"u"?new globals_default.WebSocket(this.url):new globals_default.WebSocket(this.url,{proxy:this.proxy||null,headers:{"accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.9","cache-control":"no-cache",connection:"Upgrade",origin:url.origin.replace("ws","http"),pragma:"no-cache","user-agent":UserAgent}}),this.binaryType)this.socket.binaryType=this.binaryType}catch(e){return this.errorLogger(`Failed to connect on try ${tries}, trying again...`,e),await retryOrQuit()}if(this.onBeforeConnect)this.onBeforeConnect();return new Promise((resolve)=>{let timeout=setTimeout(async()=>{this.socket.close(),resolve(await retryOrQuit())},this.connectionTimeout),errorListener=async(e)=>{clearTimeout(timeout),this.errorLogger("WebSocket error",e),resolve(await retryOrQuit())};this.socket.addEventListener("open",async()=>{clearTimeout(timeout),this.connected=!0,this.onopen(),this.socket.removeEventListener("error",errorListener),this.socket.addEventListener("message",(messageEvent)=>this.onmessage(messageEvent)),this.socket.addEventListener("close",(closeEvent)=>!this.autoReconnect&&this.onclose(closeEvent)),this.socket.addEventListener("error",(event)=>this.onerror(event)),resolve(!0)}),this.socket.addEventListener("error",errorListener),this.socket.addEventListener("close",()=>{if(this.connected){if(this.connected=!1,this.autoReconnect)setTimeout(async()=>{if(!await this.tryConnect()){if(this.onclose)this.onclose();this.errorLogger("tryConnect: failed to reconnect to",this.url,"after 5 attempts."),this.errorLogger("tryConnect: please check your internet connection & ensure your IP isn't blocked.")}},250)}})})}send(data){return this.socket?.send(data)}close(data){if(!this.socket)return;if(this.autoReconnect=!1,this.socket.terminate)try{this.socket.terminate()}catch{}else this.socket.close(data)}}var socket_default=yolkws;var exports_enums={};__export(exports_enums,{ZoneLeaveReason:()=>ZoneLeaveReason,RedeemCodeError:()=>RedeemCodeError,PathfindError:()=>PathfindError,MatchmakerError:()=>MatchmakerError,LoginError:()=>LoginError,Intents:()=>Intents,GameJoinError:()=>GameJoinError,GameFindError:()=>GameFindError,CleanupLevel:()=>CleanupLevel,ClaimURLError:()=>ClaimURLError,ClaimSocialError:()=>ClaimSocialError,ChicknWinnerError:()=>ChicknWinnerError,ChallengeRerollError:()=>ChallengeRerollError,ChallengeClaimError:()=>ChallengeClaimError,BuyItemError:()=>BuyItemError,APIError:()=>APIError});var APIError={WebSocketConnectFail:"websocket_connect_fail",MissingParams:"missing_params",NetworkFail:"firebase_network_failed",ServicesClosedEarly:"services_closed_early",InternalError:"unknown_error",FirebaseRateLimited:"firebase_rate_limited"},LoginError={...APIError,AccountBanned:"account_banned"},BuyItemError={SessionExpired:"PLAYER_NOT_FOUND",ItemNotFound:"ITEM_NOT_FOUND",ItemAlreadyOwned:"ALREADY_OWNED",CannotAfford:"INSUFFICIENT_FUNDS",InternalError:"UNKNOWN_ERROR"},ChicknWinnerError={OnCooldown:"on_cooldown",HitDailyLimit:"hit_daily_limit",NotAtDailyLimit:"not_at_limit",NotEnoughResetEggs:"not_enough_eggs",SessionExpired:"session_expired",InternalError:"unknown_error"},GameFindError={MissingParams:"missing_params",InvalidRegion:"region_not_in_list",InvalidMode:"mode_not_in_list",InvalidMap:"map_not_in_list",GameNotFound:"game_not_found",SessionExpired:"session_expired",InternalError:"unknown_error"},GameJoinError={MissingParams:"missing_params",InvalidObject:"invalid_game_object",WebSocketConnectFail:"websocket_connect_fail",GameNotFound:"game_not_found",InternalError:"unknown_error"},MatchmakerError={WebSocketConnectFail:"websocket_connect_fail"},Intents={CHALLENGES:1,BOT_STATS:2,PATHFINDING:3,PING:5,COSMETIC_DATA:6,PLAYER_HEALTH:7,PACKET_HOOK:8,LOG_PACKETS:10,SKIP_LOGIN:11,DEBUG_BUFFER:12,NO_AFK_KICK:16,LOAD_MAP:17,OBSERVE_GAME:18,RENEW_SESSION:21,VIP_HIDE_BADGE:22,SIMULATION:23,MANUAL_UPDATE:24,FASTER_RESPAWN:25},RedeemCodeError={SessionExpired:"PLAYER_NOT_FOUND",CurrentlyRedeemingElsewhere:"CODE_DOUBLE_DOUBLE",AlreadyRedeemed:"CODE_PREV_REDEEMED",InvalidCode:"CODE_NOT_FOUND",Ratelimited:"RATE_LIMIT_REACHED",InternalError:"UNKNOWN_ERROR"},ClaimSocialError={SessionExpired:"reward_expired_session",InvalidReward:"REWARD_NOT_FOUND",AlreadyRedeemed:"REWARD_PREV_GIVEN",InternalError:"unknown_error"},ClaimURLError={SessionExpired:"urlRewardParams_expired_session",InvalidReward:"REWARD_NOT_FOUND",AlreadyRedeemed:"REWARD_PREV_GIVEN",InternalError:"unknown_error"},ChallengeRerollError={SessionExpired:"challengeRerollSlot_expired_session",ChallengeNotFound:"challenge_not_found",ChallengeNotAssigned:"challenge_reroll_not_found",NotEnoughEggs:"insufficient_eggs",InternalError:"unknown_error"},ChallengeClaimError={SessionExpired:"challengeClaimReward_expired_session",ChallengeNotFound:"challenge_claim_not_found",ChallengeNotCompleted:"challenge_not_completed",InternalError:"unknown_error"},PathfindError={NoPathFound:"no_path_found",PathTooShort:"path_too_short"},ZoneLeaveReason={Despawned:"despawned",Killed:"killed",WalkedOut:"exited",RoundEnded:"round_ended"},CleanupLevel={None:0,Partial:1,Full:2};var exports_util2={};__export(exports_util2,{isDoubleEggWeeknd:()=>isDoubleEggWeeknd,initKotcZones:()=>initKotcZones,fetchMap:()=>fetchMap,createGun:()=>createGun,createError:()=>createError});var createGun=(baseGun)=>{let gun=structuredClone(baseGun);return gun.ammo.rounds=gun.ammo.capacity,gun.ammo.storeMax=gun.ammo.store,gun},createError=(errorEnum)=>({ok:!1,error:errorEnum}),attemptFetch=async(url,options={},retries=3,backoff=300)=>{try{let response=await fetch(url,options);if(!response.ok)throw Error(`failed to fetch map; status: ${response.status}`);return response}catch(error){if(retries>0)return await new Promise((res)=>setTimeout(res,backoff)),attemptFetch(url,options,retries-1,backoff*2);else throw error}},fetchMap=async(name,hash)=>{if(typeof process<"u"){let{existsSync,mkdirSync,readFileSync,writeFileSync}=process.getBuiltinModule("node:fs"),{join}=process.getBuiltinModule("node:path"),{homedir}=process.getBuiltinModule("node:os"),yolkbotCache=join(homedir(),".yolkbot");if(!existsSync(yolkbotCache))mkdirSync(yolkbotCache);let mapCache=join(yolkbotCache,"maps");if(!existsSync(mapCache))mkdirSync(mapCache);let safeName=String(name).replace(/[^a-z0-9_-]/gi,"_"),safeHash=String(hash).replace(/[^a-z0-9_-]/gi,"_"),mapFile=join(mapCache,`${safeName}-${safeHash}.json`);if(existsSync(mapFile))return JSON.parse(readFileSync(mapFile,"utf-8"));let data2=await(await attemptFetch(`https://x.yolkbot.xyz/data/maps/full/${name}.json?${hash}`)).json();return writeFileSync(mapFile,JSON.stringify(data2,null,4),{flag:"w+"}),data2}return await(await attemptFetch(`https://x.yolkbot.xyz/data/maps/full/${name}.json?${hash}`)).json()},initKotcZones=(meshData)=>{let len2=meshData.length;if(!len2)return[];let minX=1/0,minY=1/0,minZ=1/0,maxX=-1/0,maxY=-1/0,maxZ=-1/0;for(let i2=0;i2<len2;i2++){let{x,y,z}=meshData[i2];if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;if(z<minZ)minZ=z;if(z>maxZ)maxZ=z}let sizeX=maxX-minX+1|0,sizeY=maxY-minY+1|0,sizeZ=maxZ-minZ+1|0,strideY=sizeX,strideZ=sizeX*sizeY,cellIndex=new Int32Array(sizeX*sizeY*sizeZ).fill(-1),zoneIds=new Uint16Array(len2),queue=new Uint32Array(len2);for(let i2=0;i2<len2;i2++){let{x,y,z}=meshData[i2];cellIndex[(x-minX|0)+(y-minY|0)*strideY+(z-minZ|0)*strideZ]=i2}let zones=[],zoneId=0;for(let i2=0;i2<len2;i2++){if(zoneIds[i2])continue;let zone=++zoneId,activeZone=[],head=0,tail=0;queue[tail++]=i2,zoneIds[i2]=zone;while(head<tail){let idx=queue[head++],cell=meshData[idx];cell.zone=zone,activeZone[activeZone.length]=cell;let{x,y,z}=cell,flatIdx=(x-minX|0)+(y-minY|0)*strideY+(z-minZ|0)*strideZ,nIdx;if(x>minX&&(nIdx=cellIndex[flatIdx-1])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(x<maxX&&(nIdx=cellIndex[flatIdx+1])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(y>minY&&(nIdx=cellIndex[flatIdx-strideY])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(y<maxY&&(nIdx=cellIndex[flatIdx+strideY])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(z>minZ&&(nIdx=cellIndex[flatIdx-strideZ])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx;if(z<maxZ&&(nIdx=cellIndex[flatIdx+strideZ])!==-1&&!zoneIds[nIdx])zoneIds[nIdx]=zone,queue[tail++]=nIdx}zones[zones.length]=activeZone}return zones},isDoubleEggWeeknd=()=>{let day=new Date().getUTCDay();return day>=5&&new Date().getUTCHours()>=20||day===6||day===0};var baseHeaders={origin:"https://shellshock.io","user-agent":typeof process>"u"?null:UserAgent,"x-client-version":"Chrome/JsCore/9.17.2/FirebaseCore-web","x-firebase-locale":"en"};class API{errorLogger=(...args)=>console.error(...args);idToken=null;constructor(params={}){if(this.proxy=params.proxy,this.instance=params.instance||"shellshock.io",this.protocol=params.protocol||"wss",this.customKey=params.customKey||null,this.connectionTimeout=params.connectionTimeout||5000,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger}queryServices=async(request)=>{let ws=new socket_default(`${this.protocol}://${this.instance}/services/`,{proxy:this.proxy,errorLogger:this.errorLogger});if(ws.connectionTimeout=this.connectionTimeout,!await ws.tryConnect()||ws.socket.readyState!==1)return createError(APIError.WebSocketConnectFail);return new Promise((resolve)=>{let resolved=!1;ws.onmessage=(mes)=>{resolved=!0;try{let resp=JSON.parse(mes.data);resolve({ok:!0,...resp})}catch(e){this.errorLogger("queryServices: error! command:",request.cmd,"and data:",request,e),resolve(createError(APIError.InternalError))}ws.close()},ws.onerror=(error)=>{if(resolved)return;resolved=!0,this.errorLogger("queryServices: websocket error! command:",request.cmd,"and data:",request,"error:",error),resolve(createError(APIError.InternalError))},ws.onclose=()=>{if(resolved)return;resolved=!0,this.errorLogger("queryServices: services closed before sending back message"),this.errorLogger("queryServices: command:",request.cmd,"and data:",request),resolve(createError(APIError.ServicesClosedEarly))},ws.send(JSON.stringify(request))})};#authWithEmailPass=async(email,password,customServicesParams,endpoint)=>{if(!email||!password)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:${endpoint}?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({email,password,returnSecureToken:!0}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("authWithEmailPass: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ERR_BAD_REQUEST")return this.errorLogger("authWithEmailPass: bad request",body||error),createError(APIError.InternalError);else if(error.code==="ECONNREFUSED")return this.errorLogger("authWithEmailPass: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("authWithEmailPass: unknown error:",email,error),createError(APIError.InternalError)}if(!body.idToken)return this.errorLogger("authWithEmailPass: missing idToken",body),createError(APIError.InternalError);this.idToken=body.idToken;let servicesQuery=await this.queryServices({cmd:"auth",firebaseToken:body.idToken,...customServicesParams});return servicesQuery.ok?{firebase:body,...servicesQuery}:servicesQuery};createAccount=(email,password,customServicesParams)=>this.#authWithEmailPass(email,password,customServicesParams,"signUp");loginWithCredentials=(email,password,customServicesParams)=>this.#authWithEmailPass(email,password,customServicesParams,"signInWithPassword");loginWithRefreshToken=async(refreshToken,customServicesParams)=>{if(!refreshToken)return createError(APIError.MissingParams);let formData=new URLSearchParams;formData.append("grant_type","refresh_token"),formData.append("refresh_token",refreshToken);let body;try{body=await(await globals_default.fetch(`https://securetoken.googleapis.com/v1/token?key=${this.customKey||FirebaseKey}`,{method:"POST",body:formData.toString(),headers:{...baseHeaders,"content-type":"application/x-www-form-urlencoded"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("loginWithRefreshToken: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("loginWithRefreshToken: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("loginWithRefreshToken: unknown error:",body,error),createError(APIError.InternalError)}if(!body.id_token)return this.errorLogger("loginWithRefreshToken: missing idToken",body),createError(APIError.InternalError);this.idToken=body.id_token;let response=await this.queryServices({cmd:"auth",firebaseToken:body.id_token,...customServicesParams});return response.ok?{firebase:body,...response}:response};loginAnonymously=async(customServicesParams)=>{let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({returnSecureToken:!0}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="ECONNREFUSED")return this.errorLogger("loginAnonymously: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("loginAnonymously: unknown error:",body,error),createError(APIError.InternalError)}if(!body.idToken)return this.errorLogger("loginAnonymously: missing idToken",body),createError(APIError.InternalError);this.idToken=body.idToken;let query=await this.queryServices({cmd:"auth",firebaseToken:body.idToken,...customServicesParams});return query.ok?{firebase:body,...query}:query};sendEmailVerification=async(idToken=this.idToken)=>{if(!idToken)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({requestType:"VERIFY_EMAIL",idToken}),headers:{...baseHeaders,"content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("sendEmailVerification: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("sendEmailVerification: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("sendEmailVerification: unknown error:",idToken,error),createError(APIError.InternalError)}if(body.kind!=="identitytoolkit#GetOobConfirmationCodeResponse")return this.errorLogger("sendEmailVerification: the game sent an invalid response",body),createError(APIError.InternalError);return{ok:!0,email:body.email}};verifyOobCode=async(oobCode)=>{if(!oobCode)return createError(APIError.MissingParams);let body;try{body=await(await globals_default.fetch(`https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key=${this.customKey||FirebaseKey}`,{method:"POST",body:JSON.stringify({oobCode}),headers:{...baseHeaders,"x-client-version":"Chrome/JsCore/3.7.5/FirebaseCore-web",referer:"https://shellshockio-181719.firebaseapp.com/","content-type":"application/json"},proxy:this.proxy})).json()}catch(error){if(error.code==="auth/too-many-requests")return createError(APIError.FirebaseRateLimited);else if(error.code==="auth/network-request-failed")return this.errorLogger("verifyOobCode: network error",body||error),createError(APIError.NetworkFail);else if(error.code==="ECONNREFUSED")return this.errorLogger("verifyOobCode: connection refused",body||error),createError(APIError.NetworkFail);return this.errorLogger("verifyOobCode: unknown error:",oobCode,error),createError(APIError.InternalError)}if(!body.emailVerified)return this.errorLogger("verifyOobCode: the game sent an invalid response",body),createError(APIError.InternalError);return{ok:!0,email:body.email}}}var api_default=API;class CommIn{static buffer;static idx;static init(buf){this.buffer=new Uint8Array(buf),this.idx=0}static isMoreDataAvailable(){return this.buffer.length-this.idx}static unPackInt8U(){return this.buffer[this.idx++]}static unPackInt8(){return this.unPackInt8U()<<24>>24}static unPackInt16U(){let i2=this.idx;return this.idx+=2,this.buffer[i2]|this.buffer[i2+1]<<8}static unPackInt24U(){let i2=this.idx;return this.idx+=3,this.buffer[i2]|this.buffer[i2+1]<<8|this.buffer[i2+2]<<16}static unPackInt32U(){let i2=this.idx;return this.idx+=4,(this.buffer[i2]|this.buffer[i2+1]<<8|this.buffer[i2+2]<<16|this.buffer[i2+3]<<24)>>>0}static unPackInt16(){return this.unPackInt16U()<<16>>16}static unPackInt32(){return this.unPackInt32U()<<0}static unPackRadU(){return this.unPackInt24U()/2097152}static unPackRad(){return this.unPackInt16U()/8192-Math.PI}static unPackFloat(){return this.unPackInt16()/256}static unPackDouble(){return this.unPackInt32()/1048576}static unPackString(maxLen){maxLen=maxLen||255;let len2=Math.min(this.unPackInt8U(),maxLen);return this.unPackStringHelper(len2)}static unPackLongString(maxLen){maxLen=maxLen||16383;let len2=Math.min(this.unPackInt16U(),maxLen);return this.unPackStringHelper(len2)}static unPackStringHelper(len2){if(this.isMoreDataAvailable()<len2*2)return"";let chars=[];for(let i2=0;i2<len2;i2++){let c=this.unPackInt16U();if(c>0)chars.push(String.fromCodePoint(c))}return chars.join("")}}var CommIn_default=CommIn;class CommOut{constructor(size=16384){this.idx=0,this.arrayBuffer=new ArrayBuffer(size),this.view=new DataView(this.arrayBuffer),this.buffer=new Uint8Array(this.arrayBuffer)}send(ws2){let b2=new Uint8Array(this.arrayBuffer,0,this.idx);ws2.send(b2)}packInt8(val){this.view.setInt8(this.idx,val),this.idx++}packInt16(val){this.view.setInt16(this.idx,val,!0),this.idx+=2}packInt24(val){this.view.setInt16(this.idx,val&65535,!0),this.view.setInt8(this.idx+2,val>>16&255),this.idx+=3}packInt32(val){this.view.setInt32(this.idx,val,!0),this.idx+=4}packRadU(val){this.packInt24(val*2097152)}packRad(val){this.packInt16((val+Math.PI)*8192)}packFloat(val){this.packInt16(val*256)}packDouble(val){this.packInt32(val*1048576)}packString(str){if(typeof str!=="string")str="";if(str.length>255)console.trace("truncated packString to fit int8 (shell protocol); this should not happen"),console.log("report this issue at https://yolkbot.xyz/community"),str=str.slice(0,255);this.packInt8(str.length);for(let i2=0;i2<str.length;i2++)this.packInt16(str.charCodeAt(i2))}packLongString(str){if(typeof str!=="string")str="";this.packInt16(str.length);for(let i2=0;i2<str.length;i2++)this.packInt16(str.charCodeAt(i2))}}var CommOut_default=CommOut;var CloseCode={gameNotFound:4000,gameFull:4001,badName:4002,mainMenu:4003,gameIdleExceeded:4004,corruptedLoginData0:4005,corruptedLoginData1:4006,corruptedLoginData2:4007,corruptedLoginData3:4008,corruptedLoginData4:4009,corruptedLoginData5:4010,gameMaxPlayersExceeded:4011,gameDestroyUser:4012,joinGameOutOfOrder:4013,gameShuttingDown:4014,readyBeforeReady:4015,booted:4016,gameErrorOnUserSocket:4017,uuidNotFound:4018,sessionNotFound:4019,clusterFullCpu:4020,clusterFullMem:4021,noClustersAvailable:4022,locked:4023},CloseCode_default=CloseCode;var CommCode={swapWeapon:0,joinGame:1,refreshGameState:2,spawnItem:3,observeGame:4,ping:5,bootPlayer:6,banPlayer:7,loginRequired:8,gameLocked:9,reportPlayer:10,banned:11,createPrivateGame:12,switchTeam:13,changeCharacter:14,pause:15,gameOptions:16,gameAction:17,requestGameOptions:18,gameJoined:19,socketReady:20,addPlayer:21,removePlayer:22,fire:23,melee:24,throwGrenade:25,info:26,eventModifier:27,hitThem:28,hitMe:29,collectItem:30,chlgPlayerRerollInGame:31,playerInGameReward:32,playerRewards:33,chat:34,syncThem:35,syncAmmo:36,die:37,beginShellStreak:38,endShellStreak:39,startReload:40,announcement:41,updateBalance:42,reload:43,respawn:44,respawnDenied:45,pong:46,clientReady:47,requestRespawn:48,joinPublicGame:49,joinPrivateGame:50,switchTeamFail:51,expireUpgrade:52,metaGameState:53,syncMe:54,explode:55,keepAlive:56,musicInfo:57,hitMeHardBoiled:58,playerInfo:59,challengeCompleted:60,eggOrgGameStats:61},CommCode_default=CommCode;var RSocialMedia=Object.fromEntries(Object.entries(SocialMedia).map(([key,value])=>[value,key.toLowerCase()]));class GamePlayer{constructor(playerData,activeZone=null){if(this.id=playerData.id,this.uniqueId=playerData.uniqueId,this.name=playerData.name,this.safeName=playerData.safeName,this.team=playerData.team,this.playing=playerData.playing,this.socials=[],typeof playerData.social==="string"&&playerData.social.length)try{let parsed=JSON.parse(playerData.social);if(Array.isArray(parsed))this.socials=parsed}catch(e){console.error("error parsing socials:",e),console.error("report this issue at https://yolkbot.xyz/community")}if(this.socials.forEach((social)=>social.type=RSocialMedia[social.id]),this.isVip=playerData.upgradeProductId>0,this.showBadge=!playerData.hideBadge||!1,this.streak=playerData.score,this.streakRewards=Object.values(ShellStreak).filter((streak)=>playerData.activeShellStreaks&streak),this.scale=this.streakRewards.includes(ShellStreak.MiniEgg)?0.5:1,this.position={x:playerData.x,y:playerData.y,z:playerData.z},this.jumping=playerData.$controlKeys&Movement.Jump,this.scoping=playerData.$controlKeys&Movement.Scope,this.climbing=!1,this.view={yaw:playerData.yaw,pitch:playerData.pitch},this.updateKotcZone(activeZone),this.character={eggColor:playerData.shellColor,primaryGun:playerData.primaryWeaponItem,secondaryGun:playerData.secondaryWeaponItem,stamp:playerData.stampItem,hat:playerData.hatItem,grenade:playerData.grenadeItem,melee:playerData.meleeItem,stampPos:{x:playerData.stampPosX,y:playerData.stampPosY}},this.stats={totalKills:playerData.totalKills,totalDeaths:playerData.totalDeaths,bestStreak:playerData.bestStreak},this.activeGun=playerData.weaponIdx,this.selectedGun=playerData.charClass,this.weapons=[],this.character.primaryGun)this.weapons[0]=createGun(GunList[this.selectedGun]),this.weapons[1]=createGun(Cluck9mm);this.grenades=1,this.hp=playerData.hp,this.hpShield=0,this.spawnShield=playerData.shield,this.randomSeed=0}updateKotcZone(activeZone){if(!activeZone)return this.inKotcZone=!1;let fx=Math.floor(this.position.x),fy=Math.floor(this.position.y),fz=Math.floor(this.position.z);this.inKotcZone=activeZone.some((coordSets)=>coordSets.x===fx&&coordSets.y===fy&&coordSets.z===fz)&&this.playing}}var GamePlayer_default=GamePlayer;var mod=(n,m)=>(n%m+m)%m,PI2=Math.PI*2,setPrecision=(value)=>Math.round(value*8192)/8192,calculateYaw=(pos)=>setPrecision(mod(Math.atan2(-pos.x,-pos.z),PI2)),calculatePitch=(pos)=>setPrecision(Math.atan2(pos.y,Math.hypot(pos.x,pos.z)));class LookAtPosDispatch{constructor(pos){this.pos=pos}validate(){return this.pos&&Number.isFinite(this.pos.x)&&Number.isFinite(this.pos.y)&&Number.isFinite(this.pos.z)}check(bot){return bot.me.playing}execute(bot){let directionVector={x:this.pos.x-bot.me.position.x,y:this.pos.y-bot.me.position.y,z:this.pos.z-bot.me.position.z},yaw=calculateYaw(directionVector),pitch=calculatePitch(directionVector);bot.state.yaw=yaw,bot.state.pitch=pitch}}var LookAtPosDispatch_default=LookAtPosDispatch;class MovementDispatch{constructor(inputKeys){if(typeof inputKeys==="number")this.inputKeys=inputKeys;else if(Array.isArray(inputKeys))this.inputKeys=inputKeys.reduce((a,b)=>a|b,0)}validate(){if(typeof this.inputKeys!=="number")return!1;if(this.inputKeys&Movement.Forward&&this.inputKeys&Movement.Backward)return!1;if(this.inputKeys&Movement.Left&&this.inputKeys&Movement.Right)return!1;return!0}check(bot){return bot.me.playing}execute(bot){bot.state.controlKeys=this.inputKeys}}var MovementDispatch_default=MovementDispatch;class BanPlayerDispatch{constructor(uniqueId,duration,reason=""){this.uniqueId=uniqueId,this.duration=duration,this.reason=reason}validate(bot){if(typeof this.uniqueId!=="string"||typeof this.reason!=="string")return!1;if(typeof this.duration!=="number"||!Object.values(BanDuration).some((d)=>this.duration===d))return!1;if(!(bot.account.adminRoles&4))return!1;return!0}check(){return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.banPlayer),out.packString(this.uniqueId),out.packString(this.reason),out.packInt8(this.duration),out.send(bot.game.socket)}}var BanPlayerDispatch_default=BanPlayerDispatch;class BootPlayerDispatch{constructor(uniqueId){this.uniqueId=uniqueId}validate(bot){return typeof this.uniqueId==="string"&&bot.game.isGameOwner&&Object.values(bot.players).find((player)=>player.uniqueId===this.uniqueId)}check(){return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.bootPlayer),out.packString(this.uniqueId),out.send(bot.game.socket)}}var BootPlayerDispatch_default=BootPlayerDispatch;class ChatDispatch{constructor(msg){this.msg=msg}validate(bot){if(typeof this.msg!=="string")return!1;if(this.msg.length<1||this.msg.length>64)return!1;if(!bot.game.isPrivate&&!bot.account.emailVerified&&!bot.account.isAged&&!bot.account.isCG)return!1;return!0}check(bot){if(!bot.state?.inGame)return!1;if(!bot.game.isPrivate&&!bot.account.adminRoles&&bot.state.chatLines>=2)return!1;return!0}execute(bot){bot.state.chatLines++;let out=new CommOut_default;out.packInt8(CommCode_default.chat),out.packString(this.msg),out.send(bot.game.socket)}}var ChatDispatch_default=ChatDispatch;class FireDispatch{constructor(amount){this.amount=amount||1}validate(){return this.amount>=1}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee&&bot.me.weapons[bot.me.activeGun].ammo.rounds>=this.amount}execute(bot){bot.state.shotsFired+=this.amount||1}}var FireDispatch_default=FireDispatch;var gravityScale=Array.from({length:4},(_,i2)=>(i2+1)*0.25),damageScale=Array.from({length:9},(_,i2)=>i2*0.25),regenScale=Array.from({length:17},(_,i2)=>i2*0.25),whichever=(arg1,arg2)=>typeof arg1>"u"?arg2:arg1;class GameOptionsDispatch{constructor(changes){this.changes=changes}#constructFinalOutput(bot){let output={};if(output.gravity=whichever(this.changes.gravity,bot.game.options.gravity),output.damage=whichever(this.changes.damage,bot.game.options.damage),output.healthRegen=whichever(this.changes.healthRegen,bot.game.options.healthRegen),output.locked=whichever(this.changes.locked,bot.game.options.locked),output.noTeamChange=whichever(this.changes.noTeamChange,bot.game.options.noTeamChange),output.noTeamShuffle=whichever(this.changes.noTeamShuffle,bot.game.options.noTeamShuffle),output.weaponsDisabled=[whichever(this.changes.disableEggk,bot.game.options.weaponsDisabled[0]),whichever(this.changes.disableScrambler,bot.game.options.weaponsDisabled[1]),whichever(this.changes.disableFreeRanger,bot.game.options.weaponsDisabled[2]),whichever(this.changes.disableRPG,bot.game.options.weaponsDisabled[3]),whichever(this.changes.disableWhipper,bot.game.options.weaponsDisabled[4]),whichever(this.changes.disableCrackshot,bot.game.options.weaponsDisabled[5]),whichever(this.changes.disableTriHard,bot.game.options.weaponsDisabled[6])],this.changes.toDisable&&Array.isArray(this.changes.toDisable))this.changes.toDisable.forEach((idx)=>output.weaponsDisabled[idx]=!0);if(this.changes.toEnable&&Array.isArray(this.changes.toEnable))this.changes.toEnable.forEach((idx)=>output.weaponsDisabled[idx]=!1);if(this.changes.rawWeaponsDisabled&&Array.isArray(this.changes.rawWeaponsDisabled)&&this.changes.rawWeaponsDisabled.length===7)output.weaponsDisabled=this.changes.rawWeaponsDisabled.map((v)=>!!v);return output.mustUseSecondary=output.weaponsDisabled.every((v)=>v),output}validate(bot){let wouldBe=this.#constructFinalOutput(bot);if(!gravityScale.includes(wouldBe.gravity))return!1;if(!damageScale.includes(wouldBe.damage))return!1;if(!regenScale.includes(wouldBe.healthRegen))return!1;if(typeof wouldBe.locked!=="number"&&typeof wouldBe.locked!=="boolean")return!1;if(typeof wouldBe.noTeamChange!=="number"&&typeof wouldBe.noTeamChange!=="boolean")return!1;if(typeof wouldBe.noTeamShuffle!=="number"&&typeof wouldBe.noTeamShuffle!=="boolean")return!1;if(!Array.isArray(wouldBe.weaponsDisabled))return!1;if(wouldBe.weaponsDisabled.length!==7)return!1;if(wouldBe.weaponsDisabled.some((weapon)=>typeof weapon!=="number"&&typeof weapon!=="boolean"))return!1;return!0}check(bot){return bot.game.isGameOwner}execute(bot){bot.game.options=this.#constructFinalOutput(bot),bot.updateGameOptions()}}var GameOptionsDispatch_default=GameOptionsDispatch;class GoToAmmoDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.collectibles[0].length}execute(bot){let minDistance=2000,closestAmmo=null;for(let ammo of bot.game.collectibles[0]){let dx=ammo.x-bot.me.position.x,dy=ammo.y-bot.me.position.y,dz=ammo.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestAmmo=ammo}if(!closestAmmo)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestAmmo),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToAmmoDispatch_default=GoToAmmoDispatch;class GoToCoopDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.kotc.zoneIdx&&bot.game.kotc.activeZone}execute(bot){let minDistance=20000,closestZone=null;for(let zoneCoords of bot.game.kotc.activeZone){let dx=zoneCoords.x-bot.me.position.x,dy=zoneCoords.y-bot.me.position.y,dz=zoneCoords.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestZone=zoneCoords}if(!closestZone)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestZone),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToCoopDispatch_default=GoToCoopDispatch;class GoToGrenadeDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.collectibles[1].length}execute(bot){let minDistance=2000,closestGrenade=null;for(let grenade of bot.game.collectibles[1]){let dx=grenade.x-bot.me.position.x,dy=grenade.y-bot.me.position.y,dz=grenade.z-bot.me.position.z,distance=Math.sqrt(dx*dx+dy*dy+dz*dz);if(distance<minDistance)minDistance=distance,closestGrenade=grenade}if(!closestGrenade)return;let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(closestGrenade),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToGrenadeDispatch_default=GoToGrenadeDispatch;class GoToPlayerDispatch{idOrName;constructor(idOrName){this.idOrName=idOrName}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(bot){return bot.intents.includes(Intents.PATHFINDING)&&(typeof this.idOrName==="string"||typeof this.idOrName==="number")}check(bot){if(!bot.me.playing)return!1;let target=this.$grabPlayer(bot);return target&&target.playing&&target.position&&Number.isFinite(target.position.x)}execute(bot){let target=this.$grabPlayer(bot),myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(target.position),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToPlayerDispatch_default=GoToPlayerDispatch;class GoToSpatulaDispatch{validate(bot){return bot.intents.includes(Intents.PATHFINDING)}check(bot){return bot.me.playing&&bot.game.spatula&&bot.game.spatula.coords&&Number.isFinite(bot.game.spatula.coords.x)}execute(bot){let myNode=bot.pathing.nodeList.atObject(bot.me.position),targetNode=bot.pathing.nodeList.atObject(bot.game.spatula.coords),path=bot.pathing.astar.path(myNode,targetNode);if(!path)return bot.$emit("pathfindError",PathfindError.NoPathFound);if(path.length<2)return bot.$emit("pathfindError",PathfindError.PathTooShort);bot.pathing.activePath=path,bot.pathing.activeNode=bot.pathing.activePath[1],bot.pathing.activeNodeIdx=1}}var GoToSpatulaDispatch_default=GoToSpatulaDispatch;var mod2=(n,m)=>(n%m+m)%m,PI22=Math.PI*2,setPrecision2=(value)=>Math.round(value*8192)/8192,calculateYaw2=(pos)=>setPrecision2(mod2(Math.atan2(-pos.x,-pos.z),PI22)),calculatePitch2=(pos)=>setPrecision2(Math.atan2(pos.y,Math.hypot(pos.x,pos.z)));class LookAtDispatch{idOrName;constructor(idOrName){this.idOrName=idOrName}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(){return typeof this.idOrName==="string"||typeof this.idOrName==="number"}check(bot){if(!bot.me.playing)return!1;let target=this.$grabPlayer(bot);return target&&target.playing&&target.position&&Number.isFinite(target.position.x)}execute(bot){let target=this.$grabPlayer(bot),directionVector={x:target.position.x-bot.me.position.x,y:target.position.y-bot.me.position.y-0.05,z:target.position.z-bot.me.position.z},yaw=calculateYaw2(directionVector),pitch=calculatePitch2(directionVector);bot.state.yaw=yaw,bot.state.pitch=pitch}}var LookAtDispatch_default=LookAtDispatch;class MeleeDispatch{validate(){return!0}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.melee),out.send(bot.game.socket),bot.state.usingMelee=!0,setTimeout(()=>{bot.state.usingMelee=!1,bot.state.swappingGun=!0,setTimeout(()=>{bot.state.swappingGun=!1},0.5*GunEquipTime)},566.6666666666667)}}var MeleeDispatch_default=MeleeDispatch;class PauseDispatch{validate(){return!0}check(bot){return bot.me.playing}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.pause),out.send(bot.game.socket),setTimeout(()=>bot.me.playing=!1,3000)}}var PauseDispatch_default=PauseDispatch;class ReloadDispatch{validate(){return!0}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee&&bot.me.weapons[bot.me.activeGun].ammo?.rounds<bot.me.weapons[bot.me.activeGun].ammo?.capacity&&bot.me.weapons[bot.me.activeGun].ammo?.store>0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.reload),out.send(bot.game.socket);let playerActiveWeapon=bot.me.weapons[bot.me.activeGun],isEmpty=playerActiveWeapon.ammo.rounds<1;bot.$emit("playerStartReload",bot.me,playerActiveWeapon),bot.state.reloading=!0,setTimeout(()=>{if(!bot.me||bot.hasQuit)return;bot.state.reloading=!1;let latestWeapon=bot.me.weapons[bot.me.activeGun];if(latestWeapon.ammo){let maxLoad=Math.min(latestWeapon.ammo.capacity,latestWeapon.ammo.reload),needed=Math.max(0,maxLoad-latestWeapon.ammo.rounds),newRounds=Math.min(needed,latestWeapon.ammo.store);latestWeapon.ammo.rounds+=newRounds,latestWeapon.ammo.store-=newRounds}bot.$emit("playerEndReload",bot.me,latestWeapon)},isEmpty?playerActiveWeapon.longReloadTime:playerActiveWeapon.shortReloadTime)}}var ReloadDispatch_default=ReloadDispatch;class ReportPlayerDispatch{constructor(idOrName,reasons={}){if(this.idOrName=idOrName,this.reasons=[!!reasons.cheating,!!reasons.harassment,!!reasons.offensive,!!reasons.other],!this.reasons.includes(!0))this.reasons[3]=!0;for(let i2=0;i2<this.reasons.length;i2++)if(this.reasons[i2]===!0)this.reasonInt|=1<<i2}$grabPlayer(bot){return bot.players[this.idOrName.toString()]||Object.values(bot.players).find((player)=>player.name===this.idOrName.toString())}validate(){if(typeof this.idOrName!=="string"&&typeof this.idOrName!=="number")return!1;if(this.reasons.every((reason)=>reason===!1))return!1;return!0}check(bot){if(!bot.state.inGame)return!1;return!!this.$grabPlayer(bot)}execute(bot){let target=this.$grabPlayer(bot),out=new CommOut_default;out.packInt8(CommCode_default.reportPlayer),out.packString(target.uniqueId),out.packInt8(this.reasonInt),out.send(bot.game.socket)}}var ReportPlayerDispatch_default=ReportPlayerDispatch;class ResetGameDispatch{validate(){return!0}check(bot){return bot.game.isGameOwner}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.gameAction),out.packInt8(GameAction.Reset),out.send(bot.game.socket)}}var ResetGameDispatch_default=ResetGameDispatch;var isDefault=(itemId)=>findItemById(itemId)&&findItemById(itemId).unlock==="default",isType=(itemId,type)=>findItemById(itemId)&&findItemById(itemId).item_type_id===type;class SaveLoadoutDispatch{constructor(opts){this.changes={classIdx:opts.gunId,hatId:opts.hatId,stampId:opts.stampId,grenadeId:opts.grenadeId,meleeId:opts.meleeId,colorIdx:opts.eggColor,primaryId:opts.primaryIds,secondaryId:opts.secondaryIds},this.changes=Object.fromEntries(Object.entries(this.changes).filter(([,v])=>typeof v<"u"))}validate(bot){let load=this.changes;if(load.colorIdx&&load.colorIdx>=7&&!bot.account.vip)return!1;if(load.colorIdx&&load.colorIdx>=14)return!1;if(isType(load.hatId,ItemType.Hat)&&!isDefault(load.hatId)&&!bot.account.ownedItemIds.includes(load.hatId))return!1;if(isType(load.stampId,ItemType.Stamp)&&!isDefault(load.stampId)&&!bot.account.ownedItemIds.includes(load.stampId))return!1;if(isType(load.grenadeId,ItemType.Grenade)&&!isDefault(load.grenadeId)&&!bot.account.ownedItemIds.includes(load.grenadeId))return!1;if(isType(load.meleeId,ItemType.Melee)&&!isDefault(load.meleeId)&&!bot.account.ownedItemIds.includes(load.meleeId))return!1;if(typeof load.classIdx==="number"&&(load.classIdx>6||load.classIdx<0))return!1;if(this.changes.primaryId)for(let i2=0;i2<7;i2++){let testingId=this.changes.primaryId[i2];if(!isType(testingId,ItemType.Primary)||!isDefault(testingId)&&!bot.account.ownedItemIds.includes(testingId))return!1}if(this.changes.secondaryId)for(let i2=0;i2<7;i2++){let testingId=this.changes.secondaryId[i2];if(!isType(testingId,ItemType.Secondary)||!isDefault(testingId)&&!bot.account.ownedItemIds.includes(testingId))return!1}return!0}check(bot){return!bot.me.playing}execute(bot){if(bot.me&&typeof this.changes.classIdx<"u"&&this.changes.classIdx!==bot.me.selectedGun)bot.me.weapons[0]=createGun(GunList[this.changes.classIdx]);bot.state.weaponIdx=this.changes.classIdx??bot.state.weaponIdx;let loadout={...bot.account.loadout,...this.changes},saveLoadout=bot.api.queryServices({cmd:"saveLoadout",save:!0,firebaseId:bot.account.firebaseId,sessionId:bot.account.sessionId,loadout});if(bot.account.loadout=loadout,bot.me)saveLoadout.then(()=>{if(bot.state.inGame){let out=new CommOut_default;out.packInt8(CommCode_default.changeCharacter),out.packInt8(this.changes?.classIdx??bot.me.selectedGun),out.send(bot.game.socket)}let findCosmetics=bot.intents.includes(Intents.COSMETIC_DATA);Object.entries(this.changes).forEach(([changeKey,changeValue])=>{if(changeKey==="classIdx")bot.me.selectedGun=changeValue;else if(changeKey==="hatId")bot.me.character.hat=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="stampId")bot.me.character.stamp=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="grenadeId")bot.me.character.grenade=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="meleeId")bot.me.character.melee=findCosmetics?findItemById(changeValue):changeValue;else if(changeKey==="colorIdx")bot.me.character.eggColor=changeValue;else if(changeKey==="primaryId")bot.me.character.primaryGun=findCosmetics?findItemById(changeValue[bot.me.selectedGun]):changeValue;else if(changeKey==="secondaryId")bot.me.character.secondaryGun=findCosmetics?findItemById(changeValue[bot.me.selectedGun]):changeValue})})}}var SaveLoadoutDispatch_default=SaveLoadoutDispatch;class SpawnDispatch{validate(){return!0}check(bot){let respawnTime=bot.intents.includes(Intents.FASTER_RESPAWN)?5000:6000;if(bot.me.playing)return!1;if(bot.intents.includes(Intents.OBSERVE_GAME))return!1;if(bot.lastDeathTime>0&&bot.lastDeathTime+respawnTime>Date.now())return!1;return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.requestRespawn),out.send(bot.game.socket),bot.state.buffer=[]}}var SpawnDispatch_default=SpawnDispatch;class SwapWeaponDispatch{constructor(manualWeapon){this.manualWeapon=manualWeapon}validate(){return[0,1].includes(this.manualWeapon)||typeof this.manualWeapon>"u"}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let chosenWeapon=+!bot.me.activeGun;if(typeof this.manualWeapon==="number")chosenWeapon=this.manualWeapon;bot.me.activeGun=chosenWeapon;let out=new CommOut_default;out.packInt8(CommCode_default.swapWeapon),out.packInt8(bot.me.activeGun),out.send(bot.game.socket)}}var SwapWeaponDispatch_default=SwapWeaponDispatch;class SwitchTeamDispatch{validate(){return!0}check(bot){if(!bot.state.inGame||bot.me.playing)return!1;if(bot.game.gameModeId===0)return!1;if(bot.intents.includes(Intents.OBSERVE_GAME))return!1;if(bot.game.isPrivate)return!bot.game.options.noTeamChange;let players=bot.players,myTeam=bot.me.team,playersWithMyTeam=Object.values(players).filter((player)=>player.team===myTeam).length,playersWithOtherTeam=Object.values(players).filter((player)=>player.team!==myTeam).length;if(playersWithOtherTeam>playersWithMyTeam)return!1;if(playersWithMyTeam===playersWithOtherTeam)return!1;return!0}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.switchTeam),out.send(bot.game.socket)}}var SwitchTeamDispatch_default=SwitchTeamDispatch;class ThrowGrenadeDispatch{constructor(power=1){this.power=power}validate(){return typeof this.power==="number"&&this.power>=0&&this.power<=1}check(bot){return bot.me.playing&&!bot.state.reloading&&!bot.state.swappingGun&&!bot.state.usingMelee}execute(bot){let out=new CommOut_default;out.packInt8(CommCode_default.throwGrenade),out.packFloat(this.power),out.send(bot.game.socket)}}var ThrowGrenadeDispatch_default=ThrowGrenadeDispatch;var DispatchIndex={banPlayer:BanPlayerDispatch_default,bootPlayer:BootPlayerDispatch_default,chat:ChatDispatch_default,fire:FireDispatch_default,gameOptions:GameOptionsDispatch_default,goToAmmo:GoToAmmoDispatch_default,goToCoop:GoToCoopDispatch_default,goToGrenade:GoToGrenadeDispatch_default,goToPlayer:GoToPlayerDispatch_default,goToSpatula:GoToSpatulaDispatch_default,lookAt:LookAtDispatch_default,lookAtPos:LookAtPosDispatch_default,melee:MeleeDispatch_default,move:MovementDispatch_default,pause:PauseDispatch_default,reload:ReloadDispatch_default,reportPlayer:ReportPlayerDispatch_default,resetGame:ResetGameDispatch_default,saveLoadout:SaveLoadoutDispatch_default,spawn:SpawnDispatch_default,swapWeapon:SwapWeaponDispatch_default,switchTeam:SwitchTeamDispatch_default,throwGrenade:ThrowGrenadeDispatch_default},dispatches_default={BanPlayerDispatch:BanPlayerDispatch_default,BootPlayerDispatch:BootPlayerDispatch_default,ChatDispatch:ChatDispatch_default,FireDispatch:FireDispatch_default,GameOptionsDispatch:GameOptionsDispatch_default,GoToAmmoDispatch:GoToAmmoDispatch_default,GoToCoopDispatch:GoToCoopDispatch_default,GoToGrenadeDispatch:GoToGrenadeDispatch_default,GoToPlayerDispatch:GoToPlayerDispatch_default,GoToSpatulaDispatch:GoToSpatulaDispatch_default,LookAtDispatch:LookAtDispatch_default,LookAtPosDispatch:LookAtPosDispatch_default,MeleeDispatch:MeleeDispatch_default,MovementDispatch:MovementDispatch_default,PauseDispatch:PauseDispatch_default,ReloadDispatch:ReloadDispatch_default,ReportPlayerDispatch:ReportPlayerDispatch_default,ResetGameDispatch:ResetGameDispatch_default,SaveLoadoutDispatch:SaveLoadoutDispatch_default,SpawnDispatch:SpawnDispatch_default,SwapWeaponDispatch:SwapWeaponDispatch_default,SwitchTeamDispatch:SwitchTeamDispatch_default,ThrowGrenadeDispatch:ThrowGrenadeDispatch_default};var exports_direct={};__export(exports_direct,{validate:()=>validate,processJS:()=>processJS,coords:()=>coords});var hexToUint8Array=(hex)=>new Uint8Array(hex.match(/.{2}/g).map((b)=>parseInt(b,16))),encoder=new TextEncoder,validate=async(input)=>{if(typeof process<"u"&&typeof process.getBuiltinModule==="function"){let crypto2=process.getBuiltinModule("node:crypto"),salt2=Buffer.from("3496afa51f2a553ea1fc5211400c000b","hex");return crypto2.createHmac("sha256",salt2).update(input).digest("hex")}let salt=hexToUint8Array("3496afa51f2a553ea1fc5211400c000b"),key=await crypto.subtle.importKey("raw",salt,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),signature=await crypto.subtle.sign("HMAC",key,encoder.encode(input));return Array.from(new Uint8Array(signature)).map((b)=>b.toString(16).padStart(2,"0")).join("")},tableAt=(addr)=>{return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(addr)},coords=(yaw11,pitch10)=>{let local_9=Math.round(yaw11/(Math.PI*2)*65535),local_4=0,local_12=Math.round((pitch10+1.5)/3*32767),temp_yaw=local_9<0?0:local_9;local_9=temp_yaw>65535?65535:temp_yaw;let yaw_i32=Math.trunc(local_9);if(yaw_i32<0)yaw_i32=0;if(yaw_i32>4294967295)yaw_i32=4294967295;yaw_i32=local_9>=0?yaw_i32:0,yaw_i32=local_9>65535?0:yaw_i32;let local_5=yaw_i32;local_4^=local_5;let temp_pitch=local_12<0?0:local_12;local_9=temp_pitch,temp_pitch=local_9>32767?32767:local_9,local_9=temp_pitch;let pitch_i32=Math.trunc(local_9);if(pitch_i32<0)pitch_i32=0;if(pitch_i32>4294967295)pitch_i32=4294967295;pitch_i32=local_9>=0?pitch_i32:0,pitch_i32=local_9>65535?0:pitch_i32;let local_3=pitch_i32,local_6=(local_3^4294934528)&65535,local_01=local_4^local_6,pitch_low_byte=local_01&255,yaw_shifted=local_4<<8,yaw_byte_high=(local_4&65280)>>>8;local_3=(yaw_shifted|yaw_byte_high)>>>0;let local_7=pitch_low_byte^local_3;local_01=local_01<<8|(local_01&65280)>>>8,local_5^=local_6,local_6=local_01^local_5&255,local_5=local_5<<8|(local_5&65280)>>8,local_4=local_5^local_4&255;let letters=[];return letters[3]=tableAt(local_6&63),letters[7]=tableAt(local_3>>>8&63),letters[4]=tableAt(local_01>>>10&63),letters[0]=tableAt((local_4&252)>>>2),letters[5]=tableAt(local_01>>>4&48|local_7>>>4&15),letters[2]=tableAt(local_5>>>6&60|local_6>>>6&3),letters[6]=tableAt((local_3>>>14&3|local_7<<2)&63),letters[1]=tableAt((local_5>>>12&15|local_4<<4)&63),String.fromCharCode(...letters)};var processJS=(input)=>{let inputArray=new Uint8Array([...input].map((c)=>c.charCodeAt(0))),xorKeyStart=88,decoded=new Uint8Array(inputArray.length);for(let i2=0;i2<inputArray.length;i2++)decoded[i2]=inputArray[i2]^88+i2&127;let result="";for(let i2=0;i2<decoded.length;i2+=65536){let chunk=decoded.subarray(i2,Math.min(i2+65536,decoded.length));result+=String.fromCharCode(...chunk)}return result};var Challenges=[{id:1,loc_ref:"chlg_kill_streak_five",type:0,subType:0,period:0,goal:1,reward:100,conditional:0,value:"5",valueTwo:null,tier:2,loc:{title:"Master Chef",desc:"Get a 5 killstreak"}},{id:2,loc_ref:"chlg_kill_streak_ten",type:0,subType:0,period:0,goal:1,reward:200,conditional:0,value:"10",valueTwo:null,tier:2,loc:{title:"Butcher",desc:"Get a 10 killstreak"}},{id:3,loc_ref:"chlg_kill_streak_fifteen",type:0,subType:0,period:0,goal:1,reward:500,conditional:0,value:"15",valueTwo:null,tier:3,loc:{title:"Eggsassin",desc:"Get a 15 killstreak"}},{id:4,loc_ref:"chlg_kill_streak_twenty",type:0,subType:0,period:0,goal:1,reward:1000,conditional:0,value:"20",valueTwo:null,tier:3,loc:{title:"Eggsecutioner",desc:"Get a 20 killstreak"}},{id:5,loc_ref:"chlg_kill_streak_fifty",type:0,subType:0,period:0,goal:1,reward:5000,conditional:0,value:"50",valueTwo:null,tier:3,loc:{title:"Shell Smasher",desc:"Get a 50 killstreak"}},{id:6,loc_ref:"chlg_kill_kills_ten",type:0,subType:10,period:0,goal:10,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Shell Shocker",desc:"Get 10 total kills"}},{id:7,loc_ref:"chlg_kill_kills_twenty",type:0,subType:10,period:0,goal:20,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Yolk Drinker",desc:"Get 20 total kills"}},{id:8,loc_ref:"chlg_kill_kills_fifty",type:0,subType:10,period:0,goal:50,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Clutch Master",desc:"Get 50 total kills"}},{id:9,loc_ref:"chlg_kill_kills_hundred",type:0,subType:10,period:0,goal:100,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Eggsterminator",desc:"Get 100 total kills"}},{id:10,loc_ref:"chlg_kill_kills_two_fifty",type:0,subType:10,period:0,goal:250,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Ovum Overlord",desc:"Get 250 total kills"}},{id:11,loc_ref:"chlg_kill_timePlayed_two",type:0,subType:6,period:0,goal:1,reward:100,conditional:null,value:"2",valueTwo:"60",tier:0,loc:{title:"Back to Back",desc:"Spawn and get 2 kills in 1 min"}},{id:12,loc_ref:"chlg_kill_timePlayed_four",type:0,subType:6,period:0,goal:1,reward:500,conditional:null,value:"4",valueTwo:"60",tier:2,loc:{title:"C-C-C-COMBO",desc:"Spawn and get 4 kills in 1 min"}},{id:13,loc_ref:"chlg_kill_timePlayed_seven",type:0,subType:6,period:0,goal:1,reward:1000,conditional:null,value:"7",valueTwo:"60",tier:3,loc:{title:"Eggcellerator",desc:"Spawn and get 7 kills in 1 min"}},{id:14,loc_ref:"chlg_kill_timePlayed_ten",type:0,subType:6,period:0,goal:1,reward:2500,conditional:null,value:"10",valueTwo:"60",tier:3,loc:{title:"Need for Speed",desc:"Spawn and get 10 kills in 1 min"}},{id:15,loc_ref:"chlg_kill_con_kill_one_shot",type:0,subType:8,period:0,goal:1,reward:100,conditional:11,value:"1",valueTwo:"1",tier:1,loc:{title:"Bullseye",desc:"Kill an egg with 1 shot"}},{id:16,loc_ref:"chlg_kill_con_kill_hp_ten",type:0,subType:8,period:0,goal:1,reward:500,conditional:12,value:"1",valueTwo:"10",tier:1,loc:{title:"Cutting it Close",desc:"Get a kill with less than 10 HP"}},{id:17,loc_ref:"chlg_kill_con_kill_five_streak",type:0,subType:8,period:0,goal:1,reward:1000,conditional:0,value:"0",valueTwo:"5",tier:2,loc:{title:"Soft Boiled",desc:"Kill an egg on a 5+ streak"}},{id:18,loc_ref:"chlg_kill_con_kill_ten_streak",type:0,subType:8,period:0,goal:1,reward:2500,conditional:0,value:"0",valueTwo:"10",tier:3,loc:{title:"Breaker-breaker",desc:"Kill an egg on a 10+ streak"}},{id:19,loc_ref:"chlg_kill_con_kill_scoped",type:0,subType:8,period:0,goal:1,reward:200,conditional:13,value:null,valueTwo:null,tier:2,loc:{title:"Eye 2 Eye",desc:"Snipe a zoomed-in sniper"}},{id:20,loc_ref:"chlg_kill_con_two_kills_one_shot",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:null,tier:2,loc:{title:"Collateral Damage",desc:"Kill two eggs at once"}},{id:21,loc_ref:"chlg_kill_con_reloading",type:0,subType:8,period:0,goal:1,reward:100,conditional:17,value:null,valueTwo:null,tier:1,loc:{title:"Owned",desc:"Kill an egg while they reload"}},{id:22,loc_ref:"chlg_kill_con_kill_scoped_melee",type:0,subType:8,period:0,goal:1,reward:200,conditional:13,value:null,valueTwo:"9",tier:2,loc:{title:"Behind You!",desc:"Melee kill a zoomed-in egg"}},{id:23,loc_ref:"chlg_kill_con_kill_two_grenade",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:"8",tier:2,loc:{title:"2 Birds 1 Stone",desc:"Kill 2 eggs with 1 Grenade"}},{id:24,loc_ref:"chlg_kill_con_kill_three_grenade",type:0,subType:8,period:0,goal:1,reward:1000,conditional:16,value:"3",valueTwo:"8",tier:3,loc:{title:"M-M-M-Multikill",desc:"Kill 3 eggs with 1 Grenade"}},{id:25,loc_ref:"chlg_kill_con_kill_two_rpegg",type:0,subType:8,period:0,goal:1,reward:200,conditional:16,value:"2",valueTwo:"4",tier:2,loc:{title:"Splash Damage",desc:"Kill 2 eggs with 1 RPEGG shot"}},{id:26,loc_ref:"chlg_kill_con_kill_three_rpegg",type:0,subType:8,period:0,goal:1,reward:1000,conditional:16,value:"3",valueTwo:"4",tier:3,loc:{title:"Big Boomer",desc:"Kill 3 eggs with 1 RPEGG shot"}},{id:27,loc_ref:"chlg_kill_weaponType_Cluck9mm_five",type:0,subType:1,period:0,goal:5,reward:200,conditional:null,value:null,valueTwo:"3",tier:1,loc:{title:"Pew Pew",desc:"Get 5 Cluck 9mm kills"}},{id:28,loc_ref:"chlg_kill_weaponType_Cluck9mm_ten",type:0,subType:1,period:0,goal:10,reward:500,conditional:null,value:null,valueTwo:"3",tier:1,loc:{title:"Trigger Happy",desc:"Get 10 Cluck 9mm kills"}},{id:29,loc_ref:"chlg_kill_weaponType_Cluck9mm_twenty",type:0,subType:1,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:"3",tier:2,loc:{title:"Sidearm Specialist",desc:"Get 20 Cluck 9mm kills"}},{id:30,loc_ref:"chlg_kill_weaponType_Cluck9mm_fifty",type:0,subType:1,period:0,goal:50,reward:2500,conditional:null,value:null,valueTwo:"3",tier:3,loc:{title:"9mm Master",desc:"Get 50 Cluck 9mm kills"}},{id:31,loc_ref:"chlg_kill_weaponType_Scrambler_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"1",tier:1,loc:{title:"Scrambled Eggs",desc:"Get 5 Scrambler kills"}},{id:32,loc_ref:"chlg_kill_weaponType_Scrambler_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"1",tier:1,loc:{title:"Hunting Wabbits",desc:"Get 10 Scrambler kills"}},{id:33,loc_ref:"chlg_kill_weaponType_Scrambler_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"1",tier:2,loc:{title:"Boomstick",desc:"Get 20 Scrambler kills"}},{id:34,loc_ref:"chlg_kill_weaponType_Scrambler_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"1",tier:3,loc:{title:"Splat-o-matic",desc:"Get 50 Scrambler kills"}},{id:35,loc_ref:"chlg_kill_weaponType_Rpegg_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Eggsploder",desc:"Get 5 RPEGG kills"}},{id:36,loc_ref:"chlg_kill_weaponType_Rpegg_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Arm Cannons",desc:"Get 10 RPEGG kills"}},{id:37,loc_ref:"chlg_kill_weaponType_Rpegg_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"4",tier:2,loc:{title:"Bazooka Joe",desc:"Get 20 RPEGG kills"}},{id:38,loc_ref:"chlg_kill_weaponType_Rpegg_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"4",tier:3,loc:{title:"Master Eggsploder",desc:"Get 50 RPEGG kills"}},{id:39,loc_ref:"chlg_kill_weaponType_Whipper_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"5",tier:1,loc:{title:"Whip it Good",desc:"Get 5 Whipper kills"}},{id:40,loc_ref:"chlg_kill_weaponType_Whipper_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"5",tier:1,loc:{title:"Cool Whip",desc:"Get 10 Whipper kills"}},{id:41,loc_ref:"chlg_kill_weaponType_Whipper_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"5",tier:2,loc:{title:"Whip it REAL Good",desc:"Get 20 Whipper kills"}},{id:42,loc_ref:"chlg_kill_weaponType_Whipper_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"5",tier:3,loc:{title:"Whip up a Storm",desc:"Get 50 Whipper kills"}},{id:43,loc_ref:"chlg_kill_weaponType_Eggk47_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"0",tier:0,loc:{title:"Lock & Load",desc:"Get 5 EggK-47 kills"}},{id:44,loc_ref:"chlg_kill_weaponType_Eggk47_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"0",tier:1,loc:{title:"Almost a Dozen",desc:"Get 10 EggK-47 kills"}},{id:45,loc_ref:"chlg_kill_weaponType_Eggk47_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"0",tier:2,loc:{title:"Spray Down",desc:"Get 20 EggK-47 kills"}},{id:46,loc_ref:"chlg_kill_weaponType_Eggk47_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"0",tier:3,loc:{title:"Eggk-47 Eggspert",desc:"Get 50 EggK-47 kills"}},{id:47,loc_ref:"chlg_kill_weaponType_FreeRanger_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"2",tier:1,loc:{title:"Poacher",desc:"Get 5 Free Ranger kills"}},{id:48,loc_ref:"chlg_kill_weaponType_FreeRanger_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"2",tier:1,loc:{title:"Bounty Hunter",desc:"Get 10 Free Ranger kills"}},{id:49,loc_ref:"chlg_kill_weaponType_FreeRanger_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"2",tier:2,loc:{title:"Hired Gun",desc:"Get 20 Free Ranger kills"}},{id:50,loc_ref:"chlg_kill_weaponType_FreeRanger_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"2",tier:3,loc:{title:"Big-Game Hunter",desc:"Get 50 Free Ranger kills"}},{id:51,loc_ref:"chlg_kill_weaponType_Crackshot_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"6",tier:1,loc:{title:"Sniper",desc:"Get 5 Crackshot kills"}},{id:52,loc_ref:"chlg_kill_weaponType_Crackshot_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"6",tier:1,loc:{title:"Sharpshooter",desc:"Get 10 Crackshot kills"}},{id:53,loc_ref:"chlg_kill_weaponType_Crackshot_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"6",tier:2,loc:{title:"Marksman",desc:"Get 20 Crackshot kills"}},{id:54,loc_ref:"chlg_kill_weaponType_Crackshot_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"6",tier:3,loc:{title:"Cracked",desc:"Get 50 Crackshot kills"}},{id:55,loc_ref:"chlg_kill_weaponType_TriHard_five",type:0,subType:1,period:0,goal:5,reward:100,conditional:null,value:null,valueTwo:"7",tier:1,loc:{title:"Tri-Hard",desc:"Get 5 Tri-Hard kills"}},{id:56,loc_ref:"chlg_kill_weaponType_TriHard_ten",type:0,subType:1,period:0,goal:10,reward:200,conditional:null,value:null,valueTwo:"7",tier:1,loc:{title:"Tri-Harder",desc:"Get 10 Tri-Hard kills"}},{id:57,loc_ref:"chlg_kill_weaponType_TriHard_twenty",type:0,subType:1,period:0,goal:20,reward:500,conditional:null,value:null,valueTwo:"7",tier:2,loc:{title:"Tri-Even-Harder",desc:"Get 20 Tri-Hard kills"}},{id:58,loc_ref:"chlg_kill_weaponType_TriHard_fifty",type:0,subType:1,period:0,goal:50,reward:1000,conditional:null,value:null,valueTwo:"7",tier:3,loc:{title:"Tri-Hardest",desc:"Get 50 Tri-Hard kills"}},{id:59,loc_ref:"chlg_kill_weaponType_Melee_five",type:0,subType:1,period:0,goal:5,reward:200,conditional:null,value:null,valueTwo:"9",tier:2,loc:{title:"Whisky Business",desc:"Get 5 Melee kills"}},{id:60,loc_ref:"chlg_kill_weaponType_Melee_ten",type:0,subType:1,period:0,goal:10,reward:500,conditional:null,value:null,valueTwo:"9",tier:2,loc:{title:"Slap the Bass",desc:"Get 10 Melee kills"}},{id:61,loc_ref:"chlg_kill_weaponType_Melee_twenty",type:0,subType:1,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:"9",tier:3,loc:{title:"Whack & Slash",desc:"Get 20 Melee kills"}},{id:62,loc_ref:"chlg_kill_weaponType_Melee_fifty",type:0,subType:1,period:0,goal:50,reward:2500,conditional:null,value:null,valueTwo:"9",tier:3,loc:{title:"Melee Master",desc:"Get 50 Melee kills"}},{id:63,loc_ref:"chlg_damage_five_hundred",type:1,subType:null,period:0,goal:500,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Shattered Shells",desc:"Deal 500 damage"}},{id:64,loc_ref:"chlg_damage_one_thousand",type:1,subType:null,period:0,goal:1000,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Decimator",desc:"Deal 1000 damage"}},{id:65,loc_ref:"chlg_damage_twenty_five_hundred",type:1,subType:null,period:0,goal:2500,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Tormentor",desc:"Deal 2500 damage"}},{id:66,loc_ref:"chlg_damage_five_thousand",type:1,subType:null,period:0,goal:5000,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Devastator",desc:"Deal 5000 damage"}},{id:67,loc_ref:"chlg_damage_ten_thousand",type:1,subType:null,period:0,goal:1e4,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Boomsauce",desc:"Deal 10000 damage"}},{id:68,loc_ref:"chlg_damage_twenty_five_thousand",type:1,subType:null,period:0,goal:25000,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Maximum Damage",desc:"Deal 25000 damage"}},{id:69,loc_ref:"chlg_deaths_ten",type:2,subType:null,period:0,goal:10,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Cracked",desc:"Die 10 times"}},{id:70,loc_ref:"chlg_deaths_twenty",type:2,subType:null,period:0,goal:20,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Fried",desc:"Die 20 times"}},{id:71,loc_ref:"chlg_deaths_fifty",type:2,subType:null,period:0,goal:50,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Death Wish",desc:"Die 50 times"}},{id:72,loc_ref:"chlg_movement_distance_five_hunderd",type:3,subType:3,period:0,goal:500,reward:100,conditional:null,value:null,valueTwo:null,tier:0,loc:{title:"Runny Egg",desc:"Travel 500m"}},{id:73,loc_ref:"chlg_movement_distance_one_thousand",type:3,subType:3,period:0,goal:1000,reward:500,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Poultry in Motion",desc:"Travel 1000m"}},{id:74,loc_ref:"chlg_movement_distance_five_thousand",type:3,subType:3,period:0,goal:5000,reward:2500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Gaming Marathon",desc:"Travel 5000m"}},{id:75,loc_ref:"chlg_movement_jump_one_hundred",type:3,subType:4,period:0,goal:100,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Jumpman",desc:"Jump 100 times"}},{id:76,loc_ref:"chlg_movement_jump_five_hundred",type:3,subType:4,period:0,goal:500,reward:500,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Bouncing Bomb",desc:"Jump 500 times"}},{id:77,loc_ref:"chlg_kill_jump_one",type:0,subType:4,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Aerial Assault",desc:"Get a kill while jumping"}},{id:78,loc_ref:"chlg_kill_jump_five",type:0,subType:4,period:0,goal:5,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Do a Barrel Roll",desc:"Get 5 kills while airborne"}},{id:79,loc_ref:"chlg_kill_jump_victim_jump",type:0,subType:4,period:0,goal:1,reward:2500,conditional:4,value:null,valueTwo:null,tier:3,loc:{title:"Aerial Acrobatics",desc:"Kill an egg while both airborne"}},{id:80,loc_ref:"chlg_movement_collect_ammo_ten",type:4,subType:18,period:0,goal:10,reward:100,conditional:16,value:"0",valueTwo:null,tier:1,loc:{title:"We Need Supplies!",desc:"Collect 10 ammo boxes"}},{id:81,loc_ref:"chlg_movement_collect_ammo_twenty_five",type:4,subType:18,period:0,goal:25,reward:500,conditional:16,value:"0",valueTwo:null,tier:2,loc:{title:"Quartermaster",desc:"Collect 25 ammo boxes"}},{id:82,loc_ref:"chlg_movement_collect_ammo_fifty",type:4,subType:18,period:0,goal:50,reward:1000,conditional:16,value:"0",valueTwo:null,tier:3,loc:{title:"Locked & Loaded",desc:"Collect 50 ammo boxes"}},{id:83,loc_ref:"chlg_movement_collect_grenade_ten",type:4,subType:18,period:0,goal:10,reward:100,conditional:17,value:"1",valueTwo:null,tier:1,loc:{title:"Explosives expert",desc:"Collect 10 grenades"}},{id:84,loc_ref:"chlg_movement_collect_grenade_twenty_five",type:4,subType:18,period:0,goal:25,reward:500,conditional:17,value:"1",valueTwo:null,tier:2,loc:{title:"Bombardier",desc:"Collect 25 grenades"}},{id:85,loc_ref:"chlg_movement_collect_grenade_fifty",type:4,subType:18,period:0,goal:50,reward:1000,conditional:17,value:"1",valueTwo:null,tier:3,loc:{title:"Explosive Temper",desc:"Collect 50 grenades"}},{id:86,loc_ref:"chlg_timed_timeAlive_thirty",type:5,subType:7,period:0,goal:1,reward:100,conditional:7,value:"30",valueTwo:null,tier:1,loc:{title:"Running Scared",desc:"Stay alive for 30 sec"}},{id:87,loc_ref:"chlg_timed_timeAlive_sixty",type:5,subType:7,period:0,goal:1,reward:200,conditional:7,value:"60",valueTwo:null,tier:2,loc:{title:"Hard to Beat",desc:"Stay alive for 1 min"}},{id:88,loc_ref:"chlg_timed_timeAlive_three_hundred",type:5,subType:7,period:0,goal:1,reward:2500,conditional:7,value:"300",valueTwo:null,tier:3,loc:{title:"Happily Ever After",desc:"Stay alive for 5 min"}},{id:90,loc_ref:"chlg_timed_timePlayed_three_hundred",type:5,subType:6,period:0,goal:300,reward:200,conditional:6,value:"300",valueTwo:null,tier:0,loc:{title:"Shell Shocked!",desc:"Play for 5 min"}},{id:91,loc_ref:"chlg_timed_timePlayed_nine_hundred",type:5,subType:6,period:0,goal:900,reward:500,conditional:6,value:"900",valueTwo:null,tier:1,loc:{title:"Not so Noob",desc:"Play for 15 min"}},{id:92,loc_ref:"chlg_timed_timePlayed_eighteen_hundred",type:5,subType:6,period:0,goal:1800,reward:1000,conditional:6,value:"1800",valueTwo:null,tier:2,loc:{title:"Oval Office",desc:"Play for 30 min"}},{id:93,loc_ref:"chlg_timed_timePlayed_thirty_six_hundred",type:5,subType:6,period:0,goal:3600,reward:2500,conditional:6,value:"3600",valueTwo:null,tier:3,loc:{title:"On That Grind",desc:"Play for 60 min"}},{id:94,loc_ref:"chlg_kotc_capturing_timeAlive_twenty",type:6,subType:20,period:0,goal:1,reward:100,conditional:7,value:"10",valueTwo:null,tier:1,loc:{title:"Hold the Fort",desc:"Stand on Coop for 10 sec"}},{id:95,loc_ref:"chlg_kotc_capture",type:6,subType:21,period:0,goal:1,reward:100,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Coop King",desc:"Capture a Coop"}},{id:96,loc_ref:"chlg_kotc_win_one",type:6,subType:23,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"King of the Coop",desc:"Win a KotC match"}},{id:97,loc_ref:"chlg_kotc_win_three",type:6,subType:23,period:0,goal:3,reward:500,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Team Sports",desc:"Win 3 KotC matches"}},{id:98,loc_ref:"chlg_kotc_win_five",type:6,subType:23,period:0,goal:5,reward:1000,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Rule the Roost",desc:"Win 5 KotC matches"}},{id:99,loc_ref:"chlg_kotc_win_ten",type:6,subType:23,period:0,goal:10,reward:2500,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Coop Commander",desc:"Win 10 KotC matches"}},{id:100,loc_ref:"chlg_kotc_coop_kill",type:6,subType:20,period:0,goal:1,reward:200,conditional:10,value:null,valueTwo:null,tier:1,loc:{title:"Defender",desc:"Kill an egg from the Coop"}},{id:101,loc_ref:"chlg_kotc_coop_kill_victim_capturing",type:6,subType:20,period:0,goal:1,reward:200,conditional:10,value:"18",valueTwo:null,tier:1,loc:{title:"Offender",desc:"Kill an egg on a Coop"}},{id:102,loc_ref:"chlg_cts_pick_up",type:7,subType:21,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Fry Cook",desc:"CTS: Pick up the Spatula"}},{id:103,loc_ref:"chlg_cts_capture_timeAlive_thirty",type:7,subType:21,period:0,goal:1,reward:500,conditional:7,value:"30",valueTwo:null,tier:2,loc:{title:"Keepaway",desc:"CTS: Hold the Spatula for 30s"}},{id:104,loc_ref:"chlg_cts_win_ten",type:7,subType:23,period:0,goal:20,reward:1000,conditional:null,value:null,valueTwo:null,tier:1,loc:{title:"Sunny Side Up!",desc:"CTS: Gain 20+ kills holding the spatula"}},{id:105,loc_ref:"chlg_cts_win_twenty_five",type:7,subType:23,period:0,goal:50,reward:4000,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Flippin 'em",desc:"CTS: Gain 50+ kills holding the spatula"}},{id:106,loc_ref:"chlg_cts_win_fifty",type:7,subType:23,period:0,goal:100,reward:1e4,conditional:null,value:null,valueTwo:null,tier:3,loc:{title:"Makin' Bacon",desc:"CTS: Gain 100+ kills holding the spatula"}},{id:107,loc_ref:"chlg_cts_kills_victim_spatula",type:7,subType:10,period:0,goal:1,reward:200,conditional:null,value:null,valueTwo:null,tier:2,loc:{title:"Kill the Cook",desc:"CTS: Kill the Spatula holder"}},{id:108,loc_ref:"chlg_cts_kills_killstreak_five",type:7,subType:10,period:0,goal:1,reward:500,conditional:0,value:"5",valueTwo:null,tier:3,loc:{title:"Flippin' Dangerous",desc:"CTS: Get a 5 KS with the spatula"}}];var Maps=[{filename:"abduction",hash:"1ritt77g1fv",name:"Abduction",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"aqueduct",hash:"11dp765kifr",name:"Aqueduct",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"backstage",hash:"9dsromfqr1",name:"Backstage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"bastion",hash:"uuwh7401no",name:"Bastion",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"bedrock",hash:"yqbkimntiu",name:"Bedrock",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"biohazard",hash:"kzarr9ebqx",name:"BioHazard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"blender",hash:"1vvfxp9rt8u",name:"Blender",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"14"},{filename:"blue",hash:"2e7izzo70bk",name:"Blue",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"bridge",hash:"20vcy8e1ev0",name:"Bridge",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"canyon",hash:"2avqtv9ygk1",name:"Canyon",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"cash",hash:"1427gfre8ma",name:"Cash",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"castle",hash:"2d2tcz2mw7e",name:"Castle",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"12"},{filename:"castleArena",hash:"9dhs3kms6l",name:"Castle Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"8"},{filename:"catacombs",hash:"2el91jtcun0",name:"Catacombs",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"chickenItza",hash:"hyjqbat0i3",name:"Chicken Itza",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"cluckgrounds",hash:"1h9z3hj51g5",name:"Cluckgrounds",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"cobalt",hash:"1c9fg9re2mf",name:"Cobalt",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"courtyard",hash:"kh2cr3m620",name:"Courtyard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"creak",hash:"l2pzui2f6o",name:"Creak",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"crossed",hash:"ead3tcf30r",name:"Crossed",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"crowsnest",hash:"1ze2s5zr9bm",name:"Crowsnest",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"8"},{filename:"deathpit",hash:"1cc9cvjf607",name:"Death Pit",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"dirt",hash:"1u3k5nfvwuh",name:"Dirt",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"dirt2",hash:"494aka3mb4",name:"Dirt 2",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"dirtbase",hash:"6e9r2y7dxk",name:"Dirt Base",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"downfall",hash:"26g5aj8aruc",name:"Downfall",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"duelPyramid",hash:"vmg0rj2e3b",name:"Duel Pyramid",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"eggcrates",hash:"j0i36e808n",name:"Eggcrates",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"6"},{filename:"enchanted",hash:"1igxtcyetaw",name:"Enchanted",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"exposure",hash:"15hv3cme1fh",name:"Exposure",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"facility",hash:"18djbmo35ru",name:"Facility",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"feedlot",hash:"iuj8rc7kyh",name:"Feedlot",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"field",hash:"e4aszuch87",name:"Field",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"flux",hash:"2e9jbskip5u",name:"Flux",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"fortFlip",hash:"1w1b6dkalc2",name:"Fort Flip",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"foundation",hash:"11y636vc64b",name:"Foundation",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"fourQuarters",hash:"1a0w7vbz8is",name:"Four Quarters",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"10"},{filename:"gravelstomp",hash:"h2s7fdl8ke",name:"Gravel Stomp",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"greenhouse",hash:"1zx6pqgc23x",name:"Greenhouse",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"growler",hash:"1izyni7tb1e",name:"Growler",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"haunted",hash:"2dma8z1jdev",name:"Haunted",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"helix",hash:"i2sl4vsg3h",name:"Helix",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"hydro",hash:"8znnxbxfss",name:"Hydro",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"icebox",hash:"1mwbrjievwg",name:"Ice Box",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"indigo",hash:"1vrzzn6ym9q",name:"Indigo",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"inmates",hash:"19wzahko4nm",name:"Inmates",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"jailbreak",hash:"2a3blmd9hf4",name:"Jail Break",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"jinx",hash:"24u6pohagnj",name:"Jinx",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"junction",hash:"bkca8j2ppd",name:"Junction",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"kingsCourt",hash:"aq1t2lsjza",name:"King's Court",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"lunarmodule",hash:"1448aqjdqvl",name:"Lunar Module",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"mansion",hash:"nqhtvwj3fo",name:"Mansion",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"mazerunner",hash:"j16i30k9dz",name:"Maze Runner",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"metamorph",hash:"l9o69l8e1b",name:"Metamorph",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"14"},{filename:"metro",hash:"1keh36qjpjz",name:"Metro 1012",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"moonbase",hash:"1yzocf1mex3",name:"Moonbase",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"mudGulch",hash:"kto278skze",name:"Mud Gulch",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"nextdoor",hash:"s2i5za1kx9",name:"Nextdoor",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"orbital",hash:"76g9ms7t5o",name:"Orbital",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"outer",hash:"w1biqokp89",name:"Outer Reach",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"overcooked",hash:"29ca98hgdeh",name:"Overcooked",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"palaceSiege",hash:"1enghs5hsxe",name:"Palace Siege",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"parkour1",hash:"1fwysuizmoy",name:"Parkour - Easy",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"parkour2",hash:"25n7k671t0e",name:"Parkour - Medium",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"parkour3",hash:"pm58s3bnil",name:"Parkour - Hard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"12"},{filename:"quarry",hash:"2crjk106pa",name:"Quarry",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"14"},{filename:"queenscourt",hash:"raudy4h9pv",name:"Queen's Court",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"raceway",hash:"1a3eo6xaoju",name:"Raceway",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"rameses",hash:"177jt4j8so9",name:"Rameses",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"rats",hash:"13r2oqql8se",name:"Rats",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"relic",hash:"lxzknz53a2",name:"Relic",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"rivals",hash:"26fkvcef2h6",name:"Rivals",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"road",hash:"2h312vlocd",name:"Road",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"14"},{filename:"ruins",hash:"3ycs8z9bcu",name:"Ruins",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"sanctuary",hash:"1evqx0d08e4",name:"Sanctuary",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"scales",hash:"101v5lpkv1s",name:"Scales",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"shadyglen",hash:"2d0d4bj7aq3",name:"Shady Glen",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"shellville",hash:"fdgmkbfe7n",name:"Shellville",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"16"},{filename:"shipyard",hash:"1n1sptszksq",name:"Shipyard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"skyScratcher",hash:"1th1c8epp95",name:"Sky Scratcher",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"spaceFactory",hash:"10802a2az0f",name:"Space Factory",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"10"},{filename:"spacearena",hash:"k9zf5lqzze",name:"Space Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"14"},{filename:"sparta",hash:"274wwdyll9w",name:"Sparta",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"spellbound",hash:"1curtd0i4ls",name:"Spellbound",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"stage",hash:"1zn44r9jb3t",name:"Stage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"starship",hash:"24m3k5sq9tn",name:"Starship",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"both",numPlayers:"18"},{filename:"staxarena",hash:"1jid8ffda0z",name:"Stax Arena",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"teggtris",hash:"1y4rswkkv3l",name:"Teggtris",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"temple",hash:"bp6twwct9v",name:"Temple",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"18"},{filename:"timetwist",hash:"1ad75xyk2rv",name:"Timetwist",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"trainyard",hash:"2e1w70fjqet",name:"Trainyard",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"treefort",hash:"14a9akanqms",name:"Tree Fort",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"6"},{filename:"twoTowers",hash:"2asidv5c0ff",name:"Two Towers",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"uncovered",hash:"bxrd0zdvtn",name:"Uncovered",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!1},availability:"private",numPlayers:"12"},{filename:"vert",hash:"25a9ikled77",name:"Vert",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"12"},{filename:"wimble",hash:"13smnxheae1",name:"Wimble",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"wonderland",hash:"5n6ixyepvy",name:"Wonderland",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"wreckage",hash:"nkiu4z6uj1",name:"Wreckage",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"yolkido",hash:"pttsmqw7xj",name:"Yolkido Garrison",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"},{filename:"zoomies",hash:"3vitx32ce8",name:"Zoomies",modes:{FFA:!0,Teams:!0,Spatula:!0,King:!0},availability:"private",numPlayers:"18"}];var processAddPlayerPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),findCosmetics=bot.intents.includes(Intents.COSMETIC_DATA),playerData={id,uniqueId:CommIn_default.unPackString(),name:CommIn_default.unPackString(),safeName:CommIn_default.unPackString(),charClass:CommIn_default.unPackInt8U(),team:CommIn_default.unPackInt8U(),primaryWeaponItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),secondaryWeaponItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),shellColor:CommIn_default.unPackInt8U(),hatItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),stampItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),stampPosX:CommIn_default.unPackInt8(),stampPosY:CommIn_default.unPackInt8(),grenadeItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),meleeItem:findCosmetics?findItemById(CommIn_default.unPackInt16U()):CommIn_default.unPackInt16U(),x:CommIn_default.unPackFloat(),y:CommIn_default.unPackFloat(),z:CommIn_default.unPackFloat(),$dx:CommIn_default.unPackFloat(),$dy:CommIn_default.unPackFloat(),$dz:CommIn_default.unPackFloat(),yaw:CommIn_default.unPackRadU(),pitch:CommIn_default.unPackRad(),score:CommIn_default.unPackInt32U(),$kills:CommIn_default.unPackInt16U(),$deaths:CommIn_default.unPackInt16U(),$streak:CommIn_default.unPackInt16U(),totalKills:CommIn_default.unPackInt32U(),totalDeaths:CommIn_default.unPackInt32U(),bestStreak:CommIn_default.unPackInt16U(),$bestOverallStreak:CommIn_default.unPackInt16U(),shield:CommIn_default.unPackInt8U(),hp:CommIn_default.unPackInt8U(),playing:CommIn_default.unPackInt8U(),weaponIdx:CommIn_default.unPackInt8U(),$controlKeys:CommIn_default.unPackInt8U(),upgradeProductId:CommIn_default.unPackInt8U(),activeShellStreaks:CommIn_default.unPackInt8U(),social:CommIn_default.unPackLongString(),hideBadge:CommIn_default.unPackInt8U()};bot.game.mapIdx=CommIn_default.unPackInt8U(),bot.game.isPrivate=CommIn_default.unPackInt8U()===1,bot.game.gameModeId=CommIn_default.unPackInt8U();let player=new GamePlayer_default(playerData,bot.game.gameMode===GameMode.KOTC?bot.game.kotc.activeZone:null);if(!bot.players[playerData.id])bot.players[playerData.id]=player;if(bot.$emit("playerJoin",player),bot.me.id===playerData.id)bot.me=player,bot.$emit("botJoin",bot.me)},addPlayer_default=processAddPlayerPacket;var processBeginShellStreakPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),ksType=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;switch(ksType){case ShellStreak.HardBoiled:if(id===bot.me.id)bot.me.shieldHp=100;player.streakRewards.push(ShellStreak.HardBoiled);break;case ShellStreak.EggBreaker:player.streakRewards.push(ShellStreak.EggBreaker);break;case ShellStreak.Restock:{if(player.grenades=3,player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.rounds=player.weapons[0].ammo.capacity,player.weapons[0].ammo.store=player.weapons[0].ammo.storeMax;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.rounds=player.weapons[1].ammo.capacity,player.weapons[1].ammo.store=player.weapons[1].ammo.storeMax;break}case ShellStreak.OverHeal:player.hp=Math.min(200,player.hp+100),player.streakRewards.push(ShellStreak.OverHeal);break;case ShellStreak.DoubleEggs:player.streakRewards.push(ShellStreak.DoubleEggs);break;case ShellStreak.MiniEgg:player.scale=0.5,player.streakRewards.push(ShellStreak.MiniEgg);break}bot.$emit("playerBeginStreak",player,ksType)},beginShellStreak_default=processBeginShellStreakPacket;var processChallengeCompletedPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),challengeId=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;if(!bot.intents.includes(Intents.CHALLENGES))return bot.$emit("challengeComplete",player,challengeId);let challenge=bot.account.challenges.find((c)=>c.id===challengeId);if(bot.$emit("challengeComplete",player,challenge),player.id===bot.me.id)bot.refreshChallenges()},challengeCompleted_default=processChallengeCompletedPacket;var processChangeCharacterPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),weaponIndex=CommIn_default.unPackInt8U(),primaryWeaponIdx=CommIn_default.unPackInt16U(),secondaryWeaponIdx=CommIn_default.unPackInt16U(),shellColor=CommIn_default.unPackInt8U(),hatIdx=CommIn_default.unPackInt16U(),stampIdx=CommIn_default.unPackInt16U(),grenadeIdx=CommIn_default.unPackInt16U(),meleeIdx=CommIn_default.unPackInt16U(),stampPositionX=CommIn_default.unPackInt8(),stampPositionY=CommIn_default.unPackInt8(),findCosmetics=bot.intents.includes(Intents.COSMETIC_DATA),primaryWeaponItem=findCosmetics?findItemById(primaryWeaponIdx):primaryWeaponIdx,secondaryWeaponItem=findCosmetics?findItemById(secondaryWeaponIdx):secondaryWeaponIdx,hatItem=findCosmetics?findItemById(hatIdx):hatIdx,stampItem=findCosmetics?findItemById(stampIdx):stampIdx,grenadeItem=findCosmetics?findItemById(grenadeIdx):grenadeIdx,meleeItem=findCosmetics?findItemById(meleeIdx):meleeIdx,player=bot.players[id];if(player){let oldCharacter=structuredClone(player.character),oldWeaponIdx=player.selectedGun;if(player.character.eggColor=shellColor,player.character.primaryGun=primaryWeaponItem,player.character.secondaryGun=secondaryWeaponItem,player.character.stamp=stampItem,player.character.hat=hatItem,player.character.grenade=grenadeItem,player.character.melee=meleeItem,player.character.stampPos.x=stampPositionX,player.character.stampPos.y=stampPositionY,player.selectedGun=weaponIndex,player.weapons[0]=createGun(GunList[weaponIndex]),oldWeaponIdx!==player.selectedGun)bot.$emit("playerChangeGun",player,oldWeaponIdx,player.selectedGun);if(JSON.stringify(oldCharacter)!==JSON.stringify(player.character))bot.$emit("playerChangeCharacter",player,oldCharacter,player.character)}},changeCharacter_default=processChangeCharacterPacket;var processChatPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),msgFlags=CommIn_default.unPackInt8U(),text=CommIn_default.unPackString(),player=bot.players[id];if(player)bot.$emit("chat",player,text,msgFlags)},chat_default=processChatPacket;var processCollectItemPacket=(bot)=>{let playerId=CommIn_default.unPackInt8U(),type=CommIn_default.unPackInt8U(),applyToWeaponIdx=CommIn_default.unPackInt8U(),id=CommIn_default.unPackInt16U(),player=bot.players[playerId];if(!player)return;if(bot.game.collectibles[type]=bot.game.collectibles[type].filter((c)=>c.id!==id),type===CollectType.Ammo){let playerWeapon=player.weapons[applyToWeaponIdx];if(playerWeapon&&playerWeapon.ammo)playerWeapon.ammo.store=Math.min(playerWeapon.ammo.storeMax,playerWeapon.ammo.store+playerWeapon.ammo.pickup),bot.$emit("playerCollectAmmo",player,playerWeapon,id)}if(type===CollectType.Grenade){if(player.grenades++,player.grenades>3)player.grenades=3;bot.$emit("playerCollectGrenade",player,id)}},collectItem_default=processCollectItemPacket;var processDiePacket=(bot)=>{let killedId=CommIn_default.unPackInt8U(),killerId=CommIn_default.unPackInt8U();CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U();let damageCauseInt=CommIn_default.unPackInt8U(),killed=bot.players[killedId],killer=bot.players[killerId],oldKilled=killed?structuredClone(killed):null;if(bot.me&&killed){if(killed.id===bot.me.id){if(bot.lastDeathTime=Date.now(),bot.pathing.activePath)bot.pathing.activePath=null,bot.pathing.activeNode=null,bot.pathing.activeNodeIdx=0;bot.state.controlKeys=0}if(killed.playing=!1,killed.streak=0,killed.hp=100,killed.spawnShield=0,killed.stats.totalDeaths++,killed.inKotcZone)killed.inKotcZone=!1,bot.$emit("playerLeaveZone",killed,ZoneLeaveReason.Killed)}if(killer){if(killer.streak++,killer.stats.totalKills++,killer.streak>killer.stats.bestStreak)killer.stats.bestStreak=killer.streak}bot.$emit("playerDeath",killed,killer,oldKilled,damageCauseInt)},die_default=processDiePacket;var timedStreaks=[ShellStreak.EggBreaker,ShellStreak.OverHeal,ShellStreak.DoubleEggs,ShellStreak.MiniEgg],processEndShellStreakPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),ksType=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;if(timedStreaks.includes(ksType)&&player.streakRewards.includes(ksType))player.streakRewards=player.streakRewards.filter((r)=>r!==ksType);if(ksType===ShellStreak.MiniEgg)player.scale=1;bot.$emit("playerEndStreak",player,ksType)},endShellStreak_default=processEndShellStreakPacket;var processEventModifierPacket=(bot)=>{let out=new CommOut_default;out.packInt8(CommCode_default.eventModifier),out.send(bot.game.socket)},eventModifier_default=processEventModifierPacket;var processExplodePacket=(bot)=>{let itemType=CommIn_default.unPackInt8U(),item=CommIn_default.unPackInt16U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),damage=CommIn_default.unPackInt8U(),radius=CommIn_default.unPackFloat();if(bot.intents.includes(Intents.COSMETIC_DATA))item=findItemById(item);if(itemType===ItemType.Grenade)bot.$emit("grenadeExplode",item,{x,y,z},damage,radius);else bot.$emit("rocketHit",{x,y,z},damage,radius)},explode_default=processExplodePacket;var processFirePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),bullet={posX:CommIn_default.unPackFloat(),posY:CommIn_default.unPackFloat(),posZ:CommIn_default.unPackFloat(),dirX:CommIn_default.unPackFloat(),dirY:CommIn_default.unPackFloat(),dirZ:CommIn_default.unPackFloat()},player=bot.players[id];if(!player)return;let playerWeapon=player.weapons[player.activeGun];if(playerWeapon&&playerWeapon.ammo)playerWeapon.ammo.rounds--,bot.$emit("playerFire",player,playerWeapon,bullet)},fire_default=processFirePacket;var processGameActionPacket=(bot)=>{let action=CommIn_default.unPackInt8U();if(action===GameAction.Pause)bot.$emit("gameForcePause"),setTimeout(()=>{if(bot.me)bot.me.playing=!1},3000);if(action===GameAction.Reset){if(Object.values(bot.players).forEach((player)=>player.streak=0),bot.game.gameModeId!==GameMode.FFA)bot.game.teamScore=[0,0,0];if(bot.game.gameModeId===GameMode.Spatula)bot.game.spatula.controlledBy=0,bot.game.spatula.controlledByTeam=0,bot.game.spatula.coords={x:0,y:0,z:0};if(bot.game.gameModeId===GameMode.KOTC)bot.game.kotc.stage=CoopState.Capturing,bot.game.kotc.zoneIdx=0,bot.game.kotc.activeZone=null,bot.game.kotc.teamCapturing=0,bot.game.kotc.captureProgress=0,bot.game.kotc.numCapturing=0,bot.game.kotc.capturePercent=0;bot.$emit("gameReset")}},gameAction_default=processGameActionPacket;class AStar{constructor(list){this.list=list}heuristic(pos1,pos2){let dx=Math.abs(pos1.x-pos2.x),dy=Math.abs(pos1.y-pos2.y),dz=Math.abs(pos1.z-pos2.z),dxz=Math.max(dx,dz);return dy+dxz}reversePath(node){let path=[];while(node.parent)path.push(node),node=node.parent;return path.reverse(),path}path(start,end){this.list.clean();let openSet=[start],closedSet=new Set;start.h=this.heuristic(start,end),start.g=0,start.f=start.h,start.visited=!0;let current;while(openSet.length>0){let lowestIdx=0,lowestF=openSet[0].f,lowestG=openSet[0].g;for(let i2=1;i2<openSet.length;i2++){let node=openSet[i2];if(node.f<lowestF||node.f===lowestF&&node.g>lowestG)lowestF=node.f,lowestG=node.g,lowestIdx=i2}if(current=openSet[lowestIdx],current===end)return this.reversePath(current);openSet[lowestIdx]=openSet[openSet.length-1],openSet.pop(),closedSet.add(current);let neighbors=current.links;for(let i2=0;i2<neighbors.length;i2++){let neighbor=neighbors[i2];if(closedSet.has(neighbor))continue;let tentativeGScore=current.g+1;if(!neighbor.visited||tentativeGScore<neighbor.g){let isNew=!neighbor.visited;if(neighbor.visited=!0,neighbor.parent=current,neighbor.g=tentativeGScore,neighbor.h=this.heuristic(neighbor,end),neighbor.f=neighbor.g+neighbor.h,isNew)openSet.push(neighbor)}}}return null}}var FORWARD_RY_WEDGE_MAPPING=Object.freeze({0:{x:0,z:-1},1:{x:-1,z:0},2:{x:0,z:1},3:{x:1,z:0}}),positionKey=(x,y,z)=>(x&255)<<16|(y&255)<<8|z&255;class MapNode{constructor(meshType,data){if(this.x=data.x,this.y=data.y,this.z=data.z,this.positionKey=positionKey(this.x,this.y,this.z),this.meshType=meshType.split(".").pop(),this.f=0,this.g=0,this.h=0,this.visited=null,this.parent=null,this.closed=null,this.links=[],this.flatCenter={x:this.x+0.5,y:this.y,z:this.z+0.5},this.meshType==="wedge")this.ry=data.ry??0}isFull(){return this.meshType==="full"}canWalkThrough(){return this.meshType==="none"||this.meshType==="ladder"}canWalkOn(){return this.meshType==="full"}isLadder(){return this.meshType==="ladder"}isStair(){return this.meshType==="wedge"}isAir(){return this.meshType==="none"}isJumpPad(){return this.meshType==="jump-pad"}canLink(node,list){let dx0=this.x-node.x,dz0=this.z-node.z,dy0=this.y-node.y,dx=Math.abs(dx0),dy=Math.abs(dy0),dz=Math.abs(dz0);if(dx+dy+dz===0||dx+dz>1&&!(dx===2&&dz===1||dx===1&&dz===2||dx===2&&dz===2)||this.isFull()||node.isFull())return!1;let belowMe=list.at(this.x,this.y-1,this.z),belowOther=list.at(node.x,node.y-1,node.z);if(!belowMe||!belowOther)return!1;if(dy===0&&belowMe.isFull()&&belowOther.isFull()){if(dx===2&&dz===0||dx===0&&dz===2){let midX=(this.x+node.x)/2,midZ=(this.z+node.z)/2,midNode=list.at(midX,this.y,midZ),midBelow=list.at(midX,this.y-1,midZ),midAbove=list.at(midX,this.y+1,midZ);if(midBelow&&midBelow.isAir()){if(midNode&&midNode.isAir()&&midAbove&&midAbove.isAir()){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}}else if(dx===2&&dz===1||dx===1&&dz===2){let xDir=dx0>0?-1:1,zDir=dz0>0?-1:1,checks=dx===2?[[this.x+xDir,this.y,this.z],[this.x+xDir,this.y,this.z+zDir]]:[[this.x,this.y,this.z+zDir],[this.x+xDir,this.y,this.z+zDir]],allClear=!0;for(let[x,y,z]of checks){let block=list.at(x,y,z),blockBelow=list.at(x,y-1,z),blockAbove=list.at(x,y+1,z);if(!block||!block.isAir()||!blockBelow||!blockBelow.isAir()||!blockAbove||!blockAbove.isAir()){allClear=!1;break}}if(allClear){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}else if(dx===2&&dz===2){let xDir=dx0>0?-1:1,zDir=dz0>0?-1:1,checks=[[this.x+xDir,this.y,this.z+zDir],[this.x+2*xDir,this.y,this.z+zDir],[this.x+2*xDir,this.y,this.z+2*zDir]],allClear=!0;for(let[x,y,z]of checks){let block=list.at(x,y,z),blockBelow=list.at(x,y-1,z),blockAbove=list.at(x,y+1,z);if(!block||!block.isAir()||!blockBelow||!blockBelow.isAir()||!blockAbove||!blockAbove.isAir()){allClear=!1;break}}if(allClear){let startHead=list.at(this.x,this.y+1,this.z),endHead=list.at(node.x,node.y+1,node.z);if(startHead&&startHead.isAir()&&endHead&&endHead.isAir())return!0}}}let meSupported=belowMe.isFull()||this.isStair(),otherSupported=belowOther.isFull()||belowOther.isStair()||node.isStair();if(dy<=2&&meSupported&&otherSupported){if(this.meshType==="none"){if(dy0===1&&node.canWalkThrough())return!0;if(belowMe.canWalkOn()||belowMe.isLadder()||belowMe.isStair()){if(node.meshType==="none"||node.meshType==="ladder"&&dy===0||node.meshType==="wedge"&&dy0===0&&dx0===-FORWARD_RY_WEDGE_MAPPING[node.ry].x&&dz0===-FORWARD_RY_WEDGE_MAPPING[node.ry].z)return!0}return!1}else if(this.meshType==="ladder"){if(dy===1&&node.canWalkThrough())return!0;if(dy===0&&belowMe.canWalkOn())return!0;return node.meshType==="ladder"&&(dy===1||belowMe.canWalkOn()&&belowOther.canWalkOn())}else if(this.meshType==="wedge"){let forward=FORWARD_RY_WEDGE_MAPPING[this.ry],backward={x:-forward.x,z:-forward.z};if(this.x+forward.x===node.x&&this.z+forward.z===node.z){if(this.y+1===node.y&&node.canWalkThrough())return!0;if(this.y===node.y&&node.meshType==="wedge")return!0;if(this.y+1===node.y&&node.meshType==="wedge")return!0}if(this.x+backward.x===node.x&&this.z+backward.z===node.z){if((this.y===node.y||this.y-1===node.y)&&node.canWalkThrough())return!0;if(this.y-1===node.y&&(node.meshType==="wedge"||node.meshType==="none"&&belowOther.isFull()))return!0}if(node.canWalkThrough()&&(belowOther.isFull()||belowOther.isStair()))return!0;if(node.isStair())return!0;return!1}}return!1}flatRadialDistance(position){return Math.hypot(this.flatCenter.x-position.x,this.flatCenter.z-position.z)}}var NEIGHBOR_OFFSETS=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1],[1,0,1],[1,0,-1],[-1,0,1],[-1,0,-1],[1,1,0],[-1,1,0],[0,1,1],[0,1,-1],[1,-1,0],[-1,-1,0],[0,-1,1],[0,-1,-1],[2,0,0],[-2,0,0],[0,0,2],[0,0,-2],[2,0,1],[2,0,-1],[-2,0,1],[-2,0,-1],[1,0,2],[1,0,-2],[-1,0,2],[-1,0,-2],[2,0,2],[2,0,-2],[-2,0,2],[-2,0,-2]];class NodeList{list=[];nodeMap=null;constructor(raw){let addedPositions=new Set;for(let meshName of Object.keys(raw.data))for(let nodeData of raw.data[meshName])addedPositions.add(positionKey(nodeData.x,nodeData.y,nodeData.z)),this.list.push(new MapNode(meshName,nodeData));for(let x=0;x<raw.width;x++)for(let y=0;y<raw.height;y++)for(let z=0;z<raw.depth;z++)if(!addedPositions.has(positionKey(x,y,z)))this.list.push(new MapNode("SPECIAL.air.none",{x,y,z}));this.nodeMap=new Map;for(let node of this.list)this.nodeMap.set(node.positionKey,node);for(let node of this.list)for(let[dx,dy,dz]of NEIGHBOR_OFFSETS){let neighborKey=positionKey(node.x+dx,node.y+dy,node.z+dz),neighborNode=this.nodeMap.get(neighborKey);if(neighborNode&&node.canLink(neighborNode,this))node.links.push(neighborNode)}}at(x,y,z){return this.nodeMap?.get(positionKey(x,y,z))}atObject({x,y,z}){return this.nodeMap?.get(positionKey(Math.floor(x),Math.floor(y),Math.floor(z)))}clean(){for(let node of this.list)node.f=0,node.g=0,node.h=0,node.visited=null,node.parent=null,node.closed=null}hasLineOfSight(bot,target){let dx=target.x-bot.x,dy=target.y-bot.y,dz=target.z-bot.z,steps=Math.max(Math.abs(dx),Math.abs(dy),Math.abs(dz)),xStep=dx/steps,yStep=dy/steps,zStep=dz/steps,x=bot.x,y=bot.y,z=bot.z;for(let i2=0;i2<=steps;i2++){if(this.at(Math.round(x),Math.round(y),Math.round(z))?.isFull())return!1;x+=xStep,y+=yStep,z+=zStep}return!0}}var GameModeById=Object.fromEntries(Object.entries(GameMode).map(([key,value])=>[value,key])),processGameJoinedPacket=async(bot)=>{if(bot.me.id=CommIn_default.unPackInt8U(),bot.me.team=CommIn_default.unPackInt8U(),bot.game.gameModeId=CommIn_default.unPackInt8U(),bot.game.gameMode=GameModeById[bot.game.gameModeId],bot.game.mapIdx=CommIn_default.unPackInt8U(),bot.game.map=Maps[bot.game.mapIdx],bot.game.playerLimit=CommIn_default.unPackInt8U(),bot.game.isGameOwner=CommIn_default.unPackInt8U()===1,bot.game.isPrivate=CommIn_default.unPackInt8U()===1||bot.game.isGameOwner,CommIn_default.unPackInt8U(),bot.intents.includes(Intents.LOAD_MAP)||bot.intents.includes(Intents.PATHFINDING)){let map=await fetchMap(bot.game.map.filename,bot.game.map.hash);if(bot.game.map)bot.game.map.raw=map;if(bot.game.gameModeId===GameMode.KOTC){let meshData=bot.game.map.raw.data["DYNAMIC.capture-zone.none"];if(meshData){if(bot.game.map.zones=initKotcZones(meshData),!bot.game.kotc.activeZone)bot.game.kotc.activeZone=bot.game.map.zones[bot.game.kotc.zoneIdx-1]}else delete bot.game.map.zones}if(bot.intents.includes(Intents.PATHFINDING))bot.pathing.nodeList=new NodeList(bot.game.map.raw),bot.pathing.astar=new AStar(bot.pathing.nodeList);bot.$emit("mapLoad",bot.game.map.raw)}bot.state.inGame=!0,bot.lastDeathTime=Date.now();let out=new CommOut_default;if(out.packInt8(CommCode_default.clientReady),out.send(bot.game.socket),!bot.intents.includes(Intents.MANUAL_UPDATE))bot.updateIntervalId=setInterval(()=>bot.update(),33.333333333333336);if(bot.intents.includes(Intents.PING)){bot.lastPingTime=Date.now();let out2=new CommOut_default;out2.packInt8(CommCode_default.ping),out2.send(bot.game.socket)}if(bot.intents.includes(Intents.NO_AFK_KICK))bot.afkKickInterval=setInterval(()=>{if(bot.state.inGame&&!bot.me.playing&&Date.now()-bot.lastDeathTime>=15000){let out3=new CommOut_default;out3.packInt8(CommCode_default.keepAlive),out3.send(bot.game.socket)}},15000);bot.$emit("gameReady")},gameJoined_default=processGameJoinedPacket;var CCGameOptionFlag=Object.fromEntries(Object.entries(GameOptionFlag).map(([k,v])=>[k[0].toLowerCase()+k.slice(1),v])),processGameOptionsPacket=(bot)=>{let oldOptions=structuredClone(bot.game.options),gravity=CommIn_default.unPackInt8U(),damage=CommIn_default.unPackInt8U(),healthRegen=CommIn_default.unPackInt8U();if(gravity<1||gravity>4)gravity=4;if(damage<0||damage>8)damage=4;if(healthRegen>16)healthRegen=4;bot.game.options.gravity=gravity/4,bot.game.options.damage=damage/4,bot.game.options.healthRegen=healthRegen/4;let rawFlags=CommIn_default.unPackInt8U();Object.keys(CCGameOptionFlag).forEach((optionFlagName)=>{let value=rawFlags&CCGameOptionFlag[optionFlagName]?1:0;bot.game.options[optionFlagName]=value}),bot.game.options.weaponsDisabled=Array.from({length:7},()=>CommIn_default.unPackInt8U()===1),bot.game.options.mustUseSecondary=bot.game.options.weaponsDisabled.every((v)=>v),bot.$emit("gameOptionsChange",oldOptions,bot.game.options)},gameOptions_default=processGameOptionsPacket;var processHitMeHardBoiledPacket=(bot)=>{let shieldHealth=CommIn_default.unPackInt8U(),playerHealth=CommIn_default.unPackInt8U(),dx=CommIn_default.unPackFloat(),dz=CommIn_default.unPackFloat();if(!bot.me)return;if(bot.me.shieldHp=shieldHealth,bot.me.hp=playerHealth,bot.me.shieldHp<=0)bot.me.streakRewards=bot.me.streakRewards.filter((r)=>r!==ShellStreak.HardBoiled),bot.$emit("selfShieldLost",bot.me.hp,{dx,dz});else bot.$emit("selfShieldHit",bot.me.shieldHp,bot.me.hp,{dx,dz})},hitMeHardBoiled_default=processHitMeHardBoiledPacket;var processHitMePacket=(bot)=>{let hp=CommIn_default.unPackInt8U();if(CommIn_default.unPackFloat(),CommIn_default.unPackFloat(),bot.me){let oldHealth=bot.me.hp;bot.me.hp=hp,bot.$emit("playerDamage",bot.me,oldHealth,bot.me.hp)}},hitMe_default=processHitMePacket;var processHitThemPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),hp=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let oldHealth=player.hp;player.hp=hp,bot.$emit("playerDamage",player,oldHealth,player.hp)},hitThem_default=processHitThemPacket;var processMeleePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(player)bot.$emit("playerMelee",player)},melee_default=processMeleePacket;var processMetaGameStatePacket=(bot)=>{if(bot.game.gameModeId===GameMode.Spatula){let oldTeamScores=structuredClone(bot.game.teamScore),oldSpatula=structuredClone(bot.game.spatula);bot.game.teamScore[1]=CommIn_default.unPackInt16U(),bot.game.teamScore[2]=CommIn_default.unPackInt16U();let spatulaCoords={x:CommIn_default.unPackFloat(),y:CommIn_default.unPackFloat(),z:CommIn_default.unPackFloat()},controlledBy=CommIn_default.unPackInt8U(),controlledByTeam=CommIn_default.unPackInt8U();bot.game.spatula={coords:spatulaCoords,controlledBy,controlledByTeam},bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore},spatula:{before:oldSpatula,after:bot.game.spatula}})}else if(bot.game.gameModeId===GameMode.KOTC){let oldTeamScores=structuredClone(bot.game.teamScore),oldKOTC=structuredClone(bot.game.kotc),oldPlayersOnZone=Object.values(bot.players).filter((p)=>p.inKotcZone&&p.playing);if(bot.game.kotc.stage=CommIn_default.unPackInt8U(),bot.game.kotc.zoneIdx=CommIn_default.unPackInt8U(),bot.game.kotc.teamCapturing=CommIn_default.unPackInt8U(),bot.game.kotc.captureProgress=CommIn_default.unPackInt16U(),bot.game.kotc.numCapturing=CommIn_default.unPackInt8U(),bot.game.teamScore[1]=CommIn_default.unPackInt8U(),bot.game.teamScore[2]=CommIn_default.unPackInt8U(),bot.game.kotc.capturePercent=bot.game.kotc.captureProgress/1000,bot.game.kotc.activeZone=bot.game.map?.zones?bot.game.map.zones[bot.game.kotc.zoneIdx-1]:null,bot.game.kotc.activeZone)Object.values(bot.players).forEach((player)=>player.updateKotcZone(bot.game.kotc.activeZone));if(bot.game.kotc.numCapturing<=0)Object.values(bot.players).forEach((player)=>{if(player.inKotcZone)player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.RoundEnded)});let newPlayersOnZone=Object.values(bot.players).filter((p)=>p.inKotcZone&&p.playing);bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore},kotc:{before:oldKOTC,after:bot.game.kotc},playersOnZone:{before:oldPlayersOnZone,after:newPlayersOnZone}})}else if(bot.game.gameModeId===GameMode.Team){let oldTeamScores=structuredClone(bot.game.teamScore);bot.game.teamScore[1]=CommIn_default.unPackInt16U(),bot.game.teamScore[2]=CommIn_default.unPackInt16U(),bot.$emit("gameStateChange",{teamScore:{before:oldTeamScores,after:bot.game.teamScore}})}if(bot.game.gameModeId!==GameMode.Spatula)delete bot.game.spatula;if(bot.game.gameModeId!==GameMode.KOTC)delete bot.game.kotc;if(bot.game.gameModeId===GameMode.FFA)delete bot.game.teamScore},metaGameState_default=processMetaGameStatePacket;var processPausePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(player){if(player.playing=!1,player.streakRewards)player.streakRewards=[];if(bot.$emit("playerPause",player),player.inKotcZone)player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.Despawned)}},pause_default=processPausePacket;var processPingPacket=(bot)=>{if(!bot.intents.includes(Intents.PING))return;if(bot.pingTimeoutId)clearTimeout(bot.pingTimeoutId);let oldPing=bot.ping??0;bot.ping=bot.lastPingTime?Date.now()-bot.lastPingTime:0,bot.$emit("pingUpdate",oldPing,bot.ping),bot.pingTimeoutId=setTimeout(()=>{let out=new CommOut_default;out.packInt8(CommCode_default.ping),out.send(bot.game.socket),bot.lastPingTime=Date.now()},1000)},ping_default=processPingPacket;var processPlayerInfoPacket=(bot)=>{let playerId=CommIn_default.unPackInt8U(),playerDBId=CommIn_default.unPackString(128),playerIp=CommIn_default.unPackString(32),player=bot.players[playerId];if(!player)return;player.admin={ip:playerIp,dbId:playerDBId},bot.$emit("playerInfo",player,playerIp,playerDBId)},playerInfo_default=processPlayerInfoPacket;var processReloadPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let playerActiveWeapon=player.weapons[player.activeGun];if(playerActiveWeapon.ammo){let maxLoad=Math.min(playerActiveWeapon.ammo.capacity,playerActiveWeapon.ammo.reload),needed=Math.max(0,maxLoad-playerActiveWeapon.ammo.rounds),newRounds=Math.min(needed,playerActiveWeapon.ammo.store);playerActiveWeapon.ammo.rounds+=newRounds,playerActiveWeapon.ammo.store-=newRounds}bot.$emit("playerReload",player,playerActiveWeapon)},reload_default=processReloadPacket;var processRemovePlayerPacket=(bot)=>{let id=CommIn_default.unPackInt8U();if(!bot.players[id])return;let removedPlayer=structuredClone(bot.players[id]);delete bot.players[id],bot.$emit("playerLeave",removedPlayer)},removePlayer_default=processRemovePlayerPacket;var processRespawnPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),seed=CommIn_default.unPackInt16U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),primaryRounds=CommIn_default.unPackInt8U(),primaryStore=CommIn_default.unPackInt8U(),secondaryRounds=CommIn_default.unPackInt8U(),secondaryStore=CommIn_default.unPackInt8U(),grenades=CommIn_default.unPackInt8U(),player=bot.players[id];if(player){if(player.playing=!0,player.randomSeed=seed,player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.rounds=primaryRounds;if(player.weapons[0]&&player.weapons[0].ammo)player.weapons[0].ammo.store=primaryStore;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.rounds=secondaryRounds;if(player.weapons[1]&&player.weapons[1].ammo)player.weapons[1].ammo.store=secondaryStore;player.grenades=grenades,player.position={x,y,z},player.spawnShield=120,bot.$emit("playerRespawn",player)}},respawn_default=processRespawnPacket;var processSocketReadyPacket=(bot)=>{let out=new CommOut_default;out.packInt8(bot.intents.includes(Intents.OBSERVE_GAME)?CommCode_default.observeGame:CommCode_default.joinGame),out.packString(bot.game.raw.uuid),out.packInt8(+bot.intents.includes(Intents.VIP_HIDE_BADGE)),out.packInt8(bot.state.weaponIdx||bot.account.loadout?.classIdx||0),out.packString(bot.state.name),out.packInt32(bot.account.session),out.packString(bot.account.sessionId),out.packString(bot.account.firebaseId),out.send(bot.game.socket)},socketReady_default=processSocketReadyPacket;var processSpawnItemPacket=(bot)=>{let id=CommIn_default.unPackInt16U(),type=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat();bot.game.collectibles[type].push({id,x,y,z}),bot.$emit("spawnItem",type,{x,y,z},id)},spawnItem_default=processSpawnItemPacket;var processSwitchTeamPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),toTeam=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player)return;let oldTeam=player.team;player.team=toTeam,player.streak=0,bot.$emit("playerSwitchTeam",player,oldTeam,toTeam)},switchTeam_default=processSwitchTeamPacket;var processSyncMePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),player=bot.players[id];CommIn_default.unPackInt8U();let serverStateIdx=CommIn_default.unPackInt8U(),newX=CommIn_default.unPackFloat(),newY=CommIn_default.unPackFloat(),newZ=CommIn_default.unPackFloat();if(bot.me.climbing=!!CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U(),CommIn_default.unPackInt8U(),!player)return;bot.state.serverStateIdx=serverStateIdx;let oldX=player.position.x,oldY=player.position.y,oldZ=player.position.z;if(player.position.x=newX,player.position.y=newY,player.position.z=newZ,oldX!==newX||oldY!==newY||oldZ!==newZ)bot.$emit("playerMove",player,{x:oldX,y:oldY,z:oldZ},{x:newX,y:newY,z:newZ})},syncMe_default=processSyncMePacket;var processSyncThemPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),climbing=CommIn_default.unPackInt8U(),player=bot.players[id];if(!player||player.id===bot.me.id){for(let i2=0;i2<FramesBetweenSyncs;i2++)CommIn_default.unPackInt8U(),CommIn_default.unPackRadU(),CommIn_default.unPackRad(),CommIn_default.unPackInt8U();return}for(let i2=0;i2<FramesBetweenSyncs;i2++){let controlKeys=CommIn_default.unPackInt8U();player.jumping=!!(controlKeys&Movement.Jump),player.scoping=!!(controlKeys&Movement.Scope);let oldView=structuredClone(player.view);if(player.view.yaw=CommIn_default.unPackRadU(),player.view.pitch=CommIn_default.unPackRad(),player.view.yaw!==oldView.yaw||player.view.pitch!==oldView.pitch)bot.$emit("playerRotate",player,oldView,player.view);player.scale=CommIn_default.unPackInt8U()}let px=player.position,posChanged=px.x!==x||px.y!==y||px.z!==z,climbingChanged=player.climbing!==climbing,didChange=posChanged||climbingChanged,oldPosition=didChange?structuredClone(px):null;if(px.x!==x)px.x=x;if(px.z!==z)px.z=z;if(!player.jumping||Math.abs(px.y-y)>0.5)px.y=y;if(climbingChanged)player.climbing=climbing;if(!didChange)return;if(bot.$emit("playerMove",player,oldPosition,px),bot.game.gameModeId!==GameMode.KOTC)return;let zone=bot.game.kotc.activeZone,wasIn=!!player.inKotcZone;if(!zone&&wasIn){player.inKotcZone=!1,bot.$emit("playerLeaveZone",player,ZoneLeaveReason.RoundEnded);return}player.updateKotcZone(zone);let nowIn=!!player.inKotcZone;if(wasIn!==nowIn)player.inKotcZone=nowIn,bot.$emit(nowIn?"playerEnterZone":"playerLeaveZone",player,nowIn?null:ZoneLeaveReason.WalkedOut)},syncThem_default=processSyncThemPacket;var processThrowGrenadePacket=(bot)=>{let id=CommIn_default.unPackInt8U(),x=CommIn_default.unPackFloat(),y=CommIn_default.unPackFloat(),z=CommIn_default.unPackFloat(),dx=CommIn_default.unPackFloat(),dy=CommIn_default.unPackFloat(),dz=CommIn_default.unPackFloat(),player=bot.players[id];if(player){if(player.grenades>0)player.grenades--;bot.$emit("playerThrowGrenade",player,{x,y,z},{x:dx,y:dy,z:dz})}},throwGrenade_default=processThrowGrenadePacket;var processUpdateBalancePacket=(bot)=>{let newBalance=CommIn_default.unPackInt32U(),oldBalance=bot.account.eggBalance;bot.account.eggBalance=newBalance,bot.$emit("balanceUpdate",oldBalance,newBalance)},updateBalance_default=processUpdateBalancePacket;var processSwapWeaponPacket=(bot)=>{let id=CommIn_default.unPackInt8U(),newWeaponId=CommIn_default.unPackInt8U(),player=bot.players[id];if(player)player.activeGun=newWeaponId,bot.$emit("playerSwapWeapon",player,newWeaponId)},swapWeapon_default=processSwapWeaponPacket;var mod3=(n,m)=>(n%m+m)%m;class Bot{intents=[];regionList=[];matchmakerListeners=[];#dispatches=[];#hooks={};#globalHooks=[];#initialAccount;#initialGame;errorLogger=(...args)=>console.error(...args);constructor(params={}){if(params.proxy&&typeof process>"u")throw Error("proxies do not work in this environment");if(this.intents=params.intents||[],this.intents.includes(Intents.COSMETIC_DATA)){if(!findItemById(1001))throw Error("you cannot use the COSMETIC_DATA intent inside of the browser bundles")}if(this.intents.includes(Intents.SIMULATION)&&!this.intents.includes(Intents.PATHFINDING))throw Error("the SIMULATION intent requires the PATHFINDING intent");if(this.instance=params.instance||"shellshock.io",this.protocol=params.protocol||"wss",this.proxy=params.proxy||"",this.connectionTimeout=params.connectionTimeout||5000,typeof params.errorLogger==="function")this.errorLogger=params.errorLogger;if(this.state={name:"yolkbot",weaponIdx:0,useAltGameURL:!1,inGame:!1,chatLines:0,yaw:0,pitch:0,controlKeys:0,onGround:4,dx:0,dy:0,dz:0,reloading:!1,swappingGun:!1,usingMelee:!1,stateIdx:0,serverStateIdx:0,shotsFired:0,buffer:[]},this.players={},this.me=new GamePlayer_default({}),this.game={raw:{},code:"",region:"",socket:null,gameModeId:0,gameMode:"ffa",mapIdx:0,map:{filename:"",hash:"",name:"",modes:{FFA:!1,Teams:!1,Spatula:!1,King:!1},availability:"both",numPlayers:"18",raw:{},zones:[]},playerLimit:0,isGameOwner:!1,isPrivate:!0,options:{gravity:1,damage:1,healthRegen:1,locked:!1,noTeamChange:!1,noTeamShuffle:!1,weaponsDisabled:Array(7).fill(!1),mustUseSecondary:!1},collectibles:[[],[]],teamScore:[0,0,0],spatula:{coords:{x:0,y:0,z:0},controlledBy:0,controlledByTeam:0},kotc:{stage:CoopState.Capturing,zoneIdx:0,activeZone:[],teamCapturing:0,captureProgress:0,numCapturing:0,capturePercent:0}},this.#initialGame=JSON.parse(JSON.stringify(this.game)),this.account={id:0,firebase:{idToken:"",refreshToken:"",expiresIn:"3600",localId:""},firebaseId:"",sessionId:"",session:0,email:"",password:"",cw:{atLimit:!1,limit:0,secondsUntilPlay:0,canPlayAgain:Date.now()},loadout:{hatId:null,meleeId:0,stampId:null,classIdx:0,colorIdx:0,grenadeId:0,primaryId:[3100,3600,3400,3800,4000,4200,4500],secondaryId:[,,,,,,,].fill(3000),stampPositionX:0,stampPositionY:0},ownedItemIds:[],vip:!1,emailVerified:!1,isAged:!1,isCG:!1,adminRoles:0,rawLoginData:{},eggBalance:0},this.#initialAccount=JSON.parse(JSON.stringify(this.account)),this.api=new api_default({proxy:this.proxy,protocol:this.protocol,instance:this.instance,connectionTimeout:this.connectionTimeout}),this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.pathing={nodeList:null,activePath:null,activeNode:null,activeNodeIdx:0},this.hasQuit=!1,this.intents.includes(Intents.NO_AFK_KICK))this.afkKickInterval=0;if(this.intents.includes(Intents.RENEW_SESSION))this.renewSessionInterval=0}dispatch(dispatch,isEmit){if(dispatch.validate(this)){if(dispatch.check(this))dispatch.execute(this);else this.#dispatches.push(dispatch);return!0}return this.errorLogger(`${isEmit?"emit":"dispatch"}: validation failed for dispatch ${dispatch.constructor.name}`),this.errorLogger("this means the dispatch will NEVER RUN!"),this.errorLogger("make sure all parameters are valid and that any player IDs are in the game"),!1}async createAccount(email,pass){this.account=this.#initialAccount,this.account.email=email,this.account.password=pass;let loginData=await this.api.createAccount(email,pass);return this.processLoginData(loginData)}async login(email,pass){this.account=this.#initialAccount,this.account.email=email,this.account.password=pass;let loginData=await this.api.loginWithCredentials(email,pass);return this.processLoginData(loginData)}async loginWithRefreshToken(refreshToken){this.account=this.#initialAccount;let loginData=await this.api.loginWithRefreshToken(refreshToken);return this.processLoginData(loginData)}async loginAnonymously(){this.account=this.#initialAccount;let loginData=await this.api.loginAnonymously();return this.processLoginData(loginData)}processLoginData(loginData){if(!loginData.ok||!loginData.playerOutput){if(this.$emit("authFail",loginData),loginData.ok&&!loginData.playerOutput)this.errorLogger("processLoginData: missing playerOutput but is ok",loginData);return{...loginData,error:LoginError.InternalError,ok:!1}}if(loginData.banRemaining)return this.$emit("banned",loginData.banRemaining),createError(LoginError.AccountBanned);this.account.firebase=loginData.firebase;let output=loginData.playerOutput;if(this.account.rawLoginData=output,this.account.adminRoles=output.adminRoles||0,this.account.eggBalance=output.currentBalance,this.account.emailVerified=output.emailVerified,this.account.firebaseId=output.firebaseId,this.account.id=output.id,this.account.isAged=new Date(output.dateCreated).getTime()<1714546800000,this.account.isCG=output.cgAccountStatus?.hasAccount,this.account.loadout=output.loadout,this.account.ownedItemIds=output.ownedItemIds,this.account.session=output.session,this.account.sessionId=output.sessionId,this.account.vip=output.active_sub==="IsVIP",this.intents.includes(Intents.BOT_STATS))this.account.stats={lifetime:output.statsLifetime,monthly:output.statsCurrent};if(this.intents.includes(Intents.CHALLENGES))this.#importChallenges(output.challenges);if(this.$emit("authSuccess",this.account),this.intents.includes(Intents.RENEW_SESSION))this.renewSessionInterval=setInterval(async()=>{if(!this.account?.sessionId)return clearInterval(this.renewSessionInterval);if((await this.api.queryServices({cmd:"renewSession",sessionId:this.account.sessionId})).data!=="renewed")this.$emit("sessionExpired")},600000);return{ok:!0,account:this.account}}#importChallenges(challengeArray){this.account.challenges=[];for(let challengeData of challengeArray){let challengeInfo=Challenges.find((c)=>c.id===challengeData.challengeId);if(!challengeInfo)continue;delete challengeData.playerId,this.account.challenges.push({raw:{challengeInfo,challengeData},id:challengeData.challengeId,name:challengeInfo.loc.title,desc:challengeInfo.loc.desc,rewardEggs:challengeInfo.reward,isRerolled:!!challengeData.reset,isClaimed:!!challengeData.claimed,isCompleted:!!challengeData.completed,progressNum:challengeData.progress,goalNum:challengeInfo.goal})}}async createMatchmaker(){let matchmaker=new socket_default(`${this.protocol}://${this.instance}/matchmaker/`,{proxy:this.proxy,errorLogger:this.errorLogger});if(matchmaker.autoReconnect=!0,!await matchmaker.tryConnect())return createError(MatchmakerError.WebSocketConnectFail);this.matchmaker=matchmaker;let uuidTimeouts=[];return this.matchmaker.onmessage=async(e)=>{let data=JSON.parse(e.data);if(data.command==="validateUUID"){let timeout=setTimeout(()=>{console.error("createMatchmaker: the matchmaker did not respond to our validateUUID"),console.error("createMatchmaker: report this issue at https://yolkbot.xyz/community")},5000);return uuidTimeouts.push(timeout),this.matchmaker.send(JSON.stringify({command:"validateUUID",hash:await validate(data.uuid)}))}if(uuidTimeouts.length)uuidTimeouts.forEach((t)=>clearTimeout(t)),uuidTimeouts.length=0;this.matchmakerListeners.forEach((listener)=>listener(data))},await this.getRegions()}async getRegions(){if(!this.matchmaker){let mmConnection=await this.createMatchmaker();if(!mmConnection.ok)return mmConnection}return new Promise((res)=>{let listener=(data)=>{if(data.command==="regionList")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),this.regionList=data.regionList,res({ok:!0,regionList:this.regionList})};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"regionList"}))})}async initSession(){if(!this.account.sessionId&&!this.intents.includes(Intents.SKIP_LOGIN)){let anonLogin=await this.loginAnonymously();if(!anonLogin.ok)return anonLogin}if(!this.matchmaker){let mmConnection=await this.createMatchmaker();if(!mmConnection.ok)return mmConnection}return{ok:!0}}async findPublicGame(region,mode){if(typeof region!=="string")return createError(GameFindError.MissingParams);let computedModeId;if(typeof mode==="number")if(Object.values(GameMode).indexOf(mode)>-1)computedModeId=mode;else return createError(GameFindError.InvalidMode);else if(typeof mode==="string"){let modeEntry=Object.keys(GameMode).find((key)=>key.toLowerCase()===mode.toLowerCase());if(modeEntry)computedModeId=GameMode[modeEntry];else return createError(GameFindError.InvalidMode)}else return createError(GameFindError.InvalidMode);let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;if(!this.regionList.find((r)=>r.id===region))return createError(GameFindError.InvalidRegion);let game=await new Promise((resolve)=>{let listener=(msg)=>{if(msg.command==="notice")return;if(this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),msg.command==="gameFound"){if(msg.useAltGameURL)this.state.useAltGameURL=!0;return resolve(msg)}if(msg.error==="sessionNotFound")return resolve(createError(GameFindError.SessionExpired));this.errorLogger("findPublicGame: unknown matchmaker response",JSON.stringify(msg)),resolve(createError(GameFindError.InternalError))};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"findGame",region,playType:PlayType.JoinPublic,gameType:computedModeId,sessionId:this.account.sessionId}))});if(!game.id)return game;return{ok:!0,raw:game,id:game.id,uuid:game.uuid,region:game.region,private:game.private,subdomain:game.subdomain}}async createPrivateGame(region,mode,map){if(typeof region!=="string")return createError(GameFindError.MissingParams);let computedModeId;if(typeof mode==="number")if(Object.values(GameMode).indexOf(mode)>-1)computedModeId=mode;else return createError(GameFindError.InvalidMode);else if(typeof mode==="string"){let modeEntry=Object.keys(GameMode).find((key)=>key.toLowerCase()===mode.toLowerCase());if(modeEntry)computedModeId=GameMode[modeEntry];else return createError(GameFindError.InvalidMode)}else return createError(GameFindError.InvalidMode);let mapIdx=Maps.findIndex((m)=>m.name.toLowerCase()===map.toLowerCase());if(mapIdx===-1)return createError(GameFindError.InvalidMap);let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;if(!this.regionList.find((r)=>r.id===region))return createError(GameFindError.InvalidRegion);let game=await new Promise((resolve)=>{let listener=(msg)=>{if(msg.command==="notice")return;if(this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),msg.command==="gameFound"){if(msg.useAltGameURL)this.state.useAltGameURL=!0;return resolve(msg)}if(msg.error==="sessionNotFound")return resolve(createError(GameFindError.SessionExpired));this.errorLogger("createPrivateGame: unknown matchmaker response",JSON.stringify(msg)),resolve(createError(GameFindError.InternalError))};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"findGame",region,playType:PlayType.CreatePrivate,gameType:computedModeId,sessionId:this.account.sessionId,noobLobby:!1,map:mapIdx}))});if(!game.id)return game;return{ok:!0,raw:game,id:game.id,uuid:game.uuid,region:game.region,private:game.private,subdomain:game.subdomain}}async join(name,data){if(this.state.name=name||"yolkbot",typeof data==="string"){if(data.includes("#"))data=data.split("#")[1];let initInfo=await this.initSession();if(!initInfo.ok)return initInfo;if(await new Promise((resolve)=>{let listener=(message)=>{if(message.command==="gameFound")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),this.game.raw=message,this.game.code=message.id,this.game.region=message.region,resolve(message.id);if(message.error&&message.error==="gameNotFound")this.matchmakerListeners.splice(this.matchmakerListeners.indexOf(listener),1),resolve("gameNotFound")};this.matchmakerListeners.push(listener),this.matchmaker.send(JSON.stringify({command:"joinGame",id:data,observe:!1,sessionId:this.account.sessionId}))})==="gameNotFound")return createError(GameJoinError.GameNotFound);if(!this.game.raw.id)return this.errorLogger("join: invalid game data received from matchmaker:",this.game.raw),createError(GameJoinError.InternalError)}else if(typeof data==="object"){if(!data.id||!data.subdomain||!data.uuid||!data.region)return createError(GameJoinError.InvalidObject);if(this.account.id===0){let anonAttempt=await this.loginAnonymously();if(!anonAttempt.ok)return anonAttempt}this.game.raw=data,this.game.code=this.game.raw.id,this.game.region=this.game.raw.region}else return createError(GameJoinError.MissingParams);let host=this.state.useAltGameURL||this.instance==="proxy.yolkbot.xyz"?`${this.instance}/servers/${this.game.raw.subdomain}`:`${this.game.raw.subdomain}.${this.instance}`;if(this.game.socket=new socket_default(`${this.protocol}://${host}/game/${this.game.raw.id}`,{proxy:this.proxy,errorLogger:this.errorLogger}),this.game.socket.binaryType="arraybuffer",this.game.socket.connectionTimeout=this.connectionTimeout,this.game.socket.onBeforeConnect=()=>{this.game.socket.onmessage=(msg)=>this.processPacket(msg.data),this.game.socket.onclose=(e)=>{if(this.state?.inGame)this.$emit("close",e.code),this.leave(-1)}},!await this.game.socket.tryConnect())return createError(GameJoinError.WebSocketConnectFail);return{ok:!0}}#processMovement(ndx,ndy,ndz){this.state.onGround=Math.max(--this.state.onGround,0),this.me.position.x+=ndx,this.me.position.y+=ndy,this.me.position.z+=ndz;let thisBlockX=Math.floor(this.me.position.x),thisBlockY=Math.floor(this.me.position.y),thisBlockZ=Math.floor(this.me.position.z),blockInMyHitbox=this.pathing.nodeList.at(thisBlockX,thisBlockY,thisBlockZ);if(blockInMyHitbox&&!blockInMyHitbox.isAir()){if(!this.climbing&&blockInMyHitbox.isLadder());}if(this.me.climbing);else if(blockInMyHitbox&&blockInMyHitbox.isJumpPad())this.me.position.y+=0.26,this.me.jumping=!0,this.state.onGround=0}#processPathfinding(){let pathLen=this.pathing.activePath.length,lastNode=this.pathing.activePath[pathLen-1],myPos=this.me.position,myFloorY=Math.floor(myPos.y);if(Math.hypot(myPos.x-lastNode.flatCenter.x,myPos.z-lastNode.flatCenter.z)<0.3)this.pathing.activePath=null,this.pathing.activeNode=null,this.pathing.activeNodeIdx=0,this.dispatch(new MovementDispatch_default(0)),this.$emit("pathfindComplete");else{let shouldJump=!1;if(this.pathing.activeNodeIdx<pathLen-1){let currentNode=this.pathing.activePath[this.pathing.activeNodeIdx],nextNode=this.pathing.activePath[this.pathing.activeNodeIdx+1],dx=Math.abs(currentNode.x-nextNode.x),dz=Math.abs(currentNode.z-nextNode.z);if(dx===2&&dz===0||dx===0&&dz===2||dx===2&&dz===1||dx===1&&dz===2||dx===2&&dz===2){let localX=myPos.x-Math.floor(myPos.x),localZ=myPos.z-Math.floor(myPos.z),headingX=nextNode.x>currentNode.x?1:nextNode.x<currentNode.x?-1:0,headingZ=nextNode.z>currentNode.z?1:nextNode.z<currentNode.z?-1:0,distToEdge=0;if(headingX>0)distToEdge=1-localX;else if(headingX<0)distToEdge=localX;else if(headingZ>0)distToEdge=1-localZ;else if(headingZ<0)distToEdge=localZ;if(distToEdge<=0.04)shouldJump=!0}}if(this.pathing.activeNodeIdx<pathLen){let positionTarget=this.pathing.activePath[this.pathing.activeNodeIdx].flatCenter;if(this.state.onGround)this.dispatch(new LookAtPosDispatch_default(positionTarget))}for(let i2=this.pathing.activeNodeIdx;i2<pathLen;i2++){let node=this.pathing.activePath[i2];if(node.flatRadialDistance(myPos)<0.1&&node.y===myFloorY){this.pathing.activeNodeIdx=i2+1,this.pathing.activeNode=this.pathing.activePath[this.pathing.activeNodeIdx];break}}let movementKeys=Movement.Forward|(shouldJump?Movement.Jump:0);this.dispatch(new MovementDispatch_default(movementKeys))}}update(){if(this.hasQuit)return;if(this.pathing.activePath&&this.intents.includes(Intents.PATHFINDING))this.#processPathfinding();for(let i2=this.#dispatches.length-1;i2>=0;i2--){let disp=this.#dispatches[i2];if(disp.check(this))disp.execute(this),this.#dispatches.splice(i2,1)}if(this.state.chatLines=Math.max(0,this.state.chatLines-0.008333333333333333),this.me.playing){let currentIdx=this.state.stateIdx,isBufferDebug=this.intents.includes(Intents.DEBUG_BUFFER);if(isBufferDebug)console.log("setting buffer for idx",currentIdx);if(this.me.jumping=!!(this.state.controlKeys&Movement.Jump),this.state.buffer[currentIdx]={controlKeys:this.state.controlKeys,yaw:this.state.yaw,pitch:this.state.pitch,shotsFired:this.state.shotsFired,position:isBufferDebug?{...this.me.position}:{}},this.state.shotsFired=0,this.intents.includes(Intents.SIMULATION)){let dx=0,dy=0,dz=0,state=this.state.buffer[currentIdx];if(state.controlKeys&Movement.Left)dx-=Math.cos(state.yaw),dz+=Math.sin(state.yaw);if(state.controlKeys&Movement.Right)dx+=Math.cos(state.yaw),dz-=Math.sin(state.yaw);if(state.controlKeys&Movement.Forward)if(this.me.climbing)dy+=1;else dx-=Math.sin(state.yaw),dz-=Math.cos(state.yaw);if(state.controlKeys&Movement.Backward)if(this.me.climbing)dy-=1;else dx+=Math.sin(state.yaw),dz+=Math.cos(state.yaw);if(state.controlKeys&Movement.Jump)this.state.controlKeys^=this.state.controlKeys&Movement.Jump;if(this.me.climbing)this.me.jumping=!1,dy+=dy*0.028,this.me.position.y+=dy,dy*=0.5,this.#processMovement(0,dy,0);else{let mag=Math.sqrt(dx*dx+dy*dy+dz*dz);if(mag>0){let normDx=dx/mag,normDz=dz/mag;dx=this.state.dx+normDx*0.025,dz=this.state.dz+normDz*0.025}else dx=this.state.dx,dz=this.state.dz;dy=this.state.dy-this.game.options.gravity*0.012,dy=Math.max(-0.29,dy);let oldX=this.me.position.x,oldY=this.me.position.y,oldZ=this.me.position.z;if(this.#processMovement(dx,dy,dz),dx=this.me.position.x-oldX,dy=this.me.position.y-oldY,dz=this.me.position.z-oldZ,this.state.onGround&&dy>0){let n=1-(mag===0?0:dy/mag)*0.5;dx*=n,dz*=n}}if(dx*=0.64,dz*=0.64,this.me.climbing)dy*=0.64;this.state.dx=dx,this.state.dy=dy,this.state.dz=dz}if(this.state.stateIdx%FramesBetweenSyncs===0){this.$emit("tick");let out=new CommOut_default;out.packInt8(CommCode_default.syncMe),out.packInt8(this.state.stateIdx),out.packInt8(this.state.serverStateIdx);let startIdx=mod3(this.state.stateIdx-FramesBetweenSyncs+1,StateBufferSize);if(isBufferDebug)console.log("--- START THIS SYNC LOGGING ---");for(let i2=0;i2<FramesBetweenSyncs;i2++){let idx=mod3(startIdx+i2,StateBufferSize),frame=this.state.buffer[idx]||{},keys=frame.controlKeys||0,shots=frame.shotsFired||0,yaw=frame.yaw??this.state.yaw,pitch=frame.pitch??this.state.pitch;if(isBufferDebug)console.log("adding",this.state.stateIdx,startIdx,idx,frame);out.packInt8(keys),out.packInt8(shots),out.packString(coords(yaw,pitch)),out.packInt8(100)}if(out.send(this.game.socket),isBufferDebug)console.log("--- END SYNC LOGGING ---");this.state.buffer=[]}this.state.stateIdx=mod3(this.state.stateIdx+1,StateBufferSize)}if(!this.intents.includes(Intents.PLAYER_HEALTH))return;let regen=0.1*(this.game.isPrivate?this.game.options.healthRegen:1),players=Object.values(this.players);for(let i2=0;i2<players.length;i2++){let player=players[i2];if(player.playing&&player.hp>0){let hasOverHeal=player.streakRewards.includes(ShellStreak.OverHeal);player.hp+=hasOverHeal?-regen:regen,player.hp=hasOverHeal?Math.max(100,player.hp):Math.min(100,player.hp)}if(player.spawnShield>0)player.spawnShield-=6}}on(event,cb){if(Object.keys(this.#hooks).includes(event))this.#hooks[event].push(cb);else this.#hooks[event]=[cb]}onAny(cb){this.#globalHooks.push(cb)}off(event,cb){if(cb)this.#hooks[event]=this.#hooks[event].filter((hook)=>hook!==cb);else this.#hooks[event]=[]}$emit(event,...args){if(this.hasQuit)return;if(this.#hooks[event])for(let cb of this.#hooks[event])cb(...args);for(let cb of this.#globalHooks)cb(event,...args)}emit(event,...args){let dispatch=DispatchIndex[event];if(dispatch)this.dispatch(new dispatch(...args),!0);else throw Error(`no event found for "${event}"`)}updateGameOptions(){let out=new CommOut_default;out.packInt8(CommCode_default.gameOptions),out.packInt8(this.game.options.gravity*4),out.packInt8(this.game.options.damage*4),out.packInt8(this.game.options.healthRegen*4);let flags=(this.game.options.locked?1:0)|(this.game.options.noTeamChange?2:0)|(this.game.options.noTeamShuffle?4:0);out.packInt8(flags),this.game.options.weaponsDisabled.forEach((v)=>out.packInt8(v?1:0)),out.send(this.game.socket)}packetHandlers={[CommCode_default.syncThem]:syncThem_default.bind(null,this),[CommCode_default.fire]:fire_default.bind(null,this),[CommCode_default.hitThem]:hitThem_default.bind(null,this),[CommCode_default.syncMe]:syncMe_default.bind(null,this),[CommCode_default.hitMe]:hitMe_default.bind(null,this),[CommCode_default.swapWeapon]:swapWeapon_default.bind(null,this),[CommCode_default.collectItem]:collectItem_default.bind(null,this),[CommCode_default.respawn]:respawn_default.bind(null,this),[CommCode_default.die]:die_default.bind(null,this),[CommCode_default.pause]:pause_default.bind(null,this),[CommCode_default.chat]:chat_default.bind(null,this),[CommCode_default.addPlayer]:addPlayer_default.bind(null,this),[CommCode_default.removePlayer]:removePlayer_default.bind(null,this),[CommCode_default.eventModifier]:eventModifier_default.bind(null,this),[CommCode_default.metaGameState]:metaGameState_default.bind(null,this),[CommCode_default.beginShellStreak]:beginShellStreak_default.bind(null,this),[CommCode_default.endShellStreak]:endShellStreak_default.bind(null,this),[CommCode_default.hitMeHardBoiled]:hitMeHardBoiled_default.bind(null,this),[CommCode_default.gameOptions]:gameOptions_default.bind(null,this),[CommCode_default.ping]:ping_default.bind(null,this),[CommCode_default.switchTeam]:switchTeam_default.bind(null,this),[CommCode_default.changeCharacter]:changeCharacter_default.bind(null,this),[CommCode_default.reload]:reload_default.bind(null,this),[CommCode_default.explode]:explode_default.bind(null,this),[CommCode_default.throwGrenade]:throwGrenade_default.bind(null,this),[CommCode_default.spawnItem]:spawnItem_default.bind(null,this),[CommCode_default.melee]:melee_default.bind(null,this),[CommCode_default.updateBalance]:updateBalance_default.bind(null,this),[CommCode_default.challengeCompleted]:challengeCompleted_default.bind(null,this),[CommCode_default.gameAction]:gameAction_default.bind(null,this),[CommCode_default.socketReady]:socketReady_default.bind(null,this),[CommCode_default.gameJoined]:gameJoined_default.bind(null,this),[CommCode_default.playerInfo]:playerInfo_default.bind(null,this),[CommCode_default.respawnDenied]:()=>{this.me.playing=!1,this.$emit("respawnDenied")},[CommCode_default.requestGameOptions]:()=>{this.game.isPrivate=!0,this.updateGameOptions()},[CommCode_default.expireUpgrade]:()=>{},[CommCode_default.clientReady]:()=>{},[CommCode_default.musicInfo]:()=>CommIn_default.unPackLongString()};processPacket(packet){if(this.hasQuit)return;if(CommIn_default.init(packet),this.intents.includes(Intents.PACKET_HOOK))this.$emit("packet",packet);let lastCommand=0,lastCode=0;while(CommIn_default.isMoreDataAvailable()){let cmd=CommIn_default.unPackInt8U(),handler=this.packetHandlers[cmd];if(handler)handler();else{if(console.error(`processPacket: got but couldn't identify: ${Object.keys(CommCode_default).find((k)=>CommCode_default[k]===cmd)} ${cmd}`),lastCommand)console.error(`processPacket: it may be a result of the ${lastCommand} command (${lastCode}).`);break}if(lastCommand=Object.keys(CommCode_default).find((k)=>CommCode_default[k]===cmd),lastCode=cmd,this.intents.includes(Intents.LOG_PACKETS))console.log(`[LOG_PACKETS] packet ${lastCommand}: ${lastCode}`)}}async checkChiknWinner(){let response=await this.api.queryServices({cmd:"chicknWinnerReady",id:this.account.id,sessionId:this.account.sessionId});if(!response.ok)return response;return this.account.cw.limit=response.limit,this.account.cw.atLimit=response.limit>=4,this.account.cw.secondsUntilPlay=(this.account.cw.atLimit?response.period:response.span)||0,this.account.cw.canPlayAgain=Date.now()+this.account.cw.secondsUntilPlay*1000,{ok:!0,cw:this.account.cw}}async playChiknWinner(doPrematureCooldownCheck=!0){if(this.account.cw.atLimit||this.account.cw.limit>ChiknWinnerDailyLimit)return createError(ChicknWinnerError.HitDailyLimit);if(this.account.cw.canPlayAgain>Date.now()&&doPrematureCooldownCheck)return createError(ChicknWinnerError.OnCooldown);let response=await this.api.queryServices({cmd:"incentivizedVideoReward",firebaseId:this.account.firebaseId,id:this.account.id,sessionId:this.account.sessionId,token:null});if(!response.ok)return response;if(response.error){if(response.error==="RATELIMITED"||response.error==="RATELMITED")return await this.checkChiknWinner(),createError(ChicknWinnerError.OnCooldown);else if(response.error==="SESSION_EXPIRED")return this.$emit("sessionExpired"),createError(ChicknWinnerError.SessionExpired);return this.errorLogger("unknown Chikn Winner response:",response),this.errorLogger("report this issue at https://yolkbot.xyz/community"),createError(ChicknWinnerError.InternalError)}if(response.reward)return this.account.eggBalance+=response.reward.eggsGiven,response.reward.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),await this.checkChiknWinner(),{ok:!0,...response.reward};return this.errorLogger("unknown Chikn Winner response:",response),this.errorLogger("report this issue at https://yolkbot.xyz/community"),createError(ChicknWinnerError.InternalError)}async resetChiknWinner(){if(this.account.eggBalance<200)return createError(ChicknWinnerError.NotEnoughResetEggs);if(!this.account.cw.atLimit)return createError(ChicknWinnerError.NotAtDailyLimit);let response=await this.api.queryServices({cmd:"chwReset",sessionId:this.account.sessionId});if(!response.ok)return response;if(response.result!=="SUCCESS")return this.errorLogger("unknown Chikn Winner reset response:",response),this.errorLogger("report this issue at https://yolkbot.xyz/community"),createError(ChicknWinnerError.InternalError);return this.account.eggBalance-=200,await this.checkChiknWinner(),{ok:!0,cw:this.account.cw}}canSee(target){if(!this.intents.includes(Intents.PATHFINDING))throw Error("canSee: you need enable the PATHFINDING intent");return this.pathing.nodeList.hasLineOfSight(this.me.position,target.position)}getBestTarget(){let distancePlayers=Object.values(this.players).filter((player)=>player?.playing).filter((player)=>player.hp>0).filter((player)=>player.id!==this.me.id).filter((player)=>this.me.team===0||player.team!==this.me.team).map((player)=>({player,distance:(player.position.x-this.me.position.x)**2+5*(player.position.y-this.me.position.y)**2+(player.position.z-this.me.position.z)**2})).sort((a,b)=>a.distance-b.distance);if(distancePlayers.length)return distancePlayers[0].player;else return null}async refreshChallenges(){let result=await this.api.queryServices({cmd:"challengeGetDaily",sessionId:this.account.sessionId,playerId:this.account.id});if(!result.ok)return result;return this.#importChallenges(result),{ok:!0,challenges:this.account.challenges}}async rerollChallenge(challengeId){let result=await this.api.queryServices({cmd:"challengeRerollSlot",sessionId:this.account.sessionId,slotId:challengeId});if(!result.ok)return result;if(result["0"])return this.#importChallenges(Object.values(result)),{ok:!0,challenges:this.account.challenges};if(Object.values(ChallengeRerollError).includes(result.error))return{ok:!1,error:result.error};return this.errorLogger("rerollChallenge: unknown error response",result),{ok:!1,error:ChallengeRerollError.InternalError}}async claimChallenge(challengeId){let result=await this.api.queryServices({cmd:"challengeClaimReward",sessionId:this.account.sessionId,slotId:challengeId});if(!result.ok)return result;if(result.reward){if(this.#importChallenges(result.challenges),result.reward>0)this.account.eggBalance+=result.reward;return{ok:!0,eggReward:result.reward,updatedChallenges:this.account.challenges}}if(Object.values(ChallengeClaimError).includes(result.error))return{ok:!1,error:result.error};return this.errorLogger("claimChallenge: unknown error response",result),{ok:!1,error:ChallengeClaimError.InternalError}}async refreshBalance(){let result=await this.api.queryServices({cmd:"checkBalance",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId});if(!result.ok)return result;return this.account.eggBalance=result.currentBalance,{ok:!0,currentBalance:result.currentBalance}}async redeemCode(code2){let result=await this.api.queryServices({cmd:"redeem",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,id:this.account.id,code:code2});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggs_given,result.item_ids.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggs_given,itemIds:result.item_ids};if(Object.values(RedeemCodeError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("redeemCode: unknown error response",result),{ok:!1,error:RedeemCodeError.InternalError}}async claimURLReward(reward){let result=await this.api.queryServices({cmd:"urlRewardParams",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,reward});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggsGiven,result.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggsGiven,itemIds:result.itemIds};if(Object.values(ClaimURLError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("claimURLReward: unknown error response",result),{ok:!1,error:ClaimURLError.InternalError}}async claimSocialReward(rewardTag){let result=await this.api.queryServices({cmd:"reward",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,rewardTag});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance+=result.eggsGiven,result.itemIds.forEach((id)=>this.account.ownedItemIds.push(id)),{ok:!0,eggsGiven:result.eggsGiven,itemIds:result.itemIds};if(Object.values(ClaimSocialError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("claimSocialReward: unknown error response",result),{ok:!1,error:ClaimSocialError.InternalError}}async buyItem(itemId){let result=await this.api.queryServices({cmd:"buy",firebaseId:this.account.firebaseId,sessionId:this.account.sessionId,itemId,save:!0});if(!result.ok)return result;if(result.result==="SUCCESS")return this.account.eggBalance=result.currentBalance,this.account.ownedItemIds.push(result.itemId),{ok:!0,itemId:result.itemId,currentBalance:result.currentBalance};if(Object.values(BuyItemError).includes(result.result))return{ok:!1,error:result.result};return this.errorLogger("buyItem: unknown error response",result),{ok:!1,error:BuyItemError.InternalError}}leave(code2=CloseCode_default.mainMenu){if(this.hasQuit)return;if(this.state.inGame=!1,code2>-1)this.game?.socket?.close(code2),this.$emit("leave",code2);if(this.updateIntervalId)clearInterval(this.updateIntervalId);if(this.pingTimeoutId)clearTimeout(this.pingTimeoutId);this.#dispatches=[],this.state.chatLines=0,this.state.reloading=!1,this.state.swappingGun=!1,this.state.usingMelee=!1,this.state.stateIdx=0,this.state.serverStateIdx=0,this.state.shotsFired=0,this.state.buffer=[],this.players={},this.me=new GamePlayer_default({}),this.game=this.#initialGame,this.ping=0,this.lastPingTime=-1,this.lastDeathTime=-1,this.pathing={nodeList:null,activePath:null,activeNode:null,activeNodeIdx:0}}logout(){if(this.account=this.#initialAccount,this.intents.includes(Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval)}quit(cleanupLevel=CleanupLevel.Partial){if(this.hasQuit)return;if(this.hasQuit=!0,this.leave(),this.matchmaker){try{this.matchmaker.close()}catch{}if(cleanupLevel>=CleanupLevel.Partial)this.matchmaker=null}if(this.intents.includes(Intents.NO_AFK_KICK))clearInterval(this.afkKickInterval);if(this.intents.includes(Intents.RENEW_SESSION))clearInterval(this.renewSessionInterval);if(this.pingTimeoutId)clearTimeout(this.pingTimeoutId);if(cleanupLevel>=CleanupLevel.Partial){if(this.api=null,this.packetHandlers=null,this.pathing=null,this.#initialAccount={},this.#initialGame={},this.#hooks={},this.#globalHooks=[],this.#dispatches=[],this.matchmakerListeners=[],cleanupLevel>=CleanupLevel.Full)this.account=null,this.game=null,this.me=null,this.players=null,this.state=null}}}var yolkbot={API,Bot,Enums:exports_enums,yolkws,util:exports_util2,GamePlayer,Comm:{CommIn,CommOut},Constants:exports_constants,Challenges,CloseCode,CommCode,Guns:exports_guns,Items:[],Maps,Dispatches:dispatches_default,WASM:exports_direct};window.yolkbot=yolkbot;