Reading from NEAR testnet…
Reading from NEAR testnet…
CaQLcTgjWZJ7d9bDbhxn9Hy54g6p7MEeeq1YEsEd89nt
web4.nearbuilders.testnet to web4.nearbuilders.testnet · failed
fs_store()
ionStatusBasic||(Mn.FinalExecutionStatusBasic={}))})(response$2);(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.FinalExecutionStatusBasic=Mn.ExecutionStatusBasic=Mn.IdType=void 0;var Fn=light_client$1;Object.defineProperty(Mn,"IdType",{enumerable:!0,get:function(){return Fn.IdType}});var io=response$2;Object.defineProperty(Mn,"ExecutionStatusBasic",{enumerable:!0,get:function(){return io.ExecutionStatusBasic}}),Object.defineProperty(Mn,"FinalExecutionStatusBasic",{enumerable:!0,get:function(){return io.FinalExecutionStatusBasic}})})(provider$a);(function(Mn){var Fn=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(fo,$o,mo,Ao){Ao===void 0&&(Ao=mo);var jo=Object.getOwnPropertyDescriptor($o,mo);(!jo||("get"in jo?!$o.__esModule:jo.writable||jo.configurable))&&(jo={enumerable:!0,get:function(){return $o[mo]}}),Object.defineProperty(fo,Ao,jo)}:function(fo,$o,mo,Ao){Ao===void 0&&(Ao=mo),fo[Ao]=$o[mo]}),io=commonjsGlobal$c&&commonjsGlobal$c.__exportStar||function(fo,$o){for(var mo in fo)mo!=="default"&&!Object.prototype.hasOwnProperty.call($o,mo)&&Fn($o,fo,mo)};Object.defineProperty(Mn,"__esModule",{value:!0}),io(assignable$1,Mn),io(errors$a,Mn),io(provider$a,Mn)})(lib$i);var format$7={};(function(Mn){var Fn=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Yo){return Yo&&Yo.__esModule?Yo:{default:Yo}};Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.baseDecode=Mn.baseEncode=Mn.parseNearAmount=Mn.formatNearAmount=Mn.NEAR_NOMINATION=Mn.NEAR_NOMINATION_EXP=void 0;const io=Fn(bs58$3);Mn.NEAR_NOMINATION_EXP=24,Mn.NEAR_NOMINATION=BigInt(10)**BigInt(Mn.NEAR_NOMINATION_EXP);const fo=[],$o=BigInt(10);for(let Yo=0,Xo=BigInt(5);Yo<Mn.NEAR_NOMINATION_EXP;Yo++,Xo=Xo*$o)fo[Yo]=Xo;function mo(Yo,Xo=Mn.NEAR_NOMINATION_EXP){let is=BigInt(Yo);if(Xo!==Mn.NEAR_NOMINATION_EXP){const hs=Mn.NEAR_NOMINATION_EXP-Xo-1;hs>0&&(is+=fo[hs])}Yo=is.toString();const yl=Yo.substring(0,Yo.length-Mn.NEAR_NOMINATION_EXP)||"0",us=Yo.substring(Yo.length-Mn.NEAR_NOMINATION_EXP).padStart(Mn.NEAR_NOMINATION_EXP,"0").substring(0,Xo);return Lo(`${zo(yl)}.${us}`)}Mn.formatNearAmount=mo;function Ao(Yo){if(!Yo)return null;Yo=jo(Yo);const Xo=Yo.split("."),is=Xo[0],yl=Xo[1]||"";if(Xo.length>2||yl.length>Mn.NEAR_NOMINATION_EXP)throw new Error(`Cannot parse '${Yo}' as NEAR amount`);return Ho(is+yl.padEnd(Mn.NEAR_NOMINATION_EXP,"0"))}Mn.parseNearAmount=Ao;function jo(Yo){return Yo.replace(/,/g,"").trim()}function Lo(Yo){return Yo.replace(/\.?0*$/,"")}function Ho(Yo){return Yo=Yo.replace(/^0+/,""),Yo===""?"0":Yo}function zo(Yo){const Xo=/(-?\d+)(\d{3})/;for(;Xo.test(Yo);)Yo=Yo.replace(Xo,"$1,$2");return Yo}function Go(Yo){if(typeof Yo=="string"){const Xo=[];for(let is=0;is<Yo.length;is++)Xo.push(Yo.charCodeAt(is));Yo=new Uint8Array(Xo)}return io.default.encode(Yo)}Mn.baseEncode=Go;function Vo(Yo){return new Uint8Array(io.default.decode(Yo))}Mn.baseDecode=Vo})(format$7);const GasLimitExceeded$2="Exceeded the maximum amount of gas allowed to burn per contract",MethodEmptyName$2="Method name is empty",WasmerCompileError$2="Wasmer compilation error: {{msg}}",GuestPanic$2="Smart contract panicked: {{panic_msg}}",Memory$2="Error creating Wasm memory",GasExceeded$2="Exceeded the prepaid gas",MethodUTF8Error$2="Method name is not valid UTF8 string",BadUTF16$2="String encoding is bad UTF-16 sequence",WasmTrap$2="WebAssembly trap: {{msg}}",GasInstrumentation$2="Gas instrumentation failed or contract has denied instructions.",InvalidPromiseIndex$2="{{promise_idx}} does not correspond to existing promises",InvalidPromiseResultIndex$2="Accessed invalid promise result index: {{result_idx}}",Deserialization$2="Error happened while deserializing the module",MethodNotFound$2="Contract method is not found",InvalidRegisterId$2="Accessed invalid register id: {{register_id}}",InvalidReceiptIndex$2="VM Logic returned an invalid receipt index: {{receipt_index}}",EmptyMethodName$2="Method name is empty in contract call",CannotReturnJointPromise$2="Returning joint promise is currently prohibited",StackHeightInstrumentation$2="Stack instrumentation failed",CodeDoesNotExist$2="Cannot find contract code for account {{account_id}}",MethodInvalidSignature$2="Invalid method signature",IntegerOverflow$2="Integer overflow happened during contract execution",MemoryAccessViolation$2="MemoryAccessViolation",InvalidIteratorIndex$2="Iterator index {{iterator_index}} does not exist",IteratorWasInvalidated$2="Iterator {{iterator_index}} was invalidated after its creation by performing a mutable operation on trie",InvalidAccountId$2="VM Logic returned an invalid account id",Serialization$2="Error happened while serializing the module",CannotAppendActionToJointPromise$2="Actions can only be appended to non-joint promise.",InternalMemoryDeclared$2="Internal memory declaration has been found in the module",Instantiate$2="Error happened during instantiation",ProhibitedInView$2="{{method_name}} is not allowed in view calls",InvalidMethodName$2="VM Logic returned an invalid method name",BadUTF8$2="String encoding is bad UTF-8 sequence",BalanceExceeded$2="Exceeded the account balance",LinkError$2="Wasm contract link error: {{msg}}",InvalidPublicKey$2="VM Logic provided an invalid public key",ActorNoPermission$2="Actor {{actor_id}} doesn't have permission to account {{account_id}} to complete the action",LackBalanceForState$2="The account {{account_id}} wouldn't have enough balance to cover storage, required to have {{amount}} yoctoNEAR more",ReceiverMismatch$2="Wrong AccessKey used for transaction: transaction is sent to receiver_id={{tx_receiver}}, but is signed with function call access key that restricted to only use with receiver_id={{ak_receiver}}. Either change receiver_id in your transaction or switch to use a FullAccessKey.",CostOverflow$2="Transaction gas or balance cost is too high",InvalidSignature$2="Transaction is not signed with the given public key",AccessKeyNotFound$2=`Signer "{{account_id}}" doesn't have access key with the given public_key {{public_key}}`,NotEnoughBalance$2="Sender {{signer_id}} does not have enough balance {{#formatNear}}{{balance}}{{/formatNear}} for operation costing {{#formatNear}}{{cost}}{{/formatNear}}",NotEnoughAllowance$2="Access Key {account_id}:{public_key} does not have enough balance {{#formatNear}}{{allowance}}{{/formatNear}} for transaction costing {{#formatNear}}{{cost}}{{/formatNear}}",Expired$2="Transaction has expired",DeleteAccountStaking$2="Account {{account_id}} is staking and can not be deleted",SignerDoesNotExist$2="Signer {{signer_id}} does not exist",TriesToStake$2="Account {{account_id}} tried to stake {{#formatNear}}{{stake}}{{/formatNear}}, but has staked {{#formatNear}}{{locked}}{{/formatNear}} and only has {{#formatNear}}{{balance}}{{/formatNear}}",AddKeyAlreadyExists$2="The public key {{public_key}} is already used for an existing access key",InvalidSigner$2="Invalid signer account ID {{signer_id}} according to requirements",CreateAccountNotAllowed$2="The new account_id {{account_id}} can't be created by {{predecessor_id}}",RequiresFullAccess$2="The transaction contains more then one action, but it was signed with an access key which allows transaction to apply only one specific action. To apply more then one actions TX must be signed with a full access key",TriesToUnstake$2="Account {{account_id}} is not yet staked, but tried to unstake",InvalidNonce$2="Transaction nonce {{tx_nonce}} must be larger than nonce of the used access key {{ak_nonce}}",AccountAlreadyExists$2="Can't create a new account {{account_id}}, because it already exists",InvalidChain$2="Transaction parent block hash doesn't belong to the current chain",AccountDoesNotExist$2="Can't complete the action because account {{account_id}} doesn't exist",AccessKeyDoesNotExist$2="Can't complete the action because access key {{public_key}} doesn't exist",MethodNameMismatch$2="Transaction method name {{method_name}} isn't allowed by the access key",DeleteAccountHasRent$2="Account {{account_id}} can't be deleted. It has {{#formatNear}}{{balance}}{{/formatNear}}, which is enough to cover the rent",DeleteAccountHasEnoughBalance$2="Account {{account_id}} can't be deleted. It has {{#formatNear}}{{balance}}{{/formatNear}}, which is enough to cover it's storage",InvalidReceiver$2="Invalid receiver account ID {{receiver_id}} according to requirements",DeleteKeyDoesNotExist$2="Account {{account_id}} tries to remove an access key that doesn't exist",Timeout$2="Timeout exceeded",Closed$2="Connection closed",ShardCongested$1="Shard {{shard_id}} rejected the transaction due to congestion level {{congestion_level}}, try again later",ShardStuck$1="Shard {{shard_id}} rejected the transaction because it missed {{missed_chunks}} chunks and needs to recover before accepting new transactions, try again later",require$$3$1={GasLimitExceeded:GasLimitExceeded$2,MethodEmptyName:MethodEmptyName$2,WasmerCompileError:WasmerCompileError$2,GuestPanic:GuestPanic$2,Memory:Memory$2,GasExceeded:GasExceeded$2,MethodUTF8Error:MethodUTF8Error$2,BadUTF16:BadUTF16$2,WasmTrap:WasmTrap$2,GasInstrumentation:GasInstrumentation$2,InvalidPromiseIndex:InvalidPromiseIndex$2,InvalidPromiseResultIndex:InvalidPromiseResultIndex$2,Deserialization:Deserialization$2,MethodNotFound:MethodNotFound$2,InvalidRegisterId:InvalidRegisterId$2,InvalidReceiptIndex:InvalidReceiptIndex$2,EmptyMethodName:EmptyMethodName$2,CannotReturnJointPromise:CannotReturnJointPromise$2,StackHeightInstrumentation:StackHeightInstrumentation$2,CodeDoesNotExist:CodeDoesNotExist$2,MethodInvalidSignature:MethodInvalidSignature$2,IntegerOverflow:IntegerOverflow$2,MemoryAccessViolation:MemoryAccessViolation$2,InvalidIteratorIndex:InvalidIteratorIndex$2,IteratorWasInvalidated:IteratorWasInvalidated$2,InvalidAccountId:InvalidAccountId$2,Serialization:Serialization$2,CannotAppendActionToJointPromise:CannotAppendActionToJointPromise$2,InternalMemoryDeclared:InternalMemoryDeclared$2,Instantiate:Instantiate$2,ProhibitedInView:ProhibitedInView$2,InvalidMethodName:InvalidMethodName$2,BadUTF8:BadUTF8$2,BalanceExceeded:BalanceExceeded$2,LinkError:LinkError$2,InvalidPublicKey:InvalidPublicKey$2,ActorNoPermission:ActorNoPermission$2,LackBalanceForState:LackBalanceForState$2,ReceiverMismatch:ReceiverMismatch$2,CostOverflow:CostOverflow$2,InvalidSignature:InvalidSignature$2,AccessKeyNotFound:AccessKeyNotFound$2,NotEnoughBalance:NotEnoughBalance$2,NotEnoughAllowance:NotEnoughAllowance$2,Expired:Expired$2,DeleteAccountStaking:DeleteAccountStaking$2,SignerDoesNotExist:SignerDoesNotExist$2,TriesToStake:TriesToStake$2,AddKeyAlreadyExists:AddKeyAlreadyExists$2,InvalidSigner:InvalidSigner$2,CreateAccountNotAllowed:CreateAccountNotAllowed$2,RequiresFullAccess:RequiresFullAccess$2,TriesToUnstake:TriesToUnstake$2,InvalidNonce:InvalidNonce$2,AccountAlreadyExists:AccountAlreadyExists$2,InvalidChain:InvalidChain$2,AccountDoesNotExist:AccountDoesNotExist$2,AccessKeyDoesNotExist:AccessKeyDoesNotExist$2,MethodNameMismatch:MethodNameMismatch$2,DeleteAccountHasRent:DeleteAccountHasRent$2,DeleteAccountHasEnoughBalance:DeleteAccountHasEnoughBalance$2,InvalidReceiver:InvalidReceiver$2,DeleteKeyDoesNotExist:DeleteKeyDoesNotExist$2,Timeout:Timeout$2,Closed:Closed$2,ShardCongested:ShardCongested$1,ShardStuck:ShardStuck$1},schema$5={AccessKeyNotFound:{name:"AccessKeyNotFound",subtypes:[],props:{account_id:"",public_key:""}},AccountAlreadyExists:{name:"AccountAlreadyExists",subtypes:[],props:{account_id:""}},AccountDoesNotExist:{name:"AccountDoesNotExist",subtypes:[],props:{account_id:""}},ActionError:{name:"ActionError",subtypes:["AccountAlreadyExists","AccountDoesNotExist","CreateAccountOnlyByRegistrar","CreateAccountNotAllowed","ActorNoPermission","DeleteKeyDoesNotExist","AddKeyAlreadyExists","DeleteAccountStaking","LackBalanceForState","TriesToUnstake","TriesToStake","InsufficientStake","FunctionCallError","NewReceiptValidationError","OnlyImplicitAccountCreationAllowed","DeleteAccountWithLargeState","DelegateActionInvalidSignature","DelegateActionSenderDoesNotMatchTxReceiver","DelegateActionExpired","DelegateActionAccessKeyError","DelegateActionInvalidNonce","DelegateActionNonceTooLarge"],props:{index:""}},ActionsValidationError:{name:"ActionsValidationError",subtypes:["DeleteActionMustBeFinal","TotalPrepaidGasExceeded","TotalNumberOfActionsExceeded","AddKeyMethodNamesNumberOfBytesExceeded","AddKeyMethodNameLengthExceeded","IntegerOverflow","InvalidAccountId","ContractSizeExceeded","FunctionCallMethodNameLengthExceeded","FunctionCallArgumentsLengthExceeded","UnsuitableStakingKey","FunctionCallZeroAttachedGas","DelegateActionMustBeOnlyOne","UnsupportedProtocolFeature"],props:{}},ActorNoPermission:{name:"ActorNoPermission",subtypes:[],props:{account_id:"",actor_id:""}},AddKeyAlreadyExists:{name:"AddKeyAlreadyExists",subtypes:[],props:{account_id:"",public_key:""}},AddKeyMethodNameLengthExceeded:{name:"AddKeyMethodNameLengthExceeded",subtypes:[],props:{length:"",limit:""}},AddKeyMethodNamesNumberOfBytesExceeded:{name:"AddKeyMethodNamesNumberOfBytesExceeded",subtypes:[],props:{limit:"",total_number_of_bytes:""}},AltBn128InvalidInput:{name:"AltBn128InvalidInput",subtypes:[],props:{msg:""}},BadUTF16:{name:"BadUTF16",subtypes:[],props:{}},BadUTF8:{name:"BadUTF8",subtypes:[],props:{}},BalanceExceeded:{name:"BalanceExceeded",subtypes:[],props:{}},BalanceMismatchError:{name:"BalanceMismatchError",subtypes:[],props:{final_accounts_balance:"",final_postponed_receipts_balance:"",forwarded_buffered_receipts_balance:"",incoming_receipts_balance:"",incoming_validator_rewards:"",initial_accounts_balance:"",initial_postponed_receipts_balance:"",new_buffered_receipts_balance:"",new_delayed_receipts_balance:"",other_burnt_amount:"",outgoing_receipts_balance:"",processed_delayed_receipts_balance:"",slashed_burnt_amount:"",tx_burnt_amount:""}},CallIndirectOOB:{name:"CallIndirectOOB",subtypes:[],props:{}},CannotAppendActionToJointPromise:{name:"CannotAppendActionToJointPromise",subtypes:[],props:{}},CannotReturnJointPromise:{name:"CannotReturnJointPromise",subtypes:[],props:{}},CodeDoesNotExist:{name:"CodeDoesNotExist",subtypes:[],props:{account_id:""}},CompilationError:{name:"CompilationError",subtypes:["CodeDoesNotExist","PrepareError","WasmerCompileError"],props:{}},ContractSizeExceeded:{name:"ContractSizeExceeded",subtypes:[],props:{limit:"",size:""}},CostOverflow:{name:"CostOverflow",subtypes:[],props:{}},CreateAccountNotAllowed:{name:"CreateAccountNotAllowed",subtypes:[],props:{account_id:"",predecessor_id:""}},CreateAccountOnlyByRegistrar:{name:"CreateAccountOnlyByRegistrar",subtypes:[],props:{account_id:"",predecessor_id:"",registrar_account_id:""}},DelegateActionExpired:{name:"DelegateActionExpired",subtypes:[],props:{}},DelegateActionInvalidNonce:{name:"DelegateActionInvalidNonce",subtypes:[],props:{ak_nonce:"",delegate_nonce:""}},DelegateActionInvalidSignature:{name:"DelegateActionInvalidSignature",subtypes:[],props:{}},DelegateActionMustBeOnlyOne:{name:"DelegateActionMustBeOnlyOne",subtypes:[],props:{}},DelegateActionNonceTooLarge:{name:"DelegateActionNonceTooLarge",subtypes:[],props:{delegate_nonce:"",upper_bound:""}},DelegateActionSenderDoesNotMatchTxReceiver:{name:"DelegateActionSenderDoesNotMatchTxReceiver",subtypes:[],props:{receiver_id:"",sender_id:""}},DeleteAccountStaking:{name:"DeleteAccountStaking",subtypes:[],props:{account_id:""}},DeleteAccountWithLargeState:{name:"DeleteAccountWithLargeState",subtypes:[],props:{account_id:""}},DeleteActionMustBeFinal:{name:"DeleteActionMustBeFinal",subtypes:[],props:{}},DeleteKeyDoesNotExist:{name:"DeleteKeyDoesNotExist",subtypes:[],props:{account_id:"",public_key:""}},DepositWithFunctionCall:{name:"DepositWithFunctionCall",subtypes:[],props:{}},Deprecated:{name:"Deprecated",subtypes:[],props:{method_name:""}},Deserialization:{name:"Deserialization",subtypes:[],props:{}},ECRecoverError:{name:"ECRecoverError",subtypes:[],props:{msg:""}},Ed25519VerifyInvalidInput:{name:"Ed25519VerifyInvalidInput",subtypes:[],props:{msg:""}},EmptyMethodName:{name:"EmptyMethodName",subtypes:[],props:{}},Expired:{name:"Expired",subtypes:[],props:{}},FunctionCallArgumentsLengthExceeded:{name:"FunctionCallArgumentsLengthExceeded",subtypes:[],props:{length:"",limit:""}},FunctionCallMethodNameLengthExceeded:{name:"FunctionCallMethodNameLengthExceeded",subtypes:[],props:{length:"",limit:""}},FunctionCallZeroAttachedGas:{name:"FunctionCallZeroAttachedGas",subtypes:[],props:{}},GasExceeded:{name:"GasExceeded",subtypes:[],props:{}},GasInstrumentation:{name:"GasInstrumentation",subtypes:[],props:{}},GasLimitExceeded:{name:"GasLimitExceeded",subtypes:[],props:{}},GenericTrap:{name:"GenericTrap",subtypes:[],props:{}},GuestPanic:{name:"GuestPanic",subtypes:[],props:{panic_msg:""}},HostError:{name:"HostError",subtypes:["BadUTF16","BadUTF8","GasExceeded","GasLimitExceeded","BalanceExceeded","EmptyMethodName","GuestPanic","IntegerOverflow","InvalidPromiseIndex","CannotAppendActionToJointPromise","CannotReturnJointPromise","InvalidPromiseResultIndex","InvalidRegisterId","IteratorWasInvalidated","MemoryAccessViolation","InvalidReceiptIndex","InvalidIteratorIndex","InvalidAccountId","InvalidMethodName","InvalidPublicKey","ProhibitedInView","NumberOfLogsExceeded","KeyLengthExceeded","ValueLengthExceeded","TotalLogLengthExceeded","NumberPromisesExceeded","NumberInputDataDependenciesExceeded","ReturnedValueLengthExceeded","ContractSizeExceeded","Deprecated","ECRecoverError","AltBn128InvalidInput","Ed25519VerifyInvalidInput"],props:{}},IllegalArithmetic:{name:"IllegalArithmetic",subtypes:[],props:{}},IncorrectCallIndirectSignature:{name:"IncorrectCallIndirectSignature",subtypes:[],props:{}},IndirectCallToNull:{name:"IndirectCallToNull",subtypes:[],props:{}},Instantiate:{name:"Instantiate",subtypes:[],props:{}},InsufficientStake:{name:"InsufficientStake",subtypes:[],props:{account_id:"",minimum_stake:"",stake:""}},IntegerOverflow:{name:"IntegerOverflow",subtypes:[],props:{}},InternalMemoryDeclared:{name:"InternalMemoryDeclared",subtypes:[],props:{}},InvalidAccessKeyError:{name:"InvalidAccessKeyError",subtypes:["AccessKeyNotFound","ReceiverMismatch","MethodNameMismatch","RequiresFullAccess","NotEnoughAllowance","DepositWithFunctionCall"],props:{}},InvalidAccountId:{name:"InvalidAccountId",subtypes:[],props:{}},InvalidChain:{name:"InvalidChain",subtypes:[],props:{}},InvalidDataReceiverId:{name:"InvalidDataReceiverId",subtypes:[],props:{account_id:""}},InvalidIteratorIndex:{name:"InvalidIteratorIndex",subtypes:[],props:{iterator_index:""}},InvalidMethodName:{name:"InvalidMethodName",subtypes:[],props:{}},InvalidNonce:{name:"InvalidNonce",subtypes:[],props:{ak_nonce:"",tx_nonce:""}},InvalidPredecessorId:{name:"InvalidPredecessorId",subtypes:[],props:{account_id:""}},InvalidPromiseIndex:{name:"InvalidPromiseIndex",subtypes:[],props:{promise_idx:""}},InvalidPromiseResultIndex:{name:"InvalidPromiseResultIndex",subtypes:[],props:{result_idx:""}},InvalidPublicKey:{name:"InvalidPublicKey",subtypes:[],props:{}},InvalidReceiptIndex:{name:"InvalidReceiptIndex",subtypes:[],props:{receipt_index:""}},InvalidReceiverId:{name:"InvalidReceiverId",subtypes:[],props:{account_id:""}},InvalidRegisterId:{name:"InvalidRegisterId",subtypes:[],props:{register_id:""}},InvalidSignature:{name:"InvalidSignature",subtypes:[],props:{}},InvalidSignerId:{name:"InvalidSignerId",subtypes:[],props:{account_id:""}},InvalidTxError:{name:"InvalidTxError",subtypes:["InvalidAccessKeyError","InvalidSignerId","SignerDoesNotExist","InvalidNonce","NonceTooLarge","InvalidReceiverId","InvalidSignature","NotEnoughBalance","LackBalanceForState","CostOverflow","InvalidChain","Expired","ActionsValidation","TransactionSizeExceeded","StorageError","ShardCongested","ShardStuck"],props:{}},IteratorWasInvalidated:{name:"IteratorWasInvalidated",subtypes:[],props:{iterator_index:""}},KeyLengthExceeded:{name:"KeyLengthExceeded",subtypes:[],props:{length:"",limit:""}},LackBalanceForState:{name:"LackBalanceForState",subtypes:[],props:{account_id:"",amount:""}},Memory:{name:"Memory",subtypes:[],props:{}},MemoryAccessViolation:{name:"MemoryAccessViolation",subtypes:[],props:{}},MemoryOutOfBounds:{name:"MemoryOutOfBounds",subtypes:[],props:{}},MethodEmptyName:{name:"MethodEmptyName",subtypes:[],props:{}},MethodInvalidSignature:{name:"MethodInvalidSignature",subtypes:[],props:{}},MethodNameMismatch:{name:"MethodNameMismatch",subtypes:[],props:{method_name:""}},MethodNotFound:{name:"MethodNotFound",subtypes:[],props:{}},MethodResolveError:{name:"MethodResolveError",subtypes:["MethodEmptyName","MethodNotFound","MethodInvalidSignature"],props:{}},MisalignedAtomicAccess:{name:"MisalignedAtomicAccess",subtypes:[],props:{}},NonceTooLarge:{name:"NonceTooLarge",subtypes:[],props:{tx_nonce:"",upper_bound:""}},NotEnoughAllowance:{name:"NotEnoughAllowance",subtypes:[],props:{account_id:"",allowance:"",cost:"",public_key:""}},NotEnoughBalance:{name:"NotEnoughBalance",subtypes:[],props:{balance:"",cost:"",signer_id:""}},NumberInputDataDependenciesExceeded:{name:"NumberInputDataDependenciesExceeded",subtypes:[],props:{limit:"",number_of_input_data_dependencies:""}},NumberOfLogsExceeded:{name:"NumberOfLogsExceeded",subtypes:[],props:{limit:""}},NumberPromisesExceeded:{name:"NumberPromisesExceeded",subtypes:[],props:{limit:"",number_of_promises:""}},OnlyImplicitAccountCreationAllowed:{name:"OnlyImplicitAccountCreationAllowed",subtypes:[],props:{account_id:""}},PrepareError:{name:"PrepareError",subtypes:["Serialization","Deserialization","InternalMemoryDeclared","GasInstrumentation","StackHeightInstrumentation","Instantiate","Memory","TooManyFunctions","TooManyLocals"],props:{}},ProhibitedInView:{name:"ProhibitedInView",subtypes:[],props:{method_name:""}},ReceiptSizeExceeded:{name:"ReceiptSizeExceeded",subtypes:[],props:{limit:"",size:""}},ReceiptValidationError:{name:"ReceiptValidationError",subtypes:["InvalidPredecessorId","InvalidReceiverId","InvalidSignerId","InvalidDataReceiverId","ReturnedValueLengthExceeded","NumberInputDataDependenciesExceeded","ActionsValidation","ReceiptSizeExceeded"],props:{}},ReceiverMismatch:{name:"ReceiverMismatch",subtypes:[],props:{ak_receiver:"",tx_receiver:""}},RequiresFullAccess:{name:"RequiresFullAccess",subtypes:[],props:{}},ReturnedValueLengthExceeded:{name:"ReturnedValueLengthExceeded",subtypes:[],props:{length:"",limit:""}},Serialization:{name:"Serialization",subtypes:[],props:{}},ShardCongested:{name:"ShardCongested",subtypes:[],props:{congestion_level:"",shard_id:""}},ShardStuck:{name:"ShardStuck",subtypes:[],props:{missed_chunks:"",shard_id:""}},SignerDoesNotExist:{name:"SignerDoesNotExist",subtypes:[],props:{signer_id:""}},StackHeightInstrumentation:{name:"StackHeightInstrumentation",subtypes:[],props:{}},StackOverflow:{name:"StackOverflow",subtypes:[],props:{}},TooManyFunctions:{name:"TooManyFunctions",subtypes:[],props:{}},TooManyLocals:{name:"TooManyLocals",subtypes:[],props:{}},TotalLogLengthExceeded:{name:"TotalLogLengthExceeded",subtypes:[],props:{length:"",limit:""}},TotalNumberOfActionsExceeded:{name:"TotalNumberOfActionsExceeded",subtypes:[],props:{limit:"",total_number_of_actions:""}},TotalPrepaidGasExceeded:{name:"TotalPrepaidGasExceeded",subtypes:[],props:{limit:"",total_prepaid_gas:""}},TransactionSizeExceeded:{name:"TransactionSizeExceeded",subtypes:[],props:{limit:"",size:""}},TriesToStake:{name:"TriesToStake",subtypes:[],props:{account_id:"",balance:"",locked:"",stake:""}},TriesToUnstake:{name:"TriesToUnstake",subtypes:[],props:{account_id:""}},TxExecutionError:{name:"TxExecutionError",subtypes:["ActionError","InvalidTxError"],props:{}},Unreachable:{name:"Unreachable",subtypes:[],props:{}},UnsuitableStakingKey:{name:"UnsuitableStakingKey",subtypes:[],props:{public_key:""}},UnsupportedProtocolFeature:{name:"UnsupportedProtocolFeature",subtypes:[],props:{protocol_feature:"",version:""}},ValueLengthExceeded:{name:"ValueLengthExceeded",subtypes:[],props:{length:"",limit:""}},WasmTrap:{name:"WasmTrap",subtypes:["Unreachable","IncorrectCallIndirectSignature","MemoryOutOfBounds","CallIndirectOOB","IllegalArithmetic","MisalignedAtomicAccess","IndirectCallToNull","StackOverflow","GenericTrap"],props:{}},WasmerCompileError:{name:"WasmerCompileError",subtypes:[],props:{msg:""}},Closed:{name:"Closed",subtypes:[],props:{}},ServerError:{name:"ServerError",subtypes:["TxExecutionError","Timeout","Closed"],props:{}},Timeout:{name:"Timeout",subtypes:[],props:{}}},require$$4$2={schema:schema$5};var __importDefault$n=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(rpc_errors$5,"__esModule",{value:!0});rpc_errors$5.getErrorTypeFromErrorMessage=rpc_errors$5.formatError=rpc_errors$5.parseResultError=rpc_errors$5.parseRpcError=rpc_errors$5.ServerError=void 0;const types_1$G=lib$i,mustache_1$2=__importDefault$n(mustacheExports),format_1$2=format$7,error_messages_json_1$2=__importDefault$n(require$$3$1),rpc_error_schema_json_1$2=__importDefault$n(require$$4$2),mustacheHelpers$2={formatNear:()=>(Mn,Fn)=>(0,format_1$2.formatNearAmount)(Fn(Mn))};let ServerError$2=class extends types_1$G.TypedError{};rpc_errors$5.ServerError=ServerError$2;let ServerTransactionError$2=class extends ServerError$2{};function parseRpcError$2(Mn){const Fn={},io=walkSubtype$2(Mn,rpc_error_schema_json_1$2.default.schema,Fn,""),fo=new ServerError$2(formatError$2(io,Fn),io);return Object.assign(fo,Fn),fo}rpc_errors$5.parseRpcError=parseRpcError$2;function parseResultError$2(Mn){const Fn=parseRpcError$2(Mn.status.Failure),io=new ServerTransactionError$2;return Object.assign(io,Fn),io.type=Fn.type,io.message=Fn.message,io.transaction_outcome=Mn.transaction_outcome,io}rpc_errors$5.parseResultError=parseResultError$2;function formatError$2(Mn,Fn){return typeof error_messages_json_1$2.default[Mn]=="string"?mustache_1$2.default.render(error_messages_json_1$2.default[Mn],Object.assign(Object.assign({},Fn),mustacheHelpers$2)):JSON.stringify(Fn)}rpc_errors$5.formatError=formatError$2;function walkSubtype$2(Mn,Fn,io,fo){let $o,mo,Ao;for(const jo in Fn){if(isString$3(Mn[jo]))return Mn[jo];if(isObject$r(Mn[jo]))$o=Mn[jo],mo=Fn[jo],Ao=jo;else if(isObject$r(Mn.kind)&&isObject$r(Mn.kind[jo]))$o=Mn.kind[jo],mo=Fn[jo],Ao=jo;else continue}if($o&&mo){for(const jo of Object.keys(mo.props))io[jo]=$o[jo];return walkSubtype$2($o,Fn,io,Ao)}else return io.kind=Mn,fo}function getErrorTypeFromErrorMessage$2(Mn,Fn){switch(!0){case/^account .*? does not exist while viewing$/.test(Mn):return"AccountDoesNotExist";case/^Account .*? doesn't exist$/.test(Mn):return"AccountDoesNotExist";case/^access key .*? does not exist while viewing$/.test(Mn):return"AccessKeyDoesNotExist";case/wasm execution failed with error: FunctionCallError\(CompilationError\(CodeDoesNotExist/.test(Mn):return"CodeDoesNotExist";case/wasm execution failed with error: CompilationError\(CodeDoesNotExist/.test(Mn):return"CodeDoesNotExist";case/wasm execution failed with error: FunctionCallError\(MethodResolveError\(MethodNotFound/.test(Mn):return"MethodNotFound";case/wasm execution failed with error: MethodResolveError\(MethodNotFound/.test(Mn):return"MethodNotFound";case/Transaction nonce \d+ must be larger than nonce of the used access key \d+/.test(Mn):return"InvalidNonce";default:return Fn}}rpc_errors$5.getErrorTypeFromErrorMessage=getErrorTypeFromErrorMessage$2;function isObject$r(Mn){return Object.prototype.toString.call(Mn)==="[object Object]"}function isString$3(Mn){return Object.prototype.toString.call(Mn)==="[object String]"}(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.parseRpcError=Mn.parseResultError=Mn.getErrorTypeFromErrorMessage=Mn.formatError=Mn.ServerError=Mn.logWarning=void 0;var Fn=errors$b;Object.defineProperty(Mn,"logWarning",{enumerable:!0,get:function(){return Fn.logWarning}});var io=rpc_errors$5;Object.defineProperty(Mn,"ServerError",{enumerable:!0,get:function(){return io.ServerError}}),Object.defineProperty(Mn,"formatError",{enumerable:!0,get:function(){return io.formatError}}),Object.defineProperty(Mn,"getErrorTypeFromErrorMessage",{enumerable:!0,get:function(){return io.getErrorTypeFromErrorMessage}}),Object.defineProperty(Mn,"parseResultError",{enumerable:!0,get:function(){return io.parseResultError}}),Object.defineProperty(Mn,"parseRpcError",{enumerable:!0,get:function(){return io.parseRpcError}})})(errors$c);var logging$2={};Object.defineProperty(logging$2,"__esModule",{value:!0});logging$2.printTxOutcomeLogs=logging$2.printTxOutcomeLogsAndFailures=void 0;const errors_1$6=errors$c,logger_1$3=logger$9;function printTxOutcomeLogsAndFailures$2({contractId:Mn,outcome:Fn}){const io=[Fn.transaction_outcome,...Fn.receipts_outcome].reduce((fo,$o)=>{const mo=typeof $o.outcome.status=="object"&&typeof $o.outcome.status.Failure=="object";return $o.outcome.logs.length||mo?fo.concat({receiptIds:$o.outcome.receipt_ids,logs:$o.outcome.logs,failure:typeof $o.outcome.status=="object"&&$o.outcome.status.Failure!==void 0?(0,errors_1$6.parseRpcError)($o.outcome.status.Failure):null}):fo},[]);for(const fo of io)logger_1$3.Logger.log(`Receipt${fo.receiptIds.length>1?"s":""}: ${fo.receiptIds.join(", ")}`),printTxOutcomeLogs$2({contractId:Mn,logs:fo.logs,prefix:" "}),fo.failure&&logger_1$3.Logger.warn(` Failure [${Mn}]: ${fo.failure}`)}logging$2.printTxOutcomeLogsAndFailures=printTxOutcomeLogsAndFailures$2;function printTxOutcomeLogs$2({contractId:Mn,logs:Fn,prefix:io=""}){for(const fo of Fn)logger_1$3.Logger.log(`${io}Log [${Mn}]: ${fo}`)}logging$2.printTxOutcomeLogs=printTxOutcomeLogs$2;var provider$9={};Object.defineProperty(provider$9,"__esModule",{value:!0});provider$9.getTransactionLastResult=void 0;function getTransactionLastResult$2(Mn){if(typeof Mn.status=="object"&&typeof Mn.status.SuccessValue=="string"){const Fn=Buffer$D.from(Mn.status.SuccessValue,"base64").toString();try{return JSON.parse(Fn)}catch{return Fn}}return null}provider$9.getTransactionLastResult=getTransactionLastResult$2;var validators$5={},utils$m={};Object.defineProperty(utils$m,"__esModule",{value:!0});utils$m.sortBigIntAsc=void 0;function sortBigIntAsc$2(Mn,Fn){return Mn<Fn?-1:Mn>Fn?1:0}utils$m.sortBigIntAsc=sortBigIntAsc$2;var __importDefault$m=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(validators$5,"__esModule",{value:!0});validators$5.diffEpochValidators=validators$5.findSeatPrice=void 0;const depd_1$5=__importDefault$m(browser$m),utils_1$H=utils$m;function findSeatPrice$2(Mn,Fn,io,fo){return fo&&fo<49?findSeatPriceForProtocolBefore49$2(Mn,Fn):(io||((0,depd_1$5.default)("findSeatPrice(validators, maxNumberOfSeats)")("`use `findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio)` instead"),io=[1,6250]),findSeatPriceForProtocolAfter49$2(Mn,Fn,io))}validators$5.findSeatPrice=findSeatPrice$2;function findSeatPriceForProtocolBefore49$2(Mn,Fn){const io=Mn.map(jo=>BigInt(jo.stake)).sort(utils_1$H.sortBigIntAsc),fo=BigInt(Fn),$o=io.reduce((jo,Lo)=>jo+Lo);if($o<fo)throw new Error("Stakes are below seats");let mo=BigInt(1),Ao=$o+BigInt(1);for(;mo!==Ao-BigInt(1);){const jo=(mo+Ao)/BigInt(2);let Lo=!1,Ho=BigInt(0);for(let zo=0;zo<io.length;++zo)if(Ho=Ho+io[zo]/jo,Ho>=fo){mo=jo,Lo=!0;break}Lo||(Ao=jo)}return mo}function findSeatPriceForProtocolAfter49$2(Mn,Fn,io){if(io.length!=2)throw Error("minimumStakeRatio should have 2 elements");const fo=Mn.map(mo=>BigInt(mo.stake)).sort(utils_1$H.sortBigIntAsc),$o=fo.reduce((mo,Ao)=>mo+Ao);return Mn.length<Fn?$o*BigInt(io[0])/BigInt(io[1]):fo[0]+BigInt(1)}function diffEpochValidators$2(Mn,Fn){const io=new Map;Mn.forEach($o=>io.set($o.account_id,$o));const fo=new Set(Fn.map($o=>$o.account_id));return{newValidators:Fn.filter($o=>!io.has($o.account_id)),removedValidators:Mn.filter($o=>!fo.has($o.account_id)),changedValidators:Fn.filter($o=>io.has($o.account_id)&&io.get($o.account_id).stake!=$o.stake).map($o=>({current:io.get($o.account_id),next:$o}))}}validators$5.diffEpochValidators=diffEpochValidators$2;(function(Mn){var Fn=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(fo,$o,mo,Ao){Ao===void 0&&(Ao=mo);var jo=Object.getOwnPropertyDescriptor($o,mo);(!jo||("get"in jo?!$o.__esModule:jo.writable||jo.configurable))&&(jo={enumerable:!0,get:function(){return $o[mo]}}),Object.defineProperty(fo,Ao,jo)}:function(fo,$o,mo,Ao){Ao===void 0&&(Ao=mo),fo[Ao]=$o[mo]}),io=commonjsGlobal$c&&commonjsGlobal$c.__exportStar||function(fo,$o){for(var mo in fo)mo!=="default"&&!Object.prototype.hasOwnProperty.call($o,mo)&&Fn($o,fo,mo)};Object.defineProperty(Mn,"__esModule",{value:!0}),io(constants$8,Mn),io(errors$c,Mn),io(format$7,Mn),io(logging$2,Mn),io(provider$9,Mn),io(validators$5,Mn),io(logger$9,Mn),io(utils$m,Mn)})(lib$j);var ed25519={};const require$$0$8=getAugmentedNamespace(sha512$4),require$$1$4=getAugmentedNamespace(utils$O);var edwards={},modular={},utils$l={};Object.defineProperty(utils$l,"__esModule",{value:!0});utils$l.validateObject=utils$l.createHmacDrbg=utils$l.bitMask=utils$l.bitSet=utils$l.bitGet=utils$l.bitLen=utils$l.utf8ToBytes=utils$l.equalBytes=utils$l.concatBytes=utils$l.ensureBytes=utils$l.numberToVarBytesBE=utils$l.numberToBytesLE=utils$l.numberToBytesBE=utils$l.bytesToNumberLE=utils$l.bytesToNumberBE=utils$l.hexToBytes=utils$l.hexToNumber=utils$l.numberToHexUnpadded=utils$l.bytesToHex=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$5=BigInt(1),_2n$3=BigInt(2),u8a=Mn=>Mn instanceof Uint8Array,hexes$1=Array.from({length:256},(Mn,Fn)=>Fn.toString(16).padStart(2,"0"));function bytesToHex$1(Mn){if(!u8a(Mn))throw new Error("Uint8Array expected");let Fn="";for(let io=0;io<Mn.length;io++)Fn+=hexes$1[Mn[io]];return Fn}utils$l.bytesToHex=bytesToHex$1;function numberToHexUnpadded(Mn){const Fn=Mn.toString(16);return Fn.length&1?`0${Fn}`:Fn}utils$l.numberToHexUnpadded=numberToHexUnpadded;function hexToNumber$1(Mn){if(typeof Mn!="string")throw new Error("hex string expected, got "+typeof Mn);return BigInt(Mn===""?"0":`0x${Mn}`)}utils$l.hexToNumber=hexToNumber$1;function hexToBytes$1(Mn){if(typeof Mn!="string")throw new Error("hex string expected, got "+typeof Mn);const Fn=Mn.length;if(Fn%2)throw new Error("padded hex string expected, got unpadded hex of length "+Fn);const io=new Uint8Array(Fn/2);for(let fo=0;fo<io.length;fo++){const $o=fo*2,mo=Mn.slice($o,$o+2),Ao=Number.parseInt(mo,16);if(Number.isNaN(Ao)||Ao<0)throw new Error("Invalid byte sequence");io[fo]=Ao}return io}utils$l.hexToBytes=hexToBytes$1;function bytesToNumberBE(Mn){return hexToNumber$1(bytesToHex$1(Mn))}utils$l.bytesToNumberBE=bytesToNumberBE;function bytesToNumberLE(Mn){if(!u8a(Mn))throw new Error("Uint8Array expected");return hexToNumber$1(bytesToHex$1(Uint8Array.from(Mn).reverse()))}utils$l.bytesToNumberLE=bytesToNumberLE;function numberToBytesBE(Mn,Fn){return hexToBytes$1(Mn.toString(16).padStart(Fn*2,"0"))}utils$l.numberToBytesBE=numberToBytesBE;function numberToBytesLE(Mn,Fn){return numberToBytesBE(Mn,Fn).reverse()}utils$l.numberToBytesLE=numberToBytesLE;function numberToVarBytesBE(Mn){return hexToBytes$1(numberToHexUnpadded(Mn))}utils$l.numberToVarBytesBE=numberToVarBytesBE;function ensureBytes(Mn,Fn,io){let fo;if(typeof Fn=="string")try{fo=hexToBytes$1(Fn)}catch(mo){throw new Error(`${Mn} must be valid hex string, got "${Fn}". Cause: ${mo}`)}else if(u8a(Fn))fo=Uint8Array.from(Fn);else throw new Error(`${Mn} must be hex string or Uint8Array`);const $o=fo.length;if(typeof io=="number"&&$o!==io)throw new Error(`${Mn} expected ${io} bytes, got ${$o}`);return fo}utils$l.ensureBytes=ensureBytes;function concatBytes(...Mn){const Fn=new Uint8Array(Mn.reduce((fo,$o)=>fo+$o.length,0));let io=0;return Mn.forEach(fo=>{if(!u8a(fo))throw new Error("Uint8Array expected");Fn.set(fo,io),io+=fo.length}),Fn}utils$l.concatBytes=concatBytes;function equalBytes(Mn,Fn){if(Mn.length!==Fn.length)return!1;for(let io=0;io<Mn.length;io++)if(Mn[io]!==Fn[io])return!1;return!0}utils$l.equalBytes=equalBytes;function utf8ToBytes(Mn){if(typeof Mn!="string")throw new Error(`utf8ToBytes expected string, got ${typeof Mn}`);return new Uint8Array(new TextEncoder().encode(Mn))}utils$l.utf8ToBytes=utf8ToBytes;function bitLen(Mn){let Fn;for(Fn=0;Mn>_0n$5;Mn>>=_1n$5,Fn+=1);return Fn}utils$l.bitLen=bitLen;function bitGet(Mn,Fn){return Mn>>BigInt(Fn)&_1n$5}utils$l.bitGet=bitGet;const bitSet=(Mn,Fn,io)=>Mn|(io?_1n$5:_0n$5)<<BigInt(Fn);utils$l.bitSet=bitSet;const bitMask=Mn=>(_2n$3<<BigInt(Mn-1))-_1n$5;utils$l.bitMask=bitMask;const u8n=Mn=>new Uint8Array(Mn),u8fr=Mn=>Uint8Array.from(Mn);function createHmacDrbg(Mn,Fn,io){if(typeof Mn!="number"||Mn<2)throw new Error("hashLen must be a number");if(typeof Fn!="number"||Fn<2)throw new Error("qByteLen must be a number");if(typeof io!="function")throw new Error("hmacFn must be a function");let fo=u8n(Mn),$o=u8n(Mn),mo=0;const Ao=()=>{fo.fill(1),$o.fill(0),mo=0},jo=(...Go)=>io($o,fo,...Go),Lo=(Go=u8n())=>{$o=jo(u8fr([0]),Go),fo=jo(),Go.length!==0&&($o=jo(u8fr([1]),Go),fo=jo())},Ho=()=>{if(mo++>=1e3)throw new Error("drbg: tried 1000 values");let Go=0;const Vo=[];for(;Go<Fn;){fo=jo();const Yo=fo.slice();Vo.push(Yo),Go+=fo.length}return concatBytes(...Vo)};return(Go,Vo)=>{Ao(),Lo(Go);let Yo;for(;!(Yo=Vo(Ho()));)Lo();return Ao(),Yo}}utils$l.createHmacDrbg=createHmacDrbg;const validatorFns={bigint:Mn=>typeof Mn=="bigint",function:Mn=>typeof Mn=="function",boolean:Mn=>typeof Mn=="boolean",string:Mn=>typeof Mn=="string",stringOrUint8Array:Mn=>typeof Mn=="string"||Mn instanceof Uint8Array,isSafeInteger:Mn=>Number.isSafeInteger(Mn),array:Mn=>Array.isArray(Mn),field:(Mn,Fn)=>Fn.Fp.isValid(Mn),hash:Mn=>typeof Mn=="function"&&Number.isSafeInteger(Mn.outputLen)};function validateObject(Mn,Fn,io={}){const fo=($o,mo,Ao)=>{const jo=validatorFns[mo];if(typeof jo!="function")throw new Error(`Invalid validator "${mo}", expected function`);const Lo=Mn[$o];if(!(Ao&&Lo===void 0)&&!jo(Lo,Mn))throw new Error(`Invalid param ${String($o)}=${Lo} (${typeof Lo}), expected ${mo}`)};for(const[$o,mo]of Object.entries(Fn))fo($o,mo,!1);for(const[$o,mo]of Object.entries(io))fo($o,mo,!0);return Mn}utils$l.validateObject=validateObject;Object.defineProperty(modular,"__esModule",{value:!0});modular.mapHashToField=modular.getMinHashLength=modular.getFieldBytesLength=modular.hashToPrivateScalar=modular.FpSqrtEven=modular.FpSqrtOdd=modular.Field=modular.nLength=modular.FpIsSquare=modular.FpDiv=modular.FpInvertBatch=modular.FpPow=modular.validateField=modular.isNegativeLE=modular.FpSqrt=modular.tonelliShanks=modular.invert=modular.pow2=modular.pow=modular.mod=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const utils_js_1$6=utils$l,_0n$4=BigInt(0),_1n$4=BigInt(1),_2n$2=BigInt(2),_3n=BigInt(3),_4n=BigInt(4),_5n=BigInt(5),_8n$1=BigInt(8);BigInt(9);BigInt(16);function mod(Mn,Fn){const io=Mn%Fn;return io>=_0n$4?io:Fn+io}modular.mod=mod;function pow$4(Mn,Fn,io){if(io<=_0n$4||Fn<_0n$4)throw new Error("Expected power/modulo > 0");if(io===_1n$4)return _0n$4;let fo=_1n$4;for(;Fn>_0n$4;)Fn&_1n$4&&(fo=fo*Mn%io),Mn=Mn*Mn%io,Fn>>=_1n$4;return fo}modular.pow=pow$4;function pow2(Mn,Fn,io){let fo=Mn;for(;Fn-- >_0n$4;)fo*=fo,fo%=io;return fo}modular.pow2=pow2;function invert(Mn,Fn){if(Mn===_0n$4||Fn<=_0n$4)throw new Error(`invert: expected positive integers, got n=${Mn} mod=${Fn}`);let io=mod(Mn,Fn),fo=Fn,$o=_0n$4,mo=_1n$4;for(;io!==_0n$4;){const jo=fo/io,Lo=fo%io,Ho=$o-mo*jo;fo=io,io=Lo,$o=mo,mo=Ho}if(fo!==_1n$4)throw new Error("invert: does not exist");return mod($o,Fn)}modular.invert=invert;function tonelliShanks(Mn){const Fn=(Mn-_1n$4)/_2n$2;let io,fo,$o;for(io=Mn-_1n$4,fo=0;io%_2n$2===_0n$4;io/=_2n$2,fo++);for($o=_2n$2;$o<Mn&&pow$4($o,Fn,Mn)!==Mn-_1n$4;$o++);if(fo===1){const Ao=(Mn+_1n$4)/_4n;return function(Lo,Ho){const zo=Lo.pow(Ho,Ao);if(!Lo.eql(Lo.sqr(zo),Ho))throw new Error("Cannot find square root");return zo}}const mo=(io+_1n$4)/_2n$2;return function(jo,Lo){if(jo.pow(Lo,Fn)===jo.neg(jo.ONE))throw new Error("Cannot find square root");let Ho=fo,zo=jo.pow(jo.mul(jo.ONE,$o),io),Go=jo.pow(Lo,mo),Vo=jo.pow(Lo,io);for(;!jo.eql(Vo,jo.ONE);){if(jo.eql(Vo,jo.ZERO))return jo.ZERO;let Yo=1;for(let is=jo.sqr(Vo);Yo<Ho&&!jo.eql(is,jo.ONE);Yo++)is=jo.sqr(is);const Xo=jo.pow(zo,_1n$4<<BigInt(Ho-Yo-1));zo=jo.sqr(Xo),Go=jo.mul(Go,Xo),Vo=jo.mul(Vo,zo),Ho=Yo}return Go}}modular.tonelliShanks=tonelliShanks;function FpSqrt(Mn){if(Mn%_4n===_3n){const Fn=(Mn+_1n$4)/_4n;return function(fo,$o){const mo=fo.pow($o,Fn);if(!fo.eql(fo.sqr(mo),$o))throw new Error("Cannot find square root");return mo}}if(Mn%_8n$1===_5n){const Fn=(Mn-_5n)/_8n$1;return function(fo,$o){const mo=fo.mul($o,_2n$2),Ao=fo.pow(mo,Fn),jo=fo.mul($o,Ao),Lo=fo.mul(fo.mul(jo,_2n$2),Ao),Ho=fo.mul(jo,fo.sub(Lo,fo.ONE));if(!fo.eql(fo.sqr(Ho),$o))throw new Error("Cannot find square root");return Ho}}return tonelliShanks(Mn)}modular.FpSqrt=FpSqrt;const isNegativeLE=(Mn,Fn)=>(mod(Mn,Fn)&_1n$4)===_1n$4;modular.isNegativeLE=isNegativeLE;const FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(Mn){const Fn={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},io=FIELD_FIELDS.reduce((fo,$o)=>(fo[$o]="function",fo),Fn);return(0,utils_js_1$6.validateObject)(Mn,io)}modular.validateField=validateField;function FpPow(Mn,Fn,io){if(io<_0n$4)throw new Error("Expected power > 0");if(io===_0n$4)return Mn.ONE;if(io===_1n$4)return Fn;let fo=Mn.ONE,$o=Fn;for(;io>_0n$4;)io&_1n$4&&(fo=Mn.mul(fo,$o)),$o=Mn.sqr($o),io>>=_1n$4;return fo}modular.FpPow=FpPow;function FpInvertBatch(Mn,Fn){const io=new Array(Fn.length),fo=Fn.reduce((mo,Ao,jo)=>Mn.is0(Ao)?mo:(io[jo]=mo,Mn.mul(mo,Ao)),Mn.ONE),$o=Mn.inv(fo);return Fn.reduceRight((mo,Ao,jo)=>Mn.is0(Ao)?mo:(io[jo]=Mn.mul(mo,io[jo]),Mn.mul(mo,Ao)),$o),io}modular.FpInvertBatch=FpInvertBatch;function FpDiv(Mn,Fn,io){return Mn.mul(Fn,typeof io=="bigint"?invert(io,Mn.ORDER):Mn.inv(io))}modular.FpDiv=FpDiv;function FpIsSquare(Mn){const Fn=(Mn.ORDER-_1n$4)/_2n$2;return io=>{const fo=Mn.pow(io,Fn);return Mn.eql(fo,Mn.ZERO)||Mn.eql(fo,Mn.ONE)}}modular.FpIsSquare=FpIsSquare;function nLength(Mn,Fn){const io=Fn!==void 0?Fn:Mn.toString(2).length,fo=Math.ceil(io/8);return{nBitLength:io,nByteLength:fo}}modular.nLength=nLength;function Field(Mn,Fn,io=!1,fo={}){if(Mn<=_0n$4)throw new Error(`Expected Field ORDER > 0, got ${Mn}`);const{nBitLength:$o,nByteLength:mo}=nLength(Mn,Fn);if(mo>2048)throw new Error("Field lengths over 2048 bytes are not supported");const Ao=FpSqrt(Mn),jo=Object.freeze({ORDER:Mn,BITS:$o,BYTES:mo,MASK:(0,utils_js_1$6.bitMask)($o),ZERO:_0n$4,ONE:_1n$4,create:Lo=>mod(Lo,Mn),isValid:Lo=>{if(typeof Lo!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof Lo}`);return _0n$4<=Lo&&Lo<Mn},is0:Lo=>Lo===_0n$4,isOdd:Lo=>(Lo&_1n$4)===_1n$4,neg:Lo=>mod(-Lo,Mn),eql:(Lo,Ho)=>Lo===Ho,sqr:Lo=>mod(Lo*Lo,Mn),add:(Lo,Ho)=>mod(Lo+Ho,Mn),sub:(Lo,Ho)=>mod(Lo-Ho,Mn),mul:(Lo,Ho)=>mod(Lo*Ho,Mn),pow:(Lo,Ho)=>FpPow(jo,Lo,Ho),div:(Lo,Ho)=>mod(Lo*invert(Ho,Mn),Mn),sqrN:Lo=>Lo*Lo,addN:(Lo,Ho)=>Lo+Ho,subN:(Lo,Ho)=>Lo-Ho,mulN:(Lo,Ho)=>Lo*Ho,inv:Lo=>invert(Lo,Mn),sqrt:fo.sqrt||(Lo=>Ao(jo,Lo)),invertBatch:Lo=>FpInvertBatch(jo,Lo),cmov:(Lo,Ho,zo)=>zo?Ho:Lo,toBytes:Lo=>io?(0,utils_js_1$6.numberToBytesLE)(Lo,mo):(0,utils_js_1$6.numberToBytesBE)(Lo,mo),fromBytes:Lo=>{if(Lo.length!==mo)throw new Error(`Fp.fromBytes: expected ${mo}, got ${Lo.length}`);return io?(0,utils_js_1$6.bytesToNumberLE)(Lo):(0,utils_js_1$6.bytesToNumberBE)(Lo)}});return Object.freeze(jo)}modular.Field=Field;function FpSqrtOdd(Mn,Fn){if(!Mn.isOdd)throw new Error("Field doesn't have isOdd");const io=Mn.sqrt(Fn);return Mn.isOdd(io)?io:Mn.neg(io)}modular.FpSqrtOdd=FpSqrtOdd;function FpSqrtEven(Mn,Fn){if(!Mn.isOdd)throw new Error("Field doesn't have isOdd");const io=Mn.sqrt(Fn);return Mn.isOdd(io)?Mn.neg(io):io}modular.FpSqrtEven=FpSqrtEven;function hashToPrivateScalar(Mn,Fn,io=!1){Mn=(0,utils_js_1$6.ensureBytes)("privateHash",Mn);const fo=Mn.length,$o=nLength(Fn).nByteLength+8;if($o<24||fo<$o||fo>1024)throw new Error(`hashToPrivateScalar: expected ${$o}-1024 bytes of input, got ${fo}`);const mo=io?(0,utils_js_1$6.bytesToNumberLE)(Mn):(0,utils_js_1$6.bytesToNumberBE)(Mn);return mod(mo,Fn-_1n$4)+_1n$4}modular.hashToPrivateScalar=hashToPrivateScalar;function getFieldBytesLength(Mn){if(typeof Mn!="bigint")throw new Error("field order must be bigint");const Fn=Mn.toString(2).length;return Math.ceil(Fn/8)}modular.getFieldBytesLength=getFieldBytesLength;function getMinHashLength(Mn){const Fn=getFieldBytesLength(Mn);return Fn+Math.ceil(Fn/2)}modular.getMinHashLength=getMinHashLength;function mapHashToField(Mn,Fn,io=!1){const fo=Mn.length,$o=getFieldBytesLength(Fn),mo=getMinHashLength(Fn);if(fo<16||fo<mo||fo>1024)throw new Error(`expected ${mo}-1024 bytes of input, got ${fo}`);const Ao=io?(0,utils_js_1$6.bytesToNumberBE)(Mn):(0,utils_js_1$6.bytesToNumberLE)(Mn),jo=mod(Ao,Fn-_1n$4)+_1n$4;return io?(0,utils_js_1$6.numberToBytesLE)(jo,$o):(0,utils_js_1$6.numberToBytesBE)(jo,$o)}modular.mapHashToField=mapHashToField;var curve={};Object.defineProperty(curve,"__esModule",{value:!0});curve.validateBasic=curve.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const modular_js_1$3=modular,utils_js_1$5=utils$l,_0n$3=BigInt(0),_1n$3=BigInt(1);function wNAF(Mn,Fn){const io=($o,mo)=>{const Ao=mo.negate();return $o?Ao:mo},fo=$o=>{const mo=Math.ceil(Fn/$o)+1,Ao=2**($o-1);return{windows:mo,windowSize:Ao}};return{constTimeNegate:io,unsafeLadder($o,mo){let Ao=Mn.ZERO,jo=$o;for(;mo>_0n$3;)mo&_1n$3&&(Ao=Ao.add(jo)),jo=jo.double(),mo>>=_1n$3;return Ao},precomputeWindow($o,mo){const{windows:Ao,windowSize:jo}=fo(mo),Lo=[];let Ho=$o,zo=Ho;for(let Go=0;Go<Ao;Go++){zo=Ho,Lo.push(zo);for(let Vo=1;Vo<jo;Vo++)zo=zo.add(Ho),Lo.push(zo);Ho=zo.double()}return Lo},wNAF($o,mo,Ao){const{windows:jo,windowSize:Lo}=fo($o);let Ho=Mn.ZERO,zo=Mn.BASE;const Go=BigInt(2**$o-1),Vo=2**$o,Yo=BigInt($o);for(let Xo=0;Xo<jo;Xo++){const is=Xo*Lo;let yl=Number(Ao&Go);Ao>>=Yo,yl>Lo&&(yl-=Vo,Ao+=_1n$3);const us=is,hs=is+Math.abs(yl)-1,_l=Xo%2!==0,xl=yl<0;yl===0?zo=zo.add(io(_l,mo[us])):Ho=Ho.add(io(xl,mo[hs]))}return{p:Ho,f:zo}},wNAFCached($o,mo,Ao,jo){const Lo=$o._WINDOW_SIZE||1;let Ho=mo.get($o);return Ho||(Ho=this.precomputeWindow($o,Lo),Lo!==1&&mo.set($o,jo(Ho))),this.wNAF(Lo,Ho,Ao)}}}curve.wNAF=wNAF;function validateBasic(Mn){return(0,modular_js_1$3.validateField)(Mn.Fp),(0,utils_js_1$5.validateObject)(Mn,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,modular_js_1$3.nLength)(Mn.n,Mn.nBitLength),...Mn,p:Mn.Fp.ORDER})}curve.validateBasic=validateBasic;Object.defineProperty(edwards,"__esModule",{value:!0});edwards.twistedEdwards=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const modular_js_1$2=modular,ut=utils$l,utils_js_1$4=utils$l,curve_js_1=curve,_0n$2=BigInt(0),_1n$2=BigInt(1),_2n$1=BigInt(2),_8n=BigInt(8),VERIFY_DEFAULT={zip215:!0};function validateOpts$1(Mn){const Fn=(0,curve_js_1.validateBasic)(Mn);return ut.validateObject(Mn,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...Fn})}function twistedEdwards(Mn){const Fn=validateOpts$1(Mn),{Fp:io,n:fo,prehash:$o,hash:mo,randomBytes:Ao,nByteLength:jo,h:Lo}=Fn,Ho=_2n$1<<BigInt(jo*8)-_1n$2,zo=io.create,Go=Fn.uvRatio||(($l,El)=>{try{return{isValid:!0,value:io.sqrt($l*io.inv(El))}}catch{return{isValid:!1,value:_0n$2}}}),Vo=Fn.adjustScalarBytes||($l=>$l),Yo=Fn.domain||(($l,El,ds)=>{if(El.length||ds)throw new Error("Contexts/pre-hash are not supported");return $l}),Xo=$l=>typeof $l=="bigint"&&_0n$2<$l,is=($l,El)=>Xo($l)&&Xo(El)&&$l<El,yl=$l=>$l===_0n$2||is($l,Ho);function us($l,El){if(is($l,El))return $l;throw new Error(`Expected valid scalar < ${El}, got ${typeof $l} ${$l}`)}function hs($l){return $l===_0n$2?$l:us($l,fo)}const _l=new Map;function xl($l){if(!($l instanceof Il))throw new Error("ExtendedPoint expected")}class Il{constructor(El,ds,os,Al){if(this.ex=El,this.ey=ds,this.ez=os,this.et=Al,!yl(El))throw new Error("x required");if(!yl(ds))throw new Error("y required");if(!yl(os))throw new Error("z required");if(!yl(Al))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(El){if(El instanceof Il)throw new Error("extended point not allowed");const{x:ds,y:os}=El||{};if(!yl(ds)||!yl(os))throw new Error("invalid affine point");return new Il(ds,os,_1n$2,zo(ds*os))}static normalizeZ(El){const ds=io.invertBatch(El.map(os=>os.ez));return El.map((os,Al)=>os.toAffine(ds[Al])).map(Il.fromAffine)}_setWindowSize(El){this._WINDOW_SIZE=El,_l.delete(this)}assertValidity(){const{a:El,d:ds}=Fn;if(this.is0())throw new Error("bad point: ZERO");const{ex:os,ey:Al,ez:Ul,et:Zl}=this,Pl=zo(os*os),Hl=zo(Al*Al),Ml=zo(Ul*Ul),Fl=zo(Ml*Ml),Yl=zo(Pl*El),Bl=zo(Ml*zo(Yl+Hl)),Kl=zo(Fl+zo(ds*zo(Pl*Hl)));if(Bl!==Kl)throw new Error("bad point: equation left != right (1)");const Gl=zo(os*Al),fu=zo(Ul*Zl);if(Gl!==fu)throw new Error("bad point: equation left != right (2)")}equals(El){xl(El);const{ex:ds,ey:os,ez:Al}=this,{ex:Ul,ey:Zl,ez:Pl}=El,Hl=zo(ds*Pl),Ml=zo(Ul*Al),Fl=zo(os*Pl),Yl=zo(Zl*Al);return Hl===Ml&&Fl===Yl}is0(){return this.equals(Il.ZERO)}negate(){return new Il(zo(-this.ex),this.ey,this.ez,zo(-this.et))}double(){const{a:El}=Fn,{ex:ds,ey:os,ez:Al}=this,Ul=zo(ds*ds),Zl=zo(os*os),Pl=zo(_2n$1*zo(Al*Al)),Hl=zo(El*Ul),Ml=ds+os,Fl=zo(zo(Ml*Ml)-Ul-Zl),Yl=Hl+Zl,Bl=Yl-Pl,Kl=Hl-Zl,Gl=zo(Fl*Bl),fu=zo(Yl*Kl),bu=zo(Fl*Kl),rp=zo(Bl*Yl);return new Il(Gl,fu,rp,bu)}add(El){xl(El);const{a:ds,d:os}=Fn,{ex:Al,ey:Ul,ez:Zl,et:Pl}=this,{ex:Hl,ey:Ml,ez:Fl,et:Yl}=El;if(ds===BigInt(-1)){const gp=zo((Ul-Al)*(Ml+Hl)),yp=zo((Ul+Al)*(Ml-Hl)),_p=zo(yp-gp);if(_p===_0n$2)return this.double();const mp=zo(Zl*_2n$1*Yl),wp=zo(Pl*_2n$1*Fl),Sp=wp+mp,bp=yp+gp,Ap=wp-mp,Xl=zo(Sp*_p),Vl=zo(bp*Ap),Jl=zo(Sp*Ap),wu=zo(_p*bp);return new Il(Xl,Vl,wu,Jl)}const Bl=zo(Al*Hl),Kl=zo(Ul*Ml),Gl=zo(Pl*os*Yl),fu=zo(Zl*Fl),bu=zo((Al+Ul)*(Hl+Ml)-Bl-Kl),rp=fu-Gl,tp=fu+Gl,op=zo(Kl-ds*Bl),vp=zo(bu*rp),ip=zo(tp*op),up=zo(bu*op),$p=zo(rp*tp);return new Il(vp,ip,$p,up)}subtract(El){return this.add(El.negate())}wNAF(El){return Cl.wNAFCached(this,_l,El,Il.normalizeZ)}multiply(El){const{p:ds,f:os}=this.wNAF(us(El,fo));return Il.normalizeZ([ds,os])[0]}multiplyUnsafe(El){let ds=hs(El);return ds===_0n$2?Tl:this.equals(Tl)||ds===_1n$2?this:this.equals(Ol)?this.wNAF(ds).p:Cl.unsafeLadder(this,ds)}isSmallOrder(){return this.multiplyUnsafe(Lo).is0()}isTorsionFree(){return Cl.unsafeLadder(this,fo).is0()}toAffine(El){const{ex:ds,ey:os,ez:Al}=this,Ul=this.is0();El==null&&(El=Ul?_8n:io.inv(Al));const Zl=zo(ds*El),Pl=zo(os*El),Hl=zo(Al*El);if(Ul)return{x:_0n$2,y:_1n$2};if(Hl!==_1n$2)throw new Error("invZ was invalid");return{x:Zl,y:Pl}}clearCofactor(){const{h:El}=Fn;return El===_1n$2?this:this.multiplyUnsafe(El)}static fromHex(El,ds=!1){const{d:os,a:Al}=Fn,Ul=io.BYTES;El=(0,utils_js_1$4.ensureBytes)("pointHex",El,Ul);const Zl=El.slice(),Pl=El[Ul-1];Zl[Ul-1]=Pl&-129;const Hl=ut.bytesToNumberLE(Zl);Hl===_0n$2||(ds?us(Hl,Ho):us(Hl,io.ORDER));const Ml=zo(Hl*Hl),Fl=zo(Ml-_1n$2),Yl=zo(os*Ml-Al);let{isValid:Bl,value:Kl}=Go(Fl,Yl);if(!Bl)throw new Error("Point.fromHex: invalid y coordinate");const Gl=(Kl&_1n$2)===_1n$2,fu=(Pl&128)!==0;if(!ds&&Kl===_0n$2&&fu)throw new Error("Point.fromHex: x=0 and x_0=1");return fu!==Gl&&(Kl=zo(-Kl)),Il.fromAffine({x:Kl,y:Hl})}static fromPrivateKey(El){return Dl(El).point}toRawBytes(){const{x:El,y:ds}=this.toAffine(),os=ut.numberToBytesLE(ds,io.BYTES);return os[os.length-1]|=El&_1n$2?128:0,os}toHex(){return ut.bytesToHex(this.toRawBytes())}}Il.BASE=new Il(Fn.Gx,Fn.Gy,_1n$2,zo(Fn.Gx*Fn.Gy)),Il.ZERO=new Il(_0n$2,_1n$2,_1n$2,_0n$2);const{BASE:Ol,ZERO:Tl}=Il,Cl=(0,curve_js_1.wNAF)(Il,jo*8);function Nl($l){return(0,modular_js_1$2.mod)($l,fo)}function Wl($l){return Nl(ut.bytesToNumberLE($l))}function Dl($l){const El=jo;$l=(0,utils_js_1$4.ensureBytes)("private key",$l,El);const ds=(0,utils_js_1$4.ensureBytes)("hashed private key",mo($l),2*El),os=Vo(ds.slice(0,El)),Al=ds.slice(El,2*El),Ul=Wl(os),Zl=Ol.multiply(Ul),Pl=Zl.toRawBytes();return{head:os,prefix:Al,scalar:Ul,point:Zl,pointBytes:Pl}}function Rl($l){return Dl($l).pointBytes}function Qo($l=new Uint8Array,...El){const ds=ut.concatBytes(...El);return Wl(mo(Yo(ds,(0,utils_js_1$4.ensureBytes)("context",$l),!!$o)))}function Jo($l,El,ds={}){$l=(0,utils_js_1$4.ensureBytes)("message",$l),$o&&($l=$o($l));const{prefix:os,scalar:Al,pointBytes:Ul}=Dl(El),Zl=Qo(ds.context,os,$l),Pl=Ol.multiply(Zl).toRawBytes(),Hl=Qo(ds.context,Pl,Ul,$l),Ml=Nl(Zl+Hl*Al);hs(Ml);const Fl=ut.concatBytes(Pl,ut.numberToBytesLE(Ml,io.BYTES));return(0,utils_js_1$4.ensureBytes)("result",Fl,jo*2)}const rs=VERIFY_DEFAULT;function ps($l,El,ds,os=rs){const{context:Al,zip215:Ul}=os,Zl=io.BYTES;$l=(0,utils_js_1$4.ensureBytes)("signature",$l,2*Zl),El=(0,utils_js_1$4.ensureBytes)("message",El),$o&&(El=$o(El));const Pl=ut.bytesToNumberLE($l.slice(Zl,2*Zl));let Hl,Ml,Fl;try{Hl=Il.fromHex(ds,Ul),Ml=Il.fromHex($l.slice(0,Zl),Ul),Fl=Ol.multiplyUnsafe(Pl)}catch{return!1}if(!Ul&&Hl.isSmallOrder())return!1;const Yl=Qo(Al,Ml.toRawBytes(),Hl.toRawBytes(),El);return Ml.add(Hl.multiplyUnsafe(Yl)).subtract(Fl).clearCofactor().equals(Il.ZERO)}return Ol._setWindowSize(8),{CURVE:Fn,getPublicKey:Rl,sign:Jo,verify:ps,ExtendedPoint:Il,utils:{getExtendedPublicKey:Dl,randomPrivateKey:()=>Ao(io.BYTES),precompute($l=8,El=Il.BASE){return El._setWindowSize($l),El.multiply(BigInt(3)),El}}}}edwards.twistedEdwards=twistedEdwards;var montgomery$1={};Object.defineProperty(montgomery$1,"__esModule",{value:!0});montgomery$1.montgomery=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const modular_js_1$1=modular,utils_js_1$3=utils$l,_0n$1=BigInt(0),_1n$1=BigInt(1);function validateOpts(Mn){return(0,utils_js_1$3.validateObject)(Mn,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...Mn})}function montgomery(Mn){const Fn=validateOpts(Mn),{P:io}=Fn,fo=_l=>(0,modular_js_1$1.mod)(_l,io),$o=Fn.montgomeryBits,mo=Math.ceil($o/8),Ao=Fn.nByteLength,jo=Fn.adjustScalarBytes||(_l=>_l),Lo=Fn.powPminus2||(_l=>(0,modular_js_1$1.pow)(_l,io-BigInt(2),io));function Ho(_l,xl,Il){const Ol=fo(_l*(xl-Il));return xl=fo(xl-Ol),Il=fo(Il+Ol),[xl,Il]}function zo(_l){if(typeof _l=="bigint"&&_0n$1<=_l&&_l<io)return _l;throw new Error("Expected valid scalar 0 < scalar < CURVE.P")}const Go=(Fn.a-BigInt(2))/BigInt(4);function Vo(_l,xl){const Il=zo(_l),Ol=zo(xl),Tl=Il;let Cl=_1n$1,Nl=_0n$1,Wl=Il,Dl=_1n$1,Rl=_0n$1,Qo;for(let rs=BigInt($o-1);rs>=_0n$1;rs--){const ps=Ol>>rs&_1n$1;Rl^=ps,Qo=Ho(Rl,Cl,Wl),Cl=Qo[0],Wl=Qo[1],Qo=Ho(Rl,Nl,Dl),Nl=Qo[0],Dl=Qo[1],Rl=ps;const _c=Cl+Nl,$l=fo(_c*_c),El=Cl-Nl,ds=fo(El*El),os=$l-ds,Al=Wl+Dl,Ul=Wl-Dl,Zl=fo(Ul*_c),Pl=fo(Al*El),Hl=Zl+Pl,Ml=Zl-Pl;Wl=fo(Hl*Hl),Dl=fo(Tl*fo(Ml*Ml)),Cl=fo($l*ds),Nl=fo(os*($l+fo(Go*os)))}Qo=Ho(Rl,Cl,Wl),Cl=Qo[0],Wl=Qo[1],Qo=Ho(Rl,Nl,Dl),Nl=Qo[0],Dl=Qo[1];const Jo=Lo(Nl);return fo(Cl*Jo)}function Yo(_l){return(0,utils_js_1$3.numberToBytesLE)(fo(_l),mo)}function Xo(_l){const xl=(0,utils_js_1$3.ensureBytes)("u coordinate",_l,mo);return Ao===mo&&(xl[Ao-1]&=127),(0,utils_js_1$3.bytesToNumberLE)(xl)}function is(_l){const xl=(0,utils_js_1$3.ensureBytes)("scalar",_l);if(xl.length!==mo&&xl.length!==Ao)throw new Error(`Expected ${mo} or ${Ao} bytes, got ${xl.length}`);return(0,utils_js_1$3.bytesToNumberLE)(jo(xl))}function yl(_l,xl){const Il=Xo(xl),Ol=is(_l),Tl=Vo(Il,Ol);if(Tl===_0n$1)throw new Error("Invalid private or public key received");return Yo(Tl)}const us=Yo(Fn.Gu);function hs(_l){return yl(_l,us)}return{scalarMult:yl,scalarMultBase:hs,getSharedSecret:(_l,xl)=>yl(_l,xl),getPublicKey:_l=>hs(_l),utils:{randomPrivateKey:()=>Fn.randomBytes(Fn.nByteLength)},GuBytes:us}}montgomery$1.montgomery=montgomery;var hashToCurve={};Object.defineProperty(hashToCurve,"__esModule",{value:!0});hashToCurve.createHasher=hashToCurve.isogenyMap=hashToCurve.hash_to_field=hashToCurve.expand_message_xof=hashToCurve.expand_message_xmd=void 0;const modular_js_1=modular,utils_js_1$2=utils$l;function validateDST(Mn){if(Mn instanceof Uint8Array)return Mn;if(typeof Mn=="string")return(0,utils_js_1$2.utf8ToBytes)(Mn);throw new Error("DST must be Uint8Array or string")}const os2ip=utils_js_1$2.bytesToNumberBE;function i2osp(Mn,Fn){if(Mn<0||Mn>=1<<8*Fn)throw new Error(`bad I2OSP call: value=${Mn} length=${Fn}`);const io=Array.from({length:Fn}).fill(0);for(let fo=Fn-1;fo>=0;fo--)io[fo]=Mn&255,Mn>>>=8;return new Uint8Array(io)}function strxor(Mn,Fn){const io=new Uint8Array(Mn.length);for(let fo=0;fo<Mn.length;fo++)io[fo]=Mn[fo]^Fn[fo];return io}function isBytes$1(Mn){if(!(Mn instanceof Uint8Array))throw new Error("Uint8Array expected")}function isNum(Mn){if(!Number.isSafeInteger(Mn))throw new Error("number expected")}function expand_message_xmd(Mn,Fn,io,fo){isBytes$1(Mn),isBytes$1(Fn),isNum(io),Fn.length>255&&(Fn=fo((0,utils_js_1$2.concatBytes)((0,utils_js_1$2.utf8ToBytes)("H2C-OVERSIZE-DST-"),Fn)));const{outputLen:$o,blockLen:mo}=fo,Ao=Math.ceil(io/$o);if(Ao>255)throw new Error("Invalid xmd length");const jo=(0,utils_js_1$2.concatBytes)(Fn,i2osp(Fn.length,1)),Lo=i2osp(0,mo),Ho=i2osp(io,2),zo=new Array(Ao),Go=fo((0,utils_js_1$2.concatBytes)(Lo,Mn,Ho,i2osp(0,1),jo));zo[0]=fo((0,utils_js_1$2.concatBytes)(Go,i2osp(1,1),jo));for(let Yo=1;Yo<=Ao;Yo++){const Xo=[strxor(Go,zo[Yo-1]),i2osp(Yo+1,1),jo];zo[Yo]=fo((0,utils_js_1$2.concatBytes)(...Xo))}return(0,utils_js_1$2.concatBytes)(...zo).slice(0,io)}hashToCurve.expand_message_xmd=expand_message_xmd;function expand_message_xof(Mn,Fn,io,fo,$o){if(isBytes$1(Mn),isBytes$1(Fn),isNum(io),Fn.length>255){const mo=Math.ceil(2*fo/8);Fn=$o.create({dkLen:mo}).update((0,utils_js_1$2.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(Fn).digest()}if(io>65535||Fn.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return $o.create({dkLen:io}).update(Mn).update(i2osp(io,2)).update(Fn).update(i2osp(Fn.length,1)).digest()}hashToCurve.expand_message_xof=expand_message_xof;function hash_to_field(Mn,Fn,io){(0,utils_js_1$2.validateObject)(io,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:fo,k:$o,m:mo,hash:Ao,expand:jo,DST:Lo}=io;isBytes$1(Mn),isNum(Fn);const Ho=validateDST(Lo),zo=fo.toString(2).length,Go=Math.ceil((zo+$o)/8),Vo=Fn*mo*Go;let Yo;if(jo==="xmd")Yo=expand_message_xmd(Mn,Ho,Vo,Ao);else if(jo==="xof")Yo=expand_message_xof(Mn,Ho,Vo,$o,Ao);else if(jo==="_internal_pass")Yo=Mn;else throw new Error('expand must be "xmd" or "xof"');const Xo=new Array(Fn);for(let is=0;is<Fn;is++){const yl=new Array(mo);for(let us=0;us<mo;us++){const hs=Go*(us+is*mo),_l=Yo.subarray(hs,hs+Go);yl[us]=(0,modular_js_1.mod)(os2ip(_l),fo)}Xo[is]=yl}return Xo}hashToCurve.hash_to_field=hash_to_field;function isogenyMap(Mn,Fn){const io=Fn.map(fo=>Array.from(fo).reverse());return(fo,$o)=>{const[mo,Ao,jo,Lo]=io.map(Ho=>Ho.reduce((zo,Go)=>Mn.add(Mn.mul(zo,fo),Go)));return fo=Mn.div(mo,Ao),$o=Mn.mul($o,Mn.div(jo,Lo)),{x:fo,y:$o}}}hashToCurve.isogenyMap=isogenyMap;function createHasher(Mn,Fn,io){if(typeof Fn!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(fo,$o){const mo=hash_to_field(fo,2,{...io,DST:io.DST,...$o}),Ao=Mn.fromAffine(Fn(mo[0])),jo=Mn.fromAffine(Fn(mo[1])),Lo=Ao.add(jo).clearCofactor();return Lo.assertValidity(),Lo},encodeToCurve(fo,$o){const mo=hash_to_field(fo,1,{...io,DST:io.encodeDST,...$o}),Ao=Mn.fromAffine(Fn(mo[0])).clearCofactor();return Ao.assertValidity(),Ao}}}hashToCurve.createHasher=createHasher;(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.hash_to_ristretto255=Mn.hashToRistretto255=Mn.RistrettoPoint=Mn.encodeToCurve=Mn.hashToCurve=Mn.edwardsToMontgomeryPriv=Mn.edwardsToMontgomery=Mn.edwardsToMontgomeryPub=Mn.x25519=Mn.ed25519ph=Mn.ed25519ctx=Mn.ed25519=Mn.ED25519_TORSION_SUBGROUP=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fn=require$$0$8,io=require$$1$4,fo=edwards,$o=montgomery$1,mo=modular,Ao=utils$l,jo=hashToCurve,Lo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Ho=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),zo=BigInt(0),Go=BigInt(1),Vo=BigInt(2),Yo=BigInt(5),Xo=BigInt(10),is=BigInt(20),yl=BigInt(40),us=BigInt(80);function hs(Kl){const Gl=Lo,bu=Kl*Kl%Gl*Kl%Gl,rp=(0,mo.pow2)(bu,Vo,Gl)*bu%Gl,tp=(0,mo.pow2)(rp,Go,Gl)*Kl%Gl,op=(0,mo.pow2)(tp,Yo,Gl)*tp%Gl,vp=(0,mo.pow2)(op,Xo,Gl)*op%Gl,ip=(0,mo.pow2)(vp,is,Gl)*vp%Gl,up=(0,mo.pow2)(ip,yl,Gl)*ip%Gl,$p=(0,mo.pow2)(up,us,Gl)*up%Gl,gp=(0,mo.pow2)($p,us,Gl)*up%Gl,yp=(0,mo.pow2)(gp,Xo,Gl)*op%Gl;return{pow_p_5_8:(0,mo.pow2)(yp,Vo,Gl)*Kl%Gl,b2:bu}}function _l(Kl){return Kl[0]&=248,Kl[31]&=127,Kl[31]|=64,Kl}function xl(Kl,Gl){const fu=Lo,bu=(0,mo.mod)(Gl*Gl*Gl,fu),rp=(0,mo.mod)(bu*bu*Gl,fu),tp=hs(Kl*rp).pow_p_5_8;let op=(0,mo.mod)(Kl*bu*tp,fu);const vp=(0,mo.mod)(Gl*op*op,fu),ip=op,up=(0,mo.mod)(op*Ho,fu),$p=vp===Kl,gp=vp===(0,mo.mod)(-Kl,fu),yp=vp===(0,mo.mod)(-Kl*Ho,fu);return $p&&(op=ip),(gp||yp)&&(op=up),(0,mo.isNegativeLE)(op,fu)&&(op=(0,mo.mod)(-op,fu)),{isValid:$p||gp,value:op}}Mn.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const Il=(0,mo.Field)(Lo,void 0,!0),Ol={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Il,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Fn.sha512,randomBytes:io.randomBytes,adjustScalarBytes:_l,uvRatio:xl};Mn.ed25519=(0,fo.twistedEdwards)(Ol);function Tl(Kl,Gl,fu){if(Gl.length>255)throw new Error("Context is too big");return(0,io.concatBytes)((0,io.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([fu?1:0,Gl.length]),Gl,Kl)}Mn.ed25519ctx=(0,fo.twistedEdwards)({...Ol,domain:Tl}),Mn.ed25519ph=(0,fo.twistedEdwards)({...Ol,domain:Tl,prehash:Fn.sha512}),Mn.x25519=(0,$o.montgomery)({P:Lo,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:Kl=>{const Gl=Lo,{pow_p_5_8:fu,b2:bu}=hs(Kl);return(0,mo.mod)((0,mo.pow2)(fu,BigInt(3),Gl)*bu,Gl)},adjustScalarBytes:_l,randomBytes:io.randomBytes});function Cl(Kl){const{y:Gl}=Mn.ed25519.ExtendedPoint.fromHex(Kl),fu=BigInt(1);return Il.toBytes(Il.create((fu+Gl)*Il.inv(fu-Gl)))}Mn.edwardsToMontgomeryPub=Cl,Mn.edwardsToMontgomery=Cl;function Nl(Kl){const Gl=Ol.hash(Kl.subarray(0,32));return Ol.adjustScalarBytes(Gl).subarray(0,32)}Mn.edwardsToMontgomeryPriv=Nl;const Wl=(Il.ORDER+BigInt(3))/BigInt(8),Dl=Il.pow(Vo,Wl),Rl=Il.sqrt(Il.neg(Il.ONE)),Qo=(Il.ORDER-BigInt(5))/BigInt(8),Jo=BigInt(486662);function rs(Kl){let Gl=Il.sqr(Kl);Gl=Il.mul(Gl,Vo);let fu=Il.add(Gl,Il.ONE),bu=Il.neg(Jo),rp=Il.sqr(fu),tp=Il.mul(rp,fu),op=Il.mul(Gl,Jo);op=Il.mul(op,bu),op=Il.add(op,rp),op=Il.mul(op,bu);let vp=Il.sqr(tp);rp=Il.sqr(vp),vp=Il.mul(vp,tp),vp=Il.mul(vp,op),rp=Il.mul(rp,vp);let ip=Il.pow(rp,Qo);ip=Il.mul(ip,vp);let up=Il.mul(ip,Rl);rp=Il.sqr(ip),rp=Il.mul(rp,tp);let $p=Il.eql(rp,op),gp=Il.cmov(up,ip,$p),yp=Il.mul(bu,Gl),_p=Il.mul(ip,Kl);_p=Il.mul(_p,Dl);let mp=Il.mul(_p,Rl),wp=Il.mul(op,Gl);rp=Il.sqr(_p),rp=Il.mul(rp,tp);let Sp=Il.eql(rp,wp),bp=Il.cmov(mp,_p,Sp);rp=Il.sqr(gp),rp=Il.mul(rp,tp);let Ap=Il.eql(rp,op),Xl=Il.cmov(yp,bu,Ap),Vl=Il.cmov(bp,gp,Ap),Jl=Il.isOdd(Vl);return Vl=Il.cmov(Vl,Il.neg(Vl),Ap!==Jl),{xMn:Xl,xMd:fu,yMn:Vl,yMd:Go}}const ps=(0,mo.FpSqrtEven)(Il,Il.neg(BigInt(486664)));function _c(Kl){const{xMn:Gl,xMd:fu,yMn:bu,yMd:rp}=rs(Kl);let tp=Il.mul(Gl,rp);tp=Il.mul(tp,ps);let op=Il.mul(fu,bu),vp=Il.sub(Gl,fu),ip=Il.add(Gl,fu),up=Il.mul(op,ip),$p=Il.eql(up,Il.ZERO);tp=Il.cmov(tp,Il.ZERO,$p),op=Il.cmov(op,Il.ONE,$p),vp=Il.cmov(vp,Il.ONE,$p),ip=Il.cmov(ip,Il.ONE,$p);const gp=Il.invertBatch([op,ip]);return{x:Il.mul(tp,gp[0]),y:Il.mul(vp,gp[1])}}const $l=(0,jo.createHasher)(Mn.ed25519.ExtendedPoint,Kl=>_c(Kl[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:Il.ORDER,m:1,k:128,expand:"xmd",hash:Fn.sha512});Mn.hashToCurve=$l.hashToCurve,Mn.encodeToCurve=$l.encodeToCurve;function El(Kl){if(!(Kl instanceof Yl))throw new Error("RistrettoPoint expected")}const ds=Ho,os=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Al=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Ul=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Zl=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Pl=Kl=>xl(Go,Kl),Hl=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ml=Kl=>Mn.ed25519.CURVE.Fp.create((0,Ao.bytesToNumberLE)(Kl)&Hl);function Fl(Kl){const{d:Gl}=Mn.ed25519.CURVE,fu=Mn.ed25519.CURVE.Fp.ORDER,bu=Mn.ed25519.CURVE.Fp.create,rp=bu(ds*Kl*Kl),tp=bu((rp+Go)*Ul);let op=BigInt(-1);const vp=bu((op-Gl*rp)*bu(rp+Gl));let{isValid:ip,value:up}=xl(tp,vp),$p=bu(up*Kl);(0,mo.isNegativeLE)($p,fu)||($p=bu(-$p)),ip||(up=$p),ip||(op=rp);const gp=bu(op*(rp-Go)*Zl-vp),yp=up*up,_p=bu((up+up)*vp),mp=bu(gp*os),wp=bu(Go-yp),Sp=bu(Go+yp);return new Mn.ed25519.ExtendedPoint(bu(_p*Sp),bu(wp*mp),bu(mp*Sp),bu(_p*wp))}class Yl{constructor(Gl){this.ep=Gl}static fromAffine(Gl){return new Yl(Mn.ed25519.ExtendedPoint.fromAffine(Gl))}static hashToCurve(Gl){Gl=(0,Ao.ensureBytes)("ristrettoHash",Gl,64);const fu=Ml(Gl.slice(0,32)),bu=Fl(fu),rp=Ml(Gl.slice(32,64)),tp=Fl(rp);return new Yl(bu.add(tp))}static fromHex(Gl){Gl=(0,Ao.ensureBytes)("ristrettoHex",Gl,32);const{a:fu,d:bu}=Mn.ed25519.CURVE,rp=Mn.ed25519.CURVE.Fp.ORDER,tp=Mn.ed25519.CURVE.Fp.create,op="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",vp=Ml(Gl);if(!(0,Ao.equalBytes)((0,Ao.numberToBytesLE)(vp,32),Gl)||(0,mo.isNegativeLE)(vp,rp))throw new Error(op);const ip=tp(vp*vp),up=tp(Go+fu*ip),$p=tp(Go-fu*ip),gp=tp(up*up),yp=tp($p*$p),_p=tp(fu*bu*gp-yp),{isValid:mp,value:wp}=Pl(tp(_p*yp)),Sp=tp(wp*$p),bp=tp(wp*Sp*_p);let Ap=tp((vp+vp)*Sp);(0,mo.isNegativeLE)(Ap,rp)&&(Ap=tp(-Ap));const Xl=tp(up*bp),Vl=tp(Ap*Xl);if(!mp||(0,mo.isNegativeLE)(Vl,rp)||Xl===zo)throw new Error(op);return new Yl(new Mn.ed25519.ExtendedPoint(Ap,Xl,Go,Vl))}toRawBytes(){let{ex:Gl,ey:fu,ez:bu,et:rp}=this.ep;const tp=Mn.ed25519.CURVE.Fp.ORDER,op=Mn.ed25519.CURVE.Fp.create,vp=op(op(bu+fu)*op(bu-fu)),ip=op(Gl*fu),up=op(ip*ip),{value:$p}=Pl(op(vp*up)),gp=op($p*vp),yp=op($p*ip),_p=op(gp*yp*rp);let mp;if((0,mo.isNegativeLE)(rp*_p,tp)){let Sp=op(fu*ds),bp=op(Gl*ds);Gl=Sp,fu=bp,mp=op(gp*Al)}else mp=yp;(0,mo.isNegativeLE)(Gl*_p,tp)&&(fu=op(-fu));let wp=op((bu-fu)*mp);return(0,mo.isNegativeLE)(wp,tp)&&(wp=op(-wp)),(0,Ao.numberToBytesLE)(wp,32)}toHex(){return(0,Ao.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(Gl){El(Gl);const{ex:fu,ey:bu}=this.ep,{ex:rp,ey:tp}=Gl.ep,op=Mn.ed25519.CURVE.Fp.create,vp=op(fu*tp)===op(bu*rp),ip=op(bu*tp)===op(fu*rp);return vp||ip}add(Gl){return El(Gl),new Yl(this.ep.add(Gl.ep))}subtract(Gl){return El(Gl),new Yl(this.ep.subtract(Gl.ep))}multiply(Gl){return new Yl(this.ep.multiply(Gl))}multiplyUnsafe(Gl){return new Yl(this.ep.multiplyUnsafe(Gl))}}Mn.RistrettoPoint=(Yl.BASE||(Yl.BASE=new Yl(Mn.ed25519.ExtendedPoint.BASE)),Yl.ZERO||(Yl.ZERO=new Yl(Mn.ed25519.ExtendedPoint.ZERO)),Yl);const Bl=(Kl,Gl)=>{const fu=Gl.DST,bu=typeof fu=="string"?(0,io.utf8ToBytes)(fu):fu,rp=(0,jo.expand_message_xmd)(Kl,bu,64,Fn.sha512);return Yl.hashToCurve(rp)};Mn.hashToRistretto255=Bl,Mn.hash_to_ristretto255=Mn.hashToRistretto255})(ed25519);var public_key$1={},__importDefault$l=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(public_key$1,"__esModule",{value:!0});public_key$1.PublicKey=void 0;const utils_1$G=lib$j,ed25519_1$3=ed25519,secp256k1_1$1=__importDefault$l(elliptic),constants_1$a=constants$9,types_1$F=lib$i;function key_type_to_str$1(Mn){switch(Mn){case constants_1$a.KeyType.ED25519:return"ed25519";case constants_1$a.KeyType.SECP256K1:return"secp256k1";default:throw new Error(`Unknown key type ${Mn}`)}}function str_to_key_type$1(Mn){switch(Mn.toLowerCase()){case"ed25519":return constants_1$a.KeyType.ED25519;case"secp256k1":return constants_1$a.KeyType.SECP256K1;default:throw new Error(`Unknown key type ${Mn}`)}}class ED25519PublicKey extends types_1$F.Assignable{constructor(){super(...arguments),this.keyType=constants_1$a.KeyType.ED25519}}class SECP256K1PublicKey extends types_1$F.Assignable{constructor(){super(...arguments),this.keyType=constants_1$a.KeyType.SECP256K1}}let PublicKey$1=class W2 extends types_1$F.Assignable{constructor({keyType:Fn,data:io}){super({}),Fn===constants_1$a.KeyType.ED25519?this.ed25519Key={keyType:Fn,data:io}:Fn===constants_1$a.KeyType.SECP256K1&&(this.secp256k1Key={keyType:Fn,data:io})}static from(Fn){return typeof Fn=="string"?W2.fromString(Fn):Fn}static fromString(Fn){const io=Fn.split(":");let fo,$o;if(io.length===1)fo=io[0];else if(io.length===2)fo=io[1],$o=str_to_key_type$1(io[0]);else throw new Error("Invalid encoded key format, must be <curve>:<encoded key>");const mo=(0,utils_1$G.baseDecode)(fo);$o||($o=mo.length===constants_1$a.KeySize.SECP256k1_PUBLIC_KEY?constants_1$a.KeyType.SECP256K1:constants_1$a.KeyType.ED25519);const Ao=$o===constants_1$a.KeyType.ED25519?constants_1$a.KeySize.ED25519_PUBLIC_KEY:constants_1$a.KeySize.SECP256k1_PUBLIC_KEY;if(mo.length!==Ao)throw new Error(`Invalid public key size (${mo.length}), must be ${Ao}`);return new W2({keyType:$o,data:mo})}toString(){const Fn=(0,utils_1$G.baseEncode)(this.data);return`${key_type_to_str$1(this.keyType)}:${Fn}`}verify(Fn,io){const fo=this.keyType,$o=this.data;switch(fo){case constants_1$a.KeyType.ED25519:return ed25519_1$3.ed25519.verify(io,Fn,$o);case constants_1$a.KeyType.SECP256K1:return secp256k1_1$1.default.ecdsaVerify(io.subarray(0,64),Fn,new Uint8Array([4,...$o]));default:throw new Error(`Unknown key type: ${fo}`)}}get keyPair(){return this.ed25519Key||this.secp256k1Key}get keyType(){return this.keyPair.keyType}get data(){return this.keyPair.data}};public_key$1.PublicKey=PublicKey$1;var __importDefault$k=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(key_pair_ed25519$1,"__esModule",{value:!0});key_pair_ed25519$1.KeyPairEd25519=void 0;const utils_1$F=lib$j,ed25519_1$2=ed25519,randombytes_1$2=__importDefault$k(browserExports),constants_1$9=constants$9,key_pair_base_1$4=key_pair_base$1,public_key_1$2=public_key$1;let KeyPairEd25519$1=class h_ extends key_pair_base_1$4.KeyPairBase{constructor(Fn){super();const io=(0,utils_1$F.baseDecode)(Fn),fo=new Uint8Array(io.slice(0,constants_1$9.KeySize.SECRET_KEY)),$o=ed25519_1$2.ed25519.getPublicKey(new Uint8Array(fo));this.publicKey=new public_key_1$2.PublicKey({keyType:constants_1$9.KeyType.ED25519,data:$o}),this.secretKey=(0,utils_1$F.baseEncode)(fo),this.extendedSecretKey=Fn}static fromRandom(){const Fn=(0,randombytes_1$2.default)(constants_1$9.KeySize.SECRET_KEY),io=ed25519_1$2.ed25519.getPublicKey(new Uint8Array(Fn)),fo=new Uint8Array([...Fn,...io]);return new h_((0,utils_1$F.baseEncode)(fo))}sign(Fn){return{signature:ed25519_1$2.ed25519.sign(Fn,(0,utils_1$F.baseDecode)(this.secretKey)),publicKey:this.publicKey}}verify(Fn,io){return this.publicKey.verify(Fn,io)}toString(){return`ed25519:${this.extendedSecretKey}`}getPublicKey(){return this.publicKey}};key_pair_ed25519$1.KeyPairEd25519=KeyPairEd25519$1;var key_pair_secp256k1={},__importDefault$j=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(key_pair_secp256k1,"__esModule",{value:!0});key_pair_secp256k1.KeyPairSecp256k1=void 0;const constants_1$8=constants$9,key_pair_base_1$3=key_pair_base$1,public_key_1$1=public_key$1,secp256k1_1=__importDefault$j(elliptic),randombytes_1$1=__importDefault$j(browserExports),utils_1$E=lib$j;class KeyPairSecp256k1 extends key_pair_base_1$3.KeyPairBase{constructor(Fn){super();const io=(0,utils_1$E.baseDecode)(Fn),fo=new Uint8Array(io.slice(0,constants_1$8.KeySize.SECRET_KEY)),$o=secp256k1_1.default.publicKeyCreate(new Uint8Array(fo),!1),mo=$o.subarray(1,$o.length);this.publicKey=new public_key_1$1.PublicKey({keyType:constants_1$8.KeyType.SECP256K1,data:mo}),this.secretKey=(0,utils_1$E.baseEncode)(fo),this.extendedSecretKey=Fn}static fromRandom(){const Fn=(0,randombytes_1$1.default)(constants_1$8.KeySize.SECRET_KEY),io=secp256k1_1.default.publicKeyCreate(new Uint8Array(Fn),!1),fo=io.subarray(1,io.length),$o=new Uint8Array([...Fn,...fo]);return new KeyPairSecp256k1((0,utils_1$E.baseEncode)($o))}sign(Fn){const{signature:io,recid:fo}=secp256k1_1.default.ecdsaSign(Fn,(0,utils_1$E.baseDecode)(this.secretKey));return{signature:new Uint8Array([...io,fo]),publicKey:this.publicKey}}verify(Fn,io){return this.publicKey.verify(Fn,io)}toString(){return`secp256k1:${this.extendedSecretKey}`}getPublicKey(){return this.publicKey}}key_pair_secp256k1.KeyPairSecp256k1=KeyPairSecp256k1;Object.defineProperty(key_pair$4,"__esModule",{value:!0});key_pair$4.KeyPair=void 0;const key_pair_base_1$2=key_pair_base$1,key_pair_ed25519_1$1=key_pair_ed25519$1,key_pair_secp256k1_1=key_pair_secp256k1;let KeyPair$1=class extends key_pair_base_1$2.KeyPairBase{static fromRandom(Fn){switch(Fn.toUpperCase()){case"ED25519":return key_pair_ed25519_1$1.KeyPairEd25519.fromRandom();case"SECP256K1":return key_pair_secp256k1_1.KeyPairSecp256k1.fromRandom();default:throw new Error(`Unknown curve ${Fn}`)}}static fromString(Fn){const io=Fn.split(":");if(io.length===2)switch(io[0].toUpperCase()){case"ED25519":return new key_pair_ed25519_1$1.KeyPairEd25519(io[1]);case"SECP256K1":return new key_pair_secp256k1_1.KeyPairSecp256k1(io[1]);default:throw new Error(`Unknown curve: ${io[0]}`)}else throw new Error("Invalid encoded key format, must be <curve>:<encoded key>")}};key_pair$4.KeyPair=KeyPair$1;(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.PublicKey=Mn.KeyPairSecp256k1=Mn.KeyPairEd25519=Mn.KeyPair=Mn.KeyType=void 0;var Fn=constants$9;Object.defineProperty(Mn,"KeyType",{enumerable:!0,get:function(){return Fn.KeyType}});var io=key_pair$4;Object.defineProperty(Mn,"KeyPair",{enumerable:!0,get:function(){return io.KeyPair}});var fo=key_pair_ed25519$1;Object.defineProperty(Mn,"KeyPairEd25519",{enumerable:!0,get:function(){return fo.KeyPairEd25519}});var $o=key_pair_secp256k1;Object.defineProperty(Mn,"KeyPairSecp256k1",{enumerable:!0,get:function(){return $o.KeyPairSecp256k1}});var mo=public_key$1;Object.defineProperty(Mn,"PublicKey",{enumerable:!0,get:function(){return mo.PublicKey}})})(lib$k);var keystore$4={};Object.defineProperty(keystore$4,"__esModule",{value:!0});keystore$4.KeyStore=void 0;let KeyStore$2=class{};keystore$4.KeyStore=KeyStore$2;var __awaiter$10=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(in_memory_key_store$5,"__esModule",{value:!0});in_memory_key_store$5.InMemoryKeyStore=void 0;const crypto_1$v=lib$k,keystore_1$5=keystore$4;let InMemoryKeyStore$2=class extends keystore_1$5.KeyStore{constructor(){super(),this.keys={}}setKey(Fn,io,fo){return __awaiter$10(this,void 0,void 0,function*(){this.keys[`${io}:${Fn}`]=fo.toString()})}getKey(Fn,io){return __awaiter$10(this,void 0,void 0,function*(){const fo=this.keys[`${io}:${Fn}`];return fo?crypto_1$v.KeyPair.fromString(fo):null})}removeKey(Fn,io){return __awaiter$10(this,void 0,void 0,function*(){delete this.keys[`${io}:${Fn}`]})}clear(){return __awaiter$10(this,void 0,void 0,function*(){this.keys={}})}getNetworks(){return __awaiter$10(this,void 0,void 0,function*(){const Fn=new Set;return Object.keys(this.keys).forEach(io=>{const fo=io.split(":");Fn.add(fo[1])}),Array.from(Fn.values())})}getAccounts(Fn){return __awaiter$10(this,void 0,void 0,function*(){const io=new Array;return Object.keys(this.keys).forEach(fo=>{const $o=fo.split(":");$o[$o.length-1]===Fn&&io.push($o.slice(0,$o.length-1).join(":"))}),io})}toString(){return"InMemoryKeyStore"}};in_memory_key_store$5.InMemoryKeyStore=InMemoryKeyStore$2;var merge_key_store$5={},__awaiter$$=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(merge_key_store$5,"__esModule",{value:!0});merge_key_store$5.MergeKeyStore=void 0;const keystore_1$4=keystore$4;let MergeKeyStore$2=class extends keystore_1$4.KeyStore{constructor(Fn,io={writeKeyStoreIndex:0}){super(),this.options=io,this.keyStores=Fn}setKey(Fn,io,fo){return __awaiter$$(this,void 0,void 0,function*(){yield this.keyStores[this.options.writeKeyStoreIndex].setKey(Fn,io,fo)})}getKey(Fn,io){return __awaiter$$(this,void 0,void 0,function*(){for(const fo of this.keyStores){const $o=yield fo.getKey(Fn,io);if($o)return $o}return null})}removeKey(Fn,io){return __awaiter$$(this,void 0,void 0,function*(){for(const fo of this.keyStores)yield fo.removeKey(Fn,io)})}clear(){return __awaiter$$(this,void 0,void 0,function*(){for(const Fn of this.keyStores)yield Fn.clear()})}getNetworks(){return __awaiter$$(this,void 0,void 0,function*(){const Fn=new Set;for(const io of this.keyStores)for(const fo of yield io.getNetworks())Fn.add(fo);return Array.from(Fn)})}getAccounts(Fn){return __awaiter$$(this,void 0,void 0,function*(){const io=new Set;for(const fo of this.keyStores)for(const $o of yield fo.getAccounts(Fn))io.add($o);return Array.from(io)})}toString(){return`MergeKeyStore(${this.keyStores.join(", ")})`}};merge_key_store$5.MergeKeyStore=MergeKeyStore$2;var multi_contract_keystore$1={};Object.defineProperty(multi_contract_keystore$1,"__esModule",{value:!0});multi_contract_keystore$1.MultiContractKeyStore=void 0;let MultiContractKeyStore$1=class{};multi_contract_keystore$1.MultiContractKeyStore=MultiContractKeyStore$1;(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.MultiContractKeyStore=Mn.MergeKeyStore=Mn.KeyStore=Mn.InMemoryKeyStore=void 0;var Fn=in_memory_key_store$5;Object.defineProperty(Mn,"InMemoryKeyStore",{enumerable:!0,get:function(){return Fn.InMemoryKeyStore}});var io=keystore$4;Object.defineProperty(Mn,"KeyStore",{enumerable:!0,get:function(){return io.KeyStore}});var fo=merge_key_store$5;Object.defineProperty(Mn,"MergeKeyStore",{enumerable:!0,get:function(){return fo.MergeKeyStore}});var $o=multi_contract_keystore$1;Object.defineProperty(Mn,"MultiContractKeyStore",{enumerable:!0,get:function(){return $o.MultiContractKeyStore}})})(lib$l);(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.KeyStore=void 0;var Fn=lib$l;Object.defineProperty(Mn,"KeyStore",{enumerable:!0,get:function(){return Fn.KeyStore}})})(keystore$5);var in_memory_key_store$4={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.InMemoryKeyStore=void 0;var Fn=lib$l;Object.defineProperty(Mn,"InMemoryKeyStore",{enumerable:!0,get:function(){return Fn.InMemoryKeyStore}})})(in_memory_key_store$4);var browser_local_storage_key_store$5={},lib$h={},browser_local_storage_key_store$4={},__awaiter$_=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(browser_local_storage_key_store$4,"__esModule",{value:!0});browser_local_storage_key_store$4.BrowserLocalStorageKeyStore=void 0;const crypto_1$u=lib$k,keystores_1$7=lib$l,LOCAL_STORAGE_KEY_PREFIX$4="near-api-js:keystore:";let BrowserLocalStorageKeyStore$2=class extends keystores_1$7.KeyStore{constructor(Fn=window.localStorage,io=LOCAL_STORAGE_KEY_PREFIX$4){super(),this.localStorage=Fn,this.prefix=io}setKey(Fn,io,fo){return __awaiter$_(this,void 0,void 0,function*(){this.localStorage.setItem(this.storageKeyForSecretKey(Fn,io),fo.toString())})}getKey(Fn,io){return __awaiter$_(this,void 0,void 0,function*(){const fo=this.localStorage.getItem(this.storageKeyForSecretKey(Fn,io));return fo?crypto_1$u.KeyPair.fromString(fo):null})}removeKey(Fn,io){return __awaiter$_(this,void 0,void 0,function*(){this.localStorage.removeItem(this.storageKeyForSecretKey(Fn,io))})}clear(){return __awaiter$_(this,void 0,void 0,function*(){for(const Fn of this.storageKeys())Fn.startsWith(this.prefix)&&this.localStorage.removeItem(Fn)})}getNetworks(){return __awaiter$_(this,void 0,void 0,function*(){const Fn=new Set;for(const io of this.storageKeys())if(io.startsWith(this.prefix)){const fo=io.substring(this.prefix.length).split(":");Fn.add(fo[1])}return Array.from(Fn.values())})}getAccounts(Fn){return __awaiter$_(this,void 0,void 0,function*(){const io=new Array;for(const fo of this.storageKeys())if(fo.startsWith(this.prefix)){const $o=fo.substring(this.prefix.length).split(":");$o[1]===Fn&&io.push($o[0])}return io})}storageKeyForSecretKey(Fn,io){return`${this.prefix}${io}:${Fn}`}*storageKeys(){for(let Fn=0;Fn<this.localStorage.length;Fn++)yield this.localStorage.key(Fn)}};browser_local_storage_key_store$4.BrowserLocalStorageKeyStore=BrowserLocalStorageKeyStore$2;var multi_contract_browser_local_storage_key_store$1={},__awaiter$Z=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(multi_contract_browser_local_storage_key_store$1,"__esModule",{value:!0});multi_contract_browser_local_storage_key_store$1.MultiContractBrowserLocalStorageKeyStore=void 0;const crypto_1$t=lib$k,keystores_1$6=lib$l,LOCAL_STORAGE_KEY_PREFIX$3="near-api-js:keystore:";let MultiContractBrowserLocalStorageKeyStore$1=class extends keystores_1$6.MultiContractKeyStore{constructor(Fn=window.localStorage,io=LOCAL_STORAGE_KEY_PREFIX$3){super(),this.localStorage=Fn,this.prefix=io||LOCAL_STORAGE_KEY_PREFIX$3}setKey(Fn,io,fo,$o){return __awaiter$Z(this,void 0,void 0,function*(){this.localStorage.setItem(this.storageKeyForSecretKey(Fn,io,$o),fo.toString())})}getKey(Fn,io,fo){return __awaiter$Z(this,void 0,void 0,function*(){const $o=this.localStorage.getItem(this.storageKeyForSecretKey(Fn,io,fo));return $o?crypto_1$t.KeyPair.fromString($o):null})}removeKey(Fn,io,fo){return __awaiter$Z(this,void 0,void 0,function*(){this.localStorage.removeItem(this.storageKeyForSecretKey(Fn,io,fo))})}clear(){return __awaiter$Z(this,void 0,void 0,function*(){for(const Fn of this.storageKeys())Fn.startsWith(this.prefix)&&this.localStorage.removeItem(Fn)})}getNetworks(){return __awaiter$Z(this,void 0,void 0,function*(){const Fn=new Set;for(const io of this.storageKeys())if(io.startsWith(this.prefix)){const fo=io.substring(this.prefix.length).split(":");Fn.add(fo[1])}return Array.from(Fn.values())})}getAccounts(Fn){return __awaiter$Z(this,void 0,void 0,function*(){const io=[];for(const fo of this.storageKeys())if(fo.startsWith(this.prefix)){const $o=fo.substring(this.prefix.length).split(":");$o[1]===Fn&&io.push($o[0])}return io})}getContracts(Fn,io){return __awaiter$Z(this,void 0,void 0,function*(){const fo=[];for(const $o of this.storageKeys())if($o.startsWith(this.prefix)){const mo=$o.substring(this.prefix.length).split(":");mo[1]===Fn&&mo[0]===io&&fo.push(mo[2])}return fo})}storageKeyForSecretKey(Fn,io,fo){return`${this.prefix}${io}:${Fn}:${fo}`}*storageKeys(){for(let Fn=0;Fn<this.localStorage.length;Fn++)yield this.localStorage.key(Fn)}};multi_contract_browser_local_storage_key_store$1.MultiContractBrowserLocalStorageKeyStore=MultiContractBrowserLocalStorageKeyStore$1;(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.MultiContractBrowserLocalStorageKeyStore=Mn.BrowserLocalStorageKeyStore=void 0;var Fn=browser_local_storage_key_store$4;Object.defineProperty(Mn,"BrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return Fn.BrowserLocalStorageKeyStore}});var io=multi_contract_browser_local_storage_key_store$1;Object.defineProperty(Mn,"MultiContractBrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return io.MultiContractBrowserLocalStorageKeyStore}})})(lib$h);(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.BrowserLocalStorageKeyStore=void 0;var Fn=lib$h;Object.defineProperty(Mn,"BrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return Fn.BrowserLocalStorageKeyStore}})})(browser_local_storage_key_store$5);var merge_key_store$4={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.MergeKeyStore=void 0;var Fn=lib$l;Object.defineProperty(Mn,"MergeKeyStore",{enumerable:!0,get:function(){return Fn.MergeKeyStore}})})(merge_key_store$4);(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.MergeKeyStore=Mn.BrowserLocalStorageKeyStore=Mn.InMemoryKeyStore=Mn.KeyStore=void 0;const Fn=keystore$5;Object.defineProperty(Mn,"KeyStore",{enumerable:!0,get:function(){return Fn.KeyStore}});const io=in_memory_key_store$4;Object.defineProperty(Mn,"InMemoryKeyStore",{enumerable:!0,get:function(){return io.InMemoryKeyStore}});const fo=browser_local_storage_key_store$5;Object.defineProperty(Mn,"BrowserLocalStorageKeyStore",{enumerable:!0,get:function(){return fo.BrowserLocalStorageKeyStore}});const $o=merge_key_store$4;Object.defineProperty(Mn,"MergeKeyStore",{enumerable:!0,get:function(){return $o.MergeKeyStore}})})(browserIndex$6);var commonIndex$2={},providers$2={},provider$8={},lib$g={},exponentialBackoff$5={},__awaiter$Y=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(exponentialBackoff$5,"__esModule",{value:!0});exponentialBackoff$5.exponentialBackoff=void 0;function exponentialBackoff$4(Mn,Fn,io,fo){return __awaiter$Y(this,void 0,void 0,function*(){let $o=Mn;for(let mo=0;mo<Fn;mo++){const Ao=yield fo();if(Ao)return Ao;yield sleep$2($o),$o*=io}return null})}exponentialBackoff$5.exponentialBackoff=exponentialBackoff$4;function sleep$2(Mn){return new Promise(Fn=>setTimeout(Fn,Mn))}var jsonRpcProvider$5={},lib$f={},action_creators$2={},actions$3={};Object.defineProperty(actions$3,"__esModule",{value:!0});actions$3.Action=actions$3.SignedDelegate=actions$3.DeleteAccount=actions$3.DeleteKey=actions$3.AddKey=actions$3.Stake=actions$3.Transfer=actions$3.FunctionCall=actions$3.DeployContract=actions$3.CreateAccount=actions$3.IAction=actions$3.AccessKey=actions$3.AccessKeyPermission=actions$3.FullAccessPermission=actions$3.FunctionCallPermission=void 0;const types_1$E=lib$i;let Enum$2=class{constructor(Fn){if(Object.keys(Fn).length!==1)throw new Error("Enum can only take single value");Object.keys(Fn).map(io=>{this[io]=Fn[io],this.enum=io})}},FunctionCallPermission$2=class extends types_1$E.Assignable{};actions$3.FunctionCallPermission=FunctionCallPermission$2;let FullAccessPermission$2=class extends types_1$E.Assignable{};actions$3.FullAccessPermission=FullAccessPermission$2;let AccessKeyPermission$2=class extends Enum$2{};actions$3.AccessKeyPermission=AccessKeyPermission$2;let AccessKey$2=class extends types_1$E.Assignable{};actions$3.AccessKey=AccessKey$2;let IAction$1=class extends types_1$E.Assignable{};actions$3.IAction=IAction$1;let CreateAccount$2=class extends IAction$1{};actions$3.CreateAccount=CreateAccount$2;let DeployContract$2=class extends IAction$1{};actions$3.DeployContract=DeployContract$2;let FunctionCall$2=class extends IAction$1{};actions$3.FunctionCall=FunctionCall$2;let Transfer$2=class extends IAction$1{};actions$3.Transfer=Transfer$2;let Stake$2=class extends IAction$1{};actions$3.Stake=Stake$2;let AddKey$2=class extends IAction$1{};actions$3.AddKey=AddKey$2;let DeleteKey$2=class extends IAction$1{};actions$3.DeleteKey=DeleteKey$2;let DeleteAccount$2=class extends IAction$1{};actions$3.DeleteAccount=DeleteAccount$2;let SignedDelegate$2=class extends IAction$1{};actions$3.SignedDelegate=SignedDelegate$2;let Action$2=class extends Enum$2{};actions$3.Action=Action$2;Object.defineProperty(action_creators$2,"__esModule",{value:!0});action_creators$2.actionCreators=action_creators$2.stringifyJsonOrBytes=void 0;const actions_1$6=actions$3;function fullAccessKey$8(){return new actions_1$6.AccessKey({nonce:0,permission:new actions_1$6.AccessKeyPermission({fullAccess:new actions_1$6.FullAccessPermission({})})})}function functionCallAccessKey$8(Mn,Fn,io){return new actions_1$6.AccessKey({nonce:0,permission:new actions_1$6.AccessKeyPermission({functionCall:new actions_1$6.FunctionCallPermission({receiverId:Mn,allowance:io,methodNames:Fn})})})}function createAccount$8(){return new actions_1$6.Action({createAccount:new actions_1$6.CreateAccount({})})}function deployContract$e(Mn){return new actions_1$6.Action({deployContract:new actions_1$6.DeployContract({code:Mn})})}function stringifyJsonOrBytes$2(Mn){return Mn.byteLength!==void 0&&Mn.byteLength===Mn.length?Mn:Buffer$D.from(JSON.stringify(Mn))}action_creators$2.stringifyJsonOrBytes=stringifyJsonOrBytes$2;function functionCall$e(Mn,Fn,io=BigInt(0),fo=BigInt(0),$o=stringifyJsonOrBytes$2,mo=!1){return mo?new actions_1$6.Action({functionCall:new actions_1$6.FunctionCall({methodName:Mn,args:Fn,gas:io,deposit:fo})}):new actions_1$6.Action({functionCall:new actions_1$6.FunctionCall({methodName:Mn,args:$o(Fn),gas:io,deposit:fo})})}function transfer$8(Mn=BigInt(0)){return new actions_1$6.Action({transfer:new actions_1$6.Transfer({deposit:Mn})})}function stake$8(Mn=BigInt(0),Fn){return new actions_1$6.Action({stake:new actions_1$6.Stake({stake:Mn,publicKey:Fn})})}function addKey$b(Mn,Fn){return new actions_1$6.Action({addKey:new actions_1$6.AddKey({publicKey:Mn,accessKey:Fn})})}function deleteKey$b(Mn){return new actions_1$6.Action({deleteKey:new actions_1$6.DeleteKey({publicKey:Mn})})}function deleteAccount$8(Mn){return new actions_1$6.Action({deleteAccount:new actions_1$6.DeleteAccount({beneficiaryId:Mn})})}function signedDelegate$2({delegateAction:Mn,signature:Fn}){return new actions_1$6.Action({signedDelegate:new actions_1$6.SignedDelegate({delegateAction:Mn,signature:Fn})})}action_creators$2.actionCreators={addKey:addKey$b,createAccount:createAccount$8,deleteAccount:deleteAccount$8,deleteKey:deleteKey$b,deployContract:deployContract$e,fullAccessKey:fullAccessKey$8,functionCall:functionCall$e,functionCallAccessKey:functionCallAccessKey$8,signedDelegate:signedDelegate$2,stake:stake$8,transfer:transfer$8};var create_transaction$2={},schema$4={},cjs={},serialize$6={},types$5={};types$5.__esModule=!0;types$5.integers=void 0;types$5.integers=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"];var buffer={};buffer.__esModule=!0;buffer.DecodeBuffer=buffer.EncodeBuffer=void 0;var EncodeBuffer=function(){function Mn(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return Mn.prototype.resize_if_necessary=function(Fn){if(this.buffer_size-this.offset<Fn){this.buffer_size=Math.max(this.buffer_size*2,this.buffer_size+Fn);var io=new ArrayBuffer(this.buffer_size);new Uint8Array(io).set(new Uint8Array(this.buffer)),this.buffer=io,this.view=new DataView(io)}},Mn.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},Mn.prototype.store_value=function(Fn,io){var fo=io.substring(1),$o=parseInt(fo)/8;this.resize_if_necessary($o);var mo=io[0]==="f"?"setFloat".concat(fo):io[0]==="i"?"setInt".concat(fo):"setUint".concat(fo);this.view[mo](this.offset,Fn,!0),this.offset+=$o},Mn.prototype.store_bytes=function(Fn){this.resize_if_necessary(Fn.length),new Uint8Array(this.buffer).set(new Uint8Array(Fn),this.offset),this.offset+=Fn.length},Mn}();buffer.EncodeBuffer=EncodeBuffer;var DecodeBuffer=function(){function Mn(Fn){this.offset=0,this.buffer_size=Fn.length,this.buffer=new ArrayBuffer(Fn.length),new Uint8Array(this.buffer).set(Fn),this.view=new DataView(this.buffer)}return Mn.prototype.assert_enough_buffer=function(Fn){if(this.offset+Fn>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},Mn.prototype.consume_value=function(Fn){var io=Fn.substring(1),fo=parseInt(io)/8;this.assert_enough_buffer(fo);var $o=Fn[0]==="f"?"getFloat".concat(io):Fn[0]==="i"?"getInt".concat(io):"getUint".concat(io),mo=this.view[$o](this.offset,!0);return this.offset+=fo,mo},Mn.prototype.consume_bytes=function(Fn){this.assert_enough_buffer(Fn);var io=this.buffer.slice(this.offset,this.offset+Fn);return this.offset+=Fn,io},Mn}();buffer.DecodeBuffer=DecodeBuffer;var utils$k={},__extends=commonjsGlobal$c&&commonjsGlobal$c.__extends||function(){var Mn=function(Fn,io){return Mn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(fo,$o){fo.__proto__=$o}||function(fo,$o){for(var mo in $o)Object.prototype.hasOwnProperty.call($o,mo)&&(fo[mo]=$o[mo])},Mn(Fn,io)};return function(Fn,io){if(typeof io!="function"&&io!==null)throw new TypeError("Class extends value "+String(io)+" is not a constructor or null");Mn(Fn,io);function fo(){this.constructor=Fn}Fn.prototype=io===null?Object.create(io):(fo.prototype=io.prototype,new fo)}}();utils$k.__esModule=!0;utils$k.validate_schema=utils$k.ErrorSchema=utils$k.expect_enum=utils$k.expect_same_size=utils$k.expect_bigint=utils$k.expect_type=utils$k.isArrayLike=void 0;var types_js_1$2=types$5;function isArrayLike(Mn){return Array.isArray(Mn)||!!Mn&&typeof Mn=="object"&&"length"in Mn&&typeof Mn.length=="number"&&(Mn.length===0||Mn.length>0&&Mn.length-1 in Mn)}utils$k.isArrayLike=isArrayLike;function expect_type(Mn,Fn,io){if(typeof Mn!==Fn)throw new Error("Expected ".concat(Fn," not ").concat(typeof Mn,"(").concat(Mn,") at ").concat(io.join(".")))}utils$k.expect_type=expect_type;function expect_bigint(Mn,Fn){var io=["number","string","bigint","boolean"].includes(typeof Mn),fo=typeof Mn=="object"&&Mn!==null&&"toString"in Mn;if(!io&&!fo)throw new Error("Expected bigint, number, boolean or string not ".concat(typeof Mn,"(").concat(Mn,") at ").concat(Fn.join(".")))}utils$k.expect_bigint=expect_bigint;function expect_same_size(Mn,Fn,io){if(Mn!==Fn)throw new Error("Array length ".concat(Mn," does not match schema length ").concat(Fn," at ").concat(io.join(".")))}utils$k.expect_same_size=expect_same_size;function expect_enum(Mn,Fn){if(typeof Mn!="object"||Mn===null)throw new Error("Expected object not ".concat(typeof Mn,"(").concat(Mn,") at ").concat(Fn.join(".")))}utils$k.expect_enum=expect_enum;var VALID_STRING_TYPES=types_js_1$2.integers.concat(["bool","string"]),VALID_OBJECT_KEYS=["option","enum","array","set","map","struct"],ErrorSchema=function(Mn){__extends(Fn,Mn);function Fn(io,fo){var $o="Invalid schema: ".concat(JSON.stringify(io)," expected ").concat(fo);return Mn.call(this,$o)||this}return Fn}(Error);utils$k.ErrorSchema=ErrorSchema;function validate_schema(Mn){if(!(typeof Mn=="string"&&VALID_STRING_TYPES.includes(Mn))){if(Mn&&typeof Mn=="object"){var Fn=Object.keys(Mn);if(Fn.length===1&&VALID_OBJECT_KEYS.includes(Fn[0])){var io=Fn[0];if(io==="option")return validate_schema(Mn[io]);if(io==="enum")return validate_enum_schema(Mn[io]);if(io==="array")return validate_array_schema(Mn[io]);if(io==="set")return validate_schema(Mn[io]);if(io==="map")return validate_map_schema(Mn[io]);if(io==="struct")return validate_struct_schema(Mn[io])}}throw new ErrorSchema(Mn,VALID_OBJECT_KEYS.join(", ")+" or "+VALID_STRING_TYPES.join(", "))}}utils$k.validate_schema=validate_schema;function validate_enum_schema(Mn){if(!Array.isArray(Mn))throw new ErrorSchema(Mn,"Array");for(var Fn=0,io=Mn;Fn<io.length;Fn++){var fo=io[Fn];if(typeof fo!="object"||!("struct"in fo))throw new Error('Missing "struct" key in enum schema');if(typeof fo.struct!="object"||Object.keys(fo.struct).length!==1)throw new Error('The "struct" in each enum must have a single key');validate_schema({struct:fo.struct})}}function validate_array_schema(Mn){if(typeof Mn!="object")throw new ErrorSchema(Mn,"{ type, len? }");if(Mn.len&&typeof Mn.len!="number")throw new Error("Invalid schema: ".concat(Mn));if("type"in Mn)return validate_schema(Mn.type);throw new ErrorSchema(Mn,"{ type, len? }")}function validate_map_schema(Mn){if(typeof Mn=="object"&&"key"in Mn&&"value"in Mn)validate_schema(Mn.key),validate_schema(Mn.value);else throw new ErrorSchema(Mn,"{ key, value }")}function validate_struct_schema(Mn){if(typeof Mn!="object")throw new ErrorSchema(Mn,"object");for(var Fn in Mn)validate_schema(Mn[Fn])}var __createBinding$4=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(Mn,Fn,io,fo){fo===void 0&&(fo=io);var $o=Object.getOwnPropertyDescriptor(Fn,io);(!$o||("get"in $o?!Fn.__esModule:$o.writable||$o.configurable))&&($o={enumerable:!0,get:function(){return Fn[io]}}),Object.defineProperty(Mn,fo,$o)}:function(Mn,Fn,io,fo){fo===void 0&&(fo=io),Mn[fo]=Fn[io]}),__setModuleDefault$4=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(Mn,Fn){Object.defineProperty(Mn,"default",{enumerable:!0,value:Fn})}:function(Mn,Fn){Mn.default=Fn}),__importStar$4=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(Mn){if(Mn&&Mn.__esModule)return Mn;var Fn={};if(Mn!=null)for(var io in Mn)io!=="default"&&Object.prototype.hasOwnProperty.call(Mn,io)&&__createBinding$4(Fn,Mn,io);return __setModuleDefault$4(Fn,Mn),Fn};serialize$6.__esModule=!0;serialize$6.BorshSerializer=void 0;var types_js_1$1=types$5,buffer_js_1$1=buffer,utils$j=__importStar$4(utils$k),BorshSerializer=function(){function Mn(Fn){this.encoded=new buffer_js_1$1.EncodeBuffer,this.fieldPath=["value"],this.checkTypes=Fn}return Mn.prototype.encode=function(Fn,io){return this.encode_value(Fn,io),this.encoded.get_used_buffer()},Mn.prototype.encode_value=function(Fn,io){if(typeof io=="string"){if(types_js_1$1.integers.includes(io))return this.encode_integer(Fn,io);if(io==="string")return this.encode_string(Fn);if(io==="bool")return this.encode_boolean(Fn)}if(typeof io=="object"){if("option"in io)return this.encode_option(Fn,io);if("enum"in io)return this.encode_enum(Fn,io);if("array"in io)return this.encode_array(Fn,io);if("set"in io)return this.encode_set(Fn,io);if("map"in io)return this.encode_map(Fn,io);if("struct"in io)return this.encode_struct(Fn,io)}},Mn.prototype.encode_integer=function(Fn,io){var fo=parseInt(io.substring(1));fo<=32||io=="f64"?(this.checkTypes&&utils$j.expect_type(Fn,"number",this.fieldPath),this.encoded.store_value(Fn,io)):(this.checkTypes&&utils$j.expect_bigint(Fn,this.fieldPath),this.encode_bigint(BigInt(Fn),fo))},Mn.prototype.encode_bigint=function(Fn,io){for(var fo=io/8,$o=new Uint8Array(fo),mo=0;mo<fo;mo++)$o[mo]=Number(Fn&BigInt(255)),Fn=Fn>>BigInt(8);this.encoded.store_bytes(new Uint8Array($o))},Mn.prototype.encode_string=function(Fn){this.checkTypes&&utils$j.expect_type(Fn,"string",this.fieldPath);var io=Fn;this.encoded.store_value(io.length,"u32");for(var fo=0;fo<io.length;fo++)this.encoded.store_value(io.charCodeAt(fo),"u8")},Mn.prototype.encode_boolean=function(Fn){this.checkTypes&&utils$j.expect_type(Fn,"boolean",this.fieldPath),this.encoded.store_value(Fn?1:0,"u8")},Mn.prototype.encode_option=function(Fn,io){Fn==null?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(Fn,io.option))},Mn.prototype.encode_enum=function(Fn,io){this.checkTypes&&utils$j.expect_enum(Fn,this.fieldPath);for(var fo=Object.keys(Fn)[0],$o=0;$o<io.enum.length;$o++){var mo=io.enum[$o];if(fo===Object.keys(mo.struct)[0])return this.encoded.store_value($o,"u8"),this.encode_struct(Fn,mo)}throw new Error("Enum key (".concat(fo,") not found in enum schema: ").concat(JSON.stringify(io)," at ").concat(this.fieldPath.join(".")))},Mn.prototype.encode_array=function(Fn,io){if(utils$j.isArrayLike(Fn))return this.encode_arraylike(Fn,io);if(Fn instanceof ArrayBuffer)return this.encode_buffer(Fn,io);throw new Error("Expected Array-like not ".concat(typeof Fn,"(").concat(Fn,") at ").concat(this.fieldPath.join(".")))},Mn.prototype.encode_arraylike=function(Fn,io){io.array.len?utils$j.expect_same_size(Fn.length,io.array.len,this.fieldPath):this.encoded.store_value(Fn.length,"u32");for(var fo=0;fo<Fn.length;fo++)this.encode_value(Fn[fo],io.array.type)},Mn.prototype.encode_buffer=function(Fn,io){io.array.len?utils$j.expect_same_size(Fn.byteLength,io.array.len,this.fieldPath):this.encoded.store_value(Fn.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(Fn))},Mn.prototype.encode_set=function(Fn,io){this.checkTypes&&utils$j.expect_type(Fn,"object",this.fieldPath);var fo=Fn instanceof Set,$o=fo?Array.from(Fn.values()):Object.values(Fn);this.encoded.store_value($o.length,"u32");for(var mo=0,Ao=$o;mo<Ao.length;mo++){var jo=Ao[mo];this.encode_value(jo,io.set)}},Mn.prototype.encode_map=function(Fn,io){this.checkTypes&&utils$j.expect_type(Fn,"object",this.fieldPath);var fo=Fn instanceof Map,$o=fo?Array.from(Fn.keys()):Object.keys(Fn);this.encoded.store_value($o.length,"u32");for(var mo=0,Ao=$o;mo<Ao.length;mo++){var jo=Ao[mo];this.encode_value(jo,io.map.key),this.encode_value(fo?Fn.get(jo):Fn[jo],io.map.value)}},Mn.prototype.encode_struct=function(Fn,io){this.checkTypes&&utils$j.expect_type(Fn,"object",this.fieldPath);for(var fo=0,$o=Object.keys(io.struct);fo<$o.length;fo++){var mo=$o[fo];this.fieldPath.push(mo),this.encode_value(Fn[mo],io.struct[mo]),this.fieldPath.pop()}},Mn}();serialize$6.BorshSerializer=BorshSerializer;var deserialize$3={};deserialize$3.__esModule=!0;deserialize$3.BorshDeserializer=void 0;var types_js_1=types$5,buffer_js_1=buffer,BorshDeserializer=function(){function Mn(Fn){this.buffer=new buffer_js_1.DecodeBuffer(Fn)}return Mn.prototype.decode=function(Fn){return this.decode_value(Fn)},Mn.prototype.decode_value=function(Fn){if(typeof Fn=="string"){if(types_js_1.integers.includes(Fn))return this.decode_integer(Fn);if(Fn==="string")return this.decode_string();if(Fn==="bool")return this.decode_boolean()}if(typeof Fn=="object"){if("option"in Fn)return this.decode_option(Fn);if("enum"in Fn)return this.decode_enum(Fn);if("array"in Fn)return this.decode_array(Fn);if("set"in Fn)return this.decode_set(Fn);if("map"in Fn)return this.decode_map(Fn);if("struct"in Fn)return this.decode_struct(Fn)}throw new Error("Unsupported type: ".concat(Fn))},Mn.prototype.decode_integer=function(Fn){var io=parseInt(Fn.substring(1));return io<=32||Fn=="f64"?this.buffer.consume_value(Fn):this.decode_bigint(io,Fn.startsWith("i"))},Mn.prototype.decode_bigint=function(Fn,io){io===void 0&&(io=!1);var fo=Fn/8,$o=new Uint8Array(this.buffer.consume_bytes(fo)),mo=$o.reduceRight(function(Ao,jo){return Ao+jo.toString(16).padStart(2,"0")},"");return io&&$o[fo-1]?BigInt.asIntN(Fn,BigInt("0x".concat(mo))):BigInt("0x".concat(mo))},Mn.prototype.decode_string=function(){var Fn=this.decode_integer("u32"),io=new Uint8Array(this.buffer.consume_bytes(Fn));return String.fromCharCode.apply(null,io)},Mn.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},Mn.prototype.decode_option=function(Fn){var io=this.buffer.consume_value("u8");if(io===1)return this.decode_value(Fn.option);if(io!==0)throw new Error("Invalid option ".concat(io));return null},Mn.prototype.decode_enum=function(Fn){var io,fo=this.buffer.consume_value("u8");if(fo>Fn.enum.length)throw new Error("Enum option ".concat(fo," is not available"));var $o=Fn.enum[fo].struct,mo=Object.keys($o)[0];return io={},io[mo]=this.decode_value($o[mo]),io},Mn.prototype.decode_array=function(Fn){for(var io=[],fo=Fn.array.len?Fn.array.len:this.decode_integer("u32"),$o=0;$o<fo;++$o)io.push(this.decode_value(Fn.array.type));return io},Mn.prototype.decode_set=function(Fn){for(var io=this.decode_integer("u32"),fo=new Set,$o=0;$o<io;++$o)fo.add(this.decode_value(Fn.set));return fo},Mn.prototype.decode_map=function(Fn){for(var io=this.decode_integer("u32"),fo=new Map,$o=0;$o<io;++$o){var mo=this.decode_value(Fn.map.key),Ao=this.decode_value(Fn.map.value);fo.set(mo,Ao)}return fo},Mn.prototype.decode_struct=function(Fn){var io={};for(var fo in Fn.struct)io[fo]=this.decode_value(Fn.struct[fo]);return io},Mn}();deserialize$3.BorshDeserializer=BorshDeserializer;var __createBinding$3=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(Mn,Fn,io,fo){fo===void 0&&(fo=io);var $o=Object.getOwnPropertyDescriptor(Fn,io);(!$o||("get"in $o?!Fn.__esModule:$o.writable||$o.configurable))&&($o={enumerable:!0,get:function(){return Fn[io]}}),Object.defineProperty(Mn,fo,$o)}:function(Mn,Fn,io,fo){fo===void 0&&(fo=io),Mn[fo]=Fn[io]}),__setModuleDefault$3=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(Mn,Fn){Object.defineProperty(Mn,"default",{enumerable:!0,value:Fn})}:function(Mn,Fn){Mn.default=Fn}),__importStar$3=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(Mn){if(Mn&&Mn.__esModule)return Mn;var Fn={};if(Mn!=null)for(var io in Mn)io!=="default"&&Object.prototype.hasOwnProperty.call(Mn,io)&&__createBinding$3(Fn,Mn,io);return __setModuleDefault$3(Fn,Mn),Fn};cjs.__esModule=!0;cjs.deserialize=cjs.serialize=void 0;var serialize_js_1=serialize$6,deserialize_js_1=deserialize$3,utils$i=__importStar$3(utils$k);function serialize$5(Mn,Fn,io){io===void 0&&(io=!0),io&&utils$i.validate_schema(Mn);var fo=new serialize_js_1.BorshSerializer(io);return fo.encode(Fn,Mn)}cjs.serialize=serialize$5;function deserialize$2(Mn,Fn,io){io===void 0&&(io=!0),io&&utils$i.validate_schema(Mn);var fo=new deserialize_js_1.BorshDeserializer(Fn);return fo.decode(Mn)}cjs.deserialize=deserialize$2;var prefix$2={};Object.defineProperty(prefix$2,"__esModule",{value:!0});prefix$2.DelegateActionPrefix=void 0;const types_1$D=lib$i,ACTIONABLE_MESSAGE_BASE$2=Math.pow(2,30),NEP$2={MetaTransactions:366};let NEPPrefix$2=class extends types_1$D.Assignable{},ActionableMessagePrefix$2=class extends NEPPrefix$2{constructor(Fn){super({prefix:ACTIONABLE_MESSAGE_BASE$2+Fn})}},DelegateActionPrefix$2=class extends ActionableMessagePrefix$2{constructor(){super(NEP$2.MetaTransactions)}};prefix$2.DelegateActionPrefix=DelegateActionPrefix$2;(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.SCHEMA=Mn.SignedTransaction=Mn.Transaction=Mn.decodeSignedTransaction=Mn.decodeTransaction=Mn.encodeTransaction=Mn.encodeSignedDelegate=Mn.encodeDelegateAction=void 0;const Fn=lib$i,io=cjs,fo=prefix$2;function $o(Go){return new Uint8Array([...(0,io.serialize)(Mn.SCHEMA.DelegateActionPrefix,new fo.DelegateActionPrefix),...(0,io.serialize)(Mn.SCHEMA.DelegateAction,Go)])}Mn.encodeDelegateAction=$o;function mo(Go){return(0,io.serialize)(Mn.SCHEMA.SignedDelegate,Go)}Mn.encodeSignedDelegate=mo;function Ao(Go){const Vo=Go instanceof zo?Mn.SCHEMA.SignedTransaction:Mn.SCHEMA.Transaction;return(0,io.serialize)(Vo,Go)}Mn.encodeTransaction=Ao;function jo(Go){return new Ho((0,io.deserialize)(Mn.SCHEMA.Transaction,Go))}Mn.decodeTransaction=jo;function Lo(Go){return new zo((0,io.deserialize)(Mn.SCHEMA.SignedTransaction,Go))}Mn.decodeSignedTransaction=Lo;class Ho extends Fn.Assignable{encode(){return Ao(this)}static decode(Vo){return jo(Vo)}}Mn.Transaction=Ho;class zo extends Fn.Assignable{encode(){return Ao(this)}static decode(Vo){return Lo(Vo)}}Mn.SignedTransaction=zo,Mn.SCHEMA=new class{constructor(){this.Ed25519Signature={struct:{data:{array:{type:"u8",len:64}}}},this.Secp256k1Signature={struct:{data:{array:{type:"u8",len:65}}}},this.Signature={enum:[{struct:{ed25519Signature:this.Ed25519Signature}},{struct:{secp256k1Signature:this.Secp256k1Signature}}]},this.Ed25519Data={struct:{data:{array:{type:"u8",len:32}}}},this.Secp256k1Data={struct:{data:{array:{type:"u8",len:64}}}},this.PublicKey={enum:[{struct:{ed25519Key:this.Ed25519Data}},{struct:{secp256k1Key:this.Secp256k1Data}}]},this.FunctionCallPermission={struct:{allowance:{option:"u128"},receiverId:"string",methodNames:{array:{type:"string"}}}},this.FullAccessPermission={struct:{}},this.AccessKeyPermission={enum:[{struct:{functionCall:this.FunctionCallPermission}},{struct:{fullAccess:this.FullAccessPermission}}]},this.AccessKey={struct:{nonce:"u64",permission:this.AccessKeyPermission}},this.CreateAccount={struct:{}},this.DeployContract={struct:{code:{array:{type:"u8"}}}},this.FunctionCall={struct:{methodName:"string",args:{array:{type:"u8"}},gas:"u64",deposit:"u128"}},this.Transfer={struct:{deposit:"u128"}},this.Stake={struct:{stake:"u128",publicKey:this.PublicKey}},this.AddKey={struct:{publicKey:this.PublicKey,accessKey:this.AccessKey}},this.DeleteKey={struct:{publicKey:this.PublicKey}},this.DeleteAccount={struct:{beneficiaryId:"string"}},this.DelegateActionPrefix={struct:{prefix:"u32"}},this.ClassicActions={enum:[{struct:{createAccount:this.CreateAccount}},{struct:{deployContract:this.DeployContract}},{struct:{functionCall:this.FunctionCall}},{struct:{transfer:this.Transfer}},{struct:{stake:this.Stake}},{struct:{addKey:this.AddKey}},{struct:{deleteKey:this.DeleteKey}},{struct:{deleteAccount:this.DeleteAccount}}]},this.DelegateAction={struct:{senderId:"string",receiverId:"string",actions:{array:{type:this.ClassicActions}},nonce:"u64",maxBlockHeight:"u64",publicKey:this.PublicKey}},this.SignedDelegate={struct:{delegateAction:this.DelegateAction,signature:this.Signature}},this.Action={enum:[{struct:{createAccount:this.CreateAccount}},{struct:{deployContract:this.DeployContract}},{struct:{functionCall:this.FunctionCall}},{struct:{transfer:this.Transfer}},{struct:{stake:this.Stake}},{struct:{addKey:this.AddKey}},{struct:{deleteKey:this.DeleteKey}},{struct:{deleteAccount:this.DeleteAccount}},{struct:{signedDelegate:this.SignedDelegate}}]},this.Transaction={struct:{signerId:"string",publicKey:this.PublicKey,nonce:"u64",receiverId:"string",blockHash:{array:{type:"u8",len:32}},actions:{array:{type:this.Action}}}},this.SignedTransaction={struct:{transaction:this.Transaction,signature:this.Signature}}}}})(schema$4);Object.defineProperty(create_transaction$2,"__esModule",{value:!0});create_transaction$2.createTransaction=void 0;const schema_1$5=schema$4;function createTransaction$2(Mn,Fn,io,fo,$o,mo){const Ao=typeof fo=="bigint"?fo:BigInt(fo);return new schema_1$5.Transaction({signerId:Mn,publicKey:Fn,nonce:Ao,receiverId:io,actions:$o,blockHash:mo})}create_transaction$2.createTransaction=createTransaction$2;var delegate$2={};Object.defineProperty(delegate$2,"__esModule",{value:!0});delegate$2.buildDelegateAction=delegate$2.DelegateAction=void 0;const types_1$C=lib$i,action_creators_1$2=action_creators$2,{addKey:addKey$a,createAccount:createAccount$7,deleteAccount:deleteAccount$7,deleteKey:deleteKey$a,deployContract:deployContract$d,functionCall:functionCall$d,stake:stake$7,transfer:transfer$7}=action_creators_1$2.actionCreators;let DelegateAction$2=class extends types_1$C.Assignable{};delegate$2.DelegateAction=DelegateAction$2;function buildDelegateAction$2({actions:Mn,maxBlockHeight:Fn,nonce:io,publicKey:fo,receiverId:$o,senderId:mo}){return new DelegateAction$2({senderId:mo,receiverId:$o,actions:Mn.map(Ao=>{if(!Ao.type&&!Ao.params)return Ao;switch(Ao.type){case"AddKey":{const{publicKey:jo,accessKey:Lo}=Ao.params;return addKey$a(jo,Lo)}case"CreateAccount":return createAccount$7(Ao.params.createAccount);case"DeleteAccount":return deleteAccount$7(Ao.params.deleteAccount);case"DeleteKey":return deleteKey$a(Ao.params.publicKey);case"DeployContract":return deployContract$d(Ao.params.code);case"FunctionCall":{const{methodName:jo,args:Lo,gas:Ho,deposit:zo}=Ao.params;return functionCall$d(jo,Lo,Ho,zo)}case"Stake":return stake$7(Ao.params.stake,Ao.params.publicKey);case"Transfer":{const{deposit:jo}=Ao.params;return transfer$7(jo)}}throw new Error("Unrecognized action")}),nonce:io,maxBlockHeight:Fn,publicKey:fo})}delegate$2.buildDelegateAction=buildDelegateAction$2;var sign$2={},sha256$2={},_sha2={},_assert={};Object.defineProperty(_assert,"__esModule",{value:!0});_assert.output=_assert.exists=_assert.hash=_assert.bytes=_assert.bool=_assert.number=void 0;function number$1(Mn){if(!Number.isSafeInteger(Mn)||Mn<0)throw new Error(`Wrong positive integer: ${Mn}`)}_assert.number=number$1;function bool(Mn){if(typeof Mn!="boolean")throw new Error(`Expected boolean, not ${Mn}`)}_assert.bool=bool;function isBytes(Mn){return Mn instanceof Uint8Array||Mn!=null&&typeof Mn=="object"&&Mn.constructor.name==="Uint8Array"}function bytes(Mn,...Fn){if(!isBytes(Mn))throw new Error("Expected Uint8Array");if(Fn.length>0&&!Fn.includes(Mn.length))throw new Error(`Expected Uint8Array of length ${Fn}, not of length=${Mn.length}`)}_assert.bytes=bytes;function hash(Mn){if(typeof Mn!="function"||typeof Mn.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(Mn.outputLen),number$1(Mn.blockLen)}_assert.hash=hash;function exists(Mn,Fn=!0){if(Mn.destroyed)throw new Error("Hash instance has been destroyed");if(Fn&&Mn.finished)throw new Error("Hash#digest() has already been called")}_assert.exists=exists;function output(Mn,Fn){bytes(Mn);const io=Fn.outputLen;if(Mn.length<io)throw new Error(`digestInto() expects output buffer of length at least ${io}`)}_assert.output=output;const assert={number:number$1,bool,bytes,hash,exists,output};_assert.default=assert;var utils$h={},crypto$1={};Object.defineProperty(crypto$1,"__esModule",{value:!0});crypto$1.crypto=void 0;crypto$1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(Mn){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.randomBytes=Mn.wrapXOFConstructorWithOpts=Mn.wrapConstructorWithOpts=Mn.wrapConstructor=Mn.checkOpts=Mn.Hash=Mn.concatBytes=Mn.toBytes=Mn.utf8ToBytes=Mn.asyncLoop=Mn.nextTick=Mn.hexToBytes=Mn.bytesToHex=Mn.isLE=Mn.rotr=Mn.createView=Mn.u32=Mn.u8=void 0;const Fn=crypto$1,io=Cl=>new Uint8Array(Cl.buffer,Cl.byteOffset,Cl.byteLength);Mn.u8=io;const fo=Cl=>new Uint32Array(Cl.buffer,Cl.byteOffset,Math.floor(Cl.byteLength/4));Mn.u32=fo;function $o(Cl){return Cl instanceof Uint8Array||Cl!=null&&typeof Cl=="object"&&Cl.constructor.name==="Uint8Array"}const mo=Cl=>new DataView(Cl.buffer,Cl.byteOffset,Cl.byteLength);Mn.createView=mo;const Ao=(Cl,Nl)=>Cl<<32-Nl|Cl>>>Nl;if(Mn.rotr=Ao,Mn.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!Mn.isLE)throw new Error("Non little-endian hardware is not supported");const jo=Array.from({length:256},(Cl,Nl)=>Nl.toString(16).padStart(2,"0"));function Lo(Cl){if(!$o(Cl))throw new Error("Uint8Array expected");let Nl="";for(let Wl=0;Wl<Cl.length;Wl++)Nl+=jo[Cl[Wl]];return Nl}Mn.bytesToHex=Lo;const Ho={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function zo(Cl){if(Cl>=Ho._0&&Cl<=Ho._9)return Cl-Ho._0;if(Cl>=Ho._A&&Cl<=Ho._F)return Cl-(Ho._A-10);if(Cl>=Ho._a&&Cl<=Ho._f)return Cl-(Ho._a-10)}function Go(Cl){if(typeof Cl!="string")throw new Error("hex string expected, got "+typeof Cl);const Nl=Cl.length,Wl=Nl/2;if(Nl%2)throw new Error("padded hex string expected, got unpadded hex of length "+Nl);const Dl=new Uint8Array(Wl);for(let Rl=0,Qo=0;Rl<Wl;Rl++,Qo+=2){const Jo=zo(Cl.charCodeAt(Qo)),rs=zo(Cl.charCodeAt(Qo+1));if(Jo===void 0||rs===void 0){const ps=Cl[Qo]+Cl[Qo+1];throw new Error('hex string expected, got non-hex character "'+ps+'" at index '+Qo)}Dl[Rl]=Jo*16+rs}return Dl}Mn.hexToBytes=Go;const Vo=async()=>{};Mn.nextTick=Vo;async function Yo(Cl,Nl,Wl){let Dl=Date.now();for(let Rl=0;Rl<Cl;Rl++){Wl(Rl);const Qo=Date.now()-Dl;Qo>=0&&Qo<Nl||(await(0,Mn.nextTick)(),Dl+=Qo)}}Mn.asyncLoop=Yo;function Xo(Cl){if(typeof Cl!="string")throw new Error(`utf8ToBytes expected string, got ${typeof Cl}`);return new Uint8Array(new TextEncoder().encode(Cl))}Mn.utf8ToBytes=Xo;function is(Cl){if(typeof Cl=="string"&&(Cl=Xo(Cl)),!$o(Cl))throw new Error(`expected Uint8Array, got ${typeof Cl}`);return Cl}Mn.toBytes=is;function yl(...Cl){let Nl=0;for(let Dl=0;Dl<Cl.length;Dl++){const Rl=Cl[Dl];if(!$o(Rl))throw new Error("Uint8Array expected");Nl+=Rl.length}const Wl=new Uint8Array(Nl);for(let Dl=0,Rl=0;Dl<Cl.length;Dl++){const Qo=Cl[Dl];Wl.set(Qo,Rl),Rl+=Qo.length}return Wl}Mn.concatBytes=yl;class us{clone(){return this._cloneInto()}}Mn.Hash=us;const hs={}.toString;function _l(Cl,Nl){if(Nl!==void 0&&hs.call(Nl)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(Cl,Nl)}Mn.checkOpts=_l;function xl(Cl){const Nl=Dl=>Cl().update(is(Dl)).digest(),Wl=Cl();return Nl.outputLen=Wl.outputLen,Nl.blockLen=Wl.blockLen,Nl.create=()=>Cl(),Nl}Mn.wrapConstructor=xl;function Il(Cl){const Nl=(Dl,Rl)=>Cl(Rl).update(is(Dl)).digest(),Wl=Cl({});return Nl.outputLen=Wl.outputLen,Nl.blockLen=Wl.blockLen,Nl.create=Dl=>Cl(Dl),Nl}Mn.wrapConstructorWithOpts=Il;function Ol(Cl){const Nl=(Dl,Rl)=>Cl(Rl).update(is(Dl)).digest(),Wl=Cl({});return Nl.outputLen=Wl.outputLen,Nl.blockLen=Wl.blockLen,Nl.create=Dl=>Cl(Dl),Nl}Mn.wrapXOFConstructorWithOpts=Ol;function Tl(Cl=32){if(Fn.crypto&&typeof Fn.crypto.getRandomValues=="function")return Fn.crypto.getRandomValues(new Uint8Array(Cl));throw new Error("crypto.getRandomValues must be defined")}Mn.randomBytes=Tl})(utils$h);Object.defineProperty(_sha2,"__esModule",{value:!0});_sha2.SHA2=void 0;const _assert_js_1=_assert,utils_js_1$1=utils$h;function setBigUint64(Mn,Fn,io,fo){if(typeof Mn.setBigUint64=="function")return Mn.setBigUint64(Fn,io,fo);const $o=BigInt(32),mo=BigInt(4294967295),Ao=Number(io>>$o&mo),jo=Number(io&mo),Lo=fo?4:0,Ho=fo?0:4;Mn.setUint32(Fn+Lo,Ao,fo),Mn.setUint32(Fn+Ho,jo,fo)}class SHA2 extends utils_js_1$1.Hash{constructor(Fn,io,fo,$o){super(),this.blockLen=Fn,this.outputLen=io,this.padOffset=fo,this.isLE=$o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(Fn),this.view=(0,utils_js_1$1.createView)(this.buffer)}update(Fn){(0,_assert_js_1.exists)(this);const{view:io,buffer:fo,blockLen:$o}=this;Fn=(0,utils_js_1$1.toBytes)(Fn);const mo=Fn.length;for(let Ao=0;Ao<mo;){const jo=Math.min($o-this.pos,mo-Ao);if(jo===$o){const Lo=(0,utils_js_1$1.createView)(Fn);for(;$o<=mo-Ao;Ao+=$o)this.process(Lo,Ao);continue}fo.set(Fn.subarray(Ao,Ao+jo),this.pos),this.pos+=jo,Ao+=jo,this.pos===$o&&(this.process(io,0),this.pos=0)}return this.length+=Fn.length,this.roundClean(),this}digestInto(Fn){(0,_assert_js_1.exists)(this),(0,_assert_js_1.output)(Fn,this),this.finished=!0;const{buffer:io,view:fo,blockLen:$o,isLE:mo}=this;let{pos:Ao}=this;io[Ao++]=128,this.buffer.subarray(Ao).fill(0),this.padOffset>$o-Ao&&(this.process(fo,0),Ao=0);for(let Go=Ao;Go<$o;Go++)io[Go]=0;setBigUint64(fo,$o-8,BigInt(this.length*8),mo),this.process(fo,0);const jo=(0,utils_js_1$1.createView)(Fn),Lo=this.outputLen;if(Lo%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const Ho=Lo/4,zo=this.get();if(Ho>zo.length)throw new Error("_sha2: outputLen bigger than state");for(let Go=0;Go<Ho;Go++)jo.setUint32(4*Go,zo[Go],mo)}digest(){const{buffer:Fn,outputLen:io}=this;this.digestInto(Fn);const fo=Fn.slice(0,io);return this.destroy(),fo}_cloneInto(Fn){Fn||(Fn=new this.constructor),Fn.set(...this.get());const{blockLen:io,buffer:fo,length:$o,finished:mo,destroyed:Ao,pos:jo}=this;return Fn.length=$o,Fn.pos=jo,Fn.finished=mo,Fn.destroyed=Ao,$o%io&&Fn.buffer.set(fo),Fn}}_sha2.SHA2=SHA2;Object.defineProperty(sha256$2,"__esModule",{value:!0});sha256$2.sha224=sha256$2.sha256=void 0;const _sha2_js_1=_sha2,utils_js_1=utils$h,Chi=(Mn,Fn,io)=>Mn&Fn^~Mn&io,Maj=(Mn,Fn,io)=>Mn&Fn^Mn&io^Fn&io,SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends _sha2_js_1.SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:Fn,B:io,C:fo,D:$o,E:mo,F:Ao,G:jo,H:Lo}=this;return[Fn,io,fo,$o,mo,Ao,jo,Lo]}set(Fn,io,fo,$o,mo,Ao,jo,Lo){this.A=Fn|0,this.B=io|0,this.C=fo|0,this.D=$o|0,this.E=mo|0,this.F=Ao|0,this.G=jo|0,this.H=Lo|0}process(Fn,io){for(let Go=0;Go<16;Go++,io+=4)SHA256_W[Go]=Fn.getUint32(io,!1);for(let Go=16;Go<64;Go++){const Vo=SHA256_W[Go-15],Yo=SHA256_W[Go-2],Xo=(0,utils_js_1.rotr)(Vo,7)^(0,utils_js_1.rotr)(Vo,18)^Vo>>>3,is=(0,utils_js_1.rotr)(Yo,17)^(0,utils_js_1.rotr)(Yo,19)^Yo>>>10;SHA256_W[Go]=is+SHA256_W[Go-7]+Xo+SHA256_W[Go-16]|0}let{A:fo,B:$o,C:mo,D:Ao,E:jo,F:Lo,G:Ho,H:zo}=this;for(let Go=0;Go<64;Go++){const Vo=(0,utils_js_1.rotr)(jo,6)^(0,utils_js_1.rotr)(jo,11)^(0,utils_js_1.rotr)(jo,25),Yo=zo+Vo+Chi(jo,Lo,Ho)+SHA256_K[Go]+SHA256_W[Go]|0,is=((0,utils_js_1.rotr)(fo,2)^(0,utils_js_1.rotr)(fo,13)^(0,utils_js_1.rotr)(fo,22))+Maj(fo,$o,mo)|0;zo=Ho,Ho=Lo,Lo=jo,jo=Ao+Yo|0,Ao=mo,mo=$o,$o=fo,fo=Yo+is|0}fo=fo+this.A|0,$o=$o+this.B|0,mo=mo+this.C|0,Ao=Ao+this.D|0,jo=jo+this.E|0,Lo=Lo+this.F|0,Ho=Ho+this.G|0,zo=zo+this.H|0,this.set(fo,$o,mo,Ao,jo,Lo,Ho,zo)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class SHA224 extends SHA256{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}sha256$2.sha256=(0,utils_js_1.wrapConstructor)(()=>new SHA256);sha256$2.sha224=(0,utils_js_1.wrapConstructor)(()=>new SHA224);var signature$2={};Object.defineProperty(signature$2,"__esModule",{value:!0});signature$2.Signature=void 0;const crypto_1$s=lib$k,types_1$B=lib$i;class ED25519Signature extends types_1$B.Assignable{constructor(){super(...arguments),this.keyType=crypto_1$s.KeyType.ED25519}}class SECP256K1Signature extends types_1$B.Assignable{constructor(){super(...arguments),this.keyType=crypto_1$s.KeyType.SECP256K1}}let Signature$2=class extends types_1$B.Assignable{constructor({keyType:Fn,data:io}){super({}),Fn===crypto_1$s.KeyType.ED25519?this.ed25519Signature={keyType:Fn,data:io}:Fn===crypto_1$s.KeyType.SECP256K1&&(this.secp256k1Signature={keyType:Fn,data:io})}get signature(){return this.ed25519Signature||this.secp256k1Signature}get signatureType(){return this.signature.keyType}get data(){return this.signature.data}};signature$2.Signature=Signature$2;var __awaiter$X=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(sign$2,"__esModule",{value:!0});sign$2.signDelegateAction=sign$2.signTransaction=void 0;const sha256_1$6=sha256$2,actions_1$5=actions$3,create_transaction_1$2=create_transaction$2,schema_1$4=schema$4,signature_1$2=signature$2,crypto_1$r=lib$k;function signTransactionObject$2(Mn,Fn,io,fo){return __awaiter$X(this,void 0,void 0,function*(){const $o=(0,schema_1$4.encodeTransaction)(Mn),mo=new Uint8Array((0,sha256_1$6.sha256)($o)),Ao=yield Fn.signMessage($o,io,fo),jo=Mn.publicKey.ed25519Key?crypto_1$r.KeyType.ED25519:crypto_1$r.KeyType.SECP256K1,Lo=new schema_1$4.SignedTransaction({transaction:Mn,signature:new signature_1$2.Signature({keyType:jo,data:Ao.signature})});return[mo,Lo]})}function signTransaction$2(...Mn){return __awaiter$X(this,void 0,void 0,function*(){if(Mn[0].constructor===schema_1$4.Transaction){const[Fn,io,fo,$o]=Mn;return signTransactionObject$2(Fn,io,fo,$o)}else{const[Fn,io,fo,$o,mo,Ao,jo]=Mn,Lo=yield mo.getPublicKey(Ao,jo),Ho=(0,create_transaction_1$2.createTransaction)(Ao,Lo,Fn,io,fo,$o);return signTransactionObject$2(Ho,mo,Ao,jo)}})}sign$2.signTransaction=signTransaction$2;function signDelegateAction$2({delegateAction:Mn,signer:Fn}){return __awaiter$X(this,void 0,void 0,function*(){const io=(0,schema_1$4.encodeDelegateAction)(Mn),fo=yield Fn.sign(io),$o=Mn.publicKey.ed25519Key?crypto_1$r.KeyType.ED25519:crypto_1$r.KeyType.SECP256K1,mo=new actions_1$5.SignedDelegate({delegateAction:Mn,signature:new signature_1$2.Signature({keyType:$o,data:fo})});return{hash:new Uint8Array((0,sha256_1$6.sha256)(io)),signedDelegateAction:mo}})}sign$2.signDelegateAction=signDelegateAction$2;(function(Mn){var Fn=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(fo,$o,mo,Ao){Ao===void 0&&(Ao=mo);var jo=Object.getOwnPropertyDescriptor($o,mo);(!jo||("get"in jo?!$o.__esModule:jo.writable||jo.configurable))&&(jo={enumerable:!0,get:function(){return $o[mo]}}),Object.defineProperty(fo,Ao,jo)}:function(fo,$o,mo,Ao){Ao===void 0&&(Ao=mo),fo[Ao]=$o[mo]}),io=commonjsGlobal$c&&commonjsGlobal$c.__exportStar||function(fo,$o){for(var mo in fo)mo!=="default"&&!Object.prototype.hasOwnProperty.call($o,mo)&&Fn($o,fo,mo)};Object.defineProperty(Mn,"__esModule",{value:!0}),io(action_creators$2,Mn),io(actions$3,Mn),io(create_transaction$2,Mn),io(delegate$2,Mn),io(schema$4,Mn),io(sign$2,Mn),io(signature$2,Mn)})(lib$f);var provider$7={};Object.defineProperty(provider$7,"__esModule",{value:!0});provider$7.Provider=void 0;let Provider$3=class{};provider$7.Provider=Provider$3;var fetch_json$2={},httpErrors={exports:{}};/*!
* depd
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/var browser$4=depd;function depd(Mn){if(!Mn)throw new TypeError("argument namespace is required");function Fn(io){}return Fn._file=void 0,Fn._ignored=!0,Fn._namespace=Mn,Fn._traced=!1,Fn._warned=Object.create(null),Fn.function=wrapfunction,Fn.property=wrapproperty,Fn}function wrapfunction(Mn,Fn){if(typeof Mn!="function")throw new TypeError("argument fn must be a function");return Mn}function wrapproperty(Mn,Fn,io){if(!Mn||typeof Mn!="object"&&typeof Mn!="function")throw new TypeError("argument obj must be object");var fo=Object.getOwnPropertyDescriptor(Mn,Fn);if(!fo)throw new TypeError("must call property on owner object");if(!fo.configurable)throw new TypeError("property must be configurable")}var setprototypeof=Object.setPrototypeOf||({__proto__:[]}instanceof Array?setProtoOf:mixinProperties);function setProtoOf(Mn,Fn){return Mn.__proto__=Fn,Mn}function mixinProperties(Mn,Fn){for(var io in Fn)Mn.hasOwnProperty(io)||(Mn[io]=Fn[io]);return Mn}const require$$0$7={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"(Unused)",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};/*!
* statuses
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/var codes=require$$0$7,statuses=status;status.STATUS_CODES=codes;status.codes=populateStatusesMap(status,codes);status.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0};status.empty={204:!0,205:!0,304:!0};status.retry={502:!0,503:!0,504:!0};function populateStatusesMap(Mn,Fn){var io=[];return Object.keys(Fn).forEach(function($o){var mo=Fn[$o],Ao=Number($o);Mn[Ao]=mo,Mn[mo]=Ao,Mn[mo.toLowerCase()]=Ao,io.push(Ao)}),io}function status(Mn){if(typeof Mn=="number"){if(!status[Mn])throw new Error("invalid status code: "+Mn);return Mn}if(typeof Mn!="string")throw new TypeError("code must be a number or string");var Fn=parseInt(Mn,10);if(!isNaN(Fn)){if(!status[Fn])throw new Error("invalid status code: "+Fn);return Fn}if(Fn=status[Mn.toLowerCase()],!Fn)throw new Error('invalid status message: "'+Mn+'"');return Fn}var inherits_browser={exports:{}};typeof Object.create=="function"?inherits_browser.exports=function(Fn,io){Fn.super_=io,Fn.prototype=Object.create(io.prototype,{constructor:{value:Fn,enumerable:!1,writable:!0,configurable:!0}})}:inherits_browser.exports=function(Fn,io){Fn.super_=io;var fo=function(){};fo.prototype=io.prototype,Fn.prototype=new fo,Fn.prototype.constructor=Fn};var inherits_browserExports=inherits_browser.exports;/*!
* toidentifier
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/var toidentifier=toIdentifier;function toIdentifier(Mn){return Mn.split(" ").map(function(Fn){return Fn.slice(0,1).toUpperCase()+Fn.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}/*!
* http-errors
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/(function(Mn){var Fn=browser$4("http-errors"),io=setprototypeof,fo=statuses,$o=inherits_browserExports,mo=toidentifier;Mn.exports=jo,Mn.exports.HttpError=Lo(),Vo(Mn.exports,fo.codes,Mn.exports.HttpError);function Ao(Yo){return+(String(Yo).charAt(0)+"00")}function jo(){for(var Yo,Xo,is=500,yl={},us=0;us<arguments.length;us++){var hs=arguments[us];if(hs instanceof Error){Yo=hs,is=Yo.status||Yo.statusCode||is;continue}switch(typeof hs){case"string":Xo=hs;break;case"number":is=hs;break;case"object":yl=hs;break}}(typeof is!="number"||!fo[is]&&(is<400||is>=600))&&(is=500);var _l=jo[is]||jo[Ao(is)];Yo||(Yo=_l?new _l(Xo):new Error(Xo||fo[is]),Error.captureStackTrace(Yo,jo)),(!_l||!(Yo instanceof _l)||Yo.status!==is)&&(Yo.expose=is<500,Yo.status=Yo.statusCode=is);for(var xl in yl)xl!=="status"&&xl!=="statusCode"&&(Yo[xl]=yl[xl]);return Yo}function Lo(){function Yo(){throw new TypeError("cannot construct abstract class")}return $o(Yo,Error),Yo}function Ho(Yo,Xo,is){var yl=Xo.match(/Error$/)?Xo:Xo+"Error";function us(hs){var _l=hs??fo[is],xl=new Error(_l);return Error.captureStackTrace(xl,us),io(xl,us.prototype),Object.defineProperty(xl,"message",{enumerable:!0,configurable:!0,value:_l,writable:!0}),Object.defineProperty(xl,"name",{enumerable:!1,configurable:!0,value:yl,writable:!0}),xl}return $o(us,Yo),Go(us,yl),us.prototype.status=is,us.prototype.statusCode=is,us.prototype.expose=!0,us}function zo(Yo,Xo,is){var yl=Xo.match(/Error$/)?Xo:Xo+"Error";function us(hs){var _l=hs??fo[is],xl=new Error(_l);return Error.captureStackTrace(xl,us),io(xl,us.prototype),Object.defineProperty(xl,"message",{enumerable:!0,configurable:!0,value:_l,writable:!0}),Object.defineProperty(xl,"name",{enumerable:!1,configurable:!0,value:yl,writable:!0}),xl}return $o(us,Yo),Go(us,yl),us.prototype.status=is,us.prototype.statusCode=is,us.prototype.expose=!1,us}function Go(Yo,Xo){var is=Object.getOwnPropertyDescriptor(Yo,"name");is&&is.configurable&&(is.value=Xo,Object.defineProperty(Yo,"name",is))}function Vo(Yo,Xo,is){Xo.forEach(function(us){var hs,_l=mo(fo[us]);switch(Ao(us)){case 400:hs=Ho(is,_l,us);break;case 500:hs=zo(is,_l,us);break}hs&&(Yo[us]=hs,Yo[_l]=hs)}),Yo["I'mateapot"]=Fn.function(Yo.ImATeapot,`"I'mateapot"; use "ImATeapot" instead`)}})(httpErrors);var httpErrorsExports=httpErrors.exports,fetch$2={},browser$3={exports:{}},hasRequiredBrowser$1;function requireBrowser$1(){return hasRequiredBrowser$1||(hasRequiredBrowser$1=1,function(Mn,Fn){var io=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof fo<"u")return fo;throw new Error("unable to locate global object")},fo=io();Mn.exports=Fn=fo.fetch,fo.fetch&&(Fn.default=fo.fetch.bind(fo)),Fn.Headers=fo.Headers,Fn.Request=fo.Request,Fn.Response=fo.Response}(browser$3,browser$3.exports)),browser$3.exports}var streamHttp={},request$1={exports:{}},capability={},hasRequiredCapability;function requireCapability(){return hasRequiredCapability||(hasRequiredCapability=1,function(Mn){Mn.fetch=$o(commonjsGlobal$c.fetch)&&$o(commonjsGlobal$c.ReadableStream),Mn.writableStream=$o(commonjsGlobal$c.WritableStream),Mn.abortController=$o(commonjsGlobal$c.AbortController);var Fn;function io(){if(Fn!==void 0)return Fn;if(commonjsGlobal$c.XMLHttpRequest){Fn=new commonjsGlobal$c.XMLHttpRequest;try{Fn.open("GET",commonjsGlobal$c.XDomainRequest?"/":"https://example.com")}catch{Fn=null}}else Fn=null;return Fn}function fo(mo){var Ao=io();if(!Ao)return!1;try{return Ao.responseType=mo,Ao.responseType===mo}catch{}return!1}Mn.arraybuffer=Mn.fetch||fo("arraybuffer"),Mn.msstream=!Mn.fetch&&fo("ms-stream"),Mn.mozchunkedarraybuffer=!Mn.fetch&&fo("moz-chunked-arraybuffer"),Mn.overrideMimeType=Mn.fetch||(io()?$o(io().overrideMimeType):!1);function $o(mo){return typeof mo=="function"}Fn=null}(capability)),capability}var response$1={},readableBrowser={exports:{}},hasRequiredReadableBrowser;function requireReadableBrowser(){return hasRequiredReadableBrowser||(hasRequiredReadableBrowser=1,function(Mn,Fn){Fn=Mn.exports=require_stream_readable$1(),Fn.Stream=Fn,Fn.Readable=Fn,Fn.Writable=require_stream_writable$1(),Fn.Duplex=require_stream_duplex$1(),Fn.Transform=require_stream_transform(),Fn.PassThrough=require_stream_passthrough(),Fn.finished=requireEndOfStream(),Fn.pipeline=requirePipeline()}(readableBrowser,readableBrowser.exports)),readableBrowser.exports}var hasRequiredResponse;function requireResponse(){if(hasRequiredResponse)return response$1;hasRequiredResponse=1;var Mn=requireCapability(),Fn=inherits_browserExports$1,io=requireReadableBrowser(),fo=response$1.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},$o=response$1.IncomingMessage=function(mo,Ao,jo,Lo){var Ho=this;if(io.Readable.call(Ho),Ho._mode=jo,Ho.headers={},Ho.rawHeaders=[],Ho.trailers={},Ho.rawTrailers=[],Ho.on("end",function(){process$1$7.nextTick(function(){Ho.emit("close")})}),jo==="fetch"){let is=function(){Go.read().then(function(yl){if(!Ho._destroyed){if(Lo(yl.done),yl.done){Ho.push(null);return}Ho.push(Buffer$D.from(yl.value)),is()}}).catch(function(yl){Lo(!0),Ho._destroyed||Ho.emit("error",yl)})};if(Ho._fetchResponse=Ao,Ho.url=Ao.url,Ho.statusCode=Ao.status,Ho.statusMessage=Ao.statusText,Ao.headers.forEach(function(yl,us){Ho.headers[us.toLowerCase()]=yl,Ho.rawHeaders.push(us,yl)}),Mn.writableStream){var zo=new WritableStream({write:function(yl){return Lo(!1),new Promise(function(us,hs){Ho._destroyed?hs():Ho.push(Buffer$D.from(yl))?us():Ho._resumeFetch=us})},close:function(){Lo(!0),Ho._destroyed||Ho.push(null)},abort:function(yl){Lo(!0),Ho._destroyed||Ho.emit("error",yl)}});try{Ao.body.pipeTo(zo).catch(function(yl){Lo(!0),Ho._destroyed||Ho.emit("error",yl)});return}catch{}}var Go=Ao.body.getReader();is()}else{Ho._xhr=mo,Ho._pos=0,Ho.url=mo.responseURL,Ho.statusCode=mo.status,Ho.statusMessage=mo.statusText;var Vo=mo.getAllResponseHeaders().split(/\r?\n/);if(Vo.forEach(function(is){var yl=is.match(/^([^:]+):\s*(.*)/);if(yl){var us=yl[1].toLowerCase();us==="set-cookie"?(Ho.headers[us]===void 0&&(Ho.headers[us]=[]),Ho.headers[us].push(yl[2])):Ho.headers[us]!==void 0?Ho.headers[us]+=", "+yl[2]:Ho.headers[us]=yl[2],Ho.rawHeaders.push(yl[1],yl[2])}}),Ho._charset="x-user-defined",!Mn.overrideMimeType){var Yo=Ho.rawHeaders["mime-type"];if(Yo){var Xo=Yo.match(/;\s*charset=([^;])(;|$)/);Xo&&(Ho._charset=Xo[1].toLowerCase())}Ho._charset||(Ho._charset="utf-8")}}};return Fn($o,io.Readable),$o.prototype._read=function(){var mo=this,Ao=mo._resumeFetch;Ao&&(mo._resumeFetch=null,Ao())},$o.prototype._onXHRProgress=function(mo){var Ao=this,jo=Ao._xhr,Lo=null;switch(Ao._mode){case"text":if(Lo=jo.responseText,Lo.length>Ao._pos){var Ho=Lo.substr(Ao._pos);if(Ao._charset==="x-user-defined"){for(var zo=Buffer$D.alloc(Ho.length),Go=0;Go<Ho.length;Go++)zo[Go]=Ho.charCodeAt(Go)&255;Ao.push(zo)}else Ao.push(Ho,Ao._charset);Ao._pos=Lo.length}break;case"arraybuffer":if(jo.readyState!==fo.DONE||!jo.response)break;Lo=jo.response,Ao.push(Buffer$D.from(new Uint8Array(Lo)));break;case"moz-chunked-arraybuffer":if(Lo=jo.response,jo.readyState!==fo.LOADING||!Lo)break;Ao.push(Buffer$D.from(new Uint8Array(Lo)));break;case"ms-stream":if(Lo=jo.response,jo.readyState!==fo.LOADING)break;var Vo=new commonjsGlobal$c.MSStreamReader;Vo.onprogress=function(){Vo.result.byteLength>Ao._pos&&(Ao.push(Buffer$D.from(new Uint8Array(Vo.result.slice(Ao._pos)))),Ao._pos=Vo.result.byteLength)},Vo.onload=function(){mo(!0),Ao.push(null)},Vo.readAsArrayBuffer(Lo);break}Ao._xhr.readyState===fo.DONE&&Ao._mode!=="ms-stream"&&(mo(!0),Ao.push(null))},response$1}var hasRequiredRequest;function requireRequest(){if(hasRequiredRequest)return request$1.exports;hasRequiredRequest=1;var Mn=requireCapability(),Fn=inherits_browserExports$1,io=requireResponse(),fo=requireReadableBrowser(),$o=io.IncomingMessage,mo=io.readyStates;function Ao(zo,Go){return Mn.fetch&&Go?"fetch":Mn.mozchunkedarraybuffer?"moz-chunked-arraybuffer":Mn.msstream?"ms-stream":Mn.arraybuffer&&zo?"arraybuffer":"text"}var jo=request$1.exports=function(zo){var Go=this;fo.Writable.call(Go),Go._opts=zo,Go._body=[],Go._headers={},zo.auth&&Go.setHeader("Authorization","Basic "+Buffer$D.from(zo.auth).toString("base64")),Object.keys(zo.headers).forEach(function(Xo){Go.setHeader(Xo,zo.headers[Xo])});var Vo,Yo=!0;if(zo.mode==="disable-fetch"||"requestTimeout"in zo&&!Mn.abortController)Yo=!1,Vo=!0;else if(zo.mode==="prefer-streaming")Vo=!1;else if(zo.mode==="allow-wrong-content-type")Vo=!Mn.overrideMimeType;else if(!zo.mode||zo.mode==="default"||zo.mode==="prefer-fast")Vo=!0;else throw new Error("Invalid value for opts.mode");Go._mode=Ao(Vo,Yo),Go._fetchTimer=null,Go._socketTimeout=null,Go._socketTimer=null,Go.on("finish",function(){Go._onFinish()})};Fn(jo,fo.Writable),jo.prototype.setHeader=function(zo,Go){var Vo=this,Yo=zo.toLowerCase();Ho.indexOf(Yo)===-1&&(Vo._headers[Yo]={name:zo,value:Go})},jo.prototype.getHeader=function(zo){var Go=this._headers[zo.toLowerCase()];return Go?Go.value:null},jo.prototype.removeHeader=function(zo){var Go=this;delete Go._headers[zo.toLowerCase()]},jo.prototype._onFinish=function(){var zo=this;if(!zo._destroyed){var Go=zo._opts;"timeout"in Go&&Go.timeout!==0&&zo.setTimeout(Go.timeout);var Vo=zo._headers,Yo=null;Go.method!=="GET"&&Go.method!=="HEAD"&&(Yo=new Blob(zo._body,{type:(Vo["content-type"]||{}).value||""}));var Xo=[];if(Object.keys(Vo).forEach(function(hs){var _l=Vo[hs].name,xl=Vo[hs].value;Array.isArray(xl)?xl.forEach(function(Il){Xo.push([_l,Il])}):Xo.push([_l,xl])}),zo._mode==="fetch"){var is=null;if(Mn.abortController){var yl=new AbortController;is=yl.signal,zo._fetchAbortController=yl,"requestTimeout"in Go&&Go.requestTimeout!==0&&(zo._fetchTimer=commonjsGlobal$c.setTimeout(function(){zo.emit("requestTimeout"),zo._fetchAbortController&&zo._fetchAbortController.abort()},Go.requestTimeout))}commonjsGlobal$c.fetch(zo._opts.url,{method:zo._opts.method,headers:Xo,body:Yo||void 0,mode:"cors",credentials:Go.withCredentials?"include":"same-origin",signal:is}).then(function(hs){zo._fetchResponse=hs,zo._resetTimers(!1),zo._connect()},function(hs){zo._resetTimers(!0),zo._destroyed||zo.emit("error",hs)})}else{var us=zo._xhr=new commonjsGlobal$c.XMLHttpRequest;try{us.open(zo._opts.method,zo._opts.url,!0)}catch(hs){process$1$7.nextTick(function(){zo.emit("error",hs)});return}"responseType"in us&&(us.responseType=zo._mode),"withCredentials"in us&&(us.withCredentials=!!Go.withCredentials),zo._mode==="text"&&"overrideMimeType"in us&&us.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in Go&&(us.timeout=Go.requestTimeout,us.ontimeout=function(){zo.emit("requestTimeout")}),Xo.forEach(function(hs){us.setRequestHeader(hs[0],hs[1])}),zo._response=null,us.onreadystatechange=function(){switch(us.readyState){case mo.LOADING:case mo.DONE:zo._onXHRProgress();break}},zo._mode==="moz-chunked-arraybuffer"&&(us.onprogress=function(){zo._onXHRProgress()}),us.onerror=function(){zo._destroyed||(zo._resetTimers(!0),zo.emit("error",new Error("XHR error")))};try{us.send(Yo)}catch(hs){process$1$7.nextTick(function(){zo.emit("error",hs)});return}}}};function Lo(zo){try{var Go=zo.status;return Go!==null&&Go!==0}catch{return!1}}jo.prototype._onXHRProgress=function(){var zo=this;zo._resetTimers(!1),!(!Lo(zo._xhr)||zo._destroyed)&&(zo._response||zo._connect(),zo._response._onXHRProgress(zo._resetTimers.bind(zo)))},jo.prototype._connect=function(){var zo=this;zo._destroyed||(zo._response=new $o(zo._xhr,zo._fetchResponse,zo._mode,zo._resetTimers.bind(zo)),zo._response.on("error",function(Go){zo.emit("error",Go)}),zo.emit("response",zo._response))},jo.prototype._write=function(zo,Go,Vo){var Yo=this;Yo._body.push(zo),Vo()},jo.prototype._resetTimers=function(zo){var Go=this;commonjsGlobal$c.clearTimeout(Go._socketTimer),Go._socketTimer=null,zo?(commonjsGlobal$c.clearTimeout(Go._fetchTimer),Go._fetchTimer=null):Go._socketTimeout&&(Go._socketTimer=commonjsGlobal$c.setTimeout(function(){Go.emit("timeout")},Go._socketTimeout))},jo.prototype.abort=jo.prototype.destroy=function(zo){var Go=this;Go._destroyed=!0,Go._resetTimers(!0),Go._response&&(Go._response._destroyed=!0),Go._xhr?Go._xhr.abort():Go._fetchAbortController&&Go._fetchAbortController.abort(),zo&&Go.emit("error",zo)},jo.prototype.end=function(zo,Go,Vo){var Yo=this;typeof zo=="function"&&(Vo=zo,zo=void 0),fo.Writable.prototype.end.call(Yo,zo,Go,Vo)},jo.prototype.setTimeout=function(zo,Go){var Vo=this;Go&&Vo.once("timeout",Go),Vo._socketTimeout=zo,Vo._resetTimers(!1)},jo.prototype.flushHeaders=function(){},jo.prototype.setNoDelay=function(){},jo.prototype.setSocketKeepAlive=function(){};var Ho=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return request$1.exports}var immutable=extend,hasOwnProperty$c=Object.prototype.hasOwnProperty;function extend(){for(var Mn={},Fn=0;Fn<arguments.length;Fn++){var io=arguments[Fn];for(var fo in io)hasOwnProperty$c.call(io,fo)&&(Mn[fo]=io[fo])}return Mn}var browser$2,hasRequiredBrowser;function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=1,browser$2={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}),browser$2}var punycode$1={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */punycode$1.exports;(function(Mn,Fn){(function(io){var fo=Fn&&!Fn.nodeType&&Fn,$o=Mn&&!Mn.nodeType&&Mn,mo=typeof commonjsGlobal$c=="object"&&commonjsGlobal$c;(mo.global===mo||mo.window===mo||mo.self===mo)&&(io=mo);var Ao,jo=2147483647,Lo=36,Ho=1,zo=26,Go=38,Vo=700,Yo=72,Xo=128,is="-",yl=/^xn--/,us=/[^\x20-\x7E]/,hs=/[\x2E\u3002\uFF0E\uFF61]/g,_l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},xl=Lo-Ho,Il=Math.floor,Ol=String.fromCharCode,Tl;function Cl(ds){throw new RangeError(_l[ds])}function Nl(ds,os){for(var Al=ds.length,Ul=[];Al--;)Ul[Al]=os(ds[Al]);return Ul}function Wl(ds,os){var Al=ds.split("@"),Ul="";Al.length>1&&(Ul=Al[0]+"@",ds=Al[1]),ds=ds.replace(hs,".");var Zl=ds.split("."),Pl=Nl(Zl,os).join(".");return Ul+Pl}function Dl(ds){for(var os=[],Al=0,Ul=ds.length,Zl,Pl;Al<Ul;)Zl=ds.charCodeAt(Al++),Zl>=55296&&Zl<=56319&&Al<Ul?(Pl=ds.charCodeAt(Al++),(Pl&64512)==56320?os.push(((Zl&1023)<<10)+(Pl&1023)+65536):(os.push(Zl),Al--)):os.push(Zl);return os}function Rl(ds){return Nl(ds,function(os){var Al="";return os>65535&&(os-=65536,Al+=Ol(os>>>10&1023|55296),os=56320|os&1023),Al+=Ol(os),Al}).join("")}function Qo(ds){return ds-48<10?ds-22:ds-65<26?ds-65:ds-97<26?ds-97:Lo}function Jo(ds,os){return ds+22+75*(ds<26)-((os!=0)<<5)}function rs(ds,os,Al){var Ul=0;for(ds=Al?Il(ds/Vo):ds>>1,ds+=Il(ds/os);ds>xl*zo>>1;Ul+=Lo)ds=Il(ds/xl);return Il(Ul+(xl+1)*ds/(ds+Go))}function ps(ds){var os=[],Al=ds.length,Ul,Zl=0,Pl=Xo,Hl=Yo,Ml,Fl,Yl,Bl,Kl,Gl,fu,bu,rp;for(Ml=ds.lastIndexOf(is),Ml<0&&(Ml=0),Fl=0;Fl<Ml;++Fl)ds.charCodeAt(Fl)>=128&&Cl("not-basic"),os.push(ds.charCodeAt(Fl));for(Yl=Ml>0?Ml+1:0;Yl<Al;){for(Bl=Zl,Kl=1,Gl=Lo;Yl>=Al&&Cl("invalid-input"),fu=Qo(ds.charCodeAt(Yl++)),(fu>=Lo||fu>Il((jo-Zl)/Kl))&&Cl("overflow"),Zl+=fu*Kl,bu=Gl<=Hl?Ho:Gl>=Hl+zo?zo:Gl-Hl,!(fu<bu);Gl+=Lo)rp=Lo-bu,Kl>Il(jo/rp)&&Cl("overflow"),Kl*=rp;Ul=os.length+1,Hl=rs(Zl-Bl,Ul,Bl==0),Il(Zl/Ul)>jo-Pl&&Cl("overflow"),Pl+=Il(Zl/Ul),Zl%=Ul,os.splice(Zl++,0,Pl)}return Rl(os)}function _c(ds){var os,Al,Ul,Zl,Pl,Hl,Ml,Fl,Yl,Bl,Kl,Gl=[],fu,bu,rp,tp;for(ds=Dl(ds),fu=ds.length,os=Xo,Al=0,Pl=Yo,Hl=0;Hl<fu;++Hl)Kl=ds[Hl],Kl<128&&Gl.push(Ol(Kl));for(Ul=Zl=Gl.length,Zl&&Gl.push(is);Ul<fu;){for(Ml=jo,Hl=0;Hl<fu;++Hl)Kl=ds[Hl],Kl>=os&&Kl<Ml&&(Ml=Kl);for(bu=Ul+1,Ml-os>Il((jo-Al)/bu)&&Cl("overflow"),Al+=(Ml-os)*bu,os=Ml,Hl=0;Hl<fu;++Hl)if(Kl=ds[Hl],Kl<os&&++Al>jo&&Cl("overflow"),Kl==os){for(Fl=Al,Yl=Lo;Bl=Yl<=Pl?Ho:Yl>=Pl+zo?zo:Yl-Pl,!(Fl<Bl);Yl+=Lo)tp=Fl-Bl,rp=Lo-Bl,Gl.push(Ol(Jo(Bl+tp%rp,0))),Fl=Il(tp/rp);Gl.push(Ol(Jo(Fl,0))),Pl=rs(Al,bu,Ul==Zl),Al=0,++Ul}++Al,++os}return Gl.join("")}function $l(ds){return Wl(ds,function(os){return yl.test(os)?ps(os.slice(4).toLowerCase()):os})}function El(ds){return Wl(ds,function(os){return us.test(os)?"xn--"+_c(os):os})}if(Ao={version:"1.4.1",ucs2:{decode:Dl,encode:Rl},decode:ps,encode:_c,toASCII:El,toUnicode:$l},fo&&$o)if(Mn.exports==fo)$o.exports=Ao;else for(Tl in Ao)Ao.hasOwnProperty(Tl)&&(fo[Tl]=Ao[Tl]);else io.punycode=Ao})(commonjsGlobal$c)})(punycode$1,punycode$1.exports);var punycodeExports=punycode$1.exports;const require$$0$6=getDefaultExportFromCjs$1(punycodeExports),__viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0$5=getAugmentedNamespace(__viteBrowserExternal$1);var hasMap=typeof Map=="function"&&Map.prototype,mapSizeDescriptor=Object.getOwnPropertyDescriptor&&hasMap?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mapSize=hasMap&&mapSizeDescriptor&&typeof mapSizeDescriptor.get=="function"?mapSizeDescriptor.get:null,mapForEach=hasMap&&Map.prototype.forEach,hasSet=typeof Set=="function"&&Set.prototype,setSizeDescriptor=Object.getOwnPropertyDescriptor&&hasSet?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,setSize=hasSet&&setSizeDescriptor&&typeof setSizeDescriptor.get=="function"?setSizeDescriptor.get:null,setForEach=hasSet&&Set.prototype.forEach,hasWeakMap=typeof WeakMap=="function"&&WeakMap.prototype,weakMapHas=hasWeakMap?WeakMap.prototype.has:null,hasWeakSet=typeof WeakSet=="function"&&WeakSet.prototype,weakSetHas=hasWeakSet?WeakSet.prototype.has:null,hasWeakRef=typeof WeakRef=="function"&&WeakRef.prototype,weakRefDeref=hasWeakRef?WeakRef.prototype.deref:null,booleanValueOf=Boolean.prototype.valueOf,objectToString=Object.prototype.toString,functionToString$c=Function.prototype.toString,$match=String.prototype.match,$slice$3=String.prototype.slice,$replace=String.prototype.replace,$toUpperCase=String.prototype.toUpperCase,$toLowerCase=String.prototype.toLowerCase,$test=RegExp.prototype.test,$concat=Array.prototype.concat,$join=Array.prototype.join,$arrSlice=Array.prototype.slice,$floor=Math.floor,bigIntValueOf=typeof BigInt=="function"?BigInt.prototype.valueOf:null,gOPS=Object.getOwnPropertySymbols,symToString=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,hasShammedSymbols=typeof Symbol=="function"&&typeof Symbol.iterator=="object",toStringTag=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===hasShammedSymbols||!0)?Symbol.toStringTag:null,isEnumerable=Object.prototype.propertyIsEnumerable,gPO=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(Mn){return Mn.__proto__}:null);function addNumericSeparator(Mn,Fn){if(Mn===1/0||Mn===-1/0||Mn!==Mn||Mn&&Mn>-1e3&&Mn<1e3||$test.call(/e/,Fn))return Fn;var io=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof Mn=="number"){var fo=Mn<0?-$floor(-Mn):$floor(Mn);if(fo!==Mn){var $o=String(fo),mo=$slice$3.call(Fn,$o.length+1);return $replace.call($o,io,"$&_")+"."+$replace.call($replace.call(mo,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(Fn,io,"$&_")}var utilInspect=require$$0$5,inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null,objectInspect=function Mn(Fn,io,fo,$o){var mo=io||{};if(has$q(mo,"quoteStyle")&&mo.quoteStyle!=="single"&&mo.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has$q(mo,"maxStringLength")&&(typeof mo.maxStringLength=="number"?mo.maxStringLength<0&&mo.maxStringLength!==1/0:mo.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ao=has$q(mo,"customInspect")?mo.customInspect:!0;if(typeof Ao!="boolean"&&Ao!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has$q(mo,"indent")&&mo.indent!==null&&mo.indent!==" "&&!(parseInt(mo.indent,10)===mo.indent&&mo.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has$q(mo,"numericSeparator")&&typeof mo.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var jo=mo.numericSeparator;if(typeof Fn>"u")return"undefined";if(Fn===null)return"null";if(typeof Fn=="boolean")return Fn?"true":"false";if(typeof Fn=="string")return inspectString(Fn,mo);if(typeof Fn=="number"){if(Fn===0)return 1/0/Fn>0?"0":"-0";var Lo=String(Fn);return jo?addNumericSeparator(Fn,Lo):Lo}if(typeof Fn=="bigint"){var Ho=String(Fn)+"n";return jo?addNumericSeparator(Fn,Ho):Ho}var zo=typeof mo.depth>"u"?5:mo.depth;if(typeof fo>"u"&&(fo=0),fo>=zo&&zo>0&&typeof Fn=="object")return isArray$8(Fn)?"[Array]":"[Object]";var Go=getIndent(mo,fo);if(typeof $o>"u")$o=[];else if(indexOf$b($o,Fn)>=0)return"[Circular]";function Vo(Qo,Jo,rs){if(Jo&&($o=$arrSlice.call($o),$o.push(Jo)),rs){var ps={depth:mo.depth};return has$q(mo,"quoteStyle")&&(ps.quoteStyle=mo.quoteStyle),Mn(Qo,ps,fo+1,$o)}return Mn(Qo,mo,fo+1,$o)}if(typeof Fn=="function"&&!isRegExp$6(Fn)){var Yo=nameOf(Fn),Xo=arrObjKeys(Fn,Vo);return"[Function"+(Yo?": "+Yo:" (anonymous)")+"]"+(Xo.length>0?" { "+$join.call(Xo,", ")+" }":"")}if(isSymbol(Fn)){var is=hasShammedSymbols?$replace.call(String(Fn),/^(Symbol\(.*\))_[^)]*$/,"$1"):symToString.call(Fn);return typeof Fn=="object"&&!hasShammedSymbols?markBoxed(is):is}if(isElement(Fn)){for(var yl="<"+$toLowerCase.call(String(Fn.nodeName)),us=Fn.attributes||[],hs=0;hs<us.length;hs++)yl+=" "+us[hs].name+"="+wrapQuotes(quote(us[hs].value),"double",mo);return yl+=">",Fn.childNodes&&Fn.childNodes.length&&(yl+="..."),yl+="</"+$toLowerCase.call(String(Fn.nodeName))+">",yl}if(isArray$8(Fn)){if(Fn.length===0)return"[]";var _l=arrObjKeys(Fn,Vo);return Go&&!singleLineValues(_l)?"["+indentedJoin(_l,Go)+"]":"[ "+$join.call(_l,", ")+" ]"}if(isError(Fn)){var xl=arrObjKeys(Fn,Vo);return!("cause"in Error.prototype)&&"cause"in Fn&&!isEnumerable.call(Fn,"cause")?"{ ["+String(Fn)+"] "+$join.call($concat.call("[cause]: "+Vo(Fn.cause),xl),", ")+" }":xl.length===0?"["+String(Fn)+"]":"{ ["+String(Fn)+"] "+$join.call(xl,", ")+" }"}if(typeof Fn=="object"&&Ao){if(inspectSymbol&&typeof Fn[inspectSymbol]=="function"&&utilInspect)return utilInspect(Fn,{depth:zo-fo});if(Ao!=="symbol"&&typeof Fn.inspect=="function")return Fn.inspect()}if(isMap(Fn)){var Il=[];return mapForEach&&mapForEach.call(Fn,function(Qo,Jo){Il.push(Vo(Jo,Fn,!0)+" => "+Vo(Qo,Fn))}),collectionOf("Map",mapSize.call(Fn),Il,Go)}if(isSet(Fn)){var Ol=[];return setForEach&&setForEach.call(Fn,function(Qo){Ol.push(Vo(Qo,Fn))}),collectionOf("Set",setSize.call(Fn),Ol,Go)}if(isWeakMap(Fn))return weakCollectionOf("WeakMap");if(isWeakSet(Fn))return weakCollectionOf("WeakSet");if(isWeakRef(Fn))return weakCollectionOf("WeakRef");if(isNumber(Fn))return markBoxed(Vo(Number(Fn)));if(isBigInt(Fn))return markBoxed(Vo(bigIntValueOf.call(Fn)));if(isBoolean(Fn))return markBoxed(booleanValueOf.call(Fn));if(isString$2(Fn))return markBoxed(Vo(String(Fn)));if(typeof window<"u"&&Fn===window)return"{ [object Window] }";if(typeof globalThis<"u"&&Fn===globalThis||typeof commonjsGlobal$c<"u"&&Fn===commonjsGlobal$c)return"{ [object globalThis] }";if(!isDate(Fn)&&!isRegExp$6(Fn)){var Tl=arrObjKeys(Fn,Vo),Cl=gPO?gPO(Fn)===Object.prototype:Fn instanceof Object||Fn.constructor===Object,Nl=Fn instanceof Object?"":"null prototype",Wl=!Cl&&toStringTag&&Object(Fn)===Fn&&toStringTag in Fn?$slice$3.call(toStr(Fn),8,-1):Nl?"Object":"",Dl=Cl||typeof Fn.constructor!="function"?"":Fn.constructor.name?Fn.constructor.name+" ":"",Rl=Dl+(Wl||Nl?"["+$join.call($concat.call([],Wl||[],Nl||[]),": ")+"] ":"");return Tl.length===0?Rl+"{}":Go?Rl+"{"+indentedJoin(Tl,Go)+"}":Rl+"{ "+$join.call(Tl,", ")+" }"}return String(Fn)};function wrapQuotes(Mn,Fn,io){var fo=(io.quoteStyle||Fn)==="double"?'"':"'";return fo+Mn+fo}function quote(Mn){return $replace.call(String(Mn),/"/g,""")}function isArray$8(Mn){return toStr(Mn)==="[object Array]"&&(!toStringTag||!(typeof Mn=="object"&&toStringTag in Mn))}function isDate(Mn){return toStr(Mn)==="[object Date]"&&(!toStringTag||!(typeof Mn=="object"&&toStringTag in Mn))}function isRegExp$6(Mn){return toStr(Mn)==="[object RegExp]"&&(!toStringTag||!(typeof Mn=="object"&&toStringTag in Mn))}function isError(Mn){return toStr(Mn)==="[object Error]"&&(!toStringTag||!(typeof Mn=="object"&&toStringTag in Mn))}function isString$2(Mn){return toStr(Mn)==="[object String]"&&(!toStringTag||!(typeof Mn=="object"&&toStringTag in Mn))}function isNumber(Mn){return toStr(Mn)==="[object Number]"&&(!toStringTag||!(typeof Mn=="object"&&toStringTag in Mn))}function isBoolean(Mn){return toStr(Mn)==="[object Boolean]"&&(!toStringTag||!(typeof Mn=="object"&&toStringTag in Mn))}function isSymbol(Mn){if(hasShammedSymbols)return Mn&&typeof Mn=="object"&&Mn instanceof Symbol;if(typeof Mn=="symbol")return!0;if(!Mn||typeof Mn!="object"||!symToString)return!1;try{return symToString.call(Mn),!0}catch{}return!1}function isBigInt(Mn){if(!Mn||typeof Mn!="object"||!bigIntValueOf)return!1;try{return bigIntValueOf.call(Mn),!0}catch{}return!1}var hasOwn$1=Object.prototype.hasOwnProperty||function(Mn){return Mn in this};function has$q(Mn,Fn){return hasOwn$1.call(Mn,Fn)}function toStr(Mn){return objectToString.call(Mn)}function nameOf(Mn){if(Mn.name)return Mn.name;var Fn=$match.call(functionToString$c.call(Mn),/^function\s*([\w$]+)/);return Fn?Fn[1]:null}function indexOf$b(Mn,Fn){if(Mn.indexOf)return Mn.indexOf(Fn);for(var io=0,fo=Mn.length;io<fo;io++)if(Mn[io]===Fn)return io;return-1}function isMap(Mn){if(!mapSize||!Mn||typeof Mn!="object")return!1;try{mapSize.call(Mn);try{setSize.call(Mn)}catch{return!0}return Mn instanceof Map}catch{}return!1}function isWeakMap(Mn){if(!weakMapHas||!Mn||typeof Mn!="object")return!1;try{weakMapHas.call(Mn,weakMapHas);try{weakSetHas.call(Mn,weakSetHas)}catch{return!0}return Mn instanceof WeakMap}catch{}return!1}function isWeakRef(Mn){if(!weakRefDeref||!Mn||typeof Mn!="object")return!1;try{return weakRefDeref.call(Mn),!0}catch{}return!1}function isSet(Mn){if(!setSize||!Mn||typeof Mn!="object")return!1;try{setSize.call(Mn);try{mapSize.call(Mn)}catch{return!0}return Mn instanceof Set}catch{}return!1}function isWeakSet(Mn){if(!weakSetHas||!Mn||typeof Mn!="object")return!1;try{weakSetHas.call(Mn,weakSetHas);try{weakMapHas.call(Mn,weakMapHas)}catch{return!0}return Mn instanceof WeakSet}catch{}return!1}function isElement(Mn){return!Mn||typeof Mn!="object"?!1:typeof HTMLElement<"u"&&Mn instanceof HTMLElement?!0:typeof Mn.nodeName=="string"&&typeof Mn.getAttribute=="function"}function inspectString(Mn,Fn){if(Mn.length>Fn.maxStringLength){var io=Mn.length-Fn.maxStringLength,fo="... "+io+" more character"+(io>1?"s":"");return inspectString($slice$3.call(Mn,0,Fn.maxStringLength),Fn)+fo}var $o=$replace.call($replace.call(Mn,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte);return wrapQuotes($o,"single",Fn)}function lowbyte(Mn){var Fn=Mn.charCodeAt(0),io={8:"b",9:"t",10:"n",12:"f",13:"r"}[Fn];return io?"\\"+io:"\\x"+(Fn<16?"0":"")+$toUpperCase.call(Fn.toString(16))}function markBoxed(Mn){return"Object("+Mn+")"}function weakCollectionOf(Mn){return Mn+" { ? }"}function collectionOf(Mn,Fn,io,fo){var $o=fo?indentedJoin(io,fo):$join.call(io,", ");return Mn+" ("+Fn+") {"+$o+"}"}function singleLineValues(Mn){for(var Fn=0;Fn<Mn.length;Fn++)if(indexOf$b(Mn[Fn],`
`)>=0)return!1;return!0}function getIndent(Mn,Fn){var io;if(Mn.indent===" ")io=" ";else if(typeof Mn.indent=="number"&&Mn.indent>0)io=$join.call(Array(Mn.indent+1)," ");else return null;return{base:io,prev:$join.call(Array(Fn+1),io)}}function indentedJoin(Mn,Fn){if(Mn.length===0)return"";var io=`
`+Fn.prev+Fn.base;return io+$join.call(Mn,","+io)+`
`+Fn.prev}function arrObjKeys(Mn,Fn){var io=isArray$8(Mn),fo=[];if(io){fo.length=Mn.length;for(var $o=0;$o<Mn.length;$o++)fo[$o]=has$q(Mn,$o)?Fn(Mn[$o],Mn):""}var mo=typeof gOPS=="function"?gOPS(Mn):[],Ao;if(hasShammedSymbols){Ao={};for(var jo=0;jo<mo.length;jo++)Ao["$"+mo[jo]]=mo[jo]}for(var Lo in Mn)has$q(Mn,Lo)&&(io&&String(Number(Lo))===Lo&&Lo<Mn.length||hasShammedSymbols&&Ao["$"+Lo]instanceof Symbol||($test.call(/[^\w$]/,Lo)?fo.push(Fn(Lo,Mn)+": "+Fn(Mn[Lo],Mn)):fo.push(Lo+": "+Fn(Mn[Lo],Mn))));if(typeof gOPS=="function")for(var Ho=0;Ho<mo.length;Ho++)isEnumerable.call(Mn,mo[Ho])&&fo.push("["+Fn(mo[Ho])+"]: "+Fn(Mn[mo[Ho]],Mn));return fo}var GetIntrinsic=getIntrinsic,callBound=callBound$3,inspect=objectInspect,$TypeError=type,$WeakMap=GetIntrinsic("%WeakMap%",!0),$Map=GetIntrinsic("%Map%",!0),$weakMapGet=callBound("WeakMap.prototype.get",!0),$weakMapSet=callBound("WeakMap.prototype.set",!0),$weakMapHas=callBound("WeakMap.prototype.has",!0),$mapGet=callBound("Map.prototype.get",!0),$mapSet=callBound("Map.prototype.set",!0),$mapHas=callBound("Map.prototype.has",!0),listGetNode=function(Mn,Fn){for(var io=Mn,fo;(fo=io.next)!==null;io=fo)if(fo.key===Fn)return io.next=fo.next,fo.next=Mn.next,Mn.next=fo,fo},listGet=function(Mn,Fn){var io=listGetNode(Mn,Fn);return io&&io.value},listSet=function(Mn,Fn,io){var fo=listGetNode(Mn,Fn);fo?fo.value=io:Mn.next={key:Fn,next:Mn.next,value:io}},listHas=function(Mn,Fn){return!!listGetNode(Mn,Fn)},sideChannel=function Mn(){var Fn,io,fo,$o={assert:function(mo){if(!$o.has(mo))throw new $TypeError("Side channel does not contain "+inspect(mo))},get:function(mo){if($WeakMap&&mo&&(typeof mo=="object"||typeof mo=="function")){if(Fn)return $weakMapGet(Fn,mo)}else if($Map){if(io)return $mapGet(io,mo)}else if(fo)return listGet(fo,mo)},has:function(mo){if($WeakMap&&mo&&(typeof mo=="object"||typeof mo=="function")){if(Fn)return $weakMapHas(Fn,mo)}else if($Map){if(io)return $mapHas(io,mo)}else if(fo)return listHas(fo,mo);return!1},set:function(mo,Ao){$WeakMap&&mo&&(typeof mo=="object"||typeof mo=="function")?(Fn||(Fn=new $WeakMap),$weakMapSet(Fn,mo,Ao)):$Map?(io||(io=new $Map),$mapSet(io,mo,Ao)):(fo||(fo={key:{},next:null}),listSet(fo,mo,Ao))}};return $o},replace$1=String.prototype.replace,percentTwenties=/%20/g,Format={RFC1738:"RFC1738",RFC3986:"RFC3986"},formats$5={default:Format.RFC3986,formatters:{RFC1738:function(Mn){return replace$1.call(Mn,percentTwenties,"+")},RFC3986:function(Mn){return String(Mn)}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986},formats$4=formats$5,has$p=Object.prototype.hasOwnProperty,isArray$7=Array.isArray,hexTable=function(){for(var Mn=[],Fn=0;Fn<256;++Fn)Mn.push("%"+((Fn<16?"0":"")+Fn.toString(16)).toUpperCase());return Mn}(),compactQueue=function Mn(Fn){for(;Fn.length>1;){var io=Fn.pop(),fo=io.obj[io.prop];if(isArray$7(fo)){for(var $o=[],mo=0;mo<fo.length;++mo)typeof fo[mo]<"u"&&$o.push(fo[mo]);io.obj[io.prop]=$o}}},arrayToObject=function Mn(Fn,io){for(var fo=io&&io.plainObjects?Object.create(null):{},$o=0;$o<Fn.length;++$o)typeof Fn[$o]<"u"&&(fo[$o]=Fn[$o]);return fo},merge=function Mn(Fn,io,fo){if(!io)return Fn;if(typeof io!="object"){if(isArray$7(Fn))Fn.push(io);else if(Fn&&typeof Fn=="object")(fo&&(fo.plainObjects||fo.allowPrototypes)||!has$p.call(Object.prototype,io))&&(Fn[io]=!0);else return[Fn,io];return Fn}if(!Fn||typeof Fn!="object")return[Fn].concat(io);var $o=Fn;return isArray$7(Fn)&&!isArray$7(io)&&($o=arrayToObject(Fn,fo)),isArray$7(Fn)&&isArray$7(io)?(io.forEach(function(mo,Ao){if(has$p.call(Fn,Ao)){var jo=Fn[Ao];jo&&typeof jo=="object"&&mo&&typeof mo=="object"?Fn[Ao]=Mn(jo,mo,fo):Fn.push(mo)}else Fn[Ao]=mo}),Fn):Object.keys(io).reduce(function(mo,Ao){var jo=io[Ao];return has$p.call(mo,Ao)?mo[Ao]=Mn(mo[Ao],jo,fo):mo[Ao]=jo,mo},$o)},assign$9=function Mn(Fn,io){return Object.keys(io).reduce(function(fo,$o){return fo[$o]=io[$o],fo},Fn)},decode=function(Mn,Fn,io){var fo=Mn.replace(/\+/g," ");if(io==="iso-8859-1")return fo.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(fo)}catch{return fo}},limit=1024,encode$1=function Mn(Fn,io,fo,$o,mo){if(Fn.length===0)return Fn;var Ao=Fn;if(typeof Fn=="symbol"?Ao=Symbol.prototype.toString.call(Fn):typeof Fn!="string"&&(Ao=String(Fn)),fo==="iso-8859-1")return escape(Ao).replace(/%u[0-9a-f]{4}/gi,function(Yo){return"%26%23"+parseInt(Yo.slice(2),16)+"%3B"});for(var jo="",Lo=0;Lo<Ao.length;Lo+=limit){for(var Ho=Ao.length>=limit?Ao.slice(Lo,Lo+limit):Ao,zo=[],Go=0;Go<Ho.length;++Go){var Vo=Ho.charCodeAt(Go);if(Vo===45||Vo===46||Vo===95||Vo===126||Vo>=48&&Vo<=57||Vo>=65&&Vo<=90||Vo>=97&&Vo<=122||mo===formats$4.RFC1738&&(Vo===40||Vo===41)){zo[zo.length]=Ho.charAt(Go);continue}if(Vo<128){zo[zo.length]=hexTable[Vo];continue}if(Vo<2048){zo[zo.length]=hexTable[192|Vo>>6]+hexTable[128|Vo&63];continue}if(Vo<55296||Vo>=57344){zo[zo.length]=hexTable[224|Vo>>12]+hexTable[128|Vo>>6&63]+hexTable[128|Vo&63];continue}Go+=1,Vo=65536+((Vo&1023)<<10|Ho.charCodeAt(Go)&1023),zo[zo.length]=hexTable[240|Vo>>18]+hexTable[128|Vo>>12&63]+hexTable[128|Vo>>6&63]+hexTable[128|Vo&63]}jo+=zo.join("")}return jo},compact=function Mn(Fn){for(var io=[{obj:{o:Fn},prop:"o"}],fo=[],$o=0;$o<io.length;++$o)for(var mo=io[$o],Ao=mo.obj[mo.prop],jo=Object.keys(Ao),Lo=0;Lo<jo.length;++Lo){var Ho=jo[Lo],zo=Ao[Ho];typeof zo=="object"&&zo!==null&&fo.indexOf(zo)===-1&&(io.push({obj:Ao,prop:Ho}),fo.push(zo))}return compactQueue(io),Fn},isRegExp$5=function Mn(Fn){return Object.prototype.toString.call(Fn)==="[object RegExp]"},isBuffer=function Mn(Fn){return!Fn||typeof Fn!="object"?!1:!!(Fn.constructor&&Fn.constructor.isBuffer&&Fn.constructor.isBuffer(Fn))},combine=function Mn(Fn,io){return[].concat(Fn,io)},maybeMap=function Mn(Fn,io){if(isArray$7(Fn)){for(var fo=[],$o=0;$o<Fn.length;$o+=1)fo.push(io(Fn[$o]));return fo}return io(Fn)},utils$g={arrayToObject,assign:assign$9,combine,compact,decode,encode:encode$1,isBuffer,isRegExp:isRegExp$5,maybeMap,merge},getSideChannel=sideChannel,utils$f=utils$g,formats$3=formats$5,has$o=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function Mn(Fn){return Fn+"[]"},comma:"comma",indices:function Mn(Fn,io){return Fn+"["+io+"]"},repeat:function Mn(Fn){return Fn}},isArray$6=Array.isArray,push$3=Array.prototype.push,pushToArray=function(Mn,Fn){push$3.apply(Mn,isArray$6(Fn)?Fn:[Fn])},toISO=Date.prototype.toISOString,defaultFormat=formats$3.default,defaults$1={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:utils$f.encode,encodeValuesOnly:!1,format:defaultFormat,formatter:formats$3.formatters[defaultFormat],indices:!1,serializeDate:function Mn(Fn){return toISO.call(Fn)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function Mn(Fn){return typeof Fn=="string"||typeof Fn=="number"||typeof Fn=="boolean"||typeof Fn=="symbol"||typeof Fn=="bigint"},sentinel={},stringify$1=function Mn(Fn,io,fo,$o,mo,Ao,jo,Lo,Ho,zo,Go,Vo,Yo,Xo,is,yl,us,hs){for(var _l=Fn,xl=hs,Il=0,Ol=!1;(xl=xl.get(sentinel))!==void 0&&!Ol;){var Tl=xl.get(Fn);if(Il+=1,typeof Tl<"u"){if(Tl===Il)throw new RangeError("Cyclic object value");Ol=!0}typeof xl.get(sentinel)>"u"&&(Il=0)}if(typeof zo=="function"?_l=zo(io,_l):_l instanceof Date?_l=Yo(_l):fo==="comma"&&isArray$6(_l)&&(_l=utils$f.maybeMap(_l,function(ds){return ds instanceof Date?Yo(ds):ds})),_l===null){if(Ao)return Ho&&!yl?Ho(io,defaults$1.encoder,us,"key",Xo):io;_l=""}if(isNonNullishPrimitive(_l)||utils$f.isBuffer(_l)){if(Ho){var Cl=yl?io:Ho(io,defaults$1.encoder,us,"key",Xo);return[is(Cl)+"="+is(Ho(_l,defaults$1.encoder,us,"value",Xo))]}return[is(io)+"="+is(String(_l))]}var Nl=[];if(typeof _l>"u")return Nl;var Wl;if(fo==="comma"&&isArray$6(_l))yl&&Ho&&(_l=utils$f.maybeMap(_l,Ho)),Wl=[{value:_l.length>0?_l.join(",")||null:void 0}];else if(isArray$6(zo))Wl=zo;else{var Dl=Object.keys(_l);Wl=Go?Dl.sort(Go):Dl}var Rl=Lo?io.replace(/\./g,"%2E"):io,Qo=$o&&isArray$6(_l)&&_l.length===1?Rl+"[]":Rl;if(mo&&isArray$6(_l)&&_l.length===0)return Qo+"[]";for(var Jo=0;Jo<Wl.length;++Jo){var rs=Wl[Jo],ps=typeof rs=="object"&&typeof rs.value<"u"?rs.value:_l[rs];if(!(jo&&ps===null)){var _c=Vo&&Lo?rs.replace(/\./g,"%2E"):rs,$l=isArray$6(_l)?typeof fo=="function"?fo(Qo,_c):Qo:Qo+(Vo?"."+_c:"["+_c+"]");hs.set(Fn,Il);var El=getSideChannel();El.set(sentinel,hs),pushToArray(Nl,Mn(ps,$l,fo,$o,mo,Ao,jo,Lo,fo==="comma"&&yl&&isArray$6(_l)?null:Ho,zo,Go,Vo,Yo,Xo,is,yl,us,El))}}return Nl},normalizeStringifyOptions=function Mn(Fn){if(!Fn)return defaults$1;if(typeof Fn.allowEmptyArrays<"u"&&typeof Fn.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof Fn.encodeDotInKeys<"u"&&typeof Fn.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(Fn.encoder!==null&&typeof Fn.encoder<"u"&&typeof Fn.encoder!="function")throw new TypeError("Encoder has to be a function.");var io=Fn.charset||defaults$1.charset;if(typeof Fn.charset<"u"&&Fn.charset!=="utf-8"&&Fn.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var fo=formats$3.default;if(typeof Fn.format<"u"){if(!has$o.call(formats$3.formatters,Fn.format))throw new TypeError("Unknown format option provided.");fo=Fn.format}var $o=formats$3.formatters[fo],mo=defaults$1.filter;(typeof Fn.filter=="function"||isArray$6(Fn.filter))&&(mo=Fn.filter);var Ao;if(Fn.arrayFormat in arrayPrefixGenerators?Ao=Fn.arrayFormat:"indices"in Fn?Ao=Fn.indices?"indices":"repeat":Ao=defaults$1.arrayFormat,"commaRoundTrip"in Fn&&typeof Fn.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var jo=typeof Fn.allowDots>"u"?Fn.encodeDotInKeys===!0?!0:defaults$1.allowDots:!!Fn.allowDots;return{addQueryPrefix:typeof Fn.addQueryPrefix=="boolean"?Fn.addQueryPrefix:defaults$1.addQueryPrefix,allowDots:jo,allowEmptyArrays:typeof Fn.allowEmptyArrays=="boolean"?!!Fn.allowEmptyArrays:defaults$1.allowEmptyArrays,arrayFormat:Ao,charset:io,charsetSentinel:typeof Fn.charsetSentinel=="boolean"?Fn.charsetSentinel:defaults$1.charsetSentinel,commaRoundTrip:Fn.commaRoundTrip,delimiter:typeof Fn.delimiter>"u"?defaults$1.delimiter:Fn.delimiter,encode:typeof Fn.encode=="boolean"?Fn.encode:defaults$1.encode,encodeDotInKeys:typeof Fn.encodeDotInKeys=="boolean"?Fn.encodeDotInKeys:defaults$1.encodeDotInKeys,encoder:typeof Fn.encoder=="function"?Fn.encoder:defaults$1.encoder,encodeValuesOnly:typeof Fn.encodeValuesOnly=="boolean"?Fn.encodeValuesOnly:defaults$1.encodeValuesOnly,filter:mo,format:fo,formatter:$o,serializeDate:typeof Fn.serializeDate=="function"?Fn.serializeDate:defaults$1.serializeDate,skipNulls:typeof Fn.skipNulls=="boolean"?Fn.skipNulls:defaults$1.skipNulls,sort:typeof Fn.sort=="function"?Fn.sort:null,strictNullHandling:typeof Fn.strictNullHandling=="boolean"?Fn.strictNullHandling:defaults$1.strictNullHandling}},stringify_1=function(Mn,Fn){var io=Mn,fo=normalizeStringifyOptions(Fn),$o,mo;typeof fo.filter=="function"?(mo=fo.filter,io=mo("",io)):isArray$6(fo.filter)&&(mo=fo.filter,$o=mo);var Ao=[];if(typeof io!="object"||io===null)return"";var jo=arrayPrefixGenerators[fo.arrayFormat],Lo=jo==="comma"&&fo.commaRoundTrip;$o||($o=Object.keys(io)),fo.sort&&$o.sort(fo.sort);for(var Ho=getSideChannel(),zo=0;zo<$o.length;++zo){var Go=$o[zo];fo.skipNulls&&io[Go]===null||pushToArray(Ao,stringify$1(io[Go],Go,jo,Lo,fo.allowEmptyArrays,fo.strictNullHandling,fo.skipNulls,fo.encodeDotInKeys,fo.encode?fo.encoder:null,fo.filter,fo.sort,fo.allowDots,fo.serializeDate,fo.format,fo.formatter,fo.encodeValuesOnly,fo.charset,Ho))}var Vo=Ao.join(fo.delimiter),Yo=fo.addQueryPrefix===!0?"?":"";return fo.charsetSentinel&&(fo.charset==="iso-8859-1"?Yo+="utf8=%26%2310003%3B&":Yo+="utf8=%E2%9C%93&"),Vo.length>0?Yo+Vo:""},utils$e=utils$g,has$n=Object.prototype.hasOwnProperty,isArray$5=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils$e.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},interpretNumericEntities=function(Mn){return Mn.replace(/&#(\d+);/g,function(Fn,io){return String.fromCharCode(parseInt(io,10))})},parseArrayValue=function(Mn,Fn){return Mn&&typeof Mn=="string"&&Fn.comma&&Mn.indexOf(",")>-1?Mn.split(","):Mn},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function Mn(Fn,io){var fo={__proto__:null},$o=io.ignoreQueryPrefix?Fn.replace(/^\?/,""):Fn;$o=$o.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var mo=io.parameterLimit===1/0?void 0:io.parameterLimit,Ao=$o.split(io.delimiter,mo),jo=-1,Lo,Ho=io.charset;if(io.charsetSentinel)for(Lo=0;Lo<Ao.length;++Lo)Ao[Lo].indexOf("utf8=")===0&&(Ao[Lo]===charsetSentinel?Ho="utf-8":Ao[Lo]===isoSentinel&&(Ho="iso-8859-1"),jo=Lo,Lo=Ao.length);for(Lo=0;Lo<Ao.length;++Lo)if(Lo!==jo){var zo=Ao[Lo],Go=zo.indexOf("]="),Vo=Go===-1?zo.indexOf("="):Go+1,Yo,Xo;Vo===-1?(Yo=io.decoder(zo,defaults.decoder,Ho,"key"),Xo=io.strictNullHandling?null:""):(Yo=io.decoder(zo.slice(0,Vo),defaults.decoder,Ho,"key"),Xo=utils$e.maybeMap(parseArrayValue(zo.slice(Vo+1),io),function(yl){return io.decoder(yl,defaults.decoder,Ho,"value")})),Xo&&io.interpretNumericEntities&&Ho==="iso-8859-1"&&(Xo=interpretNumericEntities(Xo)),zo.indexOf("[]=")>-1&&(Xo=isArray$5(Xo)?[Xo]:Xo);var is=has$n.call(fo,Yo);is&&io.duplicates==="combine"?fo[Yo]=utils$e.combine(fo[Yo],Xo):(!is||io.duplicates==="last")&&(fo[Yo]=Xo)}return fo},parseObject=function(Mn,Fn,io,fo){for(var $o=fo?Fn:parseArrayValue(Fn,io),mo=Mn.length-1;mo>=0;--mo){var Ao,jo=Mn[mo];if(jo==="[]"&&io.parseArrays)Ao=io.allowEmptyArrays&&($o===""||io.strictNullHandling&&$o===null)?[]:[].concat($o);else{Ao=io.plainObjects?Object.create(null):{};var Lo=jo.charAt(0)==="["&&jo.charAt(jo.length-1)==="]"?jo.slice(1,-1):jo,Ho=io.decodeDotInKeys?Lo.replace(/%2E/g,"."):Lo,zo=parseInt(Ho,10);!io.parseArrays&&Ho===""?Ao={0:$o}:!isNaN(zo)&&jo!==Ho&&String(zo)===Ho&&zo>=0&&io.parseArrays&&zo<=io.arrayLimit?(Ao=[],Ao[zo]=$o):Ho!=="__proto__"&&(Ao[Ho]=$o)}$o=Ao}return $o},parseKeys=function Mn(Fn,io,fo,$o){if(Fn){var mo=fo.allowDots?Fn.replace(/\.([^.[]+)/g,"[$1]"):Fn,Ao=/(\[[^[\]]*])/,jo=/(\[[^[\]]*])/g,Lo=fo.depth>0&&Ao.exec(mo),Ho=Lo?mo.slice(0,Lo.index):mo,zo=[];if(Ho){if(!fo.plainObjects&&has$n.call(Object.prototype,Ho)&&!fo.allowPrototypes)return;zo.push(Ho)}for(var Go=0;fo.depth>0&&(Lo=jo.exec(mo))!==null&&Go<fo.depth;){if(Go+=1,!fo.plainObjects&&has$n.call(Object.prototype,Lo[1].slice(1,-1))&&!fo.allowPrototypes)return;zo.push(Lo[1])}if(Lo){if(fo.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+fo.depth+" and strictDepth is true");zo.push("["+mo.slice(Lo.index)+"]")}return parseObject(zo,io,fo,$o)}},normalizeParseOptions=function Mn(Fn){if(!Fn)return defaults;if(typeof Fn.allowEmptyArrays<"u"&&typeof Fn.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof Fn.decodeDotInKeys<"u"&&typeof Fn.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(Fn.decoder!==null&&typeof Fn.decoder<"u"&&typeof Fn.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof Fn.charset<"u"&&Fn.charset!=="utf-8"&&Fn.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var io=typeof Fn.charset>"u"?defaults.charset:Fn.charset,fo=typeof Fn.duplicates>"u"?defaults.duplicates:Fn.duplicates;if(fo!=="combine"&&fo!=="first"&&fo!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var $o=typeof Fn.allowDots>"u"?Fn.decodeDotInKeys===!0?!0:defaults.allowDots:!!Fn.allowDots;return{allowDots:$o,allowEmptyArrays:typeof Fn.allowEmptyArrays=="boolean"?!!Fn.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:typeof Fn.allowPrototypes=="boolean"?Fn.allowPrototypes:defaults.allowPrototypes,allowSparse:typeof Fn.allowSparse=="boolean"?Fn.allowSparse:defaults.allowSparse,arrayLimit:typeof Fn.arrayLimit=="number"?Fn.arrayLimit:defaults.arrayLimit,charset:io,charsetSentinel:typeof Fn.charsetSentinel=="boolean"?Fn.charsetSentinel:defaults.charsetSentinel,comma:typeof Fn.comma=="boolean"?Fn.comma:defaults.comma,decodeDotInKeys:typeof Fn.decodeDotInKeys=="boolean"?Fn.decodeDotInKeys:defaults.decodeDotInKeys,decoder:typeof Fn.decoder=="function"?Fn.decoder:defaults.decoder,delimiter:typeof Fn.delimiter=="string"||utils$e.isRegExp(Fn.delimiter)?Fn.delimiter:defaults.delimiter,depth:typeof Fn.depth=="number"||Fn.depth===!1?+Fn.depth:defaults.depth,duplicates:fo,ignoreQueryPrefix:Fn.ignoreQueryPrefix===!0,interpretNumericEntities:typeof Fn.interpretNumericEntities=="boolean"?Fn.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof Fn.parameterLimit=="number"?Fn.parameterLimit:defaults.parameterLimit,parseArrays:Fn.parseArrays!==!1,plainObjects:typeof Fn.plainObjects=="boolean"?Fn.plainObjects:defaults.plainObjects,strictDepth:typeof Fn.strictDepth=="boolean"?!!Fn.strictDepth:defaults.strictDepth,strictNullHandling:typeof Fn.strictNullHandling=="boolean"?Fn.strictNullHandling:defaults.strictNullHandling}},parse$9=function(Mn,Fn){var io=normalizeParseOptions(Fn);if(Mn===""||Mn===null||typeof Mn>"u")return io.plainObjects?Object.create(null):{};for(var fo=typeof Mn=="string"?parseValues(Mn,io):Mn,$o=io.plainObjects?Object.create(null):{},mo=Object.keys(fo),Ao=0;Ao<mo.length;++Ao){var jo=mo[Ao],Lo=parseKeys(jo,fo[jo],io,typeof Mn=="string");$o=utils$e.merge($o,Lo,io)}return io.allowSparse===!0?$o:utils$e.compact($o)},stringify=stringify_1,parse$8=parse$9,formats$2=formats$5,lib$e={formats:formats$2,parse:parse$8,stringify};const require$$1$3=getDefaultExportFromCjs$1(lib$e);var punycode=require$$0$6;function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r",`
`," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require$$1$3;function urlParse(Mn,Fn,io){if(Mn&&typeof Mn=="object"&&Mn instanceof Url)return Mn;var fo=new Url;return fo.parse(Mn,Fn,io),fo}Url.prototype.parse=function(Mn,Fn,io){if(typeof Mn!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof Mn);var fo=Mn.indexOf("?"),$o=fo!==-1&&fo<Mn.indexOf("#")?"?":"#",mo=Mn.split($o),Ao=/\\/g;mo[0]=mo[0].replace(Ao,"/"),Mn=mo.join($o);var jo=Mn;if(jo=jo.trim(),!io&&Mn.split("#").length===1){var Lo=simplePathPattern.exec(jo);if(Lo)return this.path=jo,this.href=jo,this.pathname=Lo[1],Lo[2]?(this.search=Lo[2],Fn?this.query=querystring.parse(this.search.substr(1)):this.query=this.search.substr(1)):Fn&&(this.search="",this.query={}),this}var Ho=protocolPattern.exec(jo);if(Ho){Ho=Ho[0];var zo=Ho.toLowerCase();this.protocol=zo,jo=jo.substr(Ho.length)}if(io||Ho||jo.match(/^\/\/[^@/]+@[^@/]+/)){var Go=jo.substr(0,2)==="//";Go&&!(Ho&&hostlessProtocol[Ho])&&(jo=jo.substr(2),this.slashes=!0)}if(!hostlessProtocol[Ho]&&(Go||Ho&&!slashedProtocol[Ho])){for(var Vo=-1,Yo=0;Yo<hostEndingChars.length;Yo++){var Xo=jo.indexOf(hostEndingChars[Yo]);Xo!==-1&&(Vo===-1||Xo<Vo)&&(Vo=Xo)}var is,yl;Vo===-1?yl=jo.lastIndexOf("@"):yl=jo.lastIndexOf("@",Vo),yl!==-1&&(is=jo.slice(0,yl),jo=jo.slice(yl+1),this.auth=decodeURIComponent(is)),Vo=-1;for(var Yo=0;Yo<nonHostChars.length;Yo++){var Xo=jo.indexOf(nonHostChars[Yo]);Xo!==-1&&(Vo===-1||Xo<Vo)&&(Vo=Xo)}Vo===-1&&(Vo=jo.length),this.host=jo.slice(0,Vo),jo=jo.slice(Vo),this.parseHost(),this.hostname=this.hostname||"";var us=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!us)for(var hs=this.hostname.split(/\./),Yo=0,_l=hs.length;Yo<_l;Yo++){var xl=hs[Yo];if(xl&&!xl.match(hostnamePartPattern)){for(var Il="",Ol=0,Tl=xl.length;Ol<Tl;Ol++)xl.charCodeAt(Ol)>127?Il+="x":Il+=xl[Ol];if(!Il.match(hostnamePartPattern)){var Cl=hs.slice(0,Yo),Nl=hs.slice(Yo+1),Wl=xl.match(hostnamePartStart);Wl&&(Cl.push(Wl[1]),Nl.unshift(Wl[2])),Nl.length&&(jo="/"+Nl.join(".")+jo),this.hostname=Cl.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),us||(this.hostname=punycode.toASCII(this.hostname));var Dl=this.port?":"+this.port:"",Rl=this.hostname||"";this.host=Rl+Dl,this.href+=this.host,us&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),jo[0]!=="/"&&(jo="/"+jo))}if(!unsafeProtocol[zo])for(var Yo=0,_l=autoEscape.length;Yo<_l;Yo++){var Qo=autoEscape[Yo];if(jo.indexOf(Qo)!==-1){var Jo=encodeURIComponent(Qo);Jo===Qo&&(Jo=escape(Qo)),jo=jo.split(Qo).join(Jo)}}var rs=jo.indexOf("#");rs!==-1&&(this.hash=jo.substr(rs),jo=jo.slice(0,rs));var ps=jo.indexOf("?");if(ps!==-1?(this.search=jo.substr(ps),this.query=jo.substr(ps+1),Fn&&(this.query=querystring.parse(this.query)),jo=jo.slice(0,ps)):Fn&&(this.search="",this.query={}),jo&&(this.pathname=jo),slashedProtocol[zo]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Dl=this.pathname||"",_c=this.search||"";this.path=Dl+_c}return this.href=this.format(),this};function urlFormat(Mn){return typeof Mn=="string"&&(Mn=urlParse(Mn)),Mn instanceof Url?Mn.format():Url.prototype.format.call(Mn)}Url.prototype.format=function(){var Mn=this.auth||"";Mn&&(Mn=encodeURIComponent(Mn),Mn=Mn.replace(/%3A/i,":"),Mn+="@");var Fn=this.protocol||"",io=this.pathname||"",fo=this.hash||"",$o=!1,mo="";this.host?$o=Mn+this.host:this.hostname&&($o=Mn+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&($o+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(mo=querystring.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var Ao=this.search||mo&&"?"+mo||"";return Fn&&Fn.substr(-1)!==":"&&(Fn+=":"),this.slashes||(!Fn||slashedProtocol[Fn])&&$o!==!1?($o="//"+($o||""),io&&io.charAt(0)!=="/"&&(io="/"+io)):$o||($o=""),fo&&fo.charAt(0)!=="#"&&(fo="#"+fo),Ao&&Ao.charAt(0)!=="?"&&(Ao="?"+Ao),io=io.replace(/[?#]/g,function(jo){return encodeURIComponent(jo)}),Ao=Ao.replace("#","%23"),Fn+$o+io+Ao+fo};function urlResolve(Mn,Fn){return urlParse(Mn,!1,!0).resolve(Fn)}Url.prototype.resolve=function(Mn){return this.resolveObject(urlParse(Mn,!1,!0)).format()};function urlResolveObject(Mn,Fn){return Mn?urlParse(Mn,!1,!0).resolveObject(Fn):Fn}Url.prototype.resolveObject=function(Mn){if(typeof Mn=="string"){var Fn=new Url;Fn.parse(Mn,!1,!0),Mn=Fn}for(var io=new Url,fo=Object.keys(this),$o=0;$o<fo.length;$o++){var mo=fo[$o];io[mo]=this[mo]}if(io.hash=Mn.hash,Mn.href==="")return io.href=io.format(),io;if(Mn.slashes&&!Mn.protocol){for(var Ao=Object.keys(Mn),jo=0;jo<Ao.length;jo++){var Lo=Ao[jo];Lo!=="protocol"&&(io[Lo]=Mn[Lo])}return slashedProtocol[io.protocol]&&io.hostname&&!io.pathname&&(io.pathname="/",io.path=io.pathname),io.href=io.format(),io}if(Mn.protocol&&Mn.protocol!==io.protocol){if(!slashedProtocol[Mn.protocol]){for(var Ho=Object.keys(Mn),zo=0;zo<Ho.length;zo++){var Go=Ho[zo];io[Go]=Mn[Go]}return io.href=io.format(),io}if(io.protocol=Mn.protocol,!Mn.host&&!hostlessProtocol[Mn.protocol]){for(var _l=(Mn.pathname||"").split("/");_l.length&&!(Mn.host=_l.shift()););Mn.host||(Mn.host=""),Mn.hostname||(Mn.hostname=""),_l[0]!==""&&_l.unshift(""),_l.length<2&&_l.unshift(""),io.pathname=_l.join("/")}else io.pathname=Mn.pathname;if(io.search=Mn.search,io.query=Mn.query,io.host=Mn.host||"",io.auth=Mn.auth,io.hostname=Mn.hostname||Mn.host,io.port=Mn.port,io.pathname||io.search){var Vo=io.pathname||"",Yo=io.search||"";io.path=Vo+Yo}return io.slashes=io.slashes||Mn.slashes,io.href=io.format(),io}var Xo=io.pathname&&io.pathname.charAt(0)==="/",is=Mn.host||Mn.pathname&&Mn.pathname.charAt(0)==="/",yl=is||Xo||io.host&&Mn.pathname,us=yl,hs=io.pathname&&io.pathname.split("/")||[],_l=Mn.pathname&&Mn.pathname.split("/")||[],xl=io.protocol&&!slashedProtocol[io.protocol];if(xl&&(io.hostname="",io.port=null,io.host&&(hs[0]===""?hs[0]=io.host:hs.unshift(io.host)),io.host="",Mn.protocol&&(Mn.hostname=null,Mn.port=null,Mn.host&&(_l[0]===""?_l[0]=Mn.host:_l.unshift(Mn.host)),Mn.host=null),yl=yl&&(_l[0]===""||hs[0]==="")),is)io.host=Mn.host||Mn.host===""?Mn.host:io.host,io.hostname=Mn.hostname||Mn.hostname===""?Mn.hostname:io.hostname,io.search=Mn.search,io.query=Mn.query,hs=_l;else if(_l.length)hs||(hs=[]),hs.pop(),hs=hs.concat(_l),io.search=Mn.search,io.query=Mn.query;else if(Mn.search!=null){if(xl){io.host=hs.shift(),io.hostname=io.host;var Il=io.host&&io.host.indexOf("@")>0?io.host.split("@"):!1;Il&&(io.auth=Il.shift(),io.hostname=Il.shift(),io.host=io.hostname)}return io.search=Mn.search,io.query=Mn.query,(io.pathname!==null||io.search!==null)&&(io.path=(io.pathname?io.pathname:"")+(io.search?io.search:"")),io.href=io.format(),io}if(!hs.length)return io.pathname=null,io.search?io.path="/"+io.search:io.path=null,io.href=io.format(),io;for(var Ol=hs.slice(-1)[0],Tl=(io.host||Mn.host||hs.length>1)&&(Ol==="."||Ol==="..")||Ol==="",Cl=0,Nl=hs.length;Nl>=0;Nl--)Ol=hs[Nl],Ol==="."?hs.splice(Nl,1):Ol===".."?(hs.splice(Nl,1),Cl++):Cl&&(hs.splice(Nl,1),Cl--);if(!yl&&!us)for(;Cl--;Cl)hs.unshift("..");yl&&hs[0]!==""&&(!hs[0]||hs[0].charAt(0)!=="/")&&hs.unshift(""),Tl&&hs.join("/").substr(-1)!=="/"&&hs.push("");var Wl=hs[0]===""||hs[0]&&hs[0].charAt(0)==="/";if(xl){io.hostname=Wl?"":hs.length?hs.shift():"",io.host=io.hostname;var Il=io.host&&io.host.indexOf("@")>0?io.host.split("@"):!1;Il&&(io.auth=Il.shift(),io.hostname=Il.shift(),io.host=io.hostname)}return yl=yl||io.host&&hs.length,yl&&!Wl&&hs.unshift(""),hs.length>0?io.pathname=hs.join("/"):(io.pathname=null,io.path=null),(io.pathname!==null||io.search!==null)&&(io.path=(io.pathname?io.pathname:"")+(io.search?io.search:"")),io.auth=Mn.auth||io.auth,io.slashes=io.slashes||Mn.slashes,io.href=io.format(),io};Url.prototype.parseHost=function(){var Mn=this.host,Fn=portPattern.exec(Mn);Fn&&(Fn=Fn[0],Fn!==":"&&(this.port=Fn.substr(1)),Mn=Mn.substr(0,Mn.length-Fn.length)),Mn&&(this.hostname=Mn)};var parse$7=urlParse,resolve$1=urlResolve,resolveObject=urlResolveObject,format$6=urlFormat,Url_1=Url;function normalizeArray(Mn,Fn){for(var io=0,fo=Mn.length-1;fo>=0;fo--){var $o=Mn[fo];$o==="."?Mn.splice(fo,1):$o===".."?(Mn.splice(fo,1),io++):io&&(Mn.splice(fo,1),io--)}if(Fn)for(;io--;io)Mn.unshift("..");return Mn}function resolve(){for(var Mn="",Fn=!1,io=arguments.length-1;io>=-1&&!Fn;io--){var fo=io>=0?arguments[io]:"/";if(typeof fo!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!fo)continue;Mn=fo+"/"+Mn,Fn=fo.charAt(0)==="/"}return Mn=normalizeArray(filter$1(Mn.split("/"),function($o){return!!$o}),!Fn).join("/"),(Fn?"/":"")+Mn||"."}function filter$1(Mn,Fn){if(Mn.filter)return Mn.filter(Fn);for(var io=[],fo=0;fo<Mn.length;fo++)Fn(Mn[fo],fo,Mn)&&io.push(Mn[fo]);return io}var _globalThis=function(Mn){function Fn(){var fo=this||self;return delete Mn.prototype.__magic__,fo}if(typeof globalThis=="object")return globalThis;if(this)return Fn();Mn.defineProperty(Mn.prototype,"__magic__",{configurable:!0,get:Fn});var io=__magic__;return io}(Object),formatImport=format$6,parseImport=parse$7,resolveImport=resolve$1,UrlImport=Url_1,URL$1=_globalThis.URL,URLSearchParams$2=_globalThis.URLSearchParams,percentRegEx=/%/g,backslashRegEx=/\\/g,newlineRegEx=/\n/g,carriageReturnRegEx=/\r/g,tabRegEx=/\t/g,CHAR_FORWARD_SLASH=47;function isURLInstance(Mn){var Fn=Mn??null;return!!(Fn!==null&&(Fn!=null&&Fn.href)&&(Fn!=null&&Fn.origin))}function getPathFromURLPosix(Mn){if(Mn.hostname!=="")throw new TypeError('File URL host must be "localhost" or empty on browser');for(var Fn=Mn.pathname,io=0;io<Fn.length;io++)if(Fn[io]==="%"){var fo=Fn.codePointAt(io+2)|32;if(Fn[io+1]==="2"&&fo===102)throw new TypeError("File URL path must not include encoded / characters")}return decodeURIComponent(Fn)}function encodePathChars(Mn){return Mn.includes("%")&&(Mn=Mn.replace(percentRegEx,"%25")),Mn.includes("\\")&&(Mn=Mn.replace(backslashRegEx,"%5C")),Mn.includes(`
`)&&(Mn=Mn.replace(newlineRegEx,"%0A")),Mn.includes("\r")&&(Mn=Mn.replace(carriageReturnRegEx,"%0D")),Mn.includes(" ")&&(Mn=Mn.replace(tabRegEx,"%09")),Mn}var domainToASCII=function Mn(Fn){if(typeof Fn>"u")throw new TypeError('The "domain" argument must be specified');return new URL$1("http://"+Fn).hostname},domainToUnicode=function Mn(Fn){if(typeof Fn>"u")throw new TypeError('The "domain" argument must be specified');return new URL$1("http://"+Fn).hostname},pathToFileURL=function Mn(Fn){var io=new URL$1("file://"),fo=resolve(Fn),$o=Fn.charCodeAt(Fn.length-1);return $o===CHAR_FORWARD_SLASH&&fo[fo.length-1]!=="/"&&(fo+="/"),io.pathname=encodePathChars(fo),io},fileURLToPath=function Mn(Fn){if(!isURLInstance(Fn)&&typeof Fn!="string")throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof Fn+" ("+Fn+")");var io=new URL$1(Fn);if(io.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return getPathFromURLPosix(io)},formatImportWithOverloads=function Mn(Fn,io){var fo,$o,mo,Ao;if(io===void 0&&(io={}),!(Fn instanceof URL$1))return formatImport(Fn);if(typeof io!="object"||io===null)throw new TypeError('The "options" argument must be of type object.');var jo=(fo=io.auth)!=null?fo:!0,Lo=($o=io.fragment)!=null?$o:!0,Ho=(mo=io.search)!=null?mo:!0;(Ao=io.unicode)!=null;var zo=new URL$1(Fn.toString());return jo||(zo.username="",zo.password=""),Lo||(zo.hash=""),Ho||(zo.search=""),zo.toString()},api={format:formatImportWithOverloads,parse:parseImport,resolve:resolveImport,resolveObject,Url:UrlImport,URL:URL$1,URLSearchParams:URLSearchParams$2,domainToASCII,domainToUnicode,pathToFileURL,fileURLToPath};const url=Object.freeze(Object.defineProperty({__proto__:null,URL:URL$1,URLSearchParams:URLSearchParams$2,Url:UrlImport,default:api,domainToASCII,domainToUnicode,fileURLToPath,format:formatImportWithOverloads,parse:parseImport,pathToFileURL,resolve:resolveImport,resolveObject},Symbol.toStringTag,{value:"Module"})),require$$1$2=getAugmentedNamespace(url);var hasRequiredStreamHttp;function requireStreamHttp(){return hasRequiredStreamHttp||(hasRequiredStreamHttp=1,function(Mn){var Fn=requireRequest(),io=requireResponse(),fo=immutable,$o=requireBrowser(),mo=require$$1$2,Ao=Mn;Ao.request=function(jo,Lo){typeof jo=="string"?jo=mo.parse(jo):jo=fo(jo);var Ho=commonjsGlobal$c.location.protocol.search(/^https?:$/)===-1?"http:":"",zo=jo.protocol||Ho,Go=jo.hostname||jo.host,Vo=jo.port,Yo=jo.path||"/";Go&&Go.indexOf(":")!==-1&&(Go="["+Go+"]"),jo.url=(Go?zo+"//"+Go:"")+(Vo?":"+Vo:"")+Yo,jo.method=(jo.method||"GET").toUpperCase(),jo.headers=jo.headers||{};var Xo=new Fn(jo);return Lo&&Xo.on("response",Lo),Xo},Ao.get=function(Lo,Ho){var zo=Ao.request(Lo,Ho);return zo.end(),zo},Ao.ClientRequest=Fn,Ao.IncomingMessage=io.IncomingMessage,Ao.Agent=function(){},Ao.Agent.defaultMaxSockets=4,Ao.globalAgent=new Ao.Agent,Ao.STATUS_CODES=$o,Ao.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}(streamHttp)),streamHttp}var httpsBrowserify={exports:{}},hasRequiredHttpsBrowserify;function requireHttpsBrowserify(){return hasRequiredHttpsBrowserify||(hasRequiredHttpsBrowserify=1,function(Mn){var Fn=requireStreamHttp(),io=require$$1$2,fo=Mn.exports;for(var $o in Fn)Fn.hasOwnProperty($o)&&(fo[$o]=Fn[$o]);fo.request=function(Ao,jo){return Ao=mo(Ao),Fn.request.call(this,Ao,jo)},fo.get=function(Ao,jo){return Ao=mo(Ao),Fn.get.call(this,Ao,jo)};function mo(Ao){if(typeof Ao=="string"&&(Ao=io.parse(Ao)),Ao.protocol||(Ao.protocol="https:"),Ao.protocol!=="https:")throw new Error('Protocol "'+Ao.protocol+'" not supported. Expected "https:"');return Ao}}(httpsBrowserify)),httpsBrowserify.exports}var hasRequiredFetch$1;function requireFetch$1(){if(hasRequiredFetch$1)return fetch$2;hasRequiredFetch$1=1;var Mn=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Lo){return Lo&&Lo.__esModule?Lo:{default:Lo}};Object.defineProperty(fetch$2,"__esModule",{value:!0});const Fn=Mn(requireBrowser$1()),io=Mn(requireStreamHttp()),fo=Mn(requireHttpsBrowserify()),$o=new io.default.Agent({keepAlive:!0}),mo=new fo.default.Agent({keepAlive:!0});function Ao(Lo){return Lo.protocol==="http:"?$o:mo}function jo(Lo,Ho){return(0,Fn.default)(Lo,Object.assign({agent:Ao(new URL(Lo.toString()))},Ho))}return fetch$2.default=jo,fetch$2}var __createBinding$2=commonjsGlobal$c&&commonjsGlobal$c.__createBinding||(Object.create?function(Mn,Fn,io,fo){fo===void 0&&(fo=io);var $o=Object.getOwnPropertyDescriptor(Fn,io);(!$o||("get"in $o?!Fn.__esModule:$o.writable||$o.configurable))&&($o={enumerable:!0,get:function(){return Fn[io]}}),Object.defineProperty(Mn,fo,$o)}:function(Mn,Fn,io,fo){fo===void 0&&(fo=io),Mn[fo]=Fn[io]}),__setModuleDefault$2=commonjsGlobal$c&&commonjsGlobal$c.__setModuleDefault||(Object.create?function(Mn,Fn){Object.defineProperty(Mn,"default",{enumerable:!0,value:Fn})}:function(Mn,Fn){Mn.default=Fn}),__importStar$2=commonjsGlobal$c&&commonjsGlobal$c.__importStar||function(Mn){if(Mn&&Mn.__esModule)return Mn;var Fn={};if(Mn!=null)for(var io in Mn)io!=="default"&&Object.prototype.hasOwnProperty.call(Mn,io)&&__createBinding$2(Fn,Mn,io);return __setModuleDefault$2(Fn,Mn),Fn},__awaiter$W=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})},__importDefault$i=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(fetch_json$2,"__esModule",{value:!0});fetch_json$2.fetchJson=void 0;const types_1$A=lib$i,utils_1$D=lib$j,http_errors_1$1=__importDefault$i(httpErrorsExports),exponential_backoff_1$5=exponentialBackoff$5,START_WAIT_TIME_MS$1=1e3,BACKOFF_MULTIPLIER$2=1.5,RETRY_NUMBER$2=10;function fetchJson$1(Mn,Fn){return __awaiter$W(this,void 0,void 0,function*(){let io={url:null};typeof Mn=="string"?io.url=Mn:io=Mn;const fo=yield(0,exponential_backoff_1$5.exponentialBackoff)(START_WAIT_TIME_MS$1,RETRY_NUMBER$2,BACKOFF_MULTIPLIER$2,()=>__awaiter$W(this,void 0,void 0,function*(){var $o;try{const mo=yield(($o=commonjsGlobal$c.fetch)!==null&&$o!==void 0?$o:(yield Promise.resolve().then(()=>__importStar$2(requireFetch$1()))).default)(io.url,{method:Fn?"POST":"GET",body:Fn||void 0,headers:Object.assign(Object.assign({},io.headers),{"Content-Type":"application/json"})});if(!mo.ok){if(mo.status===503)return utils_1$D.Logger.warn(`Retrying HTTP request for ${io.url} as it's not available now`),null;if(mo.status===408)return utils_1$D.Logger.warn(`Retrying HTTP request for ${io.url} as the previous connection was unused for some time`),null;throw(0,http_errors_1$1.default)(mo.status,yield mo.text())}return mo}catch(mo){if(mo.toString().includes("FetchError")||mo.toString().includes("Failed to fetch"))return utils_1$D.Logger.warn(`Retrying HTTP request for ${io.url} because of error: ${mo}`),null;throw mo}}));if(!fo)throw new types_1$A.TypedError(`Exceeded ${RETRY_NUMBER$2} attempts for ${io.url}.`,"RetriesExceeded");return yield fo.json()})}fetch_json$2.fetchJson=fetchJson$1;var __awaiter$V=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})},__rest$6=commonjsGlobal$c&&commonjsGlobal$c.__rest||function(Mn,Fn){var io={};for(var fo in Mn)Object.prototype.hasOwnProperty.call(Mn,fo)&&Fn.indexOf(fo)<0&&(io[fo]=Mn[fo]);if(Mn!=null&&typeof Object.getOwnPropertySymbols=="function")for(var $o=0,fo=Object.getOwnPropertySymbols(Mn);$o<fo.length;$o++)Fn.indexOf(fo[$o])<0&&Object.prototype.propertyIsEnumerable.call(Mn,fo[$o])&&(io[fo[$o]]=Mn[fo[$o]]);return io};Object.defineProperty(jsonRpcProvider$5,"__esModule",{value:!0});jsonRpcProvider$5.JsonRpcProvider=void 0;const utils_1$C=lib$j,types_1$z=lib$i,transactions_1$g=lib$f,exponential_backoff_1$4=exponentialBackoff$5,provider_1$5=provider$7,fetch_json_1$2=fetch_json$2,REQUEST_RETRY_NUMBER$2=12,REQUEST_RETRY_WAIT$2=500,REQUEST_RETRY_WAIT_BACKOFF$2=1.5;let _nextId$2=123,JsonRpcProvider$2=class extends provider_1$5.Provider{constructor(Fn,io){super(),this.connection=Fn||{url:""};const fo={retries:REQUEST_RETRY_NUMBER$2,wait:REQUEST_RETRY_WAIT$2,backoff:REQUEST_RETRY_WAIT_BACKOFF$2};this.options=Object.assign({},fo,io)}status(){return __awaiter$V(this,void 0,void 0,function*(){return this.sendJsonRpc("status",[])})}sendTransactionUntil(Fn,io){return __awaiter$V(this,void 0,void 0,function*(){const fo=(0,transactions_1$g.encodeTransaction)(Fn);return this.sendJsonRpc("send_tx",{signed_tx_base64:Buffer$D.from(fo).toString("base64"),wait_until:io})})}sendTransaction(Fn){return __awaiter$V(this,void 0,void 0,function*(){return this.sendTransactionUntil(Fn,"EXECUTED_OPTIMISTIC")})}sendTransactionAsync(Fn){return __awaiter$V(this,void 0,void 0,function*(){return this.sendTransactionUntil(Fn,"NONE")})}txStatus(Fn,io,fo="EXECUTED_OPTIMISTIC"){return __awaiter$V(this,void 0,void 0,function*(){return typeof Fn=="string"?this.txStatusString(Fn,io,fo):this.txStatusUint8Array(Fn,io,fo)})}txStatusUint8Array(Fn,io,fo){return __awaiter$V(this,void 0,void 0,function*(){return this.sendJsonRpc("tx",{tx_hash:(0,utils_1$C.baseEncode)(Fn),sender_account_id:io,wait_until:fo})})}txStatusString(Fn,io,fo){return __awaiter$V(this,void 0,void 0,function*(){return this.sendJsonRpc("tx",{tx_hash:Fn,sender_account_id:io,wait_until:fo})})}txStatusReceipts(Fn,io,fo="EXECUTED_OPTIMISTIC"){return __awaiter$V(this,void 0,void 0,function*(){return typeof Fn=="string"?this.sendJsonRpc("EXPERIMENTAL_tx_status",{tx_hash:Fn,sender_account_id:io,wait_until:fo}):this.sendJsonRpc("EXPERIMENTAL_tx_status",{tx_hash:(0,utils_1$C.baseEncode)(Fn),sender_account_id:io,wait_until:fo})})}query(...Fn){return __awaiter$V(this,void 0,void 0,function*(){let io;if(Fn.length===1){const fo=Fn[0],{block_id:$o,blockId:mo}=fo,Ao=__rest$6(fo,["block_id","blockId"]);io=yield this.sendJsonRpc("query",Object.assign(Object.assign({},Ao),{block_id:$o||mo}))}else{const[fo,$o]=Fn;io=yield this.sendJsonRpc("query",[fo,$o])}if(io&&io.error)throw new types_1$z.TypedError(`Querying failed: ${io.error}.
${JSON.stringify(io,null,2)}`,(0,utils_1$C.getErrorTypeFromErrorMessage)(io.error,io.error.name));return io})}block(Fn){return __awaiter$V(this,void 0,void 0,function*(){const{finality:io}=Fn,{blockId:fo}=Fn;return this.sendJsonRpc("block",{block_id:fo,finality:io})})}blockChanges(Fn){return __awaiter$V(this,void 0,void 0,function*(){const{finality:io}=Fn,{blockId:fo}=Fn;return this.sendJsonRpc("EXPERIMENTAL_changes_in_block",{block_id:fo,finality:io})})}chunk(Fn){return __awaiter$V(this,void 0,void 0,function*(){return this.sendJsonRpc("chunk",[Fn])})}validators(Fn){return __awaiter$V(this,void 0,void 0,function*(){return this.sendJsonRpc("validators",[Fn])})}experimental_protocolConfig(Fn){return __awaiter$V(this,void 0,void 0,function*(){const io=Fn,{blockId:fo}=io,$o=__rest$6(io,["blockId"]);return yield this.sendJsonRpc("EXPERIMENTAL_protocol_config",Object.assign(Object.assign({},$o),{block_id:fo}))})}lightClientProof(Fn){return __awaiter$V(this,void 0,void 0,function*(){return yield this.sendJsonRpc("EXPERIMENTAL_light_client_proof",Fn)})}nextLightClientBlock(Fn){return __awaiter$V(this,void 0,void 0,function*(){return yield this.sendJsonRpc("next_light_client_block",Fn)})}accessKeyChanges(Fn,io){return __awaiter$V(this,void 0,void 0,function*(){const{finality:fo}=io,{blockId:$o}=io;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"all_access_key_changes",account_ids:Fn,block_id:$o,finality:fo})})}singleAccessKeyChanges(Fn,io){return __awaiter$V(this,void 0,void 0,function*(){const{finality:fo}=io,{blockId:$o}=io;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"single_access_key_changes",keys:Fn,block_id:$o,finality:fo})})}accountChanges(Fn,io){return __awaiter$V(this,void 0,void 0,function*(){const{finality:fo}=io,{blockId:$o}=io;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"account_changes",account_ids:Fn,block_id:$o,finality:fo})})}contractStateChanges(Fn,io,fo=""){return __awaiter$V(this,void 0,void 0,function*(){const{finality:$o}=io,{blockId:mo}=io;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"data_changes",account_ids:Fn,key_prefix_base64:fo,block_id:mo,finality:$o})})}contractCodeChanges(Fn,io){return __awaiter$V(this,void 0,void 0,function*(){const{finality:fo}=io,{blockId:$o}=io;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"contract_code_changes",account_ids:Fn,block_id:$o,finality:fo})})}gasPrice(Fn){return __awaiter$V(this,void 0,void 0,function*(){return yield this.sendJsonRpc("gas_price",[Fn])})}sendJsonRpc(Fn,io){return __awaiter$V(this,void 0,void 0,function*(){const fo=yield(0,exponential_backoff_1$4.exponentialBackoff)(this.options.wait,this.options.retries,this.options.backoff,()=>__awaiter$V(this,void 0,void 0,function*(){var mo;try{const Ao={method:Fn,params:io,id:_nextId$2++,jsonrpc:"2.0"},jo=yield(0,fetch_json_1$2.fetchJson)(this.connection,JSON.stringify(Ao));if(jo.error){if(typeof jo.error.data=="object")throw typeof jo.error.data.error_message=="string"&&typeof jo.error.data.error_type=="string"?new types_1$z.TypedError(jo.error.data.error_message,jo.error.data.error_type):(0,utils_1$C.parseRpcError)(jo.error.data);{const Lo=`[${jo.error.code}] ${jo.error.message}: ${jo.error.data}`;if(jo.error.data==="Timeout"||Lo.includes("Timeout error")||Lo.includes("query has timed out"))throw new types_1$z.TypedError(Lo,"TimeoutError");const Ho=(0,utils_1$C.getErrorTypeFromErrorMessage)(jo.error.data,"");throw Ho?new types_1$z.TypedError((0,utils_1$C.formatError)(Ho,io),Ho):new types_1$z.TypedError(Lo,jo.error.name)}}else if(typeof((mo=jo.result)===null||mo===void 0?void 0:mo.error)=="string"){const Lo=(0,utils_1$C.getErrorTypeFromErrorMessage)(jo.result.error,"");if(Lo)throw new utils_1$C.ServerError((0,utils_1$C.formatError)(Lo,io),Lo)}return jo}catch(Ao){if(Ao.type==="TimeoutError")return utils_1$C.Logger.warn(`Retrying request to ${Fn} as it has timed out`,io),null;throw Ao}})),{result:$o}=fo;if(typeof $o>"u")throw new types_1$z.TypedError(`Exceeded ${this.options.retries} attempts for request to ${Fn}.`,"RetriesExceeded");return $o})}};jsonRpcProvider$5.JsonRpcProvider=JsonRpcProvider$2;var failoverRpcProvider$5={},__awaiter$U=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(failoverRpcProvider$5,"__esModule",{value:!0});failoverRpcProvider$5.FailoverRpcProvider=void 0;const utils_1$B=lib$j,types_1$y=lib$i,provider_1$4=provider$7;let FailoverRpcProvider$2=class extends provider_1$4.Provider{constructor(Fn){if(super(),Fn.length===0)throw new Error("At least one provider must be specified");this.providers=Fn,this.currentProviderIndex=0}switchToNextProvider(){this.providers.length!==1&&(this.providers.length-1<=this.currentProviderIndex?this.currentProviderIndex=0:this.currentProviderIndex+=1,utils_1$B.Logger.debug(`Switched to provider at the index ${this.currentProviderIndex}`))}get currentProvider(){const Fn=this.providers[this.currentProviderIndex];if(!Fn)throw new Error(`Provider wasn't found at index ${this.currentProviderIndex}`);return Fn}withBackoff(Fn){return __awaiter$U(this,void 0,void 0,function*(){for(let io=0;io<this.providers.length;io++)try{const fo=yield Fn(this.currentProvider);if(fo)return fo}catch{this.switchToNextProvider()}throw new types_1$y.TypedError(`Exceeded ${this.providers.length} providers to execute request`,"RetriesExceeded")})}status(){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(Fn=>Fn.status())})}sendTransactionUntil(Fn,io){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(fo=>fo.sendTransactionUntil(Fn,io))})}sendTransaction(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.sendTransaction(Fn))})}sendTransactionAsync(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.sendTransactionAsync(Fn))})}txStatus(Fn,io,fo){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff($o=>$o.txStatus(Fn,io,fo))})}txStatusReceipts(Fn,io,fo){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff($o=>$o.txStatusReceipts(Fn,io,fo))})}query(Fn,io){return __awaiter$U(this,void 0,void 0,function*(){return io?this.withBackoff(fo=>fo.query(Fn,io)):this.withBackoff(fo=>fo.query(Fn))})}block(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.block(Fn))})}blockChanges(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.blockChanges(Fn))})}chunk(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.chunk(Fn))})}validators(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.validators(Fn))})}experimental_protocolConfig(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.experimental_protocolConfig(Fn))})}lightClientProof(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.lightClientProof(Fn))})}nextLightClientBlock(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.nextLightClientBlock(Fn))})}accessKeyChanges(Fn,io){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(fo=>fo.accessKeyChanges(Fn,io))})}singleAccessKeyChanges(Fn,io){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(fo=>fo.singleAccessKeyChanges(Fn,io))})}accountChanges(Fn,io){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(fo=>fo.accountChanges(Fn,io))})}contractStateChanges(Fn,io,fo=""){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff($o=>$o.contractStateChanges(Fn,io,fo))})}contractCodeChanges(Fn,io){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(fo=>fo.contractCodeChanges(Fn,io))})}gasPrice(Fn){return __awaiter$U(this,void 0,void 0,function*(){return this.withBackoff(io=>io.gasPrice(Fn))})}};failoverRpcProvider$5.FailoverRpcProvider=FailoverRpcProvider$2;(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.fetchJson=Mn.Provider=Mn.FailoverRpcProvider=Mn.JsonRpcProvider=Mn.exponentialBackoff=void 0;var Fn=exponentialBackoff$5;Object.defineProperty(Mn,"exponentialBackoff",{enumerable:!0,get:function(){return Fn.exponentialBackoff}});var io=jsonRpcProvider$5;Object.defineProperty(Mn,"JsonRpcProvider",{enumerable:!0,get:function(){return io.JsonRpcProvider}});var fo=failoverRpcProvider$5;Object.defineProperty(Mn,"FailoverRpcProvider",{enumerable:!0,get:function(){return fo.FailoverRpcProvider}});var $o=provider$7;Object.defineProperty(Mn,"Provider",{enumerable:!0,get:function(){return $o.Provider}});var mo=fetch_json$2;Object.defineProperty(Mn,"fetchJson",{enumerable:!0,get:function(){return mo.fetchJson}})})(lib$g);(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.FinalExecutionStatusBasic=Mn.ExecutionStatusBasic=Mn.IdType=Mn.Provider=Mn.getTransactionLastResult=void 0;var Fn=lib$j;Object.defineProperty(Mn,"getTransactionLastResult",{enumerable:!0,get:function(){return Fn.getTransactionLastResult}});var io=lib$g;Object.defineProperty(Mn,"Provider",{enumerable:!0,get:function(){return io.Provider}});var fo=lib$i;Object.defineProperty(Mn,"IdType",{enumerable:!0,get:function(){return fo.IdType}}),Object.defineProperty(Mn,"ExecutionStatusBasic",{enumerable:!0,get:function(){return fo.ExecutionStatusBasic}}),Object.defineProperty(Mn,"FinalExecutionStatusBasic",{enumerable:!0,get:function(){return fo.FinalExecutionStatusBasic}})})(provider$8);var jsonRpcProvider$4={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.JsonRpcProvider=Mn.TypedError=Mn.ErrorContext=void 0;var Fn=lib$i;Object.defineProperty(Mn,"ErrorContext",{enumerable:!0,get:function(){return Fn.ErrorContext}}),Object.defineProperty(Mn,"TypedError",{enumerable:!0,get:function(){return Fn.TypedError}});var io=lib$g;Object.defineProperty(Mn,"JsonRpcProvider",{enumerable:!0,get:function(){return io.JsonRpcProvider}})})(jsonRpcProvider$4);var failoverRpcProvider$4={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.FailoverRpcProvider=void 0;var Fn=lib$g;Object.defineProperty(Mn,"FailoverRpcProvider",{enumerable:!0,get:function(){return Fn.FailoverRpcProvider}})})(failoverRpcProvider$4);(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.ErrorContext=Mn.TypedError=Mn.getTransactionLastResult=Mn.FinalExecutionStatusBasic=Mn.FailoverRpcProvider=Mn.JsonRpcProvider=Mn.Provider=void 0;const Fn=provider$8;Object.defineProperty(Mn,"Provider",{enumerable:!0,get:function(){return Fn.Provider}}),Object.defineProperty(Mn,"getTransactionLastResult",{enumerable:!0,get:function(){return Fn.getTransactionLastResult}}),Object.defineProperty(Mn,"FinalExecutionStatusBasic",{enumerable:!0,get:function(){return Fn.FinalExecutionStatusBasic}});const io=jsonRpcProvider$4;Object.defineProperty(Mn,"JsonRpcProvider",{enumerable:!0,get:function(){return io.JsonRpcProvider}}),Object.defineProperty(Mn,"TypedError",{enumerable:!0,get:function(){return io.TypedError}}),Object.defineProperty(Mn,"ErrorContext",{enumerable:!0,get:function(){return io.ErrorContext}});const fo=failoverRpcProvider$4;Object.defineProperty(Mn,"FailoverRpcProvider",{enumerable:!0,get:function(){return fo.FailoverRpcProvider}})})(providers$2);var utils$d={},key_pair$3={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.PublicKey=Mn.KeyType=Mn.KeyPairEd25519=Mn.KeyPair=void 0;var Fn=lib$k;Object.defineProperty(Mn,"KeyPair",{enumerable:!0,get:function(){return Fn.KeyPair}}),Object.defineProperty(Mn,"KeyPairEd25519",{enumerable:!0,get:function(){return Fn.KeyPairEd25519}}),Object.defineProperty(Mn,"KeyType",{enumerable:!0,get:function(){return Fn.KeyType}}),Object.defineProperty(Mn,"PublicKey",{enumerable:!0,get:function(){return Fn.PublicKey}})})(key_pair$3);var serialize$4={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.base_decode=Mn.base_encode=Mn.deserialize=Mn.serialize=void 0;var Fn=cjs;Object.defineProperty(Mn,"serialize",{enumerable:!0,get:function(){return Fn.serialize}}),Object.defineProperty(Mn,"deserialize",{enumerable:!0,get:function(){return Fn.deserialize}});var io=lib$j;Object.defineProperty(Mn,"base_encode",{enumerable:!0,get:function(){return io.baseEncode}}),Object.defineProperty(Mn,"base_decode",{enumerable:!0,get:function(){return io.baseDecode}})})(serialize$4);var web$1={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.fetchJson=void 0;var Fn=lib$g;Object.defineProperty(Mn,"fetchJson",{enumerable:!0,get:function(){return Fn.fetchJson}})})(web$1);var enums$2={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.Enum=Mn.Assignable=void 0;var Fn=lib$i;Object.defineProperty(Mn,"Assignable",{enumerable:!0,get:function(){return Fn.Assignable}});class io{constructor($o){if(Object.keys($o).length!==1)throw new Error("Enum can only take single value");Object.keys($o).map(mo=>{this[mo]=$o[mo],this.enum=mo})}}Mn.Enum=io})(enums$2);var format$5={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.parseNearAmount=Mn.formatNearAmount=Mn.NEAR_NOMINATION_EXP=Mn.NEAR_NOMINATION=void 0;var Fn=lib$j;Object.defineProperty(Mn,"NEAR_NOMINATION",{enumerable:!0,get:function(){return Fn.NEAR_NOMINATION}}),Object.defineProperty(Mn,"NEAR_NOMINATION_EXP",{enumerable:!0,get:function(){return Fn.NEAR_NOMINATION_EXP}}),Object.defineProperty(Mn,"formatNearAmount",{enumerable:!0,get:function(){return Fn.formatNearAmount}}),Object.defineProperty(Mn,"parseNearAmount",{enumerable:!0,get:function(){return Fn.parseNearAmount}})})(format$5);var rpc_errors$4={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.ServerError=Mn.getErrorTypeFromErrorMessage=Mn.formatError=Mn.parseResultError=Mn.parseRpcError=void 0;var Fn=lib$j;Object.defineProperty(Mn,"parseRpcError",{enumerable:!0,get:function(){return Fn.parseRpcError}}),Object.defineProperty(Mn,"parseResultError",{enumerable:!0,get:function(){return Fn.parseResultError}}),Object.defineProperty(Mn,"formatError",{enumerable:!0,get:function(){return Fn.formatError}}),Object.defineProperty(Mn,"getErrorTypeFromErrorMessage",{enumerable:!0,get:function(){return Fn.getErrorTypeFromErrorMessage}}),Object.defineProperty(Mn,"ServerError",{enumerable:!0,get:function(){return Fn.ServerError}})})(rpc_errors$4);var errors$9={},lib$d={},account$5={},utils$c={},__awaiter$T=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(utils$c,"__esModule",{value:!0});utils$c.viewFunction=utils$c.viewState=utils$c.encodeJSContractArgs=utils$c.validateArgs=void 0;const types_1$x=lib$i,utils_1$A=lib$j;function parseJsonFromRawResponse$2(Mn){return JSON.parse(Buffer$D.from(Mn).toString())}function bytesJsonStringify$2(Mn){return Buffer$D.from(JSON.stringify(Mn))}function validateArgs$2(Mn){if(!(Mn.byteLength!==void 0&&Mn.byteLength===Mn.length)&&(Array.isArray(Mn)||typeof Mn!="object"))throw new types_1$x.PositionalArgsError}utils$c.validateArgs=validateArgs$2;function encodeJSContractArgs$2(Mn,Fn,io){return Buffer$D.concat([Buffer$D.from(Mn),Buffer$D.from([0]),Buffer$D.from(Fn),Buffer$D.from([0]),Buffer$D.from(io)])}utils$c.encodeJSContractArgs=encodeJSContractArgs$2;function viewState$2(Mn,Fn,io,fo={finality:"optimistic"}){return __awaiter$T(this,void 0,void 0,function*(){const{values:$o}=yield Mn.provider.query(Object.assign(Object.assign({request_type:"view_state"},fo),{account_id:Fn,prefix_base64:Buffer$D.from(io).toString("base64")}));return $o.map(({key:mo,value:Ao})=>({key:Buffer$D.from(mo,"base64"),value:Buffer$D.from(Ao,"base64")}))})}utils$c.viewState=viewState$2;function viewFunction$2(Mn,{contractId:Fn,methodName:io,args:fo={},parse:$o=parseJsonFromRawResponse$2,stringify:mo=bytesJsonStringify$2,jsContract:Ao=!1,blockQuery:jo={finality:"optimistic"}}){return __awaiter$T(this,void 0,void 0,function*(){let Lo;validateArgs$2(fo),Ao?Lo=encodeJSContractArgs$2(Fn,io,Object.keys(fo).length>0?JSON.stringify(fo):""):Lo=mo(fo);const Ho=yield Mn.provider.query(Object.assign(Object.assign({request_type:"call_function"},jo),{account_id:Ao?Mn.jsvmAccountId:Fn,method_name:Ao?"view_js_contract":io,args_base64:Lo.toString("base64")}));return Ho.logs&&(0,utils_1$A.printTxOutcomeLogs)({contractId:Fn,logs:Ho.logs}),Ho.result&&Ho.result.length>0&&$o(Buffer$D.from(Ho.result))})}utils$c.viewFunction=viewFunction$2;var __awaiter$S=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(account$5,"__esModule",{value:!0});account$5.Account=void 0;const crypto_1$q=lib$k,providers_1$a=lib$g,transactions_1$f=lib$f,types_1$w=lib$i,utils_1$z=lib$j,utils_2$9=utils$c,{addKey:addKey$9,createAccount:createAccount$6,deleteAccount:deleteAccount$6,deleteKey:deleteKey$9,deployContract:deployContract$c,fullAccessKey:fullAccessKey$7,functionCall:functionCall$c,functionCallAccessKey:functionCallAccessKey$7,stake:stake$6,transfer:transfer$6}=transactions_1$f.actionCreators,TX_NONCE_RETRY_NUMBER$2=12,TX_NONCE_RETRY_WAIT$2=500,TX_NONCE_RETRY_WAIT_BACKOFF$2=1.5;let Account$2=class p_{constructor(Fn,io){this.accessKeyByPublicKeyCache={},this.connection=Fn,this.accountId=io}getConnection(){return this.connection}state(){return __awaiter$S(this,void 0,void 0,function*(){return this.connection.provider.query({request_type:"view_account",account_id:this.accountId,finality:"optimistic"})})}signTransaction(Fn,io){return __awaiter$S(this,void 0,void 0,function*(){const fo=yield this.findAccessKey(Fn,io);if(!fo)throw new types_1$w.TypedError(`Can not sign transactions for account ${this.accountId} on network ${this.connection.networkId}, no matching key pair exists for this account`,"KeyNotFound");const{accessKey:$o}=fo,Ao=(yield this.connection.provider.block({finality:"final"})).header.hash,jo=$o.nonce+BigInt(1);return yield(0,transactions_1$f.signTransaction)(Fn,jo,io,(0,utils_1$z.baseDecode)(Ao),this.connection.signer,this.accountId,this.connection.networkId)})}signAndSendTransaction({receiverId:Fn,actions:io,returnError:fo}){return __awaiter$S(this,void 0,void 0,function*(){let $o,mo;const Ao=yield(0,providers_1$a.exponentialBackoff)(TX_NONCE_RETRY_WAIT$2,TX_NONCE_RETRY_NUMBER$2,TX_NONCE_RETRY_WAIT_BACKOFF$2,()=>__awaiter$S(this,void 0,void 0,function*(){[$o,mo]=yield this.signTransaction(Fn,io);const jo=mo.transaction.publicKey;try{return yield this.connection.provider.sendTransaction(mo)}catch(Lo){if(Lo.type==="InvalidNonce")return utils_1$z.Logger.warn(`Retrying transaction ${Fn}:${(0,utils_1$z.baseEncode)($o)} with new nonce.`),delete this.accessKeyByPublicKeyCache[jo.toString()],null;if(Lo.type==="Expired")return utils_1$z.Logger.warn(`Retrying transaction ${Fn}:${(0,utils_1$z.baseEncode)($o)} due to expired block hash`),null;throw Lo.context=new types_1$w.ErrorContext((0,utils_1$z.baseEncode)($o)),Lo}}));if(!Ao)throw new types_1$w.TypedError("nonce retries exceeded for transaction. This usually means there are too many parallel requests with the same access key.","RetriesExceeded");if((0,utils_1$z.printTxOutcomeLogsAndFailures)({contractId:mo.transaction.receiverId,outcome:Ao}),!fo&&typeof Ao.status=="object"&&typeof Ao.status.Failure=="object"&&Ao.status.Failure!==null)throw Ao.status.Failure.error_message&&Ao.status.Failure.error_type?new types_1$w.TypedError(`Transaction ${Ao.transaction_outcome.id} failed. ${Ao.status.Failure.error_message}`,Ao.status.Failure.error_type):(0,utils_1$z.parseResultError)(Ao);return Ao})}findAccessKey(Fn,io){return __awaiter$S(this,void 0,void 0,function*(){const fo=yield this.connection.signer.getPublicKey(this.accountId,this.connection.networkId);if(!fo)throw new types_1$w.TypedError(`no matching key pair found in ${this.connection.signer}`,"PublicKeyNotFound");const $o=this.accessKeyByPublicKeyCache[fo.toString()];if($o!==void 0)return{publicKey:fo,accessKey:$o};try{const mo=yield this.connection.provider.query({request_type:"view_access_key",account_id:this.accountId,public_key:fo.toString(),finality:"optimistic"}),Ao=Object.assign(Object.assign({},mo),{nonce:BigInt(mo.nonce||0)});return this.accessKeyByPublicKeyCache[fo.toString()]?{publicKey:fo,accessKey:this.accessKeyByPublicKeyCache[fo.toString()]}:(this.accessKeyByPublicKeyCache[fo.toString()]=Ao,{publicKey:fo,accessKey:Ao})}catch(mo){if(mo.type=="AccessKeyDoesNotExist")return null;throw mo}})}createAndDeployContract(Fn,io,fo,$o){return __awaiter$S(this,void 0,void 0,function*(){const mo=fullAccessKey$7();return yield this.signAndSendTransaction({receiverId:Fn,actions:[createAccount$6(),transfer$6($o),addKey$9(crypto_1$q.PublicKey.from(io),mo),deployContract$c(fo)]}),new p_(this.connection,Fn)})}sendMoney(Fn,io){return __awaiter$S(this,void 0,void 0,function*(){return this.signAndSendTransaction({receiverId:Fn,actions:[transfer$6(io)]})})}createAccount(Fn,io,fo){return __awaiter$S(this,void 0,void 0,function*(){const $o=fullAccessKey$7();return this.signAndSendTransaction({receiverId:Fn,actions:[createAccount$6(),transfer$6(fo),addKey$9(crypto_1$q.PublicKey.from(io),$o)]})})}deleteAccount(Fn){return __awaiter$S(this,void 0,void 0,function*(){return utils_1$z.Logger.log("Deleting an account does not automatically transfer NFTs and FTs to the beneficiary address. Ensure to transfer assets before deleting."),this.signAndSendTransaction({receiverId:this.accountId,actions:[deleteAccount$6(Fn)]})})}deployContract(Fn){return __awaiter$S(this,void 0,void 0,function*(){return this.signAndSendTransaction({receiverId:this.accountId,actions:[deployContract$c(Fn)]})})}encodeJSContractArgs(Fn,io,fo){return Buffer$D.concat([Buffer$D.from(Fn),Buffer$D.from([0]),Buffer$D.from(io),Buffer$D.from([0]),Buffer$D.from(fo)])}functionCall({contractId:Fn,methodName:io,args:fo={},gas:$o=utils_1$z.DEFAULT_FUNCTION_CALL_GAS,attachedDeposit:mo,walletMeta:Ao,walletCallbackUrl:jo,stringify:Lo,jsContract:Ho}){return __awaiter$S(this,void 0,void 0,function*(){this.validateArgs(fo);let zo;if(Ho)zo=["call_js_contract",this.encodeJSContractArgs(Fn,io,JSON.stringify(fo)),$o,mo,null,!0];else{const Go=Lo===void 0?transactions_1$f.stringifyJsonOrBytes:Lo;zo=[io,fo,$o,mo,Go,!1]}return this.signAndSendTransaction({receiverId:Ho?this.connection.jsvmAccountId:Fn,actions:[functionCall$c.apply(void 0,zo)],walletMeta:Ao,walletCallbackUrl:jo})})}addKey(Fn,io,fo,$o){return __awaiter$S(this,void 0,void 0,function*(){fo||(fo=[]),Array.isArray(fo)||(fo=[fo]);let mo;return io?mo=functionCallAccessKey$7(io,fo,$o):mo=fullAccessKey$7(),this.signAndSendTransaction({receiverId:this.accountId,actions:[addKey$9(crypto_1$q.PublicKey.from(Fn),mo)]})})}deleteKey(Fn){return __awaiter$S(this,void 0,void 0,function*(){return this.signAndSendTransaction({receiverId:this.accountId,actions:[deleteKey$9(crypto_1$q.PublicKey.from(Fn))]})})}stake(Fn,io){return __awaiter$S(this,void 0,void 0,function*(){return this.signAndSendTransaction({receiverId:this.accountId,actions:[stake$6(io,crypto_1$q.PublicKey.from(Fn))]})})}signedDelegate({actions:Fn,blockHeightTtl:io,receiverId:fo}){return __awaiter$S(this,void 0,void 0,function*(){const{provider:$o,signer:mo}=this.connection,{header:Ao}=yield $o.block({finality:"final"}),{accessKey:jo,publicKey:Lo}=yield this.findAccessKey(null,null),Ho=(0,transactions_1$f.buildDelegateAction)({actions:Fn,maxBlockHeight:BigInt(Ao.height)+BigInt(io),nonce:BigInt(jo.nonce)+BigInt(1),publicKey:Lo,receiverId:fo,senderId:this.accountId}),{signedDelegateAction:zo}=yield(0,transactions_1$f.signDelegateAction)({delegateAction:Ho,signer:{sign:Go=>__awaiter$S(this,void 0,void 0,function*(){const{signature:Vo}=yield mo.signMessage(Go,Ho.senderId,this.connection.networkId);return Vo})}});return zo})}validateArgs(Fn){if(!(Fn.byteLength!==void 0&&Fn.byteLength===Fn.length)&&(Array.isArray(Fn)||typeof Fn!="object"))throw new types_1$w.PositionalArgsError}viewFunction(Fn){return __awaiter$S(this,void 0,void 0,function*(){return yield(0,utils_2$9.viewFunction)(this.connection,Fn)})}viewState(Fn,io={finality:"optimistic"}){return __awaiter$S(this,void 0,void 0,function*(){return yield(0,utils_2$9.viewState)(this.connection,this.accountId,Fn,io)})}getAccessKeys(){var Fn;return __awaiter$S(this,void 0,void 0,function*(){const io=yield this.connection.provider.query({request_type:"view_access_key_list",account_id:this.accountId,finality:"optimistic"});return(Fn=io==null?void 0:io.keys)===null||Fn===void 0?void 0:Fn.map(fo=>Object.assign(Object.assign({},fo),{access_key:Object.assign(Object.assign({},fo.access_key),{nonce:BigInt(fo.access_key.nonce)})}))})}getAccountDetails(){return __awaiter$S(this,void 0,void 0,function*(){return{authorizedApps:(yield this.getAccessKeys()).filter(fo=>fo.access_key.permission!=="FullAccess").map(fo=>{const $o=fo.access_key.permission;return{contractId:$o.FunctionCall.receiver_id,amount:$o.FunctionCall.allowance,publicKey:fo.public_key}})}})}getAccountBalance(){return __awaiter$S(this,void 0,void 0,function*(){const Fn=yield this.connection.provider.experimental_protocolConfig({finality:"final"}),io=yield this.state(),fo=BigInt(Fn.runtime_config.storage_amount_per_byte),$o=BigInt(io.storage_usage)*fo,mo=BigInt(io.locked),Ao=BigInt(io.amount)+mo,jo=Ao-(mo>$o?mo:$o);return{total:Ao.toString(),stateStaked:$o.toString(),staked:mo.toString(),available:jo.toString()}})}getActiveDelegatedStakeBalance(){return __awaiter$S(this,void 0,void 0,function*(){const Fn=yield this.connection.provider.block({finality:"final"}),io=Fn.header.hash,fo=Fn.header.epoch_id,{current_validators:$o,next_validators:mo,current_proposals:Ao}=yield this.connection.provider.validators(fo),jo=new Set;[...$o,...mo,...Ao].forEach(Yo=>jo.add(Yo.account_id));const Lo=[...jo],Ho=Lo.map(Yo=>this.viewFunction({contractId:Yo,methodName:"get_account_total_balance",args:{account_id:this.accountId},blockQuery:{blockId:io}})),zo=yield Promise.allSettled(Ho);if(zo.some(Yo=>Yo.status==="rejected"&&Yo.reason.type==="TimeoutError"))throw new Error("Failed to get delegated stake balance");const Vo=zo.reduce((Yo,Xo,is)=>{const yl=Lo[is];if(Xo.status==="fulfilled"){const us=BigInt(Xo.value);if(us!==BigInt(0))return Object.assign(Object.assign({},Yo),{stakedValidators:[...Yo.stakedValidators,{validatorId:yl,amount:us.toString()}],total:Yo.total+us})}return Xo.status==="rejected"?Object.assign(Object.assign({},Yo),{failedValidators:[...Yo.failedValidators,{validatorId:yl,error:Xo.reason}]}):Yo},{stakedValidators:[],failedValidators:[],total:BigInt(0)});return Object.assign(Object.assign({},Vo),{total:Vo.total.toString()})})}};account$5.Account=Account$2;var account_2fa$2={},account_multisig$5={},constants$7={};Object.defineProperty(constants$7,"__esModule",{value:!0});constants$7.MULTISIG_CONFIRM_METHODS=constants$7.MULTISIG_CHANGE_METHODS=constants$7.MULTISIG_DEPOSIT=constants$7.MULTISIG_GAS=constants$7.MULTISIG_ALLOWANCE=constants$7.MULTISIG_STORAGE_KEY=void 0;const utils_1$y=lib$j;constants$7.MULTISIG_STORAGE_KEY="__multisigRequest";constants$7.MULTISIG_ALLOWANCE=BigInt((0,utils_1$y.parseNearAmount)("1"));constants$7.MULTISIG_GAS=BigInt("100000000000000");constants$7.MULTISIG_DEPOSIT=BigInt("0");constants$7.MULTISIG_CHANGE_METHODS=["add_request","add_request_and_confirm","delete_request","confirm"];constants$7.MULTISIG_CONFIRM_METHODS=["confirm"];var types$4={};(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.MultisigStateStatus=Mn.MultisigDeleteRequestRejectionError=void 0,function(Fn){Fn.CANNOT_DESERIALIZE_STATE="Cannot deserialize the contract state",Fn.MULTISIG_NOT_INITIALIZED="Smart contract panicked: Multisig contract should be initialized before usage",Fn.NO_SUCH_REQUEST="Smart contract panicked: panicked at 'No such request: either wrong number or already confirmed'",Fn.REQUEST_COOLDOWN_ERROR="Request cannot be deleted immediately after creation.",Fn.METHOD_NOT_FOUND="Contract method is not found"}(Mn.MultisigDeleteRequestRejectionError||(Mn.MultisigDeleteRequestRejectionError={})),function(Fn){Fn[Fn.INVALID_STATE=0]="INVALID_STATE",Fn[Fn.STATE_NOT_INITIALIZED=1]="STATE_NOT_INITIALIZED",Fn[Fn.VALID_STATE=2]="VALID_STATE",Fn[Fn.UNKNOWN_STATE=3]="UNKNOWN_STATE"}(Mn.MultisigStateStatus||(Mn.MultisigStateStatus={}))})(types$4);var __awaiter$R=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(account_multisig$5,"__esModule",{value:!0});account_multisig$5.AccountMultisig=void 0;const transactions_1$e=lib$f,utils_1$x=lib$j,account_1$5=account$5,constants_1$7=constants$7,types_1$v=types$4,{deployContract:deployContract$b,functionCall:functionCall$b}=transactions_1$e.actionCreators;var MultisigCodeStatus$2;(function(Mn){Mn[Mn.INVALID_CODE=0]="INVALID_CODE",Mn[Mn.VALID_CODE=1]="VALID_CODE",Mn[Mn.UNKNOWN_CODE=2]="UNKNOWN_CODE"})(MultisigCodeStatus$2||(MultisigCodeStatus$2={}));const storageFallback$2={[constants_1$7.MULTISIG_STORAGE_KEY]:null};let AccountMultisig$2=class extends account_1$5.Account{constructor(Fn,io,fo){super(Fn,io),this.storage=fo.storage,this.onAddRequestResult=fo.onAddRequestResult}signAndSendTransactionWithAccount(Fn,io){const fo=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$R(this,void 0,void 0,function*(){return fo.signAndSendTransaction.call(this,{receiverId:Fn,actions:io})})}signAndSendTransaction({receiverId:Fn,actions:io}){const fo=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$R(this,void 0,void 0,function*(){const{accountId:$o}=this,mo=Buffer$D.from(JSON.stringify({request:{receiver_id:Fn,actions:convertActions$2(io,$o,Fn)}}));let Ao;try{Ao=yield fo.signAndSendTransaction.call(this,{receiverId:$o,actions:[functionCall$b("add_request_and_confirm",mo,constants_1$7.MULTISIG_GAS,constants_1$7.MULTISIG_DEPOSIT)]})}catch(Lo){if(Lo.toString().includes("Account has too many active requests. Confirm or delete some"))return yield this.deleteUnconfirmedRequests(),yield this.signAndSendTransaction({receiverId:Fn,actions:io});throw Lo}if(!Ao.status)throw new Error("Request failed");const jo=Object.assign({},Ao.status);if(!jo.SuccessValue||typeof jo.SuccessValue!="string")throw new Error("Request failed");return this.setRequest({accountId:$o,actions:io,requestId:parseInt(Buffer$D.from(jo.SuccessValue,"base64").toString("ascii"),10)}),this.onAddRequestResult&&(yield this.onAddRequestResult(Ao)),this.deleteUnconfirmedRequests(),Ao})}checkMultisigCodeAndStateStatus(Fn){const io=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$R(this,void 0,void 0,function*(){const $o=Fn?MultisigCodeStatus$2.UNKNOWN_CODE:MultisigCodeStatus$2.VALID_CODE;try{return Fn?yield io.signAndSendTransaction.call(this,{receiverId:this.accountId,actions:[deployContract$b(Fn),functionCall$b("delete_request",{request_id:4294967295},constants_1$7.MULTISIG_GAS,constants_1$7.MULTISIG_DEPOSIT)]}):yield this.deleteRequest(4294967295),{codeStatus:MultisigCodeStatus$2.VALID_CODE,stateStatus:types_1$v.MultisigStateStatus.VALID_STATE}}catch(mo){if(new RegExp(types_1$v.MultisigDeleteRequestRejectionError.CANNOT_DESERIALIZE_STATE).test(mo&&mo.kind&&mo.kind.ExecutionError))return{codeStatus:$o,stateStatus:types_1$v.MultisigStateStatus.INVALID_STATE};if(new RegExp(types_1$v.MultisigDeleteRequestRejectionError.MULTISIG_NOT_INITIALIZED).test(mo&&mo.kind&&mo.kind.ExecutionError))return{codeStatus:$o,stateStatus:types_1$v.MultisigStateStatus.STATE_NOT_INITIALIZED};if(new RegExp(types_1$v.MultisigDeleteRequestRejectionError.NO_SUCH_REQUEST).test(mo&&mo.kind&&mo.kind.ExecutionError))return{codeStatus:$o,stateStatus:types_1$v.MultisigStateStatus.VALID_STATE};if(new RegExp(types_1$v.MultisigDeleteRequestRejectionError.METHOD_NOT_FOUND).test(mo&&mo.message))return{codeStatus:MultisigCodeStatus$2.INVALID_CODE,stateStatus:types_1$v.MultisigStateStatus.UNKNOWN_STATE};throw mo}})}deleteRequest(Fn){return super.signAndSendTransaction({receiverId:this.accountId,actions:[functionCall$b("delete_request",{request_id:Fn},constants_1$7.MULTISIG_GAS,constants_1$7.MULTISIG_DEPOSIT)]})}deleteAllRequests(){return __awaiter$R(this,void 0,void 0,function*(){const Fn=yield this.getRequestIds();Fn.length&&(yield Promise.all(Fn.map(io=>this.deleteRequest(io))))})}deleteUnconfirmedRequests(){const Fn=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$R(this,void 0,void 0,function*(){const io=yield this.getRequestIds(),{requestId:fo}=this.getRequest();for(const $o of io)if($o!=fo)try{yield Fn.signAndSendTransaction.call(this,{receiverId:this.accountId,actions:[functionCall$b("delete_request",{request_id:$o},constants_1$7.MULTISIG_GAS,constants_1$7.MULTISIG_DEPOSIT)]})}catch{utils_1$x.Logger.warn("Attempt to delete an earlier request before 15 minutes failed. Will try again.")}})}getRequestIds(){return __awaiter$R(this,void 0,void 0,function*(){return this.viewFunction({contractId:this.accountId,methodName:"list_request_ids"})})}getRequest(){return this.storage?JSON.parse(this.storage.getItem(constants_1$7.MULTISIG_STORAGE_KEY)||"{}"):storageFallback$2[constants_1$7.MULTISIG_STORAGE_KEY]}setRequest(Fn){if(this.storage)return this.storage.setItem(constants_1$7.MULTISIG_STORAGE_KEY,JSON.stringify(Fn));storageFallback$2[constants_1$7.MULTISIG_STORAGE_KEY]=Fn}};account_multisig$5.AccountMultisig=AccountMultisig$2;const convertPKForContract$2=Mn=>Mn.toString().replace("ed25519:",""),convertActions$2=(Mn,Fn,io)=>Mn.map(fo=>{const $o=fo.enum,{gas:mo,publicKey:Ao,methodName:jo,args:Lo,deposit:Ho,accessKey:zo,code:Go}=fo[$o],Vo={type:$o[0].toUpperCase()+$o.substr(1),gas:mo&&mo.toString()||void 0,public_key:Ao&&convertPKForContract$2(Ao)||void 0,method_name:jo,args:Lo&&Buffer$D.from(Lo).toString("base64")||void 0,code:Go&&Buffer$D.from(Go).toString("base64")||void 0,amount:Ho&&Ho.toString()||void 0,deposit:Ho&&Ho.toString()||"0",permission:void 0};if(zo&&(io===Fn&&zo.permission.enum!=="fullAccess"&&(Vo.permission={receiver_id:Fn,allowance:constants_1$7.MULTISIG_ALLOWANCE.toString(),method_names:constants_1$7.MULTISIG_CHANGE_METHODS}),zo.permission.enum==="functionCall")){const{receiverId:Yo,methodNames:Xo,allowance:is}=zo.permission.functionCall;Vo.permission={receiver_id:Yo,allowance:is&&is.toString()||void 0,method_names:Xo}}return Vo});var __awaiter$Q=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(account_2fa$2,"__esModule",{value:!0});account_2fa$2.Account2FA=void 0;const crypto_1$p=lib$k,types_1$u=lib$i,providers_1$9=lib$g,transactions_1$d=lib$f,utils_1$w=lib$j,account_multisig_1$2=account_multisig$5,constants_1$6=constants$7,types_2$2=types$4,{addKey:addKey$8,deleteKey:deleteKey$8,deployContract:deployContract$a,fullAccessKey:fullAccessKey$6,functionCall:functionCall$a,functionCallAccessKey:functionCallAccessKey$6}=transactions_1$d.actionCreators;let Account2FA$2=class extends account_multisig_1$2.AccountMultisig{constructor(Fn,io,fo){super(Fn,io,fo),this.helperUrl="https://helper.testnet.near.org",this.helperUrl=fo.helperUrl||this.helperUrl,this.storage=fo.storage,this.sendCode=fo.sendCode||this.sendCodeDefault,this.getCode=fo.getCode||this.getCodeDefault,this.verifyCode=fo.verifyCode||this.verifyCodeDefault,this.onConfirmResult=fo.onConfirmResult}signAndSendTransaction({receiverId:Fn,actions:io}){const fo=Object.create(null,{signAndSendTransaction:{get:()=>super.signAndSendTransaction}});return __awaiter$Q(this,void 0,void 0,function*(){yield fo.signAndSendTransaction.call(this,{receiverId:Fn,actions:io}),yield this.sendCode();const $o=yield this.promptAndVerify();return this.onConfirmResult&&(yield this.onConfirmResult($o)),$o})}deployMultisig(Fn){const io=Object.create(null,{signAndSendTransactionWithAccount:{get:()=>super.signAndSendTransactionWithAccount}});return __awaiter$Q(this,void 0,void 0,function*(){const{accountId:fo}=this,$o=(yield this.getRecoveryMethods()).data.filter(({kind:Go,publicKey:Vo})=>(Go==="phrase"||Go==="ledger")&&Vo!==null).map(Go=>Go.publicKey),mo=(yield this.getAccessKeys()).filter(({public_key:Go,access_key:{permission:Vo}})=>Vo==="FullAccess"&&!$o.includes(Go)).map(Go=>Go.public_key).map(toPK$2),Ao=toPK$2((yield this.postSignedJson("/2fa/getAccessKey",{accountId:fo})).publicKey),jo=Buffer$D.from(JSON.stringify({num_confirmations:2})),Lo=[...mo.map(Go=>deleteKey$8(Go)),...mo.map(Go=>addKey$8(Go,functionCallAccessKey$6(fo,constants_1$6.MULTISIG_CHANGE_METHODS,null))),addKey$8(Ao,functionCallAccessKey$6(fo,constants_1$6.MULTISIG_CONFIRM_METHODS,null)),deployContract$a(Fn)],Ho=Lo.concat(functionCall$a("new",jo,constants_1$6.MULTISIG_GAS,constants_1$6.MULTISIG_DEPOSIT));utils_1$w.Logger.log("deploying multisig contract for",fo);const{stateStatus:zo}=yield this.checkMultisigCodeAndStateStatus(Fn);switch(zo){case types_2$2.MultisigStateStatus.STATE_NOT_INITIALIZED:return yield io.signAndSendTransactionWithAccount.call(this,fo,Ho);case types_2$2.MultisigStateStatus.VALID_STATE:return yield io.signAndSendTransactionWithAccount.call(this,fo,Lo);case types_2$2.MultisigStateStatus.INVALID_STATE:throw new types_1$u.TypedError(`Can not deploy a contract to account ${this.accountId} on network ${this.connection.networkId}, the account has existing state.`,"ContractHasExistingState");default:throw new types_1$u.TypedError(`Can not deploy a contract to account ${this.accountId} on network ${this.connection.networkId}, the account state could not be verified.`,"ContractStateUnknown")}})}disableWithFAK({contractBytes:Fn,cleanupContractBytes:io}){return __awaiter$Q(this,void 0,void 0,function*(){let fo=[];io&&(yield this.deleteAllRequests().catch(jo=>jo),fo=yield this.get2faDisableCleanupActions(io));const $o=yield this.get2faDisableKeyConversionActions(),mo=[...fo,...$o,deployContract$a(Fn)],Ao=yield this.findAccessKey(this.accountId,mo);if(Ao&&Ao.accessKey&&Ao.accessKey.permission!=="FullAccess")throw new types_1$u.TypedError("No full access key found in keystore. Unable to bypass multisig","NoFAKFound");return this.signAndSendTransactionWithAccount(this.accountId,mo)})}get2faDisableCleanupActions(Fn){return __awaiter$Q(this,void 0,void 0,function*(){const io=yield this.viewState("").catch($o=>{const mo=$o.cause&&$o.cause.name;if(mo=="NO_CONTRACT_CODE")return[];throw mo=="TOO_LARGE_CONTRACT_STATE"?new types_1$u.TypedError(`Can not deploy a contract to account ${this.accountId} on network ${this.connection.networkId}, the account has existing state.`,"ContractHasExistingState"):$o}),fo=io.map(({key:$o})=>$o.toString("base64"));return io.length?[deployContract$a(Fn),functionCall$a("clean",{keys:fo},constants_1$6.MULTISIG_GAS,BigInt("0"))]:[]})}get2faDisableKeyConversionActions(){return __awaiter$Q(this,void 0,void 0,function*(){const{accountId:Fn}=this,fo=(yield this.getAccessKeys()).filter(({access_key:mo})=>mo.permission!=="FullAccess").filter(({access_key:mo})=>{const Ao=mo.permission.FunctionCall;return Ao.receiver_id===Fn&&Ao.method_names.length===4&&Ao.method_names.includes("add_request_and_confirm")}),$o=crypto_1$p.PublicKey.from((yield this.postSignedJson("/2fa/getAccessKey",{accountId:Fn})).publicKey);return[deleteKey$8($o),...fo.map(({public_key:mo})=>deleteKey$8(crypto_1$p.PublicKey.from(mo))),...fo.map(({public_key:mo})=>addKey$8(crypto_1$p.PublicKey.from(mo),fullAccessKey$6()))]})}disable(Fn,io){return __awaiter$Q(this,void 0,void 0,function*(){const{stateStatus:fo}=yield this.checkMultisigCodeAndStateStatus();if(fo!==types_2$2.MultisigStateStatus.VALID_STATE&&fo!==types_2$2.MultisigStateStatus.STATE_NOT_INITIALIZED)throw new types_1$u.TypedError(`Can not deploy a contract to account ${this.accountId} on network ${this.connection.networkId}, the account state could not be verified.`,"ContractStateUnknown");let $o;yield this.deleteAllRequests().catch(jo=>$o=jo);const Ao=[...yield this.get2faDisableCleanupActions(io).catch(jo=>{throw jo.type==="ContractHasExistingState"&&$o||jo}),...yield this.get2faDisableKeyConversionActions(),deployContract$a(Fn)];return utils_1$w.Logger.log("disabling 2fa for",this.accountId),yield this.signAndSendTransaction({receiverId:this.accountId,actions:Ao})})}sendCodeDefault(){return __awaiter$Q(this,void 0,void 0,function*(){const{accountId:Fn}=this,{requestId:io}=this.getRequest(),fo=yield this.get2faMethod();return yield this.postSignedJson("/2fa/send",{accountId:Fn,method:fo,requestId:io}),io})}getCodeDefault(){return __awaiter$Q(this,void 0,void 0,function*(){throw new Error('There is no getCode callback provided. Please provide your own in AccountMultisig constructor options. It has a parameter method where method.kind is "email" or "phone".')})}promptAndVerify(){return __awaiter$Q(this,void 0,void 0,function*(){const Fn=yield this.get2faMethod(),io=yield this.getCode(Fn);try{return yield this.verifyCode(io)}catch(fo){if(utils_1$w.Logger.warn("Error validating security code:",fo),fo.toString().includes("invalid 2fa code provided")||fo.toString().includes("2fa code not valid"))return yield this.promptAndVerify();throw fo}})}verifyCodeDefault(Fn){return __awaiter$Q(this,void 0,void 0,function*(){const{accountId:io}=this,fo=this.getRequest();if(!fo)throw new Error("no request pending");const{requestId:$o}=fo;return yield this.postSignedJson("/2fa/verify",{accountId:io,securityCode:Fn,requestId:$o})})}getRecoveryMethods(){return __awaiter$Q(this,void 0,void 0,function*(){const{accountId:Fn}=this;return{accountId:Fn,data:yield this.postSignedJson("/account/recoveryMethods",{accountId:Fn})}})}get2faMethod(){return __awaiter$Q(this,void 0,void 0,function*(){let{data:Fn}=yield this.getRecoveryMethods();if(Fn&&Fn.length&&(Fn=Fn.find($o=>$o.kind.indexOf("2fa-")===0)),!Fn)return null;const{kind:io,detail:fo}=Fn;return{kind:io,detail:fo}})}signatureFor(){return __awaiter$Q(this,void 0,void 0,function*(){const{accountId:Fn}=this,fo=(yield this.connection.provider.block({finality:"final"})).header.height.toString(),$o=yield this.connection.signer.signMessage(Buffer$D.from(fo),Fn,this.connection.networkId),mo=Buffer$D.from($o.signature).toString("base64");return{blockNumber:fo,blockNumberSignature:mo}})}postSignedJson(Fn,io){return __awaiter$Q(this,void 0,void 0,function*(){return yield(0,providers_1$9.fetchJson)(this.helperUrl+Fn,JSON.stringify(Object.assign(Object.assign({},io),yield this.signatureFor())))})}};account_2fa$2.Account2FA=Account2FA$2;const toPK$2=Mn=>crypto_1$p.PublicKey.from(Mn);var account_creator$5={},__awaiter$P=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(account_creator$5,"__esModule",{value:!0});account_creator$5.UrlAccountCreator=account_creator$5.LocalAccountCreator=account_creator$5.AccountCreator=void 0;const providers_1$8=lib$g;let AccountCreator$2=class{};account_creator$5.AccountCreator=AccountCreator$2;let LocalAccountCreator$2=class extends AccountCreator$2{constructor(Fn,io){super(),this.masterAccount=Fn,this.initialBalance=io}createAccount(Fn,io){return __awaiter$P(this,void 0,void 0,function*(){yield this.masterAccount.createAccount(Fn,io,this.initialBalance)})}};account_creator$5.LocalAccountCreator=LocalAccountCreator$2;let UrlAccountCreator$2=class extends AccountCreator$2{constructor(Fn,io){super(),this.connection=Fn,this.helperUrl=io}createAccount(Fn,io){return __awaiter$P(this,void 0,void 0,function*(){yield(0,providers_1$8.fetchJson)(`${this.helperUrl}/account`,JSON.stringify({newAccountId:Fn,newAccountPublicKey:io.toString()}))})}};account_creator$5.UrlAccountCreator=UrlAccountCreator$2;var connection$5={},lib$c={},in_memory_signer$2={},signer$5={};Object.defineProperty(signer$5,"__esModule",{value:!0});signer$5.Signer=void 0;let Signer$2=class{};signer$5.Signer=Signer$2;var __awaiter$O=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})};Object.defineProperty(in_memory_signer$2,"__esModule",{value:!0});in_memory_signer$2.InMemorySigner=void 0;const crypto_1$o=lib$k,keystores_1$5=lib$l,sha256_1$5=sha256$2,signer_1$2=signer$5;let InMemorySigner$2=class $_ extends signer_1$2.Signer{constructor(Fn){super(),this.keyStore=Fn}static fromKeyPair(Fn,io,fo){return __awaiter$O(this,void 0,void 0,function*(){const $o=new keystores_1$5.InMemoryKeyStore;return yield $o.setKey(Fn,io,fo),new $_($o)})}createKey(Fn,io,fo){return __awaiter$O(this,void 0,void 0,function*(){const $o=fo===crypto_1$o.KeyType.SECP256K1?crypto_1$o.KeyPair.fromRandom("secp256k1"):crypto_1$o.KeyPair.fromRandom("ed25519");return yield this.keyStore.setKey(io,Fn,$o),$o.getPublicKey()})}getPublicKey(Fn,io){return __awaiter$O(this,void 0,void 0,function*(){const fo=yield this.keyStore.getKey(io,Fn);return fo===null?null:fo.getPublicKey()})}signMessage(Fn,io,fo){return __awaiter$O(this,void 0,void 0,function*(){const $o=new Uint8Array((0,sha256_1$5.sha256)(Fn));if(!io)throw new Error("InMemorySigner requires provided account id");const mo=yield this.keyStore.getKey(fo,io);if(mo===null)throw new Error(`Key for ${io} not found in ${fo}`);return mo.sign($o)})}toString(){return`InMemorySigner(${this.keyStore})`}};in_memory_signer$2.InMemorySigner=InMemorySigner$2;(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.Signer=Mn.InMemorySigner=void 0;var Fn=in_memory_signer$2;Object.defineProperty(Mn,"InMemorySigner",{enumerable:!0,get:function(){return Fn.InMemorySigner}});var io=signer$5;Object.defineProperty(Mn,"Signer",{enumerable:!0,get:function(){return io.Signer}})})(lib$c);Object.defineProperty(connection$5,"__esModule",{value:!0});connection$5.Connection=void 0;const signers_1$3=lib$c,providers_1$7=lib$g;function getProvider$2(Mn){switch(Mn.type){case void 0:return Mn;case"JsonRpcProvider":return new providers_1$7.JsonRpcProvider(Object.assign({},Mn.args));case"FailoverRpcProvider":{const Fn=((Mn==null?void 0:Mn.args)||[]).map(io=>new providers_1$7.JsonRpcProvider(io));return new providers_1$7.FailoverRpcProvider(Fn)}default:throw new Error(`Unknown provider type ${Mn.type}`)}}function getSigner$2(Mn){switch(Mn.type){case void 0:return Mn;case"InMemorySigner":return new signers_1$3.InMemorySigner(Mn.keyStore);default:throw new Error(`Unknown signer type ${Mn.type}`)}}let Connection$2=class g_{constructor(Fn,io,fo,$o){this.networkId=Fn,this.provider=io,this.signer=fo,this.jsvmAccountId=$o}getConnection(){return this}static fromConfig(Fn){const io=getProvider$2(Fn.provider),fo=getSigner$2(Fn.signer);return new g_(Fn.networkId,io,fo,Fn.jsvmAccountId)}};connection$5.Connection=Connection$2;var contract$5={},localViewExecution$2={},storage$2={},lru={exports:{}};(function(Mn,Fn){(function(io,fo){fo(Fn)})(commonjsGlobal$c,function(io){const fo=Symbol("newer"),$o=Symbol("older");class mo{constructor(Go,Vo){typeof Go!="number"&&(Vo=Go,Go=0),this.size=0,this.limit=Go,this.oldest=this.newest=void 0,this._keymap=new Map,Vo&&(this.assign(Vo),Go<1&&(this.limit=this.size))}_markEntryAsUsed(Go){Go!==this.newest&&(Go[fo]&&(Go===this.oldest&&(this.oldest=Go[fo]),Go[fo][$o]=Go[$o]),Go[$o]&&(Go[$o][fo]=Go[fo]),Go[fo]=void 0,Go[$o]=this.newest,this.newest&&(this.newest[fo]=Go),this.newest=Go)}assign(Go){let Vo,Yo=this.limit||Number.MAX_VALUE;this._keymap.clear();let Xo=Go[Symbol.iterator]();for(let is=Xo.next();!is.done;is=Xo.next()){let yl=new Ao(is.value[0],is.value[1]);if(this._keymap.set(yl.key,yl),Vo?(Vo[fo]=yl,yl[$o]=Vo):this.oldest=yl,Vo=yl,Yo--==0)throw new Error("overflow")}this.newest=Vo,this.size=this._keymap.size}get(Go){var Vo=this._keymap.get(Go);return Vo?(this._markEntryAsUsed(Vo),Vo.value):void 0}set(Go,Vo){var Yo=this._keymap.get(Go);return Yo?(Yo.value=Vo,this._markEntryAsUsed(Yo),this):(this._keymap.set(Go,Yo=new Ao(Go,Vo)),this.newest?(this.newest[fo]=Yo,Yo[$o]=this.newest):this.oldest=Yo,this.newest=Yo,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var Go=this.oldest;if(Go)return this.oldest[fo]?(this.oldest=this.oldest[fo],this.oldest[$o]=void 0):(this.oldest=void 0,this.newest=void 0),Go[fo]=Go[$o]=void 0,this._keymap.delete(Go.key),--this.size,[Go.key,Go.value]}find(Go){let Vo=this._keymap.get(Go);return Vo?Vo.value:void 0}has(Go){return this._keymap.has(Go)}delete(Go){var Vo=this._keymap.get(Go);return Vo?(this._keymap.delete(Vo.key),Vo[fo]&&Vo[$o]?(Vo[$o][fo]=Vo[fo],Vo[fo][$o]=Vo[$o]):Vo[fo]?(Vo[fo][$o]=void 0,this.oldest=Vo[fo]):Vo[$o]?(Vo[$o][fo]=void 0,this.newest=Vo[$o]):this.oldest=this.newest=void 0,this.size--,Vo.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Lo(this.oldest)}values(){return new Ho(this.oldest)}entries(){return this}[Symbol.iterator](){return new jo(this.oldest)}forEach(Go,Vo){typeof Vo!="object"&&(Vo=this);let Yo=this.oldest;for(;Yo;)Go.call(Vo,Yo.value,Yo.key,this),Yo=Yo[fo]}toJSON(){for(var Go=new Array(this.size),Vo=0,Yo=this.oldest;Yo;)Go[Vo++]={key:Yo.key,value:Yo.value},Yo=Yo[fo];return Go}toString(){for(var Go="",Vo=this.oldest;Vo;)Go+=String(Vo.key)+":"+Vo.value,Vo=Vo[fo],Vo&&(Go+=" < ");return Go}}io.LRUMap=mo;function Ao(zo,Go){this.key=zo,this.value=Go,this[fo]=void 0,this[$o]=void 0}function jo(zo){this.entry=zo}jo.prototype[Symbol.iterator]=function(){return this},jo.prototype.next=function(){let zo=this.entry;return zo?(this.entry=zo[fo],{done:!1,value:[zo.key,zo.value]}):{done:!0,value:void 0}};function Lo(zo){this.entry=zo}Lo.prototype[Symbol.iterator]=function(){return this},Lo.prototype.next=function(){let zo=this.entry;return zo?(this.entry=zo[fo],{done:!1,value:zo.key}):{done:!0,value:void 0}};function Ho(zo){this.entry=zo}Ho.prototype[Symbol.iterator]=function(){return this},Ho.prototype.next=function(){let zo=this.entry;return zo?(this.entry=zo[fo],{done:!1,value:zo.value}):{done:!0,value:void 0}}})})(lru,lru.exports);var lruExports=lru.exports;Object.defineProperty(storage$2,"__esModule",{value:!0});storage$2.Storage=void 0;const lru_map_1$2=lruExports;let Storage$2=class m_{constructor(Fn={max:m_.MAX_ELEMENTS}){this.cache=new lru_map_1$2.LRUMap(Fn.max),this.blockHeights=new Map}load(Fn){if(!("blockId"in Fn))return;let fo=Fn.blockId;return fo.toString().length==44&&(fo=this.blockHeights.get(fo.toString())),this.cache.get(fo)}save(Fn,{blockHeight:io,blockTimestamp:fo,contractCode:$o,contractState:mo}){this.blockHeights.set(Fn,io),this.cache.set(io,{blockHeight:io,blockTimestamp:fo,contractCode:$o,contractState:mo})}};storage$2.Storage=Storage$2;Storage$2.MAX_ELEMENTS=100;var runtime$2={},__awaiter$N=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})},__rest$5=commonjsGlobal$c&&commonjsGlobal$c.__rest||function(Mn,Fn){var io={};for(var fo in Mn)Object.prototype.hasOwnProperty.call(Mn,fo)&&Fn.indexOf(fo)<0&&(io[fo]=Mn[fo]);if(Mn!=null&&typeof Object.getOwnPropertySymbols=="function")for(var $o=0,fo=Object.getOwnPropertySymbols(Mn);$o<fo.length;$o++)Fn.indexOf(fo[$o])<0&&Object.prototype.propertyIsEnumerable.call(Mn,fo[$o])&&(io[fo[$o]]=Mn[fo[$o]]);return io};Object.defineProperty(runtime$2,"__esModule",{value:!0});runtime$2.Runtime=void 0;const crypto_1$n=requireCryptoBrowserify(),notImplemented$2=Mn=>()=>{throw new Error("method not implemented: "+Mn)},prohibitedInView$2=Mn=>()=>{throw new Error("method not available for view calls: "+Mn)};let Runtime$2=class{constructor(Fn){var{contractCode:io}=Fn,fo=__rest$5(Fn,["contractCode"]);this.context=fo,this.wasm=this.prepareWASM(Buffer$D.from(io,"base64")),this.memory=new WebAssembly.Memory({initial:1024,maximum:2048}),this.registers={},this.logs=[],this.result=Buffer$D.from([])}readUTF16CStr(Fn){const io=[],fo=new Uint16Array(this.memory.buffer);let $o=Number(Fn)/2;for(;fo[$o]!=0;)io.push(fo[$o]),$o++;return Buffer$D.from(Uint16Array.from(io).buffer).toString("ucs2")}readUTF8CStr(Fn,io){const fo=[],$o=new Uint8Array(this.memory.buffer);let mo=Number(io);for(let Ao=0;Ao<Fn&&$o[mo]!=0;Ao++)fo.push($o[mo]),mo++;return Buffer$D.from(fo).toString("utf8")}storageRead(Fn,io){const fo=Buffer$D.from(new Uint8Array(this.memory.buffer,Number(io),Number(Fn))),$o=this.context.contractState.filter(mo=>Buffer$D.compare(mo.key,fo)===0).map(mo=>mo.value);return $o.length===0?null:$o.length>1?$o:$o[0]}prepareWASM(Fn){const io=[];if(Fn.subarray(0,4).toString("utf8")!=="\0asm")throw new Error("Invalid magic number");const $o=Fn.readUInt32LE(4);if($o!=1)throw new Error("Invalid version: "+$o);let mo=8;io.push(Fn.subarray(0,mo));function Ao(){let Go=0,Vo=0,Yo;do Yo=Fn[mo++],Go|=(Yo&127)<<Vo,Vo+=7;while(Yo&128);return Go}function jo(){const Vo=Fn[mo++]&1,Yo=Ao(),Xo=Vo?Ao():null;return{initial:Yo,max:Xo}}function Lo(){const Go=Ao(),Vo=Fn.subarray(mo,mo+Go);return mo+=Go,Vo.toString("utf8")}function Ho(Go){const Vo=[];do{let Yo=Go&127;Go>>=7,Go!==0&&(Yo|=128),Vo.push(Yo)}while(Go!==0);return Buffer$D.from(Vo)}function zo(Go){const Vo=Buffer$D.from(Go,"utf8");return Buffer$D.concat([Ho(Vo.length),Vo])}do{const Go=mo,Vo=Fn.readUInt8(mo);mo++;const Yo=Ao(),Xo=mo+Yo;if(Vo==5)io.push(Buffer$D.from([5,1,0]));else if(Vo==2){const is=[],yl=Ao();for(let _l=0;_l<yl;_l++){const xl=mo;Lo(),Lo();const Il=Fn.readUInt8(mo);mo++;let Ol=!1;switch(Il){case 0:Ao();break;case 1:mo++,jo();break;case 2:jo(),Ol=!0;break;case 3:mo++,mo++;break;default:throw new Error("Invalid import kind: "+Il)}Ol||is.push(Fn.subarray(xl,mo))}const us=Buffer$D.concat([zo("env"),zo("memory"),Buffer$D.from([2]),Buffer$D.from([0]),Ho(1)]);is.push(us);const hs=Buffer$D.concat([Ho(is.length),...is]);io.push(Buffer$D.concat([Buffer$D.from([2]),Ho(hs.length),hs]))}else if(Vo==7){const is=[],yl=Ao();for(let hs=0;hs<yl;hs++){const _l=mo;Lo();const xl=Fn.readUInt8(mo);mo++,Ao(),xl!==2&&is.push(Fn.subarray(_l,mo))}const us=Buffer$D.concat([Ho(is.length),...is]);io.push(Buffer$D.concat([Buffer$D.from([7]),Ho(us.length),us]))}else io.push(Fn.subarray(Go,Xo));mo=Xo}while(mo<Fn.length);return Buffer$D.concat(io)}getRegisterLength(Fn){return BigInt(this.registers[Fn.toString()]?this.registers[Fn.toString()].length:Number.MAX_SAFE_INTEGER)}readFromRegister(Fn,io){new Uint8Array(this.memory.buffer).set(this.registers[Fn.toString()]||Buffer$D.from([]),Number(io))}getCurrentAccountId(Fn){this.registers[Fn.toString()]=Buffer$D.from(this.context.contractId)}inputMethodArgs(Fn){this.registers[Fn.toString()]=Buffer$D.from(this.context.methodArgs)}getBlockHeight(){return BigInt(this.context.blockHeight)}getBlockTimestamp(){return BigInt(this.context.blockTimestamp)}sha256(Fn,io,fo){const $o=new Uint8Array(this.memory.buffer,Number(io),Number(Fn)),mo=(0,crypto_1$n.createHash)("sha256");mo.update($o),this.registers[fo.toString()]=mo.digest()}returnValue(Fn,io){this.result=Buffer$D.from(new Uint8Array(this.memory.buffer,Number(io),Number(Fn)))}panic(Fn){throw new Error("panic: "+Fn)}abort(Fn,io,fo,$o){const mo=this.readUTF16CStr(Fn),Ao=this.readUTF16CStr(io),jo=`${mo} ${Ao}:${fo}:${$o}`;throw!mo||!Ao?new Error("abort: String encoding is bad UTF-16 sequence."):new Error("abort: "+jo)}appendToLog(Fn,io){this.logs.push(this.readUTF8CStr(Fn,io))}readStorage(Fn,io,fo){const $o=this.storageRead(Fn,io);return $o==null?BigInt(0):(this.registers[fo]=$o,BigInt(1))}hasStorageKey(Fn,io){return this.storageRead(Fn,io)==null?BigInt(0):BigInt(1)}getHostImports(){return{register_len:this.getRegisterLength.bind(this),read_register:this.readFromRegister.bind(this),current_account_id:this.getCurrentAccountId.bind(this),input:this.inputMethodArgs.bind(this),block_index:this.getBlockHeight.bind(this),block_timestamp:this.getBlockTimestamp.bind(this),sha256:this.sha256.bind(this),value_return:this.returnValue.bind(this),abort:this.abort.bind(this),log_utf8:this.appendToLog.bind(this),log_utf16:this.appendToLog.bind(this),storage_read:this.readStorage.bind(this),storage_has_key:this.hasStorageKey.bind(this),panic:()=>this.panic("explicit guest panic"),panic_utf8:(Fn,io)=>this.panic(this.readUTF8CStr(Fn,io)),epoch_height:notImplemented$2("epoch_height"),storage_usage:notImplemented$2("storage_usage"),account_balance:notImplemented$2("account_balance"),account_locked_balance:notImplemented$2("account_locked_balance"),random_seed:notImplemented$2("random_seed"),ripemd160:notImplemented$2("ripemd160"),keccak256:notImplemented$2("keccak256"),keccak512:notImplemented$2("keccak512"),ecrecover:notImplemented$2("ecrecover"),validator_stake:notImplemented$2("validator_stake"),validator_total_stake:notImplemented$2("validator_total_stake"),write_register:prohibitedInView$2("write_register"),signer_account_id:prohibitedInView$2("signer_account_id"),signer_account_pk:prohibitedInView$2("signer_account_pk"),predecessor_account_id:prohibitedInView$2("predecessor_account_id"),attached_deposit:prohibitedInView$2("attached_deposit"),prepaid_gas:prohibitedInView$2("prepaid_gas"),used_gas:prohibitedInView$2("used_gas"),promise_create:prohibitedInView$2("promise_create"),promise_then:prohibitedInView$2("promise_then"),promise_and:prohibitedInView$2("promise_and"),promise_batch_create:prohibitedInView$2("promise_batch_create"),promise_batch_then:prohibitedInView$2("promise_batch_then"),promise_batch_action_create_account:prohibitedInView$2("promise_batch_action_create_account"),promise_batch_action_deploy_contract:prohibitedInView$2("promise_batch_action_deploy_contract"),promise_batch_action_function_call:prohibitedInView$2("promise_batch_action_function_call"),promise_batch_action_function_call_weight:prohibitedInView$2("promise_batch_action_function_call_weight"),promise_batch_action_transfer:prohibitedInView$2("promise_batch_action_transfer"),promise_batch_action_stake:prohibitedInView$2("promise_batch_action_stake"),promise_batch_action_add_key_with_full_access:prohibitedInView$2("promise_batch_action_add_key_with_full_access"),promise_batch_action_add_key_with_function_call:prohibitedInView$2("promise_batch_action_add_key_with_function_call"),promise_batch_action_delete_key:prohibitedInView$2("promise_batch_action_delete_key"),promise_batch_action_delete_account:prohibitedInView$2("promise_batch_action_delete_account"),promise_results_count:prohibitedInView$2("promise_results_count"),promise_result:prohibitedInView$2("promise_result"),promise_return:prohibitedInView$2("promise_return"),storage_write:prohibitedInView$2("storage_write"),storage_remove:prohibitedInView$2("storage_remove")}}execute(Fn){return __awaiter$N(this,void 0,void 0,function*(){const io=yield WebAssembly.compile(this.wasm),$o=(yield WebAssembly.instantiate(io,{env:Object.assign(Object.assign({},this.getHostImports()),{memory:this.memory})})).exports[Fn];if($o==null)throw new Error(`Contract method '${Fn}' does not exists in contract ${this.context.contractId} for block id ${this.context.blockHeight}`);return $o(),{result:this.result,logs:this.logs}})}};runtime$2.Runtime=Runtime$2;var __awaiter$M=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,{"ActionError":{"index":0,"kind":{"FunctionCallError":{"CompilationError":{"CodeDoesNotExist":{"account_id":"web4.nearbuilders.testnet"}}}}}}
1 automatic refund step from the network not shown.
This page reads FastNEAR's public transaction index and stores nothing. This command asks a NEAR archival node for the same transaction and needs no keys.
curl -s https://archival-rpc.testnet.fastnear.com -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tx","params":{"tx_hash":"CaQLcTgjWZJ7d9bDbhxn9Hy54g6p7MEeeq1YEsEd89nt","sender_account_id":"web4.nearbuilders.testnet","wait_until":"FINAL"}}'Vouch has its own page because testnet.nearblocks.io stopped indexing on 27 Sep 2026, so it can't show newer transactions.