@ar.io/sdk 3.2.0-alpha.1 → 3.2.0-alpha.2
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.
- package/README.md +9 -0
- package/bundles/web.bundle.min.js +2 -2
- package/lib/cjs/common/ant.js +7 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +7 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +4 -0
- package/lib/types/types/ant.d.ts +1 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -129,7 +129,7 @@ ${JSON.stringify(Me.from(r))},${JSON.stringify(Me.from(a))},${h} => ${JSON.strin
|
|
|
129
129
|
`)+`
|
|
130
130
|
`)}static register(e,r){if(r||(r=e.locale),d6e)try{let a=window;a._ethers&&a._ethers.wordlists&&(a._ethers.wordlists[r]||ur(a._ethers.wordlists,r,e))}catch{}}};ie();ae();ne();ie();ae();ne();var v6e="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",Jm=null;function HG(t){if(Jm==null&&(Jm=v6e.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Xp.check(t)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw Jm=null,new Error("BIP39 Wordlist for en (English) FAILED")}var ZA=class extends Xp{constructor(){super("en")}getWord(e){return HG(this),Jm[e]}getWordIndex(e){return HG(this),Jm.indexOf(e)}},HA=new ZA;Xp.register(HA);var $3={en:HA};ie();ae();ne();var KG="hdnode/5.7.0";var U3=new er(KG),m6e=nn.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),g6e=Ca("Bitcoin seed"),Xm=2147483648;function VG(t){return(1<<t)-1<<8-t}function b6e(t){return(1<<t)-1}function q3(t){return Ea(sr(t),32)}function WG(t){return jA.encode(Ao([t,Mh(P0(P0(t)),0,4)]))}function KA(t){if(t==null)return $3.en;if(typeof t=="string"){let e=$3[t];return e==null&&U3.throwArgumentError("unknown locale","wordlist",t),e}return t}var Qp={},C0="m/44'/60'/0'/0/0",Ql=class t{constructor(e,r,a,i,h,l,p,b){if(e!==Qp)throw new Error("HDNode constructor cannot be called directly");if(r){let g=new Au(r);ur(this,"privateKey",g.privateKey),ur(this,"publicKey",g.compressedPublicKey)}else ur(this,"privateKey",null),ur(this,"publicKey",sr(a));ur(this,"parentFingerprint",i),ur(this,"fingerprint",Mh(zA(P0(this.publicKey)),0,4)),ur(this,"address",xs(this.publicKey)),ur(this,"chainCode",h),ur(this,"index",l),ur(this,"depth",p),b==null?(ur(this,"mnemonic",null),ur(this,"path",null)):typeof b=="string"?(ur(this,"mnemonic",null),ur(this,"path",b)):(ur(this,"mnemonic",b),ur(this,"path",b.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return WG(Ao([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",sr(this.depth),this.parentFingerprint,Ea(sr(this.index),4),this.chainCode,this.privateKey!=null?Ao(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new t(Qp,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let r=this.path;r&&(r+="/"+(e&~Xm));let a=new Uint8Array(37);if(e&Xm){if(!this.privateKey)throw new Error("cannot derive child of neutered node");a.set(Ct(this.privateKey),1),r&&(r+="'")}else a.set(Ct(this.publicKey));for(let M=24;M>=0;M-=8)a[33+(M>>3)]=e>>24-M&255;let i=Ct(O0(Xl.sha512,this.chainCode,a)),h=i.slice(0,32),l=i.slice(32),p=null,b=null;this.privateKey?p=q3(nn.from(h).add(this.privateKey).mod(m6e)):b=new Au(sr(h))._addPoint(this.publicKey);let g=r,y=this.mnemonic;return y&&(g=Object.freeze({phrase:y.phrase,path:r,locale:y.locale||"en"})),new t(Qp,p,b,this.fingerprint,q3(l),e,this.depth+1,g)}derivePath(e){let r=e.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);r[0]==="m"&&r.shift();let a=this;for(let i=0;i<r.length;i++){let h=r[i];if(h.match(/^[0-9]+'$/)){let l=parseInt(h.substring(0,h.length-1));if(l>=Xm)throw new Error("invalid path index - "+h);a=a._derive(Xm+l)}else if(h.match(/^[0-9]+$/)){let l=parseInt(h);if(l>=Xm)throw new Error("invalid path index - "+h);a=a._derive(l)}else throw new Error("invalid path component - "+h)}return a}static _fromSeed(e,r){let a=Ct(e);if(a.length<16||a.length>64)throw new Error("invalid seed");let i=Ct(O0(Xl.sha512,g6e,a));return new t(Qp,q3(i.slice(0,32)),null,"0x00000000",q3(i.slice(32)),0,0,r)}static fromMnemonic(e,r,a){return a=KA(a),e=Qm(WA(e,a),a),t._fromSeed(y6e(e,r),{phrase:e,path:"m",locale:a.locale})}static fromSeed(e){return t._fromSeed(e,null)}static fromExtendedKey(e){let r=jA.decode(e);(r.length!==82||WG(r.slice(0,78))!==e)&&U3.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");let a=r[4],i=sr(r.slice(5,9)),h=parseInt(sr(r.slice(9,13)).substring(2),16),l=sr(r.slice(13,45)),p=r.slice(45,78);switch(sr(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new t(Qp,null,sr(p),i,l,h,a,null);case"0x0488ade4":case"0x04358394 ":if(p[0]!==0)break;return new t(Qp,sr(p.slice(1)),null,i,l,h,a,null)}return U3.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}};function y6e(t,e){e||(e="");let r=Ca("mnemonic"+e,gu.NFKD);return N0(Ca(t,gu.NFKD),r,2048,64,"sha512")}function WA(t,e){e=KA(e),U3.checkNormalize();let r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");let a=Ct(new Uint8Array(Math.ceil(11*r.length/8))),i=0;for(let g=0;g<r.length;g++){let y=e.getWordIndex(r[g].normalize("NFKD"));if(y===-1)throw new Error("invalid mnemonic");for(let M=0;M<11;M++)y&1<<10-M&&(a[i>>3]|=1<<7-i%8),i++}let h=32*r.length/3,l=r.length/3,p=VG(l);if((Ct(P0(a.slice(0,h/8)))[0]&p)!==(a[a.length-1]&p))throw new Error("invalid checksum");return sr(a.slice(0,h/8))}function Qm(t,e){if(e=KA(e),t=Ct(t),t.length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");let r=[0],a=11;for(let l=0;l<t.length;l++)a>8?(r[r.length-1]<<=8,r[r.length-1]|=t[l],a-=8):(r[r.length-1]<<=a,r[r.length-1]|=t[l]>>8-a,r.push(t[l]&b6e(8-a)),a+=3);let i=t.length/4,h=Ct(P0(t))[0]&VG(i);return r[r.length-1]<<=i,r[r.length-1]|=h>>8-i,e.join(r.map(l=>e.getWord(l)))}ie();ae();ne();ie();ae();ne();ie();ae();ne();var GG="random/5.7.0";var VA=new er(GG);function w6e(){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 YG=w6e(),F3=YG.crypto||YG.msCrypto;(!F3||!F3.getRandomValues)&&(VA.warn("WARNING: Missing strong random number source"),F3={getRandomValues:function(t){return VA.throwError("no secure random source avaialble",er.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function ec(t){(t<=0||t>1024||t%1||t!=t)&&VA.throwArgumentError("invalid length","length",t);let e=new Uint8Array(t);return F3.getRandomValues(e),Ct(e)}ie();ae();ne();ie();ae();ne();var JA=gi(YA());ie();ae();ne();var j3="json-wallets/5.7.0";ie();ae();ne();function Th(t){return typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Ct(t)}function e1(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function eg(t){return typeof t=="string"?Ca(t,gu.NFKC):Ct(t)}function on(t,e){let r=t,a=e.toLowerCase().split("/");for(let i=0;i<a.length;i++){let h=null;for(let l in r)if(l.toLowerCase()===a[i]){h=r[l];break}if(h===null)return null;r=h}return r}function XG(t){let e=Ct(t);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=sr(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}var _6e=new er(j3),XA=class extends T0{isCrowdsaleAccount(e){return!!(e&&e._isCrowdsaleAccount)}};function QA(t,e){let r=JSON.parse(t);e=eg(e);let a=Aa(on(r,"ethaddr")),i=Th(on(r,"encseed"));(!i||i.length%16!==0)&&_6e.throwArgumentError("invalid encseed","json",t);let h=Ct(N0(e,e,2e3,32,"sha256")).slice(0,16),l=i.slice(0,16),p=i.slice(16),b=new JA.default.ModeOfOperation.cbc(h,l),g=JA.default.padding.pkcs7.strip(Ct(b.decrypt(p))),y="";for(let E=0;E<g.length;E++)y+=String.fromCharCode(g[E]);let M=Ca(y),x=rn(M);return new XA({_isCrowdsaleAccount:!0,address:a,privateKey:x})}ie();ae();ne();function eR(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return e.encseed&&e.ethaddr}function tR(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return!(!e.version||parseInt(e.version)!==e.version||parseInt(e.version)!==3)}ie();ae();ne();var kh=gi(YA()),z3=gi(eY());var M6e=function(t,e,r,a){function i(h){return h instanceof r?h:new r(function(l){l(h)})}return new(r||(r=Promise))(function(h,l){function p(y){try{g(a.next(y))}catch(M){l(M)}}function b(y){try{g(a.throw(y))}catch(M){l(M)}}function g(y){y.done?h(y.value):i(y.value).then(p,b)}g((a=a.apply(t,e||[])).next())})},iR=new er(j3);function tY(t){return t!=null&&t.mnemonic&&t.mnemonic.phrase}var nR=class extends T0{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}};function x6e(t,e,r){if(on(t,"crypto/cipher")==="aes-128-ctr"){let i=Th(on(t,"crypto/cipherparams/iv")),h=new kh.default.Counter(i),l=new kh.default.ModeOfOperation.ctr(e,h);return Ct(l.decrypt(r))}return null}function rY(t,e){let r=Th(on(t,"crypto/ciphertext"));if(sr(rn(Ao([e.slice(16,32),r]))).substring(2)!==on(t,"crypto/mac").toLowerCase())throw new Error("invalid password");let i=x6e(t,e.slice(0,16),r);i||iR.throwError("unsupported cipher",er.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});let h=e.slice(32,64),l=xs(i);if(t.address){let b=t.address.toLowerCase();if(b.substring(0,2)!=="0x"&&(b="0x"+b),Aa(b)!==l)throw new Error("address mismatch")}let p={_isKeystoreAccount:!0,address:l,privateKey:sr(i)};if(on(t,"x-ethers/version")==="0.1"){let b=Th(on(t,"x-ethers/mnemonicCiphertext")),g=Th(on(t,"x-ethers/mnemonicCounter")),y=new kh.default.Counter(g),M=new kh.default.ModeOfOperation.ctr(h,y),x=on(t,"x-ethers/path")||C0,E=on(t,"x-ethers/locale")||"en",A=Ct(M.decrypt(b));try{let k=Qm(A,E),P=Ql.fromMnemonic(k,null,E).derivePath(x);if(P.privateKey!=p.privateKey)throw new Error("mnemonic mismatch");p.mnemonic=P.mnemonic}catch(k){if(k.code!==er.errors.INVALID_ARGUMENT||k.argument!=="wordlist")throw k}}return new nR(p)}function iY(t,e,r,a,i){return Ct(N0(t,e,r,a,i))}function S6e(t,e,r,a,i){return Promise.resolve(iY(t,e,r,a,i))}function nY(t,e,r,a,i){let h=eg(e),l=on(t,"crypto/kdf");if(l&&typeof l=="string"){let p=function(b,g){return iR.throwArgumentError("invalid key-derivation function parameters",b,g)};if(l.toLowerCase()==="scrypt"){let b=Th(on(t,"crypto/kdfparams/salt")),g=parseInt(on(t,"crypto/kdfparams/n")),y=parseInt(on(t,"crypto/kdfparams/r")),M=parseInt(on(t,"crypto/kdfparams/p"));(!g||!y||!M)&&p("kdf",l),g&g-1&&p("N",g);let x=parseInt(on(t,"crypto/kdfparams/dklen"));return x!==32&&p("dklen",x),a(h,b,g,y,M,64,i)}else if(l.toLowerCase()==="pbkdf2"){let b=Th(on(t,"crypto/kdfparams/salt")),g=null,y=on(t,"crypto/kdfparams/prf");y==="hmac-sha256"?g="sha256":y==="hmac-sha512"?g="sha512":p("prf",y);let M=parseInt(on(t,"crypto/kdfparams/c")),x=parseInt(on(t,"crypto/kdfparams/dklen"));return x!==32&&p("dklen",x),r(h,b,M,x,g)}}return iR.throwArgumentError("unsupported key-derivation function","kdf",l)}function aY(t,e){let r=JSON.parse(t),a=nY(r,e,iY,z3.default.syncScrypt);return rY(r,a)}function oY(t,e,r){return M6e(this,void 0,void 0,function*(){let a=JSON.parse(t),i=yield nY(a,e,S6e,z3.default.scrypt,r);return rY(a,i)})}function aR(t,e,r,a){try{if(Aa(t.address)!==xs(t.privateKey))throw new Error("address/privateKey mismatch");if(tY(t)){let P=t.mnemonic;if(Ql.fromMnemonic(P.phrase,null,P.locale).derivePath(P.path||C0).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(P){return Promise.reject(P)}typeof r=="function"&&!a&&(a=r,r={}),r||(r={});let i=Ct(t.privateKey),h=eg(e),l=null,p=null,b=null;if(tY(t)){let P=t.mnemonic;l=Ct(WA(P.phrase,P.locale||"en")),p=P.path||C0,b=P.locale||"en"}let g=r.client;g||(g="ethers.js");let y=null;r.salt?y=Ct(r.salt):y=ec(32);let M=null;if(r.iv){if(M=Ct(r.iv),M.length!==16)throw new Error("invalid iv")}else M=ec(16);let x=null;if(r.uuid){if(x=Ct(r.uuid),x.length!==16)throw new Error("invalid uuid")}else x=ec(16);let E=1<<17,A=8,k=1;return r.scrypt&&(r.scrypt.N&&(E=r.scrypt.N),r.scrypt.r&&(A=r.scrypt.r),r.scrypt.p&&(k=r.scrypt.p)),z3.default.scrypt(h,y,E,A,k,64,a).then(P=>{P=Ct(P);let N=P.slice(0,16),L=P.slice(16,32),C=P.slice(32,64),Y=new kh.default.Counter(M),G=new kh.default.ModeOfOperation.ctr(N,Y),ee=Ct(G.encrypt(i)),D=rn(Ao([L,ee])),U={address:t.address.substring(2).toLowerCase(),id:XG(x),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:sr(M).substring(2)},ciphertext:sr(ee).substring(2),kdf:"scrypt",kdfparams:{salt:sr(y).substring(2),n:E,dklen:32,p:k,r:A},mac:D.substring(2)}};if(l){let V=ec(16),_=new kh.default.Counter(V),n=new kh.default.ModeOfOperation.ctr(C,_),s=Ct(n.encrypt(l)),f=new Date,u=f.getUTCFullYear()+"-"+e1(f.getUTCMonth()+1,2)+"-"+e1(f.getUTCDate(),2)+"T"+e1(f.getUTCHours(),2)+"-"+e1(f.getUTCMinutes(),2)+"-"+e1(f.getUTCSeconds(),2)+".0Z";U["x-ethers"]={client:g,gethFilename:"UTC--"+u+"--"+U.address,mnemonicCounter:sr(V).substring(2),mnemonicCiphertext:sr(s).substring(2),path:p,locale:b,version:"0.1"}}return JSON.stringify(U)})}function sY(t,e,r){if(eR(t)){r&&r(0);let a=QA(t,e);return r&&r(1),Promise.resolve(a)}return tR(t)?oY(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function fY(t,e){if(eR(t))return QA(t,e);if(tR(t))return aY(t,e);throw new Error("invalid JSON wallet")}ie();ae();ne();var uY="wallet/5.7.0";var hY=function(t,e,r,a){function i(h){return h instanceof r?h:new r(function(l){l(h)})}return new(r||(r=Promise))(function(h,l){function p(y){try{g(a.next(y))}catch(M){l(M)}}function b(y){try{g(a.throw(y))}catch(M){l(M)}}function g(y){y.done?h(y.value):i(y.value).then(p,b)}g((a=a.apply(t,e||[])).next())})},t1=new er(uY);function E6e(t){return t!=null&&$n(t.privateKey,32)&&t.address!=null}function A6e(t){let e=t.mnemonic;return e&&e.phrase}var r1=class t extends L3{constructor(e,r){if(super(),E6e(e)){let a=new Au(e.privateKey);if(ur(this,"_signingKey",()=>a),ur(this,"address",xs(this.publicKey)),this.address!==Aa(e.address)&&t1.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),A6e(e)){let i=e.mnemonic;ur(this,"_mnemonic",()=>({phrase:i.phrase,path:i.path||C0,locale:i.locale||"en"}));let h=this.mnemonic,l=Ql.fromMnemonic(h.phrase,null,h.locale).derivePath(h.path);xs(l.privateKey)!==this.address&&t1.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ur(this,"_mnemonic",()=>null)}else{if(Au.isSigningKey(e))e.curve!=="secp256k1"&&t1.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ur(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);let a=new Au(e);ur(this,"_signingKey",()=>a)}ur(this,"_mnemonic",()=>null),ur(this,"address",xs(this.publicKey))}r&&!C3.isProvider(r)&&t1.throwArgumentError("invalid provider","provider",r),ur(this,"provider",r||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(e){return new t(this,e)}signTransaction(e){return Sh(e).then(r=>{r.from!=null&&(Aa(r.from)!==this.address&&t1.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);let a=this._signingKey().signDigest(rn(FA(r)));return FA(r,a)})}signMessage(e){return hY(this,void 0,void 0,function*(){return pA(this._signingKey().signDigest(Vl(e)))})}_signTypedData(e,r,a){return hY(this,void 0,void 0,function*(){let i=yield k0.resolveNames(e,r,a,h=>(this.provider==null&&t1.throwError("cannot resolve ENS names without a provider",er.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:h}),this.provider.resolveName(h)));return pA(this._signingKey().signDigest(k0.hash(i.domain,r,i.value)))})}encrypt(e,r,a){if(typeof r=="function"&&!a&&(a=r,r={}),a&&typeof a!="function")throw new Error("invalid callback");return r||(r={}),aR(this,e,r,a)}static createRandom(e){let r=ec(16);e||(e={}),e.extraEntropy&&(r=Ct(Mh(rn(Ao([r,e.extraEntropy])),0,16)));let a=Qm(r,e.locale);return t.fromMnemonic(a,e.path,e.locale)}static fromEncryptedJson(e,r,a){return sY(e,r,a).then(i=>new t(i))}static fromEncryptedJsonSync(e,r){return new t(fY(e,r))}static fromMnemonic(e,r,a){return r||(r=C0),new t(Ql.fromMnemonic(e,null,a).derivePath(r))}};function lY(t,e){return UA(Vl(t),e)}function Z3(t,e,r,a){return UA(k0.hash(t,e,r),a)}var oR=class{signer;publicKey;ownerLength=Wr[wr.ETHEREUM].pubLength;signatureLength=Wr[wr.ETHEREUM].sigLength;signatureType=wr.ETHEREUM;constructor(e){this.signer=e.getSigner()}async setPublicKey(){let e="sign this message to connect to Bundlr.Network",r=await this.signer.signMessage(e),a=await Vl(e),i=N3(Ct(a),r);this.publicKey=Me.from(Ct(i))}async sign(e){this.publicKey||await this.setPublicKey();let r=await this.signer.signMessage(e);return Me.from(r.slice(2),"hex")}static verify(e,r,a){let i=xs(e);return lY(r,a)===i}};ie();ae();ne();var i1=gi(gY(),1),Ih=class extends xo{get publicKey(){return i1.default.decode(this.pk)}get key(){return i1.default.decode(this._key)}constructor(e){let r=i1.default.decode(e);super(i1.default.encode(r.subarray(0,32)),i1.default.encode(r.subarray(32,64)))}};ie();ae();ne();ie();ae();ne();ie();ae();ne();var LX=gi(qo(),1),eT=gi(ER(),1);ie();ae();ne();lo();var kX=gi(TX(),1);function QR(t){return t=IX(t),(0,kX.default)("keccak256").update(t).digest()}function IX(t){if(!Me.isBuffer(t))if(Array.isArray(t))t=Me.from(t);else if(typeof t=="string")BX(t)?t=Me.from(M8(PX(t)),"hex"):t=Me.from(t);else if(typeof t=="number")t=NX(t);else if(typeof t=="bigint")t=z4e(t);else if(t==null)t=Me.allocUnsafe(0);else throw new Error("invalid type");return t}function BX(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function M8(t){if(typeof t!="string")throw new Error(`while padding to even, value must be string, is currently ${typeof t}, while padToEven.`);return t.length%2&&(t=`0${t}`),t}function PX(t){return typeof t!="string"?t:OX(t)?t.slice(2):t}function OX(t){if(typeof t!="string")throw new Error("value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return t.startsWith("0x")}function NX(t){let e=CX(t);return Me.from(M8(e.slice(2)),"hex")}function CX(t){return`0x${t.toString(16)}`}function z4e(t){let e=t.toString(16);return Me.from(M8(e),"hex")}typeof window<"u"&&(window.keccak256=QR);var cg=QR,Z4e={intToBuffer:NX,intToHex:CX,isHexPrefixed:OX,stripHexPrefix:PX,padToEven:M8,isHexString:BX,toBuffer:IX};var Y0=class{_key;ownerLength=Wr[wr.ETHEREUM].pubLength;signatureLength=Wr[wr.ETHEREUM].sigLength;signatureType=wr.ETHEREUM;pk;constructor(e,r){this._key=e,this.pk=r.toString("hex")}get publicKey(){throw new Error("You must implement `publicKey`")}get key(){return Me.from(this._key,"hex")}static async verify(e,r,a){let i=e;typeof e=="string"&&(i=LX.default.toBuffer(e));let h=!1;try{h=eT.default.ecdsaVerify(a,cg(Me.from(r)),i)}catch{}return h}async sign(e){return eT.default.ecdsaSign(cg(Me.from(e)),Me.from(this.key)).signature}};var tT=gi(ER(),1),DX=gi(qo(),1);var Io=class extends Y0{get publicKey(){return Me.from(this.pk,"hex")}constructor(e){e.startsWith("0x")&&(e=e.slice(2));let r=Me.from(e,"hex"),a=tT.default.publicKeyCreate(r,!1);super(e,Me.from(a))}async sign(e){return new r1(this._key).signMessage(e).then(a=>Me.from(a.slice(2),"hex"))}static async verify(e,r,a){return tT.default.ecdsaVerify(a.length===65?a.slice(0,-1):a,Ct(Vl(r)),typeof e=="string"?DX.default.toBuffer(e):e)}};var dg=class extends Io{};ie();ae();ne();var pg=class extends Ih{constructor(e){super(e.replace("ed25519:",""))}};ie();ae();ne();var vg=class extends xo{get publicKey(){return Me.from(this.pk)}get key(){return Me.from(this._key)}constructor(e,r){super(e.subarray(0,32),r)}};ie();ae();ne();var J0=class extends A0{signatureType=4;constructor(e){super(e)}async sign(e){return super.sign(Me.from(Me.from(e).toString("hex")))}static async verify(e,r,a){return super.verify(e,Me.from(Me.from(r).toString("hex")),a)}};ie();ae();ne();var mg=class extends Ih{signatureType=4;constructor(e){super(e)}async sign(e){return super.sign(Me.from(Me.from(e).toString("hex")))}static async verify(e,r,a){return super.verify(e,Me.from(Me.from(r).toString("hex")),a)}};ie();ae();ne();var gg=class extends xo{constructor(e,r){super(e,r)}get publicKey(){return Me.from(this.pk.slice(2),"hex")}get key(){return Me.from(this._key.slice(2),"hex")}};ie();ae();ne();var X0=class{_publicKey;ownerLength=Wr[wr.INJECTEDAPTOS].pubLength;signatureLength=Wr[wr.INJECTEDAPTOS].sigLength;signatureType=wr.INJECTEDAPTOS;pem;provider;constructor(e,r){this.provider=e,this._publicKey=r}get publicKey(){return this._publicKey}async sign(e){if(!this.provider.signMessage)throw new Error("Selected Wallet does not support message signing");let a=(await this.provider.signMessage({message:Me.from(e).toString("hex"),nonce:"bundlr"})).signature;return typeof a=="string"?Me.from(a,"hex"):a.data.toUint8Array()}static async verify(e,r,a){let i=e;return ql(Me.from(a),Me.from(`APTOS
|
|
131
131
|
message: ${Me.from(r).toString("hex")}
|
|
132
|
-
nonce: bundlr`),Me.from(i))}};ie();ae();ne();var Q0=class{_publicKey;ownerLength=Wr[wr.MULTIAPTOS].pubLength;signatureLength=Wr[wr.MULTIAPTOS].sigLength;signatureType=wr.MULTIAPTOS;collectSignatures;provider;constructor(e,r){this._publicKey=e,this.collectSignatures=r}get publicKey(){return this._publicKey}async sign(e){let{signatures:r,bitmap:a}=await this.collectSignatures(e),i=128,h=new Uint8Array([0,0,0,0]),l=new Set;a.forEach(g=>{if(g>=32)throw new Error(`Invalid bit value ${g}.`);if(l.has(g))throw new Error("Duplicated bits detected.");l.add(g);let y=Math.floor(g/8),M=h[y];M|=i>>g%8,h[y]=M});let p=Me.alloc(this.signatureLength),b=0;for(let g=0;g<32;g++)a.includes(g)&&p.set(r[b++],g*64);return p.set(h,this.signatureLength-4),p}static async verify(e,r,a){let h=Wr[wr.MULTIAPTOS].sigLength-4,l=a.slice(0,h),p=a.slice(h),b=!1;for(let g=0;g<32;g++){let y=Math.floor(g/8),M=g-y*8;if((p[y]&128>>M)!==0){let E=l.slice(g*64,(g+1)*64),A=e.slice(g*32,(g+1)*32);await ql(Me.from(E),Me.from(r),Me.from(A))||(b=!0)}}return!b}};ie();ae();ne();var ed=class extends Io{ownerLength=Wr[wr.TYPEDETHEREUM].pubLength;signatureLength=Wr[wr.TYPEDETHEREUM].sigLength;signatureType=wr.TYPEDETHEREUM;address;signer;constructor(e){super(e),this.address="0x"+cg(super.publicKey.slice(1)).slice(-20).toString("hex"),this.signer=new r1(e)}get publicKey(){return Me.from(this.address)}async sign(e){let r=await this.signer._signTypedData(bg,yg,{address:this.address,"Transaction hash":e});return Me.from(r.slice(2),"hex")}static async verify(e,r,a){let i=e.toString(),h=Z3(bg,yg,{address:i,"Transaction hash":r},a);return i.toLowerCase()===h.toLowerCase()}},bg={name:"Bundlr",version:"1"},yg={Bundlr:[{name:"Transaction hash",type:"bytes"},{name:"address",type:"address"}]};ie();ae();ne();var rT=class{ownerLength=Wr[wr.TYPEDETHEREUM].pubLength;signatureLength=Wr[wr.TYPEDETHEREUM].sigLength;signatureType=wr.TYPEDETHEREUM;address;signer;publicKey;constructor(e){this.signer=e.getSigner()}async ready(){this.address=(await this.signer.getAddress()).toString().toLowerCase(),this.publicKey=Me.from(this.address)}async sign(e){let r=await this.signer._signTypedData(bg,yg,{address:this.address,"Transaction hash":e});return Me.from(r.slice(2),"hex")}static verify(e,r,a){let i=e.toString(),h=Z3(bg,yg,{address:i,"Transaction hash":r},a);return i.toLowerCase()===h.toLowerCase()}};ie();ae();ne();var $X=gi(qo(),1);var v1=class{signer;publicKey;ownerLength=Wr[wr.ARWEAVE].pubLength;signatureLength=Wr[wr.ARWEAVE].sigLength;signatureType=wr.ARWEAVE;constructor(e){this.signer=e}async setPublicKey(){let e=await this.signer.getActivePublicKey();this.publicKey=$X.default.toBuffer(e)}async sign(e){this.publicKey||await this.setPublicKey();let r={name:"RSA-PSS",saltLength:32},a=await this.signer.signature(e,r);return new Uint8Array(Object.values(a).map(h=>+h))}static async verify(e,r,a){return await xn().verify(e,r,a)}};ie();ae();ne();var wg=class extends Io{signatureType=wr.KYVE};var _g={1:Hl,2:xo,3:Io,4:J0,5:X0,6:Q0,7:ed};ie();ae();ne();ie();ae();ne();async function H4e(t){return Ul([(0,Pi.stringToBuffer)("dataitem"),(0,Pi.stringToBuffer)("1"),(0,Pi.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}var Mg=H4e;ie();ae();ne();ie();ae();ne();function xg(t,e){let r=new Uint8Array(t);if(e<0)throw new Error("Array is unsigned, cannot represent -ve numbers");if(e>2**(t*8)-1)throw new Error(`Number ${e} is too large for an array of ${t} bytes`);for(let a=0;a<r.length;a++){let i=e&255;r[a]=i,e=(e-i)/256}return r}function x8(t){return xg(8,t)}function iT(t){return xg(2,t)}function K4e(t){return xg(16,t)}function S8(t){return xg(32,t)}function yn(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}ie();ae();ne();var Eg=gi(qo(),1);ie();ae();ne();var Is=gi(qo(),1);lo();ie();ae();ne();var Sg=class{buf;pos;constructor(e=Me.alloc(E8),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,a;if(r)for(this.writeLong(r),a=0;a<r;a++){let i=e[a];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 e=Me.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}writeLong(e){let r=this.buf,a,i;if(e>=-1073741824&&e<1073741824){i=e>=0?e<<1:~e<<1|1;do r[this.pos]=i&127,i>>=7;while(i&&(r[this.pos++]|=128))}else{a=e>=0?e*2:-e*2-1;do r[this.pos]=a&127,a/=128;while(a>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(e){let r=Me.byteLength(e),a=this.buf;this.writeLong(r);let i=this.pos;if(this.pos+=r,!(this.pos>a.length)){if(r>64)this.buf.write(e,this.pos-r,r,"utf8");else{let h,l,p,b;for(h=0,l=r;h<l;h++)p=e.charCodeAt(h),p<128?a[i++]=p:p<2048?(a[i++]=p>>6|192,a[i++]=p&63|128):(p&64512)===55296&&((b=e.charCodeAt(h+1))&64512)===56320?(p=65536+((p&1023)<<10)+(b&1023),h++,a[i++]=p>>18|240,a[i++]=p>>12&63|128,a[i++]=p>>6&63|128,a[i++]=p&63|128):(a[i++]=p>>12|224,a[i++]=p>>6&63|128,a[i++]=p&63|128)}this.buf=a}}readLong(){let e=0,r=0,a=this.buf,i,h,l,p;do i=a[this.pos++],h=i&128,e|=(i&127)<<r,r+=7;while(h&&r<28);if(h){l=e,p=268435456;do i=a[this.pos++],l+=(i&127)*p,p*=128;while(i&128);return(l%2?-(l+1):l)/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 a=this.readString(),i=this.readString();e.push({name:a,value:i})}return e}readString(){let e=this.readLong(),r=this.pos,a=this.buf;if(this.pos+=e,this.pos>a.length)throw new Error("TAP Position out of range");return this.buf.slice(r,r+e).toString()}};function nT(t){if(t?.length===0)return Me.allocUnsafe(0);let e=new Sg;return e.writeTags(t),e.toBuffer()}function m1(t){return new Sg(t).readTags()}du();var R8=80,E8=4096,A8=class t{binary;_id;constructor(e){this.binary=e}static isDataItem(e){return e.binary!==void 0}get signatureType(){let e=yn(this.binary.subarray(0,2));if(wr?.[e]!==void 0)return e;throw new Error("Unknown signature type: "+e)}async isValid(){return t.verify(this.binary)}get id(){return Is.default.encode(this.rawId)}set id(e){this._id=Is.default.toBuffer(e)}get rawId(){return pf("sha256").update(this.rawSignature).digest()}set rawId(e){this._id=e}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Is.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 Wr[this.signatureType].sigLength}get owner(){return Is.default.encode(this.rawOwner)}get ownerLength(){return Wr[this.signatureType].pubLength}get rawTarget(){let e=this.getTargetStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):Me.alloc(0)}get target(){return Is.default.encode(this.rawTarget)}get rawAnchor(){let e=this.getAnchorStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):Me.alloc(0)}get anchor(){return Is.default.encode(this.rawAnchor)}get rawTags(){let e=this.getTagsStart(),r=yn(this.binary.subarray(e+8,e+16));return this.binary.subarray(e+16,e+16+r)}get tags(){let e=this.getTagsStart();if(yn(this.binary.subarray(e,e+8))==0)return[];let a=yn(this.binary.subarray(e+8,e+16));return m1(Me.from(this.binary.subarray(e+16,e+16+a)))}get tagsB64Url(){return this.tags.map(r=>({name:Is.default.encode(r.name),value:Is.default.encode(r.value)}))}getStartOfData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),a=yn(r);return e+16+a}get rawData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),a=yn(r),i=e+16+a;return this.binary.subarray(i,this.binary.length)}get data(){return Is.default.encode(this.rawData)}getRaw(){return this.binary}async sign(e){return this._id=await T8(this,e),this.rawId}async setSignature(e){this.binary.set(e,2),this._id=Me.from(await xn().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:Is.default.encode(e.name),value:Is.default.encode(e.value)})),data:this.data}}static async verify(e){if(e.byteLength<R8)return!1;let r=new t(e),a=r.signatureType,i=r.getTagsStart(),h=yn(e.subarray(i,i+8)),l=e.subarray(i+8,i+16),p=yn(l);if(p>E8)return!1;if(h>0)try{if(m1(Me.from(e.subarray(i+16,i+16+p))).length!==h)return!1}catch{return!1}let b=_g[a],g=await Mg(r);return await b.verify(r.rawOwner,g,r.rawSignature)}async getSignatureData(){return Mg(this)}getTagsStart(){let e=this.getTargetStart(),r=this.binary[e]==1,a=e+(r?33:1),i=this.binary[a]==1;return a+=i?33:1,a}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}},g1=A8;du();var Bu=32,k8=class{length;items;binary;constructor(e){this.binary=e,this.length=this.getDataItemCount(),this.items=this.getItems()}getRaw(){return this.binary}get(e){if(typeof e=="number"){if(e>=this.length)throw new RangeError("Index out of range");return this.getByIndex(e)}else return this.getById(e)}getSizes(){let e=[];for(let r=Bu;r<Bu+64*this.length;r+=64)e.push(yn(this.binary.subarray(r,r+32)));return e}getIds(){let e=[];for(let r=Bu;r<Bu+64*this.length;r+=64){let a=this.binary.subarray(r+32,r+64);if(a.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");e.push(Eg.default.encode(a))}return e}getIdBy(e){if(e>this.length-1)throw new RangeError("Index of bundle out of range");let r=64+64*e;return Eg.default.encode(this.binary.subarray(r,r+32))}async toTransaction(e,r,a){let i=await r.createTransaction({data:this.binary,...e},a);return i.addTag("Bundle-Format","binary"),i.addTag("Bundle-Version","2.0.0"),i}async verify(){for(let e of this.items){let r=await e.isValid(),a=(0,Eg.default)(pf("sha256").update(e.rawSignature).digest());if(!(r&&e.id===a))return!1}return!0}getOffset(e){let r=0;for(let a=Bu;a<Bu+64*this.length;a+=64){let i=yn(this.binary.subarray(a,a+32));r+=i;let h=this.binary.subarray(a+32,a+64);if(Me.compare(h,e)===0)return{startOffset:r,size:i}}return{startOffset:-1,size:-1}}getByIndex(e){let r=0,a=this.getBundleStart(),i=0,h,l;for(let y=Bu;y<Bu+64*this.length;y+=64){if(h=yn(this.binary.subarray(y,y+32)),i++===e){l=this.binary.subarray(y+32,y+64);break}r+=h}let p=a+r,b=this.binary.subarray(p,p+h),g=new g1(b);return g.rawId=l,g}getById(e){let r=Eg.default.toBuffer(e),a=this.getOffset(r);if(a.startOffset===-1)throw new Error("Transaction not found");let h=this.getBundleStart()+a.startOffset;return new g1(this.binary.subarray(h,h+a.size))}getDataItemCount(){return yn(this.binary.subarray(0,32))}getBundleStart(){return 32+64*this.length}getItems(){let e=new Array(this.length),r=0,a=this.getBundleStart(),i=0;for(let h=Bu;h<Bu+64*this.length;h+=64){let l=yn(this.binary.subarray(h,h+32)),p=this.binary.subarray(h+32,h+64);if(p.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");let b=a+r,g=this.binary.subarray(b,b+l);r+=l;let y=new g1(g);y.rawId=p,e[i]=y,i++}return e}},aT=k8;function W4e(t){return new aT(t)}async function V4e(t,e){let r=new Uint8Array(64*t.length),a=await Promise.all(t.map(async(h,l)=>{let p=h.isSigned()?h.rawId:await T8(h,e),b=new Uint8Array(64);return b.set(S8(h.getRaw().byteLength),0),b.set(p,32),r.set(b,64*l),h.getRaw()})).then(h=>Me.concat(h)),i=Me.concat([Me.from(S8(t.length)),Me.from(r),a]);return new aT(i)}async function qX(t,e){let r=await Mg(t),a=await e.sign(r),i=await xn().hash(a);return{signature:Me.from(a),id:Me.from(i)}}async function T8(t,e){let{signature:r,id:a}=await qX(t,e);return t.getRaw().set(r,2),a}ie();ae();ne();var UX=gi(qo(),1);function Ag(t,e,r){let a=e.publicKey,i=r?.target?UX.default.toBuffer(r.target):null,h=1+(i?.byteLength??0),l=r?.anchor?Me.from(r.anchor):null,p=1+(l?.byteLength??0),b=(r?.tags?.length??0)>0?nT(r?.tags):null,g=16+(b?b.byteLength:0),y=typeof t=="string"?Me.from(t):Me.from(t),M=y.byteLength,x=2+e.signatureLength+e.ownerLength+h+p+g+M,E=Me.alloc(x);if(E.set(iT(e.signatureType),0),E.set(new Uint8Array(e.signatureLength).fill(0),2),a.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${a.byteLength}`);E.set(a,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(E[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);E.set(i,A+1)}let k=A+h,P=k+1;if(E[k]=l?1:0,l){if(P+=l.byteLength,l.byteLength!==32)throw new Error("Anchor must be 32 bytes");E.set(l,k+1)}E.set(x8(r?.tags?.length??0),P);let N=x8(b?.byteLength??0);E.set(N,P+8),b&&E.set(b,P+16);let L=P+g;return E.set(y,L),new g1(E)}ie();ae();ne();ie();ae();ne();var oT=class{signatureType;rawSignature;signature;signatureLength;rawOwner;owner;ownerLength;rawTarget;target;rawAnchor;anchor;rawTags;tags;rawData;data;static async verify(...e){throw new Error("You must implement `verify`")}};ie();ae();ne();ie();ae();ne();var hT={};Ha(hT,{default:()=>J4e,processStream:()=>HX,streamExportForTesting:()=>X4e,streamSigner:()=>Y4e});ie();ae();ne();I8();var td=gi(qo(),1);du();async function HX(t){let e=KX(t),r=(await e.next()).value;r=await La(e,r,32);let a=yn(r.subarray(0,32));r=r.subarray(32);let i=64*a;r=await La(e,r,i);let h=new Array(a);for(let b=0;b<i;b+=64)h[b/64]=[yn(r.subarray(b,b+32)),(0,td.default)(Me.from(r.subarray(b+32,b+64)))];r=r.subarray(i);let l=32+i,p=[];for(let[b,g]of h){r=await La(e,r,R8),r=await La(e,r,2);let y=yn(r.subarray(0,2));r=r.subarray(2);let{sigLength:M,pubLength:x,sigName:E}=Wr[y];r=await La(e,r,M);let A=r.subarray(0,M);r=r.subarray(M),r=await La(e,r,x);let k=r.subarray(0,x);r=r.subarray(x),r=await La(e,r,1);let P=r[0]===1;P&&(r=await La(e,r,33));let N=P?r.subarray(1,33):Me.allocUnsafe(0);r=r.subarray(P?33:1),r=await La(e,r,1);let L=r[0]===1;L&&(r=await La(e,r,33));let C=L?r.subarray(1,33):Me.allocUnsafe(0);r=r.subarray(L?33:1),r=await La(e,r,8);let Y=yn(r.subarray(0,8));r=r.subarray(8),r=await La(e,r,8);let G=yn(r.subarray(0,8));r=r.subarray(8),r=await La(e,r,G);let ee=r.subarray(0,G),D=Y!==0&&G!==0?m1(Me.from(ee)):[];if(D.length!==Y)throw new Error("Tags lengths don't match");r=r.subarray(G);let U=new zX;U._transform=function(f,u,c){this.push(f),c()};let V=Ul([(0,Pi.stringToBuffer)("dataitem"),(0,Pi.stringToBuffer)("1"),(0,Pi.stringToBuffer)(y.toString()),k,N,C,ee,U]),_=2+M+x+(P?33:1)+(L?33:1)+16+G,n=b-_;if(r.byteLength>n)U.write(r.subarray(0,n)),r=r.subarray(n);else{let f=r.byteLength;for(U.write(r);n>f;){if(r=(await e.next()).value,!r)throw new Error(`Not enough data bytes expected: ${n} received: ${f}`);f+=r.byteLength,f>n?U.write(r.subarray(0,r.byteLength-(f-n))):U.write(r)}r=r.subarray(r.byteLength-(f-n))}if(U.end(),g!==(0,td.default)(pf("sha256").update(A).digest()))throw new Error("ID doesn't match signature");if(!await _g[y].verify(k,await V,A))throw new Error("Invalid signature");p.push({id:g,sigName:E,signature:(0,td.default)(Me.from(A)),target:(0,td.default)(Me.from(N)),anchor:(0,td.default)(Me.from(C)),owner:(0,td.default)(Me.from(k)),tags:D,dataOffset:l+_,dataSize:n}),l+=_+n}return p}async function Y4e(t,e,r,a){let i=Ag("",r,a),h=new ZX,l=[(0,Pi.stringToBuffer)("dataitem"),(0,Pi.stringToBuffer)("1"),(0,Pi.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,t],p=await Ul(l),b=Me.from(await r.sign(p));return i.setSignature(b),h.write(i.getRaw()),e.pipe(h)}async function La(t,e,r){if(e.byteLength>=r)return e;let{done:a,value:i}=await t.next();if(a&&!i)throw new Error("Invalid buffer");return La(t,Me.concat([Me.from(e),Me.from(i)]),r)}async function*KX(t){for await(let e of t)yield e}var J4e=HX,X4e={readBytes:La,getReader:KX};var Q4e={...sT,stream:hT};globalThis.arbundles??=Q4e;ie();ae();ne();ie();ae();ne();ie();ae();ne();ie();ae();ne();var fi;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let h={};for(let l of i)h[l]=l;return h},t.getValidEnumValues=i=>{let h=t.objectKeys(i).filter(p=>typeof i[i[p]]!="number"),l={};for(let p of h)l[p]=i[p];return t.objectValues(l)},t.objectValues=i=>t.objectKeys(i).map(function(h){return i[h]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let h=[];for(let l in i)Object.prototype.hasOwnProperty.call(i,l)&&h.push(l);return h},t.find=(i,h)=>{for(let l of i)if(h(l))return l},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function a(i,h=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(h)}t.joinValues=a,t.jsonStringifyReplacer=(i,h)=>typeof h=="bigint"?h.toString():h})(fi||(fi={}));var cT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(cT||(cT={}));var Yt=fi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),lc=t=>{switch(typeof t){case"undefined":return Yt.undefined;case"string":return Yt.string;case"number":return isNaN(t)?Yt.nan:Yt.number;case"boolean":return Yt.boolean;case"function":return Yt.function;case"bigint":return Yt.bigint;case"symbol":return Yt.symbol;case"object":return Array.isArray(t)?Yt.array:t===null?Yt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Yt.promise:typeof Map<"u"&&t instanceof Map?Yt.map:typeof Set<"u"&&t instanceof Set?Yt.set:typeof Date<"u"&&t instanceof Date?Yt.date:Yt.object;default:return Yt.unknown}},Pt=fi.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"]),ewe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Bo=class t extends Error{constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(h){return h.message},a={_errors:[]},i=h=>{for(let l of h.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)a._errors.push(r(l));else{let p=a,b=0;for(;b<l.path.length;){let g=l.path[b];b===l.path.length-1?(p[g]=p[g]||{_errors:[]},p[g]._errors.push(r(l))):p[g]=p[g]||{_errors:[]},p=p[g],b++}}};return i(this),a}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fi.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},a=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):a.push(e(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};Bo.create=t=>new Bo(t);var w1=(t,e)=>{let r;switch(t.code){case Pt.invalid_type:t.received===Yt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Pt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,fi.jsonStringifyReplacer)}`;break;case Pt.unrecognized_keys:r=`Unrecognized key(s) in object: ${fi.joinValues(t.keys,", ")}`;break;case Pt.invalid_union:r="Invalid input";break;case Pt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${fi.joinValues(t.options)}`;break;case Pt.invalid_enum_value:r=`Invalid enum value. Expected ${fi.joinValues(t.options)}, received '${t.received}'`;break;case Pt.invalid_arguments:r="Invalid function arguments";break;case Pt.invalid_return_type:r="Invalid function return type";break;case Pt.invalid_date:r="Invalid date";break;case Pt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:fi.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Pt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Pt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Pt.custom:r="Invalid input";break;case Pt.invalid_intersection_types:r="Intersection results could not be merged";break;case Pt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Pt.not_finite:r="Number must be finite";break;default:r=e.defaultError,fi.assertNever(t)}return{message:r}},GX=w1;function twe(t){GX=t}function B8(){return GX}var P8=t=>{let{data:e,path:r,errorMaps:a,issueData:i}=t,h=[...r,...i.path||[]],l={...i,path:h};if(i.message!==void 0)return{...i,path:h,message:i.message};let p="",b=a.filter(g=>!!g).slice().reverse();for(let g of b)p=g(l,{data:e,defaultError:p}).message;return{...i,path:h,message:p}},rwe=[];function Wt(t,e){let r=B8(),a=P8({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===w1?void 0:w1].filter(i=>!!i)});t.common.issues.push(a)}var Ia=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let a=[];for(let i of r){if(i.status==="aborted")return pr;i.status==="dirty"&&e.dirty(),a.push(i.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let i of r){let h=await i.key,l=await i.value;a.push({key:h,value:l})}return t.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let i of r){let{key:h,value:l}=i;if(h.status==="aborted"||l.status==="aborted")return pr;h.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),h.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(a[h.value]=l.value)}return{status:e.value,value:a}}},pr=Object.freeze({status:"aborted"}),y1=t=>({status:"dirty",value:t}),Da=t=>({status:"valid",value:t}),dT=t=>t.status==="aborted",pT=t=>t.status==="dirty",Ig=t=>t.status==="valid",Bg=t=>typeof Promise<"u"&&t instanceof Promise;function O8(t,e,r,a){if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?a:r==="a"?a.call(t):a?a.value:e.get(t)}function YX(t,e,r,a,i){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}var rr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(rr||(rr={}));var Tg,kg,Ps=class{constructor(e,r,a,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,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}},WX=(t,e)=>{if(Ig(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Bo(t.common.issues);return this._error=r,this._error}}};function Br(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:i}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(l,p)=>{var b,g;let{message:y}=t;return l.code==="invalid_enum_value"?{message:y??p.defaultError}:typeof p.data>"u"?{message:(b=y??a)!==null&&b!==void 0?b:p.defaultError}:l.code!=="invalid_type"?{message:p.defaultError}:{message:(g=y??r)!==null&&g!==void 0?g:p.defaultError}},description:i}}var Pr=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,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)}get description(){return this._def.description}_getType(e){return lc(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:lc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ia,ctx:{common:e.parent.common,data:e.data,parsedType:lc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Bg(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let a=this.safeParse(e,r);if(a.success)return a.data;throw a.error}safeParse(e,r){var a;let i={common:{issues:[],async:(a=r?.async)!==null&&a!==void 0?a:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:lc(e)},h=this._parseSync({data:e,path:i.path,parent:i});return WX(i,h)}async parseAsync(e,r){let a=await this.safeParseAsync(e,r);if(a.success)return a.data;throw a.error}async safeParseAsync(e,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:lc(e)},i=this._parse({data:e,path:a.path,parent:a}),h=await(Bg(i)?i:Promise.resolve(i));return WX(a,h)}refine(e,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,h)=>{let l=e(i),p=()=>h.addIssue({code:Pt.custom,...a(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(b=>b?!0:(p(),!1)):l?!0:(p(),!1)})}refinement(e,r){return this._refinement((a,i)=>e(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(e){return new Po({schema:this,typeName:lr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Bs.create(this,this._def)}nullable(){return Ou.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lh.create(this,this._def)}promise(){return pc.create(this,this._def)}or(e){return fd.create([this,e],this._def)}and(e){return ud.create(this,e,this._def)}transform(e){return new Po({...Br(this._def),schema:this,typeName:lr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new pd({...Br(this._def),innerType:this,defaultValue:r,typeName:lr.ZodDefault})}brand(){return new Pg({typeName:lr.ZodBranded,type:this,...Br(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new vd({...Br(this._def),innerType:this,catchValue:r,typeName:lr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Og.create(this,e)}readonly(){return md.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},iwe=/^c[^\s-]{8,}$/i,nwe=/^[0-9a-z]+$/,awe=/^[0-9A-HJKMNP-TV-Z]{26}$/,owe=/^[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,swe=/^[a-z0-9_-]{21}$/i,fwe=/^[-+]?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)?)??$/,uwe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hwe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lT,lwe=/^(?:(?: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])$/,cwe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,dwe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JX="((\\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])))",pwe=new RegExp(`^${JX}$`);function XX(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function vwe(t){return new RegExp(`^${XX(t)}$`)}function QX(t){let e=`${JX}T${XX(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mwe(t,e){return!!((e==="v4"||!e)&&lwe.test(t)||(e==="v6"||!e)&&cwe.test(t))}var cc=class t extends Pr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Yt.string){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_type,expected:Yt.string,received:h.parsedType}),pr}let a=new Ia,i;for(let h of this._def.checks)if(h.kind==="min")e.data.length<h.value&&(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),a.dirty());else if(h.kind==="max")e.data.length>h.value&&(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),a.dirty());else if(h.kind==="length"){let l=e.data.length>h.value,p=e.data.length<h.value;(l||p)&&(i=this._getOrReturnCtx(e,i),l?Wt(i,{code:Pt.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}):p&&Wt(i,{code:Pt.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}),a.dirty())}else if(h.kind==="email")uwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"email",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="emoji")lT||(lT=new RegExp(hwe,"u")),lT.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"emoji",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="uuid")owe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"uuid",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="nanoid")swe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"nanoid",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="cuid")iwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"cuid",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="cuid2")nwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"cuid2",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="ulid")awe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"ulid",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Wt(i,{validation:"url",code:Pt.invalid_string,message:h.message}),a.dirty()}else h.kind==="regex"?(h.regex.lastIndex=0,h.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"regex",code:Pt.invalid_string,message:h.message}),a.dirty())):h.kind==="trim"?e.data=e.data.trim():h.kind==="includes"?e.data.includes(h.value,h.position)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:{includes:h.value,position:h.position},message:h.message}),a.dirty()):h.kind==="toLowerCase"?e.data=e.data.toLowerCase():h.kind==="toUpperCase"?e.data=e.data.toUpperCase():h.kind==="startsWith"?e.data.startsWith(h.value)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:{startsWith:h.value},message:h.message}),a.dirty()):h.kind==="endsWith"?e.data.endsWith(h.value)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:{endsWith:h.value},message:h.message}),a.dirty()):h.kind==="datetime"?QX(h).test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:"datetime",message:h.message}),a.dirty()):h.kind==="date"?pwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:"date",message:h.message}),a.dirty()):h.kind==="time"?vwe(h).test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:"time",message:h.message}),a.dirty()):h.kind==="duration"?fwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"duration",code:Pt.invalid_string,message:h.message}),a.dirty()):h.kind==="ip"?mwe(e.data,h.version)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"ip",code:Pt.invalid_string,message:h.message}),a.dirty()):h.kind==="base64"?dwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"base64",code:Pt.invalid_string,message:h.message}),a.dirty()):fi.assertNever(h);return{status:a.value,value:e.data}}_regex(e,r,a){return this.refinement(i=>e.test(i),{validation:r,code:Pt.invalid_string,...rr.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...rr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...rr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...rr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...rr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...rr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...rr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...rr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...rr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...rr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...rr.errToObj(e)})}datetime(e){var r,a;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(a=e?.local)!==null&&a!==void 0?a:!1,...rr.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...rr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...rr.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...rr.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...rr.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...rr.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...rr.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...rr.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...rr.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...rr.errToObj(r)})}nonempty(e){return this.min(1,rr.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};cc.create=t=>{var e;return new cc({checks:[],typeName:lr.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Br(t)})};function gwe(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,i=r>a?r:a,h=parseInt(t.toFixed(i).replace(".","")),l=parseInt(e.toFixed(i).replace(".",""));return h%l/Math.pow(10,i)}var rd=class t extends Pr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Yt.number){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_type,expected:Yt.number,received:h.parsedType}),pr}let a,i=new Ia;for(let h of this._def.checks)h.kind==="int"?fi.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.invalid_type,expected:"integer",received:"float",message:h.message}),i.dirty()):h.kind==="min"?(h.inclusive?e.data<h.value:e.data<=h.value)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.too_small,minimum:h.value,type:"number",inclusive:h.inclusive,exact:!1,message:h.message}),i.dirty()):h.kind==="max"?(h.inclusive?e.data>h.value:e.data>=h.value)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.too_big,maximum:h.value,type:"number",inclusive:h.inclusive,exact:!1,message:h.message}),i.dirty()):h.kind==="multipleOf"?gwe(e.data,h.value)!==0&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.not_multiple_of,multipleOf:h.value,message:h.message}),i.dirty()):h.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.not_finite,message:h.message}),i.dirty()):fi.assertNever(h);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,rr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,rr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,rr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,rr.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:rr.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:rr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:rr.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:rr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rr.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&fi.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(r)&&Number.isFinite(e)}};rd.create=t=>new rd({checks:[],typeName:lr.ZodNumber,coerce:t?.coerce||!1,...Br(t)});var id=class t extends Pr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Yt.bigint){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_type,expected:Yt.bigint,received:h.parsedType}),pr}let a,i=new Ia;for(let h of this._def.checks)h.kind==="min"?(h.inclusive?e.data<h.value:e.data<=h.value)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.too_small,type:"bigint",minimum:h.value,inclusive:h.inclusive,message:h.message}),i.dirty()):h.kind==="max"?(h.inclusive?e.data>h.value:e.data>=h.value)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.too_big,type:"bigint",maximum:h.value,inclusive:h.inclusive,message:h.message}),i.dirty()):h.kind==="multipleOf"?e.data%h.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.not_multiple_of,multipleOf:h.value,message:h.message}),i.dirty()):fi.assertNever(h);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,rr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,rr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,rr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,rr.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:rr.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:rr.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};id.create=t=>{var e;return new id({checks:[],typeName:lr.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Br(t)})};var nd=class extends Pr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Yt.boolean){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.boolean,received:a.parsedType}),pr}return Da(e.data)}};nd.create=t=>new nd({typeName:lr.ZodBoolean,coerce:t?.coerce||!1,...Br(t)});var ad=class t extends Pr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Yt.date){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_type,expected:Yt.date,received:h.parsedType}),pr}if(isNaN(e.data.getTime())){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_date}),pr}let a=new Ia,i;for(let h of this._def.checks)h.kind==="min"?e.data.getTime()<h.value&&(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.too_small,message:h.message,inclusive:!0,exact:!1,minimum:h.value,type:"date"}),a.dirty()):h.kind==="max"?e.data.getTime()>h.value&&(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.too_big,message:h.message,inclusive:!0,exact:!1,maximum:h.value,type:"date"}),a.dirty()):fi.assertNever(h);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:rr.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:rr.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};ad.create=t=>new ad({checks:[],coerce:t?.coerce||!1,typeName:lr.ZodDate,...Br(t)});var _1=class extends Pr{_parse(e){if(this._getType(e)!==Yt.symbol){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.symbol,received:a.parsedType}),pr}return Da(e.data)}};_1.create=t=>new _1({typeName:lr.ZodSymbol,...Br(t)});var od=class extends Pr{_parse(e){if(this._getType(e)!==Yt.undefined){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.undefined,received:a.parsedType}),pr}return Da(e.data)}};od.create=t=>new od({typeName:lr.ZodUndefined,...Br(t)});var sd=class extends Pr{_parse(e){if(this._getType(e)!==Yt.null){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.null,received:a.parsedType}),pr}return Da(e.data)}};sd.create=t=>new sd({typeName:lr.ZodNull,...Br(t)});var dc=class extends Pr{constructor(){super(...arguments),this._any=!0}_parse(e){return Da(e.data)}};dc.create=t=>new dc({typeName:lr.ZodAny,...Br(t)});var Ch=class extends Pr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Da(e.data)}};Ch.create=t=>new Ch({typeName:lr.ZodUnknown,...Br(t)});var Tf=class extends Pr{_parse(e){let r=this._getOrReturnCtx(e);return Wt(r,{code:Pt.invalid_type,expected:Yt.never,received:r.parsedType}),pr}};Tf.create=t=>new Tf({typeName:lr.ZodNever,...Br(t)});var M1=class extends Pr{_parse(e){if(this._getType(e)!==Yt.undefined){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.void,received:a.parsedType}),pr}return Da(e.data)}};M1.create=t=>new M1({typeName:lr.ZodVoid,...Br(t)});var Lh=class t extends Pr{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),i=this._def;if(r.parsedType!==Yt.array)return Wt(r,{code:Pt.invalid_type,expected:Yt.array,received:r.parsedType}),pr;if(i.exactLength!==null){let l=r.data.length>i.exactLength.value,p=r.data.length<i.exactLength.value;(l||p)&&(Wt(r,{code:l?Pt.too_big:Pt.too_small,minimum:p?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Wt(r,{code:Pt.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Wt(r,{code:Pt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((l,p)=>i.type._parseAsync(new Ps(r,l,r.path,p)))).then(l=>Ia.mergeArray(a,l));let h=[...r.data].map((l,p)=>i.type._parseSync(new Ps(r,l,r.path,p)));return Ia.mergeArray(a,h)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:rr.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:rr.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:rr.toString(r)}})}nonempty(e){return this.min(1,e)}};Lh.create=(t,e)=>new Lh({type:t,minLength:null,maxLength:null,exactLength:null,typeName:lr.ZodArray,...Br(e)});function b1(t){if(t instanceof ao){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=Bs.create(b1(a))}return new ao({...t._def,shape:()=>e})}else return t instanceof Lh?new Lh({...t._def,type:b1(t.element)}):t instanceof Bs?Bs.create(b1(t.unwrap())):t instanceof Ou?Ou.create(b1(t.unwrap())):t instanceof Pu?Pu.create(t.items.map(e=>b1(e))):t}var ao=class t extends Pr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=fi.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Yt.object){let g=this._getOrReturnCtx(e);return Wt(g,{code:Pt.invalid_type,expected:Yt.object,received:g.parsedType}),pr}let{status:a,ctx:i}=this._processInputParams(e),{shape:h,keys:l}=this._getCached(),p=[];if(!(this._def.catchall instanceof Tf&&this._def.unknownKeys==="strip"))for(let g in i.data)l.includes(g)||p.push(g);let b=[];for(let g of l){let y=h[g],M=i.data[g];b.push({key:{status:"valid",value:g},value:y._parse(new Ps(i,M,i.path,g)),alwaysSet:g in i.data})}if(this._def.catchall instanceof Tf){let g=this._def.unknownKeys;if(g==="passthrough")for(let y of p)b.push({key:{status:"valid",value:y},value:{status:"valid",value:i.data[y]}});else if(g==="strict")p.length>0&&(Wt(i,{code:Pt.unrecognized_keys,keys:p}),a.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let g=this._def.catchall;for(let y of p){let M=i.data[y];b.push({key:{status:"valid",value:y},value:g._parse(new Ps(i,M,i.path,y)),alwaysSet:y in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let g=[];for(let y of b){let M=await y.key,x=await y.value;g.push({key:M,value:x,alwaysSet:y.alwaysSet})}return g}).then(g=>Ia.mergeObjectSync(a,g)):Ia.mergeObjectSync(a,b)}get shape(){return this._def.shape()}strict(e){return rr.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{var i,h,l,p;let b=(l=(h=(i=this._def).errorMap)===null||h===void 0?void 0:h.call(i,r,a).message)!==null&&l!==void 0?l:a.defaultError;return r.code==="unrecognized_keys"?{message:(p=rr.errToObj(e).message)!==null&&p!==void 0?p:b}:{message:b}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:lr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return fi.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(r[a]=this.shape[a])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return fi.objectKeys(this.shape).forEach(a=>{e[a]||(r[a]=this.shape[a])}),new t({...this._def,shape:()=>r})}deepPartial(){return b1(this)}partial(e){let r={};return fi.objectKeys(this.shape).forEach(a=>{let i=this.shape[a];e&&!e[a]?r[a]=i:r[a]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return fi.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])r[a]=this.shape[a];else{let h=this.shape[a];for(;h instanceof Bs;)h=h._def.innerType;r[a]=h}}),new t({...this._def,shape:()=>r})}keyof(){return eQ(fi.objectKeys(this.shape))}};ao.create=(t,e)=>new ao({shape:()=>t,unknownKeys:"strip",catchall:Tf.create(),typeName:lr.ZodObject,...Br(e)});ao.strictCreate=(t,e)=>new ao({shape:()=>t,unknownKeys:"strict",catchall:Tf.create(),typeName:lr.ZodObject,...Br(e)});ao.lazycreate=(t,e)=>new ao({shape:t,unknownKeys:"strip",catchall:Tf.create(),typeName:lr.ZodObject,...Br(e)});var fd=class extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function i(h){for(let p of h)if(p.result.status==="valid")return p.result;for(let p of h)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let l=h.map(p=>new Bo(p.ctx.common.issues));return Wt(r,{code:Pt.invalid_union,unionErrors:l}),pr}if(r.common.async)return Promise.all(a.map(async h=>{let l={...r,common:{...r.common,issues:[]},parent:null};return{result:await h._parseAsync({data:r.data,path:r.path,parent:l}),ctx:l}})).then(i);{let h,l=[];for(let b of a){let g={...r,common:{...r.common,issues:[]},parent:null},y=b._parseSync({data:r.data,path:r.path,parent:g});if(y.status==="valid")return y;y.status==="dirty"&&!h&&(h={result:y,ctx:g}),g.common.issues.length&&l.push(g.common.issues)}if(h)return r.common.issues.push(...h.ctx.common.issues),h.result;let p=l.map(b=>new Bo(b));return Wt(r,{code:Pt.invalid_union,unionErrors:p}),pr}}get options(){return this._def.options}};fd.create=(t,e)=>new fd({options:t,typeName:lr.ZodUnion,...Br(e)});var Nh=t=>t instanceof hd?Nh(t.schema):t instanceof Po?Nh(t.innerType()):t instanceof ld?[t.value]:t instanceof cd?t.options:t instanceof dd?fi.objectValues(t.enum):t instanceof pd?Nh(t._def.innerType):t instanceof od?[void 0]:t instanceof sd?[null]:t instanceof Bs?[void 0,...Nh(t.unwrap())]:t instanceof Ou?[null,...Nh(t.unwrap())]:t instanceof Pg||t instanceof md?Nh(t.unwrap()):t instanceof vd?Nh(t._def.innerType):[],N8=class t extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Yt.object)return Wt(r,{code:Pt.invalid_type,expected:Yt.object,received:r.parsedType}),pr;let a=this.discriminator,i=r.data[a],h=this.optionsMap.get(i);return h?r.common.async?h._parseAsync({data:r.data,path:r.path,parent:r}):h._parseSync({data:r.data,path:r.path,parent:r}):(Wt(r,{code:Pt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),pr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let i=new Map;for(let h of r){let l=Nh(h.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of l){if(i.has(p))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(p)}`);i.set(p,h)}}return new t({typeName:lr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Br(a)})}};function vT(t,e){let r=lc(t),a=lc(e);if(t===e)return{valid:!0,data:t};if(r===Yt.object&&a===Yt.object){let i=fi.objectKeys(e),h=fi.objectKeys(t).filter(p=>i.indexOf(p)!==-1),l={...t,...e};for(let p of h){let b=vT(t[p],e[p]);if(!b.valid)return{valid:!1};l[p]=b.data}return{valid:!0,data:l}}else if(r===Yt.array&&a===Yt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let h=0;h<t.length;h++){let l=t[h],p=e[h],b=vT(l,p);if(!b.valid)return{valid:!1};i.push(b.data)}return{valid:!0,data:i}}else return r===Yt.date&&a===Yt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ud=class extends Pr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=(h,l)=>{if(dT(h)||dT(l))return pr;let p=vT(h.value,l.value);return p.valid?((pT(h)||pT(l))&&r.dirty(),{status:r.value,value:p.data}):(Wt(a,{code:Pt.invalid_intersection_types}),pr)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([h,l])=>i(h,l)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};ud.create=(t,e,r)=>new ud({left:t,right:e,typeName:lr.ZodIntersection,...Br(r)});var Pu=class t extends Pr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Yt.array)return Wt(a,{code:Pt.invalid_type,expected:Yt.array,received:a.parsedType}),pr;if(a.data.length<this._def.items.length)return Wt(a,{code:Pt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pr;!this._def.rest&&a.data.length>this._def.items.length&&(Wt(a,{code:Pt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let h=[...a.data].map((l,p)=>{let b=this._def.items[p]||this._def.rest;return b?b._parse(new Ps(a,l,a.path,p)):null}).filter(l=>!!l);return a.common.async?Promise.all(h).then(l=>Ia.mergeArray(r,l)):Ia.mergeArray(r,h)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Pu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pu({items:t,typeName:lr.ZodTuple,rest:null,...Br(e)})};var C8=class t extends Pr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Yt.object)return Wt(a,{code:Pt.invalid_type,expected:Yt.object,received:a.parsedType}),pr;let i=[],h=this._def.keyType,l=this._def.valueType;for(let p in a.data)i.push({key:h._parse(new Ps(a,p,a.path,p)),value:l._parse(new Ps(a,a.data[p],a.path,p)),alwaysSet:p in a.data});return a.common.async?Ia.mergeObjectAsync(r,i):Ia.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof Pr?new t({keyType:e,valueType:r,typeName:lr.ZodRecord,...Br(a)}):new t({keyType:cc.create(),valueType:e,typeName:lr.ZodRecord,...Br(r)})}},x1=class extends Pr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Yt.map)return Wt(a,{code:Pt.invalid_type,expected:Yt.map,received:a.parsedType}),pr;let i=this._def.keyType,h=this._def.valueType,l=[...a.data.entries()].map(([p,b],g)=>({key:i._parse(new Ps(a,p,a.path,[g,"key"])),value:h._parse(new Ps(a,b,a.path,[g,"value"]))}));if(a.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let b of l){let g=await b.key,y=await b.value;if(g.status==="aborted"||y.status==="aborted")return pr;(g.status==="dirty"||y.status==="dirty")&&r.dirty(),p.set(g.value,y.value)}return{status:r.value,value:p}})}else{let p=new Map;for(let b of l){let g=b.key,y=b.value;if(g.status==="aborted"||y.status==="aborted")return pr;(g.status==="dirty"||y.status==="dirty")&&r.dirty(),p.set(g.value,y.value)}return{status:r.value,value:p}}}};x1.create=(t,e,r)=>new x1({valueType:e,keyType:t,typeName:lr.ZodMap,...Br(r)});var S1=class t extends Pr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Yt.set)return Wt(a,{code:Pt.invalid_type,expected:Yt.set,received:a.parsedType}),pr;let i=this._def;i.minSize!==null&&a.data.size<i.minSize.value&&(Wt(a,{code:Pt.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&a.data.size>i.maxSize.value&&(Wt(a,{code:Pt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let h=this._def.valueType;function l(b){let g=new Set;for(let y of b){if(y.status==="aborted")return pr;y.status==="dirty"&&r.dirty(),g.add(y.value)}return{status:r.value,value:g}}let p=[...a.data.values()].map((b,g)=>h._parse(new Ps(a,b,a.path,g)));return a.common.async?Promise.all(p).then(b=>l(b)):l(p)}min(e,r){return new t({...this._def,minSize:{value:e,message:rr.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:rr.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};S1.create=(t,e)=>new S1({valueType:t,minSize:null,maxSize:null,typeName:lr.ZodSet,...Br(e)});var L8=class t extends Pr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Yt.function)return Wt(r,{code:Pt.invalid_type,expected:Yt.function,received:r.parsedType}),pr;function a(p,b){return P8({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,B8(),w1].filter(g=>!!g),issueData:{code:Pt.invalid_arguments,argumentsError:b}})}function i(p,b){return P8({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,B8(),w1].filter(g=>!!g),issueData:{code:Pt.invalid_return_type,returnTypeError:b}})}let h={errorMap:r.common.contextualErrorMap},l=r.data;if(this._def.returns instanceof pc){let p=this;return Da(async function(...b){let g=new Bo([]),y=await p._def.args.parseAsync(b,h).catch(E=>{throw g.addIssue(a(b,E)),g}),M=await Reflect.apply(l,this,y);return await p._def.returns._def.type.parseAsync(M,h).catch(E=>{throw g.addIssue(i(M,E)),g})})}else{let p=this;return Da(function(...b){let g=p._def.args.safeParse(b,h);if(!g.success)throw new Bo([a(b,g.error)]);let y=Reflect.apply(l,this,g.data),M=p._def.returns.safeParse(y,h);if(!M.success)throw new Bo([i(y,M.error)]);return M.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Pu.create(e).rest(Ch.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new t({args:e||Pu.create([]).rest(Ch.create()),returns:r||Ch.create(),typeName:lr.ZodFunction,...Br(a)})}},hd=class extends Pr{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};hd.create=(t,e)=>new hd({getter:t,typeName:lr.ZodLazy,...Br(e)});var ld=class extends Pr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Wt(r,{received:r.data,code:Pt.invalid_literal,expected:this._def.value}),pr}return{status:"valid",value:e.data}}get value(){return this._def.value}};ld.create=(t,e)=>new ld({value:t,typeName:lr.ZodLiteral,...Br(e)});function eQ(t,e){return new cd({values:t,typeName:lr.ZodEnum,...Br(e)})}var cd=class t extends Pr{constructor(){super(...arguments),Tg.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return Wt(r,{expected:fi.joinValues(a),received:r.parsedType,code:Pt.invalid_type}),pr}if(O8(this,Tg,"f")||YX(this,Tg,new Set(this._def.values),"f"),!O8(this,Tg,"f").has(e.data)){let r=this._getOrReturnCtx(e),a=this._def.values;return Wt(r,{received:r.data,code:Pt.invalid_enum_value,options:a}),pr}return Da(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Tg=new WeakMap;cd.create=eQ;var dd=class extends Pr{constructor(){super(...arguments),kg.set(this,void 0)}_parse(e){let r=fi.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==Yt.string&&a.parsedType!==Yt.number){let i=fi.objectValues(r);return Wt(a,{expected:fi.joinValues(i),received:a.parsedType,code:Pt.invalid_type}),pr}if(O8(this,kg,"f")||YX(this,kg,new Set(fi.getValidEnumValues(this._def.values)),"f"),!O8(this,kg,"f").has(e.data)){let i=fi.objectValues(r);return Wt(a,{received:a.data,code:Pt.invalid_enum_value,options:i}),pr}return Da(e.data)}get enum(){return this._def.values}};kg=new WeakMap;dd.create=(t,e)=>new dd({values:t,typeName:lr.ZodNativeEnum,...Br(e)});var pc=class extends Pr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Yt.promise&&r.common.async===!1)return Wt(r,{code:Pt.invalid_type,expected:Yt.promise,received:r.parsedType}),pr;let a=r.parsedType===Yt.promise?r.data:Promise.resolve(r.data);return Da(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};pc.create=(t,e)=>new pc({type:t,typeName:lr.ZodPromise,...Br(e)});var Po=class extends Pr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===lr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=this._def.effect||null,h={addIssue:l=>{Wt(a,l),l.fatal?r.abort():r.dirty()},get path(){return a.path}};if(h.addIssue=h.addIssue.bind(h),i.type==="preprocess"){let l=i.transform(a.data,h);if(a.common.async)return Promise.resolve(l).then(async p=>{if(r.value==="aborted")return pr;let b=await this._def.schema._parseAsync({data:p,path:a.path,parent:a});return b.status==="aborted"?pr:b.status==="dirty"||r.value==="dirty"?y1(b.value):b});{if(r.value==="aborted")return pr;let p=this._def.schema._parseSync({data:l,path:a.path,parent:a});return p.status==="aborted"?pr:p.status==="dirty"||r.value==="dirty"?y1(p.value):p}}if(i.type==="refinement"){let l=p=>{let b=i.refinement(p,h);if(a.common.async)return Promise.resolve(b);if(b instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(a.common.async===!1){let p=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return p.status==="aborted"?pr:(p.status==="dirty"&&r.dirty(),l(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(p=>p.status==="aborted"?pr:(p.status==="dirty"&&r.dirty(),l(p.value).then(()=>({status:r.value,value:p.value}))))}if(i.type==="transform")if(a.common.async===!1){let l=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ig(l))return l;let p=i.transform(l.value,h);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(l=>Ig(l)?Promise.resolve(i.transform(l.value,h)).then(p=>({status:r.value,value:p})):l);fi.assertNever(i)}};Po.create=(t,e,r)=>new Po({schema:t,typeName:lr.ZodEffects,effect:e,...Br(r)});Po.createWithPreprocess=(t,e,r)=>new Po({schema:e,effect:{type:"preprocess",transform:t},typeName:lr.ZodEffects,...Br(r)});var Bs=class extends Pr{_parse(e){return this._getType(e)===Yt.undefined?Da(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bs.create=(t,e)=>new Bs({innerType:t,typeName:lr.ZodOptional,...Br(e)});var Ou=class extends Pr{_parse(e){return this._getType(e)===Yt.null?Da(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ou.create=(t,e)=>new Ou({innerType:t,typeName:lr.ZodNullable,...Br(e)});var pd=class extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===Yt.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pd.create=(t,e)=>new pd({innerType:t,typeName:lr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Br(e)});var vd=class extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Bg(i)?i.then(h=>({status:"valid",value:h.status==="valid"?h.value:this._def.catchValue({get error(){return new Bo(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Bo(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};vd.create=(t,e)=>new vd({innerType:t,typeName:lr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Br(e)});var E1=class extends Pr{_parse(e){if(this._getType(e)!==Yt.nan){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.nan,received:a.parsedType}),pr}return{status:"valid",value:e.data}}};E1.create=t=>new E1({typeName:lr.ZodNaN,...Br(t)});var bwe=Symbol("zod_brand"),Pg=class extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Og=class t extends Pr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let h=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return h.status==="aborted"?pr:h.status==="dirty"?(r.dirty(),y1(h.value)):this._def.out._parseAsync({data:h.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?pr:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(e,r){return new t({in:e,out:r,typeName:lr.ZodPipeline})}},md=class extends Pr{_parse(e){let r=this._def.innerType._parse(e),a=i=>(Ig(i)&&(i.value=Object.freeze(i.value)),i);return Bg(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};md.create=(t,e)=>new md({innerType:t,typeName:lr.ZodReadonly,...Br(e)});function tQ(t,e={},r){return t?dc.create().superRefine((a,i)=>{var h,l;if(!t(a)){let p=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,b=(l=(h=p.fatal)!==null&&h!==void 0?h:r)!==null&&l!==void 0?l:!0,g=typeof p=="string"?{message:p}:p;i.addIssue({code:"custom",...g,fatal:b})}}):dc.create()}var ywe={object:ao.lazycreate},lr;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(lr||(lr={}));var wwe=(t,e={message:`Input not instance of ${t.name}`})=>tQ(r=>r instanceof t,e),rQ=cc.create,iQ=rd.create,_we=E1.create,Mwe=id.create,nQ=nd.create,xwe=ad.create,Swe=_1.create,Ewe=od.create,Awe=sd.create,Rwe=dc.create,Twe=Ch.create,kwe=Tf.create,Iwe=M1.create,Bwe=Lh.create,Pwe=ao.create,Owe=ao.strictCreate,Nwe=fd.create,Cwe=N8.create,Lwe=ud.create,Dwe=Pu.create,$we=C8.create,qwe=x1.create,Uwe=S1.create,Fwe=L8.create,jwe=hd.create,zwe=ld.create,Zwe=cd.create,Hwe=dd.create,Kwe=pc.create,VX=Po.create,Wwe=Bs.create,Vwe=Ou.create,Gwe=Po.createWithPreprocess,Ywe=Og.create,Jwe=()=>rQ().optional(),Xwe=()=>iQ().optional(),Qwe=()=>nQ().optional(),e5e={string:t=>cc.create({...t,coerce:!0}),number:t=>rd.create({...t,coerce:!0}),boolean:t=>nd.create({...t,coerce:!0}),bigint:t=>id.create({...t,coerce:!0}),date:t=>ad.create({...t,coerce:!0})},t5e=pr,vr=Object.freeze({__proto__:null,defaultErrorMap:w1,setErrorMap:twe,getErrorMap:B8,makeIssue:P8,EMPTY_PATH:rwe,addIssueToContext:Wt,ParseStatus:Ia,INVALID:pr,DIRTY:y1,OK:Da,isAborted:dT,isDirty:pT,isValid:Ig,isAsync:Bg,get util(){return fi},get objectUtil(){return cT},ZodParsedType:Yt,getParsedType:lc,ZodType:Pr,datetimeRegex:QX,ZodString:cc,ZodNumber:rd,ZodBigInt:id,ZodBoolean:nd,ZodDate:ad,ZodSymbol:_1,ZodUndefined:od,ZodNull:sd,ZodAny:dc,ZodUnknown:Ch,ZodNever:Tf,ZodVoid:M1,ZodArray:Lh,ZodObject:ao,ZodUnion:fd,ZodDiscriminatedUnion:N8,ZodIntersection:ud,ZodTuple:Pu,ZodRecord:C8,ZodMap:x1,ZodSet:S1,ZodFunction:L8,ZodLazy:hd,ZodLiteral:ld,ZodEnum:cd,ZodNativeEnum:dd,ZodPromise:pc,ZodEffects:Po,ZodTransformer:Po,ZodOptional:Bs,ZodNullable:Ou,ZodDefault:pd,ZodCatch:vd,ZodNaN:E1,BRAND:bwe,ZodBranded:Pg,ZodPipeline:Og,ZodReadonly:md,custom:tQ,Schema:Pr,ZodSchema:Pr,late:ywe,get ZodFirstPartyTypeKind(){return lr},coerce:e5e,any:Rwe,array:Bwe,bigint:Mwe,boolean:nQ,date:xwe,discriminatedUnion:Cwe,effect:VX,enum:Zwe,function:Fwe,instanceof:wwe,intersection:Lwe,lazy:jwe,literal:zwe,map:qwe,nan:_we,nativeEnum:Hwe,never:kwe,null:Awe,nullable:Vwe,number:iQ,object:Pwe,oboolean:Qwe,onumber:Xwe,optional:Wwe,ostring:Jwe,pipeline:Ywe,preprocess:Gwe,promise:Kwe,record:$we,set:Uwe,strictObject:Owe,string:rQ,symbol:Swe,transformer:VX,tuple:Dwe,undefined:Ewe,union:Nwe,unknown:Twe,void:Iwe,NEVER:t5e,ZodIssueCode:Pt,quotelessJson:ewe,ZodError:Bo});ie();ae();ne();var D8=new RegExp("^[a-zA-Z0-9_-]{43}$"),Lft=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),Dft=new RegExp("^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$"),$ft=He.env.ARNS_REGISTRY_TX??"bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U",qft="_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8",r5e="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",Uft=r5e,A1="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",$8="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",mT=1e6,aQ="cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk",gT="16_FyX-V2QU0RPSh1GIaEETSaUjNb0oVjCFpVbAfQq4",oQ="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var gd=vr.string({description:"Arweave Transaction ID"}).refine(t=>D8.test(t),{message:"Must be an Arweave Transaction ID"}),sQ=vr.string({description:"Integer String"}).refine(t=>{let e=parseInt(t);return Number.isInteger(e)&&e>=0},{message:"Must be a non negative integer string"}),i5e=vr.string(),uQ=vr.array(vr.string()),q8=vr.object({transactionId:gd.describe("The Target ID of the undername"),ttlSeconds:vr.number()}),bT=vr.record(vr.string(),q8),yT=vr.array(gd.describe("Controller address")),wT=vr.record(gd.describe("Holder address"),vr.number()),_T=vr.object({Name:vr.string().describe("The name of the ANT."),Ticker:vr.string().describe("The ticker symbol for the ANT."),Description:vr.string().describe("The description for the ANT."),Keywords:uQ.describe("The keywords for the ANT."),Denomination:vr.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:gd.describe("The Owners address."),Controllers:yT.describe("Controllers of the ANT who have administrative privileges."),Records:bT.describe("Records associated with the ANT."),Balances:wT.describe("Balance details for each address holding the ANT."),Logo:gd.describe("Transaction ID of the ANT logo."),TotalSupply:vr.number().describe("Total supply of the ANT in circulation.").min(0,{message:"Total supply must be a non-negative number"}),Initialized:vr.boolean().describe("Flag indicating whether the ANT has been initialized.")}),n5e=["balance","balances","totalSupply","info","controllers","record","records","state"],a5e=["_eval","_default","transfer","addController","removeController","setRecord","removeRecord","setName","setTicker","setDescription","setKeywords","setLogo","initializeState","releaseName","reassignName","approvePrimaryName","removePrimaryNames"],o5e=[...n5e,...a5e],fQ=vr.array(vr.string({description:"Handler Name"})).refine(t=>o5e.every(e=>t.includes(e)),{message:"ANT is missing required handlers"}),hQ=vr.object({Name:vr.string().describe("The name of the ANT."),Owner:gd.describe("The Owners address."),Ticker:vr.string().describe("The ticker symbol for the ANT."),"Total-Supply":sQ.describe("Total supply of the ANT in circulation."),Description:i5e.describe("The description for the ANT."),Keywords:uQ.describe("The keywords for the ANT."),Logo:gd.describe("Transaction ID of the ANT logo."),Denomination:sQ.describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers."),Handlers:fQ.optional().describe("List of handlers for the ANT."),HandlerNames:fQ.optional().describe('Deprecated: List of handlers for the ANT. Use "Handlers" instead.')});function Wft(t){return _T.safeParse(t).success}ie();ae();ne();ie();ae();ne();ie();ae();ne();var lQ=t=>D8.test(t);function rut(t){return t!==void 0&&!isNaN(parseInt(t.toString()))}var En=t=>t.filter(e=>e.value!==void 0&&e.value!==""),Oo=t=>{let e=[{name:"Cursor",value:t?.cursor?.toString()},{name:"Limit",value:t?.limit?.toString()},{name:"Sort-By",value:t?.sortBy?.toString()},{name:"Sort-Order",value:t?.sortOrder?.toString()}];return En(e)};var s5e=["Buy-Record","Extend-Lease","Increase-Undername-Limit","Upgrade-Name","Primary-Name-Request"],fut=["Buy-Record","Extend-Lease"],uut=t=>s5e.indexOf(t)!==-1,f5e=["balance","stakes","any"],hut=t=>f5e.indexOf(t)!==-1;function Dh(t){return"process"in t}function $h(t){return"processId"in t&&typeof t.processId=="string"&&lQ(t.processId)===!0}function lut(t){return t.type==="lease"}ie();ae();ne();var MT=class t{constructor(e){this.positiveFiniteInteger=e;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${e}`)}[Symbol.toPrimitive](e){return e==="string"&&this.toString(),this.positiveFiniteInteger}plus(e){return new t(this.positiveFiniteInteger+e.positiveFiniteInteger)}minus(e){return new t(this.positiveFiniteInteger-e.positiveFiniteInteger)}isGreaterThan(e){return this.positiveFiniteInteger>e.positiveFiniteInteger}isGreaterThanOrEqualTo(e){return this.positiveFiniteInteger>=e.positiveFiniteInteger}isLessThan(e){return this.positiveFiniteInteger<e.positiveFiniteInteger}isLessThanOrEqualTo(e){return this.positiveFiniteInteger<=e.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(e){return this.positiveFiniteInteger===e.positiveFiniteInteger}},xT=class{value;constructor(e){if(!Number.isFinite(e)||e<0)throw new Error("ARIOToken must be a non-negative finite number");this.value=+e.toFixed(6)}valueOf(){return this.value}toMARIO(){return new ST(Math.floor(this.value*mT))}toString(){return`${this.value}`}},ST=class t extends MT{constructor(e){super(e)}multiply(e){let r=Math.floor(this.valueOf()*e.valueOf());return new t(r)}divide(e){if(e.valueOf()===0)throw new Error("Cannot divide by zero");let r=Math.floor(this.valueOf()/e.valueOf());return new t(r)}plus(e){let r=super.plus(e);return new t(r.valueOf())}minus(e){let r=super.minus(e);return new t(r.valueOf())}toARIO(){return new xT(this.valueOf()/mT)}};ie();ae();ne();ie();ae();ne();var kf=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},cQ=class extends kf{},dQ=class extends kf{},pQ=class extends kf{constructor(e,r){super(`Failed request: ${e}: ${r}`)}},vQ=class extends kf{},U8=class extends kf{},mQ=class extends kf{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},Nu=class extends kf{constructor(){super("Invalid contract configuration")}},gQ=class extends kf{constructor(){super("Invalid process configuration")}},bQ=class extends kf{};ie();ae();ne();var $f=gi($ae(),1);ie();ae();ne();var W4="3.1.0";var Fu=class t{logger;silent=!1;static default=new t;constructor({level:e="info"}={}){e==="none"&&(this.silent=!0),typeof window<"u"?this.logger=console:this.logger=(0,$f.createLogger)({level:e,silent:this.silent,defaultMeta:{name:"ar-io-sdk",version:W4},format:$f.format.combine($f.format.timestamp(),$f.format.json()),transports:[new $f.transports.Console({format:$f.format.combine($f.format.timestamp(),$f.format.json())})]})}info(e,...r){this.silent||this.logger.info(e,...r)}warn(e,...r){this.silent||this.logger.warn(e,...r)}error(e,...r){this.silent||this.logger.error(e,...r)}debug(e,...r){this.silent||this.logger.debug(e,...r)}setLogLevel(e){this.silent=e==="none","silent"in this.logger&&(this.logger.silent=e==="none"),"level"in this.logger&&(this.logger.level=e)}};ie();ae();ne();ie();ae();ne();ie();ae();ne();var fBe=Object.create,oB=Object.defineProperty,uBe=Object.getOwnPropertyDescriptor,hoe=Object.getOwnPropertyNames,hBe=Object.getPrototypeOf,lBe=Object.prototype.hasOwnProperty,Lo=(t,e)=>function(){return e||(0,t[hoe(t)[0]])((e={exports:{}}).exports,e),e.exports},loe=(t,e)=>{for(var r in e)oB(t,r,{get:e[r],enumerable:!0})},cBe=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hoe(e))!lBe.call(t,i)&&i!==r&&oB(t,i,{get:()=>e[i],enumerable:!(a=uBe(e,i))||a.enumerable});return t},sB=(t,e,r)=>(r=t!=null?fBe(hBe(t)):{},cBe(e||!t||!t.__esModule?oB(r,"default",{value:t,enumerable:!0}):r,t)),dBe=Lo({"node_modules/obliterator/iterator.js"(t,e){function r(a){if(typeof a!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=a}typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var a=arguments,i=a.length,h=0;return new r(function(){return h>=i?{done:!0}:{done:!1,value:a[h++]}})},r.empty=function(){var a=new r(function(){return{done:!0}});return a},r.fromSequence=function(a){var i=0,h=a.length;return new r(function(){return i>=h?{done:!0}:{done:!1,value:a[i++]}})},r.is=function(a){return a instanceof r?!0:typeof a=="object"&&a!==null&&typeof a.next=="function"},e.exports=r}}),pBe=Lo({"node_modules/obliterator/support.js"(t){t.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",t.SYMBOL_SUPPORT=typeof Symbol<"u"}}),fB=Lo({"node_modules/obliterator/foreach.js"(t,e){var r=pBe(),a=r.ARRAY_BUFFER_SUPPORT,i=r.SYMBOL_SUPPORT;e.exports=function(l,p){var b,g,y,M,x;if(!l)throw new Error("obliterator/forEach: invalid iterable.");if(typeof p!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(l)||a&&ArrayBuffer.isView(l)||typeof l=="string"||l.toString()==="[object Arguments]"){for(y=0,M=l.length;y<M;y++)p(l[y],y);return}if(typeof l.forEach=="function"){l.forEach(p);return}if(i&&Symbol.iterator in l&&typeof l.next!="function"&&(l=l[Symbol.iterator]()),typeof l.next=="function"){for(b=l,y=0;x=b.next(),x.done!==!0;)p(x.value,y),y++;return}for(g in l)l.hasOwnProperty(g)&&p(l[g],g)}}}),uB=Lo({"node_modules/mnemonist/utils/typed-arrays.js"(t){var e=Math.pow(2,8)-1,r=Math.pow(2,16)-1,a=Math.pow(2,32)-1,i=Math.pow(2,7)-1,h=Math.pow(2,15)-1,l=Math.pow(2,31)-1;t.getPointerArray=function(b){var g=b-1;if(g<=e)return Uint8Array;if(g<=r)return Uint16Array;if(g<=a)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},t.getSignedPointerArray=function(b){var g=b-1;return g<=i?Int8Array:g<=h?Int16Array:g<=l?Int32Array:Float64Array},t.getNumberType=function(b){return b===(b|0)?Math.sign(b)===-1?b<=127&&b>=-128?Int8Array:b<=32767&&b>=-32768?Int16Array:Int32Array:b<=255?Uint8Array:b<=65535?Uint16Array:Uint32Array:Float64Array};var p={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};t.getMinimalRepresentation=function(b,g){var y=null,M=0,x,E,A,k,P;for(k=0,P=b.length;k<P;k++)A=g?g(b[k]):b[k],E=t.getNumberType(A),x=p[E.name],x>M&&(M=x,y=E);return y},t.isTypedArray=function(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(b)},t.concat=function(){var b=0,g,y,M;for(g=0,M=arguments.length;g<M;g++)b+=arguments[g].length;var x=new arguments[0].constructor(b);for(g=0,y=0;g<M;g++)x.set(arguments[g],y),y+=arguments[g].length;return x},t.indices=function(b){for(var g=t.getPointerArray(b),y=new g(b),M=0;M<b;M++)y[M]=M;return y}}}),coe=Lo({"node_modules/mnemonist/utils/iterables.js"(t){var e=fB(),r=uB();function a(p){return Array.isArray(p)||r.isTypedArray(p)}function i(p){if(typeof p.length=="number")return p.length;if(typeof p.size=="number")return p.size}function h(p){var b=i(p),g=typeof b=="number"?new Array(b):[],y=0;return e(p,function(M){g[y++]=M}),g}function l(p){var b=i(p),g=typeof b=="number"?r.getPointerArray(b):Array,y=typeof b=="number"?new Array(b):[],M=typeof b=="number"?new g(b):[],x=0;return e(p,function(E){y[x]=E,M[x]=x++}),[y,M]}t.isArrayLike=a,t.guessLength=i,t.toArray=h,t.toArrayWithIndices=l}}),vBe=Lo({"node_modules/mnemonist/lru-cache.js"(t,e){var r=dBe(),a=fB(),i=uB(),h=coe();function l(p,b,g){if(arguments.length<2&&(g=p,p=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var y=i.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof p=="function"?new p(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items={}}l.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},l.prototype.splayOnTop=function(p){var b=this.head;if(this.head===p)return this;var g=this.backward[p],y=this.forward[p];return this.tail===p?this.tail=g:this.backward[y]=g,this.forward[g]=y,this.backward[b]=p,this.head=p,this.forward[p]=b,this},l.prototype.set=function(p,b){var g=this.items[p];if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],delete this.items[this.K[g]]),this.items[p]=g,this.K[g]=p,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},l.prototype.setpop=function(p,b){var g=null,y=null,M=this.items[p];return typeof M<"u"?(this.splayOnTop(M),g=this.V[M],this.V[M]=b,{evicted:!1,key:p,value:g}):(this.size<this.capacity?M=this.size++:(M=this.tail,this.tail=this.backward[M],g=this.V[M],y=this.K[M],delete this.items[y]),this.items[p]=M,this.K[M]=p,this.V[M]=b,this.forward[M]=this.head,this.backward[this.head]=M,this.head=M,y?{evicted:!0,key:y,value:g}:null)},l.prototype.has=function(p){return p in this.items},l.prototype.get=function(p){var b=this.items[p];if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},l.prototype.peek=function(p){var b=this.items[p];if(!(typeof b>"u"))return this.V[b]},l.prototype.forEach=function(p,b){b=arguments.length>1?b:this;for(var g=0,y=this.size,M=this.head,x=this.K,E=this.V,A=this.forward;g<y;)p.call(b,E[M],x[M],this),M=A[M],g++},l.prototype.keys=function(){var p=0,b=this.size,g=this.head,y=this.K,M=this.forward;return new r(function(){if(p>=b)return{done:!0};var x=y[g];return p++,p<b&&(g=M[g]),{done:!1,value:x}})},l.prototype.values=function(){var p=0,b=this.size,g=this.head,y=this.V,M=this.forward;return new r(function(){if(p>=b)return{done:!0};var x=y[g];return p++,p<b&&(g=M[g]),{done:!1,value:x}})},l.prototype.entries=function(){var p=0,b=this.size,g=this.head,y=this.K,M=this.V,x=this.forward;return new r(function(){if(p>=b)return{done:!0};var E=y[g],A=M[g];return p++,p<b&&(g=x[g]),{done:!1,value:[E,A]}})},typeof Symbol<"u"&&(l.prototype[Symbol.iterator]=l.prototype.entries),l.prototype.inspect=function(){for(var p=new Map,b=this.entries(),g;g=b.next(),!g.done;)p.set(g.value[0],g.value[1]);return Object.defineProperty(p,"constructor",{value:l,enumerable:!1}),p},typeof Symbol<"u"&&(l.prototype[Symbol.for("nodejs.util.inspect.custom")]=l.prototype.inspect),l.from=function(p,b,g,y){if(arguments.length<2){if(y=h.guessLength(p),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var M=new l(b,g,y);return a(p,function(x,E){M.set(E,x)}),M},e.exports=l}}),mBe=Lo({"node_modules/mnemonist/lru-map.js"(t,e){var r=vBe(),a=fB(),i=uB(),h=coe();function l(p,b,g){if(arguments.length<2&&(g=p,p=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var y=i.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof p=="function"?new p(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items=new Map}l.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},l.prototype.set=function(p,b){var g=this.items.get(p);if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],this.items.delete(this.K[g])),this.items.set(p,g),this.K[g]=p,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},l.prototype.setpop=function(p,b){var g=null,y=null,M=this.items.get(p);return typeof M<"u"?(this.splayOnTop(M),g=this.V[M],this.V[M]=b,{evicted:!1,key:p,value:g}):(this.size<this.capacity?M=this.size++:(M=this.tail,this.tail=this.backward[M],g=this.V[M],y=this.K[M],this.items.delete(y)),this.items.set(p,M),this.K[M]=p,this.V[M]=b,this.forward[M]=this.head,this.backward[this.head]=M,this.head=M,y?{evicted:!0,key:y,value:g}:null)},l.prototype.has=function(p){return this.items.has(p)},l.prototype.get=function(p){var b=this.items.get(p);if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},l.prototype.peek=function(p){var b=this.items.get(p);if(!(typeof b>"u"))return this.V[b]},l.prototype.splayOnTop=r.prototype.splayOnTop,l.prototype.forEach=r.prototype.forEach,l.prototype.keys=r.prototype.keys,l.prototype.values=r.prototype.values,l.prototype.entries=r.prototype.entries,typeof Symbol<"u"&&(l.prototype[Symbol.iterator]=l.prototype.entries),l.prototype.inspect=r.prototype.inspect,l.from=function(p,b,g,y){if(arguments.length<2){if(y=h.guessLength(p),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var M=new l(b,g,y);return a(p,function(x,E){M.set(E,x)}),M},e.exports=l}}),gBe=Lo({"node_modules/ms/index.js"(t,e){var r=1e3,a=r*60,i=a*60,h=i*24,l=h*7,p=h*365.25;e.exports=function(x,E){E=E||{};var A=typeof x;if(A==="string"&&x.length>0)return b(x);if(A==="number"&&isFinite(x))return E.long?y(x):g(x);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(x))};function b(x){if(x=String(x),!(x.length>100)){var E=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(x);if(E){var A=parseFloat(E[1]),k=(E[2]||"ms").toLowerCase();switch(k){case"years":case"year":case"yrs":case"yr":case"y":return A*p;case"weeks":case"week":case"w":return A*l;case"days":case"day":case"d":return A*h;case"hours":case"hour":case"hrs":case"hr":case"h":return A*i;case"minutes":case"minute":case"mins":case"min":case"m":return A*a;case"seconds":case"second":case"secs":case"sec":case"s":return A*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function g(x){var E=Math.abs(x);return E>=h?Math.round(x/h)+"d":E>=i?Math.round(x/i)+"h":E>=a?Math.round(x/a)+"m":E>=r?Math.round(x/r)+"s":x+"ms"}function y(x){var E=Math.abs(x);return E>=h?M(x,E,h,"day"):E>=i?M(x,E,i,"hour"):E>=a?M(x,E,a,"minute"):E>=r?M(x,E,r,"second"):x+" ms"}function M(x,E,A,k){var P=E>=A*1.5;return Math.round(x/A)+" "+k+(P?"s":"")}}}),bBe=Lo({"node_modules/debug/src/common.js"(t,e){function r(a){h.debug=h,h.default=h,h.coerce=M,h.disable=b,h.enable=p,h.enabled=g,h.humanize=gBe(),h.destroy=x,Object.keys(a).forEach(E=>{h[E]=a[E]}),h.names=[],h.skips=[],h.formatters={};function i(E){let A=0;for(let k=0;k<E.length;k++)A=(A<<5)-A+E.charCodeAt(k),A|=0;return h.colors[Math.abs(A)%h.colors.length]}h.selectColor=i;function h(E){let A,k=null,P,N;function L(...C){if(!L.enabled)return;let Y=L,G=Number(new Date),ee=G-(A||G);Y.diff=ee,Y.prev=A,Y.curr=G,A=G,C[0]=h.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let D=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(V,_)=>{if(V==="%%")return"%";D++;let n=h.formatters[_];if(typeof n=="function"){let s=C[D];V=n.call(Y,s),C.splice(D,1),D--}return V}),h.formatArgs.call(Y,C),(Y.log||h.log).apply(Y,C)}return L.namespace=E,L.useColors=h.useColors(),L.color=h.selectColor(E),L.extend=l,L.destroy=h.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>k!==null?k:(P!==h.namespaces&&(P=h.namespaces,N=h.enabled(E)),N),set:C=>{k=C}}),typeof h.init=="function"&&h.init(L),L}function l(E,A){let k=h(this.namespace+(typeof A>"u"?":":A)+E);return k.log=this.log,k}function p(E){h.save(E),h.namespaces=E,h.names=[],h.skips=[];let A,k=(typeof E=="string"?E:"").split(/[\s,]+/),P=k.length;for(A=0;A<P;A++)k[A]&&(E=k[A].replace(/\*/g,".*?"),E[0]==="-"?h.skips.push(new RegExp("^"+E.slice(1)+"$")):h.names.push(new RegExp("^"+E+"$")))}function b(){let E=[...h.names.map(y),...h.skips.map(y).map(A=>"-"+A)].join(",");return h.enable(""),E}function g(E){if(E[E.length-1]==="*")return!0;let A,k;for(A=0,k=h.skips.length;A<k;A++)if(h.skips[A].test(E))return!1;for(A=0,k=h.names.length;A<k;A++)if(h.names[A].test(E))return!0;return!1}function y(E){return E.toString().substring(2,E.toString().length-2).replace(/\.\*\?$/,"*")}function M(E){return E instanceof Error?E.stack||E.message:E}function x(){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 h.enable(h.load()),h}e.exports=r}}),yBe=Lo({"node_modules/debug/src/browser.js"(t,e){t.formatArgs=a,t.save=i,t.load=h,t.useColors=r,t.storage=l(),t.destroy=(()=>{let b=!1;return()=>{b||(b=!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`."))}})(),t.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 r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1: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(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function a(b){if(b[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+b[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let g="color: "+this.color;b.splice(1,0,g,"color: inherit");let y=0,M=0;b[0].replace(/%[a-zA-Z%]/g,x=>{x!=="%%"&&(y++,x==="%c"&&(M=y))}),b.splice(M,0,g)}t.log=console.debug||console.log||(()=>{});function i(b){try{b?t.storage.setItem("debug",b):t.storage.removeItem("debug")}catch{}}function h(){let b;try{b=t.storage.getItem("debug")}catch{}return!b&&typeof He<"u"&&"env"in He&&(b=He.env.DEBUG),b}function l(){try{return localStorage}catch{}}e.exports=bBe()(t);var{formatters:p}=e.exports;p.j=function(b){try{return JSON.stringify(b)}catch(g){return"[UnexpectedJSONParseError]: "+g.message}}}}),wBe=Lo({"node_modules/base64-js/index.js"(t){"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=E;var e=[],r=[],a=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,l=i.length;h<l;++h)e[h]=i[h],r[i.charCodeAt(h)]=h;var h,l;r[45]=62,r[95]=63;function p(A){var k=A.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=A.indexOf("=");P===-1&&(P=k);var N=P===k?0:4-P%4;return[P,N]}function b(A){var k=p(A),P=k[0],N=k[1];return(P+N)*3/4-N}function g(A,k,P){return(k+P)*3/4-P}function y(A){var k,P=p(A),N=P[0],L=P[1],C=new a(g(A,N,L)),Y=0,G=L>0?N-4:N,ee;for(ee=0;ee<G;ee+=4)k=r[A.charCodeAt(ee)]<<18|r[A.charCodeAt(ee+1)]<<12|r[A.charCodeAt(ee+2)]<<6|r[A.charCodeAt(ee+3)],C[Y++]=k>>16&255,C[Y++]=k>>8&255,C[Y++]=k&255;return L===2&&(k=r[A.charCodeAt(ee)]<<2|r[A.charCodeAt(ee+1)]>>4,C[Y++]=k&255),L===1&&(k=r[A.charCodeAt(ee)]<<10|r[A.charCodeAt(ee+1)]<<4|r[A.charCodeAt(ee+2)]>>2,C[Y++]=k>>8&255,C[Y++]=k&255),C}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,k,P){for(var N,L=[],C=k;C<P;C+=3)N=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),L.push(M(N));return L.join("")}function E(A){for(var k,P=A.length,N=P%3,L=[],C=16383,Y=0,G=P-N;Y<G;Y+=C)L.push(x(A,Y,Y+C>G?G:Y+C));return N===1?(k=A[P-1],L.push(e[k>>2]+e[k<<4&63]+"==")):N===2&&(k=(A[P-2]<<8)+A[P-1],L.push(e[k>>10]+e[k>>4&63]+e[k<<2&63]+"=")),L.join("")}}}),_Be=Lo({"node_modules/ieee754/index.js"(t){t.read=function(e,r,a,i,h){var l,p,b=h*8-i-1,g=(1<<b)-1,y=g>>1,M=-7,x=a?h-1:0,E=a?-1:1,A=e[r+x];for(x+=E,l=A&(1<<-M)-1,A>>=-M,M+=b;M>0;l=l*256+e[r+x],x+=E,M-=8);for(p=l&(1<<-M)-1,l>>=-M,M+=i;M>0;p=p*256+e[r+x],x+=E,M-=8);if(l===0)l=1-y;else{if(l===g)return p?NaN:(A?-1:1)*(1/0);p=p+Math.pow(2,i),l=l-y}return(A?-1:1)*p*Math.pow(2,l-i)},t.write=function(e,r,a,i,h,l){var p,b,g,y=l*8-h-1,M=(1<<y)-1,x=M>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:l-1,k=i?1:-1,P=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,p=M):(p=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-p))<1&&(p--,g*=2),p+x>=1?r+=E/g:r+=E*Math.pow(2,1-x),r*g>=2&&(p++,g/=2),p+x>=M?(b=0,p=M):p+x>=1?(b=(r*g-1)*Math.pow(2,h),p=p+x):(b=r*Math.pow(2,x-1)*Math.pow(2,h),p=0));h>=8;e[a+A]=b&255,A+=k,b/=256,h-=8);for(p=p<<h|b,y+=h;y>0;e[a+A]=p&255,A+=k,p/=256,y-=8);e[a+A-k]|=P*128}}}),MBe=Lo({"node_modules/buffer/index.js"(t){"use strict";var e=wBe(),r=_Be(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=p,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,p.TYPED_ARRAY_SUPPORT=h(),!p.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 h(){try{let T=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(T,I),T.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function l(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let I=new Uint8Array(T);return Object.setPrototypeOf(I,p.prototype),I}function p(T,I,O){if(typeof T=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(T)}return b(T,I,O)}p.poolSize=8192;function b(T,I,O){if(typeof T=="string")return x(T,I);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(ut(T,ArrayBuffer)||T&&ut(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(T,SharedArrayBuffer)||T&&ut(T.buffer,SharedArrayBuffer)))return k(T,I,O);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let q=T.valueOf&&T.valueOf();if(q!=null&&q!==T)return p.from(q,I,O);let H=P(T);if(H)return H;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return p.from(T[Symbol.toPrimitive]("string"),I,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}p.from=function(T,I,O){return b(T,I,O)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function g(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function y(T,I,O){return g(T),T<=0?l(T):I!==void 0?typeof O=="string"?l(T).fill(I,O):l(T).fill(I):l(T)}p.alloc=function(T,I,O){return y(T,I,O)};function M(T){return g(T),l(T<0?0:N(T)|0)}p.allocUnsafe=function(T){return M(T)},p.allocUnsafeSlow=function(T){return M(T)};function x(T,I){if((typeof I!="string"||I==="")&&(I="utf8"),!p.isEncoding(I))throw new TypeError("Unknown encoding: "+I);let O=C(T,I)|0,q=l(O),H=q.write(T,I);return H!==O&&(q=q.slice(0,H)),q}function E(T){let I=T.length<0?0:N(T.length)|0,O=l(I);for(let q=0;q<I;q+=1)O[q]=T[q]&255;return O}function A(T){if(ut(T,Uint8Array)){let I=new Uint8Array(T);return k(I.buffer,I.byteOffset,I.byteLength)}return E(T)}function k(T,I,O){if(I<0||T.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<I+(O||0))throw new RangeError('"length" is outside of buffer bounds');let q;return I===void 0&&O===void 0?q=new Uint8Array(T):O===void 0?q=new Uint8Array(T,I):q=new Uint8Array(T,I,O),Object.setPrototypeOf(q,p.prototype),q}function P(T){if(p.isBuffer(T)){let I=N(T.length)|0,O=l(I);return O.length===0||T.copy(O,0,0,I),O}if(T.length!==void 0)return typeof T.length!="number"||Ze(T.length)?l(0):E(T);if(T.type==="Buffer"&&Array.isArray(T.data))return E(T.data)}function N(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function L(T){return+T!=T&&(T=0),p.alloc(+T)}p.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==p.prototype},p.compare=function(I,O){if(ut(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),ut(O,Uint8Array)&&(O=p.from(O,O.offset,O.byteLength)),!p.isBuffer(I)||!p.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===O)return 0;let q=I.length,H=O.length;for(let W=0,fe=Math.min(q,H);W<fe;++W)if(I[W]!==O[W]){q=I[W],H=O[W];break}return q<H?-1:H<q?1:0},p.isEncoding=function(I){switch(String(I).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}},p.concat=function(I,O){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return p.alloc(0);let q;if(O===void 0)for(O=0,q=0;q<I.length;++q)O+=I[q].length;let H=p.allocUnsafe(O),W=0;for(q=0;q<I.length;++q){let fe=I[q];if(ut(fe,Uint8Array))W+fe.length>H.length?(p.isBuffer(fe)||(fe=p.from(fe)),fe.copy(H,W)):Uint8Array.prototype.set.call(H,fe,W);else if(p.isBuffer(fe))fe.copy(H,W);else throw new TypeError('"list" argument must be an Array of Buffers');W+=fe.length}return H};function C(T,I){if(p.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||ut(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let O=T.length,q=arguments.length>2&&arguments[2]===!0;if(!q&&O===0)return 0;let H=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O*2;case"hex":return O>>>1;case"base64":return ge(T).length;default:if(H)return q?-1:oe(T).length;I=(""+I).toLowerCase(),H=!0}}p.byteLength=C;function Y(T,I,O){let q=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0,I>>>=0,O<=I))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,I,O);case"utf8":case"utf-8":return u(this,I,O);case"ascii":return w(this,I,O);case"latin1":case"binary":return d(this,I,O);case"base64":return f(this,I,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,I,O);default:if(q)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),q=!0}}p.prototype._isBuffer=!0;function G(T,I,O){let q=T[I];T[I]=T[O],T[O]=q}p.prototype.swap16=function(){let I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<I;O+=2)G(this,O,O+1);return this},p.prototype.swap32=function(){let I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<I;O+=4)G(this,O,O+3),G(this,O+1,O+2);return this},p.prototype.swap64=function(){let I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<I;O+=8)G(this,O,O+7),G(this,O+1,O+6),G(this,O+2,O+5),G(this,O+3,O+4);return this},p.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?u(this,0,I):Y.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(I){if(!p.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:p.compare(this,I)===0},p.prototype.inspect=function(){let I="",O=t.INSPECT_MAX_BYTES;return I=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(I+=" ... "),"<Buffer "+I+">"},a&&(p.prototype[a]=p.prototype.inspect),p.prototype.compare=function(I,O,q,H,W){if(ut(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),!p.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(O===void 0&&(O=0),q===void 0&&(q=I?I.length:0),H===void 0&&(H=0),W===void 0&&(W=this.length),O<0||q>I.length||H<0||W>this.length)throw new RangeError("out of range index");if(H>=W&&O>=q)return 0;if(H>=W)return-1;if(O>=q)return 1;if(O>>>=0,q>>>=0,H>>>=0,W>>>=0,this===I)return 0;let fe=W-H,st=q-O,ue=Math.min(fe,st),me=this.slice(H,W),pe=I.slice(O,q);for(let be=0;be<ue;++be)if(me[be]!==pe[be]){fe=me[be],st=pe[be];break}return fe<st?-1:st<fe?1:0};function ee(T,I,O,q,H){if(T.length===0)return-1;if(typeof O=="string"?(q=O,O=0):O>2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),O=+O,Ze(O)&&(O=H?0:T.length-1),O<0&&(O=T.length+O),O>=T.length){if(H)return-1;O=T.length-1}else if(O<0)if(H)O=0;else return-1;if(typeof I=="string"&&(I=p.from(I,q)),p.isBuffer(I))return I.length===0?-1:D(T,I,O,q,H);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?H?Uint8Array.prototype.indexOf.call(T,I,O):Uint8Array.prototype.lastIndexOf.call(T,I,O):D(T,[I],O,q,H);throw new TypeError("val must be string, number or Buffer")}function D(T,I,O,q,H){let W=1,fe=T.length,st=I.length;if(q!==void 0&&(q=String(q).toLowerCase(),q==="ucs2"||q==="ucs-2"||q==="utf16le"||q==="utf-16le")){if(T.length<2||I.length<2)return-1;W=2,fe/=2,st/=2,O/=2}function ue(pe,be){return W===1?pe[be]:pe.readUInt16BE(be*W)}let me;if(H){let pe=-1;for(me=O;me<fe;me++)if(ue(T,me)===ue(I,pe===-1?0:me-pe)){if(pe===-1&&(pe=me),me-pe+1===st)return pe*W}else pe!==-1&&(me-=me-pe),pe=-1}else for(O+st>fe&&(O=fe-st),me=O;me>=0;me--){let pe=!0;for(let be=0;be<st;be++)if(ue(T,me+be)!==ue(I,be)){pe=!1;break}if(pe)return me}return-1}p.prototype.includes=function(I,O,q){return this.indexOf(I,O,q)!==-1},p.prototype.indexOf=function(I,O,q){return ee(this,I,O,q,!0)},p.prototype.lastIndexOf=function(I,O,q){return ee(this,I,O,q,!1)};function U(T,I,O,q){O=Number(O)||0;let H=T.length-O;q?(q=Number(q),q>H&&(q=H)):q=H;let W=I.length;q>W/2&&(q=W/2);let fe;for(fe=0;fe<q;++fe){let st=parseInt(I.substr(fe*2,2),16);if(Ze(st))return fe;T[O+fe]=st}return fe}function V(T,I,O,q){return Se(oe(I,T.length-O),T,O,q)}function _(T,I,O,q){return Se(ce(I),T,O,q)}function n(T,I,O,q){return Se(ge(I),T,O,q)}function s(T,I,O,q){return Se(ot(I,T.length-O),T,O,q)}p.prototype.write=function(I,O,q,H){if(O===void 0)H="utf8",q=this.length,O=0;else if(q===void 0&&typeof O=="string")H=O,q=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(q)?(q=q>>>0,H===void 0&&(H="utf8")):(H=q,q=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let W=this.length-O;if((q===void 0||q>W)&&(q=W),I.length>0&&(q<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");H||(H="utf8");let fe=!1;for(;;)switch(H){case"hex":return U(this,I,O,q);case"utf8":case"utf-8":return V(this,I,O,q);case"ascii":case"latin1":case"binary":return _(this,I,O,q);case"base64":return n(this,I,O,q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,I,O,q);default:if(fe)throw new TypeError("Unknown encoding: "+H);H=(""+H).toLowerCase(),fe=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(T,I,O){return I===0&&O===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(I,O))}function u(T,I,O){O=Math.min(T.length,O);let q=[],H=I;for(;H<O;){let W=T[H],fe=null,st=W>239?4:W>223?3:W>191?2:1;if(H+st<=O){let ue,me,pe,be;switch(st){case 1:W<128&&(fe=W);break;case 2:ue=T[H+1],(ue&192)===128&&(be=(W&31)<<6|ue&63,be>127&&(fe=be));break;case 3:ue=T[H+1],me=T[H+2],(ue&192)===128&&(me&192)===128&&(be=(W&15)<<12|(ue&63)<<6|me&63,be>2047&&(be<55296||be>57343)&&(fe=be));break;case 4:ue=T[H+1],me=T[H+2],pe=T[H+3],(ue&192)===128&&(me&192)===128&&(pe&192)===128&&(be=(W&15)<<18|(ue&63)<<12|(me&63)<<6|pe&63,be>65535&&be<1114112&&(fe=be))}}fe===null?(fe=65533,st=1):fe>65535&&(fe-=65536,q.push(fe>>>10&1023|55296),fe=56320|fe&1023),q.push(fe),H+=st}return m(q)}var c=4096;function m(T){let I=T.length;if(I<=c)return String.fromCharCode.apply(String,T);let O="",q=0;for(;q<I;)O+=String.fromCharCode.apply(String,T.slice(q,q+=c));return O}function w(T,I,O){let q="";O=Math.min(T.length,O);for(let H=I;H<O;++H)q+=String.fromCharCode(T[H]&127);return q}function d(T,I,O){let q="";O=Math.min(T.length,O);for(let H=I;H<O;++H)q+=String.fromCharCode(T[H]);return q}function o(T,I,O){let q=T.length;(!I||I<0)&&(I=0),(!O||O<0||O>q)&&(O=q);let H="";for(let W=I;W<O;++W)H+=Ge[T[W]];return H}function v(T,I,O){let q=T.slice(I,O),H="";for(let W=0;W<q.length-1;W+=2)H+=String.fromCharCode(q[W]+q[W+1]*256);return H}p.prototype.slice=function(I,O){let q=this.length;I=~~I,O=O===void 0?q:~~O,I<0?(I+=q,I<0&&(I=0)):I>q&&(I=q),O<0?(O+=q,O<0&&(O=0)):O>q&&(O=q),O<I&&(O=I);let H=this.subarray(I,O);return Object.setPrototypeOf(H,p.prototype),H};function R(T,I,O){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+I>O)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(I,O,q){I=I>>>0,O=O>>>0,q||R(I,O,this.length);let H=this[I],W=1,fe=0;for(;++fe<O&&(W*=256);)H+=this[I+fe]*W;return H},p.prototype.readUintBE=p.prototype.readUIntBE=function(I,O,q){I=I>>>0,O=O>>>0,q||R(I,O,this.length);let H=this[I+--O],W=1;for(;O>0&&(W*=256);)H+=this[I+--O]*W;return H},p.prototype.readUint8=p.prototype.readUInt8=function(I,O){return I=I>>>0,O||R(I,1,this.length),this[I]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(I,O){return I=I>>>0,O||R(I,2,this.length),this[I]|this[I+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(I,O){return I=I>>>0,O||R(I,2,this.length),this[I]<<8|this[I+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(I,O){return I=I>>>0,O||R(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(I,O){return I=I>>>0,O||R(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},p.prototype.readBigUInt64LE=lt(function(I){I=I>>>0,J(I,"offset");let O=this[I],q=this[I+7];(O===void 0||q===void 0)&&X(I,this.length-8);let H=O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,W=this[++I]+this[++I]*2**8+this[++I]*2**16+q*2**24;return BigInt(H)+(BigInt(W)<<BigInt(32))}),p.prototype.readBigUInt64BE=lt(function(I){I=I>>>0,J(I,"offset");let O=this[I],q=this[I+7];(O===void 0||q===void 0)&&X(I,this.length-8);let H=O*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],W=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+q;return(BigInt(H)<<BigInt(32))+BigInt(W)}),p.prototype.readIntLE=function(I,O,q){I=I>>>0,O=O>>>0,q||R(I,O,this.length);let H=this[I],W=1,fe=0;for(;++fe<O&&(W*=256);)H+=this[I+fe]*W;return W*=128,H>=W&&(H-=Math.pow(2,8*O)),H},p.prototype.readIntBE=function(I,O,q){I=I>>>0,O=O>>>0,q||R(I,O,this.length);let H=O,W=1,fe=this[I+--H];for(;H>0&&(W*=256);)fe+=this[I+--H]*W;return W*=128,fe>=W&&(fe-=Math.pow(2,8*O)),fe},p.prototype.readInt8=function(I,O){return I=I>>>0,O||R(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},p.prototype.readInt16LE=function(I,O){I=I>>>0,O||R(I,2,this.length);let q=this[I]|this[I+1]<<8;return q&32768?q|4294901760:q},p.prototype.readInt16BE=function(I,O){I=I>>>0,O||R(I,2,this.length);let q=this[I+1]|this[I]<<8;return q&32768?q|4294901760:q},p.prototype.readInt32LE=function(I,O){return I=I>>>0,O||R(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},p.prototype.readInt32BE=function(I,O){return I=I>>>0,O||R(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},p.prototype.readBigInt64LE=lt(function(I){I=I>>>0,J(I,"offset");let O=this[I],q=this[I+7];(O===void 0||q===void 0)&&X(I,this.length-8);let H=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(q<<24);return(BigInt(H)<<BigInt(32))+BigInt(O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),p.prototype.readBigInt64BE=lt(function(I){I=I>>>0,J(I,"offset");let O=this[I],q=this[I+7];(O===void 0||q===void 0)&&X(I,this.length-8);let H=(O<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(H)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+q)}),p.prototype.readFloatLE=function(I,O){return I=I>>>0,O||R(I,4,this.length),r.read(this,I,!0,23,4)},p.prototype.readFloatBE=function(I,O){return I=I>>>0,O||R(I,4,this.length),r.read(this,I,!1,23,4)},p.prototype.readDoubleLE=function(I,O){return I=I>>>0,O||R(I,8,this.length),r.read(this,I,!0,52,8)},p.prototype.readDoubleBE=function(I,O){return I=I>>>0,O||R(I,8,this.length),r.read(this,I,!1,52,8)};function S(T,I,O,q,H,W){if(!p.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>H||I<W)throw new RangeError('"value" argument is out of bounds');if(O+q>T.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(I,O,q,H){if(I=+I,O=O>>>0,q=q>>>0,!H){let st=Math.pow(2,8*q)-1;S(this,I,O,q,st,0)}let W=1,fe=0;for(this[O]=I&255;++fe<q&&(W*=256);)this[O+fe]=I/W&255;return O+q},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(I,O,q,H){if(I=+I,O=O>>>0,q=q>>>0,!H){let st=Math.pow(2,8*q)-1;S(this,I,O,q,st,0)}let W=q-1,fe=1;for(this[O+W]=I&255;--W>=0&&(fe*=256);)this[O+W]=I/fe&255;return O+q},p.prototype.writeUint8=p.prototype.writeUInt8=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,1,255,0),this[O]=I&255,O+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,2,65535,0),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,2,65535,0),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,4,4294967295,0),this[O+3]=I>>>24,this[O+2]=I>>>16,this[O+1]=I>>>8,this[O]=I&255,O+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,4,4294967295,0),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4};function B(T,I,O,q,H){j(I,q,H,T,O,7);let W=Number(I&BigInt(4294967295));T[O++]=W,W=W>>8,T[O++]=W,W=W>>8,T[O++]=W,W=W>>8,T[O++]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[O++]=fe,fe=fe>>8,T[O++]=fe,fe=fe>>8,T[O++]=fe,fe=fe>>8,T[O++]=fe,O}function F(T,I,O,q,H){j(I,q,H,T,O,7);let W=Number(I&BigInt(4294967295));T[O+7]=W,W=W>>8,T[O+6]=W,W=W>>8,T[O+5]=W,W=W>>8,T[O+4]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[O+3]=fe,fe=fe>>8,T[O+2]=fe,fe=fe>>8,T[O+1]=fe,fe=fe>>8,T[O]=fe,O+8}p.prototype.writeBigUInt64LE=lt(function(I,O=0){return B(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=lt(function(I,O=0){return F(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(I,O,q,H){if(I=+I,O=O>>>0,!H){let ue=Math.pow(2,8*q-1);S(this,I,O,q,ue-1,-ue)}let W=0,fe=1,st=0;for(this[O]=I&255;++W<q&&(fe*=256);)I<0&&st===0&&this[O+W-1]!==0&&(st=1),this[O+W]=(I/fe>>0)-st&255;return O+q},p.prototype.writeIntBE=function(I,O,q,H){if(I=+I,O=O>>>0,!H){let ue=Math.pow(2,8*q-1);S(this,I,O,q,ue-1,-ue)}let W=q-1,fe=1,st=0;for(this[O+W]=I&255;--W>=0&&(fe*=256);)I<0&&st===0&&this[O+W+1]!==0&&(st=1),this[O+W]=(I/fe>>0)-st&255;return O+q},p.prototype.writeInt8=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,1,127,-128),I<0&&(I=255+I+1),this[O]=I&255,O+1},p.prototype.writeInt16LE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,2,32767,-32768),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeInt16BE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,2,32767,-32768),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeInt32LE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,4,2147483647,-2147483648),this[O]=I&255,this[O+1]=I>>>8,this[O+2]=I>>>16,this[O+3]=I>>>24,O+4},p.prototype.writeInt32BE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4},p.prototype.writeBigInt64LE=lt(function(I,O=0){return B(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=lt(function(I,O=0){return F(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(T,I,O,q,H,W){if(O+q>T.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("Index out of range")}function re(T,I,O,q,H){return I=+I,O=O>>>0,H||$(T,I,O,4,34028234663852886e22,-34028234663852886e22),r.write(T,I,O,q,23,4),O+4}p.prototype.writeFloatLE=function(I,O,q){return re(this,I,O,!0,q)},p.prototype.writeFloatBE=function(I,O,q){return re(this,I,O,!1,q)};function Q(T,I,O,q,H){return I=+I,O=O>>>0,H||$(T,I,O,8,17976931348623157e292,-17976931348623157e292),r.write(T,I,O,q,52,8),O+8}p.prototype.writeDoubleLE=function(I,O,q){return Q(this,I,O,!0,q)},p.prototype.writeDoubleBE=function(I,O,q){return Q(this,I,O,!1,q)},p.prototype.copy=function(I,O,q,H){if(!p.isBuffer(I))throw new TypeError("argument should be a Buffer");if(q||(q=0),!H&&H!==0&&(H=this.length),O>=I.length&&(O=I.length),O||(O=0),H>0&&H<q&&(H=q),H===q||I.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if(q<0||q>=this.length)throw new RangeError("Index out of range");if(H<0)throw new RangeError("sourceEnd out of bounds");H>this.length&&(H=this.length),I.length-O<H-q&&(H=I.length-O+q);let W=H-q;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,q,H):Uint8Array.prototype.set.call(I,this.subarray(q,H),O),W},p.prototype.fill=function(I,O,q,H){if(typeof I=="string"){if(typeof O=="string"?(H=O,O=0,q=this.length):typeof q=="string"&&(H=q,q=this.length),H!==void 0&&typeof H!="string")throw new TypeError("encoding must be a string");if(typeof H=="string"&&!p.isEncoding(H))throw new TypeError("Unknown encoding: "+H);if(I.length===1){let fe=I.charCodeAt(0);(H==="utf8"&&fe<128||H==="latin1")&&(I=fe)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(O<0||this.length<O||this.length<q)throw new RangeError("Out of range index");if(q<=O)return this;O=O>>>0,q=q===void 0?this.length:q>>>0,I||(I=0);let W;if(typeof I=="number")for(W=O;W<q;++W)this[W]=I;else{let fe=p.isBuffer(I)?I:p.from(I,H),st=fe.length;if(st===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(W=0;W<q-O;++W)this[W+O]=fe[W%st]}return this};var Z={};function K(T,I,O){Z[T]=class extends O{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(H){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:H,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(T,I){return`The "${T}" argument must be of type number. Received type ${typeof I}`},TypeError),K("ERR_OUT_OF_RANGE",function(T,I,O){let q=`The value of "${T}" is out of range.`,H=O;return Number.isInteger(O)&&Math.abs(O)>2**32?H=le(String(O)):typeof O=="bigint"&&(H=String(O),(O>BigInt(2)**BigInt(32)||O<-(BigInt(2)**BigInt(32)))&&(H=le(H)),H+="n"),q+=` It must be ${I}. Received ${H}`,q},RangeError);function le(T){let I="",O=T.length,q=T[0]==="-"?1:0;for(;O>=q+4;O-=3)I=`_${T.slice(O-3,O)}${I}`;return`${T.slice(0,O)}${I}`}function te(T,I,O){J(I,"offset"),(T[I]===void 0||T[I+O]===void 0)&&X(I,T.length-(O+1))}function j(T,I,O,q,H,W){if(T>O||T<I){let fe=typeof I=="bigint"?"n":"",st;throw W>3?I===0||I===BigInt(0)?st=`>= 0${fe} and < 2${fe} ** ${(W+1)*8}${fe}`:st=`>= -(2${fe} ** ${(W+1)*8-1}${fe}) and < 2 ** ${(W+1)*8-1}${fe}`:st=`>= ${I}${fe} and <= ${O}${fe}`,new Z.ERR_OUT_OF_RANGE("value",st,T)}te(q,H,W)}function J(T,I){if(typeof T!="number")throw new Z.ERR_INVALID_ARG_TYPE(I,"number",T)}function X(T,I,O){throw Math.floor(T)!==T?(J(T,O),new Z.ERR_OUT_OF_RANGE(O||"offset","an integer",T)):I<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE(O||"offset",`>= ${O?1:0} and <= ${I}`,T)}var he=/[^+/0-9A-Za-z-_]/g;function Te(T){if(T=T.split("=")[0],T=T.trim().replace(he,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function oe(T,I){I=I||1/0;let O,q=T.length,H=null,W=[];for(let fe=0;fe<q;++fe){if(O=T.charCodeAt(fe),O>55295&&O<57344){if(!H){if(O>56319){(I-=3)>-1&&W.push(239,191,189);continue}else if(fe+1===q){(I-=3)>-1&&W.push(239,191,189);continue}H=O;continue}if(O<56320){(I-=3)>-1&&W.push(239,191,189),H=O;continue}O=(H-55296<<10|O-56320)+65536}else H&&(I-=3)>-1&&W.push(239,191,189);if(H=null,O<128){if((I-=1)<0)break;W.push(O)}else if(O<2048){if((I-=2)<0)break;W.push(O>>6|192,O&63|128)}else if(O<65536){if((I-=3)<0)break;W.push(O>>12|224,O>>6&63|128,O&63|128)}else if(O<1114112){if((I-=4)<0)break;W.push(O>>18|240,O>>12&63|128,O>>6&63|128,O&63|128)}else throw new Error("Invalid code point")}return W}function ce(T){let I=[];for(let O=0;O<T.length;++O)I.push(T.charCodeAt(O)&255);return I}function ot(T,I){let O,q,H,W=[];for(let fe=0;fe<T.length&&!((I-=2)<0);++fe)O=T.charCodeAt(fe),q=O>>8,H=O%256,W.push(H),W.push(q);return W}function ge(T){return e.toByteArray(Te(T))}function Se(T,I,O,q){let H;for(H=0;H<q&&!(H+O>=I.length||H>=T.length);++H)I[H+O]=T[H];return H}function ut(T,I){return T instanceof I||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===I.name}function Ze(T){return T!==T}var Ge=function(){let T="0123456789abcdef",I=new Array(256);for(let O=0;O<16;++O){let q=O*16;for(let H=0;H<16;++H)I[q+H]=T[O]+T[H]}return I}();function lt(T){return typeof BigInt>"u"?z:T}function z(){throw new Error("BigInt not supported")}}}),xBe={"@@functional/placeholder":!0};function Yi(t){return t===xBe}function Fa(t){return function e(r){return arguments.length===0||Yi(r)?e:t.apply(this,arguments)}}function Fn(t){return function e(r,a){switch(arguments.length){case 0:return e;case 1:return Yi(r)?e:Fa(function(i){return t(r,i)});default:return Yi(r)&&Yi(a)?e:Yi(r)?Fa(function(i){return t(i,a)}):Yi(a)?Fa(function(i){return t(r,i)}):t(r,a)}}}function Sw(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,a){return e.apply(this,arguments)};case 3:return function(r,a,i){return e.apply(this,arguments)};case 4:return function(r,a,i,h){return e.apply(this,arguments)};case 5:return function(r,a,i,h,l){return e.apply(this,arguments)};case 6:return function(r,a,i,h,l,p){return e.apply(this,arguments)};case 7:return function(r,a,i,h,l,p,b){return e.apply(this,arguments)};case 8:return function(r,a,i,h,l,p,b,g){return e.apply(this,arguments)};case 9:return function(r,a,i,h,l,p,b,g,y){return e.apply(this,arguments)};case 10:return function(r,a,i,h,l,p,b,g,y,M){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function doe(t,e,r){return function(){for(var a=[],i=0,h=t,l=0,p=!1;l<e.length||i<arguments.length;){var b;l<e.length&&(!Yi(e[l])||i>=arguments.length)?b=e[l]:(b=arguments[i],i+=1),a[l]=b,Yi(b)?p=!0:h-=1,l+=1}return!p&&h<=0?r.apply(this,a):Sw(Math.max(0,h),doe(t,a,r))}}var SBe=Fn(function(t,e){return t===1?Fa(e):Sw(t,doe(t,[],e))}),poe=SBe;function hB(t){return function e(r,a,i){switch(arguments.length){case 0:return e;case 1:return Yi(r)?e:Fn(function(h,l){return t(r,h,l)});case 2:return Yi(r)&&Yi(a)?e:Yi(r)?Fn(function(h,l){return t(h,a,l)}):Yi(a)?Fn(function(h,l){return t(r,h,l)}):Fa(function(h){return t(r,a,h)});default:return Yi(r)&&Yi(a)&&Yi(i)?e:Yi(r)&&Yi(a)?Fn(function(h,l){return t(h,l,i)}):Yi(r)&&Yi(i)?Fn(function(h,l){return t(h,a,l)}):Yi(a)&&Yi(i)?Fn(function(h,l){return t(r,h,l)}):Yi(r)?Fa(function(h){return t(h,a,i)}):Yi(a)?Fa(function(h){return t(r,h,i)}):Yi(i)?Fa(function(h){return t(r,a,h)}):t(r,a,i)}}}var lB=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function EBe(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function cB(t,e,r){return function(){if(arguments.length===0)return r();var a=arguments[arguments.length-1];if(!lB(a)){for(var i=0;i<t.length;){if(typeof a[t[i]]=="function")return a[t[i]].apply(a,Array.prototype.slice.call(arguments,0,-1));i+=1}if(EBe(a)){var h=e.apply(null,Array.prototype.slice.call(arguments,0,-1));return h(a)}}return r.apply(this,arguments)}}function ABe(t){return t&&t["@@transducer/reduced"]?t:{"@@transducer/value":t,"@@transducer/reduced":!0}}var B2={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}};function qae(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function Uae(t,e,r){for(var a=0,i=r.length;a<i;){if(t(e,r[a]))return!0;a+=1}return!1}function RBe(t){var e=String(t).match(/^function (\w*)/);return e==null?"":e[1]}function ew(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function TBe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var AI=typeof Object.is=="function"?Object.is:TBe,Fae=Object.prototype.toString,kBe=function(){return Fae.call(arguments)==="[object Arguments]"?function(t){return Fae.call(t)==="[object Arguments]"}:function(t){return ew("callee",t)}}(),IBe=kBe,BBe=!{toString:null}.propertyIsEnumerable("toString"),jae=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],zae=function(){"use strict";return arguments.propertyIsEnumerable("length")}(),PBe=function(t,e){for(var r=0;r<t.length;){if(t[r]===e)return!0;r+=1}return!1},OBe=Fa(typeof Object.keys=="function"&&!zae?function(t){return Object(t)!==t?[]:Object.keys(t)}:function(t){if(Object(t)!==t)return[];var e,r,a=[],i=zae&&IBe(t);for(e in t)ew(e,t)&&(!i||e!=="length")&&(a[a.length]=e);if(BBe)for(r=jae.length-1;r>=0;)e=jae[r],ew(e,t)&&!PBe(a,e)&&(a[a.length]=e),r-=1;return a}),ev=OBe,NBe=Fa(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),Zae=NBe;function Hae(t,e,r,a){var i=qae(t),h=qae(e);function l(p,b){return dB(p,b,r.slice(),a.slice())}return!Uae(function(p,b){return!Uae(l,b,p)},h,i)}function dB(t,e,r,a){if(AI(t,e))return!0;var i=Zae(t);if(i!==Zae(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&RBe(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&AI(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!AI(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var h=r.length-1;h>=0;){if(r[h]===t)return a[h]===e;h-=1}switch(i){case"Map":return t.size!==e.size?!1:Hae(t.entries(),e.entries(),r.concat([t]),a.concat([e]));case"Set":return t.size!==e.size?!1:Hae(t.values(),e.values(),r.concat([t]),a.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var l=ev(t);if(l.length!==ev(e).length)return!1;var p=r.concat([t]),b=a.concat([e]);for(h=l.length-1;h>=0;){var g=l[h];if(!(ew(g,e)&&dB(e[g],t[g],p,b)))return!1;h-=1}return!0}var CBe=Fn(function(t,e){return dB(t,e,[],[])}),voe=CBe;function LBe(t,e,r){var a,i;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(a=1/e;r<t.length;){if(i=t[r],i===0&&1/i===a)return r;r+=1}return-1}else if(e!==e){for(;r<t.length;){if(i=t[r],typeof i=="number"&&i!==i)return r;r+=1}return-1}return t.indexOf(e,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,r);case"object":if(e===null)return t.indexOf(e,r)}for(;r<t.length;){if(voe(t[r],e))return r;r+=1}return-1}function DBe(t,e){return LBe(e,t,0)>=0}function k2(t,e){for(var r=0,a=e.length,i=Array(a);r<a;)i[r]=t(e[r]),r+=1;return i}function RI(t){var e=t.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+e.replace(/"/g,'\\"')+'"'}var b2=function(t){return(t<10?"0":"")+t},$Be=typeof Date.prototype.toISOString=="function"?function(t){return t.toISOString()}:function(t){return t.getUTCFullYear()+"-"+b2(t.getUTCMonth()+1)+"-"+b2(t.getUTCDate())+"T"+b2(t.getUTCHours())+":"+b2(t.getUTCMinutes())+":"+b2(t.getUTCSeconds())+"."+(t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"},qBe=$Be;function UBe(t){return function(){return!t.apply(this,arguments)}}function moe(t,e,r){for(var a=0,i=r.length;a<i;)e=t(e,r[a]),a+=1;return e}function FBe(t,e){for(var r=0,a=e.length,i=[];r<a;)t(e[r])&&(i[i.length]=e[r]),r+=1;return i}function jBe(t){return Object.prototype.toString.call(t)==="[object Object]"}var zBe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=B2.init,t.prototype["@@transducer/result"]=B2.result,t.prototype["@@transducer/step"]=function(e,r){return this.f(r)?this.xf["@@transducer/step"](e,r):e},t}();function ZBe(t){return function(e){return new zBe(t,e)}}var HBe=Fn(cB(["fantasy-land/filter","filter"],ZBe,function(t,e){return jBe(e)?moe(function(r,a){return t(e[a])&&(r[a]=e[a]),r},{},ev(e)):FBe(t,e)})),KBe=HBe,WBe=Fn(function(t,e){return KBe(UBe(t),e)}),VBe=WBe;function goe(t,e){var r=function(h){var l=e.concat([t]);return DBe(h,l)?"<Circular>":goe(h,l)},a=function(h,l){return k2(function(p){return RI(p)+": "+r(h[p])},l.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+k2(r,t).join(", ")+"))";case"[object Array]":return"["+k2(r,t).concat(a(t,VBe(function(h){return/^\d+$/.test(h)},ev(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):RI(qBe(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":RI(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var i=t.toString();if(i!=="[object Object]")return i}return"{"+a(t,ev(t)).join(", ")+"}"}}var GBe=Fa(function(t){return goe(t,[])}),Kae=GBe,YBe=Fn(function(t,e){if(t===e)return e;function r(p,b){if(p>b!=b>p)return b>p?b:p}var a=r(t,e);if(a!==void 0)return a;var i=r(typeof t,typeof e);if(i!==void 0)return i===typeof t?t:e;var h=Kae(t),l=r(h,Kae(e));return l!==void 0&&l===h?t:e}),JBe=YBe,XBe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=B2.init,t.prototype["@@transducer/result"]=B2.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),QBe=function(t){return function(e){return new XBe(t,e)}},ePe=QBe,tPe=Fn(cB(["fantasy-land/map","map"],ePe,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return poe(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return moe(function(r,a){return r[a]=t(e[a]),r},{},ev(e));default:return k2(t,e)}})),rPe=tPe,boe=Number.isInteger||function(t){return t<<0===t};function yoe(t){return Object.prototype.toString.call(t)==="[object String]"}function woe(t,e){var r=t<0?e.length+t:t;return yoe(e)?e.charAt(r):e[r]}var iPe=Fn(function(t,e){if(e!=null)return boe(t)?woe(t,e):e[t]}),Ew=iPe,nPe=Fn(function(t,e){return rPe(Ew(t),e)}),aPe=nPe,oPe=Fa(function(t){return lB(t)?!0:!t||typeof t!="object"||yoe(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),sPe=oPe,Wae=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function fPe(t,e,r){return function(a,i,h){if(sPe(h))return t(a,i,h);if(h==null)return i;if(typeof h["fantasy-land/reduce"]=="function")return e(a,i,h,"fantasy-land/reduce");if(h[Wae]!=null)return r(a,i,h[Wae]());if(typeof h.next=="function")return r(a,i,h);if(typeof h.reduce=="function")return e(a,i,h,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function uPe(t,e,r){for(var a=0,i=r.length;a<i;){if(e=t["@@transducer/step"](e,r[a]),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}a+=1}return t["@@transducer/result"](e)}var hPe=Fn(function(t,e){return Sw(t.length,function(){return t.apply(e,arguments)})}),lPe=hPe;function cPe(t,e,r){for(var a=r.next();!a.done;){if(e=t["@@transducer/step"](e,a.value),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}a=r.next()}return t["@@transducer/result"](e)}function dPe(t,e,r,a){return t["@@transducer/result"](r[a](lPe(t["@@transducer/step"],t),e))}var pPe=fPe(uPe,dPe,cPe),vPe=pPe,mPe=function(){function t(e){this.f=e}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(e){return e},t.prototype["@@transducer/step"]=function(e,r){return this.f(e,r)},t}();function gPe(t){return new mPe(t)}var bPe=hB(function(t,e,r){return vPe(typeof t=="function"?gPe(t):t,e,r)}),_oe=bPe;function yPe(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function Moe(t,e){return function(){var r=arguments.length;if(r===0)return e();var a=arguments[r-1];return lB(a)||typeof a[t]!="function"?e.apply(this,arguments):a[t].apply(a,Array.prototype.slice.call(arguments,0,r-1))}}var wPe=hB(Moe("slice",function(t,e,r){return Array.prototype.slice.call(r,t,e)})),_Pe=wPe,MPe=Fa(Moe("tail",_Pe(1,1/0))),xPe=MPe;function xoe(){if(arguments.length===0)throw new Error("pipe requires at least one argument");return Sw(arguments[0].length,_oe(yPe,arguments[0],xPe(arguments)))}var SPe=Fn(function(t,e){return poe(_oe(JBe,0,aPe("length",e)),function(){var r=arguments,a=this;return t.apply(a,k2(function(i){return i.apply(a,r)},e))})}),EPe=SPe,APe=Fn(function(t,e){return e==null||e!==e?t:e}),CI=APe,RPe=function(){function t(e,r){this.xf=r,this.f=e,this.found=!1}return t.prototype["@@transducer/init"]=B2.init,t.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},t.prototype["@@transducer/step"]=function(e,r){return this.f(r)&&(this.found=!0,e=ABe(this.xf["@@transducer/step"](e,r))),e},t}();function TPe(t){return function(e){return new RPe(t,e)}}var kPe=Fn(cB(["find"],TPe,function(t,e){for(var r=0,a=e.length;r<a;){if(t(e[r]))return e[r];r+=1}})),IPe=kPe,BPe=Fa(function(t){return EPe(function(){return Array.prototype.slice.call(arguments,0)},t)}),PPe=BPe;function OPe(t,e){for(var r=e,a=0;a<t.length;a+=1){if(r==null)return;var i=t[a];boe(i)?r=woe(i,r):r=r[i]}return r}var NPe=Fn(OPe),Soe=NPe,CPe=hB(function(t,e,r){return voe(t,Ew(e,r))}),LPe=CPe,tw=class extends Error{name="InvalidSchedulerLocation"},DPe=class extends Error{name="SchedulerTagNotFound"},$Pe=class extends Error{name="TransactionNotFound"},qPe="Url",UPe="Time-To-Live",FPe="Scheduler",LI=t=>xoe(CI([]),IPe(LPe(t,"name")),CI({}),Ew("value")),Eoe=t=>xoe(e=>{if(!e)throw new $Pe(t);return e},Ew("tags"),CI([]));function Aoe({fetch:t,GRAPHQL_URL:e}){return async({query:r,variables:a})=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:a})}).then(i=>i.json())}function jPe({fetch:t,GRAPHQL_URL:e}){let r=Aoe({fetch:t,GRAPHQL_URL:e}),a=Roe({fetch:t,GRAPHQL_URL:e}),i=`
|
|
132
|
+
nonce: bundlr`),Me.from(i))}};ie();ae();ne();var Q0=class{_publicKey;ownerLength=Wr[wr.MULTIAPTOS].pubLength;signatureLength=Wr[wr.MULTIAPTOS].sigLength;signatureType=wr.MULTIAPTOS;collectSignatures;provider;constructor(e,r){this._publicKey=e,this.collectSignatures=r}get publicKey(){return this._publicKey}async sign(e){let{signatures:r,bitmap:a}=await this.collectSignatures(e),i=128,h=new Uint8Array([0,0,0,0]),l=new Set;a.forEach(g=>{if(g>=32)throw new Error(`Invalid bit value ${g}.`);if(l.has(g))throw new Error("Duplicated bits detected.");l.add(g);let y=Math.floor(g/8),M=h[y];M|=i>>g%8,h[y]=M});let p=Me.alloc(this.signatureLength),b=0;for(let g=0;g<32;g++)a.includes(g)&&p.set(r[b++],g*64);return p.set(h,this.signatureLength-4),p}static async verify(e,r,a){let h=Wr[wr.MULTIAPTOS].sigLength-4,l=a.slice(0,h),p=a.slice(h),b=!1;for(let g=0;g<32;g++){let y=Math.floor(g/8),M=g-y*8;if((p[y]&128>>M)!==0){let E=l.slice(g*64,(g+1)*64),A=e.slice(g*32,(g+1)*32);await ql(Me.from(E),Me.from(r),Me.from(A))||(b=!0)}}return!b}};ie();ae();ne();var ed=class extends Io{ownerLength=Wr[wr.TYPEDETHEREUM].pubLength;signatureLength=Wr[wr.TYPEDETHEREUM].sigLength;signatureType=wr.TYPEDETHEREUM;address;signer;constructor(e){super(e),this.address="0x"+cg(super.publicKey.slice(1)).slice(-20).toString("hex"),this.signer=new r1(e)}get publicKey(){return Me.from(this.address)}async sign(e){let r=await this.signer._signTypedData(bg,yg,{address:this.address,"Transaction hash":e});return Me.from(r.slice(2),"hex")}static async verify(e,r,a){let i=e.toString(),h=Z3(bg,yg,{address:i,"Transaction hash":r},a);return i.toLowerCase()===h.toLowerCase()}},bg={name:"Bundlr",version:"1"},yg={Bundlr:[{name:"Transaction hash",type:"bytes"},{name:"address",type:"address"}]};ie();ae();ne();var rT=class{ownerLength=Wr[wr.TYPEDETHEREUM].pubLength;signatureLength=Wr[wr.TYPEDETHEREUM].sigLength;signatureType=wr.TYPEDETHEREUM;address;signer;publicKey;constructor(e){this.signer=e.getSigner()}async ready(){this.address=(await this.signer.getAddress()).toString().toLowerCase(),this.publicKey=Me.from(this.address)}async sign(e){let r=await this.signer._signTypedData(bg,yg,{address:this.address,"Transaction hash":e});return Me.from(r.slice(2),"hex")}static verify(e,r,a){let i=e.toString(),h=Z3(bg,yg,{address:i,"Transaction hash":r},a);return i.toLowerCase()===h.toLowerCase()}};ie();ae();ne();var $X=gi(qo(),1);var v1=class{signer;publicKey;ownerLength=Wr[wr.ARWEAVE].pubLength;signatureLength=Wr[wr.ARWEAVE].sigLength;signatureType=wr.ARWEAVE;constructor(e){this.signer=e}async setPublicKey(){let e=await this.signer.getActivePublicKey();this.publicKey=$X.default.toBuffer(e)}async sign(e){this.publicKey||await this.setPublicKey();let r={name:"RSA-PSS",saltLength:32},a=await this.signer.signature(e,r);return new Uint8Array(Object.values(a).map(h=>+h))}static async verify(e,r,a){return await xn().verify(e,r,a)}};ie();ae();ne();var wg=class extends Io{signatureType=wr.KYVE};var _g={1:Hl,2:xo,3:Io,4:J0,5:X0,6:Q0,7:ed};ie();ae();ne();ie();ae();ne();async function H4e(t){return Ul([(0,Pi.stringToBuffer)("dataitem"),(0,Pi.stringToBuffer)("1"),(0,Pi.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}var Mg=H4e;ie();ae();ne();ie();ae();ne();function xg(t,e){let r=new Uint8Array(t);if(e<0)throw new Error("Array is unsigned, cannot represent -ve numbers");if(e>2**(t*8)-1)throw new Error(`Number ${e} is too large for an array of ${t} bytes`);for(let a=0;a<r.length;a++){let i=e&255;r[a]=i,e=(e-i)/256}return r}function x8(t){return xg(8,t)}function iT(t){return xg(2,t)}function K4e(t){return xg(16,t)}function S8(t){return xg(32,t)}function yn(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}ie();ae();ne();var Eg=gi(qo(),1);ie();ae();ne();var Is=gi(qo(),1);lo();ie();ae();ne();var Sg=class{buf;pos;constructor(e=Me.alloc(E8),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,a;if(r)for(this.writeLong(r),a=0;a<r;a++){let i=e[a];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 e=Me.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}writeLong(e){let r=this.buf,a,i;if(e>=-1073741824&&e<1073741824){i=e>=0?e<<1:~e<<1|1;do r[this.pos]=i&127,i>>=7;while(i&&(r[this.pos++]|=128))}else{a=e>=0?e*2:-e*2-1;do r[this.pos]=a&127,a/=128;while(a>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(e){let r=Me.byteLength(e),a=this.buf;this.writeLong(r);let i=this.pos;if(this.pos+=r,!(this.pos>a.length)){if(r>64)this.buf.write(e,this.pos-r,r,"utf8");else{let h,l,p,b;for(h=0,l=r;h<l;h++)p=e.charCodeAt(h),p<128?a[i++]=p:p<2048?(a[i++]=p>>6|192,a[i++]=p&63|128):(p&64512)===55296&&((b=e.charCodeAt(h+1))&64512)===56320?(p=65536+((p&1023)<<10)+(b&1023),h++,a[i++]=p>>18|240,a[i++]=p>>12&63|128,a[i++]=p>>6&63|128,a[i++]=p&63|128):(a[i++]=p>>12|224,a[i++]=p>>6&63|128,a[i++]=p&63|128)}this.buf=a}}readLong(){let e=0,r=0,a=this.buf,i,h,l,p;do i=a[this.pos++],h=i&128,e|=(i&127)<<r,r+=7;while(h&&r<28);if(h){l=e,p=268435456;do i=a[this.pos++],l+=(i&127)*p,p*=128;while(i&128);return(l%2?-(l+1):l)/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 a=this.readString(),i=this.readString();e.push({name:a,value:i})}return e}readString(){let e=this.readLong(),r=this.pos,a=this.buf;if(this.pos+=e,this.pos>a.length)throw new Error("TAP Position out of range");return this.buf.slice(r,r+e).toString()}};function nT(t){if(t?.length===0)return Me.allocUnsafe(0);let e=new Sg;return e.writeTags(t),e.toBuffer()}function m1(t){return new Sg(t).readTags()}du();var R8=80,E8=4096,A8=class t{binary;_id;constructor(e){this.binary=e}static isDataItem(e){return e.binary!==void 0}get signatureType(){let e=yn(this.binary.subarray(0,2));if(wr?.[e]!==void 0)return e;throw new Error("Unknown signature type: "+e)}async isValid(){return t.verify(this.binary)}get id(){return Is.default.encode(this.rawId)}set id(e){this._id=Is.default.toBuffer(e)}get rawId(){return pf("sha256").update(this.rawSignature).digest()}set rawId(e){this._id=e}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Is.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 Wr[this.signatureType].sigLength}get owner(){return Is.default.encode(this.rawOwner)}get ownerLength(){return Wr[this.signatureType].pubLength}get rawTarget(){let e=this.getTargetStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):Me.alloc(0)}get target(){return Is.default.encode(this.rawTarget)}get rawAnchor(){let e=this.getAnchorStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):Me.alloc(0)}get anchor(){return Is.default.encode(this.rawAnchor)}get rawTags(){let e=this.getTagsStart(),r=yn(this.binary.subarray(e+8,e+16));return this.binary.subarray(e+16,e+16+r)}get tags(){let e=this.getTagsStart();if(yn(this.binary.subarray(e,e+8))==0)return[];let a=yn(this.binary.subarray(e+8,e+16));return m1(Me.from(this.binary.subarray(e+16,e+16+a)))}get tagsB64Url(){return this.tags.map(r=>({name:Is.default.encode(r.name),value:Is.default.encode(r.value)}))}getStartOfData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),a=yn(r);return e+16+a}get rawData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),a=yn(r),i=e+16+a;return this.binary.subarray(i,this.binary.length)}get data(){return Is.default.encode(this.rawData)}getRaw(){return this.binary}async sign(e){return this._id=await T8(this,e),this.rawId}async setSignature(e){this.binary.set(e,2),this._id=Me.from(await xn().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:Is.default.encode(e.name),value:Is.default.encode(e.value)})),data:this.data}}static async verify(e){if(e.byteLength<R8)return!1;let r=new t(e),a=r.signatureType,i=r.getTagsStart(),h=yn(e.subarray(i,i+8)),l=e.subarray(i+8,i+16),p=yn(l);if(p>E8)return!1;if(h>0)try{if(m1(Me.from(e.subarray(i+16,i+16+p))).length!==h)return!1}catch{return!1}let b=_g[a],g=await Mg(r);return await b.verify(r.rawOwner,g,r.rawSignature)}async getSignatureData(){return Mg(this)}getTagsStart(){let e=this.getTargetStart(),r=this.binary[e]==1,a=e+(r?33:1),i=this.binary[a]==1;return a+=i?33:1,a}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}},g1=A8;du();var Bu=32,k8=class{length;items;binary;constructor(e){this.binary=e,this.length=this.getDataItemCount(),this.items=this.getItems()}getRaw(){return this.binary}get(e){if(typeof e=="number"){if(e>=this.length)throw new RangeError("Index out of range");return this.getByIndex(e)}else return this.getById(e)}getSizes(){let e=[];for(let r=Bu;r<Bu+64*this.length;r+=64)e.push(yn(this.binary.subarray(r,r+32)));return e}getIds(){let e=[];for(let r=Bu;r<Bu+64*this.length;r+=64){let a=this.binary.subarray(r+32,r+64);if(a.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");e.push(Eg.default.encode(a))}return e}getIdBy(e){if(e>this.length-1)throw new RangeError("Index of bundle out of range");let r=64+64*e;return Eg.default.encode(this.binary.subarray(r,r+32))}async toTransaction(e,r,a){let i=await r.createTransaction({data:this.binary,...e},a);return i.addTag("Bundle-Format","binary"),i.addTag("Bundle-Version","2.0.0"),i}async verify(){for(let e of this.items){let r=await e.isValid(),a=(0,Eg.default)(pf("sha256").update(e.rawSignature).digest());if(!(r&&e.id===a))return!1}return!0}getOffset(e){let r=0;for(let a=Bu;a<Bu+64*this.length;a+=64){let i=yn(this.binary.subarray(a,a+32));r+=i;let h=this.binary.subarray(a+32,a+64);if(Me.compare(h,e)===0)return{startOffset:r,size:i}}return{startOffset:-1,size:-1}}getByIndex(e){let r=0,a=this.getBundleStart(),i=0,h,l;for(let y=Bu;y<Bu+64*this.length;y+=64){if(h=yn(this.binary.subarray(y,y+32)),i++===e){l=this.binary.subarray(y+32,y+64);break}r+=h}let p=a+r,b=this.binary.subarray(p,p+h),g=new g1(b);return g.rawId=l,g}getById(e){let r=Eg.default.toBuffer(e),a=this.getOffset(r);if(a.startOffset===-1)throw new Error("Transaction not found");let h=this.getBundleStart()+a.startOffset;return new g1(this.binary.subarray(h,h+a.size))}getDataItemCount(){return yn(this.binary.subarray(0,32))}getBundleStart(){return 32+64*this.length}getItems(){let e=new Array(this.length),r=0,a=this.getBundleStart(),i=0;for(let h=Bu;h<Bu+64*this.length;h+=64){let l=yn(this.binary.subarray(h,h+32)),p=this.binary.subarray(h+32,h+64);if(p.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");let b=a+r,g=this.binary.subarray(b,b+l);r+=l;let y=new g1(g);y.rawId=p,e[i]=y,i++}return e}},aT=k8;function W4e(t){return new aT(t)}async function V4e(t,e){let r=new Uint8Array(64*t.length),a=await Promise.all(t.map(async(h,l)=>{let p=h.isSigned()?h.rawId:await T8(h,e),b=new Uint8Array(64);return b.set(S8(h.getRaw().byteLength),0),b.set(p,32),r.set(b,64*l),h.getRaw()})).then(h=>Me.concat(h)),i=Me.concat([Me.from(S8(t.length)),Me.from(r),a]);return new aT(i)}async function qX(t,e){let r=await Mg(t),a=await e.sign(r),i=await xn().hash(a);return{signature:Me.from(a),id:Me.from(i)}}async function T8(t,e){let{signature:r,id:a}=await qX(t,e);return t.getRaw().set(r,2),a}ie();ae();ne();var UX=gi(qo(),1);function Ag(t,e,r){let a=e.publicKey,i=r?.target?UX.default.toBuffer(r.target):null,h=1+(i?.byteLength??0),l=r?.anchor?Me.from(r.anchor):null,p=1+(l?.byteLength??0),b=(r?.tags?.length??0)>0?nT(r?.tags):null,g=16+(b?b.byteLength:0),y=typeof t=="string"?Me.from(t):Me.from(t),M=y.byteLength,x=2+e.signatureLength+e.ownerLength+h+p+g+M,E=Me.alloc(x);if(E.set(iT(e.signatureType),0),E.set(new Uint8Array(e.signatureLength).fill(0),2),a.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${a.byteLength}`);E.set(a,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(E[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);E.set(i,A+1)}let k=A+h,P=k+1;if(E[k]=l?1:0,l){if(P+=l.byteLength,l.byteLength!==32)throw new Error("Anchor must be 32 bytes");E.set(l,k+1)}E.set(x8(r?.tags?.length??0),P);let N=x8(b?.byteLength??0);E.set(N,P+8),b&&E.set(b,P+16);let L=P+g;return E.set(y,L),new g1(E)}ie();ae();ne();ie();ae();ne();var oT=class{signatureType;rawSignature;signature;signatureLength;rawOwner;owner;ownerLength;rawTarget;target;rawAnchor;anchor;rawTags;tags;rawData;data;static async verify(...e){throw new Error("You must implement `verify`")}};ie();ae();ne();ie();ae();ne();var hT={};Ha(hT,{default:()=>J4e,processStream:()=>HX,streamExportForTesting:()=>X4e,streamSigner:()=>Y4e});ie();ae();ne();I8();var td=gi(qo(),1);du();async function HX(t){let e=KX(t),r=(await e.next()).value;r=await La(e,r,32);let a=yn(r.subarray(0,32));r=r.subarray(32);let i=64*a;r=await La(e,r,i);let h=new Array(a);for(let b=0;b<i;b+=64)h[b/64]=[yn(r.subarray(b,b+32)),(0,td.default)(Me.from(r.subarray(b+32,b+64)))];r=r.subarray(i);let l=32+i,p=[];for(let[b,g]of h){r=await La(e,r,R8),r=await La(e,r,2);let y=yn(r.subarray(0,2));r=r.subarray(2);let{sigLength:M,pubLength:x,sigName:E}=Wr[y];r=await La(e,r,M);let A=r.subarray(0,M);r=r.subarray(M),r=await La(e,r,x);let k=r.subarray(0,x);r=r.subarray(x),r=await La(e,r,1);let P=r[0]===1;P&&(r=await La(e,r,33));let N=P?r.subarray(1,33):Me.allocUnsafe(0);r=r.subarray(P?33:1),r=await La(e,r,1);let L=r[0]===1;L&&(r=await La(e,r,33));let C=L?r.subarray(1,33):Me.allocUnsafe(0);r=r.subarray(L?33:1),r=await La(e,r,8);let Y=yn(r.subarray(0,8));r=r.subarray(8),r=await La(e,r,8);let G=yn(r.subarray(0,8));r=r.subarray(8),r=await La(e,r,G);let ee=r.subarray(0,G),D=Y!==0&&G!==0?m1(Me.from(ee)):[];if(D.length!==Y)throw new Error("Tags lengths don't match");r=r.subarray(G);let U=new zX;U._transform=function(f,u,c){this.push(f),c()};let V=Ul([(0,Pi.stringToBuffer)("dataitem"),(0,Pi.stringToBuffer)("1"),(0,Pi.stringToBuffer)(y.toString()),k,N,C,ee,U]),_=2+M+x+(P?33:1)+(L?33:1)+16+G,n=b-_;if(r.byteLength>n)U.write(r.subarray(0,n)),r=r.subarray(n);else{let f=r.byteLength;for(U.write(r);n>f;){if(r=(await e.next()).value,!r)throw new Error(`Not enough data bytes expected: ${n} received: ${f}`);f+=r.byteLength,f>n?U.write(r.subarray(0,r.byteLength-(f-n))):U.write(r)}r=r.subarray(r.byteLength-(f-n))}if(U.end(),g!==(0,td.default)(pf("sha256").update(A).digest()))throw new Error("ID doesn't match signature");if(!await _g[y].verify(k,await V,A))throw new Error("Invalid signature");p.push({id:g,sigName:E,signature:(0,td.default)(Me.from(A)),target:(0,td.default)(Me.from(N)),anchor:(0,td.default)(Me.from(C)),owner:(0,td.default)(Me.from(k)),tags:D,dataOffset:l+_,dataSize:n}),l+=_+n}return p}async function Y4e(t,e,r,a){let i=Ag("",r,a),h=new ZX,l=[(0,Pi.stringToBuffer)("dataitem"),(0,Pi.stringToBuffer)("1"),(0,Pi.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,t],p=await Ul(l),b=Me.from(await r.sign(p));return i.setSignature(b),h.write(i.getRaw()),e.pipe(h)}async function La(t,e,r){if(e.byteLength>=r)return e;let{done:a,value:i}=await t.next();if(a&&!i)throw new Error("Invalid buffer");return La(t,Me.concat([Me.from(e),Me.from(i)]),r)}async function*KX(t){for await(let e of t)yield e}var J4e=HX,X4e={readBytes:La,getReader:KX};var Q4e={...sT,stream:hT};globalThis.arbundles??=Q4e;ie();ae();ne();ie();ae();ne();ie();ae();ne();ie();ae();ne();var fi;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let h={};for(let l of i)h[l]=l;return h},t.getValidEnumValues=i=>{let h=t.objectKeys(i).filter(p=>typeof i[i[p]]!="number"),l={};for(let p of h)l[p]=i[p];return t.objectValues(l)},t.objectValues=i=>t.objectKeys(i).map(function(h){return i[h]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let h=[];for(let l in i)Object.prototype.hasOwnProperty.call(i,l)&&h.push(l);return h},t.find=(i,h)=>{for(let l of i)if(h(l))return l},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function a(i,h=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(h)}t.joinValues=a,t.jsonStringifyReplacer=(i,h)=>typeof h=="bigint"?h.toString():h})(fi||(fi={}));var cT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(cT||(cT={}));var Yt=fi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),lc=t=>{switch(typeof t){case"undefined":return Yt.undefined;case"string":return Yt.string;case"number":return isNaN(t)?Yt.nan:Yt.number;case"boolean":return Yt.boolean;case"function":return Yt.function;case"bigint":return Yt.bigint;case"symbol":return Yt.symbol;case"object":return Array.isArray(t)?Yt.array:t===null?Yt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Yt.promise:typeof Map<"u"&&t instanceof Map?Yt.map:typeof Set<"u"&&t instanceof Set?Yt.set:typeof Date<"u"&&t instanceof Date?Yt.date:Yt.object;default:return Yt.unknown}},Pt=fi.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"]),ewe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Bo=class t extends Error{constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(h){return h.message},a={_errors:[]},i=h=>{for(let l of h.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)a._errors.push(r(l));else{let p=a,b=0;for(;b<l.path.length;){let g=l.path[b];b===l.path.length-1?(p[g]=p[g]||{_errors:[]},p[g]._errors.push(r(l))):p[g]=p[g]||{_errors:[]},p=p[g],b++}}};return i(this),a}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fi.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},a=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):a.push(e(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};Bo.create=t=>new Bo(t);var w1=(t,e)=>{let r;switch(t.code){case Pt.invalid_type:t.received===Yt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Pt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,fi.jsonStringifyReplacer)}`;break;case Pt.unrecognized_keys:r=`Unrecognized key(s) in object: ${fi.joinValues(t.keys,", ")}`;break;case Pt.invalid_union:r="Invalid input";break;case Pt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${fi.joinValues(t.options)}`;break;case Pt.invalid_enum_value:r=`Invalid enum value. Expected ${fi.joinValues(t.options)}, received '${t.received}'`;break;case Pt.invalid_arguments:r="Invalid function arguments";break;case Pt.invalid_return_type:r="Invalid function return type";break;case Pt.invalid_date:r="Invalid date";break;case Pt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:fi.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Pt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Pt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Pt.custom:r="Invalid input";break;case Pt.invalid_intersection_types:r="Intersection results could not be merged";break;case Pt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Pt.not_finite:r="Number must be finite";break;default:r=e.defaultError,fi.assertNever(t)}return{message:r}},GX=w1;function twe(t){GX=t}function B8(){return GX}var P8=t=>{let{data:e,path:r,errorMaps:a,issueData:i}=t,h=[...r,...i.path||[]],l={...i,path:h};if(i.message!==void 0)return{...i,path:h,message:i.message};let p="",b=a.filter(g=>!!g).slice().reverse();for(let g of b)p=g(l,{data:e,defaultError:p}).message;return{...i,path:h,message:p}},rwe=[];function Wt(t,e){let r=B8(),a=P8({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===w1?void 0:w1].filter(i=>!!i)});t.common.issues.push(a)}var Ia=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let a=[];for(let i of r){if(i.status==="aborted")return pr;i.status==="dirty"&&e.dirty(),a.push(i.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let i of r){let h=await i.key,l=await i.value;a.push({key:h,value:l})}return t.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let i of r){let{key:h,value:l}=i;if(h.status==="aborted"||l.status==="aborted")return pr;h.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),h.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(a[h.value]=l.value)}return{status:e.value,value:a}}},pr=Object.freeze({status:"aborted"}),y1=t=>({status:"dirty",value:t}),Da=t=>({status:"valid",value:t}),dT=t=>t.status==="aborted",pT=t=>t.status==="dirty",Ig=t=>t.status==="valid",Bg=t=>typeof Promise<"u"&&t instanceof Promise;function O8(t,e,r,a){if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?a:r==="a"?a.call(t):a?a.value:e.get(t)}function YX(t,e,r,a,i){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}var rr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(rr||(rr={}));var Tg,kg,Ps=class{constructor(e,r,a,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,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}},WX=(t,e)=>{if(Ig(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Bo(t.common.issues);return this._error=r,this._error}}};function Br(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:i}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(l,p)=>{var b,g;let{message:y}=t;return l.code==="invalid_enum_value"?{message:y??p.defaultError}:typeof p.data>"u"?{message:(b=y??a)!==null&&b!==void 0?b:p.defaultError}:l.code!=="invalid_type"?{message:p.defaultError}:{message:(g=y??r)!==null&&g!==void 0?g:p.defaultError}},description:i}}var Pr=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,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)}get description(){return this._def.description}_getType(e){return lc(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:lc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ia,ctx:{common:e.parent.common,data:e.data,parsedType:lc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Bg(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let a=this.safeParse(e,r);if(a.success)return a.data;throw a.error}safeParse(e,r){var a;let i={common:{issues:[],async:(a=r?.async)!==null&&a!==void 0?a:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:lc(e)},h=this._parseSync({data:e,path:i.path,parent:i});return WX(i,h)}async parseAsync(e,r){let a=await this.safeParseAsync(e,r);if(a.success)return a.data;throw a.error}async safeParseAsync(e,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:lc(e)},i=this._parse({data:e,path:a.path,parent:a}),h=await(Bg(i)?i:Promise.resolve(i));return WX(a,h)}refine(e,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,h)=>{let l=e(i),p=()=>h.addIssue({code:Pt.custom,...a(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(b=>b?!0:(p(),!1)):l?!0:(p(),!1)})}refinement(e,r){return this._refinement((a,i)=>e(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(e){return new Po({schema:this,typeName:lr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Bs.create(this,this._def)}nullable(){return Ou.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lh.create(this,this._def)}promise(){return pc.create(this,this._def)}or(e){return fd.create([this,e],this._def)}and(e){return ud.create(this,e,this._def)}transform(e){return new Po({...Br(this._def),schema:this,typeName:lr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new pd({...Br(this._def),innerType:this,defaultValue:r,typeName:lr.ZodDefault})}brand(){return new Pg({typeName:lr.ZodBranded,type:this,...Br(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new vd({...Br(this._def),innerType:this,catchValue:r,typeName:lr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Og.create(this,e)}readonly(){return md.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},iwe=/^c[^\s-]{8,}$/i,nwe=/^[0-9a-z]+$/,awe=/^[0-9A-HJKMNP-TV-Z]{26}$/,owe=/^[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,swe=/^[a-z0-9_-]{21}$/i,fwe=/^[-+]?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)?)??$/,uwe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hwe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lT,lwe=/^(?:(?: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])$/,cwe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,dwe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JX="((\\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])))",pwe=new RegExp(`^${JX}$`);function XX(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function vwe(t){return new RegExp(`^${XX(t)}$`)}function QX(t){let e=`${JX}T${XX(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function mwe(t,e){return!!((e==="v4"||!e)&&lwe.test(t)||(e==="v6"||!e)&&cwe.test(t))}var cc=class t extends Pr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Yt.string){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_type,expected:Yt.string,received:h.parsedType}),pr}let a=new Ia,i;for(let h of this._def.checks)if(h.kind==="min")e.data.length<h.value&&(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),a.dirty());else if(h.kind==="max")e.data.length>h.value&&(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),a.dirty());else if(h.kind==="length"){let l=e.data.length>h.value,p=e.data.length<h.value;(l||p)&&(i=this._getOrReturnCtx(e,i),l?Wt(i,{code:Pt.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}):p&&Wt(i,{code:Pt.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}),a.dirty())}else if(h.kind==="email")uwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"email",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="emoji")lT||(lT=new RegExp(hwe,"u")),lT.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"emoji",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="uuid")owe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"uuid",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="nanoid")swe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"nanoid",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="cuid")iwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"cuid",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="cuid2")nwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"cuid2",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="ulid")awe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"ulid",code:Pt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Wt(i,{validation:"url",code:Pt.invalid_string,message:h.message}),a.dirty()}else h.kind==="regex"?(h.regex.lastIndex=0,h.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"regex",code:Pt.invalid_string,message:h.message}),a.dirty())):h.kind==="trim"?e.data=e.data.trim():h.kind==="includes"?e.data.includes(h.value,h.position)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:{includes:h.value,position:h.position},message:h.message}),a.dirty()):h.kind==="toLowerCase"?e.data=e.data.toLowerCase():h.kind==="toUpperCase"?e.data=e.data.toUpperCase():h.kind==="startsWith"?e.data.startsWith(h.value)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:{startsWith:h.value},message:h.message}),a.dirty()):h.kind==="endsWith"?e.data.endsWith(h.value)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:{endsWith:h.value},message:h.message}),a.dirty()):h.kind==="datetime"?QX(h).test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:"datetime",message:h.message}),a.dirty()):h.kind==="date"?pwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:"date",message:h.message}),a.dirty()):h.kind==="time"?vwe(h).test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.invalid_string,validation:"time",message:h.message}),a.dirty()):h.kind==="duration"?fwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"duration",code:Pt.invalid_string,message:h.message}),a.dirty()):h.kind==="ip"?mwe(e.data,h.version)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"ip",code:Pt.invalid_string,message:h.message}),a.dirty()):h.kind==="base64"?dwe.test(e.data)||(i=this._getOrReturnCtx(e,i),Wt(i,{validation:"base64",code:Pt.invalid_string,message:h.message}),a.dirty()):fi.assertNever(h);return{status:a.value,value:e.data}}_regex(e,r,a){return this.refinement(i=>e.test(i),{validation:r,code:Pt.invalid_string,...rr.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...rr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...rr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...rr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...rr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...rr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...rr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...rr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...rr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...rr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...rr.errToObj(e)})}datetime(e){var r,a;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(a=e?.local)!==null&&a!==void 0?a:!1,...rr.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...rr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...rr.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...rr.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...rr.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...rr.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...rr.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...rr.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...rr.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...rr.errToObj(r)})}nonempty(e){return this.min(1,rr.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};cc.create=t=>{var e;return new cc({checks:[],typeName:lr.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Br(t)})};function gwe(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,i=r>a?r:a,h=parseInt(t.toFixed(i).replace(".","")),l=parseInt(e.toFixed(i).replace(".",""));return h%l/Math.pow(10,i)}var rd=class t extends Pr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Yt.number){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_type,expected:Yt.number,received:h.parsedType}),pr}let a,i=new Ia;for(let h of this._def.checks)h.kind==="int"?fi.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.invalid_type,expected:"integer",received:"float",message:h.message}),i.dirty()):h.kind==="min"?(h.inclusive?e.data<h.value:e.data<=h.value)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.too_small,minimum:h.value,type:"number",inclusive:h.inclusive,exact:!1,message:h.message}),i.dirty()):h.kind==="max"?(h.inclusive?e.data>h.value:e.data>=h.value)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.too_big,maximum:h.value,type:"number",inclusive:h.inclusive,exact:!1,message:h.message}),i.dirty()):h.kind==="multipleOf"?gwe(e.data,h.value)!==0&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.not_multiple_of,multipleOf:h.value,message:h.message}),i.dirty()):h.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.not_finite,message:h.message}),i.dirty()):fi.assertNever(h);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,rr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,rr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,rr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,rr.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:rr.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:rr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:rr.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:rr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rr.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&fi.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(r)&&Number.isFinite(e)}};rd.create=t=>new rd({checks:[],typeName:lr.ZodNumber,coerce:t?.coerce||!1,...Br(t)});var id=class t extends Pr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Yt.bigint){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_type,expected:Yt.bigint,received:h.parsedType}),pr}let a,i=new Ia;for(let h of this._def.checks)h.kind==="min"?(h.inclusive?e.data<h.value:e.data<=h.value)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.too_small,type:"bigint",minimum:h.value,inclusive:h.inclusive,message:h.message}),i.dirty()):h.kind==="max"?(h.inclusive?e.data>h.value:e.data>=h.value)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.too_big,type:"bigint",maximum:h.value,inclusive:h.inclusive,message:h.message}),i.dirty()):h.kind==="multipleOf"?e.data%h.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),Wt(a,{code:Pt.not_multiple_of,multipleOf:h.value,message:h.message}),i.dirty()):fi.assertNever(h);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,rr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,rr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,rr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,rr.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:rr.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:rr.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};id.create=t=>{var e;return new id({checks:[],typeName:lr.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Br(t)})};var nd=class extends Pr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Yt.boolean){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.boolean,received:a.parsedType}),pr}return Da(e.data)}};nd.create=t=>new nd({typeName:lr.ZodBoolean,coerce:t?.coerce||!1,...Br(t)});var ad=class t extends Pr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Yt.date){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_type,expected:Yt.date,received:h.parsedType}),pr}if(isNaN(e.data.getTime())){let h=this._getOrReturnCtx(e);return Wt(h,{code:Pt.invalid_date}),pr}let a=new Ia,i;for(let h of this._def.checks)h.kind==="min"?e.data.getTime()<h.value&&(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.too_small,message:h.message,inclusive:!0,exact:!1,minimum:h.value,type:"date"}),a.dirty()):h.kind==="max"?e.data.getTime()>h.value&&(i=this._getOrReturnCtx(e,i),Wt(i,{code:Pt.too_big,message:h.message,inclusive:!0,exact:!1,maximum:h.value,type:"date"}),a.dirty()):fi.assertNever(h);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:rr.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:rr.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};ad.create=t=>new ad({checks:[],coerce:t?.coerce||!1,typeName:lr.ZodDate,...Br(t)});var _1=class extends Pr{_parse(e){if(this._getType(e)!==Yt.symbol){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.symbol,received:a.parsedType}),pr}return Da(e.data)}};_1.create=t=>new _1({typeName:lr.ZodSymbol,...Br(t)});var od=class extends Pr{_parse(e){if(this._getType(e)!==Yt.undefined){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.undefined,received:a.parsedType}),pr}return Da(e.data)}};od.create=t=>new od({typeName:lr.ZodUndefined,...Br(t)});var sd=class extends Pr{_parse(e){if(this._getType(e)!==Yt.null){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.null,received:a.parsedType}),pr}return Da(e.data)}};sd.create=t=>new sd({typeName:lr.ZodNull,...Br(t)});var dc=class extends Pr{constructor(){super(...arguments),this._any=!0}_parse(e){return Da(e.data)}};dc.create=t=>new dc({typeName:lr.ZodAny,...Br(t)});var Ch=class extends Pr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Da(e.data)}};Ch.create=t=>new Ch({typeName:lr.ZodUnknown,...Br(t)});var Tf=class extends Pr{_parse(e){let r=this._getOrReturnCtx(e);return Wt(r,{code:Pt.invalid_type,expected:Yt.never,received:r.parsedType}),pr}};Tf.create=t=>new Tf({typeName:lr.ZodNever,...Br(t)});var M1=class extends Pr{_parse(e){if(this._getType(e)!==Yt.undefined){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.void,received:a.parsedType}),pr}return Da(e.data)}};M1.create=t=>new M1({typeName:lr.ZodVoid,...Br(t)});var Lh=class t extends Pr{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),i=this._def;if(r.parsedType!==Yt.array)return Wt(r,{code:Pt.invalid_type,expected:Yt.array,received:r.parsedType}),pr;if(i.exactLength!==null){let l=r.data.length>i.exactLength.value,p=r.data.length<i.exactLength.value;(l||p)&&(Wt(r,{code:l?Pt.too_big:Pt.too_small,minimum:p?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Wt(r,{code:Pt.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Wt(r,{code:Pt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((l,p)=>i.type._parseAsync(new Ps(r,l,r.path,p)))).then(l=>Ia.mergeArray(a,l));let h=[...r.data].map((l,p)=>i.type._parseSync(new Ps(r,l,r.path,p)));return Ia.mergeArray(a,h)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:rr.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:rr.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:rr.toString(r)}})}nonempty(e){return this.min(1,e)}};Lh.create=(t,e)=>new Lh({type:t,minLength:null,maxLength:null,exactLength:null,typeName:lr.ZodArray,...Br(e)});function b1(t){if(t instanceof ao){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=Bs.create(b1(a))}return new ao({...t._def,shape:()=>e})}else return t instanceof Lh?new Lh({...t._def,type:b1(t.element)}):t instanceof Bs?Bs.create(b1(t.unwrap())):t instanceof Ou?Ou.create(b1(t.unwrap())):t instanceof Pu?Pu.create(t.items.map(e=>b1(e))):t}var ao=class t extends Pr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=fi.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Yt.object){let g=this._getOrReturnCtx(e);return Wt(g,{code:Pt.invalid_type,expected:Yt.object,received:g.parsedType}),pr}let{status:a,ctx:i}=this._processInputParams(e),{shape:h,keys:l}=this._getCached(),p=[];if(!(this._def.catchall instanceof Tf&&this._def.unknownKeys==="strip"))for(let g in i.data)l.includes(g)||p.push(g);let b=[];for(let g of l){let y=h[g],M=i.data[g];b.push({key:{status:"valid",value:g},value:y._parse(new Ps(i,M,i.path,g)),alwaysSet:g in i.data})}if(this._def.catchall instanceof Tf){let g=this._def.unknownKeys;if(g==="passthrough")for(let y of p)b.push({key:{status:"valid",value:y},value:{status:"valid",value:i.data[y]}});else if(g==="strict")p.length>0&&(Wt(i,{code:Pt.unrecognized_keys,keys:p}),a.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let g=this._def.catchall;for(let y of p){let M=i.data[y];b.push({key:{status:"valid",value:y},value:g._parse(new Ps(i,M,i.path,y)),alwaysSet:y in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let g=[];for(let y of b){let M=await y.key,x=await y.value;g.push({key:M,value:x,alwaysSet:y.alwaysSet})}return g}).then(g=>Ia.mergeObjectSync(a,g)):Ia.mergeObjectSync(a,b)}get shape(){return this._def.shape()}strict(e){return rr.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{var i,h,l,p;let b=(l=(h=(i=this._def).errorMap)===null||h===void 0?void 0:h.call(i,r,a).message)!==null&&l!==void 0?l:a.defaultError;return r.code==="unrecognized_keys"?{message:(p=rr.errToObj(e).message)!==null&&p!==void 0?p:b}:{message:b}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:lr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return fi.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(r[a]=this.shape[a])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return fi.objectKeys(this.shape).forEach(a=>{e[a]||(r[a]=this.shape[a])}),new t({...this._def,shape:()=>r})}deepPartial(){return b1(this)}partial(e){let r={};return fi.objectKeys(this.shape).forEach(a=>{let i=this.shape[a];e&&!e[a]?r[a]=i:r[a]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return fi.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])r[a]=this.shape[a];else{let h=this.shape[a];for(;h instanceof Bs;)h=h._def.innerType;r[a]=h}}),new t({...this._def,shape:()=>r})}keyof(){return eQ(fi.objectKeys(this.shape))}};ao.create=(t,e)=>new ao({shape:()=>t,unknownKeys:"strip",catchall:Tf.create(),typeName:lr.ZodObject,...Br(e)});ao.strictCreate=(t,e)=>new ao({shape:()=>t,unknownKeys:"strict",catchall:Tf.create(),typeName:lr.ZodObject,...Br(e)});ao.lazycreate=(t,e)=>new ao({shape:t,unknownKeys:"strip",catchall:Tf.create(),typeName:lr.ZodObject,...Br(e)});var fd=class extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function i(h){for(let p of h)if(p.result.status==="valid")return p.result;for(let p of h)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let l=h.map(p=>new Bo(p.ctx.common.issues));return Wt(r,{code:Pt.invalid_union,unionErrors:l}),pr}if(r.common.async)return Promise.all(a.map(async h=>{let l={...r,common:{...r.common,issues:[]},parent:null};return{result:await h._parseAsync({data:r.data,path:r.path,parent:l}),ctx:l}})).then(i);{let h,l=[];for(let b of a){let g={...r,common:{...r.common,issues:[]},parent:null},y=b._parseSync({data:r.data,path:r.path,parent:g});if(y.status==="valid")return y;y.status==="dirty"&&!h&&(h={result:y,ctx:g}),g.common.issues.length&&l.push(g.common.issues)}if(h)return r.common.issues.push(...h.ctx.common.issues),h.result;let p=l.map(b=>new Bo(b));return Wt(r,{code:Pt.invalid_union,unionErrors:p}),pr}}get options(){return this._def.options}};fd.create=(t,e)=>new fd({options:t,typeName:lr.ZodUnion,...Br(e)});var Nh=t=>t instanceof hd?Nh(t.schema):t instanceof Po?Nh(t.innerType()):t instanceof ld?[t.value]:t instanceof cd?t.options:t instanceof dd?fi.objectValues(t.enum):t instanceof pd?Nh(t._def.innerType):t instanceof od?[void 0]:t instanceof sd?[null]:t instanceof Bs?[void 0,...Nh(t.unwrap())]:t instanceof Ou?[null,...Nh(t.unwrap())]:t instanceof Pg||t instanceof md?Nh(t.unwrap()):t instanceof vd?Nh(t._def.innerType):[],N8=class t extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Yt.object)return Wt(r,{code:Pt.invalid_type,expected:Yt.object,received:r.parsedType}),pr;let a=this.discriminator,i=r.data[a],h=this.optionsMap.get(i);return h?r.common.async?h._parseAsync({data:r.data,path:r.path,parent:r}):h._parseSync({data:r.data,path:r.path,parent:r}):(Wt(r,{code:Pt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),pr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let i=new Map;for(let h of r){let l=Nh(h.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of l){if(i.has(p))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(p)}`);i.set(p,h)}}return new t({typeName:lr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Br(a)})}};function vT(t,e){let r=lc(t),a=lc(e);if(t===e)return{valid:!0,data:t};if(r===Yt.object&&a===Yt.object){let i=fi.objectKeys(e),h=fi.objectKeys(t).filter(p=>i.indexOf(p)!==-1),l={...t,...e};for(let p of h){let b=vT(t[p],e[p]);if(!b.valid)return{valid:!1};l[p]=b.data}return{valid:!0,data:l}}else if(r===Yt.array&&a===Yt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let h=0;h<t.length;h++){let l=t[h],p=e[h],b=vT(l,p);if(!b.valid)return{valid:!1};i.push(b.data)}return{valid:!0,data:i}}else return r===Yt.date&&a===Yt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ud=class extends Pr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=(h,l)=>{if(dT(h)||dT(l))return pr;let p=vT(h.value,l.value);return p.valid?((pT(h)||pT(l))&&r.dirty(),{status:r.value,value:p.data}):(Wt(a,{code:Pt.invalid_intersection_types}),pr)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([h,l])=>i(h,l)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};ud.create=(t,e,r)=>new ud({left:t,right:e,typeName:lr.ZodIntersection,...Br(r)});var Pu=class t extends Pr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Yt.array)return Wt(a,{code:Pt.invalid_type,expected:Yt.array,received:a.parsedType}),pr;if(a.data.length<this._def.items.length)return Wt(a,{code:Pt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pr;!this._def.rest&&a.data.length>this._def.items.length&&(Wt(a,{code:Pt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let h=[...a.data].map((l,p)=>{let b=this._def.items[p]||this._def.rest;return b?b._parse(new Ps(a,l,a.path,p)):null}).filter(l=>!!l);return a.common.async?Promise.all(h).then(l=>Ia.mergeArray(r,l)):Ia.mergeArray(r,h)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Pu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pu({items:t,typeName:lr.ZodTuple,rest:null,...Br(e)})};var C8=class t extends Pr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Yt.object)return Wt(a,{code:Pt.invalid_type,expected:Yt.object,received:a.parsedType}),pr;let i=[],h=this._def.keyType,l=this._def.valueType;for(let p in a.data)i.push({key:h._parse(new Ps(a,p,a.path,p)),value:l._parse(new Ps(a,a.data[p],a.path,p)),alwaysSet:p in a.data});return a.common.async?Ia.mergeObjectAsync(r,i):Ia.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof Pr?new t({keyType:e,valueType:r,typeName:lr.ZodRecord,...Br(a)}):new t({keyType:cc.create(),valueType:e,typeName:lr.ZodRecord,...Br(r)})}},x1=class extends Pr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Yt.map)return Wt(a,{code:Pt.invalid_type,expected:Yt.map,received:a.parsedType}),pr;let i=this._def.keyType,h=this._def.valueType,l=[...a.data.entries()].map(([p,b],g)=>({key:i._parse(new Ps(a,p,a.path,[g,"key"])),value:h._parse(new Ps(a,b,a.path,[g,"value"]))}));if(a.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let b of l){let g=await b.key,y=await b.value;if(g.status==="aborted"||y.status==="aborted")return pr;(g.status==="dirty"||y.status==="dirty")&&r.dirty(),p.set(g.value,y.value)}return{status:r.value,value:p}})}else{let p=new Map;for(let b of l){let g=b.key,y=b.value;if(g.status==="aborted"||y.status==="aborted")return pr;(g.status==="dirty"||y.status==="dirty")&&r.dirty(),p.set(g.value,y.value)}return{status:r.value,value:p}}}};x1.create=(t,e,r)=>new x1({valueType:e,keyType:t,typeName:lr.ZodMap,...Br(r)});var S1=class t extends Pr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Yt.set)return Wt(a,{code:Pt.invalid_type,expected:Yt.set,received:a.parsedType}),pr;let i=this._def;i.minSize!==null&&a.data.size<i.minSize.value&&(Wt(a,{code:Pt.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&a.data.size>i.maxSize.value&&(Wt(a,{code:Pt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let h=this._def.valueType;function l(b){let g=new Set;for(let y of b){if(y.status==="aborted")return pr;y.status==="dirty"&&r.dirty(),g.add(y.value)}return{status:r.value,value:g}}let p=[...a.data.values()].map((b,g)=>h._parse(new Ps(a,b,a.path,g)));return a.common.async?Promise.all(p).then(b=>l(b)):l(p)}min(e,r){return new t({...this._def,minSize:{value:e,message:rr.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:rr.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};S1.create=(t,e)=>new S1({valueType:t,minSize:null,maxSize:null,typeName:lr.ZodSet,...Br(e)});var L8=class t extends Pr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Yt.function)return Wt(r,{code:Pt.invalid_type,expected:Yt.function,received:r.parsedType}),pr;function a(p,b){return P8({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,B8(),w1].filter(g=>!!g),issueData:{code:Pt.invalid_arguments,argumentsError:b}})}function i(p,b){return P8({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,B8(),w1].filter(g=>!!g),issueData:{code:Pt.invalid_return_type,returnTypeError:b}})}let h={errorMap:r.common.contextualErrorMap},l=r.data;if(this._def.returns instanceof pc){let p=this;return Da(async function(...b){let g=new Bo([]),y=await p._def.args.parseAsync(b,h).catch(E=>{throw g.addIssue(a(b,E)),g}),M=await Reflect.apply(l,this,y);return await p._def.returns._def.type.parseAsync(M,h).catch(E=>{throw g.addIssue(i(M,E)),g})})}else{let p=this;return Da(function(...b){let g=p._def.args.safeParse(b,h);if(!g.success)throw new Bo([a(b,g.error)]);let y=Reflect.apply(l,this,g.data),M=p._def.returns.safeParse(y,h);if(!M.success)throw new Bo([i(y,M.error)]);return M.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Pu.create(e).rest(Ch.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new t({args:e||Pu.create([]).rest(Ch.create()),returns:r||Ch.create(),typeName:lr.ZodFunction,...Br(a)})}},hd=class extends Pr{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};hd.create=(t,e)=>new hd({getter:t,typeName:lr.ZodLazy,...Br(e)});var ld=class extends Pr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Wt(r,{received:r.data,code:Pt.invalid_literal,expected:this._def.value}),pr}return{status:"valid",value:e.data}}get value(){return this._def.value}};ld.create=(t,e)=>new ld({value:t,typeName:lr.ZodLiteral,...Br(e)});function eQ(t,e){return new cd({values:t,typeName:lr.ZodEnum,...Br(e)})}var cd=class t extends Pr{constructor(){super(...arguments),Tg.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return Wt(r,{expected:fi.joinValues(a),received:r.parsedType,code:Pt.invalid_type}),pr}if(O8(this,Tg,"f")||YX(this,Tg,new Set(this._def.values),"f"),!O8(this,Tg,"f").has(e.data)){let r=this._getOrReturnCtx(e),a=this._def.values;return Wt(r,{received:r.data,code:Pt.invalid_enum_value,options:a}),pr}return Da(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Tg=new WeakMap;cd.create=eQ;var dd=class extends Pr{constructor(){super(...arguments),kg.set(this,void 0)}_parse(e){let r=fi.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==Yt.string&&a.parsedType!==Yt.number){let i=fi.objectValues(r);return Wt(a,{expected:fi.joinValues(i),received:a.parsedType,code:Pt.invalid_type}),pr}if(O8(this,kg,"f")||YX(this,kg,new Set(fi.getValidEnumValues(this._def.values)),"f"),!O8(this,kg,"f").has(e.data)){let i=fi.objectValues(r);return Wt(a,{received:a.data,code:Pt.invalid_enum_value,options:i}),pr}return Da(e.data)}get enum(){return this._def.values}};kg=new WeakMap;dd.create=(t,e)=>new dd({values:t,typeName:lr.ZodNativeEnum,...Br(e)});var pc=class extends Pr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Yt.promise&&r.common.async===!1)return Wt(r,{code:Pt.invalid_type,expected:Yt.promise,received:r.parsedType}),pr;let a=r.parsedType===Yt.promise?r.data:Promise.resolve(r.data);return Da(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};pc.create=(t,e)=>new pc({type:t,typeName:lr.ZodPromise,...Br(e)});var Po=class extends Pr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===lr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=this._def.effect||null,h={addIssue:l=>{Wt(a,l),l.fatal?r.abort():r.dirty()},get path(){return a.path}};if(h.addIssue=h.addIssue.bind(h),i.type==="preprocess"){let l=i.transform(a.data,h);if(a.common.async)return Promise.resolve(l).then(async p=>{if(r.value==="aborted")return pr;let b=await this._def.schema._parseAsync({data:p,path:a.path,parent:a});return b.status==="aborted"?pr:b.status==="dirty"||r.value==="dirty"?y1(b.value):b});{if(r.value==="aborted")return pr;let p=this._def.schema._parseSync({data:l,path:a.path,parent:a});return p.status==="aborted"?pr:p.status==="dirty"||r.value==="dirty"?y1(p.value):p}}if(i.type==="refinement"){let l=p=>{let b=i.refinement(p,h);if(a.common.async)return Promise.resolve(b);if(b instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(a.common.async===!1){let p=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return p.status==="aborted"?pr:(p.status==="dirty"&&r.dirty(),l(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(p=>p.status==="aborted"?pr:(p.status==="dirty"&&r.dirty(),l(p.value).then(()=>({status:r.value,value:p.value}))))}if(i.type==="transform")if(a.common.async===!1){let l=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ig(l))return l;let p=i.transform(l.value,h);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(l=>Ig(l)?Promise.resolve(i.transform(l.value,h)).then(p=>({status:r.value,value:p})):l);fi.assertNever(i)}};Po.create=(t,e,r)=>new Po({schema:t,typeName:lr.ZodEffects,effect:e,...Br(r)});Po.createWithPreprocess=(t,e,r)=>new Po({schema:e,effect:{type:"preprocess",transform:t},typeName:lr.ZodEffects,...Br(r)});var Bs=class extends Pr{_parse(e){return this._getType(e)===Yt.undefined?Da(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bs.create=(t,e)=>new Bs({innerType:t,typeName:lr.ZodOptional,...Br(e)});var Ou=class extends Pr{_parse(e){return this._getType(e)===Yt.null?Da(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ou.create=(t,e)=>new Ou({innerType:t,typeName:lr.ZodNullable,...Br(e)});var pd=class extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===Yt.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pd.create=(t,e)=>new pd({innerType:t,typeName:lr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Br(e)});var vd=class extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Bg(i)?i.then(h=>({status:"valid",value:h.status==="valid"?h.value:this._def.catchValue({get error(){return new Bo(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Bo(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};vd.create=(t,e)=>new vd({innerType:t,typeName:lr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Br(e)});var E1=class extends Pr{_parse(e){if(this._getType(e)!==Yt.nan){let a=this._getOrReturnCtx(e);return Wt(a,{code:Pt.invalid_type,expected:Yt.nan,received:a.parsedType}),pr}return{status:"valid",value:e.data}}};E1.create=t=>new E1({typeName:lr.ZodNaN,...Br(t)});var bwe=Symbol("zod_brand"),Pg=class extends Pr{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Og=class t extends Pr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let h=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return h.status==="aborted"?pr:h.status==="dirty"?(r.dirty(),y1(h.value)):this._def.out._parseAsync({data:h.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?pr:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(e,r){return new t({in:e,out:r,typeName:lr.ZodPipeline})}},md=class extends Pr{_parse(e){let r=this._def.innerType._parse(e),a=i=>(Ig(i)&&(i.value=Object.freeze(i.value)),i);return Bg(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};md.create=(t,e)=>new md({innerType:t,typeName:lr.ZodReadonly,...Br(e)});function tQ(t,e={},r){return t?dc.create().superRefine((a,i)=>{var h,l;if(!t(a)){let p=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,b=(l=(h=p.fatal)!==null&&h!==void 0?h:r)!==null&&l!==void 0?l:!0,g=typeof p=="string"?{message:p}:p;i.addIssue({code:"custom",...g,fatal:b})}}):dc.create()}var ywe={object:ao.lazycreate},lr;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(lr||(lr={}));var wwe=(t,e={message:`Input not instance of ${t.name}`})=>tQ(r=>r instanceof t,e),rQ=cc.create,iQ=rd.create,_we=E1.create,Mwe=id.create,nQ=nd.create,xwe=ad.create,Swe=_1.create,Ewe=od.create,Awe=sd.create,Rwe=dc.create,Twe=Ch.create,kwe=Tf.create,Iwe=M1.create,Bwe=Lh.create,Pwe=ao.create,Owe=ao.strictCreate,Nwe=fd.create,Cwe=N8.create,Lwe=ud.create,Dwe=Pu.create,$we=C8.create,qwe=x1.create,Uwe=S1.create,Fwe=L8.create,jwe=hd.create,zwe=ld.create,Zwe=cd.create,Hwe=dd.create,Kwe=pc.create,VX=Po.create,Wwe=Bs.create,Vwe=Ou.create,Gwe=Po.createWithPreprocess,Ywe=Og.create,Jwe=()=>rQ().optional(),Xwe=()=>iQ().optional(),Qwe=()=>nQ().optional(),e5e={string:t=>cc.create({...t,coerce:!0}),number:t=>rd.create({...t,coerce:!0}),boolean:t=>nd.create({...t,coerce:!0}),bigint:t=>id.create({...t,coerce:!0}),date:t=>ad.create({...t,coerce:!0})},t5e=pr,vr=Object.freeze({__proto__:null,defaultErrorMap:w1,setErrorMap:twe,getErrorMap:B8,makeIssue:P8,EMPTY_PATH:rwe,addIssueToContext:Wt,ParseStatus:Ia,INVALID:pr,DIRTY:y1,OK:Da,isAborted:dT,isDirty:pT,isValid:Ig,isAsync:Bg,get util(){return fi},get objectUtil(){return cT},ZodParsedType:Yt,getParsedType:lc,ZodType:Pr,datetimeRegex:QX,ZodString:cc,ZodNumber:rd,ZodBigInt:id,ZodBoolean:nd,ZodDate:ad,ZodSymbol:_1,ZodUndefined:od,ZodNull:sd,ZodAny:dc,ZodUnknown:Ch,ZodNever:Tf,ZodVoid:M1,ZodArray:Lh,ZodObject:ao,ZodUnion:fd,ZodDiscriminatedUnion:N8,ZodIntersection:ud,ZodTuple:Pu,ZodRecord:C8,ZodMap:x1,ZodSet:S1,ZodFunction:L8,ZodLazy:hd,ZodLiteral:ld,ZodEnum:cd,ZodNativeEnum:dd,ZodPromise:pc,ZodEffects:Po,ZodTransformer:Po,ZodOptional:Bs,ZodNullable:Ou,ZodDefault:pd,ZodCatch:vd,ZodNaN:E1,BRAND:bwe,ZodBranded:Pg,ZodPipeline:Og,ZodReadonly:md,custom:tQ,Schema:Pr,ZodSchema:Pr,late:ywe,get ZodFirstPartyTypeKind(){return lr},coerce:e5e,any:Rwe,array:Bwe,bigint:Mwe,boolean:nQ,date:xwe,discriminatedUnion:Cwe,effect:VX,enum:Zwe,function:Fwe,instanceof:wwe,intersection:Lwe,lazy:jwe,literal:zwe,map:qwe,nan:_we,nativeEnum:Hwe,never:kwe,null:Awe,nullable:Vwe,number:iQ,object:Pwe,oboolean:Qwe,onumber:Xwe,optional:Wwe,ostring:Jwe,pipeline:Ywe,preprocess:Gwe,promise:Kwe,record:$we,set:Uwe,strictObject:Owe,string:rQ,symbol:Swe,transformer:VX,tuple:Dwe,undefined:Ewe,union:Nwe,unknown:Twe,void:Iwe,NEVER:t5e,ZodIssueCode:Pt,quotelessJson:ewe,ZodError:Bo});ie();ae();ne();var D8=new RegExp("^[a-zA-Z0-9_-]{43}$"),Lft=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),Dft=new RegExp("^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$"),$ft=He.env.ARNS_REGISTRY_TX??"bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U",qft="_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8",r5e="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",Uft=r5e,A1="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",$8="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",mT=1e6,aQ="cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk",gT="16_FyX-V2QU0RPSh1GIaEETSaUjNb0oVjCFpVbAfQq4",oQ="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var gd=vr.string({description:"Arweave Transaction ID"}).refine(t=>D8.test(t),{message:"Must be an Arweave Transaction ID"}),sQ=vr.string({description:"Integer String"}).refine(t=>{let e=parseInt(t);return Number.isInteger(e)&&e>=0},{message:"Must be a non negative integer string"}),i5e=vr.string(),uQ=vr.array(vr.string()),q8=vr.object({transactionId:gd.describe("The Target ID of the undername"),ttlSeconds:vr.number()}),bT=vr.record(vr.string(),q8),yT=vr.array(gd.describe("Controller address")),wT=vr.record(gd.describe("Holder address"),vr.number()),_T=vr.object({Name:vr.string().describe("The name of the ANT."),Ticker:vr.string().describe("The ticker symbol for the ANT."),Description:vr.string().describe("The description for the ANT."),Keywords:uQ.describe("The keywords for the ANT."),Denomination:vr.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:gd.describe("The Owners address."),Controllers:yT.describe("Controllers of the ANT who have administrative privileges."),Records:bT.describe("Records associated with the ANT."),Balances:wT.describe("Balance details for each address holding the ANT."),Logo:gd.describe("Transaction ID of the ANT logo."),TotalSupply:vr.number().describe("Total supply of the ANT in circulation.").min(0,{message:"Total supply must be a non-negative number"}),Initialized:vr.boolean().describe("Flag indicating whether the ANT has been initialized.")}),n5e=["balance","balances","totalSupply","info","controllers","record","records","state"],a5e=["_eval","_default","transfer","addController","removeController","setRecord","removeRecord","setName","setTicker","setDescription","setKeywords","setLogo","initializeState","releaseName","reassignName","approvePrimaryName","removePrimaryNames"],o5e=[...n5e,...a5e],fQ=vr.array(vr.string({description:"Handler Name"})).refine(t=>o5e.every(e=>t.includes(e)),{message:"ANT is missing required handlers"}),hQ=vr.object({Name:vr.string().describe("The name of the ANT."),Owner:gd.describe("The Owners address."),Ticker:vr.string().describe("The ticker symbol for the ANT."),"Total-Supply":sQ.describe("Total supply of the ANT in circulation."),Description:i5e.describe("The description for the ANT."),Keywords:uQ.describe("The keywords for the ANT."),Logo:gd.describe("Transaction ID of the ANT logo."),Denomination:sQ.describe("The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers."),Handlers:fQ.optional().describe("List of handlers for the ANT."),HandlerNames:fQ.optional().describe('Deprecated: List of handlers for the ANT. Use "Handlers" instead.')});function Wft(t){return _T.safeParse(t).success}ie();ae();ne();ie();ae();ne();ie();ae();ne();var lQ=t=>D8.test(t);function rut(t){return t!==void 0&&!isNaN(parseInt(t.toString()))}var En=t=>t.filter(e=>e.value!==void 0&&e.value!==""),Oo=t=>{let e=[{name:"Cursor",value:t?.cursor?.toString()},{name:"Limit",value:t?.limit?.toString()},{name:"Sort-By",value:t?.sortBy?.toString()},{name:"Sort-Order",value:t?.sortOrder?.toString()}];return En(e)};var s5e=["Buy-Record","Extend-Lease","Increase-Undername-Limit","Upgrade-Name","Primary-Name-Request"],fut=["Buy-Record","Extend-Lease"],uut=t=>s5e.indexOf(t)!==-1,f5e=["balance","stakes","any"],hut=t=>f5e.indexOf(t)!==-1;function Dh(t){return"process"in t}function $h(t){return"processId"in t&&typeof t.processId=="string"&&lQ(t.processId)===!0}function lut(t){return t.type==="lease"}ie();ae();ne();var MT=class t{constructor(e){this.positiveFiniteInteger=e;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${e}`)}[Symbol.toPrimitive](e){return e==="string"&&this.toString(),this.positiveFiniteInteger}plus(e){return new t(this.positiveFiniteInteger+e.positiveFiniteInteger)}minus(e){return new t(this.positiveFiniteInteger-e.positiveFiniteInteger)}isGreaterThan(e){return this.positiveFiniteInteger>e.positiveFiniteInteger}isGreaterThanOrEqualTo(e){return this.positiveFiniteInteger>=e.positiveFiniteInteger}isLessThan(e){return this.positiveFiniteInteger<e.positiveFiniteInteger}isLessThanOrEqualTo(e){return this.positiveFiniteInteger<=e.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(e){return this.positiveFiniteInteger===e.positiveFiniteInteger}},xT=class{value;constructor(e){if(!Number.isFinite(e)||e<0)throw new Error("ARIOToken must be a non-negative finite number");this.value=+e.toFixed(6)}valueOf(){return this.value}toMARIO(){return new ST(Math.floor(this.value*mT))}toString(){return`${this.value}`}},ST=class t extends MT{constructor(e){super(e)}multiply(e){let r=Math.floor(this.valueOf()*e.valueOf());return new t(r)}divide(e){if(e.valueOf()===0)throw new Error("Cannot divide by zero");let r=Math.floor(this.valueOf()/e.valueOf());return new t(r)}plus(e){let r=super.plus(e);return new t(r.valueOf())}minus(e){let r=super.minus(e);return new t(r.valueOf())}toARIO(){return new xT(this.valueOf()/mT)}};ie();ae();ne();ie();ae();ne();var kf=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},cQ=class extends kf{},dQ=class extends kf{},pQ=class extends kf{constructor(e,r){super(`Failed request: ${e}: ${r}`)}},vQ=class extends kf{},U8=class extends kf{},mQ=class extends kf{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},Nu=class extends kf{constructor(){super("Invalid contract configuration")}},gQ=class extends kf{constructor(){super("Invalid process configuration")}},bQ=class extends kf{};ie();ae();ne();var $f=gi($ae(),1);ie();ae();ne();var W4="3.2.0-alpha.1";var Fu=class t{logger;silent=!1;static default=new t;constructor({level:e="info"}={}){e==="none"&&(this.silent=!0),typeof window<"u"?this.logger=console:this.logger=(0,$f.createLogger)({level:e,silent:this.silent,defaultMeta:{name:"ar-io-sdk",version:W4},format:$f.format.combine($f.format.timestamp(),$f.format.json()),transports:[new $f.transports.Console({format:$f.format.combine($f.format.timestamp(),$f.format.json())})]})}info(e,...r){this.silent||this.logger.info(e,...r)}warn(e,...r){this.silent||this.logger.warn(e,...r)}error(e,...r){this.silent||this.logger.error(e,...r)}debug(e,...r){this.silent||this.logger.debug(e,...r)}setLogLevel(e){this.silent=e==="none","silent"in this.logger&&(this.logger.silent=e==="none"),"level"in this.logger&&(this.logger.level=e)}};ie();ae();ne();ie();ae();ne();ie();ae();ne();var fBe=Object.create,oB=Object.defineProperty,uBe=Object.getOwnPropertyDescriptor,hoe=Object.getOwnPropertyNames,hBe=Object.getPrototypeOf,lBe=Object.prototype.hasOwnProperty,Lo=(t,e)=>function(){return e||(0,t[hoe(t)[0]])((e={exports:{}}).exports,e),e.exports},loe=(t,e)=>{for(var r in e)oB(t,r,{get:e[r],enumerable:!0})},cBe=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hoe(e))!lBe.call(t,i)&&i!==r&&oB(t,i,{get:()=>e[i],enumerable:!(a=uBe(e,i))||a.enumerable});return t},sB=(t,e,r)=>(r=t!=null?fBe(hBe(t)):{},cBe(e||!t||!t.__esModule?oB(r,"default",{value:t,enumerable:!0}):r,t)),dBe=Lo({"node_modules/obliterator/iterator.js"(t,e){function r(a){if(typeof a!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=a}typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var a=arguments,i=a.length,h=0;return new r(function(){return h>=i?{done:!0}:{done:!1,value:a[h++]}})},r.empty=function(){var a=new r(function(){return{done:!0}});return a},r.fromSequence=function(a){var i=0,h=a.length;return new r(function(){return i>=h?{done:!0}:{done:!1,value:a[i++]}})},r.is=function(a){return a instanceof r?!0:typeof a=="object"&&a!==null&&typeof a.next=="function"},e.exports=r}}),pBe=Lo({"node_modules/obliterator/support.js"(t){t.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",t.SYMBOL_SUPPORT=typeof Symbol<"u"}}),fB=Lo({"node_modules/obliterator/foreach.js"(t,e){var r=pBe(),a=r.ARRAY_BUFFER_SUPPORT,i=r.SYMBOL_SUPPORT;e.exports=function(l,p){var b,g,y,M,x;if(!l)throw new Error("obliterator/forEach: invalid iterable.");if(typeof p!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(l)||a&&ArrayBuffer.isView(l)||typeof l=="string"||l.toString()==="[object Arguments]"){for(y=0,M=l.length;y<M;y++)p(l[y],y);return}if(typeof l.forEach=="function"){l.forEach(p);return}if(i&&Symbol.iterator in l&&typeof l.next!="function"&&(l=l[Symbol.iterator]()),typeof l.next=="function"){for(b=l,y=0;x=b.next(),x.done!==!0;)p(x.value,y),y++;return}for(g in l)l.hasOwnProperty(g)&&p(l[g],g)}}}),uB=Lo({"node_modules/mnemonist/utils/typed-arrays.js"(t){var e=Math.pow(2,8)-1,r=Math.pow(2,16)-1,a=Math.pow(2,32)-1,i=Math.pow(2,7)-1,h=Math.pow(2,15)-1,l=Math.pow(2,31)-1;t.getPointerArray=function(b){var g=b-1;if(g<=e)return Uint8Array;if(g<=r)return Uint16Array;if(g<=a)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},t.getSignedPointerArray=function(b){var g=b-1;return g<=i?Int8Array:g<=h?Int16Array:g<=l?Int32Array:Float64Array},t.getNumberType=function(b){return b===(b|0)?Math.sign(b)===-1?b<=127&&b>=-128?Int8Array:b<=32767&&b>=-32768?Int16Array:Int32Array:b<=255?Uint8Array:b<=65535?Uint16Array:Uint32Array:Float64Array};var p={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};t.getMinimalRepresentation=function(b,g){var y=null,M=0,x,E,A,k,P;for(k=0,P=b.length;k<P;k++)A=g?g(b[k]):b[k],E=t.getNumberType(A),x=p[E.name],x>M&&(M=x,y=E);return y},t.isTypedArray=function(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(b)},t.concat=function(){var b=0,g,y,M;for(g=0,M=arguments.length;g<M;g++)b+=arguments[g].length;var x=new arguments[0].constructor(b);for(g=0,y=0;g<M;g++)x.set(arguments[g],y),y+=arguments[g].length;return x},t.indices=function(b){for(var g=t.getPointerArray(b),y=new g(b),M=0;M<b;M++)y[M]=M;return y}}}),coe=Lo({"node_modules/mnemonist/utils/iterables.js"(t){var e=fB(),r=uB();function a(p){return Array.isArray(p)||r.isTypedArray(p)}function i(p){if(typeof p.length=="number")return p.length;if(typeof p.size=="number")return p.size}function h(p){var b=i(p),g=typeof b=="number"?new Array(b):[],y=0;return e(p,function(M){g[y++]=M}),g}function l(p){var b=i(p),g=typeof b=="number"?r.getPointerArray(b):Array,y=typeof b=="number"?new Array(b):[],M=typeof b=="number"?new g(b):[],x=0;return e(p,function(E){y[x]=E,M[x]=x++}),[y,M]}t.isArrayLike=a,t.guessLength=i,t.toArray=h,t.toArrayWithIndices=l}}),vBe=Lo({"node_modules/mnemonist/lru-cache.js"(t,e){var r=dBe(),a=fB(),i=uB(),h=coe();function l(p,b,g){if(arguments.length<2&&(g=p,p=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var y=i.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof p=="function"?new p(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items={}}l.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},l.prototype.splayOnTop=function(p){var b=this.head;if(this.head===p)return this;var g=this.backward[p],y=this.forward[p];return this.tail===p?this.tail=g:this.backward[y]=g,this.forward[g]=y,this.backward[b]=p,this.head=p,this.forward[p]=b,this},l.prototype.set=function(p,b){var g=this.items[p];if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],delete this.items[this.K[g]]),this.items[p]=g,this.K[g]=p,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},l.prototype.setpop=function(p,b){var g=null,y=null,M=this.items[p];return typeof M<"u"?(this.splayOnTop(M),g=this.V[M],this.V[M]=b,{evicted:!1,key:p,value:g}):(this.size<this.capacity?M=this.size++:(M=this.tail,this.tail=this.backward[M],g=this.V[M],y=this.K[M],delete this.items[y]),this.items[p]=M,this.K[M]=p,this.V[M]=b,this.forward[M]=this.head,this.backward[this.head]=M,this.head=M,y?{evicted:!0,key:y,value:g}:null)},l.prototype.has=function(p){return p in this.items},l.prototype.get=function(p){var b=this.items[p];if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},l.prototype.peek=function(p){var b=this.items[p];if(!(typeof b>"u"))return this.V[b]},l.prototype.forEach=function(p,b){b=arguments.length>1?b:this;for(var g=0,y=this.size,M=this.head,x=this.K,E=this.V,A=this.forward;g<y;)p.call(b,E[M],x[M],this),M=A[M],g++},l.prototype.keys=function(){var p=0,b=this.size,g=this.head,y=this.K,M=this.forward;return new r(function(){if(p>=b)return{done:!0};var x=y[g];return p++,p<b&&(g=M[g]),{done:!1,value:x}})},l.prototype.values=function(){var p=0,b=this.size,g=this.head,y=this.V,M=this.forward;return new r(function(){if(p>=b)return{done:!0};var x=y[g];return p++,p<b&&(g=M[g]),{done:!1,value:x}})},l.prototype.entries=function(){var p=0,b=this.size,g=this.head,y=this.K,M=this.V,x=this.forward;return new r(function(){if(p>=b)return{done:!0};var E=y[g],A=M[g];return p++,p<b&&(g=x[g]),{done:!1,value:[E,A]}})},typeof Symbol<"u"&&(l.prototype[Symbol.iterator]=l.prototype.entries),l.prototype.inspect=function(){for(var p=new Map,b=this.entries(),g;g=b.next(),!g.done;)p.set(g.value[0],g.value[1]);return Object.defineProperty(p,"constructor",{value:l,enumerable:!1}),p},typeof Symbol<"u"&&(l.prototype[Symbol.for("nodejs.util.inspect.custom")]=l.prototype.inspect),l.from=function(p,b,g,y){if(arguments.length<2){if(y=h.guessLength(p),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var M=new l(b,g,y);return a(p,function(x,E){M.set(E,x)}),M},e.exports=l}}),mBe=Lo({"node_modules/mnemonist/lru-map.js"(t,e){var r=vBe(),a=fB(),i=uB(),h=coe();function l(p,b,g){if(arguments.length<2&&(g=p,p=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var y=i.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof p=="function"?new p(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items=new Map}l.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},l.prototype.set=function(p,b){var g=this.items.get(p);if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],this.items.delete(this.K[g])),this.items.set(p,g),this.K[g]=p,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},l.prototype.setpop=function(p,b){var g=null,y=null,M=this.items.get(p);return typeof M<"u"?(this.splayOnTop(M),g=this.V[M],this.V[M]=b,{evicted:!1,key:p,value:g}):(this.size<this.capacity?M=this.size++:(M=this.tail,this.tail=this.backward[M],g=this.V[M],y=this.K[M],this.items.delete(y)),this.items.set(p,M),this.K[M]=p,this.V[M]=b,this.forward[M]=this.head,this.backward[this.head]=M,this.head=M,y?{evicted:!0,key:y,value:g}:null)},l.prototype.has=function(p){return this.items.has(p)},l.prototype.get=function(p){var b=this.items.get(p);if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},l.prototype.peek=function(p){var b=this.items.get(p);if(!(typeof b>"u"))return this.V[b]},l.prototype.splayOnTop=r.prototype.splayOnTop,l.prototype.forEach=r.prototype.forEach,l.prototype.keys=r.prototype.keys,l.prototype.values=r.prototype.values,l.prototype.entries=r.prototype.entries,typeof Symbol<"u"&&(l.prototype[Symbol.iterator]=l.prototype.entries),l.prototype.inspect=r.prototype.inspect,l.from=function(p,b,g,y){if(arguments.length<2){if(y=h.guessLength(p),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var M=new l(b,g,y);return a(p,function(x,E){M.set(E,x)}),M},e.exports=l}}),gBe=Lo({"node_modules/ms/index.js"(t,e){var r=1e3,a=r*60,i=a*60,h=i*24,l=h*7,p=h*365.25;e.exports=function(x,E){E=E||{};var A=typeof x;if(A==="string"&&x.length>0)return b(x);if(A==="number"&&isFinite(x))return E.long?y(x):g(x);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(x))};function b(x){if(x=String(x),!(x.length>100)){var E=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(x);if(E){var A=parseFloat(E[1]),k=(E[2]||"ms").toLowerCase();switch(k){case"years":case"year":case"yrs":case"yr":case"y":return A*p;case"weeks":case"week":case"w":return A*l;case"days":case"day":case"d":return A*h;case"hours":case"hour":case"hrs":case"hr":case"h":return A*i;case"minutes":case"minute":case"mins":case"min":case"m":return A*a;case"seconds":case"second":case"secs":case"sec":case"s":return A*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function g(x){var E=Math.abs(x);return E>=h?Math.round(x/h)+"d":E>=i?Math.round(x/i)+"h":E>=a?Math.round(x/a)+"m":E>=r?Math.round(x/r)+"s":x+"ms"}function y(x){var E=Math.abs(x);return E>=h?M(x,E,h,"day"):E>=i?M(x,E,i,"hour"):E>=a?M(x,E,a,"minute"):E>=r?M(x,E,r,"second"):x+" ms"}function M(x,E,A,k){var P=E>=A*1.5;return Math.round(x/A)+" "+k+(P?"s":"")}}}),bBe=Lo({"node_modules/debug/src/common.js"(t,e){function r(a){h.debug=h,h.default=h,h.coerce=M,h.disable=b,h.enable=p,h.enabled=g,h.humanize=gBe(),h.destroy=x,Object.keys(a).forEach(E=>{h[E]=a[E]}),h.names=[],h.skips=[],h.formatters={};function i(E){let A=0;for(let k=0;k<E.length;k++)A=(A<<5)-A+E.charCodeAt(k),A|=0;return h.colors[Math.abs(A)%h.colors.length]}h.selectColor=i;function h(E){let A,k=null,P,N;function L(...C){if(!L.enabled)return;let Y=L,G=Number(new Date),ee=G-(A||G);Y.diff=ee,Y.prev=A,Y.curr=G,A=G,C[0]=h.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let D=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(V,_)=>{if(V==="%%")return"%";D++;let n=h.formatters[_];if(typeof n=="function"){let s=C[D];V=n.call(Y,s),C.splice(D,1),D--}return V}),h.formatArgs.call(Y,C),(Y.log||h.log).apply(Y,C)}return L.namespace=E,L.useColors=h.useColors(),L.color=h.selectColor(E),L.extend=l,L.destroy=h.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>k!==null?k:(P!==h.namespaces&&(P=h.namespaces,N=h.enabled(E)),N),set:C=>{k=C}}),typeof h.init=="function"&&h.init(L),L}function l(E,A){let k=h(this.namespace+(typeof A>"u"?":":A)+E);return k.log=this.log,k}function p(E){h.save(E),h.namespaces=E,h.names=[],h.skips=[];let A,k=(typeof E=="string"?E:"").split(/[\s,]+/),P=k.length;for(A=0;A<P;A++)k[A]&&(E=k[A].replace(/\*/g,".*?"),E[0]==="-"?h.skips.push(new RegExp("^"+E.slice(1)+"$")):h.names.push(new RegExp("^"+E+"$")))}function b(){let E=[...h.names.map(y),...h.skips.map(y).map(A=>"-"+A)].join(",");return h.enable(""),E}function g(E){if(E[E.length-1]==="*")return!0;let A,k;for(A=0,k=h.skips.length;A<k;A++)if(h.skips[A].test(E))return!1;for(A=0,k=h.names.length;A<k;A++)if(h.names[A].test(E))return!0;return!1}function y(E){return E.toString().substring(2,E.toString().length-2).replace(/\.\*\?$/,"*")}function M(E){return E instanceof Error?E.stack||E.message:E}function x(){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 h.enable(h.load()),h}e.exports=r}}),yBe=Lo({"node_modules/debug/src/browser.js"(t,e){t.formatArgs=a,t.save=i,t.load=h,t.useColors=r,t.storage=l(),t.destroy=(()=>{let b=!1;return()=>{b||(b=!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`."))}})(),t.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 r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1: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(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function a(b){if(b[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+b[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let g="color: "+this.color;b.splice(1,0,g,"color: inherit");let y=0,M=0;b[0].replace(/%[a-zA-Z%]/g,x=>{x!=="%%"&&(y++,x==="%c"&&(M=y))}),b.splice(M,0,g)}t.log=console.debug||console.log||(()=>{});function i(b){try{b?t.storage.setItem("debug",b):t.storage.removeItem("debug")}catch{}}function h(){let b;try{b=t.storage.getItem("debug")}catch{}return!b&&typeof He<"u"&&"env"in He&&(b=He.env.DEBUG),b}function l(){try{return localStorage}catch{}}e.exports=bBe()(t);var{formatters:p}=e.exports;p.j=function(b){try{return JSON.stringify(b)}catch(g){return"[UnexpectedJSONParseError]: "+g.message}}}}),wBe=Lo({"node_modules/base64-js/index.js"(t){"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=E;var e=[],r=[],a=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,l=i.length;h<l;++h)e[h]=i[h],r[i.charCodeAt(h)]=h;var h,l;r[45]=62,r[95]=63;function p(A){var k=A.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=A.indexOf("=");P===-1&&(P=k);var N=P===k?0:4-P%4;return[P,N]}function b(A){var k=p(A),P=k[0],N=k[1];return(P+N)*3/4-N}function g(A,k,P){return(k+P)*3/4-P}function y(A){var k,P=p(A),N=P[0],L=P[1],C=new a(g(A,N,L)),Y=0,G=L>0?N-4:N,ee;for(ee=0;ee<G;ee+=4)k=r[A.charCodeAt(ee)]<<18|r[A.charCodeAt(ee+1)]<<12|r[A.charCodeAt(ee+2)]<<6|r[A.charCodeAt(ee+3)],C[Y++]=k>>16&255,C[Y++]=k>>8&255,C[Y++]=k&255;return L===2&&(k=r[A.charCodeAt(ee)]<<2|r[A.charCodeAt(ee+1)]>>4,C[Y++]=k&255),L===1&&(k=r[A.charCodeAt(ee)]<<10|r[A.charCodeAt(ee+1)]<<4|r[A.charCodeAt(ee+2)]>>2,C[Y++]=k>>8&255,C[Y++]=k&255),C}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,k,P){for(var N,L=[],C=k;C<P;C+=3)N=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),L.push(M(N));return L.join("")}function E(A){for(var k,P=A.length,N=P%3,L=[],C=16383,Y=0,G=P-N;Y<G;Y+=C)L.push(x(A,Y,Y+C>G?G:Y+C));return N===1?(k=A[P-1],L.push(e[k>>2]+e[k<<4&63]+"==")):N===2&&(k=(A[P-2]<<8)+A[P-1],L.push(e[k>>10]+e[k>>4&63]+e[k<<2&63]+"=")),L.join("")}}}),_Be=Lo({"node_modules/ieee754/index.js"(t){t.read=function(e,r,a,i,h){var l,p,b=h*8-i-1,g=(1<<b)-1,y=g>>1,M=-7,x=a?h-1:0,E=a?-1:1,A=e[r+x];for(x+=E,l=A&(1<<-M)-1,A>>=-M,M+=b;M>0;l=l*256+e[r+x],x+=E,M-=8);for(p=l&(1<<-M)-1,l>>=-M,M+=i;M>0;p=p*256+e[r+x],x+=E,M-=8);if(l===0)l=1-y;else{if(l===g)return p?NaN:(A?-1:1)*(1/0);p=p+Math.pow(2,i),l=l-y}return(A?-1:1)*p*Math.pow(2,l-i)},t.write=function(e,r,a,i,h,l){var p,b,g,y=l*8-h-1,M=(1<<y)-1,x=M>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:l-1,k=i?1:-1,P=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,p=M):(p=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-p))<1&&(p--,g*=2),p+x>=1?r+=E/g:r+=E*Math.pow(2,1-x),r*g>=2&&(p++,g/=2),p+x>=M?(b=0,p=M):p+x>=1?(b=(r*g-1)*Math.pow(2,h),p=p+x):(b=r*Math.pow(2,x-1)*Math.pow(2,h),p=0));h>=8;e[a+A]=b&255,A+=k,b/=256,h-=8);for(p=p<<h|b,y+=h;y>0;e[a+A]=p&255,A+=k,p/=256,y-=8);e[a+A-k]|=P*128}}}),MBe=Lo({"node_modules/buffer/index.js"(t){"use strict";var e=wBe(),r=_Be(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=p,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,p.TYPED_ARRAY_SUPPORT=h(),!p.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 h(){try{let T=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(T,I),T.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function l(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let I=new Uint8Array(T);return Object.setPrototypeOf(I,p.prototype),I}function p(T,I,O){if(typeof T=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(T)}return b(T,I,O)}p.poolSize=8192;function b(T,I,O){if(typeof T=="string")return x(T,I);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(ut(T,ArrayBuffer)||T&&ut(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(T,SharedArrayBuffer)||T&&ut(T.buffer,SharedArrayBuffer)))return k(T,I,O);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let q=T.valueOf&&T.valueOf();if(q!=null&&q!==T)return p.from(q,I,O);let H=P(T);if(H)return H;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return p.from(T[Symbol.toPrimitive]("string"),I,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}p.from=function(T,I,O){return b(T,I,O)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function g(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function y(T,I,O){return g(T),T<=0?l(T):I!==void 0?typeof O=="string"?l(T).fill(I,O):l(T).fill(I):l(T)}p.alloc=function(T,I,O){return y(T,I,O)};function M(T){return g(T),l(T<0?0:N(T)|0)}p.allocUnsafe=function(T){return M(T)},p.allocUnsafeSlow=function(T){return M(T)};function x(T,I){if((typeof I!="string"||I==="")&&(I="utf8"),!p.isEncoding(I))throw new TypeError("Unknown encoding: "+I);let O=C(T,I)|0,q=l(O),H=q.write(T,I);return H!==O&&(q=q.slice(0,H)),q}function E(T){let I=T.length<0?0:N(T.length)|0,O=l(I);for(let q=0;q<I;q+=1)O[q]=T[q]&255;return O}function A(T){if(ut(T,Uint8Array)){let I=new Uint8Array(T);return k(I.buffer,I.byteOffset,I.byteLength)}return E(T)}function k(T,I,O){if(I<0||T.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<I+(O||0))throw new RangeError('"length" is outside of buffer bounds');let q;return I===void 0&&O===void 0?q=new Uint8Array(T):O===void 0?q=new Uint8Array(T,I):q=new Uint8Array(T,I,O),Object.setPrototypeOf(q,p.prototype),q}function P(T){if(p.isBuffer(T)){let I=N(T.length)|0,O=l(I);return O.length===0||T.copy(O,0,0,I),O}if(T.length!==void 0)return typeof T.length!="number"||Ze(T.length)?l(0):E(T);if(T.type==="Buffer"&&Array.isArray(T.data))return E(T.data)}function N(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function L(T){return+T!=T&&(T=0),p.alloc(+T)}p.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==p.prototype},p.compare=function(I,O){if(ut(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),ut(O,Uint8Array)&&(O=p.from(O,O.offset,O.byteLength)),!p.isBuffer(I)||!p.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===O)return 0;let q=I.length,H=O.length;for(let W=0,fe=Math.min(q,H);W<fe;++W)if(I[W]!==O[W]){q=I[W],H=O[W];break}return q<H?-1:H<q?1:0},p.isEncoding=function(I){switch(String(I).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}},p.concat=function(I,O){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return p.alloc(0);let q;if(O===void 0)for(O=0,q=0;q<I.length;++q)O+=I[q].length;let H=p.allocUnsafe(O),W=0;for(q=0;q<I.length;++q){let fe=I[q];if(ut(fe,Uint8Array))W+fe.length>H.length?(p.isBuffer(fe)||(fe=p.from(fe)),fe.copy(H,W)):Uint8Array.prototype.set.call(H,fe,W);else if(p.isBuffer(fe))fe.copy(H,W);else throw new TypeError('"list" argument must be an Array of Buffers');W+=fe.length}return H};function C(T,I){if(p.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||ut(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let O=T.length,q=arguments.length>2&&arguments[2]===!0;if(!q&&O===0)return 0;let H=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O*2;case"hex":return O>>>1;case"base64":return ge(T).length;default:if(H)return q?-1:oe(T).length;I=(""+I).toLowerCase(),H=!0}}p.byteLength=C;function Y(T,I,O){let q=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0,I>>>=0,O<=I))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,I,O);case"utf8":case"utf-8":return u(this,I,O);case"ascii":return w(this,I,O);case"latin1":case"binary":return d(this,I,O);case"base64":return f(this,I,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,I,O);default:if(q)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),q=!0}}p.prototype._isBuffer=!0;function G(T,I,O){let q=T[I];T[I]=T[O],T[O]=q}p.prototype.swap16=function(){let I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<I;O+=2)G(this,O,O+1);return this},p.prototype.swap32=function(){let I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<I;O+=4)G(this,O,O+3),G(this,O+1,O+2);return this},p.prototype.swap64=function(){let I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<I;O+=8)G(this,O,O+7),G(this,O+1,O+6),G(this,O+2,O+5),G(this,O+3,O+4);return this},p.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?u(this,0,I):Y.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(I){if(!p.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:p.compare(this,I)===0},p.prototype.inspect=function(){let I="",O=t.INSPECT_MAX_BYTES;return I=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(I+=" ... "),"<Buffer "+I+">"},a&&(p.prototype[a]=p.prototype.inspect),p.prototype.compare=function(I,O,q,H,W){if(ut(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),!p.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(O===void 0&&(O=0),q===void 0&&(q=I?I.length:0),H===void 0&&(H=0),W===void 0&&(W=this.length),O<0||q>I.length||H<0||W>this.length)throw new RangeError("out of range index");if(H>=W&&O>=q)return 0;if(H>=W)return-1;if(O>=q)return 1;if(O>>>=0,q>>>=0,H>>>=0,W>>>=0,this===I)return 0;let fe=W-H,st=q-O,ue=Math.min(fe,st),me=this.slice(H,W),pe=I.slice(O,q);for(let be=0;be<ue;++be)if(me[be]!==pe[be]){fe=me[be],st=pe[be];break}return fe<st?-1:st<fe?1:0};function ee(T,I,O,q,H){if(T.length===0)return-1;if(typeof O=="string"?(q=O,O=0):O>2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),O=+O,Ze(O)&&(O=H?0:T.length-1),O<0&&(O=T.length+O),O>=T.length){if(H)return-1;O=T.length-1}else if(O<0)if(H)O=0;else return-1;if(typeof I=="string"&&(I=p.from(I,q)),p.isBuffer(I))return I.length===0?-1:D(T,I,O,q,H);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?H?Uint8Array.prototype.indexOf.call(T,I,O):Uint8Array.prototype.lastIndexOf.call(T,I,O):D(T,[I],O,q,H);throw new TypeError("val must be string, number or Buffer")}function D(T,I,O,q,H){let W=1,fe=T.length,st=I.length;if(q!==void 0&&(q=String(q).toLowerCase(),q==="ucs2"||q==="ucs-2"||q==="utf16le"||q==="utf-16le")){if(T.length<2||I.length<2)return-1;W=2,fe/=2,st/=2,O/=2}function ue(pe,be){return W===1?pe[be]:pe.readUInt16BE(be*W)}let me;if(H){let pe=-1;for(me=O;me<fe;me++)if(ue(T,me)===ue(I,pe===-1?0:me-pe)){if(pe===-1&&(pe=me),me-pe+1===st)return pe*W}else pe!==-1&&(me-=me-pe),pe=-1}else for(O+st>fe&&(O=fe-st),me=O;me>=0;me--){let pe=!0;for(let be=0;be<st;be++)if(ue(T,me+be)!==ue(I,be)){pe=!1;break}if(pe)return me}return-1}p.prototype.includes=function(I,O,q){return this.indexOf(I,O,q)!==-1},p.prototype.indexOf=function(I,O,q){return ee(this,I,O,q,!0)},p.prototype.lastIndexOf=function(I,O,q){return ee(this,I,O,q,!1)};function U(T,I,O,q){O=Number(O)||0;let H=T.length-O;q?(q=Number(q),q>H&&(q=H)):q=H;let W=I.length;q>W/2&&(q=W/2);let fe;for(fe=0;fe<q;++fe){let st=parseInt(I.substr(fe*2,2),16);if(Ze(st))return fe;T[O+fe]=st}return fe}function V(T,I,O,q){return Se(oe(I,T.length-O),T,O,q)}function _(T,I,O,q){return Se(ce(I),T,O,q)}function n(T,I,O,q){return Se(ge(I),T,O,q)}function s(T,I,O,q){return Se(ot(I,T.length-O),T,O,q)}p.prototype.write=function(I,O,q,H){if(O===void 0)H="utf8",q=this.length,O=0;else if(q===void 0&&typeof O=="string")H=O,q=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(q)?(q=q>>>0,H===void 0&&(H="utf8")):(H=q,q=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let W=this.length-O;if((q===void 0||q>W)&&(q=W),I.length>0&&(q<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");H||(H="utf8");let fe=!1;for(;;)switch(H){case"hex":return U(this,I,O,q);case"utf8":case"utf-8":return V(this,I,O,q);case"ascii":case"latin1":case"binary":return _(this,I,O,q);case"base64":return n(this,I,O,q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,I,O,q);default:if(fe)throw new TypeError("Unknown encoding: "+H);H=(""+H).toLowerCase(),fe=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(T,I,O){return I===0&&O===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(I,O))}function u(T,I,O){O=Math.min(T.length,O);let q=[],H=I;for(;H<O;){let W=T[H],fe=null,st=W>239?4:W>223?3:W>191?2:1;if(H+st<=O){let ue,me,pe,be;switch(st){case 1:W<128&&(fe=W);break;case 2:ue=T[H+1],(ue&192)===128&&(be=(W&31)<<6|ue&63,be>127&&(fe=be));break;case 3:ue=T[H+1],me=T[H+2],(ue&192)===128&&(me&192)===128&&(be=(W&15)<<12|(ue&63)<<6|me&63,be>2047&&(be<55296||be>57343)&&(fe=be));break;case 4:ue=T[H+1],me=T[H+2],pe=T[H+3],(ue&192)===128&&(me&192)===128&&(pe&192)===128&&(be=(W&15)<<18|(ue&63)<<12|(me&63)<<6|pe&63,be>65535&&be<1114112&&(fe=be))}}fe===null?(fe=65533,st=1):fe>65535&&(fe-=65536,q.push(fe>>>10&1023|55296),fe=56320|fe&1023),q.push(fe),H+=st}return m(q)}var c=4096;function m(T){let I=T.length;if(I<=c)return String.fromCharCode.apply(String,T);let O="",q=0;for(;q<I;)O+=String.fromCharCode.apply(String,T.slice(q,q+=c));return O}function w(T,I,O){let q="";O=Math.min(T.length,O);for(let H=I;H<O;++H)q+=String.fromCharCode(T[H]&127);return q}function d(T,I,O){let q="";O=Math.min(T.length,O);for(let H=I;H<O;++H)q+=String.fromCharCode(T[H]);return q}function o(T,I,O){let q=T.length;(!I||I<0)&&(I=0),(!O||O<0||O>q)&&(O=q);let H="";for(let W=I;W<O;++W)H+=Ge[T[W]];return H}function v(T,I,O){let q=T.slice(I,O),H="";for(let W=0;W<q.length-1;W+=2)H+=String.fromCharCode(q[W]+q[W+1]*256);return H}p.prototype.slice=function(I,O){let q=this.length;I=~~I,O=O===void 0?q:~~O,I<0?(I+=q,I<0&&(I=0)):I>q&&(I=q),O<0?(O+=q,O<0&&(O=0)):O>q&&(O=q),O<I&&(O=I);let H=this.subarray(I,O);return Object.setPrototypeOf(H,p.prototype),H};function R(T,I,O){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+I>O)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(I,O,q){I=I>>>0,O=O>>>0,q||R(I,O,this.length);let H=this[I],W=1,fe=0;for(;++fe<O&&(W*=256);)H+=this[I+fe]*W;return H},p.prototype.readUintBE=p.prototype.readUIntBE=function(I,O,q){I=I>>>0,O=O>>>0,q||R(I,O,this.length);let H=this[I+--O],W=1;for(;O>0&&(W*=256);)H+=this[I+--O]*W;return H},p.prototype.readUint8=p.prototype.readUInt8=function(I,O){return I=I>>>0,O||R(I,1,this.length),this[I]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(I,O){return I=I>>>0,O||R(I,2,this.length),this[I]|this[I+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(I,O){return I=I>>>0,O||R(I,2,this.length),this[I]<<8|this[I+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(I,O){return I=I>>>0,O||R(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(I,O){return I=I>>>0,O||R(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},p.prototype.readBigUInt64LE=lt(function(I){I=I>>>0,J(I,"offset");let O=this[I],q=this[I+7];(O===void 0||q===void 0)&&X(I,this.length-8);let H=O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,W=this[++I]+this[++I]*2**8+this[++I]*2**16+q*2**24;return BigInt(H)+(BigInt(W)<<BigInt(32))}),p.prototype.readBigUInt64BE=lt(function(I){I=I>>>0,J(I,"offset");let O=this[I],q=this[I+7];(O===void 0||q===void 0)&&X(I,this.length-8);let H=O*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],W=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+q;return(BigInt(H)<<BigInt(32))+BigInt(W)}),p.prototype.readIntLE=function(I,O,q){I=I>>>0,O=O>>>0,q||R(I,O,this.length);let H=this[I],W=1,fe=0;for(;++fe<O&&(W*=256);)H+=this[I+fe]*W;return W*=128,H>=W&&(H-=Math.pow(2,8*O)),H},p.prototype.readIntBE=function(I,O,q){I=I>>>0,O=O>>>0,q||R(I,O,this.length);let H=O,W=1,fe=this[I+--H];for(;H>0&&(W*=256);)fe+=this[I+--H]*W;return W*=128,fe>=W&&(fe-=Math.pow(2,8*O)),fe},p.prototype.readInt8=function(I,O){return I=I>>>0,O||R(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},p.prototype.readInt16LE=function(I,O){I=I>>>0,O||R(I,2,this.length);let q=this[I]|this[I+1]<<8;return q&32768?q|4294901760:q},p.prototype.readInt16BE=function(I,O){I=I>>>0,O||R(I,2,this.length);let q=this[I+1]|this[I]<<8;return q&32768?q|4294901760:q},p.prototype.readInt32LE=function(I,O){return I=I>>>0,O||R(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},p.prototype.readInt32BE=function(I,O){return I=I>>>0,O||R(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},p.prototype.readBigInt64LE=lt(function(I){I=I>>>0,J(I,"offset");let O=this[I],q=this[I+7];(O===void 0||q===void 0)&&X(I,this.length-8);let H=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(q<<24);return(BigInt(H)<<BigInt(32))+BigInt(O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),p.prototype.readBigInt64BE=lt(function(I){I=I>>>0,J(I,"offset");let O=this[I],q=this[I+7];(O===void 0||q===void 0)&&X(I,this.length-8);let H=(O<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(H)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+q)}),p.prototype.readFloatLE=function(I,O){return I=I>>>0,O||R(I,4,this.length),r.read(this,I,!0,23,4)},p.prototype.readFloatBE=function(I,O){return I=I>>>0,O||R(I,4,this.length),r.read(this,I,!1,23,4)},p.prototype.readDoubleLE=function(I,O){return I=I>>>0,O||R(I,8,this.length),r.read(this,I,!0,52,8)},p.prototype.readDoubleBE=function(I,O){return I=I>>>0,O||R(I,8,this.length),r.read(this,I,!1,52,8)};function S(T,I,O,q,H,W){if(!p.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>H||I<W)throw new RangeError('"value" argument is out of bounds');if(O+q>T.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(I,O,q,H){if(I=+I,O=O>>>0,q=q>>>0,!H){let st=Math.pow(2,8*q)-1;S(this,I,O,q,st,0)}let W=1,fe=0;for(this[O]=I&255;++fe<q&&(W*=256);)this[O+fe]=I/W&255;return O+q},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(I,O,q,H){if(I=+I,O=O>>>0,q=q>>>0,!H){let st=Math.pow(2,8*q)-1;S(this,I,O,q,st,0)}let W=q-1,fe=1;for(this[O+W]=I&255;--W>=0&&(fe*=256);)this[O+W]=I/fe&255;return O+q},p.prototype.writeUint8=p.prototype.writeUInt8=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,1,255,0),this[O]=I&255,O+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,2,65535,0),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,2,65535,0),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,4,4294967295,0),this[O+3]=I>>>24,this[O+2]=I>>>16,this[O+1]=I>>>8,this[O]=I&255,O+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,4,4294967295,0),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4};function B(T,I,O,q,H){j(I,q,H,T,O,7);let W=Number(I&BigInt(4294967295));T[O++]=W,W=W>>8,T[O++]=W,W=W>>8,T[O++]=W,W=W>>8,T[O++]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[O++]=fe,fe=fe>>8,T[O++]=fe,fe=fe>>8,T[O++]=fe,fe=fe>>8,T[O++]=fe,O}function F(T,I,O,q,H){j(I,q,H,T,O,7);let W=Number(I&BigInt(4294967295));T[O+7]=W,W=W>>8,T[O+6]=W,W=W>>8,T[O+5]=W,W=W>>8,T[O+4]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[O+3]=fe,fe=fe>>8,T[O+2]=fe,fe=fe>>8,T[O+1]=fe,fe=fe>>8,T[O]=fe,O+8}p.prototype.writeBigUInt64LE=lt(function(I,O=0){return B(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=lt(function(I,O=0){return F(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(I,O,q,H){if(I=+I,O=O>>>0,!H){let ue=Math.pow(2,8*q-1);S(this,I,O,q,ue-1,-ue)}let W=0,fe=1,st=0;for(this[O]=I&255;++W<q&&(fe*=256);)I<0&&st===0&&this[O+W-1]!==0&&(st=1),this[O+W]=(I/fe>>0)-st&255;return O+q},p.prototype.writeIntBE=function(I,O,q,H){if(I=+I,O=O>>>0,!H){let ue=Math.pow(2,8*q-1);S(this,I,O,q,ue-1,-ue)}let W=q-1,fe=1,st=0;for(this[O+W]=I&255;--W>=0&&(fe*=256);)I<0&&st===0&&this[O+W+1]!==0&&(st=1),this[O+W]=(I/fe>>0)-st&255;return O+q},p.prototype.writeInt8=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,1,127,-128),I<0&&(I=255+I+1),this[O]=I&255,O+1},p.prototype.writeInt16LE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,2,32767,-32768),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeInt16BE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,2,32767,-32768),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeInt32LE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,4,2147483647,-2147483648),this[O]=I&255,this[O+1]=I>>>8,this[O+2]=I>>>16,this[O+3]=I>>>24,O+4},p.prototype.writeInt32BE=function(I,O,q){return I=+I,O=O>>>0,q||S(this,I,O,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4},p.prototype.writeBigInt64LE=lt(function(I,O=0){return B(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=lt(function(I,O=0){return F(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(T,I,O,q,H,W){if(O+q>T.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("Index out of range")}function re(T,I,O,q,H){return I=+I,O=O>>>0,H||$(T,I,O,4,34028234663852886e22,-34028234663852886e22),r.write(T,I,O,q,23,4),O+4}p.prototype.writeFloatLE=function(I,O,q){return re(this,I,O,!0,q)},p.prototype.writeFloatBE=function(I,O,q){return re(this,I,O,!1,q)};function Q(T,I,O,q,H){return I=+I,O=O>>>0,H||$(T,I,O,8,17976931348623157e292,-17976931348623157e292),r.write(T,I,O,q,52,8),O+8}p.prototype.writeDoubleLE=function(I,O,q){return Q(this,I,O,!0,q)},p.prototype.writeDoubleBE=function(I,O,q){return Q(this,I,O,!1,q)},p.prototype.copy=function(I,O,q,H){if(!p.isBuffer(I))throw new TypeError("argument should be a Buffer");if(q||(q=0),!H&&H!==0&&(H=this.length),O>=I.length&&(O=I.length),O||(O=0),H>0&&H<q&&(H=q),H===q||I.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if(q<0||q>=this.length)throw new RangeError("Index out of range");if(H<0)throw new RangeError("sourceEnd out of bounds");H>this.length&&(H=this.length),I.length-O<H-q&&(H=I.length-O+q);let W=H-q;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,q,H):Uint8Array.prototype.set.call(I,this.subarray(q,H),O),W},p.prototype.fill=function(I,O,q,H){if(typeof I=="string"){if(typeof O=="string"?(H=O,O=0,q=this.length):typeof q=="string"&&(H=q,q=this.length),H!==void 0&&typeof H!="string")throw new TypeError("encoding must be a string");if(typeof H=="string"&&!p.isEncoding(H))throw new TypeError("Unknown encoding: "+H);if(I.length===1){let fe=I.charCodeAt(0);(H==="utf8"&&fe<128||H==="latin1")&&(I=fe)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(O<0||this.length<O||this.length<q)throw new RangeError("Out of range index");if(q<=O)return this;O=O>>>0,q=q===void 0?this.length:q>>>0,I||(I=0);let W;if(typeof I=="number")for(W=O;W<q;++W)this[W]=I;else{let fe=p.isBuffer(I)?I:p.from(I,H),st=fe.length;if(st===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(W=0;W<q-O;++W)this[W+O]=fe[W%st]}return this};var Z={};function K(T,I,O){Z[T]=class extends O{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(H){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:H,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(T,I){return`The "${T}" argument must be of type number. Received type ${typeof I}`},TypeError),K("ERR_OUT_OF_RANGE",function(T,I,O){let q=`The value of "${T}" is out of range.`,H=O;return Number.isInteger(O)&&Math.abs(O)>2**32?H=le(String(O)):typeof O=="bigint"&&(H=String(O),(O>BigInt(2)**BigInt(32)||O<-(BigInt(2)**BigInt(32)))&&(H=le(H)),H+="n"),q+=` It must be ${I}. Received ${H}`,q},RangeError);function le(T){let I="",O=T.length,q=T[0]==="-"?1:0;for(;O>=q+4;O-=3)I=`_${T.slice(O-3,O)}${I}`;return`${T.slice(0,O)}${I}`}function te(T,I,O){J(I,"offset"),(T[I]===void 0||T[I+O]===void 0)&&X(I,T.length-(O+1))}function j(T,I,O,q,H,W){if(T>O||T<I){let fe=typeof I=="bigint"?"n":"",st;throw W>3?I===0||I===BigInt(0)?st=`>= 0${fe} and < 2${fe} ** ${(W+1)*8}${fe}`:st=`>= -(2${fe} ** ${(W+1)*8-1}${fe}) and < 2 ** ${(W+1)*8-1}${fe}`:st=`>= ${I}${fe} and <= ${O}${fe}`,new Z.ERR_OUT_OF_RANGE("value",st,T)}te(q,H,W)}function J(T,I){if(typeof T!="number")throw new Z.ERR_INVALID_ARG_TYPE(I,"number",T)}function X(T,I,O){throw Math.floor(T)!==T?(J(T,O),new Z.ERR_OUT_OF_RANGE(O||"offset","an integer",T)):I<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE(O||"offset",`>= ${O?1:0} and <= ${I}`,T)}var he=/[^+/0-9A-Za-z-_]/g;function Te(T){if(T=T.split("=")[0],T=T.trim().replace(he,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function oe(T,I){I=I||1/0;let O,q=T.length,H=null,W=[];for(let fe=0;fe<q;++fe){if(O=T.charCodeAt(fe),O>55295&&O<57344){if(!H){if(O>56319){(I-=3)>-1&&W.push(239,191,189);continue}else if(fe+1===q){(I-=3)>-1&&W.push(239,191,189);continue}H=O;continue}if(O<56320){(I-=3)>-1&&W.push(239,191,189),H=O;continue}O=(H-55296<<10|O-56320)+65536}else H&&(I-=3)>-1&&W.push(239,191,189);if(H=null,O<128){if((I-=1)<0)break;W.push(O)}else if(O<2048){if((I-=2)<0)break;W.push(O>>6|192,O&63|128)}else if(O<65536){if((I-=3)<0)break;W.push(O>>12|224,O>>6&63|128,O&63|128)}else if(O<1114112){if((I-=4)<0)break;W.push(O>>18|240,O>>12&63|128,O>>6&63|128,O&63|128)}else throw new Error("Invalid code point")}return W}function ce(T){let I=[];for(let O=0;O<T.length;++O)I.push(T.charCodeAt(O)&255);return I}function ot(T,I){let O,q,H,W=[];for(let fe=0;fe<T.length&&!((I-=2)<0);++fe)O=T.charCodeAt(fe),q=O>>8,H=O%256,W.push(H),W.push(q);return W}function ge(T){return e.toByteArray(Te(T))}function Se(T,I,O,q){let H;for(H=0;H<q&&!(H+O>=I.length||H>=T.length);++H)I[H+O]=T[H];return H}function ut(T,I){return T instanceof I||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===I.name}function Ze(T){return T!==T}var Ge=function(){let T="0123456789abcdef",I=new Array(256);for(let O=0;O<16;++O){let q=O*16;for(let H=0;H<16;++H)I[q+H]=T[O]+T[H]}return I}();function lt(T){return typeof BigInt>"u"?z:T}function z(){throw new Error("BigInt not supported")}}}),xBe={"@@functional/placeholder":!0};function Yi(t){return t===xBe}function Fa(t){return function e(r){return arguments.length===0||Yi(r)?e:t.apply(this,arguments)}}function Fn(t){return function e(r,a){switch(arguments.length){case 0:return e;case 1:return Yi(r)?e:Fa(function(i){return t(r,i)});default:return Yi(r)&&Yi(a)?e:Yi(r)?Fa(function(i){return t(i,a)}):Yi(a)?Fa(function(i){return t(r,i)}):t(r,a)}}}function Sw(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,a){return e.apply(this,arguments)};case 3:return function(r,a,i){return e.apply(this,arguments)};case 4:return function(r,a,i,h){return e.apply(this,arguments)};case 5:return function(r,a,i,h,l){return e.apply(this,arguments)};case 6:return function(r,a,i,h,l,p){return e.apply(this,arguments)};case 7:return function(r,a,i,h,l,p,b){return e.apply(this,arguments)};case 8:return function(r,a,i,h,l,p,b,g){return e.apply(this,arguments)};case 9:return function(r,a,i,h,l,p,b,g,y){return e.apply(this,arguments)};case 10:return function(r,a,i,h,l,p,b,g,y,M){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function doe(t,e,r){return function(){for(var a=[],i=0,h=t,l=0,p=!1;l<e.length||i<arguments.length;){var b;l<e.length&&(!Yi(e[l])||i>=arguments.length)?b=e[l]:(b=arguments[i],i+=1),a[l]=b,Yi(b)?p=!0:h-=1,l+=1}return!p&&h<=0?r.apply(this,a):Sw(Math.max(0,h),doe(t,a,r))}}var SBe=Fn(function(t,e){return t===1?Fa(e):Sw(t,doe(t,[],e))}),poe=SBe;function hB(t){return function e(r,a,i){switch(arguments.length){case 0:return e;case 1:return Yi(r)?e:Fn(function(h,l){return t(r,h,l)});case 2:return Yi(r)&&Yi(a)?e:Yi(r)?Fn(function(h,l){return t(h,a,l)}):Yi(a)?Fn(function(h,l){return t(r,h,l)}):Fa(function(h){return t(r,a,h)});default:return Yi(r)&&Yi(a)&&Yi(i)?e:Yi(r)&&Yi(a)?Fn(function(h,l){return t(h,l,i)}):Yi(r)&&Yi(i)?Fn(function(h,l){return t(h,a,l)}):Yi(a)&&Yi(i)?Fn(function(h,l){return t(r,h,l)}):Yi(r)?Fa(function(h){return t(h,a,i)}):Yi(a)?Fa(function(h){return t(r,h,i)}):Yi(i)?Fa(function(h){return t(r,a,h)}):t(r,a,i)}}}var lB=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function EBe(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function cB(t,e,r){return function(){if(arguments.length===0)return r();var a=arguments[arguments.length-1];if(!lB(a)){for(var i=0;i<t.length;){if(typeof a[t[i]]=="function")return a[t[i]].apply(a,Array.prototype.slice.call(arguments,0,-1));i+=1}if(EBe(a)){var h=e.apply(null,Array.prototype.slice.call(arguments,0,-1));return h(a)}}return r.apply(this,arguments)}}function ABe(t){return t&&t["@@transducer/reduced"]?t:{"@@transducer/value":t,"@@transducer/reduced":!0}}var B2={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}};function qae(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function Uae(t,e,r){for(var a=0,i=r.length;a<i;){if(t(e,r[a]))return!0;a+=1}return!1}function RBe(t){var e=String(t).match(/^function (\w*)/);return e==null?"":e[1]}function ew(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function TBe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var AI=typeof Object.is=="function"?Object.is:TBe,Fae=Object.prototype.toString,kBe=function(){return Fae.call(arguments)==="[object Arguments]"?function(t){return Fae.call(t)==="[object Arguments]"}:function(t){return ew("callee",t)}}(),IBe=kBe,BBe=!{toString:null}.propertyIsEnumerable("toString"),jae=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],zae=function(){"use strict";return arguments.propertyIsEnumerable("length")}(),PBe=function(t,e){for(var r=0;r<t.length;){if(t[r]===e)return!0;r+=1}return!1},OBe=Fa(typeof Object.keys=="function"&&!zae?function(t){return Object(t)!==t?[]:Object.keys(t)}:function(t){if(Object(t)!==t)return[];var e,r,a=[],i=zae&&IBe(t);for(e in t)ew(e,t)&&(!i||e!=="length")&&(a[a.length]=e);if(BBe)for(r=jae.length-1;r>=0;)e=jae[r],ew(e,t)&&!PBe(a,e)&&(a[a.length]=e),r-=1;return a}),ev=OBe,NBe=Fa(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),Zae=NBe;function Hae(t,e,r,a){var i=qae(t),h=qae(e);function l(p,b){return dB(p,b,r.slice(),a.slice())}return!Uae(function(p,b){return!Uae(l,b,p)},h,i)}function dB(t,e,r,a){if(AI(t,e))return!0;var i=Zae(t);if(i!==Zae(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&RBe(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&AI(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!AI(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var h=r.length-1;h>=0;){if(r[h]===t)return a[h]===e;h-=1}switch(i){case"Map":return t.size!==e.size?!1:Hae(t.entries(),e.entries(),r.concat([t]),a.concat([e]));case"Set":return t.size!==e.size?!1:Hae(t.values(),e.values(),r.concat([t]),a.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var l=ev(t);if(l.length!==ev(e).length)return!1;var p=r.concat([t]),b=a.concat([e]);for(h=l.length-1;h>=0;){var g=l[h];if(!(ew(g,e)&&dB(e[g],t[g],p,b)))return!1;h-=1}return!0}var CBe=Fn(function(t,e){return dB(t,e,[],[])}),voe=CBe;function LBe(t,e,r){var a,i;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(a=1/e;r<t.length;){if(i=t[r],i===0&&1/i===a)return r;r+=1}return-1}else if(e!==e){for(;r<t.length;){if(i=t[r],typeof i=="number"&&i!==i)return r;r+=1}return-1}return t.indexOf(e,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,r);case"object":if(e===null)return t.indexOf(e,r)}for(;r<t.length;){if(voe(t[r],e))return r;r+=1}return-1}function DBe(t,e){return LBe(e,t,0)>=0}function k2(t,e){for(var r=0,a=e.length,i=Array(a);r<a;)i[r]=t(e[r]),r+=1;return i}function RI(t){var e=t.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+e.replace(/"/g,'\\"')+'"'}var b2=function(t){return(t<10?"0":"")+t},$Be=typeof Date.prototype.toISOString=="function"?function(t){return t.toISOString()}:function(t){return t.getUTCFullYear()+"-"+b2(t.getUTCMonth()+1)+"-"+b2(t.getUTCDate())+"T"+b2(t.getUTCHours())+":"+b2(t.getUTCMinutes())+":"+b2(t.getUTCSeconds())+"."+(t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"},qBe=$Be;function UBe(t){return function(){return!t.apply(this,arguments)}}function moe(t,e,r){for(var a=0,i=r.length;a<i;)e=t(e,r[a]),a+=1;return e}function FBe(t,e){for(var r=0,a=e.length,i=[];r<a;)t(e[r])&&(i[i.length]=e[r]),r+=1;return i}function jBe(t){return Object.prototype.toString.call(t)==="[object Object]"}var zBe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=B2.init,t.prototype["@@transducer/result"]=B2.result,t.prototype["@@transducer/step"]=function(e,r){return this.f(r)?this.xf["@@transducer/step"](e,r):e},t}();function ZBe(t){return function(e){return new zBe(t,e)}}var HBe=Fn(cB(["fantasy-land/filter","filter"],ZBe,function(t,e){return jBe(e)?moe(function(r,a){return t(e[a])&&(r[a]=e[a]),r},{},ev(e)):FBe(t,e)})),KBe=HBe,WBe=Fn(function(t,e){return KBe(UBe(t),e)}),VBe=WBe;function goe(t,e){var r=function(h){var l=e.concat([t]);return DBe(h,l)?"<Circular>":goe(h,l)},a=function(h,l){return k2(function(p){return RI(p)+": "+r(h[p])},l.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+k2(r,t).join(", ")+"))";case"[object Array]":return"["+k2(r,t).concat(a(t,VBe(function(h){return/^\d+$/.test(h)},ev(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):RI(qBe(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":RI(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var i=t.toString();if(i!=="[object Object]")return i}return"{"+a(t,ev(t)).join(", ")+"}"}}var GBe=Fa(function(t){return goe(t,[])}),Kae=GBe,YBe=Fn(function(t,e){if(t===e)return e;function r(p,b){if(p>b!=b>p)return b>p?b:p}var a=r(t,e);if(a!==void 0)return a;var i=r(typeof t,typeof e);if(i!==void 0)return i===typeof t?t:e;var h=Kae(t),l=r(h,Kae(e));return l!==void 0&&l===h?t:e}),JBe=YBe,XBe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=B2.init,t.prototype["@@transducer/result"]=B2.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),QBe=function(t){return function(e){return new XBe(t,e)}},ePe=QBe,tPe=Fn(cB(["fantasy-land/map","map"],ePe,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return poe(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return moe(function(r,a){return r[a]=t(e[a]),r},{},ev(e));default:return k2(t,e)}})),rPe=tPe,boe=Number.isInteger||function(t){return t<<0===t};function yoe(t){return Object.prototype.toString.call(t)==="[object String]"}function woe(t,e){var r=t<0?e.length+t:t;return yoe(e)?e.charAt(r):e[r]}var iPe=Fn(function(t,e){if(e!=null)return boe(t)?woe(t,e):e[t]}),Ew=iPe,nPe=Fn(function(t,e){return rPe(Ew(t),e)}),aPe=nPe,oPe=Fa(function(t){return lB(t)?!0:!t||typeof t!="object"||yoe(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),sPe=oPe,Wae=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function fPe(t,e,r){return function(a,i,h){if(sPe(h))return t(a,i,h);if(h==null)return i;if(typeof h["fantasy-land/reduce"]=="function")return e(a,i,h,"fantasy-land/reduce");if(h[Wae]!=null)return r(a,i,h[Wae]());if(typeof h.next=="function")return r(a,i,h);if(typeof h.reduce=="function")return e(a,i,h,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function uPe(t,e,r){for(var a=0,i=r.length;a<i;){if(e=t["@@transducer/step"](e,r[a]),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}a+=1}return t["@@transducer/result"](e)}var hPe=Fn(function(t,e){return Sw(t.length,function(){return t.apply(e,arguments)})}),lPe=hPe;function cPe(t,e,r){for(var a=r.next();!a.done;){if(e=t["@@transducer/step"](e,a.value),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}a=r.next()}return t["@@transducer/result"](e)}function dPe(t,e,r,a){return t["@@transducer/result"](r[a](lPe(t["@@transducer/step"],t),e))}var pPe=fPe(uPe,dPe,cPe),vPe=pPe,mPe=function(){function t(e){this.f=e}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(e){return e},t.prototype["@@transducer/step"]=function(e,r){return this.f(e,r)},t}();function gPe(t){return new mPe(t)}var bPe=hB(function(t,e,r){return vPe(typeof t=="function"?gPe(t):t,e,r)}),_oe=bPe;function yPe(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function Moe(t,e){return function(){var r=arguments.length;if(r===0)return e();var a=arguments[r-1];return lB(a)||typeof a[t]!="function"?e.apply(this,arguments):a[t].apply(a,Array.prototype.slice.call(arguments,0,r-1))}}var wPe=hB(Moe("slice",function(t,e,r){return Array.prototype.slice.call(r,t,e)})),_Pe=wPe,MPe=Fa(Moe("tail",_Pe(1,1/0))),xPe=MPe;function xoe(){if(arguments.length===0)throw new Error("pipe requires at least one argument");return Sw(arguments[0].length,_oe(yPe,arguments[0],xPe(arguments)))}var SPe=Fn(function(t,e){return poe(_oe(JBe,0,aPe("length",e)),function(){var r=arguments,a=this;return t.apply(a,k2(function(i){return i.apply(a,r)},e))})}),EPe=SPe,APe=Fn(function(t,e){return e==null||e!==e?t:e}),CI=APe,RPe=function(){function t(e,r){this.xf=r,this.f=e,this.found=!1}return t.prototype["@@transducer/init"]=B2.init,t.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},t.prototype["@@transducer/step"]=function(e,r){return this.f(r)&&(this.found=!0,e=ABe(this.xf["@@transducer/step"](e,r))),e},t}();function TPe(t){return function(e){return new RPe(t,e)}}var kPe=Fn(cB(["find"],TPe,function(t,e){for(var r=0,a=e.length;r<a;){if(t(e[r]))return e[r];r+=1}})),IPe=kPe,BPe=Fa(function(t){return EPe(function(){return Array.prototype.slice.call(arguments,0)},t)}),PPe=BPe;function OPe(t,e){for(var r=e,a=0;a<t.length;a+=1){if(r==null)return;var i=t[a];boe(i)?r=woe(i,r):r=r[i]}return r}var NPe=Fn(OPe),Soe=NPe,CPe=hB(function(t,e,r){return voe(t,Ew(e,r))}),LPe=CPe,tw=class extends Error{name="InvalidSchedulerLocation"},DPe=class extends Error{name="SchedulerTagNotFound"},$Pe=class extends Error{name="TransactionNotFound"},qPe="Url",UPe="Time-To-Live",FPe="Scheduler",LI=t=>xoe(CI([]),IPe(LPe(t,"name")),CI({}),Ew("value")),Eoe=t=>xoe(e=>{if(!e)throw new $Pe(t);return e},Ew("tags"),CI([]));function Aoe({fetch:t,GRAPHQL_URL:e}){return async({query:r,variables:a})=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:a})}).then(i=>i.json())}function jPe({fetch:t,GRAPHQL_URL:e}){let r=Aoe({fetch:t,GRAPHQL_URL:e}),a=Roe({fetch:t,GRAPHQL_URL:e}),i=`
|
|
133
133
|
query GetTransactions ($transactionIds: [ID!]!) {
|
|
134
134
|
transactions(ids: $transactionIds) {
|
|
135
135
|
edges {
|
|
@@ -184,7 +184,7 @@ nonce: bundlr`),Me.from(i))}};ie();ae();ne();var Q0=class{_publicKey;ownerLength
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
}`,i=wt.object({data:wt.object({transactions:wt.object({edges:wt.array(wt.object({node:wt.record(wt.any())}))})})});return h=>zr(h).chain(Di(l=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:a,variables:{transactionIds:[l]}})}).then(async p=>{if(p.ok)return p.json();throw r('Error Encountered when querying gateway for transaction "%s"',l),new Error(`${p.status}: ${await p.text()}`)}).then(i.parse).then(eLe(["data","transactions","edges","0","node"])))).toPromise()}var lDe=sB(yBe(),1),Ose=(t="@permaweb/aoconnect")=>{let e=(0,lDe.default)(t);return e.child=r=>Ose(`${e.namespace}:${r}`),e.tap=(r,...a)=>sLe((...i)=>e(r,...a,...i)),e},Nse=({url:t,path:e})=>e?e.startsWith("/")?Nse({url:t,path:e.slice(1)}):(t=new URL(t),t.pathname+=e,t.toString()):t;function cDe(t){return uv(Bw([]),fv((e,r)=>uv(iLe([],r.name),xB(r.value),Us(r.name,Gh,e))(e),{}),kw(e=>e.length>1?e:e[0]))(t)}function Ds(t,e){return r=>ise(cCe([aoe(t,"name"),EB(MB(e),aoe(e,"value"),yB)]),r)}function foe(t){return dse([[I2(String),X1(t)],[I2(Array),HCe(t)],[yB,MNe]])}function zd(t){let e;return I2($s,t)?(e=new Error(dDe(t)),e.stack+=t.stack):I2(Error,t)?e=t:jCe("message",t)?e=new Error(t.message):I2(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function dDe(t){return uv(e=>function r(a,i,h){return fv((l,p)=>uv(dse([[X1(Rt.invalid_arguments),()=>r(p.argumentsError,422,"Invalid Arguments")],[X1(Rt.invalid_return_type),()=>r(p.returnTypeError,500,"Invalid Return")],[X1(Rt.invalid_union),()=>TCe(b=>r(b,400,"Invalid Union"),p.unionErrors)],[yB,()=>[{...p,status:i,contextCode:h}]]]),SB(l))(p.code),[],a.issues)}(e,400,""),e=>fv((r,a)=>{let{message:i,path:h,contextCode:l}=a,p=h[1]||h[0],b=l?`${l} `:"";return r.push(`${b}'${p}': ${i}.`),r},[],e),JCe(" | "))(t)}var pDe=wt.object({id:wt.string().min(1,{message:"message is required to be a message id"}),processId:wt.string().min(1,{message:"process is required to be a process id"})});function vDe(){return t=>zr(t).map(pDe.parse).map(()=>t)}var db=wt.object({name:wt.string(),value:wt.string()}),mDe=wt.function().args(wt.object({Id:wt.string(),Target:wt.string(),Owner:wt.string(),Anchor:wt.string().optional(),Data:wt.any().default("1234"),Tags:wt.array(wt.object({name:wt.string(),value:wt.string()}))})).returns(wt.promise(wt.any())),gDe=wt.function().args(wt.object({id:wt.string().min(1,{message:"message id is required"}),processId:wt.string().min(1,{message:"process id is required"})})).returns(wt.promise(wt.any())),bDe=wt.function().args(wt.object({process:wt.string().min(1,{message:"process id is required"}),from:wt.string().optional(),to:wt.string().optional(),sort:wt.enum(["ASC","DESC"]).default("ASC"),limit:wt.number().optional()})).returns(wt.promise(wt.object({edges:wt.array(wt.object({cursor:wt.string(),node:wt.object({Output:wt.any().optional(),Messages:wt.array(wt.any()).optional(),Spawns:wt.array(wt.any()).optional(),Error:wt.any().optional()})}))}))),Cse=wt.function().args(wt.object({processId:wt.string(),data:wt.any(),tags:wt.array(db),anchor:wt.string().optional(),signer:wt.any()})).returns(wt.promise(wt.object({messageId:wt.string()}).passthrough())),yDe=wt.function().args(wt.object({data:wt.any(),tags:wt.array(db),signer:wt.any()})).returns(wt.promise(wt.object({processId:wt.string()}).passthrough())),wDe=wt.function().args(wt.object({process:wt.string(),message:wt.string(),baseLayer:wt.boolean().optional(),exclude:wt.array(wt.string()).optional()})).returns(wt.promise(wt.object({assignmentId:wt.string()}).passthrough())),Lse=Cse,qmt=wt.function().args(wt.object({suUrl:wt.string().url(),processId:wt.string()})).returns(wt.promise(wt.object({tags:wt.array(db)}).passthrough())),Umt=wt.function().args(wt.string()).returns(wt.promise(wt.object({url:wt.string()}))),_De=wt.function().args(wt.string()).returns(wt.promise(wt.boolean())),MDe=wt.function().args(wt.string()).returns(wt.promise(wt.object({tags:wt.array(db)}).passthrough())),Pw=wt.function().args(wt.object({data:wt.any(),tags:wt.array(db),target:wt.string().optional(),anchor:wt.string().optional()})).returns(wt.promise(wt.object({id:wt.string(),raw:wt.any()})));function xDe({loadResult:t}){return t=Di(gDe.implement(t)),e=>zr({id:e.id,processId:e.processId}).chain(t)}function SDe(t){let e=vDe(t),r=xDe(t);return({message:a,process:i})=>zr({id:a,processId:i}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',a)).map(h=>h).bimap(zd,jd).toPromise()}var EDe=wt.array(wt.object({name:wt.string(),value:wt.string()}));function ADe(){return t=>zr(t.tags).map(Bw([])).map(Ds("Data-Protocol","ao")).map(Ds("Variant")).map(Ds("Type")).map(Ds("SDK")).map(SB(Gh,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(EDe.parse).map(Us("tags",Gh,t))}function RDe({logger:t}){return e=>zr(e).chain(EB(MB(e.data),()=>$d(e),()=>$d(Math.random().toString().slice(-4)).map(Us("data",Gh,e)).map(r=>uv(Fd("tags"),Ds("Content-Type"),xB({name:"Content-Type",value:"text/plain"}),Us("tags",Gh,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function TDe(t){let e=ADe(t),r=RDe(t),a=Cse.implement(t.deployMessage);return i=>zr(i).chain(e).chain(r).chain(Di(({id:h,data:l,tags:p,anchor:b,signer:g})=>a({processId:h,data:l,tags:p,anchor:b,signer:Pw.implement(g)}))).map(h=>Us("messageId",h.messageId,i))}function kDe(t){let e=TDe(t);return({process:r,data:a,tags:i,anchor:h,signer:l})=>zr({id:r,data:a,tags:i,anchor:h,signer:l}).chain(e).map(p=>p.messageId).bimap(zd,jd).toPromise()}var w2=(t,e,r)=>a=>e(a[t])?$d(a):Tc(`Tag '${t}': ${r}`);function IDe({loadTransactionMeta:t,logger:e}){return t=Di(MDe.implement(t)),r=>zr(r).chain(t).map(Fd("tags")).map(cDe).chain(w2("Data-Protocol",foe("ao"),"value 'ao' was not found on module")).chain(w2("Type",foe("Module"),"value 'Module' was not found on module")).chain(w2("Module-Format",PI,"was not found on module")).chain(w2("Input-Encoding",PI,"was not found on module")).chain(w2("Output-Encoding",PI,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function BDe({logger:t,validateScheduler:e}){return e=Di(_De.implement(e)),r=>zr(r).chain(a=>e(a).chain(i=>i?$d(a):Tc(`Valid Scheduler-Location owned by ${a} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function PDe({logger:t}){return e=>zr(e).map(t.tap("Checking for signer")).chain(r=>r?$d(r):Tc("signer not found"))}function ODe(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=IDe(t),a=BDe(t),i=PDe(t);return h=>zr(h).chain(l=>r(l.module).map(()=>l)).chain(l=>a(l.scheduler)).map(()=>h).chain(l=>i(l.signer).map(()=>l)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var NDe=wt.array(wt.object({name:wt.string(),value:wt.string()}));function CDe(){return t=>zr(t).map(Fd("tags")).map(Bw([])).map(Ds("Data-Protocol","ao")).map(Ds("Variant")).map(Ds("Type")).map(Ds("Module")).map(Ds("Scheduler")).map(Ds("SDK")).map(SB(Gh,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:t.module},{name:"Scheduler",value:t.scheduler},{name:"SDK",value:"aoconnect"}])).map(NDe.parse).map(Us("tags",Gh,t))}function LDe({logger:t}){return e=>zr(e).chain(EB(MB(e.data),()=>$d(e),()=>$d(Math.random().toString().slice(-4)).map(Us("data",Gh,e)).map(r=>uv(Fd("tags"),Ds("Content-Type"),xB({name:"Content-Type",value:"text/plain"}),Us("tags",Gh,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function DDe(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=CDe(t),a=LDe(t),i=yDe.implement(t.deployProcess);return h=>zr(h).chain(r).chain(a).chain(Di(({data:l,tags:p,signer:b})=>i({data:l,tags:p,signer:Pw.implement(b)}))).map(l=>Us("processId",l.processId,h))}function $De(t){let e=ODe(t),r=DDe(t);return({module:a,scheduler:i,signer:h,tags:l,data:p})=>zr({module:a,scheduler:i,signer:h,tags:l,data:p}).chain(e).chain(r).map(b=>b.processId).bimap(zd,jd).toPromise()}function qDe(t){let e=Lse.implement(t.deployMonitor);return r=>zr(r).chain(Di(({id:a,signer:i})=>e({processId:a,signer:Pw.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(a=>Us("monitorId",a.messageId,r))}function UDe(t){let e=qDe(t);return({process:r,signer:a})=>zr({id:r,signer:a}).chain(e).map(i=>i.monitorId).bimap(zd,jd).toPromise()}function FDe(t){let e=Lse.implement(t.deployUnmonitor);return r=>zr(r).chain(Di(({id:a,signer:i})=>e({processId:a,signer:Pw.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(a=>Us("monitorId",a.messageId,r))}function jDe(t){let e=FDe(t);return({process:r,signer:a})=>zr({id:r,signer:a}).chain(e).map(i=>i.monitorId).bimap(zd,jd).toPromise()}var zDe=wt.object({process:wt.string().min(1,{message:"process identifier is required"}),from:wt.string().optional(),to:wt.string().optional(),sort:wt.enum(["ASC","DESC"]).default("ASC"),limit:wt.number().optional()});function ZDe(){return t=>zr(t).map(zDe.parse).map(()=>t)}function HDe({queryResults:t}){return t=Di(bDe.implement(t)),e=>zr({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(t)}function KDe(t){let e=ZDe(t),r=HDe(t);return({process:a,from:i,to:h,sort:l,limit:p})=>zr({process:a,from:i,to:h,sort:l,limit:p}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',a)).map(b=>b).bimap(zd,jd).toPromise()}var WDe=wt.object({Id:wt.string(),Target:wt.string(),Owner:wt.string(),Anchor:wt.string().optional(),Data:wt.any().default("1234"),Tags:wt.array(wt.object({name:wt.string(),value:wt.string()}))});function VDe(){return t=>zr(t).map(WDe.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function GDe({dryrunFetch:t}){return Di(mDe.implement(t))}function YDe(t){let e=VDe(t),r=GDe(t);return a=>zr(a).map(JDe).chain(e).chain(r).toPromise()}function JDe({process:t,data:e,tags:r,anchor:a,...i}){return{Id:"1234",Owner:"1234",...i,Target:t,Data:e||"1234",Tags:r||[],Anchor:a||"0"}}function XDe(t){let e=wDe.implement(t.deployAssign);return r=>zr(r).chain(Di(({process:a,message:i,baseLayer:h,exclude:l})=>e({process:a,message:i,baseLayer:h,exclude:l}))).map(a=>Us("assignmentId",a.assignmentId,r))}function QDe(t){let e=XDe(t);return({process:r,message:a,baseLayer:i,exclude:h})=>zr({process:r,message:a,baseLayer:i,exclude:h}).chain(e).map(l=>l.assignmentId).bimap(zd,jd).toPromise()}var e$e="https://arweave.net",t$e="https://mu.ao-testnet.xyz",r$e="https://cu.ao-testnet.xyz";function vv({GRAPHQL_URL:t,GATEWAY_URL:e=e$e,MU_URL:r=t$e,CU_URL:a=r$e}={}){let i=Ose();t||(t=Nse({url:e,path:"/graphql"}));let{validate:h}=Qoe({cacheSize:100,GRAPHQL_URL:t}),l=wNe({MAX_SIZE:25}),p=i.child("result"),b=SDe({loadResult:gNe({fetch,CU_URL:a,logger:p}),logger:p}),g=i.child("message"),y=kDe({loadProcessMeta:kI({fetch,cache:l,logger:g}),deployMessage:lNe({fetch,MU_URL:r,logger:g}),logger:g}),M=i.child("spawn"),x=$De({loadTransactionMeta:hDe({fetch,GRAPHQL_URL:t,logger:M}),validateScheduler:h,deployProcess:cNe({fetch,MU_URL:r,logger:M}),logger:M}),E=i.child("monitor"),A=UDe({loadProcessMeta:kI({fetch,cache:l,logger:E}),deployMonitor:dNe({fetch,MU_URL:r,logger:E}),logger:E}),k=i.child("unmonitor"),P=jDe({loadProcessMeta:kI({fetch,cache:l,logger:k}),deployUnmonitor:pNe({fetch,MU_URL:r,logger:k}),logger:E}),N=i.child("results"),L=KDe({queryResults:bNe({fetch,CU_URL:a,logger:N}),logger:N}),C=i.child("dryrun"),Y=YDe({dryrunFetch:mNe({fetch,CU_URL:a,logger:C}),logger:C}),G=i.child("assign"),ee=QDe({deployAssign:vNe({fetch,MU_URL:r,logger:G}),logger:g});return{result:b,results:L,message:y,spawn:x,monitor:A,unmonitor:P,dryrun:Y,assign:ee}}var Dse={};loe(Dse,{createDataItemSigner:()=>R$e});var $se=sB(MBe(),1),qse={};loe(qse,{AVSCTap:()=>pb,ArweaveSigner:()=>IB,DataItem:()=>ub,MAX_TAG_BYTES:()=>Ow,MIN_BINARY_SIZE:()=>OB,SIG_CONFIG:()=>pv,SignatureConfig:()=>Ls,Signer:()=>zse,createData:()=>Wse,default:()=>S$e,deserializeTags:()=>xw,indexToType:()=>BB,serializeTags:()=>PB,tagsExceedLimit:()=>Kse,warparbundles:()=>E$e});var i$e=Object.create,TB=Object.defineProperty,n$e=Object.getOwnPropertyDescriptor,a$e=Object.getOwnPropertyNames,o$e=Object.getPrototypeOf,s$e=Object.prototype.hasOwnProperty,Jh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),f$e=(t,e)=>{for(var r in e)TB(t,r,{get:e[r],enumerable:!0})},u$e=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a$e(e))!s$e.call(t,i)&&i!==r&&TB(t,i,{get:()=>e[i],enumerable:!(a=n$e(e,i))||a.enumerable});return t},Zd=(t,e,r)=>(r=t!=null?i$e(o$e(t)):{},u$e(e||!t||!t.__esModule?TB(r,"default",{value:t,enumerable:!0}):r,t)),h$e=Jh(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});function e(r){var a=4,i=r.length,h=i%a;if(!h)return r;var l=i,p=a-h,b=i+p,g=Me.alloc(b);for(g.write(r);p--;)g.write("=",l++);return g.toString()}t.default=e}),l$e=Jh(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=h$e();function r(b,g){return g===void 0&&(g="utf8"),Me.isBuffer(b)?h(b.toString("base64")):h(Me.from(b,g).toString("base64"))}function a(b,g){return g===void 0&&(g="utf8"),Me.from(i(b),"base64").toString(g)}function i(b){return b=b.toString(),e.default(b).replace(/\-/g,"+").replace(/_/g,"/")}function h(b){return b.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function l(b){return Me.from(i(b),"base64")}var p=r;p.encode=r,p.decode=a,p.toBase64=i,p.fromBase64=h,p.toBuffer=l,t.default=p}),kB=Jh((t,e)=>{e.exports=l$e().default,e.exports.default=e.exports}),Use=Jh(t=>{"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=E;var e=[],r=[],a=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,l=i.length;h<l;++h)e[h]=i[h],r[i.charCodeAt(h)]=h;var h,l;r[45]=62,r[95]=63;function p(A){var k=A.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=A.indexOf("=");P===-1&&(P=k);var N=P===k?0:4-P%4;return[P,N]}function b(A){var k=p(A),P=k[0],N=k[1];return(P+N)*3/4-N}function g(A,k,P){return(k+P)*3/4-P}function y(A){var k,P=p(A),N=P[0],L=P[1],C=new a(g(A,N,L)),Y=0,G=L>0?N-4:N,ee;for(ee=0;ee<G;ee+=4)k=r[A.charCodeAt(ee)]<<18|r[A.charCodeAt(ee+1)]<<12|r[A.charCodeAt(ee+2)]<<6|r[A.charCodeAt(ee+3)],C[Y++]=k>>16&255,C[Y++]=k>>8&255,C[Y++]=k&255;return L===2&&(k=r[A.charCodeAt(ee)]<<2|r[A.charCodeAt(ee+1)]>>4,C[Y++]=k&255),L===1&&(k=r[A.charCodeAt(ee)]<<10|r[A.charCodeAt(ee+1)]<<4|r[A.charCodeAt(ee+2)]>>2,C[Y++]=k>>8&255,C[Y++]=k&255),C}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,k,P){for(var N,L=[],C=k;C<P;C+=3)N=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),L.push(M(N));return L.join("")}function E(A){for(var k,P=A.length,N=P%3,L=[],C=16383,Y=0,G=P-N;Y<G;Y+=C)L.push(x(A,Y,Y+C>G?G:Y+C));return N===1?(k=A[P-1],L.push(e[k>>2]+e[k<<4&63]+"==")):N===2&&(k=(A[P-2]<<8)+A[P-1],L.push(e[k>>10]+e[k>>4&63]+e[k<<2&63]+"=")),L.join("")}}),Fse=Jh(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=Use();function r(x){let E=0;for(let P=0;P<x.length;P++)E+=x[P].byteLength;let A=new Uint8Array(E),k=0;A.set(new Uint8Array(x[0]),k),k+=x[0].byteLength;for(let P=1;P<x.length;P++)A.set(new Uint8Array(x[P]),k),k+=x[P].byteLength;return A}t.concatBuffers=r;function a(x){let E=p(x);return i(E)}t.b64UrlToString=a;function i(x){return new TextDecoder("utf-8",{fatal:!0}).decode(x)}t.bufferToString=i;function h(x){return new TextEncoder().encode(x)}t.stringToBuffer=h;function l(x){return g(h(x))}t.stringToB64Url=l;function p(x){return new Uint8Array(e.toByteArray(M(x)))}t.b64UrlToBuffer=p;function b(x){return e.fromByteArray(new Uint8Array(x))}t.bufferTob64=b;function g(x){return y(b(x))}t.bufferTob64Url=g;function y(x){return x.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}t.b64UrlEncode=y;function M(x){x=x.replace(/\-/g,"+").replace(/\_/g,"/");let E;return x.length%4==0?E=0:E=4-x.length%4,x.concat("=".repeat(E))}t.b64UrlDecode=M}),c$e=Jh(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=Fse(),r=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 a=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",a.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(a,i,{saltLength:h}={}){let l=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(a),i);return new Uint8Array(l)}async hash(a,i="SHA-256"){let h=await this.driver.digest(i,a);return new Uint8Array(h)}async verify(a,i,h){let l={kty:"RSA",e:"AQAB",n:a},p=await this.jwkToPublicCryptoKey(l),b=await this.driver.digest("SHA-256",i),g=await this.driver.verify({name:"RSA-PSS",saltLength:0},p,h,i),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},p,h,i),M=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((p.algorithm.modulusLength-1)/8)-b.byteLength-2},p,h,i);return g||y||M}async jwkToCryptoKey(a){return this.driver.importKey("jwk",a,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(a){return this.driver.importKey("jwk",a,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let a=crypto?.subtle;return a===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof a[i]=="function")}async encrypt(a,i,h){let l=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=new Uint8Array(16);crypto.getRandomValues(b);let g=await this.driver.encrypt({name:"AES-CBC",iv:b},p,a);return e.concatBuffers([b,g])}async decrypt(a,i,h){let l=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=a.slice(0,16),g=await this.driver.decrypt({name:"AES-CBC",iv:b},p,a.slice(16));return e.concatBuffers([g])}};t.default=r}),d$e=Jh(t=>{t.read=function(e,r,a,i,h){var l,p,b=h*8-i-1,g=(1<<b)-1,y=g>>1,M=-7,x=a?h-1:0,E=a?-1:1,A=e[r+x];for(x+=E,l=A&(1<<-M)-1,A>>=-M,M+=b;M>0;l=l*256+e[r+x],x+=E,M-=8);for(p=l&(1<<-M)-1,l>>=-M,M+=i;M>0;p=p*256+e[r+x],x+=E,M-=8);if(l===0)l=1-y;else{if(l===g)return p?NaN:(A?-1:1)*(1/0);p=p+Math.pow(2,i),l=l-y}return(A?-1:1)*p*Math.pow(2,l-i)},t.write=function(e,r,a,i,h,l){var p,b,g,y=l*8-h-1,M=(1<<y)-1,x=M>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:l-1,k=i?1:-1,P=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,p=M):(p=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-p))<1&&(p--,g*=2),p+x>=1?r+=E/g:r+=E*Math.pow(2,1-x),r*g>=2&&(p++,g/=2),p+x>=M?(b=0,p=M):p+x>=1?(b=(r*g-1)*Math.pow(2,h),p=p+x):(b=r*Math.pow(2,x-1)*Math.pow(2,h),p=0));h>=8;e[a+A]=b&255,A+=k,b/=256,h-=8);for(p=p<<h|b,y+=h;y>0;e[a+A]=p&255,A+=k,p/=256,y-=8);e[a+A-k]|=P*128}}),nB=Jh(t=>{"use strict";var e=Use(),r=d$e(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=p,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,p.TYPED_ARRAY_SUPPORT=h(),!p.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 h(){try{let T=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(T,I),T.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function l(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let I=new Uint8Array(T);return Object.setPrototypeOf(I,p.prototype),I}function p(T,I,O){if(typeof T=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(T)}return b(T,I,O)}p.poolSize=8192;function b(T,I,O){if(typeof T=="string")return x(T,I);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(ut(T,ArrayBuffer)||T&&ut(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(T,SharedArrayBuffer)||T&&ut(T.buffer,SharedArrayBuffer)))return k(T,I,O);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let q=T.valueOf&&T.valueOf();if(q!=null&&q!==T)return p.from(q,I,O);let H=P(T);if(H)return H;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return p.from(T[Symbol.toPrimitive]("string"),I,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}p.from=function(T,I,O){return b(T,I,O)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function g(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function y(T,I,O){return g(T),T<=0?l(T):I!==void 0?typeof O=="string"?l(T).fill(I,O):l(T).fill(I):l(T)}p.alloc=function(T,I,O){return y(T,I,O)};function M(T){return g(T),l(T<0?0:N(T)|0)}p.allocUnsafe=function(T){return M(T)},p.allocUnsafeSlow=function(T){return M(T)};function x(T,I){if((typeof I!="string"||I==="")&&(I="utf8"),!p.isEncoding(I))throw new TypeError("Unknown encoding: "+I);let O=C(T,I)|0,q=l(O),H=q.write(T,I);return H!==O&&(q=q.slice(0,H)),q}function E(T){let I=T.length<0?0:N(T.length)|0,O=l(I);for(let q=0;q<I;q+=1)O[q]=T[q]&255;return O}function A(T){if(ut(T,Uint8Array)){let I=new Uint8Array(T);return k(I.buffer,I.byteOffset,I.byteLength)}return E(T)}function k(T,I,O){if(I<0||T.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<I+(O||0))throw new RangeError('"length" is outside of buffer bounds');let q;return I===void 0&&O===void 0?q=new Uint8Array(T):O===void 0?q=new Uint8Array(T,I):q=new Uint8Array(T,I,O),Object.setPrototypeOf(q,p.prototype),q}function P(T){if(p.isBuffer(T)){let I=N(T.length)|0,O=l(I);return O.length===0||T.copy(O,0,0,I),O}if(T.length!==void 0)return typeof T.length!="number"||Ze(T.length)?l(0):E(T);if(T.type==="Buffer"&&Array.isArray(T.data))return E(T.data)}function N(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function L(T){return+T!=T&&(T=0),p.alloc(+T)}p.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==p.prototype},p.compare=function(T,I){if(ut(T,Uint8Array)&&(T=p.from(T,T.offset,T.byteLength)),ut(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),!p.isBuffer(T)||!p.isBuffer(I))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===I)return 0;let O=T.length,q=I.length;for(let H=0,W=Math.min(O,q);H<W;++H)if(T[H]!==I[H]){O=T[H],q=I[H];break}return O<q?-1:q<O?1:0},p.isEncoding=function(T){switch(String(T).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}},p.concat=function(T,I){if(!Array.isArray(T))throw new TypeError('"list" argument must be an Array of Buffers');if(T.length===0)return p.alloc(0);let O;if(I===void 0)for(I=0,O=0;O<T.length;++O)I+=T[O].length;let q=p.allocUnsafe(I),H=0;for(O=0;O<T.length;++O){let W=T[O];if(ut(W,Uint8Array))H+W.length>q.length?(p.isBuffer(W)||(W=p.from(W)),W.copy(q,H)):Uint8Array.prototype.set.call(q,W,H);else if(p.isBuffer(W))W.copy(q,H);else throw new TypeError('"list" argument must be an Array of Buffers');H+=W.length}return q};function C(T,I){if(p.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||ut(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let O=T.length,q=arguments.length>2&&arguments[2]===!0;if(!q&&O===0)return 0;let H=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O*2;case"hex":return O>>>1;case"base64":return ge(T).length;default:if(H)return q?-1:oe(T).length;I=(""+I).toLowerCase(),H=!0}}p.byteLength=C;function Y(T,I,O){let q=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0,I>>>=0,O<=I))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,I,O);case"utf8":case"utf-8":return u(this,I,O);case"ascii":return w(this,I,O);case"latin1":case"binary":return d(this,I,O);case"base64":return f(this,I,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,I,O);default:if(q)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),q=!0}}p.prototype._isBuffer=!0;function G(T,I,O){let q=T[I];T[I]=T[O],T[O]=q}p.prototype.swap16=function(){let T=this.length;if(T%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let I=0;I<T;I+=2)G(this,I,I+1);return this},p.prototype.swap32=function(){let T=this.length;if(T%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let I=0;I<T;I+=4)G(this,I,I+3),G(this,I+1,I+2);return this},p.prototype.swap64=function(){let T=this.length;if(T%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let I=0;I<T;I+=8)G(this,I,I+7),G(this,I+1,I+6),G(this,I+2,I+5),G(this,I+3,I+4);return this},p.prototype.toString=function(){let T=this.length;return T===0?"":arguments.length===0?u(this,0,T):Y.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(T){if(!p.isBuffer(T))throw new TypeError("Argument must be a Buffer");return this===T?!0:p.compare(this,T)===0},p.prototype.inspect=function(){let T="",I=t.INSPECT_MAX_BYTES;return T=this.toString("hex",0,I).replace(/(.{2})/g,"$1 ").trim(),this.length>I&&(T+=" ... "),"<Buffer "+T+">"},a&&(p.prototype[a]=p.prototype.inspect),p.prototype.compare=function(T,I,O,q,H){if(ut(T,Uint8Array)&&(T=p.from(T,T.offset,T.byteLength)),!p.isBuffer(T))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(I===void 0&&(I=0),O===void 0&&(O=T?T.length:0),q===void 0&&(q=0),H===void 0&&(H=this.length),I<0||O>T.length||q<0||H>this.length)throw new RangeError("out of range index");if(q>=H&&I>=O)return 0;if(q>=H)return-1;if(I>=O)return 1;if(I>>>=0,O>>>=0,q>>>=0,H>>>=0,this===T)return 0;let W=H-q,fe=O-I,st=Math.min(W,fe),ue=this.slice(q,H),me=T.slice(I,O);for(let pe=0;pe<st;++pe)if(ue[pe]!==me[pe]){W=ue[pe],fe=me[pe];break}return W<fe?-1:fe<W?1:0};function ee(T,I,O,q,H){if(T.length===0)return-1;if(typeof O=="string"?(q=O,O=0):O>2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),O=+O,Ze(O)&&(O=H?0:T.length-1),O<0&&(O=T.length+O),O>=T.length){if(H)return-1;O=T.length-1}else if(O<0)if(H)O=0;else return-1;if(typeof I=="string"&&(I=p.from(I,q)),p.isBuffer(I))return I.length===0?-1:D(T,I,O,q,H);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?H?Uint8Array.prototype.indexOf.call(T,I,O):Uint8Array.prototype.lastIndexOf.call(T,I,O):D(T,[I],O,q,H);throw new TypeError("val must be string, number or Buffer")}function D(T,I,O,q,H){let W=1,fe=T.length,st=I.length;if(q!==void 0&&(q=String(q).toLowerCase(),q==="ucs2"||q==="ucs-2"||q==="utf16le"||q==="utf-16le")){if(T.length<2||I.length<2)return-1;W=2,fe/=2,st/=2,O/=2}function ue(pe,be){return W===1?pe[be]:pe.readUInt16BE(be*W)}let me;if(H){let pe=-1;for(me=O;me<fe;me++)if(ue(T,me)===ue(I,pe===-1?0:me-pe)){if(pe===-1&&(pe=me),me-pe+1===st)return pe*W}else pe!==-1&&(me-=me-pe),pe=-1}else for(O+st>fe&&(O=fe-st),me=O;me>=0;me--){let pe=!0;for(let be=0;be<st;be++)if(ue(T,me+be)!==ue(I,be)){pe=!1;break}if(pe)return me}return-1}p.prototype.includes=function(T,I,O){return this.indexOf(T,I,O)!==-1},p.prototype.indexOf=function(T,I,O){return ee(this,T,I,O,!0)},p.prototype.lastIndexOf=function(T,I,O){return ee(this,T,I,O,!1)};function U(T,I,O,q){O=Number(O)||0;let H=T.length-O;q?(q=Number(q),q>H&&(q=H)):q=H;let W=I.length;q>W/2&&(q=W/2);let fe;for(fe=0;fe<q;++fe){let st=parseInt(I.substr(fe*2,2),16);if(Ze(st))return fe;T[O+fe]=st}return fe}function V(T,I,O,q){return Se(oe(I,T.length-O),T,O,q)}function _(T,I,O,q){return Se(ce(I),T,O,q)}function n(T,I,O,q){return Se(ge(I),T,O,q)}function s(T,I,O,q){return Se(ot(I,T.length-O),T,O,q)}p.prototype.write=function(T,I,O,q){if(I===void 0)q="utf8",O=this.length,I=0;else if(O===void 0&&typeof I=="string")q=I,O=this.length,I=0;else if(isFinite(I))I=I>>>0,isFinite(O)?(O=O>>>0,q===void 0&&(q="utf8")):(q=O,O=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let H=this.length-I;if((O===void 0||O>H)&&(O=H),T.length>0&&(O<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");q||(q="utf8");let W=!1;for(;;)switch(q){case"hex":return U(this,T,I,O);case"utf8":case"utf-8":return V(this,T,I,O);case"ascii":case"latin1":case"binary":return _(this,T,I,O);case"base64":return n(this,T,I,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,T,I,O);default:if(W)throw new TypeError("Unknown encoding: "+q);q=(""+q).toLowerCase(),W=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(T,I,O){return I===0&&O===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(I,O))}function u(T,I,O){O=Math.min(T.length,O);let q=[],H=I;for(;H<O;){let W=T[H],fe=null,st=W>239?4:W>223?3:W>191?2:1;if(H+st<=O){let ue,me,pe,be;switch(st){case 1:W<128&&(fe=W);break;case 2:ue=T[H+1],(ue&192)===128&&(be=(W&31)<<6|ue&63,be>127&&(fe=be));break;case 3:ue=T[H+1],me=T[H+2],(ue&192)===128&&(me&192)===128&&(be=(W&15)<<12|(ue&63)<<6|me&63,be>2047&&(be<55296||be>57343)&&(fe=be));break;case 4:ue=T[H+1],me=T[H+2],pe=T[H+3],(ue&192)===128&&(me&192)===128&&(pe&192)===128&&(be=(W&15)<<18|(ue&63)<<12|(me&63)<<6|pe&63,be>65535&&be<1114112&&(fe=be))}}fe===null?(fe=65533,st=1):fe>65535&&(fe-=65536,q.push(fe>>>10&1023|55296),fe=56320|fe&1023),q.push(fe),H+=st}return m(q)}var c=4096;function m(T){let I=T.length;if(I<=c)return String.fromCharCode.apply(String,T);let O="",q=0;for(;q<I;)O+=String.fromCharCode.apply(String,T.slice(q,q+=c));return O}function w(T,I,O){let q="";O=Math.min(T.length,O);for(let H=I;H<O;++H)q+=String.fromCharCode(T[H]&127);return q}function d(T,I,O){let q="";O=Math.min(T.length,O);for(let H=I;H<O;++H)q+=String.fromCharCode(T[H]);return q}function o(T,I,O){let q=T.length;(!I||I<0)&&(I=0),(!O||O<0||O>q)&&(O=q);let H="";for(let W=I;W<O;++W)H+=Ge[T[W]];return H}function v(T,I,O){let q=T.slice(I,O),H="";for(let W=0;W<q.length-1;W+=2)H+=String.fromCharCode(q[W]+q[W+1]*256);return H}p.prototype.slice=function(T,I){let O=this.length;T=~~T,I=I===void 0?O:~~I,T<0?(T+=O,T<0&&(T=0)):T>O&&(T=O),I<0?(I+=O,I<0&&(I=0)):I>O&&(I=O),I<T&&(I=T);let q=this.subarray(T,I);return Object.setPrototypeOf(q,p.prototype),q};function R(T,I,O){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+I>O)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(T,I,O){T=T>>>0,I=I>>>0,O||R(T,I,this.length);let q=this[T],H=1,W=0;for(;++W<I&&(H*=256);)q+=this[T+W]*H;return q},p.prototype.readUintBE=p.prototype.readUIntBE=function(T,I,O){T=T>>>0,I=I>>>0,O||R(T,I,this.length);let q=this[T+--I],H=1;for(;I>0&&(H*=256);)q+=this[T+--I]*H;return q},p.prototype.readUint8=p.prototype.readUInt8=function(T,I){return T=T>>>0,I||R(T,1,this.length),this[T]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(T,I){return T=T>>>0,I||R(T,2,this.length),this[T]|this[T+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(T,I){return T=T>>>0,I||R(T,2,this.length),this[T]<<8|this[T+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(T,I){return T=T>>>0,I||R(T,4,this.length),(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])},p.prototype.readBigUInt64LE=lt(function(T){T=T>>>0,J(T,"offset");let I=this[T],O=this[T+7];(I===void 0||O===void 0)&&X(T,this.length-8);let q=I+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24,H=this[++T]+this[++T]*2**8+this[++T]*2**16+O*2**24;return BigInt(q)+(BigInt(H)<<BigInt(32))}),p.prototype.readBigUInt64BE=lt(function(T){T=T>>>0,J(T,"offset");let I=this[T],O=this[T+7];(I===void 0||O===void 0)&&X(T,this.length-8);let q=I*2**24+this[++T]*2**16+this[++T]*2**8+this[++T],H=this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+O;return(BigInt(q)<<BigInt(32))+BigInt(H)}),p.prototype.readIntLE=function(T,I,O){T=T>>>0,I=I>>>0,O||R(T,I,this.length);let q=this[T],H=1,W=0;for(;++W<I&&(H*=256);)q+=this[T+W]*H;return H*=128,q>=H&&(q-=Math.pow(2,8*I)),q},p.prototype.readIntBE=function(T,I,O){T=T>>>0,I=I>>>0,O||R(T,I,this.length);let q=I,H=1,W=this[T+--q];for(;q>0&&(H*=256);)W+=this[T+--q]*H;return H*=128,W>=H&&(W-=Math.pow(2,8*I)),W},p.prototype.readInt8=function(T,I){return T=T>>>0,I||R(T,1,this.length),this[T]&128?(255-this[T]+1)*-1:this[T]},p.prototype.readInt16LE=function(T,I){T=T>>>0,I||R(T,2,this.length);let O=this[T]|this[T+1]<<8;return O&32768?O|4294901760:O},p.prototype.readInt16BE=function(T,I){T=T>>>0,I||R(T,2,this.length);let O=this[T+1]|this[T]<<8;return O&32768?O|4294901760:O},p.prototype.readInt32LE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24},p.prototype.readInt32BE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]},p.prototype.readBigInt64LE=lt(function(T){T=T>>>0,J(T,"offset");let I=this[T],O=this[T+7];(I===void 0||O===void 0)&&X(T,this.length-8);let q=this[T+4]+this[T+5]*2**8+this[T+6]*2**16+(O<<24);return(BigInt(q)<<BigInt(32))+BigInt(I+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24)}),p.prototype.readBigInt64BE=lt(function(T){T=T>>>0,J(T,"offset");let I=this[T],O=this[T+7];(I===void 0||O===void 0)&&X(T,this.length-8);let q=(I<<24)+this[++T]*2**16+this[++T]*2**8+this[++T];return(BigInt(q)<<BigInt(32))+BigInt(this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+O)}),p.prototype.readFloatLE=function(T,I){return T=T>>>0,I||R(T,4,this.length),r.read(this,T,!0,23,4)},p.prototype.readFloatBE=function(T,I){return T=T>>>0,I||R(T,4,this.length),r.read(this,T,!1,23,4)},p.prototype.readDoubleLE=function(T,I){return T=T>>>0,I||R(T,8,this.length),r.read(this,T,!0,52,8)},p.prototype.readDoubleBE=function(T,I){return T=T>>>0,I||R(T,8,this.length),r.read(this,T,!1,52,8)};function S(T,I,O,q,H,W){if(!p.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>H||I<W)throw new RangeError('"value" argument is out of bounds');if(O+q>T.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(T,I,O,q){if(T=+T,I=I>>>0,O=O>>>0,!q){let fe=Math.pow(2,8*O)-1;S(this,T,I,O,fe,0)}let H=1,W=0;for(this[I]=T&255;++W<O&&(H*=256);)this[I+W]=T/H&255;return I+O},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(T,I,O,q){if(T=+T,I=I>>>0,O=O>>>0,!q){let fe=Math.pow(2,8*O)-1;S(this,T,I,O,fe,0)}let H=O-1,W=1;for(this[I+H]=T&255;--H>=0&&(W*=256);)this[I+H]=T/W&255;return I+O},p.prototype.writeUint8=p.prototype.writeUInt8=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,1,255,0),this[I]=T&255,I+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,2,65535,0),this[I]=T&255,this[I+1]=T>>>8,I+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,2,65535,0),this[I]=T>>>8,this[I+1]=T&255,I+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,4,4294967295,0),this[I+3]=T>>>24,this[I+2]=T>>>16,this[I+1]=T>>>8,this[I]=T&255,I+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,4,4294967295,0),this[I]=T>>>24,this[I+1]=T>>>16,this[I+2]=T>>>8,this[I+3]=T&255,I+4};function B(T,I,O,q,H){j(I,q,H,T,O,7);let W=Number(I&BigInt(4294967295));T[O++]=W,W=W>>8,T[O++]=W,W=W>>8,T[O++]=W,W=W>>8,T[O++]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[O++]=fe,fe=fe>>8,T[O++]=fe,fe=fe>>8,T[O++]=fe,fe=fe>>8,T[O++]=fe,O}function F(T,I,O,q,H){j(I,q,H,T,O,7);let W=Number(I&BigInt(4294967295));T[O+7]=W,W=W>>8,T[O+6]=W,W=W>>8,T[O+5]=W,W=W>>8,T[O+4]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[O+3]=fe,fe=fe>>8,T[O+2]=fe,fe=fe>>8,T[O+1]=fe,fe=fe>>8,T[O]=fe,O+8}p.prototype.writeBigUInt64LE=lt(function(T,I=0){return B(this,T,I,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=lt(function(T,I=0){return F(this,T,I,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(T,I,O,q){if(T=+T,I=I>>>0,!q){let st=Math.pow(2,8*O-1);S(this,T,I,O,st-1,-st)}let H=0,W=1,fe=0;for(this[I]=T&255;++H<O&&(W*=256);)T<0&&fe===0&&this[I+H-1]!==0&&(fe=1),this[I+H]=(T/W>>0)-fe&255;return I+O},p.prototype.writeIntBE=function(T,I,O,q){if(T=+T,I=I>>>0,!q){let st=Math.pow(2,8*O-1);S(this,T,I,O,st-1,-st)}let H=O-1,W=1,fe=0;for(this[I+H]=T&255;--H>=0&&(W*=256);)T<0&&fe===0&&this[I+H+1]!==0&&(fe=1),this[I+H]=(T/W>>0)-fe&255;return I+O},p.prototype.writeInt8=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,1,127,-128),T<0&&(T=255+T+1),this[I]=T&255,I+1},p.prototype.writeInt16LE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,2,32767,-32768),this[I]=T&255,this[I+1]=T>>>8,I+2},p.prototype.writeInt16BE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,2,32767,-32768),this[I]=T>>>8,this[I+1]=T&255,I+2},p.prototype.writeInt32LE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,4,2147483647,-2147483648),this[I]=T&255,this[I+1]=T>>>8,this[I+2]=T>>>16,this[I+3]=T>>>24,I+4},p.prototype.writeInt32BE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,4,2147483647,-2147483648),T<0&&(T=4294967295+T+1),this[I]=T>>>24,this[I+1]=T>>>16,this[I+2]=T>>>8,this[I+3]=T&255,I+4},p.prototype.writeBigInt64LE=lt(function(T,I=0){return B(this,T,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=lt(function(T,I=0){return F(this,T,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(T,I,O,q,H,W){if(O+q>T.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("Index out of range")}function re(T,I,O,q,H){return I=+I,O=O>>>0,H||$(T,I,O,4,34028234663852886e22,-34028234663852886e22),r.write(T,I,O,q,23,4),O+4}p.prototype.writeFloatLE=function(T,I,O){return re(this,T,I,!0,O)},p.prototype.writeFloatBE=function(T,I,O){return re(this,T,I,!1,O)};function Q(T,I,O,q,H){return I=+I,O=O>>>0,H||$(T,I,O,8,17976931348623157e292,-17976931348623157e292),r.write(T,I,O,q,52,8),O+8}p.prototype.writeDoubleLE=function(T,I,O){return Q(this,T,I,!0,O)},p.prototype.writeDoubleBE=function(T,I,O){return Q(this,T,I,!1,O)},p.prototype.copy=function(T,I,O,q){if(!p.isBuffer(T))throw new TypeError("argument should be a Buffer");if(O||(O=0),!q&&q!==0&&(q=this.length),I>=T.length&&(I=T.length),I||(I=0),q>0&&q<O&&(q=O),q===O||T.length===0||this.length===0)return 0;if(I<0)throw new RangeError("targetStart out of bounds");if(O<0||O>=this.length)throw new RangeError("Index out of range");if(q<0)throw new RangeError("sourceEnd out of bounds");q>this.length&&(q=this.length),T.length-I<q-O&&(q=T.length-I+O);let H=q-O;return this===T&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(I,O,q):Uint8Array.prototype.set.call(T,this.subarray(O,q),I),H},p.prototype.fill=function(T,I,O,q){if(typeof T=="string"){if(typeof I=="string"?(q=I,I=0,O=this.length):typeof O=="string"&&(q=O,O=this.length),q!==void 0&&typeof q!="string")throw new TypeError("encoding must be a string");if(typeof q=="string"&&!p.isEncoding(q))throw new TypeError("Unknown encoding: "+q);if(T.length===1){let W=T.charCodeAt(0);(q==="utf8"&&W<128||q==="latin1")&&(T=W)}}else typeof T=="number"?T=T&255:typeof T=="boolean"&&(T=Number(T));if(I<0||this.length<I||this.length<O)throw new RangeError("Out of range index");if(O<=I)return this;I=I>>>0,O=O===void 0?this.length:O>>>0,T||(T=0);let H;if(typeof T=="number")for(H=I;H<O;++H)this[H]=T;else{let W=p.isBuffer(T)?T:p.from(T,q),fe=W.length;if(fe===0)throw new TypeError('The value "'+T+'" is invalid for argument "value"');for(H=0;H<O-I;++H)this[H+I]=W[H%fe]}return this};var Z={};function K(T,I,O){Z[T]=class extends O{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:q,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(T,I){return`The "${T}" argument must be of type number. Received type ${typeof I}`},TypeError),K("ERR_OUT_OF_RANGE",function(T,I,O){let q=`The value of "${T}" is out of range.`,H=O;return Number.isInteger(O)&&Math.abs(O)>2**32?H=le(String(O)):typeof O=="bigint"&&(H=String(O),(O>BigInt(2)**BigInt(32)||O<-(BigInt(2)**BigInt(32)))&&(H=le(H)),H+="n"),q+=` It must be ${I}. Received ${H}`,q},RangeError);function le(T){let I="",O=T.length,q=T[0]==="-"?1:0;for(;O>=q+4;O-=3)I=`_${T.slice(O-3,O)}${I}`;return`${T.slice(0,O)}${I}`}function te(T,I,O){J(I,"offset"),(T[I]===void 0||T[I+O]===void 0)&&X(I,T.length-(O+1))}function j(T,I,O,q,H,W){if(T>O||T<I){let fe=typeof I=="bigint"?"n":"",st;throw W>3?I===0||I===BigInt(0)?st=`>= 0${fe} and < 2${fe} ** ${(W+1)*8}${fe}`:st=`>= -(2${fe} ** ${(W+1)*8-1}${fe}) and < 2 ** ${(W+1)*8-1}${fe}`:st=`>= ${I}${fe} and <= ${O}${fe}`,new Z.ERR_OUT_OF_RANGE("value",st,T)}te(q,H,W)}function J(T,I){if(typeof T!="number")throw new Z.ERR_INVALID_ARG_TYPE(I,"number",T)}function X(T,I,O){throw Math.floor(T)!==T?(J(T,O),new Z.ERR_OUT_OF_RANGE(O||"offset","an integer",T)):I<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE(O||"offset",`>= ${O?1:0} and <= ${I}`,T)}var he=/[^+/0-9A-Za-z-_]/g;function Te(T){if(T=T.split("=")[0],T=T.trim().replace(he,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function oe(T,I){I=I||1/0;let O,q=T.length,H=null,W=[];for(let fe=0;fe<q;++fe){if(O=T.charCodeAt(fe),O>55295&&O<57344){if(!H){if(O>56319){(I-=3)>-1&&W.push(239,191,189);continue}else if(fe+1===q){(I-=3)>-1&&W.push(239,191,189);continue}H=O;continue}if(O<56320){(I-=3)>-1&&W.push(239,191,189),H=O;continue}O=(H-55296<<10|O-56320)+65536}else H&&(I-=3)>-1&&W.push(239,191,189);if(H=null,O<128){if((I-=1)<0)break;W.push(O)}else if(O<2048){if((I-=2)<0)break;W.push(O>>6|192,O&63|128)}else if(O<65536){if((I-=3)<0)break;W.push(O>>12|224,O>>6&63|128,O&63|128)}else if(O<1114112){if((I-=4)<0)break;W.push(O>>18|240,O>>12&63|128,O>>6&63|128,O&63|128)}else throw new Error("Invalid code point")}return W}function ce(T){let I=[];for(let O=0;O<T.length;++O)I.push(T.charCodeAt(O)&255);return I}function ot(T,I){let O,q,H,W=[];for(let fe=0;fe<T.length&&!((I-=2)<0);++fe)O=T.charCodeAt(fe),q=O>>8,H=O%256,W.push(H),W.push(q);return W}function ge(T){return e.toByteArray(Te(T))}function Se(T,I,O,q){let H;for(H=0;H<q&&!(H+O>=I.length||H>=T.length);++H)I[H+O]=T[H];return H}function ut(T,I){return T instanceof I||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===I.name}function Ze(T){return T!==T}var Ge=function(){let T="0123456789abcdef",I=new Array(256);for(let O=0;O<16;++O){let q=O*16;for(let H=0;H<16;++H)I[q+H]=T[O]+T[H]}return I}();function lt(T){return typeof BigInt>"u"?z:T}function z(){throw new Error("BigInt not supported")}}),p$e=Jh((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:nB().Buffer,Crypto:window.crypto}):e.exports={Buffer:nB().Buffer,Crypto:crypto}}),jse={};f$e(jse,{AVSCTap:()=>pb,ArweaveSigner:()=>IB,DataItem:()=>ub,MAX_TAG_BYTES:()=>Ow,MIN_BINARY_SIZE:()=>OB,SIG_CONFIG:()=>pv,SignatureConfig:()=>Ls,Signer:()=>zse,createData:()=>Wse,deserializeTags:()=>xw,indexToType:()=>BB,serializeTags:()=>PB,tagsExceedLimit:()=>Kse});var zse=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,r,a){throw new Error("You must implement verify method on child")}},v$e=Zd(kB(),1),Ff=Zd(Fse(),1);async function Zse(t){if(Array.isArray(t)){let i=(0,Ff.concatBuffers)([(0,Ff.stringToBuffer)("list"),(0,Ff.stringToBuffer)(t.length.toString())]);return await Hse(t,await Wh().hash(i,"SHA-384"))}let e=t,r=(0,Ff.concatBuffers)([(0,Ff.stringToBuffer)("blob"),(0,Ff.stringToBuffer)(e.byteLength.toString())]),a=(0,Ff.concatBuffers)([await Wh().hash(r,"SHA-384"),await Wh().hash(e,"SHA-384")]);return await Wh().hash(a,"SHA-384")}async function Hse(t,e){if(t.length<1)return e;let r=(0,Ff.concatBuffers)([e,await Zse(t[0])]),a=await Wh().hash(r,"SHA-384");return await Hse(t.slice(1),a)}var NI=Zd(c$e(),1),m$e=NI.default.default?NI.default.default:NI.default,g$e=class extends m$e{getPublicKey(t){throw new Error("Unimplemented")}},b$e;function Wh(){return b$e??=new g$e}var Ls;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Ls||(Ls={}));var pv={[Ls.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Ls.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Ls.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Ls.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Ls.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Ls.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Ls.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},IB=class{signatureType=1;ownerLength=pv[1].pubLength;signatureLength=pv[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return v$e.default.toBuffer(this.pk)}sign(t){return Wh().sign(this.jwk,t)}static async verify(t,e,r){return await Wh().verify(t,e,r)}},BB={1:IB},ju=Zd(kB(),1);async function aB(t){return Zse([(0,Ff.stringToBuffer)("dataitem"),(0,Ff.stringToBuffer)("1"),(0,Ff.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function y$e(t,e){let r=await aB(t),a=await e.sign(r),i=await Wh().hash(a);return{signature:Me.from(a),id:Me.from(i)}}async function w$e(t,e){let{signature:r,id:a}=await y$e(t,e);return t.getRaw().set(r,2),a}var pb=class{buf;pos;constructor(t=Me.alloc(Ow),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;r<e;r++){let a=t[r];if(a?.name===void 0||a?.value===void 0)throw new Error(`Invalid tag format for ${a}, expected {name:string, value: string}`);this.writeString(a.name),this.writeString(a.value)}this.writeLong(0)}toBuffer(){let t=Me.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(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,a;if(t>=-1073741824&&t<1073741824){a=t>=0?t<<1:~t<<1|1;do e[this.pos]=a&127,a>>=7;while(a&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=Me.byteLength(t),r=this.buf;this.writeLong(e);let a=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,h,l,p;for(i=0,h=e;i<h;i++)l=t.charCodeAt(i),l<128?r[a++]=l:l<2048?(r[a++]=l>>6|192,r[a++]=l&63|128):(l&64512)===55296&&((p=t.charCodeAt(i+1))&64512)===56320?(l=65536+((l&1023)<<10)+(p&1023),i++,r[a++]=l>>18|240,r[a++]=l>>12&63|128,r[a++]=l>>6&63|128,r[a++]=l&63|128):(r[a++]=l>>12|224,r[a++]=l>>6&63|128,r[a++]=l&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,a,i,h,l;do a=r[this.pos++],i=a&128,t|=(a&127)<<e,e+=7;while(i&&e<28);if(i){h=t,l=268435456;do a=r[this.pos++],h+=(a&127)*l,l*=128;while(a&128);return(h%2?-(h+1):h)/2}return t>>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),a=this.readString();t.push({name:r,value:a})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function PB(t){let e=new pb;return e.writeTags(t),e.toBuffer()}function Kse(t){let e=new pb;return e.writeTags(t),e.tagsExceedLimit()}function xw(t){return new pb(t).readTags()}function yc(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function _$e(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;r<e.length;r++){let a=t&255;e[r]=a,t=(t-a)/256}return Uint8Array.from(e)}function uoe(t){let e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){let a=t&255;e[r]=a,t=(t-a)/256}return Uint8Array.from(e)}var M$e=Zd(p$e(),1),V1=Zd(nB(),1),Ow=4096,OB=80,ub=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return t.binary!==void 0}get signatureType(){let t=yc(this.binary.subarray(0,2));if(Ls?.[t]!==void 0)return t;throw new Error("Unknown signature type: "+t)}async isValid(){return ub.verify(this.binary)}get id(){return(async()=>ju.default.encode(await this.rawId))()}set id(t){this._id=ju.default.toBuffer(t)}get rawId(){return(async()=>V1.Buffer.from(await M$e.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return ju.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return pv[this.signatureType].sigLength}get owner(){return ju.default.encode(this.rawOwner)}get ownerLength(){return pv[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):V1.Buffer.alloc(0)}get target(){return ju.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):V1.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=yc(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(yc(this.binary.subarray(t,t+8))==0)return[];let e=yc(this.binary.subarray(t+8,t+16));return xw(V1.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:ju.default.encode(t.name),value:ju.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=yc(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=yc(e),a=t+16+r;return this.binary.subarray(a,this.binary.length)}get data(){return ju.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await w$e(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=V1.Buffer.from(await Wh().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:ju.default.encode(t.name),value:ju.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength<OB)return!1;let e=new ub(t),r=e.signatureType,a=e.getTagsStart(),i=yc(t.subarray(a,a+8)),h=t.subarray(a+8,a+16),l=yc(h);if(l>Ow)return!1;if(i>0)try{if(xw(V1.Buffer.from(t.subarray(a+16,a+16+l))).length!==i)return!1}catch{return!1}let p=BB[r],b=await aB(e);return await p.verify(e.rawOwner,b,e.rawSignature)}async getSignatureData(){return aB(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),a=this.binary[r]==1;return r+=a?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},x$e=Zd(kB(),1);function Wse(t,e,r){let a=e.publicKey,i=r?.target?x$e.default.toBuffer(r.target):null,h=1+(i?.byteLength??0),l=r?.anchor?Me.from(r.anchor):null,p=1+(l?.byteLength??0),b=(r?.tags?.length??0)>0?PB(r.tags):null,g=16+(b?b.byteLength:0),y=Me.from(t),M=y.byteLength,x=2+e.signatureLength+e.ownerLength+h+p+g+M,E=Me.alloc(x);if(E.set(_$e(e.signatureType),0),E.set(new Uint8Array(e.signatureLength).fill(0),2),a.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${a.byteLength}`);E.set(a,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(E[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);E.set(i,A+1)}let k=A+h,P=k+1;if(E[k]=l?1:0,l){if(P+=l.byteLength,l.byteLength!==32)throw new Error("Anchor must be 32 bytes");E.set(l,k+1)}E.set(uoe(r?.tags?.length??0),P);let N=uoe(b?.byteLength??0);E.set(N,P+8),b&&E.set(b,P+16);let L=P+g;return E.set(y,L),new ub(E)}var NB={...jse};globalThis.arbundles??=NB;var S$e=NB,E$e=NB;globalThis.Buffer||(globalThis.Buffer=$se.Buffer);var{DataItem:A$e}=qse;function R$e(t){return async({data:r,tags:a,target:i,anchor:h,createDataItem:l=p=>new A$e(p)})=>{let p=await t.signDataItem({data:r,tags:a,target:i,anchor:h}),b=l($se.Buffer.from(p));return{id:await b.id,raw:await b.getRaw()}}}var T$e=globalThis.GATEWAY_URL||void 0,k$e=globalThis.MU_URL||void 0,I$e=globalThis.CU_URL||void 0,B$e=globalThis.GRAPHQL_URL||void 0,{result:Fmt,results:jmt,message:zmt,spawn:Zmt,monitor:Hmt,unmonitor:Kmt,dryrun:Wmt,assign:Vmt}=vv({GATEWAY_URL:T$e,MU_URL:k$e,CU_URL:I$e,GRAPHQL_URL:B$e}),Vse=Dse.createDataItemSigner;ie();ae();ne();var Ffe=gi(Ufe(),1),hP=Ffe.default.init({host:"arweave.net",port:443,protocol:"https"});async function qbt({signer:t,module:e=aQ,luaCodeTxId:r=gT,ao:a=vv(),scheduler:i=oQ,state:h,stateContractTxId:l,antRegistryId:p=$8,logger:b=Fu.default,arweave:g=hP}){let y=await g.transactions.getData(r,{decode:!0,string:!0}),M=await a.spawn({module:e,scheduler:i,signer:t,tags:[{name:"ANT-Registry-Id",value:p},{name:"Source-Code-TX-ID",value:r}]}),x=new Pa({processId:M,ao:a,logger:b}),{id:E}=await x.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:y,signer:t});if(b.debug("Spawned ANT",{processId:M,module:e,scheduler:i,luaCodeTxId:r,evalId:E}),h){let{id:P}=await x.send({tags:[{name:"Action",value:"Initialize-State"},...l!==void 0?[{name:"State-Contract-TX-ID",value:l}]:[]],data:JSON.stringify(h),signer:t});b.debug("Initialized ANT",{processId:M,module:e,scheduler:i,initializeMsgId:P})}let A=Hd.init({process:new Pa({processId:p,ao:a,logger:b}),signer:t}),{id:k}=await A.register({processId:M});return b.debug("Registered ANT to ANT Registry",{processId:M,module:e,scheduler:i,antRegistrationMsgId:k,antRegistryId:p}),M}async function Ubt({signer:t,processId:e,luaCodeTxId:r=gT,ao:a=vv(),logger:i=Fu.default,arweave:h=hP}){let l=new Pa({processId:e,ao:a,logger:i}),p=await h.transactions.getData(r,{decode:!0,string:!0}),{id:b}=await l.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:p,signer:t});return i.debug("Evolved ANT",{processId:e,luaCodeTxId:r,evalMsgId:b}),b}function Jqe(t){let e=vr.object({name:vr.string(),value:vr.union([vr.string(),vr.number()])}),r=vr.function().args(vr.object({data:vr.union([vr.string(),vr.instanceof(Me)]),tags:vr.array(e).optional(),target:vr.string().optional(),anchor:vr.string().optional()})).returns(vr.promise(vr.object({id:vr.string(),raw:vr.instanceof(ArrayBuffer)})));try{return r.parse(t),!0}catch{return!1}}function Bc(t){return Jqe(t)?t:"publicKey"in t?async({data:r,tags:a,target:i,anchor:h})=>{t.publicKey===void 0&&"setPublicKey"in t&&typeof t.setPublicKey=="function"&&await t.setPublicKey();let l=Ag(r,t,{tags:a,target:i,anchor:h});return l.sign(t).then(async()=>({id:await l.id,raw:await l.getRaw()}))}:Vse(t)}var Xqe="-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI";function Fbt({owner:t,targetId:e,ttlSeconds:r=3600,keywords:a=[],controllers:i=[],description:h="",ticker:l="aos",name:p="ANT"}){return{ticker:l,name:p,description:h,keywords:a,owner:t,controllers:[t,...i],balances:{[t]:1},records:{"@":{transactionId:e??Xqe.toString(),ttlSeconds:r}}}}ie();ae();ne();function Pc(t,e){let r=t.safeParse(e);if(!r.success)throw new Error(JSON.stringify(r.error.format(),null,2));return r}var Fw=class{static init({signer:e,strict:r=!1,...a}){if(Dh(a)||$h(a))return e?new lP({signer:e,strict:r,...a}):new jw({strict:r,...a});throw new Nu}},jw=class{process;strict;constructor(e){if(this.strict=e.strict||!1,Dh(e))this.process=e.process;else if($h(e))this.process=new Pa({processId:e.processId});else throw new Nu}async getState({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"State"}],a=await this.process.read({tags:r});return e&&Pc(_T.passthrough().and(vr.object({Records:vr.record(vr.string(),q8.passthrough())})),a),a}async getInfo({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"Info"}],a=await this.process.read({tags:r});return e&&Pc(hQ.passthrough(),a),a}async getRecord({undername:e},{strict:r}={strict:this.strict}){let a=[{name:"Sub-Domain",value:e},{name:"Action",value:"Record"}],i=await this.process.read({tags:a});return r&&Pc(q8.passthrough(),i),i}async getRecords({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"Records"}],a=await this.process.read({tags:r});return e&&Pc(bT,a),a}async getOwner({strict:e}={strict:this.strict}){return(await this.getInfo({strict:e})).Owner}async getControllers({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"Controllers"}],a=await this.process.read({tags:r});return e&&Pc(yT,a),a}async getName({strict:e}={strict:this.strict}){return(await this.getInfo({strict:e})).Name}async getTicker({strict:e}={strict:this.strict}){return(await this.getInfo({strict:e})).Ticker}async getBalances({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"Balances"}],a=await this.process.read({tags:r});return e&&Pc(wT,a),a}async getBalance({address:e},{strict:r}={strict:this.strict}){let a=[{name:"Action",value:"Balance"},{name:"Recipient",value:e}],i=await this.process.read({tags:a});return r&&Pc(vr.number(),i),i}async getHandlers(){let e=await this.getInfo();return e.Handlers??e.HandlerNames}},lP=class extends jw{signer;constructor({signer:e,...r}){super(r),this.signer=Bc(e)}async transfer({target:e},r){let a=[...r?.tags??[],{name:"Action",value:"Transfer"},{name:"Recipient",value:e}];return this.process.send({tags:a,signer:this.signer})}async addController({controller:e},r){let a=[...r?.tags??[],{name:"Action",value:"Add-Controller"},{name:"Controller",value:e}];return this.process.send({tags:a,signer:this.signer})}async removeController({controller:e},r){let a=[...r?.tags??[],{name:"Action",value:"Remove-Controller"},{name:"Controller",value:e}];return this.process.send({tags:a,signer:this.signer})}async setRecord({undername:e,transactionId:r,ttlSeconds:a},i){return this.process.send({tags:[...i?.tags??[],{name:"Action",value:"Set-Record"},{name:"Sub-Domain",value:e},{name:"Transaction-Id",value:r},{name:"TTL-Seconds",value:a.toString()}],signer:this.signer})}async removeRecord({undername:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Remove-Record"},{name:"Sub-Domain",value:e}],signer:this.signer})}async setTicker({ticker:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Ticker"},{name:"Ticker",value:e}],signer:this.signer})}async setName({name:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Name"},{name:"Name",value:e}],signer:this.signer})}async setDescription({description:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Description"},{name:"Description",value:e}],signer:this.signer})}async setKeywords({keywords:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Keywords"},{name:"Keywords",value:JSON.stringify(e)}],signer:this.signer})}async setLogo({txId:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Logo"},{name:"Logo",value:e}],signer:this.signer})}async releaseName({name:e,arioProcessId:r},a){return this.process.send({tags:[...a?.tags??[],{name:"Action",value:"Release-Name"},{name:"Name",value:e},{name:"IO-Process-Id",value:r},{name:"ARIO-Process-Id",value:r}],signer:this.signer})}async reassignName({name:e,arioProcessId:r,antProcessId:a},i){return this.process.send({tags:[...i?.tags??[],{name:"Action",value:"Reassign-Name"},{name:"Name",value:e},{name:"IO-Process-Id",value:r},{name:"ARIO-Process-Id",value:r},{name:"Process-Id",value:a}],signer:this.signer})}async approvePrimaryNameRequest({name:e,address:r,arioProcessId:a},i){return this.process.send({tags:[...i?.tags??[],{name:"Action",value:"Approve-Primary-Name"},{name:"Name",value:e},{name:"Recipient",value:r},{name:"IO-Process-Id",value:a},{name:"ARIO-Process-Id",value:a}],signer:this.signer})}async removePrimaryNames({names:e,arioProcessId:r},a){return this.process.send({tags:[...a?.tags??[],{name:"Action",value:"Remove-Primary-Names"},{name:"Names",value:e.join(",")},{name:"IO-Process-Id",value:r},{name:"ARIO-Process-Id",value:r}],signer:this.signer})}};ie();ae();ne();var Hd=class{static init(e){if(e&&e.signer){let{signer:r,...a}=e;return new cP({...a,signer:r})}return new zw(e)}},zw=class{process;constructor(e){if(e&&($h(e)||Dh(e)))if(Dh(e))this.process=e.process;else if($h(e))this.process=new Pa({processId:e.processId});else throw new Nu;else this.process=new Pa({processId:$8})}async accessControlList({address:e}){return this.process.read({tags:[{name:"Action",value:"Access-Control-List"},{name:"Address",value:e}]})}},cP=class extends zw{signer;constructor({signer:e,...r}){super(r),this.signer=Bc(e)}async register({processId:e}){return this.process.send({tags:[{name:"Action",value:"Register"},{name:"Process-Id",value:e}],signer:this.signer})}};ie();ae();ne();ie();ae();ne();ie();ae();ne();du();var jfe="+",zfe="/",Zfe="-",Hfe="_",Kfe="=";function Qqe(t){let e=t.length%4;return e&&(t+=Kfe.repeat(4-e)),t.replaceAll(Zfe,jfe).replaceAll(Hfe,zfe)}function eUe(t){return t.replaceAll(jfe,Zfe).replaceAll(zfe,Hfe).replaceAll(Kfe,"")}function Nyt(t){let e=Qqe(t);return Me.from(e,"base64")}function tUe(t){let e=t.toString("base64");return eUe(e)}function Cyt(t){return tUe(pf("sha256").update(Uint8Array.from(t)).digest())}function Wfe(t=32){let e=nE(t);return Array.from(e,r=>r.toString(16).padStart(2,"0")).join("").slice(0,t)}ie();ae();ne();function dP(t){try{return JSON.parse(t)}catch{return t}}var Pa=class{logger;processId;ao;constructor({processId:e,ao:r=vv(),logger:a=Fu.default}){this.processId=e,this.logger=a,this.ao=r}isMessageDataEmpty(e){return e===void 0||e==="null"||e===""||e===null}async read({tags:e,retries:r=3,fromAddress:a}){let i=0,h;for(;i<r;)try{this.logger.debug("Evaluating read interaction on contract",{tags:e});let l={process:this.processId,tags:e};a!==void 0&&(l.Owner=a);let p=await this.ao.dryrun(l);this.logger.debug("Read interaction result",{result:p});let b=Vfe(p);if(b!==void 0)throw new Error(b);if(p.Messages===void 0||p.Messages.length===0)throw this.logger.debug(`Process ${this.processId} does not support provided action.`,p,e),new Error(`Process ${this.processId} does not support provided action.`);let g=p.Messages?.[0]?.Data;return this.isMessageDataEmpty(g)?void 0:dP(p.Messages[0].Data)}catch(l){i++,this.logger.debug(`Read attempt ${i} failed`,{error:l instanceof Error?l.message:l,tags:e}),h=l,await new Promise(p=>setTimeout(p,2**i*1e3))}throw h}async send({tags:e,data:r,signer:a,retries:i=3}){let h=0,l;for(;h<i;)try{this.logger.debug("Evaluating send interaction on contract",{tags:e,data:r,processId:this.processId});let p=Wfe(32),b=await this.ao.message({process:this.processId,tags:[...e,{name:"AR-IO-SDK",value:W4}],data:r,signer:a,anchor:p});this.logger.debug("Sent message to process",{messageId:b,processId:this.processId,anchor:p});let g=await this.ao.result({message:b,process:this.processId});this.logger.debug("Message result",{output:g,messageId:b,processId:this.processId});let y=Vfe(g);if(y!==void 0)throw new U8(y);if(g.Messages?.length===0||g.Messages===void 0)return{id:b};if(g.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);if(this.isMessageDataEmpty(g.Messages[0].Data))return{id:b};let M=dP(g.Messages[0].Data);return this.logger.debug("Message result data",{resultData:M,messageId:b,processId:this.processId}),{id:b,result:M}}catch(p){if(this.logger.error("Error sending message to process",{error:p.message,processId:this.processId,tags:e}),p.message.includes("500"))this.logger.debug("Retrying send interaction",{attempts:h,retries:i,error:p.message,processId:this.processId}),await new Promise(b=>setTimeout(b,2**h*2e3)),h++,l=p;else throw p}throw l}};function Vfe(t){let e=t.Error;if(e!==void 0)return e;let r=t.Messages?.[0]?.Tags?.find(a=>a.name==="Error")?.value;if(r!==void 0){let a=r.match(/\d+/)?.[0];return`${r.replace(/\[string "aos"\]:\d+:/,"")} (line ${a})`.trim()}}var Eb=class{static init(e){if(e&&e.signer){let{signer:r,...a}=e;return new pP({...a,signer:r})}return new Zw(e)}},Zw=class{process;epochSettings;constructor(e){if(!e)this.process=new Pa({processId:A1});else if(Dh(e))this.process=e.process;else if($h(e))this.process=new Pa({processId:e.processId});else throw new Nu}async getInfo(){return this.process.read({tags:[{name:"Action",value:"Info"}]})}async getTokenSupply(){return this.process.read({tags:[{name:"Action",value:"Total-Token-Supply"}]})}async computeEpochIndexForTimestamp(e){let r=await this.getEpochSettings(),a=r.epochZeroStartTimestamp,i=r.durationMs;return Math.floor((e-a)/i)}async computeEpochIndex(e){let r=e?.epochIndex;if(r!==void 0)return r.toString();let a=e?.timestamp;if(a!==void 0)return(await this.computeEpochIndexForTimestamp(a)).toString()}async getEpochSettings(){return this.epochSettings??=await this.process.read({tags:[{name:"Action",value:"Epoch-Settings"}]})}async getEpoch(e){let r=[{name:"Action",value:"Epoch"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getArNSRecord({name:e}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:e}]})}async getArNSRecords(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Records"},...Oo(e)]})}async getArNSReservedNames(e){return this.process.read({tags:[{name:"Action",value:"Reserved-Names"},...Oo(e)]})}async getArNSReservedName({name:e}){return this.process.read({tags:[{name:"Action",value:"Reserved-Name"},{name:"Name",value:e}]})}async getBalance({address:e}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:e}]})}async getBalances(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Balances"},...Oo(e)]})}async getVault({address:e,vaultId:r}){return this.process.read({tags:[{name:"Action",value:"Vault"},{name:"Address",value:e},{name:"Vault-Id",value:r}]})}async getVaults(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Vaults"},...Oo(e)]})}async getGateway({address:e}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:e}]})}async getGatewayDelegates({address:e,...r}){return this.process.read({tags:[{name:"Action",value:"Paginated-Delegates"},{name:"Address",value:e},...Oo(r)]})}async getGatewayDelegateAllowList({address:e,...r}){return this.process.read({tags:[{name:"Action",value:"Paginated-Allowed-Delegates"},{name:"Address",value:e},...Oo(r)]})}async getGateways(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Gateways"},...Oo(e)]})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"}]})}async getPrescribedObservers(e){let r=[{name:"Action",value:"Epoch-Prescribed-Observers"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getPrescribedNames(e){let r=[{name:"Action",value:"Epoch-Prescribed-Names"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getObservations(e){let r=[{name:"Action",value:"Epoch-Observations"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getDistributions(e){let r=[{name:"Action",value:"Epoch-Distributions"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getTokenCost({intent:e,type:r,years:a,name:i,quantity:h,fromAddress:l}){let p=[{name:"Action",value:"Token-Cost"},{name:"Intent",value:e},{name:"Name",value:i},{name:"Years",value:a?.toString()},{name:"Quantity",value:h?.toString()},{name:"Purchase-Type",value:r}];return this.process.read({tags:En(p),fromAddress:l})}async getCostDetails({intent:e,type:r,years:a,name:i,quantity:h,fromAddress:l,fundFrom:p}){let b=[{name:"Action",value:"Get-Cost-Details-For-Action"},{name:"Intent",value:e},{name:"Name",value:i},{name:"Years",value:a?.toString()},{name:"Quantity",value:h?.toString()},{name:"Purchase-Type",value:r},{name:"Fund-From",value:p}];return this.process.read({tags:En(b),fromAddress:l})}async getRegistrationFees(){return this.process.read({tags:[{name:"Action",value:"Get-Registration-Fees"}]})}async getDemandFactor(){return this.process.read({tags:[{name:"Action",value:"Demand-Factor"}]})}async getDemandFactorSettings(){return this.process.read({tags:[{name:"Action",value:"Demand-Factor-Settings"}]})}async getArNSReturnedNames(e){return this.process.read({tags:[{name:"Action",value:"Returned-Names"},...Oo(e)]})}async getArNSReturnedName({name:e}){let r=[{name:"Action",value:"Returned-Name"},{name:"Name",value:e}];return this.process.read({tags:r})}async getDelegations(e){let r=[{name:"Action",value:"Paginated-Delegations"},{name:"Address",value:e.address},...Oo(e)];return this.process.read({tags:En(r)})}async getAllowedDelegates(e){return this.getGatewayDelegateAllowList(e)}async getGatewayVaults(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Gateway-Vaults"},{name:"Address",value:e.address},...Oo(e)]})}async getPrimaryNameRequest(e){let r=[{name:"Action",value:"Primary-Name-Request"},{name:"Initiator",value:e.initiator}];return this.process.read({tags:r})}async getPrimaryNameRequests(e){return this.process.read({tags:[{name:"Action",value:"Primary-Name-Requests"},...Oo(e)]})}async getPrimaryName(e){let r=[{name:"Action",value:"Primary-Name"},{name:"Address",value:e?.address},{name:"Name",value:e?.name}];return this.process.read({tags:En(r)})}async getPrimaryNames(e){return this.process.read({tags:[{name:"Action",value:"Primary-Names"},...Oo(e)]})}async getRedelegationFee(e){return this.process.read({tags:[{name:"Action",value:"Redelegation-Fee"},{name:"Address",value:e.address}]})}async getGatewayRegistrySettings(){return this.process.read({tags:[{name:"Action",value:"Gateway-Registry-Settings"}]})}},pP=class extends Zw{signer;constructor({signer:e,...r}){if(Object.keys(r).length===0)super({process:new Pa({processId:A1})}),this.signer=Bc(e);else if(Dh(r))super({process:r.process}),this.signer=Bc(e);else if($h(r))super({process:new Pa({processId:r.processId})}),this.signer=Bc(e);else throw new Nu}async transfer({target:e,qty:r},a){let{tags:i=[]}=a||{};return this.process.send({tags:[...i,{name:"Action",value:"Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:r.valueOf().toString()}],signer:this.signer})}async joinNetwork({operatorStake:e,allowDelegatedStaking:r,allowedDelegates:a,delegateRewardShareRatio:i,fqdn:h,label:l,minDelegatedStake:p,note:b,port:g,properties:y,protocol:M,autoStake:x,observerAddress:E},A){let{tags:k=[]}=A||{},P=[...k,{name:"Action",value:"Join-Network"},{name:"Operator-Stake",value:e.valueOf().toString()},{name:"Allow-Delegated-Staking",value:r?.toString()},{name:"Allowed-Delegates",value:a?.join(",")},{name:"Delegate-Reward-Share-Ratio",value:i?.toString()},{name:"FQDN",value:h},{name:"Label",value:l},{name:"Min-Delegated-Stake",value:p?.valueOf().toString()},{name:"Note",value:b},{name:"Port",value:g?.toString()},{name:"Properties",value:y},{name:"Protocol",value:M},{name:"Auto-Stake",value:x?.toString()},{name:"Observer-Address",value:E}];return this.process.send({signer:this.signer,tags:En(P)})}async leaveNetwork(e){let{tags:r=[]}=e||{};return this.process.send({signer:this.signer,tags:[...r,{name:"Action",value:"Leave-Network"}]})}async updateGatewaySettings({allowDelegatedStaking:e,allowedDelegates:r,delegateRewardShareRatio:a,fqdn:i,label:h,minDelegatedStake:l,note:p,port:b,properties:g,protocol:y,autoStake:M,observerAddress:x},E){let{tags:A=[]}=E||{},k=[...A,{name:"Action",value:"Update-Gateway-Settings"},{name:"Label",value:h},{name:"Note",value:p},{name:"FQDN",value:i},{name:"Port",value:b?.toString()},{name:"Properties",value:g},{name:"Protocol",value:y},{name:"Observer-Address",value:x},{name:"Allow-Delegated-Staking",value:e?.toString()},{name:"Allowed-Delegates",value:r?.join(",")},{name:"Delegate-Reward-Share-Ratio",value:a?.toString()},{name:"Min-Delegated-Stake",value:l?.valueOf().toString()},{name:"Auto-Stake",value:M?.toString()}];return this.process.send({signer:this.signer,tags:En(k)})}async delegateStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Decrease-Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.decreaseQty.valueOf().toString()},{name:"Instant",value:`${e.instant||!1}`}]})}async instantWithdrawal(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Instant-Withdrawal"},{name:"Vault-Id",value:e.vaultId},{name:"Address",value:e.gatewayAddress}];return this.process.send({signer:this.signer,tags:En(i)})}async increaseOperatorStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Increase-Operator-Stake"},{name:"Quantity",value:e.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Decrease-Operator-Stake"},{name:"Quantity",value:e.decreaseQty.valueOf().toString()},{name:"Instant",value:`${e.instant||!1}`}]})}async saveObservations(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Save-Observations"},{name:"Report-Tx-Id",value:e.reportTxId},{name:"Failed-Gateways",value:e.failedGateways.join(",")}]})}async buyRecord(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Buy-Record"},{name:"Name",value:e.name},{name:"Years",value:e.years?.toString()??"1"},{name:"Process-Id",value:e.processId},{name:"Purchase-Type",value:e.type||"lease"},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:En(i)})}async upgradeRecord(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Upgrade-Name"},{name:"Name",value:e.name},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:En(i)})}async extendLease(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Extend-Lease"},{name:"Name",value:e.name},{name:"Years",value:e.years.toString()},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:En(i)})}async increaseUndernameLimit(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Increase-Undername-Limit"},{name:"Name",value:e.name},{name:"Quantity",value:e.increaseCount.toString()},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:En(i)})}async cancelWithdrawal(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Cancel-Withdrawal"},{name:"Vault-Id",value:e.vaultId},{name:"Address",value:e.gatewayAddress}];return this.process.send({signer:this.signer,tags:En(i)})}async requestPrimaryName(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Request-Primary-Name"},{name:"Name",value:e.name}];return this.process.send({signer:this.signer,tags:En(i)})}async redelegateStake(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Redelegate-Stake"},{name:"Target",value:e.target},{name:"Source",value:e.source},{name:"Quantity",value:e.stakeQty.valueOf().toString()},{name:"Vault-Id",value:e.vaultId}];return this.process.send({signer:this.signer,tags:En(i)})}};ie();ae();ne();ie();ae();ne();ie();ae();ne();var mP=gi(Yfe(),1);ie();ae();ne();var nUe=Object.defineProperty,aUe=(t,e,r)=>e in t?nUe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rb=(t,e,r)=>(aUe(t,typeof e!="symbol"?e+"":e,r),r),gP=class{constructor(e){Rb(this,"value"),Rb(this,"next"),this.value=e}},bP=class{constructor(){Rb(this,"head"),Rb(this,"tail"),Rb(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(e){let r=new gP(e);return this.head&&this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),this._size++,this._size}pop(){if(!this.head)return;let e=this.head;return this.head=this.head.next,this._size--,e.value}get size(){return this._size}*[Symbol.iterator](){let e=this.head;for(;e;)yield e.value,e=e.next}};function Jfe(t){if(!((Number.isInteger(t)||t===1/0)&&t>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let e=new bP,r=0,a=()=>{r--,e.size>0&&e.pop()()},i=async(p,b,g)=>{r++;let y=(async()=>p(...g))();b(y);try{await y}catch{}a()},h=(p,b,g)=>{e.push(i.bind(null,p,b,g)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.pop()()))()},l=(p,...b)=>new Promise(g=>{h(p,g,b)});return Object.defineProperties(l,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),l}var l3t=async({address:t,registry:e=Hd.init()})=>{let r=await e.accessControlList({address:t});return[...new Set([...r.Owned,...r.Controlled])]};function Xfe(t,e){return new Promise((r,a)=>{let i=setTimeout(()=>{a(new Error("Timeout"))},t);e.then(h=>{clearTimeout(i),r(h)}).catch(h=>{clearTimeout(i),a(h)})})}var Qfe=class extends mP.default{contract;timeoutMs;throttle;logger;strict;constructor({contract:e=Eb.init({processId:A1}),timeoutMs:r=6e4,concurrency:a=30,logger:i=Fu.default,strict:h=!1}={}){super(),this.contract=e,this.timeoutMs=r,this.throttle=Jfe(a),this.logger=i,this.strict=h}async fetchProcessesOwnedByWallet({address:e,pageSize:r,antRegistry:a=Hd.init()}){let i={},h=await a.accessControlList({address:e}),l=new Set([...h.Owned,...h.Controlled]);await Xfe(this.timeoutMs,oUe({contract:this.contract,emitter:this,pageSize:r})).catch(b=>(this.emit("error",`Error getting ArNS records: ${b}`),this.logger.error("Error getting ArNS records",{message:b?.message,stack:b?.stack}),{})).then(b=>{Object.entries(b).forEach(([g,y])=>{l.has(y.processId)&&(i[y.processId]==null&&(i[y.processId]={state:void 0,names:{}}),i[y.processId].names[g]=y)})});let p=Object.keys(i).length;this.emit("progress",0,p),await Promise.all(Object.keys(i).map(async(b,g)=>this.throttle(async()=>{if(i[b].state!==void 0){this.emit("progress",g+1,p);return}let y=Fw.init({processId:b,strict:this.strict}),M=await Xfe(this.timeoutMs,y.getState()).catch(x=>{this.emit("error",`Error getting state for process ${b}: ${x}`)});(M?.Owner===e||M?.Controllers.includes(e))&&(i[b].state=M,this.emit("process",b,i[b])),this.emit("progress",g+1,p)}))),this.emit("end",i)}},oUe=async({contract:t=Eb.init({processId:A1}),emitter:e,logger:r=Fu.default,pageSize:a=5e4})=>{let i,h=Date.now(),l={};do{let p=await t.getArNSRecords({cursor:i,limit:a}).catch(b=>{r?.error("Error getting ArNS records",{message:b?.message,stack:b?.stack}),e?.emit("arns:error",`Error getting ArNS records: ${b}`)});if(!p)return{};p.items.forEach(b=>{let{name:g,...y}=b;l[g]=y}),r.debug("Fetched page of ArNS records",{totalRecordCount:p.totalItems,fetchedRecordCount:Object.keys(l).length,cursor:p.nextCursor}),e?.emit("arns:pageLoaded",{totalRecordCount:p.totalItems,fetchedRecordCount:Object.keys(l).length,records:p.items,cursor:p.nextCursor}),i=p.nextCursor}while(i!==void 0);return e?.emit("arns:end",l),r.debug("Fetched all ArNS records",{totalRecordCount:Object.keys(l).length,durationMs:Date.now()-h}),l};export{Fw as ANT,Hd as ANTRegistry,gT as ANT_LUA_ID,$8 as ANT_REGISTRY_ID,Pa as AOProcess,aQ as AOS_MODULE_ID,Eb as ARIO,Zw as ARIOReadable,xT as ARIOToken,pP as ARIOWriteable,r5e as ARIO_DEVNET_PROCESS_ID,A1 as ARIO_TESTNET_PROCESS_ID,qft as ARNS_DEVNET_REGISTRY_TX,$ft as ARNS_TESTNET_REGISTRY_TX,D8 as ARWEAVE_TX_REGEX,bQ as AbortError,wT as AntBalancesSchema,yT as AntControllersSchema,i5e as AntDescriptionSchema,o5e as AntHandlerNames,fQ as AntHandlersSchema,hQ as AntInfoSchema,uQ as AntKeywordsSchema,n5e as AntReadHandlers,q8 as AntRecordSchema,bT as AntRecordsSchema,_T as AntStateSchema,a5e as AntWriteHandlers,jw as AoANTReadable,zw as AoANTRegistryReadable,cP as AoANTRegistryWriteable,lP as AoANTWriteable,Qfe as ArNSEventEmitter,v1 as ArconnectSigner,Hl as ArweaveSigner,gd as ArweaveTxIdSchema,dQ as BadRequest,kf as BaseError,oQ as DEFAULT_SCHEDULER_ID,Lft as FQDN_REGEX,pQ as FailedRequestError,sQ as IntegerStringSchema,Nu as InvalidContractConfigurationError,gQ as InvalidProcessConfigurationError,mQ as InvalidSignerError,Fu as Logger,mT as MARIO_PER_ARIO,cQ as NotFound,Dft as SORT_KEY_REGEX,vQ as UnknownError,U8 as WriteInteractionError,Uft as arioDevnetProcessId,Bc as createAoSigner,Xqe as defaultTargetManifestId,Ubt as evolveANT,oUe as fetchAllArNSRecords,Nyt as fromB64Url,f5e as fundFromOptions,l3t as getANTProcessesOwnedByWallet,Wfe as getRandomText,Fbt as initANTStateForAddress,fut as intentsUsingYears,Wft as isAoANTState,Jqe as isAoSigner,rut as isBlockHeight,lut as isLeasedArNSRecord,Dh as isProcessConfiguration,$h as isProcessIdConfiguration,hut as isValidFundFrom,uut as isValidIntent,ST as mARIOToken,Oo as paginationParamsToTags,Pc as parseSchemaResult,En as pruneTags,dP as safeDecode,Cyt as sha256B64Url,qbt as spawnANT,tUe as toB64Url,s5e as validIntents,lQ as validateArweaveId};
|
|
187
|
+
}`,i=wt.object({data:wt.object({transactions:wt.object({edges:wt.array(wt.object({node:wt.record(wt.any())}))})})});return h=>zr(h).chain(Di(l=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:a,variables:{transactionIds:[l]}})}).then(async p=>{if(p.ok)return p.json();throw r('Error Encountered when querying gateway for transaction "%s"',l),new Error(`${p.status}: ${await p.text()}`)}).then(i.parse).then(eLe(["data","transactions","edges","0","node"])))).toPromise()}var lDe=sB(yBe(),1),Ose=(t="@permaweb/aoconnect")=>{let e=(0,lDe.default)(t);return e.child=r=>Ose(`${e.namespace}:${r}`),e.tap=(r,...a)=>sLe((...i)=>e(r,...a,...i)),e},Nse=({url:t,path:e})=>e?e.startsWith("/")?Nse({url:t,path:e.slice(1)}):(t=new URL(t),t.pathname+=e,t.toString()):t;function cDe(t){return uv(Bw([]),fv((e,r)=>uv(iLe([],r.name),xB(r.value),Us(r.name,Gh,e))(e),{}),kw(e=>e.length>1?e:e[0]))(t)}function Ds(t,e){return r=>ise(cCe([aoe(t,"name"),EB(MB(e),aoe(e,"value"),yB)]),r)}function foe(t){return dse([[I2(String),X1(t)],[I2(Array),HCe(t)],[yB,MNe]])}function zd(t){let e;return I2($s,t)?(e=new Error(dDe(t)),e.stack+=t.stack):I2(Error,t)?e=t:jCe("message",t)?e=new Error(t.message):I2(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function dDe(t){return uv(e=>function r(a,i,h){return fv((l,p)=>uv(dse([[X1(Rt.invalid_arguments),()=>r(p.argumentsError,422,"Invalid Arguments")],[X1(Rt.invalid_return_type),()=>r(p.returnTypeError,500,"Invalid Return")],[X1(Rt.invalid_union),()=>TCe(b=>r(b,400,"Invalid Union"),p.unionErrors)],[yB,()=>[{...p,status:i,contextCode:h}]]]),SB(l))(p.code),[],a.issues)}(e,400,""),e=>fv((r,a)=>{let{message:i,path:h,contextCode:l}=a,p=h[1]||h[0],b=l?`${l} `:"";return r.push(`${b}'${p}': ${i}.`),r},[],e),JCe(" | "))(t)}var pDe=wt.object({id:wt.string().min(1,{message:"message is required to be a message id"}),processId:wt.string().min(1,{message:"process is required to be a process id"})});function vDe(){return t=>zr(t).map(pDe.parse).map(()=>t)}var db=wt.object({name:wt.string(),value:wt.string()}),mDe=wt.function().args(wt.object({Id:wt.string(),Target:wt.string(),Owner:wt.string(),Anchor:wt.string().optional(),Data:wt.any().default("1234"),Tags:wt.array(wt.object({name:wt.string(),value:wt.string()}))})).returns(wt.promise(wt.any())),gDe=wt.function().args(wt.object({id:wt.string().min(1,{message:"message id is required"}),processId:wt.string().min(1,{message:"process id is required"})})).returns(wt.promise(wt.any())),bDe=wt.function().args(wt.object({process:wt.string().min(1,{message:"process id is required"}),from:wt.string().optional(),to:wt.string().optional(),sort:wt.enum(["ASC","DESC"]).default("ASC"),limit:wt.number().optional()})).returns(wt.promise(wt.object({edges:wt.array(wt.object({cursor:wt.string(),node:wt.object({Output:wt.any().optional(),Messages:wt.array(wt.any()).optional(),Spawns:wt.array(wt.any()).optional(),Error:wt.any().optional()})}))}))),Cse=wt.function().args(wt.object({processId:wt.string(),data:wt.any(),tags:wt.array(db),anchor:wt.string().optional(),signer:wt.any()})).returns(wt.promise(wt.object({messageId:wt.string()}).passthrough())),yDe=wt.function().args(wt.object({data:wt.any(),tags:wt.array(db),signer:wt.any()})).returns(wt.promise(wt.object({processId:wt.string()}).passthrough())),wDe=wt.function().args(wt.object({process:wt.string(),message:wt.string(),baseLayer:wt.boolean().optional(),exclude:wt.array(wt.string()).optional()})).returns(wt.promise(wt.object({assignmentId:wt.string()}).passthrough())),Lse=Cse,qmt=wt.function().args(wt.object({suUrl:wt.string().url(),processId:wt.string()})).returns(wt.promise(wt.object({tags:wt.array(db)}).passthrough())),Umt=wt.function().args(wt.string()).returns(wt.promise(wt.object({url:wt.string()}))),_De=wt.function().args(wt.string()).returns(wt.promise(wt.boolean())),MDe=wt.function().args(wt.string()).returns(wt.promise(wt.object({tags:wt.array(db)}).passthrough())),Pw=wt.function().args(wt.object({data:wt.any(),tags:wt.array(db),target:wt.string().optional(),anchor:wt.string().optional()})).returns(wt.promise(wt.object({id:wt.string(),raw:wt.any()})));function xDe({loadResult:t}){return t=Di(gDe.implement(t)),e=>zr({id:e.id,processId:e.processId}).chain(t)}function SDe(t){let e=vDe(t),r=xDe(t);return({message:a,process:i})=>zr({id:a,processId:i}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',a)).map(h=>h).bimap(zd,jd).toPromise()}var EDe=wt.array(wt.object({name:wt.string(),value:wt.string()}));function ADe(){return t=>zr(t.tags).map(Bw([])).map(Ds("Data-Protocol","ao")).map(Ds("Variant")).map(Ds("Type")).map(Ds("SDK")).map(SB(Gh,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(EDe.parse).map(Us("tags",Gh,t))}function RDe({logger:t}){return e=>zr(e).chain(EB(MB(e.data),()=>$d(e),()=>$d(Math.random().toString().slice(-4)).map(Us("data",Gh,e)).map(r=>uv(Fd("tags"),Ds("Content-Type"),xB({name:"Content-Type",value:"text/plain"}),Us("tags",Gh,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function TDe(t){let e=ADe(t),r=RDe(t),a=Cse.implement(t.deployMessage);return i=>zr(i).chain(e).chain(r).chain(Di(({id:h,data:l,tags:p,anchor:b,signer:g})=>a({processId:h,data:l,tags:p,anchor:b,signer:Pw.implement(g)}))).map(h=>Us("messageId",h.messageId,i))}function kDe(t){let e=TDe(t);return({process:r,data:a,tags:i,anchor:h,signer:l})=>zr({id:r,data:a,tags:i,anchor:h,signer:l}).chain(e).map(p=>p.messageId).bimap(zd,jd).toPromise()}var w2=(t,e,r)=>a=>e(a[t])?$d(a):Tc(`Tag '${t}': ${r}`);function IDe({loadTransactionMeta:t,logger:e}){return t=Di(MDe.implement(t)),r=>zr(r).chain(t).map(Fd("tags")).map(cDe).chain(w2("Data-Protocol",foe("ao"),"value 'ao' was not found on module")).chain(w2("Type",foe("Module"),"value 'Module' was not found on module")).chain(w2("Module-Format",PI,"was not found on module")).chain(w2("Input-Encoding",PI,"was not found on module")).chain(w2("Output-Encoding",PI,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function BDe({logger:t,validateScheduler:e}){return e=Di(_De.implement(e)),r=>zr(r).chain(a=>e(a).chain(i=>i?$d(a):Tc(`Valid Scheduler-Location owned by ${a} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function PDe({logger:t}){return e=>zr(e).map(t.tap("Checking for signer")).chain(r=>r?$d(r):Tc("signer not found"))}function ODe(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=IDe(t),a=BDe(t),i=PDe(t);return h=>zr(h).chain(l=>r(l.module).map(()=>l)).chain(l=>a(l.scheduler)).map(()=>h).chain(l=>i(l.signer).map(()=>l)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var NDe=wt.array(wt.object({name:wt.string(),value:wt.string()}));function CDe(){return t=>zr(t).map(Fd("tags")).map(Bw([])).map(Ds("Data-Protocol","ao")).map(Ds("Variant")).map(Ds("Type")).map(Ds("Module")).map(Ds("Scheduler")).map(Ds("SDK")).map(SB(Gh,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:t.module},{name:"Scheduler",value:t.scheduler},{name:"SDK",value:"aoconnect"}])).map(NDe.parse).map(Us("tags",Gh,t))}function LDe({logger:t}){return e=>zr(e).chain(EB(MB(e.data),()=>$d(e),()=>$d(Math.random().toString().slice(-4)).map(Us("data",Gh,e)).map(r=>uv(Fd("tags"),Ds("Content-Type"),xB({name:"Content-Type",value:"text/plain"}),Us("tags",Gh,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function DDe(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=CDe(t),a=LDe(t),i=yDe.implement(t.deployProcess);return h=>zr(h).chain(r).chain(a).chain(Di(({data:l,tags:p,signer:b})=>i({data:l,tags:p,signer:Pw.implement(b)}))).map(l=>Us("processId",l.processId,h))}function $De(t){let e=ODe(t),r=DDe(t);return({module:a,scheduler:i,signer:h,tags:l,data:p})=>zr({module:a,scheduler:i,signer:h,tags:l,data:p}).chain(e).chain(r).map(b=>b.processId).bimap(zd,jd).toPromise()}function qDe(t){let e=Lse.implement(t.deployMonitor);return r=>zr(r).chain(Di(({id:a,signer:i})=>e({processId:a,signer:Pw.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(a=>Us("monitorId",a.messageId,r))}function UDe(t){let e=qDe(t);return({process:r,signer:a})=>zr({id:r,signer:a}).chain(e).map(i=>i.monitorId).bimap(zd,jd).toPromise()}function FDe(t){let e=Lse.implement(t.deployUnmonitor);return r=>zr(r).chain(Di(({id:a,signer:i})=>e({processId:a,signer:Pw.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(a=>Us("monitorId",a.messageId,r))}function jDe(t){let e=FDe(t);return({process:r,signer:a})=>zr({id:r,signer:a}).chain(e).map(i=>i.monitorId).bimap(zd,jd).toPromise()}var zDe=wt.object({process:wt.string().min(1,{message:"process identifier is required"}),from:wt.string().optional(),to:wt.string().optional(),sort:wt.enum(["ASC","DESC"]).default("ASC"),limit:wt.number().optional()});function ZDe(){return t=>zr(t).map(zDe.parse).map(()=>t)}function HDe({queryResults:t}){return t=Di(bDe.implement(t)),e=>zr({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(t)}function KDe(t){let e=ZDe(t),r=HDe(t);return({process:a,from:i,to:h,sort:l,limit:p})=>zr({process:a,from:i,to:h,sort:l,limit:p}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',a)).map(b=>b).bimap(zd,jd).toPromise()}var WDe=wt.object({Id:wt.string(),Target:wt.string(),Owner:wt.string(),Anchor:wt.string().optional(),Data:wt.any().default("1234"),Tags:wt.array(wt.object({name:wt.string(),value:wt.string()}))});function VDe(){return t=>zr(t).map(WDe.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function GDe({dryrunFetch:t}){return Di(mDe.implement(t))}function YDe(t){let e=VDe(t),r=GDe(t);return a=>zr(a).map(JDe).chain(e).chain(r).toPromise()}function JDe({process:t,data:e,tags:r,anchor:a,...i}){return{Id:"1234",Owner:"1234",...i,Target:t,Data:e||"1234",Tags:r||[],Anchor:a||"0"}}function XDe(t){let e=wDe.implement(t.deployAssign);return r=>zr(r).chain(Di(({process:a,message:i,baseLayer:h,exclude:l})=>e({process:a,message:i,baseLayer:h,exclude:l}))).map(a=>Us("assignmentId",a.assignmentId,r))}function QDe(t){let e=XDe(t);return({process:r,message:a,baseLayer:i,exclude:h})=>zr({process:r,message:a,baseLayer:i,exclude:h}).chain(e).map(l=>l.assignmentId).bimap(zd,jd).toPromise()}var e$e="https://arweave.net",t$e="https://mu.ao-testnet.xyz",r$e="https://cu.ao-testnet.xyz";function vv({GRAPHQL_URL:t,GATEWAY_URL:e=e$e,MU_URL:r=t$e,CU_URL:a=r$e}={}){let i=Ose();t||(t=Nse({url:e,path:"/graphql"}));let{validate:h}=Qoe({cacheSize:100,GRAPHQL_URL:t}),l=wNe({MAX_SIZE:25}),p=i.child("result"),b=SDe({loadResult:gNe({fetch,CU_URL:a,logger:p}),logger:p}),g=i.child("message"),y=kDe({loadProcessMeta:kI({fetch,cache:l,logger:g}),deployMessage:lNe({fetch,MU_URL:r,logger:g}),logger:g}),M=i.child("spawn"),x=$De({loadTransactionMeta:hDe({fetch,GRAPHQL_URL:t,logger:M}),validateScheduler:h,deployProcess:cNe({fetch,MU_URL:r,logger:M}),logger:M}),E=i.child("monitor"),A=UDe({loadProcessMeta:kI({fetch,cache:l,logger:E}),deployMonitor:dNe({fetch,MU_URL:r,logger:E}),logger:E}),k=i.child("unmonitor"),P=jDe({loadProcessMeta:kI({fetch,cache:l,logger:k}),deployUnmonitor:pNe({fetch,MU_URL:r,logger:k}),logger:E}),N=i.child("results"),L=KDe({queryResults:bNe({fetch,CU_URL:a,logger:N}),logger:N}),C=i.child("dryrun"),Y=YDe({dryrunFetch:mNe({fetch,CU_URL:a,logger:C}),logger:C}),G=i.child("assign"),ee=QDe({deployAssign:vNe({fetch,MU_URL:r,logger:G}),logger:g});return{result:b,results:L,message:y,spawn:x,monitor:A,unmonitor:P,dryrun:Y,assign:ee}}var Dse={};loe(Dse,{createDataItemSigner:()=>R$e});var $se=sB(MBe(),1),qse={};loe(qse,{AVSCTap:()=>pb,ArweaveSigner:()=>IB,DataItem:()=>ub,MAX_TAG_BYTES:()=>Ow,MIN_BINARY_SIZE:()=>OB,SIG_CONFIG:()=>pv,SignatureConfig:()=>Ls,Signer:()=>zse,createData:()=>Wse,default:()=>S$e,deserializeTags:()=>xw,indexToType:()=>BB,serializeTags:()=>PB,tagsExceedLimit:()=>Kse,warparbundles:()=>E$e});var i$e=Object.create,TB=Object.defineProperty,n$e=Object.getOwnPropertyDescriptor,a$e=Object.getOwnPropertyNames,o$e=Object.getPrototypeOf,s$e=Object.prototype.hasOwnProperty,Jh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),f$e=(t,e)=>{for(var r in e)TB(t,r,{get:e[r],enumerable:!0})},u$e=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a$e(e))!s$e.call(t,i)&&i!==r&&TB(t,i,{get:()=>e[i],enumerable:!(a=n$e(e,i))||a.enumerable});return t},Zd=(t,e,r)=>(r=t!=null?i$e(o$e(t)):{},u$e(e||!t||!t.__esModule?TB(r,"default",{value:t,enumerable:!0}):r,t)),h$e=Jh(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});function e(r){var a=4,i=r.length,h=i%a;if(!h)return r;var l=i,p=a-h,b=i+p,g=Me.alloc(b);for(g.write(r);p--;)g.write("=",l++);return g.toString()}t.default=e}),l$e=Jh(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=h$e();function r(b,g){return g===void 0&&(g="utf8"),Me.isBuffer(b)?h(b.toString("base64")):h(Me.from(b,g).toString("base64"))}function a(b,g){return g===void 0&&(g="utf8"),Me.from(i(b),"base64").toString(g)}function i(b){return b=b.toString(),e.default(b).replace(/\-/g,"+").replace(/_/g,"/")}function h(b){return b.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function l(b){return Me.from(i(b),"base64")}var p=r;p.encode=r,p.decode=a,p.toBase64=i,p.fromBase64=h,p.toBuffer=l,t.default=p}),kB=Jh((t,e)=>{e.exports=l$e().default,e.exports.default=e.exports}),Use=Jh(t=>{"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=E;var e=[],r=[],a=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,l=i.length;h<l;++h)e[h]=i[h],r[i.charCodeAt(h)]=h;var h,l;r[45]=62,r[95]=63;function p(A){var k=A.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=A.indexOf("=");P===-1&&(P=k);var N=P===k?0:4-P%4;return[P,N]}function b(A){var k=p(A),P=k[0],N=k[1];return(P+N)*3/4-N}function g(A,k,P){return(k+P)*3/4-P}function y(A){var k,P=p(A),N=P[0],L=P[1],C=new a(g(A,N,L)),Y=0,G=L>0?N-4:N,ee;for(ee=0;ee<G;ee+=4)k=r[A.charCodeAt(ee)]<<18|r[A.charCodeAt(ee+1)]<<12|r[A.charCodeAt(ee+2)]<<6|r[A.charCodeAt(ee+3)],C[Y++]=k>>16&255,C[Y++]=k>>8&255,C[Y++]=k&255;return L===2&&(k=r[A.charCodeAt(ee)]<<2|r[A.charCodeAt(ee+1)]>>4,C[Y++]=k&255),L===1&&(k=r[A.charCodeAt(ee)]<<10|r[A.charCodeAt(ee+1)]<<4|r[A.charCodeAt(ee+2)]>>2,C[Y++]=k>>8&255,C[Y++]=k&255),C}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,k,P){for(var N,L=[],C=k;C<P;C+=3)N=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),L.push(M(N));return L.join("")}function E(A){for(var k,P=A.length,N=P%3,L=[],C=16383,Y=0,G=P-N;Y<G;Y+=C)L.push(x(A,Y,Y+C>G?G:Y+C));return N===1?(k=A[P-1],L.push(e[k>>2]+e[k<<4&63]+"==")):N===2&&(k=(A[P-2]<<8)+A[P-1],L.push(e[k>>10]+e[k>>4&63]+e[k<<2&63]+"=")),L.join("")}}),Fse=Jh(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=Use();function r(x){let E=0;for(let P=0;P<x.length;P++)E+=x[P].byteLength;let A=new Uint8Array(E),k=0;A.set(new Uint8Array(x[0]),k),k+=x[0].byteLength;for(let P=1;P<x.length;P++)A.set(new Uint8Array(x[P]),k),k+=x[P].byteLength;return A}t.concatBuffers=r;function a(x){let E=p(x);return i(E)}t.b64UrlToString=a;function i(x){return new TextDecoder("utf-8",{fatal:!0}).decode(x)}t.bufferToString=i;function h(x){return new TextEncoder().encode(x)}t.stringToBuffer=h;function l(x){return g(h(x))}t.stringToB64Url=l;function p(x){return new Uint8Array(e.toByteArray(M(x)))}t.b64UrlToBuffer=p;function b(x){return e.fromByteArray(new Uint8Array(x))}t.bufferTob64=b;function g(x){return y(b(x))}t.bufferTob64Url=g;function y(x){return x.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}t.b64UrlEncode=y;function M(x){x=x.replace(/\-/g,"+").replace(/\_/g,"/");let E;return x.length%4==0?E=0:E=4-x.length%4,x.concat("=".repeat(E))}t.b64UrlDecode=M}),c$e=Jh(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=Fse(),r=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 a=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",a.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(a,i,{saltLength:h}={}){let l=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(a),i);return new Uint8Array(l)}async hash(a,i="SHA-256"){let h=await this.driver.digest(i,a);return new Uint8Array(h)}async verify(a,i,h){let l={kty:"RSA",e:"AQAB",n:a},p=await this.jwkToPublicCryptoKey(l),b=await this.driver.digest("SHA-256",i),g=await this.driver.verify({name:"RSA-PSS",saltLength:0},p,h,i),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},p,h,i),M=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((p.algorithm.modulusLength-1)/8)-b.byteLength-2},p,h,i);return g||y||M}async jwkToCryptoKey(a){return this.driver.importKey("jwk",a,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(a){return this.driver.importKey("jwk",a,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let a=crypto?.subtle;return a===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof a[i]=="function")}async encrypt(a,i,h){let l=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=new Uint8Array(16);crypto.getRandomValues(b);let g=await this.driver.encrypt({name:"AES-CBC",iv:b},p,a);return e.concatBuffers([b,g])}async decrypt(a,i,h){let l=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=a.slice(0,16),g=await this.driver.decrypt({name:"AES-CBC",iv:b},p,a.slice(16));return e.concatBuffers([g])}};t.default=r}),d$e=Jh(t=>{t.read=function(e,r,a,i,h){var l,p,b=h*8-i-1,g=(1<<b)-1,y=g>>1,M=-7,x=a?h-1:0,E=a?-1:1,A=e[r+x];for(x+=E,l=A&(1<<-M)-1,A>>=-M,M+=b;M>0;l=l*256+e[r+x],x+=E,M-=8);for(p=l&(1<<-M)-1,l>>=-M,M+=i;M>0;p=p*256+e[r+x],x+=E,M-=8);if(l===0)l=1-y;else{if(l===g)return p?NaN:(A?-1:1)*(1/0);p=p+Math.pow(2,i),l=l-y}return(A?-1:1)*p*Math.pow(2,l-i)},t.write=function(e,r,a,i,h,l){var p,b,g,y=l*8-h-1,M=(1<<y)-1,x=M>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:l-1,k=i?1:-1,P=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,p=M):(p=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-p))<1&&(p--,g*=2),p+x>=1?r+=E/g:r+=E*Math.pow(2,1-x),r*g>=2&&(p++,g/=2),p+x>=M?(b=0,p=M):p+x>=1?(b=(r*g-1)*Math.pow(2,h),p=p+x):(b=r*Math.pow(2,x-1)*Math.pow(2,h),p=0));h>=8;e[a+A]=b&255,A+=k,b/=256,h-=8);for(p=p<<h|b,y+=h;y>0;e[a+A]=p&255,A+=k,p/=256,y-=8);e[a+A-k]|=P*128}}),nB=Jh(t=>{"use strict";var e=Use(),r=d$e(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=p,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,p.TYPED_ARRAY_SUPPORT=h(),!p.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 h(){try{let T=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(T,I),T.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function l(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let I=new Uint8Array(T);return Object.setPrototypeOf(I,p.prototype),I}function p(T,I,O){if(typeof T=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(T)}return b(T,I,O)}p.poolSize=8192;function b(T,I,O){if(typeof T=="string")return x(T,I);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(ut(T,ArrayBuffer)||T&&ut(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(T,SharedArrayBuffer)||T&&ut(T.buffer,SharedArrayBuffer)))return k(T,I,O);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let q=T.valueOf&&T.valueOf();if(q!=null&&q!==T)return p.from(q,I,O);let H=P(T);if(H)return H;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return p.from(T[Symbol.toPrimitive]("string"),I,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}p.from=function(T,I,O){return b(T,I,O)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function g(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function y(T,I,O){return g(T),T<=0?l(T):I!==void 0?typeof O=="string"?l(T).fill(I,O):l(T).fill(I):l(T)}p.alloc=function(T,I,O){return y(T,I,O)};function M(T){return g(T),l(T<0?0:N(T)|0)}p.allocUnsafe=function(T){return M(T)},p.allocUnsafeSlow=function(T){return M(T)};function x(T,I){if((typeof I!="string"||I==="")&&(I="utf8"),!p.isEncoding(I))throw new TypeError("Unknown encoding: "+I);let O=C(T,I)|0,q=l(O),H=q.write(T,I);return H!==O&&(q=q.slice(0,H)),q}function E(T){let I=T.length<0?0:N(T.length)|0,O=l(I);for(let q=0;q<I;q+=1)O[q]=T[q]&255;return O}function A(T){if(ut(T,Uint8Array)){let I=new Uint8Array(T);return k(I.buffer,I.byteOffset,I.byteLength)}return E(T)}function k(T,I,O){if(I<0||T.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<I+(O||0))throw new RangeError('"length" is outside of buffer bounds');let q;return I===void 0&&O===void 0?q=new Uint8Array(T):O===void 0?q=new Uint8Array(T,I):q=new Uint8Array(T,I,O),Object.setPrototypeOf(q,p.prototype),q}function P(T){if(p.isBuffer(T)){let I=N(T.length)|0,O=l(I);return O.length===0||T.copy(O,0,0,I),O}if(T.length!==void 0)return typeof T.length!="number"||Ze(T.length)?l(0):E(T);if(T.type==="Buffer"&&Array.isArray(T.data))return E(T.data)}function N(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function L(T){return+T!=T&&(T=0),p.alloc(+T)}p.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==p.prototype},p.compare=function(T,I){if(ut(T,Uint8Array)&&(T=p.from(T,T.offset,T.byteLength)),ut(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),!p.isBuffer(T)||!p.isBuffer(I))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===I)return 0;let O=T.length,q=I.length;for(let H=0,W=Math.min(O,q);H<W;++H)if(T[H]!==I[H]){O=T[H],q=I[H];break}return O<q?-1:q<O?1:0},p.isEncoding=function(T){switch(String(T).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}},p.concat=function(T,I){if(!Array.isArray(T))throw new TypeError('"list" argument must be an Array of Buffers');if(T.length===0)return p.alloc(0);let O;if(I===void 0)for(I=0,O=0;O<T.length;++O)I+=T[O].length;let q=p.allocUnsafe(I),H=0;for(O=0;O<T.length;++O){let W=T[O];if(ut(W,Uint8Array))H+W.length>q.length?(p.isBuffer(W)||(W=p.from(W)),W.copy(q,H)):Uint8Array.prototype.set.call(q,W,H);else if(p.isBuffer(W))W.copy(q,H);else throw new TypeError('"list" argument must be an Array of Buffers');H+=W.length}return q};function C(T,I){if(p.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||ut(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let O=T.length,q=arguments.length>2&&arguments[2]===!0;if(!q&&O===0)return 0;let H=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O*2;case"hex":return O>>>1;case"base64":return ge(T).length;default:if(H)return q?-1:oe(T).length;I=(""+I).toLowerCase(),H=!0}}p.byteLength=C;function Y(T,I,O){let q=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0,I>>>=0,O<=I))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,I,O);case"utf8":case"utf-8":return u(this,I,O);case"ascii":return w(this,I,O);case"latin1":case"binary":return d(this,I,O);case"base64":return f(this,I,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,I,O);default:if(q)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),q=!0}}p.prototype._isBuffer=!0;function G(T,I,O){let q=T[I];T[I]=T[O],T[O]=q}p.prototype.swap16=function(){let T=this.length;if(T%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let I=0;I<T;I+=2)G(this,I,I+1);return this},p.prototype.swap32=function(){let T=this.length;if(T%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let I=0;I<T;I+=4)G(this,I,I+3),G(this,I+1,I+2);return this},p.prototype.swap64=function(){let T=this.length;if(T%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let I=0;I<T;I+=8)G(this,I,I+7),G(this,I+1,I+6),G(this,I+2,I+5),G(this,I+3,I+4);return this},p.prototype.toString=function(){let T=this.length;return T===0?"":arguments.length===0?u(this,0,T):Y.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(T){if(!p.isBuffer(T))throw new TypeError("Argument must be a Buffer");return this===T?!0:p.compare(this,T)===0},p.prototype.inspect=function(){let T="",I=t.INSPECT_MAX_BYTES;return T=this.toString("hex",0,I).replace(/(.{2})/g,"$1 ").trim(),this.length>I&&(T+=" ... "),"<Buffer "+T+">"},a&&(p.prototype[a]=p.prototype.inspect),p.prototype.compare=function(T,I,O,q,H){if(ut(T,Uint8Array)&&(T=p.from(T,T.offset,T.byteLength)),!p.isBuffer(T))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(I===void 0&&(I=0),O===void 0&&(O=T?T.length:0),q===void 0&&(q=0),H===void 0&&(H=this.length),I<0||O>T.length||q<0||H>this.length)throw new RangeError("out of range index");if(q>=H&&I>=O)return 0;if(q>=H)return-1;if(I>=O)return 1;if(I>>>=0,O>>>=0,q>>>=0,H>>>=0,this===T)return 0;let W=H-q,fe=O-I,st=Math.min(W,fe),ue=this.slice(q,H),me=T.slice(I,O);for(let pe=0;pe<st;++pe)if(ue[pe]!==me[pe]){W=ue[pe],fe=me[pe];break}return W<fe?-1:fe<W?1:0};function ee(T,I,O,q,H){if(T.length===0)return-1;if(typeof O=="string"?(q=O,O=0):O>2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),O=+O,Ze(O)&&(O=H?0:T.length-1),O<0&&(O=T.length+O),O>=T.length){if(H)return-1;O=T.length-1}else if(O<0)if(H)O=0;else return-1;if(typeof I=="string"&&(I=p.from(I,q)),p.isBuffer(I))return I.length===0?-1:D(T,I,O,q,H);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?H?Uint8Array.prototype.indexOf.call(T,I,O):Uint8Array.prototype.lastIndexOf.call(T,I,O):D(T,[I],O,q,H);throw new TypeError("val must be string, number or Buffer")}function D(T,I,O,q,H){let W=1,fe=T.length,st=I.length;if(q!==void 0&&(q=String(q).toLowerCase(),q==="ucs2"||q==="ucs-2"||q==="utf16le"||q==="utf-16le")){if(T.length<2||I.length<2)return-1;W=2,fe/=2,st/=2,O/=2}function ue(pe,be){return W===1?pe[be]:pe.readUInt16BE(be*W)}let me;if(H){let pe=-1;for(me=O;me<fe;me++)if(ue(T,me)===ue(I,pe===-1?0:me-pe)){if(pe===-1&&(pe=me),me-pe+1===st)return pe*W}else pe!==-1&&(me-=me-pe),pe=-1}else for(O+st>fe&&(O=fe-st),me=O;me>=0;me--){let pe=!0;for(let be=0;be<st;be++)if(ue(T,me+be)!==ue(I,be)){pe=!1;break}if(pe)return me}return-1}p.prototype.includes=function(T,I,O){return this.indexOf(T,I,O)!==-1},p.prototype.indexOf=function(T,I,O){return ee(this,T,I,O,!0)},p.prototype.lastIndexOf=function(T,I,O){return ee(this,T,I,O,!1)};function U(T,I,O,q){O=Number(O)||0;let H=T.length-O;q?(q=Number(q),q>H&&(q=H)):q=H;let W=I.length;q>W/2&&(q=W/2);let fe;for(fe=0;fe<q;++fe){let st=parseInt(I.substr(fe*2,2),16);if(Ze(st))return fe;T[O+fe]=st}return fe}function V(T,I,O,q){return Se(oe(I,T.length-O),T,O,q)}function _(T,I,O,q){return Se(ce(I),T,O,q)}function n(T,I,O,q){return Se(ge(I),T,O,q)}function s(T,I,O,q){return Se(ot(I,T.length-O),T,O,q)}p.prototype.write=function(T,I,O,q){if(I===void 0)q="utf8",O=this.length,I=0;else if(O===void 0&&typeof I=="string")q=I,O=this.length,I=0;else if(isFinite(I))I=I>>>0,isFinite(O)?(O=O>>>0,q===void 0&&(q="utf8")):(q=O,O=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let H=this.length-I;if((O===void 0||O>H)&&(O=H),T.length>0&&(O<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");q||(q="utf8");let W=!1;for(;;)switch(q){case"hex":return U(this,T,I,O);case"utf8":case"utf-8":return V(this,T,I,O);case"ascii":case"latin1":case"binary":return _(this,T,I,O);case"base64":return n(this,T,I,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,T,I,O);default:if(W)throw new TypeError("Unknown encoding: "+q);q=(""+q).toLowerCase(),W=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(T,I,O){return I===0&&O===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(I,O))}function u(T,I,O){O=Math.min(T.length,O);let q=[],H=I;for(;H<O;){let W=T[H],fe=null,st=W>239?4:W>223?3:W>191?2:1;if(H+st<=O){let ue,me,pe,be;switch(st){case 1:W<128&&(fe=W);break;case 2:ue=T[H+1],(ue&192)===128&&(be=(W&31)<<6|ue&63,be>127&&(fe=be));break;case 3:ue=T[H+1],me=T[H+2],(ue&192)===128&&(me&192)===128&&(be=(W&15)<<12|(ue&63)<<6|me&63,be>2047&&(be<55296||be>57343)&&(fe=be));break;case 4:ue=T[H+1],me=T[H+2],pe=T[H+3],(ue&192)===128&&(me&192)===128&&(pe&192)===128&&(be=(W&15)<<18|(ue&63)<<12|(me&63)<<6|pe&63,be>65535&&be<1114112&&(fe=be))}}fe===null?(fe=65533,st=1):fe>65535&&(fe-=65536,q.push(fe>>>10&1023|55296),fe=56320|fe&1023),q.push(fe),H+=st}return m(q)}var c=4096;function m(T){let I=T.length;if(I<=c)return String.fromCharCode.apply(String,T);let O="",q=0;for(;q<I;)O+=String.fromCharCode.apply(String,T.slice(q,q+=c));return O}function w(T,I,O){let q="";O=Math.min(T.length,O);for(let H=I;H<O;++H)q+=String.fromCharCode(T[H]&127);return q}function d(T,I,O){let q="";O=Math.min(T.length,O);for(let H=I;H<O;++H)q+=String.fromCharCode(T[H]);return q}function o(T,I,O){let q=T.length;(!I||I<0)&&(I=0),(!O||O<0||O>q)&&(O=q);let H="";for(let W=I;W<O;++W)H+=Ge[T[W]];return H}function v(T,I,O){let q=T.slice(I,O),H="";for(let W=0;W<q.length-1;W+=2)H+=String.fromCharCode(q[W]+q[W+1]*256);return H}p.prototype.slice=function(T,I){let O=this.length;T=~~T,I=I===void 0?O:~~I,T<0?(T+=O,T<0&&(T=0)):T>O&&(T=O),I<0?(I+=O,I<0&&(I=0)):I>O&&(I=O),I<T&&(I=T);let q=this.subarray(T,I);return Object.setPrototypeOf(q,p.prototype),q};function R(T,I,O){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+I>O)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(T,I,O){T=T>>>0,I=I>>>0,O||R(T,I,this.length);let q=this[T],H=1,W=0;for(;++W<I&&(H*=256);)q+=this[T+W]*H;return q},p.prototype.readUintBE=p.prototype.readUIntBE=function(T,I,O){T=T>>>0,I=I>>>0,O||R(T,I,this.length);let q=this[T+--I],H=1;for(;I>0&&(H*=256);)q+=this[T+--I]*H;return q},p.prototype.readUint8=p.prototype.readUInt8=function(T,I){return T=T>>>0,I||R(T,1,this.length),this[T]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(T,I){return T=T>>>0,I||R(T,2,this.length),this[T]|this[T+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(T,I){return T=T>>>0,I||R(T,2,this.length),this[T]<<8|this[T+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(T,I){return T=T>>>0,I||R(T,4,this.length),(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])},p.prototype.readBigUInt64LE=lt(function(T){T=T>>>0,J(T,"offset");let I=this[T],O=this[T+7];(I===void 0||O===void 0)&&X(T,this.length-8);let q=I+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24,H=this[++T]+this[++T]*2**8+this[++T]*2**16+O*2**24;return BigInt(q)+(BigInt(H)<<BigInt(32))}),p.prototype.readBigUInt64BE=lt(function(T){T=T>>>0,J(T,"offset");let I=this[T],O=this[T+7];(I===void 0||O===void 0)&&X(T,this.length-8);let q=I*2**24+this[++T]*2**16+this[++T]*2**8+this[++T],H=this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+O;return(BigInt(q)<<BigInt(32))+BigInt(H)}),p.prototype.readIntLE=function(T,I,O){T=T>>>0,I=I>>>0,O||R(T,I,this.length);let q=this[T],H=1,W=0;for(;++W<I&&(H*=256);)q+=this[T+W]*H;return H*=128,q>=H&&(q-=Math.pow(2,8*I)),q},p.prototype.readIntBE=function(T,I,O){T=T>>>0,I=I>>>0,O||R(T,I,this.length);let q=I,H=1,W=this[T+--q];for(;q>0&&(H*=256);)W+=this[T+--q]*H;return H*=128,W>=H&&(W-=Math.pow(2,8*I)),W},p.prototype.readInt8=function(T,I){return T=T>>>0,I||R(T,1,this.length),this[T]&128?(255-this[T]+1)*-1:this[T]},p.prototype.readInt16LE=function(T,I){T=T>>>0,I||R(T,2,this.length);let O=this[T]|this[T+1]<<8;return O&32768?O|4294901760:O},p.prototype.readInt16BE=function(T,I){T=T>>>0,I||R(T,2,this.length);let O=this[T+1]|this[T]<<8;return O&32768?O|4294901760:O},p.prototype.readInt32LE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24},p.prototype.readInt32BE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]},p.prototype.readBigInt64LE=lt(function(T){T=T>>>0,J(T,"offset");let I=this[T],O=this[T+7];(I===void 0||O===void 0)&&X(T,this.length-8);let q=this[T+4]+this[T+5]*2**8+this[T+6]*2**16+(O<<24);return(BigInt(q)<<BigInt(32))+BigInt(I+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24)}),p.prototype.readBigInt64BE=lt(function(T){T=T>>>0,J(T,"offset");let I=this[T],O=this[T+7];(I===void 0||O===void 0)&&X(T,this.length-8);let q=(I<<24)+this[++T]*2**16+this[++T]*2**8+this[++T];return(BigInt(q)<<BigInt(32))+BigInt(this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+O)}),p.prototype.readFloatLE=function(T,I){return T=T>>>0,I||R(T,4,this.length),r.read(this,T,!0,23,4)},p.prototype.readFloatBE=function(T,I){return T=T>>>0,I||R(T,4,this.length),r.read(this,T,!1,23,4)},p.prototype.readDoubleLE=function(T,I){return T=T>>>0,I||R(T,8,this.length),r.read(this,T,!0,52,8)},p.prototype.readDoubleBE=function(T,I){return T=T>>>0,I||R(T,8,this.length),r.read(this,T,!1,52,8)};function S(T,I,O,q,H,W){if(!p.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>H||I<W)throw new RangeError('"value" argument is out of bounds');if(O+q>T.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(T,I,O,q){if(T=+T,I=I>>>0,O=O>>>0,!q){let fe=Math.pow(2,8*O)-1;S(this,T,I,O,fe,0)}let H=1,W=0;for(this[I]=T&255;++W<O&&(H*=256);)this[I+W]=T/H&255;return I+O},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(T,I,O,q){if(T=+T,I=I>>>0,O=O>>>0,!q){let fe=Math.pow(2,8*O)-1;S(this,T,I,O,fe,0)}let H=O-1,W=1;for(this[I+H]=T&255;--H>=0&&(W*=256);)this[I+H]=T/W&255;return I+O},p.prototype.writeUint8=p.prototype.writeUInt8=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,1,255,0),this[I]=T&255,I+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,2,65535,0),this[I]=T&255,this[I+1]=T>>>8,I+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,2,65535,0),this[I]=T>>>8,this[I+1]=T&255,I+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,4,4294967295,0),this[I+3]=T>>>24,this[I+2]=T>>>16,this[I+1]=T>>>8,this[I]=T&255,I+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,4,4294967295,0),this[I]=T>>>24,this[I+1]=T>>>16,this[I+2]=T>>>8,this[I+3]=T&255,I+4};function B(T,I,O,q,H){j(I,q,H,T,O,7);let W=Number(I&BigInt(4294967295));T[O++]=W,W=W>>8,T[O++]=W,W=W>>8,T[O++]=W,W=W>>8,T[O++]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[O++]=fe,fe=fe>>8,T[O++]=fe,fe=fe>>8,T[O++]=fe,fe=fe>>8,T[O++]=fe,O}function F(T,I,O,q,H){j(I,q,H,T,O,7);let W=Number(I&BigInt(4294967295));T[O+7]=W,W=W>>8,T[O+6]=W,W=W>>8,T[O+5]=W,W=W>>8,T[O+4]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[O+3]=fe,fe=fe>>8,T[O+2]=fe,fe=fe>>8,T[O+1]=fe,fe=fe>>8,T[O]=fe,O+8}p.prototype.writeBigUInt64LE=lt(function(T,I=0){return B(this,T,I,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=lt(function(T,I=0){return F(this,T,I,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(T,I,O,q){if(T=+T,I=I>>>0,!q){let st=Math.pow(2,8*O-1);S(this,T,I,O,st-1,-st)}let H=0,W=1,fe=0;for(this[I]=T&255;++H<O&&(W*=256);)T<0&&fe===0&&this[I+H-1]!==0&&(fe=1),this[I+H]=(T/W>>0)-fe&255;return I+O},p.prototype.writeIntBE=function(T,I,O,q){if(T=+T,I=I>>>0,!q){let st=Math.pow(2,8*O-1);S(this,T,I,O,st-1,-st)}let H=O-1,W=1,fe=0;for(this[I+H]=T&255;--H>=0&&(W*=256);)T<0&&fe===0&&this[I+H+1]!==0&&(fe=1),this[I+H]=(T/W>>0)-fe&255;return I+O},p.prototype.writeInt8=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,1,127,-128),T<0&&(T=255+T+1),this[I]=T&255,I+1},p.prototype.writeInt16LE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,2,32767,-32768),this[I]=T&255,this[I+1]=T>>>8,I+2},p.prototype.writeInt16BE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,2,32767,-32768),this[I]=T>>>8,this[I+1]=T&255,I+2},p.prototype.writeInt32LE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,4,2147483647,-2147483648),this[I]=T&255,this[I+1]=T>>>8,this[I+2]=T>>>16,this[I+3]=T>>>24,I+4},p.prototype.writeInt32BE=function(T,I,O){return T=+T,I=I>>>0,O||S(this,T,I,4,2147483647,-2147483648),T<0&&(T=4294967295+T+1),this[I]=T>>>24,this[I+1]=T>>>16,this[I+2]=T>>>8,this[I+3]=T&255,I+4},p.prototype.writeBigInt64LE=lt(function(T,I=0){return B(this,T,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=lt(function(T,I=0){return F(this,T,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(T,I,O,q,H,W){if(O+q>T.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("Index out of range")}function re(T,I,O,q,H){return I=+I,O=O>>>0,H||$(T,I,O,4,34028234663852886e22,-34028234663852886e22),r.write(T,I,O,q,23,4),O+4}p.prototype.writeFloatLE=function(T,I,O){return re(this,T,I,!0,O)},p.prototype.writeFloatBE=function(T,I,O){return re(this,T,I,!1,O)};function Q(T,I,O,q,H){return I=+I,O=O>>>0,H||$(T,I,O,8,17976931348623157e292,-17976931348623157e292),r.write(T,I,O,q,52,8),O+8}p.prototype.writeDoubleLE=function(T,I,O){return Q(this,T,I,!0,O)},p.prototype.writeDoubleBE=function(T,I,O){return Q(this,T,I,!1,O)},p.prototype.copy=function(T,I,O,q){if(!p.isBuffer(T))throw new TypeError("argument should be a Buffer");if(O||(O=0),!q&&q!==0&&(q=this.length),I>=T.length&&(I=T.length),I||(I=0),q>0&&q<O&&(q=O),q===O||T.length===0||this.length===0)return 0;if(I<0)throw new RangeError("targetStart out of bounds");if(O<0||O>=this.length)throw new RangeError("Index out of range");if(q<0)throw new RangeError("sourceEnd out of bounds");q>this.length&&(q=this.length),T.length-I<q-O&&(q=T.length-I+O);let H=q-O;return this===T&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(I,O,q):Uint8Array.prototype.set.call(T,this.subarray(O,q),I),H},p.prototype.fill=function(T,I,O,q){if(typeof T=="string"){if(typeof I=="string"?(q=I,I=0,O=this.length):typeof O=="string"&&(q=O,O=this.length),q!==void 0&&typeof q!="string")throw new TypeError("encoding must be a string");if(typeof q=="string"&&!p.isEncoding(q))throw new TypeError("Unknown encoding: "+q);if(T.length===1){let W=T.charCodeAt(0);(q==="utf8"&&W<128||q==="latin1")&&(T=W)}}else typeof T=="number"?T=T&255:typeof T=="boolean"&&(T=Number(T));if(I<0||this.length<I||this.length<O)throw new RangeError("Out of range index");if(O<=I)return this;I=I>>>0,O=O===void 0?this.length:O>>>0,T||(T=0);let H;if(typeof T=="number")for(H=I;H<O;++H)this[H]=T;else{let W=p.isBuffer(T)?T:p.from(T,q),fe=W.length;if(fe===0)throw new TypeError('The value "'+T+'" is invalid for argument "value"');for(H=0;H<O-I;++H)this[H+I]=W[H%fe]}return this};var Z={};function K(T,I,O){Z[T]=class extends O{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:q,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(T,I){return`The "${T}" argument must be of type number. Received type ${typeof I}`},TypeError),K("ERR_OUT_OF_RANGE",function(T,I,O){let q=`The value of "${T}" is out of range.`,H=O;return Number.isInteger(O)&&Math.abs(O)>2**32?H=le(String(O)):typeof O=="bigint"&&(H=String(O),(O>BigInt(2)**BigInt(32)||O<-(BigInt(2)**BigInt(32)))&&(H=le(H)),H+="n"),q+=` It must be ${I}. Received ${H}`,q},RangeError);function le(T){let I="",O=T.length,q=T[0]==="-"?1:0;for(;O>=q+4;O-=3)I=`_${T.slice(O-3,O)}${I}`;return`${T.slice(0,O)}${I}`}function te(T,I,O){J(I,"offset"),(T[I]===void 0||T[I+O]===void 0)&&X(I,T.length-(O+1))}function j(T,I,O,q,H,W){if(T>O||T<I){let fe=typeof I=="bigint"?"n":"",st;throw W>3?I===0||I===BigInt(0)?st=`>= 0${fe} and < 2${fe} ** ${(W+1)*8}${fe}`:st=`>= -(2${fe} ** ${(W+1)*8-1}${fe}) and < 2 ** ${(W+1)*8-1}${fe}`:st=`>= ${I}${fe} and <= ${O}${fe}`,new Z.ERR_OUT_OF_RANGE("value",st,T)}te(q,H,W)}function J(T,I){if(typeof T!="number")throw new Z.ERR_INVALID_ARG_TYPE(I,"number",T)}function X(T,I,O){throw Math.floor(T)!==T?(J(T,O),new Z.ERR_OUT_OF_RANGE(O||"offset","an integer",T)):I<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE(O||"offset",`>= ${O?1:0} and <= ${I}`,T)}var he=/[^+/0-9A-Za-z-_]/g;function Te(T){if(T=T.split("=")[0],T=T.trim().replace(he,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function oe(T,I){I=I||1/0;let O,q=T.length,H=null,W=[];for(let fe=0;fe<q;++fe){if(O=T.charCodeAt(fe),O>55295&&O<57344){if(!H){if(O>56319){(I-=3)>-1&&W.push(239,191,189);continue}else if(fe+1===q){(I-=3)>-1&&W.push(239,191,189);continue}H=O;continue}if(O<56320){(I-=3)>-1&&W.push(239,191,189),H=O;continue}O=(H-55296<<10|O-56320)+65536}else H&&(I-=3)>-1&&W.push(239,191,189);if(H=null,O<128){if((I-=1)<0)break;W.push(O)}else if(O<2048){if((I-=2)<0)break;W.push(O>>6|192,O&63|128)}else if(O<65536){if((I-=3)<0)break;W.push(O>>12|224,O>>6&63|128,O&63|128)}else if(O<1114112){if((I-=4)<0)break;W.push(O>>18|240,O>>12&63|128,O>>6&63|128,O&63|128)}else throw new Error("Invalid code point")}return W}function ce(T){let I=[];for(let O=0;O<T.length;++O)I.push(T.charCodeAt(O)&255);return I}function ot(T,I){let O,q,H,W=[];for(let fe=0;fe<T.length&&!((I-=2)<0);++fe)O=T.charCodeAt(fe),q=O>>8,H=O%256,W.push(H),W.push(q);return W}function ge(T){return e.toByteArray(Te(T))}function Se(T,I,O,q){let H;for(H=0;H<q&&!(H+O>=I.length||H>=T.length);++H)I[H+O]=T[H];return H}function ut(T,I){return T instanceof I||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===I.name}function Ze(T){return T!==T}var Ge=function(){let T="0123456789abcdef",I=new Array(256);for(let O=0;O<16;++O){let q=O*16;for(let H=0;H<16;++H)I[q+H]=T[O]+T[H]}return I}();function lt(T){return typeof BigInt>"u"?z:T}function z(){throw new Error("BigInt not supported")}}),p$e=Jh((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:nB().Buffer,Crypto:window.crypto}):e.exports={Buffer:nB().Buffer,Crypto:crypto}}),jse={};f$e(jse,{AVSCTap:()=>pb,ArweaveSigner:()=>IB,DataItem:()=>ub,MAX_TAG_BYTES:()=>Ow,MIN_BINARY_SIZE:()=>OB,SIG_CONFIG:()=>pv,SignatureConfig:()=>Ls,Signer:()=>zse,createData:()=>Wse,deserializeTags:()=>xw,indexToType:()=>BB,serializeTags:()=>PB,tagsExceedLimit:()=>Kse});var zse=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,r,a){throw new Error("You must implement verify method on child")}},v$e=Zd(kB(),1),Ff=Zd(Fse(),1);async function Zse(t){if(Array.isArray(t)){let i=(0,Ff.concatBuffers)([(0,Ff.stringToBuffer)("list"),(0,Ff.stringToBuffer)(t.length.toString())]);return await Hse(t,await Wh().hash(i,"SHA-384"))}let e=t,r=(0,Ff.concatBuffers)([(0,Ff.stringToBuffer)("blob"),(0,Ff.stringToBuffer)(e.byteLength.toString())]),a=(0,Ff.concatBuffers)([await Wh().hash(r,"SHA-384"),await Wh().hash(e,"SHA-384")]);return await Wh().hash(a,"SHA-384")}async function Hse(t,e){if(t.length<1)return e;let r=(0,Ff.concatBuffers)([e,await Zse(t[0])]),a=await Wh().hash(r,"SHA-384");return await Hse(t.slice(1),a)}var NI=Zd(c$e(),1),m$e=NI.default.default?NI.default.default:NI.default,g$e=class extends m$e{getPublicKey(t){throw new Error("Unimplemented")}},b$e;function Wh(){return b$e??=new g$e}var Ls;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Ls||(Ls={}));var pv={[Ls.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Ls.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Ls.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Ls.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Ls.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Ls.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Ls.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},IB=class{signatureType=1;ownerLength=pv[1].pubLength;signatureLength=pv[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return v$e.default.toBuffer(this.pk)}sign(t){return Wh().sign(this.jwk,t)}static async verify(t,e,r){return await Wh().verify(t,e,r)}},BB={1:IB},ju=Zd(kB(),1);async function aB(t){return Zse([(0,Ff.stringToBuffer)("dataitem"),(0,Ff.stringToBuffer)("1"),(0,Ff.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function y$e(t,e){let r=await aB(t),a=await e.sign(r),i=await Wh().hash(a);return{signature:Me.from(a),id:Me.from(i)}}async function w$e(t,e){let{signature:r,id:a}=await y$e(t,e);return t.getRaw().set(r,2),a}var pb=class{buf;pos;constructor(t=Me.alloc(Ow),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;r<e;r++){let a=t[r];if(a?.name===void 0||a?.value===void 0)throw new Error(`Invalid tag format for ${a}, expected {name:string, value: string}`);this.writeString(a.name),this.writeString(a.value)}this.writeLong(0)}toBuffer(){let t=Me.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(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,a;if(t>=-1073741824&&t<1073741824){a=t>=0?t<<1:~t<<1|1;do e[this.pos]=a&127,a>>=7;while(a&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=Me.byteLength(t),r=this.buf;this.writeLong(e);let a=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,h,l,p;for(i=0,h=e;i<h;i++)l=t.charCodeAt(i),l<128?r[a++]=l:l<2048?(r[a++]=l>>6|192,r[a++]=l&63|128):(l&64512)===55296&&((p=t.charCodeAt(i+1))&64512)===56320?(l=65536+((l&1023)<<10)+(p&1023),i++,r[a++]=l>>18|240,r[a++]=l>>12&63|128,r[a++]=l>>6&63|128,r[a++]=l&63|128):(r[a++]=l>>12|224,r[a++]=l>>6&63|128,r[a++]=l&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,a,i,h,l;do a=r[this.pos++],i=a&128,t|=(a&127)<<e,e+=7;while(i&&e<28);if(i){h=t,l=268435456;do a=r[this.pos++],h+=(a&127)*l,l*=128;while(a&128);return(h%2?-(h+1):h)/2}return t>>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),a=this.readString();t.push({name:r,value:a})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function PB(t){let e=new pb;return e.writeTags(t),e.toBuffer()}function Kse(t){let e=new pb;return e.writeTags(t),e.tagsExceedLimit()}function xw(t){return new pb(t).readTags()}function yc(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function _$e(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;r<e.length;r++){let a=t&255;e[r]=a,t=(t-a)/256}return Uint8Array.from(e)}function uoe(t){let e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){let a=t&255;e[r]=a,t=(t-a)/256}return Uint8Array.from(e)}var M$e=Zd(p$e(),1),V1=Zd(nB(),1),Ow=4096,OB=80,ub=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return t.binary!==void 0}get signatureType(){let t=yc(this.binary.subarray(0,2));if(Ls?.[t]!==void 0)return t;throw new Error("Unknown signature type: "+t)}async isValid(){return ub.verify(this.binary)}get id(){return(async()=>ju.default.encode(await this.rawId))()}set id(t){this._id=ju.default.toBuffer(t)}get rawId(){return(async()=>V1.Buffer.from(await M$e.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return ju.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return pv[this.signatureType].sigLength}get owner(){return ju.default.encode(this.rawOwner)}get ownerLength(){return pv[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):V1.Buffer.alloc(0)}get target(){return ju.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):V1.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=yc(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(yc(this.binary.subarray(t,t+8))==0)return[];let e=yc(this.binary.subarray(t+8,t+16));return xw(V1.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:ju.default.encode(t.name),value:ju.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=yc(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=yc(e),a=t+16+r;return this.binary.subarray(a,this.binary.length)}get data(){return ju.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await w$e(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=V1.Buffer.from(await Wh().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:ju.default.encode(t.name),value:ju.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength<OB)return!1;let e=new ub(t),r=e.signatureType,a=e.getTagsStart(),i=yc(t.subarray(a,a+8)),h=t.subarray(a+8,a+16),l=yc(h);if(l>Ow)return!1;if(i>0)try{if(xw(V1.Buffer.from(t.subarray(a+16,a+16+l))).length!==i)return!1}catch{return!1}let p=BB[r],b=await aB(e);return await p.verify(e.rawOwner,b,e.rawSignature)}async getSignatureData(){return aB(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),a=this.binary[r]==1;return r+=a?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},x$e=Zd(kB(),1);function Wse(t,e,r){let a=e.publicKey,i=r?.target?x$e.default.toBuffer(r.target):null,h=1+(i?.byteLength??0),l=r?.anchor?Me.from(r.anchor):null,p=1+(l?.byteLength??0),b=(r?.tags?.length??0)>0?PB(r.tags):null,g=16+(b?b.byteLength:0),y=Me.from(t),M=y.byteLength,x=2+e.signatureLength+e.ownerLength+h+p+g+M,E=Me.alloc(x);if(E.set(_$e(e.signatureType),0),E.set(new Uint8Array(e.signatureLength).fill(0),2),a.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${a.byteLength}`);E.set(a,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(E[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);E.set(i,A+1)}let k=A+h,P=k+1;if(E[k]=l?1:0,l){if(P+=l.byteLength,l.byteLength!==32)throw new Error("Anchor must be 32 bytes");E.set(l,k+1)}E.set(uoe(r?.tags?.length??0),P);let N=uoe(b?.byteLength??0);E.set(N,P+8),b&&E.set(b,P+16);let L=P+g;return E.set(y,L),new ub(E)}var NB={...jse};globalThis.arbundles??=NB;var S$e=NB,E$e=NB;globalThis.Buffer||(globalThis.Buffer=$se.Buffer);var{DataItem:A$e}=qse;function R$e(t){return async({data:r,tags:a,target:i,anchor:h,createDataItem:l=p=>new A$e(p)})=>{let p=await t.signDataItem({data:r,tags:a,target:i,anchor:h}),b=l($se.Buffer.from(p));return{id:await b.id,raw:await b.getRaw()}}}var T$e=globalThis.GATEWAY_URL||void 0,k$e=globalThis.MU_URL||void 0,I$e=globalThis.CU_URL||void 0,B$e=globalThis.GRAPHQL_URL||void 0,{result:Fmt,results:jmt,message:zmt,spawn:Zmt,monitor:Hmt,unmonitor:Kmt,dryrun:Wmt,assign:Vmt}=vv({GATEWAY_URL:T$e,MU_URL:k$e,CU_URL:I$e,GRAPHQL_URL:B$e}),Vse=Dse.createDataItemSigner;ie();ae();ne();var Ffe=gi(Ufe(),1),hP=Ffe.default.init({host:"arweave.net",port:443,protocol:"https"});async function qbt({signer:t,module:e=aQ,luaCodeTxId:r=gT,ao:a=vv(),scheduler:i=oQ,state:h,stateContractTxId:l,antRegistryId:p=$8,logger:b=Fu.default,arweave:g=hP}){let y=await g.transactions.getData(r,{decode:!0,string:!0}),M=await a.spawn({module:e,scheduler:i,signer:t,tags:[{name:"ANT-Registry-Id",value:p},{name:"Source-Code-TX-ID",value:r}]}),x=new Pa({processId:M,ao:a,logger:b}),{id:E}=await x.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:y,signer:t});if(b.debug("Spawned ANT",{processId:M,module:e,scheduler:i,luaCodeTxId:r,evalId:E}),h){let{id:P}=await x.send({tags:[{name:"Action",value:"Initialize-State"},...l!==void 0?[{name:"State-Contract-TX-ID",value:l}]:[]],data:JSON.stringify(h),signer:t});b.debug("Initialized ANT",{processId:M,module:e,scheduler:i,initializeMsgId:P})}let A=Hd.init({process:new Pa({processId:p,ao:a,logger:b}),signer:t}),{id:k}=await A.register({processId:M});return b.debug("Registered ANT to ANT Registry",{processId:M,module:e,scheduler:i,antRegistrationMsgId:k,antRegistryId:p}),M}async function Ubt({signer:t,processId:e,luaCodeTxId:r=gT,ao:a=vv(),logger:i=Fu.default,arweave:h=hP}){let l=new Pa({processId:e,ao:a,logger:i}),p=await h.transactions.getData(r,{decode:!0,string:!0}),{id:b}=await l.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:p,signer:t});return i.debug("Evolved ANT",{processId:e,luaCodeTxId:r,evalMsgId:b}),b}function Jqe(t){let e=vr.object({name:vr.string(),value:vr.union([vr.string(),vr.number()])}),r=vr.function().args(vr.object({data:vr.union([vr.string(),vr.instanceof(Me)]),tags:vr.array(e).optional(),target:vr.string().optional(),anchor:vr.string().optional()})).returns(vr.promise(vr.object({id:vr.string(),raw:vr.instanceof(ArrayBuffer)})));try{return r.parse(t),!0}catch{return!1}}function Bc(t){return Jqe(t)?t:"publicKey"in t?async({data:r,tags:a,target:i,anchor:h})=>{t.publicKey===void 0&&"setPublicKey"in t&&typeof t.setPublicKey=="function"&&await t.setPublicKey();let l=Ag(r,t,{tags:a,target:i,anchor:h});return l.sign(t).then(async()=>({id:await l.id,raw:await l.getRaw()}))}:Vse(t)}var Xqe="-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI";function Fbt({owner:t,targetId:e,ttlSeconds:r=3600,keywords:a=[],controllers:i=[],description:h="",ticker:l="aos",name:p="ANT"}){return{ticker:l,name:p,description:h,keywords:a,owner:t,controllers:[t,...i],balances:{[t]:1},records:{"@":{transactionId:e??Xqe.toString(),ttlSeconds:r}}}}ie();ae();ne();function Pc(t,e){let r=t.safeParse(e);if(!r.success)throw new Error(JSON.stringify(r.error.format(),null,2));return r}var Fw=class{static init({signer:e,strict:r=!1,...a}){if(Dh(a)||$h(a))return e?new lP({signer:e,strict:r,...a}):new jw({strict:r,...a});throw new Nu}},jw=class{process;strict;constructor(e){if(this.strict=e.strict||!1,Dh(e))this.process=e.process;else if($h(e))this.process=new Pa({processId:e.processId});else throw new Nu}async getState({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"State"}],a=await this.process.read({tags:r});return e&&Pc(_T.passthrough().and(vr.object({Records:vr.record(vr.string(),q8.passthrough())})),a),a}async getInfo({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"Info"}],a=await this.process.read({tags:r});return e&&Pc(hQ.passthrough(),a),a}async getLogo(){return(await this.getInfo()).Logo}async getRecord({undername:e},{strict:r}={strict:this.strict}){let a=[{name:"Sub-Domain",value:e},{name:"Action",value:"Record"}],i=await this.process.read({tags:a});return r&&Pc(q8.passthrough(),i),i}async getRecords({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"Records"}],a=await this.process.read({tags:r});return e&&Pc(bT,a),a}async getOwner({strict:e}={strict:this.strict}){return(await this.getInfo({strict:e})).Owner}async getControllers({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"Controllers"}],a=await this.process.read({tags:r});return e&&Pc(yT,a),a}async getName({strict:e}={strict:this.strict}){return(await this.getInfo({strict:e})).Name}async getTicker({strict:e}={strict:this.strict}){return(await this.getInfo({strict:e})).Ticker}async getBalances({strict:e}={strict:this.strict}){let r=[{name:"Action",value:"Balances"}],a=await this.process.read({tags:r});return e&&Pc(wT,a),a}async getBalance({address:e},{strict:r}={strict:this.strict}){let a=[{name:"Action",value:"Balance"},{name:"Recipient",value:e}],i=await this.process.read({tags:a});return r&&Pc(vr.number(),i),i}async getHandlers(){let e=await this.getInfo();return e.Handlers??e.HandlerNames}},lP=class extends jw{signer;constructor({signer:e,...r}){super(r),this.signer=Bc(e)}async transfer({target:e},r){let a=[...r?.tags??[],{name:"Action",value:"Transfer"},{name:"Recipient",value:e}];return this.process.send({tags:a,signer:this.signer})}async addController({controller:e},r){let a=[...r?.tags??[],{name:"Action",value:"Add-Controller"},{name:"Controller",value:e}];return this.process.send({tags:a,signer:this.signer})}async removeController({controller:e},r){let a=[...r?.tags??[],{name:"Action",value:"Remove-Controller"},{name:"Controller",value:e}];return this.process.send({tags:a,signer:this.signer})}async setRecord({undername:e,transactionId:r,ttlSeconds:a},i){return this.process.send({tags:[...i?.tags??[],{name:"Action",value:"Set-Record"},{name:"Sub-Domain",value:e},{name:"Transaction-Id",value:r},{name:"TTL-Seconds",value:a.toString()}],signer:this.signer})}async removeRecord({undername:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Remove-Record"},{name:"Sub-Domain",value:e}],signer:this.signer})}async setTicker({ticker:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Ticker"},{name:"Ticker",value:e}],signer:this.signer})}async setName({name:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Name"},{name:"Name",value:e}],signer:this.signer})}async setDescription({description:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Description"},{name:"Description",value:e}],signer:this.signer})}async setKeywords({keywords:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Keywords"},{name:"Keywords",value:JSON.stringify(e)}],signer:this.signer})}async setLogo({txId:e},r){return this.process.send({tags:[...r?.tags??[],{name:"Action",value:"Set-Logo"},{name:"Logo",value:e}],signer:this.signer})}async releaseName({name:e,arioProcessId:r},a){return this.process.send({tags:[...a?.tags??[],{name:"Action",value:"Release-Name"},{name:"Name",value:e},{name:"IO-Process-Id",value:r},{name:"ARIO-Process-Id",value:r}],signer:this.signer})}async reassignName({name:e,arioProcessId:r,antProcessId:a},i){return this.process.send({tags:[...i?.tags??[],{name:"Action",value:"Reassign-Name"},{name:"Name",value:e},{name:"IO-Process-Id",value:r},{name:"ARIO-Process-Id",value:r},{name:"Process-Id",value:a}],signer:this.signer})}async approvePrimaryNameRequest({name:e,address:r,arioProcessId:a},i){return this.process.send({tags:[...i?.tags??[],{name:"Action",value:"Approve-Primary-Name"},{name:"Name",value:e},{name:"Recipient",value:r},{name:"IO-Process-Id",value:a},{name:"ARIO-Process-Id",value:a}],signer:this.signer})}async removePrimaryNames({names:e,arioProcessId:r},a){return this.process.send({tags:[...a?.tags??[],{name:"Action",value:"Remove-Primary-Names"},{name:"Names",value:e.join(",")},{name:"IO-Process-Id",value:r},{name:"ARIO-Process-Id",value:r}],signer:this.signer})}};ie();ae();ne();var Hd=class{static init(e){if(e&&e.signer){let{signer:r,...a}=e;return new cP({...a,signer:r})}return new zw(e)}},zw=class{process;constructor(e){if(e&&($h(e)||Dh(e)))if(Dh(e))this.process=e.process;else if($h(e))this.process=new Pa({processId:e.processId});else throw new Nu;else this.process=new Pa({processId:$8})}async accessControlList({address:e}){return this.process.read({tags:[{name:"Action",value:"Access-Control-List"},{name:"Address",value:e}]})}},cP=class extends zw{signer;constructor({signer:e,...r}){super(r),this.signer=Bc(e)}async register({processId:e}){return this.process.send({tags:[{name:"Action",value:"Register"},{name:"Process-Id",value:e}],signer:this.signer})}};ie();ae();ne();ie();ae();ne();ie();ae();ne();du();var jfe="+",zfe="/",Zfe="-",Hfe="_",Kfe="=";function Qqe(t){let e=t.length%4;return e&&(t+=Kfe.repeat(4-e)),t.replaceAll(Zfe,jfe).replaceAll(Hfe,zfe)}function eUe(t){return t.replaceAll(jfe,Zfe).replaceAll(zfe,Hfe).replaceAll(Kfe,"")}function Nyt(t){let e=Qqe(t);return Me.from(e,"base64")}function tUe(t){let e=t.toString("base64");return eUe(e)}function Cyt(t){return tUe(pf("sha256").update(Uint8Array.from(t)).digest())}function Wfe(t=32){let e=nE(t);return Array.from(e,r=>r.toString(16).padStart(2,"0")).join("").slice(0,t)}ie();ae();ne();function dP(t){try{return JSON.parse(t)}catch{return t}}var Pa=class{logger;processId;ao;constructor({processId:e,ao:r=vv(),logger:a=Fu.default}){this.processId=e,this.logger=a,this.ao=r}isMessageDataEmpty(e){return e===void 0||e==="null"||e===""||e===null}async read({tags:e,retries:r=3,fromAddress:a}){let i=0,h;for(;i<r;)try{this.logger.debug("Evaluating read interaction on contract",{tags:e});let l={process:this.processId,tags:e};a!==void 0&&(l.Owner=a);let p=await this.ao.dryrun(l);this.logger.debug("Read interaction result",{result:p});let b=Vfe(p);if(b!==void 0)throw new Error(b);if(p.Messages===void 0||p.Messages.length===0)throw this.logger.debug(`Process ${this.processId} does not support provided action.`,p,e),new Error(`Process ${this.processId} does not support provided action.`);let g=p.Messages?.[0]?.Data;return this.isMessageDataEmpty(g)?void 0:dP(p.Messages[0].Data)}catch(l){i++,this.logger.debug(`Read attempt ${i} failed`,{error:l instanceof Error?l.message:l,tags:e}),h=l,await new Promise(p=>setTimeout(p,2**i*1e3))}throw h}async send({tags:e,data:r,signer:a,retries:i=3}){let h=0,l;for(;h<i;)try{this.logger.debug("Evaluating send interaction on contract",{tags:e,data:r,processId:this.processId});let p=Wfe(32),b=await this.ao.message({process:this.processId,tags:[...e,{name:"AR-IO-SDK",value:W4}],data:r,signer:a,anchor:p});this.logger.debug("Sent message to process",{messageId:b,processId:this.processId,anchor:p});let g=await this.ao.result({message:b,process:this.processId});this.logger.debug("Message result",{output:g,messageId:b,processId:this.processId});let y=Vfe(g);if(y!==void 0)throw new U8(y);if(g.Messages?.length===0||g.Messages===void 0)return{id:b};if(g.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);if(this.isMessageDataEmpty(g.Messages[0].Data))return{id:b};let M=dP(g.Messages[0].Data);return this.logger.debug("Message result data",{resultData:M,messageId:b,processId:this.processId}),{id:b,result:M}}catch(p){if(this.logger.error("Error sending message to process",{error:p.message,processId:this.processId,tags:e}),p.message.includes("500"))this.logger.debug("Retrying send interaction",{attempts:h,retries:i,error:p.message,processId:this.processId}),await new Promise(b=>setTimeout(b,2**h*2e3)),h++,l=p;else throw p}throw l}};function Vfe(t){let e=t.Error;if(e!==void 0)return e;let r=t.Messages?.[0]?.Tags?.find(a=>a.name==="Error")?.value;if(r!==void 0){let a=r.match(/\d+/)?.[0];return`${r.replace(/\[string "aos"\]:\d+:/,"")} (line ${a})`.trim()}}var Eb=class{static init(e){if(e&&e.signer){let{signer:r,...a}=e;return new pP({...a,signer:r})}return new Zw(e)}},Zw=class{process;epochSettings;constructor(e){if(!e)this.process=new Pa({processId:A1});else if(Dh(e))this.process=e.process;else if($h(e))this.process=new Pa({processId:e.processId});else throw new Nu}async getInfo(){return this.process.read({tags:[{name:"Action",value:"Info"}]})}async getTokenSupply(){return this.process.read({tags:[{name:"Action",value:"Total-Token-Supply"}]})}async computeEpochIndexForTimestamp(e){let r=await this.getEpochSettings(),a=r.epochZeroStartTimestamp,i=r.durationMs;return Math.floor((e-a)/i)}async computeEpochIndex(e){let r=e?.epochIndex;if(r!==void 0)return r.toString();let a=e?.timestamp;if(a!==void 0)return(await this.computeEpochIndexForTimestamp(a)).toString()}async getEpochSettings(){return this.epochSettings??=await this.process.read({tags:[{name:"Action",value:"Epoch-Settings"}]})}async getEpoch(e){let r=[{name:"Action",value:"Epoch"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getArNSRecord({name:e}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:e}]})}async getArNSRecords(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Records"},...Oo(e)]})}async getArNSReservedNames(e){return this.process.read({tags:[{name:"Action",value:"Reserved-Names"},...Oo(e)]})}async getArNSReservedName({name:e}){return this.process.read({tags:[{name:"Action",value:"Reserved-Name"},{name:"Name",value:e}]})}async getBalance({address:e}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:e}]})}async getBalances(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Balances"},...Oo(e)]})}async getVault({address:e,vaultId:r}){return this.process.read({tags:[{name:"Action",value:"Vault"},{name:"Address",value:e},{name:"Vault-Id",value:r}]})}async getVaults(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Vaults"},...Oo(e)]})}async getGateway({address:e}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:e}]})}async getGatewayDelegates({address:e,...r}){return this.process.read({tags:[{name:"Action",value:"Paginated-Delegates"},{name:"Address",value:e},...Oo(r)]})}async getGatewayDelegateAllowList({address:e,...r}){return this.process.read({tags:[{name:"Action",value:"Paginated-Allowed-Delegates"},{name:"Address",value:e},...Oo(r)]})}async getGateways(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Gateways"},...Oo(e)]})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"}]})}async getPrescribedObservers(e){let r=[{name:"Action",value:"Epoch-Prescribed-Observers"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getPrescribedNames(e){let r=[{name:"Action",value:"Epoch-Prescribed-Names"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getObservations(e){let r=[{name:"Action",value:"Epoch-Observations"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getDistributions(e){let r=[{name:"Action",value:"Epoch-Distributions"},{name:"Epoch-Index",value:await this.computeEpochIndex(e)}];return this.process.read({tags:En(r)})}async getTokenCost({intent:e,type:r,years:a,name:i,quantity:h,fromAddress:l}){let p=[{name:"Action",value:"Token-Cost"},{name:"Intent",value:e},{name:"Name",value:i},{name:"Years",value:a?.toString()},{name:"Quantity",value:h?.toString()},{name:"Purchase-Type",value:r}];return this.process.read({tags:En(p),fromAddress:l})}async getCostDetails({intent:e,type:r,years:a,name:i,quantity:h,fromAddress:l,fundFrom:p}){let b=[{name:"Action",value:"Get-Cost-Details-For-Action"},{name:"Intent",value:e},{name:"Name",value:i},{name:"Years",value:a?.toString()},{name:"Quantity",value:h?.toString()},{name:"Purchase-Type",value:r},{name:"Fund-From",value:p}];return this.process.read({tags:En(b),fromAddress:l})}async getRegistrationFees(){return this.process.read({tags:[{name:"Action",value:"Get-Registration-Fees"}]})}async getDemandFactor(){return this.process.read({tags:[{name:"Action",value:"Demand-Factor"}]})}async getDemandFactorSettings(){return this.process.read({tags:[{name:"Action",value:"Demand-Factor-Settings"}]})}async getArNSReturnedNames(e){return this.process.read({tags:[{name:"Action",value:"Returned-Names"},...Oo(e)]})}async getArNSReturnedName({name:e}){let r=[{name:"Action",value:"Returned-Name"},{name:"Name",value:e}];return this.process.read({tags:r})}async getDelegations(e){let r=[{name:"Action",value:"Paginated-Delegations"},{name:"Address",value:e.address},...Oo(e)];return this.process.read({tags:En(r)})}async getAllowedDelegates(e){return this.getGatewayDelegateAllowList(e)}async getGatewayVaults(e){return this.process.read({tags:[{name:"Action",value:"Paginated-Gateway-Vaults"},{name:"Address",value:e.address},...Oo(e)]})}async getPrimaryNameRequest(e){let r=[{name:"Action",value:"Primary-Name-Request"},{name:"Initiator",value:e.initiator}];return this.process.read({tags:r})}async getPrimaryNameRequests(e){return this.process.read({tags:[{name:"Action",value:"Primary-Name-Requests"},...Oo(e)]})}async getPrimaryName(e){let r=[{name:"Action",value:"Primary-Name"},{name:"Address",value:e?.address},{name:"Name",value:e?.name}];return this.process.read({tags:En(r)})}async getPrimaryNames(e){return this.process.read({tags:[{name:"Action",value:"Primary-Names"},...Oo(e)]})}async getRedelegationFee(e){return this.process.read({tags:[{name:"Action",value:"Redelegation-Fee"},{name:"Address",value:e.address}]})}async getGatewayRegistrySettings(){return this.process.read({tags:[{name:"Action",value:"Gateway-Registry-Settings"}]})}},pP=class extends Zw{signer;constructor({signer:e,...r}){if(Object.keys(r).length===0)super({process:new Pa({processId:A1})}),this.signer=Bc(e);else if(Dh(r))super({process:r.process}),this.signer=Bc(e);else if($h(r))super({process:new Pa({processId:r.processId})}),this.signer=Bc(e);else throw new Nu}async transfer({target:e,qty:r},a){let{tags:i=[]}=a||{};return this.process.send({tags:[...i,{name:"Action",value:"Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:r.valueOf().toString()}],signer:this.signer})}async joinNetwork({operatorStake:e,allowDelegatedStaking:r,allowedDelegates:a,delegateRewardShareRatio:i,fqdn:h,label:l,minDelegatedStake:p,note:b,port:g,properties:y,protocol:M,autoStake:x,observerAddress:E},A){let{tags:k=[]}=A||{},P=[...k,{name:"Action",value:"Join-Network"},{name:"Operator-Stake",value:e.valueOf().toString()},{name:"Allow-Delegated-Staking",value:r?.toString()},{name:"Allowed-Delegates",value:a?.join(",")},{name:"Delegate-Reward-Share-Ratio",value:i?.toString()},{name:"FQDN",value:h},{name:"Label",value:l},{name:"Min-Delegated-Stake",value:p?.valueOf().toString()},{name:"Note",value:b},{name:"Port",value:g?.toString()},{name:"Properties",value:y},{name:"Protocol",value:M},{name:"Auto-Stake",value:x?.toString()},{name:"Observer-Address",value:E}];return this.process.send({signer:this.signer,tags:En(P)})}async leaveNetwork(e){let{tags:r=[]}=e||{};return this.process.send({signer:this.signer,tags:[...r,{name:"Action",value:"Leave-Network"}]})}async updateGatewaySettings({allowDelegatedStaking:e,allowedDelegates:r,delegateRewardShareRatio:a,fqdn:i,label:h,minDelegatedStake:l,note:p,port:b,properties:g,protocol:y,autoStake:M,observerAddress:x},E){let{tags:A=[]}=E||{},k=[...A,{name:"Action",value:"Update-Gateway-Settings"},{name:"Label",value:h},{name:"Note",value:p},{name:"FQDN",value:i},{name:"Port",value:b?.toString()},{name:"Properties",value:g},{name:"Protocol",value:y},{name:"Observer-Address",value:x},{name:"Allow-Delegated-Staking",value:e?.toString()},{name:"Allowed-Delegates",value:r?.join(",")},{name:"Delegate-Reward-Share-Ratio",value:a?.toString()},{name:"Min-Delegated-Stake",value:l?.valueOf().toString()},{name:"Auto-Stake",value:M?.toString()}];return this.process.send({signer:this.signer,tags:En(k)})}async delegateStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Decrease-Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.decreaseQty.valueOf().toString()},{name:"Instant",value:`${e.instant||!1}`}]})}async instantWithdrawal(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Instant-Withdrawal"},{name:"Vault-Id",value:e.vaultId},{name:"Address",value:e.gatewayAddress}];return this.process.send({signer:this.signer,tags:En(i)})}async increaseOperatorStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Increase-Operator-Stake"},{name:"Quantity",value:e.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Decrease-Operator-Stake"},{name:"Quantity",value:e.decreaseQty.valueOf().toString()},{name:"Instant",value:`${e.instant||!1}`}]})}async saveObservations(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Save-Observations"},{name:"Report-Tx-Id",value:e.reportTxId},{name:"Failed-Gateways",value:e.failedGateways.join(",")}]})}async buyRecord(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Buy-Record"},{name:"Name",value:e.name},{name:"Years",value:e.years?.toString()??"1"},{name:"Process-Id",value:e.processId},{name:"Purchase-Type",value:e.type||"lease"},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:En(i)})}async upgradeRecord(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Upgrade-Name"},{name:"Name",value:e.name},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:En(i)})}async extendLease(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Extend-Lease"},{name:"Name",value:e.name},{name:"Years",value:e.years.toString()},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:En(i)})}async increaseUndernameLimit(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Increase-Undername-Limit"},{name:"Name",value:e.name},{name:"Quantity",value:e.increaseCount.toString()},{name:"Fund-From",value:e.fundFrom}];return this.process.send({signer:this.signer,tags:En(i)})}async cancelWithdrawal(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Cancel-Withdrawal"},{name:"Vault-Id",value:e.vaultId},{name:"Address",value:e.gatewayAddress}];return this.process.send({signer:this.signer,tags:En(i)})}async requestPrimaryName(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Request-Primary-Name"},{name:"Name",value:e.name}];return this.process.send({signer:this.signer,tags:En(i)})}async redelegateStake(e,r){let{tags:a=[]}=r||{},i=[...a,{name:"Action",value:"Redelegate-Stake"},{name:"Target",value:e.target},{name:"Source",value:e.source},{name:"Quantity",value:e.stakeQty.valueOf().toString()},{name:"Vault-Id",value:e.vaultId}];return this.process.send({signer:this.signer,tags:En(i)})}};ie();ae();ne();ie();ae();ne();ie();ae();ne();var mP=gi(Yfe(),1);ie();ae();ne();var nUe=Object.defineProperty,aUe=(t,e,r)=>e in t?nUe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rb=(t,e,r)=>(aUe(t,typeof e!="symbol"?e+"":e,r),r),gP=class{constructor(e){Rb(this,"value"),Rb(this,"next"),this.value=e}},bP=class{constructor(){Rb(this,"head"),Rb(this,"tail"),Rb(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(e){let r=new gP(e);return this.head&&this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),this._size++,this._size}pop(){if(!this.head)return;let e=this.head;return this.head=this.head.next,this._size--,e.value}get size(){return this._size}*[Symbol.iterator](){let e=this.head;for(;e;)yield e.value,e=e.next}};function Jfe(t){if(!((Number.isInteger(t)||t===1/0)&&t>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let e=new bP,r=0,a=()=>{r--,e.size>0&&e.pop()()},i=async(p,b,g)=>{r++;let y=(async()=>p(...g))();b(y);try{await y}catch{}a()},h=(p,b,g)=>{e.push(i.bind(null,p,b,g)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.pop()()))()},l=(p,...b)=>new Promise(g=>{h(p,g,b)});return Object.defineProperties(l,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),l}var l3t=async({address:t,registry:e=Hd.init()})=>{let r=await e.accessControlList({address:t});return[...new Set([...r.Owned,...r.Controlled])]};function Xfe(t,e){return new Promise((r,a)=>{let i=setTimeout(()=>{a(new Error("Timeout"))},t);e.then(h=>{clearTimeout(i),r(h)}).catch(h=>{clearTimeout(i),a(h)})})}var Qfe=class extends mP.default{contract;timeoutMs;throttle;logger;strict;constructor({contract:e=Eb.init({processId:A1}),timeoutMs:r=6e4,concurrency:a=30,logger:i=Fu.default,strict:h=!1}={}){super(),this.contract=e,this.timeoutMs=r,this.throttle=Jfe(a),this.logger=i,this.strict=h}async fetchProcessesOwnedByWallet({address:e,pageSize:r,antRegistry:a=Hd.init()}){let i={},h=await a.accessControlList({address:e}),l=new Set([...h.Owned,...h.Controlled]);await Xfe(this.timeoutMs,oUe({contract:this.contract,emitter:this,pageSize:r})).catch(b=>(this.emit("error",`Error getting ArNS records: ${b}`),this.logger.error("Error getting ArNS records",{message:b?.message,stack:b?.stack}),{})).then(b=>{Object.entries(b).forEach(([g,y])=>{l.has(y.processId)&&(i[y.processId]==null&&(i[y.processId]={state:void 0,names:{}}),i[y.processId].names[g]=y)})});let p=Object.keys(i).length;this.emit("progress",0,p),await Promise.all(Object.keys(i).map(async(b,g)=>this.throttle(async()=>{if(i[b].state!==void 0){this.emit("progress",g+1,p);return}let y=Fw.init({processId:b,strict:this.strict}),M=await Xfe(this.timeoutMs,y.getState()).catch(x=>{this.emit("error",`Error getting state for process ${b}: ${x}`)});(M?.Owner===e||M?.Controllers.includes(e))&&(i[b].state=M,this.emit("process",b,i[b])),this.emit("progress",g+1,p)}))),this.emit("end",i)}},oUe=async({contract:t=Eb.init({processId:A1}),emitter:e,logger:r=Fu.default,pageSize:a=5e4})=>{let i,h=Date.now(),l={};do{let p=await t.getArNSRecords({cursor:i,limit:a}).catch(b=>{r?.error("Error getting ArNS records",{message:b?.message,stack:b?.stack}),e?.emit("arns:error",`Error getting ArNS records: ${b}`)});if(!p)return{};p.items.forEach(b=>{let{name:g,...y}=b;l[g]=y}),r.debug("Fetched page of ArNS records",{totalRecordCount:p.totalItems,fetchedRecordCount:Object.keys(l).length,cursor:p.nextCursor}),e?.emit("arns:pageLoaded",{totalRecordCount:p.totalItems,fetchedRecordCount:Object.keys(l).length,records:p.items,cursor:p.nextCursor}),i=p.nextCursor}while(i!==void 0);return e?.emit("arns:end",l),r.debug("Fetched all ArNS records",{totalRecordCount:Object.keys(l).length,durationMs:Date.now()-h}),l};export{Fw as ANT,Hd as ANTRegistry,gT as ANT_LUA_ID,$8 as ANT_REGISTRY_ID,Pa as AOProcess,aQ as AOS_MODULE_ID,Eb as ARIO,Zw as ARIOReadable,xT as ARIOToken,pP as ARIOWriteable,r5e as ARIO_DEVNET_PROCESS_ID,A1 as ARIO_TESTNET_PROCESS_ID,qft as ARNS_DEVNET_REGISTRY_TX,$ft as ARNS_TESTNET_REGISTRY_TX,D8 as ARWEAVE_TX_REGEX,bQ as AbortError,wT as AntBalancesSchema,yT as AntControllersSchema,i5e as AntDescriptionSchema,o5e as AntHandlerNames,fQ as AntHandlersSchema,hQ as AntInfoSchema,uQ as AntKeywordsSchema,n5e as AntReadHandlers,q8 as AntRecordSchema,bT as AntRecordsSchema,_T as AntStateSchema,a5e as AntWriteHandlers,jw as AoANTReadable,zw as AoANTRegistryReadable,cP as AoANTRegistryWriteable,lP as AoANTWriteable,Qfe as ArNSEventEmitter,v1 as ArconnectSigner,Hl as ArweaveSigner,gd as ArweaveTxIdSchema,dQ as BadRequest,kf as BaseError,oQ as DEFAULT_SCHEDULER_ID,Lft as FQDN_REGEX,pQ as FailedRequestError,sQ as IntegerStringSchema,Nu as InvalidContractConfigurationError,gQ as InvalidProcessConfigurationError,mQ as InvalidSignerError,Fu as Logger,mT as MARIO_PER_ARIO,cQ as NotFound,Dft as SORT_KEY_REGEX,vQ as UnknownError,U8 as WriteInteractionError,Uft as arioDevnetProcessId,Bc as createAoSigner,Xqe as defaultTargetManifestId,Ubt as evolveANT,oUe as fetchAllArNSRecords,Nyt as fromB64Url,f5e as fundFromOptions,l3t as getANTProcessesOwnedByWallet,Wfe as getRandomText,Fbt as initANTStateForAddress,fut as intentsUsingYears,Wft as isAoANTState,Jqe as isAoSigner,rut as isBlockHeight,lut as isLeasedArNSRecord,Dh as isProcessConfiguration,$h as isProcessIdConfiguration,hut as isValidFundFrom,uut as isValidIntent,ST as mARIOToken,Oo as paginationParamsToTags,Pc as parseSchemaResult,En as pruneTags,dP as safeDecode,Cyt as sha256B64Url,qbt as spawnANT,tUe as toB64Url,s5e as validIntents,lQ as validateArweaveId};
|
|
188
188
|
/*! Bundled license information:
|
|
189
189
|
|
|
190
190
|
@jspm/core/nodelibs/browser/buffer.js:
|