@ar.io/sdk 3.15.0-alpha.1 → 3.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,7 +154,7 @@ Found: ${r.toString().split(`
154
154
  `)}static register(r,n){if(n||(n=r.locale),wmt)try{let l=window;l._ethers&&l._ethers.wordlists&&(l._ethers.wordlists[n]||Yr(l._ethers.wordlists,n,r))}catch{}}};we();Me();_e();we();Me();_e();var Mmt="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",a5=null;function USe(e){if(a5==null&&(a5=Mmt.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Wy.check(e)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw a5=null,new Error("BIP39 Wordlist for en (English) FAILED")}var rG=class extends Wy{constructor(){super("en")}getWord(r){return USe(this),a5[r]}getWordIndex(r){return USe(this),a5.indexOf(r)}},iG=new rG;Wy.register(iG);var SA={en:iG};we();Me();_e();var jSe="hdnode/5.8.0";var EA=new Ur(jSe),Smt=ho.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),xmt=zf("Bitcoin seed"),o5=2147483648;function zSe(e){return(1<<e)-1<<8-e}function Emt(e){return(1<<e)-1}function xA(e){return Tf(Wr(e),32)}function FSe(e){return eG.encode(su([e,q1(Ig(Ig(e)),0,4)]))}function nG(e){if(e==null)return SA.en;if(typeof e=="string"){let r=SA[e];return r==null&&EA.throwArgumentError("unknown locale","wordlist",e),r}return e}var Gy={},Pg="m/44'/60'/0'/0/0",Jm=class e{constructor(r,n,l,i,d,p,v,_){if(r!==Gy)throw new Error("HDNode constructor cannot be called directly");if(n){let y=new _d(n);Yr(this,"privateKey",y.privateKey),Yr(this,"publicKey",y.compressedPublicKey)}else Yr(this,"privateKey",null),Yr(this,"publicKey",Wr(l));Yr(this,"parentFingerprint",i),Yr(this,"fingerprint",q1(tG(Ig(this.publicKey)),0,4)),Yr(this,"address",E0(this.publicKey)),Yr(this,"chainCode",d),Yr(this,"index",p),Yr(this,"depth",v),_==null?(Yr(this,"mnemonic",null),Yr(this,"path",null)):typeof _=="string"?(Yr(this,"mnemonic",null),Yr(this,"path",_)):(Yr(this,"mnemonic",_),Yr(this,"path",_.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return FSe(su([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",Wr(this.depth),this.parentFingerprint,Tf(Wr(this.index),4),this.chainCode,this.privateKey!=null?su(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new e(Gy,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(r){if(r>4294967295)throw new Error("invalid index - "+String(r));let n=this.path;n&&(n+="/"+(r&~o5));let l=new Uint8Array(37);if(r&o5){if(!this.privateKey)throw new Error("cannot derive child of neutered node");l.set(Sr(this.privateKey),1),n&&(n+="'")}else l.set(Sr(this.publicKey));for(let S=24;S>=0;S-=8)l[33+(S>>3)]=r>>24-S&255;let i=Sr(kg(Ym.sha512,this.chainCode,l)),d=i.slice(0,32),p=i.slice(32),v=null,_=null;this.privateKey?v=xA(ho.from(d).add(this.privateKey).mod(Smt)):_=new _d(Wr(d))._addPoint(this.publicKey);let y=n,w=this.mnemonic;return w&&(y=Object.freeze({phrase:w.phrase,path:n,locale:w.locale||"en"})),new e(Gy,v,_,this.fingerprint,xA(p),r,this.depth+1,y)}derivePath(r){let n=r.split("/");if(n.length===0||n[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+r);n[0]==="m"&&n.shift();let l=this;for(let i=0;i<n.length;i++){let d=n[i];if(d.match(/^[0-9]+'$/)){let p=parseInt(d.substring(0,d.length-1));if(p>=o5)throw new Error("invalid path index - "+d);l=l._derive(o5+p)}else if(d.match(/^[0-9]+$/)){let p=parseInt(d);if(p>=o5)throw new Error("invalid path index - "+d);l=l._derive(p)}else throw new Error("invalid path component - "+d)}return l}static _fromSeed(r,n){let l=Sr(r);if(l.length<16||l.length>64)throw new Error("invalid seed");let i=Sr(kg(Ym.sha512,xmt,l));return new e(Gy,xA(i.slice(0,32)),null,"0x00000000",xA(i.slice(32)),0,0,n)}static fromMnemonic(r,n,l){return l=nG(l),r=s5(aG(r,l),l),e._fromSeed(Amt(r,n),{phrase:r,path:"m",locale:l.locale})}static fromSeed(r){return e._fromSeed(r,null)}static fromExtendedKey(r){let n=eG.decode(r);(n.length!==82||FSe(n.slice(0,78))!==r)&&EA.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");let l=n[4],i=Wr(n.slice(5,9)),d=parseInt(Wr(n.slice(9,13)).substring(2),16),p=Wr(n.slice(13,45)),v=n.slice(45,78);switch(Wr(n.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new e(Gy,null,Wr(v),i,p,d,l,null);case"0x0488ade4":case"0x04358394 ":if(v[0]!==0)break;return new e(Gy,Wr(v.slice(1)),null,i,p,d,l,null)}return EA.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}};function Amt(e,r){r||(r="");let n=zf("mnemonic"+r,cd.NFKD);return Bg(zf(e,cd.NFKD),n,2048,64,"sha512")}function aG(e,r){r=nG(r),EA.checkNormalize();let n=r.split(e);if(n.length%3!==0)throw new Error("invalid mnemonic");let l=Sr(new Uint8Array(Math.ceil(11*n.length/8))),i=0;for(let y=0;y<n.length;y++){let w=r.getWordIndex(n[y].normalize("NFKD"));if(w===-1)throw new Error("invalid mnemonic");for(let S=0;S<11;S++)w&1<<10-S&&(l[i>>3]|=1<<7-i%8),i++}let d=32*n.length/3,p=n.length/3,v=zSe(p);if((Sr(Ig(l.slice(0,d/8)))[0]&v)!==(l[l.length-1]&v))throw new Error("invalid checksum");return Wr(l.slice(0,d/8))}function s5(e,r){if(r=nG(r),e=Sr(e),e.length%4!==0||e.length<16||e.length>32)throw new Error("invalid entropy");let n=[0],l=11;for(let p=0;p<e.length;p++)l>8?(n[n.length-1]<<=8,n[n.length-1]|=e[p],l-=8):(n[n.length-1]<<=l,n[n.length-1]|=e[p]>>8-l,n.push(e[p]&Emt(8-l)),l+=3);let i=e.length/4,d=Sr(Ig(e))[0]&zSe(i);return n[n.length-1]<<=i,n[n.length-1]|=d>>8-i,r.join(n.map(p=>r.getWord(p)))}we();Me();_e();we();Me();_e();we();Me();_e();var HSe="random/5.8.0";var oG=new Ur(HSe);function Rmt(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}var KSe=Rmt(),AA=KSe.crypto||KSe.msCrypto;(!AA||!AA.getRandomValues)&&(oG.warn("WARNING: Missing strong random number source"),AA={getRandomValues:function(e){return oG.throwError("no secure random source avaialble",Ur.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function Xm(e){(e<=0||e>1024||e%1||e!=e)&&oG.throwArgumentError("invalid length","length",e);let r=new Uint8Array(e);return AA.getRandomValues(r),Sr(r)}we();Me();_e();we();Me();_e();var hG=$n(fG());we();Me();_e();var RA="json-wallets/5.8.0";we();Me();_e();function K1(e){return typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),Sr(e)}function Vy(e,r){for(e=String(e);e.length<r;)e="0"+e;return e}function f5(e){return typeof e=="string"?zf(e,cd.NFKC):Sr(e)}function lo(e,r){let n=e,l=r.toLowerCase().split("/");for(let i=0;i<l.length;i++){let d=null;for(let p in n)if(p.toLowerCase()===l[i]){d=n[p];break}if(d===null)return null;n=d}return n}function WSe(e){let r=Sr(e);r[6]=r[6]&15|64,r[8]=r[8]&63|128;let n=Wr(r);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join("-")}var Tmt=new Ur(RA),uG=class extends xg{isCrowdsaleAccount(r){return!!(r&&r._isCrowdsaleAccount)}};function lG(e,r){let n=JSON.parse(e);r=f5(r);let l=If(lo(n,"ethaddr")),i=K1(lo(n,"encseed"));(!i||i.length%16!==0)&&Tmt.throwArgumentError("invalid encseed","json",e);let d=Sr(Bg(r,r,2e3,32,"sha256")).slice(0,16),p=i.slice(0,16),v=i.slice(16),_=new hG.default.ModeOfOperation.cbc(d,p),y=hG.default.padding.pkcs7.strip(Sr(_.decrypt(v))),w="";for(let x=0;x<y.length;x++)w+=String.fromCharCode(y[x]);let S=zf(w),M=fo(S);return new uG({_isCrowdsaleAccount:!0,address:l,privateKey:M})}we();Me();_e();function cG(e){let r=null;try{r=JSON.parse(e)}catch{return!1}return r.encseed&&r.ethaddr}function dG(e){let r=null;try{r=JSON.parse(e)}catch{return!1}return!(!r.version||parseInt(r.version)!==r.version||parseInt(r.version)!==3)}we();Me();_e();var Z1=$n(fG()),TA=$n(VSe());var Imt=function(e,r,n,l){function i(d){return d instanceof n?d:new n(function(p){p(d)})}return new(n||(n=Promise))(function(d,p){function v(w){try{y(l.next(w))}catch(S){p(S)}}function _(w){try{y(l.throw(w))}catch(S){p(S)}}function y(w){w.done?d(w.value):i(w.value).then(v,_)}y((l=l.apply(e,r||[])).next())})},mG=new Ur(RA);function YSe(e){return e!=null&&e.mnemonic&&e.mnemonic.phrase}var vG=class extends xg{isKeystoreAccount(r){return!!(r&&r._isKeystoreAccount)}};function kmt(e,r,n){if(lo(e,"crypto/cipher")==="aes-128-ctr"){let i=K1(lo(e,"crypto/cipherparams/iv")),d=new Z1.default.Counter(i),p=new Z1.default.ModeOfOperation.ctr(r,d);return Sr(p.decrypt(n))}return null}function JSe(e,r){let n=K1(lo(e,"crypto/ciphertext"));if(Wr(fo(su([r.slice(16,32),n]))).substring(2)!==lo(e,"crypto/mac").toLowerCase())throw new Error("invalid password");let i=kmt(e,r.slice(0,16),n);i||mG.throwError("unsupported cipher",Ur.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});let d=r.slice(32,64),p=E0(i);if(e.address){let _=e.address.toLowerCase();if(_.substring(0,2)!=="0x"&&(_="0x"+_),If(_)!==p)throw new Error("address mismatch")}let v={_isKeystoreAccount:!0,address:p,privateKey:Wr(i)};if(lo(e,"x-ethers/version")==="0.1"){let _=K1(lo(e,"x-ethers/mnemonicCiphertext")),y=K1(lo(e,"x-ethers/mnemonicCounter")),w=new Z1.default.Counter(y),S=new Z1.default.ModeOfOperation.ctr(d,w),M=lo(e,"x-ethers/path")||Pg,x=lo(e,"x-ethers/locale")||"en",E=Sr(S.decrypt(_));try{let T=s5(E,x),I=Jm.fromMnemonic(T,null,x).derivePath(M);if(I.privateKey!=v.privateKey)throw new Error("mnemonic mismatch");v.mnemonic=I.mnemonic}catch(T){if(T.code!==Ur.errors.INVALID_ARGUMENT||T.argument!=="wordlist")throw T}}return new vG(v)}function XSe(e,r,n,l,i){return Sr(Bg(e,r,n,l,i))}function Bmt(e,r,n,l,i){return Promise.resolve(XSe(e,r,n,l,i))}function QSe(e,r,n,l,i){let d=f5(r),p=lo(e,"crypto/kdf");if(p&&typeof p=="string"){let v=function(_,y){return mG.throwArgumentError("invalid key-derivation function parameters",_,y)};if(p.toLowerCase()==="scrypt"){let _=K1(lo(e,"crypto/kdfparams/salt")),y=parseInt(lo(e,"crypto/kdfparams/n")),w=parseInt(lo(e,"crypto/kdfparams/r")),S=parseInt(lo(e,"crypto/kdfparams/p"));(!y||!w||!S)&&v("kdf",p),(y&y-1)!==0&&v("N",y);let M=parseInt(lo(e,"crypto/kdfparams/dklen"));return M!==32&&v("dklen",M),l(d,_,y,w,S,64,i)}else if(p.toLowerCase()==="pbkdf2"){let _=K1(lo(e,"crypto/kdfparams/salt")),y=null,w=lo(e,"crypto/kdfparams/prf");w==="hmac-sha256"?y="sha256":w==="hmac-sha512"?y="sha512":v("prf",w);let S=parseInt(lo(e,"crypto/kdfparams/c")),M=parseInt(lo(e,"crypto/kdfparams/dklen"));return M!==32&&v("dklen",M),n(d,_,S,M,y)}}return mG.throwArgumentError("unsupported key-derivation function","kdf",p)}function exe(e,r){let n=JSON.parse(e),l=QSe(n,r,XSe,TA.default.syncScrypt);return JSe(n,l)}function txe(e,r,n){return Imt(this,void 0,void 0,function*(){let l=JSON.parse(e),i=yield QSe(l,r,Bmt,TA.default.scrypt,n);return JSe(l,i)})}function gG(e,r,n,l){try{if(If(e.address)!==E0(e.privateKey))throw new Error("address/privateKey mismatch");if(YSe(e)){let I=e.mnemonic;if(Jm.fromMnemonic(I.phrase,null,I.locale).derivePath(I.path||Pg).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(I){return Promise.reject(I)}typeof n=="function"&&!l&&(l=n,n={}),n||(n={});let i=Sr(e.privateKey),d=f5(r),p=null,v=null,_=null;if(YSe(e)){let I=e.mnemonic;p=Sr(aG(I.phrase,I.locale||"en")),v=I.path||Pg,_=I.locale||"en"}let y=n.client;y||(y="ethers.js");let w=null;n.salt?w=Sr(n.salt):w=Xm(32);let S=null;if(n.iv){if(S=Sr(n.iv),S.length!==16)throw new Error("invalid iv")}else S=Xm(16);let M=null;if(n.uuid){if(M=Sr(n.uuid),M.length!==16)throw new Error("invalid uuid")}else M=Xm(16);let x=1<<17,E=8,T=1;return n.scrypt&&(n.scrypt.N&&(x=n.scrypt.N),n.scrypt.r&&(E=n.scrypt.r),n.scrypt.p&&(T=n.scrypt.p)),TA.default.scrypt(d,w,x,E,T,64,l).then(I=>{I=Sr(I);let B=I.slice(0,16),O=I.slice(16,32),N=I.slice(32,64),H=new Z1.default.Counter(S),K=new Z1.default.ModeOfOperation.ctr(B,H),J=Sr(K.encrypt(i)),L=fo(su([O,J])),$={address:e.address.substring(2).toLowerCase(),id:WSe(M),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Wr(S).substring(2)},ciphertext:Wr(J).substring(2),kdf:"scrypt",kdfparams:{salt:Wr(w).substring(2),n:x,dklen:32,p:T,r:E},mac:L.substring(2)}};if(p){let V=Xm(16),h=new Z1.default.Counter(V),t=new Z1.default.ModeOfOperation.ctr(N,h),a=Sr(t.encrypt(p)),s=new Date,u=s.getUTCFullYear()+"-"+Vy(s.getUTCMonth()+1,2)+"-"+Vy(s.getUTCDate(),2)+"T"+Vy(s.getUTCHours(),2)+"-"+Vy(s.getUTCMinutes(),2)+"-"+Vy(s.getUTCSeconds(),2)+".0Z";$["x-ethers"]={client:y,gethFilename:"UTC--"+u+"--"+$.address,mnemonicCounter:Wr(V).substring(2),mnemonicCiphertext:Wr(a).substring(2),path:v,locale:_,version:"0.1"}}return JSON.stringify($)})}function rxe(e,r,n){if(cG(e)){n&&n(0);let l=lG(e,r);return n&&n(1),Promise.resolve(l)}return dG(e)?txe(e,r,n):Promise.reject(new Error("invalid JSON wallet"))}function ixe(e,r){if(cG(e))return lG(e,r);if(dG(e))return exe(e,r);throw new Error("invalid JSON wallet")}we();Me();_e();var nxe="wallet/5.8.0";var axe=function(e,r,n,l){function i(d){return d instanceof n?d:new n(function(p){p(d)})}return new(n||(n=Promise))(function(d,p){function v(w){try{y(l.next(w))}catch(S){p(S)}}function _(w){try{y(l.throw(w))}catch(S){p(S)}}function y(w){w.done?d(w.value):i(w.value).then(v,_)}y((l=l.apply(e,r||[])).next())})},Yy=new Ur(nxe);function Pmt(e){return e!=null&&cs(e.privateKey,32)&&e.address!=null}function Omt(e){let r=e.mnemonic;return r&&r.phrase}var Jy=class e extends _A{constructor(r,n){if(super(),Pmt(r)){let l=new _d(r.privateKey);if(Yr(this,"_signingKey",()=>l),Yr(this,"address",E0(this.publicKey)),this.address!==If(r.address)&&Yy.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),Omt(r)){let i=r.mnemonic;Yr(this,"_mnemonic",()=>({phrase:i.phrase,path:i.path||Pg,locale:i.locale||"en"}));let d=this.mnemonic,p=Jm.fromMnemonic(d.phrase,null,d.locale).derivePath(d.path);E0(p.privateKey)!==this.address&&Yy.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else Yr(this,"_mnemonic",()=>null)}else{if(_d.isSigningKey(r))r.curve!=="secp256k1"&&Yy.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),Yr(this,"_signingKey",()=>r);else{typeof r=="string"&&r.match(/^[0-9a-f]*$/i)&&r.length===64&&(r="0x"+r);let l=new _d(r);Yr(this,"_signingKey",()=>l)}Yr(this,"_mnemonic",()=>null),Yr(this,"address",E0(this.publicKey))}n&&!wA.isProvider(n)&&Yy.throwArgumentError("invalid provider","provider",n),Yr(this,"provider",n||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(r){return new e(this,r)}signTransaction(r){return j1(r).then(n=>{n.from!=null&&(If(n.from)!==this.address&&Yy.throwArgumentError("transaction from address mismatch","transaction.from",r.from),delete n.from);let l=this._signingKey().signDigest(fo(QW(n)));return QW(n,l)})}signMessage(r){return axe(this,void 0,void 0,function*(){return AW(this._signingKey().signDigest(Zm(r)))})}_signTypedData(r,n,l){return axe(this,void 0,void 0,function*(){let i=yield Eg.resolveNames(r,n,l,d=>(this.provider==null&&Yy.throwError("cannot resolve ENS names without a provider",Ur.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:d}),this.provider.resolveName(d)));return AW(this._signingKey().signDigest(Eg.hash(i.domain,n,i.value)))})}encrypt(r,n,l){if(typeof n=="function"&&!l&&(l=n,n={}),l&&typeof l!="function")throw new Error("invalid callback");return n||(n={}),gG(this,r,n,l)}static createRandom(r){let n=Xm(16);r||(r={}),r.extraEntropy&&(n=Sr(q1(fo(su([n,r.extraEntropy])),0,16)));let l=s5(n,r.locale);return e.fromMnemonic(l,r.path,r.locale)}static fromEncryptedJson(r,n,l){return rxe(r,n,l).then(i=>new e(i))}static fromEncryptedJsonSync(r,n){return new e(ixe(r,n))}static fromMnemonic(r,n,l){return n||(n=Pg),new e(Jm.fromMnemonic(r,null,l).derivePath(n))}};function oxe(e,r){return XW(Zm(e),r)}function IA(e,r,n,l){return XW(Eg.hash(e,r,n),l)}var Og=class{signer;publicKey;ownerLength=fn[ni.ETHEREUM].pubLength;signatureLength=fn[ni.ETHEREUM].sigLength;signatureType=ni.ETHEREUM;constructor(r){this.signer=r.getSigner()}async setPublicKey(){let r="sign this message to connect to Bundlr.Network",n=await this.signer.signMessage(r),l=await Zm(r),i=yA(Sr(l),n);this.publicKey=ze.from(Sr(i))}async sign(r){this.publicKey||await this.setPublicKey();let n=await this.signer.signMessage(r);return ze.from(n.slice(2),"hex")}static verify(r,n,l){let i=E0(r);return oxe(n,l)===i}};we();Me();_e();var Xy=$n(dxe(),1),W1=class extends nu{get publicKey(){return Xy.default.decode(this.pk)}get key(){return Xy.default.decode(this._key)}constructor(r){let n=Xy.default.decode(r);super(Xy.default.encode(n.subarray(0,32)),Xy.default.encode(n.subarray(32,64)))}};we();Me();_e();we();Me();_e();we();Me();_e();var vRe=$n(Cu(),1),ZV=$n(CG(),1);we();Me();_e();ah();var hRe=$n(fRe(),1);function KV(e){return e=uRe(e),(0,hRe.default)("keccak256").update(e).digest()}function uRe(e){if(!ze.isBuffer(e))if(Array.isArray(e))e=ze.from(e);else if(typeof e=="string")lRe(e)?e=ze.from(lR(cRe(e)),"hex"):e=ze.from(e);else if(typeof e=="number")e=pRe(e);else if(typeof e=="bigint")e=_bt(e);else if(e==null)e=ze.allocUnsafe(0);else throw new Error("invalid type");return e}function lRe(e,r){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||r&&e.length!==2+2*r)}function lR(e){if(typeof e!="string")throw new Error(`while padding to even, value must be string, is currently ${typeof e}, while padToEven.`);return e.length%2&&(e=`0${e}`),e}function cRe(e){return typeof e!="string"?e:dRe(e)?e.slice(2):e}function dRe(e){if(typeof e!="string")throw new Error("value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return e.startsWith("0x")}function pRe(e){let r=mRe(e);return ze.from(lR(r.slice(2)),"hex")}function mRe(e){return`0x${e.toString(16)}`}function _bt(e){let r=e.toString(16);return ze.from(lR(r),"hex")}typeof window<"u"&&(window.keccak256=KV);var x5=KV,Mbt={intToBuffer:pRe,intToHex:mRe,isHexPrefixed:dRe,stripHexPrefix:cRe,padToEven:lR,isHexString:lRe,toBuffer:uRe};var Vg=class{_key;ownerLength=fn[ni.ETHEREUM].pubLength;signatureLength=fn[ni.ETHEREUM].sigLength;signatureType=ni.ETHEREUM;pk;constructor(r,n){this._key=r,this.pk=n.toString("hex")}get publicKey(){throw new Error("You must implement `publicKey`")}get key(){return ze.from(this._key,"hex")}static async verify(r,n,l){let i=r;typeof r=="string"&&(i=vRe.default.toBuffer(r));let d=!1;try{d=ZV.default.ecdsaVerify(l,x5(ze.from(n)),i)}catch{}return d}async sign(r){return ZV.default.ecdsaSign(x5(ze.from(r)),ze.from(this.key)).signature}};var WV=$n(CG(),1),gRe=$n(Cu(),1);var of=class extends Vg{get publicKey(){return ze.from(this.pk,"hex")}constructor(r){r.startsWith("0x")&&(r=r.slice(2));let n=ze.from(r,"hex"),l=WV.default.publicKeyCreate(n,!1);super(r,ze.from(l))}async sign(r){return new Jy(this._key).signMessage(r).then(l=>ze.from(l.slice(2),"hex"))}static async verify(r,n,l){return WV.default.ecdsaVerify(l.length===65?l.slice(0,-1):l,Sr(Zm(n)),typeof r=="string"?gRe.default.toBuffer(r):r)}};var E5=class extends of{};we();Me();_e();var A5=class extends W1{constructor(r){super(r.replace("ed25519:",""))}};we();Me();_e();var R5=class extends nu{get publicKey(){return ze.from(this.pk)}get key(){return ze.from(this._key)}constructor(r,n){super(r.subarray(0,32),n)}};we();Me();_e();var Yg=class extends Mg{signatureType=4;constructor(r){super(r)}async sign(r){return super.sign(ze.from(ze.from(r).toString("hex")))}static async verify(r,n,l){return super.verify(r,ze.from(ze.from(n).toString("hex")),l)}};we();Me();_e();var T5=class extends W1{signatureType=4;constructor(r){super(r)}async sign(r){return super.sign(ze.from(ze.from(r).toString("hex")))}static async verify(r,n,l){return super.verify(r,ze.from(ze.from(n).toString("hex")),l)}};we();Me();_e();var I5=class extends nu{constructor(r,n){super(r,n)}get publicKey(){return ze.from(this.pk.slice(2),"hex")}get key(){return ze.from(this._key.slice(2),"hex")}};we();Me();_e();var Jg=class{_publicKey;ownerLength=fn[ni.INJECTEDAPTOS].pubLength;signatureLength=fn[ni.INJECTEDAPTOS].sigLength;signatureType=ni.INJECTEDAPTOS;pem;provider;constructor(r,n){this.provider=r,this._publicKey=n}get publicKey(){return this._publicKey}async sign(r){if(!this.provider.signMessage)throw new Error("Selected Wallet does not support message signing");let l=(await this.provider.signMessage({message:ze.from(r).toString("hex"),nonce:"bundlr"})).signature;return typeof l=="string"?ze.from(l,"hex"):l.data.toUint8Array()}static async verify(r,n,l){let i=r;return $m(ze.from(l),ze.from(`APTOS
155
155
  message: ${ze.from(n).toString("hex")}
156
156
  nonce: bundlr`),ze.from(i))}};we();Me();_e();var Xg=class{_publicKey;ownerLength=fn[ni.MULTIAPTOS].pubLength;signatureLength=fn[ni.MULTIAPTOS].sigLength;signatureType=ni.MULTIAPTOS;collectSignatures;provider;constructor(r,n){this._publicKey=r,this.collectSignatures=n}get publicKey(){return this._publicKey}async sign(r){let{signatures:n,bitmap:l}=await this.collectSignatures(r),i=128,d=new Uint8Array([0,0,0,0]),p=new Set;l.forEach(y=>{if(y>=32)throw new Error(`Invalid bit value ${y}.`);if(p.has(y))throw new Error("Duplicated bits detected.");p.add(y);let w=Math.floor(y/8),S=d[w];S|=i>>y%8,d[w]=S});let v=ze.alloc(this.signatureLength),_=0;for(let y=0;y<32;y++)l.includes(y)&&v.set(n[_++],y*64);return v.set(d,this.signatureLength-4),v}static async verify(r,n,l){let d=fn[ni.MULTIAPTOS].sigLength-4,p=l.slice(0,d),v=l.slice(d),_=!1;for(let y=0;y<32;y++){let w=Math.floor(y/8),S=y-w*8;if((v[w]&128>>S)!==0){let x=p.slice(y*64,(y+1)*64),E=r.slice(y*32,(y+1)*32);await $m(ze.from(x),ze.from(n),ze.from(E))||(_=!0)}}return!_}};we();Me();_e();var Qg=class extends of{ownerLength=fn[ni.TYPEDETHEREUM].pubLength;signatureLength=fn[ni.TYPEDETHEREUM].sigLength;signatureType=ni.TYPEDETHEREUM;address;signer;constructor(r){super(r),this.address="0x"+x5(super.publicKey.slice(1)).slice(-20).toString("hex"),this.signer=new Jy(r)}get publicKey(){return ze.from(this.address)}async sign(r){let n=await this.signer._signTypedData(k5,B5,{address:this.address,"Transaction hash":r});return ze.from(n.slice(2),"hex")}static async verify(r,n,l){let i=r.toString(),d=IA(k5,B5,{address:i,"Transaction hash":n},l);return i.toLowerCase()===d.toLowerCase()}},k5={name:"Bundlr",version:"1"},B5={Bundlr:[{name:"Transaction hash",type:"bytes"},{name:"address",type:"address"}]};we();Me();_e();var GV=class{ownerLength=fn[ni.TYPEDETHEREUM].pubLength;signatureLength=fn[ni.TYPEDETHEREUM].sigLength;signatureType=ni.TYPEDETHEREUM;address;signer;publicKey;constructor(r){this.signer=r.getSigner()}async ready(){this.address=(await this.signer.getAddress()).toString().toLowerCase(),this.publicKey=ze.from(this.address)}async sign(r){let n=await this.signer._signTypedData(k5,B5,{address:this.address,"Transaction hash":r});return ze.from(n.slice(2),"hex")}static verify(r,n,l){let i=r.toString(),d=IA(k5,B5,{address:i,"Transaction hash":n},l);return i.toLowerCase()===d.toLowerCase()}};we();Me();_e();var bRe=$n(Cu(),1);var rc=class{signer;publicKey;ownerLength=fn[ni.ARWEAVE].pubLength;signatureLength=fn[ni.ARWEAVE].sigLength;signatureType=ni.ARWEAVE;constructor(r){this.signer=r}async setPublicKey(){let r=await this.signer.getActivePublicKey();this.publicKey=bRe.default.toBuffer(r)}async sign(r){this.publicKey||await this.setPublicKey();let n={name:"RSA-PSS",saltLength:32},l=await this.signer.signature(r,n);return new Uint8Array(Object.values(l).map(d=>+d))}static async verify(r,n,l){return await qo().verify(r,n,l)}};we();Me();_e();var P5=class extends of{signatureType=ni.KYVE};var O5={1:zl,2:nu,3:of,4:Yg,5:Jg,6:Xg,7:Qg};we();Me();_e();we();Me();_e();async function Sbt(e){return qm([(0,ba.stringToBuffer)("dataitem"),(0,ba.stringToBuffer)("1"),(0,ba.stringToBuffer)(e.signatureType.toString()),e.rawOwner,e.rawTarget,e.rawAnchor,e.rawTags,e.rawData])}var N5=Sbt;we();Me();_e();we();Me();_e();function C5(e,r){let n=new Uint8Array(e);if(r<0)throw new Error("Array is unsigned, cannot represent -ve numbers");if(r>2**(e*8)-1)throw new Error(`Number ${r} is too large for an array of ${e} bytes`);for(let l=0;l<n.length;l++){let i=r&255;n[l]=i,r=(r-i)/256}return n}function cR(e){return C5(8,e)}function VV(e){return C5(2,e)}function xbt(e){return C5(16,e)}function dR(e){return C5(32,e)}function Po(e){let r=0;for(let n=e.length-1;n>=0;n--)r=r*256+e[n];return r}we();Me();_e();var D5=$n(Cu(),1);we();Me();_e();var O0=$n(Cu(),1);ah();we();Me();_e();var L5=class{buf;pos;constructor(r=ze.alloc(pR),n=0){this.buf=r,this.pos=n}writeTags(r){if(!Array.isArray(r))throw new Error("input must be array");let n=r.length,l;if(n)for(this.writeLong(n),l=0;l<n;l++){let i=r[l];if(typeof i?.name!="string"||typeof i?.value!="string")throw new Error(`Invalid tag format for ${i}, expected {name:string, value: string}`);this.writeString(i.name),this.writeString(i.value)}this.writeLong(0)}toBuffer(){let r=ze.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(r,0,0,this.pos),r}writeLong(r){let n=this.buf,l,i;if(r>=-1073741824&&r<1073741824){i=r>=0?r<<1:~r<<1|1;do n[this.pos]=i&127,i>>=7;while(i&&(n[this.pos++]|=128))}else{l=r>=0?r*2:-r*2-1;do n[this.pos]=l&127,l/=128;while(l>=1&&(n[this.pos++]|=128))}this.pos++,this.buf=n}writeString(r){let n=ze.byteLength(r),l=this.buf;this.writeLong(n);let i=this.pos;if(this.pos+=n,!(this.pos>l.length)){if(n>64)this.buf.write(r,this.pos-n,n,"utf8");else{let d,p,v,_;for(d=0,p=n;d<p;d++)v=r.charCodeAt(d),v<128?l[i++]=v:v<2048?(l[i++]=v>>6|192,l[i++]=v&63|128):(v&64512)===55296&&((_=r.charCodeAt(d+1))&64512)===56320?(v=65536+((v&1023)<<10)+(_&1023),d++,l[i++]=v>>18|240,l[i++]=v>>12&63|128,l[i++]=v>>6&63|128,l[i++]=v&63|128):(l[i++]=v>>12|224,l[i++]=v>>6&63|128,l[i++]=v&63|128)}this.buf=l}}readLong(){let r=0,n=0,l=this.buf,i,d,p,v;do i=l[this.pos++],d=i&128,r|=(i&127)<<n,n+=7;while(d&&n<28);if(d){p=r,v=268435456;do i=l[this.pos++],p+=(i&127)*v,v*=128;while(i&128);return(p%2?-(p+1):p)/2}return r>>1^-(r&1)}skipLong(){let r=this.buf;for(;r[this.pos++]&128;);}readTags(){let r=[],n;for(;n=this.readLong();)for(n<0&&(n=-n,this.skipLong());n--;){let l=this.readString(),i=this.readString();r.push({name:l,value:i})}return r}readString(){let r=this.readLong(),n=this.pos,l=this.buf;if(this.pos+=r,this.pos>l.length)throw new Error("TAP Position out of range");return this.buf.slice(n,n+r).toString()}};function YV(e){if(e?.length===0)return ze.allocUnsafe(0);let r=new L5;return r.writeTags(e),r.toBuffer()}function l3(e){return new L5(e).readTags()}sd();var mR=80,pR=4096,c3=class e{binary;_id;constructor(r){this.binary=r}static isDataItem(r){return r.binary!==void 0}get signatureType(){let r=Po(this.binary.subarray(0,2));if(ni?.[r]!==void 0)return r;throw new Error("Unknown signature type: "+r)}async isValid(){return e.verify(this.binary)}get id(){return O0.default.encode(this.rawId)}set id(r){this._id=O0.default.toBuffer(r)}get rawId(){return Ul("sha256").update(this.rawSignature).digest()}set rawId(r){this._id=r}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return O0.default.encode(this.rawSignature)}set rawOwner(r){if(r.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${r.byteLength} bytes.`);this.binary.set(r,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return fn[this.signatureType].sigLength}get owner(){return O0.default.encode(this.rawOwner)}get ownerLength(){return fn[this.signatureType].pubLength}get rawTarget(){let r=this.getTargetStart();return this.binary[r]==1?this.binary.subarray(r+1,r+33):ze.alloc(0)}get target(){return O0.default.encode(this.rawTarget)}get rawAnchor(){let r=this.getAnchorStart();return this.binary[r]==1?this.binary.subarray(r+1,r+33):ze.alloc(0)}get anchor(){return O0.default.encode(this.rawAnchor)}get rawTags(){let r=this.getTagsStart(),n=Po(this.binary.subarray(r+8,r+16));return this.binary.subarray(r+16,r+16+n)}get tags(){let r=this.getTagsStart();if(Po(this.binary.subarray(r,r+8))==0)return[];let l=Po(this.binary.subarray(r+8,r+16));return l3(ze.from(this.binary.subarray(r+16,r+16+l)))}get tagsB64Url(){return this.tags.map(n=>({name:O0.default.encode(n.name),value:O0.default.encode(n.value)}))}getStartOfData(){let r=this.getTagsStart(),n=this.binary.subarray(r+8,r+16),l=Po(n);return r+16+l}get rawData(){let r=this.getTagsStart(),n=this.binary.subarray(r+8,r+16),l=Po(n),i=r+16+l;return this.binary.subarray(i,this.binary.length)}get data(){return O0.default.encode(this.rawData)}getRaw(){return this.binary}async sign(r){return this._id=await vR(this,r),this.rawId}async setSignature(r){this.binary.set(r,2),this._id=ze.from(await qo().hash(r))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(r=>({name:O0.default.encode(r.name),value:O0.default.encode(r.value)})),data:this.data}}static async verify(r){if(r.byteLength<mR)return!1;let n=new e(r),l=n.signatureType,i=n.getTagsStart(),d=Po(r.subarray(i,i+8)),p=r.subarray(i+8,i+16),v=Po(p);if(v>pR)return!1;if(d>0)try{if(l3(ze.from(r.subarray(i+16,i+16+v))).length!==d)return!1}catch{return!1}let _=O5[l],y=await N5(n);return await _.verify(n.rawOwner,y,n.rawSignature)}async getSignatureData(){return N5(this)}getTagsStart(){let r=this.getTargetStart(),n=this.binary[r]==1,l=r+(n?33:1),i=this.binary[l]==1;return l+=i?33:1,l}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let r=this.getTargetStart()+1,n=this.binary[this.getTargetStart()]==1;return r+=n?32:0,r}},d3=c3;sd();var Td=32,gR=class{length;items;binary;constructor(r){this.binary=r,this.length=this.getDataItemCount(),this.items=this.getItems()}getRaw(){return this.binary}get(r){if(typeof r=="number"){if(r>=this.length)throw new RangeError("Index out of range");return this.getByIndex(r)}else return this.getById(r)}getSizes(){let r=[];for(let n=Td;n<Td+64*this.length;n+=64)r.push(Po(this.binary.subarray(n,n+32)));return r}getIds(){let r=[];for(let n=Td;n<Td+64*this.length;n+=64){let l=this.binary.subarray(n+32,n+64);if(l.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");r.push(D5.default.encode(l))}return r}getIdBy(r){if(r>this.length-1)throw new RangeError("Index of bundle out of range");let n=64+64*r;return D5.default.encode(this.binary.subarray(n,n+32))}async toTransaction(r,n,l){let i=await n.createTransaction({data:this.binary,...r},l);return i.addTag("Bundle-Format","binary"),i.addTag("Bundle-Version","2.0.0"),i}async verify(){for(let r of this.items){let n=await r.isValid(),l=(0,D5.default)(Ul("sha256").update(r.rawSignature).digest());if(!(n&&r.id===l))return!1}return!0}getOffset(r){let n=0;for(let l=Td;l<Td+64*this.length;l+=64){let i=Po(this.binary.subarray(l,l+32));n+=i;let d=this.binary.subarray(l+32,l+64);if(ze.compare(d,r)===0)return{startOffset:n,size:i}}return{startOffset:-1,size:-1}}getByIndex(r){let n=0,l=this.getBundleStart(),i=0,d,p;for(let w=Td;w<Td+64*this.length;w+=64){if(d=Po(this.binary.subarray(w,w+32)),i++===r){p=this.binary.subarray(w+32,w+64);break}n+=d}let v=l+n,_=this.binary.subarray(v,v+d),y=new d3(_);return y.rawId=p,y}getById(r){let n=D5.default.toBuffer(r),l=this.getOffset(n);if(l.startOffset===-1)throw new Error("Transaction not found");let d=this.getBundleStart()+l.startOffset;return new d3(this.binary.subarray(d,d+l.size))}getDataItemCount(){return Po(this.binary.subarray(0,32))}getBundleStart(){return 32+64*this.length}getItems(){let r=new Array(this.length),n=0,l=this.getBundleStart(),i=0;for(let d=Td;d<Td+64*this.length;d+=64){let p=Po(this.binary.subarray(d,d+32)),v=this.binary.subarray(d+32,d+64);if(v.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");let _=l+n,y=this.binary.subarray(_,_+p);n+=p;let w=new d3(y);w.rawId=v,r[i]=w,i++}return r}},JV=gR;function Ebt(e){return new JV(e)}async function Abt(e,r){let n=new Uint8Array(64*e.length),l=await Promise.all(e.map(async(d,p)=>{let v=d.isSigned()?d.rawId:await vR(d,r),_=new Uint8Array(64);return _.set(dR(d.getRaw().byteLength),0),_.set(v,32),n.set(_,64*p),d.getRaw()})).then(d=>ze.concat(d)),i=ze.concat([ze.from(dR(e.length)),ze.from(n),l]);return new JV(i)}async function yRe(e,r){let n=await N5(e),l=await r.sign(n),i=await qo().hash(l);return{signature:ze.from(l),id:ze.from(i)}}async function vR(e,r){let{signature:n,id:l}=await yRe(e,r);return e.getRaw().set(n,2),l}we();Me();_e();var wRe=$n(Cu(),1);function $5(e,r,n){let l=r.publicKey,i=n?.target?wRe.default.toBuffer(n.target):null,d=1+(i?.byteLength??0),p=n?.anchor?ze.from(n.anchor):null,v=1+(p?.byteLength??0),_=(n?.tags?.length??0)>0?YV(n?.tags):null,y=16+(_?_.byteLength:0),w=typeof e=="string"?ze.from(e):ze.from(e),S=w.byteLength,M=2+r.signatureLength+r.ownerLength+d+v+y+S,x=ze.alloc(M);if(x.set(VV(r.signatureType),0),x.set(new Uint8Array(r.signatureLength).fill(0),2),l.byteLength!==r.ownerLength)throw new Error(`Owner must be ${r.ownerLength} bytes, but was incorrectly ${l.byteLength}`);x.set(l,2+r.signatureLength);let E=2+r.signatureLength+r.ownerLength;if(x[E]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);x.set(i,E+1)}let T=E+d,I=T+1;if(x[T]=p?1:0,p){if(I+=p.byteLength,p.byteLength!==32)throw new Error("Anchor must be 32 bytes");x.set(p,T+1)}x.set(cR(n?.tags?.length??0),I);let B=cR(_?.byteLength??0);x.set(B,I+8),_&&x.set(_,I+16);let O=I+y;return x.set(w,O),new d3(x)}we();Me();_e();we();Me();_e();var XV=class{signatureType;rawSignature;signature;signatureLength;rawOwner;owner;ownerLength;rawTarget;target;rawAnchor;anchor;rawTags;tags;rawData;data;static async verify(...r){throw new Error("You must implement `verify`")}};we();Me();_e();we();Me();_e();var MY={};jf(MY,{default:()=>Pbt,processStream:()=>rTe,streamExportForTesting:()=>Obt,streamSigner:()=>Bbt});we();Me();_e();we();Me();_e();l1();ZA();qc();g4();k0();p5();b4();var eY={},_Re=!1;function No(){return _Re||(_Re=!0,eY={ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,r){return e.includes(r)},ArrayPrototypeIndexOf(e,r){return e.indexOf(r)},ArrayPrototypeJoin(e,r){return e.join(r)},ArrayPrototypeMap(e,r){return e.map(r)},ArrayPrototypePop(e,r){return e.pop(r)},ArrayPrototypePush(e,r){return e.push(r)},ArrayPrototypeSlice(e,r,n){return e.slice(r,n)},Error,FunctionPrototypeCall(e,r,...n){return e.call(r,...n)},FunctionPrototypeSymbolHasInstance(e,r){return Function.prototype[Symbol.hasInstance].call(e,r)},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(e,r){return Object.defineProperties(e,r)},ObjectDefineProperty(e,r,n){return Object.defineProperty(e,r,n)},ObjectGetOwnPropertyDescriptor(e,r){return Object.getOwnPropertyDescriptor(e,r)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,r){return Object.setPrototypeOf(e,r)},Promise,PromisePrototypeCatch(e,r){return e.catch(r)},PromisePrototypeThen(e,r,n){return e.then(r,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,r){return e.test(r)},SafeSet:Set,String,StringPrototypeSlice(e,r,n){return e.slice(r,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.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(e,r,n){return e.set(r,n)},Boolean,Uint8Array}),eY}var q5={},MRe=!1;function j5(){if(MRe)return q5;MRe=!0;let{AbortController:e,AbortSignal:r}=typeof self<"u"?self:typeof window<"u"?window:void 0;return q5=e,q5.AbortSignal=r,q5.default=e,q5}var bR={},SRe=!1;function Hf(){if(SRe)return bR;SRe=!0;let e=Oi(),{kResistStopPropagation:r,SymbolDispose:n}=No(),l=globalThis.AbortSignal||j5().AbortSignal,i=globalThis.AbortController||j5().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||e.Blob,v=typeof p<"u"?function(M){return M instanceof p}:function(M){return!1},_=(S,M)=>{if(S!==void 0&&(S===null||typeof S!="object"||!("aborted"in S)))throw new ERR_INVALID_ARG_TYPE(M,"AbortSignal",S)},y=(S,M)=>{if(typeof S!="function")throw new ERR_INVALID_ARG_TYPE(M,"Function",S)};class w extends Error{constructor(M){if(!Array.isArray(M))throw new TypeError(`Expected input to be an Array, got ${typeof M}`);let x="";for(let E=0;E<M.length;E++)x+=` ${M[E].stack}
157
- `;super(x),this.name="AggregateError",this.errors=M}}return bR={AggregateError:w,kEmptyObject:Object.freeze({}),once(S){let M=!1;return function(...x){M||(M=!0,S.apply(this,x))}},createDeferredPromise:function(){let S,M;return{promise:new Promise((E,T)=>{S=E,M=T}),resolve:S,reject:M}},promisify(S){return new Promise((M,x)=>{S((E,...T)=>E?x(E):M(...T))})},debuglog(){return function(){}},format(S,...M){return S.replace(/%([sdifj])/g,function(...[x,E]){let T=M.shift();return E==="f"?T.toFixed(6):E==="j"?JSON.stringify(T):E==="s"&&typeof T=="object"?`${T.constructor!==Object?T.constructor.name:""} {}`.trim():T.toString()})},inspect(S){switch(typeof S){case"string":if(S.includes("'"))if(S.includes('"')){if(!S.includes("`")&&!S.includes("${"))return`\`${S}\``}else return`"${S}"`;return`'${S}'`;case"number":return isNaN(S)?"NaN":Object.is(S,-0)?String(S):S;case"bigint":return`${String(S)}n`;case"boolean":case"undefined":return String(S);case"object":return"{}"}},types:{isAsyncFunction(S){return S instanceof d},isArrayBufferView(S){return ArrayBuffer.isView(S)}},isBlob:v,deprecate(S,M){return S},addAbortListener:Ed.addAbortListener||function(M,x){if(M===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",M);_(M,"signal"),y(x,"listener");let E;return M.aborted?queueMicrotask(()=>x()):(M.addEventListener("abort",x,{__proto__:null,once:!0,[r]:!0}),E=()=>{M.removeEventListener("abort",x)}),{__proto__:null,[n](){var T;(T=E)===null||T===void 0||T()}}},AbortSignalAny:l.any||function(M){if(M.length===1)return M[0];let x=new i,E=()=>x.abort();return M.forEach(T=>{_(T,"signals"),T.addEventListener("abort",E,{once:!0})}),x.signal.addEventListener("abort",()=>{M.forEach(T=>T.removeEventListener("abort",E))},{once:!0}),x.signal}},bR.promisify.custom=Symbol.for("nodejs.util.promisify.custom"),bR}var tY={},xRe=!1;function yh(){if(xRe)return tY;xRe=!0;let{format:e,inspect:r,AggregateError:n}=Hf(),l=globalThis.AggregateError||n,i=Symbol("kIsNodeError"),d=["string","function","number","object","Function","Object","boolean","bigint","symbol"],p=/^([A-Z][a-z0-9]*)+$/,v="__node_internal_",_={};function y(I,B){if(!I)throw new _.ERR_INTERNAL_ASSERTION(B)}function w(I){let B="",O=I.length,N=I[0]==="-"?1:0;for(;O>=N+4;O-=3)B=`_${I.slice(O-3,O)}${B}`;return`${I.slice(0,O)}${B}`}function S(I,B,O){if(typeof B=="function")return y(B.length<=O.length,`Code: ${I}; The provided arguments length (${O.length}) does not match the required ones (${B.length}).`),B(...O);let N=(B.match(/%[dfijoOs]/g)||[]).length;return y(N===O.length,`Code: ${I}; The provided arguments length (${O.length}) does not match the required ones (${N}).`),O.length===0?B:e(B,...O)}function M(I,B,O){O||(O=Error);class N extends O{constructor(...K){super(S(I,B,K))}toString(){return`${this.name} [${I}]: ${this.message}`}}Object.defineProperties(N.prototype,{name:{value:O.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${I}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),N.prototype.code=I,N.prototype[i]=!0,_[I]=N}function x(I){let B=v+I.name;return Object.defineProperty(I,"name",{value:B}),I}function E(I,B){if(I&&B&&I!==B){if(Array.isArray(B.errors))return B.errors.push(I),B;let O=new l([B,I],B.message);return O.code=B.code,O}return I||B}class T extends Error{constructor(B="The operation was aborted",O=void 0){if(O!==void 0&&typeof O!="object")throw new _.ERR_INVALID_ARG_TYPE("options","Object",O);super(B,O),this.code="ABORT_ERR",this.name="AbortError"}}return M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(I,B,O)=>{y(typeof I=="string","'name' must be a string"),Array.isArray(B)||(B=[B]);let N="The ";I.endsWith(" argument")?N+=`${I} `:N+=`"${I}" ${I.includes(".")?"property":"argument"} `,N+="must be ";let H=[],K=[],J=[];for(let $ of B)y(typeof $=="string","All expected entries have to be of type string"),d.includes($)?H.push($.toLowerCase()):p.test($)?K.push($):(y($!=="object",'The value "object" should be written as "Object"'),J.push($));if(K.length>0){let $=H.indexOf("object");$!==-1&&(H.splice(H,$,1),K.push("Object"))}if(H.length>0){switch(H.length){case 1:N+=`of type ${H[0]}`;break;case 2:N+=`one of type ${H[0]} or ${H[1]}`;break;default:{let $=H.pop();N+=`one of type ${H.join(", ")}, or ${$}`}}(K.length>0||J.length>0)&&(N+=" or ")}if(K.length>0){switch(K.length){case 1:N+=`an instance of ${K[0]}`;break;case 2:N+=`an instance of ${K[0]} or ${K[1]}`;break;default:{let $=K.pop();N+=`an instance of ${K.join(", ")}, or ${$}`}}J.length>0&&(N+=" or ")}switch(J.length){case 0:break;case 1:J[0].toLowerCase()!==J[0]&&(N+="an "),N+=`${J[0]}`;break;case 2:N+=`one of ${J[0]} or ${J[1]}`;break;default:{let $=J.pop();N+=`one of ${J.join(", ")}, or ${$}`}}if(O==null)N+=`. Received ${O}`;else if(typeof O=="function"&&O.name)N+=`. Received function ${O.name}`;else if(typeof O=="object"){var L;if((L=O.constructor)!==null&&L!==void 0&&L.name)N+=`. Received an instance of ${O.constructor.name}`;else{let $=r(O,{depth:-1});N+=`. Received ${$}`}}else{let $=r(O,{colors:!1});$.length>25&&($=`${$.slice(0,25)}...`),N+=`. Received type ${typeof O} (${$})`}return N},TypeError),M("ERR_INVALID_ARG_VALUE",(I,B,O="is invalid")=>{let N=r(B);return N.length>128&&(N=N.slice(0,128)+"..."),`The ${I.includes(".")?"property":"argument"} '${I}' ${O}. Received ${N}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(I,B,O)=>{var N;let H=O!=null&&(N=O.constructor)!==null&&N!==void 0&&N.name?`instance of ${O.constructor.name}`:`type ${typeof O}`;return`Expected ${I} to be returned from the "${B}" function but got ${H}.`},TypeError),M("ERR_MISSING_ARGS",(...I)=>{y(I.length>0,"At least one arg needs to be specified");let B,O=I.length;switch(I=(Array.isArray(I)?I:[I]).map(N=>`"${N}"`).join(" or "),O){case 1:B+=`The ${I[0]} argument`;break;case 2:B+=`The ${I[0]} and ${I[1]} arguments`;break;default:{let N=I.pop();B+=`The ${I.join(", ")}, and ${N} arguments`}break}return`${B} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(I,B,O)=>{y(B,'Missing "range" argument');let N;return Number.isInteger(O)&&Math.abs(O)>2**32?N=w(String(O)):typeof O=="bigint"?(N=String(O),(O>2n**32n||O<-(2n**32n))&&(N=w(N)),N+="n"):N=r(O),`The value of "${I}" is out of range. It must be ${B}. Received ${N}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),tY={AbortError:T,aggregateTwoErrors:x(E),hideStackFrames:x,codes:_},tY}var rY={},ERe=!1;function F5(){if(ERe)return rY;ERe=!0;let{ArrayIsArray:e,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:n,ArrayPrototypeMap:l,NumberIsInteger:i,NumberIsNaN:d,NumberMAX_SAFE_INTEGER:p,NumberMIN_SAFE_INTEGER:v,NumberParseInt:_,ObjectPrototypeHasOwnProperty:y,RegExpPrototypeExec:w,String:S,StringPrototypeToUpperCase:M,StringPrototypeTrim:x}=No(),{hideStackFrames:E,codes:{ERR_SOCKET_BAD_PORT:T,ERR_INVALID_ARG_TYPE:I,ERR_INVALID_ARG_VALUE:B,ERR_OUT_OF_RANGE:O,ERR_UNKNOWN_SIGNAL:N}}=yh(),{normalizeEncoding:H}=Hf(),{isAsyncFunction:K,isArrayBufferView:J}=Hf().types,L={};function $(ye){return ye===(ye|0)}function V(ye){return ye===ye>>>0}let h=/^[0-7]+$/,t="must be a 32-bit unsigned integer or an octal string";function a(ye,he,Re){if(typeof ye>"u"&&(ye=Re),typeof ye=="string"){if(w(h,ye)===null)throw new B(he,ye,t);ye=_(ye,8)}return c(ye,he),ye}let s=E((ye,he,Re=v,Be=p)=>{if(typeof ye!="number")throw new I(he,"number",ye);if(!i(ye))throw new O(he,"an integer",ye);if(ye<Re||ye>Be)throw new O(he,`>= ${Re} && <= ${Be}`,ye)}),u=E((ye,he,Re=-2147483648,Be=2147483647)=>{if(typeof ye!="number")throw new I(he,"number",ye);if(!i(ye))throw new O(he,"an integer",ye);if(ye<Re||ye>Be)throw new O(he,`>= ${Re} && <= ${Be}`,ye)}),c=E((ye,he,Re=!1)=>{if(typeof ye!="number")throw new I(he,"number",ye);if(!i(ye))throw new O(he,"an integer",ye);let Be=Re?1:0,be=4294967295;if(ye<Be||ye>be)throw new O(he,`>= ${Be} && <= ${be}`,ye)});function b(ye,he){if(typeof ye!="string")throw new I(he,"string",ye)}function m(ye,he,Re=void 0,Be){if(typeof ye!="number")throw new I(he,"number",ye);if(Re!=null&&ye<Re||Be!=null&&ye>Be||(Re!=null||Be!=null)&&d(ye))throw new O(he,`${Re!=null?`>= ${Re}`:""}${Re!=null&&Be!=null?" && ":""}${Be!=null?`<= ${Be}`:""}`,ye)}let f=E((ye,he,Re)=>{if(!r(Re,ye)){let be="must be one of: "+n(l(Re,Ne=>typeof Ne=="string"?`'${Ne}'`:S(Ne)),", ");throw new B(he,ye,be)}});function o(ye,he){if(typeof ye!="boolean")throw new I(he,"boolean",ye)}function g(ye,he,Re){return ye==null||!y(ye,he)?Re:ye[he]}let A=E((ye,he,Re=null)=>{let Be=g(Re,"allowArray",!1),be=g(Re,"allowFunction",!1);if(!g(Re,"nullable",!1)&&ye===null||!Be&&e(ye)||typeof ye!="object"&&(!be||typeof ye!="function"))throw new I(he,"Object",ye)}),R=E((ye,he)=>{if(ye!=null&&typeof ye!="object"&&typeof ye!="function")throw new I(he,"a dictionary",ye)}),k=E((ye,he,Re=0)=>{if(!e(ye))throw new I(he,"Array",ye);if(ye.length<Re){let Be=`must be longer than ${Re}`;throw new B(he,ye,Be)}});function q(ye,he){k(ye,he);for(let Re=0;Re<ye.length;Re++)b(ye[Re],`${he}[${Re}]`)}function Z(ye,he){k(ye,he);for(let Re=0;Re<ye.length;Re++)o(ye[Re],`${he}[${Re}]`)}function ne(ye,he){k(ye,he);for(let Re=0;Re<ye.length;Re++){let Be=ye[Re],be=`${he}[${Re}]`;if(Be==null)throw new I(be,"AbortSignal",Be);X(Be,be)}}function G(ye,he="signal"){if(b(ye,he),L[ye]===void 0)throw L[M(ye)]!==void 0?new N(ye+" (signals must use all capital letters)"):new N(ye)}let D=E((ye,he="buffer")=>{if(!J(ye))throw new I(he,["Buffer","TypedArray","DataView"],ye)});function W(ye,he){let Re=H(he),Be=ye.length;if(Re==="hex"&&Be%2!==0)throw new B("encoding",he,`is invalid for data of length ${Be}`)}function ie(ye,he="Port",Re=!0){if(typeof ye!="number"&&typeof ye!="string"||typeof ye=="string"&&x(ye).length===0||+ye!==+ye>>>0||ye>65535||ye===0&&!Re)throw new T(he,ye,Re);return ye|0}let X=E((ye,he)=>{if(ye!==void 0&&(ye===null||typeof ye!="object"||!("aborted"in ye)))throw new I(he,"AbortSignal",ye)}),z=E((ye,he)=>{if(typeof ye!="function")throw new I(he,"Function",ye)}),F=E((ye,he)=>{if(typeof ye!="function"||K(ye))throw new I(he,"Function",ye)}),Y=E((ye,he)=>{if(ye!==void 0)throw new I(he,"undefined",ye)});function ae(ye,he,Re){if(!r(Re,ye))throw new I(he,`('${n(Re,"|")}')`,ye)}let de=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function re(ye,he){if(typeof ye>"u"||!w(de,ye))throw new B(he,ye,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function fe(ye){if(typeof ye=="string")return re(ye,"hints"),ye;if(e(ye)){let he=ye.length,Re="";if(he===0)return Re;for(let Be=0;Be<he;Be++){let be=ye[Be];re(be,"hints"),Re+=be,Be!==he-1&&(Re+=", ")}return Re}throw new B("hints",ye,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return rY={isInt32:$,isUint32:V,parseFileMode:a,validateArray:k,validateStringArray:q,validateBooleanArray:Z,validateAbortSignalArray:ne,validateBoolean:o,validateBuffer:D,validateDictionary:R,validateEncoding:W,validateFunction:z,validateInt32:u,validateInteger:s,validateNumber:m,validateObject:A,validateOneOf:f,validatePlainFunction:F,validatePort:ie,validateSignalName:G,validateString:b,validateUint32:c,validateUndefined:Y,validateUnion:ae,validateAbortSignal:X,validateLinkHeaderValue:fe},rY}var iY={},ARe=!1;function X1(){if(ARe)return iY;ARe=!0;let{SymbolAsyncIterator:e,SymbolIterator:r,SymbolFor:n}=No(),l=n("nodejs.stream.destroyed"),i=n("nodejs.stream.errored"),d=n("nodejs.stream.readable"),p=n("nodejs.stream.writable"),v=n("nodejs.stream.disturbed"),_=n("nodejs.webstream.isClosedPromise"),y=n("nodejs.webstream.controllerErrorFunction");function w(g,A=!1){var R;return!!(g&&typeof g.pipe=="function"&&typeof g.on=="function"&&(!A||typeof g.pause=="function"&&typeof g.resume=="function")&&(!g._writableState||((R=g._readableState)===null||R===void 0?void 0:R.readable)!==!1)&&(!g._writableState||g._readableState))}function S(g){var A;return!!(g&&typeof g.write=="function"&&typeof g.on=="function"&&(!g._readableState||((A=g._writableState)===null||A===void 0?void 0:A.writable)!==!1))}function M(g){return!!(g&&typeof g.pipe=="function"&&g._readableState&&typeof g.on=="function"&&typeof g.write=="function")}function x(g){return g&&(g._readableState||g._writableState||typeof g.write=="function"&&typeof g.on=="function"||typeof g.pipe=="function"&&typeof g.on=="function")}function E(g){return!!(g&&!x(g)&&typeof g.pipeThrough=="function"&&typeof g.getReader=="function"&&typeof g.cancel=="function")}function T(g){return!!(g&&!x(g)&&typeof g.getWriter=="function"&&typeof g.abort=="function")}function I(g){return!!(g&&!x(g)&&typeof g.readable=="object"&&typeof g.writable=="object")}function B(g){return E(g)||T(g)||I(g)}function O(g,A){return g==null?!1:A===!0?typeof g[e]=="function":A===!1?typeof g[r]=="function":typeof g[e]=="function"||typeof g[r]=="function"}function N(g){if(!x(g))return null;let A=g._writableState,R=g._readableState,k=A||R;return!!(g.destroyed||g[l]||k!=null&&k.destroyed)}function H(g){if(!S(g))return null;if(g.writableEnded===!0)return!0;let A=g._writableState;return A!=null&&A.errored?!1:typeof A?.ended!="boolean"?null:A.ended}function K(g,A){if(!S(g))return null;if(g.writableFinished===!0)return!0;let R=g._writableState;return R!=null&&R.errored?!1:typeof R?.finished!="boolean"?null:!!(R.finished||A===!1&&R.ended===!0&&R.length===0)}function J(g){if(!w(g))return null;if(g.readableEnded===!0)return!0;let A=g._readableState;return!A||A.errored?!1:typeof A?.ended!="boolean"?null:A.ended}function L(g,A){if(!w(g))return null;let R=g._readableState;return R!=null&&R.errored?!1:typeof R?.endEmitted!="boolean"?null:!!(R.endEmitted||A===!1&&R.ended===!0&&R.length===0)}function $(g){return g&&g[d]!=null?g[d]:typeof g?.readable!="boolean"?null:N(g)?!1:w(g)&&g.readable&&!L(g)}function V(g){return g&&g[p]!=null?g[p]:typeof g?.writable!="boolean"?null:N(g)?!1:S(g)&&g.writable&&!H(g)}function h(g,A){return x(g)?N(g)?!0:!(A?.readable!==!1&&$(g)||A?.writable!==!1&&V(g)):null}function t(g){var A,R;return x(g)?g.writableErrored?g.writableErrored:(A=(R=g._writableState)===null||R===void 0?void 0:R.errored)!==null&&A!==void 0?A:null:null}function a(g){var A,R;return x(g)?g.readableErrored?g.readableErrored:(A=(R=g._readableState)===null||R===void 0?void 0:R.errored)!==null&&A!==void 0?A:null:null}function s(g){if(!x(g))return null;if(typeof g.closed=="boolean")return g.closed;let A=g._writableState,R=g._readableState;return typeof A?.closed=="boolean"||typeof R?.closed=="boolean"?A?.closed||R?.closed:typeof g._closed=="boolean"&&u(g)?g._closed:null}function u(g){return typeof g._closed=="boolean"&&typeof g._defaultKeepAlive=="boolean"&&typeof g._removedConnection=="boolean"&&typeof g._removedContLen=="boolean"}function c(g){return typeof g._sent100=="boolean"&&u(g)}function b(g){var A;return typeof g._consuming=="boolean"&&typeof g._dumped=="boolean"&&((A=g.req)===null||A===void 0?void 0:A.upgradeOrConnect)===void 0}function m(g){if(!x(g))return null;let A=g._writableState,R=g._readableState,k=A||R;return!k&&c(g)||!!(k&&k.autoDestroy&&k.emitClose&&k.closed===!1)}function f(g){var A;return!!(g&&((A=g[v])!==null&&A!==void 0?A:g.readableDidRead||g.readableAborted))}function o(g){var A,R,k,q,Z,ne,G,D,W,ie;return!!(g&&((A=(R=(k=(q=(Z=(ne=g[i])!==null&&ne!==void 0?ne:g.readableErrored)!==null&&Z!==void 0?Z:g.writableErrored)!==null&&q!==void 0?q:(G=g._readableState)===null||G===void 0?void 0:G.errorEmitted)!==null&&k!==void 0?k:(D=g._writableState)===null||D===void 0?void 0:D.errorEmitted)!==null&&R!==void 0?R:(W=g._readableState)===null||W===void 0?void 0:W.errored)!==null&&A!==void 0?A:!((ie=g._writableState)===null||ie===void 0)&&ie.errored))}return iY={isDestroyed:N,kIsDestroyed:l,isDisturbed:f,kIsDisturbed:v,isErrored:o,kIsErrored:i,isReadable:$,kIsReadable:d,kIsClosedPromise:_,kControllerErrorFunction:y,kIsWritable:p,isClosed:s,isDuplexNodeStream:M,isFinished:h,isIterable:O,isReadableNodeStream:w,isReadableStream:E,isReadableEnded:J,isReadableFinished:L,isReadableErrored:a,isNodeStream:x,isWebStream:B,isWritable:V,isWritableNodeStream:S,isWritableStream:T,isWritableEnded:H,isWritableFinished:K,isWritableErrored:t,isServerRequest:b,isServerResponse:c,willEmitClose:m,isTransformStream:I},iY}var yR={},RRe=!1;function hv(){if(RRe)return yR;RRe=!0;let e=pn,{AbortError:r,codes:n}=yh(),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_PREMATURE_CLOSE:i}=n,{kEmptyObject:d,once:p}=Hf(),{validateAbortSignal:v,validateFunction:_,validateObject:y,validateBoolean:w}=F5(),{Promise:S,PromisePrototypeThen:M,SymbolDispose:x}=No(),{isClosed:E,isReadable:T,isReadableNodeStream:I,isReadableStream:B,isReadableFinished:O,isReadableErrored:N,isWritable:H,isWritableNodeStream:K,isWritableStream:J,isWritableFinished:L,isWritableErrored:$,isNodeStream:V,willEmitClose:h,kIsClosedPromise:t}=X1(),a;function s(f){return f.setHeader&&typeof f.abort=="function"}let u=()=>{};function c(f,o,g){var A,R;if(arguments.length===2?(g=o,o=d):o==null?o=d:y(o,"options"),_(g,"callback"),v(o.signal,"options.signal"),g=p(g),B(f)||J(f))return b(f,o,g);if(!V(f))throw new l("stream",["ReadableStream","WritableStream","Stream"],f);let k=(A=o.readable)!==null&&A!==void 0?A:I(f),q=(R=o.writable)!==null&&R!==void 0?R:K(f),Z=f._writableState,ne=f._readableState,G=()=>{f.writable||ie()},D=h(f)&&I(f)===k&&K(f)===q,W=L(f,!1),ie=()=>{W=!0,f.destroyed&&(D=!1),!(D&&(!f.readable||k))&&(!k||X)&&g.call(f)},X=O(f,!1),z=()=>{X=!0,f.destroyed&&(D=!1),!(D&&(!f.writable||q))&&(!q||W)&&g.call(f)},F=ye=>{g.call(f,ye)},Y=E(f),ae=()=>{Y=!0;let ye=$(f)||N(f);if(ye&&typeof ye!="boolean")return g.call(f,ye);if(k&&!X&&I(f,!0)&&!O(f,!1))return g.call(f,new i);if(q&&!W&&!L(f,!1))return g.call(f,new i);g.call(f)},de=()=>{Y=!0;let ye=$(f)||N(f);if(ye&&typeof ye!="boolean")return g.call(f,ye);g.call(f)},re=()=>{f.req.on("finish",ie)};s(f)?(f.on("complete",ie),D||f.on("abort",ae),f.req?re():f.on("request",re)):q&&!Z&&(f.on("end",G),f.on("close",G)),!D&&typeof f.aborted=="boolean"&&f.on("aborted",ae),f.on("end",z),f.on("finish",ie),o.error!==!1&&f.on("error",F),f.on("close",ae),Y?e.nextTick(ae):Z!=null&&Z.errorEmitted||ne!=null&&ne.errorEmitted?D||e.nextTick(de):(!k&&(!D||T(f))&&(W||H(f)===!1)||!q&&(!D||H(f))&&(X||T(f)===!1)||ne&&f.req&&f.aborted)&&e.nextTick(de);let fe=()=>{g=u,f.removeListener("aborted",ae),f.removeListener("complete",ie),f.removeListener("abort",ae),f.removeListener("request",re),f.req&&f.req.removeListener("finish",ie),f.removeListener("end",G),f.removeListener("close",G),f.removeListener("finish",ie),f.removeListener("end",z),f.removeListener("error",F),f.removeListener("close",ae)};if(o.signal&&!Y){let ye=()=>{let he=g;fe(),he.call(f,new r(void 0,{cause:o.signal.reason}))};if(o.signal.aborted)e.nextTick(ye);else{a=a||Hf().addAbortListener;let he=a(o.signal,ye),Re=g;g=p((...Be)=>{he[x](),Re.apply(f,Be)})}}return fe}function b(f,o,g){let A=!1,R=u;if(o.signal)if(R=()=>{A=!0,g.call(f,new r(void 0,{cause:o.signal.reason}))},o.signal.aborted)e.nextTick(R);else{a=a||Hf().addAbortListener;let q=a(o.signal,R),Z=g;g=p((...ne)=>{q[x](),Z.apply(f,ne)})}let k=(...q)=>{A||e.nextTick(()=>g.apply(f,q))};return M(f[t].promise,k,k),u}function m(f,o){var g;let A=!1;return o===null&&(o=d),(g=o)!==null&&g!==void 0&&g.cleanup&&(w(o.cleanup,"cleanup"),A=o.cleanup),new S((R,k)=>{let q=c(f,o,Z=>{A&&q(),Z?k(Z):R()})})}return yR=c,yR.finished=m,yR}var nY={},TRe=!1;function p3(){if(TRe)return nY;TRe=!0;let e=pn,{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:n},AbortError:l}=yh(),{Symbol:i}=No(),{kIsDestroyed:d,isDestroyed:p,isFinished:v,isServerRequest:_}=X1(),y=i("kDestroy"),w=i("kConstruct");function S(h,t,a){h&&(h.stack,t&&!t.errored&&(t.errored=h),a&&!a.errored&&(a.errored=h))}function M(h,t){let a=this._readableState,s=this._writableState,u=s||a;return s!=null&&s.destroyed||a!=null&&a.destroyed?(typeof t=="function"&&t(),this):(S(h,s,a),s&&(s.destroyed=!0),a&&(a.destroyed=!0),u.constructed?x(this,h,t):this.once(y,function(c){x(this,r(c,h),t)}),this)}function x(h,t,a){let s=!1;function u(c){if(s)return;s=!0;let b=h._readableState,m=h._writableState;S(c,m,b),m&&(m.closed=!0),b&&(b.closed=!0),typeof a=="function"&&a(c),c?e.nextTick(E,h,c):e.nextTick(T,h)}try{h._destroy(t||null,u)}catch(c){u(c)}}function E(h,t){I(h,t),T(h)}function T(h){let t=h._readableState,a=h._writableState;a&&(a.closeEmitted=!0),t&&(t.closeEmitted=!0),(a!=null&&a.emitClose||t!=null&&t.emitClose)&&h.emit("close")}function I(h,t){let a=h._readableState,s=h._writableState;s!=null&&s.errorEmitted||a!=null&&a.errorEmitted||(s&&(s.errorEmitted=!0),a&&(a.errorEmitted=!0),h.emit("error",t))}function B(){let h=this._readableState,t=this._writableState;h&&(h.constructed=!0,h.closed=!1,h.closeEmitted=!1,h.destroyed=!1,h.errored=null,h.errorEmitted=!1,h.reading=!1,h.ended=h.readable===!1,h.endEmitted=h.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function O(h,t,a){let s=h._readableState,u=h._writableState;if(u!=null&&u.destroyed||s!=null&&s.destroyed)return this;s!=null&&s.autoDestroy||u!=null&&u.autoDestroy?h.destroy(t):t&&(t.stack,u&&!u.errored&&(u.errored=t),s&&!s.errored&&(s.errored=t),a?e.nextTick(I,h,t):I(h,t))}function N(h,t){if(typeof h._construct!="function")return;let a=h._readableState,s=h._writableState;a&&(a.constructed=!1),s&&(s.constructed=!1),h.once(w,t),!(h.listenerCount(w)>1)&&e.nextTick(H,h)}function H(h){let t=!1;function a(s){if(t){O(h,s??new n);return}t=!0;let u=h._readableState,c=h._writableState,b=c||u;u&&(u.constructed=!0),c&&(c.constructed=!0),b.destroyed?h.emit(y,s):s?O(h,s,!0):e.nextTick(K,h)}try{h._construct(s=>{e.nextTick(a,s)})}catch(s){e.nextTick(a,s)}}function K(h){h.emit(w)}function J(h){return h?.setHeader&&typeof h.abort=="function"}function L(h){h.emit("close")}function $(h,t){h.emit("error",t),e.nextTick(L,h)}function V(h,t){!h||p(h)||(!t&&!v(h)&&(t=new l),_(h)?(h.socket=null,h.destroy(t)):J(h)?h.abort():J(h.req)?h.req.abort():typeof h.destroy=="function"?h.destroy(t):typeof h.close=="function"?h.close():t?e.nextTick($,h,t):e.nextTick(L,h),h.destroyed||(h[d]=!0))}return nY={construct:N,destroyer:V,destroy:M,undestroy:B,errorOrDestroy:O},nY}var aY={},IRe=!1;function yY(){if(IRe)return aY;IRe=!0;let{ArrayIsArray:e,ObjectSetPrototypeOf:r}=No(),{EventEmitter:n}=Ed;function l(d){n.call(this,d)}r(l.prototype,n.prototype),r(l,n),l.prototype.pipe=function(d,p){let v=this;function _(T){d.writable&&d.write(T)===!1&&v.pause&&v.pause()}v.on("data",_);function y(){v.readable&&v.resume&&v.resume()}d.on("drain",y),!d._isStdio&&(!p||p.end!==!1)&&(v.on("end",S),v.on("close",M));let w=!1;function S(){w||(w=!0,d.end())}function M(){w||(w=!0,typeof d.destroy=="function"&&d.destroy())}function x(T){E(),n.listenerCount(this,"error")===0&&this.emit("error",T)}i(v,"error",x),i(d,"error",x);function E(){v.removeListener("data",_),d.removeListener("drain",y),v.removeListener("end",S),v.removeListener("close",M),v.removeListener("error",x),d.removeListener("error",x),v.removeListener("end",E),v.removeListener("close",E),d.removeListener("close",E)}return v.on("end",E),v.on("close",E),d.on("close",E),d.emit("pipe",v),d};function i(d,p,v){if(typeof d.prependListener=="function")return d.prependListener(p,v);!d._events||!d._events[p]?d.on(p,v):e(d._events[p])?d._events[p].unshift(v):d._events[p]=[v,d._events[p]]}return aY={Stream:l,prependListener:i},aY}var U5={},kRe=!1;function _R(){if(kRe)return U5;kRe=!0;let{SymbolDispose:e}=No(),{AbortError:r,codes:n}=yh(),{isNodeStream:l,isWebStream:i,kControllerErrorFunction:d}=X1(),p=hv(),{ERR_INVALID_ARG_TYPE:v}=n,_,y=(w,S)=>{if(typeof w!="object"||!("aborted"in w))throw new v(S,"AbortSignal",w)};return U5.addAbortSignal=function(S,M){if(y(S,"signal"),!l(M)&&!i(M))throw new v("stream",["ReadableStream","WritableStream","Stream"],M);return U5.addAbortSignalNoValidate(S,M)},U5.addAbortSignalNoValidate=function(w,S){if(typeof w!="object"||!("aborted"in w))return S;let M=l(S)?()=>{S.destroy(new r(void 0,{cause:w.reason}))}:()=>{S[d](new r(void 0,{cause:w.reason}))};if(w.aborted)M();else{_=_||Hf().addAbortListener;let x=_(w,M);p(S,x[e])}return S},U5}var oY={},BRe=!1;function Rbt(){if(BRe)return oY;BRe=!0;let{StringPrototypeSlice:e,SymbolIterator:r,TypedArrayPrototypeSet:n,Uint8Array:l}=No(),{Buffer:i}=Oi(),{inspect:d}=Hf();return oY=class{constructor(){this.head=null,this.tail=null,this.length=0}push(v){let _={data:v,next:null};this.length>0?this.tail.next=_:this.head=_,this.tail=_,++this.length}unshift(v){let _={data:v,next:this.head};this.length===0&&(this.tail=_),this.head=_,++this.length}shift(){if(this.length===0)return;let v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}clear(){this.head=this.tail=null,this.length=0}join(v){if(this.length===0)return"";let _=this.head,y=""+_.data;for(;(_=_.next)!==null;)y+=v+_.data;return y}concat(v){if(this.length===0)return i.alloc(0);let _=i.allocUnsafe(v>>>0),y=this.head,w=0;for(;y;)n(_,y.data,w),w+=y.data.length,y=y.next;return _}consume(v,_){let y=this.head.data;if(v<y.length){let w=y.slice(0,v);return this.head.data=y.slice(v),w}return v===y.length?this.shift():_?this._getString(v):this._getBuffer(v)}first(){return this.head.data}*[r](){for(let v=this.head;v;v=v.next)yield v.data}_getString(v){let _="",y=this.head,w=0;do{let S=y.data;if(v>S.length)_+=S,v-=S.length;else{v===S.length?(_+=S,++w,y.next?this.head=y.next:this.head=this.tail=null):(_+=e(S,0,v),this.head=y,y.data=e(S,v));break}++w}while((y=y.next)!==null);return this.length-=w,_}_getBuffer(v){let _=i.allocUnsafe(v),y=v,w=this.head,S=0;do{let M=w.data;if(v>M.length)n(_,M,y-v),v-=M.length;else{v===M.length?(n(_,M,y-v),++S,w.next?this.head=w.next:this.head=this.tail=null):(n(_,new l(M.buffer,M.byteOffset,v),y-v),this.head=w,w.data=M.slice(v));break}++S}while((w=w.next)!==null);return this.length-=S,_}[Symbol.for("nodejs.util.inspect.custom")](v,_){return d(this,{..._,depth:0,customInspect:!1})}},oY}var sY={},PRe=!1;function MR(){if(PRe)return sY;PRe=!0;let{MathFloor:e,NumberIsInteger:r}=No(),{validateInteger:n}=F5(),{ERR_INVALID_ARG_VALUE:l}=yh().codes,i=16*1024,d=16;function p(w,S,M){return w.highWaterMark!=null?w.highWaterMark:S?w[M]:null}function v(w){return w?d:i}function _(w,S){n(S,"value",0),w?d=S:i=S}function y(w,S,M,x){let E=p(S,x,M);if(E!=null){if(!r(E)||E<0){let T=x?`options.${M}`:"options.highWaterMark";throw new l(T,E)}return e(E)}return v(w.objectMode)}return sY={getHighWaterMark:y,getDefaultHighWaterMark:v,setDefaultHighWaterMark:_},sY}var fY={},ORe=!1;function GRe(){if(ORe)return fY;ORe=!0;let e=pn,{PromisePrototypeThen:r,SymbolAsyncIterator:n,SymbolIterator:l}=No(),{Buffer:i}=Oi(),{ERR_INVALID_ARG_TYPE:d,ERR_STREAM_NULL_VALUES:p}=yh().codes;function v(_,y,w){let S;if(typeof y=="string"||y instanceof i)return new _({objectMode:!0,...w,read(){this.push(y),this.push(null)}});let M;if(y&&y[n])M=!0,S=y[n]();else if(y&&y[l])M=!1,S=y[l]();else throw new d("iterable",["Iterable"],y);let x=new _({objectMode:!0,highWaterMark:1,...w}),E=!1;x._read=function(){E||(E=!0,I())},x._destroy=function(B,O){r(T(B),()=>e.nextTick(O,B),N=>e.nextTick(O,N||B))};async function T(B){let O=B!=null,N=typeof S.throw=="function";if(O&&N){let{value:H,done:K}=await S.throw(B);if(await H,K)return}if(typeof S.return=="function"){let{value:H}=await S.return();await H}}async function I(){for(;;){try{let{value:B,done:O}=M?await S.next():S.next();if(O)x.push(null);else{let N=B&&typeof B.then=="function"?await B:B;if(N===null)throw E=!1,new p;if(x.push(N))continue;E=!1}}catch(B){x.destroy(B)}break}}return x}return fY=v,fY}var hY={},NRe=!1,or=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function SR(){if(NRe)return hY;NRe=!0;let e=pn,{ArrayPrototypeIndexOf:r,NumberIsInteger:n,NumberIsNaN:l,NumberParseInt:i,ObjectDefineProperties:d,ObjectKeys:p,ObjectSetPrototypeOf:v,Promise:_,SafeSet:y,SymbolAsyncDispose:w,SymbolAsyncIterator:S,Symbol:M}=No();hY=Be,Be.ReadableState=Re;let{EventEmitter:x}=Ed,{Stream:E,prependListener:T}=yY(),{Buffer:I}=Oi(),{addAbortSignal:B}=_R(),O=hv(),N=Hf().debuglog("stream",oe=>{N=oe}),H=Rbt(),K=p3(),{getHighWaterMark:J,getDefaultHighWaterMark:L}=MR(),{aggregateTwoErrors:$,codes:{ERR_INVALID_ARG_TYPE:V,ERR_METHOD_NOT_IMPLEMENTED:h,ERR_OUT_OF_RANGE:t,ERR_STREAM_PUSH_AFTER_EOF:a,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:s},AbortError:u}=yh(),{validateObject:c}=F5(),b=M("kPaused"),{StringDecoder:m}=Lu,f=GRe();v(Be.prototype,E.prototype),v(Be,E);let o=()=>{},{errorOrDestroy:g}=K,A=1,R=2,k=4,q=8,Z=16,ne=32,G=64,D=128,W=256,ie=512,X=1024,z=2048,F=4096,Y=8192,ae=16384,de=32768,re=65536,fe=1<<17,ye=1<<18;function he(oe){return{enumerable:!1,get(){return((this||or).state&oe)!==0},set(Se){Se?(this||or).state|=oe:(this||or).state&=~oe}}}d(Re.prototype,{objectMode:he(A),ended:he(R),endEmitted:he(k),reading:he(q),constructed:he(Z),sync:he(ne),needReadable:he(G),emittedReadable:he(D),readableListening:he(W),resumeScheduled:he(ie),errorEmitted:he(X),emitClose:he(z),autoDestroy:he(F),destroyed:he(Y),closed:he(ae),closeEmitted:he(de),multiAwaitDrain:he(re),readingMore:he(fe),dataEmitted:he(ye)});function Re(oe,Se,$e){typeof $e!="boolean"&&($e=Se instanceof J1()),(this||or).state=z|F|Z|ne,oe&&oe.objectMode&&((this||or).state|=A),$e&&oe&&oe.readableObjectMode&&((this||or).state|=A),(this||or).highWaterMark=oe?J(this||or,oe,"readableHighWaterMark",$e):L(!1),(this||or).buffer=new H,(this||or).length=0,(this||or).pipes=[],(this||or).flowing=null,(this||or)[b]=null,oe&&oe.emitClose===!1&&((this||or).state&=~z),oe&&oe.autoDestroy===!1&&((this||or).state&=~F),(this||or).errored=null,(this||or).defaultEncoding=oe&&oe.defaultEncoding||"utf8",(this||or).awaitDrainWriters=null,(this||or).decoder=null,(this||or).encoding=null,oe&&oe.encoding&&((this||or).decoder=new m(oe.encoding),(this||or).encoding=oe.encoding)}function Be(oe){if(!((this||or)instanceof Be))return new Be(oe);let Se=(this||or)instanceof J1();(this||or)._readableState=new Re(oe,this||or,Se),oe&&(typeof oe.read=="function"&&((this||or)._read=oe.read),typeof oe.destroy=="function"&&((this||or)._destroy=oe.destroy),typeof oe.construct=="function"&&((this||or)._construct=oe.construct),oe.signal&&!Se&&B(oe.signal,this||or)),E.call(this||or,oe),K.construct(this||or,()=>{(this||or)._readableState.needReadable&&Q(this||or,(this||or)._readableState)})}Be.prototype.destroy=K.destroy,Be.prototype._undestroy=K.undestroy,Be.prototype._destroy=function(oe,Se){Se(oe)},Be.prototype[x.captureRejectionSymbol]=function(oe){this.destroy(oe)},Be.prototype[w]=function(){let oe;return(this||or).destroyed||(oe=(this||or).readableEnded?null:new u,this.destroy(oe)),new _((Se,$e)=>O(this||or,ge=>ge&&ge!==oe?$e(ge):Se(null)))},Be.prototype.push=function(oe,Se){return be(this||or,oe,Se,!1)},Be.prototype.unshift=function(oe,Se){return be(this||or,oe,Se,!0)};function be(oe,Se,$e,ge){N("readableAddChunk",Se);let Le=oe._readableState,Ze;if((Le.state&A)===0&&(typeof Se=="string"?($e=$e||Le.defaultEncoding,Le.encoding!==$e&&(ge&&Le.encoding?Se=I.from(Se,$e).toString(Le.encoding):(Se=I.from(Se,$e),$e=""))):Se instanceof I?$e="":E._isUint8Array(Se)?(Se=E._uint8ArrayToBuffer(Se),$e=""):Se!=null&&(Ze=new V("chunk",["string","Buffer","Uint8Array"],Se))),Ze)g(oe,Ze);else if(Se===null)Le.state&=~q,C(oe,Le);else if((Le.state&A)!==0||Se&&Se.length>0)if(ge)if((Le.state&k)!==0)g(oe,new s);else{if(Le.destroyed||Le.errored)return!1;Ne(oe,Le,Se,!0)}else if(Le.ended)g(oe,new a);else{if(Le.destroyed||Le.errored)return!1;Le.state&=~q,Le.decoder&&!$e?(Se=Le.decoder.write(Se),Le.objectMode||Se.length!==0?Ne(oe,Le,Se,!1):Q(oe,Le)):Ne(oe,Le,Se,!1)}else ge||(Le.state&=~q,Q(oe,Le));return!Le.ended&&(Le.length<Le.highWaterMark||Le.length===0)}function Ne(oe,Se,$e,ge){Se.flowing&&Se.length===0&&!Se.sync&&oe.listenerCount("data")>0?((Se.state&re)!==0?Se.awaitDrainWriters.clear():Se.awaitDrainWriters=null,Se.dataEmitted=!0,oe.emit("data",$e)):(Se.length+=Se.objectMode?1:$e.length,ge?Se.buffer.unshift($e):Se.buffer.push($e),(Se.state&G)!==0&&U(oe)),Q(oe,Se)}Be.prototype.isPaused=function(){let oe=(this||or)._readableState;return oe[b]===!0||oe.flowing===!1},Be.prototype.setEncoding=function(oe){let Se=new m(oe);(this||or)._readableState.decoder=Se,(this||or)._readableState.encoding=(this||or)._readableState.decoder.encoding;let $e=(this||or)._readableState.buffer,ge="";for(let Le of $e)ge+=Se.write(Le);return $e.clear(),ge!==""&&$e.push(ge),(this||or)._readableState.length=ge.length,this||or};let qe=1073741824;function j(oe){if(oe>qe)throw new t("size","<= 1GiB",oe);return oe--,oe|=oe>>>1,oe|=oe>>>2,oe|=oe>>>4,oe|=oe>>>8,oe|=oe>>>16,oe++,oe}function P(oe,Se){return oe<=0||Se.length===0&&Se.ended?0:(Se.state&A)!==0?1:l(oe)?Se.flowing&&Se.length?Se.buffer.first().length:Se.length:oe<=Se.length?oe:Se.ended?Se.length:0}Be.prototype.read=function(oe){N("read",oe),oe===void 0?oe=NaN:n(oe)||(oe=i(oe,10));let Se=(this||or)._readableState,$e=oe;if(oe>Se.highWaterMark&&(Se.highWaterMark=j(oe)),oe!==0&&(Se.state&=~D),oe===0&&Se.needReadable&&((Se.highWaterMark!==0?Se.length>=Se.highWaterMark:Se.length>0)||Se.ended))return N("read: emitReadable",Se.length,Se.ended),Se.length===0&&Se.ended?Oe(this||or):U(this||or),null;if(oe=P(oe,Se),oe===0&&Se.ended)return Se.length===0&&Oe(this||or),null;let ge=(Se.state&G)!==0;if(N("need readable",ge),(Se.length===0||Se.length-oe<Se.highWaterMark)&&(ge=!0,N("length less than watermark",ge)),Se.ended||Se.reading||Se.destroyed||Se.errored||!Se.constructed)ge=!1,N("reading, ended or constructing",ge);else if(ge){N("do read"),Se.state|=q|ne,Se.length===0&&(Se.state|=G);try{this._read(Se.highWaterMark)}catch(Ze){g(this||or,Ze)}Se.state&=~ne,Se.reading||(oe=P($e,Se))}let Le;return oe>0?Le=ve(oe,Se):Le=null,Le===null?(Se.needReadable=Se.length<=Se.highWaterMark,oe=0):(Se.length-=oe,Se.multiAwaitDrain?Se.awaitDrainWriters.clear():Se.awaitDrainWriters=null),Se.length===0&&(Se.ended||(Se.needReadable=!0),$e!==oe&&Se.ended&&Oe(this||or)),Le!==null&&!Se.errorEmitted&&!Se.closeEmitted&&(Se.dataEmitted=!0,this.emit("data",Le)),Le};function C(oe,Se){if(N("onEofChunk"),!Se.ended){if(Se.decoder){let $e=Se.decoder.end();$e&&$e.length&&(Se.buffer.push($e),Se.length+=Se.objectMode?1:$e.length)}Se.ended=!0,Se.sync?U(oe):(Se.needReadable=!1,Se.emittedReadable=!0,ee(oe))}}function U(oe){let Se=oe._readableState;N("emitReadable",Se.needReadable,Se.emittedReadable),Se.needReadable=!1,Se.emittedReadable||(N("emitReadable",Se.flowing),Se.emittedReadable=!0,e.nextTick(ee,oe))}function ee(oe){let Se=oe._readableState;N("emitReadable_",Se.destroyed,Se.length,Se.ended),!Se.destroyed&&!Se.errored&&(Se.length||Se.ended)&&(oe.emit("readable"),Se.emittedReadable=!1),Se.needReadable=!Se.flowing&&!Se.ended&&Se.length<=Se.highWaterMark,pe(oe)}function Q(oe,Se){!Se.readingMore&&Se.constructed&&(Se.readingMore=!0,e.nextTick(te,oe,Se))}function te(oe,Se){for(;!Se.reading&&!Se.ended&&(Se.length<Se.highWaterMark||Se.flowing&&Se.length===0);){let $e=Se.length;if(N("maybeReadMore read 0"),oe.read(0),$e===Se.length)break}Se.readingMore=!1}Be.prototype._read=function(oe){throw new h("_read()")},Be.prototype.pipe=function(oe,Se){let $e=this||or,ge=(this||or)._readableState;ge.pipes.length===1&&(ge.multiAwaitDrain||(ge.multiAwaitDrain=!0,ge.awaitDrainWriters=new y(ge.awaitDrainWriters?[ge.awaitDrainWriters]:[]))),ge.pipes.push(oe),N("pipe count=%d opts=%j",ge.pipes.length,Se);let Ze=(!Se||Se.end!==!1)&&oe!==e.stdout&&oe!==e.stderr?Ue:qt;ge.endEmitted?e.nextTick(Ze):$e.once("end",Ze),oe.on("unpipe",xe);function xe(zt,Ht){N("onunpipe"),zt===$e&&Ht&&Ht.hasUnpiped===!1&&(Ht.hasUnpiped=!0,He())}function Ue(){N("onend"),oe.end()}let Ve,Ae=!1;function He(){N("cleanup"),oe.removeListener("close",Dt),oe.removeListener("finish",$t),Ve&&oe.removeListener("drain",Ve),oe.removeListener("error",je),oe.removeListener("unpipe",xe),$e.removeListener("end",Ue),$e.removeListener("end",qt),$e.removeListener("data",ke),Ae=!0,Ve&&ge.awaitDrainWriters&&(!oe._writableState||oe._writableState.needDrain)&&Ve()}function Xe(){Ae||(ge.pipes.length===1&&ge.pipes[0]===oe?(N("false write response, pause",0),ge.awaitDrainWriters=oe,ge.multiAwaitDrain=!1):ge.pipes.length>1&&ge.pipes.includes(oe)&&(N("false write response, pause",ge.awaitDrainWriters.size),ge.awaitDrainWriters.add(oe)),$e.pause()),Ve||(Ve=le($e,oe),oe.on("drain",Ve))}$e.on("data",ke);function ke(zt){N("ondata");let Ht=oe.write(zt);N("dest.write",Ht),Ht===!1&&Xe()}function je(zt){if(N("onerror",zt),qt(),oe.removeListener("error",je),oe.listenerCount("error")===0){let Ht=oe._writableState||oe._readableState;Ht&&!Ht.errorEmitted?g(oe,zt):oe.emit("error",zt)}}T(oe,"error",je);function Dt(){oe.removeListener("finish",$t),qt()}oe.once("close",Dt);function $t(){N("onfinish"),oe.removeListener("close",Dt),qt()}oe.once("finish",$t);function qt(){N("unpipe"),$e.unpipe(oe)}return oe.emit("pipe",$e),oe.writableNeedDrain===!0?Xe():ge.flowing||(N("pipe resume"),$e.resume()),oe};function le(oe,Se){return function(){let ge=oe._readableState;ge.awaitDrainWriters===Se?(N("pipeOnDrain",1),ge.awaitDrainWriters=null):ge.multiAwaitDrain&&(N("pipeOnDrain",ge.awaitDrainWriters.size),ge.awaitDrainWriters.delete(Se)),(!ge.awaitDrainWriters||ge.awaitDrainWriters.size===0)&&oe.listenerCount("data")&&oe.resume()}}Be.prototype.unpipe=function(oe){let Se=(this||or)._readableState,$e={hasUnpiped:!1};if(Se.pipes.length===0)return this||or;if(!oe){let Le=Se.pipes;Se.pipes=[],this.pause();for(let Ze=0;Ze<Le.length;Ze++)Le[Ze].emit("unpipe",this||or,{hasUnpiped:!1});return this||or}let ge=r(Se.pipes,oe);return ge===-1?this||or:(Se.pipes.splice(ge,1),Se.pipes.length===0&&this.pause(),oe.emit("unpipe",this||or,$e),this||or)},Be.prototype.on=function(oe,Se){let $e=E.prototype.on.call(this||or,oe,Se),ge=(this||or)._readableState;return oe==="data"?(ge.readableListening=this.listenerCount("readable")>0,ge.flowing!==!1&&this.resume()):oe==="readable"&&!ge.endEmitted&&!ge.readableListening&&(ge.readableListening=ge.needReadable=!0,ge.flowing=!1,ge.emittedReadable=!1,N("on readable",ge.length,ge.reading),ge.length?U(this||or):ge.reading||e.nextTick(se,this||or)),$e},Be.prototype.addListener=Be.prototype.on,Be.prototype.removeListener=function(oe,Se){let $e=E.prototype.removeListener.call(this||or,oe,Se);return oe==="readable"&&e.nextTick(Ie,this||or),$e},Be.prototype.off=Be.prototype.removeListener,Be.prototype.removeAllListeners=function(oe){let Se=E.prototype.removeAllListeners.apply(this||or,arguments);return(oe==="readable"||oe===void 0)&&e.nextTick(Ie,this||or),Se};function Ie(oe){let Se=oe._readableState;Se.readableListening=oe.listenerCount("readable")>0,Se.resumeScheduled&&Se[b]===!1?Se.flowing=!0:oe.listenerCount("data")>0?oe.resume():Se.readableListening||(Se.flowing=null)}function se(oe){N("readable nexttick read 0"),oe.read(0)}Be.prototype.resume=function(){let oe=(this||or)._readableState;return oe.flowing||(N("resume"),oe.flowing=!oe.readableListening,Ee(this||or,oe)),oe[b]=!1,this||or};function Ee(oe,Se){Se.resumeScheduled||(Se.resumeScheduled=!0,e.nextTick(me,oe,Se))}function me(oe,Se){N("resume",Se.reading),Se.reading||oe.read(0),Se.resumeScheduled=!1,oe.emit("resume"),pe(oe),Se.flowing&&!Se.reading&&oe.read(0)}Be.prototype.pause=function(){return N("call pause flowing=%j",(this||or)._readableState.flowing),(this||or)._readableState.flowing!==!1&&(N("pause"),(this||or)._readableState.flowing=!1,this.emit("pause")),(this||or)._readableState[b]=!0,this||or};function pe(oe){let Se=oe._readableState;for(N("flow",Se.flowing);Se.flowing&&oe.read()!==null;);}Be.prototype.wrap=function(oe){let Se=!1;oe.on("data",ge=>{!this.push(ge)&&oe.pause&&(Se=!0,oe.pause())}),oe.on("end",()=>{this.push(null)}),oe.on("error",ge=>{g(this||or,ge)}),oe.on("close",()=>{this.destroy()}),oe.on("destroy",()=>{this.destroy()}),(this||or)._read=()=>{Se&&oe.resume&&(Se=!1,oe.resume())};let $e=p(oe);for(let ge=1;ge<$e.length;ge++){let Le=$e[ge];(this||or)[Le]===void 0&&typeof oe[Le]=="function"&&((this||or)[Le]=oe[Le].bind(oe))}return this||or},Be.prototype[S]=function(){return De(this||or)},Be.prototype.iterator=function(oe){return oe!==void 0&&c(oe,"options"),De(this||or,oe)};function De(oe,Se){typeof oe.read!="function"&&(oe=Be.wrap(oe,{objectMode:!0}));let $e=ue(oe,Se);return $e.stream=oe,$e}async function*ue(oe,Se){let $e=o;function ge(xe){(this||or)===oe?($e(),$e=o):$e=xe}oe.on("readable",ge);let Le,Ze=O(oe,{writable:!1},xe=>{Le=xe?$(Le,xe):null,$e(),$e=o});try{for(;;){let xe=oe.destroyed?null:oe.read();if(xe!==null)yield xe;else{if(Le)throw Le;if(Le===null)return;await new _(ge)}}}catch(xe){throw Le=$(Le,xe),Le}finally{(Le||Se?.destroyOnReturn!==!1)&&(Le===void 0||oe._readableState.autoDestroy)?K.destroyer(oe,null):(oe.off("readable",ge),Ze())}}d(Be.prototype,{readable:{__proto__:null,get(){let oe=(this||or)._readableState;return!!oe&&oe.readable!==!1&&!oe.destroyed&&!oe.errorEmitted&&!oe.endEmitted},set(oe){(this||or)._readableState&&((this||or)._readableState.readable=!!oe)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return(this||or)._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||or)._readableState.readable!==!1&&((this||or)._readableState.destroyed||(this||or)._readableState.errored)&&!(this||or)._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return(this||or)._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return(this||or)._readableState&&(this||or)._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return(this||or)._readableState.flowing},set:function(oe){(this||or)._readableState&&((this||or)._readableState.flowing=oe)}},readableLength:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.errored:null}},closed:{__proto__:null,get(){return(this||or)._readableState?(this||or)._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.destroyed:!1},set(oe){(this||or)._readableState&&((this||or)._readableState.destroyed=oe)}},readableEnded:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.endEmitted:!1}}}),d(Re.prototype,{pipesCount:{__proto__:null,get(){return(this||or).pipes.length}},paused:{__proto__:null,get(){return(this||or)[b]!==!1},set(oe){(this||or)[b]=!!oe}}}),Be._fromList=ve;function ve(oe,Se){if(Se.length===0)return null;let $e;return Se.objectMode?$e=Se.buffer.shift():!oe||oe>=Se.length?(Se.decoder?$e=Se.buffer.join(""):Se.buffer.length===1?$e=Se.buffer.first():$e=Se.buffer.concat(Se.length),Se.buffer.clear()):$e=Se.buffer.consume(oe,Se.decoder),$e}function Oe(oe){let Se=oe._readableState;N("endReadable",Se.endEmitted),Se.endEmitted||(Se.ended=!0,e.nextTick(Te,Se,oe))}function Te(oe,Se){if(N("endReadableNT",oe.endEmitted,oe.length),!oe.errored&&!oe.closeEmitted&&!oe.endEmitted&&oe.length===0){if(oe.endEmitted=!0,Se.emit("end"),Se.writable&&Se.allowHalfOpen===!1)e.nextTick(ce,Se);else if(oe.autoDestroy){let $e=Se._writableState;(!$e||$e.autoDestroy&&($e.finished||$e.writable===!1))&&Se.destroy()}}}function ce(oe){oe.writable&&!oe.writableEnded&&!oe.destroyed&&oe.end()}Be.from=function(oe,Se){return f(Be,oe,Se)};let Pe;function Ke(){return Pe===void 0&&(Pe={}),Pe}return Be.fromWeb=function(oe,Se){return Ke().newStreamReadableFromReadableStream(oe,Se)},Be.toWeb=function(oe,Se){return Ke().newReadableStreamFromStreamReadable(oe,Se)},Be.wrap=function(oe,Se){var $e,ge;return new Be({objectMode:($e=(ge=oe.readableObjectMode)!==null&&ge!==void 0?ge:oe.objectMode)!==null&&$e!==void 0?$e:!0,...Se,destroy(Le,Ze){K.destroyer(oe,Le),Ze(Le)}}).wrap(oe)},hY}var uY={},CRe=!1,ur=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function wY(){if(CRe)return uY;CRe=!0;let e=pn,{ArrayPrototypeSlice:r,Error:n,FunctionPrototypeSymbolHasInstance:l,ObjectDefineProperty:i,ObjectDefineProperties:d,ObjectSetPrototypeOf:p,StringPrototypeToLowerCase:v,Symbol:_,SymbolHasInstance:y}=No();uY=c,c.WritableState=s;let{EventEmitter:w}=Ed,S=yY().Stream,{Buffer:M}=Oi(),x=p3(),{addAbortSignal:E}=_R(),{getHighWaterMark:T,getDefaultHighWaterMark:I}=MR(),{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:O,ERR_MULTIPLE_CALLBACK:N,ERR_STREAM_CANNOT_PIPE:H,ERR_STREAM_DESTROYED:K,ERR_STREAM_ALREADY_FINISHED:J,ERR_STREAM_NULL_VALUES:L,ERR_STREAM_WRITE_AFTER_END:$,ERR_UNKNOWN_ENCODING:V}=yh().codes,{errorOrDestroy:h}=x;p(c.prototype,S.prototype),p(c,S);function t(){}let a=_("kOnFinished");function s(F,Y,ae){typeof ae!="boolean"&&(ae=Y instanceof J1()),(this||ur).objectMode=!!(F&&F.objectMode),ae&&((this||ur).objectMode=(this||ur).objectMode||!!(F&&F.writableObjectMode)),(this||ur).highWaterMark=F?T(this||ur,F,"writableHighWaterMark",ae):I(!1),(this||ur).finalCalled=!1,(this||ur).needDrain=!1,(this||ur).ending=!1,(this||ur).ended=!1,(this||ur).finished=!1,(this||ur).destroyed=!1;let de=!!(F&&F.decodeStrings===!1);(this||ur).decodeStrings=!de,(this||ur).defaultEncoding=F&&F.defaultEncoding||"utf8",(this||ur).length=0,(this||ur).writing=!1,(this||ur).corked=0,(this||ur).sync=!0,(this||ur).bufferProcessing=!1,(this||ur).onwrite=g.bind(void 0,Y),(this||ur).writecb=null,(this||ur).writelen=0,(this||ur).afterWriteTickInfo=null,u(this||ur),(this||ur).pendingcb=0,(this||ur).constructed=!0,(this||ur).prefinished=!1,(this||ur).errorEmitted=!1,(this||ur).emitClose=!F||F.emitClose!==!1,(this||ur).autoDestroy=!F||F.autoDestroy!==!1,(this||ur).errored=null,(this||ur).closed=!1,(this||ur).closeEmitted=!1,(this||ur)[a]=[]}function u(F){F.buffered=[],F.bufferedIndex=0,F.allBuffers=!0,F.allNoop=!0}s.prototype.getBuffer=function(){return r((this||ur).buffered,(this||ur).bufferedIndex)},i(s.prototype,"bufferedRequestCount",{__proto__:null,get(){return(this||ur).buffered.length-(this||ur).bufferedIndex}});function c(F){let Y=(this||ur)instanceof J1();if(!Y&&!l(c,this||ur))return new c(F);(this||ur)._writableState=new s(F,this||ur,Y),F&&(typeof F.write=="function"&&((this||ur)._write=F.write),typeof F.writev=="function"&&((this||ur)._writev=F.writev),typeof F.destroy=="function"&&((this||ur)._destroy=F.destroy),typeof F.final=="function"&&((this||ur)._final=F.final),typeof F.construct=="function"&&((this||ur)._construct=F.construct),F.signal&&E(F.signal,this||ur)),S.call(this||ur,F),x.construct(this||ur,()=>{let ae=(this||ur)._writableState;ae.writing||q(this||ur,ae),D(this||ur,ae)})}i(c,y,{__proto__:null,value:function(F){return l(this||ur,F)?!0:(this||ur)!==c?!1:F&&F._writableState instanceof s}}),c.prototype.pipe=function(){h(this||ur,new H)};function b(F,Y,ae,de){let re=F._writableState;if(typeof ae=="function")de=ae,ae=re.defaultEncoding;else{if(!ae)ae=re.defaultEncoding;else if(ae!=="buffer"&&!M.isEncoding(ae))throw new V(ae);typeof de!="function"&&(de=t)}if(Y===null)throw new L;if(!re.objectMode)if(typeof Y=="string")re.decodeStrings!==!1&&(Y=M.from(Y,ae),ae="buffer");else if(Y instanceof M)ae="buffer";else if(S._isUint8Array(Y))Y=S._uint8ArrayToBuffer(Y),ae="buffer";else throw new B("chunk",["string","Buffer","Uint8Array"],Y);let fe;return re.ending?fe=new $:re.destroyed&&(fe=new K("write")),fe?(e.nextTick(de,fe),h(F,fe,!0),fe):(re.pendingcb++,m(F,re,Y,ae,de))}c.prototype.write=function(F,Y,ae){return b(this||ur,F,Y,ae)===!0},c.prototype.cork=function(){(this||ur)._writableState.corked++},c.prototype.uncork=function(){let F=(this||ur)._writableState;F.corked&&(F.corked--,F.writing||q(this||ur,F))},c.prototype.setDefaultEncoding=function(Y){if(typeof Y=="string"&&(Y=v(Y)),!M.isEncoding(Y))throw new V(Y);return(this||ur)._writableState.defaultEncoding=Y,this||ur};function m(F,Y,ae,de,re){let fe=Y.objectMode?1:ae.length;Y.length+=fe;let ye=Y.length<Y.highWaterMark;return ye||(Y.needDrain=!0),Y.writing||Y.corked||Y.errored||!Y.constructed?(Y.buffered.push({chunk:ae,encoding:de,callback:re}),Y.allBuffers&&de!=="buffer"&&(Y.allBuffers=!1),Y.allNoop&&re!==t&&(Y.allNoop=!1)):(Y.writelen=fe,Y.writecb=re,Y.writing=!0,Y.sync=!0,F._write(ae,de,Y.onwrite),Y.sync=!1),ye&&!Y.errored&&!Y.destroyed}function f(F,Y,ae,de,re,fe,ye){Y.writelen=de,Y.writecb=ye,Y.writing=!0,Y.sync=!0,Y.destroyed?Y.onwrite(new K("write")):ae?F._writev(re,Y.onwrite):F._write(re,fe,Y.onwrite),Y.sync=!1}function o(F,Y,ae,de){--Y.pendingcb,de(ae),k(Y),h(F,ae)}function g(F,Y){let ae=F._writableState,de=ae.sync,re=ae.writecb;if(typeof re!="function"){h(F,new N);return}ae.writing=!1,ae.writecb=null,ae.length-=ae.writelen,ae.writelen=0,Y?(Y.stack,ae.errored||(ae.errored=Y),F._readableState&&!F._readableState.errored&&(F._readableState.errored=Y),de?e.nextTick(o,F,ae,Y,re):o(F,ae,Y,re)):(ae.buffered.length>ae.bufferedIndex&&q(F,ae),de?ae.afterWriteTickInfo!==null&&ae.afterWriteTickInfo.cb===re?ae.afterWriteTickInfo.count++:(ae.afterWriteTickInfo={count:1,cb:re,stream:F,state:ae},e.nextTick(A,ae.afterWriteTickInfo)):R(F,ae,1,re))}function A({stream:F,state:Y,count:ae,cb:de}){return Y.afterWriteTickInfo=null,R(F,Y,ae,de)}function R(F,Y,ae,de){for(!Y.ending&&!F.destroyed&&Y.length===0&&Y.needDrain&&(Y.needDrain=!1,F.emit("drain"));ae-- >0;)Y.pendingcb--,de();Y.destroyed&&k(Y),D(F,Y)}function k(F){if(F.writing)return;for(let re=F.bufferedIndex;re<F.buffered.length;++re){var Y;let{chunk:fe,callback:ye}=F.buffered[re],he=F.objectMode?1:fe.length;F.length-=he,ye((Y=F.errored)!==null&&Y!==void 0?Y:new K("write"))}let ae=F[a].splice(0);for(let re=0;re<ae.length;re++){var de;ae[re]((de=F.errored)!==null&&de!==void 0?de:new K("end"))}u(F)}function q(F,Y){if(Y.corked||Y.bufferProcessing||Y.destroyed||!Y.constructed)return;let{buffered:ae,bufferedIndex:de,objectMode:re}=Y,fe=ae.length-de;if(!fe)return;let ye=de;if(Y.bufferProcessing=!0,fe>1&&F._writev){Y.pendingcb-=fe-1;let he=Y.allNoop?t:Be=>{for(let be=ye;be<ae.length;++be)ae[be].callback(Be)},Re=Y.allNoop&&ye===0?ae:r(ae,ye);Re.allBuffers=Y.allBuffers,f(F,Y,!0,Y.length,Re,"",he),u(Y)}else{do{let{chunk:he,encoding:Re,callback:Be}=ae[ye];ae[ye++]=null;let be=re?1:he.length;f(F,Y,!1,be,he,Re,Be)}while(ye<ae.length&&!Y.writing);ye===ae.length?u(Y):ye>256?(ae.splice(0,ye),Y.bufferedIndex=0):Y.bufferedIndex=ye}Y.bufferProcessing=!1}c.prototype._write=function(F,Y,ae){if((this||ur)._writev)this._writev([{chunk:F,encoding:Y}],ae);else throw new O("_write()")},c.prototype._writev=null,c.prototype.end=function(F,Y,ae){let de=(this||ur)._writableState;typeof F=="function"?(ae=F,F=null,Y=null):typeof Y=="function"&&(ae=Y,Y=null);let re;if(F!=null){let fe=b(this||ur,F,Y);fe instanceof n&&(re=fe)}return de.corked&&(de.corked=1,this.uncork()),re||(!de.errored&&!de.ending?(de.ending=!0,D(this||ur,de,!0),de.ended=!0):de.finished?re=new J("end"):de.destroyed&&(re=new K("end"))),typeof ae=="function"&&(re||de.finished?e.nextTick(ae,re):de[a].push(ae)),this||ur};function Z(F){return F.ending&&!F.destroyed&&F.constructed&&F.length===0&&!F.errored&&F.buffered.length===0&&!F.finished&&!F.writing&&!F.errorEmitted&&!F.closeEmitted}function ne(F,Y){let ae=!1;function de(re){if(ae){h(F,re??N());return}if(ae=!0,Y.pendingcb--,re){let fe=Y[a].splice(0);for(let ye=0;ye<fe.length;ye++)fe[ye](re);h(F,re,Y.sync)}else Z(Y)&&(Y.prefinished=!0,F.emit("prefinish"),Y.pendingcb++,e.nextTick(W,F,Y))}Y.sync=!0,Y.pendingcb++;try{F._final(de)}catch(re){de(re)}Y.sync=!1}function G(F,Y){!Y.prefinished&&!Y.finalCalled&&(typeof F._final=="function"&&!Y.destroyed?(Y.finalCalled=!0,ne(F,Y)):(Y.prefinished=!0,F.emit("prefinish")))}function D(F,Y,ae){Z(Y)&&(G(F,Y),Y.pendingcb===0&&(ae?(Y.pendingcb++,e.nextTick((de,re)=>{Z(re)?W(de,re):re.pendingcb--},F,Y)):Z(Y)&&(Y.pendingcb++,W(F,Y))))}function W(F,Y){Y.pendingcb--,Y.finished=!0;let ae=Y[a].splice(0);for(let de=0;de<ae.length;de++)ae[de]();if(F.emit("finish"),Y.autoDestroy){let de=F._readableState;(!de||de.autoDestroy&&(de.endEmitted||de.readable===!1))&&F.destroy()}}d(c.prototype,{closed:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.closed:!1}},destroyed:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.destroyed:!1},set(F){(this||ur)._writableState&&((this||ur)._writableState.destroyed=F)}},writable:{__proto__:null,get(){let F=(this||ur)._writableState;return!!F&&F.writable!==!1&&!F.destroyed&&!F.errored&&!F.ending&&!F.ended},set(F){(this||ur)._writableState&&((this||ur)._writableState.writable=!!F)}},writableFinished:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return(this||ur)._writableState&&(this||ur)._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let F=(this||ur)._writableState;return F?!F.destroyed&&!F.ending&&F.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return(this||ur)._writableState&&(this||ur)._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.corked:0}},writableLength:{__proto__:null,get(){return(this||ur)._writableState&&(this||ur)._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return(this||ur)._writableState?(this||ur)._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||ur)._writableState.writable!==!1&&((this||ur)._writableState.destroyed||(this||ur)._writableState.errored)&&!(this||ur)._writableState.finished)}}});let ie=x.destroy;c.prototype.destroy=function(F,Y){let ae=(this||ur)._writableState;return!ae.destroyed&&(ae.bufferedIndex<ae.buffered.length||ae[a].length)&&e.nextTick(k,ae),ie.call(this||ur,F,Y),this||ur},c.prototype._undestroy=x.undestroy,c.prototype._destroy=function(F,Y){Y(F)},c.prototype[w.captureRejectionSymbol]=function(F){this.destroy(F)};let X;function z(){return X===void 0&&(X={}),X}return c.fromWeb=function(F,Y){return z().newStreamWritableFromWritableStream(F,Y)},c.toWeb=function(F){return z().newWritableStreamFromStreamWritable(F)},uY}var lY={},LRe=!1;function Tbt(){if(LRe)return lY;LRe=!0;let e=pn,r=Oi(),{isReadable:n,isWritable:l,isIterable:i,isNodeStream:d,isReadableNodeStream:p,isWritableNodeStream:v,isDuplexNodeStream:_,isReadableStream:y,isWritableStream:w}=X1(),S=hv(),{AbortError:M,codes:{ERR_INVALID_ARG_TYPE:x,ERR_INVALID_RETURN_VALUE:E}}=yh(),{destroyer:T}=p3(),I=J1(),B=SR(),O=wY(),{createDeferredPromise:N}=Hf(),H=GRe(),K=globalThis.Blob||r.Blob,J=typeof K<"u"?function(s){return s instanceof K}:function(s){return!1},L=globalThis.AbortController||j5().AbortController,{FunctionPrototypeCall:$}=No();class V extends I{constructor(s){super(s),s?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),s?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}lY=function a(s,u){if(_(s))return s;if(p(s))return t({readable:s});if(v(s))return t({writable:s});if(d(s))return t({writable:!1,readable:!1});if(y(s))return t({readable:B.fromWeb(s)});if(w(s))return t({writable:O.fromWeb(s)});if(typeof s=="function"){let{value:b,write:m,final:f,destroy:o}=h(s);if(i(b))return H(V,b,{objectMode:!0,write:m,final:f,destroy:o});let g=b?.then;if(typeof g=="function"){let A,R=$(g,b,k=>{if(k!=null)throw new E("nully","body",k)},k=>{T(A,k)});return A=new V({objectMode:!0,readable:!1,write:m,final(k){f(async()=>{try{await R,e.nextTick(k,null)}catch(q){e.nextTick(k,q)}})},destroy:o})}throw new E("Iterable, AsyncIterable or AsyncFunction",u,b)}if(J(s))return a(s.arrayBuffer());if(i(s))return H(V,s,{objectMode:!0,writable:!1});if(y(s?.readable)&&w(s?.writable))return V.fromWeb(s);if(typeof s?.writable=="object"||typeof s?.readable=="object"){let b=s!=null&&s.readable?p(s?.readable)?s?.readable:a(s.readable):void 0,m=s!=null&&s.writable?v(s?.writable)?s?.writable:a(s.writable):void 0;return t({readable:b,writable:m})}let c=s?.then;if(typeof c=="function"){let b;return $(c,s,m=>{m!=null&&b.push(m),b.push(null)},m=>{T(b,m)}),b=new V({objectMode:!0,writable:!1,read(){}})}throw new x(u,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],s)};function h(a){let{promise:s,resolve:u}=N(),c=new L,b=c.signal;return{value:a(async function*(){for(;;){let f=s;s=null;let{chunk:o,done:g,cb:A}=await f;if(e.nextTick(A),g)return;if(b.aborted)throw new M(void 0,{cause:b.reason});({promise:s,resolve:u}=N()),yield o}}(),{signal:b}),write(f,o,g){let A=u;u=null,A({chunk:f,done:!1,cb:g})},final(f){let o=u;u=null,o({done:!0,cb:f})},destroy(f,o){c.abort(),o(f)}}}function t(a){let s=a.readable&&typeof a.readable.read!="function"?B.wrap(a.readable):a.readable,u=a.writable,c=!!n(s),b=!!l(u),m,f,o,g,A;function R(k){let q=g;g=null,q?q(k):k&&A.destroy(k)}return A=new V({readableObjectMode:!!(s!=null&&s.readableObjectMode),writableObjectMode:!!(u!=null&&u.writableObjectMode),readable:c,writable:b}),b&&(S(u,k=>{b=!1,k&&T(s,k),R(k)}),A._write=function(k,q,Z){u.write(k,q)?Z():m=Z},A._final=function(k){u.end(),f=k},u.on("drain",function(){if(m){let k=m;m=null,k()}}),u.on("finish",function(){if(f){let k=f;f=null,k()}})),c&&(S(s,k=>{c=!1,k&&T(s,k),R(k)}),s.on("readable",function(){if(o){let k=o;o=null,k()}}),s.on("end",function(){A.push(null)}),A._read=function(){for(;;){let k=s.read();if(k===null){o=A._read;return}if(!A.push(k))return}}),A._destroy=function(k,q){!k&&g!==null&&(k=new M),o=null,m=null,f=null,g===null?q(k):(g=q,T(u,k),T(s,k))},A}return lY}var cY={},DRe=!1;function J1(){if(DRe)return cY;DRe=!0;let{ObjectDefineProperties:e,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:n,ObjectSetPrototypeOf:l}=No();cY=p;let i=SR(),d=wY();l(p.prototype,i.prototype),l(p,i);{let w=n(d.prototype);for(let S=0;S<w.length;S++){let M=w[S];p.prototype[M]||(p.prototype[M]=d.prototype[M])}}function p(w){if(!(this instanceof p))return new p(w);i.call(this,w),d.call(this,w),w?(this.allowHalfOpen=w.allowHalfOpen!==!1,w.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),w.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}e(p.prototype,{writable:{__proto__:null,...r(d.prototype,"writable")},writableHighWaterMark:{__proto__:null,...r(d.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...r(d.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...r(d.prototype,"writableBuffer")},writableLength:{__proto__:null,...r(d.prototype,"writableLength")},writableFinished:{__proto__:null,...r(d.prototype,"writableFinished")},writableCorked:{__proto__:null,...r(d.prototype,"writableCorked")},writableEnded:{__proto__:null,...r(d.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...r(d.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(w){this._readableState&&this._writableState&&(this._readableState.destroyed=w,this._writableState.destroyed=w)}}});let v;function _(){return v===void 0&&(v={}),v}p.fromWeb=function(w,S){return _().newStreamDuplexFromReadableWritablePair(w,S)},p.toWeb=function(w){return _().newReadableWritablePairFromDuplex(w)};let y;return p.from=function(w){return y||(y=Tbt()),y(w,"body")},cY}var dY={},$Re=!1;function VRe(){if($Re)return dY;$Re=!0;let{ObjectSetPrototypeOf:e,Symbol:r}=No();dY=p;let{ERR_METHOD_NOT_IMPLEMENTED:n}=yh().codes,l=J1(),{getHighWaterMark:i}=MR();e(p.prototype,l.prototype),e(p,l);let d=r("kCallback");function p(y){if(!(this instanceof p))return new p(y);let w=y?i(this,y,"readableHighWaterMark",!0):null;w===0&&(y={...y,highWaterMark:null,readableHighWaterMark:w,writableHighWaterMark:y.writableHighWaterMark||0}),l.call(this,y),this._readableState.sync=!1,this[d]=null,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",_)}function v(y){typeof this._flush=="function"&&!this.destroyed?this._flush((w,S)=>{if(w){y?y(w):this.destroy(w);return}S!=null&&this.push(S),this.push(null),y&&y()}):(this.push(null),y&&y())}function _(){this._final!==v&&v.call(this)}return p.prototype._final=v,p.prototype._transform=function(y,w,S){throw new n("_transform()")},p.prototype._write=function(y,w,S){let M=this._readableState,x=this._writableState,E=M.length;this._transform(y,w,(T,I)=>{if(T){S(T);return}I!=null&&this.push(I),x.ended||E===M.length||M.length<M.highWaterMark?S():this[d]=S})},p.prototype._read=function(){if(this[d]){let y=this[d];this[d]=null,y()}},dY}var pY={},qRe=!1;function YRe(){if(qRe)return pY;qRe=!0;let{ObjectSetPrototypeOf:e}=No();pY=n;let r=VRe();e(n.prototype,r.prototype),e(n,r);function n(l){if(!(this instanceof n))return new n(l);r.call(this,l)}return n.prototype._transform=function(l,i,d){d(null,l)},pY}var mY={},URe=!1;function _Y(){if(URe)return mY;URe=!0;let e=pn,{ArrayIsArray:r,Promise:n,SymbolAsyncIterator:l,SymbolDispose:i}=No(),d=hv(),{once:p}=Hf(),v=p3(),_=J1(),{aggregateTwoErrors:y,codes:{ERR_INVALID_ARG_TYPE:w,ERR_INVALID_RETURN_VALUE:S,ERR_MISSING_ARGS:M,ERR_STREAM_DESTROYED:x,ERR_STREAM_PREMATURE_CLOSE:E},AbortError:T}=yh(),{validateFunction:I,validateAbortSignal:B}=F5(),{isIterable:O,isReadable:N,isReadableNodeStream:H,isNodeStream:K,isTransformStream:J,isWebStream:L,isReadableStream:$,isReadableFinished:V}=X1(),h=globalThis.AbortController||j5().AbortController,t,a,s;function u(k,q,Z){let ne=!1;k.on("close",()=>{ne=!0});let G=d(k,{readable:q,writable:Z},D=>{ne=!D});return{destroy:D=>{ne||(ne=!0,v.destroyer(k,D||new x("pipe")))},cleanup:G}}function c(k){return I(k[k.length-1],"streams[stream.length - 1]"),k.pop()}function b(k){if(O(k))return k;if(H(k))return m(k);throw new w("val",["Readable","Iterable","AsyncIterable"],k)}async function*m(k){a||(a=SR()),yield*a.prototype[l].call(k)}async function f(k,q,Z,{end:ne}){let G,D=null,W=z=>{if(z&&(G=z),D){let F=D;D=null,F()}},ie=()=>new n((z,F)=>{G?F(G):D=()=>{G?F(G):z()}});q.on("drain",W);let X=d(q,{readable:!1},W);try{q.writableNeedDrain&&await ie();for await(let z of k)q.write(z)||await ie();ne&&(q.end(),await ie()),Z()}catch(z){Z(G!==z?y(G,z):z)}finally{X(),q.off("drain",W)}}async function o(k,q,Z,{end:ne}){J(q)&&(q=q.writable);let G=q.getWriter();try{for await(let D of k)await G.ready,G.write(D).catch(()=>{});await G.ready,ne&&await G.close(),Z()}catch(D){try{await G.abort(D),Z(D)}catch(W){Z(W)}}}function g(...k){return A(k,p(c(k)))}function A(k,q,Z){if(k.length===1&&r(k[0])&&(k=k[0]),k.length<2)throw new M("streams");let ne=new h,G=ne.signal,D=Z?.signal,W=[];B(D,"options.signal");function ie(){re(new T)}s=s||Hf().addAbortListener;let X;D&&(X=s(D,ie));let z,F,Y=[],ae=0;function de(Be){re(Be,--ae===0)}function re(Be,be){var Ne;if(Be&&(!z||z.code==="ERR_STREAM_PREMATURE_CLOSE")&&(z=Be),!(!z&&!be)){for(;Y.length;)Y.shift()(z);(Ne=X)===null||Ne===void 0||Ne[i](),ne.abort(),be&&(z||W.forEach(qe=>qe()),e.nextTick(q,z,F))}}let fe;for(let Be=0;Be<k.length;Be++){let be=k[Be],Ne=Be<k.length-1,qe=Be>0,j=Ne||Z?.end!==!1,P=Be===k.length-1;if(K(be)){let C=function(U){U&&U.name!=="AbortError"&&U.code!=="ERR_STREAM_PREMATURE_CLOSE"&&de(U)};var Re=C;if(j){let{destroy:U,cleanup:ee}=u(be,Ne,qe);Y.push(U),N(be)&&P&&W.push(ee)}be.on("error",C),N(be)&&P&&W.push(()=>{be.removeListener("error",C)})}if(Be===0)if(typeof be=="function"){if(fe=be({signal:G}),!O(fe))throw new S("Iterable, AsyncIterable or Stream","source",fe)}else O(be)||H(be)||J(be)?fe=be:fe=_.from(be);else if(typeof be=="function"){if(J(fe)){var ye;fe=b((ye=fe)===null||ye===void 0?void 0:ye.readable)}else fe=b(fe);if(fe=be(fe,{signal:G}),Ne){if(!O(fe,!0))throw new S("AsyncIterable",`transform[${Be-1}]`,fe)}else{var he;t||(t=YRe());let C=new t({objectMode:!0}),U=(he=fe)===null||he===void 0?void 0:he.then;if(typeof U=="function")ae++,U.call(fe,te=>{F=te,te!=null&&C.write(te),j&&C.end(),e.nextTick(de)},te=>{C.destroy(te),e.nextTick(de,te)});else if(O(fe,!0))ae++,f(fe,C,de,{end:j});else if($(fe)||J(fe)){let te=fe.readable||fe;ae++,f(te,C,de,{end:j})}else throw new S("AsyncIterable or Promise","destination",fe);fe=C;let{destroy:ee,cleanup:Q}=u(fe,!1,!0);Y.push(ee),P&&W.push(Q)}}else if(K(be)){if(H(fe)){ae+=2;let C=R(fe,be,de,{end:j});N(be)&&P&&W.push(C)}else if(J(fe)||$(fe)){let C=fe.readable||fe;ae++,f(C,be,de,{end:j})}else if(O(fe))ae++,f(fe,be,de,{end:j});else throw new w("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],fe);fe=be}else if(L(be)){if(H(fe))ae++,o(b(fe),be,de,{end:j});else if($(fe)||O(fe))ae++,o(fe,be,de,{end:j});else if(J(fe))ae++,o(fe.readable,be,de,{end:j});else throw new w("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],fe);fe=be}else fe=_.from(be)}return(G!=null&&G.aborted||D!=null&&D.aborted)&&e.nextTick(ie),fe}function R(k,q,Z,{end:ne}){let G=!1;if(q.on("close",()=>{G||Z(new E)}),k.pipe(q,{end:!1}),ne){let W=function(){G=!0,q.end()};var D=W;V(k)?e.nextTick(W):k.once("end",W)}else Z();return d(k,{readable:!0,writable:!1},W=>{let ie=k._readableState;W&&W.code==="ERR_STREAM_PREMATURE_CLOSE"&&ie&&ie.ended&&!ie.errored&&!ie.errorEmitted?k.once("end",Z).once("error",Z):Z(W)}),d(q,{readable:!1,writable:!0},Z)}return mY={pipelineImpl:A,pipeline:g},mY}var vY={},jRe=!1;function JRe(){if(jRe)return vY;jRe=!0;let{pipeline:e}=_Y(),r=J1(),{destroyer:n}=p3(),{isNodeStream:l,isReadable:i,isWritable:d,isWebStream:p,isTransformStream:v,isWritableStream:_,isReadableStream:y}=X1(),{AbortError:w,codes:{ERR_INVALID_ARG_VALUE:S,ERR_MISSING_ARGS:M}}=yh(),x=hv();return vY=function(...T){if(T.length===0)throw new M("streams");if(T.length===1)return r.from(T[0]);let I=[...T];if(typeof T[0]=="function"&&(T[0]=r.from(T[0])),typeof T[T.length-1]=="function"){let t=T.length-1;T[t]=r.from(T[t])}for(let t=0;t<T.length;++t)if(!(!l(T[t])&&!p(T[t]))){if(t<T.length-1&&!(i(T[t])||y(T[t])||v(T[t])))throw new S(`streams[${t}]`,I[t],"must be readable");if(t>0&&!(d(T[t])||_(T[t])||v(T[t])))throw new S(`streams[${t}]`,I[t],"must be writable")}let B,O,N,H,K;function J(t){let a=H;H=null,a?a(t):t?K.destroy(t):!h&&!V&&K.destroy()}let L=T[0],$=e(T,J),V=!!(d(L)||_(L)||v(L)),h=!!(i($)||y($)||v($));if(K=new r({writableObjectMode:!!(L!=null&&L.writableObjectMode),readableObjectMode:!!($!=null&&$.readableObjectMode),writable:V,readable:h}),V){if(l(L))K._write=function(a,s,u){L.write(a,s)?u():B=u},K._final=function(a){L.end(),O=a},L.on("drain",function(){if(B){let a=B;B=null,a()}});else if(p(L)){let s=(v(L)?L.writable:L).getWriter();K._write=async function(u,c,b){try{await s.ready,s.write(u).catch(()=>{}),b()}catch(m){b(m)}},K._final=async function(u){try{await s.ready,s.close().catch(()=>{}),O=u}catch(c){u(c)}}}let t=v($)?$.readable:$;x(t,()=>{if(O){let a=O;O=null,a()}})}if(h){if(l($))$.on("readable",function(){if(N){let t=N;N=null,t()}}),$.on("end",function(){K.push(null)}),K._read=function(){for(;;){let t=$.read();if(t===null){N=K._read;return}if(!K.push(t))return}};else if(p($)){let a=(v($)?$.readable:$).getReader();K._read=async function(){for(;;)try{let{value:s,done:u}=await a.read();if(!K.push(s))return;if(u){K.push(null);return}}catch{return}}}}return K._destroy=function(t,a){!t&&H!==null&&(t=new w),N=null,B=null,O=null,H===null?a(t):(H=a,l($)&&n($,t))},K},vY}var wR={},FRe=!1;function Ibt(){if(FRe)return wR;FRe=!0;let e=globalThis.AbortController||j5().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:n,ERR_MISSING_ARGS:l,ERR_OUT_OF_RANGE:i},AbortError:d}=yh(),{validateAbortSignal:p,validateInteger:v,validateObject:_}=F5(),y=No().Symbol("kWeak"),w=No().Symbol("kResistStopPropagation"),{finished:S}=hv(),M=JRe(),{addAbortSignalNoValidate:x}=_R(),{isWritable:E,isNodeStream:T}=X1(),{deprecate:I}=Hf(),{ArrayPrototypePush:B,Boolean:O,MathFloor:N,Number:H,NumberIsNaN:K,Promise:J,PromiseReject:L,PromiseResolve:$,PromisePrototypeThen:V,Symbol:h}=No(),t=h("kEmpty"),a=h("kEof");function s(D,W){if(W!=null&&_(W,"options"),W?.signal!=null&&p(W.signal,"options.signal"),T(D)&&!E(D))throw new r("stream",D,"must be writable");let ie=M(this,D);return W!=null&&W.signal&&x(W.signal,ie),ie}function u(D,W){if(typeof D!="function")throw new n("fn",["Function","AsyncFunction"],D);W!=null&&_(W,"options"),W?.signal!=null&&p(W.signal,"options.signal");let ie=1;W?.concurrency!=null&&(ie=N(W.concurrency));let X=ie-1;return W?.highWaterMark!=null&&(X=N(W.highWaterMark)),v(ie,"options.concurrency",1),v(X,"options.highWaterMark",0),X+=ie,async function*(){let F=Hf().AbortSignalAny([W?.signal].filter(O)),Y=this,ae=[],de={signal:F},re,fe,ye=!1,he=0;function Re(){ye=!0,Be()}function Be(){he-=1,be()}function be(){fe&&!ye&&he<ie&&ae.length<X&&(fe(),fe=null)}async function Ne(){try{for await(let qe of Y){if(ye)return;if(F.aborted)throw new d;try{if(qe=D(qe,de),qe===t)continue;qe=$(qe)}catch(j){qe=L(j)}he+=1,V(qe,Be,Re),ae.push(qe),re&&(re(),re=null),!ye&&(ae.length>=X||he>=ie)&&await new J(j=>{fe=j})}ae.push(a)}catch(qe){let j=L(qe);V(j,Be,Re),ae.push(j)}finally{ye=!0,re&&(re(),re=null)}}Ne();try{for(;;){for(;ae.length>0;){let qe=await ae[0];if(qe===a)return;if(F.aborted)throw new d;qe!==t&&(yield qe),ae.shift(),be()}await new J(qe=>{re=qe})}}finally{ye=!0,fe&&(fe(),fe=null)}}.call(this)}function c(D=void 0){return D!=null&&_(D,"options"),D?.signal!=null&&p(D.signal,"options.signal"),async function*(){let ie=0;for await(let z of this){var X;if(D!=null&&(X=D.signal)!==null&&X!==void 0&&X.aborted)throw new d({cause:D.signal.reason});yield[ie++,z]}}.call(this)}async function b(D,W=void 0){for await(let ie of g.call(this,D,W))return!0;return!1}async function m(D,W=void 0){if(typeof D!="function")throw new n("fn",["Function","AsyncFunction"],D);return!await b.call(this,async(...ie)=>!await D(...ie),W)}async function f(D,W){for await(let ie of g.call(this,D,W))return ie}async function o(D,W){if(typeof D!="function")throw new n("fn",["Function","AsyncFunction"],D);async function ie(X,z){return await D(X,z),t}for await(let X of u.call(this,ie,W));}function g(D,W){if(typeof D!="function")throw new n("fn",["Function","AsyncFunction"],D);async function ie(X,z){return await D(X,z)?X:t}return u.call(this,ie,W)}class A extends l{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function R(D,W,ie){var X;if(typeof D!="function")throw new n("reducer",["Function","AsyncFunction"],D);ie!=null&&_(ie,"options"),ie?.signal!=null&&p(ie.signal,"options.signal");let z=arguments.length>1;if(ie!=null&&(X=ie.signal)!==null&&X!==void 0&&X.aborted){let re=new d(void 0,{cause:ie.signal.reason});throw this.once("error",()=>{}),await S(this.destroy(re)),re}let F=new e,Y=F.signal;if(ie!=null&&ie.signal){let re={once:!0,[y]:this,[w]:!0};ie.signal.addEventListener("abort",()=>F.abort(),re)}let ae=!1;try{for await(let re of this){var de;if(ae=!0,ie!=null&&(de=ie.signal)!==null&&de!==void 0&&de.aborted)throw new d;z?W=await D(W,re,{signal:Y}):(W=re,z=!0)}if(!ae&&!z)throw new A}finally{F.abort()}return W}async function k(D){D!=null&&_(D,"options"),D?.signal!=null&&p(D.signal,"options.signal");let W=[];for await(let X of this){var ie;if(D!=null&&(ie=D.signal)!==null&&ie!==void 0&&ie.aborted)throw new d(void 0,{cause:D.signal.reason});B(W,X)}return W}function q(D,W){let ie=u.call(this,D,W);return async function*(){for await(let z of ie)yield*z}.call(this)}function Z(D){if(D=H(D),K(D))return 0;if(D<0)throw new i("number",">= 0",D);return D}function ne(D,W=void 0){return W!=null&&_(W,"options"),W?.signal!=null&&p(W.signal,"options.signal"),D=Z(D),async function*(){var X;if(W!=null&&(X=W.signal)!==null&&X!==void 0&&X.aborted)throw new d;for await(let F of this){var z;if(W!=null&&(z=W.signal)!==null&&z!==void 0&&z.aborted)throw new d;D--<=0&&(yield F)}}.call(this)}function G(D,W=void 0){return W!=null&&_(W,"options"),W?.signal!=null&&p(W.signal,"options.signal"),D=Z(D),async function*(){var X;if(W!=null&&(X=W.signal)!==null&&X!==void 0&&X.aborted)throw new d;for await(let F of this){var z;if(W!=null&&(z=W.signal)!==null&&z!==void 0&&z.aborted)throw new d;if(D-- >0&&(yield F),D<=0)return}}.call(this)}return wR.streamReturningOperators={asIndexedPairs:I(c,"readable.asIndexedPairs will be removed in a future version."),drop:ne,filter:g,flatMap:q,map:u,take:G,compose:s},wR.promiseReturningOperators={every:m,forEach:o,reduce:R,toArray:k,some:b,find:f},wR}var gY={},zRe=!1;function XRe(){if(zRe)return gY;zRe=!0;let{ArrayPrototypePop:e,Promise:r}=No(),{isIterable:n,isNodeStream:l,isWebStream:i}=X1(),{pipelineImpl:d}=_Y(),{finished:p}=hv();QRe();function v(..._){return new r((y,w)=>{let S,M,x=_[_.length-1];if(x&&typeof x=="object"&&!l(x)&&!n(x)&&!i(x)){let E=e(_);S=E.signal,M=E.end}d(_,(E,T)=>{E?w(E):y(T)},{signal:S,end:M})})}return gY={finished:p,pipeline:v},gY}var bY={},HRe=!1,KRe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function QRe(){if(HRe)return bY;HRe=!0;let{Buffer:e}=Oi(),{ObjectDefineProperty:r,ObjectKeys:n,ReflectApply:l}=No(),{promisify:{custom:i}}=Hf(),{streamReturningOperators:d,promiseReturningOperators:p}=Ibt(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:v}}=yh(),_=JRe(),{setDefaultHighWaterMark:y,getDefaultHighWaterMark:w}=MR(),{pipeline:S}=_Y(),{destroyer:M}=p3(),x=hv(),E=XRe(),T=X1(),I=bY=yY().Stream;I.isDestroyed=T.isDestroyed,I.isDisturbed=T.isDisturbed,I.isErrored=T.isErrored,I.isReadable=T.isReadable,I.isWritable=T.isWritable,I.Readable=SR();for(let N of n(d)){let K=function(...J){if(new.target)throw v();return I.Readable.from(l(H,this||KRe,J))};var O=K;let H=d[N];r(K,"name",{__proto__:null,value:H.name}),r(K,"length",{__proto__:null,value:H.length}),r(I.Readable.prototype,N,{__proto__:null,value:K,enumerable:!1,configurable:!0,writable:!0})}for(let N of n(p)){let K=function(...L){if(new.target)throw v();return l(H,this||KRe,L)};var O=K;let H=p[N];r(K,"name",{__proto__:null,value:H.name}),r(K,"length",{__proto__:null,value:H.length}),r(I.Readable.prototype,N,{__proto__:null,value:K,enumerable:!1,configurable:!0,writable:!0})}I.Writable=wY(),I.Duplex=J1(),I.Transform=VRe(),I.PassThrough=YRe(),I.pipeline=S;let{addAbortSignal:B}=_R();return I.addAbortSignal=B,I.finished=x,I.destroy=M,I.compose=_,I.setDefaultHighWaterMark=y,I.getDefaultHighWaterMark=w,r(I,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return E}}),r(S,i,{__proto__:null,enumerable:!0,get(){return E.pipeline}}),r(x,i,{__proto__:null,enumerable:!0,get(){return E.finished}}),I.Stream=I,I._isUint8Array=function(H){return H instanceof Uint8Array},I._uint8ArrayToBuffer=function(H){return e.from(H.buffer,H.byteOffset,H.byteLength)},bY}var Oo={},ZRe=!1;function kbt(){if(ZRe)return Oo;ZRe=!0;let e=QRe(),r=XRe(),n=e.Readable.destroy;return Oo=e.Readable,Oo._uint8ArrayToBuffer=e._uint8ArrayToBuffer,Oo._isUint8Array=e._isUint8Array,Oo.isDisturbed=e.isDisturbed,Oo.isErrored=e.isErrored,Oo.isReadable=e.isReadable,Oo.Readable=e.Readable,Oo.Writable=e.Writable,Oo.Duplex=e.Duplex,Oo.Transform=e.Transform,Oo.PassThrough=e.PassThrough,Oo.addAbortSignal=e.addAbortSignal,Oo.finished=e.finished,Oo.destroy=e.destroy,Oo.destroy=n,Oo.pipeline=e.pipeline,Oo.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return r}}),Oo.Stream=e.Stream,Oo.default=Oo,Oo}var za=kbt();za._uint8ArrayToBuffer;za._isUint8Array;za.isDisturbed;za.isErrored;za.isReadable;za.Readable;za.Writable;za.Duplex;za.Transform;za.PassThrough;za.addAbortSignal;za.finished;za.destroy;za.pipeline;za.compose;za.Stream;var WRe=za.Readable;WRe.wrap=function(e,r){return r=Object.assign({objectMode:e.readableObjectMode!=null||e.objectMode!=null||!0},r),r.destroy=function(n,l){e.destroy(n),l(n)},new WRe(r).wrap(e)};var Our=za.Writable,Nur=za.Duplex,eTe=za.Transform,tTe=za.PassThrough,Cur=za.finished,Lur=za.pipeline,Dur=za.Stream,$ur={finished:GA(za.finished),pipeline:GA(za.pipeline)};var eb=$n(Cu(),1);sd();async function rTe(e){let r=iTe(e),n=(await r.next()).value;n=await Kf(r,n,32);let l=Po(n.subarray(0,32));n=n.subarray(32);let i=64*l;n=await Kf(r,n,i);let d=new Array(l);for(let _=0;_<i;_+=64)d[_/64]=[Po(n.subarray(_,_+32)),(0,eb.default)(ze.from(n.subarray(_+32,_+64)))];n=n.subarray(i);let p=32+i,v=[];for(let[_,y]of d){n=await Kf(r,n,mR),n=await Kf(r,n,2);let w=Po(n.subarray(0,2));n=n.subarray(2);let{sigLength:S,pubLength:M,sigName:x}=fn[w];n=await Kf(r,n,S);let E=n.subarray(0,S);n=n.subarray(S),n=await Kf(r,n,M);let T=n.subarray(0,M);n=n.subarray(M),n=await Kf(r,n,1);let I=n[0]===1;I&&(n=await Kf(r,n,33));let B=I?n.subarray(1,33):ze.allocUnsafe(0);n=n.subarray(I?33:1),n=await Kf(r,n,1);let O=n[0]===1;O&&(n=await Kf(r,n,33));let N=O?n.subarray(1,33):ze.allocUnsafe(0);n=n.subarray(O?33:1),n=await Kf(r,n,8);let H=Po(n.subarray(0,8));n=n.subarray(8),n=await Kf(r,n,8);let K=Po(n.subarray(0,8));n=n.subarray(8),n=await Kf(r,n,K);let J=n.subarray(0,K),L=H!==0&&K!==0?l3(ze.from(J)):[];if(L.length!==H)throw new Error("Tags lengths don't match");n=n.subarray(K);let $=new eTe;$._transform=function(s,u,c){this.push(s),c()};let V=qm([(0,ba.stringToBuffer)("dataitem"),(0,ba.stringToBuffer)("1"),(0,ba.stringToBuffer)(w.toString()),T,B,N,J,$]),h=2+S+M+(I?33:1)+(O?33:1)+16+K,t=_-h;if(n.byteLength>t)$.write(n.subarray(0,t)),n=n.subarray(t);else{let s=n.byteLength;for($.write(n);t>s;){if(n=(await r.next()).value,!n)throw new Error(`Not enough data bytes expected: ${t} received: ${s}`);s+=n.byteLength,s>t?$.write(n.subarray(0,n.byteLength-(s-t))):$.write(n)}n=n.subarray(n.byteLength-(s-t))}if($.end(),y!==(0,eb.default)(Ul("sha256").update(E).digest()))throw new Error("ID doesn't match signature");if(!await O5[w].verify(T,await V,E))throw new Error("Invalid signature");v.push({id:y,sigName:x,signature:(0,eb.default)(ze.from(E)),target:(0,eb.default)(ze.from(B)),anchor:(0,eb.default)(ze.from(N)),owner:(0,eb.default)(ze.from(T)),tags:L,dataOffset:p+h,dataSize:t}),p+=h+t}return v}async function Bbt(e,r,n,l){let i=$5("",n,l),d=new tTe,p=[(0,ba.stringToBuffer)("dataitem"),(0,ba.stringToBuffer)("1"),(0,ba.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,e],v=await qm(p),_=ze.from(await n.sign(v));return i.setSignature(_),d.write(i.getRaw()),r.pipe(d)}async function Kf(e,r,n){if(r.byteLength>=n)return r;let{done:l,value:i}=await e.next();if(l&&!i)throw new Error("Invalid buffer");return Kf(e,ze.concat([ze.from(r),ze.from(i)]),n)}async function*iTe(e){for await(let r of e)yield r}var Pbt=rTe,Obt={readBytes:Kf,getReader:iTe};var Nbt={...QV,stream:MY};globalThis.arbundles??=Nbt;we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();var Bn;(function(e){e.assertEqual=i=>i;function r(i){}e.assertIs=r;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{let d={};for(let p of i)d[p]=p;return d},e.getValidEnumValues=i=>{let d=e.objectKeys(i).filter(v=>typeof i[i[v]]!="number"),p={};for(let v of d)p[v]=i[v];return e.objectValues(p)},e.objectValues=i=>e.objectKeys(i).map(function(d){return i[d]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let d=[];for(let p in i)Object.prototype.hasOwnProperty.call(i,p)&&d.push(p);return d},e.find=(i,d)=>{for(let p of i)if(d(p))return p},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function l(i,d=" | "){return i.map(p=>typeof p=="string"?`'${p}'`:p).join(d)}e.joinValues=l,e.jsonStringifyReplacer=(i,d)=>typeof d=="bigint"?d.toString():d})(Bn||(Bn={}));var xY;(function(e){e.mergeShapes=(r,n)=>({...r,...n})})(xY||(xY={}));var Nr=Bn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ep=e=>{switch(typeof e){case"undefined":return Nr.undefined;case"string":return Nr.string;case"number":return isNaN(e)?Nr.nan:Nr.number;case"boolean":return Nr.boolean;case"function":return Nr.function;case"bigint":return Nr.bigint;case"symbol":return Nr.symbol;case"object":return Array.isArray(e)?Nr.array:e===null?Nr.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Nr.promise:typeof Map<"u"&&e instanceof Map?Nr.map:typeof Set<"u"&&e instanceof Set?Nr.set:typeof Date<"u"&&e instanceof Date?Nr.date:Nr.object;default:return Nr.unknown}},dr=Bn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Cbt=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),lu=class e extends Error{get errors(){return this.issues}constructor(r){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=r}format(r){let n=r||function(d){return d.message},l={_errors:[]},i=d=>{for(let p of d.issues)if(p.code==="invalid_union")p.unionErrors.map(i);else if(p.code==="invalid_return_type")i(p.returnTypeError);else if(p.code==="invalid_arguments")i(p.argumentsError);else if(p.path.length===0)l._errors.push(n(p));else{let v=l,_=0;for(;_<p.path.length;){let y=p.path[_];_===p.path.length-1?(v[y]=v[y]||{_errors:[]},v[y]._errors.push(n(p))):v[y]=v[y]||{_errors:[]},v=v[y],_++}}};return i(this),l}static assert(r){if(!(r instanceof e))throw new Error(`Not a ZodError: ${r}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=n=>n.message){let n={},l=[];for(let i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(r(i))):l.push(r(i));return{formErrors:l,fieldErrors:n}}get formErrors(){return this.flatten()}};lu.create=e=>new lu(e);var g3=(e,r)=>{let n;switch(e.code){case dr.invalid_type:e.received===Nr.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case dr.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Bn.jsonStringifyReplacer)}`;break;case dr.unrecognized_keys:n=`Unrecognized key(s) in object: ${Bn.joinValues(e.keys,", ")}`;break;case dr.invalid_union:n="Invalid input";break;case dr.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Bn.joinValues(e.options)}`;break;case dr.invalid_enum_value:n=`Invalid enum value. Expected ${Bn.joinValues(e.options)}, received '${e.received}'`;break;case dr.invalid_arguments:n="Invalid function arguments";break;case dr.invalid_return_type:n="Invalid function return type";break;case dr.invalid_date:n="Invalid date";break;case dr.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Bn.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case dr.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case dr.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case dr.custom:n="Invalid input";break;case dr.invalid_intersection_types:n="Intersection results could not be merged";break;case dr.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case dr.not_finite:n="Number must be finite";break;default:n=r.defaultError,Bn.assertNever(e)}return{message:n}},sTe=g3;function Lbt(e){sTe=e}function xR(){return sTe}var ER=e=>{let{data:r,path:n,errorMaps:l,issueData:i}=e,d=[...n,...i.path||[]],p={...i,path:d};if(i.message!==void 0)return{...i,path:d,message:i.message};let v="",_=l.filter(y=>!!y).slice().reverse();for(let y of _)v=y(p,{data:r,defaultError:v}).message;return{...i,path:d,message:v}},Dbt=[];function kr(e,r){let n=xR(),l=ER({issueData:r,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===g3?void 0:g3].filter(i=>!!i)});e.common.issues.push(l)}var Pf=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(r,n){let l=[];for(let i of n){if(i.status==="aborted")return ai;i.status==="dirty"&&r.dirty(),l.push(i.value)}return{status:r.value,value:l}}static async mergeObjectAsync(r,n){let l=[];for(let i of n){let d=await i.key,p=await i.value;l.push({key:d,value:p})}return e.mergeObjectSync(r,l)}static mergeObjectSync(r,n){let l={};for(let i of n){let{key:d,value:p}=i;if(d.status==="aborted"||p.status==="aborted")return ai;d.status==="dirty"&&r.dirty(),p.status==="dirty"&&r.dirty(),d.value!=="__proto__"&&(typeof p.value<"u"||i.alwaysSet)&&(l[d.value]=p.value)}return{status:r.value,value:l}}},ai=Object.freeze({status:"aborted"}),v3=e=>({status:"dirty",value:e}),Zf=e=>({status:"valid",value:e}),EY=e=>e.status==="aborted",AY=e=>e.status==="dirty",tb=e=>e.status==="valid",K5=e=>typeof Promise<"u"&&e instanceof Promise;function AR(e,r,n,l){if(n==="a"&&!l)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!l:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?l:n==="a"?l.call(e):l?l.value:r.get(e)}function fTe(e,r,n,l,i){if(l==="m")throw new TypeError("Private method is not writable");if(l==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?e!==r||!i:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return l==="a"?i.call(e,n):i?i.value=n:r.set(e,n),n}var $r;(function(e){e.errToObj=r=>typeof r=="string"?{message:r}:r||{},e.toString=r=>typeof r=="string"?r:r?.message})($r||($r={}));var z5,H5,C0=class{constructor(r,n,l,i){this._cachedPath=[],this.parent=r,this.data=n,this._path=l,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},nTe=(e,r)=>{if(tb(r))return{success:!0,data:r.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new lu(e.common.issues);return this._error=n,this._error}}};function Ni(e){if(!e)return{};let{errorMap:r,invalid_type_error:n,required_error:l,description:i}=e;if(r&&(n||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return r?{errorMap:r,description:i}:{errorMap:(p,v)=>{var _,y;let{message:w}=e;return p.code==="invalid_enum_value"?{message:w??v.defaultError}:typeof v.data>"u"?{message:(_=w??l)!==null&&_!==void 0?_:v.defaultError}:p.code!=="invalid_type"?{message:v.defaultError}:{message:(y=w??n)!==null&&y!==void 0?y:v.defaultError}},description:i}}var Ci=class{get description(){return this._def.description}_getType(r){return ep(r.data)}_getOrReturnCtx(r,n){return n||{common:r.parent.common,data:r.data,parsedType:ep(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new Pf,ctx:{common:r.parent.common,data:r.data,parsedType:ep(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){let n=this._parse(r);if(K5(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(r){let n=this._parse(r);return Promise.resolve(n)}parse(r,n){let l=this.safeParse(r,n);if(l.success)return l.data;throw l.error}safeParse(r,n){var l;let i={common:{issues:[],async:(l=n?.async)!==null&&l!==void 0?l:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:ep(r)},d=this._parseSync({data:r,path:i.path,parent:i});return nTe(i,d)}"~validate"(r){var n,l;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:ep(r)};if(!this["~standard"].async)try{let d=this._parseSync({data:r,path:[],parent:i});return tb(d)?{value:d.value}:{issues:i.common.issues}}catch(d){!((l=(n=d?.message)===null||n===void 0?void 0:n.toLowerCase())===null||l===void 0)&&l.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:r,path:[],parent:i}).then(d=>tb(d)?{value:d.value}:{issues:i.common.issues})}async parseAsync(r,n){let l=await this.safeParseAsync(r,n);if(l.success)return l.data;throw l.error}async safeParseAsync(r,n){let l={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:ep(r)},i=this._parse({data:r,path:l.path,parent:l}),d=await(K5(i)?i:Promise.resolve(i));return nTe(l,d)}refine(r,n){let l=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,d)=>{let p=r(i),v=()=>d.addIssue({code:dr.custom,...l(i)});return typeof Promise<"u"&&p instanceof Promise?p.then(_=>_?!0:(v(),!1)):p?!0:(v(),!1)})}refinement(r,n){return this._refinement((l,i)=>r(l)?!0:(i.addIssue(typeof n=="function"?n(l,i):n),!1))}_refinement(r){return new cu({schema:this,typeName:ei.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}constructor(r){this.spa=this.safeParseAsync,this._def=r,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return N0.create(this,this._def)}nullable(){return kd.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rp.create(this)}promise(){return cv.create(this,this._def)}or(r){return fb.create([this,r],this._def)}and(r){return hb.create(this,r,this._def)}transform(r){return new cu({...Ni(this._def),schema:this,typeName:ei.ZodEffects,effect:{type:"transform",transform:r}})}default(r){let n=typeof r=="function"?r:()=>r;return new pb({...Ni(this._def),innerType:this,defaultValue:n,typeName:ei.ZodDefault})}brand(){return new Z5({typeName:ei.ZodBranded,type:this,...Ni(this._def)})}catch(r){let n=typeof r=="function"?r:()=>r;return new mb({...Ni(this._def),innerType:this,catchValue:n,typeName:ei.ZodCatch})}describe(r){let n=this.constructor;return new n({...this._def,description:r})}pipe(r){return W5.create(this,r)}readonly(){return vb.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},$bt=/^c[^\s-]{8,}$/i,qbt=/^[0-9a-z]+$/,Ubt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jbt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Fbt=/^[a-z0-9_-]{21}$/i,zbt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hbt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Kbt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zbt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",SY,Wbt=/^(?:(?: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])$/,Gbt=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Vbt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ybt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jbt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xbt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hTe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Qbt=new RegExp(`^${hTe}$`);function uTe(e){let r="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?r=`${r}\\.\\d{${e.precision}}`:e.precision==null&&(r=`${r}(\\.\\d+)?`),r}function e6t(e){return new RegExp(`^${uTe(e)}$`)}function lTe(e){let r=`${hTe}T${uTe(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${n.join("|")})`,new RegExp(`^${r}$`)}function t6t(e,r){return!!((r==="v4"||!r)&&Wbt.test(e)||(r==="v6"||!r)&&Vbt.test(e))}function r6t(e,r){if(!zbt.test(e))return!1;try{let[n]=e.split("."),l=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(l));return!(typeof i!="object"||i===null||!i.typ||!i.alg||r&&i.alg!==r)}catch{return!1}}function i6t(e,r){return!!((r==="v4"||!r)&&Gbt.test(e)||(r==="v6"||!r)&&Ybt.test(e))}var uv=class e extends Ci{_parse(r){if(this._def.coerce&&(r.data=String(r.data)),this._getType(r)!==Nr.string){let d=this._getOrReturnCtx(r);return kr(d,{code:dr.invalid_type,expected:Nr.string,received:d.parsedType}),ai}let l=new Pf,i;for(let d of this._def.checks)if(d.kind==="min")r.data.length<d.value&&(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),l.dirty());else if(d.kind==="max")r.data.length>d.value&&(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),l.dirty());else if(d.kind==="length"){let p=r.data.length>d.value,v=r.data.length<d.value;(p||v)&&(i=this._getOrReturnCtx(r,i),p?kr(i,{code:dr.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}):v&&kr(i,{code:dr.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}),l.dirty())}else if(d.kind==="email")Kbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"email",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="emoji")SY||(SY=new RegExp(Zbt,"u")),SY.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"emoji",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="uuid")jbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"uuid",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="nanoid")Fbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"nanoid",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="cuid")$bt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"cuid",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="cuid2")qbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"cuid2",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="ulid")Ubt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"ulid",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="url")try{new URL(r.data)}catch{i=this._getOrReturnCtx(r,i),kr(i,{validation:"url",code:dr.invalid_string,message:d.message}),l.dirty()}else d.kind==="regex"?(d.regex.lastIndex=0,d.regex.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"regex",code:dr.invalid_string,message:d.message}),l.dirty())):d.kind==="trim"?r.data=r.data.trim():d.kind==="includes"?r.data.includes(d.value,d.position)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:{includes:d.value,position:d.position},message:d.message}),l.dirty()):d.kind==="toLowerCase"?r.data=r.data.toLowerCase():d.kind==="toUpperCase"?r.data=r.data.toUpperCase():d.kind==="startsWith"?r.data.startsWith(d.value)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:{startsWith:d.value},message:d.message}),l.dirty()):d.kind==="endsWith"?r.data.endsWith(d.value)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:{endsWith:d.value},message:d.message}),l.dirty()):d.kind==="datetime"?lTe(d).test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:"datetime",message:d.message}),l.dirty()):d.kind==="date"?Qbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:"date",message:d.message}),l.dirty()):d.kind==="time"?e6t(d).test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:"time",message:d.message}),l.dirty()):d.kind==="duration"?Hbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"duration",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="ip"?t6t(r.data,d.version)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"ip",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="jwt"?r6t(r.data,d.alg)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"jwt",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="cidr"?i6t(r.data,d.version)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"cidr",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="base64"?Jbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"base64",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="base64url"?Xbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"base64url",code:dr.invalid_string,message:d.message}),l.dirty()):Bn.assertNever(d);return{status:l.value,value:r.data}}_regex(r,n,l){return this.refinement(i=>r.test(i),{validation:n,code:dr.invalid_string,...$r.errToObj(l)})}_addCheck(r){return new e({...this._def,checks:[...this._def.checks,r]})}email(r){return this._addCheck({kind:"email",...$r.errToObj(r)})}url(r){return this._addCheck({kind:"url",...$r.errToObj(r)})}emoji(r){return this._addCheck({kind:"emoji",...$r.errToObj(r)})}uuid(r){return this._addCheck({kind:"uuid",...$r.errToObj(r)})}nanoid(r){return this._addCheck({kind:"nanoid",...$r.errToObj(r)})}cuid(r){return this._addCheck({kind:"cuid",...$r.errToObj(r)})}cuid2(r){return this._addCheck({kind:"cuid2",...$r.errToObj(r)})}ulid(r){return this._addCheck({kind:"ulid",...$r.errToObj(r)})}base64(r){return this._addCheck({kind:"base64",...$r.errToObj(r)})}base64url(r){return this._addCheck({kind:"base64url",...$r.errToObj(r)})}jwt(r){return this._addCheck({kind:"jwt",...$r.errToObj(r)})}ip(r){return this._addCheck({kind:"ip",...$r.errToObj(r)})}cidr(r){return this._addCheck({kind:"cidr",...$r.errToObj(r)})}datetime(r){var n,l;return typeof r=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:r}):this._addCheck({kind:"datetime",precision:typeof r?.precision>"u"?null:r?.precision,offset:(n=r?.offset)!==null&&n!==void 0?n:!1,local:(l=r?.local)!==null&&l!==void 0?l:!1,...$r.errToObj(r?.message)})}date(r){return this._addCheck({kind:"date",message:r})}time(r){return typeof r=="string"?this._addCheck({kind:"time",precision:null,message:r}):this._addCheck({kind:"time",precision:typeof r?.precision>"u"?null:r?.precision,...$r.errToObj(r?.message)})}duration(r){return this._addCheck({kind:"duration",...$r.errToObj(r)})}regex(r,n){return this._addCheck({kind:"regex",regex:r,...$r.errToObj(n)})}includes(r,n){return this._addCheck({kind:"includes",value:r,position:n?.position,...$r.errToObj(n?.message)})}startsWith(r,n){return this._addCheck({kind:"startsWith",value:r,...$r.errToObj(n)})}endsWith(r,n){return this._addCheck({kind:"endsWith",value:r,...$r.errToObj(n)})}min(r,n){return this._addCheck({kind:"min",value:r,...$r.errToObj(n)})}max(r,n){return this._addCheck({kind:"max",value:r,...$r.errToObj(n)})}length(r,n){return this._addCheck({kind:"length",value:r,...$r.errToObj(n)})}nonempty(r){return this.min(1,$r.errToObj(r))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(r=>r.kind==="datetime")}get isDate(){return!!this._def.checks.find(r=>r.kind==="date")}get isTime(){return!!this._def.checks.find(r=>r.kind==="time")}get isDuration(){return!!this._def.checks.find(r=>r.kind==="duration")}get isEmail(){return!!this._def.checks.find(r=>r.kind==="email")}get isURL(){return!!this._def.checks.find(r=>r.kind==="url")}get isEmoji(){return!!this._def.checks.find(r=>r.kind==="emoji")}get isUUID(){return!!this._def.checks.find(r=>r.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(r=>r.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(r=>r.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(r=>r.kind==="cuid2")}get isULID(){return!!this._def.checks.find(r=>r.kind==="ulid")}get isIP(){return!!this._def.checks.find(r=>r.kind==="ip")}get isCIDR(){return!!this._def.checks.find(r=>r.kind==="cidr")}get isBase64(){return!!this._def.checks.find(r=>r.kind==="base64")}get isBase64url(){return!!this._def.checks.find(r=>r.kind==="base64url")}get minLength(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxLength(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}};uv.create=e=>{var r;return new uv({checks:[],typeName:ei.ZodString,coerce:(r=e?.coerce)!==null&&r!==void 0?r:!1,...Ni(e)})};function n6t(e,r){let n=(e.toString().split(".")[1]||"").length,l=(r.toString().split(".")[1]||"").length,i=n>l?n:l,d=parseInt(e.toFixed(i).replace(".","")),p=parseInt(r.toFixed(i).replace(".",""));return d%p/Math.pow(10,i)}var rb=class e extends Ci{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(r){if(this._def.coerce&&(r.data=Number(r.data)),this._getType(r)!==Nr.number){let d=this._getOrReturnCtx(r);return kr(d,{code:dr.invalid_type,expected:Nr.number,received:d.parsedType}),ai}let l,i=new Pf;for(let d of this._def.checks)d.kind==="int"?Bn.isInteger(r.data)||(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.invalid_type,expected:"integer",received:"float",message:d.message}),i.dirty()):d.kind==="min"?(d.inclusive?r.data<d.value:r.data<=d.value)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.too_small,minimum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),i.dirty()):d.kind==="max"?(d.inclusive?r.data>d.value:r.data>=d.value)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.too_big,maximum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),i.dirty()):d.kind==="multipleOf"?n6t(r.data,d.value)!==0&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.not_multiple_of,multipleOf:d.value,message:d.message}),i.dirty()):d.kind==="finite"?Number.isFinite(r.data)||(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.not_finite,message:d.message}),i.dirty()):Bn.assertNever(d);return{status:i.value,value:r.data}}gte(r,n){return this.setLimit("min",r,!0,$r.toString(n))}gt(r,n){return this.setLimit("min",r,!1,$r.toString(n))}lte(r,n){return this.setLimit("max",r,!0,$r.toString(n))}lt(r,n){return this.setLimit("max",r,!1,$r.toString(n))}setLimit(r,n,l,i){return new e({...this._def,checks:[...this._def.checks,{kind:r,value:n,inclusive:l,message:$r.toString(i)}]})}_addCheck(r){return new e({...this._def,checks:[...this._def.checks,r]})}int(r){return this._addCheck({kind:"int",message:$r.toString(r)})}positive(r){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$r.toString(r)})}negative(r){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$r.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$r.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$r.toString(r)})}multipleOf(r,n){return this._addCheck({kind:"multipleOf",value:r,message:$r.toString(n)})}finite(r){return this._addCheck({kind:"finite",message:$r.toString(r)})}safe(r){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$r.toString(r)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$r.toString(r)})}get minValue(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxValue(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}get isInt(){return!!this._def.checks.find(r=>r.kind==="int"||r.kind==="multipleOf"&&Bn.isInteger(r.value))}get isFinite(){let r=null,n=null;for(let l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(n===null||l.value>n)&&(n=l.value):l.kind==="max"&&(r===null||l.value<r)&&(r=l.value)}return Number.isFinite(n)&&Number.isFinite(r)}};rb.create=e=>new rb({checks:[],typeName:ei.ZodNumber,coerce:e?.coerce||!1,...Ni(e)});var ib=class e extends Ci{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(r){if(this._def.coerce)try{r.data=BigInt(r.data)}catch{return this._getInvalidInput(r)}if(this._getType(r)!==Nr.bigint)return this._getInvalidInput(r);let l,i=new Pf;for(let d of this._def.checks)d.kind==="min"?(d.inclusive?r.data<d.value:r.data<=d.value)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.too_small,type:"bigint",minimum:d.value,inclusive:d.inclusive,message:d.message}),i.dirty()):d.kind==="max"?(d.inclusive?r.data>d.value:r.data>=d.value)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.too_big,type:"bigint",maximum:d.value,inclusive:d.inclusive,message:d.message}),i.dirty()):d.kind==="multipleOf"?r.data%d.value!==BigInt(0)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.not_multiple_of,multipleOf:d.value,message:d.message}),i.dirty()):Bn.assertNever(d);return{status:i.value,value:r.data}}_getInvalidInput(r){let n=this._getOrReturnCtx(r);return kr(n,{code:dr.invalid_type,expected:Nr.bigint,received:n.parsedType}),ai}gte(r,n){return this.setLimit("min",r,!0,$r.toString(n))}gt(r,n){return this.setLimit("min",r,!1,$r.toString(n))}lte(r,n){return this.setLimit("max",r,!0,$r.toString(n))}lt(r,n){return this.setLimit("max",r,!1,$r.toString(n))}setLimit(r,n,l,i){return new e({...this._def,checks:[...this._def.checks,{kind:r,value:n,inclusive:l,message:$r.toString(i)}]})}_addCheck(r){return new e({...this._def,checks:[...this._def.checks,r]})}positive(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$r.toString(r)})}negative(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$r.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$r.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$r.toString(r)})}multipleOf(r,n){return this._addCheck({kind:"multipleOf",value:r,message:$r.toString(n)})}get minValue(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxValue(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}};ib.create=e=>{var r;return new ib({checks:[],typeName:ei.ZodBigInt,coerce:(r=e?.coerce)!==null&&r!==void 0?r:!1,...Ni(e)})};var nb=class extends Ci{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==Nr.boolean){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.boolean,received:l.parsedType}),ai}return Zf(r.data)}};nb.create=e=>new nb({typeName:ei.ZodBoolean,coerce:e?.coerce||!1,...Ni(e)});var ab=class e extends Ci{_parse(r){if(this._def.coerce&&(r.data=new Date(r.data)),this._getType(r)!==Nr.date){let d=this._getOrReturnCtx(r);return kr(d,{code:dr.invalid_type,expected:Nr.date,received:d.parsedType}),ai}if(isNaN(r.data.getTime())){let d=this._getOrReturnCtx(r);return kr(d,{code:dr.invalid_date}),ai}let l=new Pf,i;for(let d of this._def.checks)d.kind==="min"?r.data.getTime()<d.value&&(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.too_small,message:d.message,inclusive:!0,exact:!1,minimum:d.value,type:"date"}),l.dirty()):d.kind==="max"?r.data.getTime()>d.value&&(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.too_big,message:d.message,inclusive:!0,exact:!1,maximum:d.value,type:"date"}),l.dirty()):Bn.assertNever(d);return{status:l.value,value:new Date(r.data.getTime())}}_addCheck(r){return new e({...this._def,checks:[...this._def.checks,r]})}min(r,n){return this._addCheck({kind:"min",value:r.getTime(),message:$r.toString(n)})}max(r,n){return this._addCheck({kind:"max",value:r.getTime(),message:$r.toString(n)})}get minDate(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r!=null?new Date(r):null}get maxDate(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r!=null?new Date(r):null}};ab.create=e=>new ab({checks:[],coerce:e?.coerce||!1,typeName:ei.ZodDate,...Ni(e)});var b3=class extends Ci{_parse(r){if(this._getType(r)!==Nr.symbol){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.symbol,received:l.parsedType}),ai}return Zf(r.data)}};b3.create=e=>new b3({typeName:ei.ZodSymbol,...Ni(e)});var ob=class extends Ci{_parse(r){if(this._getType(r)!==Nr.undefined){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.undefined,received:l.parsedType}),ai}return Zf(r.data)}};ob.create=e=>new ob({typeName:ei.ZodUndefined,...Ni(e)});var sb=class extends Ci{_parse(r){if(this._getType(r)!==Nr.null){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.null,received:l.parsedType}),ai}return Zf(r.data)}};sb.create=e=>new sb({typeName:ei.ZodNull,...Ni(e)});var lv=class extends Ci{constructor(){super(...arguments),this._any=!0}_parse(r){return Zf(r.data)}};lv.create=e=>new lv({typeName:ei.ZodAny,...Ni(e)});var tp=class extends Ci{constructor(){super(...arguments),this._unknown=!0}_parse(r){return Zf(r.data)}};tp.create=e=>new tp({typeName:ei.ZodUnknown,...Ni(e)});var ic=class extends Ci{_parse(r){let n=this._getOrReturnCtx(r);return kr(n,{code:dr.invalid_type,expected:Nr.never,received:n.parsedType}),ai}};ic.create=e=>new ic({typeName:ei.ZodNever,...Ni(e)});var y3=class extends Ci{_parse(r){if(this._getType(r)!==Nr.undefined){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.void,received:l.parsedType}),ai}return Zf(r.data)}};y3.create=e=>new y3({typeName:ei.ZodVoid,...Ni(e)});var rp=class e extends Ci{_parse(r){let{ctx:n,status:l}=this._processInputParams(r),i=this._def;if(n.parsedType!==Nr.array)return kr(n,{code:dr.invalid_type,expected:Nr.array,received:n.parsedType}),ai;if(i.exactLength!==null){let p=n.data.length>i.exactLength.value,v=n.data.length<i.exactLength.value;(p||v)&&(kr(n,{code:p?dr.too_big:dr.too_small,minimum:v?i.exactLength.value:void 0,maximum:p?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),l.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(kr(n,{code:dr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),l.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(kr(n,{code:dr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),l.dirty()),n.common.async)return Promise.all([...n.data].map((p,v)=>i.type._parseAsync(new C0(n,p,n.path,v)))).then(p=>Pf.mergeArray(l,p));let d=[...n.data].map((p,v)=>i.type._parseSync(new C0(n,p,n.path,v)));return Pf.mergeArray(l,d)}get element(){return this._def.type}min(r,n){return new e({...this._def,minLength:{value:r,message:$r.toString(n)}})}max(r,n){return new e({...this._def,maxLength:{value:r,message:$r.toString(n)}})}length(r,n){return new e({...this._def,exactLength:{value:r,message:$r.toString(n)}})}nonempty(r){return this.min(1,r)}};rp.create=(e,r)=>new rp({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ei.ZodArray,...Ni(r)});function m3(e){if(e instanceof wh){let r={};for(let n in e.shape){let l=e.shape[n];r[n]=N0.create(m3(l))}return new wh({...e._def,shape:()=>r})}else return e instanceof rp?new rp({...e._def,type:m3(e.element)}):e instanceof N0?N0.create(m3(e.unwrap())):e instanceof kd?kd.create(m3(e.unwrap())):e instanceof Id?Id.create(e.items.map(r=>m3(r))):e}var wh=class e extends Ci{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let r=this._def.shape(),n=Bn.objectKeys(r);return this._cached={shape:r,keys:n}}_parse(r){if(this._getType(r)!==Nr.object){let y=this._getOrReturnCtx(r);return kr(y,{code:dr.invalid_type,expected:Nr.object,received:y.parsedType}),ai}let{status:l,ctx:i}=this._processInputParams(r),{shape:d,keys:p}=this._getCached(),v=[];if(!(this._def.catchall instanceof ic&&this._def.unknownKeys==="strip"))for(let y in i.data)p.includes(y)||v.push(y);let _=[];for(let y of p){let w=d[y],S=i.data[y];_.push({key:{status:"valid",value:y},value:w._parse(new C0(i,S,i.path,y)),alwaysSet:y in i.data})}if(this._def.catchall instanceof ic){let y=this._def.unknownKeys;if(y==="passthrough")for(let w of v)_.push({key:{status:"valid",value:w},value:{status:"valid",value:i.data[w]}});else if(y==="strict")v.length>0&&(kr(i,{code:dr.unrecognized_keys,keys:v}),l.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let y=this._def.catchall;for(let w of v){let S=i.data[w];_.push({key:{status:"valid",value:w},value:y._parse(new C0(i,S,i.path,w)),alwaysSet:w in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let y=[];for(let w of _){let S=await w.key,M=await w.value;y.push({key:S,value:M,alwaysSet:w.alwaysSet})}return y}).then(y=>Pf.mergeObjectSync(l,y)):Pf.mergeObjectSync(l,_)}get shape(){return this._def.shape()}strict(r){return $r.errToObj,new e({...this._def,unknownKeys:"strict",...r!==void 0?{errorMap:(n,l)=>{var i,d,p,v;let _=(p=(d=(i=this._def).errorMap)===null||d===void 0?void 0:d.call(i,n,l).message)!==null&&p!==void 0?p:l.defaultError;return n.code==="unrecognized_keys"?{message:(v=$r.errToObj(r).message)!==null&&v!==void 0?v:_}:{message:_}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(r){return new e({...this._def,shape:()=>({...this._def.shape(),...r})})}merge(r){return new e({unknownKeys:r._def.unknownKeys,catchall:r._def.catchall,shape:()=>({...this._def.shape(),...r._def.shape()}),typeName:ei.ZodObject})}setKey(r,n){return this.augment({[r]:n})}catchall(r){return new e({...this._def,catchall:r})}pick(r){let n={};return Bn.objectKeys(r).forEach(l=>{r[l]&&this.shape[l]&&(n[l]=this.shape[l])}),new e({...this._def,shape:()=>n})}omit(r){let n={};return Bn.objectKeys(this.shape).forEach(l=>{r[l]||(n[l]=this.shape[l])}),new e({...this._def,shape:()=>n})}deepPartial(){return m3(this)}partial(r){let n={};return Bn.objectKeys(this.shape).forEach(l=>{let i=this.shape[l];r&&!r[l]?n[l]=i:n[l]=i.optional()}),new e({...this._def,shape:()=>n})}required(r){let n={};return Bn.objectKeys(this.shape).forEach(l=>{if(r&&!r[l])n[l]=this.shape[l];else{let d=this.shape[l];for(;d instanceof N0;)d=d._def.innerType;n[l]=d}}),new e({...this._def,shape:()=>n})}keyof(){return cTe(Bn.objectKeys(this.shape))}};wh.create=(e,r)=>new wh({shape:()=>e,unknownKeys:"strip",catchall:ic.create(),typeName:ei.ZodObject,...Ni(r)});wh.strictCreate=(e,r)=>new wh({shape:()=>e,unknownKeys:"strict",catchall:ic.create(),typeName:ei.ZodObject,...Ni(r)});wh.lazycreate=(e,r)=>new wh({shape:e,unknownKeys:"strip",catchall:ic.create(),typeName:ei.ZodObject,...Ni(r)});var fb=class extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r),l=this._def.options;function i(d){for(let v of d)if(v.result.status==="valid")return v.result;for(let v of d)if(v.result.status==="dirty")return n.common.issues.push(...v.ctx.common.issues),v.result;let p=d.map(v=>new lu(v.ctx.common.issues));return kr(n,{code:dr.invalid_union,unionErrors:p}),ai}if(n.common.async)return Promise.all(l.map(async d=>{let p={...n,common:{...n.common,issues:[]},parent:null};return{result:await d._parseAsync({data:n.data,path:n.path,parent:p}),ctx:p}})).then(i);{let d,p=[];for(let _ of l){let y={...n,common:{...n.common,issues:[]},parent:null},w=_._parseSync({data:n.data,path:n.path,parent:y});if(w.status==="valid")return w;w.status==="dirty"&&!d&&(d={result:w,ctx:y}),y.common.issues.length&&p.push(y.common.issues)}if(d)return n.common.issues.push(...d.ctx.common.issues),d.result;let v=p.map(_=>new lu(_));return kr(n,{code:dr.invalid_union,unionErrors:v}),ai}}get options(){return this._def.options}};fb.create=(e,r)=>new fb({options:e,typeName:ei.ZodUnion,...Ni(r)});var Q1=e=>e instanceof ub?Q1(e.schema):e instanceof cu?Q1(e.innerType()):e instanceof lb?[e.value]:e instanceof cb?e.options:e instanceof db?Bn.objectValues(e.enum):e instanceof pb?Q1(e._def.innerType):e instanceof ob?[void 0]:e instanceof sb?[null]:e instanceof N0?[void 0,...Q1(e.unwrap())]:e instanceof kd?[null,...Q1(e.unwrap())]:e instanceof Z5||e instanceof vb?Q1(e.unwrap()):e instanceof mb?Q1(e._def.innerType):[],RR=class e extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r);if(n.parsedType!==Nr.object)return kr(n,{code:dr.invalid_type,expected:Nr.object,received:n.parsedType}),ai;let l=this.discriminator,i=n.data[l],d=this.optionsMap.get(i);return d?n.common.async?d._parseAsync({data:n.data,path:n.path,parent:n}):d._parseSync({data:n.data,path:n.path,parent:n}):(kr(n,{code:dr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[l]}),ai)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(r,n,l){let i=new Map;for(let d of n){let p=Q1(d.shape[r]);if(!p.length)throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);for(let v of p){if(i.has(v))throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(v)}`);i.set(v,d)}}return new e({typeName:ei.ZodDiscriminatedUnion,discriminator:r,options:n,optionsMap:i,...Ni(l)})}};function RY(e,r){let n=ep(e),l=ep(r);if(e===r)return{valid:!0,data:e};if(n===Nr.object&&l===Nr.object){let i=Bn.objectKeys(r),d=Bn.objectKeys(e).filter(v=>i.indexOf(v)!==-1),p={...e,...r};for(let v of d){let _=RY(e[v],r[v]);if(!_.valid)return{valid:!1};p[v]=_.data}return{valid:!0,data:p}}else if(n===Nr.array&&l===Nr.array){if(e.length!==r.length)return{valid:!1};let i=[];for(let d=0;d<e.length;d++){let p=e[d],v=r[d],_=RY(p,v);if(!_.valid)return{valid:!1};i.push(_.data)}return{valid:!0,data:i}}else return n===Nr.date&&l===Nr.date&&+e==+r?{valid:!0,data:e}:{valid:!1}}var hb=class extends Ci{_parse(r){let{status:n,ctx:l}=this._processInputParams(r),i=(d,p)=>{if(EY(d)||EY(p))return ai;let v=RY(d.value,p.value);return v.valid?((AY(d)||AY(p))&&n.dirty(),{status:n.value,value:v.data}):(kr(l,{code:dr.invalid_intersection_types}),ai)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([d,p])=>i(d,p)):i(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}};hb.create=(e,r,n)=>new hb({left:e,right:r,typeName:ei.ZodIntersection,...Ni(n)});var Id=class e extends Ci{_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.parsedType!==Nr.array)return kr(l,{code:dr.invalid_type,expected:Nr.array,received:l.parsedType}),ai;if(l.data.length<this._def.items.length)return kr(l,{code:dr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ai;!this._def.rest&&l.data.length>this._def.items.length&&(kr(l,{code:dr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let d=[...l.data].map((p,v)=>{let _=this._def.items[v]||this._def.rest;return _?_._parse(new C0(l,p,l.path,v)):null}).filter(p=>!!p);return l.common.async?Promise.all(d).then(p=>Pf.mergeArray(n,p)):Pf.mergeArray(n,d)}get items(){return this._def.items}rest(r){return new e({...this._def,rest:r})}};Id.create=(e,r)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Id({items:e,typeName:ei.ZodTuple,rest:null,...Ni(r)})};var TR=class e extends Ci{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.parsedType!==Nr.object)return kr(l,{code:dr.invalid_type,expected:Nr.object,received:l.parsedType}),ai;let i=[],d=this._def.keyType,p=this._def.valueType;for(let v in l.data)i.push({key:d._parse(new C0(l,v,l.path,v)),value:p._parse(new C0(l,l.data[v],l.path,v)),alwaysSet:v in l.data});return l.common.async?Pf.mergeObjectAsync(n,i):Pf.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(r,n,l){return n instanceof Ci?new e({keyType:r,valueType:n,typeName:ei.ZodRecord,...Ni(l)}):new e({keyType:uv.create(),valueType:r,typeName:ei.ZodRecord,...Ni(n)})}},w3=class extends Ci{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.parsedType!==Nr.map)return kr(l,{code:dr.invalid_type,expected:Nr.map,received:l.parsedType}),ai;let i=this._def.keyType,d=this._def.valueType,p=[...l.data.entries()].map(([v,_],y)=>({key:i._parse(new C0(l,v,l.path,[y,"key"])),value:d._parse(new C0(l,_,l.path,[y,"value"]))}));if(l.common.async){let v=new Map;return Promise.resolve().then(async()=>{for(let _ of p){let y=await _.key,w=await _.value;if(y.status==="aborted"||w.status==="aborted")return ai;(y.status==="dirty"||w.status==="dirty")&&n.dirty(),v.set(y.value,w.value)}return{status:n.value,value:v}})}else{let v=new Map;for(let _ of p){let y=_.key,w=_.value;if(y.status==="aborted"||w.status==="aborted")return ai;(y.status==="dirty"||w.status==="dirty")&&n.dirty(),v.set(y.value,w.value)}return{status:n.value,value:v}}}};w3.create=(e,r,n)=>new w3({valueType:r,keyType:e,typeName:ei.ZodMap,...Ni(n)});var _3=class e extends Ci{_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.parsedType!==Nr.set)return kr(l,{code:dr.invalid_type,expected:Nr.set,received:l.parsedType}),ai;let i=this._def;i.minSize!==null&&l.data.size<i.minSize.value&&(kr(l,{code:dr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&l.data.size>i.maxSize.value&&(kr(l,{code:dr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let d=this._def.valueType;function p(_){let y=new Set;for(let w of _){if(w.status==="aborted")return ai;w.status==="dirty"&&n.dirty(),y.add(w.value)}return{status:n.value,value:y}}let v=[...l.data.values()].map((_,y)=>d._parse(new C0(l,_,l.path,y)));return l.common.async?Promise.all(v).then(_=>p(_)):p(v)}min(r,n){return new e({...this._def,minSize:{value:r,message:$r.toString(n)}})}max(r,n){return new e({...this._def,maxSize:{value:r,message:$r.toString(n)}})}size(r,n){return this.min(r,n).max(r,n)}nonempty(r){return this.min(1,r)}};_3.create=(e,r)=>new _3({valueType:e,minSize:null,maxSize:null,typeName:ei.ZodSet,...Ni(r)});var IR=class e extends Ci{constructor(){super(...arguments),this.validate=this.implement}_parse(r){let{ctx:n}=this._processInputParams(r);if(n.parsedType!==Nr.function)return kr(n,{code:dr.invalid_type,expected:Nr.function,received:n.parsedType}),ai;function l(v,_){return ER({data:v,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xR(),g3].filter(y=>!!y),issueData:{code:dr.invalid_arguments,argumentsError:_}})}function i(v,_){return ER({data:v,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xR(),g3].filter(y=>!!y),issueData:{code:dr.invalid_return_type,returnTypeError:_}})}let d={errorMap:n.common.contextualErrorMap},p=n.data;if(this._def.returns instanceof cv){let v=this;return Zf(async function(..._){let y=new lu([]),w=await v._def.args.parseAsync(_,d).catch(x=>{throw y.addIssue(l(_,x)),y}),S=await Reflect.apply(p,this,w);return await v._def.returns._def.type.parseAsync(S,d).catch(x=>{throw y.addIssue(i(S,x)),y})})}else{let v=this;return Zf(function(..._){let y=v._def.args.safeParse(_,d);if(!y.success)throw new lu([l(_,y.error)]);let w=Reflect.apply(p,this,y.data),S=v._def.returns.safeParse(w,d);if(!S.success)throw new lu([i(w,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...r){return new e({...this._def,args:Id.create(r).rest(tp.create())})}returns(r){return new e({...this._def,returns:r})}implement(r){return this.parse(r)}strictImplement(r){return this.parse(r)}static create(r,n,l){return new e({args:r||Id.create([]).rest(tp.create()),returns:n||tp.create(),typeName:ei.ZodFunction,...Ni(l)})}},ub=class extends Ci{get schema(){return this._def.getter()}_parse(r){let{ctx:n}=this._processInputParams(r);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ub.create=(e,r)=>new ub({getter:e,typeName:ei.ZodLazy,...Ni(r)});var lb=class extends Ci{_parse(r){if(r.data!==this._def.value){let n=this._getOrReturnCtx(r);return kr(n,{received:n.data,code:dr.invalid_literal,expected:this._def.value}),ai}return{status:"valid",value:r.data}}get value(){return this._def.value}};lb.create=(e,r)=>new lb({value:e,typeName:ei.ZodLiteral,...Ni(r)});function cTe(e,r){return new cb({values:e,typeName:ei.ZodEnum,...Ni(r)})}var cb=class e extends Ci{constructor(){super(...arguments),z5.set(this,void 0)}_parse(r){if(typeof r.data!="string"){let n=this._getOrReturnCtx(r),l=this._def.values;return kr(n,{expected:Bn.joinValues(l),received:n.parsedType,code:dr.invalid_type}),ai}if(AR(this,z5,"f")||fTe(this,z5,new Set(this._def.values),"f"),!AR(this,z5,"f").has(r.data)){let n=this._getOrReturnCtx(r),l=this._def.values;return kr(n,{received:n.data,code:dr.invalid_enum_value,options:l}),ai}return Zf(r.data)}get options(){return this._def.values}get enum(){let r={};for(let n of this._def.values)r[n]=n;return r}get Values(){let r={};for(let n of this._def.values)r[n]=n;return r}get Enum(){let r={};for(let n of this._def.values)r[n]=n;return r}extract(r,n=this._def){return e.create(r,{...this._def,...n})}exclude(r,n=this._def){return e.create(this.options.filter(l=>!r.includes(l)),{...this._def,...n})}};z5=new WeakMap;cb.create=cTe;var db=class extends Ci{constructor(){super(...arguments),H5.set(this,void 0)}_parse(r){let n=Bn.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(r);if(l.parsedType!==Nr.string&&l.parsedType!==Nr.number){let i=Bn.objectValues(n);return kr(l,{expected:Bn.joinValues(i),received:l.parsedType,code:dr.invalid_type}),ai}if(AR(this,H5,"f")||fTe(this,H5,new Set(Bn.getValidEnumValues(this._def.values)),"f"),!AR(this,H5,"f").has(r.data)){let i=Bn.objectValues(n);return kr(l,{received:l.data,code:dr.invalid_enum_value,options:i}),ai}return Zf(r.data)}get enum(){return this._def.values}};H5=new WeakMap;db.create=(e,r)=>new db({values:e,typeName:ei.ZodNativeEnum,...Ni(r)});var cv=class extends Ci{unwrap(){return this._def.type}_parse(r){let{ctx:n}=this._processInputParams(r);if(n.parsedType!==Nr.promise&&n.common.async===!1)return kr(n,{code:dr.invalid_type,expected:Nr.promise,received:n.parsedType}),ai;let l=n.parsedType===Nr.promise?n.data:Promise.resolve(n.data);return Zf(l.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};cv.create=(e,r)=>new cv({type:e,typeName:ei.ZodPromise,...Ni(r)});var cu=class extends Ci{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ei.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){let{status:n,ctx:l}=this._processInputParams(r),i=this._def.effect||null,d={addIssue:p=>{kr(l,p),p.fatal?n.abort():n.dirty()},get path(){return l.path}};if(d.addIssue=d.addIssue.bind(d),i.type==="preprocess"){let p=i.transform(l.data,d);if(l.common.async)return Promise.resolve(p).then(async v=>{if(n.value==="aborted")return ai;let _=await this._def.schema._parseAsync({data:v,path:l.path,parent:l});return _.status==="aborted"?ai:_.status==="dirty"||n.value==="dirty"?v3(_.value):_});{if(n.value==="aborted")return ai;let v=this._def.schema._parseSync({data:p,path:l.path,parent:l});return v.status==="aborted"?ai:v.status==="dirty"||n.value==="dirty"?v3(v.value):v}}if(i.type==="refinement"){let p=v=>{let _=i.refinement(v,d);if(l.common.async)return Promise.resolve(_);if(_ instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return v};if(l.common.async===!1){let v=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return v.status==="aborted"?ai:(v.status==="dirty"&&n.dirty(),p(v.value),{status:n.value,value:v.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(v=>v.status==="aborted"?ai:(v.status==="dirty"&&n.dirty(),p(v.value).then(()=>({status:n.value,value:v.value}))))}if(i.type==="transform")if(l.common.async===!1){let p=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!tb(p))return p;let v=i.transform(p.value,d);if(v instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:v}}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(p=>tb(p)?Promise.resolve(i.transform(p.value,d)).then(v=>({status:n.value,value:v})):p);Bn.assertNever(i)}};cu.create=(e,r,n)=>new cu({schema:e,typeName:ei.ZodEffects,effect:r,...Ni(n)});cu.createWithPreprocess=(e,r,n)=>new cu({schema:r,effect:{type:"preprocess",transform:e},typeName:ei.ZodEffects,...Ni(n)});var N0=class extends Ci{_parse(r){return this._getType(r)===Nr.undefined?Zf(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};N0.create=(e,r)=>new N0({innerType:e,typeName:ei.ZodOptional,...Ni(r)});var kd=class extends Ci{_parse(r){return this._getType(r)===Nr.null?Zf(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};kd.create=(e,r)=>new kd({innerType:e,typeName:ei.ZodNullable,...Ni(r)});var pb=class extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r),l=n.data;return n.parsedType===Nr.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};pb.create=(e,r)=>new pb({innerType:e,typeName:ei.ZodDefault,defaultValue:typeof r.default=="function"?r.default:()=>r.default,...Ni(r)});var mb=class extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r),l={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return K5(i)?i.then(d=>({status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new lu(l.common.issues)},input:l.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new lu(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}};mb.create=(e,r)=>new mb({innerType:e,typeName:ei.ZodCatch,catchValue:typeof r.catch=="function"?r.catch:()=>r.catch,...Ni(r)});var M3=class extends Ci{_parse(r){if(this._getType(r)!==Nr.nan){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.nan,received:l.parsedType}),ai}return{status:"valid",value:r.data}}};M3.create=e=>new M3({typeName:ei.ZodNaN,...Ni(e)});var a6t=Symbol("zod_brand"),Z5=class extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r),l=n.data;return this._def.type._parse({data:l,path:n.path,parent:n})}unwrap(){return this._def.type}},W5=class e extends Ci{_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.common.async)return(async()=>{let d=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return d.status==="aborted"?ai:d.status==="dirty"?(n.dirty(),v3(d.value)):this._def.out._parseAsync({data:d.value,path:l.path,parent:l})})();{let i=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return i.status==="aborted"?ai:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:l.path,parent:l})}}static create(r,n){return new e({in:r,out:n,typeName:ei.ZodPipeline})}},vb=class extends Ci{_parse(r){let n=this._def.innerType._parse(r),l=i=>(tb(i)&&(i.value=Object.freeze(i.value)),i);return K5(n)?n.then(i=>l(i)):l(n)}unwrap(){return this._def.innerType}};vb.create=(e,r)=>new vb({innerType:e,typeName:ei.ZodReadonly,...Ni(r)});function aTe(e,r){let n=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function dTe(e,r={},n){return e?lv.create().superRefine((l,i)=>{var d,p;let v=e(l);if(v instanceof Promise)return v.then(_=>{var y,w;if(!_){let S=aTe(r,l),M=(w=(y=S.fatal)!==null&&y!==void 0?y:n)!==null&&w!==void 0?w:!0;i.addIssue({code:"custom",...S,fatal:M})}});if(!v){let _=aTe(r,l),y=(p=(d=_.fatal)!==null&&d!==void 0?d:n)!==null&&p!==void 0?p:!0;i.addIssue({code:"custom",..._,fatal:y})}}):lv.create()}var o6t={object:wh.lazycreate},ei;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ei||(ei={}));var s6t=(e,r={message:`Input not instance of ${e.name}`})=>dTe(n=>n instanceof e,r),pTe=uv.create,mTe=rb.create,f6t=M3.create,h6t=ib.create,vTe=nb.create,u6t=ab.create,l6t=b3.create,c6t=ob.create,d6t=sb.create,p6t=lv.create,m6t=tp.create,v6t=ic.create,g6t=y3.create,b6t=rp.create,y6t=wh.create,w6t=wh.strictCreate,_6t=fb.create,M6t=RR.create,S6t=hb.create,x6t=Id.create,E6t=TR.create,A6t=w3.create,R6t=_3.create,T6t=IR.create,I6t=ub.create,k6t=lb.create,B6t=cb.create,P6t=db.create,O6t=cv.create,oTe=cu.create,N6t=N0.create,C6t=kd.create,L6t=cu.createWithPreprocess,D6t=W5.create,$6t=()=>pTe().optional(),q6t=()=>mTe().optional(),U6t=()=>vTe().optional(),j6t={string:e=>uv.create({...e,coerce:!0}),number:e=>rb.create({...e,coerce:!0}),boolean:e=>nb.create({...e,coerce:!0}),bigint:e=>ib.create({...e,coerce:!0}),date:e=>ab.create({...e,coerce:!0})},F6t=ai,Dr=Object.freeze({__proto__:null,defaultErrorMap:g3,setErrorMap:Lbt,getErrorMap:xR,makeIssue:ER,EMPTY_PATH:Dbt,addIssueToContext:kr,ParseStatus:Pf,INVALID:ai,DIRTY:v3,OK:Zf,isAborted:EY,isDirty:AY,isValid:tb,isAsync:K5,get util(){return Bn},get objectUtil(){return xY},ZodParsedType:Nr,getParsedType:ep,ZodType:Ci,datetimeRegex:lTe,ZodString:uv,ZodNumber:rb,ZodBigInt:ib,ZodBoolean:nb,ZodDate:ab,ZodSymbol:b3,ZodUndefined:ob,ZodNull:sb,ZodAny:lv,ZodUnknown:tp,ZodNever:ic,ZodVoid:y3,ZodArray:rp,ZodObject:wh,ZodUnion:fb,ZodDiscriminatedUnion:RR,ZodIntersection:hb,ZodTuple:Id,ZodRecord:TR,ZodMap:w3,ZodSet:_3,ZodFunction:IR,ZodLazy:ub,ZodLiteral:lb,ZodEnum:cb,ZodNativeEnum:db,ZodPromise:cv,ZodEffects:cu,ZodTransformer:cu,ZodOptional:N0,ZodNullable:kd,ZodDefault:pb,ZodCatch:mb,ZodNaN:M3,BRAND:a6t,ZodBranded:Z5,ZodPipeline:W5,ZodReadonly:vb,custom:dTe,Schema:Ci,ZodSchema:Ci,late:o6t,get ZodFirstPartyTypeKind(){return ei},coerce:j6t,any:p6t,array:b6t,bigint:h6t,boolean:vTe,date:u6t,discriminatedUnion:M6t,effect:oTe,enum:B6t,function:T6t,instanceof:s6t,intersection:S6t,lazy:I6t,literal:k6t,map:A6t,nan:f6t,nativeEnum:P6t,never:v6t,null:d6t,nullable:C6t,number:mTe,object:y6t,oboolean:U6t,onumber:q6t,optional:N6t,ostring:$6t,pipeline:D6t,preprocess:L6t,promise:O6t,record:E6t,set:R6t,strictObject:w6t,string:pTe,symbol:l6t,transformer:oTe,tuple:x6t,undefined:c6t,union:_6t,unknown:m6t,void:g6t,NEVER:F6t,ZodIssueCode:dr,quotelessJson:Cbt,ZodError:lu});we();Me();_e();var kR=new RegExp("^[a-zA-Z0-9_-]{43}$"),p0r=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),m0r=new RegExp("^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$"),v0r=We.env.ARNS_REGISTRY_TX??"bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U",g0r="_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8",z6t="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",b0r=z6t,TY="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",_h="qNvAoz0TgcH7DMg8BCVn8jF32QH5L6T29VjHxhHqqGE",S3="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",IY=1e6,gTe="pb4fCvdJqwT-_bn38ERMdqnOF4weRMjoJ6bY6yfl4a8",bTe="OO2ewZKq4AHoqGQmYUIl-NhJ-llQyFJ3ha4Uf4-w5RI",yTe="fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",wTe="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var G5=Dr.string({description:"Arweave Transaction ID"}).refine(e=>kR.test(e),{message:"Must be an Arweave Transaction ID"}),BR=Dr.string({description:"AO Address"}),_Te=Dr.string({description:"Integer String"}).refine(e=>{let r=parseInt(e);return Number.isInteger(r)&&r>=0},{message:"Must be a non negative integer string"}),H6t=Dr.string(),kY=Dr.array(Dr.string()),PR=Dr.object({transactionId:G5.describe("The Target ID of the undername"),ttlSeconds:Dr.number(),priority:Dr.number().optional()}),OR=Dr.record(Dr.string(),PR),NR=Dr.array(BR.describe("Controller address")),CR=Dr.record(BR.describe("Holder address"),Dr.number()),BY=Dr.object({Name:Dr.string().describe("The name of the ANT."),Ticker:Dr.string().describe("The ticker symbol for the ANT."),Description:Dr.string().describe("The description for the ANT."),Keywords:kY.describe("The keywords for the ANT."),Denomination:Dr.number().describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.").min(0,{message:"Denomination must be a non-negative number"}),Owner:BR.describe("The Owners address."),Controllers:NR.describe("Controllers of the ANT who have administrative privileges."),Records:OR.describe("Records associated with the ANT."),Balances:CR.describe("Balance details for each address holding the ANT."),Logo:G5.describe("Transaction ID of the ANT logo."),TotalSupply:Dr.number().describe("Total supply of the ANT in circulation.").min(0,{message:"Total supply must be a non-negative number"}),Initialized:Dr.boolean().describe("Flag indicating whether the ANT has been initialized.")}),STe=Dr.object({name:Dr.string().describe("The name of the ANT."),ticker:Dr.string().describe("The ticker symbol for the ANT."),description:Dr.string().describe("The description for the ANT."),keywords:kY.describe("The keywords for the ANT."),owner:BR.describe("The Owners address."),controllers:NR.describe("Controllers of the ANT who have administrative privileges."),records:OR.describe("Records associated with the ANT."),balances:CR.describe("Balance details for each address holding the ANT."),logo:G5.describe("Transaction ID of the ANT logo.")}),K6t=["balance","balances","totalSupply","info","controllers","record","records","state"],Z6t=["_eval","_default","transfer","addController","removeController","setRecord","removeRecord","setName","setTicker","setDescription","setKeywords","setLogo","initializeState","releaseName","reassignName","approvePrimaryName","removePrimaryNames"],W6t=[...K6t,...Z6t],MTe=Dr.array(Dr.string({description:"Handler Name"})).refine(e=>W6t.every(r=>e.includes(r)),{message:"ANT is missing required handlers"}),xTe=Dr.object({Name:Dr.string().describe("The name of the ANT."),Owner:G5.describe("The Owners address."),Ticker:Dr.string().describe("The ticker symbol for the ANT."),"Total-Supply":_Te.describe("Total supply of the ANT in circulation."),Description:H6t.describe("The description for the ANT."),Keywords:kY.describe("The keywords for the ANT."),Logo:G5.describe("Transaction ID of the ANT logo."),Denomination:_Te.describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers."),Handlers:MTe.optional().describe("List of handlers for the ANT."),HandlerNames:MTe.optional().describe('Deprecated: List of handlers for the ANT. Use "Handlers" instead.')});function E0r(e){return BY.safeParse(e).success}we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();var G6t=Object.create,fN=Object.defineProperty,V6t=Object.getOwnPropertyDescriptor,Y6t=Object.getOwnPropertyNames,J6t=Object.getPrototypeOf,X6t=Object.prototype.hasOwnProperty,ul=(e,r)=>()=>(e&&(r=e(e=0)),r),Ka=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),hN=(e,r)=>{for(var n in r)fN(e,n,{get:r[n],enumerable:!0})},hCe=(e,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Y6t(r))!X6t.call(e,i)&&i!==n&&fN(e,i,{get:()=>r[i],enumerable:!(l=V6t(r,i))||l.enumerable});return e},uN=(e,r,n)=>(n=e!=null?G6t(J6t(e)):{},hCe(r||!e||!e.__esModule?fN(n,"default",{value:e,enumerable:!0}):n,e)),ETe=e=>hCe(fN({},"__esModule",{value:!0}),e),Q6t=Ka(e=>{"use strict";e.byteLength=_,e.toByteArray=w,e.fromByteArray=x;var r=[],n=[],l=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(d=0,p=i.length;d<p;++d)r[d]=i[d],n[i.charCodeAt(d)]=d;var d,p;n[45]=62,n[95]=63;function v(E){var T=E.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=E.indexOf("=");I===-1&&(I=T);var B=I===T?0:4-I%4;return[I,B]}function _(E){var T=v(E),I=T[0],B=T[1];return(I+B)*3/4-B}function y(E,T,I){return(T+I)*3/4-I}function w(E){var T,I=v(E),B=I[0],O=I[1],N=new l(y(E,B,O)),H=0,K=O>0?B-4:B,J;for(J=0;J<K;J+=4)T=n[E.charCodeAt(J)]<<18|n[E.charCodeAt(J+1)]<<12|n[E.charCodeAt(J+2)]<<6|n[E.charCodeAt(J+3)],N[H++]=T>>16&255,N[H++]=T>>8&255,N[H++]=T&255;return O===2&&(T=n[E.charCodeAt(J)]<<2|n[E.charCodeAt(J+1)]>>4,N[H++]=T&255),O===1&&(T=n[E.charCodeAt(J)]<<10|n[E.charCodeAt(J+1)]<<4|n[E.charCodeAt(J+2)]>>2,N[H++]=T>>8&255,N[H++]=T&255),N}function S(E){return r[E>>18&63]+r[E>>12&63]+r[E>>6&63]+r[E&63]}function M(E,T,I){for(var B,O=[],N=T;N<I;N+=3)B=(E[N]<<16&16711680)+(E[N+1]<<8&65280)+(E[N+2]&255),O.push(S(B));return O.join("")}function x(E){for(var T,I=E.length,B=I%3,O=[],N=16383,H=0,K=I-B;H<K;H+=N)O.push(M(E,H,H+N>K?K:H+N));return B===1?(T=E[I-1],O.push(r[T>>2]+r[T<<4&63]+"==")):B===2&&(T=(E[I-2]<<8)+E[I-1],O.push(r[T>>10]+r[T>>4&63]+r[T<<2&63]+"=")),O.join("")}}),eyt=Ka(e=>{e.read=function(r,n,l,i,d){var p,v,_=d*8-i-1,y=(1<<_)-1,w=y>>1,S=-7,M=l?d-1:0,x=l?-1:1,E=r[n+M];for(M+=x,p=E&(1<<-S)-1,E>>=-S,S+=_;S>0;p=p*256+r[n+M],M+=x,S-=8);for(v=p&(1<<-S)-1,p>>=-S,S+=i;S>0;v=v*256+r[n+M],M+=x,S-=8);if(p===0)p=1-w;else{if(p===y)return v?NaN:(E?-1:1)*(1/0);v=v+Math.pow(2,i),p=p-w}return(E?-1:1)*v*Math.pow(2,p-i)},e.write=function(r,n,l,i,d,p){var v,_,y,w=p*8-d-1,S=(1<<w)-1,M=S>>1,x=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:p-1,T=i?1:-1,I=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(_=isNaN(n)?1:0,v=S):(v=Math.floor(Math.log(n)/Math.LN2),n*(y=Math.pow(2,-v))<1&&(v--,y*=2),v+M>=1?n+=x/y:n+=x*Math.pow(2,1-M),n*y>=2&&(v++,y/=2),v+M>=S?(_=0,v=S):v+M>=1?(_=(n*y-1)*Math.pow(2,d),v=v+M):(_=n*Math.pow(2,M-1)*Math.pow(2,d),v=0));d>=8;r[l+E]=_&255,E+=T,_/=256,d-=8);for(v=v<<d|_,w+=d;w>0;r[l+E]=v&255,E+=T,v/=256,w-=8);r[l+E-T]|=I*128}}),uCe=Ka(e=>{"use strict";var r=Q6t(),n=eyt(),l=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=v,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,v.TYPED_ARRAY_SUPPORT=d(),!v.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function d(){try{let P=new Uint8Array(1),C={foo:function(){return 42}};return Object.setPrototypeOf(C,Uint8Array.prototype),Object.setPrototypeOf(P,C),P.foo()===42}catch{return!1}}Object.defineProperty(v.prototype,"parent",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.buffer}}),Object.defineProperty(v.prototype,"offset",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.byteOffset}});function p(P){if(P>i)throw new RangeError('The value "'+P+'" is invalid for option "size"');let C=new Uint8Array(P);return Object.setPrototypeOf(C,v.prototype),C}function v(P,C,U){if(typeof P=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(P)}return _(P,C,U)}v.poolSize=8192;function _(P,C,U){if(typeof P=="string")return M(P,C);if(ArrayBuffer.isView(P))return E(P);if(P==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P);if(Be(P,ArrayBuffer)||P&&Be(P.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Be(P,SharedArrayBuffer)||P&&Be(P.buffer,SharedArrayBuffer)))return T(P,C,U);if(typeof P=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let ee=P.valueOf&&P.valueOf();if(ee!=null&&ee!==P)return v.from(ee,C,U);let Q=I(P);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof P[Symbol.toPrimitive]=="function")return v.from(P[Symbol.toPrimitive]("string"),C,U);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P)}v.from=function(P,C,U){return _(P,C,U)},Object.setPrototypeOf(v.prototype,Uint8Array.prototype),Object.setPrototypeOf(v,Uint8Array);function y(P){if(typeof P!="number")throw new TypeError('"size" argument must be of type number');if(P<0)throw new RangeError('The value "'+P+'" is invalid for option "size"')}function w(P,C,U){return y(P),P<=0?p(P):C!==void 0?typeof U=="string"?p(P).fill(C,U):p(P).fill(C):p(P)}v.alloc=function(P,C,U){return w(P,C,U)};function S(P){return y(P),p(P<0?0:B(P)|0)}v.allocUnsafe=function(P){return S(P)},v.allocUnsafeSlow=function(P){return S(P)};function M(P,C){if((typeof C!="string"||C==="")&&(C="utf8"),!v.isEncoding(C))throw new TypeError("Unknown encoding: "+C);let U=N(P,C)|0,ee=p(U),Q=ee.write(P,C);return Q!==U&&(ee=ee.slice(0,Q)),ee}function x(P){let C=P.length<0?0:B(P.length)|0,U=p(C);for(let ee=0;ee<C;ee+=1)U[ee]=P[ee]&255;return U}function E(P){if(Be(P,Uint8Array)){let C=new Uint8Array(P);return T(C.buffer,C.byteOffset,C.byteLength)}return x(P)}function T(P,C,U){if(C<0||P.byteLength<C)throw new RangeError('"offset" is outside of buffer bounds');if(P.byteLength<C+(U||0))throw new RangeError('"length" is outside of buffer bounds');let ee;return C===void 0&&U===void 0?ee=new Uint8Array(P):U===void 0?ee=new Uint8Array(P,C):ee=new Uint8Array(P,C,U),Object.setPrototypeOf(ee,v.prototype),ee}function I(P){if(v.isBuffer(P)){let C=B(P.length)|0,U=p(C);return U.length===0||P.copy(U,0,0,C),U}if(P.length!==void 0)return typeof P.length!="number"||be(P.length)?p(0):x(P);if(P.type==="Buffer"&&Array.isArray(P.data))return x(P.data)}function B(P){if(P>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return P|0}function O(P){return+P!=P&&(P=0),v.alloc(+P)}v.isBuffer=function(P){return P!=null&&P._isBuffer===!0&&P!==v.prototype},v.compare=function(P,C){if(Be(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),Be(C,Uint8Array)&&(C=v.from(C,C.offset,C.byteLength)),!v.isBuffer(P)||!v.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(P===C)return 0;let U=P.length,ee=C.length;for(let Q=0,te=Math.min(U,ee);Q<te;++Q)if(P[Q]!==C[Q]){U=P[Q],ee=C[Q];break}return U<ee?-1:ee<U?1:0},v.isEncoding=function(P){switch(String(P).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}},v.concat=function(P,C){if(!Array.isArray(P))throw new TypeError('"list" argument must be an Array of Buffers');if(P.length===0)return v.alloc(0);let U;if(C===void 0)for(C=0,U=0;U<P.length;++U)C+=P[U].length;let ee=v.allocUnsafe(C),Q=0;for(U=0;U<P.length;++U){let te=P[U];if(Be(te,Uint8Array))Q+te.length>ee.length?(v.isBuffer(te)||(te=v.from(te)),te.copy(ee,Q)):Uint8Array.prototype.set.call(ee,te,Q);else if(v.isBuffer(te))te.copy(ee,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=te.length}return ee};function N(P,C){if(v.isBuffer(P))return P.length;if(ArrayBuffer.isView(P)||Be(P,ArrayBuffer))return P.byteLength;if(typeof P!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof P);let U=P.length,ee=arguments.length>2&&arguments[2]===!0;if(!ee&&U===0)return 0;let Q=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return U;case"utf8":case"utf-8":return re(P).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U*2;case"hex":return U>>>1;case"base64":return he(P).length;default:if(Q)return ee?-1:re(P).length;C=(""+C).toLowerCase(),Q=!0}}v.byteLength=N;function H(P,C,U){let ee=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((U===void 0||U>this.length)&&(U=this.length),U<=0)||(U>>>=0,C>>>=0,U<=C))return"";for(P||(P="utf8");;)switch(P){case"hex":return o(this,C,U);case"utf8":case"utf-8":return u(this,C,U);case"ascii":return m(this,C,U);case"latin1":case"binary":return f(this,C,U);case"base64":return s(this,C,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,C,U);default:if(ee)throw new TypeError("Unknown encoding: "+P);P=(P+"").toLowerCase(),ee=!0}}v.prototype._isBuffer=!0;function K(P,C,U){let ee=P[C];P[C]=P[U],P[U]=ee}v.prototype.swap16=function(){let P=this.length;if(P%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<P;C+=2)K(this,C,C+1);return this},v.prototype.swap32=function(){let P=this.length;if(P%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<P;C+=4)K(this,C,C+3),K(this,C+1,C+2);return this},v.prototype.swap64=function(){let P=this.length;if(P%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<P;C+=8)K(this,C,C+7),K(this,C+1,C+6),K(this,C+2,C+5),K(this,C+3,C+4);return this},v.prototype.toString=function(){let P=this.length;return P===0?"":arguments.length===0?u(this,0,P):H.apply(this,arguments)},v.prototype.toLocaleString=v.prototype.toString,v.prototype.equals=function(P){if(!v.isBuffer(P))throw new TypeError("Argument must be a Buffer");return this===P?!0:v.compare(this,P)===0},v.prototype.inspect=function(){let P="",C=e.INSPECT_MAX_BYTES;return P=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(P+=" ... "),"<Buffer "+P+">"},l&&(v.prototype[l]=v.prototype.inspect),v.prototype.compare=function(P,C,U,ee,Q){if(Be(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),!v.isBuffer(P))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof P);if(C===void 0&&(C=0),U===void 0&&(U=P?P.length:0),ee===void 0&&(ee=0),Q===void 0&&(Q=this.length),C<0||U>P.length||ee<0||Q>this.length)throw new RangeError("out of range index");if(ee>=Q&&C>=U)return 0;if(ee>=Q)return-1;if(C>=U)return 1;if(C>>>=0,U>>>=0,ee>>>=0,Q>>>=0,this===P)return 0;let te=Q-ee,le=U-C,Ie=Math.min(te,le),se=this.slice(ee,Q),Ee=P.slice(C,U);for(let me=0;me<Ie;++me)if(se[me]!==Ee[me]){te=se[me],le=Ee[me];break}return te<le?-1:le<te?1:0};function J(P,C,U,ee,Q){if(P.length===0)return-1;if(typeof U=="string"?(ee=U,U=0):U>2147483647?U=2147483647:U<-2147483648&&(U=-2147483648),U=+U,be(U)&&(U=Q?0:P.length-1),U<0&&(U=P.length+U),U>=P.length){if(Q)return-1;U=P.length-1}else if(U<0)if(Q)U=0;else return-1;if(typeof C=="string"&&(C=v.from(C,ee)),v.isBuffer(C))return C.length===0?-1:L(P,C,U,ee,Q);if(typeof C=="number")return C=C&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(P,C,U):Uint8Array.prototype.lastIndexOf.call(P,C,U):L(P,[C],U,ee,Q);throw new TypeError("val must be string, number or Buffer")}function L(P,C,U,ee,Q){let te=1,le=P.length,Ie=C.length;if(ee!==void 0&&(ee=String(ee).toLowerCase(),ee==="ucs2"||ee==="ucs-2"||ee==="utf16le"||ee==="utf-16le")){if(P.length<2||C.length<2)return-1;te=2,le/=2,Ie/=2,U/=2}function se(me,pe){return te===1?me[pe]:me.readUInt16BE(pe*te)}let Ee;if(Q){let me=-1;for(Ee=U;Ee<le;Ee++)if(se(P,Ee)===se(C,me===-1?0:Ee-me)){if(me===-1&&(me=Ee),Ee-me+1===Ie)return me*te}else me!==-1&&(Ee-=Ee-me),me=-1}else for(U+Ie>le&&(U=le-Ie),Ee=U;Ee>=0;Ee--){let me=!0;for(let pe=0;pe<Ie;pe++)if(se(P,Ee+pe)!==se(C,pe)){me=!1;break}if(me)return Ee}return-1}v.prototype.includes=function(P,C,U){return this.indexOf(P,C,U)!==-1},v.prototype.indexOf=function(P,C,U){return J(this,P,C,U,!0)},v.prototype.lastIndexOf=function(P,C,U){return J(this,P,C,U,!1)};function $(P,C,U,ee){U=Number(U)||0;let Q=P.length-U;ee?(ee=Number(ee),ee>Q&&(ee=Q)):ee=Q;let te=C.length;ee>te/2&&(ee=te/2);let le;for(le=0;le<ee;++le){let Ie=parseInt(C.substr(le*2,2),16);if(be(Ie))return le;P[U+le]=Ie}return le}function V(P,C,U,ee){return Re(re(C,P.length-U),P,U,ee)}function h(P,C,U,ee){return Re(fe(C),P,U,ee)}function t(P,C,U,ee){return Re(he(C),P,U,ee)}function a(P,C,U,ee){return Re(ye(C,P.length-U),P,U,ee)}v.prototype.write=function(P,C,U,ee){if(C===void 0)ee="utf8",U=this.length,C=0;else if(U===void 0&&typeof C=="string")ee=C,U=this.length,C=0;else if(isFinite(C))C=C>>>0,isFinite(U)?(U=U>>>0,ee===void 0&&(ee="utf8")):(ee=U,U=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-C;if((U===void 0||U>Q)&&(U=Q),P.length>0&&(U<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");ee||(ee="utf8");let te=!1;for(;;)switch(ee){case"hex":return $(this,P,C,U);case"utf8":case"utf-8":return V(this,P,C,U);case"ascii":case"latin1":case"binary":return h(this,P,C,U);case"base64":return t(this,P,C,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,P,C,U);default:if(te)throw new TypeError("Unknown encoding: "+ee);ee=(""+ee).toLowerCase(),te=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s(P,C,U){return C===0&&U===P.length?r.fromByteArray(P):r.fromByteArray(P.slice(C,U))}function u(P,C,U){U=Math.min(P.length,U);let ee=[],Q=C;for(;Q<U;){let te=P[Q],le=null,Ie=te>239?4:te>223?3:te>191?2:1;if(Q+Ie<=U){let se,Ee,me,pe;switch(Ie){case 1:te<128&&(le=te);break;case 2:se=P[Q+1],(se&192)===128&&(pe=(te&31)<<6|se&63,pe>127&&(le=pe));break;case 3:se=P[Q+1],Ee=P[Q+2],(se&192)===128&&(Ee&192)===128&&(pe=(te&15)<<12|(se&63)<<6|Ee&63,pe>2047&&(pe<55296||pe>57343)&&(le=pe));break;case 4:se=P[Q+1],Ee=P[Q+2],me=P[Q+3],(se&192)===128&&(Ee&192)===128&&(me&192)===128&&(pe=(te&15)<<18|(se&63)<<12|(Ee&63)<<6|me&63,pe>65535&&pe<1114112&&(le=pe))}}le===null?(le=65533,Ie=1):le>65535&&(le-=65536,ee.push(le>>>10&1023|55296),le=56320|le&1023),ee.push(le),Q+=Ie}return b(ee)}var c=4096;function b(P){let C=P.length;if(C<=c)return String.fromCharCode.apply(String,P);let U="",ee=0;for(;ee<C;)U+=String.fromCharCode.apply(String,P.slice(ee,ee+=c));return U}function m(P,C,U){let ee="";U=Math.min(P.length,U);for(let Q=C;Q<U;++Q)ee+=String.fromCharCode(P[Q]&127);return ee}function f(P,C,U){let ee="";U=Math.min(P.length,U);for(let Q=C;Q<U;++Q)ee+=String.fromCharCode(P[Q]);return ee}function o(P,C,U){let ee=P.length;(!C||C<0)&&(C=0),(!U||U<0||U>ee)&&(U=ee);let Q="";for(let te=C;te<U;++te)Q+=Ne[P[te]];return Q}function g(P,C,U){let ee=P.slice(C,U),Q="";for(let te=0;te<ee.length-1;te+=2)Q+=String.fromCharCode(ee[te]+ee[te+1]*256);return Q}v.prototype.slice=function(P,C){let U=this.length;P=~~P,C=C===void 0?U:~~C,P<0?(P+=U,P<0&&(P=0)):P>U&&(P=U),C<0?(C+=U,C<0&&(C=0)):C>U&&(C=U),C<P&&(C=P);let ee=this.subarray(P,C);return Object.setPrototypeOf(ee,v.prototype),ee};function A(P,C,U){if(P%1!==0||P<0)throw new RangeError("offset is not uint");if(P+C>U)throw new RangeError("Trying to access beyond buffer length")}v.prototype.readUintLE=v.prototype.readUIntLE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P],Q=1,te=0;for(;++te<C&&(Q*=256);)ee+=this[P+te]*Q;return ee},v.prototype.readUintBE=v.prototype.readUIntBE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P+--C],Q=1;for(;C>0&&(Q*=256);)ee+=this[P+--C]*Q;return ee},v.prototype.readUint8=v.prototype.readUInt8=function(P,C){return P=P>>>0,C||A(P,1,this.length),this[P]},v.prototype.readUint16LE=v.prototype.readUInt16LE=function(P,C){return P=P>>>0,C||A(P,2,this.length),this[P]|this[P+1]<<8},v.prototype.readUint16BE=v.prototype.readUInt16BE=function(P,C){return P=P>>>0,C||A(P,2,this.length),this[P]<<8|this[P+1]},v.prototype.readUint32LE=v.prototype.readUInt32LE=function(P,C){return P=P>>>0,C||A(P,4,this.length),(this[P]|this[P+1]<<8|this[P+2]<<16)+this[P+3]*16777216},v.prototype.readUint32BE=v.prototype.readUInt32BE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]*16777216+(this[P+1]<<16|this[P+2]<<8|this[P+3])},v.prototype.readBigUInt64LE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=C+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24,Q=this[++P]+this[++P]*2**8+this[++P]*2**16+U*2**24;return BigInt(ee)+(BigInt(Q)<<BigInt(32))}),v.prototype.readBigUInt64BE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=C*2**24+this[++P]*2**16+this[++P]*2**8+this[++P],Q=this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+U;return(BigInt(ee)<<BigInt(32))+BigInt(Q)}),v.prototype.readIntLE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P],Q=1,te=0;for(;++te<C&&(Q*=256);)ee+=this[P+te]*Q;return Q*=128,ee>=Q&&(ee-=Math.pow(2,8*C)),ee},v.prototype.readIntBE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=C,Q=1,te=this[P+--ee];for(;ee>0&&(Q*=256);)te+=this[P+--ee]*Q;return Q*=128,te>=Q&&(te-=Math.pow(2,8*C)),te},v.prototype.readInt8=function(P,C){return P=P>>>0,C||A(P,1,this.length),this[P]&128?(255-this[P]+1)*-1:this[P]},v.prototype.readInt16LE=function(P,C){P=P>>>0,C||A(P,2,this.length);let U=this[P]|this[P+1]<<8;return U&32768?U|4294901760:U},v.prototype.readInt16BE=function(P,C){P=P>>>0,C||A(P,2,this.length);let U=this[P+1]|this[P]<<8;return U&32768?U|4294901760:U},v.prototype.readInt32LE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]|this[P+1]<<8|this[P+2]<<16|this[P+3]<<24},v.prototype.readInt32BE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]<<24|this[P+1]<<16|this[P+2]<<8|this[P+3]},v.prototype.readBigInt64LE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=this[P+4]+this[P+5]*2**8+this[P+6]*2**16+(U<<24);return(BigInt(ee)<<BigInt(32))+BigInt(C+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24)}),v.prototype.readBigInt64BE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=(C<<24)+this[++P]*2**16+this[++P]*2**8+this[++P];return(BigInt(ee)<<BigInt(32))+BigInt(this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+U)}),v.prototype.readFloatLE=function(P,C){return P=P>>>0,C||A(P,4,this.length),n.read(this,P,!0,23,4)},v.prototype.readFloatBE=function(P,C){return P=P>>>0,C||A(P,4,this.length),n.read(this,P,!1,23,4)},v.prototype.readDoubleLE=function(P,C){return P=P>>>0,C||A(P,8,this.length),n.read(this,P,!0,52,8)},v.prototype.readDoubleBE=function(P,C){return P=P>>>0,C||A(P,8,this.length),n.read(this,P,!1,52,8)};function R(P,C,U,ee,Q,te){if(!v.isBuffer(P))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>Q||C<te)throw new RangeError('"value" argument is out of bounds');if(U+ee>P.length)throw new RangeError("Index out of range")}v.prototype.writeUintLE=v.prototype.writeUIntLE=function(P,C,U,ee){if(P=+P,C=C>>>0,U=U>>>0,!ee){let le=Math.pow(2,8*U)-1;R(this,P,C,U,le,0)}let Q=1,te=0;for(this[C]=P&255;++te<U&&(Q*=256);)this[C+te]=P/Q&255;return C+U},v.prototype.writeUintBE=v.prototype.writeUIntBE=function(P,C,U,ee){if(P=+P,C=C>>>0,U=U>>>0,!ee){let le=Math.pow(2,8*U)-1;R(this,P,C,U,le,0)}let Q=U-1,te=1;for(this[C+Q]=P&255;--Q>=0&&(te*=256);)this[C+Q]=P/te&255;return C+U},v.prototype.writeUint8=v.prototype.writeUInt8=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,1,255,0),this[C]=P&255,C+1},v.prototype.writeUint16LE=v.prototype.writeUInt16LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,65535,0),this[C]=P&255,this[C+1]=P>>>8,C+2},v.prototype.writeUint16BE=v.prototype.writeUInt16BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,65535,0),this[C]=P>>>8,this[C+1]=P&255,C+2},v.prototype.writeUint32LE=v.prototype.writeUInt32LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,4294967295,0),this[C+3]=P>>>24,this[C+2]=P>>>16,this[C+1]=P>>>8,this[C]=P&255,C+4},v.prototype.writeUint32BE=v.prototype.writeUInt32BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,4294967295,0),this[C]=P>>>24,this[C+1]=P>>>16,this[C+2]=P>>>8,this[C+3]=P&255,C+4};function k(P,C,U,ee,Q){z(C,ee,Q,P,U,7);let te=Number(C&BigInt(4294967295));P[U++]=te,te=te>>8,P[U++]=te,te=te>>8,P[U++]=te,te=te>>8,P[U++]=te;let le=Number(C>>BigInt(32)&BigInt(4294967295));return P[U++]=le,le=le>>8,P[U++]=le,le=le>>8,P[U++]=le,le=le>>8,P[U++]=le,U}function q(P,C,U,ee,Q){z(C,ee,Q,P,U,7);let te=Number(C&BigInt(4294967295));P[U+7]=te,te=te>>8,P[U+6]=te,te=te>>8,P[U+5]=te,te=te>>8,P[U+4]=te;let le=Number(C>>BigInt(32)&BigInt(4294967295));return P[U+3]=le,le=le>>8,P[U+2]=le,le=le>>8,P[U+1]=le,le=le>>8,P[U]=le,U+8}v.prototype.writeBigUInt64LE=qe(function(P,C=0){return k(this,P,C,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeBigUInt64BE=qe(function(P,C=0){return q(this,P,C,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeIntLE=function(P,C,U,ee){if(P=+P,C=C>>>0,!ee){let Ie=Math.pow(2,8*U-1);R(this,P,C,U,Ie-1,-Ie)}let Q=0,te=1,le=0;for(this[C]=P&255;++Q<U&&(te*=256);)P<0&&le===0&&this[C+Q-1]!==0&&(le=1),this[C+Q]=(P/te>>0)-le&255;return C+U},v.prototype.writeIntBE=function(P,C,U,ee){if(P=+P,C=C>>>0,!ee){let Ie=Math.pow(2,8*U-1);R(this,P,C,U,Ie-1,-Ie)}let Q=U-1,te=1,le=0;for(this[C+Q]=P&255;--Q>=0&&(te*=256);)P<0&&le===0&&this[C+Q+1]!==0&&(le=1),this[C+Q]=(P/te>>0)-le&255;return C+U},v.prototype.writeInt8=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,1,127,-128),P<0&&(P=255+P+1),this[C]=P&255,C+1},v.prototype.writeInt16LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,32767,-32768),this[C]=P&255,this[C+1]=P>>>8,C+2},v.prototype.writeInt16BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,32767,-32768),this[C]=P>>>8,this[C+1]=P&255,C+2},v.prototype.writeInt32LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,2147483647,-2147483648),this[C]=P&255,this[C+1]=P>>>8,this[C+2]=P>>>16,this[C+3]=P>>>24,C+4},v.prototype.writeInt32BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,2147483647,-2147483648),P<0&&(P=4294967295+P+1),this[C]=P>>>24,this[C+1]=P>>>16,this[C+2]=P>>>8,this[C+3]=P&255,C+4},v.prototype.writeBigInt64LE=qe(function(P,C=0){return k(this,P,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),v.prototype.writeBigInt64BE=qe(function(P,C=0){return q(this,P,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Z(P,C,U,ee,Q,te){if(U+ee>P.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("Index out of range")}function ne(P,C,U,ee,Q){return C=+C,U=U>>>0,Q||Z(P,C,U,4,34028234663852886e22,-34028234663852886e22),n.write(P,C,U,ee,23,4),U+4}v.prototype.writeFloatLE=function(P,C,U){return ne(this,P,C,!0,U)},v.prototype.writeFloatBE=function(P,C,U){return ne(this,P,C,!1,U)};function G(P,C,U,ee,Q){return C=+C,U=U>>>0,Q||Z(P,C,U,8,17976931348623157e292,-17976931348623157e292),n.write(P,C,U,ee,52,8),U+8}v.prototype.writeDoubleLE=function(P,C,U){return G(this,P,C,!0,U)},v.prototype.writeDoubleBE=function(P,C,U){return G(this,P,C,!1,U)},v.prototype.copy=function(P,C,U,ee){if(!v.isBuffer(P))throw new TypeError("argument should be a Buffer");if(U||(U=0),!ee&&ee!==0&&(ee=this.length),C>=P.length&&(C=P.length),C||(C=0),ee>0&&ee<U&&(ee=U),ee===U||P.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(U<0||U>=this.length)throw new RangeError("Index out of range");if(ee<0)throw new RangeError("sourceEnd out of bounds");ee>this.length&&(ee=this.length),P.length-C<ee-U&&(ee=P.length-C+U);let Q=ee-U;return this===P&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(C,U,ee):Uint8Array.prototype.set.call(P,this.subarray(U,ee),C),Q},v.prototype.fill=function(P,C,U,ee){if(typeof P=="string"){if(typeof C=="string"?(ee=C,C=0,U=this.length):typeof U=="string"&&(ee=U,U=this.length),ee!==void 0&&typeof ee!="string")throw new TypeError("encoding must be a string");if(typeof ee=="string"&&!v.isEncoding(ee))throw new TypeError("Unknown encoding: "+ee);if(P.length===1){let te=P.charCodeAt(0);(ee==="utf8"&&te<128||ee==="latin1")&&(P=te)}}else typeof P=="number"?P=P&255:typeof P=="boolean"&&(P=Number(P));if(C<0||this.length<C||this.length<U)throw new RangeError("Out of range index");if(U<=C)return this;C=C>>>0,U=U===void 0?this.length:U>>>0,P||(P=0);let Q;if(typeof P=="number")for(Q=C;Q<U;++Q)this[Q]=P;else{let te=v.isBuffer(P)?P:v.from(P,ee),le=te.length;if(le===0)throw new TypeError('The value "'+P+'" is invalid for argument "value"');for(Q=0;Q<U-C;++Q)this[Q+C]=te[Q%le]}return this};var D={};function W(P,C,U){D[P]=class extends U{constructor(){super(),Object.defineProperty(this,"message",{value:C.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${P}]`,this.stack,delete this.name}get code(){return P}set code(ee){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ee,writable:!0})}toString(){return`${this.name} [${P}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function(P){return P?`${P} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(P,C){return`The "${P}" argument must be of type number. Received type ${typeof C}`},TypeError),W("ERR_OUT_OF_RANGE",function(P,C,U){let ee=`The value of "${P}" is out of range.`,Q=U;return Number.isInteger(U)&&Math.abs(U)>2**32?Q=ie(String(U)):typeof U=="bigint"&&(Q=String(U),(U>BigInt(2)**BigInt(32)||U<-(BigInt(2)**BigInt(32)))&&(Q=ie(Q)),Q+="n"),ee+=` It must be ${C}. Received ${Q}`,ee},RangeError);function ie(P){let C="",U=P.length,ee=P[0]==="-"?1:0;for(;U>=ee+4;U-=3)C=`_${P.slice(U-3,U)}${C}`;return`${P.slice(0,U)}${C}`}function X(P,C,U){F(C,"offset"),(P[C]===void 0||P[C+U]===void 0)&&Y(C,P.length-(U+1))}function z(P,C,U,ee,Q,te){if(P>U||P<C){let le=typeof C=="bigint"?"n":"",Ie;throw te>3?C===0||C===BigInt(0)?Ie=`>= 0${le} and < 2${le} ** ${(te+1)*8}${le}`:Ie=`>= -(2${le} ** ${(te+1)*8-1}${le}) and < 2 ** ${(te+1)*8-1}${le}`:Ie=`>= ${C}${le} and <= ${U}${le}`,new D.ERR_OUT_OF_RANGE("value",Ie,P)}X(ee,Q,te)}function F(P,C){if(typeof P!="number")throw new D.ERR_INVALID_ARG_TYPE(C,"number",P)}function Y(P,C,U){throw Math.floor(P)!==P?(F(P,U),new D.ERR_OUT_OF_RANGE(U||"offset","an integer",P)):C<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE(U||"offset",`>= ${U?1:0} and <= ${C}`,P)}var ae=/[^+/0-9A-Za-z-_]/g;function de(P){if(P=P.split("=")[0],P=P.trim().replace(ae,""),P.length<2)return"";for(;P.length%4!==0;)P=P+"=";return P}function re(P,C){C=C||1/0;let U,ee=P.length,Q=null,te=[];for(let le=0;le<ee;++le){if(U=P.charCodeAt(le),U>55295&&U<57344){if(!Q){if(U>56319){(C-=3)>-1&&te.push(239,191,189);continue}else if(le+1===ee){(C-=3)>-1&&te.push(239,191,189);continue}Q=U;continue}if(U<56320){(C-=3)>-1&&te.push(239,191,189),Q=U;continue}U=(Q-55296<<10|U-56320)+65536}else Q&&(C-=3)>-1&&te.push(239,191,189);if(Q=null,U<128){if((C-=1)<0)break;te.push(U)}else if(U<2048){if((C-=2)<0)break;te.push(U>>6|192,U&63|128)}else if(U<65536){if((C-=3)<0)break;te.push(U>>12|224,U>>6&63|128,U&63|128)}else if(U<1114112){if((C-=4)<0)break;te.push(U>>18|240,U>>12&63|128,U>>6&63|128,U&63|128)}else throw new Error("Invalid code point")}return te}function fe(P){let C=[];for(let U=0;U<P.length;++U)C.push(P.charCodeAt(U)&255);return C}function ye(P,C){let U,ee,Q,te=[];for(let le=0;le<P.length&&!((C-=2)<0);++le)U=P.charCodeAt(le),ee=U>>8,Q=U%256,te.push(Q),te.push(ee);return te}function he(P){return r.toByteArray(de(P))}function Re(P,C,U,ee){let Q;for(Q=0;Q<ee&&!(Q+U>=C.length||Q>=P.length);++Q)C[Q+U]=P[Q];return Q}function Be(P,C){return P instanceof C||P!=null&&P.constructor!=null&&P.constructor.name!=null&&P.constructor.name===C.name}function be(P){return P!==P}var Ne=function(){let P="0123456789abcdef",C=new Array(256);for(let U=0;U<16;++U){let ee=U*16;for(let Q=0;Q<16;++Q)C[ee+Q]=P[U]+P[Q]}return C}();function qe(P){return typeof BigInt>"u"?j:P}function j(){throw new Error("BigInt not supported")}}),tyt=Ka((e,r)=>{var n=1e3,l=n*60,i=l*60,d=i*24,p=d*7,v=d*365.25;r.exports=function(M,x){x=x||{};var E=typeof M;if(E==="string"&&M.length>0)return _(M);if(E==="number"&&isFinite(M))return x.long?w(M):y(M);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(M))};function _(M){if(M=String(M),!(M.length>100)){var x=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(M);if(x){var E=parseFloat(x[1]),T=(x[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return E*v;case"weeks":case"week":case"w":return E*p;case"days":case"day":case"d":return E*d;case"hours":case"hour":case"hrs":case"hr":case"h":return E*i;case"minutes":case"minute":case"mins":case"min":case"m":return E*l;case"seconds":case"second":case"secs":case"sec":case"s":return E*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return E;default:return}}}}function y(M){var x=Math.abs(M);return x>=d?Math.round(M/d)+"d":x>=i?Math.round(M/i)+"h":x>=l?Math.round(M/l)+"m":x>=n?Math.round(M/n)+"s":M+"ms"}function w(M){var x=Math.abs(M);return x>=d?S(M,x,d,"day"):x>=i?S(M,x,i,"hour"):x>=l?S(M,x,l,"minute"):x>=n?S(M,x,n,"second"):M+" ms"}function S(M,x,E,T){var I=x>=E*1.5;return Math.round(M/E)+" "+T+(I?"s":"")}}),ryt=Ka((e,r)=>{function n(l){d.debug=d,d.default=d,d.coerce=S,d.disable=y,d.enable=v,d.enabled=w,d.humanize=tyt(),d.destroy=M,Object.keys(l).forEach(x=>{d[x]=l[x]}),d.names=[],d.skips=[],d.formatters={};function i(x){let E=0;for(let T=0;T<x.length;T++)E=(E<<5)-E+x.charCodeAt(T),E|=0;return d.colors[Math.abs(E)%d.colors.length]}d.selectColor=i;function d(x){let E,T=null,I,B;function O(...N){if(!O.enabled)return;let H=O,K=Number(new Date),J=K-(E||K);H.diff=J,H.prev=E,H.curr=K,E=K,N[0]=d.coerce(N[0]),typeof N[0]!="string"&&N.unshift("%O");let L=0;N[0]=N[0].replace(/%([a-zA-Z%])/g,($,V)=>{if($==="%%")return"%";L++;let h=d.formatters[V];if(typeof h=="function"){let t=N[L];$=h.call(H,t),N.splice(L,1),L--}return $}),d.formatArgs.call(H,N),(H.log||d.log).apply(H,N)}return O.namespace=x,O.useColors=d.useColors(),O.color=d.selectColor(x),O.extend=p,O.destroy=d.destroy,Object.defineProperty(O,"enabled",{enumerable:!0,configurable:!1,get:()=>T!==null?T:(I!==d.namespaces&&(I=d.namespaces,B=d.enabled(x)),B),set:N=>{T=N}}),typeof d.init=="function"&&d.init(O),O}function p(x,E){let T=d(this.namespace+(typeof E>"u"?":":E)+x);return T.log=this.log,T}function v(x){d.save(x),d.namespaces=x,d.names=[],d.skips=[];let E=(typeof x=="string"?x:"").trim().replace(" ",",").split(",").filter(Boolean);for(let T of E)T[0]==="-"?d.skips.push(T.slice(1)):d.names.push(T)}function _(x,E){let T=0,I=0,B=-1,O=0;for(;T<x.length;)if(I<E.length&&(E[I]===x[T]||E[I]==="*"))E[I]==="*"?(B=I,O=T,I++):(T++,I++);else if(B!==-1)I=B+1,O++,T=O;else return!1;for(;I<E.length&&E[I]==="*";)I++;return I===E.length}function y(){let x=[...d.names,...d.skips.map(E=>"-"+E)].join(",");return d.enable(""),x}function w(x){for(let E of d.skips)if(_(x,E))return!1;for(let E of d.names)if(_(x,E))return!0;return!1}function S(x){return x instanceof Error?x.stack||x.message:x}function M(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return d.enable(d.load()),d}r.exports=n}),iyt=Ka((e,r)=>{e.formatArgs=l,e.save=i,e.load=d,e.useColors=n,e.storage=p(),e.destroy=(()=>{let _=!1;return()=>{_||(_=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let _;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(_=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(_[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(_){if(_[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+_[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;let y="color: "+this.color;_.splice(1,0,y,"color: inherit");let w=0,S=0;_[0].replace(/%[a-zA-Z%]/g,M=>{M!=="%%"&&(w++,M==="%c"&&(S=w))}),_.splice(S,0,y)}e.log=console.debug||console.log||(()=>{});function i(_){try{_?e.storage.setItem("debug",_):e.storage.removeItem("debug")}catch{}}function d(){let _;try{_=e.storage.getItem("debug")}catch{}return!_&&typeof We<"u"&&"env"in We&&(_=We.env.DEBUG),_}function p(){try{return localStorage}catch{}}r.exports=ryt()(e);var{formatters:v}=r.exports;v.j=function(_){try{return JSON.stringify(_)}catch(y){return"[UnexpectedJSONParseError]: "+y.message}}});function Ia(){Ia.init.call(this)}function CT(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function lCe(e){return e._maxListeners===void 0?Ia.defaultMaxListeners:e._maxListeners}function ATe(e,r,n,l){var i,d,p,v;if(CT(n),(d=e._events)===void 0?(d=e._events=Object.create(null),e._eventsCount=0):(d.newListener!==void 0&&(e.emit("newListener",r,n.listener?n.listener:n),d=e._events),p=d[r]),p===void 0)p=d[r]=n,++e._eventsCount;else if(typeof p=="function"?p=d[r]=l?[n,p]:[p,n]:l?p.unshift(n):p.push(n),(i=lCe(e))>0&&p.length>i&&!p.warned){p.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+p.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=r,_.count=p.length,v=_,console&&console.warn&&console.warn(v)}return e}function nyt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function RTe(e,r,n){var l={fired:!1,wrapFn:void 0,target:e,type:r,listener:n},i=nyt.bind(l);return i.listener=n,l.wrapFn=i,i}function TTe(e,r,n){var l=e._events;if(l===void 0)return[];var i=l[r];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?function(d){for(var p=new Array(d.length),v=0;v<p.length;++v)p[v]=d[v].listener||d[v];return p}(i):cCe(i,i.length)}function ITe(e){var r=this._events;if(r!==void 0){var n=r[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}function cCe(e,r){for(var n=new Array(r),l=0;l<r;++l)n[l]=e[l];return n}var kTe,BTe,gb,PY,OY,NY,Fs,dCe=ul(()=>{gb=typeof Reflect=="object"?Reflect:null,PY=gb&&typeof gb.apply=="function"?gb.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},BTe=gb&&typeof gb.ownKeys=="function"?gb.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)},OY=Number.isNaN||function(e){return e!=e},kTe=Ia,Ia.EventEmitter=Ia,Ia.prototype._events=void 0,Ia.prototype._eventsCount=0,Ia.prototype._maxListeners=void 0,NY=10,Object.defineProperty(Ia,"defaultMaxListeners",{enumerable:!0,get:function(){return NY},set:function(e){if(typeof e!="number"||e<0||OY(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");NY=e}}),Ia.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ia.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||OY(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Ia.prototype.getMaxListeners=function(){return lCe(this)},Ia.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var l=e==="error",i=this._events;if(i!==void 0)l=l&&i.error===void 0;else if(!l)return!1;if(l){var d;if(r.length>0&&(d=r[0]),d instanceof Error)throw d;var p=new Error("Unhandled error."+(d?" ("+d.message+")":""));throw p.context=d,p}var v=i[e];if(v===void 0)return!1;if(typeof v=="function")PY(v,this,r);else{var _=v.length,y=cCe(v,_);for(n=0;n<_;++n)PY(y[n],this,r)}return!0},Ia.prototype.addListener=function(e,r){return ATe(this,e,r,!1)},Ia.prototype.on=Ia.prototype.addListener,Ia.prototype.prependListener=function(e,r){return ATe(this,e,r,!0)},Ia.prototype.once=function(e,r){return CT(r),this.on(e,RTe(this,e,r)),this},Ia.prototype.prependOnceListener=function(e,r){return CT(r),this.prependListener(e,RTe(this,e,r)),this},Ia.prototype.removeListener=function(e,r){var n,l,i,d,p;if(CT(r),(l=this._events)===void 0)return this;if((n=l[e])===void 0)return this;if(n===r||n.listener===r)--this._eventsCount==0?this._events=Object.create(null):(delete l[e],l.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(i=-1,d=n.length-1;d>=0;d--)if(n[d]===r||n[d].listener===r){p=n[d].listener,i=d;break}if(i<0)return this;i===0?n.shift():function(v,_){for(;_+1<v.length;_++)v[_]=v[_+1];v.pop()}(n,i),n.length===1&&(l[e]=n[0]),l.removeListener!==void 0&&this.emit("removeListener",e,p||r)}return this},Ia.prototype.off=Ia.prototype.removeListener,Ia.prototype.removeAllListeners=function(e){var r,n,l;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i,d=Object.keys(n);for(l=0;l<d.length;++l)(i=d[l])!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(r=n[e])=="function")this.removeListener(e,r);else if(r!==void 0)for(l=r.length-1;l>=0;l--)this.removeListener(e,r[l]);return this},Ia.prototype.listeners=function(e){return TTe(this,e,!0)},Ia.prototype.rawListeners=function(e){return TTe(this,e,!1)},Ia.listenerCount=function(e,r){return typeof e.listenerCount=="function"?e.listenerCount(r):ITe.call(e,r)},Ia.prototype.listenerCount=ITe,Ia.prototype.eventNames=function(){return this._eventsCount>0?BTe(this._events):[]},Fs=kTe,Fs.EventEmitter,Fs.defaultMaxListeners,Fs.init,Fs.listenerCount,Fs.EventEmitter,Fs.defaultMaxListeners,Fs.init,Fs.listenerCount});function YX(){throw new Error("setTimeout has not been defined")}function JX(){throw new Error("clearTimeout has not been defined")}function pCe(e){if(pp===setTimeout)return setTimeout(e,0);if((pp===YX||!pp)&&setTimeout)return pp=setTimeout,setTimeout(e,0);try{return pp(e,0)}catch{try{return pp.call(null,e,0)}catch{return pp.call(this||Xb,e,0)}}}function ayt(){Qb&&Wb&&(Qb=!1,Wb.length?zd=Wb.concat(zd):S9=-1,zd.length&&mCe())}function mCe(){if(!Qb){var e=pCe(ayt);Qb=!0;for(var r=zd.length;r;){for(Wb=zd,zd=[];++S9<r;)Wb&&Wb[S9].run();S9=-1,r=zd.length}Wb=null,Qb=!1,function(n){if(mp===clearTimeout)return clearTimeout(n);if((mp===JX||!mp)&&clearTimeout)return mp=clearTimeout,clearTimeout(n);try{mp(n)}catch{try{return mp.call(null,n)}catch{return mp.call(this||Xb,n)}}}(e)}}function PTe(e,r){(this||Xb).fun=e,(this||Xb).array=r}function ip(){}var OTe,pp,mp,Xb,Co,Wb,zd,Qb,S9,di,joe=ul(()=>{Xb=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis,Co=OTe={},function(){try{pp=typeof setTimeout=="function"?setTimeout:YX}catch{pp=YX}try{mp=typeof clearTimeout=="function"?clearTimeout:JX}catch{mp=JX}}(),zd=[],Qb=!1,S9=-1,Co.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];zd.push(new PTe(e,r)),zd.length!==1||Qb||pCe(mCe)},PTe.prototype.run=function(){(this||Xb).fun.apply(null,(this||Xb).array)},Co.title="browser",Co.browser=!0,Co.env={},Co.argv=[],Co.version="",Co.versions={},Co.on=ip,Co.addListener=ip,Co.once=ip,Co.off=ip,Co.removeListener=ip,Co.removeAllListeners=ip,Co.emit=ip,Co.prependListener=ip,Co.prependOnceListener=ip,Co.listeners=function(e){return[]},Co.binding=function(e){throw new Error("process.binding is not supported")},Co.cwd=function(){return"/"},Co.chdir=function(e){throw new Error("process.chdir is not supported")},Co.umask=function(){return 0},di=OTe,di.addListener,di.argv,di.binding,di.browser,di.chdir,di.cwd,di.emit,di.env,di.listeners,di.nextTick,di.off,di.on,di.once,di.prependListener,di.prependOnceListener,di.removeAllListeners,di.removeListener,di.title,di.umask,di.version,di.versions});function bb(e){return e.call.bind(e)}function M_(e,r){if(typeof e!="object")return!1;try{return r(e),!0}catch{return!1}}function NTe(e){return Xf&&Lh?qn(e)!==void 0:vCe(e)||gCe(e)||bCe(e)||yCe(e)||wCe(e)||_Ce(e)||MCe(e)||SCe(e)||xCe(e)||ECe(e)||ACe(e)}function vCe(e){return Xf&&Lh?qn(e)==="Uint8Array":no(e)==="[object Uint8Array]"||kCe(e)&&e.buffer!==void 0}function gCe(e){return Xf&&Lh?qn(e)==="Uint8ClampedArray":no(e)==="[object Uint8ClampedArray]"}function bCe(e){return Xf&&Lh?qn(e)==="Uint16Array":no(e)==="[object Uint16Array]"}function yCe(e){return Xf&&Lh?qn(e)==="Uint32Array":no(e)==="[object Uint32Array]"}function wCe(e){return Xf&&Lh?qn(e)==="Int8Array":no(e)==="[object Int8Array]"}function _Ce(e){return Xf&&Lh?qn(e)==="Int16Array":no(e)==="[object Int16Array]"}function MCe(e){return Xf&&Lh?qn(e)==="Int32Array":no(e)==="[object Int32Array]"}function SCe(e){return Xf&&Lh?qn(e)==="Float32Array":no(e)==="[object Float32Array]"}function xCe(e){return Xf&&Lh?qn(e)==="Float64Array":no(e)==="[object Float64Array]"}function ECe(e){return Xf&&Lh?qn(e)==="BigInt64Array":no(e)==="[object BigInt64Array]"}function ACe(e){return Xf&&Lh?qn(e)==="BigUint64Array":no(e)==="[object BigUint64Array]"}function LR(e){return no(e)==="[object Map]"}function DR(e){return no(e)==="[object Set]"}function $R(e){return no(e)==="[object WeakMap]"}function CY(e){return no(e)==="[object WeakSet]"}function yO(e){return no(e)==="[object ArrayBuffer]"}function CTe(e){return typeof ArrayBuffer<"u"&&(yO.working?yO(e):e instanceof ArrayBuffer)}function wO(e){return no(e)==="[object DataView]"}function LTe(e){return typeof DataView<"u"&&(wO.working?wO(e):e instanceof DataView)}function _O(e){return no(e)==="[object SharedArrayBuffer]"}function DTe(e){return typeof SharedArrayBuffer<"u"&&(_O.working?_O(e):e instanceof SharedArrayBuffer)}function $Te(e){return M_(e,BCe)}function qTe(e){return M_(e,PCe)}function UTe(e){return M_(e,OCe)}function jTe(e){return XX&&M_(e,pU)}function FTe(e){return DT&&M_(e,vU)}function Jv(e,r){var n={seen:[],stylize:syt};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Foe(r)?n.showHidden=r:r&&pr._extend(n,r),Gb(n.showHidden)&&(n.showHidden=!1),Gb(n.depth)&&(n.depth=2),Gb(n.colors)&&(n.colors=!1),Gb(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=oyt),MO(n,e,n.depth)}function oyt(e,r){var n=Jv.styles[r];return n?"\x1B["+Jv.colors[n][0]+"m"+e+"\x1B["+Jv.colors[n][1]+"m":e}function syt(e,r){return e}function MO(e,r,n){if(e.customInspect&&r&&LT(r.inspect)&&r.inspect!==pr.inspect&&(!r.constructor||r.constructor.prototype!==r)){var l=r.inspect(n,e);return xO(l)||(l=MO(e,l,n)),l}var i=function(M,x){if(Gb(x))return M.stylize("undefined","undefined");if(xO(x)){var E="'"+JSON.stringify(x).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return M.stylize(E,"string")}if(TCe(x))return M.stylize(""+x,"number");if(Foe(x))return M.stylize(""+x,"boolean");if(SO(x))return M.stylize("null","null")}(e,r);if(i)return i;var d=Object.keys(r),p=function(M){var x={};return M.forEach(function(E,T){x[E]=!0}),x}(d);if(e.showHidden&&(d=Object.getOwnPropertyNames(r)),E9(r)&&(d.indexOf("message")>=0||d.indexOf("description")>=0))return LY(r);if(d.length===0){if(LT(r)){var v=r.name?": "+r.name:"";return e.stylize("[Function"+v+"]","special")}if(x9(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(EO(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E9(r))return LY(r)}var _,y="",w=!1,S=["{","}"];return RCe(r)&&(w=!0,S=["[","]"]),LT(r)&&(y=" [Function"+(r.name?": "+r.name:"")+"]"),x9(r)&&(y=" "+RegExp.prototype.toString.call(r)),EO(r)&&(y=" "+Date.prototype.toUTCString.call(r)),E9(r)&&(y=" "+LY(r)),d.length!==0||w&&r.length!=0?n<0?x9(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=w?function(M,x,E,T,I){for(var B=[],O=0,N=x.length;O<N;++O)ICe(x,String(O))?B.push(DY(M,x,E,T,String(O),!0)):B.push("");return I.forEach(function(H){H.match(/^\d+$/)||B.push(DY(M,x,E,T,H,!0))}),B}(e,r,n,p,d):d.map(function(M){return DY(e,r,n,p,M,w)}),e.seen.pop(),function(M,x,E){var T=0;return M.reduce(function(I,B){return T++,B.indexOf(`
157
+ `;super(x),this.name="AggregateError",this.errors=M}}return bR={AggregateError:w,kEmptyObject:Object.freeze({}),once(S){let M=!1;return function(...x){M||(M=!0,S.apply(this,x))}},createDeferredPromise:function(){let S,M;return{promise:new Promise((E,T)=>{S=E,M=T}),resolve:S,reject:M}},promisify(S){return new Promise((M,x)=>{S((E,...T)=>E?x(E):M(...T))})},debuglog(){return function(){}},format(S,...M){return S.replace(/%([sdifj])/g,function(...[x,E]){let T=M.shift();return E==="f"?T.toFixed(6):E==="j"?JSON.stringify(T):E==="s"&&typeof T=="object"?`${T.constructor!==Object?T.constructor.name:""} {}`.trim():T.toString()})},inspect(S){switch(typeof S){case"string":if(S.includes("'"))if(S.includes('"')){if(!S.includes("`")&&!S.includes("${"))return`\`${S}\``}else return`"${S}"`;return`'${S}'`;case"number":return isNaN(S)?"NaN":Object.is(S,-0)?String(S):S;case"bigint":return`${String(S)}n`;case"boolean":case"undefined":return String(S);case"object":return"{}"}},types:{isAsyncFunction(S){return S instanceof d},isArrayBufferView(S){return ArrayBuffer.isView(S)}},isBlob:v,deprecate(S,M){return S},addAbortListener:Ed.addAbortListener||function(M,x){if(M===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",M);_(M,"signal"),y(x,"listener");let E;return M.aborted?queueMicrotask(()=>x()):(M.addEventListener("abort",x,{__proto__:null,once:!0,[r]:!0}),E=()=>{M.removeEventListener("abort",x)}),{__proto__:null,[n](){var T;(T=E)===null||T===void 0||T()}}},AbortSignalAny:l.any||function(M){if(M.length===1)return M[0];let x=new i,E=()=>x.abort();return M.forEach(T=>{_(T,"signals"),T.addEventListener("abort",E,{once:!0})}),x.signal.addEventListener("abort",()=>{M.forEach(T=>T.removeEventListener("abort",E))},{once:!0}),x.signal}},bR.promisify.custom=Symbol.for("nodejs.util.promisify.custom"),bR}var tY={},xRe=!1;function yh(){if(xRe)return tY;xRe=!0;let{format:e,inspect:r,AggregateError:n}=Hf(),l=globalThis.AggregateError||n,i=Symbol("kIsNodeError"),d=["string","function","number","object","Function","Object","boolean","bigint","symbol"],p=/^([A-Z][a-z0-9]*)+$/,v="__node_internal_",_={};function y(I,B){if(!I)throw new _.ERR_INTERNAL_ASSERTION(B)}function w(I){let B="",O=I.length,N=I[0]==="-"?1:0;for(;O>=N+4;O-=3)B=`_${I.slice(O-3,O)}${B}`;return`${I.slice(0,O)}${B}`}function S(I,B,O){if(typeof B=="function")return y(B.length<=O.length,`Code: ${I}; The provided arguments length (${O.length}) does not match the required ones (${B.length}).`),B(...O);let N=(B.match(/%[dfijoOs]/g)||[]).length;return y(N===O.length,`Code: ${I}; The provided arguments length (${O.length}) does not match the required ones (${N}).`),O.length===0?B:e(B,...O)}function M(I,B,O){O||(O=Error);class N extends O{constructor(...K){super(S(I,B,K))}toString(){return`${this.name} [${I}]: ${this.message}`}}Object.defineProperties(N.prototype,{name:{value:O.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${I}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),N.prototype.code=I,N.prototype[i]=!0,_[I]=N}function x(I){let B=v+I.name;return Object.defineProperty(I,"name",{value:B}),I}function E(I,B){if(I&&B&&I!==B){if(Array.isArray(B.errors))return B.errors.push(I),B;let O=new l([B,I],B.message);return O.code=B.code,O}return I||B}class T extends Error{constructor(B="The operation was aborted",O=void 0){if(O!==void 0&&typeof O!="object")throw new _.ERR_INVALID_ARG_TYPE("options","Object",O);super(B,O),this.code="ABORT_ERR",this.name="AbortError"}}return M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(I,B,O)=>{y(typeof I=="string","'name' must be a string"),Array.isArray(B)||(B=[B]);let N="The ";I.endsWith(" argument")?N+=`${I} `:N+=`"${I}" ${I.includes(".")?"property":"argument"} `,N+="must be ";let H=[],K=[],J=[];for(let $ of B)y(typeof $=="string","All expected entries have to be of type string"),d.includes($)?H.push($.toLowerCase()):p.test($)?K.push($):(y($!=="object",'The value "object" should be written as "Object"'),J.push($));if(K.length>0){let $=H.indexOf("object");$!==-1&&(H.splice(H,$,1),K.push("Object"))}if(H.length>0){switch(H.length){case 1:N+=`of type ${H[0]}`;break;case 2:N+=`one of type ${H[0]} or ${H[1]}`;break;default:{let $=H.pop();N+=`one of type ${H.join(", ")}, or ${$}`}}(K.length>0||J.length>0)&&(N+=" or ")}if(K.length>0){switch(K.length){case 1:N+=`an instance of ${K[0]}`;break;case 2:N+=`an instance of ${K[0]} or ${K[1]}`;break;default:{let $=K.pop();N+=`an instance of ${K.join(", ")}, or ${$}`}}J.length>0&&(N+=" or ")}switch(J.length){case 0:break;case 1:J[0].toLowerCase()!==J[0]&&(N+="an "),N+=`${J[0]}`;break;case 2:N+=`one of ${J[0]} or ${J[1]}`;break;default:{let $=J.pop();N+=`one of ${J.join(", ")}, or ${$}`}}if(O==null)N+=`. Received ${O}`;else if(typeof O=="function"&&O.name)N+=`. Received function ${O.name}`;else if(typeof O=="object"){var L;if((L=O.constructor)!==null&&L!==void 0&&L.name)N+=`. Received an instance of ${O.constructor.name}`;else{let $=r(O,{depth:-1});N+=`. Received ${$}`}}else{let $=r(O,{colors:!1});$.length>25&&($=`${$.slice(0,25)}...`),N+=`. Received type ${typeof O} (${$})`}return N},TypeError),M("ERR_INVALID_ARG_VALUE",(I,B,O="is invalid")=>{let N=r(B);return N.length>128&&(N=N.slice(0,128)+"..."),`The ${I.includes(".")?"property":"argument"} '${I}' ${O}. Received ${N}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(I,B,O)=>{var N;let H=O!=null&&(N=O.constructor)!==null&&N!==void 0&&N.name?`instance of ${O.constructor.name}`:`type ${typeof O}`;return`Expected ${I} to be returned from the "${B}" function but got ${H}.`},TypeError),M("ERR_MISSING_ARGS",(...I)=>{y(I.length>0,"At least one arg needs to be specified");let B,O=I.length;switch(I=(Array.isArray(I)?I:[I]).map(N=>`"${N}"`).join(" or "),O){case 1:B+=`The ${I[0]} argument`;break;case 2:B+=`The ${I[0]} and ${I[1]} arguments`;break;default:{let N=I.pop();B+=`The ${I.join(", ")}, and ${N} arguments`}break}return`${B} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(I,B,O)=>{y(B,'Missing "range" argument');let N;return Number.isInteger(O)&&Math.abs(O)>2**32?N=w(String(O)):typeof O=="bigint"?(N=String(O),(O>2n**32n||O<-(2n**32n))&&(N=w(N)),N+="n"):N=r(O),`The value of "${I}" is out of range. It must be ${B}. Received ${N}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),tY={AbortError:T,aggregateTwoErrors:x(E),hideStackFrames:x,codes:_},tY}var rY={},ERe=!1;function F5(){if(ERe)return rY;ERe=!0;let{ArrayIsArray:e,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:n,ArrayPrototypeMap:l,NumberIsInteger:i,NumberIsNaN:d,NumberMAX_SAFE_INTEGER:p,NumberMIN_SAFE_INTEGER:v,NumberParseInt:_,ObjectPrototypeHasOwnProperty:y,RegExpPrototypeExec:w,String:S,StringPrototypeToUpperCase:M,StringPrototypeTrim:x}=No(),{hideStackFrames:E,codes:{ERR_SOCKET_BAD_PORT:T,ERR_INVALID_ARG_TYPE:I,ERR_INVALID_ARG_VALUE:B,ERR_OUT_OF_RANGE:O,ERR_UNKNOWN_SIGNAL:N}}=yh(),{normalizeEncoding:H}=Hf(),{isAsyncFunction:K,isArrayBufferView:J}=Hf().types,L={};function $(ye){return ye===(ye|0)}function V(ye){return ye===ye>>>0}let h=/^[0-7]+$/,t="must be a 32-bit unsigned integer or an octal string";function a(ye,he,Re){if(typeof ye>"u"&&(ye=Re),typeof ye=="string"){if(w(h,ye)===null)throw new B(he,ye,t);ye=_(ye,8)}return c(ye,he),ye}let s=E((ye,he,Re=v,Be=p)=>{if(typeof ye!="number")throw new I(he,"number",ye);if(!i(ye))throw new O(he,"an integer",ye);if(ye<Re||ye>Be)throw new O(he,`>= ${Re} && <= ${Be}`,ye)}),u=E((ye,he,Re=-2147483648,Be=2147483647)=>{if(typeof ye!="number")throw new I(he,"number",ye);if(!i(ye))throw new O(he,"an integer",ye);if(ye<Re||ye>Be)throw new O(he,`>= ${Re} && <= ${Be}`,ye)}),c=E((ye,he,Re=!1)=>{if(typeof ye!="number")throw new I(he,"number",ye);if(!i(ye))throw new O(he,"an integer",ye);let Be=Re?1:0,be=4294967295;if(ye<Be||ye>be)throw new O(he,`>= ${Be} && <= ${be}`,ye)});function b(ye,he){if(typeof ye!="string")throw new I(he,"string",ye)}function m(ye,he,Re=void 0,Be){if(typeof ye!="number")throw new I(he,"number",ye);if(Re!=null&&ye<Re||Be!=null&&ye>Be||(Re!=null||Be!=null)&&d(ye))throw new O(he,`${Re!=null?`>= ${Re}`:""}${Re!=null&&Be!=null?" && ":""}${Be!=null?`<= ${Be}`:""}`,ye)}let f=E((ye,he,Re)=>{if(!r(Re,ye)){let be="must be one of: "+n(l(Re,Ne=>typeof Ne=="string"?`'${Ne}'`:S(Ne)),", ");throw new B(he,ye,be)}});function o(ye,he){if(typeof ye!="boolean")throw new I(he,"boolean",ye)}function g(ye,he,Re){return ye==null||!y(ye,he)?Re:ye[he]}let A=E((ye,he,Re=null)=>{let Be=g(Re,"allowArray",!1),be=g(Re,"allowFunction",!1);if(!g(Re,"nullable",!1)&&ye===null||!Be&&e(ye)||typeof ye!="object"&&(!be||typeof ye!="function"))throw new I(he,"Object",ye)}),R=E((ye,he)=>{if(ye!=null&&typeof ye!="object"&&typeof ye!="function")throw new I(he,"a dictionary",ye)}),k=E((ye,he,Re=0)=>{if(!e(ye))throw new I(he,"Array",ye);if(ye.length<Re){let Be=`must be longer than ${Re}`;throw new B(he,ye,Be)}});function q(ye,he){k(ye,he);for(let Re=0;Re<ye.length;Re++)b(ye[Re],`${he}[${Re}]`)}function Z(ye,he){k(ye,he);for(let Re=0;Re<ye.length;Re++)o(ye[Re],`${he}[${Re}]`)}function ne(ye,he){k(ye,he);for(let Re=0;Re<ye.length;Re++){let Be=ye[Re],be=`${he}[${Re}]`;if(Be==null)throw new I(be,"AbortSignal",Be);X(Be,be)}}function G(ye,he="signal"){if(b(ye,he),L[ye]===void 0)throw L[M(ye)]!==void 0?new N(ye+" (signals must use all capital letters)"):new N(ye)}let D=E((ye,he="buffer")=>{if(!J(ye))throw new I(he,["Buffer","TypedArray","DataView"],ye)});function W(ye,he){let Re=H(he),Be=ye.length;if(Re==="hex"&&Be%2!==0)throw new B("encoding",he,`is invalid for data of length ${Be}`)}function ie(ye,he="Port",Re=!0){if(typeof ye!="number"&&typeof ye!="string"||typeof ye=="string"&&x(ye).length===0||+ye!==+ye>>>0||ye>65535||ye===0&&!Re)throw new T(he,ye,Re);return ye|0}let X=E((ye,he)=>{if(ye!==void 0&&(ye===null||typeof ye!="object"||!("aborted"in ye)))throw new I(he,"AbortSignal",ye)}),z=E((ye,he)=>{if(typeof ye!="function")throw new I(he,"Function",ye)}),F=E((ye,he)=>{if(typeof ye!="function"||K(ye))throw new I(he,"Function",ye)}),Y=E((ye,he)=>{if(ye!==void 0)throw new I(he,"undefined",ye)});function ae(ye,he,Re){if(!r(Re,ye))throw new I(he,`('${n(Re,"|")}')`,ye)}let de=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function re(ye,he){if(typeof ye>"u"||!w(de,ye))throw new B(he,ye,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function fe(ye){if(typeof ye=="string")return re(ye,"hints"),ye;if(e(ye)){let he=ye.length,Re="";if(he===0)return Re;for(let Be=0;Be<he;Be++){let be=ye[Be];re(be,"hints"),Re+=be,Be!==he-1&&(Re+=", ")}return Re}throw new B("hints",ye,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return rY={isInt32:$,isUint32:V,parseFileMode:a,validateArray:k,validateStringArray:q,validateBooleanArray:Z,validateAbortSignalArray:ne,validateBoolean:o,validateBuffer:D,validateDictionary:R,validateEncoding:W,validateFunction:z,validateInt32:u,validateInteger:s,validateNumber:m,validateObject:A,validateOneOf:f,validatePlainFunction:F,validatePort:ie,validateSignalName:G,validateString:b,validateUint32:c,validateUndefined:Y,validateUnion:ae,validateAbortSignal:X,validateLinkHeaderValue:fe},rY}var iY={},ARe=!1;function X1(){if(ARe)return iY;ARe=!0;let{SymbolAsyncIterator:e,SymbolIterator:r,SymbolFor:n}=No(),l=n("nodejs.stream.destroyed"),i=n("nodejs.stream.errored"),d=n("nodejs.stream.readable"),p=n("nodejs.stream.writable"),v=n("nodejs.stream.disturbed"),_=n("nodejs.webstream.isClosedPromise"),y=n("nodejs.webstream.controllerErrorFunction");function w(g,A=!1){var R;return!!(g&&typeof g.pipe=="function"&&typeof g.on=="function"&&(!A||typeof g.pause=="function"&&typeof g.resume=="function")&&(!g._writableState||((R=g._readableState)===null||R===void 0?void 0:R.readable)!==!1)&&(!g._writableState||g._readableState))}function S(g){var A;return!!(g&&typeof g.write=="function"&&typeof g.on=="function"&&(!g._readableState||((A=g._writableState)===null||A===void 0?void 0:A.writable)!==!1))}function M(g){return!!(g&&typeof g.pipe=="function"&&g._readableState&&typeof g.on=="function"&&typeof g.write=="function")}function x(g){return g&&(g._readableState||g._writableState||typeof g.write=="function"&&typeof g.on=="function"||typeof g.pipe=="function"&&typeof g.on=="function")}function E(g){return!!(g&&!x(g)&&typeof g.pipeThrough=="function"&&typeof g.getReader=="function"&&typeof g.cancel=="function")}function T(g){return!!(g&&!x(g)&&typeof g.getWriter=="function"&&typeof g.abort=="function")}function I(g){return!!(g&&!x(g)&&typeof g.readable=="object"&&typeof g.writable=="object")}function B(g){return E(g)||T(g)||I(g)}function O(g,A){return g==null?!1:A===!0?typeof g[e]=="function":A===!1?typeof g[r]=="function":typeof g[e]=="function"||typeof g[r]=="function"}function N(g){if(!x(g))return null;let A=g._writableState,R=g._readableState,k=A||R;return!!(g.destroyed||g[l]||k!=null&&k.destroyed)}function H(g){if(!S(g))return null;if(g.writableEnded===!0)return!0;let A=g._writableState;return A!=null&&A.errored?!1:typeof A?.ended!="boolean"?null:A.ended}function K(g,A){if(!S(g))return null;if(g.writableFinished===!0)return!0;let R=g._writableState;return R!=null&&R.errored?!1:typeof R?.finished!="boolean"?null:!!(R.finished||A===!1&&R.ended===!0&&R.length===0)}function J(g){if(!w(g))return null;if(g.readableEnded===!0)return!0;let A=g._readableState;return!A||A.errored?!1:typeof A?.ended!="boolean"?null:A.ended}function L(g,A){if(!w(g))return null;let R=g._readableState;return R!=null&&R.errored?!1:typeof R?.endEmitted!="boolean"?null:!!(R.endEmitted||A===!1&&R.ended===!0&&R.length===0)}function $(g){return g&&g[d]!=null?g[d]:typeof g?.readable!="boolean"?null:N(g)?!1:w(g)&&g.readable&&!L(g)}function V(g){return g&&g[p]!=null?g[p]:typeof g?.writable!="boolean"?null:N(g)?!1:S(g)&&g.writable&&!H(g)}function h(g,A){return x(g)?N(g)?!0:!(A?.readable!==!1&&$(g)||A?.writable!==!1&&V(g)):null}function t(g){var A,R;return x(g)?g.writableErrored?g.writableErrored:(A=(R=g._writableState)===null||R===void 0?void 0:R.errored)!==null&&A!==void 0?A:null:null}function a(g){var A,R;return x(g)?g.readableErrored?g.readableErrored:(A=(R=g._readableState)===null||R===void 0?void 0:R.errored)!==null&&A!==void 0?A:null:null}function s(g){if(!x(g))return null;if(typeof g.closed=="boolean")return g.closed;let A=g._writableState,R=g._readableState;return typeof A?.closed=="boolean"||typeof R?.closed=="boolean"?A?.closed||R?.closed:typeof g._closed=="boolean"&&u(g)?g._closed:null}function u(g){return typeof g._closed=="boolean"&&typeof g._defaultKeepAlive=="boolean"&&typeof g._removedConnection=="boolean"&&typeof g._removedContLen=="boolean"}function c(g){return typeof g._sent100=="boolean"&&u(g)}function b(g){var A;return typeof g._consuming=="boolean"&&typeof g._dumped=="boolean"&&((A=g.req)===null||A===void 0?void 0:A.upgradeOrConnect)===void 0}function m(g){if(!x(g))return null;let A=g._writableState,R=g._readableState,k=A||R;return!k&&c(g)||!!(k&&k.autoDestroy&&k.emitClose&&k.closed===!1)}function f(g){var A;return!!(g&&((A=g[v])!==null&&A!==void 0?A:g.readableDidRead||g.readableAborted))}function o(g){var A,R,k,q,Z,ne,G,D,W,ie;return!!(g&&((A=(R=(k=(q=(Z=(ne=g[i])!==null&&ne!==void 0?ne:g.readableErrored)!==null&&Z!==void 0?Z:g.writableErrored)!==null&&q!==void 0?q:(G=g._readableState)===null||G===void 0?void 0:G.errorEmitted)!==null&&k!==void 0?k:(D=g._writableState)===null||D===void 0?void 0:D.errorEmitted)!==null&&R!==void 0?R:(W=g._readableState)===null||W===void 0?void 0:W.errored)!==null&&A!==void 0?A:!((ie=g._writableState)===null||ie===void 0)&&ie.errored))}return iY={isDestroyed:N,kIsDestroyed:l,isDisturbed:f,kIsDisturbed:v,isErrored:o,kIsErrored:i,isReadable:$,kIsReadable:d,kIsClosedPromise:_,kControllerErrorFunction:y,kIsWritable:p,isClosed:s,isDuplexNodeStream:M,isFinished:h,isIterable:O,isReadableNodeStream:w,isReadableStream:E,isReadableEnded:J,isReadableFinished:L,isReadableErrored:a,isNodeStream:x,isWebStream:B,isWritable:V,isWritableNodeStream:S,isWritableStream:T,isWritableEnded:H,isWritableFinished:K,isWritableErrored:t,isServerRequest:b,isServerResponse:c,willEmitClose:m,isTransformStream:I},iY}var yR={},RRe=!1;function hv(){if(RRe)return yR;RRe=!0;let e=pn,{AbortError:r,codes:n}=yh(),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_PREMATURE_CLOSE:i}=n,{kEmptyObject:d,once:p}=Hf(),{validateAbortSignal:v,validateFunction:_,validateObject:y,validateBoolean:w}=F5(),{Promise:S,PromisePrototypeThen:M,SymbolDispose:x}=No(),{isClosed:E,isReadable:T,isReadableNodeStream:I,isReadableStream:B,isReadableFinished:O,isReadableErrored:N,isWritable:H,isWritableNodeStream:K,isWritableStream:J,isWritableFinished:L,isWritableErrored:$,isNodeStream:V,willEmitClose:h,kIsClosedPromise:t}=X1(),a;function s(f){return f.setHeader&&typeof f.abort=="function"}let u=()=>{};function c(f,o,g){var A,R;if(arguments.length===2?(g=o,o=d):o==null?o=d:y(o,"options"),_(g,"callback"),v(o.signal,"options.signal"),g=p(g),B(f)||J(f))return b(f,o,g);if(!V(f))throw new l("stream",["ReadableStream","WritableStream","Stream"],f);let k=(A=o.readable)!==null&&A!==void 0?A:I(f),q=(R=o.writable)!==null&&R!==void 0?R:K(f),Z=f._writableState,ne=f._readableState,G=()=>{f.writable||ie()},D=h(f)&&I(f)===k&&K(f)===q,W=L(f,!1),ie=()=>{W=!0,f.destroyed&&(D=!1),!(D&&(!f.readable||k))&&(!k||X)&&g.call(f)},X=O(f,!1),z=()=>{X=!0,f.destroyed&&(D=!1),!(D&&(!f.writable||q))&&(!q||W)&&g.call(f)},F=ye=>{g.call(f,ye)},Y=E(f),ae=()=>{Y=!0;let ye=$(f)||N(f);if(ye&&typeof ye!="boolean")return g.call(f,ye);if(k&&!X&&I(f,!0)&&!O(f,!1))return g.call(f,new i);if(q&&!W&&!L(f,!1))return g.call(f,new i);g.call(f)},de=()=>{Y=!0;let ye=$(f)||N(f);if(ye&&typeof ye!="boolean")return g.call(f,ye);g.call(f)},re=()=>{f.req.on("finish",ie)};s(f)?(f.on("complete",ie),D||f.on("abort",ae),f.req?re():f.on("request",re)):q&&!Z&&(f.on("end",G),f.on("close",G)),!D&&typeof f.aborted=="boolean"&&f.on("aborted",ae),f.on("end",z),f.on("finish",ie),o.error!==!1&&f.on("error",F),f.on("close",ae),Y?e.nextTick(ae):Z!=null&&Z.errorEmitted||ne!=null&&ne.errorEmitted?D||e.nextTick(de):(!k&&(!D||T(f))&&(W||H(f)===!1)||!q&&(!D||H(f))&&(X||T(f)===!1)||ne&&f.req&&f.aborted)&&e.nextTick(de);let fe=()=>{g=u,f.removeListener("aborted",ae),f.removeListener("complete",ie),f.removeListener("abort",ae),f.removeListener("request",re),f.req&&f.req.removeListener("finish",ie),f.removeListener("end",G),f.removeListener("close",G),f.removeListener("finish",ie),f.removeListener("end",z),f.removeListener("error",F),f.removeListener("close",ae)};if(o.signal&&!Y){let ye=()=>{let he=g;fe(),he.call(f,new r(void 0,{cause:o.signal.reason}))};if(o.signal.aborted)e.nextTick(ye);else{a=a||Hf().addAbortListener;let he=a(o.signal,ye),Re=g;g=p((...Be)=>{he[x](),Re.apply(f,Be)})}}return fe}function b(f,o,g){let A=!1,R=u;if(o.signal)if(R=()=>{A=!0,g.call(f,new r(void 0,{cause:o.signal.reason}))},o.signal.aborted)e.nextTick(R);else{a=a||Hf().addAbortListener;let q=a(o.signal,R),Z=g;g=p((...ne)=>{q[x](),Z.apply(f,ne)})}let k=(...q)=>{A||e.nextTick(()=>g.apply(f,q))};return M(f[t].promise,k,k),u}function m(f,o){var g;let A=!1;return o===null&&(o=d),(g=o)!==null&&g!==void 0&&g.cleanup&&(w(o.cleanup,"cleanup"),A=o.cleanup),new S((R,k)=>{let q=c(f,o,Z=>{A&&q(),Z?k(Z):R()})})}return yR=c,yR.finished=m,yR}var nY={},TRe=!1;function p3(){if(TRe)return nY;TRe=!0;let e=pn,{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:n},AbortError:l}=yh(),{Symbol:i}=No(),{kIsDestroyed:d,isDestroyed:p,isFinished:v,isServerRequest:_}=X1(),y=i("kDestroy"),w=i("kConstruct");function S(h,t,a){h&&(h.stack,t&&!t.errored&&(t.errored=h),a&&!a.errored&&(a.errored=h))}function M(h,t){let a=this._readableState,s=this._writableState,u=s||a;return s!=null&&s.destroyed||a!=null&&a.destroyed?(typeof t=="function"&&t(),this):(S(h,s,a),s&&(s.destroyed=!0),a&&(a.destroyed=!0),u.constructed?x(this,h,t):this.once(y,function(c){x(this,r(c,h),t)}),this)}function x(h,t,a){let s=!1;function u(c){if(s)return;s=!0;let b=h._readableState,m=h._writableState;S(c,m,b),m&&(m.closed=!0),b&&(b.closed=!0),typeof a=="function"&&a(c),c?e.nextTick(E,h,c):e.nextTick(T,h)}try{h._destroy(t||null,u)}catch(c){u(c)}}function E(h,t){I(h,t),T(h)}function T(h){let t=h._readableState,a=h._writableState;a&&(a.closeEmitted=!0),t&&(t.closeEmitted=!0),(a!=null&&a.emitClose||t!=null&&t.emitClose)&&h.emit("close")}function I(h,t){let a=h._readableState,s=h._writableState;s!=null&&s.errorEmitted||a!=null&&a.errorEmitted||(s&&(s.errorEmitted=!0),a&&(a.errorEmitted=!0),h.emit("error",t))}function B(){let h=this._readableState,t=this._writableState;h&&(h.constructed=!0,h.closed=!1,h.closeEmitted=!1,h.destroyed=!1,h.errored=null,h.errorEmitted=!1,h.reading=!1,h.ended=h.readable===!1,h.endEmitted=h.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function O(h,t,a){let s=h._readableState,u=h._writableState;if(u!=null&&u.destroyed||s!=null&&s.destroyed)return this;s!=null&&s.autoDestroy||u!=null&&u.autoDestroy?h.destroy(t):t&&(t.stack,u&&!u.errored&&(u.errored=t),s&&!s.errored&&(s.errored=t),a?e.nextTick(I,h,t):I(h,t))}function N(h,t){if(typeof h._construct!="function")return;let a=h._readableState,s=h._writableState;a&&(a.constructed=!1),s&&(s.constructed=!1),h.once(w,t),!(h.listenerCount(w)>1)&&e.nextTick(H,h)}function H(h){let t=!1;function a(s){if(t){O(h,s??new n);return}t=!0;let u=h._readableState,c=h._writableState,b=c||u;u&&(u.constructed=!0),c&&(c.constructed=!0),b.destroyed?h.emit(y,s):s?O(h,s,!0):e.nextTick(K,h)}try{h._construct(s=>{e.nextTick(a,s)})}catch(s){e.nextTick(a,s)}}function K(h){h.emit(w)}function J(h){return h?.setHeader&&typeof h.abort=="function"}function L(h){h.emit("close")}function $(h,t){h.emit("error",t),e.nextTick(L,h)}function V(h,t){!h||p(h)||(!t&&!v(h)&&(t=new l),_(h)?(h.socket=null,h.destroy(t)):J(h)?h.abort():J(h.req)?h.req.abort():typeof h.destroy=="function"?h.destroy(t):typeof h.close=="function"?h.close():t?e.nextTick($,h,t):e.nextTick(L,h),h.destroyed||(h[d]=!0))}return nY={construct:N,destroyer:V,destroy:M,undestroy:B,errorOrDestroy:O},nY}var aY={},IRe=!1;function yY(){if(IRe)return aY;IRe=!0;let{ArrayIsArray:e,ObjectSetPrototypeOf:r}=No(),{EventEmitter:n}=Ed;function l(d){n.call(this,d)}r(l.prototype,n.prototype),r(l,n),l.prototype.pipe=function(d,p){let v=this;function _(T){d.writable&&d.write(T)===!1&&v.pause&&v.pause()}v.on("data",_);function y(){v.readable&&v.resume&&v.resume()}d.on("drain",y),!d._isStdio&&(!p||p.end!==!1)&&(v.on("end",S),v.on("close",M));let w=!1;function S(){w||(w=!0,d.end())}function M(){w||(w=!0,typeof d.destroy=="function"&&d.destroy())}function x(T){E(),n.listenerCount(this,"error")===0&&this.emit("error",T)}i(v,"error",x),i(d,"error",x);function E(){v.removeListener("data",_),d.removeListener("drain",y),v.removeListener("end",S),v.removeListener("close",M),v.removeListener("error",x),d.removeListener("error",x),v.removeListener("end",E),v.removeListener("close",E),d.removeListener("close",E)}return v.on("end",E),v.on("close",E),d.on("close",E),d.emit("pipe",v),d};function i(d,p,v){if(typeof d.prependListener=="function")return d.prependListener(p,v);!d._events||!d._events[p]?d.on(p,v):e(d._events[p])?d._events[p].unshift(v):d._events[p]=[v,d._events[p]]}return aY={Stream:l,prependListener:i},aY}var U5={},kRe=!1;function _R(){if(kRe)return U5;kRe=!0;let{SymbolDispose:e}=No(),{AbortError:r,codes:n}=yh(),{isNodeStream:l,isWebStream:i,kControllerErrorFunction:d}=X1(),p=hv(),{ERR_INVALID_ARG_TYPE:v}=n,_,y=(w,S)=>{if(typeof w!="object"||!("aborted"in w))throw new v(S,"AbortSignal",w)};return U5.addAbortSignal=function(S,M){if(y(S,"signal"),!l(M)&&!i(M))throw new v("stream",["ReadableStream","WritableStream","Stream"],M);return U5.addAbortSignalNoValidate(S,M)},U5.addAbortSignalNoValidate=function(w,S){if(typeof w!="object"||!("aborted"in w))return S;let M=l(S)?()=>{S.destroy(new r(void 0,{cause:w.reason}))}:()=>{S[d](new r(void 0,{cause:w.reason}))};if(w.aborted)M();else{_=_||Hf().addAbortListener;let x=_(w,M);p(S,x[e])}return S},U5}var oY={},BRe=!1;function Rbt(){if(BRe)return oY;BRe=!0;let{StringPrototypeSlice:e,SymbolIterator:r,TypedArrayPrototypeSet:n,Uint8Array:l}=No(),{Buffer:i}=Oi(),{inspect:d}=Hf();return oY=class{constructor(){this.head=null,this.tail=null,this.length=0}push(v){let _={data:v,next:null};this.length>0?this.tail.next=_:this.head=_,this.tail=_,++this.length}unshift(v){let _={data:v,next:this.head};this.length===0&&(this.tail=_),this.head=_,++this.length}shift(){if(this.length===0)return;let v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}clear(){this.head=this.tail=null,this.length=0}join(v){if(this.length===0)return"";let _=this.head,y=""+_.data;for(;(_=_.next)!==null;)y+=v+_.data;return y}concat(v){if(this.length===0)return i.alloc(0);let _=i.allocUnsafe(v>>>0),y=this.head,w=0;for(;y;)n(_,y.data,w),w+=y.data.length,y=y.next;return _}consume(v,_){let y=this.head.data;if(v<y.length){let w=y.slice(0,v);return this.head.data=y.slice(v),w}return v===y.length?this.shift():_?this._getString(v):this._getBuffer(v)}first(){return this.head.data}*[r](){for(let v=this.head;v;v=v.next)yield v.data}_getString(v){let _="",y=this.head,w=0;do{let S=y.data;if(v>S.length)_+=S,v-=S.length;else{v===S.length?(_+=S,++w,y.next?this.head=y.next:this.head=this.tail=null):(_+=e(S,0,v),this.head=y,y.data=e(S,v));break}++w}while((y=y.next)!==null);return this.length-=w,_}_getBuffer(v){let _=i.allocUnsafe(v),y=v,w=this.head,S=0;do{let M=w.data;if(v>M.length)n(_,M,y-v),v-=M.length;else{v===M.length?(n(_,M,y-v),++S,w.next?this.head=w.next:this.head=this.tail=null):(n(_,new l(M.buffer,M.byteOffset,v),y-v),this.head=w,w.data=M.slice(v));break}++S}while((w=w.next)!==null);return this.length-=S,_}[Symbol.for("nodejs.util.inspect.custom")](v,_){return d(this,{..._,depth:0,customInspect:!1})}},oY}var sY={},PRe=!1;function MR(){if(PRe)return sY;PRe=!0;let{MathFloor:e,NumberIsInteger:r}=No(),{validateInteger:n}=F5(),{ERR_INVALID_ARG_VALUE:l}=yh().codes,i=16*1024,d=16;function p(w,S,M){return w.highWaterMark!=null?w.highWaterMark:S?w[M]:null}function v(w){return w?d:i}function _(w,S){n(S,"value",0),w?d=S:i=S}function y(w,S,M,x){let E=p(S,x,M);if(E!=null){if(!r(E)||E<0){let T=x?`options.${M}`:"options.highWaterMark";throw new l(T,E)}return e(E)}return v(w.objectMode)}return sY={getHighWaterMark:y,getDefaultHighWaterMark:v,setDefaultHighWaterMark:_},sY}var fY={},ORe=!1;function GRe(){if(ORe)return fY;ORe=!0;let e=pn,{PromisePrototypeThen:r,SymbolAsyncIterator:n,SymbolIterator:l}=No(),{Buffer:i}=Oi(),{ERR_INVALID_ARG_TYPE:d,ERR_STREAM_NULL_VALUES:p}=yh().codes;function v(_,y,w){let S;if(typeof y=="string"||y instanceof i)return new _({objectMode:!0,...w,read(){this.push(y),this.push(null)}});let M;if(y&&y[n])M=!0,S=y[n]();else if(y&&y[l])M=!1,S=y[l]();else throw new d("iterable",["Iterable"],y);let x=new _({objectMode:!0,highWaterMark:1,...w}),E=!1;x._read=function(){E||(E=!0,I())},x._destroy=function(B,O){r(T(B),()=>e.nextTick(O,B),N=>e.nextTick(O,N||B))};async function T(B){let O=B!=null,N=typeof S.throw=="function";if(O&&N){let{value:H,done:K}=await S.throw(B);if(await H,K)return}if(typeof S.return=="function"){let{value:H}=await S.return();await H}}async function I(){for(;;){try{let{value:B,done:O}=M?await S.next():S.next();if(O)x.push(null);else{let N=B&&typeof B.then=="function"?await B:B;if(N===null)throw E=!1,new p;if(x.push(N))continue;E=!1}}catch(B){x.destroy(B)}break}}return x}return fY=v,fY}var hY={},NRe=!1,or=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function SR(){if(NRe)return hY;NRe=!0;let e=pn,{ArrayPrototypeIndexOf:r,NumberIsInteger:n,NumberIsNaN:l,NumberParseInt:i,ObjectDefineProperties:d,ObjectKeys:p,ObjectSetPrototypeOf:v,Promise:_,SafeSet:y,SymbolAsyncDispose:w,SymbolAsyncIterator:S,Symbol:M}=No();hY=Be,Be.ReadableState=Re;let{EventEmitter:x}=Ed,{Stream:E,prependListener:T}=yY(),{Buffer:I}=Oi(),{addAbortSignal:B}=_R(),O=hv(),N=Hf().debuglog("stream",oe=>{N=oe}),H=Rbt(),K=p3(),{getHighWaterMark:J,getDefaultHighWaterMark:L}=MR(),{aggregateTwoErrors:$,codes:{ERR_INVALID_ARG_TYPE:V,ERR_METHOD_NOT_IMPLEMENTED:h,ERR_OUT_OF_RANGE:t,ERR_STREAM_PUSH_AFTER_EOF:a,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:s},AbortError:u}=yh(),{validateObject:c}=F5(),b=M("kPaused"),{StringDecoder:m}=Lu,f=GRe();v(Be.prototype,E.prototype),v(Be,E);let o=()=>{},{errorOrDestroy:g}=K,A=1,R=2,k=4,q=8,Z=16,ne=32,G=64,D=128,W=256,ie=512,X=1024,z=2048,F=4096,Y=8192,ae=16384,de=32768,re=65536,fe=1<<17,ye=1<<18;function he(oe){return{enumerable:!1,get(){return((this||or).state&oe)!==0},set(Se){Se?(this||or).state|=oe:(this||or).state&=~oe}}}d(Re.prototype,{objectMode:he(A),ended:he(R),endEmitted:he(k),reading:he(q),constructed:he(Z),sync:he(ne),needReadable:he(G),emittedReadable:he(D),readableListening:he(W),resumeScheduled:he(ie),errorEmitted:he(X),emitClose:he(z),autoDestroy:he(F),destroyed:he(Y),closed:he(ae),closeEmitted:he(de),multiAwaitDrain:he(re),readingMore:he(fe),dataEmitted:he(ye)});function Re(oe,Se,$e){typeof $e!="boolean"&&($e=Se instanceof J1()),(this||or).state=z|F|Z|ne,oe&&oe.objectMode&&((this||or).state|=A),$e&&oe&&oe.readableObjectMode&&((this||or).state|=A),(this||or).highWaterMark=oe?J(this||or,oe,"readableHighWaterMark",$e):L(!1),(this||or).buffer=new H,(this||or).length=0,(this||or).pipes=[],(this||or).flowing=null,(this||or)[b]=null,oe&&oe.emitClose===!1&&((this||or).state&=~z),oe&&oe.autoDestroy===!1&&((this||or).state&=~F),(this||or).errored=null,(this||or).defaultEncoding=oe&&oe.defaultEncoding||"utf8",(this||or).awaitDrainWriters=null,(this||or).decoder=null,(this||or).encoding=null,oe&&oe.encoding&&((this||or).decoder=new m(oe.encoding),(this||or).encoding=oe.encoding)}function Be(oe){if(!((this||or)instanceof Be))return new Be(oe);let Se=(this||or)instanceof J1();(this||or)._readableState=new Re(oe,this||or,Se),oe&&(typeof oe.read=="function"&&((this||or)._read=oe.read),typeof oe.destroy=="function"&&((this||or)._destroy=oe.destroy),typeof oe.construct=="function"&&((this||or)._construct=oe.construct),oe.signal&&!Se&&B(oe.signal,this||or)),E.call(this||or,oe),K.construct(this||or,()=>{(this||or)._readableState.needReadable&&Q(this||or,(this||or)._readableState)})}Be.prototype.destroy=K.destroy,Be.prototype._undestroy=K.undestroy,Be.prototype._destroy=function(oe,Se){Se(oe)},Be.prototype[x.captureRejectionSymbol]=function(oe){this.destroy(oe)},Be.prototype[w]=function(){let oe;return(this||or).destroyed||(oe=(this||or).readableEnded?null:new u,this.destroy(oe)),new _((Se,$e)=>O(this||or,ge=>ge&&ge!==oe?$e(ge):Se(null)))},Be.prototype.push=function(oe,Se){return be(this||or,oe,Se,!1)},Be.prototype.unshift=function(oe,Se){return be(this||or,oe,Se,!0)};function be(oe,Se,$e,ge){N("readableAddChunk",Se);let Le=oe._readableState,Ze;if((Le.state&A)===0&&(typeof Se=="string"?($e=$e||Le.defaultEncoding,Le.encoding!==$e&&(ge&&Le.encoding?Se=I.from(Se,$e).toString(Le.encoding):(Se=I.from(Se,$e),$e=""))):Se instanceof I?$e="":E._isUint8Array(Se)?(Se=E._uint8ArrayToBuffer(Se),$e=""):Se!=null&&(Ze=new V("chunk",["string","Buffer","Uint8Array"],Se))),Ze)g(oe,Ze);else if(Se===null)Le.state&=~q,C(oe,Le);else if((Le.state&A)!==0||Se&&Se.length>0)if(ge)if((Le.state&k)!==0)g(oe,new s);else{if(Le.destroyed||Le.errored)return!1;Ne(oe,Le,Se,!0)}else if(Le.ended)g(oe,new a);else{if(Le.destroyed||Le.errored)return!1;Le.state&=~q,Le.decoder&&!$e?(Se=Le.decoder.write(Se),Le.objectMode||Se.length!==0?Ne(oe,Le,Se,!1):Q(oe,Le)):Ne(oe,Le,Se,!1)}else ge||(Le.state&=~q,Q(oe,Le));return!Le.ended&&(Le.length<Le.highWaterMark||Le.length===0)}function Ne(oe,Se,$e,ge){Se.flowing&&Se.length===0&&!Se.sync&&oe.listenerCount("data")>0?((Se.state&re)!==0?Se.awaitDrainWriters.clear():Se.awaitDrainWriters=null,Se.dataEmitted=!0,oe.emit("data",$e)):(Se.length+=Se.objectMode?1:$e.length,ge?Se.buffer.unshift($e):Se.buffer.push($e),(Se.state&G)!==0&&U(oe)),Q(oe,Se)}Be.prototype.isPaused=function(){let oe=(this||or)._readableState;return oe[b]===!0||oe.flowing===!1},Be.prototype.setEncoding=function(oe){let Se=new m(oe);(this||or)._readableState.decoder=Se,(this||or)._readableState.encoding=(this||or)._readableState.decoder.encoding;let $e=(this||or)._readableState.buffer,ge="";for(let Le of $e)ge+=Se.write(Le);return $e.clear(),ge!==""&&$e.push(ge),(this||or)._readableState.length=ge.length,this||or};let qe=1073741824;function j(oe){if(oe>qe)throw new t("size","<= 1GiB",oe);return oe--,oe|=oe>>>1,oe|=oe>>>2,oe|=oe>>>4,oe|=oe>>>8,oe|=oe>>>16,oe++,oe}function P(oe,Se){return oe<=0||Se.length===0&&Se.ended?0:(Se.state&A)!==0?1:l(oe)?Se.flowing&&Se.length?Se.buffer.first().length:Se.length:oe<=Se.length?oe:Se.ended?Se.length:0}Be.prototype.read=function(oe){N("read",oe),oe===void 0?oe=NaN:n(oe)||(oe=i(oe,10));let Se=(this||or)._readableState,$e=oe;if(oe>Se.highWaterMark&&(Se.highWaterMark=j(oe)),oe!==0&&(Se.state&=~D),oe===0&&Se.needReadable&&((Se.highWaterMark!==0?Se.length>=Se.highWaterMark:Se.length>0)||Se.ended))return N("read: emitReadable",Se.length,Se.ended),Se.length===0&&Se.ended?Oe(this||or):U(this||or),null;if(oe=P(oe,Se),oe===0&&Se.ended)return Se.length===0&&Oe(this||or),null;let ge=(Se.state&G)!==0;if(N("need readable",ge),(Se.length===0||Se.length-oe<Se.highWaterMark)&&(ge=!0,N("length less than watermark",ge)),Se.ended||Se.reading||Se.destroyed||Se.errored||!Se.constructed)ge=!1,N("reading, ended or constructing",ge);else if(ge){N("do read"),Se.state|=q|ne,Se.length===0&&(Se.state|=G);try{this._read(Se.highWaterMark)}catch(Ze){g(this||or,Ze)}Se.state&=~ne,Se.reading||(oe=P($e,Se))}let Le;return oe>0?Le=ve(oe,Se):Le=null,Le===null?(Se.needReadable=Se.length<=Se.highWaterMark,oe=0):(Se.length-=oe,Se.multiAwaitDrain?Se.awaitDrainWriters.clear():Se.awaitDrainWriters=null),Se.length===0&&(Se.ended||(Se.needReadable=!0),$e!==oe&&Se.ended&&Oe(this||or)),Le!==null&&!Se.errorEmitted&&!Se.closeEmitted&&(Se.dataEmitted=!0,this.emit("data",Le)),Le};function C(oe,Se){if(N("onEofChunk"),!Se.ended){if(Se.decoder){let $e=Se.decoder.end();$e&&$e.length&&(Se.buffer.push($e),Se.length+=Se.objectMode?1:$e.length)}Se.ended=!0,Se.sync?U(oe):(Se.needReadable=!1,Se.emittedReadable=!0,ee(oe))}}function U(oe){let Se=oe._readableState;N("emitReadable",Se.needReadable,Se.emittedReadable),Se.needReadable=!1,Se.emittedReadable||(N("emitReadable",Se.flowing),Se.emittedReadable=!0,e.nextTick(ee,oe))}function ee(oe){let Se=oe._readableState;N("emitReadable_",Se.destroyed,Se.length,Se.ended),!Se.destroyed&&!Se.errored&&(Se.length||Se.ended)&&(oe.emit("readable"),Se.emittedReadable=!1),Se.needReadable=!Se.flowing&&!Se.ended&&Se.length<=Se.highWaterMark,pe(oe)}function Q(oe,Se){!Se.readingMore&&Se.constructed&&(Se.readingMore=!0,e.nextTick(te,oe,Se))}function te(oe,Se){for(;!Se.reading&&!Se.ended&&(Se.length<Se.highWaterMark||Se.flowing&&Se.length===0);){let $e=Se.length;if(N("maybeReadMore read 0"),oe.read(0),$e===Se.length)break}Se.readingMore=!1}Be.prototype._read=function(oe){throw new h("_read()")},Be.prototype.pipe=function(oe,Se){let $e=this||or,ge=(this||or)._readableState;ge.pipes.length===1&&(ge.multiAwaitDrain||(ge.multiAwaitDrain=!0,ge.awaitDrainWriters=new y(ge.awaitDrainWriters?[ge.awaitDrainWriters]:[]))),ge.pipes.push(oe),N("pipe count=%d opts=%j",ge.pipes.length,Se);let Ze=(!Se||Se.end!==!1)&&oe!==e.stdout&&oe!==e.stderr?Ue:qt;ge.endEmitted?e.nextTick(Ze):$e.once("end",Ze),oe.on("unpipe",xe);function xe(zt,Ht){N("onunpipe"),zt===$e&&Ht&&Ht.hasUnpiped===!1&&(Ht.hasUnpiped=!0,He())}function Ue(){N("onend"),oe.end()}let Ve,Ae=!1;function He(){N("cleanup"),oe.removeListener("close",Dt),oe.removeListener("finish",$t),Ve&&oe.removeListener("drain",Ve),oe.removeListener("error",je),oe.removeListener("unpipe",xe),$e.removeListener("end",Ue),$e.removeListener("end",qt),$e.removeListener("data",ke),Ae=!0,Ve&&ge.awaitDrainWriters&&(!oe._writableState||oe._writableState.needDrain)&&Ve()}function Xe(){Ae||(ge.pipes.length===1&&ge.pipes[0]===oe?(N("false write response, pause",0),ge.awaitDrainWriters=oe,ge.multiAwaitDrain=!1):ge.pipes.length>1&&ge.pipes.includes(oe)&&(N("false write response, pause",ge.awaitDrainWriters.size),ge.awaitDrainWriters.add(oe)),$e.pause()),Ve||(Ve=le($e,oe),oe.on("drain",Ve))}$e.on("data",ke);function ke(zt){N("ondata");let Ht=oe.write(zt);N("dest.write",Ht),Ht===!1&&Xe()}function je(zt){if(N("onerror",zt),qt(),oe.removeListener("error",je),oe.listenerCount("error")===0){let Ht=oe._writableState||oe._readableState;Ht&&!Ht.errorEmitted?g(oe,zt):oe.emit("error",zt)}}T(oe,"error",je);function Dt(){oe.removeListener("finish",$t),qt()}oe.once("close",Dt);function $t(){N("onfinish"),oe.removeListener("close",Dt),qt()}oe.once("finish",$t);function qt(){N("unpipe"),$e.unpipe(oe)}return oe.emit("pipe",$e),oe.writableNeedDrain===!0?Xe():ge.flowing||(N("pipe resume"),$e.resume()),oe};function le(oe,Se){return function(){let ge=oe._readableState;ge.awaitDrainWriters===Se?(N("pipeOnDrain",1),ge.awaitDrainWriters=null):ge.multiAwaitDrain&&(N("pipeOnDrain",ge.awaitDrainWriters.size),ge.awaitDrainWriters.delete(Se)),(!ge.awaitDrainWriters||ge.awaitDrainWriters.size===0)&&oe.listenerCount("data")&&oe.resume()}}Be.prototype.unpipe=function(oe){let Se=(this||or)._readableState,$e={hasUnpiped:!1};if(Se.pipes.length===0)return this||or;if(!oe){let Le=Se.pipes;Se.pipes=[],this.pause();for(let Ze=0;Ze<Le.length;Ze++)Le[Ze].emit("unpipe",this||or,{hasUnpiped:!1});return this||or}let ge=r(Se.pipes,oe);return ge===-1?this||or:(Se.pipes.splice(ge,1),Se.pipes.length===0&&this.pause(),oe.emit("unpipe",this||or,$e),this||or)},Be.prototype.on=function(oe,Se){let $e=E.prototype.on.call(this||or,oe,Se),ge=(this||or)._readableState;return oe==="data"?(ge.readableListening=this.listenerCount("readable")>0,ge.flowing!==!1&&this.resume()):oe==="readable"&&!ge.endEmitted&&!ge.readableListening&&(ge.readableListening=ge.needReadable=!0,ge.flowing=!1,ge.emittedReadable=!1,N("on readable",ge.length,ge.reading),ge.length?U(this||or):ge.reading||e.nextTick(se,this||or)),$e},Be.prototype.addListener=Be.prototype.on,Be.prototype.removeListener=function(oe,Se){let $e=E.prototype.removeListener.call(this||or,oe,Se);return oe==="readable"&&e.nextTick(Ie,this||or),$e},Be.prototype.off=Be.prototype.removeListener,Be.prototype.removeAllListeners=function(oe){let Se=E.prototype.removeAllListeners.apply(this||or,arguments);return(oe==="readable"||oe===void 0)&&e.nextTick(Ie,this||or),Se};function Ie(oe){let Se=oe._readableState;Se.readableListening=oe.listenerCount("readable")>0,Se.resumeScheduled&&Se[b]===!1?Se.flowing=!0:oe.listenerCount("data")>0?oe.resume():Se.readableListening||(Se.flowing=null)}function se(oe){N("readable nexttick read 0"),oe.read(0)}Be.prototype.resume=function(){let oe=(this||or)._readableState;return oe.flowing||(N("resume"),oe.flowing=!oe.readableListening,Ee(this||or,oe)),oe[b]=!1,this||or};function Ee(oe,Se){Se.resumeScheduled||(Se.resumeScheduled=!0,e.nextTick(me,oe,Se))}function me(oe,Se){N("resume",Se.reading),Se.reading||oe.read(0),Se.resumeScheduled=!1,oe.emit("resume"),pe(oe),Se.flowing&&!Se.reading&&oe.read(0)}Be.prototype.pause=function(){return N("call pause flowing=%j",(this||or)._readableState.flowing),(this||or)._readableState.flowing!==!1&&(N("pause"),(this||or)._readableState.flowing=!1,this.emit("pause")),(this||or)._readableState[b]=!0,this||or};function pe(oe){let Se=oe._readableState;for(N("flow",Se.flowing);Se.flowing&&oe.read()!==null;);}Be.prototype.wrap=function(oe){let Se=!1;oe.on("data",ge=>{!this.push(ge)&&oe.pause&&(Se=!0,oe.pause())}),oe.on("end",()=>{this.push(null)}),oe.on("error",ge=>{g(this||or,ge)}),oe.on("close",()=>{this.destroy()}),oe.on("destroy",()=>{this.destroy()}),(this||or)._read=()=>{Se&&oe.resume&&(Se=!1,oe.resume())};let $e=p(oe);for(let ge=1;ge<$e.length;ge++){let Le=$e[ge];(this||or)[Le]===void 0&&typeof oe[Le]=="function"&&((this||or)[Le]=oe[Le].bind(oe))}return this||or},Be.prototype[S]=function(){return De(this||or)},Be.prototype.iterator=function(oe){return oe!==void 0&&c(oe,"options"),De(this||or,oe)};function De(oe,Se){typeof oe.read!="function"&&(oe=Be.wrap(oe,{objectMode:!0}));let $e=ue(oe,Se);return $e.stream=oe,$e}async function*ue(oe,Se){let $e=o;function ge(xe){(this||or)===oe?($e(),$e=o):$e=xe}oe.on("readable",ge);let Le,Ze=O(oe,{writable:!1},xe=>{Le=xe?$(Le,xe):null,$e(),$e=o});try{for(;;){let xe=oe.destroyed?null:oe.read();if(xe!==null)yield xe;else{if(Le)throw Le;if(Le===null)return;await new _(ge)}}}catch(xe){throw Le=$(Le,xe),Le}finally{(Le||Se?.destroyOnReturn!==!1)&&(Le===void 0||oe._readableState.autoDestroy)?K.destroyer(oe,null):(oe.off("readable",ge),Ze())}}d(Be.prototype,{readable:{__proto__:null,get(){let oe=(this||or)._readableState;return!!oe&&oe.readable!==!1&&!oe.destroyed&&!oe.errorEmitted&&!oe.endEmitted},set(oe){(this||or)._readableState&&((this||or)._readableState.readable=!!oe)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return(this||or)._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||or)._readableState.readable!==!1&&((this||or)._readableState.destroyed||(this||or)._readableState.errored)&&!(this||or)._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return(this||or)._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return(this||or)._readableState&&(this||or)._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return(this||or)._readableState.flowing},set:function(oe){(this||or)._readableState&&((this||or)._readableState.flowing=oe)}},readableLength:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.errored:null}},closed:{__proto__:null,get(){return(this||or)._readableState?(this||or)._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.destroyed:!1},set(oe){(this||or)._readableState&&((this||or)._readableState.destroyed=oe)}},readableEnded:{__proto__:null,enumerable:!1,get(){return(this||or)._readableState?(this||or)._readableState.endEmitted:!1}}}),d(Re.prototype,{pipesCount:{__proto__:null,get(){return(this||or).pipes.length}},paused:{__proto__:null,get(){return(this||or)[b]!==!1},set(oe){(this||or)[b]=!!oe}}}),Be._fromList=ve;function ve(oe,Se){if(Se.length===0)return null;let $e;return Se.objectMode?$e=Se.buffer.shift():!oe||oe>=Se.length?(Se.decoder?$e=Se.buffer.join(""):Se.buffer.length===1?$e=Se.buffer.first():$e=Se.buffer.concat(Se.length),Se.buffer.clear()):$e=Se.buffer.consume(oe,Se.decoder),$e}function Oe(oe){let Se=oe._readableState;N("endReadable",Se.endEmitted),Se.endEmitted||(Se.ended=!0,e.nextTick(Te,Se,oe))}function Te(oe,Se){if(N("endReadableNT",oe.endEmitted,oe.length),!oe.errored&&!oe.closeEmitted&&!oe.endEmitted&&oe.length===0){if(oe.endEmitted=!0,Se.emit("end"),Se.writable&&Se.allowHalfOpen===!1)e.nextTick(ce,Se);else if(oe.autoDestroy){let $e=Se._writableState;(!$e||$e.autoDestroy&&($e.finished||$e.writable===!1))&&Se.destroy()}}}function ce(oe){oe.writable&&!oe.writableEnded&&!oe.destroyed&&oe.end()}Be.from=function(oe,Se){return f(Be,oe,Se)};let Pe;function Ke(){return Pe===void 0&&(Pe={}),Pe}return Be.fromWeb=function(oe,Se){return Ke().newStreamReadableFromReadableStream(oe,Se)},Be.toWeb=function(oe,Se){return Ke().newReadableStreamFromStreamReadable(oe,Se)},Be.wrap=function(oe,Se){var $e,ge;return new Be({objectMode:($e=(ge=oe.readableObjectMode)!==null&&ge!==void 0?ge:oe.objectMode)!==null&&$e!==void 0?$e:!0,...Se,destroy(Le,Ze){K.destroyer(oe,Le),Ze(Le)}}).wrap(oe)},hY}var uY={},CRe=!1,ur=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function wY(){if(CRe)return uY;CRe=!0;let e=pn,{ArrayPrototypeSlice:r,Error:n,FunctionPrototypeSymbolHasInstance:l,ObjectDefineProperty:i,ObjectDefineProperties:d,ObjectSetPrototypeOf:p,StringPrototypeToLowerCase:v,Symbol:_,SymbolHasInstance:y}=No();uY=c,c.WritableState=s;let{EventEmitter:w}=Ed,S=yY().Stream,{Buffer:M}=Oi(),x=p3(),{addAbortSignal:E}=_R(),{getHighWaterMark:T,getDefaultHighWaterMark:I}=MR(),{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:O,ERR_MULTIPLE_CALLBACK:N,ERR_STREAM_CANNOT_PIPE:H,ERR_STREAM_DESTROYED:K,ERR_STREAM_ALREADY_FINISHED:J,ERR_STREAM_NULL_VALUES:L,ERR_STREAM_WRITE_AFTER_END:$,ERR_UNKNOWN_ENCODING:V}=yh().codes,{errorOrDestroy:h}=x;p(c.prototype,S.prototype),p(c,S);function t(){}let a=_("kOnFinished");function s(F,Y,ae){typeof ae!="boolean"&&(ae=Y instanceof J1()),(this||ur).objectMode=!!(F&&F.objectMode),ae&&((this||ur).objectMode=(this||ur).objectMode||!!(F&&F.writableObjectMode)),(this||ur).highWaterMark=F?T(this||ur,F,"writableHighWaterMark",ae):I(!1),(this||ur).finalCalled=!1,(this||ur).needDrain=!1,(this||ur).ending=!1,(this||ur).ended=!1,(this||ur).finished=!1,(this||ur).destroyed=!1;let de=!!(F&&F.decodeStrings===!1);(this||ur).decodeStrings=!de,(this||ur).defaultEncoding=F&&F.defaultEncoding||"utf8",(this||ur).length=0,(this||ur).writing=!1,(this||ur).corked=0,(this||ur).sync=!0,(this||ur).bufferProcessing=!1,(this||ur).onwrite=g.bind(void 0,Y),(this||ur).writecb=null,(this||ur).writelen=0,(this||ur).afterWriteTickInfo=null,u(this||ur),(this||ur).pendingcb=0,(this||ur).constructed=!0,(this||ur).prefinished=!1,(this||ur).errorEmitted=!1,(this||ur).emitClose=!F||F.emitClose!==!1,(this||ur).autoDestroy=!F||F.autoDestroy!==!1,(this||ur).errored=null,(this||ur).closed=!1,(this||ur).closeEmitted=!1,(this||ur)[a]=[]}function u(F){F.buffered=[],F.bufferedIndex=0,F.allBuffers=!0,F.allNoop=!0}s.prototype.getBuffer=function(){return r((this||ur).buffered,(this||ur).bufferedIndex)},i(s.prototype,"bufferedRequestCount",{__proto__:null,get(){return(this||ur).buffered.length-(this||ur).bufferedIndex}});function c(F){let Y=(this||ur)instanceof J1();if(!Y&&!l(c,this||ur))return new c(F);(this||ur)._writableState=new s(F,this||ur,Y),F&&(typeof F.write=="function"&&((this||ur)._write=F.write),typeof F.writev=="function"&&((this||ur)._writev=F.writev),typeof F.destroy=="function"&&((this||ur)._destroy=F.destroy),typeof F.final=="function"&&((this||ur)._final=F.final),typeof F.construct=="function"&&((this||ur)._construct=F.construct),F.signal&&E(F.signal,this||ur)),S.call(this||ur,F),x.construct(this||ur,()=>{let ae=(this||ur)._writableState;ae.writing||q(this||ur,ae),D(this||ur,ae)})}i(c,y,{__proto__:null,value:function(F){return l(this||ur,F)?!0:(this||ur)!==c?!1:F&&F._writableState instanceof s}}),c.prototype.pipe=function(){h(this||ur,new H)};function b(F,Y,ae,de){let re=F._writableState;if(typeof ae=="function")de=ae,ae=re.defaultEncoding;else{if(!ae)ae=re.defaultEncoding;else if(ae!=="buffer"&&!M.isEncoding(ae))throw new V(ae);typeof de!="function"&&(de=t)}if(Y===null)throw new L;if(!re.objectMode)if(typeof Y=="string")re.decodeStrings!==!1&&(Y=M.from(Y,ae),ae="buffer");else if(Y instanceof M)ae="buffer";else if(S._isUint8Array(Y))Y=S._uint8ArrayToBuffer(Y),ae="buffer";else throw new B("chunk",["string","Buffer","Uint8Array"],Y);let fe;return re.ending?fe=new $:re.destroyed&&(fe=new K("write")),fe?(e.nextTick(de,fe),h(F,fe,!0),fe):(re.pendingcb++,m(F,re,Y,ae,de))}c.prototype.write=function(F,Y,ae){return b(this||ur,F,Y,ae)===!0},c.prototype.cork=function(){(this||ur)._writableState.corked++},c.prototype.uncork=function(){let F=(this||ur)._writableState;F.corked&&(F.corked--,F.writing||q(this||ur,F))},c.prototype.setDefaultEncoding=function(Y){if(typeof Y=="string"&&(Y=v(Y)),!M.isEncoding(Y))throw new V(Y);return(this||ur)._writableState.defaultEncoding=Y,this||ur};function m(F,Y,ae,de,re){let fe=Y.objectMode?1:ae.length;Y.length+=fe;let ye=Y.length<Y.highWaterMark;return ye||(Y.needDrain=!0),Y.writing||Y.corked||Y.errored||!Y.constructed?(Y.buffered.push({chunk:ae,encoding:de,callback:re}),Y.allBuffers&&de!=="buffer"&&(Y.allBuffers=!1),Y.allNoop&&re!==t&&(Y.allNoop=!1)):(Y.writelen=fe,Y.writecb=re,Y.writing=!0,Y.sync=!0,F._write(ae,de,Y.onwrite),Y.sync=!1),ye&&!Y.errored&&!Y.destroyed}function f(F,Y,ae,de,re,fe,ye){Y.writelen=de,Y.writecb=ye,Y.writing=!0,Y.sync=!0,Y.destroyed?Y.onwrite(new K("write")):ae?F._writev(re,Y.onwrite):F._write(re,fe,Y.onwrite),Y.sync=!1}function o(F,Y,ae,de){--Y.pendingcb,de(ae),k(Y),h(F,ae)}function g(F,Y){let ae=F._writableState,de=ae.sync,re=ae.writecb;if(typeof re!="function"){h(F,new N);return}ae.writing=!1,ae.writecb=null,ae.length-=ae.writelen,ae.writelen=0,Y?(Y.stack,ae.errored||(ae.errored=Y),F._readableState&&!F._readableState.errored&&(F._readableState.errored=Y),de?e.nextTick(o,F,ae,Y,re):o(F,ae,Y,re)):(ae.buffered.length>ae.bufferedIndex&&q(F,ae),de?ae.afterWriteTickInfo!==null&&ae.afterWriteTickInfo.cb===re?ae.afterWriteTickInfo.count++:(ae.afterWriteTickInfo={count:1,cb:re,stream:F,state:ae},e.nextTick(A,ae.afterWriteTickInfo)):R(F,ae,1,re))}function A({stream:F,state:Y,count:ae,cb:de}){return Y.afterWriteTickInfo=null,R(F,Y,ae,de)}function R(F,Y,ae,de){for(!Y.ending&&!F.destroyed&&Y.length===0&&Y.needDrain&&(Y.needDrain=!1,F.emit("drain"));ae-- >0;)Y.pendingcb--,de();Y.destroyed&&k(Y),D(F,Y)}function k(F){if(F.writing)return;for(let re=F.bufferedIndex;re<F.buffered.length;++re){var Y;let{chunk:fe,callback:ye}=F.buffered[re],he=F.objectMode?1:fe.length;F.length-=he,ye((Y=F.errored)!==null&&Y!==void 0?Y:new K("write"))}let ae=F[a].splice(0);for(let re=0;re<ae.length;re++){var de;ae[re]((de=F.errored)!==null&&de!==void 0?de:new K("end"))}u(F)}function q(F,Y){if(Y.corked||Y.bufferProcessing||Y.destroyed||!Y.constructed)return;let{buffered:ae,bufferedIndex:de,objectMode:re}=Y,fe=ae.length-de;if(!fe)return;let ye=de;if(Y.bufferProcessing=!0,fe>1&&F._writev){Y.pendingcb-=fe-1;let he=Y.allNoop?t:Be=>{for(let be=ye;be<ae.length;++be)ae[be].callback(Be)},Re=Y.allNoop&&ye===0?ae:r(ae,ye);Re.allBuffers=Y.allBuffers,f(F,Y,!0,Y.length,Re,"",he),u(Y)}else{do{let{chunk:he,encoding:Re,callback:Be}=ae[ye];ae[ye++]=null;let be=re?1:he.length;f(F,Y,!1,be,he,Re,Be)}while(ye<ae.length&&!Y.writing);ye===ae.length?u(Y):ye>256?(ae.splice(0,ye),Y.bufferedIndex=0):Y.bufferedIndex=ye}Y.bufferProcessing=!1}c.prototype._write=function(F,Y,ae){if((this||ur)._writev)this._writev([{chunk:F,encoding:Y}],ae);else throw new O("_write()")},c.prototype._writev=null,c.prototype.end=function(F,Y,ae){let de=(this||ur)._writableState;typeof F=="function"?(ae=F,F=null,Y=null):typeof Y=="function"&&(ae=Y,Y=null);let re;if(F!=null){let fe=b(this||ur,F,Y);fe instanceof n&&(re=fe)}return de.corked&&(de.corked=1,this.uncork()),re||(!de.errored&&!de.ending?(de.ending=!0,D(this||ur,de,!0),de.ended=!0):de.finished?re=new J("end"):de.destroyed&&(re=new K("end"))),typeof ae=="function"&&(re||de.finished?e.nextTick(ae,re):de[a].push(ae)),this||ur};function Z(F){return F.ending&&!F.destroyed&&F.constructed&&F.length===0&&!F.errored&&F.buffered.length===0&&!F.finished&&!F.writing&&!F.errorEmitted&&!F.closeEmitted}function ne(F,Y){let ae=!1;function de(re){if(ae){h(F,re??N());return}if(ae=!0,Y.pendingcb--,re){let fe=Y[a].splice(0);for(let ye=0;ye<fe.length;ye++)fe[ye](re);h(F,re,Y.sync)}else Z(Y)&&(Y.prefinished=!0,F.emit("prefinish"),Y.pendingcb++,e.nextTick(W,F,Y))}Y.sync=!0,Y.pendingcb++;try{F._final(de)}catch(re){de(re)}Y.sync=!1}function G(F,Y){!Y.prefinished&&!Y.finalCalled&&(typeof F._final=="function"&&!Y.destroyed?(Y.finalCalled=!0,ne(F,Y)):(Y.prefinished=!0,F.emit("prefinish")))}function D(F,Y,ae){Z(Y)&&(G(F,Y),Y.pendingcb===0&&(ae?(Y.pendingcb++,e.nextTick((de,re)=>{Z(re)?W(de,re):re.pendingcb--},F,Y)):Z(Y)&&(Y.pendingcb++,W(F,Y))))}function W(F,Y){Y.pendingcb--,Y.finished=!0;let ae=Y[a].splice(0);for(let de=0;de<ae.length;de++)ae[de]();if(F.emit("finish"),Y.autoDestroy){let de=F._readableState;(!de||de.autoDestroy&&(de.endEmitted||de.readable===!1))&&F.destroy()}}d(c.prototype,{closed:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.closed:!1}},destroyed:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.destroyed:!1},set(F){(this||ur)._writableState&&((this||ur)._writableState.destroyed=F)}},writable:{__proto__:null,get(){let F=(this||ur)._writableState;return!!F&&F.writable!==!1&&!F.destroyed&&!F.errored&&!F.ending&&!F.ended},set(F){(this||ur)._writableState&&((this||ur)._writableState.writable=!!F)}},writableFinished:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return(this||ur)._writableState&&(this||ur)._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let F=(this||ur)._writableState;return F?!F.destroyed&&!F.ending&&F.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return(this||ur)._writableState&&(this||ur)._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return(this||ur)._writableState?(this||ur)._writableState.corked:0}},writableLength:{__proto__:null,get(){return(this||ur)._writableState&&(this||ur)._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return(this||ur)._writableState?(this||ur)._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||ur)._writableState.writable!==!1&&((this||ur)._writableState.destroyed||(this||ur)._writableState.errored)&&!(this||ur)._writableState.finished)}}});let ie=x.destroy;c.prototype.destroy=function(F,Y){let ae=(this||ur)._writableState;return!ae.destroyed&&(ae.bufferedIndex<ae.buffered.length||ae[a].length)&&e.nextTick(k,ae),ie.call(this||ur,F,Y),this||ur},c.prototype._undestroy=x.undestroy,c.prototype._destroy=function(F,Y){Y(F)},c.prototype[w.captureRejectionSymbol]=function(F){this.destroy(F)};let X;function z(){return X===void 0&&(X={}),X}return c.fromWeb=function(F,Y){return z().newStreamWritableFromWritableStream(F,Y)},c.toWeb=function(F){return z().newWritableStreamFromStreamWritable(F)},uY}var lY={},LRe=!1;function Tbt(){if(LRe)return lY;LRe=!0;let e=pn,r=Oi(),{isReadable:n,isWritable:l,isIterable:i,isNodeStream:d,isReadableNodeStream:p,isWritableNodeStream:v,isDuplexNodeStream:_,isReadableStream:y,isWritableStream:w}=X1(),S=hv(),{AbortError:M,codes:{ERR_INVALID_ARG_TYPE:x,ERR_INVALID_RETURN_VALUE:E}}=yh(),{destroyer:T}=p3(),I=J1(),B=SR(),O=wY(),{createDeferredPromise:N}=Hf(),H=GRe(),K=globalThis.Blob||r.Blob,J=typeof K<"u"?function(s){return s instanceof K}:function(s){return!1},L=globalThis.AbortController||j5().AbortController,{FunctionPrototypeCall:$}=No();class V extends I{constructor(s){super(s),s?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),s?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}lY=function a(s,u){if(_(s))return s;if(p(s))return t({readable:s});if(v(s))return t({writable:s});if(d(s))return t({writable:!1,readable:!1});if(y(s))return t({readable:B.fromWeb(s)});if(w(s))return t({writable:O.fromWeb(s)});if(typeof s=="function"){let{value:b,write:m,final:f,destroy:o}=h(s);if(i(b))return H(V,b,{objectMode:!0,write:m,final:f,destroy:o});let g=b?.then;if(typeof g=="function"){let A,R=$(g,b,k=>{if(k!=null)throw new E("nully","body",k)},k=>{T(A,k)});return A=new V({objectMode:!0,readable:!1,write:m,final(k){f(async()=>{try{await R,e.nextTick(k,null)}catch(q){e.nextTick(k,q)}})},destroy:o})}throw new E("Iterable, AsyncIterable or AsyncFunction",u,b)}if(J(s))return a(s.arrayBuffer());if(i(s))return H(V,s,{objectMode:!0,writable:!1});if(y(s?.readable)&&w(s?.writable))return V.fromWeb(s);if(typeof s?.writable=="object"||typeof s?.readable=="object"){let b=s!=null&&s.readable?p(s?.readable)?s?.readable:a(s.readable):void 0,m=s!=null&&s.writable?v(s?.writable)?s?.writable:a(s.writable):void 0;return t({readable:b,writable:m})}let c=s?.then;if(typeof c=="function"){let b;return $(c,s,m=>{m!=null&&b.push(m),b.push(null)},m=>{T(b,m)}),b=new V({objectMode:!0,writable:!1,read(){}})}throw new x(u,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],s)};function h(a){let{promise:s,resolve:u}=N(),c=new L,b=c.signal;return{value:a(async function*(){for(;;){let f=s;s=null;let{chunk:o,done:g,cb:A}=await f;if(e.nextTick(A),g)return;if(b.aborted)throw new M(void 0,{cause:b.reason});({promise:s,resolve:u}=N()),yield o}}(),{signal:b}),write(f,o,g){let A=u;u=null,A({chunk:f,done:!1,cb:g})},final(f){let o=u;u=null,o({done:!0,cb:f})},destroy(f,o){c.abort(),o(f)}}}function t(a){let s=a.readable&&typeof a.readable.read!="function"?B.wrap(a.readable):a.readable,u=a.writable,c=!!n(s),b=!!l(u),m,f,o,g,A;function R(k){let q=g;g=null,q?q(k):k&&A.destroy(k)}return A=new V({readableObjectMode:!!(s!=null&&s.readableObjectMode),writableObjectMode:!!(u!=null&&u.writableObjectMode),readable:c,writable:b}),b&&(S(u,k=>{b=!1,k&&T(s,k),R(k)}),A._write=function(k,q,Z){u.write(k,q)?Z():m=Z},A._final=function(k){u.end(),f=k},u.on("drain",function(){if(m){let k=m;m=null,k()}}),u.on("finish",function(){if(f){let k=f;f=null,k()}})),c&&(S(s,k=>{c=!1,k&&T(s,k),R(k)}),s.on("readable",function(){if(o){let k=o;o=null,k()}}),s.on("end",function(){A.push(null)}),A._read=function(){for(;;){let k=s.read();if(k===null){o=A._read;return}if(!A.push(k))return}}),A._destroy=function(k,q){!k&&g!==null&&(k=new M),o=null,m=null,f=null,g===null?q(k):(g=q,T(u,k),T(s,k))},A}return lY}var cY={},DRe=!1;function J1(){if(DRe)return cY;DRe=!0;let{ObjectDefineProperties:e,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:n,ObjectSetPrototypeOf:l}=No();cY=p;let i=SR(),d=wY();l(p.prototype,i.prototype),l(p,i);{let w=n(d.prototype);for(let S=0;S<w.length;S++){let M=w[S];p.prototype[M]||(p.prototype[M]=d.prototype[M])}}function p(w){if(!(this instanceof p))return new p(w);i.call(this,w),d.call(this,w),w?(this.allowHalfOpen=w.allowHalfOpen!==!1,w.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),w.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}e(p.prototype,{writable:{__proto__:null,...r(d.prototype,"writable")},writableHighWaterMark:{__proto__:null,...r(d.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...r(d.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...r(d.prototype,"writableBuffer")},writableLength:{__proto__:null,...r(d.prototype,"writableLength")},writableFinished:{__proto__:null,...r(d.prototype,"writableFinished")},writableCorked:{__proto__:null,...r(d.prototype,"writableCorked")},writableEnded:{__proto__:null,...r(d.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...r(d.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(w){this._readableState&&this._writableState&&(this._readableState.destroyed=w,this._writableState.destroyed=w)}}});let v;function _(){return v===void 0&&(v={}),v}p.fromWeb=function(w,S){return _().newStreamDuplexFromReadableWritablePair(w,S)},p.toWeb=function(w){return _().newReadableWritablePairFromDuplex(w)};let y;return p.from=function(w){return y||(y=Tbt()),y(w,"body")},cY}var dY={},$Re=!1;function VRe(){if($Re)return dY;$Re=!0;let{ObjectSetPrototypeOf:e,Symbol:r}=No();dY=p;let{ERR_METHOD_NOT_IMPLEMENTED:n}=yh().codes,l=J1(),{getHighWaterMark:i}=MR();e(p.prototype,l.prototype),e(p,l);let d=r("kCallback");function p(y){if(!(this instanceof p))return new p(y);let w=y?i(this,y,"readableHighWaterMark",!0):null;w===0&&(y={...y,highWaterMark:null,readableHighWaterMark:w,writableHighWaterMark:y.writableHighWaterMark||0}),l.call(this,y),this._readableState.sync=!1,this[d]=null,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",_)}function v(y){typeof this._flush=="function"&&!this.destroyed?this._flush((w,S)=>{if(w){y?y(w):this.destroy(w);return}S!=null&&this.push(S),this.push(null),y&&y()}):(this.push(null),y&&y())}function _(){this._final!==v&&v.call(this)}return p.prototype._final=v,p.prototype._transform=function(y,w,S){throw new n("_transform()")},p.prototype._write=function(y,w,S){let M=this._readableState,x=this._writableState,E=M.length;this._transform(y,w,(T,I)=>{if(T){S(T);return}I!=null&&this.push(I),x.ended||E===M.length||M.length<M.highWaterMark?S():this[d]=S})},p.prototype._read=function(){if(this[d]){let y=this[d];this[d]=null,y()}},dY}var pY={},qRe=!1;function YRe(){if(qRe)return pY;qRe=!0;let{ObjectSetPrototypeOf:e}=No();pY=n;let r=VRe();e(n.prototype,r.prototype),e(n,r);function n(l){if(!(this instanceof n))return new n(l);r.call(this,l)}return n.prototype._transform=function(l,i,d){d(null,l)},pY}var mY={},URe=!1;function _Y(){if(URe)return mY;URe=!0;let e=pn,{ArrayIsArray:r,Promise:n,SymbolAsyncIterator:l,SymbolDispose:i}=No(),d=hv(),{once:p}=Hf(),v=p3(),_=J1(),{aggregateTwoErrors:y,codes:{ERR_INVALID_ARG_TYPE:w,ERR_INVALID_RETURN_VALUE:S,ERR_MISSING_ARGS:M,ERR_STREAM_DESTROYED:x,ERR_STREAM_PREMATURE_CLOSE:E},AbortError:T}=yh(),{validateFunction:I,validateAbortSignal:B}=F5(),{isIterable:O,isReadable:N,isReadableNodeStream:H,isNodeStream:K,isTransformStream:J,isWebStream:L,isReadableStream:$,isReadableFinished:V}=X1(),h=globalThis.AbortController||j5().AbortController,t,a,s;function u(k,q,Z){let ne=!1;k.on("close",()=>{ne=!0});let G=d(k,{readable:q,writable:Z},D=>{ne=!D});return{destroy:D=>{ne||(ne=!0,v.destroyer(k,D||new x("pipe")))},cleanup:G}}function c(k){return I(k[k.length-1],"streams[stream.length - 1]"),k.pop()}function b(k){if(O(k))return k;if(H(k))return m(k);throw new w("val",["Readable","Iterable","AsyncIterable"],k)}async function*m(k){a||(a=SR()),yield*a.prototype[l].call(k)}async function f(k,q,Z,{end:ne}){let G,D=null,W=z=>{if(z&&(G=z),D){let F=D;D=null,F()}},ie=()=>new n((z,F)=>{G?F(G):D=()=>{G?F(G):z()}});q.on("drain",W);let X=d(q,{readable:!1},W);try{q.writableNeedDrain&&await ie();for await(let z of k)q.write(z)||await ie();ne&&(q.end(),await ie()),Z()}catch(z){Z(G!==z?y(G,z):z)}finally{X(),q.off("drain",W)}}async function o(k,q,Z,{end:ne}){J(q)&&(q=q.writable);let G=q.getWriter();try{for await(let D of k)await G.ready,G.write(D).catch(()=>{});await G.ready,ne&&await G.close(),Z()}catch(D){try{await G.abort(D),Z(D)}catch(W){Z(W)}}}function g(...k){return A(k,p(c(k)))}function A(k,q,Z){if(k.length===1&&r(k[0])&&(k=k[0]),k.length<2)throw new M("streams");let ne=new h,G=ne.signal,D=Z?.signal,W=[];B(D,"options.signal");function ie(){re(new T)}s=s||Hf().addAbortListener;let X;D&&(X=s(D,ie));let z,F,Y=[],ae=0;function de(Be){re(Be,--ae===0)}function re(Be,be){var Ne;if(Be&&(!z||z.code==="ERR_STREAM_PREMATURE_CLOSE")&&(z=Be),!(!z&&!be)){for(;Y.length;)Y.shift()(z);(Ne=X)===null||Ne===void 0||Ne[i](),ne.abort(),be&&(z||W.forEach(qe=>qe()),e.nextTick(q,z,F))}}let fe;for(let Be=0;Be<k.length;Be++){let be=k[Be],Ne=Be<k.length-1,qe=Be>0,j=Ne||Z?.end!==!1,P=Be===k.length-1;if(K(be)){let C=function(U){U&&U.name!=="AbortError"&&U.code!=="ERR_STREAM_PREMATURE_CLOSE"&&de(U)};var Re=C;if(j){let{destroy:U,cleanup:ee}=u(be,Ne,qe);Y.push(U),N(be)&&P&&W.push(ee)}be.on("error",C),N(be)&&P&&W.push(()=>{be.removeListener("error",C)})}if(Be===0)if(typeof be=="function"){if(fe=be({signal:G}),!O(fe))throw new S("Iterable, AsyncIterable or Stream","source",fe)}else O(be)||H(be)||J(be)?fe=be:fe=_.from(be);else if(typeof be=="function"){if(J(fe)){var ye;fe=b((ye=fe)===null||ye===void 0?void 0:ye.readable)}else fe=b(fe);if(fe=be(fe,{signal:G}),Ne){if(!O(fe,!0))throw new S("AsyncIterable",`transform[${Be-1}]`,fe)}else{var he;t||(t=YRe());let C=new t({objectMode:!0}),U=(he=fe)===null||he===void 0?void 0:he.then;if(typeof U=="function")ae++,U.call(fe,te=>{F=te,te!=null&&C.write(te),j&&C.end(),e.nextTick(de)},te=>{C.destroy(te),e.nextTick(de,te)});else if(O(fe,!0))ae++,f(fe,C,de,{end:j});else if($(fe)||J(fe)){let te=fe.readable||fe;ae++,f(te,C,de,{end:j})}else throw new S("AsyncIterable or Promise","destination",fe);fe=C;let{destroy:ee,cleanup:Q}=u(fe,!1,!0);Y.push(ee),P&&W.push(Q)}}else if(K(be)){if(H(fe)){ae+=2;let C=R(fe,be,de,{end:j});N(be)&&P&&W.push(C)}else if(J(fe)||$(fe)){let C=fe.readable||fe;ae++,f(C,be,de,{end:j})}else if(O(fe))ae++,f(fe,be,de,{end:j});else throw new w("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],fe);fe=be}else if(L(be)){if(H(fe))ae++,o(b(fe),be,de,{end:j});else if($(fe)||O(fe))ae++,o(fe,be,de,{end:j});else if(J(fe))ae++,o(fe.readable,be,de,{end:j});else throw new w("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],fe);fe=be}else fe=_.from(be)}return(G!=null&&G.aborted||D!=null&&D.aborted)&&e.nextTick(ie),fe}function R(k,q,Z,{end:ne}){let G=!1;if(q.on("close",()=>{G||Z(new E)}),k.pipe(q,{end:!1}),ne){let W=function(){G=!0,q.end()};var D=W;V(k)?e.nextTick(W):k.once("end",W)}else Z();return d(k,{readable:!0,writable:!1},W=>{let ie=k._readableState;W&&W.code==="ERR_STREAM_PREMATURE_CLOSE"&&ie&&ie.ended&&!ie.errored&&!ie.errorEmitted?k.once("end",Z).once("error",Z):Z(W)}),d(q,{readable:!1,writable:!0},Z)}return mY={pipelineImpl:A,pipeline:g},mY}var vY={},jRe=!1;function JRe(){if(jRe)return vY;jRe=!0;let{pipeline:e}=_Y(),r=J1(),{destroyer:n}=p3(),{isNodeStream:l,isReadable:i,isWritable:d,isWebStream:p,isTransformStream:v,isWritableStream:_,isReadableStream:y}=X1(),{AbortError:w,codes:{ERR_INVALID_ARG_VALUE:S,ERR_MISSING_ARGS:M}}=yh(),x=hv();return vY=function(...T){if(T.length===0)throw new M("streams");if(T.length===1)return r.from(T[0]);let I=[...T];if(typeof T[0]=="function"&&(T[0]=r.from(T[0])),typeof T[T.length-1]=="function"){let t=T.length-1;T[t]=r.from(T[t])}for(let t=0;t<T.length;++t)if(!(!l(T[t])&&!p(T[t]))){if(t<T.length-1&&!(i(T[t])||y(T[t])||v(T[t])))throw new S(`streams[${t}]`,I[t],"must be readable");if(t>0&&!(d(T[t])||_(T[t])||v(T[t])))throw new S(`streams[${t}]`,I[t],"must be writable")}let B,O,N,H,K;function J(t){let a=H;H=null,a?a(t):t?K.destroy(t):!h&&!V&&K.destroy()}let L=T[0],$=e(T,J),V=!!(d(L)||_(L)||v(L)),h=!!(i($)||y($)||v($));if(K=new r({writableObjectMode:!!(L!=null&&L.writableObjectMode),readableObjectMode:!!($!=null&&$.readableObjectMode),writable:V,readable:h}),V){if(l(L))K._write=function(a,s,u){L.write(a,s)?u():B=u},K._final=function(a){L.end(),O=a},L.on("drain",function(){if(B){let a=B;B=null,a()}});else if(p(L)){let s=(v(L)?L.writable:L).getWriter();K._write=async function(u,c,b){try{await s.ready,s.write(u).catch(()=>{}),b()}catch(m){b(m)}},K._final=async function(u){try{await s.ready,s.close().catch(()=>{}),O=u}catch(c){u(c)}}}let t=v($)?$.readable:$;x(t,()=>{if(O){let a=O;O=null,a()}})}if(h){if(l($))$.on("readable",function(){if(N){let t=N;N=null,t()}}),$.on("end",function(){K.push(null)}),K._read=function(){for(;;){let t=$.read();if(t===null){N=K._read;return}if(!K.push(t))return}};else if(p($)){let a=(v($)?$.readable:$).getReader();K._read=async function(){for(;;)try{let{value:s,done:u}=await a.read();if(!K.push(s))return;if(u){K.push(null);return}}catch{return}}}}return K._destroy=function(t,a){!t&&H!==null&&(t=new w),N=null,B=null,O=null,H===null?a(t):(H=a,l($)&&n($,t))},K},vY}var wR={},FRe=!1;function Ibt(){if(FRe)return wR;FRe=!0;let e=globalThis.AbortController||j5().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:n,ERR_MISSING_ARGS:l,ERR_OUT_OF_RANGE:i},AbortError:d}=yh(),{validateAbortSignal:p,validateInteger:v,validateObject:_}=F5(),y=No().Symbol("kWeak"),w=No().Symbol("kResistStopPropagation"),{finished:S}=hv(),M=JRe(),{addAbortSignalNoValidate:x}=_R(),{isWritable:E,isNodeStream:T}=X1(),{deprecate:I}=Hf(),{ArrayPrototypePush:B,Boolean:O,MathFloor:N,Number:H,NumberIsNaN:K,Promise:J,PromiseReject:L,PromiseResolve:$,PromisePrototypeThen:V,Symbol:h}=No(),t=h("kEmpty"),a=h("kEof");function s(D,W){if(W!=null&&_(W,"options"),W?.signal!=null&&p(W.signal,"options.signal"),T(D)&&!E(D))throw new r("stream",D,"must be writable");let ie=M(this,D);return W!=null&&W.signal&&x(W.signal,ie),ie}function u(D,W){if(typeof D!="function")throw new n("fn",["Function","AsyncFunction"],D);W!=null&&_(W,"options"),W?.signal!=null&&p(W.signal,"options.signal");let ie=1;W?.concurrency!=null&&(ie=N(W.concurrency));let X=ie-1;return W?.highWaterMark!=null&&(X=N(W.highWaterMark)),v(ie,"options.concurrency",1),v(X,"options.highWaterMark",0),X+=ie,async function*(){let F=Hf().AbortSignalAny([W?.signal].filter(O)),Y=this,ae=[],de={signal:F},re,fe,ye=!1,he=0;function Re(){ye=!0,Be()}function Be(){he-=1,be()}function be(){fe&&!ye&&he<ie&&ae.length<X&&(fe(),fe=null)}async function Ne(){try{for await(let qe of Y){if(ye)return;if(F.aborted)throw new d;try{if(qe=D(qe,de),qe===t)continue;qe=$(qe)}catch(j){qe=L(j)}he+=1,V(qe,Be,Re),ae.push(qe),re&&(re(),re=null),!ye&&(ae.length>=X||he>=ie)&&await new J(j=>{fe=j})}ae.push(a)}catch(qe){let j=L(qe);V(j,Be,Re),ae.push(j)}finally{ye=!0,re&&(re(),re=null)}}Ne();try{for(;;){for(;ae.length>0;){let qe=await ae[0];if(qe===a)return;if(F.aborted)throw new d;qe!==t&&(yield qe),ae.shift(),be()}await new J(qe=>{re=qe})}}finally{ye=!0,fe&&(fe(),fe=null)}}.call(this)}function c(D=void 0){return D!=null&&_(D,"options"),D?.signal!=null&&p(D.signal,"options.signal"),async function*(){let ie=0;for await(let z of this){var X;if(D!=null&&(X=D.signal)!==null&&X!==void 0&&X.aborted)throw new d({cause:D.signal.reason});yield[ie++,z]}}.call(this)}async function b(D,W=void 0){for await(let ie of g.call(this,D,W))return!0;return!1}async function m(D,W=void 0){if(typeof D!="function")throw new n("fn",["Function","AsyncFunction"],D);return!await b.call(this,async(...ie)=>!await D(...ie),W)}async function f(D,W){for await(let ie of g.call(this,D,W))return ie}async function o(D,W){if(typeof D!="function")throw new n("fn",["Function","AsyncFunction"],D);async function ie(X,z){return await D(X,z),t}for await(let X of u.call(this,ie,W));}function g(D,W){if(typeof D!="function")throw new n("fn",["Function","AsyncFunction"],D);async function ie(X,z){return await D(X,z)?X:t}return u.call(this,ie,W)}class A extends l{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function R(D,W,ie){var X;if(typeof D!="function")throw new n("reducer",["Function","AsyncFunction"],D);ie!=null&&_(ie,"options"),ie?.signal!=null&&p(ie.signal,"options.signal");let z=arguments.length>1;if(ie!=null&&(X=ie.signal)!==null&&X!==void 0&&X.aborted){let re=new d(void 0,{cause:ie.signal.reason});throw this.once("error",()=>{}),await S(this.destroy(re)),re}let F=new e,Y=F.signal;if(ie!=null&&ie.signal){let re={once:!0,[y]:this,[w]:!0};ie.signal.addEventListener("abort",()=>F.abort(),re)}let ae=!1;try{for await(let re of this){var de;if(ae=!0,ie!=null&&(de=ie.signal)!==null&&de!==void 0&&de.aborted)throw new d;z?W=await D(W,re,{signal:Y}):(W=re,z=!0)}if(!ae&&!z)throw new A}finally{F.abort()}return W}async function k(D){D!=null&&_(D,"options"),D?.signal!=null&&p(D.signal,"options.signal");let W=[];for await(let X of this){var ie;if(D!=null&&(ie=D.signal)!==null&&ie!==void 0&&ie.aborted)throw new d(void 0,{cause:D.signal.reason});B(W,X)}return W}function q(D,W){let ie=u.call(this,D,W);return async function*(){for await(let z of ie)yield*z}.call(this)}function Z(D){if(D=H(D),K(D))return 0;if(D<0)throw new i("number",">= 0",D);return D}function ne(D,W=void 0){return W!=null&&_(W,"options"),W?.signal!=null&&p(W.signal,"options.signal"),D=Z(D),async function*(){var X;if(W!=null&&(X=W.signal)!==null&&X!==void 0&&X.aborted)throw new d;for await(let F of this){var z;if(W!=null&&(z=W.signal)!==null&&z!==void 0&&z.aborted)throw new d;D--<=0&&(yield F)}}.call(this)}function G(D,W=void 0){return W!=null&&_(W,"options"),W?.signal!=null&&p(W.signal,"options.signal"),D=Z(D),async function*(){var X;if(W!=null&&(X=W.signal)!==null&&X!==void 0&&X.aborted)throw new d;for await(let F of this){var z;if(W!=null&&(z=W.signal)!==null&&z!==void 0&&z.aborted)throw new d;if(D-- >0&&(yield F),D<=0)return}}.call(this)}return wR.streamReturningOperators={asIndexedPairs:I(c,"readable.asIndexedPairs will be removed in a future version."),drop:ne,filter:g,flatMap:q,map:u,take:G,compose:s},wR.promiseReturningOperators={every:m,forEach:o,reduce:R,toArray:k,some:b,find:f},wR}var gY={},zRe=!1;function XRe(){if(zRe)return gY;zRe=!0;let{ArrayPrototypePop:e,Promise:r}=No(),{isIterable:n,isNodeStream:l,isWebStream:i}=X1(),{pipelineImpl:d}=_Y(),{finished:p}=hv();QRe();function v(..._){return new r((y,w)=>{let S,M,x=_[_.length-1];if(x&&typeof x=="object"&&!l(x)&&!n(x)&&!i(x)){let E=e(_);S=E.signal,M=E.end}d(_,(E,T)=>{E?w(E):y(T)},{signal:S,end:M})})}return gY={finished:p,pipeline:v},gY}var bY={},HRe=!1,KRe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function QRe(){if(HRe)return bY;HRe=!0;let{Buffer:e}=Oi(),{ObjectDefineProperty:r,ObjectKeys:n,ReflectApply:l}=No(),{promisify:{custom:i}}=Hf(),{streamReturningOperators:d,promiseReturningOperators:p}=Ibt(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:v}}=yh(),_=JRe(),{setDefaultHighWaterMark:y,getDefaultHighWaterMark:w}=MR(),{pipeline:S}=_Y(),{destroyer:M}=p3(),x=hv(),E=XRe(),T=X1(),I=bY=yY().Stream;I.isDestroyed=T.isDestroyed,I.isDisturbed=T.isDisturbed,I.isErrored=T.isErrored,I.isReadable=T.isReadable,I.isWritable=T.isWritable,I.Readable=SR();for(let N of n(d)){let K=function(...J){if(new.target)throw v();return I.Readable.from(l(H,this||KRe,J))};var O=K;let H=d[N];r(K,"name",{__proto__:null,value:H.name}),r(K,"length",{__proto__:null,value:H.length}),r(I.Readable.prototype,N,{__proto__:null,value:K,enumerable:!1,configurable:!0,writable:!0})}for(let N of n(p)){let K=function(...L){if(new.target)throw v();return l(H,this||KRe,L)};var O=K;let H=p[N];r(K,"name",{__proto__:null,value:H.name}),r(K,"length",{__proto__:null,value:H.length}),r(I.Readable.prototype,N,{__proto__:null,value:K,enumerable:!1,configurable:!0,writable:!0})}I.Writable=wY(),I.Duplex=J1(),I.Transform=VRe(),I.PassThrough=YRe(),I.pipeline=S;let{addAbortSignal:B}=_R();return I.addAbortSignal=B,I.finished=x,I.destroy=M,I.compose=_,I.setDefaultHighWaterMark=y,I.getDefaultHighWaterMark=w,r(I,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return E}}),r(S,i,{__proto__:null,enumerable:!0,get(){return E.pipeline}}),r(x,i,{__proto__:null,enumerable:!0,get(){return E.finished}}),I.Stream=I,I._isUint8Array=function(H){return H instanceof Uint8Array},I._uint8ArrayToBuffer=function(H){return e.from(H.buffer,H.byteOffset,H.byteLength)},bY}var Oo={},ZRe=!1;function kbt(){if(ZRe)return Oo;ZRe=!0;let e=QRe(),r=XRe(),n=e.Readable.destroy;return Oo=e.Readable,Oo._uint8ArrayToBuffer=e._uint8ArrayToBuffer,Oo._isUint8Array=e._isUint8Array,Oo.isDisturbed=e.isDisturbed,Oo.isErrored=e.isErrored,Oo.isReadable=e.isReadable,Oo.Readable=e.Readable,Oo.Writable=e.Writable,Oo.Duplex=e.Duplex,Oo.Transform=e.Transform,Oo.PassThrough=e.PassThrough,Oo.addAbortSignal=e.addAbortSignal,Oo.finished=e.finished,Oo.destroy=e.destroy,Oo.destroy=n,Oo.pipeline=e.pipeline,Oo.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return r}}),Oo.Stream=e.Stream,Oo.default=Oo,Oo}var za=kbt();za._uint8ArrayToBuffer;za._isUint8Array;za.isDisturbed;za.isErrored;za.isReadable;za.Readable;za.Writable;za.Duplex;za.Transform;za.PassThrough;za.addAbortSignal;za.finished;za.destroy;za.pipeline;za.compose;za.Stream;var WRe=za.Readable;WRe.wrap=function(e,r){return r=Object.assign({objectMode:e.readableObjectMode!=null||e.objectMode!=null||!0},r),r.destroy=function(n,l){e.destroy(n),l(n)},new WRe(r).wrap(e)};var Our=za.Writable,Nur=za.Duplex,eTe=za.Transform,tTe=za.PassThrough,Cur=za.finished,Lur=za.pipeline,Dur=za.Stream,$ur={finished:GA(za.finished),pipeline:GA(za.pipeline)};var eb=$n(Cu(),1);sd();async function rTe(e){let r=iTe(e),n=(await r.next()).value;n=await Kf(r,n,32);let l=Po(n.subarray(0,32));n=n.subarray(32);let i=64*l;n=await Kf(r,n,i);let d=new Array(l);for(let _=0;_<i;_+=64)d[_/64]=[Po(n.subarray(_,_+32)),(0,eb.default)(ze.from(n.subarray(_+32,_+64)))];n=n.subarray(i);let p=32+i,v=[];for(let[_,y]of d){n=await Kf(r,n,mR),n=await Kf(r,n,2);let w=Po(n.subarray(0,2));n=n.subarray(2);let{sigLength:S,pubLength:M,sigName:x}=fn[w];n=await Kf(r,n,S);let E=n.subarray(0,S);n=n.subarray(S),n=await Kf(r,n,M);let T=n.subarray(0,M);n=n.subarray(M),n=await Kf(r,n,1);let I=n[0]===1;I&&(n=await Kf(r,n,33));let B=I?n.subarray(1,33):ze.allocUnsafe(0);n=n.subarray(I?33:1),n=await Kf(r,n,1);let O=n[0]===1;O&&(n=await Kf(r,n,33));let N=O?n.subarray(1,33):ze.allocUnsafe(0);n=n.subarray(O?33:1),n=await Kf(r,n,8);let H=Po(n.subarray(0,8));n=n.subarray(8),n=await Kf(r,n,8);let K=Po(n.subarray(0,8));n=n.subarray(8),n=await Kf(r,n,K);let J=n.subarray(0,K),L=H!==0&&K!==0?l3(ze.from(J)):[];if(L.length!==H)throw new Error("Tags lengths don't match");n=n.subarray(K);let $=new eTe;$._transform=function(s,u,c){this.push(s),c()};let V=qm([(0,ba.stringToBuffer)("dataitem"),(0,ba.stringToBuffer)("1"),(0,ba.stringToBuffer)(w.toString()),T,B,N,J,$]),h=2+S+M+(I?33:1)+(O?33:1)+16+K,t=_-h;if(n.byteLength>t)$.write(n.subarray(0,t)),n=n.subarray(t);else{let s=n.byteLength;for($.write(n);t>s;){if(n=(await r.next()).value,!n)throw new Error(`Not enough data bytes expected: ${t} received: ${s}`);s+=n.byteLength,s>t?$.write(n.subarray(0,n.byteLength-(s-t))):$.write(n)}n=n.subarray(n.byteLength-(s-t))}if($.end(),y!==(0,eb.default)(Ul("sha256").update(E).digest()))throw new Error("ID doesn't match signature");if(!await O5[w].verify(T,await V,E))throw new Error("Invalid signature");v.push({id:y,sigName:x,signature:(0,eb.default)(ze.from(E)),target:(0,eb.default)(ze.from(B)),anchor:(0,eb.default)(ze.from(N)),owner:(0,eb.default)(ze.from(T)),tags:L,dataOffset:p+h,dataSize:t}),p+=h+t}return v}async function Bbt(e,r,n,l){let i=$5("",n,l),d=new tTe,p=[(0,ba.stringToBuffer)("dataitem"),(0,ba.stringToBuffer)("1"),(0,ba.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,e],v=await qm(p),_=ze.from(await n.sign(v));return i.setSignature(_),d.write(i.getRaw()),r.pipe(d)}async function Kf(e,r,n){if(r.byteLength>=n)return r;let{done:l,value:i}=await e.next();if(l&&!i)throw new Error("Invalid buffer");return Kf(e,ze.concat([ze.from(r),ze.from(i)]),n)}async function*iTe(e){for await(let r of e)yield r}var Pbt=rTe,Obt={readBytes:Kf,getReader:iTe};var Nbt={...QV,stream:MY};globalThis.arbundles??=Nbt;we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();var Bn;(function(e){e.assertEqual=i=>i;function r(i){}e.assertIs=r;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{let d={};for(let p of i)d[p]=p;return d},e.getValidEnumValues=i=>{let d=e.objectKeys(i).filter(v=>typeof i[i[v]]!="number"),p={};for(let v of d)p[v]=i[v];return e.objectValues(p)},e.objectValues=i=>e.objectKeys(i).map(function(d){return i[d]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let d=[];for(let p in i)Object.prototype.hasOwnProperty.call(i,p)&&d.push(p);return d},e.find=(i,d)=>{for(let p of i)if(d(p))return p},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function l(i,d=" | "){return i.map(p=>typeof p=="string"?`'${p}'`:p).join(d)}e.joinValues=l,e.jsonStringifyReplacer=(i,d)=>typeof d=="bigint"?d.toString():d})(Bn||(Bn={}));var xY;(function(e){e.mergeShapes=(r,n)=>({...r,...n})})(xY||(xY={}));var Nr=Bn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ep=e=>{switch(typeof e){case"undefined":return Nr.undefined;case"string":return Nr.string;case"number":return isNaN(e)?Nr.nan:Nr.number;case"boolean":return Nr.boolean;case"function":return Nr.function;case"bigint":return Nr.bigint;case"symbol":return Nr.symbol;case"object":return Array.isArray(e)?Nr.array:e===null?Nr.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Nr.promise:typeof Map<"u"&&e instanceof Map?Nr.map:typeof Set<"u"&&e instanceof Set?Nr.set:typeof Date<"u"&&e instanceof Date?Nr.date:Nr.object;default:return Nr.unknown}},dr=Bn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Cbt=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),lu=class e extends Error{get errors(){return this.issues}constructor(r){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=r}format(r){let n=r||function(d){return d.message},l={_errors:[]},i=d=>{for(let p of d.issues)if(p.code==="invalid_union")p.unionErrors.map(i);else if(p.code==="invalid_return_type")i(p.returnTypeError);else if(p.code==="invalid_arguments")i(p.argumentsError);else if(p.path.length===0)l._errors.push(n(p));else{let v=l,_=0;for(;_<p.path.length;){let y=p.path[_];_===p.path.length-1?(v[y]=v[y]||{_errors:[]},v[y]._errors.push(n(p))):v[y]=v[y]||{_errors:[]},v=v[y],_++}}};return i(this),l}static assert(r){if(!(r instanceof e))throw new Error(`Not a ZodError: ${r}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=n=>n.message){let n={},l=[];for(let i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(r(i))):l.push(r(i));return{formErrors:l,fieldErrors:n}}get formErrors(){return this.flatten()}};lu.create=e=>new lu(e);var g3=(e,r)=>{let n;switch(e.code){case dr.invalid_type:e.received===Nr.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case dr.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Bn.jsonStringifyReplacer)}`;break;case dr.unrecognized_keys:n=`Unrecognized key(s) in object: ${Bn.joinValues(e.keys,", ")}`;break;case dr.invalid_union:n="Invalid input";break;case dr.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Bn.joinValues(e.options)}`;break;case dr.invalid_enum_value:n=`Invalid enum value. Expected ${Bn.joinValues(e.options)}, received '${e.received}'`;break;case dr.invalid_arguments:n="Invalid function arguments";break;case dr.invalid_return_type:n="Invalid function return type";break;case dr.invalid_date:n="Invalid date";break;case dr.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Bn.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case dr.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case dr.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case dr.custom:n="Invalid input";break;case dr.invalid_intersection_types:n="Intersection results could not be merged";break;case dr.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case dr.not_finite:n="Number must be finite";break;default:n=r.defaultError,Bn.assertNever(e)}return{message:n}},sTe=g3;function Lbt(e){sTe=e}function xR(){return sTe}var ER=e=>{let{data:r,path:n,errorMaps:l,issueData:i}=e,d=[...n,...i.path||[]],p={...i,path:d};if(i.message!==void 0)return{...i,path:d,message:i.message};let v="",_=l.filter(y=>!!y).slice().reverse();for(let y of _)v=y(p,{data:r,defaultError:v}).message;return{...i,path:d,message:v}},Dbt=[];function kr(e,r){let n=xR(),l=ER({issueData:r,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===g3?void 0:g3].filter(i=>!!i)});e.common.issues.push(l)}var Pf=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(r,n){let l=[];for(let i of n){if(i.status==="aborted")return ai;i.status==="dirty"&&r.dirty(),l.push(i.value)}return{status:r.value,value:l}}static async mergeObjectAsync(r,n){let l=[];for(let i of n){let d=await i.key,p=await i.value;l.push({key:d,value:p})}return e.mergeObjectSync(r,l)}static mergeObjectSync(r,n){let l={};for(let i of n){let{key:d,value:p}=i;if(d.status==="aborted"||p.status==="aborted")return ai;d.status==="dirty"&&r.dirty(),p.status==="dirty"&&r.dirty(),d.value!=="__proto__"&&(typeof p.value<"u"||i.alwaysSet)&&(l[d.value]=p.value)}return{status:r.value,value:l}}},ai=Object.freeze({status:"aborted"}),v3=e=>({status:"dirty",value:e}),Zf=e=>({status:"valid",value:e}),EY=e=>e.status==="aborted",AY=e=>e.status==="dirty",tb=e=>e.status==="valid",K5=e=>typeof Promise<"u"&&e instanceof Promise;function AR(e,r,n,l){if(n==="a"&&!l)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!l:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?l:n==="a"?l.call(e):l?l.value:r.get(e)}function fTe(e,r,n,l,i){if(l==="m")throw new TypeError("Private method is not writable");if(l==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?e!==r||!i:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return l==="a"?i.call(e,n):i?i.value=n:r.set(e,n),n}var $r;(function(e){e.errToObj=r=>typeof r=="string"?{message:r}:r||{},e.toString=r=>typeof r=="string"?r:r?.message})($r||($r={}));var z5,H5,C0=class{constructor(r,n,l,i){this._cachedPath=[],this.parent=r,this.data=n,this._path=l,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},nTe=(e,r)=>{if(tb(r))return{success:!0,data:r.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new lu(e.common.issues);return this._error=n,this._error}}};function Ni(e){if(!e)return{};let{errorMap:r,invalid_type_error:n,required_error:l,description:i}=e;if(r&&(n||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return r?{errorMap:r,description:i}:{errorMap:(p,v)=>{var _,y;let{message:w}=e;return p.code==="invalid_enum_value"?{message:w??v.defaultError}:typeof v.data>"u"?{message:(_=w??l)!==null&&_!==void 0?_:v.defaultError}:p.code!=="invalid_type"?{message:v.defaultError}:{message:(y=w??n)!==null&&y!==void 0?y:v.defaultError}},description:i}}var Ci=class{get description(){return this._def.description}_getType(r){return ep(r.data)}_getOrReturnCtx(r,n){return n||{common:r.parent.common,data:r.data,parsedType:ep(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new Pf,ctx:{common:r.parent.common,data:r.data,parsedType:ep(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){let n=this._parse(r);if(K5(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(r){let n=this._parse(r);return Promise.resolve(n)}parse(r,n){let l=this.safeParse(r,n);if(l.success)return l.data;throw l.error}safeParse(r,n){var l;let i={common:{issues:[],async:(l=n?.async)!==null&&l!==void 0?l:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:ep(r)},d=this._parseSync({data:r,path:i.path,parent:i});return nTe(i,d)}"~validate"(r){var n,l;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:ep(r)};if(!this["~standard"].async)try{let d=this._parseSync({data:r,path:[],parent:i});return tb(d)?{value:d.value}:{issues:i.common.issues}}catch(d){!((l=(n=d?.message)===null||n===void 0?void 0:n.toLowerCase())===null||l===void 0)&&l.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:r,path:[],parent:i}).then(d=>tb(d)?{value:d.value}:{issues:i.common.issues})}async parseAsync(r,n){let l=await this.safeParseAsync(r,n);if(l.success)return l.data;throw l.error}async safeParseAsync(r,n){let l={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:ep(r)},i=this._parse({data:r,path:l.path,parent:l}),d=await(K5(i)?i:Promise.resolve(i));return nTe(l,d)}refine(r,n){let l=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,d)=>{let p=r(i),v=()=>d.addIssue({code:dr.custom,...l(i)});return typeof Promise<"u"&&p instanceof Promise?p.then(_=>_?!0:(v(),!1)):p?!0:(v(),!1)})}refinement(r,n){return this._refinement((l,i)=>r(l)?!0:(i.addIssue(typeof n=="function"?n(l,i):n),!1))}_refinement(r){return new cu({schema:this,typeName:ei.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}constructor(r){this.spa=this.safeParseAsync,this._def=r,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return N0.create(this,this._def)}nullable(){return kd.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rp.create(this)}promise(){return cv.create(this,this._def)}or(r){return fb.create([this,r],this._def)}and(r){return hb.create(this,r,this._def)}transform(r){return new cu({...Ni(this._def),schema:this,typeName:ei.ZodEffects,effect:{type:"transform",transform:r}})}default(r){let n=typeof r=="function"?r:()=>r;return new pb({...Ni(this._def),innerType:this,defaultValue:n,typeName:ei.ZodDefault})}brand(){return new Z5({typeName:ei.ZodBranded,type:this,...Ni(this._def)})}catch(r){let n=typeof r=="function"?r:()=>r;return new mb({...Ni(this._def),innerType:this,catchValue:n,typeName:ei.ZodCatch})}describe(r){let n=this.constructor;return new n({...this._def,description:r})}pipe(r){return W5.create(this,r)}readonly(){return vb.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},$bt=/^c[^\s-]{8,}$/i,qbt=/^[0-9a-z]+$/,Ubt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jbt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Fbt=/^[a-z0-9_-]{21}$/i,zbt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hbt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Kbt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zbt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",SY,Wbt=/^(?:(?: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])$/,Gbt=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Vbt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ybt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jbt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xbt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hTe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Qbt=new RegExp(`^${hTe}$`);function uTe(e){let r="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?r=`${r}\\.\\d{${e.precision}}`:e.precision==null&&(r=`${r}(\\.\\d+)?`),r}function e6t(e){return new RegExp(`^${uTe(e)}$`)}function lTe(e){let r=`${hTe}T${uTe(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${n.join("|")})`,new RegExp(`^${r}$`)}function t6t(e,r){return!!((r==="v4"||!r)&&Wbt.test(e)||(r==="v6"||!r)&&Vbt.test(e))}function r6t(e,r){if(!zbt.test(e))return!1;try{let[n]=e.split("."),l=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(l));return!(typeof i!="object"||i===null||!i.typ||!i.alg||r&&i.alg!==r)}catch{return!1}}function i6t(e,r){return!!((r==="v4"||!r)&&Gbt.test(e)||(r==="v6"||!r)&&Ybt.test(e))}var uv=class e extends Ci{_parse(r){if(this._def.coerce&&(r.data=String(r.data)),this._getType(r)!==Nr.string){let d=this._getOrReturnCtx(r);return kr(d,{code:dr.invalid_type,expected:Nr.string,received:d.parsedType}),ai}let l=new Pf,i;for(let d of this._def.checks)if(d.kind==="min")r.data.length<d.value&&(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),l.dirty());else if(d.kind==="max")r.data.length>d.value&&(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),l.dirty());else if(d.kind==="length"){let p=r.data.length>d.value,v=r.data.length<d.value;(p||v)&&(i=this._getOrReturnCtx(r,i),p?kr(i,{code:dr.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}):v&&kr(i,{code:dr.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}),l.dirty())}else if(d.kind==="email")Kbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"email",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="emoji")SY||(SY=new RegExp(Zbt,"u")),SY.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"emoji",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="uuid")jbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"uuid",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="nanoid")Fbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"nanoid",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="cuid")$bt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"cuid",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="cuid2")qbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"cuid2",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="ulid")Ubt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"ulid",code:dr.invalid_string,message:d.message}),l.dirty());else if(d.kind==="url")try{new URL(r.data)}catch{i=this._getOrReturnCtx(r,i),kr(i,{validation:"url",code:dr.invalid_string,message:d.message}),l.dirty()}else d.kind==="regex"?(d.regex.lastIndex=0,d.regex.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"regex",code:dr.invalid_string,message:d.message}),l.dirty())):d.kind==="trim"?r.data=r.data.trim():d.kind==="includes"?r.data.includes(d.value,d.position)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:{includes:d.value,position:d.position},message:d.message}),l.dirty()):d.kind==="toLowerCase"?r.data=r.data.toLowerCase():d.kind==="toUpperCase"?r.data=r.data.toUpperCase():d.kind==="startsWith"?r.data.startsWith(d.value)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:{startsWith:d.value},message:d.message}),l.dirty()):d.kind==="endsWith"?r.data.endsWith(d.value)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:{endsWith:d.value},message:d.message}),l.dirty()):d.kind==="datetime"?lTe(d).test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:"datetime",message:d.message}),l.dirty()):d.kind==="date"?Qbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:"date",message:d.message}),l.dirty()):d.kind==="time"?e6t(d).test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.invalid_string,validation:"time",message:d.message}),l.dirty()):d.kind==="duration"?Hbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"duration",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="ip"?t6t(r.data,d.version)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"ip",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="jwt"?r6t(r.data,d.alg)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"jwt",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="cidr"?i6t(r.data,d.version)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"cidr",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="base64"?Jbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"base64",code:dr.invalid_string,message:d.message}),l.dirty()):d.kind==="base64url"?Xbt.test(r.data)||(i=this._getOrReturnCtx(r,i),kr(i,{validation:"base64url",code:dr.invalid_string,message:d.message}),l.dirty()):Bn.assertNever(d);return{status:l.value,value:r.data}}_regex(r,n,l){return this.refinement(i=>r.test(i),{validation:n,code:dr.invalid_string,...$r.errToObj(l)})}_addCheck(r){return new e({...this._def,checks:[...this._def.checks,r]})}email(r){return this._addCheck({kind:"email",...$r.errToObj(r)})}url(r){return this._addCheck({kind:"url",...$r.errToObj(r)})}emoji(r){return this._addCheck({kind:"emoji",...$r.errToObj(r)})}uuid(r){return this._addCheck({kind:"uuid",...$r.errToObj(r)})}nanoid(r){return this._addCheck({kind:"nanoid",...$r.errToObj(r)})}cuid(r){return this._addCheck({kind:"cuid",...$r.errToObj(r)})}cuid2(r){return this._addCheck({kind:"cuid2",...$r.errToObj(r)})}ulid(r){return this._addCheck({kind:"ulid",...$r.errToObj(r)})}base64(r){return this._addCheck({kind:"base64",...$r.errToObj(r)})}base64url(r){return this._addCheck({kind:"base64url",...$r.errToObj(r)})}jwt(r){return this._addCheck({kind:"jwt",...$r.errToObj(r)})}ip(r){return this._addCheck({kind:"ip",...$r.errToObj(r)})}cidr(r){return this._addCheck({kind:"cidr",...$r.errToObj(r)})}datetime(r){var n,l;return typeof r=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:r}):this._addCheck({kind:"datetime",precision:typeof r?.precision>"u"?null:r?.precision,offset:(n=r?.offset)!==null&&n!==void 0?n:!1,local:(l=r?.local)!==null&&l!==void 0?l:!1,...$r.errToObj(r?.message)})}date(r){return this._addCheck({kind:"date",message:r})}time(r){return typeof r=="string"?this._addCheck({kind:"time",precision:null,message:r}):this._addCheck({kind:"time",precision:typeof r?.precision>"u"?null:r?.precision,...$r.errToObj(r?.message)})}duration(r){return this._addCheck({kind:"duration",...$r.errToObj(r)})}regex(r,n){return this._addCheck({kind:"regex",regex:r,...$r.errToObj(n)})}includes(r,n){return this._addCheck({kind:"includes",value:r,position:n?.position,...$r.errToObj(n?.message)})}startsWith(r,n){return this._addCheck({kind:"startsWith",value:r,...$r.errToObj(n)})}endsWith(r,n){return this._addCheck({kind:"endsWith",value:r,...$r.errToObj(n)})}min(r,n){return this._addCheck({kind:"min",value:r,...$r.errToObj(n)})}max(r,n){return this._addCheck({kind:"max",value:r,...$r.errToObj(n)})}length(r,n){return this._addCheck({kind:"length",value:r,...$r.errToObj(n)})}nonempty(r){return this.min(1,$r.errToObj(r))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(r=>r.kind==="datetime")}get isDate(){return!!this._def.checks.find(r=>r.kind==="date")}get isTime(){return!!this._def.checks.find(r=>r.kind==="time")}get isDuration(){return!!this._def.checks.find(r=>r.kind==="duration")}get isEmail(){return!!this._def.checks.find(r=>r.kind==="email")}get isURL(){return!!this._def.checks.find(r=>r.kind==="url")}get isEmoji(){return!!this._def.checks.find(r=>r.kind==="emoji")}get isUUID(){return!!this._def.checks.find(r=>r.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(r=>r.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(r=>r.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(r=>r.kind==="cuid2")}get isULID(){return!!this._def.checks.find(r=>r.kind==="ulid")}get isIP(){return!!this._def.checks.find(r=>r.kind==="ip")}get isCIDR(){return!!this._def.checks.find(r=>r.kind==="cidr")}get isBase64(){return!!this._def.checks.find(r=>r.kind==="base64")}get isBase64url(){return!!this._def.checks.find(r=>r.kind==="base64url")}get minLength(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxLength(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}};uv.create=e=>{var r;return new uv({checks:[],typeName:ei.ZodString,coerce:(r=e?.coerce)!==null&&r!==void 0?r:!1,...Ni(e)})};function n6t(e,r){let n=(e.toString().split(".")[1]||"").length,l=(r.toString().split(".")[1]||"").length,i=n>l?n:l,d=parseInt(e.toFixed(i).replace(".","")),p=parseInt(r.toFixed(i).replace(".",""));return d%p/Math.pow(10,i)}var rb=class e extends Ci{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(r){if(this._def.coerce&&(r.data=Number(r.data)),this._getType(r)!==Nr.number){let d=this._getOrReturnCtx(r);return kr(d,{code:dr.invalid_type,expected:Nr.number,received:d.parsedType}),ai}let l,i=new Pf;for(let d of this._def.checks)d.kind==="int"?Bn.isInteger(r.data)||(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.invalid_type,expected:"integer",received:"float",message:d.message}),i.dirty()):d.kind==="min"?(d.inclusive?r.data<d.value:r.data<=d.value)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.too_small,minimum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),i.dirty()):d.kind==="max"?(d.inclusive?r.data>d.value:r.data>=d.value)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.too_big,maximum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),i.dirty()):d.kind==="multipleOf"?n6t(r.data,d.value)!==0&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.not_multiple_of,multipleOf:d.value,message:d.message}),i.dirty()):d.kind==="finite"?Number.isFinite(r.data)||(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.not_finite,message:d.message}),i.dirty()):Bn.assertNever(d);return{status:i.value,value:r.data}}gte(r,n){return this.setLimit("min",r,!0,$r.toString(n))}gt(r,n){return this.setLimit("min",r,!1,$r.toString(n))}lte(r,n){return this.setLimit("max",r,!0,$r.toString(n))}lt(r,n){return this.setLimit("max",r,!1,$r.toString(n))}setLimit(r,n,l,i){return new e({...this._def,checks:[...this._def.checks,{kind:r,value:n,inclusive:l,message:$r.toString(i)}]})}_addCheck(r){return new e({...this._def,checks:[...this._def.checks,r]})}int(r){return this._addCheck({kind:"int",message:$r.toString(r)})}positive(r){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$r.toString(r)})}negative(r){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$r.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$r.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$r.toString(r)})}multipleOf(r,n){return this._addCheck({kind:"multipleOf",value:r,message:$r.toString(n)})}finite(r){return this._addCheck({kind:"finite",message:$r.toString(r)})}safe(r){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$r.toString(r)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$r.toString(r)})}get minValue(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxValue(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}get isInt(){return!!this._def.checks.find(r=>r.kind==="int"||r.kind==="multipleOf"&&Bn.isInteger(r.value))}get isFinite(){let r=null,n=null;for(let l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(n===null||l.value>n)&&(n=l.value):l.kind==="max"&&(r===null||l.value<r)&&(r=l.value)}return Number.isFinite(n)&&Number.isFinite(r)}};rb.create=e=>new rb({checks:[],typeName:ei.ZodNumber,coerce:e?.coerce||!1,...Ni(e)});var ib=class e extends Ci{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(r){if(this._def.coerce)try{r.data=BigInt(r.data)}catch{return this._getInvalidInput(r)}if(this._getType(r)!==Nr.bigint)return this._getInvalidInput(r);let l,i=new Pf;for(let d of this._def.checks)d.kind==="min"?(d.inclusive?r.data<d.value:r.data<=d.value)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.too_small,type:"bigint",minimum:d.value,inclusive:d.inclusive,message:d.message}),i.dirty()):d.kind==="max"?(d.inclusive?r.data>d.value:r.data>=d.value)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.too_big,type:"bigint",maximum:d.value,inclusive:d.inclusive,message:d.message}),i.dirty()):d.kind==="multipleOf"?r.data%d.value!==BigInt(0)&&(l=this._getOrReturnCtx(r,l),kr(l,{code:dr.not_multiple_of,multipleOf:d.value,message:d.message}),i.dirty()):Bn.assertNever(d);return{status:i.value,value:r.data}}_getInvalidInput(r){let n=this._getOrReturnCtx(r);return kr(n,{code:dr.invalid_type,expected:Nr.bigint,received:n.parsedType}),ai}gte(r,n){return this.setLimit("min",r,!0,$r.toString(n))}gt(r,n){return this.setLimit("min",r,!1,$r.toString(n))}lte(r,n){return this.setLimit("max",r,!0,$r.toString(n))}lt(r,n){return this.setLimit("max",r,!1,$r.toString(n))}setLimit(r,n,l,i){return new e({...this._def,checks:[...this._def.checks,{kind:r,value:n,inclusive:l,message:$r.toString(i)}]})}_addCheck(r){return new e({...this._def,checks:[...this._def.checks,r]})}positive(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$r.toString(r)})}negative(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$r.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$r.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$r.toString(r)})}multipleOf(r,n){return this._addCheck({kind:"multipleOf",value:r,message:$r.toString(n)})}get minValue(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxValue(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}};ib.create=e=>{var r;return new ib({checks:[],typeName:ei.ZodBigInt,coerce:(r=e?.coerce)!==null&&r!==void 0?r:!1,...Ni(e)})};var nb=class extends Ci{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==Nr.boolean){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.boolean,received:l.parsedType}),ai}return Zf(r.data)}};nb.create=e=>new nb({typeName:ei.ZodBoolean,coerce:e?.coerce||!1,...Ni(e)});var ab=class e extends Ci{_parse(r){if(this._def.coerce&&(r.data=new Date(r.data)),this._getType(r)!==Nr.date){let d=this._getOrReturnCtx(r);return kr(d,{code:dr.invalid_type,expected:Nr.date,received:d.parsedType}),ai}if(isNaN(r.data.getTime())){let d=this._getOrReturnCtx(r);return kr(d,{code:dr.invalid_date}),ai}let l=new Pf,i;for(let d of this._def.checks)d.kind==="min"?r.data.getTime()<d.value&&(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.too_small,message:d.message,inclusive:!0,exact:!1,minimum:d.value,type:"date"}),l.dirty()):d.kind==="max"?r.data.getTime()>d.value&&(i=this._getOrReturnCtx(r,i),kr(i,{code:dr.too_big,message:d.message,inclusive:!0,exact:!1,maximum:d.value,type:"date"}),l.dirty()):Bn.assertNever(d);return{status:l.value,value:new Date(r.data.getTime())}}_addCheck(r){return new e({...this._def,checks:[...this._def.checks,r]})}min(r,n){return this._addCheck({kind:"min",value:r.getTime(),message:$r.toString(n)})}max(r,n){return this._addCheck({kind:"max",value:r.getTime(),message:$r.toString(n)})}get minDate(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r!=null?new Date(r):null}get maxDate(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r!=null?new Date(r):null}};ab.create=e=>new ab({checks:[],coerce:e?.coerce||!1,typeName:ei.ZodDate,...Ni(e)});var b3=class extends Ci{_parse(r){if(this._getType(r)!==Nr.symbol){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.symbol,received:l.parsedType}),ai}return Zf(r.data)}};b3.create=e=>new b3({typeName:ei.ZodSymbol,...Ni(e)});var ob=class extends Ci{_parse(r){if(this._getType(r)!==Nr.undefined){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.undefined,received:l.parsedType}),ai}return Zf(r.data)}};ob.create=e=>new ob({typeName:ei.ZodUndefined,...Ni(e)});var sb=class extends Ci{_parse(r){if(this._getType(r)!==Nr.null){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.null,received:l.parsedType}),ai}return Zf(r.data)}};sb.create=e=>new sb({typeName:ei.ZodNull,...Ni(e)});var lv=class extends Ci{constructor(){super(...arguments),this._any=!0}_parse(r){return Zf(r.data)}};lv.create=e=>new lv({typeName:ei.ZodAny,...Ni(e)});var tp=class extends Ci{constructor(){super(...arguments),this._unknown=!0}_parse(r){return Zf(r.data)}};tp.create=e=>new tp({typeName:ei.ZodUnknown,...Ni(e)});var ic=class extends Ci{_parse(r){let n=this._getOrReturnCtx(r);return kr(n,{code:dr.invalid_type,expected:Nr.never,received:n.parsedType}),ai}};ic.create=e=>new ic({typeName:ei.ZodNever,...Ni(e)});var y3=class extends Ci{_parse(r){if(this._getType(r)!==Nr.undefined){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.void,received:l.parsedType}),ai}return Zf(r.data)}};y3.create=e=>new y3({typeName:ei.ZodVoid,...Ni(e)});var rp=class e extends Ci{_parse(r){let{ctx:n,status:l}=this._processInputParams(r),i=this._def;if(n.parsedType!==Nr.array)return kr(n,{code:dr.invalid_type,expected:Nr.array,received:n.parsedType}),ai;if(i.exactLength!==null){let p=n.data.length>i.exactLength.value,v=n.data.length<i.exactLength.value;(p||v)&&(kr(n,{code:p?dr.too_big:dr.too_small,minimum:v?i.exactLength.value:void 0,maximum:p?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),l.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(kr(n,{code:dr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),l.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(kr(n,{code:dr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),l.dirty()),n.common.async)return Promise.all([...n.data].map((p,v)=>i.type._parseAsync(new C0(n,p,n.path,v)))).then(p=>Pf.mergeArray(l,p));let d=[...n.data].map((p,v)=>i.type._parseSync(new C0(n,p,n.path,v)));return Pf.mergeArray(l,d)}get element(){return this._def.type}min(r,n){return new e({...this._def,minLength:{value:r,message:$r.toString(n)}})}max(r,n){return new e({...this._def,maxLength:{value:r,message:$r.toString(n)}})}length(r,n){return new e({...this._def,exactLength:{value:r,message:$r.toString(n)}})}nonempty(r){return this.min(1,r)}};rp.create=(e,r)=>new rp({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ei.ZodArray,...Ni(r)});function m3(e){if(e instanceof wh){let r={};for(let n in e.shape){let l=e.shape[n];r[n]=N0.create(m3(l))}return new wh({...e._def,shape:()=>r})}else return e instanceof rp?new rp({...e._def,type:m3(e.element)}):e instanceof N0?N0.create(m3(e.unwrap())):e instanceof kd?kd.create(m3(e.unwrap())):e instanceof Id?Id.create(e.items.map(r=>m3(r))):e}var wh=class e extends Ci{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let r=this._def.shape(),n=Bn.objectKeys(r);return this._cached={shape:r,keys:n}}_parse(r){if(this._getType(r)!==Nr.object){let y=this._getOrReturnCtx(r);return kr(y,{code:dr.invalid_type,expected:Nr.object,received:y.parsedType}),ai}let{status:l,ctx:i}=this._processInputParams(r),{shape:d,keys:p}=this._getCached(),v=[];if(!(this._def.catchall instanceof ic&&this._def.unknownKeys==="strip"))for(let y in i.data)p.includes(y)||v.push(y);let _=[];for(let y of p){let w=d[y],S=i.data[y];_.push({key:{status:"valid",value:y},value:w._parse(new C0(i,S,i.path,y)),alwaysSet:y in i.data})}if(this._def.catchall instanceof ic){let y=this._def.unknownKeys;if(y==="passthrough")for(let w of v)_.push({key:{status:"valid",value:w},value:{status:"valid",value:i.data[w]}});else if(y==="strict")v.length>0&&(kr(i,{code:dr.unrecognized_keys,keys:v}),l.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let y=this._def.catchall;for(let w of v){let S=i.data[w];_.push({key:{status:"valid",value:w},value:y._parse(new C0(i,S,i.path,w)),alwaysSet:w in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let y=[];for(let w of _){let S=await w.key,M=await w.value;y.push({key:S,value:M,alwaysSet:w.alwaysSet})}return y}).then(y=>Pf.mergeObjectSync(l,y)):Pf.mergeObjectSync(l,_)}get shape(){return this._def.shape()}strict(r){return $r.errToObj,new e({...this._def,unknownKeys:"strict",...r!==void 0?{errorMap:(n,l)=>{var i,d,p,v;let _=(p=(d=(i=this._def).errorMap)===null||d===void 0?void 0:d.call(i,n,l).message)!==null&&p!==void 0?p:l.defaultError;return n.code==="unrecognized_keys"?{message:(v=$r.errToObj(r).message)!==null&&v!==void 0?v:_}:{message:_}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(r){return new e({...this._def,shape:()=>({...this._def.shape(),...r})})}merge(r){return new e({unknownKeys:r._def.unknownKeys,catchall:r._def.catchall,shape:()=>({...this._def.shape(),...r._def.shape()}),typeName:ei.ZodObject})}setKey(r,n){return this.augment({[r]:n})}catchall(r){return new e({...this._def,catchall:r})}pick(r){let n={};return Bn.objectKeys(r).forEach(l=>{r[l]&&this.shape[l]&&(n[l]=this.shape[l])}),new e({...this._def,shape:()=>n})}omit(r){let n={};return Bn.objectKeys(this.shape).forEach(l=>{r[l]||(n[l]=this.shape[l])}),new e({...this._def,shape:()=>n})}deepPartial(){return m3(this)}partial(r){let n={};return Bn.objectKeys(this.shape).forEach(l=>{let i=this.shape[l];r&&!r[l]?n[l]=i:n[l]=i.optional()}),new e({...this._def,shape:()=>n})}required(r){let n={};return Bn.objectKeys(this.shape).forEach(l=>{if(r&&!r[l])n[l]=this.shape[l];else{let d=this.shape[l];for(;d instanceof N0;)d=d._def.innerType;n[l]=d}}),new e({...this._def,shape:()=>n})}keyof(){return cTe(Bn.objectKeys(this.shape))}};wh.create=(e,r)=>new wh({shape:()=>e,unknownKeys:"strip",catchall:ic.create(),typeName:ei.ZodObject,...Ni(r)});wh.strictCreate=(e,r)=>new wh({shape:()=>e,unknownKeys:"strict",catchall:ic.create(),typeName:ei.ZodObject,...Ni(r)});wh.lazycreate=(e,r)=>new wh({shape:e,unknownKeys:"strip",catchall:ic.create(),typeName:ei.ZodObject,...Ni(r)});var fb=class extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r),l=this._def.options;function i(d){for(let v of d)if(v.result.status==="valid")return v.result;for(let v of d)if(v.result.status==="dirty")return n.common.issues.push(...v.ctx.common.issues),v.result;let p=d.map(v=>new lu(v.ctx.common.issues));return kr(n,{code:dr.invalid_union,unionErrors:p}),ai}if(n.common.async)return Promise.all(l.map(async d=>{let p={...n,common:{...n.common,issues:[]},parent:null};return{result:await d._parseAsync({data:n.data,path:n.path,parent:p}),ctx:p}})).then(i);{let d,p=[];for(let _ of l){let y={...n,common:{...n.common,issues:[]},parent:null},w=_._parseSync({data:n.data,path:n.path,parent:y});if(w.status==="valid")return w;w.status==="dirty"&&!d&&(d={result:w,ctx:y}),y.common.issues.length&&p.push(y.common.issues)}if(d)return n.common.issues.push(...d.ctx.common.issues),d.result;let v=p.map(_=>new lu(_));return kr(n,{code:dr.invalid_union,unionErrors:v}),ai}}get options(){return this._def.options}};fb.create=(e,r)=>new fb({options:e,typeName:ei.ZodUnion,...Ni(r)});var Q1=e=>e instanceof ub?Q1(e.schema):e instanceof cu?Q1(e.innerType()):e instanceof lb?[e.value]:e instanceof cb?e.options:e instanceof db?Bn.objectValues(e.enum):e instanceof pb?Q1(e._def.innerType):e instanceof ob?[void 0]:e instanceof sb?[null]:e instanceof N0?[void 0,...Q1(e.unwrap())]:e instanceof kd?[null,...Q1(e.unwrap())]:e instanceof Z5||e instanceof vb?Q1(e.unwrap()):e instanceof mb?Q1(e._def.innerType):[],RR=class e extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r);if(n.parsedType!==Nr.object)return kr(n,{code:dr.invalid_type,expected:Nr.object,received:n.parsedType}),ai;let l=this.discriminator,i=n.data[l],d=this.optionsMap.get(i);return d?n.common.async?d._parseAsync({data:n.data,path:n.path,parent:n}):d._parseSync({data:n.data,path:n.path,parent:n}):(kr(n,{code:dr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[l]}),ai)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(r,n,l){let i=new Map;for(let d of n){let p=Q1(d.shape[r]);if(!p.length)throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);for(let v of p){if(i.has(v))throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(v)}`);i.set(v,d)}}return new e({typeName:ei.ZodDiscriminatedUnion,discriminator:r,options:n,optionsMap:i,...Ni(l)})}};function RY(e,r){let n=ep(e),l=ep(r);if(e===r)return{valid:!0,data:e};if(n===Nr.object&&l===Nr.object){let i=Bn.objectKeys(r),d=Bn.objectKeys(e).filter(v=>i.indexOf(v)!==-1),p={...e,...r};for(let v of d){let _=RY(e[v],r[v]);if(!_.valid)return{valid:!1};p[v]=_.data}return{valid:!0,data:p}}else if(n===Nr.array&&l===Nr.array){if(e.length!==r.length)return{valid:!1};let i=[];for(let d=0;d<e.length;d++){let p=e[d],v=r[d],_=RY(p,v);if(!_.valid)return{valid:!1};i.push(_.data)}return{valid:!0,data:i}}else return n===Nr.date&&l===Nr.date&&+e==+r?{valid:!0,data:e}:{valid:!1}}var hb=class extends Ci{_parse(r){let{status:n,ctx:l}=this._processInputParams(r),i=(d,p)=>{if(EY(d)||EY(p))return ai;let v=RY(d.value,p.value);return v.valid?((AY(d)||AY(p))&&n.dirty(),{status:n.value,value:v.data}):(kr(l,{code:dr.invalid_intersection_types}),ai)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([d,p])=>i(d,p)):i(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}};hb.create=(e,r,n)=>new hb({left:e,right:r,typeName:ei.ZodIntersection,...Ni(n)});var Id=class e extends Ci{_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.parsedType!==Nr.array)return kr(l,{code:dr.invalid_type,expected:Nr.array,received:l.parsedType}),ai;if(l.data.length<this._def.items.length)return kr(l,{code:dr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ai;!this._def.rest&&l.data.length>this._def.items.length&&(kr(l,{code:dr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let d=[...l.data].map((p,v)=>{let _=this._def.items[v]||this._def.rest;return _?_._parse(new C0(l,p,l.path,v)):null}).filter(p=>!!p);return l.common.async?Promise.all(d).then(p=>Pf.mergeArray(n,p)):Pf.mergeArray(n,d)}get items(){return this._def.items}rest(r){return new e({...this._def,rest:r})}};Id.create=(e,r)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Id({items:e,typeName:ei.ZodTuple,rest:null,...Ni(r)})};var TR=class e extends Ci{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.parsedType!==Nr.object)return kr(l,{code:dr.invalid_type,expected:Nr.object,received:l.parsedType}),ai;let i=[],d=this._def.keyType,p=this._def.valueType;for(let v in l.data)i.push({key:d._parse(new C0(l,v,l.path,v)),value:p._parse(new C0(l,l.data[v],l.path,v)),alwaysSet:v in l.data});return l.common.async?Pf.mergeObjectAsync(n,i):Pf.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(r,n,l){return n instanceof Ci?new e({keyType:r,valueType:n,typeName:ei.ZodRecord,...Ni(l)}):new e({keyType:uv.create(),valueType:r,typeName:ei.ZodRecord,...Ni(n)})}},w3=class extends Ci{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.parsedType!==Nr.map)return kr(l,{code:dr.invalid_type,expected:Nr.map,received:l.parsedType}),ai;let i=this._def.keyType,d=this._def.valueType,p=[...l.data.entries()].map(([v,_],y)=>({key:i._parse(new C0(l,v,l.path,[y,"key"])),value:d._parse(new C0(l,_,l.path,[y,"value"]))}));if(l.common.async){let v=new Map;return Promise.resolve().then(async()=>{for(let _ of p){let y=await _.key,w=await _.value;if(y.status==="aborted"||w.status==="aborted")return ai;(y.status==="dirty"||w.status==="dirty")&&n.dirty(),v.set(y.value,w.value)}return{status:n.value,value:v}})}else{let v=new Map;for(let _ of p){let y=_.key,w=_.value;if(y.status==="aborted"||w.status==="aborted")return ai;(y.status==="dirty"||w.status==="dirty")&&n.dirty(),v.set(y.value,w.value)}return{status:n.value,value:v}}}};w3.create=(e,r,n)=>new w3({valueType:r,keyType:e,typeName:ei.ZodMap,...Ni(n)});var _3=class e extends Ci{_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.parsedType!==Nr.set)return kr(l,{code:dr.invalid_type,expected:Nr.set,received:l.parsedType}),ai;let i=this._def;i.minSize!==null&&l.data.size<i.minSize.value&&(kr(l,{code:dr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&l.data.size>i.maxSize.value&&(kr(l,{code:dr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let d=this._def.valueType;function p(_){let y=new Set;for(let w of _){if(w.status==="aborted")return ai;w.status==="dirty"&&n.dirty(),y.add(w.value)}return{status:n.value,value:y}}let v=[...l.data.values()].map((_,y)=>d._parse(new C0(l,_,l.path,y)));return l.common.async?Promise.all(v).then(_=>p(_)):p(v)}min(r,n){return new e({...this._def,minSize:{value:r,message:$r.toString(n)}})}max(r,n){return new e({...this._def,maxSize:{value:r,message:$r.toString(n)}})}size(r,n){return this.min(r,n).max(r,n)}nonempty(r){return this.min(1,r)}};_3.create=(e,r)=>new _3({valueType:e,minSize:null,maxSize:null,typeName:ei.ZodSet,...Ni(r)});var IR=class e extends Ci{constructor(){super(...arguments),this.validate=this.implement}_parse(r){let{ctx:n}=this._processInputParams(r);if(n.parsedType!==Nr.function)return kr(n,{code:dr.invalid_type,expected:Nr.function,received:n.parsedType}),ai;function l(v,_){return ER({data:v,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xR(),g3].filter(y=>!!y),issueData:{code:dr.invalid_arguments,argumentsError:_}})}function i(v,_){return ER({data:v,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xR(),g3].filter(y=>!!y),issueData:{code:dr.invalid_return_type,returnTypeError:_}})}let d={errorMap:n.common.contextualErrorMap},p=n.data;if(this._def.returns instanceof cv){let v=this;return Zf(async function(..._){let y=new lu([]),w=await v._def.args.parseAsync(_,d).catch(x=>{throw y.addIssue(l(_,x)),y}),S=await Reflect.apply(p,this,w);return await v._def.returns._def.type.parseAsync(S,d).catch(x=>{throw y.addIssue(i(S,x)),y})})}else{let v=this;return Zf(function(..._){let y=v._def.args.safeParse(_,d);if(!y.success)throw new lu([l(_,y.error)]);let w=Reflect.apply(p,this,y.data),S=v._def.returns.safeParse(w,d);if(!S.success)throw new lu([i(w,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...r){return new e({...this._def,args:Id.create(r).rest(tp.create())})}returns(r){return new e({...this._def,returns:r})}implement(r){return this.parse(r)}strictImplement(r){return this.parse(r)}static create(r,n,l){return new e({args:r||Id.create([]).rest(tp.create()),returns:n||tp.create(),typeName:ei.ZodFunction,...Ni(l)})}},ub=class extends Ci{get schema(){return this._def.getter()}_parse(r){let{ctx:n}=this._processInputParams(r);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ub.create=(e,r)=>new ub({getter:e,typeName:ei.ZodLazy,...Ni(r)});var lb=class extends Ci{_parse(r){if(r.data!==this._def.value){let n=this._getOrReturnCtx(r);return kr(n,{received:n.data,code:dr.invalid_literal,expected:this._def.value}),ai}return{status:"valid",value:r.data}}get value(){return this._def.value}};lb.create=(e,r)=>new lb({value:e,typeName:ei.ZodLiteral,...Ni(r)});function cTe(e,r){return new cb({values:e,typeName:ei.ZodEnum,...Ni(r)})}var cb=class e extends Ci{constructor(){super(...arguments),z5.set(this,void 0)}_parse(r){if(typeof r.data!="string"){let n=this._getOrReturnCtx(r),l=this._def.values;return kr(n,{expected:Bn.joinValues(l),received:n.parsedType,code:dr.invalid_type}),ai}if(AR(this,z5,"f")||fTe(this,z5,new Set(this._def.values),"f"),!AR(this,z5,"f").has(r.data)){let n=this._getOrReturnCtx(r),l=this._def.values;return kr(n,{received:n.data,code:dr.invalid_enum_value,options:l}),ai}return Zf(r.data)}get options(){return this._def.values}get enum(){let r={};for(let n of this._def.values)r[n]=n;return r}get Values(){let r={};for(let n of this._def.values)r[n]=n;return r}get Enum(){let r={};for(let n of this._def.values)r[n]=n;return r}extract(r,n=this._def){return e.create(r,{...this._def,...n})}exclude(r,n=this._def){return e.create(this.options.filter(l=>!r.includes(l)),{...this._def,...n})}};z5=new WeakMap;cb.create=cTe;var db=class extends Ci{constructor(){super(...arguments),H5.set(this,void 0)}_parse(r){let n=Bn.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(r);if(l.parsedType!==Nr.string&&l.parsedType!==Nr.number){let i=Bn.objectValues(n);return kr(l,{expected:Bn.joinValues(i),received:l.parsedType,code:dr.invalid_type}),ai}if(AR(this,H5,"f")||fTe(this,H5,new Set(Bn.getValidEnumValues(this._def.values)),"f"),!AR(this,H5,"f").has(r.data)){let i=Bn.objectValues(n);return kr(l,{received:l.data,code:dr.invalid_enum_value,options:i}),ai}return Zf(r.data)}get enum(){return this._def.values}};H5=new WeakMap;db.create=(e,r)=>new db({values:e,typeName:ei.ZodNativeEnum,...Ni(r)});var cv=class extends Ci{unwrap(){return this._def.type}_parse(r){let{ctx:n}=this._processInputParams(r);if(n.parsedType!==Nr.promise&&n.common.async===!1)return kr(n,{code:dr.invalid_type,expected:Nr.promise,received:n.parsedType}),ai;let l=n.parsedType===Nr.promise?n.data:Promise.resolve(n.data);return Zf(l.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};cv.create=(e,r)=>new cv({type:e,typeName:ei.ZodPromise,...Ni(r)});var cu=class extends Ci{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ei.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){let{status:n,ctx:l}=this._processInputParams(r),i=this._def.effect||null,d={addIssue:p=>{kr(l,p),p.fatal?n.abort():n.dirty()},get path(){return l.path}};if(d.addIssue=d.addIssue.bind(d),i.type==="preprocess"){let p=i.transform(l.data,d);if(l.common.async)return Promise.resolve(p).then(async v=>{if(n.value==="aborted")return ai;let _=await this._def.schema._parseAsync({data:v,path:l.path,parent:l});return _.status==="aborted"?ai:_.status==="dirty"||n.value==="dirty"?v3(_.value):_});{if(n.value==="aborted")return ai;let v=this._def.schema._parseSync({data:p,path:l.path,parent:l});return v.status==="aborted"?ai:v.status==="dirty"||n.value==="dirty"?v3(v.value):v}}if(i.type==="refinement"){let p=v=>{let _=i.refinement(v,d);if(l.common.async)return Promise.resolve(_);if(_ instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return v};if(l.common.async===!1){let v=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return v.status==="aborted"?ai:(v.status==="dirty"&&n.dirty(),p(v.value),{status:n.value,value:v.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(v=>v.status==="aborted"?ai:(v.status==="dirty"&&n.dirty(),p(v.value).then(()=>({status:n.value,value:v.value}))))}if(i.type==="transform")if(l.common.async===!1){let p=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!tb(p))return p;let v=i.transform(p.value,d);if(v instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:v}}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(p=>tb(p)?Promise.resolve(i.transform(p.value,d)).then(v=>({status:n.value,value:v})):p);Bn.assertNever(i)}};cu.create=(e,r,n)=>new cu({schema:e,typeName:ei.ZodEffects,effect:r,...Ni(n)});cu.createWithPreprocess=(e,r,n)=>new cu({schema:r,effect:{type:"preprocess",transform:e},typeName:ei.ZodEffects,...Ni(n)});var N0=class extends Ci{_parse(r){return this._getType(r)===Nr.undefined?Zf(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};N0.create=(e,r)=>new N0({innerType:e,typeName:ei.ZodOptional,...Ni(r)});var kd=class extends Ci{_parse(r){return this._getType(r)===Nr.null?Zf(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};kd.create=(e,r)=>new kd({innerType:e,typeName:ei.ZodNullable,...Ni(r)});var pb=class extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r),l=n.data;return n.parsedType===Nr.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};pb.create=(e,r)=>new pb({innerType:e,typeName:ei.ZodDefault,defaultValue:typeof r.default=="function"?r.default:()=>r.default,...Ni(r)});var mb=class extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r),l={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return K5(i)?i.then(d=>({status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new lu(l.common.issues)},input:l.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new lu(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}};mb.create=(e,r)=>new mb({innerType:e,typeName:ei.ZodCatch,catchValue:typeof r.catch=="function"?r.catch:()=>r.catch,...Ni(r)});var M3=class extends Ci{_parse(r){if(this._getType(r)!==Nr.nan){let l=this._getOrReturnCtx(r);return kr(l,{code:dr.invalid_type,expected:Nr.nan,received:l.parsedType}),ai}return{status:"valid",value:r.data}}};M3.create=e=>new M3({typeName:ei.ZodNaN,...Ni(e)});var a6t=Symbol("zod_brand"),Z5=class extends Ci{_parse(r){let{ctx:n}=this._processInputParams(r),l=n.data;return this._def.type._parse({data:l,path:n.path,parent:n})}unwrap(){return this._def.type}},W5=class e extends Ci{_parse(r){let{status:n,ctx:l}=this._processInputParams(r);if(l.common.async)return(async()=>{let d=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return d.status==="aborted"?ai:d.status==="dirty"?(n.dirty(),v3(d.value)):this._def.out._parseAsync({data:d.value,path:l.path,parent:l})})();{let i=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return i.status==="aborted"?ai:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:l.path,parent:l})}}static create(r,n){return new e({in:r,out:n,typeName:ei.ZodPipeline})}},vb=class extends Ci{_parse(r){let n=this._def.innerType._parse(r),l=i=>(tb(i)&&(i.value=Object.freeze(i.value)),i);return K5(n)?n.then(i=>l(i)):l(n)}unwrap(){return this._def.innerType}};vb.create=(e,r)=>new vb({innerType:e,typeName:ei.ZodReadonly,...Ni(r)});function aTe(e,r){let n=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function dTe(e,r={},n){return e?lv.create().superRefine((l,i)=>{var d,p;let v=e(l);if(v instanceof Promise)return v.then(_=>{var y,w;if(!_){let S=aTe(r,l),M=(w=(y=S.fatal)!==null&&y!==void 0?y:n)!==null&&w!==void 0?w:!0;i.addIssue({code:"custom",...S,fatal:M})}});if(!v){let _=aTe(r,l),y=(p=(d=_.fatal)!==null&&d!==void 0?d:n)!==null&&p!==void 0?p:!0;i.addIssue({code:"custom",..._,fatal:y})}}):lv.create()}var o6t={object:wh.lazycreate},ei;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ei||(ei={}));var s6t=(e,r={message:`Input not instance of ${e.name}`})=>dTe(n=>n instanceof e,r),pTe=uv.create,mTe=rb.create,f6t=M3.create,h6t=ib.create,vTe=nb.create,u6t=ab.create,l6t=b3.create,c6t=ob.create,d6t=sb.create,p6t=lv.create,m6t=tp.create,v6t=ic.create,g6t=y3.create,b6t=rp.create,y6t=wh.create,w6t=wh.strictCreate,_6t=fb.create,M6t=RR.create,S6t=hb.create,x6t=Id.create,E6t=TR.create,A6t=w3.create,R6t=_3.create,T6t=IR.create,I6t=ub.create,k6t=lb.create,B6t=cb.create,P6t=db.create,O6t=cv.create,oTe=cu.create,N6t=N0.create,C6t=kd.create,L6t=cu.createWithPreprocess,D6t=W5.create,$6t=()=>pTe().optional(),q6t=()=>mTe().optional(),U6t=()=>vTe().optional(),j6t={string:e=>uv.create({...e,coerce:!0}),number:e=>rb.create({...e,coerce:!0}),boolean:e=>nb.create({...e,coerce:!0}),bigint:e=>ib.create({...e,coerce:!0}),date:e=>ab.create({...e,coerce:!0})},F6t=ai,Dr=Object.freeze({__proto__:null,defaultErrorMap:g3,setErrorMap:Lbt,getErrorMap:xR,makeIssue:ER,EMPTY_PATH:Dbt,addIssueToContext:kr,ParseStatus:Pf,INVALID:ai,DIRTY:v3,OK:Zf,isAborted:EY,isDirty:AY,isValid:tb,isAsync:K5,get util(){return Bn},get objectUtil(){return xY},ZodParsedType:Nr,getParsedType:ep,ZodType:Ci,datetimeRegex:lTe,ZodString:uv,ZodNumber:rb,ZodBigInt:ib,ZodBoolean:nb,ZodDate:ab,ZodSymbol:b3,ZodUndefined:ob,ZodNull:sb,ZodAny:lv,ZodUnknown:tp,ZodNever:ic,ZodVoid:y3,ZodArray:rp,ZodObject:wh,ZodUnion:fb,ZodDiscriminatedUnion:RR,ZodIntersection:hb,ZodTuple:Id,ZodRecord:TR,ZodMap:w3,ZodSet:_3,ZodFunction:IR,ZodLazy:ub,ZodLiteral:lb,ZodEnum:cb,ZodNativeEnum:db,ZodPromise:cv,ZodEffects:cu,ZodTransformer:cu,ZodOptional:N0,ZodNullable:kd,ZodDefault:pb,ZodCatch:mb,ZodNaN:M3,BRAND:a6t,ZodBranded:Z5,ZodPipeline:W5,ZodReadonly:vb,custom:dTe,Schema:Ci,ZodSchema:Ci,late:o6t,get ZodFirstPartyTypeKind(){return ei},coerce:j6t,any:p6t,array:b6t,bigint:h6t,boolean:vTe,date:u6t,discriminatedUnion:M6t,effect:oTe,enum:B6t,function:T6t,instanceof:s6t,intersection:S6t,lazy:I6t,literal:k6t,map:A6t,nan:f6t,nativeEnum:P6t,never:v6t,null:d6t,nullable:C6t,number:mTe,object:y6t,oboolean:U6t,onumber:q6t,optional:N6t,ostring:$6t,pipeline:D6t,preprocess:L6t,promise:O6t,record:E6t,set:R6t,strictObject:w6t,string:pTe,symbol:l6t,transformer:oTe,tuple:x6t,undefined:c6t,union:_6t,unknown:m6t,void:g6t,NEVER:F6t,ZodIssueCode:dr,quotelessJson:Cbt,ZodError:lu});we();Me();_e();var kR=new RegExp("^[a-zA-Z0-9_-]{43}$"),p0r=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),m0r=new RegExp("^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$"),v0r=We.env.ARNS_REGISTRY_TX??"bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U",g0r="_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8",z6t="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",b0r=z6t,TY="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",_h="qNvAoz0TgcH7DMg8BCVn8jF32QH5L6T29VjHxhHqqGE",S3="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",IY=1e6,gTe="nEjlSFA_8narJlVHApbczDPkMc9znSqYtqtf1iOdoxM",bTe="sOW9Sdm1yoPRrzerC5iu1nsupp4e6I-HnJyYVHzvzQo",yTe="fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",wTe="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var G5=Dr.string({description:"Arweave Transaction ID"}).refine(e=>kR.test(e),{message:"Must be an Arweave Transaction ID"}),BR=Dr.string({description:"AO Address"}),_Te=Dr.string({description:"Integer String"}).refine(e=>{let r=parseInt(e);return Number.isInteger(r)&&r>=0},{message:"Must be a non negative integer string"}),H6t=Dr.string(),kY=Dr.array(Dr.string()),PR=Dr.object({transactionId:G5.describe("The Target ID of the undername"),ttlSeconds:Dr.number(),priority:Dr.number().optional()}),OR=Dr.record(Dr.string(),PR),NR=Dr.array(BR.describe("Controller address")),CR=Dr.record(BR.describe("Holder address"),Dr.number()),BY=Dr.object({Name:Dr.string().describe("The name of the ANT."),Ticker:Dr.string().describe("The ticker symbol for the ANT."),Description:Dr.string().describe("The description for the ANT."),Keywords:kY.describe("The keywords for the ANT."),Denomination:Dr.number().describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.").min(0,{message:"Denomination must be a non-negative number"}),Owner:BR.describe("The Owners address."),Controllers:NR.describe("Controllers of the ANT who have administrative privileges."),Records:OR.describe("Records associated with the ANT."),Balances:CR.describe("Balance details for each address holding the ANT."),Logo:G5.describe("Transaction ID of the ANT logo."),TotalSupply:Dr.number().describe("Total supply of the ANT in circulation.").min(0,{message:"Total supply must be a non-negative number"}),Initialized:Dr.boolean().describe("Flag indicating whether the ANT has been initialized.")}),STe=Dr.object({name:Dr.string().describe("The name of the ANT."),ticker:Dr.string().describe("The ticker symbol for the ANT."),description:Dr.string().describe("The description for the ANT."),keywords:kY.describe("The keywords for the ANT."),owner:BR.describe("The Owners address."),controllers:NR.describe("Controllers of the ANT who have administrative privileges."),records:OR.describe("Records associated with the ANT."),balances:CR.describe("Balance details for each address holding the ANT."),logo:G5.describe("Transaction ID of the ANT logo.")}),K6t=["balance","balances","totalSupply","info","controllers","record","records","state"],Z6t=["_eval","_default","transfer","addController","removeController","setRecord","removeRecord","setName","setTicker","setDescription","setKeywords","setLogo","initializeState","releaseName","reassignName","approvePrimaryName","removePrimaryNames"],W6t=[...K6t,...Z6t],MTe=Dr.array(Dr.string({description:"Handler Name"})).refine(e=>W6t.every(r=>e.includes(r)),{message:"ANT is missing required handlers"}),xTe=Dr.object({Name:Dr.string().describe("The name of the ANT."),Owner:G5.describe("The Owners address."),Ticker:Dr.string().describe("The ticker symbol for the ANT."),"Total-Supply":_Te.describe("Total supply of the ANT in circulation."),Description:H6t.describe("The description for the ANT."),Keywords:kY.describe("The keywords for the ANT."),Logo:G5.describe("Transaction ID of the ANT logo."),Denomination:_Te.describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers."),Handlers:MTe.optional().describe("List of handlers for the ANT."),HandlerNames:MTe.optional().describe('Deprecated: List of handlers for the ANT. Use "Handlers" instead.')});function E0r(e){return BY.safeParse(e).success}we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();var G6t=Object.create,fN=Object.defineProperty,V6t=Object.getOwnPropertyDescriptor,Y6t=Object.getOwnPropertyNames,J6t=Object.getPrototypeOf,X6t=Object.prototype.hasOwnProperty,ul=(e,r)=>()=>(e&&(r=e(e=0)),r),Ka=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),hN=(e,r)=>{for(var n in r)fN(e,n,{get:r[n],enumerable:!0})},hCe=(e,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Y6t(r))!X6t.call(e,i)&&i!==n&&fN(e,i,{get:()=>r[i],enumerable:!(l=V6t(r,i))||l.enumerable});return e},uN=(e,r,n)=>(n=e!=null?G6t(J6t(e)):{},hCe(r||!e||!e.__esModule?fN(n,"default",{value:e,enumerable:!0}):n,e)),ETe=e=>hCe(fN({},"__esModule",{value:!0}),e),Q6t=Ka(e=>{"use strict";e.byteLength=_,e.toByteArray=w,e.fromByteArray=x;var r=[],n=[],l=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(d=0,p=i.length;d<p;++d)r[d]=i[d],n[i.charCodeAt(d)]=d;var d,p;n[45]=62,n[95]=63;function v(E){var T=E.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=E.indexOf("=");I===-1&&(I=T);var B=I===T?0:4-I%4;return[I,B]}function _(E){var T=v(E),I=T[0],B=T[1];return(I+B)*3/4-B}function y(E,T,I){return(T+I)*3/4-I}function w(E){var T,I=v(E),B=I[0],O=I[1],N=new l(y(E,B,O)),H=0,K=O>0?B-4:B,J;for(J=0;J<K;J+=4)T=n[E.charCodeAt(J)]<<18|n[E.charCodeAt(J+1)]<<12|n[E.charCodeAt(J+2)]<<6|n[E.charCodeAt(J+3)],N[H++]=T>>16&255,N[H++]=T>>8&255,N[H++]=T&255;return O===2&&(T=n[E.charCodeAt(J)]<<2|n[E.charCodeAt(J+1)]>>4,N[H++]=T&255),O===1&&(T=n[E.charCodeAt(J)]<<10|n[E.charCodeAt(J+1)]<<4|n[E.charCodeAt(J+2)]>>2,N[H++]=T>>8&255,N[H++]=T&255),N}function S(E){return r[E>>18&63]+r[E>>12&63]+r[E>>6&63]+r[E&63]}function M(E,T,I){for(var B,O=[],N=T;N<I;N+=3)B=(E[N]<<16&16711680)+(E[N+1]<<8&65280)+(E[N+2]&255),O.push(S(B));return O.join("")}function x(E){for(var T,I=E.length,B=I%3,O=[],N=16383,H=0,K=I-B;H<K;H+=N)O.push(M(E,H,H+N>K?K:H+N));return B===1?(T=E[I-1],O.push(r[T>>2]+r[T<<4&63]+"==")):B===2&&(T=(E[I-2]<<8)+E[I-1],O.push(r[T>>10]+r[T>>4&63]+r[T<<2&63]+"=")),O.join("")}}),eyt=Ka(e=>{e.read=function(r,n,l,i,d){var p,v,_=d*8-i-1,y=(1<<_)-1,w=y>>1,S=-7,M=l?d-1:0,x=l?-1:1,E=r[n+M];for(M+=x,p=E&(1<<-S)-1,E>>=-S,S+=_;S>0;p=p*256+r[n+M],M+=x,S-=8);for(v=p&(1<<-S)-1,p>>=-S,S+=i;S>0;v=v*256+r[n+M],M+=x,S-=8);if(p===0)p=1-w;else{if(p===y)return v?NaN:(E?-1:1)*(1/0);v=v+Math.pow(2,i),p=p-w}return(E?-1:1)*v*Math.pow(2,p-i)},e.write=function(r,n,l,i,d,p){var v,_,y,w=p*8-d-1,S=(1<<w)-1,M=S>>1,x=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:p-1,T=i?1:-1,I=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(_=isNaN(n)?1:0,v=S):(v=Math.floor(Math.log(n)/Math.LN2),n*(y=Math.pow(2,-v))<1&&(v--,y*=2),v+M>=1?n+=x/y:n+=x*Math.pow(2,1-M),n*y>=2&&(v++,y/=2),v+M>=S?(_=0,v=S):v+M>=1?(_=(n*y-1)*Math.pow(2,d),v=v+M):(_=n*Math.pow(2,M-1)*Math.pow(2,d),v=0));d>=8;r[l+E]=_&255,E+=T,_/=256,d-=8);for(v=v<<d|_,w+=d;w>0;r[l+E]=v&255,E+=T,v/=256,w-=8);r[l+E-T]|=I*128}}),uCe=Ka(e=>{"use strict";var r=Q6t(),n=eyt(),l=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=v,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,v.TYPED_ARRAY_SUPPORT=d(),!v.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function d(){try{let P=new Uint8Array(1),C={foo:function(){return 42}};return Object.setPrototypeOf(C,Uint8Array.prototype),Object.setPrototypeOf(P,C),P.foo()===42}catch{return!1}}Object.defineProperty(v.prototype,"parent",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.buffer}}),Object.defineProperty(v.prototype,"offset",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.byteOffset}});function p(P){if(P>i)throw new RangeError('The value "'+P+'" is invalid for option "size"');let C=new Uint8Array(P);return Object.setPrototypeOf(C,v.prototype),C}function v(P,C,U){if(typeof P=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(P)}return _(P,C,U)}v.poolSize=8192;function _(P,C,U){if(typeof P=="string")return M(P,C);if(ArrayBuffer.isView(P))return E(P);if(P==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P);if(Be(P,ArrayBuffer)||P&&Be(P.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Be(P,SharedArrayBuffer)||P&&Be(P.buffer,SharedArrayBuffer)))return T(P,C,U);if(typeof P=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let ee=P.valueOf&&P.valueOf();if(ee!=null&&ee!==P)return v.from(ee,C,U);let Q=I(P);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof P[Symbol.toPrimitive]=="function")return v.from(P[Symbol.toPrimitive]("string"),C,U);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P)}v.from=function(P,C,U){return _(P,C,U)},Object.setPrototypeOf(v.prototype,Uint8Array.prototype),Object.setPrototypeOf(v,Uint8Array);function y(P){if(typeof P!="number")throw new TypeError('"size" argument must be of type number');if(P<0)throw new RangeError('The value "'+P+'" is invalid for option "size"')}function w(P,C,U){return y(P),P<=0?p(P):C!==void 0?typeof U=="string"?p(P).fill(C,U):p(P).fill(C):p(P)}v.alloc=function(P,C,U){return w(P,C,U)};function S(P){return y(P),p(P<0?0:B(P)|0)}v.allocUnsafe=function(P){return S(P)},v.allocUnsafeSlow=function(P){return S(P)};function M(P,C){if((typeof C!="string"||C==="")&&(C="utf8"),!v.isEncoding(C))throw new TypeError("Unknown encoding: "+C);let U=N(P,C)|0,ee=p(U),Q=ee.write(P,C);return Q!==U&&(ee=ee.slice(0,Q)),ee}function x(P){let C=P.length<0?0:B(P.length)|0,U=p(C);for(let ee=0;ee<C;ee+=1)U[ee]=P[ee]&255;return U}function E(P){if(Be(P,Uint8Array)){let C=new Uint8Array(P);return T(C.buffer,C.byteOffset,C.byteLength)}return x(P)}function T(P,C,U){if(C<0||P.byteLength<C)throw new RangeError('"offset" is outside of buffer bounds');if(P.byteLength<C+(U||0))throw new RangeError('"length" is outside of buffer bounds');let ee;return C===void 0&&U===void 0?ee=new Uint8Array(P):U===void 0?ee=new Uint8Array(P,C):ee=new Uint8Array(P,C,U),Object.setPrototypeOf(ee,v.prototype),ee}function I(P){if(v.isBuffer(P)){let C=B(P.length)|0,U=p(C);return U.length===0||P.copy(U,0,0,C),U}if(P.length!==void 0)return typeof P.length!="number"||be(P.length)?p(0):x(P);if(P.type==="Buffer"&&Array.isArray(P.data))return x(P.data)}function B(P){if(P>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return P|0}function O(P){return+P!=P&&(P=0),v.alloc(+P)}v.isBuffer=function(P){return P!=null&&P._isBuffer===!0&&P!==v.prototype},v.compare=function(P,C){if(Be(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),Be(C,Uint8Array)&&(C=v.from(C,C.offset,C.byteLength)),!v.isBuffer(P)||!v.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(P===C)return 0;let U=P.length,ee=C.length;for(let Q=0,te=Math.min(U,ee);Q<te;++Q)if(P[Q]!==C[Q]){U=P[Q],ee=C[Q];break}return U<ee?-1:ee<U?1:0},v.isEncoding=function(P){switch(String(P).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}},v.concat=function(P,C){if(!Array.isArray(P))throw new TypeError('"list" argument must be an Array of Buffers');if(P.length===0)return v.alloc(0);let U;if(C===void 0)for(C=0,U=0;U<P.length;++U)C+=P[U].length;let ee=v.allocUnsafe(C),Q=0;for(U=0;U<P.length;++U){let te=P[U];if(Be(te,Uint8Array))Q+te.length>ee.length?(v.isBuffer(te)||(te=v.from(te)),te.copy(ee,Q)):Uint8Array.prototype.set.call(ee,te,Q);else if(v.isBuffer(te))te.copy(ee,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=te.length}return ee};function N(P,C){if(v.isBuffer(P))return P.length;if(ArrayBuffer.isView(P)||Be(P,ArrayBuffer))return P.byteLength;if(typeof P!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof P);let U=P.length,ee=arguments.length>2&&arguments[2]===!0;if(!ee&&U===0)return 0;let Q=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return U;case"utf8":case"utf-8":return re(P).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U*2;case"hex":return U>>>1;case"base64":return he(P).length;default:if(Q)return ee?-1:re(P).length;C=(""+C).toLowerCase(),Q=!0}}v.byteLength=N;function H(P,C,U){let ee=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((U===void 0||U>this.length)&&(U=this.length),U<=0)||(U>>>=0,C>>>=0,U<=C))return"";for(P||(P="utf8");;)switch(P){case"hex":return o(this,C,U);case"utf8":case"utf-8":return u(this,C,U);case"ascii":return m(this,C,U);case"latin1":case"binary":return f(this,C,U);case"base64":return s(this,C,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,C,U);default:if(ee)throw new TypeError("Unknown encoding: "+P);P=(P+"").toLowerCase(),ee=!0}}v.prototype._isBuffer=!0;function K(P,C,U){let ee=P[C];P[C]=P[U],P[U]=ee}v.prototype.swap16=function(){let P=this.length;if(P%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<P;C+=2)K(this,C,C+1);return this},v.prototype.swap32=function(){let P=this.length;if(P%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<P;C+=4)K(this,C,C+3),K(this,C+1,C+2);return this},v.prototype.swap64=function(){let P=this.length;if(P%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<P;C+=8)K(this,C,C+7),K(this,C+1,C+6),K(this,C+2,C+5),K(this,C+3,C+4);return this},v.prototype.toString=function(){let P=this.length;return P===0?"":arguments.length===0?u(this,0,P):H.apply(this,arguments)},v.prototype.toLocaleString=v.prototype.toString,v.prototype.equals=function(P){if(!v.isBuffer(P))throw new TypeError("Argument must be a Buffer");return this===P?!0:v.compare(this,P)===0},v.prototype.inspect=function(){let P="",C=e.INSPECT_MAX_BYTES;return P=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(P+=" ... "),"<Buffer "+P+">"},l&&(v.prototype[l]=v.prototype.inspect),v.prototype.compare=function(P,C,U,ee,Q){if(Be(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),!v.isBuffer(P))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof P);if(C===void 0&&(C=0),U===void 0&&(U=P?P.length:0),ee===void 0&&(ee=0),Q===void 0&&(Q=this.length),C<0||U>P.length||ee<0||Q>this.length)throw new RangeError("out of range index");if(ee>=Q&&C>=U)return 0;if(ee>=Q)return-1;if(C>=U)return 1;if(C>>>=0,U>>>=0,ee>>>=0,Q>>>=0,this===P)return 0;let te=Q-ee,le=U-C,Ie=Math.min(te,le),se=this.slice(ee,Q),Ee=P.slice(C,U);for(let me=0;me<Ie;++me)if(se[me]!==Ee[me]){te=se[me],le=Ee[me];break}return te<le?-1:le<te?1:0};function J(P,C,U,ee,Q){if(P.length===0)return-1;if(typeof U=="string"?(ee=U,U=0):U>2147483647?U=2147483647:U<-2147483648&&(U=-2147483648),U=+U,be(U)&&(U=Q?0:P.length-1),U<0&&(U=P.length+U),U>=P.length){if(Q)return-1;U=P.length-1}else if(U<0)if(Q)U=0;else return-1;if(typeof C=="string"&&(C=v.from(C,ee)),v.isBuffer(C))return C.length===0?-1:L(P,C,U,ee,Q);if(typeof C=="number")return C=C&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(P,C,U):Uint8Array.prototype.lastIndexOf.call(P,C,U):L(P,[C],U,ee,Q);throw new TypeError("val must be string, number or Buffer")}function L(P,C,U,ee,Q){let te=1,le=P.length,Ie=C.length;if(ee!==void 0&&(ee=String(ee).toLowerCase(),ee==="ucs2"||ee==="ucs-2"||ee==="utf16le"||ee==="utf-16le")){if(P.length<2||C.length<2)return-1;te=2,le/=2,Ie/=2,U/=2}function se(me,pe){return te===1?me[pe]:me.readUInt16BE(pe*te)}let Ee;if(Q){let me=-1;for(Ee=U;Ee<le;Ee++)if(se(P,Ee)===se(C,me===-1?0:Ee-me)){if(me===-1&&(me=Ee),Ee-me+1===Ie)return me*te}else me!==-1&&(Ee-=Ee-me),me=-1}else for(U+Ie>le&&(U=le-Ie),Ee=U;Ee>=0;Ee--){let me=!0;for(let pe=0;pe<Ie;pe++)if(se(P,Ee+pe)!==se(C,pe)){me=!1;break}if(me)return Ee}return-1}v.prototype.includes=function(P,C,U){return this.indexOf(P,C,U)!==-1},v.prototype.indexOf=function(P,C,U){return J(this,P,C,U,!0)},v.prototype.lastIndexOf=function(P,C,U){return J(this,P,C,U,!1)};function $(P,C,U,ee){U=Number(U)||0;let Q=P.length-U;ee?(ee=Number(ee),ee>Q&&(ee=Q)):ee=Q;let te=C.length;ee>te/2&&(ee=te/2);let le;for(le=0;le<ee;++le){let Ie=parseInt(C.substr(le*2,2),16);if(be(Ie))return le;P[U+le]=Ie}return le}function V(P,C,U,ee){return Re(re(C,P.length-U),P,U,ee)}function h(P,C,U,ee){return Re(fe(C),P,U,ee)}function t(P,C,U,ee){return Re(he(C),P,U,ee)}function a(P,C,U,ee){return Re(ye(C,P.length-U),P,U,ee)}v.prototype.write=function(P,C,U,ee){if(C===void 0)ee="utf8",U=this.length,C=0;else if(U===void 0&&typeof C=="string")ee=C,U=this.length,C=0;else if(isFinite(C))C=C>>>0,isFinite(U)?(U=U>>>0,ee===void 0&&(ee="utf8")):(ee=U,U=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-C;if((U===void 0||U>Q)&&(U=Q),P.length>0&&(U<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");ee||(ee="utf8");let te=!1;for(;;)switch(ee){case"hex":return $(this,P,C,U);case"utf8":case"utf-8":return V(this,P,C,U);case"ascii":case"latin1":case"binary":return h(this,P,C,U);case"base64":return t(this,P,C,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,P,C,U);default:if(te)throw new TypeError("Unknown encoding: "+ee);ee=(""+ee).toLowerCase(),te=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s(P,C,U){return C===0&&U===P.length?r.fromByteArray(P):r.fromByteArray(P.slice(C,U))}function u(P,C,U){U=Math.min(P.length,U);let ee=[],Q=C;for(;Q<U;){let te=P[Q],le=null,Ie=te>239?4:te>223?3:te>191?2:1;if(Q+Ie<=U){let se,Ee,me,pe;switch(Ie){case 1:te<128&&(le=te);break;case 2:se=P[Q+1],(se&192)===128&&(pe=(te&31)<<6|se&63,pe>127&&(le=pe));break;case 3:se=P[Q+1],Ee=P[Q+2],(se&192)===128&&(Ee&192)===128&&(pe=(te&15)<<12|(se&63)<<6|Ee&63,pe>2047&&(pe<55296||pe>57343)&&(le=pe));break;case 4:se=P[Q+1],Ee=P[Q+2],me=P[Q+3],(se&192)===128&&(Ee&192)===128&&(me&192)===128&&(pe=(te&15)<<18|(se&63)<<12|(Ee&63)<<6|me&63,pe>65535&&pe<1114112&&(le=pe))}}le===null?(le=65533,Ie=1):le>65535&&(le-=65536,ee.push(le>>>10&1023|55296),le=56320|le&1023),ee.push(le),Q+=Ie}return b(ee)}var c=4096;function b(P){let C=P.length;if(C<=c)return String.fromCharCode.apply(String,P);let U="",ee=0;for(;ee<C;)U+=String.fromCharCode.apply(String,P.slice(ee,ee+=c));return U}function m(P,C,U){let ee="";U=Math.min(P.length,U);for(let Q=C;Q<U;++Q)ee+=String.fromCharCode(P[Q]&127);return ee}function f(P,C,U){let ee="";U=Math.min(P.length,U);for(let Q=C;Q<U;++Q)ee+=String.fromCharCode(P[Q]);return ee}function o(P,C,U){let ee=P.length;(!C||C<0)&&(C=0),(!U||U<0||U>ee)&&(U=ee);let Q="";for(let te=C;te<U;++te)Q+=Ne[P[te]];return Q}function g(P,C,U){let ee=P.slice(C,U),Q="";for(let te=0;te<ee.length-1;te+=2)Q+=String.fromCharCode(ee[te]+ee[te+1]*256);return Q}v.prototype.slice=function(P,C){let U=this.length;P=~~P,C=C===void 0?U:~~C,P<0?(P+=U,P<0&&(P=0)):P>U&&(P=U),C<0?(C+=U,C<0&&(C=0)):C>U&&(C=U),C<P&&(C=P);let ee=this.subarray(P,C);return Object.setPrototypeOf(ee,v.prototype),ee};function A(P,C,U){if(P%1!==0||P<0)throw new RangeError("offset is not uint");if(P+C>U)throw new RangeError("Trying to access beyond buffer length")}v.prototype.readUintLE=v.prototype.readUIntLE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P],Q=1,te=0;for(;++te<C&&(Q*=256);)ee+=this[P+te]*Q;return ee},v.prototype.readUintBE=v.prototype.readUIntBE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P+--C],Q=1;for(;C>0&&(Q*=256);)ee+=this[P+--C]*Q;return ee},v.prototype.readUint8=v.prototype.readUInt8=function(P,C){return P=P>>>0,C||A(P,1,this.length),this[P]},v.prototype.readUint16LE=v.prototype.readUInt16LE=function(P,C){return P=P>>>0,C||A(P,2,this.length),this[P]|this[P+1]<<8},v.prototype.readUint16BE=v.prototype.readUInt16BE=function(P,C){return P=P>>>0,C||A(P,2,this.length),this[P]<<8|this[P+1]},v.prototype.readUint32LE=v.prototype.readUInt32LE=function(P,C){return P=P>>>0,C||A(P,4,this.length),(this[P]|this[P+1]<<8|this[P+2]<<16)+this[P+3]*16777216},v.prototype.readUint32BE=v.prototype.readUInt32BE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]*16777216+(this[P+1]<<16|this[P+2]<<8|this[P+3])},v.prototype.readBigUInt64LE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=C+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24,Q=this[++P]+this[++P]*2**8+this[++P]*2**16+U*2**24;return BigInt(ee)+(BigInt(Q)<<BigInt(32))}),v.prototype.readBigUInt64BE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=C*2**24+this[++P]*2**16+this[++P]*2**8+this[++P],Q=this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+U;return(BigInt(ee)<<BigInt(32))+BigInt(Q)}),v.prototype.readIntLE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P],Q=1,te=0;for(;++te<C&&(Q*=256);)ee+=this[P+te]*Q;return Q*=128,ee>=Q&&(ee-=Math.pow(2,8*C)),ee},v.prototype.readIntBE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=C,Q=1,te=this[P+--ee];for(;ee>0&&(Q*=256);)te+=this[P+--ee]*Q;return Q*=128,te>=Q&&(te-=Math.pow(2,8*C)),te},v.prototype.readInt8=function(P,C){return P=P>>>0,C||A(P,1,this.length),this[P]&128?(255-this[P]+1)*-1:this[P]},v.prototype.readInt16LE=function(P,C){P=P>>>0,C||A(P,2,this.length);let U=this[P]|this[P+1]<<8;return U&32768?U|4294901760:U},v.prototype.readInt16BE=function(P,C){P=P>>>0,C||A(P,2,this.length);let U=this[P+1]|this[P]<<8;return U&32768?U|4294901760:U},v.prototype.readInt32LE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]|this[P+1]<<8|this[P+2]<<16|this[P+3]<<24},v.prototype.readInt32BE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]<<24|this[P+1]<<16|this[P+2]<<8|this[P+3]},v.prototype.readBigInt64LE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=this[P+4]+this[P+5]*2**8+this[P+6]*2**16+(U<<24);return(BigInt(ee)<<BigInt(32))+BigInt(C+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24)}),v.prototype.readBigInt64BE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=(C<<24)+this[++P]*2**16+this[++P]*2**8+this[++P];return(BigInt(ee)<<BigInt(32))+BigInt(this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+U)}),v.prototype.readFloatLE=function(P,C){return P=P>>>0,C||A(P,4,this.length),n.read(this,P,!0,23,4)},v.prototype.readFloatBE=function(P,C){return P=P>>>0,C||A(P,4,this.length),n.read(this,P,!1,23,4)},v.prototype.readDoubleLE=function(P,C){return P=P>>>0,C||A(P,8,this.length),n.read(this,P,!0,52,8)},v.prototype.readDoubleBE=function(P,C){return P=P>>>0,C||A(P,8,this.length),n.read(this,P,!1,52,8)};function R(P,C,U,ee,Q,te){if(!v.isBuffer(P))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>Q||C<te)throw new RangeError('"value" argument is out of bounds');if(U+ee>P.length)throw new RangeError("Index out of range")}v.prototype.writeUintLE=v.prototype.writeUIntLE=function(P,C,U,ee){if(P=+P,C=C>>>0,U=U>>>0,!ee){let le=Math.pow(2,8*U)-1;R(this,P,C,U,le,0)}let Q=1,te=0;for(this[C]=P&255;++te<U&&(Q*=256);)this[C+te]=P/Q&255;return C+U},v.prototype.writeUintBE=v.prototype.writeUIntBE=function(P,C,U,ee){if(P=+P,C=C>>>0,U=U>>>0,!ee){let le=Math.pow(2,8*U)-1;R(this,P,C,U,le,0)}let Q=U-1,te=1;for(this[C+Q]=P&255;--Q>=0&&(te*=256);)this[C+Q]=P/te&255;return C+U},v.prototype.writeUint8=v.prototype.writeUInt8=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,1,255,0),this[C]=P&255,C+1},v.prototype.writeUint16LE=v.prototype.writeUInt16LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,65535,0),this[C]=P&255,this[C+1]=P>>>8,C+2},v.prototype.writeUint16BE=v.prototype.writeUInt16BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,65535,0),this[C]=P>>>8,this[C+1]=P&255,C+2},v.prototype.writeUint32LE=v.prototype.writeUInt32LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,4294967295,0),this[C+3]=P>>>24,this[C+2]=P>>>16,this[C+1]=P>>>8,this[C]=P&255,C+4},v.prototype.writeUint32BE=v.prototype.writeUInt32BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,4294967295,0),this[C]=P>>>24,this[C+1]=P>>>16,this[C+2]=P>>>8,this[C+3]=P&255,C+4};function k(P,C,U,ee,Q){z(C,ee,Q,P,U,7);let te=Number(C&BigInt(4294967295));P[U++]=te,te=te>>8,P[U++]=te,te=te>>8,P[U++]=te,te=te>>8,P[U++]=te;let le=Number(C>>BigInt(32)&BigInt(4294967295));return P[U++]=le,le=le>>8,P[U++]=le,le=le>>8,P[U++]=le,le=le>>8,P[U++]=le,U}function q(P,C,U,ee,Q){z(C,ee,Q,P,U,7);let te=Number(C&BigInt(4294967295));P[U+7]=te,te=te>>8,P[U+6]=te,te=te>>8,P[U+5]=te,te=te>>8,P[U+4]=te;let le=Number(C>>BigInt(32)&BigInt(4294967295));return P[U+3]=le,le=le>>8,P[U+2]=le,le=le>>8,P[U+1]=le,le=le>>8,P[U]=le,U+8}v.prototype.writeBigUInt64LE=qe(function(P,C=0){return k(this,P,C,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeBigUInt64BE=qe(function(P,C=0){return q(this,P,C,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeIntLE=function(P,C,U,ee){if(P=+P,C=C>>>0,!ee){let Ie=Math.pow(2,8*U-1);R(this,P,C,U,Ie-1,-Ie)}let Q=0,te=1,le=0;for(this[C]=P&255;++Q<U&&(te*=256);)P<0&&le===0&&this[C+Q-1]!==0&&(le=1),this[C+Q]=(P/te>>0)-le&255;return C+U},v.prototype.writeIntBE=function(P,C,U,ee){if(P=+P,C=C>>>0,!ee){let Ie=Math.pow(2,8*U-1);R(this,P,C,U,Ie-1,-Ie)}let Q=U-1,te=1,le=0;for(this[C+Q]=P&255;--Q>=0&&(te*=256);)P<0&&le===0&&this[C+Q+1]!==0&&(le=1),this[C+Q]=(P/te>>0)-le&255;return C+U},v.prototype.writeInt8=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,1,127,-128),P<0&&(P=255+P+1),this[C]=P&255,C+1},v.prototype.writeInt16LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,32767,-32768),this[C]=P&255,this[C+1]=P>>>8,C+2},v.prototype.writeInt16BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,32767,-32768),this[C]=P>>>8,this[C+1]=P&255,C+2},v.prototype.writeInt32LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,2147483647,-2147483648),this[C]=P&255,this[C+1]=P>>>8,this[C+2]=P>>>16,this[C+3]=P>>>24,C+4},v.prototype.writeInt32BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,2147483647,-2147483648),P<0&&(P=4294967295+P+1),this[C]=P>>>24,this[C+1]=P>>>16,this[C+2]=P>>>8,this[C+3]=P&255,C+4},v.prototype.writeBigInt64LE=qe(function(P,C=0){return k(this,P,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),v.prototype.writeBigInt64BE=qe(function(P,C=0){return q(this,P,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Z(P,C,U,ee,Q,te){if(U+ee>P.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("Index out of range")}function ne(P,C,U,ee,Q){return C=+C,U=U>>>0,Q||Z(P,C,U,4,34028234663852886e22,-34028234663852886e22),n.write(P,C,U,ee,23,4),U+4}v.prototype.writeFloatLE=function(P,C,U){return ne(this,P,C,!0,U)},v.prototype.writeFloatBE=function(P,C,U){return ne(this,P,C,!1,U)};function G(P,C,U,ee,Q){return C=+C,U=U>>>0,Q||Z(P,C,U,8,17976931348623157e292,-17976931348623157e292),n.write(P,C,U,ee,52,8),U+8}v.prototype.writeDoubleLE=function(P,C,U){return G(this,P,C,!0,U)},v.prototype.writeDoubleBE=function(P,C,U){return G(this,P,C,!1,U)},v.prototype.copy=function(P,C,U,ee){if(!v.isBuffer(P))throw new TypeError("argument should be a Buffer");if(U||(U=0),!ee&&ee!==0&&(ee=this.length),C>=P.length&&(C=P.length),C||(C=0),ee>0&&ee<U&&(ee=U),ee===U||P.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(U<0||U>=this.length)throw new RangeError("Index out of range");if(ee<0)throw new RangeError("sourceEnd out of bounds");ee>this.length&&(ee=this.length),P.length-C<ee-U&&(ee=P.length-C+U);let Q=ee-U;return this===P&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(C,U,ee):Uint8Array.prototype.set.call(P,this.subarray(U,ee),C),Q},v.prototype.fill=function(P,C,U,ee){if(typeof P=="string"){if(typeof C=="string"?(ee=C,C=0,U=this.length):typeof U=="string"&&(ee=U,U=this.length),ee!==void 0&&typeof ee!="string")throw new TypeError("encoding must be a string");if(typeof ee=="string"&&!v.isEncoding(ee))throw new TypeError("Unknown encoding: "+ee);if(P.length===1){let te=P.charCodeAt(0);(ee==="utf8"&&te<128||ee==="latin1")&&(P=te)}}else typeof P=="number"?P=P&255:typeof P=="boolean"&&(P=Number(P));if(C<0||this.length<C||this.length<U)throw new RangeError("Out of range index");if(U<=C)return this;C=C>>>0,U=U===void 0?this.length:U>>>0,P||(P=0);let Q;if(typeof P=="number")for(Q=C;Q<U;++Q)this[Q]=P;else{let te=v.isBuffer(P)?P:v.from(P,ee),le=te.length;if(le===0)throw new TypeError('The value "'+P+'" is invalid for argument "value"');for(Q=0;Q<U-C;++Q)this[Q+C]=te[Q%le]}return this};var D={};function W(P,C,U){D[P]=class extends U{constructor(){super(),Object.defineProperty(this,"message",{value:C.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${P}]`,this.stack,delete this.name}get code(){return P}set code(ee){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ee,writable:!0})}toString(){return`${this.name} [${P}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function(P){return P?`${P} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(P,C){return`The "${P}" argument must be of type number. Received type ${typeof C}`},TypeError),W("ERR_OUT_OF_RANGE",function(P,C,U){let ee=`The value of "${P}" is out of range.`,Q=U;return Number.isInteger(U)&&Math.abs(U)>2**32?Q=ie(String(U)):typeof U=="bigint"&&(Q=String(U),(U>BigInt(2)**BigInt(32)||U<-(BigInt(2)**BigInt(32)))&&(Q=ie(Q)),Q+="n"),ee+=` It must be ${C}. Received ${Q}`,ee},RangeError);function ie(P){let C="",U=P.length,ee=P[0]==="-"?1:0;for(;U>=ee+4;U-=3)C=`_${P.slice(U-3,U)}${C}`;return`${P.slice(0,U)}${C}`}function X(P,C,U){F(C,"offset"),(P[C]===void 0||P[C+U]===void 0)&&Y(C,P.length-(U+1))}function z(P,C,U,ee,Q,te){if(P>U||P<C){let le=typeof C=="bigint"?"n":"",Ie;throw te>3?C===0||C===BigInt(0)?Ie=`>= 0${le} and < 2${le} ** ${(te+1)*8}${le}`:Ie=`>= -(2${le} ** ${(te+1)*8-1}${le}) and < 2 ** ${(te+1)*8-1}${le}`:Ie=`>= ${C}${le} and <= ${U}${le}`,new D.ERR_OUT_OF_RANGE("value",Ie,P)}X(ee,Q,te)}function F(P,C){if(typeof P!="number")throw new D.ERR_INVALID_ARG_TYPE(C,"number",P)}function Y(P,C,U){throw Math.floor(P)!==P?(F(P,U),new D.ERR_OUT_OF_RANGE(U||"offset","an integer",P)):C<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE(U||"offset",`>= ${U?1:0} and <= ${C}`,P)}var ae=/[^+/0-9A-Za-z-_]/g;function de(P){if(P=P.split("=")[0],P=P.trim().replace(ae,""),P.length<2)return"";for(;P.length%4!==0;)P=P+"=";return P}function re(P,C){C=C||1/0;let U,ee=P.length,Q=null,te=[];for(let le=0;le<ee;++le){if(U=P.charCodeAt(le),U>55295&&U<57344){if(!Q){if(U>56319){(C-=3)>-1&&te.push(239,191,189);continue}else if(le+1===ee){(C-=3)>-1&&te.push(239,191,189);continue}Q=U;continue}if(U<56320){(C-=3)>-1&&te.push(239,191,189),Q=U;continue}U=(Q-55296<<10|U-56320)+65536}else Q&&(C-=3)>-1&&te.push(239,191,189);if(Q=null,U<128){if((C-=1)<0)break;te.push(U)}else if(U<2048){if((C-=2)<0)break;te.push(U>>6|192,U&63|128)}else if(U<65536){if((C-=3)<0)break;te.push(U>>12|224,U>>6&63|128,U&63|128)}else if(U<1114112){if((C-=4)<0)break;te.push(U>>18|240,U>>12&63|128,U>>6&63|128,U&63|128)}else throw new Error("Invalid code point")}return te}function fe(P){let C=[];for(let U=0;U<P.length;++U)C.push(P.charCodeAt(U)&255);return C}function ye(P,C){let U,ee,Q,te=[];for(let le=0;le<P.length&&!((C-=2)<0);++le)U=P.charCodeAt(le),ee=U>>8,Q=U%256,te.push(Q),te.push(ee);return te}function he(P){return r.toByteArray(de(P))}function Re(P,C,U,ee){let Q;for(Q=0;Q<ee&&!(Q+U>=C.length||Q>=P.length);++Q)C[Q+U]=P[Q];return Q}function Be(P,C){return P instanceof C||P!=null&&P.constructor!=null&&P.constructor.name!=null&&P.constructor.name===C.name}function be(P){return P!==P}var Ne=function(){let P="0123456789abcdef",C=new Array(256);for(let U=0;U<16;++U){let ee=U*16;for(let Q=0;Q<16;++Q)C[ee+Q]=P[U]+P[Q]}return C}();function qe(P){return typeof BigInt>"u"?j:P}function j(){throw new Error("BigInt not supported")}}),tyt=Ka((e,r)=>{var n=1e3,l=n*60,i=l*60,d=i*24,p=d*7,v=d*365.25;r.exports=function(M,x){x=x||{};var E=typeof M;if(E==="string"&&M.length>0)return _(M);if(E==="number"&&isFinite(M))return x.long?w(M):y(M);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(M))};function _(M){if(M=String(M),!(M.length>100)){var x=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(M);if(x){var E=parseFloat(x[1]),T=(x[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return E*v;case"weeks":case"week":case"w":return E*p;case"days":case"day":case"d":return E*d;case"hours":case"hour":case"hrs":case"hr":case"h":return E*i;case"minutes":case"minute":case"mins":case"min":case"m":return E*l;case"seconds":case"second":case"secs":case"sec":case"s":return E*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return E;default:return}}}}function y(M){var x=Math.abs(M);return x>=d?Math.round(M/d)+"d":x>=i?Math.round(M/i)+"h":x>=l?Math.round(M/l)+"m":x>=n?Math.round(M/n)+"s":M+"ms"}function w(M){var x=Math.abs(M);return x>=d?S(M,x,d,"day"):x>=i?S(M,x,i,"hour"):x>=l?S(M,x,l,"minute"):x>=n?S(M,x,n,"second"):M+" ms"}function S(M,x,E,T){var I=x>=E*1.5;return Math.round(M/E)+" "+T+(I?"s":"")}}),ryt=Ka((e,r)=>{function n(l){d.debug=d,d.default=d,d.coerce=S,d.disable=y,d.enable=v,d.enabled=w,d.humanize=tyt(),d.destroy=M,Object.keys(l).forEach(x=>{d[x]=l[x]}),d.names=[],d.skips=[],d.formatters={};function i(x){let E=0;for(let T=0;T<x.length;T++)E=(E<<5)-E+x.charCodeAt(T),E|=0;return d.colors[Math.abs(E)%d.colors.length]}d.selectColor=i;function d(x){let E,T=null,I,B;function O(...N){if(!O.enabled)return;let H=O,K=Number(new Date),J=K-(E||K);H.diff=J,H.prev=E,H.curr=K,E=K,N[0]=d.coerce(N[0]),typeof N[0]!="string"&&N.unshift("%O");let L=0;N[0]=N[0].replace(/%([a-zA-Z%])/g,($,V)=>{if($==="%%")return"%";L++;let h=d.formatters[V];if(typeof h=="function"){let t=N[L];$=h.call(H,t),N.splice(L,1),L--}return $}),d.formatArgs.call(H,N),(H.log||d.log).apply(H,N)}return O.namespace=x,O.useColors=d.useColors(),O.color=d.selectColor(x),O.extend=p,O.destroy=d.destroy,Object.defineProperty(O,"enabled",{enumerable:!0,configurable:!1,get:()=>T!==null?T:(I!==d.namespaces&&(I=d.namespaces,B=d.enabled(x)),B),set:N=>{T=N}}),typeof d.init=="function"&&d.init(O),O}function p(x,E){let T=d(this.namespace+(typeof E>"u"?":":E)+x);return T.log=this.log,T}function v(x){d.save(x),d.namespaces=x,d.names=[],d.skips=[];let E=(typeof x=="string"?x:"").trim().replace(" ",",").split(",").filter(Boolean);for(let T of E)T[0]==="-"?d.skips.push(T.slice(1)):d.names.push(T)}function _(x,E){let T=0,I=0,B=-1,O=0;for(;T<x.length;)if(I<E.length&&(E[I]===x[T]||E[I]==="*"))E[I]==="*"?(B=I,O=T,I++):(T++,I++);else if(B!==-1)I=B+1,O++,T=O;else return!1;for(;I<E.length&&E[I]==="*";)I++;return I===E.length}function y(){let x=[...d.names,...d.skips.map(E=>"-"+E)].join(",");return d.enable(""),x}function w(x){for(let E of d.skips)if(_(x,E))return!1;for(let E of d.names)if(_(x,E))return!0;return!1}function S(x){return x instanceof Error?x.stack||x.message:x}function M(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return d.enable(d.load()),d}r.exports=n}),iyt=Ka((e,r)=>{e.formatArgs=l,e.save=i,e.load=d,e.useColors=n,e.storage=p(),e.destroy=(()=>{let _=!1;return()=>{_||(_=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let _;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(_=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(_[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(_){if(_[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+_[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;let y="color: "+this.color;_.splice(1,0,y,"color: inherit");let w=0,S=0;_[0].replace(/%[a-zA-Z%]/g,M=>{M!=="%%"&&(w++,M==="%c"&&(S=w))}),_.splice(S,0,y)}e.log=console.debug||console.log||(()=>{});function i(_){try{_?e.storage.setItem("debug",_):e.storage.removeItem("debug")}catch{}}function d(){let _;try{_=e.storage.getItem("debug")}catch{}return!_&&typeof We<"u"&&"env"in We&&(_=We.env.DEBUG),_}function p(){try{return localStorage}catch{}}r.exports=ryt()(e);var{formatters:v}=r.exports;v.j=function(_){try{return JSON.stringify(_)}catch(y){return"[UnexpectedJSONParseError]: "+y.message}}});function Ia(){Ia.init.call(this)}function CT(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function lCe(e){return e._maxListeners===void 0?Ia.defaultMaxListeners:e._maxListeners}function ATe(e,r,n,l){var i,d,p,v;if(CT(n),(d=e._events)===void 0?(d=e._events=Object.create(null),e._eventsCount=0):(d.newListener!==void 0&&(e.emit("newListener",r,n.listener?n.listener:n),d=e._events),p=d[r]),p===void 0)p=d[r]=n,++e._eventsCount;else if(typeof p=="function"?p=d[r]=l?[n,p]:[p,n]:l?p.unshift(n):p.push(n),(i=lCe(e))>0&&p.length>i&&!p.warned){p.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+p.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=r,_.count=p.length,v=_,console&&console.warn&&console.warn(v)}return e}function nyt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function RTe(e,r,n){var l={fired:!1,wrapFn:void 0,target:e,type:r,listener:n},i=nyt.bind(l);return i.listener=n,l.wrapFn=i,i}function TTe(e,r,n){var l=e._events;if(l===void 0)return[];var i=l[r];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?function(d){for(var p=new Array(d.length),v=0;v<p.length;++v)p[v]=d[v].listener||d[v];return p}(i):cCe(i,i.length)}function ITe(e){var r=this._events;if(r!==void 0){var n=r[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}function cCe(e,r){for(var n=new Array(r),l=0;l<r;++l)n[l]=e[l];return n}var kTe,BTe,gb,PY,OY,NY,Fs,dCe=ul(()=>{gb=typeof Reflect=="object"?Reflect:null,PY=gb&&typeof gb.apply=="function"?gb.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},BTe=gb&&typeof gb.ownKeys=="function"?gb.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)},OY=Number.isNaN||function(e){return e!=e},kTe=Ia,Ia.EventEmitter=Ia,Ia.prototype._events=void 0,Ia.prototype._eventsCount=0,Ia.prototype._maxListeners=void 0,NY=10,Object.defineProperty(Ia,"defaultMaxListeners",{enumerable:!0,get:function(){return NY},set:function(e){if(typeof e!="number"||e<0||OY(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");NY=e}}),Ia.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ia.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||OY(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Ia.prototype.getMaxListeners=function(){return lCe(this)},Ia.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var l=e==="error",i=this._events;if(i!==void 0)l=l&&i.error===void 0;else if(!l)return!1;if(l){var d;if(r.length>0&&(d=r[0]),d instanceof Error)throw d;var p=new Error("Unhandled error."+(d?" ("+d.message+")":""));throw p.context=d,p}var v=i[e];if(v===void 0)return!1;if(typeof v=="function")PY(v,this,r);else{var _=v.length,y=cCe(v,_);for(n=0;n<_;++n)PY(y[n],this,r)}return!0},Ia.prototype.addListener=function(e,r){return ATe(this,e,r,!1)},Ia.prototype.on=Ia.prototype.addListener,Ia.prototype.prependListener=function(e,r){return ATe(this,e,r,!0)},Ia.prototype.once=function(e,r){return CT(r),this.on(e,RTe(this,e,r)),this},Ia.prototype.prependOnceListener=function(e,r){return CT(r),this.prependListener(e,RTe(this,e,r)),this},Ia.prototype.removeListener=function(e,r){var n,l,i,d,p;if(CT(r),(l=this._events)===void 0)return this;if((n=l[e])===void 0)return this;if(n===r||n.listener===r)--this._eventsCount==0?this._events=Object.create(null):(delete l[e],l.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(i=-1,d=n.length-1;d>=0;d--)if(n[d]===r||n[d].listener===r){p=n[d].listener,i=d;break}if(i<0)return this;i===0?n.shift():function(v,_){for(;_+1<v.length;_++)v[_]=v[_+1];v.pop()}(n,i),n.length===1&&(l[e]=n[0]),l.removeListener!==void 0&&this.emit("removeListener",e,p||r)}return this},Ia.prototype.off=Ia.prototype.removeListener,Ia.prototype.removeAllListeners=function(e){var r,n,l;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i,d=Object.keys(n);for(l=0;l<d.length;++l)(i=d[l])!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(r=n[e])=="function")this.removeListener(e,r);else if(r!==void 0)for(l=r.length-1;l>=0;l--)this.removeListener(e,r[l]);return this},Ia.prototype.listeners=function(e){return TTe(this,e,!0)},Ia.prototype.rawListeners=function(e){return TTe(this,e,!1)},Ia.listenerCount=function(e,r){return typeof e.listenerCount=="function"?e.listenerCount(r):ITe.call(e,r)},Ia.prototype.listenerCount=ITe,Ia.prototype.eventNames=function(){return this._eventsCount>0?BTe(this._events):[]},Fs=kTe,Fs.EventEmitter,Fs.defaultMaxListeners,Fs.init,Fs.listenerCount,Fs.EventEmitter,Fs.defaultMaxListeners,Fs.init,Fs.listenerCount});function YX(){throw new Error("setTimeout has not been defined")}function JX(){throw new Error("clearTimeout has not been defined")}function pCe(e){if(pp===setTimeout)return setTimeout(e,0);if((pp===YX||!pp)&&setTimeout)return pp=setTimeout,setTimeout(e,0);try{return pp(e,0)}catch{try{return pp.call(null,e,0)}catch{return pp.call(this||Xb,e,0)}}}function ayt(){Qb&&Wb&&(Qb=!1,Wb.length?zd=Wb.concat(zd):S9=-1,zd.length&&mCe())}function mCe(){if(!Qb){var e=pCe(ayt);Qb=!0;for(var r=zd.length;r;){for(Wb=zd,zd=[];++S9<r;)Wb&&Wb[S9].run();S9=-1,r=zd.length}Wb=null,Qb=!1,function(n){if(mp===clearTimeout)return clearTimeout(n);if((mp===JX||!mp)&&clearTimeout)return mp=clearTimeout,clearTimeout(n);try{mp(n)}catch{try{return mp.call(null,n)}catch{return mp.call(this||Xb,n)}}}(e)}}function PTe(e,r){(this||Xb).fun=e,(this||Xb).array=r}function ip(){}var OTe,pp,mp,Xb,Co,Wb,zd,Qb,S9,di,joe=ul(()=>{Xb=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis,Co=OTe={},function(){try{pp=typeof setTimeout=="function"?setTimeout:YX}catch{pp=YX}try{mp=typeof clearTimeout=="function"?clearTimeout:JX}catch{mp=JX}}(),zd=[],Qb=!1,S9=-1,Co.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];zd.push(new PTe(e,r)),zd.length!==1||Qb||pCe(mCe)},PTe.prototype.run=function(){(this||Xb).fun.apply(null,(this||Xb).array)},Co.title="browser",Co.browser=!0,Co.env={},Co.argv=[],Co.version="",Co.versions={},Co.on=ip,Co.addListener=ip,Co.once=ip,Co.off=ip,Co.removeListener=ip,Co.removeAllListeners=ip,Co.emit=ip,Co.prependListener=ip,Co.prependOnceListener=ip,Co.listeners=function(e){return[]},Co.binding=function(e){throw new Error("process.binding is not supported")},Co.cwd=function(){return"/"},Co.chdir=function(e){throw new Error("process.chdir is not supported")},Co.umask=function(){return 0},di=OTe,di.addListener,di.argv,di.binding,di.browser,di.chdir,di.cwd,di.emit,di.env,di.listeners,di.nextTick,di.off,di.on,di.once,di.prependListener,di.prependOnceListener,di.removeAllListeners,di.removeListener,di.title,di.umask,di.version,di.versions});function bb(e){return e.call.bind(e)}function M_(e,r){if(typeof e!="object")return!1;try{return r(e),!0}catch{return!1}}function NTe(e){return Xf&&Lh?qn(e)!==void 0:vCe(e)||gCe(e)||bCe(e)||yCe(e)||wCe(e)||_Ce(e)||MCe(e)||SCe(e)||xCe(e)||ECe(e)||ACe(e)}function vCe(e){return Xf&&Lh?qn(e)==="Uint8Array":no(e)==="[object Uint8Array]"||kCe(e)&&e.buffer!==void 0}function gCe(e){return Xf&&Lh?qn(e)==="Uint8ClampedArray":no(e)==="[object Uint8ClampedArray]"}function bCe(e){return Xf&&Lh?qn(e)==="Uint16Array":no(e)==="[object Uint16Array]"}function yCe(e){return Xf&&Lh?qn(e)==="Uint32Array":no(e)==="[object Uint32Array]"}function wCe(e){return Xf&&Lh?qn(e)==="Int8Array":no(e)==="[object Int8Array]"}function _Ce(e){return Xf&&Lh?qn(e)==="Int16Array":no(e)==="[object Int16Array]"}function MCe(e){return Xf&&Lh?qn(e)==="Int32Array":no(e)==="[object Int32Array]"}function SCe(e){return Xf&&Lh?qn(e)==="Float32Array":no(e)==="[object Float32Array]"}function xCe(e){return Xf&&Lh?qn(e)==="Float64Array":no(e)==="[object Float64Array]"}function ECe(e){return Xf&&Lh?qn(e)==="BigInt64Array":no(e)==="[object BigInt64Array]"}function ACe(e){return Xf&&Lh?qn(e)==="BigUint64Array":no(e)==="[object BigUint64Array]"}function LR(e){return no(e)==="[object Map]"}function DR(e){return no(e)==="[object Set]"}function $R(e){return no(e)==="[object WeakMap]"}function CY(e){return no(e)==="[object WeakSet]"}function yO(e){return no(e)==="[object ArrayBuffer]"}function CTe(e){return typeof ArrayBuffer<"u"&&(yO.working?yO(e):e instanceof ArrayBuffer)}function wO(e){return no(e)==="[object DataView]"}function LTe(e){return typeof DataView<"u"&&(wO.working?wO(e):e instanceof DataView)}function _O(e){return no(e)==="[object SharedArrayBuffer]"}function DTe(e){return typeof SharedArrayBuffer<"u"&&(_O.working?_O(e):e instanceof SharedArrayBuffer)}function $Te(e){return M_(e,BCe)}function qTe(e){return M_(e,PCe)}function UTe(e){return M_(e,OCe)}function jTe(e){return XX&&M_(e,pU)}function FTe(e){return DT&&M_(e,vU)}function Jv(e,r){var n={seen:[],stylize:syt};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Foe(r)?n.showHidden=r:r&&pr._extend(n,r),Gb(n.showHidden)&&(n.showHidden=!1),Gb(n.depth)&&(n.depth=2),Gb(n.colors)&&(n.colors=!1),Gb(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=oyt),MO(n,e,n.depth)}function oyt(e,r){var n=Jv.styles[r];return n?"\x1B["+Jv.colors[n][0]+"m"+e+"\x1B["+Jv.colors[n][1]+"m":e}function syt(e,r){return e}function MO(e,r,n){if(e.customInspect&&r&&LT(r.inspect)&&r.inspect!==pr.inspect&&(!r.constructor||r.constructor.prototype!==r)){var l=r.inspect(n,e);return xO(l)||(l=MO(e,l,n)),l}var i=function(M,x){if(Gb(x))return M.stylize("undefined","undefined");if(xO(x)){var E="'"+JSON.stringify(x).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return M.stylize(E,"string")}if(TCe(x))return M.stylize(""+x,"number");if(Foe(x))return M.stylize(""+x,"boolean");if(SO(x))return M.stylize("null","null")}(e,r);if(i)return i;var d=Object.keys(r),p=function(M){var x={};return M.forEach(function(E,T){x[E]=!0}),x}(d);if(e.showHidden&&(d=Object.getOwnPropertyNames(r)),E9(r)&&(d.indexOf("message")>=0||d.indexOf("description")>=0))return LY(r);if(d.length===0){if(LT(r)){var v=r.name?": "+r.name:"";return e.stylize("[Function"+v+"]","special")}if(x9(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(EO(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E9(r))return LY(r)}var _,y="",w=!1,S=["{","}"];return RCe(r)&&(w=!0,S=["[","]"]),LT(r)&&(y=" [Function"+(r.name?": "+r.name:"")+"]"),x9(r)&&(y=" "+RegExp.prototype.toString.call(r)),EO(r)&&(y=" "+Date.prototype.toUTCString.call(r)),E9(r)&&(y=" "+LY(r)),d.length!==0||w&&r.length!=0?n<0?x9(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),_=w?function(M,x,E,T,I){for(var B=[],O=0,N=x.length;O<N;++O)ICe(x,String(O))?B.push(DY(M,x,E,T,String(O),!0)):B.push("");return I.forEach(function(H){H.match(/^\d+$/)||B.push(DY(M,x,E,T,H,!0))}),B}(e,r,n,p,d):d.map(function(M){return DY(e,r,n,p,M,w)}),e.seen.pop(),function(M,x,E){var T=0;return M.reduce(function(I,B){return T++,B.indexOf(`
158
158
  `)>=0&&T++,I+B.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?E[0]+(x===""?"":x+`
159
159
  `)+" "+M.join(`,
160
160
  `)+" "+E[1]:E[0]+x+" "+M.join(", ")+" "+E[1]}(_,y,S)):S[0]+y+S[1]}function LY(e){return"["+Error.prototype.toString.call(e)+"]"}function DY(e,r,n,l,i,d){var p,v,_;if((_=Object.getOwnPropertyDescriptor(r,i)||{value:r[i]}).get?v=_.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):_.set&&(v=e.stylize("[Setter]","special")),ICe(l,i)||(p="["+i+"]"),v||(e.seen.indexOf(_.value)<0?(v=SO(n)?MO(e,_.value,null):MO(e,_.value,n-1)).indexOf(`
@@ -240,7 +240,7 @@ Use Chrome, Firefox or Internet Explorer 11`)},a9=_n.Buffer,Mre=gu.Transform,Bi(
240
240
  `,`${r?`content-type: ${r.trim()}`:""}\r
241
241
  `,e,`\r
242
242
  --${n}--\r
243
- `]);return{boundary:n,body:l}}async function zSt(e){let r=await e.arrayBuffer(),n=await crypto.subtle.digest("SHA-256",r);return qSt.Buffer.from(n)}async function vfe({processId:e,data:r,tags:n,anchor:l}){let i=new Headers;e&&i.append("target",e),l&&i.append("anchor",l),n&&n.forEach(p=>i.append(p.name,p.value)),i.set("Variant","ao.N.1");let d;if(r){let p=i.get("content-type"),v=await FSt(r,p);d=v.body,i.set("Content-Type",`multipart/form-data; boundary="${v.boundary}"`);let _=await zSt(d);i.append("Content-Digest",`sha-256=:${jSt(_)}:`)}return{headers:i,body:d}}function gfe({url:e,method:r,headers:n}){return n=new Headers(n),{fields:[...n.keys()].sort(),request:{url:e,method:r,headers:{...Object.fromEntries(n)}}}}function HSt(e){return`http-sig-${[...USt(e).subarray(1,9)].map(r=>r.toString(16).padStart(2,"0")).join("")}`}function KSt({fetch:e,logger:r,HB_URL:n,signer:l}){let i=r.child("deployProcess");return d=>wi(d).chain(Ji(({processId:p,data:v,tags:_})=>vfe({processId:p,data:v,tags:_}))).chain(Ji(({headers:p,body:v})=>l(gfe({url:`${n}/~scheduler@1.0/schedule`,method:"POST",headers:p})).then(_=>({..._,body:v})))).map(i.tap("Sending HTTP signed message to HB MU: %o")).chain(p=>wi(p).chain(Ji(({url:v,method:_,headers:y,body:w})=>e(v,{method:_,headers:y,body:w,redirect:"follow"}))).bichain(v=>Mc(v),Ji(async v=>{if(v.ok)return v.headers.get("process");throw new Error(`${v.status}: ${await v.text()}`)})).bimap(i.tap("Error encountered when deploying process via HB MU"),i.tap("Successfully deployed process via HB MU")).map(v=>({processId:v}))).toPromise()}function ZSt({fetch:e,logger:r,HB_URL:n,signer:l}){let i=r.child("deployMessage");return d=>wi(d).chain(Ji(({processId:p,data:v,tags:_,anchor:y})=>vfe({processId:p,data:v,tags:_,anchor:y}))).chain(Ji(({headers:p,body:v})=>l(gfe({url:`${n}/~scheduler@1.0/schedule`,method:"POST",headers:p})).then(_=>({..._,body:v})))).map(i.tap("Sending HTTP signed message to HB MU: %o")).chain(p=>wi(p).chain(Ji(({url:v,method:_,headers:y,body:w})=>e(v,{method:_,headers:y,body:w,redirect:"follow"}))).bichain(v=>Mc(v),Ji(async v=>{if(v.ok)return v.headers.get("slot");throw new Error(`${v.status}: ${await v.text()}`)})).bimap(i.tap("Error encountered when writing message via HB MU"),i.tap("Successfully wrote message via HB MU")).map(v=>({messageId:v}))).toPromise()}function WSt({fetch:e,logger:r,HB_URL:n,signer:l}){let i=r.child("loadResult");return d=>wi(d).chain(Ji(async({id:p,processId:v})=>{let{headers:_,body:y}=await vfe({processId:v});return _.append("slot+integer",p),_.append("accept","application/json"),l(gfe({url:`${n}/~compute-lite@1.0/compute&slot+integer=${p}&process-id=${v}`,method:"POST",headers:_})).then(w=>({...w,body:y}))})).map(i.tap("fetching message result from HB CU: %o")).chain(p=>wi(p).chain(Ji(({url:v,method:_,headers:y,body:w})=>e(v,{method:_,headers:y,body:w,redirect:"follow"}))).bichain(v=>Mc(v),Ji(async v=>{if(v.ok)return v.json();throw new Error(`${v.status}: ${await v.text()}`)})).bimap(i.tap("Error encountered when writing message via HB CU"),i.tap("Successfully wrote message via HB CU"))).toPromise()}function GSt({fetch:e,logger:r,HB_URL:n,signer:l}){return async(i,d)=>{let p=new URL(i);d.headers=new Headers(d.headers);let v=p.href,_=new URLSearchParams({"relay-path":v}),y=`${n}/~relay@1.0/call?${_.toString()}`;r('Relaying "%s" through HyperBEAM Node "%s"',p.href,y);let{headers:w}=await l({fields:[...d.headers.keys(),"relay-path"].sort(),request:{url:i,...d,headers:{...Object.fromEntries(d.headers),"relay-path":v}}});return e(y,{...d,headers:w})}}var VSt=uN(iyt(),1),FHe=(e="@permaweb/aoconnect")=>{let r=(0,VSt.default)(e);return r.child=n=>FHe(`${r.namespace}:${n}`),r.tap=(n,...l)=>kMt((...i)=>r(n,...l,...i)),r},zHe=({url:e,path:r})=>r?r.startsWith("/")?zHe({url:e,path:r.slice(1)}):(e=new URL(e),e.pathname+=r,e.toString()):e;function YSt(e){return a2(PN([]),a_((r,n)=>a2(AMt([],n.name),L_t(n.value),Ch(n.name,Ip,r))(r),{}),cfe(r=>r.length>1?r:r[0]))(e)}function QNe(e){return _He([[q9(String),$9(e)],[q9(Array),mMt(e)],[fHe,K9t]])}function c6(e){let r;return q9(sl,e)?(r=new Error(JSt(e)),r.stack+=e.stack):q9(Error,e)?r=e:cMt("message",e)?r=new Error(e.message):q9(String,e)?r=new Error(e):r=new Error("An error occurred"),r}function JSt(e){return a2(r=>function n(l,i,d){return a_((p,v)=>a2(_He([[$9(cr.invalid_arguments),()=>n(v.argumentsError,422,"Invalid Arguments")],[$9(cr.invalid_return_type),()=>n(v.returnTypeError,500,"Invalid Return")],[$9(cr.invalid_union),()=>J_t(_=>n(_,400,"Invalid Union"),v.unionErrors)],[fHe,()=>[{...v,status:i,contextCode:d}]]]),oMt(p))(v.code),[],l.issues)}(r,400,""),r=>a_((n,l)=>{let{message:i,path:d,contextCode:p}=l,v=d[1]||d[0],_=p?`${p} `:"";return n.push(`${_}'${v}': ${i}.`),n},[],r),_Mt(" | "))(e)}var XSt=ar.object({id:ar.string().min(1,{message:"message is required to be a message id"}),processId:ar.string().min(1,{message:"process is required to be a process id"})});function QSt(){return e=>wi(e).map(XSt.parse).map(()=>e)}var B_=ar.object({name:ar.string(),value:ar.string()}),ext=ar.function().args(ar.object({Id:ar.string(),Target:ar.string(),Owner:ar.string(),Anchor:ar.string().optional(),Data:ar.any().default("1234"),Tags:ar.array(ar.object({name:ar.string(),value:ar.string()}))})).returns(ar.promise(ar.any())),txt=ar.function().args(ar.object({id:ar.string().min(1,{message:"message id is required"}),processId:ar.string().min(1,{message:"process id is required"})})).returns(ar.promise(ar.any())),rxt=ar.function().args(ar.object({process:ar.string().min(1,{message:"process id is required"}),from:ar.string().optional(),to:ar.string().optional(),sort:ar.enum(["ASC","DESC"]).default("ASC"),limit:ar.number().optional()})).returns(ar.promise(ar.object({edges:ar.array(ar.object({cursor:ar.string(),node:ar.object({Output:ar.any().optional(),Messages:ar.array(ar.any()).optional(),Spawns:ar.array(ar.any()).optional(),Error:ar.any().optional()})}))}))),HHe=ar.function().args(ar.object({processId:ar.string(),data:ar.any(),tags:ar.array(B_),anchor:ar.string().optional(),signer:ar.any()})).returns(ar.promise(ar.object({messageId:ar.string()}).passthrough())),ixt=ar.function().args(ar.object({data:ar.any(),tags:ar.array(B_),signer:ar.any()})).returns(ar.promise(ar.object({processId:ar.string()}).passthrough())),nxt=ar.function().args(ar.object({process:ar.string(),message:ar.string(),baseLayer:ar.boolean().optional(),exclude:ar.array(ar.string()).optional()})).returns(ar.promise(ar.object({assignmentId:ar.string()}).passthrough())),KHe=HHe,U0r=ar.function().args(ar.object({suUrl:ar.string().url(),processId:ar.string()})).returns(ar.promise(ar.object({tags:ar.array(B_)}).passthrough())),j0r=ar.function().args(ar.string()).returns(ar.promise(ar.object({url:ar.string()}))),axt=ar.function().args(ar.string()).returns(ar.promise(ar.boolean())),oxt=ar.function().args(ar.string()).returns(ar.promise(ar.object({tags:ar.array(B_)}).passthrough())),ON=ar.function().args(ar.object({data:ar.any(),tags:ar.array(B_),target:ar.string().optional(),anchor:ar.string().optional()})).returns(ar.promise(ar.object({id:ar.string(),raw:ar.any()})));function sxt({loadResult:e}){return e=Ji(txt.implement(e)),r=>wi({id:r.id,processId:r.processId}).chain(e)}function ZX(e){let r=QSt(e),n=sxt(e);return({message:l,process:i})=>wi({id:l,processId:i}).chain(r).chain(n).map(e.logger.tap('readResult result for message "%s": %O',l)).map(d=>d).bimap(c6,l6).toPromise()}var u6=(...e)=>r=>e.reduce((n,l)=>l(n),r),bfe=e=>r=>r??e,fxt=e=>r=>u6(n=>n&&n[r],bfe(e)),hxt=e=>r=>{let n={};for(let l in r)r.hasOwnProperty(l)&&(n[l]=e(r[l],l,r));return n},uxt=e=>(...r)=>!e(...r),NN=e=>r=>{let n=r.findIndex(i=>i.name==="Data-Protocol"&&i.value===e);if(n===-1)return[0,0];let l=r.findIndex((i,d)=>d>n&&i.name==="Data-Protocol"&&i.value!==e);return l===-1&&(l=r.length),[n,l]},yfe=e=>{let r=e.findIndex(n=>n.name==="Data-Protocol");return r===-1&&(r=e.length),r},ZHe=e=>r=>r.name===e,wfe=(e,r)=>u6(NN(e),([n,l])=>r.slice(n,l))(r),WHe=(e,r,n)=>u6(l=>wfe(e,l),l=>l.filter(ZHe(r)))(n),lxt=(e,r,n)=>u6(l=>WHe(e,r,l),l=>l[0])(n),CN=(e,r)=>(r=r.filter(n=>n.name!=="Data-Protocol"||n.value!==e),r.length?[{name:"Data-Protocol",value:e},...r]:[]),cxt=(e,r,n)=>{let[l,i]=NN(e)(n),[d,p,v]=[n.slice(0,l),n.slice(l,i),n.slice(i)];return p.length||(r=CN(e,r),d=v,v=[]),[d,p,r,v].flat(1)},dxt=(e,r)=>{let n=yfe(r),[l,i]=[r.slice(0,n),r.slice(n)];return[l,e,i].flat(1)},GHe=(e,r,n)=>{let[l,i]=NN(e)(n),[d,p]=[n.slice(0,l),n.slice(i)];return p.length===n.length&&(d=p,p=[]),[d,CN(e,r),p].flat(1)},pxt=(e,r)=>GHe(e,[],r),mxt=(e,r,n)=>{let[l,i]=NN(e)(n),[d,p,v]=[n.slice(0,l),n.slice(l,i),n.slice(i)];return[d,CN(e,p.filter(uxt(ZHe(r)))),v].flat(1)},_fe=(e,r=!1)=>u6(bfe([]),n=>n.reduce((l,i)=>u6(fxt([])(i.name),d=>(d.push(i.value),d),d=>(l[i.name]=d,l))(l),{}),hxt(n=>r?n:n[0]))(e),VHe=(e,r,n)=>u6(bfe([]),l=>wfe(e,l),l=>_fe(l,n))(r),vxt=(e,r)=>VHe(e,r,!0),gxt=(e,r)=>VHe(e,r,!1),bxt=e=>{let r=yfe(e);return _fe(e.slice(0,r),!1)},yxt=e=>{let r=yfe(e);return _fe(e.slice(0,r),!0)},YHe=e=>({findAll:r=>wfe(e,r),findAllByName:(r,n)=>WHe(e,r,n),findByName:(r,n)=>lxt(e,r,n),create:r=>CN(e,r),update:(r,n)=>GHe(e,r,n),concat:(r,n)=>cxt(e,r,n),removeAll:r=>pxt(e,r),removeAllByName:(r,n)=>mxt(e,r,n),parse:r=>gxt(e,r),parseAll:r=>vxt(e,r),concatUnassoc:dxt,parseUnassoc:bxt,parseAllUnassoc:yxt}),Mfe=YHe("ao"),eCe=O8(Mfe.removeAllByName),wxt=O8(Mfe.concat),tCe=O8(Mfe.concatUnassoc),_xt=ar.array(ar.object({name:ar.string(),value:ar.string()}));function Mxt(){return e=>wi(e.tags).map(PN([])).map(eCe("Variant")).map(eCe("Type")).map(wxt([{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"}])).map(_xt.parse).map(Ch("tags",Ip,e))}function Sxt({logger:e}){return r=>wi(r).chain(MHe(gHe(r.data),()=>o6(r),()=>o6(" ").map(Ch("data",Ip,r)).map(n=>a2(s6("tags"),tCe([{name:"Content-Type",value:"text/plain"}]),Ch("tags",Ip,n))(n)).map(e.tap('added pseudo-random string as message "data"')))).map(n=>a2(s6("tags"),tCe([{name:"SDK",value:"aoconnect"}]),Ch("tags",Ip,n))(n))}function xxt(e){let r=Mxt(e),n=Sxt(e),l=HHe.implement(e.deployMessage);return i=>wi(i).chain(r).chain(n).chain(Ji(({id:d,data:p,tags:v,anchor:_,signer:y})=>l({processId:d,data:p,tags:v,anchor:_,signer:ON.implement(y)}))).map(d=>Ch("messageId",d.messageId,i))}function WX(e){let r=xxt(e);return({process:n,data:l,tags:i,anchor:d,signer:p})=>wi({id:n,data:l,tags:i,anchor:d,signer:p}).chain(r).map(v=>v.messageId).bimap(c6,l6).toPromise()}var U7=(e,r,n)=>l=>r(l[e])?o6(l):Mc(`Tag '${e}': ${n}`);function Ext({loadTransactionMeta:e,logger:r}){return e=Ji(oxt.implement(e)),n=>wi(n).chain(e).map(s6("tags")).map(YSt).chain(U7("Data-Protocol",QNe("ao"),"value 'ao' was not found on module")).chain(U7("Type",QNe("Module"),"value 'Module' was not found on module")).chain(U7("Module-Format",zX,"was not found on module")).chain(U7("Input-Encoding",zX,"was not found on module")).chain(U7("Output-Encoding",zX,"was not found on module")).bimap(r.tap("Verifying module source failed: %s"),r.tap("Verified module source"))}function Axt({logger:e,validateScheduler:r}){return r=Ji(axt.implement(r)),n=>wi(n).chain(l=>r(l).chain(i=>i?o6(l):Mc(`Valid Scheduler-Location owned by ${l} not found`))).bimap(e.tap("Verifying scheduler failed: %s"),e.tap("Verified scheduler"))}function Rxt({logger:e}){return r=>wi(r).map(e.tap("Checking for signer")).chain(n=>n?o6(n):Mc("signer not found"))}function Txt(e){let r=e.logger.child("verifyInput");e={...e,logger:r};let n=Ext(e),l=Axt(e),i=Rxt(e);return d=>wi(d).chain(p=>n(p.module).map(()=>p)).chain(p=>i(p.signer).map(()=>p)).bimap(r.tap("Error when verify input: %s"),r.tap("Successfully verified inputs"))}var Sfe=YHe("ao"),NT=O8(Sfe.removeAllByName),Ixt=O8(Sfe.concat),rCe=O8(Sfe.concatUnassoc),kxt=ar.array(ar.object({name:ar.string(),value:ar.string()}));function Bxt(){return e=>wi(e).map(s6("tags")).map(PN([])).map(NT("Variant")).map(NT("Type")).map(NT("Module")).map(NT("Scheduler")).map(Ixt([{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:e.module},{name:"Scheduler",value:e.scheduler}])).map(kxt.parse).map(Ch("tags",Ip,e))}function Pxt({logger:e}){return r=>wi(r).chain(MHe(gHe(r.data),()=>o6(r),()=>o6(" ").map(Ch("data",Ip,r)).map(n=>a2(s6("tags"),rCe([{name:"Content-Type",value:"text/plain"}]),Ch("tags",Ip,n))(n)).map(e.tap('added pseudo-random string as process "data"')))).map(n=>a2(s6("tags"),rCe([{name:"SDK",value:"aoconnect"}]),Ch("tags",Ip,n))(n))}function Oxt(e){let r=e.logger.child("uploadProcess");e={...e,logger:r};let n=Bxt(e),l=Pxt(e),i=ixt.implement(e.deployProcess);return d=>wi(d).chain(n).chain(l).chain(Ji(({data:p,tags:v,signer:_})=>i({data:p,tags:v,signer:ON.implement(_)}))).map(p=>Ch("processId",p.processId,d))}function GX(e){let r=Txt(e),n=Oxt(e);return({module:l,scheduler:i,signer:d,tags:p,data:v})=>wi({module:l,scheduler:i,signer:d,tags:p,data:v}).chain(r).chain(n).map(_=>_.processId).bimap(c6,l6).toPromise()}function Nxt(e){let r=KHe.implement(e.deployMonitor);return n=>wi(n).chain(Ji(({id:l,signer:i})=>r({processId:l,signer:ON.implement(i),data:" ",tags:[]}))).map(l=>Ch("monitorId",l.messageId,n))}function iCe(e){let r=Nxt(e);return({process:n,signer:l})=>wi({id:n,signer:l}).chain(r).map(i=>i.monitorId).bimap(c6,l6).toPromise()}function Cxt(e){let r=KHe.implement(e.deployUnmonitor);return n=>wi(n).chain(Ji(({id:l,signer:i})=>r({processId:l,signer:ON.implement(i),data:" ",tags:[]}))).map(l=>Ch("monitorId",l.messageId,n))}function nCe(e){let r=Cxt(e);return({process:n,signer:l})=>wi({id:n,signer:l}).chain(r).map(i=>i.monitorId).bimap(c6,l6).toPromise()}var Lxt=ar.object({process:ar.string().min(1,{message:"process identifier is required"}),from:ar.string().optional(),to:ar.string().optional(),sort:ar.enum(["ASC","DESC"]).default("ASC"),limit:ar.number().optional()});function Dxt(){return e=>wi(e).map(Lxt.parse).map(()=>e)}function $xt({queryResults:e}){return e=Ji(rxt.implement(e)),r=>wi({process:r.process,from:r.from,to:r.to,sort:r.sort,limit:r.limit}).chain(e)}function aCe(e){let r=Dxt(e),n=$xt(e);return({process:l,from:i,to:d,sort:p,limit:v})=>wi({process:l,from:i,to:d,sort:p,limit:v}).chain(r).chain(n).map(e.logger.tap('readResults result for message "%s": %O',l)).map(_=>_).bimap(c6,l6).toPromise()}var qxt=ar.object({Id:ar.string(),Target:ar.string(),Owner:ar.string(),Anchor:ar.string().optional(),Data:ar.any().default("1234"),Tags:ar.array(ar.object({name:ar.string(),value:ar.string()}))});function Uxt(){return e=>wi(e).map(qxt.parse).map(r=>(r.Tags=r.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),r))}function jxt({dryrunFetch:e}){return Ji(ext.implement(e))}function oCe(e){let r=Uxt(e),n=jxt(e);return l=>wi(l).map(Fxt).chain(r).chain(n).toPromise()}function Fxt({process:e,data:r,tags:n,anchor:l,...i}){return{Id:"1234",Owner:"1234",...i,Target:e,Data:r||"1234",Tags:n||[],Anchor:l||"0"}}function zxt(e){let r=nxt.implement(e.deployAssign);return n=>wi(n).chain(Ji(({process:l,message:i,baseLayer:d,exclude:p})=>r({process:l,message:i,baseLayer:d,exclude:p}))).map(l=>Ch("assignmentId",l.assignmentId,n))}function sCe(e){let r=zxt(e);return({process:n,message:l,baseLayer:i,exclude:d})=>wi({process:n,message:l,baseLayer:i,exclude:d}).chain(r).map(p=>p.assignmentId).bimap(c6,l6).toPromise()}var Hxt="https://arweave.net",Kxt="https://mu.ao-testnet.xyz",Zxt="https://cu.ao-testnet.xyz",Wxt="http://localhost:8734",Gxt="http://localhost:8734",Vxt="http://cu.s451-comm3-main.xyz",Yxt="http://mu.s451-comm3-main.xyz",qb=fetch;function Jxt({createDataItemSigner:e,createHbSigner:r}){let n=FHe();function l({MODE:v,wallet:_,GRAPHQL_URL:y,GRAPHQL_MAX_RETRIES:w,GRAPHQL_RETRY_BACKOFF:S,MU_URL:M=Yxt,CU_URL:x=Vxt,RELAY_URL:E=Wxt,fetch:T=qb}){let I=n.child("relay");I("Mode Activated \u{1F500}");let B=r(_),O=()=>e(_),N=GSt({fetch:qb,logger:I,HB_URL:E,signer:B}),{validate:H}=Aoe({cacheSize:100,GRAPHQL_URL:y,GRAPHQL_MAX_RETRIES:w,GRAPHQL_RETRY_BACKOFF:S}),K=I.child("result"),J=ZX({loadResult:jNe({fetch:N,CU_URL:x,logger:K}),logger:K}),L=I.child("message"),$=WX({deployMessage:CNe({fetch:N,MU_URL:M,logger:L}),logger:L}),V=I.child("spawn"),h=GX({loadTransactionMeta:KX({fetch:T,GRAPHQL_URL:y,logger:V}),validateScheduler:H,deployProcess:LNe({fetch:N,MU_URL:M,logger:V}),logger:V}),t=I.child("monitor"),a=iCe({deployMonitor:DNe({fetch:N,MU_URL:M,logger:t}),logger:t}),s=I.child("unmonitor"),u=nCe({deployUnmonitor:$Ne({fetch:N,MU_URL:M,logger:s}),logger:t}),c=I.child("results"),b=aCe({queryResults:FNe({fetch:N,CU_URL:x,logger:c}),logger:c}),m=I.child("dryrun"),f=oCe({dryrunFetch:UNe({fetch:N,CU_URL:x,logger:m}),logger:m}),o=I.child("assign"),g=sCe({deployAssign:qNe({fetch:N,MU_URL:M,logger:o}),logger:L});return{MODE:v,result:J,results:b,message:$,spawn:h,monitor:a,unmonitor:u,dryrun:f,assign:g,createDataItemSigner:O}}function i({MODE:v,GRAPHQL_URL:_,GRAPHQL_MAX_RETRIES:y,GRAPHQL_RETRY_BACKOFF:w,MU_URL:S=Kxt,CU_URL:M=Zxt,fetch:x=qb,noLog:E}){let T=n.child("legacy");E||T("Mode Activated \u2139\uFE0F");let{validate:I}=Aoe({cacheSize:100,GRAPHQL_URL:_,GRAPHQL_MAX_RETRIES:y,GRAPHQL_RETRY_BACKOFF:w}),B=T.child("result"),O=ZX({loadResult:jNe({fetch:x,CU_URL:M,logger:B}),logger:B}),N=T.child("message"),H=WX({deployMessage:CNe({fetch:x,MU_URL:S,logger:N}),logger:N}),K=T.child("spawn"),J=GX({loadTransactionMeta:KX({fetch:x,GRAPHQL_URL:_,logger:K}),validateScheduler:I,deployProcess:LNe({fetch:x,MU_URL:S,logger:K}),logger:K}),L=T.child("monitor"),$=iCe({deployMonitor:DNe({fetch:x,MU_URL:S,logger:L}),logger:L}),V=T.child("unmonitor"),h=nCe({deployUnmonitor:$Ne({fetch:x,MU_URL:S,logger:V}),logger:L}),t=T.child("results"),a=aCe({queryResults:FNe({fetch:x,CU_URL:M,logger:t}),logger:t}),s=T.child("dryrun"),u=oCe({dryrunFetch:UNe({fetch:x,CU_URL:M,logger:s}),logger:s}),c=T.child("assign"),b=sCe({deployAssign:qNe({fetch:x,MU_URL:S,logger:c}),logger:N});return{MODE:v,result:O,results:a,message:H,spawn:J,monitor:$,unmonitor:h,dryrun:u,assign:b,createDataItemSigner:e}}function d({MODE:v,wallet:_,GRAPHQL_URL:y,AO_URL:w=Gxt,fetch:S=qb}){let M=n.child("mainnet");if(M("Mode Activated \u{1F432}"),!_)throw new Error("mainnet mode requires providing a wallet to connect()");let x=r(_),E=()=>e(_);async function T(J){return M('Mock validation for address "%s"',J),!0}let I=M.child("result"),B=ZX({loadResult:WSt({fetch:qb,logger:I,HB_URL:w,signer:x}),logger:I}),O=M.child("message"),N=WX({deployMessage:ZSt({fetch:qb,logger:O,HB_URL:w,signer:x}),logger:O}),H=M.child("spawn"),K=GX({loadTransactionMeta:KX({fetch:S,GRAPHQL_URL:y,logger:H}),validateScheduler:T,deployProcess:KSt({fetch:qb,logger:H,HB_URL:w,signer:x}),logger:H});return{MODE:v,result:B,message:N,spawn:K,createDataItemSigner:E}}function p(v={}){let{GRAPHQL_URL:_,GATEWAY_URL:y=Hxt,...w}=v;_||(_=zHe({url:y,path:"/graphql"}));let S=v.MODE||"legacy";if(S==="legacy")return i({...w,GRAPHQL_URL:_});if(S==="relay")return l({...w,GRAPHQL_URL:_});if(S==="mainnet")return d({...w,GRAPHQL_URL:_});throw new Error(`Unrecognized MODE: ${S}`)}return p}var $oe={};hN($oe,{createDataItemSigner:()=>xEt,createHbSigner:()=>EEt});var xfe=uN(uCe(),1),JHe={};hN(JHe,{AVSCTap:()=>P_,ArweaveSigner:()=>Rfe,DataItem:()=>__,MAX_TAG_BYTES:()=>LN,MIN_BINARY_SIZE:()=>kfe,SIG_CONFIG:()=>x8,SignatureConfig:()=>ol,Signer:()=>tKe,createData:()=>aKe,default:()=>yEt,deserializeTags:()=>sN,indexToType:()=>Tfe,serializeTags:()=>Ife,tagsExceedLimit:()=>nKe,warparbundles:()=>wEt});var Xxt=Object.create,Efe=Object.defineProperty,Qxt=Object.getOwnPropertyDescriptor,eEt=Object.getOwnPropertyNames,tEt=Object.getPrototypeOf,rEt=Object.prototype.hasOwnProperty,Np=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),iEt=(e,r)=>{for(var n in r)Efe(e,n,{get:r[n],enumerable:!0})},nEt=(e,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of eEt(r))!rEt.call(e,i)&&i!==n&&Efe(e,i,{get:()=>r[i],enumerable:!(l=Qxt(r,i))||l.enumerable});return e},d6=(e,r,n)=>(n=e!=null?Xxt(tEt(e)):{},nEt(r||!e||!e.__esModule?Efe(n,"default",{value:e,enumerable:!0}):n,e)),aEt=Np(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});function r(n){var l=4,i=n.length,d=i%l;if(!d)return n;var p=i,v=l-d,_=i+v,y=ze.alloc(_);for(y.write(n);v--;)y.write("=",p++);return y.toString()}e.default=r}),oEt=Np(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=aEt();function n(_,y){return y===void 0&&(y="utf8"),ze.isBuffer(_)?d(_.toString("base64")):d(ze.from(_,y).toString("base64"))}function l(_,y){return y===void 0&&(y="utf8"),ze.from(i(_),"base64").toString(y)}function i(_){return _=_.toString(),r.default(_).replace(/\-/g,"+").replace(/_/g,"/")}function d(_){return _.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(_){return ze.from(i(_),"base64")}var v=n;v.encode=n,v.decode=l,v.toBase64=i,v.fromBase64=d,v.toBuffer=p,e.default=v}),Afe=Np((e,r)=>{r.exports=oEt().default,r.exports.default=r.exports}),XHe=Np(e=>{"use strict";e.byteLength=_,e.toByteArray=w,e.fromByteArray=x;var r=[],n=[],l=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(d=0,p=i.length;d<p;++d)r[d]=i[d],n[i.charCodeAt(d)]=d;var d,p;n[45]=62,n[95]=63;function v(E){var T=E.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=E.indexOf("=");I===-1&&(I=T);var B=I===T?0:4-I%4;return[I,B]}function _(E){var T=v(E),I=T[0],B=T[1];return(I+B)*3/4-B}function y(E,T,I){return(T+I)*3/4-I}function w(E){var T,I=v(E),B=I[0],O=I[1],N=new l(y(E,B,O)),H=0,K=O>0?B-4:B,J;for(J=0;J<K;J+=4)T=n[E.charCodeAt(J)]<<18|n[E.charCodeAt(J+1)]<<12|n[E.charCodeAt(J+2)]<<6|n[E.charCodeAt(J+3)],N[H++]=T>>16&255,N[H++]=T>>8&255,N[H++]=T&255;return O===2&&(T=n[E.charCodeAt(J)]<<2|n[E.charCodeAt(J+1)]>>4,N[H++]=T&255),O===1&&(T=n[E.charCodeAt(J)]<<10|n[E.charCodeAt(J+1)]<<4|n[E.charCodeAt(J+2)]>>2,N[H++]=T>>8&255,N[H++]=T&255),N}function S(E){return r[E>>18&63]+r[E>>12&63]+r[E>>6&63]+r[E&63]}function M(E,T,I){for(var B,O=[],N=T;N<I;N+=3)B=(E[N]<<16&16711680)+(E[N+1]<<8&65280)+(E[N+2]&255),O.push(S(B));return O.join("")}function x(E){for(var T,I=E.length,B=I%3,O=[],N=16383,H=0,K=I-B;H<K;H+=N)O.push(M(E,H,H+N>K?K:H+N));return B===1?(T=E[I-1],O.push(r[T>>2]+r[T<<4&63]+"==")):B===2&&(T=(E[I-2]<<8)+E[I-1],O.push(r[T>>10]+r[T>>4&63]+r[T<<2&63]+"=")),O.join("")}}),QHe=Np(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.b64UrlDecode=e.b64UrlEncode=e.bufferTob64Url=e.bufferTob64=e.b64UrlToBuffer=e.stringToB64Url=e.stringToBuffer=e.bufferToString=e.b64UrlToString=e.concatBuffers=void 0;var r=XHe();function n(M){let x=0;for(let I=0;I<M.length;I++)x+=M[I].byteLength;let E=new Uint8Array(x),T=0;E.set(new Uint8Array(M[0]),T),T+=M[0].byteLength;for(let I=1;I<M.length;I++)E.set(new Uint8Array(M[I]),T),T+=M[I].byteLength;return E}e.concatBuffers=n;function l(M){let x=v(M);return i(x)}e.b64UrlToString=l;function i(M){return new TextDecoder("utf-8",{fatal:!0}).decode(M)}e.bufferToString=i;function d(M){return new TextEncoder().encode(M)}e.stringToBuffer=d;function p(M){return y(d(M))}e.stringToB64Url=p;function v(M){return new Uint8Array(r.toByteArray(S(M)))}e.b64UrlToBuffer=v;function _(M){return r.fromByteArray(new Uint8Array(M))}e.bufferTob64=_;function y(M){return w(_(M))}e.bufferTob64Url=y;function w(M){return M.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}e.b64UrlEncode=w;function S(M){M=M.replace(/\-/g,"+").replace(/\_/g,"/");let x;return M.length%4==0?x=0:x=4-M.length%4,M.concat("=".repeat(x))}e.b64UrlDecode=S}),sEt=Np(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=QHe(),n=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let l=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),i=await this.driver.exportKey("jwk",l.privateKey);return{kty:i.kty,e:i.e,n:i.n,d:i.d,p:i.p,q:i.q,dp:i.dp,dq:i.dq,qi:i.qi}}async sign(l,i,{saltLength:d}={}){let p=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(l),i);return new Uint8Array(p)}async hash(l,i="SHA-256"){let d=await this.driver.digest(i,l);return new Uint8Array(d)}async verify(l,i,d){let p={kty:"RSA",e:"AQAB",n:l},v=await this.jwkToPublicCryptoKey(p),_=await this.driver.digest("SHA-256",i),y=await this.driver.verify({name:"RSA-PSS",saltLength:0},v,d,i),w=await this.driver.verify({name:"RSA-PSS",saltLength:32},v,d,i),S=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((v.algorithm.modulusLength-1)/8)-_.byteLength-2},v,d,i);return y||w||S}async jwkToCryptoKey(l){return this.driver.importKey("jwk",l,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(l){return this.driver.importKey("jwk",l,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let l=crypto?.subtle;return l===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof l[i]=="function")}async encrypt(l,i,d){let p=await this.driver.importKey("raw",typeof i=="string"?r.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:d?r.stringToBuffer(d):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},p,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),_=new Uint8Array(16);crypto.getRandomValues(_);let y=await this.driver.encrypt({name:"AES-CBC",iv:_},v,l);return r.concatBuffers([_,y])}async decrypt(l,i,d){let p=await this.driver.importKey("raw",typeof i=="string"?r.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:d?r.stringToBuffer(d):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},p,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),_=l.slice(0,16),y=await this.driver.decrypt({name:"AES-CBC",iv:_},v,l.slice(16));return r.concatBuffers([y])}};e.default=n}),fEt=Np(e=>{e.read=function(r,n,l,i,d){var p,v,_=d*8-i-1,y=(1<<_)-1,w=y>>1,S=-7,M=l?d-1:0,x=l?-1:1,E=r[n+M];for(M+=x,p=E&(1<<-S)-1,E>>=-S,S+=_;S>0;p=p*256+r[n+M],M+=x,S-=8);for(v=p&(1<<-S)-1,p>>=-S,S+=i;S>0;v=v*256+r[n+M],M+=x,S-=8);if(p===0)p=1-w;else{if(p===y)return v?NaN:(E?-1:1)*(1/0);v=v+Math.pow(2,i),p=p-w}return(E?-1:1)*v*Math.pow(2,p-i)},e.write=function(r,n,l,i,d,p){var v,_,y,w=p*8-d-1,S=(1<<w)-1,M=S>>1,x=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:p-1,T=i?1:-1,I=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(_=isNaN(n)?1:0,v=S):(v=Math.floor(Math.log(n)/Math.LN2),n*(y=Math.pow(2,-v))<1&&(v--,y*=2),v+M>=1?n+=x/y:n+=x*Math.pow(2,1-M),n*y>=2&&(v++,y/=2),v+M>=S?(_=0,v=S):v+M>=1?(_=(n*y-1)*Math.pow(2,d),v=v+M):(_=n*Math.pow(2,M-1)*Math.pow(2,d),v=0));d>=8;r[l+E]=_&255,E+=T,_/=256,d-=8);for(v=v<<d|_,w+=d;w>0;r[l+E]=v&255,E+=T,v/=256,w-=8);r[l+E-T]|=I*128}}),qoe=Np(e=>{"use strict";var r=XHe(),n=fEt(),l=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=v,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,v.TYPED_ARRAY_SUPPORT=d(),!v.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function d(){try{let P=new Uint8Array(1),C={foo:function(){return 42}};return Object.setPrototypeOf(C,Uint8Array.prototype),Object.setPrototypeOf(P,C),P.foo()===42}catch{return!1}}Object.defineProperty(v.prototype,"parent",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.buffer}}),Object.defineProperty(v.prototype,"offset",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.byteOffset}});function p(P){if(P>i)throw new RangeError('The value "'+P+'" is invalid for option "size"');let C=new Uint8Array(P);return Object.setPrototypeOf(C,v.prototype),C}function v(P,C,U){if(typeof P=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(P)}return _(P,C,U)}v.poolSize=8192;function _(P,C,U){if(typeof P=="string")return M(P,C);if(ArrayBuffer.isView(P))return E(P);if(P==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P);if(Be(P,ArrayBuffer)||P&&Be(P.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Be(P,SharedArrayBuffer)||P&&Be(P.buffer,SharedArrayBuffer)))return T(P,C,U);if(typeof P=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let ee=P.valueOf&&P.valueOf();if(ee!=null&&ee!==P)return v.from(ee,C,U);let Q=I(P);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof P[Symbol.toPrimitive]=="function")return v.from(P[Symbol.toPrimitive]("string"),C,U);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P)}v.from=function(P,C,U){return _(P,C,U)},Object.setPrototypeOf(v.prototype,Uint8Array.prototype),Object.setPrototypeOf(v,Uint8Array);function y(P){if(typeof P!="number")throw new TypeError('"size" argument must be of type number');if(P<0)throw new RangeError('The value "'+P+'" is invalid for option "size"')}function w(P,C,U){return y(P),P<=0?p(P):C!==void 0?typeof U=="string"?p(P).fill(C,U):p(P).fill(C):p(P)}v.alloc=function(P,C,U){return w(P,C,U)};function S(P){return y(P),p(P<0?0:B(P)|0)}v.allocUnsafe=function(P){return S(P)},v.allocUnsafeSlow=function(P){return S(P)};function M(P,C){if((typeof C!="string"||C==="")&&(C="utf8"),!v.isEncoding(C))throw new TypeError("Unknown encoding: "+C);let U=N(P,C)|0,ee=p(U),Q=ee.write(P,C);return Q!==U&&(ee=ee.slice(0,Q)),ee}function x(P){let C=P.length<0?0:B(P.length)|0,U=p(C);for(let ee=0;ee<C;ee+=1)U[ee]=P[ee]&255;return U}function E(P){if(Be(P,Uint8Array)){let C=new Uint8Array(P);return T(C.buffer,C.byteOffset,C.byteLength)}return x(P)}function T(P,C,U){if(C<0||P.byteLength<C)throw new RangeError('"offset" is outside of buffer bounds');if(P.byteLength<C+(U||0))throw new RangeError('"length" is outside of buffer bounds');let ee;return C===void 0&&U===void 0?ee=new Uint8Array(P):U===void 0?ee=new Uint8Array(P,C):ee=new Uint8Array(P,C,U),Object.setPrototypeOf(ee,v.prototype),ee}function I(P){if(v.isBuffer(P)){let C=B(P.length)|0,U=p(C);return U.length===0||P.copy(U,0,0,C),U}if(P.length!==void 0)return typeof P.length!="number"||be(P.length)?p(0):x(P);if(P.type==="Buffer"&&Array.isArray(P.data))return x(P.data)}function B(P){if(P>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return P|0}function O(P){return+P!=P&&(P=0),v.alloc(+P)}v.isBuffer=function(P){return P!=null&&P._isBuffer===!0&&P!==v.prototype},v.compare=function(P,C){if(Be(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),Be(C,Uint8Array)&&(C=v.from(C,C.offset,C.byteLength)),!v.isBuffer(P)||!v.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(P===C)return 0;let U=P.length,ee=C.length;for(let Q=0,te=Math.min(U,ee);Q<te;++Q)if(P[Q]!==C[Q]){U=P[Q],ee=C[Q];break}return U<ee?-1:ee<U?1:0},v.isEncoding=function(P){switch(String(P).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}},v.concat=function(P,C){if(!Array.isArray(P))throw new TypeError('"list" argument must be an Array of Buffers');if(P.length===0)return v.alloc(0);let U;if(C===void 0)for(C=0,U=0;U<P.length;++U)C+=P[U].length;let ee=v.allocUnsafe(C),Q=0;for(U=0;U<P.length;++U){let te=P[U];if(Be(te,Uint8Array))Q+te.length>ee.length?(v.isBuffer(te)||(te=v.from(te)),te.copy(ee,Q)):Uint8Array.prototype.set.call(ee,te,Q);else if(v.isBuffer(te))te.copy(ee,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=te.length}return ee};function N(P,C){if(v.isBuffer(P))return P.length;if(ArrayBuffer.isView(P)||Be(P,ArrayBuffer))return P.byteLength;if(typeof P!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof P);let U=P.length,ee=arguments.length>2&&arguments[2]===!0;if(!ee&&U===0)return 0;let Q=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return U;case"utf8":case"utf-8":return re(P).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U*2;case"hex":return U>>>1;case"base64":return he(P).length;default:if(Q)return ee?-1:re(P).length;C=(""+C).toLowerCase(),Q=!0}}v.byteLength=N;function H(P,C,U){let ee=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((U===void 0||U>this.length)&&(U=this.length),U<=0)||(U>>>=0,C>>>=0,U<=C))return"";for(P||(P="utf8");;)switch(P){case"hex":return o(this,C,U);case"utf8":case"utf-8":return u(this,C,U);case"ascii":return m(this,C,U);case"latin1":case"binary":return f(this,C,U);case"base64":return s(this,C,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,C,U);default:if(ee)throw new TypeError("Unknown encoding: "+P);P=(P+"").toLowerCase(),ee=!0}}v.prototype._isBuffer=!0;function K(P,C,U){let ee=P[C];P[C]=P[U],P[U]=ee}v.prototype.swap16=function(){let P=this.length;if(P%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<P;C+=2)K(this,C,C+1);return this},v.prototype.swap32=function(){let P=this.length;if(P%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<P;C+=4)K(this,C,C+3),K(this,C+1,C+2);return this},v.prototype.swap64=function(){let P=this.length;if(P%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<P;C+=8)K(this,C,C+7),K(this,C+1,C+6),K(this,C+2,C+5),K(this,C+3,C+4);return this},v.prototype.toString=function(){let P=this.length;return P===0?"":arguments.length===0?u(this,0,P):H.apply(this,arguments)},v.prototype.toLocaleString=v.prototype.toString,v.prototype.equals=function(P){if(!v.isBuffer(P))throw new TypeError("Argument must be a Buffer");return this===P?!0:v.compare(this,P)===0},v.prototype.inspect=function(){let P="",C=e.INSPECT_MAX_BYTES;return P=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(P+=" ... "),"<Buffer "+P+">"},l&&(v.prototype[l]=v.prototype.inspect),v.prototype.compare=function(P,C,U,ee,Q){if(Be(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),!v.isBuffer(P))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof P);if(C===void 0&&(C=0),U===void 0&&(U=P?P.length:0),ee===void 0&&(ee=0),Q===void 0&&(Q=this.length),C<0||U>P.length||ee<0||Q>this.length)throw new RangeError("out of range index");if(ee>=Q&&C>=U)return 0;if(ee>=Q)return-1;if(C>=U)return 1;if(C>>>=0,U>>>=0,ee>>>=0,Q>>>=0,this===P)return 0;let te=Q-ee,le=U-C,Ie=Math.min(te,le),se=this.slice(ee,Q),Ee=P.slice(C,U);for(let me=0;me<Ie;++me)if(se[me]!==Ee[me]){te=se[me],le=Ee[me];break}return te<le?-1:le<te?1:0};function J(P,C,U,ee,Q){if(P.length===0)return-1;if(typeof U=="string"?(ee=U,U=0):U>2147483647?U=2147483647:U<-2147483648&&(U=-2147483648),U=+U,be(U)&&(U=Q?0:P.length-1),U<0&&(U=P.length+U),U>=P.length){if(Q)return-1;U=P.length-1}else if(U<0)if(Q)U=0;else return-1;if(typeof C=="string"&&(C=v.from(C,ee)),v.isBuffer(C))return C.length===0?-1:L(P,C,U,ee,Q);if(typeof C=="number")return C=C&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(P,C,U):Uint8Array.prototype.lastIndexOf.call(P,C,U):L(P,[C],U,ee,Q);throw new TypeError("val must be string, number or Buffer")}function L(P,C,U,ee,Q){let te=1,le=P.length,Ie=C.length;if(ee!==void 0&&(ee=String(ee).toLowerCase(),ee==="ucs2"||ee==="ucs-2"||ee==="utf16le"||ee==="utf-16le")){if(P.length<2||C.length<2)return-1;te=2,le/=2,Ie/=2,U/=2}function se(me,pe){return te===1?me[pe]:me.readUInt16BE(pe*te)}let Ee;if(Q){let me=-1;for(Ee=U;Ee<le;Ee++)if(se(P,Ee)===se(C,me===-1?0:Ee-me)){if(me===-1&&(me=Ee),Ee-me+1===Ie)return me*te}else me!==-1&&(Ee-=Ee-me),me=-1}else for(U+Ie>le&&(U=le-Ie),Ee=U;Ee>=0;Ee--){let me=!0;for(let pe=0;pe<Ie;pe++)if(se(P,Ee+pe)!==se(C,pe)){me=!1;break}if(me)return Ee}return-1}v.prototype.includes=function(P,C,U){return this.indexOf(P,C,U)!==-1},v.prototype.indexOf=function(P,C,U){return J(this,P,C,U,!0)},v.prototype.lastIndexOf=function(P,C,U){return J(this,P,C,U,!1)};function $(P,C,U,ee){U=Number(U)||0;let Q=P.length-U;ee?(ee=Number(ee),ee>Q&&(ee=Q)):ee=Q;let te=C.length;ee>te/2&&(ee=te/2);let le;for(le=0;le<ee;++le){let Ie=parseInt(C.substr(le*2,2),16);if(be(Ie))return le;P[U+le]=Ie}return le}function V(P,C,U,ee){return Re(re(C,P.length-U),P,U,ee)}function h(P,C,U,ee){return Re(fe(C),P,U,ee)}function t(P,C,U,ee){return Re(he(C),P,U,ee)}function a(P,C,U,ee){return Re(ye(C,P.length-U),P,U,ee)}v.prototype.write=function(P,C,U,ee){if(C===void 0)ee="utf8",U=this.length,C=0;else if(U===void 0&&typeof C=="string")ee=C,U=this.length,C=0;else if(isFinite(C))C=C>>>0,isFinite(U)?(U=U>>>0,ee===void 0&&(ee="utf8")):(ee=U,U=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-C;if((U===void 0||U>Q)&&(U=Q),P.length>0&&(U<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");ee||(ee="utf8");let te=!1;for(;;)switch(ee){case"hex":return $(this,P,C,U);case"utf8":case"utf-8":return V(this,P,C,U);case"ascii":case"latin1":case"binary":return h(this,P,C,U);case"base64":return t(this,P,C,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,P,C,U);default:if(te)throw new TypeError("Unknown encoding: "+ee);ee=(""+ee).toLowerCase(),te=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s(P,C,U){return C===0&&U===P.length?r.fromByteArray(P):r.fromByteArray(P.slice(C,U))}function u(P,C,U){U=Math.min(P.length,U);let ee=[],Q=C;for(;Q<U;){let te=P[Q],le=null,Ie=te>239?4:te>223?3:te>191?2:1;if(Q+Ie<=U){let se,Ee,me,pe;switch(Ie){case 1:te<128&&(le=te);break;case 2:se=P[Q+1],(se&192)===128&&(pe=(te&31)<<6|se&63,pe>127&&(le=pe));break;case 3:se=P[Q+1],Ee=P[Q+2],(se&192)===128&&(Ee&192)===128&&(pe=(te&15)<<12|(se&63)<<6|Ee&63,pe>2047&&(pe<55296||pe>57343)&&(le=pe));break;case 4:se=P[Q+1],Ee=P[Q+2],me=P[Q+3],(se&192)===128&&(Ee&192)===128&&(me&192)===128&&(pe=(te&15)<<18|(se&63)<<12|(Ee&63)<<6|me&63,pe>65535&&pe<1114112&&(le=pe))}}le===null?(le=65533,Ie=1):le>65535&&(le-=65536,ee.push(le>>>10&1023|55296),le=56320|le&1023),ee.push(le),Q+=Ie}return b(ee)}var c=4096;function b(P){let C=P.length;if(C<=c)return String.fromCharCode.apply(String,P);let U="",ee=0;for(;ee<C;)U+=String.fromCharCode.apply(String,P.slice(ee,ee+=c));return U}function m(P,C,U){let ee="";U=Math.min(P.length,U);for(let Q=C;Q<U;++Q)ee+=String.fromCharCode(P[Q]&127);return ee}function f(P,C,U){let ee="";U=Math.min(P.length,U);for(let Q=C;Q<U;++Q)ee+=String.fromCharCode(P[Q]);return ee}function o(P,C,U){let ee=P.length;(!C||C<0)&&(C=0),(!U||U<0||U>ee)&&(U=ee);let Q="";for(let te=C;te<U;++te)Q+=Ne[P[te]];return Q}function g(P,C,U){let ee=P.slice(C,U),Q="";for(let te=0;te<ee.length-1;te+=2)Q+=String.fromCharCode(ee[te]+ee[te+1]*256);return Q}v.prototype.slice=function(P,C){let U=this.length;P=~~P,C=C===void 0?U:~~C,P<0?(P+=U,P<0&&(P=0)):P>U&&(P=U),C<0?(C+=U,C<0&&(C=0)):C>U&&(C=U),C<P&&(C=P);let ee=this.subarray(P,C);return Object.setPrototypeOf(ee,v.prototype),ee};function A(P,C,U){if(P%1!==0||P<0)throw new RangeError("offset is not uint");if(P+C>U)throw new RangeError("Trying to access beyond buffer length")}v.prototype.readUintLE=v.prototype.readUIntLE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P],Q=1,te=0;for(;++te<C&&(Q*=256);)ee+=this[P+te]*Q;return ee},v.prototype.readUintBE=v.prototype.readUIntBE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P+--C],Q=1;for(;C>0&&(Q*=256);)ee+=this[P+--C]*Q;return ee},v.prototype.readUint8=v.prototype.readUInt8=function(P,C){return P=P>>>0,C||A(P,1,this.length),this[P]},v.prototype.readUint16LE=v.prototype.readUInt16LE=function(P,C){return P=P>>>0,C||A(P,2,this.length),this[P]|this[P+1]<<8},v.prototype.readUint16BE=v.prototype.readUInt16BE=function(P,C){return P=P>>>0,C||A(P,2,this.length),this[P]<<8|this[P+1]},v.prototype.readUint32LE=v.prototype.readUInt32LE=function(P,C){return P=P>>>0,C||A(P,4,this.length),(this[P]|this[P+1]<<8|this[P+2]<<16)+this[P+3]*16777216},v.prototype.readUint32BE=v.prototype.readUInt32BE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]*16777216+(this[P+1]<<16|this[P+2]<<8|this[P+3])},v.prototype.readBigUInt64LE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=C+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24,Q=this[++P]+this[++P]*2**8+this[++P]*2**16+U*2**24;return BigInt(ee)+(BigInt(Q)<<BigInt(32))}),v.prototype.readBigUInt64BE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=C*2**24+this[++P]*2**16+this[++P]*2**8+this[++P],Q=this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+U;return(BigInt(ee)<<BigInt(32))+BigInt(Q)}),v.prototype.readIntLE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P],Q=1,te=0;for(;++te<C&&(Q*=256);)ee+=this[P+te]*Q;return Q*=128,ee>=Q&&(ee-=Math.pow(2,8*C)),ee},v.prototype.readIntBE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=C,Q=1,te=this[P+--ee];for(;ee>0&&(Q*=256);)te+=this[P+--ee]*Q;return Q*=128,te>=Q&&(te-=Math.pow(2,8*C)),te},v.prototype.readInt8=function(P,C){return P=P>>>0,C||A(P,1,this.length),this[P]&128?(255-this[P]+1)*-1:this[P]},v.prototype.readInt16LE=function(P,C){P=P>>>0,C||A(P,2,this.length);let U=this[P]|this[P+1]<<8;return U&32768?U|4294901760:U},v.prototype.readInt16BE=function(P,C){P=P>>>0,C||A(P,2,this.length);let U=this[P+1]|this[P]<<8;return U&32768?U|4294901760:U},v.prototype.readInt32LE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]|this[P+1]<<8|this[P+2]<<16|this[P+3]<<24},v.prototype.readInt32BE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]<<24|this[P+1]<<16|this[P+2]<<8|this[P+3]},v.prototype.readBigInt64LE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=this[P+4]+this[P+5]*2**8+this[P+6]*2**16+(U<<24);return(BigInt(ee)<<BigInt(32))+BigInt(C+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24)}),v.prototype.readBigInt64BE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=(C<<24)+this[++P]*2**16+this[++P]*2**8+this[++P];return(BigInt(ee)<<BigInt(32))+BigInt(this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+U)}),v.prototype.readFloatLE=function(P,C){return P=P>>>0,C||A(P,4,this.length),n.read(this,P,!0,23,4)},v.prototype.readFloatBE=function(P,C){return P=P>>>0,C||A(P,4,this.length),n.read(this,P,!1,23,4)},v.prototype.readDoubleLE=function(P,C){return P=P>>>0,C||A(P,8,this.length),n.read(this,P,!0,52,8)},v.prototype.readDoubleBE=function(P,C){return P=P>>>0,C||A(P,8,this.length),n.read(this,P,!1,52,8)};function R(P,C,U,ee,Q,te){if(!v.isBuffer(P))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>Q||C<te)throw new RangeError('"value" argument is out of bounds');if(U+ee>P.length)throw new RangeError("Index out of range")}v.prototype.writeUintLE=v.prototype.writeUIntLE=function(P,C,U,ee){if(P=+P,C=C>>>0,U=U>>>0,!ee){let le=Math.pow(2,8*U)-1;R(this,P,C,U,le,0)}let Q=1,te=0;for(this[C]=P&255;++te<U&&(Q*=256);)this[C+te]=P/Q&255;return C+U},v.prototype.writeUintBE=v.prototype.writeUIntBE=function(P,C,U,ee){if(P=+P,C=C>>>0,U=U>>>0,!ee){let le=Math.pow(2,8*U)-1;R(this,P,C,U,le,0)}let Q=U-1,te=1;for(this[C+Q]=P&255;--Q>=0&&(te*=256);)this[C+Q]=P/te&255;return C+U},v.prototype.writeUint8=v.prototype.writeUInt8=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,1,255,0),this[C]=P&255,C+1},v.prototype.writeUint16LE=v.prototype.writeUInt16LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,65535,0),this[C]=P&255,this[C+1]=P>>>8,C+2},v.prototype.writeUint16BE=v.prototype.writeUInt16BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,65535,0),this[C]=P>>>8,this[C+1]=P&255,C+2},v.prototype.writeUint32LE=v.prototype.writeUInt32LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,4294967295,0),this[C+3]=P>>>24,this[C+2]=P>>>16,this[C+1]=P>>>8,this[C]=P&255,C+4},v.prototype.writeUint32BE=v.prototype.writeUInt32BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,4294967295,0),this[C]=P>>>24,this[C+1]=P>>>16,this[C+2]=P>>>8,this[C+3]=P&255,C+4};function k(P,C,U,ee,Q){z(C,ee,Q,P,U,7);let te=Number(C&BigInt(4294967295));P[U++]=te,te=te>>8,P[U++]=te,te=te>>8,P[U++]=te,te=te>>8,P[U++]=te;let le=Number(C>>BigInt(32)&BigInt(4294967295));return P[U++]=le,le=le>>8,P[U++]=le,le=le>>8,P[U++]=le,le=le>>8,P[U++]=le,U}function q(P,C,U,ee,Q){z(C,ee,Q,P,U,7);let te=Number(C&BigInt(4294967295));P[U+7]=te,te=te>>8,P[U+6]=te,te=te>>8,P[U+5]=te,te=te>>8,P[U+4]=te;let le=Number(C>>BigInt(32)&BigInt(4294967295));return P[U+3]=le,le=le>>8,P[U+2]=le,le=le>>8,P[U+1]=le,le=le>>8,P[U]=le,U+8}v.prototype.writeBigUInt64LE=qe(function(P,C=0){return k(this,P,C,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeBigUInt64BE=qe(function(P,C=0){return q(this,P,C,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeIntLE=function(P,C,U,ee){if(P=+P,C=C>>>0,!ee){let Ie=Math.pow(2,8*U-1);R(this,P,C,U,Ie-1,-Ie)}let Q=0,te=1,le=0;for(this[C]=P&255;++Q<U&&(te*=256);)P<0&&le===0&&this[C+Q-1]!==0&&(le=1),this[C+Q]=(P/te>>0)-le&255;return C+U},v.prototype.writeIntBE=function(P,C,U,ee){if(P=+P,C=C>>>0,!ee){let Ie=Math.pow(2,8*U-1);R(this,P,C,U,Ie-1,-Ie)}let Q=U-1,te=1,le=0;for(this[C+Q]=P&255;--Q>=0&&(te*=256);)P<0&&le===0&&this[C+Q+1]!==0&&(le=1),this[C+Q]=(P/te>>0)-le&255;return C+U},v.prototype.writeInt8=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,1,127,-128),P<0&&(P=255+P+1),this[C]=P&255,C+1},v.prototype.writeInt16LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,32767,-32768),this[C]=P&255,this[C+1]=P>>>8,C+2},v.prototype.writeInt16BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,32767,-32768),this[C]=P>>>8,this[C+1]=P&255,C+2},v.prototype.writeInt32LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,2147483647,-2147483648),this[C]=P&255,this[C+1]=P>>>8,this[C+2]=P>>>16,this[C+3]=P>>>24,C+4},v.prototype.writeInt32BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,2147483647,-2147483648),P<0&&(P=4294967295+P+1),this[C]=P>>>24,this[C+1]=P>>>16,this[C+2]=P>>>8,this[C+3]=P&255,C+4},v.prototype.writeBigInt64LE=qe(function(P,C=0){return k(this,P,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),v.prototype.writeBigInt64BE=qe(function(P,C=0){return q(this,P,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Z(P,C,U,ee,Q,te){if(U+ee>P.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("Index out of range")}function ne(P,C,U,ee,Q){return C=+C,U=U>>>0,Q||Z(P,C,U,4,34028234663852886e22,-34028234663852886e22),n.write(P,C,U,ee,23,4),U+4}v.prototype.writeFloatLE=function(P,C,U){return ne(this,P,C,!0,U)},v.prototype.writeFloatBE=function(P,C,U){return ne(this,P,C,!1,U)};function G(P,C,U,ee,Q){return C=+C,U=U>>>0,Q||Z(P,C,U,8,17976931348623157e292,-17976931348623157e292),n.write(P,C,U,ee,52,8),U+8}v.prototype.writeDoubleLE=function(P,C,U){return G(this,P,C,!0,U)},v.prototype.writeDoubleBE=function(P,C,U){return G(this,P,C,!1,U)},v.prototype.copy=function(P,C,U,ee){if(!v.isBuffer(P))throw new TypeError("argument should be a Buffer");if(U||(U=0),!ee&&ee!==0&&(ee=this.length),C>=P.length&&(C=P.length),C||(C=0),ee>0&&ee<U&&(ee=U),ee===U||P.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(U<0||U>=this.length)throw new RangeError("Index out of range");if(ee<0)throw new RangeError("sourceEnd out of bounds");ee>this.length&&(ee=this.length),P.length-C<ee-U&&(ee=P.length-C+U);let Q=ee-U;return this===P&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(C,U,ee):Uint8Array.prototype.set.call(P,this.subarray(U,ee),C),Q},v.prototype.fill=function(P,C,U,ee){if(typeof P=="string"){if(typeof C=="string"?(ee=C,C=0,U=this.length):typeof U=="string"&&(ee=U,U=this.length),ee!==void 0&&typeof ee!="string")throw new TypeError("encoding must be a string");if(typeof ee=="string"&&!v.isEncoding(ee))throw new TypeError("Unknown encoding: "+ee);if(P.length===1){let te=P.charCodeAt(0);(ee==="utf8"&&te<128||ee==="latin1")&&(P=te)}}else typeof P=="number"?P=P&255:typeof P=="boolean"&&(P=Number(P));if(C<0||this.length<C||this.length<U)throw new RangeError("Out of range index");if(U<=C)return this;C=C>>>0,U=U===void 0?this.length:U>>>0,P||(P=0);let Q;if(typeof P=="number")for(Q=C;Q<U;++Q)this[Q]=P;else{let te=v.isBuffer(P)?P:v.from(P,ee),le=te.length;if(le===0)throw new TypeError('The value "'+P+'" is invalid for argument "value"');for(Q=0;Q<U-C;++Q)this[Q+C]=te[Q%le]}return this};var D={};function W(P,C,U){D[P]=class extends U{constructor(){super(),Object.defineProperty(this,"message",{value:C.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${P}]`,this.stack,delete this.name}get code(){return P}set code(ee){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ee,writable:!0})}toString(){return`${this.name} [${P}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function(P){return P?`${P} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(P,C){return`The "${P}" argument must be of type number. Received type ${typeof C}`},TypeError),W("ERR_OUT_OF_RANGE",function(P,C,U){let ee=`The value of "${P}" is out of range.`,Q=U;return Number.isInteger(U)&&Math.abs(U)>2**32?Q=ie(String(U)):typeof U=="bigint"&&(Q=String(U),(U>BigInt(2)**BigInt(32)||U<-(BigInt(2)**BigInt(32)))&&(Q=ie(Q)),Q+="n"),ee+=` It must be ${C}. Received ${Q}`,ee},RangeError);function ie(P){let C="",U=P.length,ee=P[0]==="-"?1:0;for(;U>=ee+4;U-=3)C=`_${P.slice(U-3,U)}${C}`;return`${P.slice(0,U)}${C}`}function X(P,C,U){F(C,"offset"),(P[C]===void 0||P[C+U]===void 0)&&Y(C,P.length-(U+1))}function z(P,C,U,ee,Q,te){if(P>U||P<C){let le=typeof C=="bigint"?"n":"",Ie;throw te>3?C===0||C===BigInt(0)?Ie=`>= 0${le} and < 2${le} ** ${(te+1)*8}${le}`:Ie=`>= -(2${le} ** ${(te+1)*8-1}${le}) and < 2 ** ${(te+1)*8-1}${le}`:Ie=`>= ${C}${le} and <= ${U}${le}`,new D.ERR_OUT_OF_RANGE("value",Ie,P)}X(ee,Q,te)}function F(P,C){if(typeof P!="number")throw new D.ERR_INVALID_ARG_TYPE(C,"number",P)}function Y(P,C,U){throw Math.floor(P)!==P?(F(P,U),new D.ERR_OUT_OF_RANGE(U||"offset","an integer",P)):C<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE(U||"offset",`>= ${U?1:0} and <= ${C}`,P)}var ae=/[^+/0-9A-Za-z-_]/g;function de(P){if(P=P.split("=")[0],P=P.trim().replace(ae,""),P.length<2)return"";for(;P.length%4!==0;)P=P+"=";return P}function re(P,C){C=C||1/0;let U,ee=P.length,Q=null,te=[];for(let le=0;le<ee;++le){if(U=P.charCodeAt(le),U>55295&&U<57344){if(!Q){if(U>56319){(C-=3)>-1&&te.push(239,191,189);continue}else if(le+1===ee){(C-=3)>-1&&te.push(239,191,189);continue}Q=U;continue}if(U<56320){(C-=3)>-1&&te.push(239,191,189),Q=U;continue}U=(Q-55296<<10|U-56320)+65536}else Q&&(C-=3)>-1&&te.push(239,191,189);if(Q=null,U<128){if((C-=1)<0)break;te.push(U)}else if(U<2048){if((C-=2)<0)break;te.push(U>>6|192,U&63|128)}else if(U<65536){if((C-=3)<0)break;te.push(U>>12|224,U>>6&63|128,U&63|128)}else if(U<1114112){if((C-=4)<0)break;te.push(U>>18|240,U>>12&63|128,U>>6&63|128,U&63|128)}else throw new Error("Invalid code point")}return te}function fe(P){let C=[];for(let U=0;U<P.length;++U)C.push(P.charCodeAt(U)&255);return C}function ye(P,C){let U,ee,Q,te=[];for(let le=0;le<P.length&&!((C-=2)<0);++le)U=P.charCodeAt(le),ee=U>>8,Q=U%256,te.push(Q),te.push(ee);return te}function he(P){return r.toByteArray(de(P))}function Re(P,C,U,ee){let Q;for(Q=0;Q<ee&&!(Q+U>=C.length||Q>=P.length);++Q)C[Q+U]=P[Q];return Q}function Be(P,C){return P instanceof C||P!=null&&P.constructor!=null&&P.constructor.name!=null&&P.constructor.name===C.name}function be(P){return P!==P}var Ne=function(){let P="0123456789abcdef",C=new Array(256);for(let U=0;U<16;++U){let ee=U*16;for(let Q=0;Q<16;++Q)C[ee+Q]=P[U]+P[Q]}return C}();function qe(P){return typeof BigInt>"u"?j:P}function j(){throw new Error("BigInt not supported")}}),hEt=Np((e,r)=>{typeof window<"u"?(window.global=window,globalThis.fetch=window.fetch,r.exports={Buffer:qoe().Buffer,Crypto:window.crypto}):r.exports={Buffer:qoe().Buffer,Crypto:crypto}}),eKe={};iEt(eKe,{AVSCTap:()=>P_,ArweaveSigner:()=>Rfe,DataItem:()=>__,MAX_TAG_BYTES:()=>LN,MIN_BINARY_SIZE:()=>kfe,SIG_CONFIG:()=>x8,SignatureConfig:()=>ol,Signer:()=>tKe,createData:()=>aKe,deserializeTags:()=>sN,indexToType:()=>Tfe,serializeTags:()=>Ife,tagsExceedLimit:()=>nKe});var tKe=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(e,r,n,l){throw new Error("You must implement verify method on child")}},uEt=d6(Afe(),1),mc=d6(QHe(),1);async function rKe(e){if(Array.isArray(e)){let i=(0,mc.concatBuffers)([(0,mc.stringToBuffer)("list"),(0,mc.stringToBuffer)(e.length.toString())]);return await iKe(e,await Tp().hash(i,"SHA-384"))}let r=e,n=(0,mc.concatBuffers)([(0,mc.stringToBuffer)("blob"),(0,mc.stringToBuffer)(r.byteLength.toString())]),l=(0,mc.concatBuffers)([await Tp().hash(n,"SHA-384"),await Tp().hash(r,"SHA-384")]);return await Tp().hash(l,"SHA-384")}async function iKe(e,r){if(e.length<1)return r;let n=(0,mc.concatBuffers)([r,await rKe(e[0])]),l=await Tp().hash(n,"SHA-384");return await iKe(e.slice(1),l)}var VX=d6(sEt(),1),lEt=VX.default.default?VX.default.default:VX.default,cEt=class extends lEt{getPublicKey(e){throw new Error("Unimplemented")}},dEt;function Tp(){return dEt??=new cEt}var ol;(function(e){e[e.ARWEAVE=1]="ARWEAVE",e[e.ED25519=2]="ED25519",e[e.ETHEREUM=3]="ETHEREUM",e[e.SOLANA=4]="SOLANA",e[e.INJECTEDAPTOS=5]="INJECTEDAPTOS",e[e.MULTIAPTOS=6]="MULTIAPTOS",e[e.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(ol||(ol={}));var x8={[ol.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[ol.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[ol.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[ol.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[ol.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[ol.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[ol.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},Rfe=class{signatureType=1;ownerLength=x8[1].pubLength;signatureLength=x8[1].sigLength;jwk;pk;constructor(e){this.pk=e.n,this.jwk=e}get publicKey(){return uEt.default.toBuffer(this.pk)}sign(e){return Tp().sign(this.jwk,e)}static async verify(e,r,n){return await Tp().verify(e,r,n)}},Tfe={1:Rfe},Nd=d6(Afe(),1);async function Uoe(e){return rKe([(0,mc.stringToBuffer)("dataitem"),(0,mc.stringToBuffer)("1"),(0,mc.stringToBuffer)(e.signatureType.toString()),e.rawOwner,e.rawTarget,e.rawAnchor,e.rawTags,e.rawData])}async function pEt(e,r){let n=await Uoe(e),l=await r.sign(n),i=await Tp().hash(l);return{signature:ze.from(l),id:ze.from(i)}}async function mEt(e,r){let{signature:n,id:l}=await pEt(e,r);return e.getRaw().set(n,2),l}var P_=class{buf;pos;constructor(e=ze.alloc(LN),r=0){this.buf=e,this.pos=r}writeTags(e){if(!Array.isArray(e))throw new Error("input must be array");let r=e.length,n;if(r)for(this.writeLong(r),n=0;n<r;n++){let l=e[n];if(l?.name===void 0||l?.value===void 0)throw new Error(`Invalid tag format for ${l}, expected {name:string, value: string}`);this.writeString(l.name),this.writeString(l.value)}this.writeLong(0)}toBuffer(){let e=ze.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(e,0,0,this.pos),e}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(e){let r=this.buf,n,l;if(e>=-1073741824&&e<1073741824){l=e>=0?e<<1:~e<<1|1;do r[this.pos]=l&127,l>>=7;while(l&&(r[this.pos++]|=128))}else{n=e>=0?e*2:-e*2-1;do r[this.pos]=n&127,n/=128;while(n>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(e){let r=ze.byteLength(e),n=this.buf;this.writeLong(r);let l=this.pos;if(this.pos+=r,!(this.pos>n.length)){if(r>64)this.buf.write(e,this.pos-r,r,"utf8");else{let i,d,p,v;for(i=0,d=r;i<d;i++)p=e.charCodeAt(i),p<128?n[l++]=p:p<2048?(n[l++]=p>>6|192,n[l++]=p&63|128):(p&64512)===55296&&((v=e.charCodeAt(i+1))&64512)===56320?(p=65536+((p&1023)<<10)+(v&1023),i++,n[l++]=p>>18|240,n[l++]=p>>12&63|128,n[l++]=p>>6&63|128,n[l++]=p&63|128):(n[l++]=p>>12|224,n[l++]=p>>6&63|128,n[l++]=p&63|128)}this.buf=n}}readLong(){let e=0,r=0,n=this.buf,l,i,d,p;do l=n[this.pos++],i=l&128,e|=(l&127)<<r,r+=7;while(i&&r<28);if(i){d=e,p=268435456;do l=n[this.pos++],d+=(l&127)*p,p*=128;while(l&128);return(d%2?-(d+1):d)/2}return e>>1^-(e&1)}skipLong(){let e=this.buf;for(;e[this.pos++]&128;);}readTags(){let e=[],r;for(;r=this.readLong();)for(r<0&&(r=-r,this.skipLong());r--;){let n=this.readString(),l=this.readString();e.push({name:n,value:l})}return e}readString(){let e=this.readLong(),r=this.pos,n=this.buf;if(this.pos+=e,!(this.pos>n.length))return this.buf.slice(r,r+e).toString()}};function Ife(e){let r=new P_;return r.writeTags(e),r.toBuffer()}function nKe(e){let r=new P_;return r.writeTags(e),r.tagsExceedLimit()}function sN(e){return new P_(e).readTags()}function Bv(e){let r=0;for(let n=e.length-1;n>=0;n--)r=r*256+e[n];return r}function vEt(e){if(e>29)throw new Error("Short too long");let r=[0,0];for(let n=0;n<r.length;n++){let l=e&255;r[n]=l,e=(e-l)/256}return Uint8Array.from(r)}function fCe(e){let r=[0,0,0,0,0,0,0,0];for(let n=0;n<r.length;n++){let l=e&255;r[n]=l,e=(e-l)/256}return Uint8Array.from(r)}var gEt=d6(hEt(),1),G3=d6(qoe(),1),LN=4096,kfe=80,__=class{binary;_id;constructor(e){this.binary=e}static isDataItem(e){return e.binary!==void 0}get signatureType(){let e=Bv(this.binary.subarray(0,2));if(ol?.[e]!==void 0)return e;throw new Error("Unknown signature type: "+e)}async isValid(){return __.verify(this.binary)}get id(){return(async()=>Nd.default.encode(await this.rawId))()}set id(e){this._id=Nd.default.toBuffer(e)}get rawId(){return(async()=>G3.Buffer.from(await gEt.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(e){this._id=e}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Nd.default.encode(this.rawSignature)}set rawOwner(e){if(e.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${e.byteLength} bytes.`);this.binary.set(e,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return x8[this.signatureType].sigLength}get owner(){return Nd.default.encode(this.rawOwner)}get ownerLength(){return x8[this.signatureType].pubLength}get rawTarget(){let e=this.getTargetStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):G3.Buffer.alloc(0)}get target(){return Nd.default.encode(this.rawTarget)}get rawAnchor(){let e=this.getAnchorStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):G3.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let e=this.getTagsStart(),r=Bv(this.binary.subarray(e+8,e+16));return this.binary.subarray(e+16,e+16+r)}get tags(){let e=this.getTagsStart();if(Bv(this.binary.subarray(e,e+8))==0)return[];let r=Bv(this.binary.subarray(e+8,e+16));return sN(G3.Buffer.from(this.binary.subarray(e+16,e+16+r)))}get tagsB64Url(){return this.tags.map(e=>({name:Nd.default.encode(e.name),value:Nd.default.encode(e.value)}))}getStartOfData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),n=Bv(r);return e+16+n}get rawData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),n=Bv(r),l=e+16+n;return this.binary.subarray(l,this.binary.length)}get data(){return Nd.default.encode(this.rawData)}getRaw(){return this.binary}async sign(e){return this._id=await mEt(this,e),this.rawId}async setSignature(e){this.binary.set(e,2),this._id=G3.Buffer.from(await Tp().hash(e))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(e=>({name:Nd.default.encode(e.name),value:Nd.default.encode(e.value)})),data:this.data}}static async verify(e){if(e.byteLength<kfe)return!1;let r=new __(e),n=r.signatureType,l=r.getTagsStart(),i=Bv(e.subarray(l,l+8)),d=e.subarray(l+8,l+16),p=Bv(d);if(p>LN)return!1;if(i>0)try{if(sN(G3.Buffer.from(e.subarray(l+16,l+16+p))).length!==i)return!1}catch{return!1}let v=Tfe[n],_=await Uoe(r);return await v.verify(r.rawOwner,_,r.rawSignature)}async getSignatureData(){return Uoe(this)}getTagsStart(){let e=this.getTargetStart(),r=this.binary[e]==1,n=e+(r?33:1),l=this.binary[n]==1;return n+=l?33:1,n}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let e=this.getTargetStart()+1,r=this.binary[this.getTargetStart()]==1;return e+=r?32:0,e}},bEt=d6(Afe(),1);function aKe(e,r,n){let l=r.publicKey,i=n?.target?bEt.default.toBuffer(n.target):null,d=1+(i?.byteLength??0),p=n?.anchor?ze.from(n.anchor):null,v=1+(p?.byteLength??0),_=(n?.tags?.length??0)>0?Ife(n.tags):null,y=16+(_?_.byteLength:0),w=ze.from(e),S=w.byteLength,M=2+r.signatureLength+r.ownerLength+d+v+y+S,x=ze.alloc(M);if(x.set(vEt(r.signatureType),0),x.set(new Uint8Array(r.signatureLength).fill(0),2),l.byteLength!==r.ownerLength)throw new Error(`Owner must be ${r.ownerLength} bytes, but was incorrectly ${l.byteLength}`);x.set(l,2+r.signatureLength);let E=2+r.signatureLength+r.ownerLength;if(x[E]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);x.set(i,E+1)}let T=E+d,I=T+1;if(x[T]=p?1:0,p){if(I+=p.byteLength,p.byteLength!==32)throw new Error("Anchor must be 32 bytes");x.set(p,T+1)}x.set(fCe(n?.tags?.length??0),I);let B=fCe(_?.byteLength??0);x.set(B,I+8),_&&x.set(_,I+16);let O=I+y;return x.set(w,O),new __(x)}var Bfe={...eKe};globalThis.arbundles??=Bfe;var yEt=Bfe,wEt=Bfe,_Et=uN(Wwt(),1);globalThis.Buffer||(globalThis.Buffer=xfe.Buffer);var{DataItem:MEt}=JHe,{signMessage:SEt}=_Et.httpbis;function xEt(e){return async({data:r,tags:n,target:l,anchor:i,createDataItem:d=p=>new MEt(p)})=>{let p=await e.signDataItem({data:r,tags:n,target:l,anchor:i}),v=d(xfe.Buffer.from(p));return{id:await v.id,raw:await v.getRaw()}}}function EEt(e){let r=["alg","keyid"].sort(),n;return async({fields:l,request:i})=>new Promise(d=>(n||(n=e.connect(["ACCESS_ADDRESS","ACCESS_PUBLIC_KEY","SIGNATURE"]).then(async()=>{let p=await e.getActivePublicKey(),v=await e.getActiveAddress();return{publicKey:p,address:v}})),d(n))).then(({publicKey:d,address:p})=>SEt({key:{id:d,alg:"rsa-pss-sha512",sign:async v=>{let _=await e.signMessage(v,{hashAlgorithm:"SHA-512"});return xfe.Buffer.from(_)}},fields:l,name:HSt(p),params:r},i))}var AEt=globalThis.GATEWAY_URL||void 0,REt=globalThis.MU_URL||void 0,TEt=globalThis.CU_URL||void 0,IEt=globalThis.GRAPHQL_URL||void 0,kEt=globalThis.GRAPHQL_MAX_RETRIES||void 0,BEt=globalThis.GRAPHQL_RETRY_BACKOFF||void 0,PEt=globalThis.RELAY_URL||void 0,OEt=globalThis.AO_URL=void 0,Au=Jxt({createDataItemSigner:$oe.createDataItemSigner,createHbSigner:$oe.createHbSigner}),{result:F0r,results:z0r,message:H0r,spawn:K0r,monitor:Z0r,unmonitor:W0r,dryrun:G0r,assign:V0r,createDataItemSigner:oKe}=Au({MODE:"legacy",GATEWAY_URL:AEt,MU_URL:REt,CU_URL:TEt,RELAY_URL:PEt,AO_URL:OEt,GRAPHQL_URL:IEt,GRAPHQL_MAX_RETRIES:kEt,GRAPHQL_RETRY_BACKOFF:BEt,noLog:!0});we();Me();_e();var QKe=$n(XKe(),1),KN=QKe.default.init({host:"arweave.net",port:443,protocol:"https"});we();Me();_e();we();Me();_e();var Ac=class extends Error{constructor(r){super(r),this.name=this.constructor.name}},eZe=class extends Ac{},tZe=class extends Ac{},rZe=class extends Ac{constructor(r,n){super(`Failed request: ${r}: ${n}`)}},iZe=class extends Ac{},ZN=class extends Ac{},nZe=class extends Ac{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},e1=class extends Ac{constructor(){super("Invalid contract configuration")}},aZe=class extends Ac{constructor(){super("Invalid process configuration")}},oZe=class extends Ac{};we();Me();_e();var Nc=$n(pQe(),1);we();Me();_e();var n4="3.14.1-alpha.2";var Vs=class e{logger;silent=!1;static default=new e;constructor({level:r="info"}={}){r==="none"&&(this.silent=!0),typeof window<"u"?this.logger=console:this.logger=(0,Nc.createLogger)({level:r,silent:this.silent,defaultMeta:{name:"ar-io-sdk",version:n4},format:Nc.format.combine(Nc.format.timestamp(),Nc.format.json()),transports:[new Nc.transports.Console({format:Nc.format.combine(Nc.format.timestamp(),Nc.format.json())})]})}info(r,...n){this.silent||this.logger.info(r,...n)}warn(r,...n){this.silent||this.logger.warn(r,...n)}error(r,...n){this.silent||this.logger.error(r,...n)}debug(r,...n){this.silent||this.logger.debug(r,...n)}setLogLevel(r){this.silent=r==="none","silent"in this.logger&&(this.logger.silent=r==="none"),"level"in this.logger&&(this.logger.level=r)}};we();Me();_e();we();Me();_e();var q0e=e=>{let r=Object.entries(e).sort(([n,l],[i,d])=>n==="@"?-1:i==="@"?1:"priority"in l&&!("priority"in d)?-1:!("priority"in l)&&"priority"in d?1:l.priority!==void 0&&d.priority!==void 0?l.priority===d.priority?n<i?-1:n>i?1:0:l.priority-d.priority:n<i?-1:n>i?1:0);return Object.fromEntries(r.map(([n,l],i)=>[n,{...l,index:i}]))},mQe=e=>"name"in e&&"ticker"in e&&"description"in e&&"keywords"in e&&"denomination"in e&&"owner"in e&&"controllers"in e&&"records"in e&&"balances"in e&&"logo"in e&&"totalsupply"in e&&"initialized"in e,vQe=e=>{function r(l){return Object.fromEntries(Object.entries(l).map(([i,d])=>i.toLowerCase().includes("balances")?[i.toLowerCase(),d]:typeof d=="object"&&!Array.isArray(d)&&d!==null?[i.toLowerCase(),r(d)]:[i.toLowerCase(),d]))}let n=r(e);return{Name:n.name,Ticker:n.ticker,Description:n.description,Keywords:n.keywords,Denomination:parseInt(n.denomination),Owner:n.owner,Controllers:n.controllers,Records:Object.entries(n.records).reduce((l,[i,d])=>(l[i]={transactionId:d.transactionid,ttlSeconds:d.ttlseconds,...d.priority!==void 0?{priority:d.priority}:{}},l),{}),Balances:n.balances,Logo:n.logo,TotalSupply:n.totalsupply||1,Initialized:n.initialized}};we();Me();_e();function o1(e,r){let n=e.safeParse(r);if(!n.success)throw new Error(JSON.stringify(n.error.format(),null,2));return n}we();Me();_e();we();Me();_e();we();Me();_e();sd();var gQe="+",bQe="/",yQe="-",wQe="_",_Qe="=";function DUt(e){let r=e.length%4;return r&&(e+=_Qe.repeat(4-r)),e.replaceAll(yQe,gQe).replaceAll(wQe,bQe)}function $Ut(e){return e.replaceAll(gQe,yQe).replaceAll(bQe,wQe).replaceAll(_Qe,"")}function qyr(e){let r=DUt(e);return ze.from(r,"base64")}function a4(e){let r=e.toString("base64");return $Ut(r)}function Uyr(e){return a4(Ul("sha256").update(Uint8Array.from(e)).digest())}function MQe(e=32){let r=mZ(e);return Array.from(r,n=>n.toString(16).padStart(2,"0")).join("").slice(0,e)}we();Me();_e();we();Me();_e();function U0e(e){try{return JSON.parse(e)}catch{return e}}we();Me();_e();we();Me();_e();var F0e=$n(xQe(),1);we();Me();_e();var jUt=Object.defineProperty,FUt=(e,r,n)=>r in e?jUt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,AM=(e,r,n)=>(FUt(e,typeof r!="symbol"?r+"":r,n),n),z0e=class{constructor(r){AM(this,"value"),AM(this,"next"),this.value=r}},H0e=class{constructor(){AM(this,"head"),AM(this,"tail"),AM(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(r){let n=new z0e(r);return this.head&&this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n),this._size++,this._size}pop(){if(!this.head)return;let r=this.head;return this.head=this.head.next,this._size--,r.value}get size(){return this._size}*[Symbol.iterator](){let r=this.head;for(;r;)yield r.value,r=r.next}};function EQe(e){if(!((Number.isInteger(e)||e===1/0)&&e>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let r=new H0e,n=0,l=()=>{n--,r.size>0&&r.pop()()},i=async(v,_,y)=>{n++;let w=(async()=>v(...y))();_(w);try{await w}catch{}l()},d=(v,_,y)=>{r.push(i.bind(null,v,_,y)),(async()=>(await Promise.resolve(),n<e&&r.size>0&&r.pop()()))()},p=(v,..._)=>new Promise(y=>{d(v,y,_)});return Object.defineProperties(p,{activeCount:{get:()=>n},pendingCount:{get:()=>r.size},clearQueue:{value:()=>{r.clear()}}}),p}we();Me();_e();var RM=class{static init(r){return r!==void 0&&"signer"in r?new K0e(r):new tL(r)}},tL=class{process;hyperbeamUrl;checkHyperBeamPromise;logger;constructor(r){if(this.logger=r?.logger??Vs.default,r===void 0||Object.keys(r).length===0)this.process=new ao({processId:S3});else if(g2(r))this.process=r.process;else if(b2(r))this.process=new ao({processId:r.processId});else throw new e1;r?.hyperbeamUrl!==void 0&&(this.hyperbeamUrl=new URL(r.hyperbeamUrl).toString(),this.checkHyperBeamPromise=this.checkHyperBeamCompatibility())}async checkHyperBeamCompatibility(){return this.hyperbeamUrl===void 0?Promise.resolve(!1):this.checkHyperBeamPromise!==void 0?this.checkHyperBeamPromise:(this.logger.debug("Checking HyperBeam compatibility"),this.checkHyperBeamPromise=fetch(`${this.hyperbeamUrl.toString()}${this.process.processId}~process@1.0/now/cache/acl`,{method:"HEAD",signal:AbortSignal.timeout(5e3)}).then(r=>r.ok?(this.logger.debug("HyperBeam compatible"),!0):(this.logger.debug("HyperBeam not compatible"),!1)),this.checkHyperBeamPromise)}async accessControlList({address:r}){if(await this.checkHyperBeamCompatibility()){let n=0;for(;n<3;)try{this.logger.debug("Fetching ant registry acl for address from hyperbeam",r);let l=await fetch(`${this.hyperbeamUrl?.toString()}${this.process.processId}~process@1.0/now/cache/acl/${r}/serialize~json@1.0`);if(l.status!==200)throw this.logger.debug("Failed to fetch ant registry acl for address from hyperbeam",r,l.status,l.statusText),new Error(`Failed to fetch ant registry acl for address ${r}: ${l?.statusText??"Unknown error"}`);this.logger.debug("Fetched ant registry acl for address from hyperbeam",r);let i=await l.json();return{Owned:i.Owned,Controlled:i.Controlled}}catch{n++,this.logger.debug("Failed to fetch ant registry acl for address from hyperbeam",r,n),await new Promise(i=>setTimeout(i,1e3*n**2))}}return this.logger.debug("Fetching ant registry acl for address from process",r),this.process.read({tags:[{name:"Action",value:"Access-Control-List"},{name:"Address",value:r}]})}async getAntsForAddress({address:r}){return this.accessControlList({address:r})}},K0e=class extends tL{signer;constructor({signer:r,...n}){super(n),this.signer=v2(r)}async register({processId:r}){return this.process.send({tags:[{name:"Action",value:"Register"},{name:"Process-Id",value:r}],signer:this.signer})}};we();Me();_e();we();Me();_e();var zUt="https://faucet.ario.permaweb.services";function W0e({arioInstance:e,faucetApiUrl:r=zUt}){let n=new Z0e({faucetUrl:r,processId:e.process.processId});return new Proxy(e,{get(i,d){if(d==="faucet")return n;if(d in i){let p=i[d];return typeof p=="function"?p.bind(i):p}}})}var Z0e=class{faucetUrl;processId;constructor({faucetUrl:r,processId:n}){this.faucetUrl=r,this.processId=n}async captchaUrl(){let r=await fetch(`${this.faucetUrl}/api/captcha/url?process-id=${this.processId}`,{method:"GET"});if(!r.ok){let l=await r.json().catch(()=>({error:r.statusText}));throw new Error(l.error)}return await r.json()}async claimWithCaptchaResponse({captchaResponse:r,recipient:n,quantity:l}){let i=await fetch(`${this.faucetUrl}/api/claim/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,recipient:n,quantity:l,captchaResponse:r})});if(!i.ok){let p=await i.json().catch(()=>({error:i.statusText}));throw new Error(p.error)}return await i.json()}async requestAuthToken({captchaResponse:r}){let n=await fetch(`${this.faucetUrl}/api/captcha/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,captchaResponse:r})});if(!n.ok){let i=await n.json().catch(()=>({error:n.statusText}));throw new Error(i.error)}return await n.json()}async claimWithAuthToken({authToken:r,recipient:n,quantity:l}){let i=await fetch(`${this.faucetUrl}/api/claim/async`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({recipient:n,qty:l,processId:this.processId})});if(!i.ok){let p=await i.json().catch(()=>({error:i.statusText}));throw new Error(p.error)}return await i.json()}async verifyAuthToken({authToken:r}){let n=await fetch(`${this.faucetUrl}/api/token/verify?process-id=${this.processId}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});if(!n.ok){let i=await n.json().catch(()=>({error:n.statusText}));throw new Error(i.error)}return await n.json()}};we();Me();_e();we();Me();_e();we();Me();_e();var pf=[];for(let e=0;e<256;++e)pf.push((e+256).toString(16).slice(1));function AQe(e,r=0){return(pf[e[r+0]]+pf[e[r+1]]+pf[e[r+2]]+pf[e[r+3]]+"-"+pf[e[r+4]]+pf[e[r+5]]+"-"+pf[e[r+6]]+pf[e[r+7]]+"-"+pf[e[r+8]]+pf[e[r+9]]+"-"+pf[e[r+10]]+pf[e[r+11]]+pf[e[r+12]]+pf[e[r+13]]+pf[e[r+14]]+pf[e[r+15]]).toLowerCase()}we();Me();_e();var G0e,HUt=new Uint8Array(16);function V0e(){if(!G0e){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");G0e=crypto.getRandomValues.bind(crypto)}return G0e(HUt)}we();Me();_e();we();Me();_e();var KUt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Y0e={randomUUID:KUt};function ZUt(e,r,n){if(Y0e.randomUUID&&!r&&!e)return Y0e.randomUUID();e=e||{};let l=e.random??e.rng?.()??V0e();if(l.length<16)throw new Error("Random bytes length must be >= 16");if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,r){if(n=n||0,n<0||n+16>r.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let i=0;i<16;++i)r[n+i]=l[i];return r}return AQe(l)}var J0e=ZUt;we();Me();_e();var X0e=class e{constructor(r){this.positiveFiniteInteger=r;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${r}`)}[Symbol.toPrimitive](r){return r==="string"&&this.toString(),this.positiveFiniteInteger}plus(r){return new e(this.positiveFiniteInteger+r.positiveFiniteInteger)}minus(r){return new e(this.positiveFiniteInteger-r.positiveFiniteInteger)}isGreaterThan(r){return this.positiveFiniteInteger>r.positiveFiniteInteger}isGreaterThanOrEqualTo(r){return this.positiveFiniteInteger>=r.positiveFiniteInteger}isLessThan(r){return this.positiveFiniteInteger<r.positiveFiniteInteger}isLessThanOrEqualTo(r){return this.positiveFiniteInteger<=r.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(r){return this.positiveFiniteInteger===r.positiveFiniteInteger}},Q0e=class{value;constructor(r){if(!Number.isFinite(r)||r<0)throw new Error("ARIOToken must be a non-negative finite number");this.value=+r.toFixed(6)}valueOf(){return this.value}toMARIO(){return new TM(Math.floor(this.value*IY))}toString(){return`${this.value}`}},TM=class e extends X0e{constructor(r){super(r)}multiply(r){let n=Math.floor(this.valueOf()*r.valueOf());return new e(n)}divide(r){if(r.valueOf()===0)throw new Error("Cannot divide by zero");let n=Math.floor(this.valueOf()/r.valueOf());return new e(n)}plus(r){let n=super.plus(r);return new e(n.valueOf())}minus(r){let n=super.minus(r);return new e(n.valueOf())}toARIO(){return new Q0e(this.valueOf()/IY)}};we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();function IM(e,r){return function(){return e.apply(r,arguments)}}var{toString:WUt}=Object.prototype,{getPrototypeOf:tle}=Object,iL=(e=>r=>{let n=WUt.call(r);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Cc=e=>(e=e.toLowerCase(),r=>iL(r)===e),nL=e=>r=>typeof r===e,{isArray:o4}=Array,kM=nL("undefined");function GUt(e){return e!==null&&!kM(e)&&e.constructor!==null&&!kM(e.constructor)&&Ou(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var TQe=Cc("ArrayBuffer");function VUt(e){let r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(e):r=e&&e.buffer&&TQe(e.buffer),r}var YUt=nL("string"),Ou=nL("function"),IQe=nL("number"),aL=e=>e!==null&&typeof e=="object",JUt=e=>e===!0||e===!1,rL=e=>{if(iL(e)!=="object")return!1;let r=tle(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},XUt=Cc("Date"),QUt=Cc("File"),ejt=Cc("Blob"),tjt=Cc("FileList"),rjt=e=>aL(e)&&Ou(e.pipe),ijt=e=>{let r;return e&&(typeof FormData=="function"&&e instanceof FormData||Ou(e.append)&&((r=iL(e))==="formdata"||r==="object"&&Ou(e.toString)&&e.toString()==="[object FormData]"))},njt=Cc("URLSearchParams"),[ajt,ojt,sjt,fjt]=["ReadableStream","Request","Response","Headers"].map(Cc),hjt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function BM(e,r,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let l,i;if(typeof e!="object"&&(e=[e]),o4(e))for(l=0,i=e.length;l<i;l++)r.call(null,e[l],l,e);else{let d=n?Object.getOwnPropertyNames(e):Object.keys(e),p=d.length,v;for(l=0;l<p;l++)v=d[l],r.call(null,e[v],v,e)}}function kQe(e,r){r=r.toLowerCase();let n=Object.keys(e),l=n.length,i;for(;l-- >0;)if(i=n[l],r===i.toLowerCase())return i;return null}var P6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,BQe=e=>!kM(e)&&e!==P6;function ele(){let{caseless:e}=BQe(this)&&this||{},r={},n=(l,i)=>{let d=e&&kQe(r,i)||i;rL(r[d])&&rL(l)?r[d]=ele(r[d],l):rL(l)?r[d]=ele({},l):o4(l)?r[d]=l.slice():r[d]=l};for(let l=0,i=arguments.length;l<i;l++)arguments[l]&&BM(arguments[l],n);return r}var ujt=(e,r,n,{allOwnKeys:l}={})=>(BM(r,(i,d)=>{n&&Ou(i)?e[d]=IM(i,n):e[d]=i},{allOwnKeys:l}),e),ljt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cjt=(e,r,n,l)=>{e.prototype=Object.create(r.prototype,l),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:r.prototype}),n&&Object.assign(e.prototype,n)},djt=(e,r,n,l)=>{let i,d,p,v={};if(r=r||{},e==null)return r;do{for(i=Object.getOwnPropertyNames(e),d=i.length;d-- >0;)p=i[d],(!l||l(p,e,r))&&!v[p]&&(r[p]=e[p],v[p]=!0);e=n!==!1&&tle(e)}while(e&&(!n||n(e,r))&&e!==Object.prototype);return r},pjt=(e,r,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=r.length;let l=e.indexOf(r,n);return l!==-1&&l===n},mjt=e=>{if(!e)return null;if(o4(e))return e;let r=e.length;if(!IQe(r))return null;let n=new Array(r);for(;r-- >0;)n[r]=e[r];return n},vjt=(e=>r=>e&&r instanceof e)(typeof Uint8Array<"u"&&tle(Uint8Array)),gjt=(e,r)=>{let l=(e&&e[Symbol.iterator]).call(e),i;for(;(i=l.next())&&!i.done;){let d=i.value;r.call(e,d[0],d[1])}},bjt=(e,r)=>{let n,l=[];for(;(n=e.exec(r))!==null;)l.push(n);return l},yjt=Cc("HTMLFormElement"),wjt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,l,i){return l.toUpperCase()+i}),RQe=(({hasOwnProperty:e})=>(r,n)=>e.call(r,n))(Object.prototype),_jt=Cc("RegExp"),PQe=(e,r)=>{let n=Object.getOwnPropertyDescriptors(e),l={};BM(n,(i,d)=>{let p;(p=r(i,d,e))!==!1&&(l[d]=p||i)}),Object.defineProperties(e,l)},Mjt=e=>{PQe(e,(r,n)=>{if(Ou(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let l=e[n];if(Ou(l)){if(r.enumerable=!1,"writable"in r){r.writable=!1;return}r.set||(r.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Sjt=(e,r)=>{let n={},l=i=>{i.forEach(d=>{n[d]=!0})};return o4(e)?l(e):l(String(e).split(r)),n},xjt=()=>{},Ejt=(e,r)=>e!=null&&Number.isFinite(e=+e)?e:r;function Ajt(e){return!!(e&&Ou(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Rjt=e=>{let r=new Array(10),n=(l,i)=>{if(aL(l)){if(r.indexOf(l)>=0)return;if(!("toJSON"in l)){r[i]=l;let d=o4(l)?[]:{};return BM(l,(p,v)=>{let _=n(p,i+1);!kM(_)&&(d[v]=_)}),r[i]=void 0,d}}return l};return n(e,0)},Tjt=Cc("AsyncFunction"),Ijt=e=>e&&(aL(e)||Ou(e))&&Ou(e.then)&&Ou(e.catch),OQe=((e,r)=>e?setImmediate:r?((n,l)=>(P6.addEventListener("message",({source:i,data:d})=>{i===P6&&d===n&&l.length&&l.shift()()},!1),i=>{l.push(i),P6.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ou(P6.postMessage)),kjt=typeof queueMicrotask<"u"?queueMicrotask.bind(P6):typeof We<"u"&&We.nextTick||OQe,ir={isArray:o4,isArrayBuffer:TQe,isBuffer:GUt,isFormData:ijt,isArrayBufferView:VUt,isString:YUt,isNumber:IQe,isBoolean:JUt,isObject:aL,isPlainObject:rL,isReadableStream:ajt,isRequest:ojt,isResponse:sjt,isHeaders:fjt,isUndefined:kM,isDate:XUt,isFile:QUt,isBlob:ejt,isRegExp:_jt,isFunction:Ou,isStream:rjt,isURLSearchParams:njt,isTypedArray:vjt,isFileList:tjt,forEach:BM,merge:ele,extend:ujt,trim:hjt,stripBOM:ljt,inherits:cjt,toFlatObject:djt,kindOf:iL,kindOfTest:Cc,endsWith:pjt,toArray:mjt,forEachEntry:gjt,matchAll:bjt,isHTMLForm:yjt,hasOwnProperty:RQe,hasOwnProp:RQe,reduceDescriptors:PQe,freezeMethods:Mjt,toObjectSet:Sjt,toCamelCase:wjt,noop:xjt,toFiniteNumber:Ejt,findKey:kQe,global:P6,isContextDefined:BQe,isSpecCompliantForm:Ajt,toJSONObject:Rjt,isAsyncFn:Tjt,isThenable:Ijt,setImmediate:OQe,asap:kjt};we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();function s4(e,r,n,l,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",r&&(this.code=r),n&&(this.config=n),l&&(this.request=l),i&&(this.response=i,this.status=i.status?i.status:null)}ir.inherits(s4,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ir.toJSONObject(this.config),code:this.code,status:this.status}}});var NQe=s4.prototype,CQe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{CQe[e]={value:e}});Object.defineProperties(s4,CQe);Object.defineProperty(NQe,"isAxiosError",{value:!0});s4.from=(e,r,n,l,i,d)=>{let p=Object.create(NQe);return ir.toFlatObject(e,p,function(_){return _!==Error.prototype},v=>v!=="isAxiosError"),s4.call(p,e.message,r,n,l,i),p.cause=e,p.name=e.name,d&&Object.assign(p,d),p};var ci=s4;we();Me();_e();var oL=null;function rle(e){return ir.isPlainObject(e)||ir.isArray(e)}function DQe(e){return ir.endsWith(e,"[]")?e.slice(0,-2):e}function LQe(e,r,n){return e?e.concat(r).map(function(i,d){return i=DQe(i),!n&&d?"["+i+"]":i}).join(n?".":""):r}function Bjt(e){return ir.isArray(e)&&!e.some(rle)}var Pjt=ir.toFlatObject(ir,{},null,function(r){return/^is[A-Z]/.test(r)});function Ojt(e,r,n){if(!ir.isObject(e))throw new TypeError("target must be an object");r=r||new(oL||FormData),n=ir.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,I){return!ir.isUndefined(I[T])});let l=n.metaTokens,i=n.visitor||w,d=n.dots,p=n.indexes,_=(n.Blob||typeof Blob<"u"&&Blob)&&ir.isSpecCompliantForm(r);if(!ir.isFunction(i))throw new TypeError("visitor must be a function");function y(E){if(E===null)return"";if(ir.isDate(E))return E.toISOString();if(!_&&ir.isBlob(E))throw new ci("Blob is not supported. Use a Buffer instead.");return ir.isArrayBuffer(E)||ir.isTypedArray(E)?_&&typeof Blob=="function"?new Blob([E]):ze.from(E):E}function w(E,T,I){let B=E;if(E&&!I&&typeof E=="object"){if(ir.endsWith(T,"{}"))T=l?T:T.slice(0,-2),E=JSON.stringify(E);else if(ir.isArray(E)&&Bjt(E)||(ir.isFileList(E)||ir.endsWith(T,"[]"))&&(B=ir.toArray(E)))return T=DQe(T),B.forEach(function(N,H){!(ir.isUndefined(N)||N===null)&&r.append(p===!0?LQe([T],H,d):p===null?T:T+"[]",y(N))}),!1}return rle(E)?!0:(r.append(LQe(I,T,d),y(E)),!1)}let S=[],M=Object.assign(Pjt,{defaultVisitor:w,convertValue:y,isVisitable:rle});function x(E,T){if(!ir.isUndefined(E)){if(S.indexOf(E)!==-1)throw Error("Circular reference detected in "+T.join("."));S.push(E),ir.forEach(E,function(B,O){(!(ir.isUndefined(B)||B===null)&&i.call(r,B,ir.isString(O)?O.trim():O,T,M))===!0&&x(B,T?T.concat(O):[O])}),S.pop()}}if(!ir.isObject(e))throw new TypeError("data must be an object");return x(e),r}var y2=Ojt;function $Qe(e){let r={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(l){return r[l]})}function qQe(e,r){this._pairs=[],e&&y2(e,this,r)}var UQe=qQe.prototype;UQe.append=function(r,n){this._pairs.push([r,n])};UQe.toString=function(r){let n=r?function(l){return r.call(this,l,$Qe)}:$Qe;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};var sL=qQe;function Njt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function PM(e,r,n){if(!r)return e;let l=n&&n.encode||Njt;ir.isFunction(n)&&(n={serialize:n});let i=n&&n.serialize,d;if(i?d=i(r,n):d=ir.isURLSearchParams(r)?r.toString():new sL(r,n).toString(l),d){let p=e.indexOf("#");p!==-1&&(e=e.slice(0,p)),e+=(e.indexOf("?")===-1?"?":"&")+d}return e}we();Me();_e();var ile=class{constructor(){this.handlers=[]}use(r,n,l){return this.handlers.push({fulfilled:r,rejected:n,synchronous:l?l.synchronous:!1,runWhen:l?l.runWhen:null}),this.handlers.length-1}eject(r){this.handlers[r]&&(this.handlers[r]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(r){ir.forEach(this.handlers,function(l){l!==null&&r(l)})}},nle=ile;we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();var fL={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();var jQe=typeof URLSearchParams<"u"?URLSearchParams:sL;we();Me();_e();var FQe=typeof FormData<"u"?FormData:null;we();Me();_e();var zQe=typeof Blob<"u"?Blob:null;var HQe={isBrowser:!0,classes:{URLSearchParams:jQe,FormData:FQe,Blob:zQe},protocols:["http","https","file","blob","url","data"]};var sle={};jf(sle,{hasBrowserEnv:()=>ole,hasStandardBrowserEnv:()=>Cjt,hasStandardBrowserWebWorkerEnv:()=>Ljt,navigator:()=>ale,origin:()=>Djt});we();Me();_e();var ole=typeof window<"u"&&typeof document<"u",ale=typeof navigator=="object"&&navigator||void 0,Cjt=ole&&(!ale||["ReactNative","NativeScript","NS"].indexOf(ale.product)<0),Ljt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Djt=ole&&window.location.href||"http://localhost";var _o={...sle,...HQe};function fle(e,r){return y2(e,new _o.classes.URLSearchParams,Object.assign({visitor:function(n,l,i,d){return _o.isNode&&ir.isBuffer(n)?(this.append(l,n.toString("base64")),!1):d.defaultVisitor.apply(this,arguments)}},r))}we();Me();_e();function $jt(e){return ir.matchAll(/\w+|\[(\w*)]/g,e).map(r=>r[0]==="[]"?"":r[1]||r[0])}function qjt(e){let r={},n=Object.keys(e),l,i=n.length,d;for(l=0;l<i;l++)d=n[l],r[d]=e[d];return r}function Ujt(e){function r(n,l,i,d){let p=n[d++];if(p==="__proto__")return!0;let v=Number.isFinite(+p),_=d>=n.length;return p=!p&&ir.isArray(i)?i.length:p,_?(ir.hasOwnProp(i,p)?i[p]=[i[p],l]:i[p]=l,!v):((!i[p]||!ir.isObject(i[p]))&&(i[p]=[]),r(n,l,i[p],d)&&ir.isArray(i[p])&&(i[p]=qjt(i[p])),!v)}if(ir.isFormData(e)&&ir.isFunction(e.entries)){let n={};return ir.forEachEntry(e,(l,i)=>{r($jt(l),i,n,0)}),n}return null}var hL=Ujt;function jjt(e,r,n){if(ir.isString(e))try{return(r||JSON.parse)(e),ir.trim(e)}catch(l){if(l.name!=="SyntaxError")throw l}return(n||JSON.stringify)(e)}var hle={transitional:fL,adapter:["xhr","http","fetch"],transformRequest:[function(r,n){let l=n.getContentType()||"",i=l.indexOf("application/json")>-1,d=ir.isObject(r);if(d&&ir.isHTMLForm(r)&&(r=new FormData(r)),ir.isFormData(r))return i?JSON.stringify(hL(r)):r;if(ir.isArrayBuffer(r)||ir.isBuffer(r)||ir.isStream(r)||ir.isFile(r)||ir.isBlob(r)||ir.isReadableStream(r))return r;if(ir.isArrayBufferView(r))return r.buffer;if(ir.isURLSearchParams(r))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),r.toString();let v;if(d){if(l.indexOf("application/x-www-form-urlencoded")>-1)return fle(r,this.formSerializer).toString();if((v=ir.isFileList(r))||l.indexOf("multipart/form-data")>-1){let _=this.env&&this.env.FormData;return y2(v?{"files[]":r}:r,_&&new _,this.formSerializer)}}return d||i?(n.setContentType("application/json",!1),jjt(r)):r}],transformResponse:[function(r){let n=this.transitional||hle.transitional,l=n&&n.forcedJSONParsing,i=this.responseType==="json";if(ir.isResponse(r)||ir.isReadableStream(r))return r;if(r&&ir.isString(r)&&(l&&!this.responseType||i)){let p=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(r)}catch(v){if(p)throw v.name==="SyntaxError"?ci.from(v,ci.ERR_BAD_RESPONSE,this,null,this.response):v}}return r}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_o.classes.FormData,Blob:_o.classes.Blob},validateStatus:function(r){return r>=200&&r<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ir.forEach(["delete","get","head","post","put","patch"],e=>{hle.headers[e]={}});var f4=hle;we();Me();_e();we();Me();_e();var Fjt=ir.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),KQe=e=>{let r={},n,l,i;return e&&e.split(`
243
+ `]);return{boundary:n,body:l}}async function zSt(e){let r=await e.arrayBuffer(),n=await crypto.subtle.digest("SHA-256",r);return qSt.Buffer.from(n)}async function vfe({processId:e,data:r,tags:n,anchor:l}){let i=new Headers;e&&i.append("target",e),l&&i.append("anchor",l),n&&n.forEach(p=>i.append(p.name,p.value)),i.set("Variant","ao.N.1");let d;if(r){let p=i.get("content-type"),v=await FSt(r,p);d=v.body,i.set("Content-Type",`multipart/form-data; boundary="${v.boundary}"`);let _=await zSt(d);i.append("Content-Digest",`sha-256=:${jSt(_)}:`)}return{headers:i,body:d}}function gfe({url:e,method:r,headers:n}){return n=new Headers(n),{fields:[...n.keys()].sort(),request:{url:e,method:r,headers:{...Object.fromEntries(n)}}}}function HSt(e){return`http-sig-${[...USt(e).subarray(1,9)].map(r=>r.toString(16).padStart(2,"0")).join("")}`}function KSt({fetch:e,logger:r,HB_URL:n,signer:l}){let i=r.child("deployProcess");return d=>wi(d).chain(Ji(({processId:p,data:v,tags:_})=>vfe({processId:p,data:v,tags:_}))).chain(Ji(({headers:p,body:v})=>l(gfe({url:`${n}/~scheduler@1.0/schedule`,method:"POST",headers:p})).then(_=>({..._,body:v})))).map(i.tap("Sending HTTP signed message to HB MU: %o")).chain(p=>wi(p).chain(Ji(({url:v,method:_,headers:y,body:w})=>e(v,{method:_,headers:y,body:w,redirect:"follow"}))).bichain(v=>Mc(v),Ji(async v=>{if(v.ok)return v.headers.get("process");throw new Error(`${v.status}: ${await v.text()}`)})).bimap(i.tap("Error encountered when deploying process via HB MU"),i.tap("Successfully deployed process via HB MU")).map(v=>({processId:v}))).toPromise()}function ZSt({fetch:e,logger:r,HB_URL:n,signer:l}){let i=r.child("deployMessage");return d=>wi(d).chain(Ji(({processId:p,data:v,tags:_,anchor:y})=>vfe({processId:p,data:v,tags:_,anchor:y}))).chain(Ji(({headers:p,body:v})=>l(gfe({url:`${n}/~scheduler@1.0/schedule`,method:"POST",headers:p})).then(_=>({..._,body:v})))).map(i.tap("Sending HTTP signed message to HB MU: %o")).chain(p=>wi(p).chain(Ji(({url:v,method:_,headers:y,body:w})=>e(v,{method:_,headers:y,body:w,redirect:"follow"}))).bichain(v=>Mc(v),Ji(async v=>{if(v.ok)return v.headers.get("slot");throw new Error(`${v.status}: ${await v.text()}`)})).bimap(i.tap("Error encountered when writing message via HB MU"),i.tap("Successfully wrote message via HB MU")).map(v=>({messageId:v}))).toPromise()}function WSt({fetch:e,logger:r,HB_URL:n,signer:l}){let i=r.child("loadResult");return d=>wi(d).chain(Ji(async({id:p,processId:v})=>{let{headers:_,body:y}=await vfe({processId:v});return _.append("slot+integer",p),_.append("accept","application/json"),l(gfe({url:`${n}/~compute-lite@1.0/compute&slot+integer=${p}&process-id=${v}`,method:"POST",headers:_})).then(w=>({...w,body:y}))})).map(i.tap("fetching message result from HB CU: %o")).chain(p=>wi(p).chain(Ji(({url:v,method:_,headers:y,body:w})=>e(v,{method:_,headers:y,body:w,redirect:"follow"}))).bichain(v=>Mc(v),Ji(async v=>{if(v.ok)return v.json();throw new Error(`${v.status}: ${await v.text()}`)})).bimap(i.tap("Error encountered when writing message via HB CU"),i.tap("Successfully wrote message via HB CU"))).toPromise()}function GSt({fetch:e,logger:r,HB_URL:n,signer:l}){return async(i,d)=>{let p=new URL(i);d.headers=new Headers(d.headers);let v=p.href,_=new URLSearchParams({"relay-path":v}),y=`${n}/~relay@1.0/call?${_.toString()}`;r('Relaying "%s" through HyperBEAM Node "%s"',p.href,y);let{headers:w}=await l({fields:[...d.headers.keys(),"relay-path"].sort(),request:{url:i,...d,headers:{...Object.fromEntries(d.headers),"relay-path":v}}});return e(y,{...d,headers:w})}}var VSt=uN(iyt(),1),FHe=(e="@permaweb/aoconnect")=>{let r=(0,VSt.default)(e);return r.child=n=>FHe(`${r.namespace}:${n}`),r.tap=(n,...l)=>kMt((...i)=>r(n,...l,...i)),r},zHe=({url:e,path:r})=>r?r.startsWith("/")?zHe({url:e,path:r.slice(1)}):(e=new URL(e),e.pathname+=r,e.toString()):e;function YSt(e){return a2(PN([]),a_((r,n)=>a2(AMt([],n.name),L_t(n.value),Ch(n.name,Ip,r))(r),{}),cfe(r=>r.length>1?r:r[0]))(e)}function QNe(e){return _He([[q9(String),$9(e)],[q9(Array),mMt(e)],[fHe,K9t]])}function c6(e){let r;return q9(sl,e)?(r=new Error(JSt(e)),r.stack+=e.stack):q9(Error,e)?r=e:cMt("message",e)?r=new Error(e.message):q9(String,e)?r=new Error(e):r=new Error("An error occurred"),r}function JSt(e){return a2(r=>function n(l,i,d){return a_((p,v)=>a2(_He([[$9(cr.invalid_arguments),()=>n(v.argumentsError,422,"Invalid Arguments")],[$9(cr.invalid_return_type),()=>n(v.returnTypeError,500,"Invalid Return")],[$9(cr.invalid_union),()=>J_t(_=>n(_,400,"Invalid Union"),v.unionErrors)],[fHe,()=>[{...v,status:i,contextCode:d}]]]),oMt(p))(v.code),[],l.issues)}(r,400,""),r=>a_((n,l)=>{let{message:i,path:d,contextCode:p}=l,v=d[1]||d[0],_=p?`${p} `:"";return n.push(`${_}'${v}': ${i}.`),n},[],r),_Mt(" | "))(e)}var XSt=ar.object({id:ar.string().min(1,{message:"message is required to be a message id"}),processId:ar.string().min(1,{message:"process is required to be a process id"})});function QSt(){return e=>wi(e).map(XSt.parse).map(()=>e)}var B_=ar.object({name:ar.string(),value:ar.string()}),ext=ar.function().args(ar.object({Id:ar.string(),Target:ar.string(),Owner:ar.string(),Anchor:ar.string().optional(),Data:ar.any().default("1234"),Tags:ar.array(ar.object({name:ar.string(),value:ar.string()}))})).returns(ar.promise(ar.any())),txt=ar.function().args(ar.object({id:ar.string().min(1,{message:"message id is required"}),processId:ar.string().min(1,{message:"process id is required"})})).returns(ar.promise(ar.any())),rxt=ar.function().args(ar.object({process:ar.string().min(1,{message:"process id is required"}),from:ar.string().optional(),to:ar.string().optional(),sort:ar.enum(["ASC","DESC"]).default("ASC"),limit:ar.number().optional()})).returns(ar.promise(ar.object({edges:ar.array(ar.object({cursor:ar.string(),node:ar.object({Output:ar.any().optional(),Messages:ar.array(ar.any()).optional(),Spawns:ar.array(ar.any()).optional(),Error:ar.any().optional()})}))}))),HHe=ar.function().args(ar.object({processId:ar.string(),data:ar.any(),tags:ar.array(B_),anchor:ar.string().optional(),signer:ar.any()})).returns(ar.promise(ar.object({messageId:ar.string()}).passthrough())),ixt=ar.function().args(ar.object({data:ar.any(),tags:ar.array(B_),signer:ar.any()})).returns(ar.promise(ar.object({processId:ar.string()}).passthrough())),nxt=ar.function().args(ar.object({process:ar.string(),message:ar.string(),baseLayer:ar.boolean().optional(),exclude:ar.array(ar.string()).optional()})).returns(ar.promise(ar.object({assignmentId:ar.string()}).passthrough())),KHe=HHe,U0r=ar.function().args(ar.object({suUrl:ar.string().url(),processId:ar.string()})).returns(ar.promise(ar.object({tags:ar.array(B_)}).passthrough())),j0r=ar.function().args(ar.string()).returns(ar.promise(ar.object({url:ar.string()}))),axt=ar.function().args(ar.string()).returns(ar.promise(ar.boolean())),oxt=ar.function().args(ar.string()).returns(ar.promise(ar.object({tags:ar.array(B_)}).passthrough())),ON=ar.function().args(ar.object({data:ar.any(),tags:ar.array(B_),target:ar.string().optional(),anchor:ar.string().optional()})).returns(ar.promise(ar.object({id:ar.string(),raw:ar.any()})));function sxt({loadResult:e}){return e=Ji(txt.implement(e)),r=>wi({id:r.id,processId:r.processId}).chain(e)}function ZX(e){let r=QSt(e),n=sxt(e);return({message:l,process:i})=>wi({id:l,processId:i}).chain(r).chain(n).map(e.logger.tap('readResult result for message "%s": %O',l)).map(d=>d).bimap(c6,l6).toPromise()}var u6=(...e)=>r=>e.reduce((n,l)=>l(n),r),bfe=e=>r=>r??e,fxt=e=>r=>u6(n=>n&&n[r],bfe(e)),hxt=e=>r=>{let n={};for(let l in r)r.hasOwnProperty(l)&&(n[l]=e(r[l],l,r));return n},uxt=e=>(...r)=>!e(...r),NN=e=>r=>{let n=r.findIndex(i=>i.name==="Data-Protocol"&&i.value===e);if(n===-1)return[0,0];let l=r.findIndex((i,d)=>d>n&&i.name==="Data-Protocol"&&i.value!==e);return l===-1&&(l=r.length),[n,l]},yfe=e=>{let r=e.findIndex(n=>n.name==="Data-Protocol");return r===-1&&(r=e.length),r},ZHe=e=>r=>r.name===e,wfe=(e,r)=>u6(NN(e),([n,l])=>r.slice(n,l))(r),WHe=(e,r,n)=>u6(l=>wfe(e,l),l=>l.filter(ZHe(r)))(n),lxt=(e,r,n)=>u6(l=>WHe(e,r,l),l=>l[0])(n),CN=(e,r)=>(r=r.filter(n=>n.name!=="Data-Protocol"||n.value!==e),r.length?[{name:"Data-Protocol",value:e},...r]:[]),cxt=(e,r,n)=>{let[l,i]=NN(e)(n),[d,p,v]=[n.slice(0,l),n.slice(l,i),n.slice(i)];return p.length||(r=CN(e,r),d=v,v=[]),[d,p,r,v].flat(1)},dxt=(e,r)=>{let n=yfe(r),[l,i]=[r.slice(0,n),r.slice(n)];return[l,e,i].flat(1)},GHe=(e,r,n)=>{let[l,i]=NN(e)(n),[d,p]=[n.slice(0,l),n.slice(i)];return p.length===n.length&&(d=p,p=[]),[d,CN(e,r),p].flat(1)},pxt=(e,r)=>GHe(e,[],r),mxt=(e,r,n)=>{let[l,i]=NN(e)(n),[d,p,v]=[n.slice(0,l),n.slice(l,i),n.slice(i)];return[d,CN(e,p.filter(uxt(ZHe(r)))),v].flat(1)},_fe=(e,r=!1)=>u6(bfe([]),n=>n.reduce((l,i)=>u6(fxt([])(i.name),d=>(d.push(i.value),d),d=>(l[i.name]=d,l))(l),{}),hxt(n=>r?n:n[0]))(e),VHe=(e,r,n)=>u6(bfe([]),l=>wfe(e,l),l=>_fe(l,n))(r),vxt=(e,r)=>VHe(e,r,!0),gxt=(e,r)=>VHe(e,r,!1),bxt=e=>{let r=yfe(e);return _fe(e.slice(0,r),!1)},yxt=e=>{let r=yfe(e);return _fe(e.slice(0,r),!0)},YHe=e=>({findAll:r=>wfe(e,r),findAllByName:(r,n)=>WHe(e,r,n),findByName:(r,n)=>lxt(e,r,n),create:r=>CN(e,r),update:(r,n)=>GHe(e,r,n),concat:(r,n)=>cxt(e,r,n),removeAll:r=>pxt(e,r),removeAllByName:(r,n)=>mxt(e,r,n),parse:r=>gxt(e,r),parseAll:r=>vxt(e,r),concatUnassoc:dxt,parseUnassoc:bxt,parseAllUnassoc:yxt}),Mfe=YHe("ao"),eCe=O8(Mfe.removeAllByName),wxt=O8(Mfe.concat),tCe=O8(Mfe.concatUnassoc),_xt=ar.array(ar.object({name:ar.string(),value:ar.string()}));function Mxt(){return e=>wi(e.tags).map(PN([])).map(eCe("Variant")).map(eCe("Type")).map(wxt([{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"}])).map(_xt.parse).map(Ch("tags",Ip,e))}function Sxt({logger:e}){return r=>wi(r).chain(MHe(gHe(r.data),()=>o6(r),()=>o6(" ").map(Ch("data",Ip,r)).map(n=>a2(s6("tags"),tCe([{name:"Content-Type",value:"text/plain"}]),Ch("tags",Ip,n))(n)).map(e.tap('added pseudo-random string as message "data"')))).map(n=>a2(s6("tags"),tCe([{name:"SDK",value:"aoconnect"}]),Ch("tags",Ip,n))(n))}function xxt(e){let r=Mxt(e),n=Sxt(e),l=HHe.implement(e.deployMessage);return i=>wi(i).chain(r).chain(n).chain(Ji(({id:d,data:p,tags:v,anchor:_,signer:y})=>l({processId:d,data:p,tags:v,anchor:_,signer:ON.implement(y)}))).map(d=>Ch("messageId",d.messageId,i))}function WX(e){let r=xxt(e);return({process:n,data:l,tags:i,anchor:d,signer:p})=>wi({id:n,data:l,tags:i,anchor:d,signer:p}).chain(r).map(v=>v.messageId).bimap(c6,l6).toPromise()}var U7=(e,r,n)=>l=>r(l[e])?o6(l):Mc(`Tag '${e}': ${n}`);function Ext({loadTransactionMeta:e,logger:r}){return e=Ji(oxt.implement(e)),n=>wi(n).chain(e).map(s6("tags")).map(YSt).chain(U7("Data-Protocol",QNe("ao"),"value 'ao' was not found on module")).chain(U7("Type",QNe("Module"),"value 'Module' was not found on module")).chain(U7("Module-Format",zX,"was not found on module")).chain(U7("Input-Encoding",zX,"was not found on module")).chain(U7("Output-Encoding",zX,"was not found on module")).bimap(r.tap("Verifying module source failed: %s"),r.tap("Verified module source"))}function Axt({logger:e,validateScheduler:r}){return r=Ji(axt.implement(r)),n=>wi(n).chain(l=>r(l).chain(i=>i?o6(l):Mc(`Valid Scheduler-Location owned by ${l} not found`))).bimap(e.tap("Verifying scheduler failed: %s"),e.tap("Verified scheduler"))}function Rxt({logger:e}){return r=>wi(r).map(e.tap("Checking for signer")).chain(n=>n?o6(n):Mc("signer not found"))}function Txt(e){let r=e.logger.child("verifyInput");e={...e,logger:r};let n=Ext(e),l=Axt(e),i=Rxt(e);return d=>wi(d).chain(p=>n(p.module).map(()=>p)).chain(p=>i(p.signer).map(()=>p)).bimap(r.tap("Error when verify input: %s"),r.tap("Successfully verified inputs"))}var Sfe=YHe("ao"),NT=O8(Sfe.removeAllByName),Ixt=O8(Sfe.concat),rCe=O8(Sfe.concatUnassoc),kxt=ar.array(ar.object({name:ar.string(),value:ar.string()}));function Bxt(){return e=>wi(e).map(s6("tags")).map(PN([])).map(NT("Variant")).map(NT("Type")).map(NT("Module")).map(NT("Scheduler")).map(Ixt([{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:e.module},{name:"Scheduler",value:e.scheduler}])).map(kxt.parse).map(Ch("tags",Ip,e))}function Pxt({logger:e}){return r=>wi(r).chain(MHe(gHe(r.data),()=>o6(r),()=>o6(" ").map(Ch("data",Ip,r)).map(n=>a2(s6("tags"),rCe([{name:"Content-Type",value:"text/plain"}]),Ch("tags",Ip,n))(n)).map(e.tap('added pseudo-random string as process "data"')))).map(n=>a2(s6("tags"),rCe([{name:"SDK",value:"aoconnect"}]),Ch("tags",Ip,n))(n))}function Oxt(e){let r=e.logger.child("uploadProcess");e={...e,logger:r};let n=Bxt(e),l=Pxt(e),i=ixt.implement(e.deployProcess);return d=>wi(d).chain(n).chain(l).chain(Ji(({data:p,tags:v,signer:_})=>i({data:p,tags:v,signer:ON.implement(_)}))).map(p=>Ch("processId",p.processId,d))}function GX(e){let r=Txt(e),n=Oxt(e);return({module:l,scheduler:i,signer:d,tags:p,data:v})=>wi({module:l,scheduler:i,signer:d,tags:p,data:v}).chain(r).chain(n).map(_=>_.processId).bimap(c6,l6).toPromise()}function Nxt(e){let r=KHe.implement(e.deployMonitor);return n=>wi(n).chain(Ji(({id:l,signer:i})=>r({processId:l,signer:ON.implement(i),data:" ",tags:[]}))).map(l=>Ch("monitorId",l.messageId,n))}function iCe(e){let r=Nxt(e);return({process:n,signer:l})=>wi({id:n,signer:l}).chain(r).map(i=>i.monitorId).bimap(c6,l6).toPromise()}function Cxt(e){let r=KHe.implement(e.deployUnmonitor);return n=>wi(n).chain(Ji(({id:l,signer:i})=>r({processId:l,signer:ON.implement(i),data:" ",tags:[]}))).map(l=>Ch("monitorId",l.messageId,n))}function nCe(e){let r=Cxt(e);return({process:n,signer:l})=>wi({id:n,signer:l}).chain(r).map(i=>i.monitorId).bimap(c6,l6).toPromise()}var Lxt=ar.object({process:ar.string().min(1,{message:"process identifier is required"}),from:ar.string().optional(),to:ar.string().optional(),sort:ar.enum(["ASC","DESC"]).default("ASC"),limit:ar.number().optional()});function Dxt(){return e=>wi(e).map(Lxt.parse).map(()=>e)}function $xt({queryResults:e}){return e=Ji(rxt.implement(e)),r=>wi({process:r.process,from:r.from,to:r.to,sort:r.sort,limit:r.limit}).chain(e)}function aCe(e){let r=Dxt(e),n=$xt(e);return({process:l,from:i,to:d,sort:p,limit:v})=>wi({process:l,from:i,to:d,sort:p,limit:v}).chain(r).chain(n).map(e.logger.tap('readResults result for message "%s": %O',l)).map(_=>_).bimap(c6,l6).toPromise()}var qxt=ar.object({Id:ar.string(),Target:ar.string(),Owner:ar.string(),Anchor:ar.string().optional(),Data:ar.any().default("1234"),Tags:ar.array(ar.object({name:ar.string(),value:ar.string()}))});function Uxt(){return e=>wi(e).map(qxt.parse).map(r=>(r.Tags=r.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),r))}function jxt({dryrunFetch:e}){return Ji(ext.implement(e))}function oCe(e){let r=Uxt(e),n=jxt(e);return l=>wi(l).map(Fxt).chain(r).chain(n).toPromise()}function Fxt({process:e,data:r,tags:n,anchor:l,...i}){return{Id:"1234",Owner:"1234",...i,Target:e,Data:r||"1234",Tags:n||[],Anchor:l||"0"}}function zxt(e){let r=nxt.implement(e.deployAssign);return n=>wi(n).chain(Ji(({process:l,message:i,baseLayer:d,exclude:p})=>r({process:l,message:i,baseLayer:d,exclude:p}))).map(l=>Ch("assignmentId",l.assignmentId,n))}function sCe(e){let r=zxt(e);return({process:n,message:l,baseLayer:i,exclude:d})=>wi({process:n,message:l,baseLayer:i,exclude:d}).chain(r).map(p=>p.assignmentId).bimap(c6,l6).toPromise()}var Hxt="https://arweave.net",Kxt="https://mu.ao-testnet.xyz",Zxt="https://cu.ao-testnet.xyz",Wxt="http://localhost:8734",Gxt="http://localhost:8734",Vxt="http://cu.s451-comm3-main.xyz",Yxt="http://mu.s451-comm3-main.xyz",qb=fetch;function Jxt({createDataItemSigner:e,createHbSigner:r}){let n=FHe();function l({MODE:v,wallet:_,GRAPHQL_URL:y,GRAPHQL_MAX_RETRIES:w,GRAPHQL_RETRY_BACKOFF:S,MU_URL:M=Yxt,CU_URL:x=Vxt,RELAY_URL:E=Wxt,fetch:T=qb}){let I=n.child("relay");I("Mode Activated \u{1F500}");let B=r(_),O=()=>e(_),N=GSt({fetch:qb,logger:I,HB_URL:E,signer:B}),{validate:H}=Aoe({cacheSize:100,GRAPHQL_URL:y,GRAPHQL_MAX_RETRIES:w,GRAPHQL_RETRY_BACKOFF:S}),K=I.child("result"),J=ZX({loadResult:jNe({fetch:N,CU_URL:x,logger:K}),logger:K}),L=I.child("message"),$=WX({deployMessage:CNe({fetch:N,MU_URL:M,logger:L}),logger:L}),V=I.child("spawn"),h=GX({loadTransactionMeta:KX({fetch:T,GRAPHQL_URL:y,logger:V}),validateScheduler:H,deployProcess:LNe({fetch:N,MU_URL:M,logger:V}),logger:V}),t=I.child("monitor"),a=iCe({deployMonitor:DNe({fetch:N,MU_URL:M,logger:t}),logger:t}),s=I.child("unmonitor"),u=nCe({deployUnmonitor:$Ne({fetch:N,MU_URL:M,logger:s}),logger:t}),c=I.child("results"),b=aCe({queryResults:FNe({fetch:N,CU_URL:x,logger:c}),logger:c}),m=I.child("dryrun"),f=oCe({dryrunFetch:UNe({fetch:N,CU_URL:x,logger:m}),logger:m}),o=I.child("assign"),g=sCe({deployAssign:qNe({fetch:N,MU_URL:M,logger:o}),logger:L});return{MODE:v,result:J,results:b,message:$,spawn:h,monitor:a,unmonitor:u,dryrun:f,assign:g,createDataItemSigner:O}}function i({MODE:v,GRAPHQL_URL:_,GRAPHQL_MAX_RETRIES:y,GRAPHQL_RETRY_BACKOFF:w,MU_URL:S=Kxt,CU_URL:M=Zxt,fetch:x=qb,noLog:E}){let T=n.child("legacy");E||T("Mode Activated \u2139\uFE0F");let{validate:I}=Aoe({cacheSize:100,GRAPHQL_URL:_,GRAPHQL_MAX_RETRIES:y,GRAPHQL_RETRY_BACKOFF:w}),B=T.child("result"),O=ZX({loadResult:jNe({fetch:x,CU_URL:M,logger:B}),logger:B}),N=T.child("message"),H=WX({deployMessage:CNe({fetch:x,MU_URL:S,logger:N}),logger:N}),K=T.child("spawn"),J=GX({loadTransactionMeta:KX({fetch:x,GRAPHQL_URL:_,logger:K}),validateScheduler:I,deployProcess:LNe({fetch:x,MU_URL:S,logger:K}),logger:K}),L=T.child("monitor"),$=iCe({deployMonitor:DNe({fetch:x,MU_URL:S,logger:L}),logger:L}),V=T.child("unmonitor"),h=nCe({deployUnmonitor:$Ne({fetch:x,MU_URL:S,logger:V}),logger:L}),t=T.child("results"),a=aCe({queryResults:FNe({fetch:x,CU_URL:M,logger:t}),logger:t}),s=T.child("dryrun"),u=oCe({dryrunFetch:UNe({fetch:x,CU_URL:M,logger:s}),logger:s}),c=T.child("assign"),b=sCe({deployAssign:qNe({fetch:x,MU_URL:S,logger:c}),logger:N});return{MODE:v,result:O,results:a,message:H,spawn:J,monitor:$,unmonitor:h,dryrun:u,assign:b,createDataItemSigner:e}}function d({MODE:v,wallet:_,GRAPHQL_URL:y,AO_URL:w=Gxt,fetch:S=qb}){let M=n.child("mainnet");if(M("Mode Activated \u{1F432}"),!_)throw new Error("mainnet mode requires providing a wallet to connect()");let x=r(_),E=()=>e(_);async function T(J){return M('Mock validation for address "%s"',J),!0}let I=M.child("result"),B=ZX({loadResult:WSt({fetch:qb,logger:I,HB_URL:w,signer:x}),logger:I}),O=M.child("message"),N=WX({deployMessage:ZSt({fetch:qb,logger:O,HB_URL:w,signer:x}),logger:O}),H=M.child("spawn"),K=GX({loadTransactionMeta:KX({fetch:S,GRAPHQL_URL:y,logger:H}),validateScheduler:T,deployProcess:KSt({fetch:qb,logger:H,HB_URL:w,signer:x}),logger:H});return{MODE:v,result:B,message:N,spawn:K,createDataItemSigner:E}}function p(v={}){let{GRAPHQL_URL:_,GATEWAY_URL:y=Hxt,...w}=v;_||(_=zHe({url:y,path:"/graphql"}));let S=v.MODE||"legacy";if(S==="legacy")return i({...w,GRAPHQL_URL:_});if(S==="relay")return l({...w,GRAPHQL_URL:_});if(S==="mainnet")return d({...w,GRAPHQL_URL:_});throw new Error(`Unrecognized MODE: ${S}`)}return p}var $oe={};hN($oe,{createDataItemSigner:()=>xEt,createHbSigner:()=>EEt});var xfe=uN(uCe(),1),JHe={};hN(JHe,{AVSCTap:()=>P_,ArweaveSigner:()=>Rfe,DataItem:()=>__,MAX_TAG_BYTES:()=>LN,MIN_BINARY_SIZE:()=>kfe,SIG_CONFIG:()=>x8,SignatureConfig:()=>ol,Signer:()=>tKe,createData:()=>aKe,default:()=>yEt,deserializeTags:()=>sN,indexToType:()=>Tfe,serializeTags:()=>Ife,tagsExceedLimit:()=>nKe,warparbundles:()=>wEt});var Xxt=Object.create,Efe=Object.defineProperty,Qxt=Object.getOwnPropertyDescriptor,eEt=Object.getOwnPropertyNames,tEt=Object.getPrototypeOf,rEt=Object.prototype.hasOwnProperty,Np=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),iEt=(e,r)=>{for(var n in r)Efe(e,n,{get:r[n],enumerable:!0})},nEt=(e,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of eEt(r))!rEt.call(e,i)&&i!==n&&Efe(e,i,{get:()=>r[i],enumerable:!(l=Qxt(r,i))||l.enumerable});return e},d6=(e,r,n)=>(n=e!=null?Xxt(tEt(e)):{},nEt(r||!e||!e.__esModule?Efe(n,"default",{value:e,enumerable:!0}):n,e)),aEt=Np(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});function r(n){var l=4,i=n.length,d=i%l;if(!d)return n;var p=i,v=l-d,_=i+v,y=ze.alloc(_);for(y.write(n);v--;)y.write("=",p++);return y.toString()}e.default=r}),oEt=Np(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=aEt();function n(_,y){return y===void 0&&(y="utf8"),ze.isBuffer(_)?d(_.toString("base64")):d(ze.from(_,y).toString("base64"))}function l(_,y){return y===void 0&&(y="utf8"),ze.from(i(_),"base64").toString(y)}function i(_){return _=_.toString(),r.default(_).replace(/\-/g,"+").replace(/_/g,"/")}function d(_){return _.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(_){return ze.from(i(_),"base64")}var v=n;v.encode=n,v.decode=l,v.toBase64=i,v.fromBase64=d,v.toBuffer=p,e.default=v}),Afe=Np((e,r)=>{r.exports=oEt().default,r.exports.default=r.exports}),XHe=Np(e=>{"use strict";e.byteLength=_,e.toByteArray=w,e.fromByteArray=x;var r=[],n=[],l=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(d=0,p=i.length;d<p;++d)r[d]=i[d],n[i.charCodeAt(d)]=d;var d,p;n[45]=62,n[95]=63;function v(E){var T=E.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=E.indexOf("=");I===-1&&(I=T);var B=I===T?0:4-I%4;return[I,B]}function _(E){var T=v(E),I=T[0],B=T[1];return(I+B)*3/4-B}function y(E,T,I){return(T+I)*3/4-I}function w(E){var T,I=v(E),B=I[0],O=I[1],N=new l(y(E,B,O)),H=0,K=O>0?B-4:B,J;for(J=0;J<K;J+=4)T=n[E.charCodeAt(J)]<<18|n[E.charCodeAt(J+1)]<<12|n[E.charCodeAt(J+2)]<<6|n[E.charCodeAt(J+3)],N[H++]=T>>16&255,N[H++]=T>>8&255,N[H++]=T&255;return O===2&&(T=n[E.charCodeAt(J)]<<2|n[E.charCodeAt(J+1)]>>4,N[H++]=T&255),O===1&&(T=n[E.charCodeAt(J)]<<10|n[E.charCodeAt(J+1)]<<4|n[E.charCodeAt(J+2)]>>2,N[H++]=T>>8&255,N[H++]=T&255),N}function S(E){return r[E>>18&63]+r[E>>12&63]+r[E>>6&63]+r[E&63]}function M(E,T,I){for(var B,O=[],N=T;N<I;N+=3)B=(E[N]<<16&16711680)+(E[N+1]<<8&65280)+(E[N+2]&255),O.push(S(B));return O.join("")}function x(E){for(var T,I=E.length,B=I%3,O=[],N=16383,H=0,K=I-B;H<K;H+=N)O.push(M(E,H,H+N>K?K:H+N));return B===1?(T=E[I-1],O.push(r[T>>2]+r[T<<4&63]+"==")):B===2&&(T=(E[I-2]<<8)+E[I-1],O.push(r[T>>10]+r[T>>4&63]+r[T<<2&63]+"=")),O.join("")}}),QHe=Np(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.b64UrlDecode=e.b64UrlEncode=e.bufferTob64Url=e.bufferTob64=e.b64UrlToBuffer=e.stringToB64Url=e.stringToBuffer=e.bufferToString=e.b64UrlToString=e.concatBuffers=void 0;var r=XHe();function n(M){let x=0;for(let I=0;I<M.length;I++)x+=M[I].byteLength;let E=new Uint8Array(x),T=0;E.set(new Uint8Array(M[0]),T),T+=M[0].byteLength;for(let I=1;I<M.length;I++)E.set(new Uint8Array(M[I]),T),T+=M[I].byteLength;return E}e.concatBuffers=n;function l(M){let x=v(M);return i(x)}e.b64UrlToString=l;function i(M){return new TextDecoder("utf-8",{fatal:!0}).decode(M)}e.bufferToString=i;function d(M){return new TextEncoder().encode(M)}e.stringToBuffer=d;function p(M){return y(d(M))}e.stringToB64Url=p;function v(M){return new Uint8Array(r.toByteArray(S(M)))}e.b64UrlToBuffer=v;function _(M){return r.fromByteArray(new Uint8Array(M))}e.bufferTob64=_;function y(M){return w(_(M))}e.bufferTob64Url=y;function w(M){return M.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}e.b64UrlEncode=w;function S(M){M=M.replace(/\-/g,"+").replace(/\_/g,"/");let x;return M.length%4==0?x=0:x=4-M.length%4,M.concat("=".repeat(x))}e.b64UrlDecode=S}),sEt=Np(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=QHe(),n=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let l=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),i=await this.driver.exportKey("jwk",l.privateKey);return{kty:i.kty,e:i.e,n:i.n,d:i.d,p:i.p,q:i.q,dp:i.dp,dq:i.dq,qi:i.qi}}async sign(l,i,{saltLength:d}={}){let p=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(l),i);return new Uint8Array(p)}async hash(l,i="SHA-256"){let d=await this.driver.digest(i,l);return new Uint8Array(d)}async verify(l,i,d){let p={kty:"RSA",e:"AQAB",n:l},v=await this.jwkToPublicCryptoKey(p),_=await this.driver.digest("SHA-256",i),y=await this.driver.verify({name:"RSA-PSS",saltLength:0},v,d,i),w=await this.driver.verify({name:"RSA-PSS",saltLength:32},v,d,i),S=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((v.algorithm.modulusLength-1)/8)-_.byteLength-2},v,d,i);return y||w||S}async jwkToCryptoKey(l){return this.driver.importKey("jwk",l,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(l){return this.driver.importKey("jwk",l,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let l=crypto?.subtle;return l===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof l[i]=="function")}async encrypt(l,i,d){let p=await this.driver.importKey("raw",typeof i=="string"?r.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:d?r.stringToBuffer(d):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},p,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),_=new Uint8Array(16);crypto.getRandomValues(_);let y=await this.driver.encrypt({name:"AES-CBC",iv:_},v,l);return r.concatBuffers([_,y])}async decrypt(l,i,d){let p=await this.driver.importKey("raw",typeof i=="string"?r.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:d?r.stringToBuffer(d):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},p,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),_=l.slice(0,16),y=await this.driver.decrypt({name:"AES-CBC",iv:_},v,l.slice(16));return r.concatBuffers([y])}};e.default=n}),fEt=Np(e=>{e.read=function(r,n,l,i,d){var p,v,_=d*8-i-1,y=(1<<_)-1,w=y>>1,S=-7,M=l?d-1:0,x=l?-1:1,E=r[n+M];for(M+=x,p=E&(1<<-S)-1,E>>=-S,S+=_;S>0;p=p*256+r[n+M],M+=x,S-=8);for(v=p&(1<<-S)-1,p>>=-S,S+=i;S>0;v=v*256+r[n+M],M+=x,S-=8);if(p===0)p=1-w;else{if(p===y)return v?NaN:(E?-1:1)*(1/0);v=v+Math.pow(2,i),p=p-w}return(E?-1:1)*v*Math.pow(2,p-i)},e.write=function(r,n,l,i,d,p){var v,_,y,w=p*8-d-1,S=(1<<w)-1,M=S>>1,x=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:p-1,T=i?1:-1,I=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(_=isNaN(n)?1:0,v=S):(v=Math.floor(Math.log(n)/Math.LN2),n*(y=Math.pow(2,-v))<1&&(v--,y*=2),v+M>=1?n+=x/y:n+=x*Math.pow(2,1-M),n*y>=2&&(v++,y/=2),v+M>=S?(_=0,v=S):v+M>=1?(_=(n*y-1)*Math.pow(2,d),v=v+M):(_=n*Math.pow(2,M-1)*Math.pow(2,d),v=0));d>=8;r[l+E]=_&255,E+=T,_/=256,d-=8);for(v=v<<d|_,w+=d;w>0;r[l+E]=v&255,E+=T,v/=256,w-=8);r[l+E-T]|=I*128}}),qoe=Np(e=>{"use strict";var r=XHe(),n=fEt(),l=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=v,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,v.TYPED_ARRAY_SUPPORT=d(),!v.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function d(){try{let P=new Uint8Array(1),C={foo:function(){return 42}};return Object.setPrototypeOf(C,Uint8Array.prototype),Object.setPrototypeOf(P,C),P.foo()===42}catch{return!1}}Object.defineProperty(v.prototype,"parent",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.buffer}}),Object.defineProperty(v.prototype,"offset",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.byteOffset}});function p(P){if(P>i)throw new RangeError('The value "'+P+'" is invalid for option "size"');let C=new Uint8Array(P);return Object.setPrototypeOf(C,v.prototype),C}function v(P,C,U){if(typeof P=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(P)}return _(P,C,U)}v.poolSize=8192;function _(P,C,U){if(typeof P=="string")return M(P,C);if(ArrayBuffer.isView(P))return E(P);if(P==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P);if(Be(P,ArrayBuffer)||P&&Be(P.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Be(P,SharedArrayBuffer)||P&&Be(P.buffer,SharedArrayBuffer)))return T(P,C,U);if(typeof P=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let ee=P.valueOf&&P.valueOf();if(ee!=null&&ee!==P)return v.from(ee,C,U);let Q=I(P);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof P[Symbol.toPrimitive]=="function")return v.from(P[Symbol.toPrimitive]("string"),C,U);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof P)}v.from=function(P,C,U){return _(P,C,U)},Object.setPrototypeOf(v.prototype,Uint8Array.prototype),Object.setPrototypeOf(v,Uint8Array);function y(P){if(typeof P!="number")throw new TypeError('"size" argument must be of type number');if(P<0)throw new RangeError('The value "'+P+'" is invalid for option "size"')}function w(P,C,U){return y(P),P<=0?p(P):C!==void 0?typeof U=="string"?p(P).fill(C,U):p(P).fill(C):p(P)}v.alloc=function(P,C,U){return w(P,C,U)};function S(P){return y(P),p(P<0?0:B(P)|0)}v.allocUnsafe=function(P){return S(P)},v.allocUnsafeSlow=function(P){return S(P)};function M(P,C){if((typeof C!="string"||C==="")&&(C="utf8"),!v.isEncoding(C))throw new TypeError("Unknown encoding: "+C);let U=N(P,C)|0,ee=p(U),Q=ee.write(P,C);return Q!==U&&(ee=ee.slice(0,Q)),ee}function x(P){let C=P.length<0?0:B(P.length)|0,U=p(C);for(let ee=0;ee<C;ee+=1)U[ee]=P[ee]&255;return U}function E(P){if(Be(P,Uint8Array)){let C=new Uint8Array(P);return T(C.buffer,C.byteOffset,C.byteLength)}return x(P)}function T(P,C,U){if(C<0||P.byteLength<C)throw new RangeError('"offset" is outside of buffer bounds');if(P.byteLength<C+(U||0))throw new RangeError('"length" is outside of buffer bounds');let ee;return C===void 0&&U===void 0?ee=new Uint8Array(P):U===void 0?ee=new Uint8Array(P,C):ee=new Uint8Array(P,C,U),Object.setPrototypeOf(ee,v.prototype),ee}function I(P){if(v.isBuffer(P)){let C=B(P.length)|0,U=p(C);return U.length===0||P.copy(U,0,0,C),U}if(P.length!==void 0)return typeof P.length!="number"||be(P.length)?p(0):x(P);if(P.type==="Buffer"&&Array.isArray(P.data))return x(P.data)}function B(P){if(P>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return P|0}function O(P){return+P!=P&&(P=0),v.alloc(+P)}v.isBuffer=function(P){return P!=null&&P._isBuffer===!0&&P!==v.prototype},v.compare=function(P,C){if(Be(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),Be(C,Uint8Array)&&(C=v.from(C,C.offset,C.byteLength)),!v.isBuffer(P)||!v.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(P===C)return 0;let U=P.length,ee=C.length;for(let Q=0,te=Math.min(U,ee);Q<te;++Q)if(P[Q]!==C[Q]){U=P[Q],ee=C[Q];break}return U<ee?-1:ee<U?1:0},v.isEncoding=function(P){switch(String(P).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}},v.concat=function(P,C){if(!Array.isArray(P))throw new TypeError('"list" argument must be an Array of Buffers');if(P.length===0)return v.alloc(0);let U;if(C===void 0)for(C=0,U=0;U<P.length;++U)C+=P[U].length;let ee=v.allocUnsafe(C),Q=0;for(U=0;U<P.length;++U){let te=P[U];if(Be(te,Uint8Array))Q+te.length>ee.length?(v.isBuffer(te)||(te=v.from(te)),te.copy(ee,Q)):Uint8Array.prototype.set.call(ee,te,Q);else if(v.isBuffer(te))te.copy(ee,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=te.length}return ee};function N(P,C){if(v.isBuffer(P))return P.length;if(ArrayBuffer.isView(P)||Be(P,ArrayBuffer))return P.byteLength;if(typeof P!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof P);let U=P.length,ee=arguments.length>2&&arguments[2]===!0;if(!ee&&U===0)return 0;let Q=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return U;case"utf8":case"utf-8":return re(P).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U*2;case"hex":return U>>>1;case"base64":return he(P).length;default:if(Q)return ee?-1:re(P).length;C=(""+C).toLowerCase(),Q=!0}}v.byteLength=N;function H(P,C,U){let ee=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((U===void 0||U>this.length)&&(U=this.length),U<=0)||(U>>>=0,C>>>=0,U<=C))return"";for(P||(P="utf8");;)switch(P){case"hex":return o(this,C,U);case"utf8":case"utf-8":return u(this,C,U);case"ascii":return m(this,C,U);case"latin1":case"binary":return f(this,C,U);case"base64":return s(this,C,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,C,U);default:if(ee)throw new TypeError("Unknown encoding: "+P);P=(P+"").toLowerCase(),ee=!0}}v.prototype._isBuffer=!0;function K(P,C,U){let ee=P[C];P[C]=P[U],P[U]=ee}v.prototype.swap16=function(){let P=this.length;if(P%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<P;C+=2)K(this,C,C+1);return this},v.prototype.swap32=function(){let P=this.length;if(P%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<P;C+=4)K(this,C,C+3),K(this,C+1,C+2);return this},v.prototype.swap64=function(){let P=this.length;if(P%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<P;C+=8)K(this,C,C+7),K(this,C+1,C+6),K(this,C+2,C+5),K(this,C+3,C+4);return this},v.prototype.toString=function(){let P=this.length;return P===0?"":arguments.length===0?u(this,0,P):H.apply(this,arguments)},v.prototype.toLocaleString=v.prototype.toString,v.prototype.equals=function(P){if(!v.isBuffer(P))throw new TypeError("Argument must be a Buffer");return this===P?!0:v.compare(this,P)===0},v.prototype.inspect=function(){let P="",C=e.INSPECT_MAX_BYTES;return P=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(P+=" ... "),"<Buffer "+P+">"},l&&(v.prototype[l]=v.prototype.inspect),v.prototype.compare=function(P,C,U,ee,Q){if(Be(P,Uint8Array)&&(P=v.from(P,P.offset,P.byteLength)),!v.isBuffer(P))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof P);if(C===void 0&&(C=0),U===void 0&&(U=P?P.length:0),ee===void 0&&(ee=0),Q===void 0&&(Q=this.length),C<0||U>P.length||ee<0||Q>this.length)throw new RangeError("out of range index");if(ee>=Q&&C>=U)return 0;if(ee>=Q)return-1;if(C>=U)return 1;if(C>>>=0,U>>>=0,ee>>>=0,Q>>>=0,this===P)return 0;let te=Q-ee,le=U-C,Ie=Math.min(te,le),se=this.slice(ee,Q),Ee=P.slice(C,U);for(let me=0;me<Ie;++me)if(se[me]!==Ee[me]){te=se[me],le=Ee[me];break}return te<le?-1:le<te?1:0};function J(P,C,U,ee,Q){if(P.length===0)return-1;if(typeof U=="string"?(ee=U,U=0):U>2147483647?U=2147483647:U<-2147483648&&(U=-2147483648),U=+U,be(U)&&(U=Q?0:P.length-1),U<0&&(U=P.length+U),U>=P.length){if(Q)return-1;U=P.length-1}else if(U<0)if(Q)U=0;else return-1;if(typeof C=="string"&&(C=v.from(C,ee)),v.isBuffer(C))return C.length===0?-1:L(P,C,U,ee,Q);if(typeof C=="number")return C=C&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(P,C,U):Uint8Array.prototype.lastIndexOf.call(P,C,U):L(P,[C],U,ee,Q);throw new TypeError("val must be string, number or Buffer")}function L(P,C,U,ee,Q){let te=1,le=P.length,Ie=C.length;if(ee!==void 0&&(ee=String(ee).toLowerCase(),ee==="ucs2"||ee==="ucs-2"||ee==="utf16le"||ee==="utf-16le")){if(P.length<2||C.length<2)return-1;te=2,le/=2,Ie/=2,U/=2}function se(me,pe){return te===1?me[pe]:me.readUInt16BE(pe*te)}let Ee;if(Q){let me=-1;for(Ee=U;Ee<le;Ee++)if(se(P,Ee)===se(C,me===-1?0:Ee-me)){if(me===-1&&(me=Ee),Ee-me+1===Ie)return me*te}else me!==-1&&(Ee-=Ee-me),me=-1}else for(U+Ie>le&&(U=le-Ie),Ee=U;Ee>=0;Ee--){let me=!0;for(let pe=0;pe<Ie;pe++)if(se(P,Ee+pe)!==se(C,pe)){me=!1;break}if(me)return Ee}return-1}v.prototype.includes=function(P,C,U){return this.indexOf(P,C,U)!==-1},v.prototype.indexOf=function(P,C,U){return J(this,P,C,U,!0)},v.prototype.lastIndexOf=function(P,C,U){return J(this,P,C,U,!1)};function $(P,C,U,ee){U=Number(U)||0;let Q=P.length-U;ee?(ee=Number(ee),ee>Q&&(ee=Q)):ee=Q;let te=C.length;ee>te/2&&(ee=te/2);let le;for(le=0;le<ee;++le){let Ie=parseInt(C.substr(le*2,2),16);if(be(Ie))return le;P[U+le]=Ie}return le}function V(P,C,U,ee){return Re(re(C,P.length-U),P,U,ee)}function h(P,C,U,ee){return Re(fe(C),P,U,ee)}function t(P,C,U,ee){return Re(he(C),P,U,ee)}function a(P,C,U,ee){return Re(ye(C,P.length-U),P,U,ee)}v.prototype.write=function(P,C,U,ee){if(C===void 0)ee="utf8",U=this.length,C=0;else if(U===void 0&&typeof C=="string")ee=C,U=this.length,C=0;else if(isFinite(C))C=C>>>0,isFinite(U)?(U=U>>>0,ee===void 0&&(ee="utf8")):(ee=U,U=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-C;if((U===void 0||U>Q)&&(U=Q),P.length>0&&(U<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");ee||(ee="utf8");let te=!1;for(;;)switch(ee){case"hex":return $(this,P,C,U);case"utf8":case"utf-8":return V(this,P,C,U);case"ascii":case"latin1":case"binary":return h(this,P,C,U);case"base64":return t(this,P,C,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,P,C,U);default:if(te)throw new TypeError("Unknown encoding: "+ee);ee=(""+ee).toLowerCase(),te=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s(P,C,U){return C===0&&U===P.length?r.fromByteArray(P):r.fromByteArray(P.slice(C,U))}function u(P,C,U){U=Math.min(P.length,U);let ee=[],Q=C;for(;Q<U;){let te=P[Q],le=null,Ie=te>239?4:te>223?3:te>191?2:1;if(Q+Ie<=U){let se,Ee,me,pe;switch(Ie){case 1:te<128&&(le=te);break;case 2:se=P[Q+1],(se&192)===128&&(pe=(te&31)<<6|se&63,pe>127&&(le=pe));break;case 3:se=P[Q+1],Ee=P[Q+2],(se&192)===128&&(Ee&192)===128&&(pe=(te&15)<<12|(se&63)<<6|Ee&63,pe>2047&&(pe<55296||pe>57343)&&(le=pe));break;case 4:se=P[Q+1],Ee=P[Q+2],me=P[Q+3],(se&192)===128&&(Ee&192)===128&&(me&192)===128&&(pe=(te&15)<<18|(se&63)<<12|(Ee&63)<<6|me&63,pe>65535&&pe<1114112&&(le=pe))}}le===null?(le=65533,Ie=1):le>65535&&(le-=65536,ee.push(le>>>10&1023|55296),le=56320|le&1023),ee.push(le),Q+=Ie}return b(ee)}var c=4096;function b(P){let C=P.length;if(C<=c)return String.fromCharCode.apply(String,P);let U="",ee=0;for(;ee<C;)U+=String.fromCharCode.apply(String,P.slice(ee,ee+=c));return U}function m(P,C,U){let ee="";U=Math.min(P.length,U);for(let Q=C;Q<U;++Q)ee+=String.fromCharCode(P[Q]&127);return ee}function f(P,C,U){let ee="";U=Math.min(P.length,U);for(let Q=C;Q<U;++Q)ee+=String.fromCharCode(P[Q]);return ee}function o(P,C,U){let ee=P.length;(!C||C<0)&&(C=0),(!U||U<0||U>ee)&&(U=ee);let Q="";for(let te=C;te<U;++te)Q+=Ne[P[te]];return Q}function g(P,C,U){let ee=P.slice(C,U),Q="";for(let te=0;te<ee.length-1;te+=2)Q+=String.fromCharCode(ee[te]+ee[te+1]*256);return Q}v.prototype.slice=function(P,C){let U=this.length;P=~~P,C=C===void 0?U:~~C,P<0?(P+=U,P<0&&(P=0)):P>U&&(P=U),C<0?(C+=U,C<0&&(C=0)):C>U&&(C=U),C<P&&(C=P);let ee=this.subarray(P,C);return Object.setPrototypeOf(ee,v.prototype),ee};function A(P,C,U){if(P%1!==0||P<0)throw new RangeError("offset is not uint");if(P+C>U)throw new RangeError("Trying to access beyond buffer length")}v.prototype.readUintLE=v.prototype.readUIntLE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P],Q=1,te=0;for(;++te<C&&(Q*=256);)ee+=this[P+te]*Q;return ee},v.prototype.readUintBE=v.prototype.readUIntBE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P+--C],Q=1;for(;C>0&&(Q*=256);)ee+=this[P+--C]*Q;return ee},v.prototype.readUint8=v.prototype.readUInt8=function(P,C){return P=P>>>0,C||A(P,1,this.length),this[P]},v.prototype.readUint16LE=v.prototype.readUInt16LE=function(P,C){return P=P>>>0,C||A(P,2,this.length),this[P]|this[P+1]<<8},v.prototype.readUint16BE=v.prototype.readUInt16BE=function(P,C){return P=P>>>0,C||A(P,2,this.length),this[P]<<8|this[P+1]},v.prototype.readUint32LE=v.prototype.readUInt32LE=function(P,C){return P=P>>>0,C||A(P,4,this.length),(this[P]|this[P+1]<<8|this[P+2]<<16)+this[P+3]*16777216},v.prototype.readUint32BE=v.prototype.readUInt32BE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]*16777216+(this[P+1]<<16|this[P+2]<<8|this[P+3])},v.prototype.readBigUInt64LE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=C+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24,Q=this[++P]+this[++P]*2**8+this[++P]*2**16+U*2**24;return BigInt(ee)+(BigInt(Q)<<BigInt(32))}),v.prototype.readBigUInt64BE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=C*2**24+this[++P]*2**16+this[++P]*2**8+this[++P],Q=this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+U;return(BigInt(ee)<<BigInt(32))+BigInt(Q)}),v.prototype.readIntLE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=this[P],Q=1,te=0;for(;++te<C&&(Q*=256);)ee+=this[P+te]*Q;return Q*=128,ee>=Q&&(ee-=Math.pow(2,8*C)),ee},v.prototype.readIntBE=function(P,C,U){P=P>>>0,C=C>>>0,U||A(P,C,this.length);let ee=C,Q=1,te=this[P+--ee];for(;ee>0&&(Q*=256);)te+=this[P+--ee]*Q;return Q*=128,te>=Q&&(te-=Math.pow(2,8*C)),te},v.prototype.readInt8=function(P,C){return P=P>>>0,C||A(P,1,this.length),this[P]&128?(255-this[P]+1)*-1:this[P]},v.prototype.readInt16LE=function(P,C){P=P>>>0,C||A(P,2,this.length);let U=this[P]|this[P+1]<<8;return U&32768?U|4294901760:U},v.prototype.readInt16BE=function(P,C){P=P>>>0,C||A(P,2,this.length);let U=this[P+1]|this[P]<<8;return U&32768?U|4294901760:U},v.prototype.readInt32LE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]|this[P+1]<<8|this[P+2]<<16|this[P+3]<<24},v.prototype.readInt32BE=function(P,C){return P=P>>>0,C||A(P,4,this.length),this[P]<<24|this[P+1]<<16|this[P+2]<<8|this[P+3]},v.prototype.readBigInt64LE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=this[P+4]+this[P+5]*2**8+this[P+6]*2**16+(U<<24);return(BigInt(ee)<<BigInt(32))+BigInt(C+this[++P]*2**8+this[++P]*2**16+this[++P]*2**24)}),v.prototype.readBigInt64BE=qe(function(P){P=P>>>0,F(P,"offset");let C=this[P],U=this[P+7];(C===void 0||U===void 0)&&Y(P,this.length-8);let ee=(C<<24)+this[++P]*2**16+this[++P]*2**8+this[++P];return(BigInt(ee)<<BigInt(32))+BigInt(this[++P]*2**24+this[++P]*2**16+this[++P]*2**8+U)}),v.prototype.readFloatLE=function(P,C){return P=P>>>0,C||A(P,4,this.length),n.read(this,P,!0,23,4)},v.prototype.readFloatBE=function(P,C){return P=P>>>0,C||A(P,4,this.length),n.read(this,P,!1,23,4)},v.prototype.readDoubleLE=function(P,C){return P=P>>>0,C||A(P,8,this.length),n.read(this,P,!0,52,8)},v.prototype.readDoubleBE=function(P,C){return P=P>>>0,C||A(P,8,this.length),n.read(this,P,!1,52,8)};function R(P,C,U,ee,Q,te){if(!v.isBuffer(P))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>Q||C<te)throw new RangeError('"value" argument is out of bounds');if(U+ee>P.length)throw new RangeError("Index out of range")}v.prototype.writeUintLE=v.prototype.writeUIntLE=function(P,C,U,ee){if(P=+P,C=C>>>0,U=U>>>0,!ee){let le=Math.pow(2,8*U)-1;R(this,P,C,U,le,0)}let Q=1,te=0;for(this[C]=P&255;++te<U&&(Q*=256);)this[C+te]=P/Q&255;return C+U},v.prototype.writeUintBE=v.prototype.writeUIntBE=function(P,C,U,ee){if(P=+P,C=C>>>0,U=U>>>0,!ee){let le=Math.pow(2,8*U)-1;R(this,P,C,U,le,0)}let Q=U-1,te=1;for(this[C+Q]=P&255;--Q>=0&&(te*=256);)this[C+Q]=P/te&255;return C+U},v.prototype.writeUint8=v.prototype.writeUInt8=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,1,255,0),this[C]=P&255,C+1},v.prototype.writeUint16LE=v.prototype.writeUInt16LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,65535,0),this[C]=P&255,this[C+1]=P>>>8,C+2},v.prototype.writeUint16BE=v.prototype.writeUInt16BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,65535,0),this[C]=P>>>8,this[C+1]=P&255,C+2},v.prototype.writeUint32LE=v.prototype.writeUInt32LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,4294967295,0),this[C+3]=P>>>24,this[C+2]=P>>>16,this[C+1]=P>>>8,this[C]=P&255,C+4},v.prototype.writeUint32BE=v.prototype.writeUInt32BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,4294967295,0),this[C]=P>>>24,this[C+1]=P>>>16,this[C+2]=P>>>8,this[C+3]=P&255,C+4};function k(P,C,U,ee,Q){z(C,ee,Q,P,U,7);let te=Number(C&BigInt(4294967295));P[U++]=te,te=te>>8,P[U++]=te,te=te>>8,P[U++]=te,te=te>>8,P[U++]=te;let le=Number(C>>BigInt(32)&BigInt(4294967295));return P[U++]=le,le=le>>8,P[U++]=le,le=le>>8,P[U++]=le,le=le>>8,P[U++]=le,U}function q(P,C,U,ee,Q){z(C,ee,Q,P,U,7);let te=Number(C&BigInt(4294967295));P[U+7]=te,te=te>>8,P[U+6]=te,te=te>>8,P[U+5]=te,te=te>>8,P[U+4]=te;let le=Number(C>>BigInt(32)&BigInt(4294967295));return P[U+3]=le,le=le>>8,P[U+2]=le,le=le>>8,P[U+1]=le,le=le>>8,P[U]=le,U+8}v.prototype.writeBigUInt64LE=qe(function(P,C=0){return k(this,P,C,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeBigUInt64BE=qe(function(P,C=0){return q(this,P,C,BigInt(0),BigInt("0xffffffffffffffff"))}),v.prototype.writeIntLE=function(P,C,U,ee){if(P=+P,C=C>>>0,!ee){let Ie=Math.pow(2,8*U-1);R(this,P,C,U,Ie-1,-Ie)}let Q=0,te=1,le=0;for(this[C]=P&255;++Q<U&&(te*=256);)P<0&&le===0&&this[C+Q-1]!==0&&(le=1),this[C+Q]=(P/te>>0)-le&255;return C+U},v.prototype.writeIntBE=function(P,C,U,ee){if(P=+P,C=C>>>0,!ee){let Ie=Math.pow(2,8*U-1);R(this,P,C,U,Ie-1,-Ie)}let Q=U-1,te=1,le=0;for(this[C+Q]=P&255;--Q>=0&&(te*=256);)P<0&&le===0&&this[C+Q+1]!==0&&(le=1),this[C+Q]=(P/te>>0)-le&255;return C+U},v.prototype.writeInt8=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,1,127,-128),P<0&&(P=255+P+1),this[C]=P&255,C+1},v.prototype.writeInt16LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,32767,-32768),this[C]=P&255,this[C+1]=P>>>8,C+2},v.prototype.writeInt16BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,2,32767,-32768),this[C]=P>>>8,this[C+1]=P&255,C+2},v.prototype.writeInt32LE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,2147483647,-2147483648),this[C]=P&255,this[C+1]=P>>>8,this[C+2]=P>>>16,this[C+3]=P>>>24,C+4},v.prototype.writeInt32BE=function(P,C,U){return P=+P,C=C>>>0,U||R(this,P,C,4,2147483647,-2147483648),P<0&&(P=4294967295+P+1),this[C]=P>>>24,this[C+1]=P>>>16,this[C+2]=P>>>8,this[C+3]=P&255,C+4},v.prototype.writeBigInt64LE=qe(function(P,C=0){return k(this,P,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),v.prototype.writeBigInt64BE=qe(function(P,C=0){return q(this,P,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Z(P,C,U,ee,Q,te){if(U+ee>P.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("Index out of range")}function ne(P,C,U,ee,Q){return C=+C,U=U>>>0,Q||Z(P,C,U,4,34028234663852886e22,-34028234663852886e22),n.write(P,C,U,ee,23,4),U+4}v.prototype.writeFloatLE=function(P,C,U){return ne(this,P,C,!0,U)},v.prototype.writeFloatBE=function(P,C,U){return ne(this,P,C,!1,U)};function G(P,C,U,ee,Q){return C=+C,U=U>>>0,Q||Z(P,C,U,8,17976931348623157e292,-17976931348623157e292),n.write(P,C,U,ee,52,8),U+8}v.prototype.writeDoubleLE=function(P,C,U){return G(this,P,C,!0,U)},v.prototype.writeDoubleBE=function(P,C,U){return G(this,P,C,!1,U)},v.prototype.copy=function(P,C,U,ee){if(!v.isBuffer(P))throw new TypeError("argument should be a Buffer");if(U||(U=0),!ee&&ee!==0&&(ee=this.length),C>=P.length&&(C=P.length),C||(C=0),ee>0&&ee<U&&(ee=U),ee===U||P.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(U<0||U>=this.length)throw new RangeError("Index out of range");if(ee<0)throw new RangeError("sourceEnd out of bounds");ee>this.length&&(ee=this.length),P.length-C<ee-U&&(ee=P.length-C+U);let Q=ee-U;return this===P&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(C,U,ee):Uint8Array.prototype.set.call(P,this.subarray(U,ee),C),Q},v.prototype.fill=function(P,C,U,ee){if(typeof P=="string"){if(typeof C=="string"?(ee=C,C=0,U=this.length):typeof U=="string"&&(ee=U,U=this.length),ee!==void 0&&typeof ee!="string")throw new TypeError("encoding must be a string");if(typeof ee=="string"&&!v.isEncoding(ee))throw new TypeError("Unknown encoding: "+ee);if(P.length===1){let te=P.charCodeAt(0);(ee==="utf8"&&te<128||ee==="latin1")&&(P=te)}}else typeof P=="number"?P=P&255:typeof P=="boolean"&&(P=Number(P));if(C<0||this.length<C||this.length<U)throw new RangeError("Out of range index");if(U<=C)return this;C=C>>>0,U=U===void 0?this.length:U>>>0,P||(P=0);let Q;if(typeof P=="number")for(Q=C;Q<U;++Q)this[Q]=P;else{let te=v.isBuffer(P)?P:v.from(P,ee),le=te.length;if(le===0)throw new TypeError('The value "'+P+'" is invalid for argument "value"');for(Q=0;Q<U-C;++Q)this[Q+C]=te[Q%le]}return this};var D={};function W(P,C,U){D[P]=class extends U{constructor(){super(),Object.defineProperty(this,"message",{value:C.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${P}]`,this.stack,delete this.name}get code(){return P}set code(ee){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ee,writable:!0})}toString(){return`${this.name} [${P}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function(P){return P?`${P} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(P,C){return`The "${P}" argument must be of type number. Received type ${typeof C}`},TypeError),W("ERR_OUT_OF_RANGE",function(P,C,U){let ee=`The value of "${P}" is out of range.`,Q=U;return Number.isInteger(U)&&Math.abs(U)>2**32?Q=ie(String(U)):typeof U=="bigint"&&(Q=String(U),(U>BigInt(2)**BigInt(32)||U<-(BigInt(2)**BigInt(32)))&&(Q=ie(Q)),Q+="n"),ee+=` It must be ${C}. Received ${Q}`,ee},RangeError);function ie(P){let C="",U=P.length,ee=P[0]==="-"?1:0;for(;U>=ee+4;U-=3)C=`_${P.slice(U-3,U)}${C}`;return`${P.slice(0,U)}${C}`}function X(P,C,U){F(C,"offset"),(P[C]===void 0||P[C+U]===void 0)&&Y(C,P.length-(U+1))}function z(P,C,U,ee,Q,te){if(P>U||P<C){let le=typeof C=="bigint"?"n":"",Ie;throw te>3?C===0||C===BigInt(0)?Ie=`>= 0${le} and < 2${le} ** ${(te+1)*8}${le}`:Ie=`>= -(2${le} ** ${(te+1)*8-1}${le}) and < 2 ** ${(te+1)*8-1}${le}`:Ie=`>= ${C}${le} and <= ${U}${le}`,new D.ERR_OUT_OF_RANGE("value",Ie,P)}X(ee,Q,te)}function F(P,C){if(typeof P!="number")throw new D.ERR_INVALID_ARG_TYPE(C,"number",P)}function Y(P,C,U){throw Math.floor(P)!==P?(F(P,U),new D.ERR_OUT_OF_RANGE(U||"offset","an integer",P)):C<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE(U||"offset",`>= ${U?1:0} and <= ${C}`,P)}var ae=/[^+/0-9A-Za-z-_]/g;function de(P){if(P=P.split("=")[0],P=P.trim().replace(ae,""),P.length<2)return"";for(;P.length%4!==0;)P=P+"=";return P}function re(P,C){C=C||1/0;let U,ee=P.length,Q=null,te=[];for(let le=0;le<ee;++le){if(U=P.charCodeAt(le),U>55295&&U<57344){if(!Q){if(U>56319){(C-=3)>-1&&te.push(239,191,189);continue}else if(le+1===ee){(C-=3)>-1&&te.push(239,191,189);continue}Q=U;continue}if(U<56320){(C-=3)>-1&&te.push(239,191,189),Q=U;continue}U=(Q-55296<<10|U-56320)+65536}else Q&&(C-=3)>-1&&te.push(239,191,189);if(Q=null,U<128){if((C-=1)<0)break;te.push(U)}else if(U<2048){if((C-=2)<0)break;te.push(U>>6|192,U&63|128)}else if(U<65536){if((C-=3)<0)break;te.push(U>>12|224,U>>6&63|128,U&63|128)}else if(U<1114112){if((C-=4)<0)break;te.push(U>>18|240,U>>12&63|128,U>>6&63|128,U&63|128)}else throw new Error("Invalid code point")}return te}function fe(P){let C=[];for(let U=0;U<P.length;++U)C.push(P.charCodeAt(U)&255);return C}function ye(P,C){let U,ee,Q,te=[];for(let le=0;le<P.length&&!((C-=2)<0);++le)U=P.charCodeAt(le),ee=U>>8,Q=U%256,te.push(Q),te.push(ee);return te}function he(P){return r.toByteArray(de(P))}function Re(P,C,U,ee){let Q;for(Q=0;Q<ee&&!(Q+U>=C.length||Q>=P.length);++Q)C[Q+U]=P[Q];return Q}function Be(P,C){return P instanceof C||P!=null&&P.constructor!=null&&P.constructor.name!=null&&P.constructor.name===C.name}function be(P){return P!==P}var Ne=function(){let P="0123456789abcdef",C=new Array(256);for(let U=0;U<16;++U){let ee=U*16;for(let Q=0;Q<16;++Q)C[ee+Q]=P[U]+P[Q]}return C}();function qe(P){return typeof BigInt>"u"?j:P}function j(){throw new Error("BigInt not supported")}}),hEt=Np((e,r)=>{typeof window<"u"?(window.global=window,globalThis.fetch=window.fetch,r.exports={Buffer:qoe().Buffer,Crypto:window.crypto}):r.exports={Buffer:qoe().Buffer,Crypto:crypto}}),eKe={};iEt(eKe,{AVSCTap:()=>P_,ArweaveSigner:()=>Rfe,DataItem:()=>__,MAX_TAG_BYTES:()=>LN,MIN_BINARY_SIZE:()=>kfe,SIG_CONFIG:()=>x8,SignatureConfig:()=>ol,Signer:()=>tKe,createData:()=>aKe,deserializeTags:()=>sN,indexToType:()=>Tfe,serializeTags:()=>Ife,tagsExceedLimit:()=>nKe});var tKe=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(e,r,n,l){throw new Error("You must implement verify method on child")}},uEt=d6(Afe(),1),mc=d6(QHe(),1);async function rKe(e){if(Array.isArray(e)){let i=(0,mc.concatBuffers)([(0,mc.stringToBuffer)("list"),(0,mc.stringToBuffer)(e.length.toString())]);return await iKe(e,await Tp().hash(i,"SHA-384"))}let r=e,n=(0,mc.concatBuffers)([(0,mc.stringToBuffer)("blob"),(0,mc.stringToBuffer)(r.byteLength.toString())]),l=(0,mc.concatBuffers)([await Tp().hash(n,"SHA-384"),await Tp().hash(r,"SHA-384")]);return await Tp().hash(l,"SHA-384")}async function iKe(e,r){if(e.length<1)return r;let n=(0,mc.concatBuffers)([r,await rKe(e[0])]),l=await Tp().hash(n,"SHA-384");return await iKe(e.slice(1),l)}var VX=d6(sEt(),1),lEt=VX.default.default?VX.default.default:VX.default,cEt=class extends lEt{getPublicKey(e){throw new Error("Unimplemented")}},dEt;function Tp(){return dEt??=new cEt}var ol;(function(e){e[e.ARWEAVE=1]="ARWEAVE",e[e.ED25519=2]="ED25519",e[e.ETHEREUM=3]="ETHEREUM",e[e.SOLANA=4]="SOLANA",e[e.INJECTEDAPTOS=5]="INJECTEDAPTOS",e[e.MULTIAPTOS=6]="MULTIAPTOS",e[e.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(ol||(ol={}));var x8={[ol.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[ol.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[ol.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[ol.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[ol.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[ol.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[ol.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},Rfe=class{signatureType=1;ownerLength=x8[1].pubLength;signatureLength=x8[1].sigLength;jwk;pk;constructor(e){this.pk=e.n,this.jwk=e}get publicKey(){return uEt.default.toBuffer(this.pk)}sign(e){return Tp().sign(this.jwk,e)}static async verify(e,r,n){return await Tp().verify(e,r,n)}},Tfe={1:Rfe},Nd=d6(Afe(),1);async function Uoe(e){return rKe([(0,mc.stringToBuffer)("dataitem"),(0,mc.stringToBuffer)("1"),(0,mc.stringToBuffer)(e.signatureType.toString()),e.rawOwner,e.rawTarget,e.rawAnchor,e.rawTags,e.rawData])}async function pEt(e,r){let n=await Uoe(e),l=await r.sign(n),i=await Tp().hash(l);return{signature:ze.from(l),id:ze.from(i)}}async function mEt(e,r){let{signature:n,id:l}=await pEt(e,r);return e.getRaw().set(n,2),l}var P_=class{buf;pos;constructor(e=ze.alloc(LN),r=0){this.buf=e,this.pos=r}writeTags(e){if(!Array.isArray(e))throw new Error("input must be array");let r=e.length,n;if(r)for(this.writeLong(r),n=0;n<r;n++){let l=e[n];if(l?.name===void 0||l?.value===void 0)throw new Error(`Invalid tag format for ${l}, expected {name:string, value: string}`);this.writeString(l.name),this.writeString(l.value)}this.writeLong(0)}toBuffer(){let e=ze.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(e,0,0,this.pos),e}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(e){let r=this.buf,n,l;if(e>=-1073741824&&e<1073741824){l=e>=0?e<<1:~e<<1|1;do r[this.pos]=l&127,l>>=7;while(l&&(r[this.pos++]|=128))}else{n=e>=0?e*2:-e*2-1;do r[this.pos]=n&127,n/=128;while(n>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(e){let r=ze.byteLength(e),n=this.buf;this.writeLong(r);let l=this.pos;if(this.pos+=r,!(this.pos>n.length)){if(r>64)this.buf.write(e,this.pos-r,r,"utf8");else{let i,d,p,v;for(i=0,d=r;i<d;i++)p=e.charCodeAt(i),p<128?n[l++]=p:p<2048?(n[l++]=p>>6|192,n[l++]=p&63|128):(p&64512)===55296&&((v=e.charCodeAt(i+1))&64512)===56320?(p=65536+((p&1023)<<10)+(v&1023),i++,n[l++]=p>>18|240,n[l++]=p>>12&63|128,n[l++]=p>>6&63|128,n[l++]=p&63|128):(n[l++]=p>>12|224,n[l++]=p>>6&63|128,n[l++]=p&63|128)}this.buf=n}}readLong(){let e=0,r=0,n=this.buf,l,i,d,p;do l=n[this.pos++],i=l&128,e|=(l&127)<<r,r+=7;while(i&&r<28);if(i){d=e,p=268435456;do l=n[this.pos++],d+=(l&127)*p,p*=128;while(l&128);return(d%2?-(d+1):d)/2}return e>>1^-(e&1)}skipLong(){let e=this.buf;for(;e[this.pos++]&128;);}readTags(){let e=[],r;for(;r=this.readLong();)for(r<0&&(r=-r,this.skipLong());r--;){let n=this.readString(),l=this.readString();e.push({name:n,value:l})}return e}readString(){let e=this.readLong(),r=this.pos,n=this.buf;if(this.pos+=e,!(this.pos>n.length))return this.buf.slice(r,r+e).toString()}};function Ife(e){let r=new P_;return r.writeTags(e),r.toBuffer()}function nKe(e){let r=new P_;return r.writeTags(e),r.tagsExceedLimit()}function sN(e){return new P_(e).readTags()}function Bv(e){let r=0;for(let n=e.length-1;n>=0;n--)r=r*256+e[n];return r}function vEt(e){if(e>29)throw new Error("Short too long");let r=[0,0];for(let n=0;n<r.length;n++){let l=e&255;r[n]=l,e=(e-l)/256}return Uint8Array.from(r)}function fCe(e){let r=[0,0,0,0,0,0,0,0];for(let n=0;n<r.length;n++){let l=e&255;r[n]=l,e=(e-l)/256}return Uint8Array.from(r)}var gEt=d6(hEt(),1),G3=d6(qoe(),1),LN=4096,kfe=80,__=class{binary;_id;constructor(e){this.binary=e}static isDataItem(e){return e.binary!==void 0}get signatureType(){let e=Bv(this.binary.subarray(0,2));if(ol?.[e]!==void 0)return e;throw new Error("Unknown signature type: "+e)}async isValid(){return __.verify(this.binary)}get id(){return(async()=>Nd.default.encode(await this.rawId))()}set id(e){this._id=Nd.default.toBuffer(e)}get rawId(){return(async()=>G3.Buffer.from(await gEt.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(e){this._id=e}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Nd.default.encode(this.rawSignature)}set rawOwner(e){if(e.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${e.byteLength} bytes.`);this.binary.set(e,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return x8[this.signatureType].sigLength}get owner(){return Nd.default.encode(this.rawOwner)}get ownerLength(){return x8[this.signatureType].pubLength}get rawTarget(){let e=this.getTargetStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):G3.Buffer.alloc(0)}get target(){return Nd.default.encode(this.rawTarget)}get rawAnchor(){let e=this.getAnchorStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):G3.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let e=this.getTagsStart(),r=Bv(this.binary.subarray(e+8,e+16));return this.binary.subarray(e+16,e+16+r)}get tags(){let e=this.getTagsStart();if(Bv(this.binary.subarray(e,e+8))==0)return[];let r=Bv(this.binary.subarray(e+8,e+16));return sN(G3.Buffer.from(this.binary.subarray(e+16,e+16+r)))}get tagsB64Url(){return this.tags.map(e=>({name:Nd.default.encode(e.name),value:Nd.default.encode(e.value)}))}getStartOfData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),n=Bv(r);return e+16+n}get rawData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),n=Bv(r),l=e+16+n;return this.binary.subarray(l,this.binary.length)}get data(){return Nd.default.encode(this.rawData)}getRaw(){return this.binary}async sign(e){return this._id=await mEt(this,e),this.rawId}async setSignature(e){this.binary.set(e,2),this._id=G3.Buffer.from(await Tp().hash(e))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(e=>({name:Nd.default.encode(e.name),value:Nd.default.encode(e.value)})),data:this.data}}static async verify(e){if(e.byteLength<kfe)return!1;let r=new __(e),n=r.signatureType,l=r.getTagsStart(),i=Bv(e.subarray(l,l+8)),d=e.subarray(l+8,l+16),p=Bv(d);if(p>LN)return!1;if(i>0)try{if(sN(G3.Buffer.from(e.subarray(l+16,l+16+p))).length!==i)return!1}catch{return!1}let v=Tfe[n],_=await Uoe(r);return await v.verify(r.rawOwner,_,r.rawSignature)}async getSignatureData(){return Uoe(this)}getTagsStart(){let e=this.getTargetStart(),r=this.binary[e]==1,n=e+(r?33:1),l=this.binary[n]==1;return n+=l?33:1,n}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let e=this.getTargetStart()+1,r=this.binary[this.getTargetStart()]==1;return e+=r?32:0,e}},bEt=d6(Afe(),1);function aKe(e,r,n){let l=r.publicKey,i=n?.target?bEt.default.toBuffer(n.target):null,d=1+(i?.byteLength??0),p=n?.anchor?ze.from(n.anchor):null,v=1+(p?.byteLength??0),_=(n?.tags?.length??0)>0?Ife(n.tags):null,y=16+(_?_.byteLength:0),w=ze.from(e),S=w.byteLength,M=2+r.signatureLength+r.ownerLength+d+v+y+S,x=ze.alloc(M);if(x.set(vEt(r.signatureType),0),x.set(new Uint8Array(r.signatureLength).fill(0),2),l.byteLength!==r.ownerLength)throw new Error(`Owner must be ${r.ownerLength} bytes, but was incorrectly ${l.byteLength}`);x.set(l,2+r.signatureLength);let E=2+r.signatureLength+r.ownerLength;if(x[E]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);x.set(i,E+1)}let T=E+d,I=T+1;if(x[T]=p?1:0,p){if(I+=p.byteLength,p.byteLength!==32)throw new Error("Anchor must be 32 bytes");x.set(p,T+1)}x.set(fCe(n?.tags?.length??0),I);let B=fCe(_?.byteLength??0);x.set(B,I+8),_&&x.set(_,I+16);let O=I+y;return x.set(w,O),new __(x)}var Bfe={...eKe};globalThis.arbundles??=Bfe;var yEt=Bfe,wEt=Bfe,_Et=uN(Wwt(),1);globalThis.Buffer||(globalThis.Buffer=xfe.Buffer);var{DataItem:MEt}=JHe,{signMessage:SEt}=_Et.httpbis;function xEt(e){return async({data:r,tags:n,target:l,anchor:i,createDataItem:d=p=>new MEt(p)})=>{let p=await e.signDataItem({data:r,tags:n,target:l,anchor:i}),v=d(xfe.Buffer.from(p));return{id:await v.id,raw:await v.getRaw()}}}function EEt(e){let r=["alg","keyid"].sort(),n;return async({fields:l,request:i})=>new Promise(d=>(n||(n=e.connect(["ACCESS_ADDRESS","ACCESS_PUBLIC_KEY","SIGNATURE"]).then(async()=>{let p=await e.getActivePublicKey(),v=await e.getActiveAddress();return{publicKey:p,address:v}})),d(n))).then(({publicKey:d,address:p})=>SEt({key:{id:d,alg:"rsa-pss-sha512",sign:async v=>{let _=await e.signMessage(v,{hashAlgorithm:"SHA-512"});return xfe.Buffer.from(_)}},fields:l,name:HSt(p),params:r},i))}var AEt=globalThis.GATEWAY_URL||void 0,REt=globalThis.MU_URL||void 0,TEt=globalThis.CU_URL||void 0,IEt=globalThis.GRAPHQL_URL||void 0,kEt=globalThis.GRAPHQL_MAX_RETRIES||void 0,BEt=globalThis.GRAPHQL_RETRY_BACKOFF||void 0,PEt=globalThis.RELAY_URL||void 0,OEt=globalThis.AO_URL=void 0,Au=Jxt({createDataItemSigner:$oe.createDataItemSigner,createHbSigner:$oe.createHbSigner}),{result:F0r,results:z0r,message:H0r,spawn:K0r,monitor:Z0r,unmonitor:W0r,dryrun:G0r,assign:V0r,createDataItemSigner:oKe}=Au({MODE:"legacy",GATEWAY_URL:AEt,MU_URL:REt,CU_URL:TEt,RELAY_URL:PEt,AO_URL:OEt,GRAPHQL_URL:IEt,GRAPHQL_MAX_RETRIES:kEt,GRAPHQL_RETRY_BACKOFF:BEt,noLog:!0});we();Me();_e();var QKe=$n(XKe(),1),KN=QKe.default.init({host:"arweave.net",port:443,protocol:"https"});we();Me();_e();we();Me();_e();var Ac=class extends Error{constructor(r){super(r),this.name=this.constructor.name}},eZe=class extends Ac{},tZe=class extends Ac{},rZe=class extends Ac{constructor(r,n){super(`Failed request: ${r}: ${n}`)}},iZe=class extends Ac{},ZN=class extends Ac{},nZe=class extends Ac{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},e1=class extends Ac{constructor(){super("Invalid contract configuration")}},aZe=class extends Ac{constructor(){super("Invalid process configuration")}},oZe=class extends Ac{};we();Me();_e();var Nc=$n(pQe(),1);we();Me();_e();var n4="3.15.0";var Vs=class e{logger;silent=!1;static default=new e;constructor({level:r="info"}={}){r==="none"&&(this.silent=!0),typeof window<"u"?this.logger=console:this.logger=(0,Nc.createLogger)({level:r,silent:this.silent,defaultMeta:{name:"ar-io-sdk",version:n4},format:Nc.format.combine(Nc.format.timestamp(),Nc.format.json()),transports:[new Nc.transports.Console({format:Nc.format.combine(Nc.format.timestamp(),Nc.format.json())})]})}info(r,...n){this.silent||this.logger.info(r,...n)}warn(r,...n){this.silent||this.logger.warn(r,...n)}error(r,...n){this.silent||this.logger.error(r,...n)}debug(r,...n){this.silent||this.logger.debug(r,...n)}setLogLevel(r){this.silent=r==="none","silent"in this.logger&&(this.logger.silent=r==="none"),"level"in this.logger&&(this.logger.level=r)}};we();Me();_e();we();Me();_e();var q0e=e=>{let r=Object.entries(e).sort(([n,l],[i,d])=>n==="@"?-1:i==="@"?1:"priority"in l&&!("priority"in d)?-1:!("priority"in l)&&"priority"in d?1:l.priority!==void 0&&d.priority!==void 0?l.priority===d.priority?n<i?-1:n>i?1:0:l.priority-d.priority:n<i?-1:n>i?1:0);return Object.fromEntries(r.map(([n,l],i)=>[n,{...l,index:i}]))},mQe=e=>"name"in e&&"ticker"in e&&"description"in e&&"keywords"in e&&"denomination"in e&&"owner"in e&&"controllers"in e&&"records"in e&&"balances"in e&&"logo"in e&&"totalsupply"in e&&"initialized"in e,vQe=e=>{function r(l){return Object.fromEntries(Object.entries(l).map(([i,d])=>i.toLowerCase().includes("balances")?[i.toLowerCase(),d]:typeof d=="object"&&!Array.isArray(d)&&d!==null?[i.toLowerCase(),r(d)]:[i.toLowerCase(),d]))}let n=r(e);return{Name:n.name,Ticker:n.ticker,Description:n.description,Keywords:n.keywords,Denomination:parseInt(n.denomination),Owner:n.owner,Controllers:n.controllers,Records:Object.entries(n.records).reduce((l,[i,d])=>(l[i]={transactionId:d.transactionid,ttlSeconds:d.ttlseconds,...d.priority!==void 0?{priority:d.priority}:{}},l),{}),Balances:n.balances,Logo:n.logo,TotalSupply:n.totalsupply||1,Initialized:n.initialized}};we();Me();_e();function o1(e,r){let n=e.safeParse(r);if(!n.success)throw new Error(JSON.stringify(n.error.format(),null,2));return n}we();Me();_e();we();Me();_e();we();Me();_e();sd();var gQe="+",bQe="/",yQe="-",wQe="_",_Qe="=";function DUt(e){let r=e.length%4;return r&&(e+=_Qe.repeat(4-r)),e.replaceAll(yQe,gQe).replaceAll(wQe,bQe)}function $Ut(e){return e.replaceAll(gQe,yQe).replaceAll(bQe,wQe).replaceAll(_Qe,"")}function qyr(e){let r=DUt(e);return ze.from(r,"base64")}function a4(e){let r=e.toString("base64");return $Ut(r)}function Uyr(e){return a4(Ul("sha256").update(Uint8Array.from(e)).digest())}function MQe(e=32){let r=mZ(e);return Array.from(r,n=>n.toString(16).padStart(2,"0")).join("").slice(0,e)}we();Me();_e();we();Me();_e();function U0e(e){try{return JSON.parse(e)}catch{return e}}we();Me();_e();we();Me();_e();var F0e=$n(xQe(),1);we();Me();_e();var jUt=Object.defineProperty,FUt=(e,r,n)=>r in e?jUt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,AM=(e,r,n)=>(FUt(e,typeof r!="symbol"?r+"":r,n),n),z0e=class{constructor(r){AM(this,"value"),AM(this,"next"),this.value=r}},H0e=class{constructor(){AM(this,"head"),AM(this,"tail"),AM(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(r){let n=new z0e(r);return this.head&&this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n),this._size++,this._size}pop(){if(!this.head)return;let r=this.head;return this.head=this.head.next,this._size--,r.value}get size(){return this._size}*[Symbol.iterator](){let r=this.head;for(;r;)yield r.value,r=r.next}};function EQe(e){if(!((Number.isInteger(e)||e===1/0)&&e>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let r=new H0e,n=0,l=()=>{n--,r.size>0&&r.pop()()},i=async(v,_,y)=>{n++;let w=(async()=>v(...y))();_(w);try{await w}catch{}l()},d=(v,_,y)=>{r.push(i.bind(null,v,_,y)),(async()=>(await Promise.resolve(),n<e&&r.size>0&&r.pop()()))()},p=(v,..._)=>new Promise(y=>{d(v,y,_)});return Object.defineProperties(p,{activeCount:{get:()=>n},pendingCount:{get:()=>r.size},clearQueue:{value:()=>{r.clear()}}}),p}we();Me();_e();var RM=class{static init(r){return r!==void 0&&"signer"in r?new K0e(r):new tL(r)}},tL=class{process;hyperbeamUrl;checkHyperBeamPromise;logger;constructor(r){if(this.logger=r?.logger??Vs.default,r===void 0||Object.keys(r).length===0)this.process=new ao({processId:S3});else if(g2(r))this.process=r.process;else if(b2(r))this.process=new ao({processId:r.processId});else throw new e1;r?.hyperbeamUrl!==void 0&&(this.hyperbeamUrl=new URL(r.hyperbeamUrl).toString(),this.checkHyperBeamPromise=this.checkHyperBeamCompatibility())}async checkHyperBeamCompatibility(){return this.hyperbeamUrl===void 0?Promise.resolve(!1):this.checkHyperBeamPromise!==void 0?this.checkHyperBeamPromise:(this.logger.debug("Checking HyperBeam compatibility"),this.checkHyperBeamPromise=fetch(`${this.hyperbeamUrl.toString()}${this.process.processId}~process@1.0/now/cache/acl`,{method:"HEAD",signal:AbortSignal.timeout(5e3)}).then(r=>r.ok?(this.logger.debug("HyperBeam compatible"),!0):(this.logger.debug("HyperBeam not compatible"),!1)),this.checkHyperBeamPromise)}async accessControlList({address:r}){if(await this.checkHyperBeamCompatibility()){let n=0;for(;n<3;)try{this.logger.debug("Fetching ant registry acl for address from hyperbeam",r);let l=await fetch(`${this.hyperbeamUrl?.toString()}${this.process.processId}~process@1.0/now/cache/acl/${r}/serialize~json@1.0`);if(l.status!==200)throw this.logger.debug("Failed to fetch ant registry acl for address from hyperbeam",r,l.status,l.statusText),new Error(`Failed to fetch ant registry acl for address ${r}: ${l?.statusText??"Unknown error"}`);this.logger.debug("Fetched ant registry acl for address from hyperbeam",r);let i=await l.json();return{Owned:i.Owned,Controlled:i.Controlled}}catch{n++,this.logger.debug("Failed to fetch ant registry acl for address from hyperbeam",r,n),await new Promise(i=>setTimeout(i,1e3*n**2))}}return this.logger.debug("Fetching ant registry acl for address from process",r),this.process.read({tags:[{name:"Action",value:"Access-Control-List"},{name:"Address",value:r}]})}async getAntsForAddress({address:r}){return this.accessControlList({address:r})}},K0e=class extends tL{signer;constructor({signer:r,...n}){super(n),this.signer=v2(r)}async register({processId:r}){return this.process.send({tags:[{name:"Action",value:"Register"},{name:"Process-Id",value:r}],signer:this.signer})}};we();Me();_e();we();Me();_e();var zUt="https://faucet.ario.permaweb.services";function W0e({arioInstance:e,faucetApiUrl:r=zUt}){let n=new Z0e({faucetUrl:r,processId:e.process.processId});return new Proxy(e,{get(i,d){if(d==="faucet")return n;if(d in i){let p=i[d];return typeof p=="function"?p.bind(i):p}}})}var Z0e=class{faucetUrl;processId;constructor({faucetUrl:r,processId:n}){this.faucetUrl=r,this.processId=n}async captchaUrl(){let r=await fetch(`${this.faucetUrl}/api/captcha/url?process-id=${this.processId}`,{method:"GET"});if(!r.ok){let l=await r.json().catch(()=>({error:r.statusText}));throw new Error(l.error)}return await r.json()}async claimWithCaptchaResponse({captchaResponse:r,recipient:n,quantity:l}){let i=await fetch(`${this.faucetUrl}/api/claim/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,recipient:n,quantity:l,captchaResponse:r})});if(!i.ok){let p=await i.json().catch(()=>({error:i.statusText}));throw new Error(p.error)}return await i.json()}async requestAuthToken({captchaResponse:r}){let n=await fetch(`${this.faucetUrl}/api/captcha/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({processId:this.processId,captchaResponse:r})});if(!n.ok){let i=await n.json().catch(()=>({error:n.statusText}));throw new Error(i.error)}return await n.json()}async claimWithAuthToken({authToken:r,recipient:n,quantity:l}){let i=await fetch(`${this.faucetUrl}/api/claim/async`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({recipient:n,qty:l,processId:this.processId})});if(!i.ok){let p=await i.json().catch(()=>({error:i.statusText}));throw new Error(p.error)}return await i.json()}async verifyAuthToken({authToken:r}){let n=await fetch(`${this.faucetUrl}/api/token/verify?process-id=${this.processId}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});if(!n.ok){let i=await n.json().catch(()=>({error:n.statusText}));throw new Error(i.error)}return await n.json()}};we();Me();_e();we();Me();_e();we();Me();_e();var pf=[];for(let e=0;e<256;++e)pf.push((e+256).toString(16).slice(1));function AQe(e,r=0){return(pf[e[r+0]]+pf[e[r+1]]+pf[e[r+2]]+pf[e[r+3]]+"-"+pf[e[r+4]]+pf[e[r+5]]+"-"+pf[e[r+6]]+pf[e[r+7]]+"-"+pf[e[r+8]]+pf[e[r+9]]+"-"+pf[e[r+10]]+pf[e[r+11]]+pf[e[r+12]]+pf[e[r+13]]+pf[e[r+14]]+pf[e[r+15]]).toLowerCase()}we();Me();_e();var G0e,HUt=new Uint8Array(16);function V0e(){if(!G0e){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");G0e=crypto.getRandomValues.bind(crypto)}return G0e(HUt)}we();Me();_e();we();Me();_e();var KUt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Y0e={randomUUID:KUt};function ZUt(e,r,n){if(Y0e.randomUUID&&!r&&!e)return Y0e.randomUUID();e=e||{};let l=e.random??e.rng?.()??V0e();if(l.length<16)throw new Error("Random bytes length must be >= 16");if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,r){if(n=n||0,n<0||n+16>r.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let i=0;i<16;++i)r[n+i]=l[i];return r}return AQe(l)}var J0e=ZUt;we();Me();_e();var X0e=class e{constructor(r){this.positiveFiniteInteger=r;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${r}`)}[Symbol.toPrimitive](r){return r==="string"&&this.toString(),this.positiveFiniteInteger}plus(r){return new e(this.positiveFiniteInteger+r.positiveFiniteInteger)}minus(r){return new e(this.positiveFiniteInteger-r.positiveFiniteInteger)}isGreaterThan(r){return this.positiveFiniteInteger>r.positiveFiniteInteger}isGreaterThanOrEqualTo(r){return this.positiveFiniteInteger>=r.positiveFiniteInteger}isLessThan(r){return this.positiveFiniteInteger<r.positiveFiniteInteger}isLessThanOrEqualTo(r){return this.positiveFiniteInteger<=r.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(r){return this.positiveFiniteInteger===r.positiveFiniteInteger}},Q0e=class{value;constructor(r){if(!Number.isFinite(r)||r<0)throw new Error("ARIOToken must be a non-negative finite number");this.value=+r.toFixed(6)}valueOf(){return this.value}toMARIO(){return new TM(Math.floor(this.value*IY))}toString(){return`${this.value}`}},TM=class e extends X0e{constructor(r){super(r)}multiply(r){let n=Math.floor(this.valueOf()*r.valueOf());return new e(n)}divide(r){if(r.valueOf()===0)throw new Error("Cannot divide by zero");let n=Math.floor(this.valueOf()/r.valueOf());return new e(n)}plus(r){let n=super.plus(r);return new e(n.valueOf())}minus(r){let n=super.minus(r);return new e(n.valueOf())}toARIO(){return new Q0e(this.valueOf()/IY)}};we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();function IM(e,r){return function(){return e.apply(r,arguments)}}var{toString:WUt}=Object.prototype,{getPrototypeOf:tle}=Object,iL=(e=>r=>{let n=WUt.call(r);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Cc=e=>(e=e.toLowerCase(),r=>iL(r)===e),nL=e=>r=>typeof r===e,{isArray:o4}=Array,kM=nL("undefined");function GUt(e){return e!==null&&!kM(e)&&e.constructor!==null&&!kM(e.constructor)&&Ou(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var TQe=Cc("ArrayBuffer");function VUt(e){let r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(e):r=e&&e.buffer&&TQe(e.buffer),r}var YUt=nL("string"),Ou=nL("function"),IQe=nL("number"),aL=e=>e!==null&&typeof e=="object",JUt=e=>e===!0||e===!1,rL=e=>{if(iL(e)!=="object")return!1;let r=tle(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},XUt=Cc("Date"),QUt=Cc("File"),ejt=Cc("Blob"),tjt=Cc("FileList"),rjt=e=>aL(e)&&Ou(e.pipe),ijt=e=>{let r;return e&&(typeof FormData=="function"&&e instanceof FormData||Ou(e.append)&&((r=iL(e))==="formdata"||r==="object"&&Ou(e.toString)&&e.toString()==="[object FormData]"))},njt=Cc("URLSearchParams"),[ajt,ojt,sjt,fjt]=["ReadableStream","Request","Response","Headers"].map(Cc),hjt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function BM(e,r,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let l,i;if(typeof e!="object"&&(e=[e]),o4(e))for(l=0,i=e.length;l<i;l++)r.call(null,e[l],l,e);else{let d=n?Object.getOwnPropertyNames(e):Object.keys(e),p=d.length,v;for(l=0;l<p;l++)v=d[l],r.call(null,e[v],v,e)}}function kQe(e,r){r=r.toLowerCase();let n=Object.keys(e),l=n.length,i;for(;l-- >0;)if(i=n[l],r===i.toLowerCase())return i;return null}var P6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,BQe=e=>!kM(e)&&e!==P6;function ele(){let{caseless:e}=BQe(this)&&this||{},r={},n=(l,i)=>{let d=e&&kQe(r,i)||i;rL(r[d])&&rL(l)?r[d]=ele(r[d],l):rL(l)?r[d]=ele({},l):o4(l)?r[d]=l.slice():r[d]=l};for(let l=0,i=arguments.length;l<i;l++)arguments[l]&&BM(arguments[l],n);return r}var ujt=(e,r,n,{allOwnKeys:l}={})=>(BM(r,(i,d)=>{n&&Ou(i)?e[d]=IM(i,n):e[d]=i},{allOwnKeys:l}),e),ljt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cjt=(e,r,n,l)=>{e.prototype=Object.create(r.prototype,l),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:r.prototype}),n&&Object.assign(e.prototype,n)},djt=(e,r,n,l)=>{let i,d,p,v={};if(r=r||{},e==null)return r;do{for(i=Object.getOwnPropertyNames(e),d=i.length;d-- >0;)p=i[d],(!l||l(p,e,r))&&!v[p]&&(r[p]=e[p],v[p]=!0);e=n!==!1&&tle(e)}while(e&&(!n||n(e,r))&&e!==Object.prototype);return r},pjt=(e,r,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=r.length;let l=e.indexOf(r,n);return l!==-1&&l===n},mjt=e=>{if(!e)return null;if(o4(e))return e;let r=e.length;if(!IQe(r))return null;let n=new Array(r);for(;r-- >0;)n[r]=e[r];return n},vjt=(e=>r=>e&&r instanceof e)(typeof Uint8Array<"u"&&tle(Uint8Array)),gjt=(e,r)=>{let l=(e&&e[Symbol.iterator]).call(e),i;for(;(i=l.next())&&!i.done;){let d=i.value;r.call(e,d[0],d[1])}},bjt=(e,r)=>{let n,l=[];for(;(n=e.exec(r))!==null;)l.push(n);return l},yjt=Cc("HTMLFormElement"),wjt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,l,i){return l.toUpperCase()+i}),RQe=(({hasOwnProperty:e})=>(r,n)=>e.call(r,n))(Object.prototype),_jt=Cc("RegExp"),PQe=(e,r)=>{let n=Object.getOwnPropertyDescriptors(e),l={};BM(n,(i,d)=>{let p;(p=r(i,d,e))!==!1&&(l[d]=p||i)}),Object.defineProperties(e,l)},Mjt=e=>{PQe(e,(r,n)=>{if(Ou(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let l=e[n];if(Ou(l)){if(r.enumerable=!1,"writable"in r){r.writable=!1;return}r.set||(r.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Sjt=(e,r)=>{let n={},l=i=>{i.forEach(d=>{n[d]=!0})};return o4(e)?l(e):l(String(e).split(r)),n},xjt=()=>{},Ejt=(e,r)=>e!=null&&Number.isFinite(e=+e)?e:r;function Ajt(e){return!!(e&&Ou(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Rjt=e=>{let r=new Array(10),n=(l,i)=>{if(aL(l)){if(r.indexOf(l)>=0)return;if(!("toJSON"in l)){r[i]=l;let d=o4(l)?[]:{};return BM(l,(p,v)=>{let _=n(p,i+1);!kM(_)&&(d[v]=_)}),r[i]=void 0,d}}return l};return n(e,0)},Tjt=Cc("AsyncFunction"),Ijt=e=>e&&(aL(e)||Ou(e))&&Ou(e.then)&&Ou(e.catch),OQe=((e,r)=>e?setImmediate:r?((n,l)=>(P6.addEventListener("message",({source:i,data:d})=>{i===P6&&d===n&&l.length&&l.shift()()},!1),i=>{l.push(i),P6.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ou(P6.postMessage)),kjt=typeof queueMicrotask<"u"?queueMicrotask.bind(P6):typeof We<"u"&&We.nextTick||OQe,ir={isArray:o4,isArrayBuffer:TQe,isBuffer:GUt,isFormData:ijt,isArrayBufferView:VUt,isString:YUt,isNumber:IQe,isBoolean:JUt,isObject:aL,isPlainObject:rL,isReadableStream:ajt,isRequest:ojt,isResponse:sjt,isHeaders:fjt,isUndefined:kM,isDate:XUt,isFile:QUt,isBlob:ejt,isRegExp:_jt,isFunction:Ou,isStream:rjt,isURLSearchParams:njt,isTypedArray:vjt,isFileList:tjt,forEach:BM,merge:ele,extend:ujt,trim:hjt,stripBOM:ljt,inherits:cjt,toFlatObject:djt,kindOf:iL,kindOfTest:Cc,endsWith:pjt,toArray:mjt,forEachEntry:gjt,matchAll:bjt,isHTMLForm:yjt,hasOwnProperty:RQe,hasOwnProp:RQe,reduceDescriptors:PQe,freezeMethods:Mjt,toObjectSet:Sjt,toCamelCase:wjt,noop:xjt,toFiniteNumber:Ejt,findKey:kQe,global:P6,isContextDefined:BQe,isSpecCompliantForm:Ajt,toJSONObject:Rjt,isAsyncFn:Tjt,isThenable:Ijt,setImmediate:OQe,asap:kjt};we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();function s4(e,r,n,l,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",r&&(this.code=r),n&&(this.config=n),l&&(this.request=l),i&&(this.response=i,this.status=i.status?i.status:null)}ir.inherits(s4,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ir.toJSONObject(this.config),code:this.code,status:this.status}}});var NQe=s4.prototype,CQe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{CQe[e]={value:e}});Object.defineProperties(s4,CQe);Object.defineProperty(NQe,"isAxiosError",{value:!0});s4.from=(e,r,n,l,i,d)=>{let p=Object.create(NQe);return ir.toFlatObject(e,p,function(_){return _!==Error.prototype},v=>v!=="isAxiosError"),s4.call(p,e.message,r,n,l,i),p.cause=e,p.name=e.name,d&&Object.assign(p,d),p};var ci=s4;we();Me();_e();var oL=null;function rle(e){return ir.isPlainObject(e)||ir.isArray(e)}function DQe(e){return ir.endsWith(e,"[]")?e.slice(0,-2):e}function LQe(e,r,n){return e?e.concat(r).map(function(i,d){return i=DQe(i),!n&&d?"["+i+"]":i}).join(n?".":""):r}function Bjt(e){return ir.isArray(e)&&!e.some(rle)}var Pjt=ir.toFlatObject(ir,{},null,function(r){return/^is[A-Z]/.test(r)});function Ojt(e,r,n){if(!ir.isObject(e))throw new TypeError("target must be an object");r=r||new(oL||FormData),n=ir.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,I){return!ir.isUndefined(I[T])});let l=n.metaTokens,i=n.visitor||w,d=n.dots,p=n.indexes,_=(n.Blob||typeof Blob<"u"&&Blob)&&ir.isSpecCompliantForm(r);if(!ir.isFunction(i))throw new TypeError("visitor must be a function");function y(E){if(E===null)return"";if(ir.isDate(E))return E.toISOString();if(!_&&ir.isBlob(E))throw new ci("Blob is not supported. Use a Buffer instead.");return ir.isArrayBuffer(E)||ir.isTypedArray(E)?_&&typeof Blob=="function"?new Blob([E]):ze.from(E):E}function w(E,T,I){let B=E;if(E&&!I&&typeof E=="object"){if(ir.endsWith(T,"{}"))T=l?T:T.slice(0,-2),E=JSON.stringify(E);else if(ir.isArray(E)&&Bjt(E)||(ir.isFileList(E)||ir.endsWith(T,"[]"))&&(B=ir.toArray(E)))return T=DQe(T),B.forEach(function(N,H){!(ir.isUndefined(N)||N===null)&&r.append(p===!0?LQe([T],H,d):p===null?T:T+"[]",y(N))}),!1}return rle(E)?!0:(r.append(LQe(I,T,d),y(E)),!1)}let S=[],M=Object.assign(Pjt,{defaultVisitor:w,convertValue:y,isVisitable:rle});function x(E,T){if(!ir.isUndefined(E)){if(S.indexOf(E)!==-1)throw Error("Circular reference detected in "+T.join("."));S.push(E),ir.forEach(E,function(B,O){(!(ir.isUndefined(B)||B===null)&&i.call(r,B,ir.isString(O)?O.trim():O,T,M))===!0&&x(B,T?T.concat(O):[O])}),S.pop()}}if(!ir.isObject(e))throw new TypeError("data must be an object");return x(e),r}var y2=Ojt;function $Qe(e){let r={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(l){return r[l]})}function qQe(e,r){this._pairs=[],e&&y2(e,this,r)}var UQe=qQe.prototype;UQe.append=function(r,n){this._pairs.push([r,n])};UQe.toString=function(r){let n=r?function(l){return r.call(this,l,$Qe)}:$Qe;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};var sL=qQe;function Njt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function PM(e,r,n){if(!r)return e;let l=n&&n.encode||Njt;ir.isFunction(n)&&(n={serialize:n});let i=n&&n.serialize,d;if(i?d=i(r,n):d=ir.isURLSearchParams(r)?r.toString():new sL(r,n).toString(l),d){let p=e.indexOf("#");p!==-1&&(e=e.slice(0,p)),e+=(e.indexOf("?")===-1?"?":"&")+d}return e}we();Me();_e();var ile=class{constructor(){this.handlers=[]}use(r,n,l){return this.handlers.push({fulfilled:r,rejected:n,synchronous:l?l.synchronous:!1,runWhen:l?l.runWhen:null}),this.handlers.length-1}eject(r){this.handlers[r]&&(this.handlers[r]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(r){ir.forEach(this.handlers,function(l){l!==null&&r(l)})}},nle=ile;we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();var fL={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};we();Me();_e();we();Me();_e();we();Me();_e();we();Me();_e();var jQe=typeof URLSearchParams<"u"?URLSearchParams:sL;we();Me();_e();var FQe=typeof FormData<"u"?FormData:null;we();Me();_e();var zQe=typeof Blob<"u"?Blob:null;var HQe={isBrowser:!0,classes:{URLSearchParams:jQe,FormData:FQe,Blob:zQe},protocols:["http","https","file","blob","url","data"]};var sle={};jf(sle,{hasBrowserEnv:()=>ole,hasStandardBrowserEnv:()=>Cjt,hasStandardBrowserWebWorkerEnv:()=>Ljt,navigator:()=>ale,origin:()=>Djt});we();Me();_e();var ole=typeof window<"u"&&typeof document<"u",ale=typeof navigator=="object"&&navigator||void 0,Cjt=ole&&(!ale||["ReactNative","NativeScript","NS"].indexOf(ale.product)<0),Ljt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Djt=ole&&window.location.href||"http://localhost";var _o={...sle,...HQe};function fle(e,r){return y2(e,new _o.classes.URLSearchParams,Object.assign({visitor:function(n,l,i,d){return _o.isNode&&ir.isBuffer(n)?(this.append(l,n.toString("base64")),!1):d.defaultVisitor.apply(this,arguments)}},r))}we();Me();_e();function $jt(e){return ir.matchAll(/\w+|\[(\w*)]/g,e).map(r=>r[0]==="[]"?"":r[1]||r[0])}function qjt(e){let r={},n=Object.keys(e),l,i=n.length,d;for(l=0;l<i;l++)d=n[l],r[d]=e[d];return r}function Ujt(e){function r(n,l,i,d){let p=n[d++];if(p==="__proto__")return!0;let v=Number.isFinite(+p),_=d>=n.length;return p=!p&&ir.isArray(i)?i.length:p,_?(ir.hasOwnProp(i,p)?i[p]=[i[p],l]:i[p]=l,!v):((!i[p]||!ir.isObject(i[p]))&&(i[p]=[]),r(n,l,i[p],d)&&ir.isArray(i[p])&&(i[p]=qjt(i[p])),!v)}if(ir.isFormData(e)&&ir.isFunction(e.entries)){let n={};return ir.forEachEntry(e,(l,i)=>{r($jt(l),i,n,0)}),n}return null}var hL=Ujt;function jjt(e,r,n){if(ir.isString(e))try{return(r||JSON.parse)(e),ir.trim(e)}catch(l){if(l.name!=="SyntaxError")throw l}return(n||JSON.stringify)(e)}var hle={transitional:fL,adapter:["xhr","http","fetch"],transformRequest:[function(r,n){let l=n.getContentType()||"",i=l.indexOf("application/json")>-1,d=ir.isObject(r);if(d&&ir.isHTMLForm(r)&&(r=new FormData(r)),ir.isFormData(r))return i?JSON.stringify(hL(r)):r;if(ir.isArrayBuffer(r)||ir.isBuffer(r)||ir.isStream(r)||ir.isFile(r)||ir.isBlob(r)||ir.isReadableStream(r))return r;if(ir.isArrayBufferView(r))return r.buffer;if(ir.isURLSearchParams(r))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),r.toString();let v;if(d){if(l.indexOf("application/x-www-form-urlencoded")>-1)return fle(r,this.formSerializer).toString();if((v=ir.isFileList(r))||l.indexOf("multipart/form-data")>-1){let _=this.env&&this.env.FormData;return y2(v?{"files[]":r}:r,_&&new _,this.formSerializer)}}return d||i?(n.setContentType("application/json",!1),jjt(r)):r}],transformResponse:[function(r){let n=this.transitional||hle.transitional,l=n&&n.forcedJSONParsing,i=this.responseType==="json";if(ir.isResponse(r)||ir.isReadableStream(r))return r;if(r&&ir.isString(r)&&(l&&!this.responseType||i)){let p=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(r)}catch(v){if(p)throw v.name==="SyntaxError"?ci.from(v,ci.ERR_BAD_RESPONSE,this,null,this.response):v}}return r}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_o.classes.FormData,Blob:_o.classes.Blob},validateStatus:function(r){return r>=200&&r<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ir.forEach(["delete","get","head","post","put","patch"],e=>{hle.headers[e]={}});var f4=hle;we();Me();_e();we();Me();_e();var Fjt=ir.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),KQe=e=>{let r={},n,l,i;return e&&e.split(`
244
244
  `).forEach(function(p){i=p.indexOf(":"),n=p.substring(0,i).trim().toLowerCase(),l=p.substring(i+1).trim(),!(!n||r[n]&&Fjt[n])&&(n==="set-cookie"?r[n]?r[n].push(l):r[n]=[l]:r[n]=r[n]?r[n]+", "+l:l)}),r};var ZQe=Symbol("internals");function OM(e){return e&&String(e).trim().toLowerCase()}function uL(e){return e===!1||e==null?e:ir.isArray(e)?e.map(uL):String(e)}function zjt(e){let r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,l;for(;l=n.exec(e);)r[l[1]]=l[2];return r}var Hjt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ule(e,r,n,l,i){if(ir.isFunction(l))return l.call(this,r,n);if(i&&(r=n),!!ir.isString(r)){if(ir.isString(l))return r.indexOf(l)!==-1;if(ir.isRegExp(l))return l.test(r)}}function Kjt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(r,n,l)=>n.toUpperCase()+l)}function Zjt(e,r){let n=ir.toCamelCase(" "+r);["get","set","has"].forEach(l=>{Object.defineProperty(e,l+n,{value:function(i,d,p){return this[l].call(this,r,i,d,p)},configurable:!0})})}var h4=class{constructor(r){r&&this.set(r)}set(r,n,l){let i=this;function d(v,_,y){let w=OM(_);if(!w)throw new Error("header name must be a non-empty string");let S=ir.findKey(i,w);(!S||i[S]===void 0||y===!0||y===void 0&&i[S]!==!1)&&(i[S||_]=uL(v))}let p=(v,_)=>ir.forEach(v,(y,w)=>d(y,w,_));if(ir.isPlainObject(r)||r instanceof this.constructor)p(r,n);else if(ir.isString(r)&&(r=r.trim())&&!Hjt(r))p(KQe(r),n);else if(ir.isHeaders(r))for(let[v,_]of r.entries())d(_,v,l);else r!=null&&d(n,r,l);return this}get(r,n){if(r=OM(r),r){let l=ir.findKey(this,r);if(l){let i=this[l];if(!n)return i;if(n===!0)return zjt(i);if(ir.isFunction(n))return n.call(this,i,l);if(ir.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(r,n){if(r=OM(r),r){let l=ir.findKey(this,r);return!!(l&&this[l]!==void 0&&(!n||ule(this,this[l],l,n)))}return!1}delete(r,n){let l=this,i=!1;function d(p){if(p=OM(p),p){let v=ir.findKey(l,p);v&&(!n||ule(l,l[v],v,n))&&(delete l[v],i=!0)}}return ir.isArray(r)?r.forEach(d):d(r),i}clear(r){let n=Object.keys(this),l=n.length,i=!1;for(;l--;){let d=n[l];(!r||ule(this,this[d],d,r,!0))&&(delete this[d],i=!0)}return i}normalize(r){let n=this,l={};return ir.forEach(this,(i,d)=>{let p=ir.findKey(l,d);if(p){n[p]=uL(i),delete n[d];return}let v=r?Kjt(d):String(d).trim();v!==d&&delete n[d],n[v]=uL(i),l[v]=!0}),this}concat(...r){return this.constructor.concat(this,...r)}toJSON(r){let n=Object.create(null);return ir.forEach(this,(l,i)=>{l!=null&&l!==!1&&(n[i]=r&&ir.isArray(l)?l.join(", "):l)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([r,n])=>r+": "+n).join(`
245
245
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(r){return r instanceof this?r:new this(r)}static concat(r,...n){let l=new this(r);return n.forEach(i=>l.set(i)),l}static accessor(r){let l=(this[ZQe]=this[ZQe]={accessors:{}}).accessors,i=this.prototype;function d(p){let v=OM(p);l[v]||(Zjt(i,p),l[v]=!0)}return ir.isArray(r)?r.forEach(d):d(r),this}};h4.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ir.reduceDescriptors(h4.prototype,({value:e},r)=>{let n=r[0].toUpperCase()+r.slice(1);return{get:()=>e,set(l){this[n]=l}}});ir.freezeMethods(h4);var _s=h4;function NM(e,r){let n=this||f4,l=r||n,i=_s.from(l.headers),d=l.data;return ir.forEach(e,function(v){d=v.call(n,d,i.normalize(),r?r.status:void 0)}),i.normalize(),d}we();Me();_e();function CM(e){return!!(e&&e.__CANCEL__)}we();Me();_e();function WQe(e,r,n){ci.call(this,e??"canceled",ci.ERR_CANCELED,r,n),this.name="CanceledError"}ir.inherits(WQe,ci,{__CANCEL__:!0});var s1=WQe;we();Me();_e();we();Me();_e();we();Me();_e();function LM(e,r,n){let l=n.config.validateStatus;!n.status||!l||l(n.status)?e(n):r(new ci("Request failed with status code "+n.status,[ci.ERR_BAD_REQUEST,ci.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}we();Me();_e();function lle(e){let r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return r&&r[1]||""}we();Me();_e();we();Me();_e();function Wjt(e,r){e=e||10;let n=new Array(e),l=new Array(e),i=0,d=0,p;return r=r!==void 0?r:1e3,function(_){let y=Date.now(),w=l[d];p||(p=y),n[i]=_,l[i]=y;let S=d,M=0;for(;S!==i;)M+=n[S++],S=S%e;if(i=(i+1)%e,i===d&&(d=(d+1)%e),y-p<r)return;let x=w&&y-w;return x?Math.round(M*1e3/x):void 0}}var GQe=Wjt;we();Me();_e();function Gjt(e,r){let n=0,l=1e3/r,i,d,p=(y,w=Date.now())=>{n=w,i=null,d&&(clearTimeout(d),d=null),e.apply(null,y)};return[(...y)=>{let w=Date.now(),S=w-n;S>=l?p(y,w):(i=y,d||(d=setTimeout(()=>{d=null,p(i)},l-S)))},()=>i&&p(i)]}var VQe=Gjt;var u4=(e,r,n=3)=>{let l=0,i=GQe(50,250);return VQe(d=>{let p=d.loaded,v=d.lengthComputable?d.total:void 0,_=p-l,y=i(_),w=p<=v;l=p;let S={loaded:p,total:v,progress:v?p/v:void 0,bytes:_,rate:y||void 0,estimated:y&&v&&w?(v-p)/y:void 0,event:d,lengthComputable:v!=null,[r?"download":"upload"]:!0};e(S)},n)},cle=(e,r)=>{let n=e!=null;return[l=>r[0]({lengthComputable:n,total:e,loaded:l}),r[1]]},dle=e=>(...r)=>ir.asap(()=>e(...r));we();Me();_e();we();Me();_e();var YQe=_o.hasStandardBrowserEnv?((e,r)=>n=>(n=new URL(n,_o.origin),e.protocol===n.protocol&&e.host===n.host&&(r||e.port===n.port)))(new URL(_o.origin),_o.navigator&&/(msie|trident)/i.test(_o.navigator.userAgent)):()=>!0;we();Me();_e();var JQe=_o.hasStandardBrowserEnv?{write(e,r,n,l,i,d){let p=[e+"="+encodeURIComponent(r)];ir.isNumber(n)&&p.push("expires="+new Date(n).toGMTString()),ir.isString(l)&&p.push("path="+l),ir.isString(i)&&p.push("domain="+i),d===!0&&p.push("secure"),document.cookie=p.join("; ")},read(e){let r=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};we();Me();_e();we();Me();_e();function ple(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}we();Me();_e();function mle(e,r){return r?e.replace(/\/?\/$/,"")+"/"+r.replace(/^\/+/,""):e}function DM(e,r,n){let l=!ple(r);return e&&(l||n==!1)?mle(e,r):r}we();Me();_e();var XQe=e=>e instanceof _s?{...e}:e;function Lc(e,r){r=r||{};let n={};function l(y,w,S,M){return ir.isPlainObject(y)&&ir.isPlainObject(w)?ir.merge.call({caseless:M},y,w):ir.isPlainObject(w)?ir.merge({},w):ir.isArray(w)?w.slice():w}function i(y,w,S,M){if(ir.isUndefined(w)){if(!ir.isUndefined(y))return l(void 0,y,S,M)}else return l(y,w,S,M)}function d(y,w){if(!ir.isUndefined(w))return l(void 0,w)}function p(y,w){if(ir.isUndefined(w)){if(!ir.isUndefined(y))return l(void 0,y)}else return l(void 0,w)}function v(y,w,S){if(S in r)return l(y,w);if(S in e)return l(void 0,y)}let _={url:d,method:d,data:d,baseURL:p,transformRequest:p,transformResponse:p,paramsSerializer:p,timeout:p,timeoutMessage:p,withCredentials:p,withXSRFToken:p,adapter:p,responseType:p,xsrfCookieName:p,xsrfHeaderName:p,onUploadProgress:p,onDownloadProgress:p,decompress:p,maxContentLength:p,maxBodyLength:p,beforeRedirect:p,transport:p,httpAgent:p,httpsAgent:p,cancelToken:p,socketPath:p,responseEncoding:p,validateStatus:v,headers:(y,w,S)=>i(XQe(y),XQe(w),S,!0)};return ir.forEach(Object.keys(Object.assign({},e,r)),function(w){let S=_[w]||i,M=S(e[w],r[w],w);ir.isUndefined(M)&&S!==v||(n[w]=M)}),n}var lL=e=>{let r=Lc({},e),{data:n,withXSRFToken:l,xsrfHeaderName:i,xsrfCookieName:d,headers:p,auth:v}=r;r.headers=p=_s.from(p),r.url=PM(DM(r.baseURL,r.url,r.allowAbsoluteUrls),e.params,e.paramsSerializer),v&&p.set("Authorization","Basic "+btoa((v.username||"")+":"+(v.password?unescape(encodeURIComponent(v.password)):"")));let _;if(ir.isFormData(n)){if(_o.hasStandardBrowserEnv||_o.hasStandardBrowserWebWorkerEnv)p.setContentType(void 0);else if((_=p.getContentType())!==!1){let[y,...w]=_?_.split(";").map(S=>S.trim()).filter(Boolean):[];p.setContentType([y||"multipart/form-data",...w].join("; "))}}if(_o.hasStandardBrowserEnv&&(l&&ir.isFunction(l)&&(l=l(r)),l||l!==!1&&YQe(r.url))){let y=i&&d&&JQe.read(d);y&&p.set(i,y)}return r};var Vjt=typeof XMLHttpRequest<"u",QQe=Vjt&&function(e){return new Promise(function(n,l){let i=lL(e),d=i.data,p=_s.from(i.headers).normalize(),{responseType:v,onUploadProgress:_,onDownloadProgress:y}=i,w,S,M,x,E;function T(){x&&x(),E&&E(),i.cancelToken&&i.cancelToken.unsubscribe(w),i.signal&&i.signal.removeEventListener("abort",w)}let I=new XMLHttpRequest;I.open(i.method.toUpperCase(),i.url,!0),I.timeout=i.timeout;function B(){if(!I)return;let N=_s.from("getAllResponseHeaders"in I&&I.getAllResponseHeaders()),K={data:!v||v==="text"||v==="json"?I.responseText:I.response,status:I.status,statusText:I.statusText,headers:N,config:e,request:I};LM(function(L){n(L),T()},function(L){l(L),T()},K),I=null}"onloadend"in I?I.onloadend=B:I.onreadystatechange=function(){!I||I.readyState!==4||I.status===0&&!(I.responseURL&&I.responseURL.indexOf("file:")===0)||setTimeout(B)},I.onabort=function(){I&&(l(new ci("Request aborted",ci.ECONNABORTED,e,I)),I=null)},I.onerror=function(){l(new ci("Network Error",ci.ERR_NETWORK,e,I)),I=null},I.ontimeout=function(){let H=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",K=i.transitional||fL;i.timeoutErrorMessage&&(H=i.timeoutErrorMessage),l(new ci(H,K.clarifyTimeoutError?ci.ETIMEDOUT:ci.ECONNABORTED,e,I)),I=null},d===void 0&&p.setContentType(null),"setRequestHeader"in I&&ir.forEach(p.toJSON(),function(H,K){I.setRequestHeader(K,H)}),ir.isUndefined(i.withCredentials)||(I.withCredentials=!!i.withCredentials),v&&v!=="json"&&(I.responseType=i.responseType),y&&([M,E]=u4(y,!0),I.addEventListener("progress",M)),_&&I.upload&&([S,x]=u4(_),I.upload.addEventListener("progress",S),I.upload.addEventListener("loadend",x)),(i.cancelToken||i.signal)&&(w=N=>{I&&(l(!N||N.type?new s1(null,e,I):N),I.abort(),I=null)},i.cancelToken&&i.cancelToken.subscribe(w),i.signal&&(i.signal.aborted?w():i.signal.addEventListener("abort",w)));let O=lle(i.url);if(O&&_o.protocols.indexOf(O)===-1){l(new ci("Unsupported protocol "+O+":",ci.ERR_BAD_REQUEST,e));return}I.send(d||null)})};we();Me();_e();we();Me();_e();var Yjt=(e,r)=>{let{length:n}=e=e?e.filter(Boolean):[];if(r||n){let l=new AbortController,i,d=function(y){if(!i){i=!0,v();let w=y instanceof Error?y:this.reason;l.abort(w instanceof ci?w:new s1(w instanceof Error?w.message:w))}},p=r&&setTimeout(()=>{p=null,d(new ci(`timeout ${r} of ms exceeded`,ci.ETIMEDOUT))},r),v=()=>{e&&(p&&clearTimeout(p),p=null,e.forEach(y=>{y.unsubscribe?y.unsubscribe(d):y.removeEventListener("abort",d)}),e=null)};e.forEach(y=>y.addEventListener("abort",d));let{signal:_}=l;return _.unsubscribe=()=>ir.asap(v),_}},eet=Yjt;we();Me();_e();var Jjt=function*(e,r){let n=e.byteLength;if(!r||n<r){yield e;return}let l=0,i;for(;l<n;)i=l+r,yield e.slice(l,i),l=i},Xjt=async function*(e,r){for await(let n of Qjt(e))yield*Jjt(n,r)},Qjt=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let r=e.getReader();try{for(;;){let{done:n,value:l}=await r.read();if(n)break;yield l}}finally{await r.cancel()}},vle=(e,r,n,l)=>{let i=Xjt(e,r),d=0,p,v=_=>{p||(p=!0,l&&l(_))};return new ReadableStream({async pull(_){try{let{done:y,value:w}=await i.next();if(y){v(),_.close();return}let S=w.byteLength;if(n){let M=d+=S;n(M)}_.enqueue(new Uint8Array(w))}catch(y){throw v(y),y}},cancel(_){return v(_),i.return()}},{highWaterMark:2})};var dL=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ret=dL&&typeof ReadableStream=="function",eFt=dL&&(typeof TextEncoder=="function"?(e=>r=>e.encode(r))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),iet=(e,...r)=>{try{return!!e(...r)}catch{return!1}},tFt=ret&&iet(()=>{let e=!1,r=new Request(_o.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!r}),tet=64*1024,gle=ret&&iet(()=>ir.isReadableStream(new Response("").body)),cL={stream:gle&&(e=>e.body)};dL&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(r=>{!cL[r]&&(cL[r]=ir.isFunction(e[r])?n=>n[r]():(n,l)=>{throw new ci(`Response type '${r}' is not supported`,ci.ERR_NOT_SUPPORT,l)})})})(new Response);var rFt=async e=>{if(e==null)return 0;if(ir.isBlob(e))return e.size;if(ir.isSpecCompliantForm(e))return(await new Request(_o.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ir.isArrayBufferView(e)||ir.isArrayBuffer(e))return e.byteLength;if(ir.isURLSearchParams(e)&&(e=e+""),ir.isString(e))return(await eFt(e)).byteLength},iFt=async(e,r)=>{let n=ir.toFiniteNumber(e.getContentLength());return n??rFt(r)},net=dL&&(async e=>{let{url:r,method:n,data:l,signal:i,cancelToken:d,timeout:p,onDownloadProgress:v,onUploadProgress:_,responseType:y,headers:w,withCredentials:S="same-origin",fetchOptions:M}=lL(e);y=y?(y+"").toLowerCase():"text";let x=eet([i,d&&d.toAbortSignal()],p),E,T=x&&x.unsubscribe&&(()=>{x.unsubscribe()}),I;try{if(_&&tFt&&n!=="get"&&n!=="head"&&(I=await iFt(w,l))!==0){let K=new Request(r,{method:"POST",body:l,duplex:"half"}),J;if(ir.isFormData(l)&&(J=K.headers.get("content-type"))&&w.setContentType(J),K.body){let[L,$]=cle(I,u4(dle(_)));l=vle(K.body,tet,L,$)}}ir.isString(S)||(S=S?"include":"omit");let B="credentials"in Request.prototype;E=new Request(r,{...M,signal:x,method:n.toUpperCase(),headers:w.normalize().toJSON(),body:l,duplex:"half",credentials:B?S:void 0});let O=await fetch(E),N=gle&&(y==="stream"||y==="response");if(gle&&(v||N&&T)){let K={};["status","statusText","headers"].forEach(V=>{K[V]=O[V]});let J=ir.toFiniteNumber(O.headers.get("content-length")),[L,$]=v&&cle(J,u4(dle(v),!0))||[];O=new Response(vle(O.body,tet,L,()=>{$&&$(),T&&T()}),K)}y=y||"text";let H=await cL[ir.findKey(cL,y)||"text"](O,e);return!N&&T&&T(),await new Promise((K,J)=>{LM(K,J,{data:H,headers:_s.from(O.headers),status:O.status,statusText:O.statusText,config:e,request:E})})}catch(B){throw T&&T(),B&&B.name==="TypeError"&&/fetch/i.test(B.message)?Object.assign(new ci("Network Error",ci.ERR_NETWORK,e,E),{cause:B.cause||B}):ci.from(B,B&&B.code,e,E)}});var ble={http:oL,xhr:QQe,fetch:net};ir.forEach(ble,(e,r)=>{if(e){try{Object.defineProperty(e,"name",{value:r})}catch{}Object.defineProperty(e,"adapterName",{value:r})}});var aet=e=>`- ${e}`,nFt=e=>ir.isFunction(e)||e===null||e===!1,pL={getAdapter:e=>{e=ir.isArray(e)?e:[e];let{length:r}=e,n,l,i={};for(let d=0;d<r;d++){n=e[d];let p;if(l=n,!nFt(n)&&(l=ble[(p=String(n)).toLowerCase()],l===void 0))throw new ci(`Unknown adapter '${p}'`);if(l)break;i[p||"#"+d]=l}if(!l){let d=Object.entries(i).map(([v,_])=>`adapter ${v} `+(_===!1?"is not supported by the environment":"is not available in the build")),p=r?d.length>1?`since :
246
246
  `+d.map(aet).join(`