@meshsdk/core 1.5.24 → 1.5.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -30
- package/dist/index.d.mts +129 -0
- package/dist/index.d.ts +129 -11
- package/dist/index.js +149 -0
- package/dist/index.mjs +91 -0
- package/package.json +30 -71
- package/dist/common/constants.d.ts +0 -58
- package/dist/common/contracts/evaluator.d.ts +0 -4
- package/dist/common/contracts/fetcher.d.ts +0 -22
- package/dist/common/contracts/index.d.ts +0 -7
- package/dist/common/contracts/initiator.d.ts +0 -8
- package/dist/common/contracts/listener.d.ts +0 -3
- package/dist/common/contracts/signer.d.ts +0 -8
- package/dist/common/contracts/submitter.d.ts +0 -3
- package/dist/common/contracts/uploader.d.ts +0 -3
- package/dist/common/decorators.d.ts +0 -19
- package/dist/common/helpers/generateNonce.d.ts +0 -1
- package/dist/common/helpers/index.d.ts +0 -4
- package/dist/common/helpers/mergeSignatures.d.ts +0 -3
- package/dist/common/helpers/readPlutusData.d.ts +0 -2
- package/dist/common/helpers/readTransaction.d.ts +0 -2
- package/dist/common/types/Account.d.ts +0 -5
- package/dist/common/types/AccountInfo.d.ts +0 -7
- package/dist/common/types/Action.d.ts +0 -12
- package/dist/common/types/Asset.d.ts +0 -7
- package/dist/common/types/AssetExtended.d.ts +0 -8
- package/dist/common/types/AssetMetadata.d.ts +0 -24
- package/dist/common/types/BlockInfo.d.ts +0 -17
- package/dist/common/types/Data.d.ts +0 -4
- package/dist/common/types/DataSignature.d.ts +0 -4
- package/dist/common/types/Era.d.ts +0 -1
- package/dist/common/types/Mint.d.ts +0 -10
- package/dist/common/types/NativeScript.d.ts +0 -14
- package/dist/common/types/Network.d.ts +0 -4
- package/dist/common/types/PlutusScript.d.ts +0 -6
- package/dist/common/types/PoolParams.d.ts +0 -16
- package/dist/common/types/Protocol.d.ts +0 -22
- package/dist/common/types/Recipient.d.ts +0 -11
- package/dist/common/types/Relay.d.ts +0 -13
- package/dist/common/types/Token.d.ts +0 -2
- package/dist/common/types/TransactionInfo.d.ts +0 -11
- package/dist/common/types/UTxO.d.ts +0 -15
- package/dist/common/types/Wallet.d.ts +0 -5
- package/dist/common/types/index.d.ts +0 -22
- package/dist/common/utils/builder.d.ts +0 -18
- package/dist/common/utils/converter.d.ts +0 -27
- package/dist/common/utils/deserializer.d.ts +0 -19
- package/dist/common/utils/index.d.ts +0 -5
- package/dist/common/utils/parser.d.ts +0 -5
- package/dist/common/utils/resolver.d.ts +0 -19
- package/dist/core/CIP14.d.ts +0 -2
- package/dist/core/CIP1852.d.ts +0 -4
- package/dist/core/CIP1853.d.ts +0 -1
- package/dist/core/CIP1855.d.ts +0 -1
- package/dist/core/CIP2.d.ts +0 -4
- package/dist/core/CIP25.d.ts +0 -19
- package/dist/core/CIP27.d.ts +0 -4
- package/dist/core/CIP8.d.ts +0 -15
- package/dist/core/CPS-009.d.ts +0 -2
- package/dist/core/CSL.d.ts +0 -147
- package/dist/core/index.d.ts +0 -9
- package/dist/core.cjs +0 -8
- package/dist/core.js +0 -5333
- package/dist/providers/blockfrost.provider.d.ts +0 -46
- package/dist/providers/index.d.ts +0 -6
- package/dist/providers/infura.provider.d.ts +0 -12
- package/dist/providers/koios.provider.d.ts +0 -27
- package/dist/providers/maestro.provider.d.ts +0 -35
- package/dist/providers/ogmios.provider.d.ts +0 -12
- package/dist/providers/tango.provider.d.ts +0 -25
- package/dist/providers/yaci.provider.d.ts +0 -32
- package/dist/scripts/forge.script.d.ts +0 -8
- package/dist/scripts/index.d.ts +0 -1
- package/dist/transaction/index.d.ts +0 -2
- package/dist/transaction/meshTxBuilder/index.d.ts +0 -2
- package/dist/transaction/meshTxBuilder/meshTxBuilder.service.d.ts +0 -47
- package/dist/transaction/meshTxBuilder/meshTxBuilder.spec.d.ts +0 -1
- package/dist/transaction/meshTxBuilder/meshTxBuilderCore.d.ts +0 -321
- package/dist/transaction/meshTxBuilder/type.d.ts +0 -146
- package/dist/transaction/transaction.service.d.ts +0 -157
- package/dist/transaction/transaction.service.spec.d.ts +0 -1
- package/dist/wallet/app.service.d.ts +0 -45
- package/dist/wallet/app.service.spec.d.ts +0 -1
- package/dist/wallet/browser.service.d.ts +0 -218
- package/dist/wallet/browser.service.spec.d.ts +0 -1
- package/dist/wallet/embedded.service.d.ts +0 -21
- package/dist/wallet/embedded.service.spec.d.ts +0 -1
- package/dist/wallet/index.d.ts +0 -4
- package/dist/wallet/mesh.service.d.ts +0 -188
- package/dist/wallet/mina.service.d.ts +0 -11
- package/dist/wallet/mina.service.spec.d.ts +0 -1
package/dist/core/CSL.d.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { csl } from '.';
|
|
2
|
-
export * as csl from '@emurgo/cardano-serialization-lib-nodejs';
|
|
3
|
-
export declare type Address = InstanceType<typeof csl.Address>;
|
|
4
|
-
export declare type AssetName = InstanceType<typeof csl.AssetName>;
|
|
5
|
-
export declare type AssetNames = InstanceType<typeof csl.AssetNames>;
|
|
6
|
-
export declare type Assets = InstanceType<typeof csl.Assets>;
|
|
7
|
-
export declare type AuxiliaryData = InstanceType<typeof csl.AuxiliaryData>;
|
|
8
|
-
export declare type AuxiliaryDataHash = InstanceType<typeof csl.AuxiliaryDataHash>;
|
|
9
|
-
export declare type AuxiliaryDataSet = InstanceType<typeof csl.AuxiliaryDataSet>;
|
|
10
|
-
export declare type BaseAddress = InstanceType<typeof csl.BaseAddress>;
|
|
11
|
-
export declare type BigInt = InstanceType<typeof csl.BigInt>;
|
|
12
|
-
export declare type BigNum = InstanceType<typeof csl.BigNum>;
|
|
13
|
-
export declare type Bip32PrivateKey = InstanceType<typeof csl.Bip32PrivateKey>;
|
|
14
|
-
export declare type Bip32PublicKey = InstanceType<typeof csl.Bip32PublicKey>;
|
|
15
|
-
export declare type Block = InstanceType<typeof csl.Block>;
|
|
16
|
-
export declare type BlockHash = InstanceType<typeof csl.BlockHash>;
|
|
17
|
-
export declare type BootstrapWitness = InstanceType<typeof csl.BootstrapWitness>;
|
|
18
|
-
export declare type BootstrapWitnesses = InstanceType<typeof csl.BootstrapWitnesses>;
|
|
19
|
-
export declare type ByronAddress = InstanceType<typeof csl.ByronAddress>;
|
|
20
|
-
export declare type Certificate = InstanceType<typeof csl.Certificate>;
|
|
21
|
-
export declare type Certificates = InstanceType<typeof csl.Certificates>;
|
|
22
|
-
export declare type ConstrPlutusData = InstanceType<typeof csl.ConstrPlutusData>;
|
|
23
|
-
export declare type CostModel = InstanceType<typeof csl.CostModel>;
|
|
24
|
-
export declare type Costmdls = InstanceType<typeof csl.Costmdls>;
|
|
25
|
-
export declare type DNSRecordAorAAAA = InstanceType<typeof csl.DNSRecordAorAAAA>;
|
|
26
|
-
export declare type DNSRecordSRV = InstanceType<typeof csl.DNSRecordSRV>;
|
|
27
|
-
export declare type DataCost = InstanceType<typeof csl.DataCost>;
|
|
28
|
-
export declare type DataHash = InstanceType<typeof csl.DataHash>;
|
|
29
|
-
export declare type DatumSource = InstanceType<typeof csl.DatumSource>;
|
|
30
|
-
export declare type Ed25519KeyHash = InstanceType<typeof csl.Ed25519KeyHash>;
|
|
31
|
-
export declare type Ed25519KeyHashes = InstanceType<typeof csl.Ed25519KeyHashes>;
|
|
32
|
-
export declare type Ed25519Signature = InstanceType<typeof csl.Ed25519Signature>;
|
|
33
|
-
export declare type EnterpriseAddress = InstanceType<typeof csl.EnterpriseAddress>;
|
|
34
|
-
export declare type ExUnitPrices = InstanceType<typeof csl.ExUnitPrices>;
|
|
35
|
-
export declare type ExUnits = InstanceType<typeof csl.ExUnits>;
|
|
36
|
-
export declare type GeneralTransactionMetadata = InstanceType<typeof csl.GeneralTransactionMetadata>;
|
|
37
|
-
export declare type GenesisDelegateHash = InstanceType<typeof csl.GenesisDelegateHash>;
|
|
38
|
-
export declare type GenesisHash = InstanceType<typeof csl.GenesisHash>;
|
|
39
|
-
export declare type GenesisHashes = InstanceType<typeof csl.GenesisHashes>;
|
|
40
|
-
export declare type GenesisKeyDelegation = InstanceType<typeof csl.GenesisKeyDelegation>;
|
|
41
|
-
export declare type Header = InstanceType<typeof csl.Header>;
|
|
42
|
-
export declare type HeaderBody = InstanceType<typeof csl.HeaderBody>;
|
|
43
|
-
export declare type Int = InstanceType<typeof csl.Int>;
|
|
44
|
-
export declare type Ipv4 = InstanceType<typeof csl.Ipv4>;
|
|
45
|
-
export declare type Ipv6 = InstanceType<typeof csl.Ipv6>;
|
|
46
|
-
export declare type KESSignature = InstanceType<typeof csl.KESSignature>;
|
|
47
|
-
export declare type KESVKey = InstanceType<typeof csl.KESVKey>;
|
|
48
|
-
export declare type Language = InstanceType<typeof csl.Language>;
|
|
49
|
-
export declare type Languages = InstanceType<typeof csl.Languages>;
|
|
50
|
-
export declare type LegacyDaedalusPrivateKey = InstanceType<typeof csl.LegacyDaedalusPrivateKey>;
|
|
51
|
-
export declare type LinearFee = InstanceType<typeof csl.LinearFee>;
|
|
52
|
-
export declare type MIRToStakeCredentials = InstanceType<typeof csl.MIRToStakeCredentials>;
|
|
53
|
-
export declare type MetadataList = InstanceType<typeof csl.MetadataList>;
|
|
54
|
-
export declare type MetadataMap = InstanceType<typeof csl.MetadataMap>;
|
|
55
|
-
export declare type Mint = InstanceType<typeof csl.Mint>;
|
|
56
|
-
export declare type MintAssets = InstanceType<typeof csl.MintAssets>;
|
|
57
|
-
export declare type MintBuilder = InstanceType<typeof csl.MintBuilder>;
|
|
58
|
-
export declare type MintWitness = InstanceType<typeof csl.MintWitness>;
|
|
59
|
-
export declare type MintsAssets = InstanceType<typeof csl.MintsAssets>;
|
|
60
|
-
export declare type MoveInstantaneousReward = InstanceType<typeof csl.MoveInstantaneousReward>;
|
|
61
|
-
export declare type MoveInstantaneousRewardsCert = InstanceType<typeof csl.MoveInstantaneousRewardsCert>;
|
|
62
|
-
export declare type MultiAsset = InstanceType<typeof csl.MultiAsset>;
|
|
63
|
-
export declare type MultiHostName = InstanceType<typeof csl.MultiHostName>;
|
|
64
|
-
export declare type NativeScript = InstanceType<typeof csl.NativeScript>;
|
|
65
|
-
export declare type NativeScripts = InstanceType<typeof csl.NativeScripts>;
|
|
66
|
-
export declare type NetworkId = InstanceType<typeof csl.NetworkId>;
|
|
67
|
-
export declare type NetworkInfo = InstanceType<typeof csl.NetworkInfo>;
|
|
68
|
-
export declare type Nonce = InstanceType<typeof csl.Nonce>;
|
|
69
|
-
export declare type OperationalCert = InstanceType<typeof csl.OperationalCert>;
|
|
70
|
-
export declare type PlutusData = InstanceType<typeof csl.PlutusData>;
|
|
71
|
-
export declare type PlutusList = InstanceType<typeof csl.PlutusList>;
|
|
72
|
-
export declare type PlutusMap = InstanceType<typeof csl.PlutusMap>;
|
|
73
|
-
export declare type PlutusScript = InstanceType<typeof csl.PlutusScript>;
|
|
74
|
-
export declare type PlutusScripts = InstanceType<typeof csl.PlutusScripts>;
|
|
75
|
-
export declare type PlutusScriptSource = InstanceType<typeof csl.PlutusScriptSource>;
|
|
76
|
-
export declare type PlutusWitness = InstanceType<typeof csl.PlutusWitness>;
|
|
77
|
-
export declare type PlutusWitnesses = InstanceType<typeof csl.PlutusWitnesses>;
|
|
78
|
-
export declare type Pointer = InstanceType<typeof csl.Pointer>;
|
|
79
|
-
export declare type PointerAddress = InstanceType<typeof csl.PointerAddress>;
|
|
80
|
-
export declare type PoolMetadata = InstanceType<typeof csl.PoolMetadata>;
|
|
81
|
-
export declare type PoolMetadataHash = InstanceType<typeof csl.PoolMetadataHash>;
|
|
82
|
-
export declare type PoolParams = InstanceType<typeof csl.PoolParams>;
|
|
83
|
-
export declare type PoolRegistration = InstanceType<typeof csl.PoolRegistration>;
|
|
84
|
-
export declare type PoolRetirement = InstanceType<typeof csl.PoolRetirement>;
|
|
85
|
-
export declare type PrivateKey = InstanceType<typeof csl.PrivateKey>;
|
|
86
|
-
export declare type ProposedProtocolParameterUpdates = InstanceType<typeof csl.ProposedProtocolParameterUpdates>;
|
|
87
|
-
export declare type ProtocolParamUpdate = InstanceType<typeof csl.ProtocolParamUpdate>;
|
|
88
|
-
export declare type ProtocolVersion = InstanceType<typeof csl.ProtocolVersion>;
|
|
89
|
-
export declare type PublicKey = InstanceType<typeof csl.PublicKey>;
|
|
90
|
-
export declare type PublicKeys = InstanceType<typeof csl.PublicKeys>;
|
|
91
|
-
export declare type Redeemer = InstanceType<typeof csl.Redeemer>;
|
|
92
|
-
export declare type RedeemerTag = InstanceType<typeof csl.RedeemerTag>;
|
|
93
|
-
export declare type Redeemers = InstanceType<typeof csl.Redeemers>;
|
|
94
|
-
export declare type Relay = InstanceType<typeof csl.Relay>;
|
|
95
|
-
export declare type Relays = InstanceType<typeof csl.Relays>;
|
|
96
|
-
export declare type RewardAddress = InstanceType<typeof csl.RewardAddress>;
|
|
97
|
-
export declare type RewardAddresses = InstanceType<typeof csl.RewardAddresses>;
|
|
98
|
-
export declare type ScriptAll = InstanceType<typeof csl.ScriptAll>;
|
|
99
|
-
export declare type ScriptAny = InstanceType<typeof csl.ScriptAny>;
|
|
100
|
-
export declare type ScriptDataHash = InstanceType<typeof csl.ScriptDataHash>;
|
|
101
|
-
export declare type ScriptHash = InstanceType<typeof csl.ScriptHash>;
|
|
102
|
-
export declare type ScriptHashes = InstanceType<typeof csl.ScriptHashes>;
|
|
103
|
-
export declare type ScriptNOfK = InstanceType<typeof csl.ScriptNOfK>;
|
|
104
|
-
export declare type ScriptPubkey = InstanceType<typeof csl.ScriptPubkey>;
|
|
105
|
-
export declare type ScriptRef = InstanceType<typeof csl.ScriptRef>;
|
|
106
|
-
export declare type SingleHostAddr = InstanceType<typeof csl.SingleHostAddr>;
|
|
107
|
-
export declare type SingleHostName = InstanceType<typeof csl.SingleHostName>;
|
|
108
|
-
export declare type StakeCredential = InstanceType<typeof csl.StakeCredential>;
|
|
109
|
-
export declare type StakeCredentials = InstanceType<typeof csl.StakeCredentials>;
|
|
110
|
-
export declare type StakeDelegation = InstanceType<typeof csl.StakeDelegation>;
|
|
111
|
-
export declare type StakeRegistration = InstanceType<typeof csl.StakeRegistration>;
|
|
112
|
-
export declare type Strings = InstanceType<typeof csl.Strings>;
|
|
113
|
-
export declare type TimelockExpiry = InstanceType<typeof csl.TimelockExpiry>;
|
|
114
|
-
export declare type TimelockStart = InstanceType<typeof csl.TimelockStart>;
|
|
115
|
-
export declare type Transaction = InstanceType<typeof csl.Transaction>;
|
|
116
|
-
export declare type TransactionBodies = InstanceType<typeof csl.TransactionBodies>;
|
|
117
|
-
export declare type TransactionBody = InstanceType<typeof csl.TransactionBody>;
|
|
118
|
-
export declare type TransactionBuilder = InstanceType<typeof csl.TransactionBuilder>;
|
|
119
|
-
export declare type TransactionBuilderConfig = InstanceType<typeof csl.TransactionBuilderConfig>;
|
|
120
|
-
export declare type TransactionBuilderConfigBuilder = InstanceType<typeof csl.TransactionBuilderConfigBuilder>;
|
|
121
|
-
export declare type TransactionHash = InstanceType<typeof csl.TransactionHash>;
|
|
122
|
-
export declare type TransactionInput = InstanceType<typeof csl.TransactionInput>;
|
|
123
|
-
export declare type TransactionInputs = InstanceType<typeof csl.TransactionInputs>;
|
|
124
|
-
export declare type TransactionMetadatum = InstanceType<typeof csl.TransactionMetadatum>;
|
|
125
|
-
export declare type TransactionMetadatumLabels = InstanceType<typeof csl.TransactionMetadatumLabels>;
|
|
126
|
-
export declare type TransactionOutput = InstanceType<typeof csl.TransactionOutput>;
|
|
127
|
-
export declare type TransactionOutputAmountBuilder = InstanceType<typeof csl.TransactionOutputAmountBuilder>;
|
|
128
|
-
export declare type TransactionOutputBuilder = InstanceType<typeof csl.TransactionOutputBuilder>;
|
|
129
|
-
export declare type TransactionOutputs = InstanceType<typeof csl.TransactionOutputs>;
|
|
130
|
-
export declare type TransactionUnspentOutput = InstanceType<typeof csl.TransactionUnspentOutput>;
|
|
131
|
-
export declare type TransactionUnspentOutputs = InstanceType<typeof csl.TransactionUnspentOutputs>;
|
|
132
|
-
export declare type TransactionWitnessSet = InstanceType<typeof csl.TransactionWitnessSet>;
|
|
133
|
-
export declare type TransactionWitnessSets = InstanceType<typeof csl.TransactionWitnessSets>;
|
|
134
|
-
export declare type TxBuilderConstants = InstanceType<typeof csl.TxBuilderConstants>;
|
|
135
|
-
export declare type TxInputsBuilder = InstanceType<typeof csl.TxInputsBuilder>;
|
|
136
|
-
export declare type URL = InstanceType<typeof csl.URL>;
|
|
137
|
-
export declare type UnitInterval = InstanceType<typeof csl.UnitInterval>;
|
|
138
|
-
export declare type Update = InstanceType<typeof csl.Update>;
|
|
139
|
-
export declare type VRFCert = InstanceType<typeof csl.VRFCert>;
|
|
140
|
-
export declare type VRFKeyHash = InstanceType<typeof csl.VRFKeyHash>;
|
|
141
|
-
export declare type VRFVKey = InstanceType<typeof csl.VRFVKey>;
|
|
142
|
-
export declare type Value = InstanceType<typeof csl.Value>;
|
|
143
|
-
export declare type Vkey = InstanceType<typeof csl.Vkey>;
|
|
144
|
-
export declare type Vkeys = InstanceType<typeof csl.Vkeys>;
|
|
145
|
-
export declare type Vkeywitness = InstanceType<typeof csl.Vkeywitness>;
|
|
146
|
-
export declare type Vkeywitnesses = InstanceType<typeof csl.Vkeywitnesses>;
|
|
147
|
-
export declare type Withdrawals = InstanceType<typeof csl.Withdrawals>;
|
package/dist/core/index.d.ts
DELETED
package/dist/core.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _r=require("nanoid"),Lr=require("@emurgo/cardano-serialization-lib-nodejs"),Gr=require("axios"),De=require("bip39"),Y=require("@emurgo/cardano-message-signing-nodejs"),Yr=s=>s&&typeof s=="object"&&"default"in s?s:{default:s};function $r(s){if(s&&s.__esModule)return s;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const a=$r(Lr),Mt=Yr(Gr),zr=s=>{const e=[];return s.forEach(t=>{const r=e.find(n=>n.unit===t.unit);r?r.quantity=(parseInt(r.quantity)+parseInt(t.quantity)).toString():e.push(t)}),e},Wr=["testnet","preview","preprod","mainnet"],yr=s=>Wr.includes(s),Yt={mem:7e6,steps:3e9},It={epoch:0,coinsPerUTxOSize:"4310",priceMem:.0577,priceStep:721e-7,minFeeA:44,minFeeB:155381,keyDeposit:"2000000",maxTxSize:16384,maxValSize:"5000",poolDeposit:"500000000",maxCollateralInputs:3,decentralisation:0,maxBlockSize:98304,collateralPercent:150,maxBlockHeaderSize:1100,minPoolCost:"340000000",maxTxExMem:"16000000",maxTxExSteps:"10000000000",maxBlockExMem:"80000000",maxBlockExSteps:"40000000000"},be=2147483648,bt={V1:a.Language.new_plutus_v1(),V2:a.Language.new_plutus_v2()},dt=56,Jr={CERT:a.RedeemerTag.new_cert(),MINT:a.RedeemerTag.new_mint(),REWARD:a.RedeemerTag.new_reward(),SPEND:a.RedeemerTag.new_spend()},Ie={testnet:["74","1598400","1595967616","432000"],preview:["183","15811222","1682467200","86400"],preprod:["65","26438400","1682121600","432000"],mainnet:["208","4492800","1596059091","432000"]},Je={ALONZO:a.TxBuilderConstants.plutus_alonzo_cost_models(),BABBAGE:(()=>{const s=a.Costmdls.new(),e=a.CostModel.new();Object.values({"addInteger-cpu-arguments-intercept":205665,"addInteger-cpu-arguments-slope":812,"addInteger-memory-arguments-intercept":1,"addInteger-memory-arguments-slope":1,"appendByteString-cpu-arguments-intercept":1e3,"appendByteString-cpu-arguments-slope":571,"appendByteString-memory-arguments-intercept":0,"appendByteString-memory-arguments-slope":1,"appendString-cpu-arguments-intercept":1e3,"appendString-cpu-arguments-slope":24177,"appendString-memory-arguments-intercept":4,"appendString-memory-arguments-slope":1,"bData-cpu-arguments":1e3,"bData-memory-arguments":32,"blake2b_256-cpu-arguments-intercept":117366,"blake2b_256-cpu-arguments-slope":10475,"blake2b_256-memory-arguments":4,"cekApplyCost-exBudgetCPU":23e3,"cekApplyCost-exBudgetMemory":100,"cekBuiltinCost-exBudgetCPU":23e3,"cekBuiltinCost-exBudgetMemory":100,"cekConstCost-exBudgetCPU":23e3,"cekConstCost-exBudgetMemory":100,"cekDelayCost-exBudgetCPU":23e3,"cekDelayCost-exBudgetMemory":100,"cekForceCost-exBudgetCPU":23e3,"cekForceCost-exBudgetMemory":100,"cekLamCost-exBudgetCPU":23e3,"cekLamCost-exBudgetMemory":100,"cekStartupCost-exBudgetCPU":100,"cekStartupCost-exBudgetMemory":100,"cekVarCost-exBudgetCPU":23e3,"cekVarCost-exBudgetMemory":100,"chooseData-cpu-arguments":19537,"chooseData-memory-arguments":32,"chooseList-cpu-arguments":175354,"chooseList-memory-arguments":32,"chooseUnit-cpu-arguments":46417,"chooseUnit-memory-arguments":4,"consByteString-cpu-arguments-intercept":221973,"consByteString-cpu-arguments-slope":511,"consByteString-memory-arguments-intercept":0,"consByteString-memory-arguments-slope":1,"constrData-cpu-arguments":89141,"constrData-memory-arguments":32,"decodeUtf8-cpu-arguments-intercept":497525,"decodeUtf8-cpu-arguments-slope":14068,"decodeUtf8-memory-arguments-intercept":4,"decodeUtf8-memory-arguments-slope":2,"divideInteger-cpu-arguments-constant":196500,"divideInteger-cpu-arguments-model-arguments-intercept":453240,"divideInteger-cpu-arguments-model-arguments-slope":220,"divideInteger-memory-arguments-intercept":0,"divideInteger-memory-arguments-minimum":1,"divideInteger-memory-arguments-slope":1,"encodeUtf8-cpu-arguments-intercept":1e3,"encodeUtf8-cpu-arguments-slope":28662,"encodeUtf8-memory-arguments-intercept":4,"encodeUtf8-memory-arguments-slope":2,"equalsByteString-cpu-arguments-constant":245e3,"equalsByteString-cpu-arguments-intercept":216773,"equalsByteString-cpu-arguments-slope":62,"equalsByteString-memory-arguments":1,"equalsData-cpu-arguments-intercept":1060367,"equalsData-cpu-arguments-slope":12586,"equalsData-memory-arguments":1,"equalsInteger-cpu-arguments-intercept":208512,"equalsInteger-cpu-arguments-slope":421,"equalsInteger-memory-arguments":1,"equalsString-cpu-arguments-constant":187e3,"equalsString-cpu-arguments-intercept":1e3,"equalsString-cpu-arguments-slope":52998,"equalsString-memory-arguments":1,"fstPair-cpu-arguments":80436,"fstPair-memory-arguments":32,"headList-cpu-arguments":43249,"headList-memory-arguments":32,"iData-cpu-arguments":1e3,"iData-memory-arguments":32,"ifThenElse-cpu-arguments":80556,"ifThenElse-memory-arguments":1,"indexByteString-cpu-arguments":57667,"indexByteString-memory-arguments":4,"lengthOfByteString-cpu-arguments":1e3,"lengthOfByteString-memory-arguments":10,"lessThanByteString-cpu-arguments-intercept":197145,"lessThanByteString-cpu-arguments-slope":156,"lessThanByteString-memory-arguments":1,"lessThanEqualsByteString-cpu-arguments-intercept":197145,"lessThanEqualsByteString-cpu-arguments-slope":156,"lessThanEqualsByteString-memory-arguments":1,"lessThanEqualsInteger-cpu-arguments-intercept":204924,"lessThanEqualsInteger-cpu-arguments-slope":473,"lessThanEqualsInteger-memory-arguments":1,"lessThanInteger-cpu-arguments-intercept":208896,"lessThanInteger-cpu-arguments-slope":511,"lessThanInteger-memory-arguments":1,"listData-cpu-arguments":52467,"listData-memory-arguments":32,"mapData-cpu-arguments":64832,"mapData-memory-arguments":32,"mkCons-cpu-arguments":65493,"mkCons-memory-arguments":32,"mkNilData-cpu-arguments":22558,"mkNilData-memory-arguments":32,"mkNilPairData-cpu-arguments":16563,"mkNilPairData-memory-arguments":32,"mkPairData-cpu-arguments":76511,"mkPairData-memory-arguments":32,"modInteger-cpu-arguments-constant":196500,"modInteger-cpu-arguments-model-arguments-intercept":453240,"modInteger-cpu-arguments-model-arguments-slope":220,"modInteger-memory-arguments-intercept":0,"modInteger-memory-arguments-minimum":1,"modInteger-memory-arguments-slope":1,"multiplyInteger-cpu-arguments-intercept":69522,"multiplyInteger-cpu-arguments-slope":11687,"multiplyInteger-memory-arguments-intercept":0,"multiplyInteger-memory-arguments-slope":1,"nullList-cpu-arguments":60091,"nullList-memory-arguments":32,"quotientInteger-cpu-arguments-constant":196500,"quotientInteger-cpu-arguments-model-arguments-intercept":453240,"quotientInteger-cpu-arguments-model-arguments-slope":220,"quotientInteger-memory-arguments-intercept":0,"quotientInteger-memory-arguments-minimum":1,"quotientInteger-memory-arguments-slope":1,"remainderInteger-cpu-arguments-constant":196500,"remainderInteger-cpu-arguments-model-arguments-intercept":453240,"remainderInteger-cpu-arguments-model-arguments-slope":220,"remainderInteger-memory-arguments-intercept":0,"remainderInteger-memory-arguments-minimum":1,"remainderInteger-memory-arguments-slope":1,"sha2_256-cpu-arguments-intercept":806990,"sha2_256-cpu-arguments-slope":30482,"sha2_256-memory-arguments":4,"sha3_256-cpu-arguments-intercept":1927926,"sha3_256-cpu-arguments-slope":82523,"sha3_256-memory-arguments":4,"sliceByteString-cpu-arguments-intercept":265318,"sliceByteString-cpu-arguments-slope":0,"sliceByteString-memory-arguments-intercept":4,"sliceByteString-memory-arguments-slope":0,"sndPair-cpu-arguments":85931,"sndPair-memory-arguments":32,"subtractInteger-cpu-arguments-intercept":205665,"subtractInteger-cpu-arguments-slope":812,"subtractInteger-memory-arguments-intercept":1,"subtractInteger-memory-arguments-slope":1,"tailList-cpu-arguments":41182,"tailList-memory-arguments":32,"trace-cpu-arguments":212342,"trace-memory-arguments":32,"unBData-cpu-arguments":31220,"unBData-memory-arguments":32,"unConstrData-cpu-arguments":32696,"unConstrData-memory-arguments":32,"unIData-cpu-arguments":43357,"unIData-memory-arguments":32,"unListData-cpu-arguments":32247,"unListData-memory-arguments":32,"unMapData-cpu-arguments":38314,"unMapData-memory-arguments":32,"verifyEd25519Signature-cpu-arguments-intercept":57996947,"verifyEd25519Signature-cpu-arguments-slope":18975,"verifyEd25519Signature-memory-arguments":10}).forEach((r,n)=>e.set(n,a.Int.new_i32(r)));const t=a.CostModel.new();return Object.values({"addInteger-cpu-arguments-intercept":205665,"addInteger-cpu-arguments-slope":812,"addInteger-memory-arguments-intercept":1,"addInteger-memory-arguments-slope":1,"appendByteString-cpu-arguments-intercept":1e3,"appendByteString-cpu-arguments-slope":571,"appendByteString-memory-arguments-intercept":0,"appendByteString-memory-arguments-slope":1,"appendString-cpu-arguments-intercept":1e3,"appendString-cpu-arguments-slope":24177,"appendString-memory-arguments-intercept":4,"appendString-memory-arguments-slope":1,"bData-cpu-arguments":1e3,"bData-memory-arguments":32,"blake2b_256-cpu-arguments-intercept":117366,"blake2b_256-cpu-arguments-slope":10475,"blake2b_256-memory-arguments":4,"cekApplyCost-exBudgetCPU":23e3,"cekApplyCost-exBudgetMemory":100,"cekBuiltinCost-exBudgetCPU":23e3,"cekBuiltinCost-exBudgetMemory":100,"cekConstCost-exBudgetCPU":23e3,"cekConstCost-exBudgetMemory":100,"cekDelayCost-exBudgetCPU":23e3,"cekDelayCost-exBudgetMemory":100,"cekForceCost-exBudgetCPU":23e3,"cekForceCost-exBudgetMemory":100,"cekLamCost-exBudgetCPU":23e3,"cekLamCost-exBudgetMemory":100,"cekStartupCost-exBudgetCPU":100,"cekStartupCost-exBudgetMemory":100,"cekVarCost-exBudgetCPU":23e3,"cekVarCost-exBudgetMemory":100,"chooseData-cpu-arguments":19537,"chooseData-memory-arguments":32,"chooseList-cpu-arguments":175354,"chooseList-memory-arguments":32,"chooseUnit-cpu-arguments":46417,"chooseUnit-memory-arguments":4,"consByteString-cpu-arguments-intercept":221973,"consByteString-cpu-arguments-slope":511,"consByteString-memory-arguments-intercept":0,"consByteString-memory-arguments-slope":1,"constrData-cpu-arguments":89141,"constrData-memory-arguments":32,"decodeUtf8-cpu-arguments-intercept":497525,"decodeUtf8-cpu-arguments-slope":14068,"decodeUtf8-memory-arguments-intercept":4,"decodeUtf8-memory-arguments-slope":2,"divideInteger-cpu-arguments-constant":196500,"divideInteger-cpu-arguments-model-arguments-intercept":453240,"divideInteger-cpu-arguments-model-arguments-slope":220,"divideInteger-memory-arguments-intercept":0,"divideInteger-memory-arguments-minimum":1,"divideInteger-memory-arguments-slope":1,"encodeUtf8-cpu-arguments-intercept":1e3,"encodeUtf8-cpu-arguments-slope":28662,"encodeUtf8-memory-arguments-intercept":4,"encodeUtf8-memory-arguments-slope":2,"equalsByteString-cpu-arguments-constant":245e3,"equalsByteString-cpu-arguments-intercept":216773,"equalsByteString-cpu-arguments-slope":62,"equalsByteString-memory-arguments":1,"equalsData-cpu-arguments-intercept":1060367,"equalsData-cpu-arguments-slope":12586,"equalsData-memory-arguments":1,"equalsInteger-cpu-arguments-intercept":208512,"equalsInteger-cpu-arguments-slope":421,"equalsInteger-memory-arguments":1,"equalsString-cpu-arguments-constant":187e3,"equalsString-cpu-arguments-intercept":1e3,"equalsString-cpu-arguments-slope":52998,"equalsString-memory-arguments":1,"fstPair-cpu-arguments":80436,"fstPair-memory-arguments":32,"headList-cpu-arguments":43249,"headList-memory-arguments":32,"iData-cpu-arguments":1e3,"iData-memory-arguments":32,"ifThenElse-cpu-arguments":80556,"ifThenElse-memory-arguments":1,"indexByteString-cpu-arguments":57667,"indexByteString-memory-arguments":4,"lengthOfByteString-cpu-arguments":1e3,"lengthOfByteString-memory-arguments":10,"lessThanByteString-cpu-arguments-intercept":197145,"lessThanByteString-cpu-arguments-slope":156,"lessThanByteString-memory-arguments":1,"lessThanEqualsByteString-cpu-arguments-intercept":197145,"lessThanEqualsByteString-cpu-arguments-slope":156,"lessThanEqualsByteString-memory-arguments":1,"lessThanEqualsInteger-cpu-arguments-intercept":204924,"lessThanEqualsInteger-cpu-arguments-slope":473,"lessThanEqualsInteger-memory-arguments":1,"lessThanInteger-cpu-arguments-intercept":208896,"lessThanInteger-cpu-arguments-slope":511,"lessThanInteger-memory-arguments":1,"listData-cpu-arguments":52467,"listData-memory-arguments":32,"mapData-cpu-arguments":64832,"mapData-memory-arguments":32,"mkCons-cpu-arguments":65493,"mkCons-memory-arguments":32,"mkNilData-cpu-arguments":22558,"mkNilData-memory-arguments":32,"mkNilPairData-cpu-arguments":16563,"mkNilPairData-memory-arguments":32,"mkPairData-cpu-arguments":76511,"mkPairData-memory-arguments":32,"modInteger-cpu-arguments-constant":196500,"modInteger-cpu-arguments-model-arguments-intercept":453240,"modInteger-cpu-arguments-model-arguments-slope":220,"modInteger-memory-arguments-intercept":0,"modInteger-memory-arguments-minimum":1,"modInteger-memory-arguments-slope":1,"multiplyInteger-cpu-arguments-intercept":69522,"multiplyInteger-cpu-arguments-slope":11687,"multiplyInteger-memory-arguments-intercept":0,"multiplyInteger-memory-arguments-slope":1,"nullList-cpu-arguments":60091,"nullList-memory-arguments":32,"quotientInteger-cpu-arguments-constant":196500,"quotientInteger-cpu-arguments-model-arguments-intercept":453240,"quotientInteger-cpu-arguments-model-arguments-slope":220,"quotientInteger-memory-arguments-intercept":0,"quotientInteger-memory-arguments-minimum":1,"quotientInteger-memory-arguments-slope":1,"remainderInteger-cpu-arguments-constant":196500,"remainderInteger-cpu-arguments-model-arguments-intercept":453240,"remainderInteger-cpu-arguments-model-arguments-slope":220,"remainderInteger-memory-arguments-intercept":0,"remainderInteger-memory-arguments-minimum":1,"remainderInteger-memory-arguments-slope":1,"serialiseData-cpu-arguments-intercept":1159724,"serialiseData-cpu-arguments-slope":392670,"serialiseData-memory-arguments-intercept":0,"serialiseData-memory-arguments-slope":2,"sha2_256-cpu-arguments-intercept":806990,"sha2_256-cpu-arguments-slope":30482,"sha2_256-memory-arguments":4,"sha3_256-cpu-arguments-intercept":1927926,"sha3_256-cpu-arguments-slope":82523,"sha3_256-memory-arguments":4,"sliceByteString-cpu-arguments-intercept":265318,"sliceByteString-cpu-arguments-slope":0,"sliceByteString-memory-arguments-intercept":4,"sliceByteString-memory-arguments-slope":0,"sndPair-cpu-arguments":85931,"sndPair-memory-arguments":32,"subtractInteger-cpu-arguments-intercept":205665,"subtractInteger-cpu-arguments-slope":812,"subtractInteger-memory-arguments-intercept":1,"subtractInteger-memory-arguments-slope":1,"tailList-cpu-arguments":41182,"tailList-memory-arguments":32,"trace-cpu-arguments":212342,"trace-memory-arguments":32,"unBData-cpu-arguments":31220,"unBData-memory-arguments":32,"unConstrData-cpu-arguments":32696,"unConstrData-memory-arguments":32,"unIData-cpu-arguments":43357,"unIData-memory-arguments":32,"unListData-cpu-arguments":32247,"unListData-memory-arguments":32,"unMapData-cpu-arguments":38314,"unMapData-memory-arguments":32,"verifyEcdsaSecp256k1Signature-cpu-arguments":35892428,"verifyEcdsaSecp256k1Signature-memory-arguments":10,"verifyEd25519Signature-cpu-arguments-intercept":57996947,"verifyEd25519Signature-cpu-arguments-slope":18975,"verifyEd25519Signature-memory-arguments":10,"verifySchnorrSecp256k1Signature-cpu-arguments-intercept":38887044,"verifySchnorrSecp256k1Signature-cpu-arguments-slope":32947,"verifySchnorrSecp256k1Signature-memory-arguments":10}).forEach((r,n)=>t.set(n,a.Int.new_i32(r))),s.insert(a.Language.new_plutus_v1(),e),s.insert(a.Language.new_plutus_v2(),t),s})()},jr={ALONZO:{V1:"a141005901d59f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f704001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff"},BABBAGE:{V1:"a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",V2:"a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"}},Ke={[a.NetworkInfo.testnet().network_id()]:"8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",[a.NetworkInfo.mainnet().network_id()]:"f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"},Xr={mainnet:"wss://ogmios-api.mainnet.dandelion.link",preprod:"wss://ogmios-api.iohk-preprod.dandelion.link",preview:"__TBD_SOON_TM__",testnet:"wss://ogmios-api.testnet.dandelion.link"},Zr={LQ:"da8c30857834c6ae7203935b89278c532b3995245295456f993e1d244c51",MIN:"29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e",NTX:"edfd7a1d77bcb8b884c474bdc92a16002d1fb720e454fa6e993444794e5458",iBTC:"f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069425443",iETH:"f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069455448",iUSD:"f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069555344",MILK:"8a1cfae21368b8bebbbed9800fec304e95cce39a2a57dc35e2e3ebaa4d494c4b",AGIX:"f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc53541474958",MELD:"6ac8ef33b510ec004fe11585f7c5a9f0c07f0c23428ab4f29c1d7d104d454c44",INDY:"533bb94a8850ee3ccbe483106489399112b74c905342cb1792a797a0494e4459",CLAY:"38ad9dc3aec6a2f38e220142b9aa6ade63ebe71f65e7cc2b7d8a8535434c4159",MCOS:"6f46e1304b16d884c85c62fb0eef35028facdc41aaa0fd319a152ed64d434f53",DING:"ce5b9e0f8a88255b65f2e4d065c6e716e9fa9a8a86dfb86423dd1ac044494e47",GERO:"10a49b996e2402269af553a8a96fb8eb90d79e9eca79e2b4223057b64745524f",NMKR:"5dac8536653edc12f6f5e1045d8164b9f59998d3bdc300fc928434894e4d4b52",PAVIA:"884892bcdc360bcef87d6b3f806e7f9cd5ac30d999d49970e7a903ae5041564941",HOSKY:"a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235484f534b59",YUMMI:"078eafce5cd7edafdf63900edef2c1ea759e77f30ca81d6bbdeec92479756d6d69",C3:"8e51398904a5d3fc129fbf4f1589701de23c7824d5c90fdb9490e15a434841524c4933",GIMBAL:"2b0a04a7b60132b1805b296c7fcb3b217ff14413991bf76f72663c3067696d62616c",SUNDAE:"9a9693a9a37912a5097918f97918d15240c92ab729a0b7c4aa144d7753554e444145",GREENS:"4623ab311b7d982d8d26fcbe1a9439ca56661aafcdcd8d8a0ef31fd6475245454e53",GENS:"dda5fdb1002f7389b33e036b6afee82a8189becb6cba852e8b79b4fb0014df1047454e53",SOCIETY:"25f0fc240e91bd95dcdaebd2ba7713fc5168ac77234a3d79449fc20c534f4349455459",DJED:"8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344",SHEN:"8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344",WMT:"1d7f33bd23d85e1a25d87d86fac4f199c3197a2f7afeb662a0f34e1e776f726c646d6f62696c65746f6b656e",COPI:"b6a7467ea1deb012808ef4e87b5ff371e85f7142d7b356a40d9b42a0436f726e75636f70696173205b76696120436861696e506f72742e696f5d"},je=["begin","eternl","flint","lace","nami","nufi","gerowallet","typhoncip30","vespr","yoroi"],xr=(s,e,t="5000000")=>{const r=a.BigNum.from_str(s.get("lovelace")??"0").checked_add(a.BigNum.from_str(t)),n=e.filter(l=>l.output.amount.filter(p=>p.unit!=="lovelace").some(p=>s.has(p.unit))),i=ss(n);return[...i.less_than(r)?ns(r.clamped_sub(i).to_str(),e.filter(l=>!n.some(p=>p.input.txHash===l.input.txHash&&p.input.outputIndex===l.input.outputIndex))):[],...n]},ts=(s,e,t=!1,{maxTxSize:r,minFeeA:n,minFeeB:i}=It)=>{const c=e.filter(v=>Cr(v)===!1).sort(He),l=a.BigNum.from_str($e(r,n,i)),p=t?a.BigNum.from_str(s).checked_add(l).to_str():s;return ne(c,new Map([["lovelace",p]]))},wr=(s,e,t=!1,r=It)=>{const n=e.filter(Cr).sort(He),i=rs(r),c=s.get("lovelace")??"0",l=t?a.BigNum.from_str(c).checked_add(i).to_str():c;return s.set("lovelace",l),ne(n,s)},es=(s,e)=>Array.from(e,t=>({unit:t[0],quantity:a.BigNum.from_str(t[1])})).every(t=>s.filter(r=>r.output.amount.find(n=>n.unit===t.unit)!==void 0).reduce((r,n)=>{const i=n.output.amount.reduce((c,l)=>c.checked_add(a.BigNum.from_str(t.unit===l.unit?l.quantity:"0")),a.BigNum.from_str("0"));return r.checked_add(i)},a.BigNum.from_str("0")).less_than(t.quantity)===!1),He=(s,e)=>{var n,i;const t=a.BigNum.from_str(((n=s.output.amount.find(c=>c.unit==="lovelace"))==null?void 0:n.quantity)??"0");return a.BigNum.from_str(((i=e.output.amount.find(c=>c.unit==="lovelace"))==null?void 0:i.quantity)??"0").compare(t)},rs=s=>{const{maxTxSize:e,minFeeA:t,minFeeB:r}=s;return a.BigNum.from_str($e(e,t,r))},Cr=s=>s.output.amount.length>1,ss=s=>s.reduce((e,t)=>{var n;const r=((n=t.output.amount.find(i=>i.unit==="lovelace"))==null?void 0:n.quantity)??"0";return e.checked_add(a.BigNum.from_str(r))},a.BigNum.from_str("0")),ns=(s,e)=>{const t=e.sort(He);return ne(t,new Map([["lovelace",s]]))},ne=(s,e,t=[])=>s.length===0||es(t,e)?t:is(s[0],e)?ne(s.slice(1),e,[...t,s[0]]):ne(s.slice(1),e,t),is=(s,e)=>Array.from(e.keys()).some(t=>s.output.amount.find(r=>r.unit===t)!==void 0),as=(s,e)=>{const t=us(e),r=ls(s,e);return{coseKey:ht(t.to_bytes()),coseSign1:ht(r.to_bytes())}},os=(s,e,{key:t,signature:r})=>{var c,l;const n=Y.COSEKey.from_bytes(G(t)),i=Y.COSESign1.from_bytes(G(r));if((s==null?void 0:s.length)>0){const p=ht(i.payload()??new Uint8Array);if(ft(s)!==p)return!1}if((e==null?void 0:e.length)>0){const y=(c=i.headers().protected().deserialized_headers().header(Y.Label.new_text("address")))==null?void 0:c.as_bytes();if(y===void 0)throw new Error("Couldn't find a signer address in signature");const B=(l=n.header(Y.Label.new_int(Y.Int.new_negative(Y.BigNum.from_str("2")))))==null?void 0:l.as_bytes();if(B===void 0)throw new Error("Couldn't find a signer key in signature");const v=Gt(ht(y)),w=Os(ht(B));if(cs(e,v,w)===!1)throw new Error("Couldn't check signature because of address mismatch");const b=Us(ht(i.signature())),P=i.signed_data().to_bytes();return w.verify(P,b)}return!1},cs=(s,e,t)=>{if(s!==e.to_bech32())return!1;try{return $t(s)===t.hash().to_hex()}catch{return!1}},us=s=>{const e=Y.COSEKey.new(Y.Label.from_key_type(Y.KeyType.OKP));return e.set_algorithm_id(Y.Label.from_algorithm_id(Y.AlgorithmId.EdDSA)),e.set_header(Y.Label.new_int(Y.Int.new_negative(Y.BigNum.from_str("1"))),Y.CBORValue.new_int(Y.Int.new_i32(6))),e.set_header(Y.Label.new_int(Y.Int.new_negative(Y.BigNum.from_str("2"))),Y.CBORValue.new_bytes(s.key.to_public().as_bytes())),e},ls=(s,e)=>{const t=Y.HeaderMap.new(),r=Y.HeaderMap.new();t.set_algorithm_id(Y.Label.from_algorithm_id(Y.AlgorithmId.EdDSA)),t.set_header(Y.Label.new_text("address"),Y.CBORValue.new_bytes(e.address.to_bytes()));const n=Y.Headers.new(Y.ProtectedHeaderMap.new(t),r),i=Y.COSESign1Builder.new(n,G(s.payload),!1);s.externalAAD!==void 0&&i.set_external_aad(G(s.externalAAD));const c=i.make_data_to_sign(),l=e.key.sign(c.to_bytes());return i.build(l.to_bytes())};var Te=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Br={},ct={exports:{}};Dt.notEqual=ds;Dt.notOk=fs;Dt.equal=hs;Dt.ok=Dt;var Sr=Dt;function hs(s,e,t){Dt(s==e,t)}function ds(s,e,t){Dt(s!=e,t)}function fs(s,e){Dt(!s,e)}function Dt(s,e){if(!s)throw new Error(e||"AssertionError")}var Et={exports:{}};function gs(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ms=Fe;Fe.supported=typeof WebAssembly<"u";function Fe(s){if(!Fe.supported)return null;var e=s&&s.imports,t=ps("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0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"),r=null,n={buffer:t,memory:null,exports:null,realloc:i,onload:c};return c(function(){}),n;function i(p){n.exports.memory.grow(Math.ceil(Math.abs(p-n.memory.length)/65536)),n.memory=new Uint8Array(n.exports.memory.buffer)}function c(p){if(n.exports)return p();if(r){r.then(p.bind(null,null)).catch(p);return}try{if(s&&s.async)throw new Error("async");l({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{r=WebAssembly.instantiate(t,e).then(l)}c(p)}function l(p){n.exports=p.instance.exports,n.memory=n.exports.memory&&n.exports.memory.buffer&&new Uint8Array(n.exports.memory.buffer)}}function ps(s){return typeof atob=="function"?new Uint8Array(atob(s).split("").map(As)):new(gs("buffer")).Buffer(s,"base64")}function As(s){return s.charCodeAt(0)}var Ct=Sr,J=ms(),Qt=64,ge=[];Et.exports=_t;var Xe=Et.exports.BYTES_MIN=16,Ze=Et.exports.BYTES_MAX=64;Et.exports.BYTES=32;var tr=Et.exports.KEYBYTES_MIN=16,er=Et.exports.KEYBYTES_MAX=64;Et.exports.KEYBYTES=32;var rr=Et.exports.SALTBYTES=16,sr=Et.exports.PERSONALBYTES=16;function _t(s,e,t,r,n){if(!(this instanceof _t))return new _t(s,e,t,r,n);if(!(J&&J.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");s||(s=32),n!==!0&&(Ct(s>=Xe,"digestLength must be at least "+Xe+", was given "+s),Ct(s<=Ze,"digestLength must be at most "+Ze+", was given "+s),e!=null&&Ct(e.length>=tr,"key must be at least "+tr+", was given "+e.length),e!=null&&Ct(e.length<=er,"key must be at least "+er+", was given "+e.length),t!=null&&Ct(t.length===rr,"salt must be exactly "+rr+", was given "+t.length),r!=null&&Ct(r.length===sr,"personal must be exactly "+sr+", was given "+r.length)),ge.length||(ge.push(Qt),Qt+=216),this.digestLength=s,this.finalized=!1,this.pointer=ge.pop(),J.memory.fill(0,0,64),J.memory[0]=this.digestLength,J.memory[1]=e?e.length:0,J.memory[2]=1,J.memory[3]=1,t&&J.memory.set(t,32),r&&J.memory.set(r,48),this.pointer+216>J.memory.length&&J.realloc(this.pointer+216),J.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),J.memory.fill(0,Qt,Qt+e.length),J.memory[this.pointer+200]=128)}_t.prototype.update=function(s){return Ct(this.finalized===!1,"Hash instance finalized"),Ct(s,"input must be TypedArray or Buffer"),Qt+s.length>J.memory.length&&J.realloc(Qt+s.length),J.memory.set(s,Qt),J.exports.blake2b_update(this.pointer,Qt,Qt+s.length),this};_t.prototype.digest=function(s){if(Ct(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,ge.push(this.pointer),J.exports.blake2b_final(this.pointer),!s||s==="binary")return J.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(s==="hex")return _s(J.memory,this.pointer+128,this.digestLength);Ct(s.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e<this.digestLength;e++)s[e]=J.memory[this.pointer+128+e];return s};_t.prototype.final=_t.prototype.digest;_t.WASM=J&&J.buffer;_t.SUPPORTED=typeof WebAssembly<"u";_t.ready=function(s){if(s||(s=Is),!J)return s(new Error("WebAssembly not supported"));var e=new Promise(function(t,r){J.onload(function(n){n?r():t(),s(n)})});return e};_t.prototype.ready=_t.ready;function Is(){}function _s(s,e,t){for(var r="",n=0;n<t;n++)r+=ys(s[e+n]);return r}function ys(s){return s<16?"0"+s.toString(16):s.toString(16)}var Ut=Sr,ie=Et.exports;function ue(s,e,t){var r=s[e]+s[t],n=s[e+1]+s[t+1];r>=4294967296&&n++,s[e]=r,s[e+1]=n}function nr(s,e,t,r){var n=s[e]+t;t<0&&(n+=4294967296);var i=s[e+1]+r;n>=4294967296&&i++,s[e]=n,s[e+1]=i}function Er(s,e){return s[e]^s[e+1]<<8^s[e+2]<<16^s[e+3]<<24}function Nt(s,e,t,r,n,i){var c=re[n],l=re[n+1],p=re[i],y=re[i+1];ue(H,s,e),nr(H,s,c,l);var B=H[r]^H[s],v=H[r+1]^H[s+1];H[r]=v,H[r+1]=B,ue(H,t,r),B=H[e]^H[t],v=H[e+1]^H[t+1],H[e]=B>>>24^v<<8,H[e+1]=v>>>24^B<<8,ue(H,s,e),nr(H,s,p,y),B=H[r]^H[s],v=H[r+1]^H[s+1],H[r]=B>>>16^v<<16,H[r+1]=v>>>16^B<<16,ue(H,t,r),B=H[e]^H[t],v=H[e+1]^H[t+1],H[e]=v>>>31^B<<1,H[e+1]=B>>>31^v<<1}var vr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),xs=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],at=new Uint8Array(xs.map(function(s){return s*2})),H=new Uint32Array(32),re=new Uint32Array(32);function br(s,e){var t=0;for(t=0;t<16;t++)H[t]=s.h[t],H[t+16]=vr[t];for(H[24]=H[24]^s.t,H[25]=H[25]^s.t/4294967296,e&&(H[28]=~H[28],H[29]=~H[29]),t=0;t<32;t++)re[t]=Er(s.b,4*t);for(t=0;t<12;t++)Nt(0,8,16,24,at[t*16+0],at[t*16+1]),Nt(2,10,18,26,at[t*16+2],at[t*16+3]),Nt(4,12,20,28,at[t*16+4],at[t*16+5]),Nt(6,14,22,30,at[t*16+6],at[t*16+7]),Nt(0,10,20,30,at[t*16+8],at[t*16+9]),Nt(2,12,22,24,at[t*16+10],at[t*16+11]),Nt(4,14,16,26,at[t*16+12],at[t*16+13]),Nt(6,8,18,28,at[t*16+14],at[t*16+15]);for(t=0;t<16;t++)s.h[t]=s.h[t]^H[t]^H[t+16]}var Pt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function Jt(s,e,t,r){Pt.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=s,Pt[0]=s,e&&(Pt[1]=e.length),Pt[2]=1,Pt[3]=1,t&&Pt.set(t,32),r&&Pt.set(r,48);for(var n=0;n<16;n++)this.h[n]=vr[n]^Er(Pt,n*4);e&&(Qr(this,e),this.c=128)}Jt.prototype.update=function(s){return Ut(s!=null,"input must be Uint8Array or Buffer"),Qr(this,s),this};Jt.prototype.digest=function(s){var e=!s||s==="binary"||s==="hex"?new Uint8Array(this.outlen):s;return Ut(e.length>=this.outlen,"out must have at least outlen bytes of space"),ws(this,e),s==="hex"?Cs(e):e};Jt.prototype.final=Jt.prototype.digest;Jt.ready=function(s){ie.ready(function(){s()})};function Qr(s,e){for(var t=0;t<e.length;t++)s.c===128&&(s.t+=s.c,br(s,!1),s.c=0),s.b[s.c++]=e[t]}function ws(s,e){for(s.t+=s.c;s.c<128;)s.b[s.c++]=0;br(s,!0);for(var t=0;t<s.outlen;t++)e[t]=s.h[t>>2]>>8*(t&3);return e}function Cs(s){for(var e="",t=0;t<s.length;t++)e+=Bs(s[t]);return e}function Bs(s){return s<16?"0"+s.toString(16):s.toString(16)}var Dr=Jt;ct.exports=function(e,t,r,n,i){return i!==!0&&(Ut(e>=ir,"outlen must be at least "+ir+", was given "+e),Ut(e<=ar,"outlen must be at most "+ar+", was given "+e),t!=null&&Ut(t.length>=or,"key must be at least "+or+", was given "+t.length),t!=null&&Ut(t.length<=cr,"key must be at most "+cr+", was given "+t.length),r!=null&&Ut(r.length===ur,"salt must be exactly "+ur+", was given "+r.length),n!=null&&Ut(n.length===lr,"personal must be exactly "+lr+", was given "+n.length)),new Dr(e,t,r,n)};ct.exports.ready=function(s){ie.ready(function(){s()})};ct.exports.WASM_SUPPORTED=ie.SUPPORTED;ct.exports.WASM_LOADED=!1;var ir=ct.exports.BYTES_MIN=16,ar=ct.exports.BYTES_MAX=64;ct.exports.BYTES=32;var or=ct.exports.KEYBYTES_MIN=16,cr=ct.exports.KEYBYTES_MAX=64;ct.exports.KEYBYTES=32;var ur=ct.exports.SALTBYTES=16,lr=ct.exports.PERSONALBYTES=16;ie.ready(function(s){s||(ct.exports.WASM_LOADED=!0,Dr=ie)});var jt={};Object.defineProperty(jt,"__esModule",{value:!0});jt.bech32m=jt.bech32=void 0;const _e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Tr={};for(let s=0;s<_e.length;s++){const e=_e.charAt(s);Tr[e]=s}function zt(s){const e=s>>25;return(s&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function hr(s){let e=1;for(let t=0;t<s.length;++t){const r=s.charCodeAt(t);if(r<33||r>126)return"Invalid prefix ("+s+")";e=zt(e)^r>>5}e=zt(e);for(let t=0;t<s.length;++t){const r=s.charCodeAt(t);e=zt(e)^r&31}return e}function Re(s,e,t,r){let n=0,i=0;const c=(1<<t)-1,l=[];for(let p=0;p<s.length;++p)for(n=n<<e|s[p],i+=e;i>=t;)i-=t,l.push(n>>i&c);if(r)i>0&&l.push(n<<t-i&c);else{if(i>=e)return"Excess padding";if(n<<t-i&c)return"Non-zero padding"}return l}function Ss(s){return Re(s,8,5,!0)}function Es(s){const e=Re(s,5,8,!1);if(Array.isArray(e))return e}function vs(s){const e=Re(s,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function kr(s){let e;s==="bech32"?e=1:e=734539939;function t(c,l,p){if(p=p||90,c.length+7+l.length>p)throw new TypeError("Exceeds length limit");c=c.toLowerCase();let y=hr(c);if(typeof y=="string")throw new Error(y);let B=c+"1";for(let v=0;v<l.length;++v){const w=l[v];if(w>>5!==0)throw new Error("Non 5-bit word");y=zt(y)^w,B+=_e.charAt(w)}for(let v=0;v<6;++v)y=zt(y);y^=e;for(let v=0;v<6;++v){const w=y>>(5-v)*5&31;B+=_e.charAt(w)}return B}function r(c,l){if(l=l||90,c.length<8)return c+" too short";if(c.length>l)return"Exceeds length limit";const p=c.toLowerCase(),y=c.toUpperCase();if(c!==p&&c!==y)return"Mixed-case string "+c;c=p;const B=c.lastIndexOf("1");if(B===-1)return"No separator character for "+c;if(B===0)return"Missing prefix for "+c;const v=c.slice(0,B),w=c.slice(B+1);if(w.length<6)return"Data too short";let b=hr(v);if(typeof b=="string")return b;const P=[];for(let T=0;T<w.length;++T){const N=w.charAt(T),k=Tr[N];if(k===void 0)return"Unknown character "+N;b=zt(b)^k,!(T+6>=w.length)&&P.push(k)}return b!==e?"Invalid checksum for "+c:{prefix:v,words:P}}function n(c,l){const p=r(c,l);if(typeof p=="object")return p}function i(c,l){const p=r(c,l);if(typeof p=="object")return p;throw new Error(p)}return{decodeUnsafe:n,decode:i,encode:t,toWords:Ss,fromWordsUnsafe:Es,fromWords:vs}}jt.bech32=kr("bech32");jt.bech32m=kr("bech32m");var bs=Te&&Te.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Br,"__esModule",{value:!0});const Qs=bs(ct.exports),le=jt,Qe="asset";class se{constructor(e){this.hashBuf=e}static fromHash(e){return new se(e)}static fromParts(e,t){const r=(0,Qs.default)(20).update(new Uint8Array([...e,...t])).digest("binary");return se.fromHash(r)}static fromBech32(e){const{prefix:t,words:r}=le.bech32.decode(e);if(t!==Qe)throw new Error("Invalid asset fingerprint");const n=Buffer.from(le.bech32.fromWords(r));return se.fromHash(n)}fingerprint(){const e=le.bech32.toWords(this.hashBuf);return le.bech32.encode(Qe,e)}hash(){return Buffer.from(this.hashBuf).toString("hex")}prefix(){return Qe}checksum(){return this.fingerprint().slice(-6)}}var Ds=Br.default=se;const Ts=Ds,ks=(s,e,t=0)=>{const r=Ns(s),n=r.derive(be+1852).derive(be+1815).derive(be+e),i=n.derive(0).derive(t).to_raw_key(),c=n.derive(2).derive(0).to_raw_key();return n.free(),r.free(),{paymentKey:i,stakeKey:c}},Gt=s=>a.Address.from_bytes(G(s)),Ns=s=>a.Bip32PrivateKey.from_bytes(G(s)),Ps=s=>a.DataHash.from_bytes(G(s)),Bt=s=>a.Ed25519KeyHash.from_bytes(G(s)),Us=s=>a.Ed25519Signature.from_bytes(G(s)),qe=s=>a.NativeScript.from_bytes(G(s)),Os=s=>a.PublicKey.from_bytes(G(s)),Nr=s=>a.PlutusData.from_bytes(G(s)),Xt=(s,e)=>a.PlutusScript.from_bytes_with_version(G(s),bt[e]),Ms=s=>a.ScriptRef.from_bytes(G(s)),Ks=s=>a.ScriptHash.from_bytes(G(s)),At=s=>a.Transaction.from_bytes(G(s)),ke=s=>a.TransactionHash.from_bytes(G(s)),dr=s=>a.TransactionUnspentOutput.from_bytes(G(s)),fr=s=>a.TransactionWitnessSet.from_bytes(G(s)),Hs=s=>a.Value.from_bytes(G(s)),xt=s=>a.Address.from_bech32(s),Ve=s=>a.BaseAddress.from_address(xt(s)),Pr=s=>a.EnterpriseAddress.from_address(xt(s)),Ur=s=>a.RewardAddress.from_address(xt(s)),ht=s=>Buffer.from(s).toString("hex"),G=s=>s.length%2===0&&/^[0-9A-F]*$/i.test(s)?Buffer.from(s,"hex"):Buffer.from(s,"utf-8"),Le=s=>{const e=t=>{const r=new Array;for(let n=0;n<t.len();n+=1)r.push(Le(t.get(n)));return r};switch(s.kind()){case a.NativeScriptKind.ScriptAll:{const t=s.as_script_all();return{type:"all",scripts:e(t.native_scripts())}}case a.NativeScriptKind.ScriptAny:{const t=s.as_script_any();return{type:"any",scripts:e(t.native_scripts())}}case a.NativeScriptKind.ScriptNOfK:{const t=s.as_script_n_of_k();return{type:"atLeast",required:t.n(),scripts:e(t.native_scripts())}}case a.NativeScriptKind.TimelockStart:return{type:"after",slot:s.as_timelock_start().slot_bignum().to_str()};case a.NativeScriptKind.TimelockExpiry:return{type:"before",slot:s.as_timelock_expiry().slot_bignum().to_str()};case a.NativeScriptKind.ScriptPubkey:return{type:"sig",keyHash:s.as_script_pubkey().addr_keyhash().to_hex()};default:throw new Error(`Script Kind: ${s.kind()}, is not supported`)}},Vt=s=>{const e=t=>{const r=a.NativeScripts.new();return t.forEach(n=>{r.add(Vt(n))}),r};switch(s.type){case"all":return a.NativeScript.new_script_all(a.ScriptAll.new(e(s.scripts)));case"any":return a.NativeScript.new_script_any(a.ScriptAny.new(e(s.scripts)));case"atLeast":return a.NativeScript.new_script_n_of_k(a.ScriptNOfK.new(s.required,e(s.scripts)));case"after":return a.NativeScript.new_timelock_start(a.TimelockStart.new_timelockstart(a.BigNum.from_str(s.slot)));case"before":return a.NativeScript.new_timelock_expiry(a.TimelockExpiry.new_timelockexpiry(a.BigNum.from_str(s.slot)));case"sig":return a.NativeScript.new_script_pubkey(a.ScriptPubkey.new(Bt(s.keyHash)))}},me=s=>{var r,n,i;const e=c=>{const l=[];for(let p=0;p<c.len();p+=1)l.push(me(c.get(p)));return l},t=c=>{const l=new Map;for(let p=0;p<c.len();p+=1){const y=c.keys().get(p),B=c.get(y)??a.PlutusData.from_hex(ft("NO_ITEM_FOUND_INSIDE_GOLD_ROOM"));l.set(me(y),me(B))}return l};switch(s.kind()){case a.PlutusDataKind.Bytes:return ht(s.as_bytes()??new Uint8Array);case a.PlutusDataKind.Integer:return parseInt(((r=s.as_integer())==null?void 0:r.to_str())??"0",10);case a.PlutusDataKind.List:return e(s.as_list()??a.PlutusList.new());case a.PlutusDataKind.Map:return t(s.as_map()??a.PlutusMap.new());case a.PlutusDataKind.ConstrPlutusData:return{alternative:parseInt(((n=s.as_constr_plutus_data())==null?void 0:n.alternative().to_str())??"0",10),fields:e(((i=s.as_constr_plutus_data())==null?void 0:i.data())??a.PlutusList.new())};default:throw new Error(`PlutusData Kind: ${s.kind()}, is not supported`)}},Ot=s=>{const e=t=>{const r=a.PlutusList.new();return t.forEach(n=>{r.add(Ot(n))}),r};switch(typeof s){case"string":return a.PlutusData.new_bytes(G(s));case"number":return a.PlutusData.new_integer(a.BigInt.from_str(s.toString()));case"bigint":return a.PlutusData.new_integer(a.BigInt.from_str(s.toString()));case"object":if(s instanceof Array){const t=e(s);return a.PlutusData.new_list(t)}else if(s instanceof Map){const t=a.PlutusMap.new();return s.forEach((r,n)=>{t.insert(Ot(n),Ot(r))}),a.PlutusData.new_map(t)}else return a.PlutusData.new_constr_plutus_data(a.ConstrPlutusData.new(a.BigNum.from_str(s.alternative.toString()),e(s.fields)))}},Fs=s=>{const e=a.Relays.new();throw s.relays.forEach(t=>{e.add(Or(t))}),new Error("toPoolParams not implemented.")},Ne=s=>{const e=t=>Jr[t];return a.Redeemer.new(e(s.tag),a.BigNum.from_str(s.index.toString()),Ot(s.data),a.ExUnits.new(a.BigNum.from_str(s.budget.mem.toString()),a.BigNum.from_str(s.budget.steps.toString())))},Or=s=>{switch(s.type){case"SingleHostAddr":{const e=s.IPV4?a.Ipv4.new(new Uint8Array(s.IPV4.split(".").map(r=>parseInt(r)))):void 0,t=s.IPV6?a.Ipv6.new(G(s.IPV6.replaceAll(":",""))):void 0;return a.Relay.new_single_host_addr(a.SingleHostAddr.new(s.port,e,t))}case"SingleHostName":return a.Relay.new_single_host_name(a.SingleHostName.new(s.port,a.DNSRecordAorAAAA.new(s.domainName)));case"MultiHostName":return a.Relay.new_multi_host_name(a.MultiHostName.new(a.DNSRecordSRV.new(s.domainName)))}},Mr=s=>{if(s.is_plutus_script()){const t=s.plutus_script();return{code:t.to_hex(),version:Object.keys(bt).find(r=>bt[r].to_hex()===t.language_version().to_hex())}}const e=s.native_script();return Le(e)},Zt=s=>{if("code"in s){const e=Xt(s.code,s.version);return a.ScriptRef.new_plutus_script(e)}return a.ScriptRef.new_native_script(Vt(s))},ae=s=>{var n,i,c;const e=s.output().has_data_hash()?(n=s.output().data_hash())==null?void 0:n.to_hex():void 0,t=s.output().has_plutus_data()?(i=s.output().plutus_data())==null?void 0:i.to_hex():void 0,r=s.output().has_script_ref()?(c=s.output().script_ref())==null?void 0:c.to_hex():void 0;return{input:{outputIndex:s.input().index(),txHash:s.input().transaction_id().to_hex()},output:{address:s.output().address().to_bech32(),amount:Kr(s.output().amount()),dataHash:e,plutusData:t,scriptRef:r}}},pt=s=>{const e=a.TransactionInput.new(ke(s.input.txHash),s.input.outputIndex),t=a.TransactionOutput.new(xt(s.output.address),St(s.output.amount));return s.output.dataHash!==void 0&&t.set_data_hash(Ps(s.output.dataHash)),s.output.plutusData!==void 0&&t.set_plutus_data(Nr(s.output.plutusData)),s.output.scriptRef!==void 0&&t.set_script_ref(Ms(s.output.scriptRef)),a.TransactionUnspentOutput.new(e,t)},gr=s=>{const e=s.split(".")[1]??"0",t=`${parseInt(e,10)}`,r="1"+"0".repeat(e.length);return a.UnitInterval.new(a.BigNum.from_str(t),a.BigNum.from_str(r))},ft=s=>s.length%2===0&&/^[0-9A-F]*$/i.test(s)?s:ht(Buffer.from(s,"utf-8")),Ge=s=>Buffer.from(s,"hex").toString("utf-8"),Kr=s=>{const e=[{unit:"lovelace",quantity:s.coin().to_str()}],t=s.multiasset();if(t!==void 0){const r=t.keys();for(let n=0;n<r.len();n+=1){const i=r.get(n),c=t.get(i);if(c!==void 0){const l=c.keys();for(let p=0;p<l.len();p+=1){const y=l.get(p),B=c.get(y)??a.BigNum.from_str("0"),v=i.to_hex()+ht(y.name());e.push({unit:v,quantity:B.to_str()})}}}}return e},St=s=>{const e=s.find(i=>i.unit==="lovelace"),t=Array.from(new Set(s.filter(i=>i.unit!=="lovelace").map(i=>i.unit.slice(0,dt)))),r=a.MultiAsset.new();t.forEach(i=>{const c=a.Assets.new();s.filter(l=>l.unit.slice(0,dt)===i).forEach(l=>{c.insert(a.AssetName.new(G(l.unit.slice(dt))),a.BigNum.from_str(l.quantity))}),r.insert(Ks(i),c)});const n=a.Value.new(a.BigNum.from_str(e?e.quantity:"0"));return(s.length>1||!e)&&n.set_multiasset(r),n},mr=(s,e,t)=>a.BaseAddress.new(s,a.StakeCredential.from_keyhash(e),a.StakeCredential.from_keyhash(t)),Hr=(s,e="")=>a.Bip32PrivateKey.from_bip39_entropy(G(s),G(ft(e))),Pe=s=>a.DataCost.new_coins_per_byte(a.BigNum.from_str(s)),Rs=s=>{if(typeof s!="object"||!("input"in s))return a.DatumSource.new(Ot(s));const e=pt(s);if(e.output().has_plutus_data())return a.DatumSource.new_ref_input(e.input());throw new Error(`No inline datum found in UTxO: ${e.input().transaction_id().to_hex()}`)},pr=(s,e)=>a.EnterpriseAddress.new(s,a.StakeCredential.from_keyhash(e)),Ar=(s,e)=>{if(typeof s=="string")return a.MintWitness.new_native_script(qe(s));if(e===void 0)throw new Error("Minting with plutus requires a redeemer to be defined");if(e.tag!=="MINT")throw new Error("Minting redeemer's tag must be defined as 'MINT'");return a.MintWitness.new_plutus_script(Oe(s),Ne({tag:"MINT",index:0,budget:Yt,data:{alternative:0,fields:[]},...e}))},Ue=(s,e)=>a.RewardAddress.new(s,a.StakeCredential.from_keyhash(e)),Oe=s=>{if("code"in s)return a.PlutusScriptSource.new(Xt(s.code,s.version));const e=pt(s);if(e.output().has_script_ref()){const t=e.output().script_ref();if(t.is_plutus_script()){const r=Mr(t),n=Xt(r.code,r.version).hash();return a.PlutusScriptSource.new_ref_input_with_lang_ver(n,e.input(),bt[r.version])}}throw new Error(`No plutus script reference found in UTxO: ${e.input().transaction_id().to_hex()}`)},he=s=>{const e=a.ScriptPubkey.new(s);return a.NativeScript.new_script_pubkey(e)},pe=(s=It)=>{const e=a.TransactionBuilderConfigBuilder.new().coins_per_utxo_byte(a.BigNum.from_str(s.coinsPerUTxOSize)).ex_unit_prices(a.ExUnitPrices.new(gr(s.priceMem.toString()),gr(s.priceStep.toString()))).fee_algo(a.LinearFee.new(a.BigNum.from_str(s.minFeeA.toString()),a.BigNum.from_str(s.minFeeB.toString()))).key_deposit(a.BigNum.from_str(s.keyDeposit)).max_tx_size(s.maxTxSize).max_value_size(parseInt(s.maxValSize,10)).pool_deposit(a.BigNum.from_str(s.poolDeposit)).build();return a.TransactionBuilder.new(e)},Ir=s=>{const e=a.TxInputsBuilder.new();return s.map(t=>t instanceof a.TransactionUnspentOutput?t:pt(t)).forEach(t=>{e.add_input(t.output().address(),t.input(),t.output().amount())}),e},de=s=>{if(typeof s=="string")return a.TransactionOutputBuilder.new().with_address(xt(s));let e=a.TransactionOutputBuilder.new().with_address(xt(s.address));if(s.datum){const{value:t,inline:r}=s.datum,n=Ot(t);e=e.with_data_hash(a.hash_plutus_data(n)),r&&(e=e.with_plutus_data(n))}if(s.script){const t=Zt(s.script);e=e.with_script_ref(t)}return e},Tt=s=>{const e=s.slice(0,dt),t=s.includes(".")?ft(s.split(".")[1]):s.slice(dt);return{policyId:e,assetName:t}},S=s=>Mt.default.isAxiosError(s)?s.response?JSON.stringify({data:s.response.data,headers:s.response.headers,status:s.response.status}):s.request?JSON.stringify(s.request):s.message:JSON.stringify(s),qs=s=>{const e=Ot(s);return a.hash_plutus_data(e).to_hex()},Vs=(s,e=Date.now())=>{if(Ie[s]){const[t,r,n,i]=Ie[s];return parseInt(a.BigNum.from_str(e.toString()).div_floor(a.BigNum.from_str("1000")).checked_sub(a.BigNum.from_str(n)).div_floor(a.BigNum.from_str(i)).checked_add(a.BigNum.from_str(t)).to_str(),10)}throw new Error(`Couldn't resolve EpochNo for network: ${s}`)},Ye=(s,e)=>Ts.fromParts(G(s),G(e)).fingerprint(),Ls=(s,e)=>jr[s][e],Gs=(s,e=0)=>{const t=Vt(s);return a.EnterpriseAddress.new(e,a.StakeCredential.from_scripthash(t.hash())).to_address().to_bech32()},Ys=s=>Vt(s).hash().to_hex(),$s=s=>Vt(s).to_hex(),qt=s=>{var e,t;try{const r=[(e=Ve(s))==null?void 0:e.payment_cred().to_keyhash(),(t=Pr(s))==null?void 0:t.payment_cred().to_keyhash()].find(n=>n!==void 0);if(r!==void 0)return r.to_hex();throw new Error(`Couldn't resolve payment key hash from address: ${s}`)}catch(r){throw new Error(`An error occurred during resolvePaymentKeyHash: ${r}.`)}},zs=(s,e=0)=>{const t=Xt(s.code,s.version);return a.EnterpriseAddress.new(e,a.StakeCredential.from_scripthash(t.hash())).to_address().to_bech32()},Ws=s=>{try{const e=Pr(s),t=e==null?void 0:e.payment_cred().to_scripthash();if(t!==void 0)return t.to_hex();throw new Error(`Couldn't resolve script hash from address: ${s}`)}catch(e){throw new Error(`An error occurred during resolveScriptHash: ${e}.`)}},Js=s=>a.Ed25519KeyHash.from_hex(s).to_bech32("pool1"),Fr=s=>{const e=De.mnemonicToEntropy(s.join(" ")),t=Hr(e),r=t.to_bech32();return t.free(),r},js=s=>Zt(s).to_hex(),Xs=(s,e=Date.now())=>{if(Ie[s]){const[t,r,n]=Ie[s];return a.BigNum.from_str(e.toString()).div_floor(a.BigNum.from_str("1000")).checked_sub(a.BigNum.from_str(n)).checked_add(a.BigNum.from_str(r)).to_str()}throw new Error(`Couldn't resolve SlotNo for network: ${s}`)},oe=s=>{try{const e=xt(s),t=Ve(s),r=t==null?void 0:t.stake_cred().to_keyhash();if(r!==void 0)return Ue(e.network_id(),r).to_address().to_bech32();throw new Error(`Couldn't resolve reward address from address: ${s}`)}catch(e){throw new Error(`An error occurred during resolveRewardAddress: ${e}.`)}},$t=s=>{var e,t;try{const r=[(e=Ve(s))==null?void 0:e.stake_cred().to_keyhash(),(t=Ur(s))==null?void 0:t.payment_cred().to_keyhash()].find(n=>n!==void 0);if(r!==void 0)return r.to_hex();throw new Error(`Couldn't resolve stake key hash from address: ${s}`)}catch(r){throw new Error(`An error occurred during resolveStakeKeyHash: ${r}.`)}},$e=(s,e=It.minFeeA,t=It.minFeeB)=>(BigInt(e)*BigInt(s)+BigInt(t)).toString(),Me=s=>{const e=At(s).body();return a.hash_transaction(e).to_hex()},Zs=(s="",e=32)=>{if(e<=0||e>2048)throw new Error("Length must be bewteen 1 and 2048");const r=_r.customAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")(e);return ft(`${s}${r}`)},ye=(s,e)=>{const t=s.vkeys();if(t!==void 0){const r=new Set;for(let i=0;i<t.len();i+=1)r.add(t.get(i).to_hex());for(let i=0;i<e.len();i+=1)r.add(e.get(i).to_hex());const n=a.Vkeywitnesses.new();return r.forEach(i=>{n.add(a.Vkeywitness.from_hex(i))}),n}return e},tn=s=>me(Nr(s)),en=s=>At(s).to_js_value();class rn{_axiosInstance;constructor(...e){if(typeof e[0]=="string"&&e[0].startsWith("http"))this._axiosInstance=Mt.default.create({baseURL:e[0]});else{const t=e[0],r=t.slice(0,7);this._axiosInstance=Mt.default.create({baseURL:`https://cardano-${r}.blockfrost.io/api/v${e[1]??0}`,headers:{project_id:t}})}}async fetchAccountInfo(e){const t=e.startsWith("addr")?oe(e):e;try{const{data:r,status:n}=await this._axiosInstance.get(`accounts/${t}`);if(n===200)return{poolId:r.pool_id,active:r.active||r.active_epoch!==null,balance:r.controlled_amount,rewards:r.withdrawable_amount,withdrawals:r.withdrawals_sum};throw S(r)}catch(r){throw S(r)}}resolveScriptRef=async e=>{if(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}`);if(r===200){const n=t.type.startsWith("plutus")?{code:await this.fetchPlutusScriptCBOR(e),version:t.type.replace("plutus","")}:await this.fetchNativeScriptJSON(e);return Zt(n).to_hex()}throw S(t)}};toUTxO=async(e,t)=>({input:{outputIndex:e.output_index,txHash:t},output:{address:e.address,amount:e.amount,dataHash:e.data_hash??void 0,plutusData:e.inline_datum??void 0,scriptRef:await this.resolveScriptRef(e.reference_script_hash),scriptHash:e.reference_script_hash}});async fetchAddressUTxOs(e,t){const r=t!==void 0?`/${t}`:"",n=`addresses/${e}/utxos`+r,i=async(c=1,l=[])=>{const{data:p,status:y}=await this._axiosInstance.get(`${n}?page=${c}`);if(y===200)return p.length>0?i(c+1,[...l,...await Promise.all(p.map(B=>this.toUTxO(B,B.tx_hash)))]):l;throw S(p)};try{return await i()}catch{return[]}}async fetchAssetAddresses(e){const t=async(r=1,n=[])=>{const{policyId:i,assetName:c}=Tt(e),{data:l,status:p}=await this._axiosInstance.get(`assets/${i}${c}/addresses?page=${r}`);if(p===200)return l.length>0?t(r+1,[...n,...l]):n;throw S(l)};try{return await t()}catch{return[]}}async fetchAssetMetadata(e){try{const{policyId:t,assetName:r}=Tt(e),{data:n,status:i}=await this._axiosInstance.get(`assets/${t}${r}`);if(i===200)return{...n.onchain_metadata};throw S(n)}catch(t){throw S(t)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`blocks/${e}`);if(r===200)return{confirmations:t.confirmations,epoch:t.epoch,epochSlot:t.epoch_slot.toString(),fees:t.fees,hash:t.hash,nextBlock:t.next_block??"",operationalCertificate:t.op_cert,output:t.output??"0",previousBlock:t.previous_block,size:t.size,slot:t.slot.toString(),slotLeader:t.slot_leader??"",time:t.time,txCount:t.tx_count,VRFKey:t.block_vrf};throw S(t)}catch(t){throw S(t)}}async fetchCollectionAssets(e,t=1){try{const{data:r,status:n}=await this._axiosInstance.get(`assets/policy/${e}?page=${t}`);if(n===200)return{assets:r.map(i=>({unit:i.asset,quantity:i.quantity})),next:r.length===100?t+1:null};throw S(r)}catch{return{assets:[],next:null}}}async fetchHandleAddress(e){try{const t=ft(e.replace("$","")),{data:r,status:n}=await this._axiosInstance.get(`assets/${Ke[1]}${t}/addresses`);if(n===200)return r[0].address;throw S(r)}catch(t){throw S(t)}}async fetchProtocolParameters(e=Number.NaN){try{const{data:t,status:r}=await this._axiosInstance.get(`epochs/${isNaN(e)?"latest":e}/parameters`);if(r===200)return{coinsPerUTxOSize:t.coins_per_utxo_word,collateralPercent:t.collateral_percent,decentralisation:t.decentralisation_param,epoch:t.epoch,keyDeposit:t.key_deposit,maxBlockExMem:t.max_block_ex_mem,maxBlockExSteps:t.max_block_ex_steps,maxBlockHeaderSize:t.max_block_header_size,maxBlockSize:t.max_block_size,maxCollateralInputs:t.max_collateral_inputs,maxTxExMem:t.max_tx_ex_mem,maxTxExSteps:t.max_tx_ex_steps,maxTxSize:t.max_tx_size,maxValSize:t.max_val_size,minFeeA:t.min_fee_a,minFeeB:t.min_fee_b,minPoolCost:t.min_pool_cost,poolDeposit:t.pool_deposit,priceMem:t.price_mem,priceStep:t.price_step};throw S(t)}catch(t){throw S(t)}}async fetchTxInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`txs/${e}`);if(r===200)return{block:t.block,deposit:t.deposit,fees:t.fees,hash:t.hash,index:t.index,invalidAfter:t.invalid_hereafter??"",invalidBefore:t.invalid_before??"",slot:t.slot.toString(),size:t.size};throw S(t)}catch(t){throw S(t)}}async fetchUTxOs(e){try{const{data:t,status:r}=await this._axiosInstance.get(`txs/${e}/utxos`);if(r===200){const n=t.outputs,i=[];return n.forEach(l=>{i.push(this.toUTxO(l,e))}),await Promise.all(i)}throw S(t)}catch(t){throw S(t)}}onTxConfirmed(e,t,r=100){let n=0;const i=setInterval(()=>{n>=r&&clearInterval(i),this.fetchTxInfo(e).then(c=>{this.fetchBlockInfo(c.block).then(l=>{(l==null?void 0:l.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{n+=1})}).catch(()=>{n+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/cbor"},{data:r,status:n}=await this._axiosInstance.post("tx/submit",G(e),{headers:t});if(n===200)return r;throw S(r)}catch(t){throw S(t)}}async fetchPlutusScriptCBOR(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}/cbor`);if(r===200)return t.cbor;throw S(t)}async fetchNativeScriptJSON(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}/json`);if(r===200)return t.json;throw S(t)}}class sn{_axiosInstance;constructor(e,t,r){const n=r.host??"ipfs.infura.io",i=r.port??5001,c=r.version??0;this._axiosInstance=Mt.default.create({baseURL:`https://${n}:${i}/api/v${c}`,auth:{username:e,password:t}})}async uploadContent(e,t=!1){try{const r={"Content-Type":"multipart/form-data"},{data:n,status:i}=await this._axiosInstance.post(`add?recursive=${t}`,e,{headers:r});if(i===200)return n;throw S(n)}catch(r){throw S(r)}}}class nn{_axiosInstance;constructor(...e){if(typeof e[0]=="string"&&e[0].startsWith("http"))this._axiosInstance=Mt.default.create({baseURL:e[0],headers:{Authorization:`Bearer ${e[1]}`}});else{let t=1;typeof e[2]=="number"&&(t=e[2]);const r={baseURL:`https://${e[0]}.koios.rest/api/v${t}`};typeof e[1]=="string"&&(r.headers={Authorization:`Bearer ${e[1]}`}),this._axiosInstance=Mt.default.create(r)}}async fetchAccountInfo(e){try{const t=e.startsWith("addr")?oe(e):e,{data:r,status:n}=await this._axiosInstance.post("account_info",{_stake_addresses:[t]});if(n===200)return{poolId:r[0].delegated_pool,active:r[0].status==="registered",balance:r[0].total_balance.toString(),rewards:r[0].rewards_available,withdrawals:r[0].withdrawals};throw S(r)}catch(t){throw S(t)}}async fetchAddressUTxOs(e,t){try{const{data:r,status:n}=await this._axiosInstance.post("address_info",{_addresses:[e]});if(n===200){const i=r.flatMap(c=>c.utxo_set).map(c=>this.toUTxO(c,e));return t!==void 0?i.filter(c=>c.output.amount.find(l=>l.unit===t)!==void 0):i}throw S(r)}catch{return[]}}async fetchAssetAddresses(e){try{const{policyId:t,assetName:r}=Tt(e),{data:n,status:i}=await this._axiosInstance.get(`asset_address_list?_asset_policy=${t}&_asset_name=${r}`);if(i===200)return n.map(c=>({address:c.payment_address,quantity:c.quantity}));throw S(n)}catch(t){throw S(t)}}async fetchAssetMetadata(e){try{const{policyId:t,assetName:r}=Tt(e),{data:n,status:i}=await this._axiosInstance.get(`asset_info?_asset_policy=${t}&_asset_name=${r}`);if(i===200)return{...n[0].minting_tx_metadata[721][t][Ge(r)]};throw S(n)}catch(t){throw S(t)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.post("block_info",{_block_hashes:[e]});if(r===200)return{confirmations:t[0].num_confirmations,epoch:t[0].epoch_no,epochSlot:t[0].epoch_slot.toString(),fees:t[0].total_fees??"",hash:t[0].hash,nextBlock:t[0].child_hash??"",operationalCertificate:t[0].op_cert,output:t[0].total_output??"0",previousBlock:t[0].parent_hash,size:t[0].block_size,slot:t[0].abs_slot.toString(),slotLeader:t[0].pool??"",time:t[0].block_time,txCount:t[0].tx_count,VRFKey:t[0].vrf_key};throw S(t)}catch(t){throw S(t)}}async fetchCollectionAssets(e,t=0){try{const{data:r,status:n}=await this._axiosInstance.get(`asset_policy_info?_asset_policy=${e}&limit=100&offset=${t}`);if(n===200)return{assets:r.map(i=>({unit:`${e}${i.asset_name}`,quantity:i.total_supply})),next:r.length===100?t+100:null};throw S(r)}catch(r){throw S(r)}}async fetchHandleAddress(e){try{const t=ft(e.replace("$","")),{data:r,status:n}=await this._axiosInstance.get(`asset_address_list?_asset_policy=${Ke[1]}&_asset_name=${t}`);if(n===200)return r[0].payment_address;throw S(r)}catch(t){throw S(t)}}async fetchProtocolParameters(e){try{const{data:t,status:r}=await this._axiosInstance.get(`epoch_params?_epoch_no=${e}`);if(r===200)return{coinsPerUTxOSize:t[0].coins_per_utxo_size,collateralPercent:t[0].collateral_percent,decentralisation:t[0].decentralisation,epoch:t[0].epoch_no,keyDeposit:t[0].key_deposit,maxBlockExMem:t[0].max_block_ex_mem.toString(),maxBlockExSteps:t[0].max_block_ex_steps.toString(),maxBlockHeaderSize:t[0].max_bh_size,maxBlockSize:t[0].max_block_size,maxCollateralInputs:t[0].max_collateral_inputs,maxTxExMem:t[0].max_tx_ex_mem.toString(),maxTxExSteps:t[0].max_tx_ex_steps.toString(),maxTxSize:t[0].max_tx_size,maxValSize:t[0].max_val_size.toString(),minFeeA:t[0].min_fee_a,minFeeB:t[0].min_fee_b,minPoolCost:t[0].min_pool_cost,poolDeposit:t[0].pool_deposit,priceMem:t[0].price_mem,priceStep:t[0].price_step};throw S(t)}catch(t){throw S(t)}}async fetchTxInfo(e){var t,r;try{const{data:n,status:i}=await this._axiosInstance.post("tx_info",{_tx_hashes:[e]});if(i===200)return{block:n[0].block_hash,deposit:n[0].deposit,fees:n[0].fee,hash:n[0].tx_hash,index:n[0].tx_block_index,invalidAfter:((t=n[0].invalid_after)==null?void 0:t.toString())??"",invalidBefore:((r=n[0].invalid_before)==null?void 0:r.toString())??"",slot:n[0].absolute_slot.toString(),size:n[0].tx_size};throw S(n)}catch(n){throw S(n)}}async fetchUTxOs(e){try{const{data:t,status:r}=await this._axiosInstance.post("tx_info",{_tx_hashes:[e]});if(r===200)return t[0].outputs.map(i=>this.toUTxO(i,i.payment_addr.bech32));throw S(t)}catch(t){throw S(t)}}onTxConfirmed(e,t,r=100){let n=0;const i=setInterval(()=>{n>=r&&clearInterval(i),this.fetchTxInfo(e).then(c=>{this.fetchBlockInfo(c.block).then(l=>{(l==null?void 0:l.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{n+=1})}).catch(()=>{n+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/cbor"},{data:r,status:n}=await this._axiosInstance.post("submittx",G(e),{headers:t});if(n===202)return r;throw S(r)}catch(t){throw S(t)}}toUTxO(e,t){var r,n;return{input:{outputIndex:e.tx_index,txHash:e.tx_hash},output:{address:t,amount:[{unit:"lovelace",quantity:e.value},...e.asset_list.map(i=>({unit:`${i.policy_id}${i.asset_name}`,quantity:`${i.quantity}`}))],dataHash:e.datum_hash??void 0,plutusData:((r=e.inline_datum)==null?void 0:r.bytes)??void 0,scriptRef:this.resolveScriptRef(e.reference_script),scriptHash:((n=e.reference_script)==null?void 0:n.hash)??void 0}}}resolveScriptRef=e=>{if(e){const t=e.type.startsWith("plutus")?{code:e.bytes,version:e.type.replace("plutus","")}:Le(qe(e.bytes));return Zt(t).to_hex()}}}class an{_baseUrl;constructor(...e){this._baseUrl=yr(e[0])?Xr[e[0]]:e[0]}async evaluateTx(e){const t=await this.open();return this.send(t,"EvaluateTx",{evaluate:e}),new Promise((r,n)=>{t.addEventListener("message",i=>{try{const{result:c}=JSON.parse(i.data);c.EvaluationResult?r(Object.keys(c.EvaluationResult).map(l=>({index:parseInt(l.split(":")[1],10),tag:l.split(":")[0].toUpperCase(),budget:{mem:c.EvaluationResult[l].memory,steps:c.EvaluationResult[l].steps}}))):n(c.EvaluationFailure),t.close()}catch(c){n(c)}},{once:!0})})}async onNextTx(e){const t=await this.open();return this.send(t,"AwaitAcquire",{}),t.addEventListener("message",r=>{const{result:n}=JSON.parse(r.data);if(n===null)return this.send(t,"AwaitAcquire",{});n.AwaitAcquired===void 0&&e(n),this.send(t,"NextTx",{})}),()=>t.close()}async submitTx(e){const t=await this.open();return this.send(t,"SubmitTx",{submit:e}),new Promise((r,n)=>{t.addEventListener("message",i=>{try{const{result:c}=JSON.parse(i.data);c.SubmitSuccess?r(c.SubmitSuccess.txId):n(c.SubmitFail),t.close()}catch(c){n(c)}},{once:!0})})}async open(){const e=new WebSocket(this._baseUrl);return await new Promise(t=>{e.addEventListener("open",()=>t(!0),{once:!0})}),e}send(e,t,r){e.send(JSON.stringify({version:"1.0",type:"jsonwsp/request",servicename:"ogmios",methodname:t,args:r}))}}class on{_axiosInstance;_amountsAsStrings={headers:{"amounts-as-strings":"true"}};submitUrl;constructor({network:e,apiKey:t,turboSubmit:r=!1}){this._axiosInstance=Mt.default.create({baseURL:`https://${e}.gomaestro-api.org/v1`,headers:{"api-key":t}}),this.submitUrl=r?"txmanager/turbosubmit":"txmanager"}async evaluateTx(e){try{const{data:t,status:r}=await this._axiosInstance.post("transactions/evaluate",{cbor:e});if(r===200){const n={spend:"SPEND",mint:"MINT",cert:"CERT",wdrl:"REWARD"};return t.map(c=>{const l=c.ex_units,p=c.redeemer_index,y=n[c.redeemer_tag];return{budget:l,index:p,tag:y}})}throw S(t)}catch(t){throw S(t)}}async fetchAccountInfo(e){const t=e.startsWith("addr")?oe(e):e;try{const{data:r,status:n}=await this._axiosInstance.get(`accounts/${t}`,this._amountsAsStrings);if(n===200){const i=r.data;return{poolId:i.delegated_pool,active:i.registered,balance:i.total_balance,rewards:i.rewards_available,withdrawals:i.total_withdrawn}}throw S(r)}catch(r){throw S(r)}}async fetchAddressUTxOs(e,t){const r=(()=>e.startsWith("addr_vkh")||e.startsWith("addr_shared_vkh")?`addresses/cred/${e}`:`addresses/${e}`)(),n=t?`&asset=${t}`:"",i=async(c=null,l=[])=>{const p=c===null?"":`&cursor=${c}`,{data:y,status:B}=await this._axiosInstance.get(`${r}/utxos?count=100${n}${p}`,this._amountsAsStrings);if(B===200){const w=y.data.map(this.toUTxO),b=[...l,...w],P=y.next_cursor;return P==null?b:i(P,b)}throw S(y)};try{return await i()}catch{return[]}}async fetchAssetAddresses(e){const{policyId:t,assetName:r}=Tt(e),n=async(i=null,c=[])=>{const l=i===null?"":`&cursor=${i}`,{data:p,status:y}=await this._axiosInstance.get(`assets/${t}${r}/addresses?count=100${l}`,this._amountsAsStrings);if(y===200){const v=p.data.map(P=>({address:P.address,quantity:P.amount})),w=p.next_cursor,b=[...c,...v];return w==null?b:n(w,b)}throw S(p)};try{return await n()}catch{return[]}}async fetchAssetMetadata(e){try{const{policyId:t,assetName:r}=Tt(e),{data:n,status:i}=await this._axiosInstance.get(`assets/${t}${r}`);if(i===200){const c=n.data;return{...c.asset_standards.cip25_metadata,...c.asset_standards.cip68_metadata}}throw S(n)}catch(t){throw S(t)}}async fetchBlockInfo(e){var t;try{const{data:r,status:n}=await this._axiosInstance.get(`blocks/${e}`,this._amountsAsStrings);if(n===200){const i=r.data;return{confirmations:i.confirmations,epoch:i.epoch,epochSlot:i.epoch_slot.toString(),fees:i.total_fees,hash:i.hash,nextBlock:i.next_block??"",operationalCertificate:(t=i.operational_certificate)==null?void 0:t.hot_vkey,output:i.total_output_lovelace??"0",previousBlock:i.previous_block,size:i.size,slot:i.absolute_slot.toString(),slotLeader:i.block_producer??"",time:Date.parse(i.timestamp)/1e3,txCount:i.tx_hashes.length,VRFKey:a.VRFVKey.from_hex(i.vrf_key).to_bech32("vrf_vk")}}throw S(r)}catch(r){throw S(r)}}async fetchCollectionAssets(e,t){try{const{data:r,status:n}=await this._axiosInstance.get(`policy/${e}/assets?count=100${t?`&cursor=${t}`:""}`);if(n===200)return{assets:r.data.map(c=>({unit:e+c.asset_name,quantity:c.total_supply})),next:r.next_cursor};throw S(r)}catch{return{assets:[],next:null}}}async fetchHandleAddress(e){try{const t=e.charAt(0)==="$"?e.substring(1):e,{data:r,status:n}=await this._axiosInstance.get(`ecosystem/adahandle/${t}`);if(n===200)return r.data;throw S(r)}catch(t){throw S(t)}}async fetchProtocolParameters(e=Number.NaN){if(!isNaN(e))throw new Error("Maestro only supports fetching Protocol parameters of the latest completed epoch.");const t=r=>{const n=r.indexOf("/");return parseInt(r.slice(0,n))/parseInt(r.slice(n+1))};try{const{data:r,status:n}=await this._axiosInstance.get("protocol-params");if(n===200){const i=r.data;try{const{data:c,status:l}=await this._axiosInstance.get("epochs/current");if(l===200){const p=c.data;return{coinsPerUTxOSize:i.coins_per_utxo_byte.toString(),collateralPercent:parseInt(i.collateral_percentage),decentralisation:0,epoch:parseInt(p.epoch_no),keyDeposit:i.stake_key_deposit.toString(),maxBlockExMem:i.max_execution_units_per_block.memory.toString(),maxBlockExSteps:i.max_execution_units_per_block.steps.toString(),maxBlockHeaderSize:parseInt(i.max_block_header_size),maxBlockSize:parseInt(i.max_block_body_size),maxCollateralInputs:parseInt(i.max_collateral_inputs),maxTxExMem:i.max_execution_units_per_transaction.memory.toString(),maxTxExSteps:i.max_execution_units_per_transaction.steps.toString(),maxTxSize:parseInt(i.max_tx_size),maxValSize:i.max_value_size.toString(),minFeeA:i.min_fee_coefficient,minFeeB:i.min_fee_constant,minPoolCost:i.min_pool_cost.toString(),poolDeposit:i.pool_deposit.toString(),priceMem:t(i.prices.memory),priceStep:t(i.prices.steps)}}throw S(c)}catch(c){throw S(c)}}throw S(r)}catch(r){throw S(r)}}async fetchTxInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`transactions/${e}`);if(r===200){const n=t.data;return{block:n.block_hash,deposit:n.deposit.toString(),fees:n.fee.toString(),hash:n.tx_hash,index:n.block_tx_index,invalidAfter:n.invalid_hereafter??"",invalidBefore:n.invalid_before??"",slot:n.block_absolute_slot.toString(),size:n.size-1}}throw S(t)}catch(t){throw S(t)}}async fetchUTxOs(e){try{const{data:t,status:r}=await this._axiosInstance.get(`transactions/${e}`,this._amountsAsStrings);if(r===200)return t.data.outputs.map(this.toUTxO);throw S(t)}catch(t){throw S(t)}}onTxConfirmed(e,t,r=100){let n=0;const i=setInterval(()=>{n>=r&&clearInterval(i),this.fetchTxInfo(e).then(c=>{this.fetchBlockInfo(c.block).then(l=>{(l==null?void 0:l.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{n+=1})}).catch(()=>{n+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/cbor"},{data:r,status:n}=await this._axiosInstance.post(this.submitUrl,G(e),{headers:t});if(n===202)return r;throw S(r)}catch(t){throw S(t)}}toUTxO=e=>{var t,r,n;return{input:{outputIndex:e.index,txHash:e.tx_hash},output:{address:e.address,amount:e.assets.map(i=>({unit:i.unit,quantity:i.amount})),dataHash:(t=e.datum)==null?void 0:t.hash,plutusData:(r=e.datum)==null?void 0:r.bytes,scriptRef:this.resolveScript(e),scriptHash:(n=e.reference_script)==null?void 0:n.hash}}};resolveScript=e=>{if(e.reference_script){const t=e.reference_script.type==="native"?e.reference_script.json:{code:e.reference_script.bytes,version:e.reference_script.type.replace("plutusv","V")};return Zt(t).to_hex()}else return}}class cn{_axiosInstance;constructor(e="http://localhost:8080/api/v1"){this._axiosInstance=Mt.default.create({baseURL:e})}async fetchAccountInfo(e){const t=e.startsWith("addr")?oe(e):e;try{const{data:r,status:n}=await this._axiosInstance.get(`accounts/${t}`);if(n===200)return{poolId:r.pool_id,active:r.active||r.active_epoch!==null,balance:r.controlled_amount,rewards:r.withdrawable_amount,withdrawals:r.withdrawals_sum};throw S(r)}catch(r){throw S(r)}}resolveScriptRef=async e=>{if(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}`);if(r===200){const n=t.type.startsWith("plutus")?{code:await this.fetchPlutusScriptCBOR(e),version:t.type.replace("plutus","")}:await this.fetchNativeScriptJSON(e);return Zt(n).to_hex()}throw S(t)}};toUTxO=async(e,t)=>({input:{outputIndex:e.output_index,txHash:t},output:{address:e.address,amount:e.amount.map(r=>({...r,quantity:r.quantity.toString()})),dataHash:e.data_hash??void 0,plutusData:e.inline_datum??void 0,scriptRef:await this.resolveScriptRef(e.reference_script_hash),scriptHash:e.reference_script_hash}});async fetchAddressUTxOs(e,t){const r=t!==void 0?`/${t}`:"",n=`addresses/${e}/utxos`+r,i=async(c=1,l=[])=>{const{data:p,status:y}=await this._axiosInstance.get(`${n}?page=${c}`);if(y===200)return p.length>0?i(c+1,[...l,...await Promise.all(p.map(B=>this.toUTxO(B,B.tx_hash)))]):l;throw S(p)};try{return await i()}catch{return[]}}async fetchAssetAddresses(e){const t=async(r=1,n=[])=>{const{policyId:i,assetName:c}=Tt(e),{data:l,status:p}=await this._axiosInstance.get(`assets/${i}${c}/addresses?page=${r}`);if(p===200)return l.length>0?t(r+1,[...n,...l]):n;throw S(l)};try{return await t()}catch{return[]}}async fetchAssetMetadata(e){try{const{policyId:t,assetName:r}=Tt(e),{data:n,status:i}=await this._axiosInstance.get(`assets/${t}${r}`);if(i===200)return{...n.onchain_metadata};throw S(n)}catch(t){throw S(t)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`blocks/${e}`);if(r===200)return{confirmations:t.confirmations,epoch:t.epoch,epochSlot:t.epoch_slot.toString(),fees:t.fees,hash:t.hash,nextBlock:t.next_block??"",operationalCertificate:t.op_cert,output:t.output??"0",previousBlock:t.previous_block,size:t.size,slot:t.slot.toString(),slotLeader:t.slot_leader??"",time:t.time,txCount:t.tx_count,VRFKey:t.block_vrf};throw S(t)}catch(t){throw S(t)}}async fetchCollectionAssets(e,t=1){try{const{data:r,status:n}=await this._axiosInstance.get(`assets/policy/${e}?page=${t}`);if(n===200)return{assets:r.map(i=>({unit:i.asset,quantity:i.quantity})),next:r.length===100?t+1:null};throw S(r)}catch{return{assets:[],next:null}}}async fetchHandleAddress(e){try{const t=ft(e.replace("$","")),{data:r,status:n}=await this._axiosInstance.get(`assets/${Ke[1]}${t}/addresses`);if(n===200)return r[0].address;throw S(r)}catch(t){throw S(t)}}async fetchProtocolParameters(e=Number.NaN){try{const{data:t,status:r}=await this._axiosInstance.get(`epochs/${isNaN(e)?"latest":e}/parameters`);if(r===200)return{coinsPerUTxOSize:t.coins_per_utxo_word,collateralPercent:t.collateral_percent,decentralisation:t.decentralisation_param,epoch:t.epoch,keyDeposit:t.key_deposit,maxBlockExMem:t.max_block_ex_mem,maxBlockExSteps:t.max_block_ex_steps,maxBlockHeaderSize:t.max_block_header_size,maxBlockSize:t.max_block_size,maxCollateralInputs:t.max_collateral_inputs,maxTxExMem:t.max_tx_ex_mem,maxTxExSteps:t.max_tx_ex_steps,maxTxSize:t.max_tx_size,maxValSize:t.max_val_size,minFeeA:t.min_fee_a,minFeeB:t.min_fee_b,minPoolCost:t.min_pool_cost,poolDeposit:t.pool_deposit,priceMem:t.price_mem,priceStep:t.price_step};throw S(t)}catch(t){throw S(t)}}async fetchTxInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`txs/${e}`);if(r===200)return{block:t.block,deposit:t.deposit,fees:t.fees,hash:t.hash,index:t.index,invalidAfter:t.invalid_hereafter??"",invalidBefore:t.invalid_before??"",slot:t.slot.toString(),size:t.size};throw S(t)}catch(t){throw S(t)}}async fetchUTxOs(e){try{const{data:t,status:r}=await this._axiosInstance.get(`txs/${e}/utxos`);if(r===200){const n=t.outputs,i=[];return n.forEach(l=>{i.push(this.toUTxO(l,e))}),await Promise.all(i)}throw S(t)}catch(t){throw S(t)}}onTxConfirmed(e,t,r=100){let n=0;const i=setInterval(()=>{n>=r&&clearInterval(i),this.fetchTxInfo(e).then(c=>{this.fetchBlockInfo(c.block).then(l=>{(l==null?void 0:l.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{n+=1})}).catch(()=>{n+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"text/plain"},{status:r,data:n}=await this._axiosInstance.post("/tx/submit",e,{headers:t});if(r===202)return n;throw S(n)}catch(t){throw console.log("error",t),S(t)}}async fetchPlutusScriptCBOR(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}/cbor`);if(r===200)return t.cbor;throw S(t)}async fetchNativeScriptJSON(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}/json`);if(r===200)return t.json;throw S(t)}}class un{static withOneSignature(e){const t=Bt(qt(e));return he(t).to_hex()}static withAtLeastNSignatures(e,t){const r=a.NativeScripts.new();e.forEach(i=>{const c=Bt(qt(i));r.add(he(c))});const n=a.ScriptNOfK.new(t,r);return a.NativeScript.new_script_any(n).to_hex()}static withAnySignature(e){const t=a.NativeScripts.new();e.forEach(n=>{const i=Bt(qt(n));t.add(he(i))});const r=a.ScriptAny.new(t);return a.NativeScript.new_script_any(r).to_hex()}static withAllSignatures(e){const t=a.NativeScripts.new();e.forEach(n=>{const i=Bt(qt(n));t.add(he(i))});const r=a.ScriptAll.new(t);return a.NativeScript.new_script_any(r).to_hex()}static fromNativeScript(e){return Vt(e).to_hex()}}function Kt(s,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var l=s.length-1;l>=0;l--)(c=s[l])&&(i=(n<3?c(i):n>3?c(e,t,i):c(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i}const ln=s=>class extends s{__visits=[]},Lt=()=>function(s,e,t){const r=t.value;t.value=function(...n){const i=r.call(this,...n);return this.__visits&&this.__visits.push(e),i}};exports.Transaction=class{_changeAddress;_txOutputs=new Map;_recipients=new Map;_totalBurns=new Map;_totalMints=new Map;_era;_initiator;_mintBuilder;_protocolParameters;_txBuilder;_txCertificates;_txInputsBuilder;_txWithdrawals;constructor(e={}){this._era=e.era,this._initiator=e.initiator,this._mintBuilder=a.MintBuilder.new(),this._protocolParameters=e.parameters??It,this._txBuilder=pe(e.parameters),this._txCertificates=a.Certificates.new(),this._txInputsBuilder=a.TxInputsBuilder.new(),this._txWithdrawals=a.Withdrawals.new()}static attachMetadata(e,t,r="BABBAGE"){var c;const n=At(e),i=n.auxiliary_data()??a.AuxiliaryData.new();if(i.set_metadata(a.GeneralTransactionMetadata.from_hex(t)),i.set_prefer_alonzo_format(r==="ALONZO"),a.hash_auxiliary_data(i).to_hex()!==((c=n.body().auxiliary_data_hash())==null?void 0:c.to_hex()))throw new Error("[Transaction] attachMetadata: The metadata hash does not match the auxiliary data hash.");return a.Transaction.new(n.body(),n.witness_set(),i).to_hex()}static deattachMetadata(e){const t=At(e);return a.Transaction.new(t.body(),t.witness_set(),void 0).to_hex()}static maskMetadata(e,t="BABBAGE"){var i;const r=At(e),n=(i=r.auxiliary_data())==null?void 0:i.metadata();if(n!==void 0){const c=a.GeneralTransactionMetadata.new();for(let p=0;p<n.len();p+=1){const y=n.keys().get(p),B=n.get(y);c.insert(y,a.TransactionMetadatum.from_hex("0".repeat(((B==null?void 0:B.to_hex())??"").length)))}const l=r.auxiliary_data();return l!==void 0&&(l.set_metadata(c),l.set_prefer_alonzo_format(t==="ALONZO")),a.Transaction.new(r.body(),r.witness_set(),l).to_hex()}return e}static readMetadata(e){var r,n;return((n=(r=At(e).auxiliary_data())==null?void 0:r.metadata())==null?void 0:n.to_hex())??""}static writeMetadata(e,t,r="BABBAGE"){const n=At(e),i=n.auxiliary_data()??a.AuxiliaryData.new();return i.set_metadata(a.GeneralTransactionMetadata.from_hex(t)),i.set_prefer_alonzo_format(r==="ALONZO"),a.Transaction.new(n.body(),n.witness_set(),i).to_hex()}get size(){return this._txBuilder.full_size()}async build(){try{return(this._mintBuilder.has_plutus_scripts()||this.notVisited("redeemValue")===!1)&&(await this.addRequiredSignersIfNeeded(),await this.addCollateralIfNeeded()),await this.forgeAssetsIfNeeded(),await this.addTxInputsAsNeeded(),await this.addChangeAddress(),this._txBuilder.build_tx().to_hex()}catch(e){throw new Error(`[Transaction] An error occurred during build: ${e}.`)}}burnAsset(e,t,r){const n=this._totalBurns.has(t.unit)?a.BigNum.from_str(this._totalBurns.get(t.unit)??"0").checked_add(a.BigNum.from_str(t.quantity)).to_str():t.quantity;return this._mintBuilder.add_asset(Ar(e,r),a.AssetName.new(G(t.unit.slice(dt))),a.Int.new_negative(a.BigNum.from_str(t.quantity))),this._totalBurns.set(t.unit,n),this}delegateStake(e,t){const r=a.Certificate.new_stake_delegation(a.StakeDelegation.new(a.StakeCredential.from_keyhash(Bt($t(e))),a.Ed25519KeyHash.from_bech32(t)));return this._txCertificates.add(r),this}deregisterStake(e){const t=a.Certificate.new_stake_deregistration(a.StakeDeregistration.new(a.StakeCredential.from_keyhash(Bt($t(e)))));return this._txCertificates.add(t),this}mintAsset(e,t,r){var y,B;const n=(v,w)=>{const b=typeof v=="string"?qe(v).hash().to_hex():i(v).hash().to_hex(),P=ft(w.assetName);return{unit:`${b}${P}`,quantity:w.assetQuantity}},i=v=>{if("code"in v)return Xt(v.code,v.version);const w=pt(v);if(w.output().has_script_ref()){const b=w.output().script_ref();if(b.is_plutus_script()){const P=Mr(b);return Xt(P.code,P.version)}}throw new Error(`[Transaction] No plutus script reference found in UTxO: ${w.input().transaction_id().to_hex()}`)},c=n(e,t),p=a.BigNum.from_str(((y=this._totalMints.get(c.unit))==null?void 0:y.assetQuantity)??"0").checked_add(a.BigNum.from_str(c.quantity));return this._mintBuilder.add_asset(Ar(e,r),a.AssetName.new(G(ft(t.assetName))),a.Int.new(a.BigNum.from_str(c.quantity))),this._recipients.has(t.recipient)?(B=this._recipients.get(t.recipient))==null||B.push(c):this._recipients.set(t.recipient,[c]),this._totalMints.set(c.unit,{...t,assetQuantity:p.to_str()}),this}redeemValue(e){const t={tag:"SPEND",budget:Yt,index:this._txInputsBuilder.inputs().len(),data:{alternative:0,fields:[]},...e.redeemer},r=pt(e.value),n=e.datum?a.PlutusWitness.new_with_ref(Oe(e.script),Rs(e.datum),Ne(t)):a.PlutusWitness.new_with_ref_without_datum(Oe(e.script),Ne(t));return this._txInputsBuilder.add_plutus_script_input(n,r.input(),r.output().amount()),this}registerStake(e){const t=a.Certificate.new_stake_registration(a.StakeRegistration.new(a.StakeCredential.from_keyhash(Bt($t(e)))));return this._txCertificates.add(t),this}registerPool(e){const t=a.Certificate.new_pool_registration(a.PoolRegistration.new(Fs(e)));return this._txCertificates.add(t),this}retirePool(e,t){const r=a.Certificate.new_pool_retirement(a.PoolRetirement.new(a.Ed25519KeyHash.from_bech32(e),t));return this._txCertificates.add(r),this}sendAssets(e,t){const r=St(t),n=r.multiasset();if(r.is_zero()||n===void 0)return this;const i=de(e).next(),c=r.coin().is_zero()?i.with_asset_and_min_required_coin_by_utxo_cost(n,Pe(this._protocolParameters.coinsPerUTxOSize)).build():i.with_coin_and_asset(r.coin(),n).build();return t.forEach(l=>{this.setTxOutput(l)}),this._txBuilder.add_output(c),this}sendLovelace(e,t){const n=de(e).next().with_coin(a.BigNum.from_str(t)).build();return this.setTxOutput({unit:"lovelace",quantity:t}),this._txBuilder.add_output(n),this}sendToken(e,t,r){return this.sendAssets(e,[{quantity:r,unit:Zr[t]}]),this}sendValue(e,t){const r=St(t.output.amount),i=de(e).next().with_value(r).build();return t.output.amount.forEach(c=>{this.setTxOutput(c)}),this._txBuilder.add_output(i),this}setChangeAddress(e){return this._changeAddress=xt(e),this}setCollateral(e){const t=Ir(e);return this._txBuilder.set_collateral(t),this}setMetadata(e,t){return this._txBuilder.add_json_metadatum_with_schema(a.BigNum.from_str(e.toString()),JSON.stringify(t),a.MetadataJsonSchema.NoConversions),this}setRequiredSigners(e){return Array.from(new Set(e.map(r=>r.startsWith("addr")?qt(r):$t(r)).map(r=>Bt(r)))).forEach(r=>{this._txBuilder.add_required_signer(r)}),this}setNativeScriptInput(e,t){const r=pt(t);return this._txBuilder.add_native_script_input(Vt(e),r.input(),r.output().amount()),this}setTimeToStart(e){return this._txBuilder.set_validity_start_interval_bignum(a.BigNum.from_str(e)),this}setTimeToExpire(e){return this._txBuilder.set_ttl_bignum(a.BigNum.from_str(e)),this}setTxInputs(e){return e.map(t=>pt(t)).forEach(t=>{this._txInputsBuilder.add_input(t.output().address(),t.input(),t.output().amount())}),this}setTxRefInputs(e){return e.map(t=>pt(t)).forEach(t=>{this._txBuilder.add_reference_input(t.input())}),this}withdrawRewards(e,t){const r=Ur(e);return r!==void 0&&this._txWithdrawals.insert(r,a.BigNum.from_str(t)),this}async addBurnInputsIfNeeded(){if(this._initiator&&this._totalBurns.size>0&&this.notVisited("setTxInputs")){const e=await this._initiator.getUsedUTxOs();wr(this._totalBurns,e.map(r=>ae(r))).map(r=>pt(r)).forEach(r=>{this._txInputsBuilder.add_input(r.output().address(),r.input(),r.output().amount())})}}async addChangeAddress(){if(this._initiator&&this._changeAddress===void 0){const e=await this._initiator.getUsedAddress();this._txBuilder.add_change_if_needed(e)}else this._changeAddress!==void 0&&this._txBuilder.add_change_if_needed(this._changeAddress)}async addCollateralIfNeeded(){if(this._initiator&&this.notVisited("setCollateral")){const e=await this._initiator.getUsedCollateral();this._txBuilder.set_collateral(Ir(e))}}async addRequiredSignersIfNeeded(){if(this._initiator&&this.notVisited("setRequiredSigners")){const e=await this._initiator.getUsedAddress(),t=qt(e.to_bech32());this._txBuilder.add_required_signer(Bt(t))}}async addTxInputsAsNeeded(){if(this.notVisited("setTxInputs")){const e=await this.filterAvailableUTxOs();xr(this._txOutputs,e.map(r=>ae(r))).map(r=>pt(r)).forEach(r=>{this._txInputsBuilder.add_input(r.output().address(),r.input(),r.output().amount())})}if(this._txBuilder.set_inputs(this._txInputsBuilder),(this._mintBuilder.has_native_scripts()||this._mintBuilder.has_plutus_scripts())&&this._txBuilder.set_mint_builder(this._mintBuilder),this._txCertificates.len()>0&&this._txBuilder.set_certs(this._txCertificates),this._txWithdrawals.len()>0&&this._txBuilder.set_withdrawals(this._txWithdrawals),this._txBuilder.get_mint_builder()||this.notVisited("redeemValue")===!1){const e=this._era!==void 0?Je[this._era]:Je.BABBAGE;this._txBuilder.calc_script_data_hash(e)}}async forgeAssetsIfNeeded(){const e=(t,r)=>{const n=t.data.assetName,i=t.data.metadata,c=t.unit.slice(0,dt);if(t.data.label==="777")return i;if(r&&r[c]){const{[c]:l,...p}=r,y={[n]:i,...l};return{[c]:{...y},...p}}return r!==void 0?{[c]:{[n]:i},...r}:{[c]:{[n]:i}}};await this.addBurnInputsIfNeeded(),Array.from(this._totalMints,t=>({unit:t[0],data:t[1]})).reduce((t,r)=>t.set(r.data.label,e(r,t.get(r.data.label))),new Map).forEach((t,r)=>{this._txBuilder.add_json_metadatum(a.BigNum.from_str(r),JSON.stringify(t))}),this.addMintOutputs()}async filterAvailableUTxOs(e=[]){return this._initiator===void 0?[]:(await this._initiator.getUsedUTxOs()).filter(r=>e.find(n=>n.input.txHash===r.input().transaction_id().to_hex())===void 0)}addMintOutputs(){this._recipients.forEach((e,t)=>{const n=St(e).multiasset();if(n!==void 0){const c=de(t).next().with_asset_and_min_required_coin_by_utxo_cost(n,Pe(this._protocolParameters.coinsPerUTxOSize)).build();this._txBuilder.add_output(c)}})}notVisited(e){return this.__visits.includes(e)===!1}setTxOutput(e){const r=a.BigNum.from_str(this._txOutputs.get(e.unit)??"0").checked_add(a.BigNum.from_str(e.quantity)).to_str();this._txOutputs.set(e.unit,r)}};Kt([Lt()],exports.Transaction.prototype,"mintAsset",null);Kt([Lt()],exports.Transaction.prototype,"redeemValue",null);Kt([Lt()],exports.Transaction.prototype,"sendAssets",null);Kt([Lt()],exports.Transaction.prototype,"sendValue",null);Kt([Lt()],exports.Transaction.prototype,"setCollateral",null);Kt([Lt()],exports.Transaction.prototype,"setRequiredSigners",null);Kt([Lt()],exports.Transaction.prototype,"setTxInputs",null);exports.Transaction=Kt([ln],exports.Transaction);const hn=(s,e,t)=>{const r=new Map(e);r.set("lovelace",String(Number(r.get("lovelace"))+Number(t)));const n=new Map;for(let w=0;w<s.length;w++)n.set(w,s[w]);const i=new Set,c=new Set,l=new Set,p=new Set,y=new Set;for(let w=0;w<s.length;w++)switch(s[w].output.amount.length){case 1:{c.add(w);break}case 2:{l.add(w);break}case 3:{p.add(w);break}default:{y.add(w);break}}const B=(w,b,P)=>{const T=n.get(w);if(!T)return;const N=dn(T,b);if(Number(N)>0){i.add(w),P.delete(w);for(const k of T.output.amount)r.set(k.unit,String(Number(r.get(k.unit))-Number(k.quantity)))}};for(const w of r.keys())if(w!="lovelace"){for(const b of l){const P=r.get(w);if(!P||Number(P)<=0)break;B(b,w,l)}for(const b of p){const P=r.get(w);if(!P||Number(P)<=0)break;B(b,w,p)}for(const b of y){const P=r.get(w);if(!P||Number(P)<=0)break;B(b,w,y)}}for(const w of c){const b=r.get("lovelace");if(!b||Number(b)<=0)break;B(w,"lovelace",c)}for(const w of l){const b=r.get("lovelace");if(!b||Number(b)<=0)break;B(w,"lovelace",l)}for(const w of p){const b=r.get("lovelace");if(!b||Number(b)<=0)break;B(w,"lovelace",p)}for(const w of y){const b=r.get("lovelace");if(!b||Number(b)<=0)break;B(w,"lovelace",y)}for(const w of r.keys())if(Number(r.get(w))>0)return[];const v=[];for(const w of i){const b=n.get(w);b&&v.push(b)}return v},dn=(s,e)=>{for(const t of s.output.amount)if(t.unit==e)return t.quantity;return"0"};var Wt={exports:{}},Rr={exports:{}},ze={exports:{}};(function(s){(function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,c="[BigNumber Error] ",l=c+"Number primitive has more than 15 significant digits: ",p=1e14,y=14,B=9007199254740991,v=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],w=1e7,b=1e9;function P(O){var M,W,Z,D=E.prototype={constructor:E,toString:null,valueOf:null},F=new E(1),q=20,j=4,nt=-7,ut=21,Ht=-1e7,yt=1e7,Ft=!1,te=1,kt=0,we={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},Rt="0123456789abcdefghijklmnopqrstuvwxyz",Ce=!0;function E(o,u){var h,I,f,m,x,d,g,_,A=this;if(!(A instanceof E))return new E(o,u);if(u==null){if(o&&o._isBigNumber===!0){A.s=o.s,!o.c||o.e>yt?A.c=A.e=null:o.e<Ht?A.c=[A.e=0]:(A.e=o.e,A.c=o.c.slice());return}if((d=typeof o=="number")&&o*0==0){if(A.s=1/o<0?(o=-o,-1):1,o===~~o){for(m=0,x=o;x>=10;x/=10,m++);m>yt?A.c=A.e=null:(A.e=m,A.c=[o]);return}_=String(o)}else{if(!r.test(_=String(o)))return Z(A,_,d);A.s=_.charCodeAt(0)==45?(_=_.slice(1),-1):1}(m=_.indexOf("."))>-1&&(_=_.replace(".","")),(x=_.search(/e/i))>0?(m<0&&(m=x),m+=+_.slice(x+1),_=_.substring(0,x)):m<0&&(m=_.length)}else{if(Q(u,2,Rt.length,"Base"),u==10&&Ce)return A=new E(o),gt(A,q+A.e+1,j);if(_=String(o),d=typeof o=="number"){if(o*0!=0)return Z(A,_,d,u);if(A.s=1/o<0?(_=_.slice(1),-1):1,E.DEBUG&&_.replace(/^0\.0*|\./,"").length>15)throw Error(l+o)}else A.s=_.charCodeAt(0)===45?(_=_.slice(1),-1):1;for(h=Rt.slice(0,u),m=x=0,g=_.length;x<g;x++)if(h.indexOf(I=_.charAt(x))<0){if(I=="."){if(x>m){m=g;continue}}else if(!f&&(_==_.toUpperCase()&&(_=_.toLowerCase())||_==_.toLowerCase()&&(_=_.toUpperCase()))){f=!0,x=-1,m=0;continue}return Z(A,String(o),d,u)}d=!1,_=W(_,u,10,A.s),(m=_.indexOf("."))>-1?_=_.replace(".",""):m=_.length}for(x=0;_.charCodeAt(x)===48;x++);for(g=_.length;_.charCodeAt(--g)===48;);if(_=_.slice(x,++g)){if(g-=x,d&&E.DEBUG&&g>15&&(o>B||o!==i(o)))throw Error(l+A.s*o);if((m=m-x-1)>yt)A.c=A.e=null;else if(m<Ht)A.c=[A.e=0];else{if(A.e=m,A.c=[],x=(m+1)%y,m<0&&(x+=y),x<g){for(x&&A.c.push(+_.slice(0,x)),g-=y;x<g;)A.c.push(+_.slice(x,x+=y));x=y-(_=_.slice(x)).length}else x-=g;for(;x--;_+="0");A.c.push(+_)}}else A.c=[A.e=0]}E.clone=P,E.ROUND_UP=0,E.ROUND_DOWN=1,E.ROUND_CEIL=2,E.ROUND_FLOOR=3,E.ROUND_HALF_UP=4,E.ROUND_HALF_DOWN=5,E.ROUND_HALF_EVEN=6,E.ROUND_HALF_CEIL=7,E.ROUND_HALF_FLOOR=8,E.EUCLID=9,E.config=E.set=function(o){var u,h;if(o!=null)if(typeof o=="object"){if(o.hasOwnProperty(u="DECIMAL_PLACES")&&(h=o[u],Q(h,0,b,u),q=h),o.hasOwnProperty(u="ROUNDING_MODE")&&(h=o[u],Q(h,0,8,u),j=h),o.hasOwnProperty(u="EXPONENTIAL_AT")&&(h=o[u],h&&h.pop?(Q(h[0],-b,0,u),Q(h[1],0,b,u),nt=h[0],ut=h[1]):(Q(h,-b,b,u),nt=-(ut=h<0?-h:h))),o.hasOwnProperty(u="RANGE"))if(h=o[u],h&&h.pop)Q(h[0],-b,-1,u),Q(h[1],1,b,u),Ht=h[0],yt=h[1];else if(Q(h,-b,b,u),h)Ht=-(yt=h<0?-h:h);else throw Error(c+u+" cannot be zero: "+h);if(o.hasOwnProperty(u="CRYPTO"))if(h=o[u],h===!!h)if(h)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))Ft=h;else throw Ft=!h,Error(c+"crypto unavailable");else Ft=h;else throw Error(c+u+" not true or false: "+h);if(o.hasOwnProperty(u="MODULO_MODE")&&(h=o[u],Q(h,0,9,u),te=h),o.hasOwnProperty(u="POW_PRECISION")&&(h=o[u],Q(h,0,b,u),kt=h),o.hasOwnProperty(u="FORMAT"))if(h=o[u],typeof h=="object")we=h;else throw Error(c+u+" not an object: "+h);if(o.hasOwnProperty(u="ALPHABET"))if(h=o[u],typeof h=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(h))Ce=h.slice(0,10)=="0123456789",Rt=h;else throw Error(c+u+" invalid: "+h)}else throw Error(c+"Object expected: "+o);return{DECIMAL_PLACES:q,ROUNDING_MODE:j,EXPONENTIAL_AT:[nt,ut],RANGE:[Ht,yt],CRYPTO:Ft,MODULO_MODE:te,POW_PRECISION:kt,FORMAT:we,ALPHABET:Rt}},E.isBigNumber=function(o){if(!o||o._isBigNumber!==!0)return!1;if(!E.DEBUG)return!0;var u,h,I=o.c,f=o.e,m=o.s;t:if({}.toString.call(I)=="[object Array]"){if((m===1||m===-1)&&f>=-b&&f<=b&&f===i(f)){if(I[0]===0){if(f===0&&I.length===1)return!0;break t}if(u=(f+1)%y,u<1&&(u+=y),String(I[0]).length==u){for(u=0;u<I.length;u++)if(h=I[u],h<0||h>=p||h!==i(h))break t;if(h!==0)return!0}}}else if(I===null&&f===null&&(m===null||m===1||m===-1))return!0;throw Error(c+"Invalid BigNumber: "+o)},E.maximum=E.max=function(){return We(arguments,-1)},E.minimum=E.min=function(){return We(arguments,1)},E.random=function(){var o=9007199254740992,u=Math.random()*o&2097151?function(){return i(Math.random()*o)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(h){var I,f,m,x,d,g=0,_=[],A=new E(F);if(h==null?h=q:Q(h,0,b),x=n(h/y),Ft)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(x*=2));g<x;)d=I[g]*131072+(I[g+1]>>>11),d>=9e15?(f=crypto.getRandomValues(new Uint32Array(2)),I[g]=f[0],I[g+1]=f[1]):(_.push(d%1e14),g+=2);g=x/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(x*=7);g<x;)d=(I[g]&31)*281474976710656+I[g+1]*1099511627776+I[g+2]*4294967296+I[g+3]*16777216+(I[g+4]<<16)+(I[g+5]<<8)+I[g+6],d>=9e15?crypto.randomBytes(7).copy(I,g):(_.push(d%1e14),g+=7);g=x/7}else throw Ft=!1,Error(c+"crypto unavailable");if(!Ft)for(;g<x;)d=u(),d<9e15&&(_[g++]=d%1e14);for(x=_[--g],h%=y,x&&h&&(d=v[y-h],_[g]=i(x/d)*d);_[g]===0;_.pop(),g--);if(g<0)_=[m=0];else{for(m=-1;_[0]===0;_.splice(0,1),m-=y);for(g=1,d=_[0];d>=10;d/=10,g++);g<y&&(m-=y-g)}return A.e=m,A.c=_,A}}(),E.sum=function(){for(var o=1,u=arguments,h=new E(u[0]);o<u.length;)h=h.plus(u[o++]);return h},W=function(){var o="0123456789";function u(h,I,f,m){for(var x,d=[0],g,_=0,A=h.length;_<A;){for(g=d.length;g--;d[g]*=I);for(d[0]+=m.indexOf(h.charAt(_++)),x=0;x<d.length;x++)d[x]>f-1&&(d[x+1]==null&&(d[x+1]=0),d[x+1]+=d[x]/f|0,d[x]%=f)}return d.reverse()}return function(h,I,f,m,x){var d,g,_,A,C,U,K,L,tt=h.indexOf("."),st=q,V=j;for(tt>=0&&(A=kt,kt=0,h=h.replace(".",""),L=new E(I),U=L.pow(h.length-tt),kt=A,L.c=u($(N(U.c),U.e,"0"),10,f,o),L.e=L.c.length),K=u(h,I,f,x?(d=Rt,o):(d=o,Rt)),_=A=K.length;K[--A]==0;K.pop());if(!K[0])return d.charAt(0);if(tt<0?--_:(U.c=K,U.e=_,U.s=m,U=M(U,L,st,V,f),K=U.c,C=U.r,_=U.e),g=_+st+1,tt=K[g],A=f/2,C=C||g<0||K[g+1]!=null,C=V<4?(tt!=null||C)&&(V==0||V==(U.s<0?3:2)):tt>A||tt==A&&(V==4||C||V==6&&K[g-1]&1||V==(U.s<0?8:7)),g<1||!K[0])h=C?$(d.charAt(1),-st,d.charAt(0)):d.charAt(0);else{if(K.length=g,C)for(--f;++K[--g]>f;)K[g]=0,g||(++_,K=[1].concat(K));for(A=K.length;!K[--A];);for(tt=0,h="";tt<=A;h+=d.charAt(K[tt++]));h=$(h,_,d.charAt(0))}return h}}(),M=function(){function o(I,f,m){var x,d,g,_,A=0,C=I.length,U=f%w,K=f/w|0;for(I=I.slice();C--;)g=I[C]%w,_=I[C]/w|0,x=K*g+_*U,d=U*g+x%w*w+A,A=(d/m|0)+(x/w|0)+K*_,I[C]=d%m;return A&&(I=[A].concat(I)),I}function u(I,f,m,x){var d,g;if(m!=x)g=m>x?1:-1;else for(d=g=0;d<m;d++)if(I[d]!=f[d]){g=I[d]>f[d]?1:-1;break}return g}function h(I,f,m,x){for(var d=0;m--;)I[m]-=d,d=I[m]<f[m]?1:0,I[m]=d*x+I[m]-f[m];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,f,m,x,d){var g,_,A,C,U,K,L,tt,st,V,z,it,ce,Ee,ve,wt,ee,mt=I.s==f.s?1:-1,ot=I.c,et=f.c;if(!ot||!ot[0]||!et||!et[0])return new E(!I.s||!f.s||(ot?et&&ot[0]==et[0]:!et)?NaN:ot&&ot[0]==0||!et?mt*0:mt/0);for(tt=new E(mt),st=tt.c=[],_=I.e-f.e,mt=m+_+1,d||(d=p,_=T(I.e/y)-T(f.e/y),mt=mt/y|0),A=0;et[A]==(ot[A]||0);A++);if(et[A]>(ot[A]||0)&&_--,mt<0)st.push(1),C=!0;else{for(Ee=ot.length,wt=et.length,A=0,mt+=2,U=i(d/(et[0]+1)),U>1&&(et=o(et,U,d),ot=o(ot,U,d),wt=et.length,Ee=ot.length),ce=wt,V=ot.slice(0,wt),z=V.length;z<wt;V[z++]=0);ee=et.slice(),ee=[0].concat(ee),ve=et[0],et[1]>=d/2&&ve++;do{if(U=0,g=u(et,V,wt,z),g<0){if(it=V[0],wt!=z&&(it=it*d+(V[1]||0)),U=i(it/ve),U>1)for(U>=d&&(U=d-1),K=o(et,U,d),L=K.length,z=V.length;u(K,V,L,z)==1;)U--,h(K,wt<L?ee:et,L,d),L=K.length,g=1;else U==0&&(g=U=1),K=et.slice(),L=K.length;if(L<z&&(K=[0].concat(K)),h(V,K,z,d),z=V.length,g==-1)for(;u(et,V,wt,z)<1;)U++,h(V,wt<z?ee:et,z,d),z=V.length}else g===0&&(U++,V=[0]);st[A++]=U,V[0]?V[z++]=ot[ce]||0:(V=[ot[ce]],z=1)}while((ce++<Ee||V[0]!=null)&&mt--);C=V[0]!=null,st[0]||st.splice(0,1)}if(d==p){for(A=1,mt=st[0];mt>=10;mt/=10,A++);gt(tt,m+(tt.e=A+_*y-1)+1,x,C)}else tt.e=_,tt.r=+C;return tt}}();function Be(o,u,h,I){var f,m,x,d,g;if(h==null?h=j:Q(h,0,8),!o.c)return o.toString();if(f=o.c[0],x=o.e,u==null)g=N(o.c),g=I==1||I==2&&(x<=nt||x>=ut)?X(g,x):$(g,x,"0");else if(o=gt(new E(o),u,h),m=o.e,g=N(o.c),d=g.length,I==1||I==2&&(u<=m||m<=nt)){for(;d<u;g+="0",d++);g=X(g,m)}else if(u-=x,g=$(g,m,"0"),m+1>d){if(--u>0)for(g+=".";u--;g+="0");}else if(u+=m-d,u>0)for(m+1==d&&(g+=".");u--;g+="0");return o.s<0&&f?"-"+g:g}function We(o,u){for(var h,I,f=1,m=new E(o[0]);f<o.length;f++)I=new E(o[f]),(!I.s||(h=k(m,I))===u||h===0&&m.s===u)&&(m=I);return m}function Se(o,u,h){for(var I=1,f=u.length;!u[--f];u.pop());for(f=u[0];f>=10;f/=10,I++);return(h=I+h*y-1)>yt?o.c=o.e=null:h<Ht?o.c=[o.e=0]:(o.e=h,o.c=u),o}Z=function(){var o=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,h=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(m,x,d,g){var _,A=d?x:x.replace(f,"");if(I.test(A))m.s=isNaN(A)?null:A<0?-1:1;else{if(!d&&(A=A.replace(o,function(C,U,K){return _=(K=K.toLowerCase())=="x"?16:K=="b"?2:8,!g||g==_?U:C}),g&&(_=g,A=A.replace(u,"$1").replace(h,"0.$1")),x!=A))return new E(A,_);if(E.DEBUG)throw Error(c+"Not a"+(g?" base "+g:"")+" number: "+x);m.s=null}m.c=m.e=null}}();function gt(o,u,h,I){var f,m,x,d,g,_,A,C=o.c,U=v;if(C){t:{for(f=1,d=C[0];d>=10;d/=10,f++);if(m=u-f,m<0)m+=y,x=u,g=C[_=0],A=i(g/U[f-x-1]%10);else if(_=n((m+1)/y),_>=C.length)if(I){for(;C.length<=_;C.push(0));g=A=0,f=1,m%=y,x=m-y+1}else break t;else{for(g=d=C[_],f=1;d>=10;d/=10,f++);m%=y,x=m-y+f,A=x<0?0:i(g/U[f-x-1]%10)}if(I=I||u<0||C[_+1]!=null||(x<0?g:g%U[f-x-1]),I=h<4?(A||I)&&(h==0||h==(o.s<0?3:2)):A>5||A==5&&(h==4||I||h==6&&(m>0?x>0?g/U[f-x]:0:C[_-1])%10&1||h==(o.s<0?8:7)),u<1||!C[0])return C.length=0,I?(u-=o.e+1,C[0]=U[(y-u%y)%y],o.e=-u||0):C[0]=o.e=0,o;if(m==0?(C.length=_,d=1,_--):(C.length=_+1,d=U[y-m],C[_]=x>0?i(g/U[f-x]%U[x])*d:0),I)for(;;)if(_==0){for(m=1,x=C[0];x>=10;x/=10,m++);for(x=C[0]+=d,d=1;x>=10;x/=10,d++);m!=d&&(o.e++,C[0]==p&&(C[0]=1));break}else{if(C[_]+=d,C[_]!=p)break;C[_--]=0,d=1}for(m=C.length;C[--m]===0;C.pop());}o.e>yt?o.c=o.e=null:o.e<Ht&&(o.c=[o.e=0])}return o}function vt(o){var u,h=o.e;return h===null?o.toString():(u=N(o.c),u=h<=nt||h>=ut?X(u,h):$(u,h,"0"),o.s<0?"-"+u:u)}return D.absoluteValue=D.abs=function(){var o=new E(this);return o.s<0&&(o.s=1),o},D.comparedTo=function(o,u){return k(this,new E(o,u))},D.decimalPlaces=D.dp=function(o,u){var h,I,f,m=this;if(o!=null)return Q(o,0,b),u==null?u=j:Q(u,0,8),gt(new E(m),o+m.e+1,u);if(!(h=m.c))return null;if(I=((f=h.length-1)-T(this.e/y))*y,f=h[f])for(;f%10==0;f/=10,I--);return I<0&&(I=0),I},D.dividedBy=D.div=function(o,u){return M(this,new E(o,u),q,j)},D.dividedToIntegerBy=D.idiv=function(o,u){return M(this,new E(o,u),0,1)},D.exponentiatedBy=D.pow=function(o,u){var h,I,f,m,x,d,g,_,A,C=this;if(o=new E(o),o.c&&!o.isInteger())throw Error(c+"Exponent not an integer: "+vt(o));if(u!=null&&(u=new E(u)),d=o.e>14,!C.c||!C.c[0]||C.c[0]==1&&!C.e&&C.c.length==1||!o.c||!o.c[0])return A=new E(Math.pow(+vt(C),d?o.s*(2-R(o)):+vt(o))),u?A.mod(u):A;if(g=o.s<0,u){if(u.c?!u.c[0]:!u.s)return new E(NaN);I=!g&&C.isInteger()&&u.isInteger(),I&&(C=C.mod(u))}else{if(o.e>9&&(C.e>0||C.e<-1||(C.e==0?C.c[0]>1||d&&C.c[1]>=24e7:C.c[0]<8e13||d&&C.c[0]<=9999975e7)))return m=C.s<0&&R(o)?-0:0,C.e>-1&&(m=1/m),new E(g?1/m:m);kt&&(m=n(kt/y+2))}for(d?(h=new E(.5),g&&(o.s=1),_=R(o)):(f=Math.abs(+vt(o)),_=f%2),A=new E(F);;){if(_){if(A=A.times(C),!A.c)break;m?A.c.length>m&&(A.c.length=m):I&&(A=A.mod(u))}if(f){if(f=i(f/2),f===0)break;_=f%2}else if(o=o.times(h),gt(o,o.e+1,1),o.e>14)_=R(o);else{if(f=+vt(o),f===0)break;_=f%2}C=C.times(C),m?C.c&&C.c.length>m&&(C.c.length=m):I&&(C=C.mod(u))}return I?A:(g&&(A=F.div(A)),u?A.mod(u):m?gt(A,kt,j,x):A)},D.integerValue=function(o){var u=new E(this);return o==null?o=j:Q(o,0,8),gt(u,u.e+1,o)},D.isEqualTo=D.eq=function(o,u){return k(this,new E(o,u))===0},D.isFinite=function(){return!!this.c},D.isGreaterThan=D.gt=function(o,u){return k(this,new E(o,u))>0},D.isGreaterThanOrEqualTo=D.gte=function(o,u){return(u=k(this,new E(o,u)))===1||u===0},D.isInteger=function(){return!!this.c&&T(this.e/y)>this.c.length-2},D.isLessThan=D.lt=function(o,u){return k(this,new E(o,u))<0},D.isLessThanOrEqualTo=D.lte=function(o,u){return(u=k(this,new E(o,u)))===-1||u===0},D.isNaN=function(){return!this.s},D.isNegative=function(){return this.s<0},D.isPositive=function(){return this.s>0},D.isZero=function(){return!!this.c&&this.c[0]==0},D.minus=function(o,u){var h,I,f,m,x=this,d=x.s;if(o=new E(o,u),u=o.s,!d||!u)return new E(NaN);if(d!=u)return o.s=-u,x.plus(o);var g=x.e/y,_=o.e/y,A=x.c,C=o.c;if(!g||!_){if(!A||!C)return A?(o.s=-u,o):new E(C?x:NaN);if(!A[0]||!C[0])return C[0]?(o.s=-u,o):new E(A[0]?x:j==3?-0:0)}if(g=T(g),_=T(_),A=A.slice(),d=g-_){for((m=d<0)?(d=-d,f=A):(_=g,f=C),f.reverse(),u=d;u--;f.push(0));f.reverse()}else for(I=(m=(d=A.length)<(u=C.length))?d:u,d=u=0;u<I;u++)if(A[u]!=C[u]){m=A[u]<C[u];break}if(m&&(f=A,A=C,C=f,o.s=-o.s),u=(I=C.length)-(h=A.length),u>0)for(;u--;A[h++]=0);for(u=p-1;I>d;){if(A[--I]<C[I]){for(h=I;h&&!A[--h];A[h]=u);--A[h],A[I]+=p}A[I]-=C[I]}for(;A[0]==0;A.splice(0,1),--_);return A[0]?Se(o,A,_):(o.s=j==3?-1:1,o.c=[o.e=0],o)},D.modulo=D.mod=function(o,u){var h,I,f=this;return o=new E(o,u),!f.c||!o.s||o.c&&!o.c[0]?new E(NaN):!o.c||f.c&&!f.c[0]?new E(f):(te==9?(I=o.s,o.s=1,h=M(f,o,0,3),o.s=I,h.s*=I):h=M(f,o,0,te),o=f.minus(h.times(o)),!o.c[0]&&te==1&&(o.s=f.s),o)},D.multipliedBy=D.times=function(o,u){var h,I,f,m,x,d,g,_,A,C,U,K,L,tt,st,V=this,z=V.c,it=(o=new E(o,u)).c;if(!z||!it||!z[0]||!it[0])return!V.s||!o.s||z&&!z[0]&&!it||it&&!it[0]&&!z?o.c=o.e=o.s=null:(o.s*=V.s,!z||!it?o.c=o.e=null:(o.c=[0],o.e=0)),o;for(I=T(V.e/y)+T(o.e/y),o.s*=V.s,g=z.length,C=it.length,g<C&&(L=z,z=it,it=L,f=g,g=C,C=f),f=g+C,L=[];f--;L.push(0));for(tt=p,st=w,f=C;--f>=0;){for(h=0,U=it[f]%st,K=it[f]/st|0,x=g,m=f+x;m>f;)_=z[--x]%st,A=z[x]/st|0,d=K*_+A*U,_=U*_+d%st*st+L[m]+h,h=(_/tt|0)+(d/st|0)+K*A,L[m--]=_%tt;L[m]=h}return h?++I:L.splice(0,1),Se(o,L,I)},D.negated=function(){var o=new E(this);return o.s=-o.s||null,o},D.plus=function(o,u){var h,I=this,f=I.s;if(o=new E(o,u),u=o.s,!f||!u)return new E(NaN);if(f!=u)return o.s=-u,I.minus(o);var m=I.e/y,x=o.e/y,d=I.c,g=o.c;if(!m||!x){if(!d||!g)return new E(f/0);if(!d[0]||!g[0])return g[0]?o:new E(d[0]?I:f*0)}if(m=T(m),x=T(x),d=d.slice(),f=m-x){for(f>0?(x=m,h=g):(f=-f,h=d),h.reverse();f--;h.push(0));h.reverse()}for(f=d.length,u=g.length,f-u<0&&(h=g,g=d,d=h,u=f),f=0;u;)f=(d[--u]=d[u]+g[u]+f)/p|0,d[u]=p===d[u]?0:d[u]%p;return f&&(d=[f].concat(d),++x),Se(o,d,x)},D.precision=D.sd=function(o,u){var h,I,f,m=this;if(o!=null&&o!==!!o)return Q(o,1,b),u==null?u=j:Q(u,0,8),gt(new E(m),o,u);if(!(h=m.c))return null;if(f=h.length-1,I=f*y+1,f=h[f]){for(;f%10==0;f/=10,I--);for(f=h[0];f>=10;f/=10,I++);}return o&&m.e+1>I&&(I=m.e+1),I},D.shiftedBy=function(o){return Q(o,-B,B),this.times("1e"+o)},D.squareRoot=D.sqrt=function(){var o,u,h,I,f,m=this,x=m.c,d=m.s,g=m.e,_=q+4,A=new E("0.5");if(d!==1||!x||!x[0])return new E(!d||d<0&&(!x||x[0])?NaN:x?m:1/0);if(d=Math.sqrt(+vt(m)),d==0||d==1/0?(u=N(x),(u.length+g)%2==0&&(u+="0"),d=Math.sqrt(+u),g=T((g+1)/2)-(g<0||g%2),d==1/0?u="5e"+g:(u=d.toExponential(),u=u.slice(0,u.indexOf("e")+1)+g),h=new E(u)):h=new E(d+""),h.c[0]){for(g=h.e,d=g+_,d<3&&(d=0);;)if(f=h,h=A.times(f.plus(M(m,f,_,1))),N(f.c).slice(0,d)===(u=N(h.c)).slice(0,d))if(h.e<g&&--d,u=u.slice(d-3,d+1),u=="9999"||!I&&u=="4999"){if(!I&&(gt(f,f.e+q+2,0),f.times(f).eq(m))){h=f;break}_+=4,d+=4,I=1}else{(!+u||!+u.slice(1)&&u.charAt(0)=="5")&&(gt(h,h.e+q+2,1),o=!h.times(h).eq(m));break}}return gt(h,h.e+q+1,j,o)},D.toExponential=function(o,u){return o!=null&&(Q(o,0,b),o++),Be(this,o,u,1)},D.toFixed=function(o,u){return o!=null&&(Q(o,0,b),o=o+this.e+1),Be(this,o,u)},D.toFormat=function(o,u,h){var I,f=this;if(h==null)o!=null&&u&&typeof u=="object"?(h=u,u=null):o&&typeof o=="object"?(h=o,o=u=null):h=we;else if(typeof h!="object")throw Error(c+"Argument not an object: "+h);if(I=f.toFixed(o,u),f.c){var m,x=I.split("."),d=+h.groupSize,g=+h.secondaryGroupSize,_=h.groupSeparator||"",A=x[0],C=x[1],U=f.s<0,K=U?A.slice(1):A,L=K.length;if(g&&(m=d,d=g,g=m,L-=m),d>0&&L>0){for(m=L%d||d,A=K.substr(0,m);m<L;m+=d)A+=_+K.substr(m,d);g>0&&(A+=_+K.slice(m)),U&&(A="-"+A)}I=C?A+(h.decimalSeparator||"")+((g=+h.fractionGroupSize)?C.replace(new RegExp("\\d{"+g+"}\\B","g"),"$&"+(h.fractionGroupSeparator||"")):C):A}return(h.prefix||"")+I+(h.suffix||"")},D.toFraction=function(o){var u,h,I,f,m,x,d,g,_,A,C,U,K=this,L=K.c;if(o!=null&&(d=new E(o),!d.isInteger()&&(d.c||d.s!==1)||d.lt(F)))throw Error(c+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+vt(d));if(!L)return new E(K);for(u=new E(F),_=h=new E(F),I=g=new E(F),U=N(L),m=u.e=U.length-K.e-1,u.c[0]=v[(x=m%y)<0?y+x:x],o=!o||d.comparedTo(u)>0?m>0?u:_:d,x=yt,yt=1/0,d=new E(U),g.c[0]=0;A=M(d,u,0,1),f=h.plus(A.times(I)),f.comparedTo(o)!=1;)h=I,I=f,_=g.plus(A.times(f=_)),g=f,u=d.minus(A.times(f=u)),d=f;return f=M(o.minus(h),I,0,1),g=g.plus(f.times(_)),h=h.plus(f.times(I)),g.s=_.s=K.s,m=m*2,C=M(_,I,m,j).minus(K).abs().comparedTo(M(g,h,m,j).minus(K).abs())<1?[_,I]:[g,h],yt=x,C},D.toNumber=function(){return+vt(this)},D.toPrecision=function(o,u){return o!=null&&Q(o,1,b),Be(this,o,u,2)},D.toString=function(o){var u,h=this,I=h.s,f=h.e;return f===null?I?(u="Infinity",I<0&&(u="-"+u)):u="NaN":(o==null?u=f<=nt||f>=ut?X(N(h.c),f):$(N(h.c),f,"0"):o===10&&Ce?(h=gt(new E(h),q+f+1,j),u=$(N(h.c),h.e,"0")):(Q(o,2,Rt.length,"Base"),u=W($(N(h.c),f,"0"),10,o,I,!0)),I<0&&h.c[0]&&(u="-"+u)),u},D.valueOf=D.toJSON=function(){return vt(this)},D._isBigNumber=!0,O!=null&&E.set(O),E}function T(O){var M=O|0;return O>0||O===M?M:M-1}function N(O){for(var M,W,Z=1,D=O.length,F=O[0]+"";Z<D;){for(M=O[Z++]+"",W=y-M.length;W--;M="0"+M);F+=M}for(D=F.length;F.charCodeAt(--D)===48;);return F.slice(0,D+1||1)}function k(O,M){var W,Z,D=O.c,F=M.c,q=O.s,j=M.s,nt=O.e,ut=M.e;if(!q||!j)return null;if(W=D&&!D[0],Z=F&&!F[0],W||Z)return W?Z?0:-j:q;if(q!=j)return q;if(W=q<0,Z=nt==ut,!D||!F)return Z?0:!D^W?1:-1;if(!Z)return nt>ut^W?1:-1;for(j=(nt=D.length)<(ut=F.length)?nt:ut,q=0;q<j;q++)if(D[q]!=F[q])return D[q]>F[q]^W?1:-1;return nt==ut?0:nt>ut^W?1:-1}function Q(O,M,W,Z){if(O<M||O>W||O!==i(O))throw Error(c+(Z||"Argument")+(typeof O=="number"?O<M||O>W?" out of range: ":" not an integer: ":" not a primitive number: ")+String(O))}function R(O){var M=O.c.length-1;return T(O.e/y)==M&&O.c[M]%2!=0}function X(O,M){return(O.length>1?O.charAt(0)+"."+O.slice(1):O)+(M<0?"e":"e+")+M}function $(O,M,W){var Z,D;if(M<0){for(D=W+".";++M;D+=W);O=D+O}else if(Z=O.length,++M>Z){for(D=W,M-=Z;--M;D+=W);O+=D}else M<Z&&(O=O.slice(0,M)+"."+O.slice(M));return O}t=P(),t.default=t.BigNumber=t,s.exports?s.exports=t:(e||(e=typeof self<"u"&&self?self:window),e.BigNumber=t)})(Te)})(ze);(function(s){var e=ze.exports,t=s.exports;(function(){var r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,i,c={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},l;function p(B){return r.lastIndex=0,r.test(B)?'"'+B.replace(r,function(v){var w=c[v];return typeof w=="string"?w:"\\u"+("0000"+v.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+B+'"'}function y(B,v){var w,b,P,T,N=n,k,Q=v[B],R=Q!=null&&(Q instanceof e||e.isBigNumber(Q));switch(Q&&typeof Q=="object"&&typeof Q.toJSON=="function"&&(Q=Q.toJSON(B)),typeof l=="function"&&(Q=l.call(v,B,Q)),typeof Q){case"string":return R?Q:p(Q);case"number":return isFinite(Q)?String(Q):"null";case"boolean":case"null":case"bigint":return String(Q);case"object":if(!Q)return"null";if(n+=i,k=[],Object.prototype.toString.apply(Q)==="[object Array]"){for(T=Q.length,w=0;w<T;w+=1)k[w]=y(w,Q)||"null";return P=k.length===0?"[]":n?`[
|
|
2
|
-
`+n+k.join(`,
|
|
3
|
-
`+n)+`
|
|
4
|
-
`+N+"]":"["+k.join(",")+"]",n=N,P}if(l&&typeof l=="object")for(T=l.length,w=0;w<T;w+=1)typeof l[w]=="string"&&(b=l[w],P=y(b,Q),P&&k.push(p(b)+(n?": ":":")+P));else Object.keys(Q).forEach(function(X){var $=y(X,Q);$&&k.push(p(X)+(n?": ":":")+$)});return P=k.length===0?"{}":n?`{
|
|
5
|
-
`+n+k.join(`,
|
|
6
|
-
`+n)+`
|
|
7
|
-
`+N+"}":"{"+k.join(",")+"}",n=N,P}}typeof t.stringify!="function"&&(t.stringify=function(B,v,w){var b;if(n="",i="",typeof w=="number")for(b=0;b<w;b+=1)i+=" ";else typeof w=="string"&&(i=w);if(l=v,v&&typeof v!="function"&&(typeof v!="object"||typeof v.length!="number"))throw new Error("JSON.stringify");return y("",{"":B})})})()})(Rr);var fe=null;const fn=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,gn=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;var mn=function(s){var e={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(s!=null){if(s.strict===!0&&(e.strict=!0),s.storeAsString===!0&&(e.storeAsString=!0),e.alwaysParseAsBig=s.alwaysParseAsBig===!0?s.alwaysParseAsBig:!1,e.useNativeBigInt=s.useNativeBigInt===!0?s.useNativeBigInt:!1,typeof s.constructorAction<"u")if(s.constructorAction==="error"||s.constructorAction==="ignore"||s.constructorAction==="preserve")e.constructorAction=s.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${s.constructorAction}`);if(typeof s.protoAction<"u")if(s.protoAction==="error"||s.protoAction==="ignore"||s.protoAction==="preserve")e.protoAction=s.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${s.protoAction}`)}var t,r,n={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
8
|
-
`,r:"\r",t:" "},i,c=function(T){throw{name:"SyntaxError",message:T,at:t,text:i}},l=function(T){return T&&T!==r&&c("Expected '"+T+"' instead of '"+r+"'"),r=i.charAt(t),t+=1,r},p=function(){var T,N="";for(r==="-"&&(N="-",l("-"));r>="0"&&r<="9";)N+=r,l();if(r===".")for(N+=".";l()&&r>="0"&&r<="9";)N+=r;if(r==="e"||r==="E")for(N+=r,l(),(r==="-"||r==="+")&&(N+=r,l());r>="0"&&r<="9";)N+=r,l();if(T=+N,!isFinite(T))c("Bad number");else return fe==null&&(fe=ze.exports),N.length>15?e.storeAsString?N:e.useNativeBigInt?BigInt(N):new fe(N):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(T):new fe(T):T},y=function(){var T,N,k="",Q;if(r==='"')for(var R=t;l();){if(r==='"')return t-1>R&&(k+=i.substring(R,t-1)),l(),k;if(r==="\\"){if(t-1>R&&(k+=i.substring(R,t-1)),l(),r==="u"){for(Q=0,N=0;N<4&&(T=parseInt(l(),16),!!isFinite(T));N+=1)Q=Q*16+T;k+=String.fromCharCode(Q)}else if(typeof n[r]=="string")k+=n[r];else break;R=t}}c("Bad string")},B=function(){for(;r&&r<=" ";)l()},v=function(){switch(r){case"t":return l("t"),l("r"),l("u"),l("e"),!0;case"f":return l("f"),l("a"),l("l"),l("s"),l("e"),!1;case"n":return l("n"),l("u"),l("l"),l("l"),null}c("Unexpected '"+r+"'")},w,b=function(){var T=[];if(r==="["){if(l("["),B(),r==="]")return l("]"),T;for(;r;){if(T.push(w()),B(),r==="]")return l("]"),T;l(","),B()}}c("Bad array")},P=function(){var T,N=Object.create(null);if(r==="{"){if(l("{"),B(),r==="}")return l("}"),N;for(;r;){if(T=y(),B(),l(":"),e.strict===!0&&Object.hasOwnProperty.call(N,T)&&c('Duplicate key "'+T+'"'),fn.test(T)===!0?e.protoAction==="error"?c("Object contains forbidden prototype property"):e.protoAction==="ignore"?w():N[T]=w():gn.test(T)===!0?e.constructorAction==="error"?c("Object contains forbidden constructor property"):e.constructorAction==="ignore"?w():N[T]=w():N[T]=w(),B(),r==="}")return l("}"),N;l(","),B()}}c("Bad object")};return w=function(){switch(B(),r){case"{":return P();case"[":return b();case'"':return y();case"-":return p();default:return r>="0"&&r<="9"?p():v()}},function(T,N){var k;return i=T+"",t=0,r=" ",k=w(),B(),r&&c("Syntax error"),typeof N=="function"?function Q(R,X){var $,O=R[X];return O&&typeof O=="object"&&Object.keys(O).forEach(function(M){$=Q(O,M),$!==void 0?O[M]=$:delete O[M]}),N.call(R,X,O)}({"":k},""):k}},pn=mn,qr=Rr.exports.stringify,Vr=pn;Wt.exports=function(s){return{parse:Vr(s),stringify:qr}};Wt.exports.parse=Vr();Wt.exports.stringify=qr;class An{txHex="";txBuilder=pe();txEvaluationMultiplier=1.1;_protocolParams=It;txOutput;addingScriptInput=!1;addingPlutusMint=!1;isHydra=!1;meshTxBuilderBody;mintItem;txInQueueItem;collateralQueueItem;refScriptTxInQueueItem;reset=()=>(this.txHex="",this.txBuilder=pe(),this.txEvaluationMultiplier=1.1,this._protocolParams=It,this.txOutput=void 0,this.addingScriptInput=!1,this.addingPlutusMint=!1,this.mintItem=void 0,this.txInQueueItem=void 0,this.collateralQueueItem=void 0,this.refScriptTxInQueueItem=void 0,this.meshTxBuilderBody=this.emptyTxBuilderBody(),this);emptyTxBuilderBody=()=>({inputs:[],outputs:[],extraInputs:[],selectionThreshold:0,collaterals:[],requiredSignatures:[],referenceInputs:[],mints:[],changeAddress:"",metadata:[],validityRange:{},certificates:[],signingKey:[]});constructor(){this.meshTxBuilderBody=this.emptyTxBuilderBody()}completeSync=e=>(e?this.meshTxBuilderBody=e:this.queueAllLastItem(),this.serializeTxBody(this.meshTxBuilderBody));completeSigning=()=>{const{signingKey:e}=this.meshTxBuilderBody;return e.length>0&&this.addAllSigningKeys(e),this.txHex};serializeTxBody=e=>{const{inputs:t,outputs:r,extraInputs:n,selectionThreshold:i,collaterals:c,referenceInputs:l,mints:p,changeAddress:y,certificates:B,validityRange:v,requiredSignatures:w,metadata:b}=e;if(this.isHydra?this.protocolParams({minFeeA:0,minFeeB:0,priceMem:0,priceStep:0,collateralPercent:0,coinsPerUTxOSize:"0"}):this.protocolParams({}),n.length>0&&this.addUtxosFrom(n,String(i)),this.removeDuplicateInputs(),this.meshTxBuilderBody.mints.sort((P,T)=>P.policyId.localeCompare(T.policyId)),this.meshTxBuilderBody.inputs.sort((P,T)=>P.txIn.txHash===T.txIn.txHash?P.txIn.txIndex-T.txIn.txIndex:P.txIn.txHash.localeCompare(T.txIn.txHash)),this.addAllInputs(t),this.addAllOutputs(r),this.addAllCollaterals(c),this.addAllReferenceInputs(l),this.addAllMints(p),this.addAllCertificates(B),this.addValidityRange(v),this.addAllRequiredSignatures(w),this.addAllMetadata(b),this.addCostModels(),y){const P=this.meshTxBuilderBody.collaterals.map(k=>{var Q,R;return((R=(Q=k.txIn.amount)==null?void 0:Q.find(X=>X.unit==="lovelace"))==null?void 0:R.quantity)||"0"}).reduce((k,Q)=>k+parseInt(Q),0),T=Math.ceil(this._protocolParams.collateralPercent*Number(Number(this.txBuilder.min_fee().checked_add(a.BigNum.from_str("10000")).to_js_value()))/100);let N=!1;if(P-T>0){const k=a.TransactionOutput.new(a.Address.from_bech32(y),a.Value.new(a.BigNum.from_str(String(T))));P-T>Number(a.min_ada_for_output(k,a.DataCost.new_coins_per_byte(a.BigNum.from_str(this._protocolParams.coinsPerUTxOSize))).to_js_value())&&(this.txBuilder.set_collateral_return(a.TransactionOutput.new(a.Address.from_bech32(y),a.Value.new(a.BigNum.from_str(String(P))))),this.txBuilder.set_total_collateral(a.BigNum.from_str(String(P))),N=!0)}this.addChange(y),N&&this.addCollateralReturn(y)}return this.buildTx(),this};txIn=(e,t,r,n)=>(this.txInQueueItem&&this.queueInput(),this.addingScriptInput?this.txInQueueItem={type:"Script",txIn:{txHash:e,txIndex:t,amount:r,address:n},scriptTxIn:{}}:this.txInQueueItem={type:"PubKey",txIn:{txHash:e,txIndex:t,amount:r,address:n}},this.addingScriptInput=!1,this);txInScript=(e,t)=>{if(!this.txInQueueItem)throw Error("Undefined input");if(this.txInQueueItem.type==="PubKey"&&(this.txInQueueItem={type:"SimpleScript",txIn:this.txInQueueItem.txIn,simpleScriptTxIn:{scriptSource:{type:"Provided",script:e}}}),this.txInQueueItem.type==="Script"){const r=t||"V2";this.txInQueueItem.scriptTxIn.scriptSource={type:"Provided",script:{code:e,version:r}}}return this};txInDatumValue=(e,t="Mesh")=>{if(!this.txInQueueItem)throw Error("Undefined input");if(this.txInQueueItem.type==="PubKey")throw Error("Datum value attempted to be called a non script input");if(this.txInQueueItem.type==="SimpleScript")throw Error("Datum value attempted to be called on a simple script input");let r=e;return t==="JSON"&&(r=this.castRawDataToJsonString(e)),t==="Mesh"?(this.txInQueueItem.scriptTxIn.datumSource={type:"Provided",data:{type:t,content:e}},this):(this.txInQueueItem.scriptTxIn.datumSource={type:"Provided",data:{type:t,content:r}},this)};txInInlineDatumPresent=()=>{if(!this.txInQueueItem)throw Error("Undefined input");if(this.txInQueueItem.type==="PubKey")throw Error("Inline datum present attempted to be called a non script input");if(this.txInQueueItem.type==="SimpleScript")throw Error("Inline datum present attempted to be called on a simple script input");const{txHash:e,txIndex:t}=this.txInQueueItem.txIn;return e&&t.toString()&&(this.txInQueueItem.scriptTxIn.datumSource={type:"Inline",txHash:e,txIndex:t}),this};txInRedeemerValue=(e,t={...Yt},r="Mesh")=>{if(!this.txInQueueItem)throw Error("Undefined input");if(this.txInQueueItem.type==="PubKey")throw Error("Spending tx in reference redeemer attempted to be called a non script input");if(this.txInQueueItem.type==="SimpleScript")throw Error("Spending tx in reference redeemer attempted to be called on a simple script input");let n=e;return r==="Mesh"?(this.txInQueueItem.scriptTxIn.redeemer={data:{type:r,content:e},exUnits:t},this):(r==="JSON"&&(n=this.castRawDataToJsonString(e)),this.txInQueueItem.scriptTxIn.redeemer={data:{type:r,content:n},exUnits:t},this)};txOut=(e,t)=>(this.txOutput&&(this.meshTxBuilderBody.outputs.push(this.txOutput),this.txOutput=void 0),this.txOutput={address:e,amount:t},this);txOutDatumHashValue=(e,t="Mesh")=>{let r=e;if(this.txOutput){if(t==="Mesh")return this.txOutput.datum={type:"Hash",data:{type:t,content:r}},this;t==="JSON"&&(r=this.castRawDataToJsonString(e)),this.txOutput.datum={type:"Hash",data:{type:t,content:r}}}return this};txOutInlineDatumValue=(e,t="Mesh")=>{let r=e;if(this.txOutput){if(t==="Mesh")return this.txOutput.datum={type:"Inline",data:{type:t,content:r}},this;t==="JSON"&&(r=this.castRawDataToJsonString(e)),this.txOutput.datum={type:"Inline",data:{type:t,content:r}}}return this};txOutReferenceScript=(e,t="V2")=>(this.txOutput&&(this.txOutput.referenceScript={code:e,version:t}),this);spendingPlutusScriptV2=()=>(this.addingScriptInput=!0,this);spendingTxInReference=(e,t,r,n="V2")=>{if(!this.txInQueueItem)throw Error("Undefined input");if(this.txInQueueItem.type==="PubKey")throw Error("Spending tx in reference attempted to be called a non script input");if(this.txInQueueItem.type==="SimpleScript")throw Error("Spending tx in reference attempted to be called on a simple script input");return this.txInQueueItem.scriptTxIn.scriptSource={type:"Inline",txInInfo:{txHash:e,txIndex:t,spendingScriptHash:r,version:n}},this};spendingReferenceTxInInlineDatumPresent=()=>(this.txInInlineDatumPresent(),this);spendingReferenceTxInRedeemerValue=(e,t={...Yt},r="Mesh")=>(this.txInRedeemerValue(e,t,r),this);readOnlyTxInReference=(e,t)=>(this.meshTxBuilderBody.referenceInputs.push({txHash:e,txIndex:t}),this);mintPlutusScriptV2=()=>(this.addingPlutusMint=!0,this);mint=(e,t,r)=>(this.mintItem&&this.queueMint(),this.mintItem={type:this.addingPlutusMint?"Plutus":"Native",policyId:t,assetName:r,amount:e},this.addingPlutusMint=!1,this);mintingScript=(e,t="V2")=>{if(!this.mintItem)throw Error("Undefined mint");if(!this.mintItem.type)throw Error("Mint information missing");return this.mintItem.scriptSource={type:"Provided",script:{code:e,version:t}},this};mintTxInReference=(e,t,r="V2")=>{if(!this.mintItem)throw Error("Undefined mint");if(!this.mintItem.type)throw Error("Mint information missing");if(this.mintItem.type=="Native")throw Error("Mint tx in reference can only be used on plutus script tokens");if(!this.mintItem.policyId)throw Error("PolicyId information missing from mint asset");return this.mintItem.scriptSource={type:"Reference Script",txHash:e,txIndex:t,version:r},this};mintReferenceTxInRedeemerValue=(e,t={...Yt},r="Mesh")=>{if(!this.mintItem)throw Error("Undefined mint");if(this.mintItem.type=="Native")throw Error("Mint tx in reference can only be used on plutus script tokens");if(this.mintItem.type=="Plutus"){if(!this.mintItem.policyId)throw Error("PolicyId information missing from mint asset");let n=e;if(r==="Mesh")return this.mintItem.redeemer={data:{type:r,content:n},exUnits:t},this;r==="JSON"&&(n=this.castRawDataToJsonString(e)),this.mintItem.redeemer={data:{type:r,content:n},exUnits:t}}return this};mintRedeemerValue=(e,t={...Yt},r="Mesh")=>(this.mintReferenceTxInRedeemerValue(e,t,r),this);requiredSignerHash=e=>(this.meshTxBuilderBody.requiredSignatures.push(e),this);txInCollateral=(e,t,r,n)=>(this.collateralQueueItem&&this.meshTxBuilderBody.collaterals.push(this.collateralQueueItem),this.collateralQueueItem={type:"PubKey",txIn:{txHash:e,txIndex:t,amount:r,address:n}},this);registerPoolCertificate=e=>(this.meshTxBuilderBody.certificates.push({type:"RegisterPool",poolParams:e}),this);registerStakeCertificate=e=>(this.meshTxBuilderBody.certificates.push({type:"RegisterStake",stakeKeyHash:e}),this);delegateStakeCertificate=(e,t)=>(this.meshTxBuilderBody.certificates.push({type:"DelegateStake",stakeKeyHash:e,poolId:t}),this);deregisterStakeCertificate=e=>(this.meshTxBuilderBody.certificates.push({type:"DeregisterStake",stakeKeyHash:e}),this);retirePoolCertificate=(e,t)=>(this.meshTxBuilderBody.certificates.push({type:"RetirePool",poolId:e,epoch:t}),this);changeAddress=e=>(this.meshTxBuilderBody.changeAddress=e,this);invalidBefore=e=>(this.meshTxBuilderBody.validityRange.invalidBefore=e,this);invalidHereafter=e=>(this.meshTxBuilderBody.validityRange.invalidHereafter=e,this);metadataValue=(e,t)=>(this.meshTxBuilderBody.metadata.push({tag:e,metadata:t}),this);protocolParams=e=>{const t={...It,...e};return this._protocolParams=t,this.txBuilder=pe(t),this};signingKey=e=>(this.meshTxBuilderBody.signingKey.push(e),this);selectUtxosFrom=(e,t=5e6)=>(this.meshTxBuilderBody.extraInputs=e,this.meshTxBuilderBody.selectionThreshold=t,this);addUtxosFrom=(e,t)=>{const r=this.meshTxBuilderBody.outputs.reduce((i,c)=>(c.amount.forEach(p=>{const{unit:y,quantity:B}=p,v=Number(i.get(y))||0;i.set(y,String(v+Number(B)))}),i),new Map);this.meshTxBuilderBody.inputs.reduce((i,c)=>{const l=c.txIn.amount;return l==null||l.forEach(p=>{const{unit:y,quantity:B}=p,v=Number(i.get(y))||0;i.set(y,String(v-Number(B)))}),i},r),this.meshTxBuilderBody.mints.reduce((i,c)=>{const l={unit:c.policyId+c.assetName,quantity:String(c.amount)},p=Number(i.get(l.unit))||0;return i.set(l.unit,String(p-Number(l.quantity))),i},r),hn(e,r,t).forEach(i=>{const c={type:"PubKey",txIn:{txHash:i.input.txHash,txIndex:i.input.outputIndex,amount:i.output.amount,address:i.output.address}};this.meshTxBuilderBody.inputs.push(c),this.addTxIn(c)})};addAllSigningKeys=e=>{if(e.length>0){const t=a.Vkeywitnesses.new(),r=a.Transaction.from_hex(this.txHex),n=r.body();e.forEach(l=>{const p=l.slice(0,4)==="5820"?l.slice(4):l,y=a.PrivateKey.from_hex(p),B=a.make_vkey_witness(a.hash_transaction(n),y);t.add(B)});const i=r.witness_set();i.set_vkeys(t);const c=a.Transaction.new(n,i,r.auxiliary_data());this.txHex=c.to_hex()}};buildTx=()=>{const e=this.txBuilder.build_tx();this.txHex=e.to_hex()};queueInput=()=>{if(!this.txInQueueItem)throw Error("Undefined input");if(this.txInQueueItem.type==="Script")if(this.txInQueueItem.scriptTxIn){if(!this.txInQueueItem.scriptTxIn.datumSource)throw Error("Script input does not contain datum information");if(!this.txInQueueItem.scriptTxIn.redeemer)throw Error("Script input does not contain redeemer information");if(!this.txInQueueItem.scriptTxIn.scriptSource)throw Error("Script input does not contain script information")}else throw Error("Script input does not contain script, datum, or redeemer information");this.meshTxBuilderBody.inputs.push(this.txInQueueItem),this.txInQueueItem=void 0};queueMint=()=>{if(!this.mintItem)throw Error("Undefined mint");if(!this.mintItem.scriptSource)throw Error("Missing mint script information");this.meshTxBuilderBody.mints.push(this.mintItem),this.mintItem=void 0};makePlutusScriptSource=e=>{const t=a.ScriptHash.from_hex(e.spendingScriptHash),r=a.TransactionInput.new(a.TransactionHash.from_hex(e.txHash),e.txIndex);return a.PlutusScriptSource.new_ref_input_with_lang_ver(t,r,bt[e.version])};removeDuplicateInputs=()=>{const e=this.meshTxBuilderBody.inputs,t=n=>`${n.txHash}#${n.txIndex}`,r=[];for(let n=0;n<e.length;n++){const i=t(e[n].txIn);r.includes(i)?(e.splice(n,1),n--):r.push(i)}};addAllInputs=e=>{for(let t=0;t<e.length;t++){const r=e[t];switch(r.type){case"PubKey":this.addTxIn(r);break;case"SimpleScript":this.addNativeScriptTxIn(r);break;case"Script":this.addScriptTxIn(r);break}}};addTxIn=e=>{this.txBuilder.add_input(a.Address.from_bech32(e.txIn.address),a.TransactionInput.new(a.TransactionHash.from_hex(e.txIn.txHash),e.txIn.txIndex),St(e.txIn.amount))};addNativeScriptTxIn=({txIn:e,simpleScriptTxIn:t})=>{t.scriptSource.type==="Provided"&&this.txBuilder.add_native_script_input(a.NativeScript.from_hex(t.scriptSource.script),a.TransactionInput.new(a.TransactionHash.from_hex(e.txHash),e.txIndex),St(e.amount))};addScriptTxIn=({scriptTxIn:e,txIn:t})=>{let r;const{datumSource:n,scriptSource:i,redeemer:c}=e;if(n.type==="Provided")r=a.DatumSource.new(this.castDataToPlutusData(n.data));else{const y=a.TransactionInput.new(a.TransactionHash.from_hex(n.txHash),n.txIndex);r=a.DatumSource.new_ref_input(y)}let l;i.type=="Inline"?l=this.makePlutusScriptSource(i.txInInfo):l=a.PlutusScriptSource.new(a.PlutusScript.from_hex_with_version(i.script.code,bt[i.script.version]));const p=a.Redeemer.new(a.RedeemerTag.new_spend(),a.BigNum.from_str("0"),this.castDataToPlutusData(c.data),a.ExUnits.new(a.BigNum.from_str(String(c.exUnits.mem)),a.BigNum.from_str(String(c.exUnits.steps))));this.txBuilder.add_plutus_script_input(a.PlutusWitness.new_with_ref(l,r,p),a.TransactionInput.new(a.TransactionHash.from_hex(t.txHash),t.txIndex),St(t.amount))};addAllOutputs=e=>{for(let t=0;t<e.length;t++){const r=e[t];this.addOutput(r)}};addOutput=({amount:e,address:t,datum:r,referenceScript:n})=>{const i=St(e),c=i.multiasset();if(i.is_zero()&&c===void 0)throw Error("Invalid output amount");let l=a.TransactionOutputBuilder.new().with_address(xt(t));r&&r.type==="Hash"&&(l=l.with_data_hash(a.hash_plutus_data(this.castDataToPlutusData(r.data)))),r&&r.type==="Inline"&&(l=l.with_plutus_data(this.castDataToPlutusData(r.data))),n&&(l=l.with_script_ref(a.ScriptRef.new_plutus_script(a.PlutusScript.from_hex_with_version(n.code,bt[n.version]))));const p=l.next();if(c){const y=i.coin().is_zero()?p.with_asset_and_min_required_coin_by_utxo_cost(c,Pe(this._protocolParams.coinsPerUTxOSize)).build():p.with_coin_and_asset(i.coin(),c).build();this.txBuilder.add_output(y)}else{const y=p.with_coin(i.coin()).build();this.txBuilder.add_output(y)}};addAllCollaterals=e=>{const t=a.TxInputsBuilder.new();for(let r=0;r<e.length;r++){const n=e[r];this.addCollateral(t,n)}this.txBuilder.set_collateral(t)};addCollateral=(e,t)=>{e.add_input(a.Address.from_bech32(t.txIn.address),a.TransactionInput.new(a.TransactionHash.from_hex(t.txIn.txHash),t.txIn.txIndex),St(t.txIn.amount))};addCollateralReturn=e=>{var r;const t=(r=this.txBuilder.get_fee_if_set())==null?void 0:r.to_js_value();if(t){const n=Math.ceil(this._protocolParams.collateralPercent*Number(t)/100);this.txBuilder.set_total_collateral_and_return(a.BigNum.from_str(String(n)),a.Address.from_bech32(e))}};addAllReferenceInputs=e=>{e.forEach(t=>{this.addReferenceInput(t)})};addReferenceInput=({txHash:e,txIndex:t})=>{const r=a.TransactionInput.new(a.TransactionHash.from_hex(e),t);this.txBuilder.add_reference_input(r)};addAllMints=e=>{const t=a.MintBuilder.new();let r=0;for(let n=0;n<e.length;n++){const i=e[n];if(!i.scriptSource)throw Error("Mint script is expected to be provided");if(i.type==="Plutus"){if(!i.redeemer)throw Error("Missing mint redeemer information");this.addPlutusMint(t,i,r),r++}else i.type==="Native"&&this.addNativeMint(t,i)}this.txBuilder.set_mint_builder(t)};addPlutusMint=(e,{redeemer:t,policyId:r,scriptSource:n,assetName:i,amount:c},l)=>{const p=a.Redeemer.new(a.RedeemerTag.new_mint(),a.BigNum.from_str(String(l)),this.castDataToPlutusData(t.data),a.ExUnits.new(a.BigNum.from_str(String(t.exUnits.mem)),a.BigNum.from_str(String(t.exUnits.steps)))),y=n.type==="Reference Script"?a.PlutusScriptSource.new_ref_input_with_lang_ver(a.ScriptHash.from_hex(r),a.TransactionInput.new(a.TransactionHash.from_hex(n.txHash),n.txIndex),bt[n.version]):a.PlutusScriptSource.new(a.PlutusScript.from_hex_with_version(n.script.code,bt[n.script.version]));e.add_asset(a.MintWitness.new_plutus_script(y,p),a.AssetName.new(Buffer.from(i,"hex")),a.Int.from_str(c))};addNativeMint=(e,{scriptSource:t,assetName:r,amount:n})=>{if(t.type==="Reference Script")throw Error("Native mint cannot have reference script");e.add_asset(a.MintWitness.new_native_script(a.NativeScript.from_hex(t.script.code)),a.AssetName.new(Buffer.from(r,"hex")),a.Int.from_str(n))};decimalToFraction(e){const t=10**e.toString().split(".")[1].length;return[e*t,t]}toPoolParams=e=>{const t=this.decimalToFraction(e.margin),r=a.Relays.new();e.relays.forEach(c=>{r.add(Or(c))});const n=a.RewardAddress.from_address(a.Address.from_bech32(e.rewardAddress));if(n===void 0)throw new Error("Reward address is invalid");const i=a.Ed25519KeyHashes.new();return e.owners.forEach(c=>{i.add(a.Ed25519KeyHash.from_hex(c))}),a.PoolParams.new(a.Ed25519KeyHash.from_hex(e.operator),a.VRFKeyHash.from_hex(e.VRFKeyHash),a.BigNum.from_str(e.pledge),a.BigNum.from_str(e.cost),a.UnitInterval.new(a.BigNum.from_str(t[0].toString()),a.BigNum.from_str(t[1].toString())),n,i,r,e.metadata?a.PoolMetadata.from_json(Wt.exports.stringify(e.metadata)):void 0)};addCertificate=(e,t)=>{switch(t.type){case"RegisterPool":e.add(a.Certificate.new_pool_registration(a.PoolRegistration.new(this.toPoolParams(t.poolParams))));break;case"RegisterStake":e.add(a.Certificate.new_stake_registration(a.StakeRegistration.new(a.StakeCredential.from_keyhash(a.Ed25519KeyHash.from_hex(t.stakeKeyHash)))));break;case"DelegateStake":e.add(a.Certificate.new_stake_delegation(a.StakeDelegation.new(a.StakeCredential.from_keyhash(a.Ed25519KeyHash.from_hex(t.stakeKeyHash)),t.poolId.startsWith("pool")?a.Ed25519KeyHash.from_bech32(t.poolId):a.Ed25519KeyHash.from_hex(t.poolId))));break;case"DeregisterStake":e.add(a.Certificate.new_stake_deregistration(a.StakeDeregistration.new(a.StakeCredential.from_keyhash(a.Ed25519KeyHash.from_hex(t.stakeKeyHash)))));break;case"RetirePool":e.add(a.Certificate.new_pool_retirement(a.PoolRetirement.new(t.poolId.startsWith("pool")?a.Ed25519KeyHash.from_bech32(t.poolId):a.Ed25519KeyHash.from_hex(t.poolId),t.epoch)))}};queueAllLastItem=()=>{this.txOutput&&(this.meshTxBuilderBody.outputs.push(this.txOutput),this.txOutput=void 0),this.txInQueueItem&&this.queueInput(),this.collateralQueueItem&&(this.meshTxBuilderBody.collaterals.push(this.collateralQueueItem),this.collateralQueueItem=void 0),this.mintItem&&this.queueMint()};addAllCertificates=e=>{const t=a.Certificates.new();e.forEach(r=>{this.addCertificate(t,r)}),this.txBuilder.set_certs(t)};addCostModels=()=>{this.txBuilder.calc_script_data_hash(a.TxBuilderConstants.plutus_vasil_cost_models())};addChange=e=>{this.txBuilder.add_change_if_needed(a.Address.from_bech32(e))};addValidityRange=({invalidBefore:e,invalidHereafter:t})=>{e&&this.txBuilder.set_validity_start_interval_bignum(a.BigNum.from_str(e.toString())),t&&this.txBuilder.set_ttl_bignum(a.BigNum.from_str(t.toString()))};addAllRequiredSignatures=e=>{e.forEach(t=>{this.txBuilder.add_required_signer(a.Ed25519KeyHash.from_hex(t))})};addAllMetadata=e=>{e.forEach(({tag:t,metadata:r})=>{this.txBuilder.add_json_metadatum(a.BigNum.from_str(t),Wt.exports.stringify(r))})};updateRedeemer=(e,t)=>{t.forEach(r=>{switch(r.tag){case"SPEND":{const n=e.inputs[r.index];n.type=="Script"&&n.scriptTxIn.redeemer&&(n.scriptTxIn.redeemer.exUnits.mem=Math.floor(r.budget.mem*this.txEvaluationMultiplier),n.scriptTxIn.redeemer.exUnits.steps=Math.floor(r.budget.steps*this.txEvaluationMultiplier));break}case"MINT":{const n=e.mints[r.index];n.type=="Plutus"&&n.redeemer&&(n.redeemer.exUnits.mem=Math.floor(r.budget.mem*this.txEvaluationMultiplier),n.redeemer.exUnits.steps=Math.floor(r.budget.steps*this.txEvaluationMultiplier));break}}})};castRawDataToJsonString=e=>typeof e=="object"?Wt.exports.stringify(e):e;castDataToPlutusData=({type:e,content:t})=>e==="Mesh"?Ot(t):e==="CBOR"?a.PlutusData.from_hex(t):a.PlutusData.from_json(t,a.PlutusDatumSchema.DetailedSchema)}class In extends An{_fetcher;_submitter;_evaluator;queriedTxHashes=new Set;queriedUTxOs={};constructor({fetcher:e,submitter:t,evaluator:r,isHydra:n=!1}){super(),e&&(this._fetcher=e),t&&(this._submitter=t),r&&(this._evaluator=r),n&&(this.isHydra=!0)}complete=async e=>{e?this.meshTxBuilderBody=e:this.queueAllLastItem();const{inputs:t,collaterals:r}=this.meshTxBuilderBody,n=[...t,...r].filter(i=>!this.isInputComplete(i));if(await this.queryAllTxInfo(n),n.forEach(i=>{this.completeTxInformation(i)}),this.completeSync(e),this._evaluator){const i=await this._evaluator.evaluateTx(this.txHex);this.updateRedeemer(this.meshTxBuilderBody,i),this.completeSync(e)}return this};submitTx=async e=>{var r;return await((r=this._submitter)==null?void 0:r.submitTx(e))};getUTxOInfo=async e=>{var r;let t=[];this.queriedTxHashes.has(e)||(this.queriedTxHashes.add(e),t=await((r=this._fetcher)==null?void 0:r.fetchUTxOs(e))||[],this.queriedUTxOs[e]=t)};queryAllTxInfo=e=>{var r;const t=[];if(e.length>0&&!this._fetcher)throw Error("Transaction information is incomplete while no fetcher instance is provided");for(let n=0;n<e.length;n++){const i=e[n];this.isInputInfoComplete(i)||t.push(this.getUTxOInfo(i.txIn.txHash)),i.type==="Script"&&((r=i.scriptTxIn.scriptSource)==null?void 0:r.type)==="Inline"&&!this.isRefScriptInfoComplete(i)&&t.push(this.getUTxOInfo(i.scriptTxIn.scriptSource.txInInfo.txHash))}return Promise.all(t)};completeTxInformation=e=>{var t;if(!this.isInputInfoComplete(e)){const r=this.queriedUTxOs[e.txIn.txHash],n=r==null?void 0:r.find(l=>l.input.outputIndex===e.txIn.txIndex),i=n==null?void 0:n.output.amount,c=n==null?void 0:n.output.address;if(!i||i.length===0)throw Error(`Couldn't find value information for ${e.txIn.txHash}#${e.txIn.txIndex}`);if(e.txIn.amount=i,e.type==="PubKey"){if(!c||c==="")throw Error(`Couldn't find address information for ${e.txIn.txHash}#${e.txIn.txIndex}`);e.txIn.address=c}}if(e.type==="Script"&&((t=e.scriptTxIn.scriptSource)==null?void 0:t.type)=="Inline"&&!this.isRefScriptInfoComplete(e)){const r=e.scriptTxIn.scriptSource.txInInfo,i=this.queriedUTxOs[r.txHash].find(c=>c.input.outputIndex===r.txIndex);if(!i)throw Error(`Couldn't find script reference utxo for ${r.txHash}#${r.txIndex}`);r.spendingScriptHash=i==null?void 0:i.output.scriptHash}};isInputComplete=e=>e.type==="PubKey"?this.isInputInfoComplete(e):e.type==="Script"?this.isInputInfoComplete(e)&&this.isRefScriptInfoComplete(e):!0;isInputInfoComplete=e=>{const{amount:t,address:r}=e.txIn;return!(e.type==="PubKey"&&(!t||!r)||e.type==="Script"&&!t)};isRefScriptInfoComplete=e=>{var r;const{scriptSource:t}=e.scriptTxIn;return!((t==null?void 0:t.type)==="Inline"&&!((r=t.txInInfo)!=null&&r.spendingScriptHash))}}class rt{_networkId;_encryptedSecret;constructor(e,t){this._networkId=e,this._encryptedSecret=t}getAccount(e,t,r=0){return this.accountContext(e,r,t,(n,i)=>{const c=mr(this._networkId,n.to_public().hash(),i.to_public().hash()).to_address().to_bech32(),l=pr(this._networkId,n.to_public().hash()).to_address().to_bech32(),p=Ue(this._networkId,i.to_public().hash()).to_address().to_bech32();return{baseAddress:c,enterpriseAddress:l,rewardAddress:p}})}signData(e,t,r,n,i=0){try{return this.accountContext(e,i,t,(c,l)=>{const p={payload:n},y={address:rt.resolveAddress(this._networkId,r,c,l),key:r.startsWith("stake")?l:c},{coseSign1:B,coseKey:v}=as(p,y);return{signature:B,key:v}})}catch(c){throw new Error(`An error occurred during signData: ${c}.`)}}signTx(e,t,r,n,i,c=0){try{const l=ke(Me(n));return this.accountContext(e,c,t,(p,y)=>{const B=a.Vkeywitnesses.new();return rt.resolveSigners(n,r,p.to_public().hash().to_hex()).forEach(w=>{if(w===p.to_public().hash().to_hex())B.add(a.make_vkey_witness(l,p));else if(w===y.to_public().hash().to_hex())B.add(a.make_vkey_witness(l,y));else if(i===!1)throw new Error(`Missing key witness for: ${w}`)}),B})}catch(l){throw new Error(`An error occurred during signTx: ${l}.`)}}addPaymentKey(e,t,r,n,i=0){const c=ke(Me(r));return this.accountContext(e,i,t,(l,p)=>{n.add(a.make_vkey_witness(c,l))}),n}static encryptMnemonic(e,t){const r=De.mnemonicToEntropy(e.join(" ")),n=Hr(r),i=ht(n.as_bytes());return n.free(),rt.encrypt(i,t)}static encryptPrivateKey(e,t){const r=a.Bip32PrivateKey.from_bech32(e),n=ht(r.as_bytes());return r.free(),rt.encrypt(n,t)}static encryptSigningKeys(e,t,r){const n=rt.encrypt(e.slice(4),r),i=rt.encrypt(t.slice(4),r);return[n,i]}static generateMnemonic(e=256){return De.generateMnemonic(e).split(" ")}accountContext(e,t,r,n){const{paymentKey:i,stakeKey:c}=rt.resolveKeys(e,t,r,this._encryptedSecret),l=n(i,c);return i.free(),c.free(),l}static decrypt(e,t){try{return a.decrypt_with_password(ft(t),e)}catch{throw new Error("The password is incorrect.")}}static encrypt(e,t){const r=_r.customAlphabet("0123456789abcdef"),n=r(64),i=r(24);return a.encrypt_with_password(ft(t),n,i,e)}static resolveAddress(e,t,r,n){const i=[mr(e,r.to_public().hash(),n.to_public().hash()),pr(e,r.to_public().hash()),Ue(e,n.to_public().hash())].find(c=>c.to_address().to_bech32()===t);if(i!==void 0)return i.to_address();throw new Error(`Address: ${t} doesn't belong to this account.`)}static resolveKeys(e,t,r,n){if(typeof n=="string"){const l=rt.decrypt(n,r);return ks(l,e,t)}const i=rt.decrypt(n[0],r),c=rt.decrypt(n[1],r);return{paymentKey:a.PrivateKey.from_hex(i),stakeKey:a.PrivateKey.from_hex(c)}}static resolveSigners(e,t,r){const n=l=>{const p=(k,Q=[],R=0)=>{var O,M,W,Z,D;if(k===void 0||R>=k.len())return Q;const X=k.get(R),$=new Array;switch(X.kind()){case a.CertificateKind.StakeDeregistration:{const F=(O=X.as_stake_deregistration())==null?void 0:O.stake_credential(),q=(F==null?void 0:F.kind())===a.StakeCredKind.Key?F.to_keyhash():void 0;q&&$.push(q.to_hex());break}case a.CertificateKind.StakeDelegation:{const F=(M=X.as_stake_delegation())==null?void 0:M.stake_credential(),q=(F==null?void 0:F.kind())===a.StakeCredKind.Key?F.to_keyhash():void 0;q&&$.push(q.to_hex());break}case a.CertificateKind.PoolRegistration:{const F=(W=X.as_pool_registration())==null?void 0:W.pool_params().pool_owners();$.push(...B(F));break}case a.CertificateKind.PoolRetirement:{const F=(Z=X.as_pool_retirement())==null?void 0:Z.pool_keyhash();F&&$.push(F.to_hex());break}case a.CertificateKind.MoveInstantaneousRewardsCert:{const F=(D=X.as_move_instantaneous_rewards_cert())==null?void 0:D.move_instantaneous_reward().as_to_stake_creds();if(F)for(let q=0;q<F.len();q+=1){const j=F.keys().get(q),nt=j.kind()===a.StakeCredKind.Key?j.to_keyhash():void 0;nt&&$.push(nt.to_hex())}break}}return p(k,[...Q,...$],R+1)},y=(k,Q=[],R=0)=>{if(k===void 0||R>=k.len())return Q;const X=k.get(R).index(),$=k.get(R).transaction_id(),O=t.find(M=>M.input.outputIndex===X&&M.input.txHash===$.to_hex())!==void 0?r:"OUR_PRINCESS_IS_IN_ANOTHER_CASTLE";return y(k,[...Q,O],R+1)},B=(k,Q=[],R=0)=>k===void 0||R>=k.len()?Q:B(k,[...Q,k.get(R).to_hex()],R+1),v=(k,Q=[],R=0)=>{if(k===void 0||R>=k.len())return Q;const X=k.keys().get(R).payment_cred(),$=X.kind()===a.StakeCredKind.Key?X.to_keyhash():void 0;return v(k,$?[...Q,$.to_hex()]:Q,R+1)},w=l.certs(),b=l.collateral(),P=l.inputs(),T=l.required_signers(),N=l.withdrawals();return[...p(w),...y(b),...y(P),...B(T),...v(N)]},i=l=>{const p=(B,v=[])=>{var w,b,P,T;if(B)for(let N=0;N<B.len();N+=1){const k=B.get(N);switch(k.kind()){case a.NativeScriptKind.ScriptPubkey:{const Q=(w=k.as_script_pubkey())==null?void 0:w.addr_keyhash().to_hex();return Q?[...v,Q]:v}case a.NativeScriptKind.ScriptAll:return p((b=k.as_script_all())==null?void 0:b.native_scripts(),v);case a.NativeScriptKind.ScriptAny:return p((P=k.as_script_any())==null?void 0:P.native_scripts(),v);case a.NativeScriptKind.ScriptNOfK:return p((T=k.as_script_n_of_k())==null?void 0:T.native_scripts(),v)}}return v},y=l.native_scripts();return[...p(y)]},c=At(e);return new Set([...n(c.body()),...i(c.witness_set())])}}const lt="MARI0TIME";class Ae{_fetcher;_submitter;_wallet;constructor(e){switch(this._fetcher=e.fetcher,this._submitter=e.submitter,e.key.type){case"mnemonic":this._wallet=new rt(e.networkId,rt.encryptMnemonic(e.key.words,lt));break;case"root":this._wallet=new rt(e.networkId,rt.encryptPrivateKey(e.key.bech32,lt));break;case"cli":this._wallet=new rt(e.networkId,rt.encryptSigningKeys(e.key.payment,e.key.stake??"f0".repeat(34),lt))}}getBaseAddress(e=0,t=0){return this._wallet.getAccount(e,lt,t).baseAddress}getPaymentAddress(e=0,t=0){return this._wallet.getAccount(e,lt,t).enterpriseAddress}getRewardAddress(e=0,t=0){return this._wallet.getAccount(e,lt,t).rewardAddress}getUsedAddress(e=0,t=0){const r=this._wallet.getAccount(e,lt,t);return xt(r.enterpriseAddress)}getUsedCollateral(e=It.maxCollateralInputs){throw new Error("getUsedCollateral not implemented.")}async getUsedUTxOs(e=0){if(!this._fetcher)throw new Error("[AppWallet] Fetcher is required to fetch UTxOs. Please provide a fetcher.");const t=this._wallet.getAccount(e,lt);return(await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map(n=>pt(n))}signData(e,t,r=0,n=0){try{return this._wallet.signData(r,lt,e,t,n)}catch(i){throw new Error(`[AppWallet] An error occurred during signData: ${i}.`)}}async signTx(e,t=!1,r=0,n=0){try{if(!this._fetcher)throw new Error("[AppWallet] Fetcher is required to fetch UTxOs. Please provide a fetcher.");const i=this._wallet.getAccount(r,lt),c=await this._fetcher.fetchAddressUTxOs(i.enterpriseAddress),l=this._wallet.signTx(r,lt,c,e,t,n),p=At(e),y=p.witness_set(),B=ye(y,l);return y.set_vkeys(B),a.Transaction.new(p.body(),y,p.auxiliary_data()).to_hex()}catch(i){throw new Error(`[AppWallet] An error occurred during signTx: ${i}.`)}}signTxSync(e,t=!1,r=0,n=0){try{const i=this._wallet.signTx(r,lt,[],e,t,n);this._wallet.addPaymentKey(r,lt,e,i,n);const c=At(e),l=c.witness_set(),p=ye(l,i);return l.set_vkeys(p),a.Transaction.new(c.body(),l,c.auxiliary_data()).to_hex()}catch(i){throw new Error(`[AppWallet] An error occurred during signTx: ${i}.`)}}async signTxs(e,t){return console.log("unimplemented",e,t),[]}submitTx(e){if(!this._submitter)throw new Error("[AppWallet] Submitter is required to submit transactions. Please provide a submitter.");return this._submitter.submitTx(e)}static brew(e=256){return rt.generateMnemonic(e)}async getUtxos(){return await this.getUsedUTxOs()}async getCollateral(){return(await this.getUsedUTxOs())[0]}async getUsedAddresses(){return console.log(1,await this.getPaymentAddress()),[await this.getPaymentAddress()]}}class xe{_walletInstance;_walletName;walletInstance;constructor(e,t){this._walletInstance=e,this._walletName=t,this.walletInstance={...e}}static getInstalledWallets(){return window.cardano===void 0?[]:je.filter(e=>window.cardano[e]!==void 0).map(e=>({name:window.cardano[e].name,icon:window.cardano[e].icon,version:window.cardano[e].apiVersion}))}static async enable(e){try{const t=await xe.resolveInstance(e);if(t!==void 0)return new xe(t,e);throw new Error(`Couldn't create an instance of wallet: ${e}`)}catch(t){throw new Error(`[BrowserWallet] An error occurred during enable: ${JSON.stringify(t)}.`)}}async getBalance(){const e=await this._walletInstance.getBalance();return Kr(Hs(e))}async getChangeAddress(){const e=await this._walletInstance.getChangeAddress();return Gt(e).to_bech32()}async getCollateral(e=It.maxCollateralInputs){return(await this.getUsedCollateral(e)).map(r=>ae(r))}getNetworkId(){return this._walletInstance.getNetworkId()}async getRewardAddresses(){return(await this._walletInstance.getRewardAddresses()).map(t=>Gt(t).to_bech32())}async getUnusedAddresses(){return(await this._walletInstance.getUnusedAddresses()).map(t=>Gt(t).to_bech32())}async getUsedAddresses(){return(await this._walletInstance.getUsedAddresses()).map(t=>Gt(t).to_bech32())}async getUtxos(e=void 0){return(await this.getUsedUTxOs(e)).map(r=>ae(r))}signData(e,t){const r=xt(e).to_hex();return this._walletInstance.signData(r,ft(t))}async signTx(e,t=!1){try{const r=At(e),n=r.witness_set(),i=await this._walletInstance.signTx(e,t),c=fr(i).vkeys()??a.Vkeywitnesses.new(),l=ye(n,c);return n.set_vkeys(l),ht(a.Transaction.new(r.body(),n,r.auxiliary_data()).to_bytes())}catch(r){throw new Error(`[BrowserWallet] An error occurred during signTx: ${JSON.stringify(r)}.`)}}async signTxs(e,t=!1){let r;switch(this._walletName){case"Typhon Wallet":this._walletInstance.signTxs&&(r=await this._walletInstance.signTxs(e,t));break;default:this._walletInstance.signTxs?r=await this._walletInstance.signTxs(e.map(i=>({cbor:i,partialSign:t}))):this._walletInstance.experimental.signTxs&&(r=await this._walletInstance.experimental.signTxs(e.map(i=>({cbor:i,partialSign:t}))));break}if(!r)throw new Error("Wallet does not support signTxs");const n=[];for(let i=0;i<r.length;i++)if(!r[i])n.push(e[i]);else{const c=At(e[i]),l=c.witness_set(),p=fr(r[i]).vkeys()??a.Vkeywitnesses.new(),y=ye(l,p);l.set_vkeys(y);const B=ht(a.Transaction.new(c.body(),l,c.auxiliary_data()).to_bytes());n.push(B)}return n}submitTx(e){return this._walletInstance.submitTx(e)}async getUsedAddress(){const e=await this._walletInstance.getUsedAddresses();return Gt(e[0])}async getUsedCollateral(e=It.maxCollateralInputs){return(await this._walletInstance.experimental.getCollateral()??[]).map(r=>dr(r)).slice(0,e)}async getUsedUTxOs(e=void 0){const t=e?St(e).to_hex():void 0;return(await this._walletInstance.getUtxos(t)??[]).map(n=>dr(n))}async getAssets(){return(await this.getBalance()).filter(t=>t.unit!=="lovelace").map(t=>{const r=t.unit.slice(0,dt),n=t.unit.slice(dt),i=Ye(r,n);return{unit:t.unit,policyId:r,assetName:Ge(n),fingerprint:i,quantity:t.quantity}})}async getLovelace(){const t=(await this.getBalance()).find(r=>r.unit==="lovelace");return t!==void 0?t.quantity:"0"}async getPolicyIdAssets(e){return(await this.getAssets()).filter(r=>r.policyId===e)}async getPolicyIds(){const e=await this.getBalance();return Array.from(new Set(e.map(t=>t.unit.slice(0,dt)))).filter(t=>t!=="lovelace")}static resolveInstance(e){if(window.cardano===void 0)return;const t=je.map(r=>window.cardano[r]).filter(r=>r!==void 0).find(r=>r.name.toLowerCase()===e.toLowerCase());return t==null?void 0:t.enable()}}class _n{_wallet;_network;constructor(e){switch(this._network=e.networkId,e.key.type){case"root":this._wallet=new Ae({networkId:e.networkId,fetcher:e.fetcher,submitter:e.submitter,key:{type:"root",bech32:e.key.bech32}});break;case"cli":this._wallet=new Ae({networkId:e.networkId,fetcher:e.fetcher,submitter:e.submitter,key:{type:"cli",payment:e.key.payment}});break;case"mnemonic":this._wallet=new Ae({networkId:e.networkId,fetcher:e.fetcher,submitter:e.submitter,key:{type:"mnemonic",words:e.key.words}});break}}async getBalance(){const e=await this.getUtxos(),t=new Map;return e.map(n=>{n.output.amount.map(i=>{const c=i.unit,l=Number(i.quantity);if(t.has(c)){const p=t.get(c);t.set(c,p+l)}else t.set(c,l)})}),Array.from(t,([n,i])=>({unit:n,quantity:i.toString()}))}getChangeAddress(){return this._wallet.getPaymentAddress()}async getCollateral(){const t=(await this.getUtxos()).filter(r=>r.output.amount.length===1&&r.output.amount[0].unit==="lovelace");t.sort((r,n)=>Number(r.output.amount[0].quantity)-Number(n.output.amount[0].quantity));for(const r of t)if(Number(r.output.amount[0].quantity)>=5e6)return[r];return[]}getNetworkId(){return this._network}async getRewardAddresses(){return[await this._wallet.getRewardAddress()]}getUnusedAddresses(){return[this.getChangeAddress()]}async getUsedAddresses(){return[this.getChangeAddress()]}async getUtxos(){return(await this.getUsedUTxOs()).map(t=>ae(t))}signData(e){return this._wallet.signData(this.getChangeAddress(),e)}async signTx(e,t=!1){return await this._wallet.signTx(e,t)}async signTxs(e,t=!1){const r=[];for(const n of e){const i=await this.signTx(n,t);r.push(i)}return r}async submitTx(e){return await this._wallet.submitTx(e)}getUsedAddress(){return this._wallet.getUsedAddress()}async getUsedCollateral(){return(await this.getCollateral()).map(r=>pt(r))}async getUsedUTxOs(){return await this._wallet.getUtxos()}async getAssets(){return(await this.getBalance()).filter(t=>t.unit!=="lovelace").map(t=>{const r=t.unit.slice(0,dt),n=t.unit.slice(dt),i=Ye(r,n);return{unit:t.unit,policyId:r,assetName:Ge(n),fingerprint:i,quantity:t.quantity}})}async getLovelace(){const t=(await this.getBalance()).find(r=>r.unit==="lovelace");return t!==void 0?t.quantity:"0"}async getPolicyIdAssets(e){return(await this.getAssets()).filter(r=>r.policyId===e)}async getPolicyIds(){const e=await this.getBalance();return Array.from(new Set(e.map(t=>t.unit.slice(0,dt)))).filter(t=>t!=="lovelace")}async createCollateral(){const t=await new exports.Transaction({initiator:this._wallet}).sendLovelace(this.getChangeAddress(),"5000000").build(),r=await this.signTx(t);return await this.submitTx(r)}static brew(e=!1,t=256){const r=rt.generateMnemonic(t);return e?Fr(r):r}}exports.AppWallet=Ae;exports.BlockfrostProvider=rn;exports.BrowserWallet=xe;exports.EmbeddedWallet=rt;exports.ForgeScript=un;exports.InfuraProvider=sn;exports.KoiosProvider=nn;exports.MaestroProvider=on;exports.MeshTxBuilder=In;exports.MeshWallet=_n;exports.OgmiosProvider=an;exports.YaciProvider=cn;exports.checkSignature=os;exports.generateNonce=Zs;exports.isNetwork=yr;exports.keepRelevant=xr;exports.largestFirst=ts;exports.largestFirstMultiAsset=wr;exports.mergeAssets=zr;exports.parseAssetUnit=Tt;exports.parseHttpError=S;exports.readPlutusData=tn;exports.readTransaction=en;exports.resolveDataHash=qs;exports.resolveEpochNo=Vs;exports.resolveFingerprint=Ye;exports.resolveLanguageView=Ls;exports.resolveNativeScriptAddress=Gs;exports.resolveNativeScriptHash=Ys;exports.resolveNativeScriptHex=$s;exports.resolvePaymentKeyHash=qt;exports.resolvePlutusScriptAddress=zs;exports.resolvePlutusScriptHash=Ws;exports.resolvePoolId=Js;exports.resolvePrivateKey=Fr;exports.resolveRewardAddress=oe;exports.resolveScriptRef=js;exports.resolveSlotNo=Xs;exports.resolveStakeKeyHash=$t;exports.resolveTxFees=$e;exports.resolveTxHash=Me;
|