@revibase/core 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import {getStructCodec,getU8Codec,getArrayCodec,getAddressCodec,address,fixEncoderSize,getBytesEncoder,transformEncoder,getStructEncoder,getAddressEncoder,getU8Encoder,getStructDecoder,fixDecoderSize,getAddressDecoder,getU8Decoder,getBytesDecoder,combineCodec,decodeAccount,assertAccountExists,fetchEncodedAccount,assertAccountsExist,fetchEncodedAccounts,getU128Encoder,getU128Decoder,getEnumEncoder,getEnumDecoder,addEncoderSizePrefix,getU32Encoder,addDecoderSizePrefix,getU32Decoder,getU64Encoder,getU64Decoder,getU16Encoder,getOptionEncoder,getArrayEncoder,getU16Decoder,getOptionDecoder,getArrayDecoder,getBooleanEncoder,getBooleanDecoder,getDiscriminatedUnionEncoder,getTupleEncoder,getDiscriminatedUnionDecoder,getTupleDecoder,getUnitEncoder,getUnitDecoder,getUtf8Encoder,getUtf8Decoder,getProgramDerivedAddress,containsBytes,isProgramError,getBase58Encoder,getBase58Decoder,getBase64Encoder,getBase64Decoder,getTransactionEncoder,createDecoder,createEncoder,AccountRole,some,none,upgradeRoleToSigner,fetchAddressesForLookupTables,isTransactionSigner}from'@solana/kit';import {sha256}from'@noble/hashes/sha2.js';import d from'zod';import {createRpc,TreeType,getLightSystemAccountMetasV2,selectStateTreeInfo}from'@lightprotocol/stateless.js';import {createSolanaRpc}from'@solana/rpc';import {decodeCBOR,encodeCBOR}from'@levischuck/tiny-cbor';import {p256}from'@noble/curves/nist.js';import {canonicalize}from'json-canonicalize';import {getTransferSolInstruction}from'@solana-program/system';import {PublicKey}from'@solana/web3.js';import {findAssociatedTokenPda,getTokenDecoder}from'@solana-program/token';var Br=new Uint8Array([201,232,212,229,59,241,106,197]);function X1(){return fixEncoderSize(getBytesEncoder(),8).encode(Br)}function Ri(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["authority",getAddressEncoder()],["rpIdHash",fixEncoderSize(getBytesEncoder(),32)],["bump",getU8Encoder()],["isDisabled",getU8Encoder()],["rpIdLength",getU8Encoder()],["numOrigins",getU8Encoder()],["rpId",fixEncoderSize(getBytesEncoder(),255)],["origins",fixEncoderSize(getBytesEncoder(),515)]]),e=>({...e,discriminator:Br}))}function Nr(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["authority",getAddressDecoder()],["rpIdHash",fixDecoderSize(getBytesDecoder(),32)],["bump",getU8Decoder()],["isDisabled",getU8Decoder()],["rpIdLength",getU8Decoder()],["numOrigins",getU8Decoder()],["rpId",fixDecoderSize(getBytesDecoder(),255)],["origins",fixDecoderSize(getBytesDecoder(),515)]])}function $1(){return combineCodec(Ri(),Nr())}function wr(e){return decodeAccount(e,Nr())}async function Fr(e,r,t){let o=await Pi(e,r,t);return assertAccountExists(o),o}async function Pi(e,r,t){let o=await fetchEncodedAccount(e,r,t);return wr(o)}async function Q1(e,r,t){let o=await _i(e,r,t);return assertAccountsExist(o),o}async function _i(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>wr(n))}function eS(){return 846}var Hr=new Uint8Array([42,206,176,58,175,129,130,233]);function rS(){return fixEncoderSize(getBytesEncoder(),8).encode(Hr)}function Hi(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["index",getU128Encoder()]]),e=>({...e,discriminator:Hr}))}function zr(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["index",getU128Decoder()]])}function oS(){return combineCodec(Hi(),zr())}function Kr(e){return decodeAccount(e,zr())}async function sS(e,r,t){let o=await zi(e,r,t);return assertAccountExists(o),o}async function zi(e,r,t){let o=await fetchEncodedAccount(e,r,t);return Kr(o)}async function cS(e,r,t){let o=await Ki(e,r,t);return assertAccountsExist(o),o}async function Ki(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>Kr(n))}function aS(){return 24}var kt=(t=>(t[t.Initialized=0]="Initialized",t[t.Frozen=1]="Frozen",t))(kt||{});function Lt(){return getEnumEncoder(kt)}function Ot(){return getEnumDecoder(kt)}function dS(){return combineCodec(Lt(),Ot())}function Wt(){return getStructEncoder([["key",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["value",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]])}function Bt(){return getStructDecoder([["key",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["value",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function lS(){return combineCodec(Wt(),Bt())}function Nt(){return getStructEncoder([["memberKey",h()],["permissions",Ae()]])}function wt(){return getStructDecoder([["memberKey",k()],["permissions",ge()]])}function TS(){return combineCodec(Nt(),wt())}function Ft(){return getStructEncoder([["programAddressIndex",getU8Encoder()],["accountIndices",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["data",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]])}function Gt(){return getStructDecoder([["programAddressIndex",getU8Decoder()],["accountIndices",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["data",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function xS(){return combineCodec(Ft(),Gt())}function Vt(){return getStructEncoder([["delegatedAmount",getU64Encoder()],["withheldTransferFee",getU64Encoder()],["isAta",getU8Encoder()]])}function Ht(){return getStructDecoder([["delegatedAmount",getU64Decoder()],["withheldTransferFee",getU64Decoder()],["isAta",getU8Decoder()]])}function DS(){return combineCodec(Vt(),Ht())}function Yt(){return getStructEncoder([["a",fixEncoderSize(getBytesEncoder(),32)],["b",fixEncoderSize(getBytesEncoder(),64)],["c",fixEncoderSize(getBytesEncoder(),32)]])}function Jt(){return getStructDecoder([["a",fixDecoderSize(getBytesDecoder(),32)],["b",fixDecoderSize(getBytesDecoder(),64)],["c",fixDecoderSize(getBytesDecoder(),32)]])}function MS(){return combineCodec(Yt(),Jt())}function Zt(){return getStructEncoder([["version",getU8Encoder()],["rootIndex",getU16Encoder()],["amount",getU64Encoder()],["merkleContext",Qt()],["tlv",getOptionEncoder(getArrayEncoder($t()))],["state",Lt()]])}function Xt(){return getStructDecoder([["version",getU8Decoder()],["rootIndex",getU16Decoder()],["amount",getU64Decoder()],["merkleContext",en()],["tlv",getOptionDecoder(getArrayDecoder(We()))],["state",Ot()]])}function hS(){return combineCodec(Zt(),Xt())}function rn(){return getStructEncoder([["decimalsOption",getU8Encoder()],["decimals",getU8Encoder()],["compressionOnly",getBooleanEncoder()],["isAta",getU8Encoder()],["info",sn()]])}function on(){return getStructDecoder([["decimalsOption",getU8Decoder()],["decimals",getU8Decoder()],["compressionOnly",getBooleanDecoder()],["isAta",getU8Decoder()],["info",cn()]])}function LS(){return combineCodec(rn(),on())}function sn(){return getStructEncoder([["configAccountVersion",getU16Encoder()],["compressToPubkey",getU8Encoder()],["accountVersion",getU8Encoder()],["lamportsPerWrite",getU32Encoder()],["compressionAuthority",fixEncoderSize(getBytesEncoder(),32)],["rentSponsor",fixEncoderSize(getBytesEncoder(),32)],["lastClaimedSlot",getU64Encoder()],["rentExemptionPaid",getU32Encoder()],["reserved",getU32Encoder()],["rentConfig",dn()]])}function cn(){return getStructDecoder([["configAccountVersion",getU16Decoder()],["compressToPubkey",getU8Decoder()],["accountVersion",getU8Decoder()],["lamportsPerWrite",getU32Decoder()],["compressionAuthority",fixDecoderSize(getBytesDecoder(),32)],["rentSponsor",fixDecoderSize(getBytesDecoder(),32)],["lastClaimedSlot",getU64Decoder()],["rentExemptionPaid",getU32Decoder()],["reserved",getU32Decoder()],["rentConfig",An()]])}function NS(){return combineCodec(sn(),cn())}function Be(){return getDiscriminatedUnionEncoder([["EditPermissions",getStructEncoder([["fields",getTupleEncoder([getArrayEncoder(pn())])]])],["AddMembers",getStructEncoder([["fields",getTupleEncoder([getArrayEncoder(Nt())])]])],["RemoveMembers",getStructEncoder([["fields",getTupleEncoder([getArrayEncoder(yn())])]])],["SetThreshold",getStructEncoder([["fields",getTupleEncoder([getU8Encoder()])]])]])}function Ne(){return getDiscriminatedUnionDecoder([["EditPermissions",getStructDecoder([["fields",getTupleDecoder([getArrayDecoder(mn())])]])],["AddMembers",getStructDecoder([["fields",getTupleDecoder([getArrayDecoder(wt())])]])],["RemoveMembers",getStructDecoder([["fields",getTupleDecoder([getArrayDecoder(Tn())])]])],["SetThreshold",getStructDecoder([["fields",getTupleDecoder([getU8Decoder()])]])]])}function VS(){return combineCodec(Be(),Ne())}function HS(e,r){return Array.isArray(r)?{__kind:e,fields:r}:{__kind:e,...r??{}}}function zS(e,r){return r.__kind===e}function pn(){return getStructEncoder([["memberKey",h()],["permissions",Ae()]])}function mn(){return getStructDecoder([["memberKey",k()],["permissions",ge()]])}function YS(){return combineCodec(pn(),mn())}function we(){return getStructEncoder([["memberKey",h()],["messageHash",getOptionEncoder(fixEncoderSize(getBytesEncoder(),32))]])}function Fe(){return getStructDecoder([["memberKey",k()],["messageHash",getOptionDecoder(fixDecoderSize(getBytesDecoder(),32))]])}function $S(){return combineCodec(we(),Fe())}function $t(){return getDiscriminatedUnionEncoder([["Placeholder0",getUnitEncoder()],["Placeholder1",getUnitEncoder()],["Placeholder2",getUnitEncoder()],["Placeholder3",getUnitEncoder()],["Placeholder4",getUnitEncoder()],["Placeholder5",getUnitEncoder()],["Placeholder6",getUnitEncoder()],["Placeholder7",getUnitEncoder()],["Placeholder8",getUnitEncoder()],["Placeholder9",getUnitEncoder()],["Placeholder10",getUnitEncoder()],["Placeholder11",getUnitEncoder()],["Placeholder12",getUnitEncoder()],["Placeholder13",getUnitEncoder()],["Placeholder14",getUnitEncoder()],["Placeholder15",getUnitEncoder()],["Placeholder16",getUnitEncoder()],["Placeholder17",getUnitEncoder()],["Placeholder18",getUnitEncoder()],["TokenMetadata",getStructEncoder([["fields",getTupleEncoder([En()])]])],["Placeholder20",getUnitEncoder()],["Placeholder21",getUnitEncoder()],["Placeholder22",getUnitEncoder()],["Placeholder23",getUnitEncoder()],["Placeholder24",getUnitEncoder()],["Placeholder25",getUnitEncoder()],["Placeholder26",getUnitEncoder()],["PausableAccount",getStructEncoder([["fields",getTupleEncoder([fn()])]])],["PermanentDelegateAccount",getStructEncoder([["fields",getTupleEncoder([xn()])]])],["TransferFeeAccount",getStructEncoder([["fields",getTupleEncoder([bn()])]])],["TransferHookAccount",getStructEncoder([["fields",getTupleEncoder([Mn()])]])],["CompressedOnly",getStructEncoder([["fields",getTupleEncoder([Vt()])]])],["Compressible",getStructEncoder([["fields",getTupleEncoder([rn()])]])]])}function We(){return getDiscriminatedUnionDecoder([["Placeholder0",getUnitDecoder()],["Placeholder1",getUnitDecoder()],["Placeholder2",getUnitDecoder()],["Placeholder3",getUnitDecoder()],["Placeholder4",getUnitDecoder()],["Placeholder5",getUnitDecoder()],["Placeholder6",getUnitDecoder()],["Placeholder7",getUnitDecoder()],["Placeholder8",getUnitDecoder()],["Placeholder9",getUnitDecoder()],["Placeholder10",getUnitDecoder()],["Placeholder11",getUnitDecoder()],["Placeholder12",getUnitDecoder()],["Placeholder13",getUnitDecoder()],["Placeholder14",getUnitDecoder()],["Placeholder15",getUnitDecoder()],["Placeholder16",getUnitDecoder()],["Placeholder17",getUnitDecoder()],["Placeholder18",getUnitDecoder()],["TokenMetadata",getStructDecoder([["fields",getTupleDecoder([Dn()])]])],["Placeholder20",getUnitDecoder()],["Placeholder21",getUnitDecoder()],["Placeholder22",getUnitDecoder()],["Placeholder23",getUnitDecoder()],["Placeholder24",getUnitDecoder()],["Placeholder25",getUnitDecoder()],["Placeholder26",getUnitDecoder()],["PausableAccount",getStructDecoder([["fields",getTupleDecoder([Sn()])]])],["PermanentDelegateAccount",getStructDecoder([["fields",getTupleDecoder([In()])]])],["TransferFeeAccount",getStructDecoder([["fields",getTupleDecoder([Cn()])]])],["TransferHookAccount",getStructDecoder([["fields",getTupleDecoder([Rn()])]])],["CompressedOnly",getStructDecoder([["fields",getTupleDecoder([Ht()])]])],["Compressible",getStructDecoder([["fields",getTupleDecoder([on()])]])]])}function nx(){return combineCodec($t(),We())}function rx(e,r){return Array.isArray(r)?{__kind:e,fields:r}:{__kind:e,...r??{}}}function ox(e,r){return r.__kind===e}function hn(){return getStructEncoder([["pubkey",h()],["role",getU8Encoder()],["permissions",Ae()],["padding",getU8Encoder()],["isDelegate",getU8Encoder()]])}function Un(){return getStructDecoder([["pubkey",k()],["role",getU8Decoder()],["permissions",ge()],["padding",getU8Decoder()],["isDelegate",getU8Decoder()]])}function ix(){return combineCodec(hn(),Un())}function h(){return getStructEncoder([["keyType",getU8Encoder()],["key",fixEncoderSize(getBytesEncoder(),33)]])}function k(){return getStructDecoder([["keyType",getU8Decoder()],["key",fixDecoderSize(getBytesDecoder(),33)]])}function Ax(){return combineCodec(h(),k())}function Qt(){return getStructEncoder([["merkleTreePubkeyIndex",getU8Encoder()],["queuePubkeyIndex",getU8Encoder()],["leafIndex",getU32Encoder()],["proveByIndex",getBooleanEncoder()]])}function en(){return getStructDecoder([["merkleTreePubkeyIndex",getU8Decoder()],["queuePubkeyIndex",getU8Decoder()],["leafIndex",getU32Decoder()],["proveByIndex",getBooleanDecoder()]])}function px(){return combineCodec(Qt(),en())}function fn(){return getStructEncoder([])}function Sn(){return getStructDecoder([])}function Tx(){return combineCodec(fn(),Sn())}function xn(){return getStructEncoder([])}function In(){return getStructDecoder([])}function xx(){return combineCodec(xn(),In())}function Ae(){return getStructEncoder([["mask",getU8Encoder()]])}function ge(){return getStructDecoder([["mask",getU8Decoder()]])}function Dx(){return combineCodec(Ae(),ge())}function vn(){return getStructEncoder([["proof",getOptionEncoder(Yt())],["lightCpiAccountsStartIndex",getU8Encoder()]])}function kn(){return getStructDecoder([["proof",getOptionDecoder(Jt())],["lightCpiAccountsStartIndex",getU8Decoder()]])}function Rx(){return combineCodec(vn(),kn())}function yn(){return getStructEncoder([["memberKey",h()]])}function Tn(){return getStructDecoder([["memberKey",k()]])}function Ux(){return combineCodec(yn(),Tn())}function dn(){return getStructEncoder([["baseRent",getU16Encoder()],["compressionCost",getU16Encoder()],["lamportsPerBytePerEpoch",getU8Encoder()],["maxFundedEpochs",getU8Encoder()],["maxTopUp",getU16Encoder()]])}function An(){return getStructDecoder([["baseRent",getU16Decoder()],["compressionCost",getU16Decoder()],["lamportsPerBytePerEpoch",getU8Decoder()],["maxFundedEpochs",getU8Decoder()],["maxTopUp",getU16Decoder()]])}function Lx(){return combineCodec(dn(),An())}function Wn(){return getTupleEncoder([fixEncoderSize(getBytesEncoder(),33)])}function Ge(){return getTupleDecoder([fixDecoderSize(getBytesDecoder(),33)])}function Bx(){return combineCodec(Wn(),Ge())}function w(){return getStructEncoder([["signedMessageIndex",getU8Encoder()],["slotNumber",getU64Encoder()],["originIndex",getU8Encoder()],["crossOrigin",getBooleanEncoder()],["truncatedClientDataJson",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["clientAndDeviceHash",fixEncoderSize(getBytesEncoder(),32)]])}function F(){return getStructDecoder([["signedMessageIndex",getU8Decoder()],["slotNumber",getU64Decoder()],["originIndex",getU8Decoder()],["crossOrigin",getBooleanDecoder()],["truncatedClientDataJson",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["clientAndDeviceHash",fixDecoderSize(getBytesDecoder(),32)]])}function Fx(){return combineCodec(w(),F())}function Bn(){return getStructEncoder([["verifyArgs",w()],["domainConfigIndex",getU8Encoder()]])}function Nn(){return getStructDecoder([["verifyArgs",F()],["domainConfigIndex",getU8Decoder()]])}function zx(){return combineCodec(Bn(),Nn())}function wn(){return getStructEncoder([["index",getU128Encoder()],["isDelegate",getBooleanEncoder()]])}function Fn(){return getStructDecoder([["index",getU128Decoder()],["isDelegate",getBooleanDecoder()]])}function jx(){return combineCodec(wn(),Fn())}function Gn(){return getStructEncoder([["index",getU8Encoder()],["restricted",getBooleanEncoder()]])}function Vn(){return getStructDecoder([["index",getU8Decoder()],["restricted",getBooleanDecoder()]])}function Zx(){return combineCodec(Gn(),Vn())}function En(){return getStructEncoder([["updateAuthority",getAddressEncoder()],["mint",getAddressEncoder()],["name",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["symbol",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["uri",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["additionalMetadata",getArrayEncoder(Wt())]])}function Dn(){return getStructDecoder([["updateAuthority",getAddressDecoder()],["mint",getAddressDecoder()],["name",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["symbol",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["uri",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["additionalMetadata",getArrayDecoder(Bt())]])}function eI(){return combineCodec(En(),Dn())}function Jn(){return getStructEncoder([["lookupTableAddressIndex",getU8Encoder()],["writableIndexes",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["readonlyIndexes",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]])}function Zn(){return getStructDecoder([["lookupTableAddressIndex",getU8Decoder()],["writableIndexes",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["readonlyIndexes",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function rI(){return combineCodec(Jn(),Zn())}function $(){return getDiscriminatedUnionEncoder([["Ed25519",getStructEncoder([["fields",getTupleEncoder([getU8Encoder()])]])],["Secp256r1",getStructEncoder([["fields",getTupleEncoder([Bn()])]])]])}function Q(){return getDiscriminatedUnionDecoder([["Ed25519",getStructDecoder([["fields",getTupleDecoder([getU8Decoder()])]])],["Secp256r1",getStructDecoder([["fields",getTupleDecoder([Nn()])]])]])}function aI(){return combineCodec($(),Q())}function iI(e,r){return Array.isArray(r)?{__kind:e,fields:r}:{__kind:e,...r??{}}}function uI(e,r){return r.__kind===e}function bn(){return getStructEncoder([["withheldAmount",getU64Encoder()]])}function Cn(){return getStructDecoder([["withheldAmount",getU64Decoder()]])}function gI(){return combineCodec(bn(),Cn())}function Mn(){return getStructEncoder([["transferring",getU8Encoder()]])}function Rn(){return getStructDecoder([["transferring",getU8Decoder()]])}function mI(){return combineCodec(Mn(),Rn())}var Xn=(a=>(a[a.Ble=0]="Ble",a[a.Cable=1]="Cable",a[a.Hybrid=2]="Hybrid",a[a.Internal=3]="Internal",a[a.Nfc=4]="Nfc",a[a.SmartCard=5]="SmartCard",a[a.Usb=6]="Usb",a))(Xn||{});function Ve(){return getEnumEncoder(Xn)}function He(){return getEnumDecoder(Xn)}function fI(){return combineCodec(Ve(),He())}var be=(n=>(n[n.TransactionManager=0]="TransactionManager",n[n.Administrator=1]="Administrator",n[n.PermanentMember=2]="PermanentMember",n[n.Member=3]="Member",n))(be||{});function Te(){return getEnumEncoder(be)}function fe(){return getEnumDecoder(be)}function II(){return combineCodec(Te(),fe())}var Oo=new Uint8Array([223,179,163,190,177,224,67,173]);function cE(){return fixEncoderSize(getBytesEncoder(),8).encode(Oo)}function Rg(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["index",getU128Encoder()],["members",getArrayEncoder(hn())],["threshold",getU8Encoder()],["multiWalletBump",getU8Encoder()],["bump",getU8Encoder()],["padding",getU8Encoder()],["latestSlotNumber",getU64Encoder()]]),e=>({...e,discriminator:Oo}))}function ut(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["index",getU128Decoder()],["members",getArrayDecoder(Un())],["threshold",getU8Decoder()],["multiWalletBump",getU8Decoder()],["bump",getU8Decoder()],["padding",getU8Decoder()],["latestSlotNumber",getU64Decoder()]])}function aE(){return combineCodec(Rg(),ut())}function Wo(e){return decodeAccount(e,ut())}async function Bo(e,r,t){let o=await Pg(e,r,t);return assertAccountExists(o),o}async function Pg(e,r,t){let o=await fetchEncodedAccount(e,r,t);return Wo(o)}async function iE(e,r,t){let o=await _g(e,r,t);return assertAccountsExist(o),o}async function _g(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>Wo(n))}var Vo=new Uint8Array([90,36,35,219,93,225,110,96]);function gE(){return fixEncoderSize(getBytesEncoder(),8).encode(Vo)}function jg(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["multiWalletSettings",getAddressEncoder()],["multiWalletBump",getU8Encoder()],["canExecute",getBooleanEncoder()],["preauthorizeExecution",getBooleanEncoder()],["validTill",getU64Encoder()],["payer",getAddressEncoder()],["bump",getU8Encoder()],["bufferIndex",getU8Encoder()],["finalBufferHash",fixEncoderSize(getBytesEncoder(),32)],["finalBufferSize",getU16Encoder()],["creator",h()],["executor",h()],["bufferExtendHashes",getArrayEncoder(fixEncoderSize(getBytesEncoder(),32))],["voters",getArrayEncoder(h())],["expectedSigners",getArrayEncoder(we())],["buffer",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]]),e=>({...e,discriminator:Vo}))}function Ho(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["multiWalletSettings",getAddressDecoder()],["multiWalletBump",getU8Decoder()],["canExecute",getBooleanDecoder()],["preauthorizeExecution",getBooleanDecoder()],["validTill",getU64Decoder()],["payer",getAddressDecoder()],["bump",getU8Decoder()],["bufferIndex",getU8Decoder()],["finalBufferHash",fixDecoderSize(getBytesDecoder(),32)],["finalBufferSize",getU16Decoder()],["creator",k()],["executor",k()],["bufferExtendHashes",getArrayDecoder(fixDecoderSize(getBytesDecoder(),32))],["voters",getArrayDecoder(k())],["expectedSigners",getArrayDecoder(Fe())],["buffer",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function lE(){return combineCodec(jg(),Ho())}function zo(e){return decodeAccount(e,Ho())}async function pE(e,r,t){let o=await Yg(e,r,t);return assertAccountExists(o),o}async function Yg(e,r,t){let o=await fetchEncodedAccount(e,r,t);return zo(o)}async function mE(e,r,t){let o=await Jg(e,r,t);return assertAccountsExist(o),o}async function Jg(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>zo(n))}var Qo=new Uint8Array([159,117,95,227,239,151,58,236]);function SE(){return fixEncoderSize(getBytesEncoder(),8).encode(Qo)}function gl(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["domainConfig",getOptionEncoder(getAddressEncoder())],["member",h()],["credentialId",getOptionEncoder(addEncoderSizePrefix(getBytesEncoder(),getU32Encoder()))],["transports",getOptionEncoder(getArrayEncoder(Ve()))],["wallets",getArrayEncoder(wn())],["role",Te()],["transactionManagerUrl",getOptionEncoder(addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder()))],["bump",getU8Encoder()]]),e=>({...e,discriminator:Qo}))}function pt(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["domainConfig",getOptionDecoder(getAddressDecoder())],["member",k()],["credentialId",getOptionDecoder(addDecoderSizePrefix(getBytesDecoder(),getU32Decoder()))],["transports",getOptionDecoder(getArrayDecoder(He()))],["wallets",getArrayDecoder(Fn())],["role",fe()],["transactionManagerUrl",getOptionDecoder(addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder()))],["bump",getU8Decoder()]])}function xE(){return combineCodec(gl(),pt())}function es(e){return decodeAccount(e,pt())}async function ts(e,r,t){let o=await ll(e,r,t);return assertAccountExists(o),o}async function ll(e,r,t){let o=await fetchEncodedAccount(e,r,t);return es(o)}async function IE(e,r,t){let o=await pl(e,r,t);return assertAccountsExist(o),o}async function pl(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>es(n))}function y({args:e}){if(!e)return [];let{remainingAccounts:r}=e;return r.map(t=>t.signer?{address:t.address,role:t.role,signer:t.signer}:{address:t.address,role:t.role})}function rs(e){if(e==null)throw new Error("Expected a value but received null or undefined.");return e}function P(e){if(!e)throw new Error("Expected a Address.");return typeof e=="object"&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function T(e,r){return t=>{if(!t.value)return Object.freeze({address:e,role:AccountRole.READONLY});let o=t.isWritable?AccountRole.WRITABLE:AccountRole.READONLY;return Object.freeze({address:P(t.value),role:ns(t.value)?upgradeRoleToSigner(o):o,...ns(t.value)?{signer:t.value}:{}})}}function ns(e){return !!e&&typeof e=="object"&&"address"in e&&isTransactionSigner(e)}var is=new Uint8Array([8]);function wE(){return fixEncoderSize(getBytesEncoder(),1).encode(is)}function us(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["configActions",getArrayEncoder(Be())],["signers",getArrayEncoder($())]]),e=>({...e,discriminator:is}))}function ds(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["configActions",getArrayDecoder(Ne())],["signers",getArrayDecoder(Q())]])}function FE(){return combineCodec(us(),ds())}function As(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.systemProgram),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:us().encode(c),programAddress:t})}function GE(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),systemProgram:t(),slotHashSysvar:o(),instructionsSysvar:t()},data:ds().decode(e.data)}}var Ss=new Uint8Array([0]);function jE(){return fixEncoderSize(getBytesEncoder(),1).encode(Ss)}function cr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["rpId",addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder())],["origins",getArrayEncoder(addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder()))]]),e=>({...e,discriminator:Ss}))}function xs(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["rpId",addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder())],["origins",getArrayDecoder(addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder()))]])}function YE(){return combineCodec(cr(),xs())}async function JE(e,r){let t=r?.programAddress??A,n={domainConfig:{value:e.domainConfig??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},authority:{value:e.authority??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.userAccount.value||(n.userAccount.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([117,115,101,114])),getAddressEncoder().encode(P(n.authority.value))]}));let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.domainConfig),s(n.payer),s(n.authority),s(n.systemProgram),s(n.userAccount),...a],data:cr().encode(c),programAddress:t})}function Is(e,r){let t=r?.programAddress??A,n={domainConfig:{value:e.domainConfig??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},authority:{value:e.authority??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.domainConfig),s(n.payer),s(n.authority),s(n.systemProgram),s(n.userAccount),...a],data:cr().encode(c),programAddress:t})}function ZE(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{domainConfig:t(),payer:t(),authority:t(),systemProgram:t(),userAccount:t()},data:xs().decode(e.data)}}var bs=new Uint8Array([4]);function rD(){return fixEncoderSize(getBytesEncoder(),1).encode(bs)}function Cs(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["member",Wn()],["role",Te()],["credentialId",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["transports",getArrayEncoder(Ve())]]),e=>({...e,discriminator:bs}))}function Ms(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["member",Ge()],["role",fe()],["credentialId",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["transports",getArrayDecoder(He())]])}function oD(){return combineCodec(Cs(),Ms())}function Rs(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},domainConfig:{value:e.domainConfig??null,isWritable:false},authority:{value:e.authority??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true},transactionManagerAccount:{value:e.transactionManagerAccount??null,isWritable:false},settings:{value:e.settings??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.domainConfig),s(n.authority),s(n.userAccount),s(n.transactionManagerAccount),s(n.settings),s(n.systemProgram),...a],data:Cs().encode(c),programAddress:t})}function sD(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{payer:t(),domainConfig:t(),authority:t(),userAccount:t(),transactionManagerAccount:o(),settings:o(),systemProgram:t()},data:Ms().decode(e.data)}}var _s=new Uint8Array([3]);function AD(){return fixEncoderSize(getBytesEncoder(),1).encode(_s)}function ur(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)]]),e=>({...e,discriminator:_s}))}function hs(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)]])}function gD(){return combineCodec(ur(),hs())}async function Us(e,r){let t=r?.programAddress??A,n={globalCounter:{value:e.globalCounter??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={};n.globalCounter.value||(n.globalCounter.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([103,108,111,98,97,108,95,99,111,117,110,116,101,114]))]})),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let i=y(c),a=T(t);return Object.freeze({accounts:[a(n.globalCounter),a(n.payer),a(n.systemProgram),...i],data:ur().encode({}),programAddress:t})}function lD(e,r){let t=r?.programAddress??A,n={globalCounter:{value:e.globalCounter??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let i=y(c),a=T(t);return Object.freeze({accounts:[a(n.globalCounter),a(n.payer),a(n.systemProgram),...i],data:ur().encode({}),programAddress:t})}function pD(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{globalCounter:t(),payer:t(),systemProgram:t()},data:hs().decode(e.data)}}var ks=new Uint8Array([5]);function ID(){return fixEncoderSize(getBytesEncoder(),1).encode(ks)}function Ar(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["role",Te()],["transactionManagerUrl",getOptionEncoder(addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder()))]]),e=>({...e,discriminator:ks}))}function Ls(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["role",fe()],["transactionManagerUrl",getOptionDecoder(addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder()))]])}function ED(){return combineCodec(Ar(),Ls())}async function DD(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},member:{value:e.member??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.userAccount.value||(n.userAccount.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([117,115,101,114])),getAddressEncoder().encode(P(n.member.value))]}));let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.member),s(n.systemProgram),s(n.userAccount),...a],data:Ar().encode(c),programAddress:t})}function Os(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},member:{value:e.member??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.member),s(n.systemProgram),s(n.userAccount),...a],data:Ar().encode(c),programAddress:t})}function bD(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{payer:t(),member:t(),systemProgram:t(),userAccount:t()},data:Ls().decode(e.data)}}var Ns=new Uint8Array([16]);function hD(){return fixEncoderSize(getBytesEncoder(),1).encode(Ns)}function lr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["settingsIndex",getU128Encoder()]]),e=>({...e,discriminator:Ns}))}function ws(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["settingsIndex",getU128Decoder()]])}function UD(){return combineCodec(lr(),ws())}async function vD(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},initialMember:{value:e.initialMember??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},globalCounter:{value:e.globalCounter??null,isWritable:true},userAccount:{value:e.userAccount??null,isWritable:true},settings:{value:e.settings??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.globalCounter.value||(n.globalCounter.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([103,108,111,98,97,108,95,99,111,117,110,116,101,114]))]})),n.userAccount.value||(n.userAccount.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([117,115,101,114])),getAddressEncoder().encode(P(n.initialMember.value))]})),n.settings.value||(n.settings.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([109,117,108,116,105,95,119,97,108,108,101,116])),getU128Encoder().encode(rs(c.settingsIndex))]}));let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.initialMember),s(n.systemProgram),s(n.globalCounter),s(n.userAccount),s(n.settings),...a],data:lr().encode(c),programAddress:t})}function Fs(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},initialMember:{value:e.initialMember??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},globalCounter:{value:e.globalCounter??null,isWritable:true},userAccount:{value:e.userAccount??null,isWritable:true},settings:{value:e.settings??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.initialMember),s(n.systemProgram),s(n.globalCounter),s(n.userAccount),s(n.settings),...a],data:lr().encode(c),programAddress:t})}function kD(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{payer:t(),initialMember:t(),systemProgram:t(),globalCounter:t(),userAccount:t(),settings:t()},data:ws().decode(e.data)}}var Hs=new Uint8Array([2]);function wD(){return fixEncoderSize(getBytesEncoder(),1).encode(Hs)}function zs(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["disable",getBooleanEncoder()]]),e=>({...e,discriminator:Hs}))}function Ks(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["disable",getBooleanDecoder()]])}function FD(){return combineCodec(zs(),Ks())}function qs(e,r){let t=r?.programAddress??A,n={domainConfig:{value:e.domainConfig??null,isWritable:true},admin:{value:e.admin??null,isWritable:false}},c={...e},a=y({args:c}),s=T(t);return Object.freeze({accounts:[s(n.domainConfig),s(n.admin),...a],data:zs().encode(c),programAddress:t})}function GD(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{domainConfig:t(),admin:t()},data:Ks().decode(e.data)}}var Js=new Uint8Array([1]);function jD(){return fixEncoderSize(getBytesEncoder(),1).encode(Js)}function Zs(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["newOrigins",getOptionEncoder(getArrayEncoder(addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder())))]]),e=>({...e,discriminator:Js}))}function Xs(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["newOrigins",getOptionDecoder(getArrayDecoder(addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder())))]])}function YD(){return combineCodec(Zs(),Xs())}function $s(e,r){let t=r?.programAddress??A,n={domainConfig:{value:e.domainConfig??null,isWritable:true},authority:{value:e.authority??null,isWritable:true},newAuthority:{value:e.newAuthority??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.domainConfig),s(n.authority),s(n.newAuthority),s(n.userAccount),s(n.systemProgram),...a],data:Zs().encode(c),programAddress:t})}function JD(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{domainConfig:t(),authority:t(),newAuthority:o(),userAccount:o(),systemProgram:t()},data:Xs().decode(e.data)}}var ec=new Uint8Array([6]);function tb(){return fixEncoderSize(getBytesEncoder(),1).encode(ec)}function mr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["transactionManagerUrl",addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder())]]),e=>({...e,discriminator:ec}))}function tc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["transactionManagerUrl",addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder())]])}function nb(){return combineCodec(mr(),tc())}async function rb(e,r){let t=r?.programAddress??A,n={signer:{value:e.signer??null,isWritable:false},transactionManagerAccount:{value:e.transactionManagerAccount??null,isWritable:true}},c={...e},i={args:c};n.transactionManagerAccount.value||(n.transactionManagerAccount.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([117,115,101,114])),getAddressEncoder().encode(P(n.signer.value))]}));let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.signer),s(n.transactionManagerAccount),...a],data:mr().encode(c),programAddress:t})}function nc(e,r){let t=r?.programAddress??A,n={signer:{value:e.signer??null,isWritable:false},transactionManagerAccount:{value:e.transactionManagerAccount??null,isWritable:true}},c={...e},a=y({args:c}),s=T(t);return Object.freeze({accounts:[s(n.signer),s(n.transactionManagerAccount),...a],data:mr().encode(c),programAddress:t})}function ob(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{signer:t(),transactionManagerAccount:t()},data:tc().decode(e.data)}}var ac=new Uint8Array([7]);function Ab(){return fixEncoderSize(getBytesEncoder(),1).encode(ac)}function ic(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["secp256r1VerifyArgs",getOptionEncoder(w())],["delegateTo",getOptionEncoder(getU128Encoder())]]),e=>({...e,discriminator:ac}))}function uc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["secp256r1VerifyArgs",getOptionDecoder(F())],["delegateTo",getOptionDecoder(getU128Decoder())]])}function gb(){return combineCodec(ic(),uc())}function dc(e,r){let t=r?.programAddress??A,n={feePayer:{value:e.feePayer??null,isWritable:true},signer:{value:e.signer??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true},oldSettings:{value:e.oldSettings??null,isWritable:true},newSettings:{value:e.newSettings??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},domainConfig:{value:e.domainConfig??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.feePayer),s(n.signer),s(n.userAccount),s(n.oldSettings),s(n.newSettings),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.domainConfig),...a],data:ic().encode(c),programAddress:t})}function lb(e){if(e.accounts.length<8)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{feePayer:t(),signer:o(),userAccount:t(),oldSettings:o(),newSettings:o(),slotHashSysvar:o(),instructionsSysvar:o(),domainConfig:o()},data:uc().decode(e.data)}}var gc=new Uint8Array([17]);function xb(){return fixEncoderSize(getBytesEncoder(),1).encode(gc)}function yr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["amount",getU64Encoder()],["signers",getArrayEncoder($())]]),e=>({...e,discriminator:gc}))}function lc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["amount",getU64Decoder()],["signers",getArrayDecoder(Q())]])}function Ib(){return combineCodec(yr(),lc())}async function Eb(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},source:{value:e.source??null,isWritable:true},destination:{value:e.destination??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.source.value||(n.source.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([109,117,108,116,105,95,119,97,108,108,101,116])),getAddressEncoder().encode(P(n.settings.value)),getBytesEncoder().encode(new Uint8Array([118,97,117,108,116]))]})),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.source),s(n.destination),s(n.systemProgram),...a],data:yr().encode(c),programAddress:t})}function pc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},source:{value:e.source??null,isWritable:true},destination:{value:e.destination??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.source),s(n.destination),s(n.systemProgram),...a],data:yr().encode(c),programAddress:t})}function Db(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),slotHashSysvar:o(),instructionsSysvar:t(),source:t(),destination:t(),systemProgram:t()},data:lc().decode(e.data)}}var xc=new Uint8Array([18]);function hb(){return fixEncoderSize(getBytesEncoder(),1).encode(xc)}function Tr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["splInterfacePdaArgs",getOptionEncoder(Gn())],["amount",getU64Encoder()],["sourceCompressedTokenAccounts",getArrayEncoder(Zt())],["compressedProofArgs",getOptionEncoder(vn())],["signers",getArrayEncoder($())]]),e=>({...e,discriminator:xc}))}function Ic(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["splInterfacePdaArgs",getOptionDecoder(Vn())],["amount",getU64Decoder()],["sourceCompressedTokenAccounts",getArrayDecoder(Xt())],["compressedProofArgs",getOptionDecoder(kn())],["signers",getArrayDecoder(Q())]])}function Ub(){return combineCodec(Tr(),Ic())}async function vb(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},source:{value:e.source??null,isWritable:false},sourceSplTokenAccount:{value:e.sourceSplTokenAccount??null,isWritable:true},sourceCtokenTokenAccount:{value:e.sourceCtokenTokenAccount??null,isWritable:true},destination:{value:e.destination??null,isWritable:false},destinationSplTokenAccount:{value:e.destinationSplTokenAccount??null,isWritable:true},destinationCtokenTokenAccount:{value:e.destinationCtokenTokenAccount??null,isWritable:true},tokenProgram:{value:e.tokenProgram??null,isWritable:false},mint:{value:e.mint??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false},compressedTokenProgramAuthority:{value:e.compressedTokenProgramAuthority??null,isWritable:false},splInterfacePda:{value:e.splInterfacePda??null,isWritable:true},compressibleConfig:{value:e.compressibleConfig??null,isWritable:false},rentSponsor:{value:e.rentSponsor??null,isWritable:true},compressedTokenProgram:{value:e.compressedTokenProgram??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.source.value||(n.source.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([109,117,108,116,105,95,119,97,108,108,101,116])),getAddressEncoder().encode(P(n.settings.value)),getBytesEncoder().encode(new Uint8Array([118,97,117,108,116]))]})),n.tokenProgram.value||(n.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n.sourceSplTokenAccount.value||(n.sourceSplTokenAccount.value=await getProgramDerivedAddress({programAddress:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",seeds:[getAddressEncoder().encode(P(n.source.value)),getAddressEncoder().encode(P(n.tokenProgram.value)),getAddressEncoder().encode(P(n.mint.value))]})),n.sourceCtokenTokenAccount.value||(n.sourceCtokenTokenAccount.value=await getProgramDerivedAddress({programAddress:"cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m",seeds:[getAddressEncoder().encode(P(n.source.value)),getBytesEncoder().encode(new Uint8Array([9,21,163,87,35,121,78,143,182,93,7,91,107,114,105,156,56,221,2,229,148,139,117,176,229,160,65,142,128,151,91,68])),getAddressEncoder().encode(P(n.mint.value))]})),n.destinationSplTokenAccount.value||(n.destinationSplTokenAccount.value=await getProgramDerivedAddress({programAddress:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",seeds:[getAddressEncoder().encode(P(n.destination.value)),getAddressEncoder().encode(P(n.tokenProgram.value)),getAddressEncoder().encode(P(n.mint.value))]})),n.destinationCtokenTokenAccount.value||(n.destinationCtokenTokenAccount.value=await getProgramDerivedAddress({programAddress:"cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m",seeds:[getAddressEncoder().encode(P(n.destination.value)),getBytesEncoder().encode(new Uint8Array([9,21,163,87,35,121,78,143,182,93,7,91,107,114,105,156,56,221,2,229,148,139,117,176,229,160,65,142,128,151,91,68])),getAddressEncoder().encode(P(n.mint.value))]})),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.compressedTokenProgramAuthority.value||(n.compressedTokenProgramAuthority.value="GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy"),n.compressedTokenProgram.value||(n.compressedTokenProgram.value="cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.source),s(n.sourceSplTokenAccount),s(n.sourceCtokenTokenAccount),s(n.destination),s(n.destinationSplTokenAccount),s(n.destinationCtokenTokenAccount),s(n.tokenProgram),s(n.mint),s(n.systemProgram),s(n.compressedTokenProgramAuthority),s(n.splInterfacePda),s(n.compressibleConfig),s(n.rentSponsor),s(n.compressedTokenProgram),...a],data:Tr().encode(c),programAddress:t})}function Ec(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},source:{value:e.source??null,isWritable:false},sourceSplTokenAccount:{value:e.sourceSplTokenAccount??null,isWritable:true},sourceCtokenTokenAccount:{value:e.sourceCtokenTokenAccount??null,isWritable:true},destination:{value:e.destination??null,isWritable:false},destinationSplTokenAccount:{value:e.destinationSplTokenAccount??null,isWritable:true},destinationCtokenTokenAccount:{value:e.destinationCtokenTokenAccount??null,isWritable:true},tokenProgram:{value:e.tokenProgram??null,isWritable:false},mint:{value:e.mint??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false},compressedTokenProgramAuthority:{value:e.compressedTokenProgramAuthority??null,isWritable:false},splInterfacePda:{value:e.splInterfacePda??null,isWritable:true},compressibleConfig:{value:e.compressibleConfig??null,isWritable:false},rentSponsor:{value:e.rentSponsor??null,isWritable:true},compressedTokenProgram:{value:e.compressedTokenProgram??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.tokenProgram.value||(n.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.compressedTokenProgramAuthority.value||(n.compressedTokenProgramAuthority.value="GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy"),n.compressedTokenProgram.value||(n.compressedTokenProgram.value="cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.source),s(n.sourceSplTokenAccount),s(n.sourceCtokenTokenAccount),s(n.destination),s(n.destinationSplTokenAccount),s(n.destinationCtokenTokenAccount),s(n.tokenProgram),s(n.mint),s(n.systemProgram),s(n.compressedTokenProgramAuthority),s(n.splInterfacePda),s(n.compressibleConfig),s(n.rentSponsor),s(n.compressedTokenProgram),...a],data:Tr().encode(c),programAddress:t})}function kb(e){if(e.accounts.length<18)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),slotHashSysvar:o(),instructionsSysvar:t(),source:t(),sourceSplTokenAccount:t(),sourceCtokenTokenAccount:t(),destination:t(),destinationSplTokenAccount:o(),destinationCtokenTokenAccount:o(),tokenProgram:t(),mint:t(),systemProgram:t(),compressedTokenProgramAuthority:t(),splInterfacePda:o(),compressibleConfig:t(),rentSponsor:o(),compressedTokenProgram:t()},data:Ic().decode(e.data)}}var Cc=new Uint8Array([12]);function Fb(){return fixEncoderSize(getBytesEncoder(),1).encode(Cc)}function Mc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["secp256r1VerifyArgs",getOptionEncoder(w())]]),e=>({...e,discriminator:Cc}))}function Rc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["secp256r1VerifyArgs",getOptionDecoder(F())]])}function Gb(){return combineCodec(Mc(),Rc())}function Pc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},domainConfig:{value:e.domainConfig??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true},closer:{value:e.closer??null,isWritable:false},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.domainConfig),s(n.transactionBuffer),s(n.closer),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:Mc().encode(c),programAddress:t})}function Vb(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),domainConfig:o(),transactionBuffer:t(),closer:o(),slotHashSysvar:o(),instructionsSysvar:o()},data:Rc().decode(e.data)}}var Uc=new Uint8Array([9]);function Jb(){return fixEncoderSize(getBytesEncoder(),1).encode(Uc)}function vc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["bufferIndex",getU8Encoder()],["preauthorizeExecution",getBooleanEncoder()],["bufferExtendHashes",getArrayEncoder(fixEncoderSize(getBytesEncoder(),32))],["finalBufferHash",fixEncoderSize(getBytesEncoder(),32)],["finalBufferSize",getU16Encoder()],["expectedSigners",getArrayEncoder(we())],["secp256r1VerifyArgs",getOptionEncoder(w())]]),e=>({...e,discriminator:Uc}))}function kc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["bufferIndex",getU8Decoder()],["preauthorizeExecution",getBooleanDecoder()],["bufferExtendHashes",getArrayDecoder(fixDecoderSize(getBytesDecoder(),32))],["finalBufferHash",fixDecoderSize(getBytesDecoder(),32)],["finalBufferSize",getU16Decoder()],["expectedSigners",getArrayDecoder(Fe())],["secp256r1VerifyArgs",getOptionDecoder(F())]])}function Zb(){return combineCodec(vc(),kc())}function Lc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:false},payer:{value:e.payer??null,isWritable:true},domainConfig:{value:e.domainConfig??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true},creator:{value:e.creator??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.domainConfig),s(n.transactionBuffer),s(n.creator),s(n.systemProgram),s(n.instructionsSysvar),s(n.slotHashSysvar),...a],data:vc().encode(c),programAddress:t})}function Xb(e){if(e.accounts.length<8)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),domainConfig:o(),transactionBuffer:t(),creator:o(),systemProgram:t(),instructionsSysvar:t(),slotHashSysvar:o()},data:kc().decode(e.data)}}var Bc=new Uint8Array([13]);function oC(){return fixEncoderSize(getBytesEncoder(),1).encode(Bc)}function Nc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["secp256r1VerifyArgs",getOptionEncoder(w())]]),e=>({...e,discriminator:Bc}))}function wc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["secp256r1VerifyArgs",getOptionDecoder(F())]])}function sC(){return combineCodec(Nc(),wc())}function Fc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},domainConfig:{value:e.domainConfig??null,isWritable:false},executor:{value:e.executor??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.domainConfig),s(n.executor),s(n.transactionBuffer),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:Nc().encode(c),programAddress:t})}function cC(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),domainConfig:o(),executor:o(),transactionBuffer:t(),slotHashSysvar:o(),instructionsSysvar:o()},data:wc().decode(e.data)}}var Hc=new Uint8Array([11]);function gC(){return fixEncoderSize(getBytesEncoder(),1).encode(Hc)}function zc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["buffer",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]]),e=>({...e,discriminator:Hc}))}function Kc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["buffer",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function lC(){return combineCodec(zc(),Kc())}function qc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true}},c={...e},a=y({args:c}),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.transactionBuffer),...a],data:zc().encode(c),programAddress:t})}function pC(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{settings:t(),transactionBuffer:t()},data:Kc().decode(e.data)}}var Jc=new Uint8Array([10]);function IC(){return fixEncoderSize(getBytesEncoder(),1).encode(Jc)}function Zc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["secp256r1VerifyArgs",getOptionEncoder(w())]]),e=>({...e,discriminator:Jc}))}function Xc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["secp256r1VerifyArgs",getOptionDecoder(F())]])}function EC(){return combineCodec(Zc(),Xc())}function $c(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:false},domainConfig:{value:e.domainConfig??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true},voter:{value:e.voter??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.domainConfig),s(n.transactionBuffer),s(n.voter),s(n.systemProgram),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:Zc().encode(c),programAddress:t})}function DC(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),domainConfig:o(),transactionBuffer:t(),voter:o(),systemProgram:t(),slotHashSysvar:o(),instructionsSysvar:o()},data:Xc().decode(e.data)}}var ta=new Uint8Array([14]);function _C(){return fixEncoderSize(getBytesEncoder(),1).encode(ta)}function na(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)]]),e=>({...e,discriminator:ta}))}function ra(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)]])}function hC(){return combineCodec(na(),ra())}function oa(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true}},c={...e},a=y({args:c}),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.transactionBuffer),...a],data:na().encode({}),programAddress:t})}function UC(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),transactionBuffer:t()},data:ra().decode(e.data)}}var aa=new Uint8Array([15]);function NC(){return fixEncoderSize(getBytesEncoder(),1).encode(aa)}function ia(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["numSigners",getU8Encoder()],["numWritableSigners",getU8Encoder()],["numWritableNonSigners",getU8Encoder()],["numAccountKeys",getU8Encoder()],["instructions",getArrayEncoder(Ft())],["addressTableLookups",getArrayEncoder(Jn())],["signers",getArrayEncoder($())]]),e=>({...e,discriminator:aa}))}function ua(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["numSigners",getU8Decoder()],["numWritableSigners",getU8Decoder()],["numWritableNonSigners",getU8Decoder()],["numAccountKeys",getU8Decoder()],["instructions",getArrayDecoder(Gt())],["addressTableLookups",getArrayDecoder(Zn())],["signers",getArrayDecoder(Q())]])}function wC(){return combineCodec(ia(),ua())}function da(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:ia().encode(c),programAddress:t})}function FC(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),slotHashSysvar:o(),instructionsSysvar:t()},data:ua().decode(e.data)}}var A="reviR1xysEChySVSWGa43a6oJ2boJYTJhwRjo8KJhhT",Wy=(c=>(c[c.DomainConfig=0]="DomainConfig",c[c.GlobalCounter=1]="GlobalCounter",c[c.Settings=2]="Settings",c[c.TransactionBuffer=3]="TransactionBuffer",c[c.User=4]="User",c))(Wy||{});function dM(e){let r="data"in e?e.data:e;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([201,232,212,229,59,241,106,197])),0))return 0;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([42,206,176,58,175,129,130,233])),0))return 1;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([223,179,163,190,177,224,67,173])),0))return 2;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([90,36,35,219,93,225,110,96])),0))return 3;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([159,117,95,227,239,151,58,236])),0))return 4;throw new Error("The provided account could not be identified as a multiWallet account.")}var By=(l=>(l[l.ChangeConfig=0]="ChangeConfig",l[l.CreateDomainConfig=1]="CreateDomainConfig",l[l.CreateDomainUserAccount=2]="CreateDomainUserAccount",l[l.CreateGlobalCounter=3]="CreateGlobalCounter",l[l.CreateUserAccount=4]="CreateUserAccount",l[l.CreateWallet=5]="CreateWallet",l[l.DisableDomainConfig=6]="DisableDomainConfig",l[l.EditDomainConfig=7]="EditDomainConfig",l[l.EditTransactionManagerUrl=8]="EditTransactionManagerUrl",l[l.EditUserDelegate=9]="EditUserDelegate",l[l.NativeTransferIntent=10]="NativeTransferIntent",l[l.TokenTransferIntent=11]="TokenTransferIntent",l[l.TransactionBufferClose=12]="TransactionBufferClose",l[l.TransactionBufferCreate=13]="TransactionBufferCreate",l[l.TransactionBufferExecute=14]="TransactionBufferExecute",l[l.TransactionBufferExtend=15]="TransactionBufferExtend",l[l.TransactionBufferVote=16]="TransactionBufferVote",l[l.TransactionExecute=17]="TransactionExecute",l[l.TransactionExecuteSync=18]="TransactionExecuteSync",l))(By||{});function AM(e){let r="data"in e?e.data:e;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([8])),0))return 0;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([0])),0))return 1;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([4])),0))return 2;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([3])),0))return 3;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([5])),0))return 4;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([16])),0))return 5;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([2])),0))return 6;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([1])),0))return 7;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([6])),0))return 8;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([7])),0))return 9;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([17])),0))return 10;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([18])),0))return 11;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([12])),0))return 12;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([9])),0))return 13;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([13])),0))return 14;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([11])),0))return 15;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([10])),0))return 16;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([14])),0))return 17;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([15])),0))return 18;throw new Error("The provided instruction could not be identified as a multiWallet instruction.")}var wy=6e3,Fy=6001,Gy=6002,Vy=6003,Hy=6004,zy=6005,Ky=6006,qy=6007,jy=6008,Yy=6009,Jy=6010,Zy=6011,Xy=6012,$y=6013,Qy=6014,eT=6015,tT=6016,nT=6017,rT=6018,oT=6019,sT=6020,cT=6021,aT=6022,iT=6023,uT=6024,dT=6025,AT=6026,gT=6027,lT=6028,pT=6029,mT=6030,yT=6031,TT=6032,fT=6033,ST=6034,xT=6035,IT=6036,ET=6037,DT=6038,bT=6039,CT=6040,MT=6041,RT=6042,PT=6043,_T=6044,hT=6045,UT=6046,vT=6047,kT=6048,LT=6049,OT=6050,WT=6051,BT=6052,NT=6053,wT=6054,FT=6055,GT=6056,VT=6057,HT=6058,zT=6059,KT=6060,qT=6061,jT=6062,YT=6063,JT=6064,ZT=6065,XT=6066,$T=6067,QT=6068,ef=6069,tf=6070,nf=6071,rf=6072,of=6073,sf=6074,Aa;process.env.NODE_ENV!=="production"&&(Aa={[mT]:"This member is already delegated to another wallet.",[qy]:"The clientDataJSON hash extracted from the signature does not match the generated hash.",[OT]:"Missing credential id.",[BT]:"The domain configuration account is disabled. Please contact support or try again later.",[NT]:"Missing domain configuration account.",[QT]:"Domain configuration account key mismatch. The provided domain config does not match the expected value.",[Jy]:"Duplicate public keys detected among members. Each member must have a unique key.",[Yy]:"Durable nonce detected: this program does not support transactions using a durable nonce.",[cT]:"No members provided. A multisig wallet must contain at least one member.",[rT]:"Expected a User with Administrator role for this instruction.",[jy]:"The message hash associated with the signer does not match the pre-declared expected message hash.",[tT]:"Expected a User with Transaction Manager role for this instruction.",[bT]:"Final buffer hash mismatch: the serialized data may be corrupted or altered.",[CT]:"The serialized transaction buffer exceeds the maximum size of 10,128 bytes.",[MT]:"Declared buffer size does not match the actual serialized size.",[FT]:"Failed to compute hash. This may indicate a system error.",[fT]:"Not enough members with vote permission to meet the approval threshold.",[yT]:"At least one signer with execute permission is required to proceed.",[TT]:"At least one signer with initiate permission is required to perform this action.",[AT]:"One or more provided accounts failed validation. Verify that all required accounts are included and correct.",[$T]:"Invalid account index in transaction message. The account index is out of bounds.",[oT]:"User with Administrator role requires a valid domain config, be a ed25519 Signer and have no delegated wallet.",[lT]:"Invalid or missing instruction arguments. Ensure all required arguments are correctly provided.",[DT]:"Buffer validation failed: contents do not match the expected hash (possible tampering detected).",[GT]:"Member key conversion failed. The provided key format is invalid.",[ST]:"Only delegated members are allowed for this transaction.",[dT]:"Unexpected number of accounts provided for this instruction.",[$y]:"User with Permanent Member role must have a delegated wallet.",[Fy]:"The instruction preceding this program invocation is not a secp256r1 verification instruction.",[Hy]:"The extracted public key has an invalid length or encoding.",[wy]:"Malformed or missing WebAuthn verification parameters. Please provide valid secp256r1 signature arguments.",[Vy]:"Failed to deserialize secp256r1 signature offsets from the instruction data.",[LT]:"The specified slot number is not recent enough. Slot must be within the recent slot history window.",[vT]:"Failed to parse the Slot History sysvar: data format is invalid or corrupted.",[iT]:"Invalid threshold: must be at least 1 and cannot exceed the number of voting-eligible members.",[XT]:"Invalid source type for token transfer. The source account type is not supported.",[nT]:"User with Transaction Manager role requires a valid transaction manager url, be a ed25519 Signer and have no delegated wallet.",[eT]:"Invalid Transaction Manager permissions. Only initiate is allowed.",[uT]:"Malformed transaction message: structure or formatting does not match the expected layout.",[nf]:"Invalid user configuration. Credential ID and transports must be none for ed25519 members.",[gT]:"One or more provided user accounts failed validation. Verify that only users with appropriate roles are allowed to perform this action.",[tf]:"Invalid user configuration. Transaction manager URL must be empty for non-transaction-manager users.",[ZT]:"Light CPI account operation failed. The account may be invalid or uninitialized.",[zy]:"The extracted WebAuthn signed message payload is malformed.",[hT]:"An input string exceeds the maximum allowed character length.",[zT]:"Member not found in settings. Cannot remove a member that does not exist.",[pT]:"A required account is missing from the instruction context.",[VT]:"Compressed proof arguments are missing. Required for compressed account operations.",[jT]:"Missing compressed token account. Required for token transfer operations.",[rf]:"Missing destination token account. Required for token transfer operations.",[JT]:"Missing instructions sysvar account. Required for secp256r1 signature verification.",[HT]:"Light CPI accounts are missing. Required for compressed account operations.",[sf]:"Missing new authority account. Required for domain configuration updates.",[of]:"Missing settings account. Required for delegate operations.",[YT]:"Missing SPL interface PDA. Required for token transfer operations.",[UT]:"Missing required sysvar: Slot History must be included as an account in this instruction.",[IT]:"No valid signer found in this transaction.",[sT]:"Only one administrator is allowed per wallet.",[Xy]:"Only one permanent member is allowed per wallet.",[Qy]:"Only one transaction manager is allowed per wallet.",[wT]:"The given origin index is not in the whitelisted origins.",[qT]:"Payer account mismatch. The provided payer does not match the transaction buffer payer.",[Zy]:"Permanent members cannot be removed from a wallet.",[_T]:"Writable CPI calls to protected accounts are not permitted.",[Ky]:"The rpIdHash extracted from the signed message does not match the expected value.",[KT]:"Settings key mismatch. The provided settings key does not match the expected value.",[Gy]:"The signature index provided is out of bounds for the secp256r1 instruction.",[kT]:"The specified slot number was not found in the provided slot history.",[aT]:"Too many members: a maximum of 4 members are supported.",[RT]:"This transaction has expired. It must be executed within 3 minutes of approval.",[PT]:"This transaction has not yet reached the required approval threshold.",[WT]:"Missing transports.",[ET]:"Only the transaction creator or rent payer may close this transaction buffer.",[ef]:"Unauthorized: Only the admin account is allowed to perform this action.",[xT]:"Member is not part of the expected signers for this transaction."});function TM(e){return process.env.NODE_ENV!=="production"?Aa[e]:"Error message not available in production bundles."}function fM(e,r,t){return isProgramError(e,r,A,t)}var se=class extends Error{constructor(t,o,n){super(t);this.code=o;this.cause=n;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor);}},Me=class extends se{constructor(r){super(`${r} is not initialized. Please call initialize() first.`,"NOT_INITIALIZED");}},ee=class extends se{constructor(r,t){super(`${r} not found.${t?` ${t}`:""}`,"NOT_FOUND");}},W=class extends se{constructor(r,t){super(r,"VALIDATION_ERROR",{field:t});}},q=class extends se{constructor(t,o,n){super(t,"NETWORK_ERROR",{statusCode:o,url:n});this.statusCode=o;this.url=n;}},xt=class extends se{constructor(t,o,n){super(`Operation "${t}" failed after ${o} attempts.`,"RETRY_EXHAUSTED",{lastError:n});this.attempts=o;this.lastError=n;}},It=class extends se{constructor(t,o,n){super(t,"PERMISSION_ERROR",{required:o,actual:n});this.required=o;this.actual=n;}};var je={Ed25519:1,Secp256r1:2};var cf=d.looseObject({publicKey:d.string(),walletAddress:d.string(),settingsIndexWithAddress:d.object({index:d.union([d.number(),d.bigint()])})}),af=d.object({devicePublicKey:d.string(),platform:d.enum(["web","ios","android"]),userAgent:d.string().optional(),browser:d.object({name:d.string().optional(),version:d.string().optional(),major:d.string().optional(),type:d.string().optional()}).optional(),engine:d.object({name:d.string().optional(),version:d.string().optional()}).optional(),cpu:d.object({architecture:d.string().optional()}).optional(),device:d.object({type:d.string().optional(),vendor:d.string().optional(),model:d.string().optional()}).optional(),os:d.object({name:d.string().optional(),version:d.string().optional()}).optional(),app:d.object({name:d.string().optional(),version:d.string().optional(),build:d.string().optional()}).optional(),display:d.object({screenWidth:d.number().optional(),screenHeight:d.number().optional(),viewportWidth:d.number().optional(),viewportHeight:d.number().optional(),devicePixelRatio:d.number().optional()}).optional(),locale:d.string().optional(),timezone:d.string().optional(),push:d.object({provider:d.enum(["expo","fcm","apns"]),token:d.string()}).optional(),website:d.string().optional(),nativeApp:d.string().optional(),createdAt:d.iso.datetime().optional()}).strict(),ga=d.enum(["create","create_with_preauthorized_execution","execute","vote","sync","close","transfer_intent","change_delegate","change_config"]),kM=d.object({transactionActionType:ga,transactionAddress:d.string(),transactionMessageBytes:d.array(d.number().int().min(0).max(255)).transform(e=>new Uint8Array(e))}).strict(),uf=d.object({transactionActionType:ga,transactionAddress:d.string(),transactionMessageBytes:d.base64()}).strict(),la=d.object({phase:d.literal("start"),clientOrigin:d.url(),signer:d.string().optional(),rid:d.string(),validTill:d.number(),providerOrigin:d.string(),rpId:d.string(),data:d.object({type:d.literal("message"),payload:d.string(),requireTwoFactorAuthentication:d.boolean().default(false)}).strict()}).strict(),pa=d.object({phase:d.literal("start"),clientOrigin:d.url(),signer:d.string().optional(),rid:d.string(),validTill:d.number(),providerOrigin:d.string(),rpId:d.string(),data:d.object({type:d.literal("transaction"),payload:uf}).strict()}).strict(),ma=d.object({startRequest:d.union([la,pa]),authResponse:d.custom(),client:d.object({clientOrigin:d.url(),jws:d.string()}).strict(),device:d.object({jwk:d.base64(),jws:d.string(),deviceProfile:af}).strict(),user:cf}).strict(),ya=d.object({signer:d.string(),additionalInfo:d.looseObject({}).optional()}).strict(),df=d.object({slotHash:d.string(),slotNumber:d.string(),estimatedSlotHashExpiry:d.number(),originIndex:d.number(),crossOrigin:d.boolean(),transactionManagerAddress:d.string().optional()}).strict(),LM=d.object({phase:d.literal("complete"),data:d.object({type:d.literal("message"),payload:ya.extend(ma.shape).extend({startRequest:la,transactionManager:d.object({publicKey:d.string(),signature:d.string()}).optional()})}).strict()}).strict(),OM=d.object({phase:d.literal("complete"),data:d.object({type:d.literal("transaction"),payload:ya.extend(ma.shape).extend(df.shape).extend({startRequest:pa})}).strict()}).strict();var te={InitiateTransaction:1,VoteTransaction:2,ExecuteTransaction:4},ce=class e{constructor(r){this.mask=r;}static fromPermissions(r){return new e(r.reduce((t,o)=>t|o,0))}static all(){return new e(Object.values(te).reduce((r,t)=>r|t,0))}static has(r,t){return (r.mask&t)===t}};var Dr=33,ae=class{_bn;constructor(r){typeof r=="string"?this._bn=new Uint8Array(getBase58Encoder().encode(r)):this._bn=new Uint8Array(r),this.validateKeyLength(this._bn);}validateKeyLength(r){if(r.length!==Dr)throw new Error(`Invalid public key length, expected ${Dr} bytes but got ${r.length}`)}toBase58(){return getBase58Decoder().decode(this.toBytes())}toTruncatedBuffer(){let r=this.toBuffer();return r.subarray(1,r.length)}toBuffer(){if(!this._bn)throw new Error("Invalid public key input");let r=this._bn;if(r.byteLength===Dr)return r;throw new Error("Invalid public key input")}toBytes(){let r=this.toBuffer();return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}toString(){return this.toBase58()}toJSON(){return this.toBase58()}},b=class extends ae{verifyArgs;domainConfig;authData;signature;originIndex;crossOrigin;clientAndDeviceHash;authResponse;constructor(r,t){super(r),this.verifyArgs=t.verifyArgs,this.domainConfig=t.domainConfig,this.authData=t.authData,this.signature=t.signature,this.originIndex=t.originIndex,this.crossOrigin=t.crossOrigin,this.clientAndDeviceHash=t.clientAndDeviceHash,this.authResponse=t.authResponse;}};function lf(){return getStructCodec([["programAddressIndex",getU8Codec()],["accountIndices",getArrayCodec(getU8Codec())],["data",getArrayCodec(getU8Codec())]])}function pf(){return getStructCodec([["lookupTableAddress",getAddressCodec()],["writableIndexes",getArrayCodec(getU8Codec())],["readonlyIndexes",getArrayCodec(getU8Codec())]])}var fa=getStructCodec([["numSigners",getU8Codec()],["numWritableSigners",getU8Codec()],["numWritableNonSigners",getU8Codec()],["accountKeys",getArrayCodec(getAddressCodec())],["instructions",getArrayCodec(lf())],["addressTableLookups",getArrayCodec(pf())]]);function Sa(e){return fa.encode({numSigners:e.header.numSignerAccounts,numWritableSigners:e.header.numSignerAccounts-e.header.numReadonlySignerAccounts,numWritableNonSigners:e.staticAccounts.length-e.header.numSignerAccounts-e.header.numReadonlyNonSignerAccounts,accountKeys:e.staticAccounts,instructions:e.instructions.map(t=>({programAddressIndex:t.programAddressIndex,accountIndices:t.accountIndices??[],data:Array.from(t.data??[])})),addressTableLookups:e.version===0?e.addressTableLookups?.map(t=>({lookupTableAddress:t.lookupTableAddress,readonlyIndexes:t.readonlyIndexes,writableIndexes:t.writableIndexes}))??[]:[]})}function xa(e){let r=fa.decode(e);return {header:{numSignerAccounts:r.numSigners,numReadonlySignerAccounts:r.numSigners-r.numWritableSigners,numReadonlyNonSignerAccounts:r.accountKeys.length-r.numSigners-r.numWritableNonSigners},addressTableLookups:r.addressTableLookups.map(t=>({lookupTableAddress:t.lookupTableAddress,readonlyIndexes:t.readonlyIndexes.map(Number),writableIndexes:t.writableIndexes.map(Number),readableIndices:t.readonlyIndexes.map(Number),writableIndices:t.writableIndexes.map(Number)})),instructions:r.instructions.map(t=>({accountIndices:t.accountIndices.map(Number),data:new Uint8Array(t.data),programAddressIndex:t.programAddressIndex})),lifetimeToken:A,staticAccounts:r.accountKeys,version:0}}function Ia(e,r,t,o){if(e<r||e>t)throw new W(`${o} must be between ${r} and ${t} (inclusive), got ${e}`)}async function v(e){let[r]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("user"),e instanceof ae?e.toTruncatedBuffer():getAddressEncoder().encode(e)]});return r}async function Re({rpIdHash:e,rpId:r}){if(!e)if(r)e=sha256(getUtf8Encoder().encode(r));else throw new W("Either rpId or rpIdHash must be provided");let[t]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("domain_config"),e]});return t}async function Dt(){let[e]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("global_counter")]});return e}async function Ea(e,r,t){Ia(t,0,255,"buffer_index");let[o]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("multi_wallet"),getAddressEncoder().encode(e),getUtf8Encoder().encode("transaction_buffer"),r instanceof ae?r.toTruncatedBuffer():getAddressEncoder().encode(r),getU8Encoder().encode(t)]});return o}async function ne(e){let[r]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("multi_wallet"),getAddressEncoder().encode(e),getUtf8Encoder().encode("vault")]});return r}async function ue(e){let[r]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("multi_wallet"),getU128Encoder().encode(e)]});return r}async function cR(e){let r=await ue(e);return await ne(r)}async function aR(){let[e]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("cpi_authority")]});return e}var re={};function pR(){if(!re.solanaRpcEndpoint)throw new Me("RPC endpoint");return re.solanaRpcEndpoint}function Ye(){if(!re.lightProtocolRpc)throw new Me("Light Protocol RPC");return re.lightProtocolRpc}function L(){if(!re.solanaRpc)throw new Me("Solana RPC");return re.solanaRpc}function mR({rpcEndpoint:e,proverEndpoint:r,compressionApiEndpoint:t}){re.solanaRpcEndpoint=e,re.lightProtocolRpc=createRpc(e,t,r);let o=createSolanaRpc(e);re.solanaRpc=o;}function bt(e){return Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}function If(e){let r=new Uint8Array(e.length/2);for(let t=0;t<r.length;t++)r[t]=parseInt(e.slice(t*2,t*2+2),16);return r}function ba(e){let r=new Set(["type","challenge","origin","crossOrigin"]),t={};for(let n in e)r.has(n)||(t[n]=e[n]);if(Object.keys(t).length===0)return new Uint8Array([]);let o=JSON.stringify(t);return new Uint8Array(new TextEncoder().encode(o.slice(1,-1)))}function Ca(e,r){let t=[],o=0,n=new TextDecoder;for(let c=0;c<r;c++){if(o+2>e.length)throw new Error("MaxLengthExceeded");let i=e[o]|e[o+1]<<8;if(o+=2,o+i>e.length)throw new Error("MaxLengthExceeded");let a=e.slice(o,o+i),s=n.decode(a);t.push(s),o+=i;}return t}function Ma(e){if(e.length===64)return e;if(e[0]!==48)throw new Error("Invalid DER sequence");let r=e[1],t=2;if(r>128){let O=r&127;t+=O;}if(e[t]!==2)throw new Error("Expected INTEGER for r");let o=e[t+1],n=t+2,c=e.slice(n,n+o);if(t=n+o,e[t]!==2)throw new Error("Expected INTEGER for s");let i=e[t+1],a=t+2,s=e.slice(a,a+i),u=c[0]===0&&c.length>32?c.slice(1):c,g=s[0]===0&&s.length>32?s.slice(1):s;if(u.length>32||g.length>32)throw new Error("r or s length > 32 bytes");let p=new Uint8Array(32);p.set(u,32-u.length);let m=p256.Point.CURVE().n>>1n,S=BigInt("0x"+bt(g)),x=(S>m?p256.Point.CURVE().n-S:S).toString(16).padStart(64,"0"),I=If(x);return new Uint8Array([...p,...I])}function Je(e){let r=z(e.response.clientDataJSON),t=z(e.response.authenticatorData),o=sha256(r);return new Uint8Array([...t,...o])}function vR(e){let r=decodeCBOR(e),t=p256.Point.fromAffine({x:BigInt("0x"+bt(r.get(-2))),y:BigInt("0x"+bt(r.get(-3)))});return getBase58Decoder().decode(t.toBytes(true))}function kR(e){let t=p256.Point.fromBytes(getBase58Encoder().encode(e)).toBytes(false),o=new Map;return o.set(1,2),o.set(3,-7),o.set(-1,1),o.set(-2,t.slice(1,33)),o.set(-3,t.slice(33,65)),new Uint8Array(encodeCBOR(o))}async function LR(e){let{authenticatorData:r,clientDataJSON:t,signature:o}=e.authResponse.response,n=z(r),c=JSON.parse(getUtf8Decoder().decode(z(t))),i=ba(c),a=Ma(z(o)),s=await Re({rpIdHash:n.subarray(0,32)});return new b(e.signer,{verifyArgs:{clientDataJson:z(t),truncatedClientDataJson:i,slotNumber:BigInt(e.slotNumber),slotHash:getBase58Encoder().encode(e.slotHash)},clientAndDeviceHash:Mr(e.client.clientOrigin,e.device.jwk,e.startRequest.rid),domainConfig:s,authData:n,signature:a,originIndex:e.originIndex,crossOrigin:e.crossOrigin,authResponse:e.authResponse})}function Mr(e,r,t){return sha256(new Uint8Array([...getUtf8Encoder().encode(e),...getBase64Encoder().encode(r),...getBase64Encoder().encode(t)]))}function OR(e){return sha256(getUtf8Encoder().encode(canonicalize(e)))}function WR(e){return Rr(e.data.payload.authResponse)}function BR(e,r,t,o){let n=Mr(r,t,o);return sha256(new Uint8Array([...getUtf8Encoder().encode(e),...n]))}async function NR(e,r,t,o,n,c,i){let a;if(!n||!c||!i){let p=(await L().getAccountInfo(address("SysvarS1otHashes111111111111111111111111111"),{encoding:"base64",commitment:"confirmed",dataSlice:{offset:8,length:40}}).send()).value?.data;if(!p)throw new ee("Slot sysvar","Unable to fetch slot sysvar data");let m=getBase64Encoder().encode(p[0]);c=getU64Decoder().decode(m.subarray(0,8)).toString(),a=m.subarray(8,40),n=getBase58Decoder().decode(a),i=Date.now()+512*400;}else a=getBase58Encoder().encode(n);let s=sha256(typeof e.transactionMessageBytes=="string"?getBase64Encoder().encode(e.transactionMessageBytes):e.transactionMessageBytes),u=Mr(r,t,o),g=sha256(new Uint8Array([...getUtf8Encoder().encode(e.transactionActionType),...getBase58Encoder().encode(e.transactionAddress),...s,...a,...u]));return {slotNumber:c,slotHash:n,challenge:g,estimatedSlotHashExpiry:i}}function wR(e,r){return new Uint8Array([...Je(e),...getUtf8Encoder().encode(canonicalize(r))])}function Rr(e){let r=Je(e);return sha256(r)}function FR(e){let r="";for(let o of e)r+=String.fromCharCode(o);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function z(e){let r=e.replace(/-/g,"+").replace(/_/g,"/"),t=(4-r.length%4)%4,o=r.padEnd(r.length+t,"="),n=atob(o),c=new ArrayBuffer(n.length),i=new Uint8Array(c);for(let a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return i}async function GR(e,r){let{data:t}=await Fr(L(),e),n=Ca(t.origins,t.numOrigins).findIndex(c=>c===r);if(n===-1)throw new ee("Origin","Origin not found in domain config");return n}function VR(e){return getBase64Decoder().decode(getUtf8Encoder().encode(canonicalize(e)))}function HR(e){return JSON.parse(getUtf8Decoder().decode(getBase64Encoder().encode(e)))}function XR(e,r){if(r.threshold>1)throw new W("Multi-signature transactions with threshold > 1 are not supported yet.");let t=r.members.find(s=>La(s.pubkey)===e);if(!t)throw new ee("Member",`Signer ${e} not found in settings`);let{permissions:o}=t;if(!o)throw new ee("Permissions","No permissions found for the current member");let n=ce.has(o,te.InitiateTransaction),c=ce.has(o,te.VoteTransaction),i=ce.has(o,te.ExecuteTransaction);if(n&&c&&i)return null;if(!c||!i)throw new It("Signer lacks the required Vote/Execute permissions.",["VoteTransaction","ExecuteTransaction"],[c?"VoteTransaction":void 0,i?"ExecuteTransaction":void 0].filter(Boolean));let a=r.members.find(s=>s.role===0);if(!a)throw new ee("Transaction manager","No transaction manager available in wallet");return {transactionManagerAddress:address(La(a.pubkey))}}function Oa(e){let r=new URL(e);return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}function he(e,r){let t=new q(e,void 0,r);return t.retryable=false,t}function vf(e){return e instanceof q?e.retryable!==false:e instanceof Error&&(e.message==="WebSocket connection failed"||e.message==="WebSocket connection timed out")}var Y=()=>{let e=new Error("Aborted");return e.name="AbortError",e};function Wa(e){return e instanceof Error&&e.name==="AbortError"}function Ie(e){if(e.aborted)throw Y();e.throwIfAborted?.();}function Pr(...e){let r=e.filter(n=>n!=null);if(r.length===0)return new AbortController().signal;if(r.length===1)return r[0];if(typeof AbortSignal<"u"&&"any"in AbortSignal)return AbortSignal.any(r);let t=new AbortController,o=()=>t.abort();for(let n of r){if(n.aborted){o();break}n.addEventListener("abort",o,{once:true});}return t.signal}function kf(e){return e<1e12?e*1e3:e}function Lf(e,r,t){return typeof e=="number"&&Number.isFinite(e)?kf(e):r!==null?r:Date.now()+t}function va(e,r){throw e instanceof q?e:new q(e instanceof Error?e.message:"Transaction manager request failed",void 0,r)}function Of(e,r,t){return r.aborted?Promise.reject(Y()):new Promise((o,n)=>{let c=new WebSocket(e),i=false,a=g=>{i||(i=true,s!==void 0&&clearTimeout(s),r.removeEventListener("abort",u),g());},s=t!==void 0?setTimeout(()=>{try{c.close();}catch{}a(()=>n(new Error("WebSocket connection timed out")));},t):void 0,u=()=>{try{c.close();}catch{}a(()=>n(Y()));};r.addEventListener("abort",u,{once:true}),c.onopen=()=>{if(r.aborted){try{c.close();}catch{}a(()=>n(Y()));return}a(()=>o(c));},c.onerror=()=>{a(()=>n(new Error("WebSocket connection failed")));},c.onclose=()=>{a(()=>n(new Error("WebSocket connection failed")));};})}async function Wf(e,r,t){return new Promise((o,n)=>{let c=false,i=false,a=()=>{e.removeEventListener("message",g),e.removeEventListener("error",p),e.removeEventListener("close",m),r.removeEventListener("abort",u);},s=S=>{c||(c=true,a(),S());},u=()=>{try{e.close();}catch{}s(()=>n(Y()));},g=S=>{if(r.aborted){s(()=>n(Y()));return}if(typeof S.data!="string")return;let f;try{f=JSON.parse(S.data);}catch{return}let x=f.event??"message";try{t(x,f.data)&&(i=!0,s(()=>o(!0)));}catch(I){s(()=>n(I));}},p=()=>s(()=>n(new q("Transaction manager request failed",0,e.url))),m=()=>s(()=>o(i));r.addEventListener("abort",u,{once:true}),e.addEventListener("message",g),e.addEventListener("error",p),e.addEventListener("close",m);})}var ka=(e,r)=>new Promise((t,o)=>{if(r.aborted)return o(Y());let n=()=>{clearTimeout(c),o(Y());},c=setTimeout(()=>{r.removeEventListener("abort",n),t();},e);r.addEventListener("abort",n,{once:true});});async function Bf(e){let{url:r,payload:t,expectedSignatureCount:o,callbacks:n,abortSignal:c,opts:i}=e,a=Pr(c),s=Oa(r),u=i?.maxAttempts??10,g=i?.retryDelayMs??400,p=i?.approvalPollMs??2e3,m=i?.defaultApprovalTimeoutMs??3e5,S=i?.connectionTimeoutMs??3e4;if(o===0)throw he("Transaction manager: no signatures requested",s);let f=null,x=0,I=()=>f!==null&&Date.now()<f;for(;;){if(Ie(a),f!==null&&Date.now()>=f)throw he("Transaction manager approval timed out",s);let O,N;try{if(O=await Of(s,a,S),Ie(a),O.send(t),await Wf(O,a,(X,K)=>{if(X==="error"){let V=typeof K=="object"&&K&&typeof K.error=="string"?K.error:"Unknown error";throw he(V,s)}if(X==="signatures"){let V=K.signatures;if(!V?.length)return !1;if(V.length!==o)throw he(`Transaction manager returned ${V.length} signature(s) but ${o} were expected`,s);return N=V,!0}if(X==="pending_transaction_approval"){let V=K.validTill;f=Lf(V,f,m),n?.onPendingApprovalsCallback?.(f);}return X==="transaction_approved"&&n?.onPendingApprovalsSuccess?.(),!1})){if(!N||N.length!==o)throw he("Transaction manager sent an invalid signatures event",s);return N}if(Ie(a),!I())throw new q("Transaction manager closed the connection before returning signatures",void 0,s)}catch(l){if(Wa(l))throw l;Ie(a),vf(l)||va(l,s),I()||(x++,x>=u&&va(l,s));}finally{try{O?.close();}catch{}}if(Ie(a),I()){let l=Math.min(p,f-Date.now());await ka(l>0?l:1,a);continue}if(x>0){await ka(g,a);continue}throw new q("Transaction manager: missing signatures",void 0,s)}}function $R(e){let{address:r,url:t,authResponses:o,transactionMessageBytes:n,onPendingApprovalsCallback:c,onPendingApprovalsSuccess:i,abortSignal:a,opts:s}=e,u=Pr(a),g=Oa(t),p=Promise.resolve();return u.aborted&&(p=Promise.reject(Y())),u.addEventListener("abort",()=>{p=Promise.reject(Y());},{once:true}),{address:r,async signTransactions(m,S){let f=Pr(u,S?.abortSignal);Ie(f);let x=p.then(async()=>{if(Ie(f),m.length===0)throw he("Transaction manager: no transactions to sign",g);let I=new Array(m.length);for(let l=0;l<m.length;l++)I[l]={transaction:getBase64Decoder().decode(getTransactionEncoder().encode(m[l])),transactionMessageBytes:n?getBase64Decoder().decode(n):void 0,authResponses:o};let O=JSON.stringify({type:"transaction",data:{publicKey:r.toString(),payload:I}});return (await Bf({url:t,payload:O,expectedSignatureCount:m.length,callbacks:{onPendingApprovalsCallback:c,onPendingApprovalsSuccess:i},abortSignal:f,opts:s})).map(l=>({[r]:getBase58Encoder().encode(l)}))});return p=x.catch(I=>{if(Wa(I))return Promise.reject(I)}),x}}}function La(e){return e.keyType===je.Ed25519?getBase58Decoder().decode(e.key.subarray(1,33)):getBase58Decoder().decode(e.key)}function QR(e){let r=e.map(c=>Be().encode(c)),t=4+r.reduce((c,i)=>c+i.length,0),o=new Uint8Array(t),n=0;o.set(getU32Encoder().encode(e.length),n),n+=4;for(let c of r)o.set(c,n),n+=c.length;return o}function eP(e){let r=0,[t,o]=getU32Decoder().read(e,r);r=o;let n=new Array(t);for(let c=0;c<t;c++){let i=Ne().read(e,r);n[c]=i[0],r=i[1];}if(r!==e.length)throw new W(`Trailing bytes detected: expected ${e.length} bytes but consumed ${r}`);return n}var _r=["HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe","ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49","96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5","Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY","DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh","ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt","3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT","DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL"];function G(e,r=0){let t=e instanceof b?e:void 0,o=t?.verifyArgs&&r!==-1?some({signedMessageIndex:r,truncatedClientDataJson:t.verifyArgs.truncatedClientDataJson,slotNumber:t.verifyArgs.slotNumber,originIndex:t.originIndex,crossOrigin:t.crossOrigin,clientAndDeviceHash:t.clientAndDeviceHash}):none(),n=t?.domainConfig?t.domainConfig:void 0,c=t?.verifyArgs?t.signature:void 0,i=t?.authData&&t.verifyArgs.clientDataJson?Je(t.authResponse):void 0,a=t?.toBuffer();return {domainConfig:n,verifyArgs:o,signature:c,message:i,publicKey:a}}function Ue(e,r,t=[]){let o=[];for(let n of e)if(n instanceof b){let c=t.length,{domainConfig:i,verifyArgs:a,signature:s,publicKey:u,message:g}=G(n,c);if(g&&s&&u&&t.push({message:g,signature:s,publicKey:u}),i){let p=r.addPreAccounts([{address:i,role:AccountRole.READONLY}]).get(i)?.index;a.__option==="Some"&&p!==void 0&&o.push({__kind:"Secp256r1",fields:[{domainConfigIndex:p,verifyArgs:a.value}]});}}else {let c=r.addPreAccounts([{address:n.address,role:AccountRole.READONLY_SIGNER,signer:n}]).get(n.address)?.index;c!==void 0&&o.push({__kind:"Ed25519",fields:[c]});}return {secp256r1VerifyInput:t,transactionSyncSigners:o}}function oe(e){if(e instanceof ae)return {keyType:je.Secp256r1,key:e.toBytes()};{let r;try{r="address"in e?e.address:e;}catch{r=e;}return {keyType:je.Ed25519,key:new Uint8Array([0,...getAddressEncoder().encode(r)])}}}function Na(e){return e instanceof b?e.toString():e.address.toString()}function J(e){let r=new Set,t=[];for(let n of e)r.has(Na(n))||(t.push(n),r.add(Na(n)));let o=t.filter(n=>n instanceof b);if(o.length>1)throw new W(`More than 1 Secp256r1 signers in an instruction is not supported (found ${o.length})`);return t}function wa({payer:e,tipAmount:r}){let t=_r[Math.floor(Math.random()*_r.length)];return getTransferSolInstruction({source:e,destination:address(t),amount:r})}var Ga=8,Va=1,zf=34,Kf=5,qf=Ga+Va,Ha=Ga+Va+32,jf=Ha+zf+Kf,Yf=20;async function fP(e,{member:r,credentialId:t}){let o=[{memcmp:{offset:BigInt(qf),encoding:"base64",bytes:getBase64Decoder().decode(getAddressEncoder().encode(e))}}];if(r)o.push({memcmp:{offset:BigInt(Ha),encoding:"base64",bytes:getBase64Decoder().decode(h().encode(oe(r)))}});else if(t)o.push({memcmp:{offset:BigInt(jf),encoding:"base64",bytes:getBase64Decoder().decode(z(t))}});else return null;let n=await L().getProgramAccounts(A,{filters:o,encoding:"base64"}).send();return n.length?n.map(c=>pt().decode(getBase64Encoder().encode(c.account.data[0])))[0]:null}async function SP(e){let r=(await ts(L(),await v(e))).data;if(r.role===1||r.role===0){let t=[];return (await L().getProgramAccounts(A,{encoding:"base64",filters:[{memcmp:{offset:BigInt(Yf),encoding:"base64",bytes:getBase64Decoder().decode(h().encode(oe(e)))}}]}).send()).forEach(n=>{let c=ut().decode(getBase64Encoder().encode(n.account.data[0]));t.push({...c});}),t}else return await Promise.all(r.wallets.map(async t=>(await Bo(L(),await ue(t.index))).data))}async function vP({payer:e,rpId:r,origins:t,authority:o}){let n=await Re({rpId:r});return Is({origins:t,authority:o,payer:e,domainConfig:n,rpId:r,userAccount:await v(o.address),remainingAccounts:[]})}async function WP({payer:e}){let r=await Dt();return Us({payer:e,globalCounter:r})}async function FP({admin:e,rpId:r,disable:t}){let o=await Re({rpId:r});return qs({domainConfig:o,admin:e,disable:t,remainingAccounts:[]})}function Zf(e,r,t,o){let n=Xf(e,r),c=$f(e,r)&&t!==o;return n&&c?AccountRole.WRITABLE_SIGNER:n&&!c?AccountRole.WRITABLE:!n&&c?AccountRole.READONLY_SIGNER:AccountRole.READONLY}function Xf(e,r){let t=e.staticAccounts.length,{numSignerAccounts:o,numReadonlySignerAccounts:n,numReadonlyNonSignerAccounts:c}=e.header,i=o-n,a=t-o-c;return r>=t?false:r<i?true:r>=o?r-o<a:false}function $f(e,r){return r<e.header.numSignerAccounts}async function Rt({walletAddress:e,transactionMessageBytes:r,addressesByLookupTableAddress:t,additionalSigners:o}){let n=xa(r),c=t??(n.addressTableLookups?await fetchAddressesForLookupTables(n.addressTableLookups.map(a=>a.lookupTableAddress),L()):{}),i=[];i.push(...n.addressTableLookups?.map(a=>({role:AccountRole.READONLY,address:a.lookupTableAddress}))??[]);for(let[a,s]of n.staticAccounts.entries())i.push({address:s,role:Zf(n,a,s,e)});if(n.addressTableLookups)for(let a of n.addressTableLookups){let s=c[a.lookupTableAddress];if(!s)throw new Error(`Address lookup table account ${a.lookupTableAddress} not found`);for(let u of a.writableIndexes){let g=s[u];if(!g)throw new Error(`Address lookup table account ${a.lookupTableAddress} does not contain address at index ${u}`);i.push({address:g,role:AccountRole.WRITABLE});}for(let u of a.readonlyIndexes){let g=s[u];if(!g)throw new Error(`Address lookup table account ${a.lookupTableAddress} does not contain address at index ${u}`);i.push({address:g,role:AccountRole.READONLY});}}for(let a of o?.filter(s=>s.address!==e)??[]){let s=i.findIndex(u=>u.address===a.address);s===-1?i.push({address:a.address,role:AccountRole.READONLY_SIGNER,signer:a}):i[s].role===AccountRole.READONLY||i[s].role===AccountRole.READONLY_SIGNER?i[s]={address:a.address,role:AccountRole.READONLY_SIGNER,signer:a}:(i[s].role===AccountRole.WRITABLE||i[s].role===AccountRole.WRITABLE_SIGNER)&&(i[s]={address:a.address,role:AccountRole.WRITABLE_SIGNER,signer:a});}return {accountMetas:i,addressLookupTableAccounts:c,transactionMessage:n}}var ve=33,ke=64,kr=14,s1=2,c1=address("Secp256r1SigVerify1111111111111111111111111");function a1(){return getStructEncoder([["signatureOffset",getU16Encoder()],["signatureInstructionIndex",getU16Encoder()],["publicKeyOffset",getU16Encoder()],["publicKeyInstructionIndex",getU16Encoder()],["messageDataOffset",getU16Encoder()],["messageDataSize",getU16Encoder()],["messageInstructionIndex",getU16Encoder()]])}function i1(){return getStructDecoder([["signatureOffset",getU16Decoder()],["signatureInstructionIndex",getU16Decoder()],["publicKeyOffset",getU16Decoder()],["publicKeyInstructionIndex",getU16Decoder()],["messageDataOffset",getU16Decoder()],["messageDataSize",getU16Decoder()],["messageInstructionIndex",getU16Decoder()]])}function ja(){return createDecoder({read:(e,r=0)=>{let t=getU8Decoder().decode(e,r);r+=1;let o=getU8Decoder().decode(e,r);r+=1;let n=[],c=i1();for(let a=0;a<t;a++)n.push(c.decode(e,r)),r+=kr;let i=[];for(let a=0;a<t;a++){let s=fixDecoderSize(getBytesDecoder(),ve).decode(e,r);r+=ve;let u=fixDecoderSize(getBytesDecoder(),ke).decode(e,r);r+=ke;let g=n[a].messageDataSize,p=fixDecoderSize(getBytesDecoder(),g).decode(e,r);r+=g,i.push({publicKey:s,signature:u,message:p});}return [{numSignatures:t,padding:o,offsets:n,payload:i},r]}})}function Ya(){return createEncoder({getSizeFromValue:e=>{let r=kr*e.offsets.length,t=e.payload.reduce((o,n)=>o+ve+ke+n.message.length,0);return 2+r+t},write:(e,r,t=0)=>{t=getU8Encoder().write(e.numSignatures,r,t),t=getU8Encoder().write(e.padding,r,t);let o=a1();for(let n of e.offsets)t=o.write(n,r,t);for(let n of e.payload)t=fixEncoderSize(getBytesEncoder(),ve).write(n.publicKey,r,t),t=fixEncoderSize(getBytesEncoder(),ke).write(n.signature,r,t),t=getBytesEncoder().write(n.message,r,t);return t}})}function XP(){return combineCodec(Ya(),ja())}function U(e,r){let t=e.length,o=s1+t*kr,n=[];for(let s=0;s<t;s++){let{message:u}=e[s],g=o,p=g+ve,m=p+ke;n.push({publicKeyOffset:g,publicKeyInstructionIndex:65535,signatureOffset:p,signatureInstructionIndex:65535,messageDataOffset:m,messageDataSize:u.length,messageInstructionIndex:65535}),o+=ve+ke+u.length;}let c=r?.programAddress??c1,i={numSignatures:t,padding:0,offsets:n,payload:e};return {accounts:[],programAddress:c,data:Ya().encode(i)}}function $P(e){return {programAddress:e.programAddress,accounts:{},data:ja().decode(e.data)}}async function Ja({settings:e,transactionBufferAddress:r,transactionMessageBytes:t,payer:o,addressesByLookupTableAddress:n,secp256r1VerifyInput:c=[],additionalSigners:i=[],jitoBundlesTipAmount:a}){let s=await ne(e),{accountMetas:u,addressLookupTableAccounts:g}=await Rt({transactionMessageBytes:t,walletAddress:s,additionalSigners:i,addressesByLookupTableAddress:n}),p=[];return c.length>0&&p.push(U(c)),p.push(oa({transactionBuffer:r,payer:o.address,remainingAccounts:u,settings:e})),a&&p.push(wa({payer:o,tipAmount:a})),{instructions:p,addressLookupTableAccounts:g}}var Z=class{systemAccounts;nextPreIndex;preMap;nextPackedIndex;packedMap;outputTreeIndex;constructor(){this.systemAccounts=[],this.nextPreIndex=0,this.preMap=new Map,this.nextPackedIndex=0,this.packedMap=new Map,this.outputTreeIndex=-1;}addPreAccounts(r){for(let t of r)this.insertOrGet(t.address.toString(),t,false);return this.preMap}getAccountRole(r,t){return r?t?AccountRole.WRITABLE_SIGNER:AccountRole.READONLY_SIGNER:t?AccountRole.WRITABLE:AccountRole.READONLY}async addSystemAccounts(){this.systemAccounts.push(...getLightSystemAccountMetasV2({selfProgram:new PublicKey(A.toString())}).map(r=>({address:address(r.pubkey.toString()),role:this.getAccountRole(r.isSigner,r.isWritable)})));}insertOrGet(r,t={address:address(r),role:AccountRole.WRITABLE},o=true){let n=o?this.packedMap:this.preMap;if(!n.has(r)){let c=o?this.nextPackedIndex++:this.nextPreIndex++;n.set(r,{index:c,accountMeta:t});}return n.get(r).index}packOutputTreeIndex(r){if(r.treeType===TreeType.StateV1)return this.insertOrGet(r.tree.toString());if(r.treeType===TreeType.StateV2)return this.insertOrGet(r.queue.toString());throw new Error("Tree type not supported")}async getOutputTreeIndex(){if(this.outputTreeIndex!==-1)return this.outputTreeIndex;let r=await Ye().getStateTreeInfos(),t=selectStateTreeInfo(r);return this.packOutputTreeIndex(t)}packTreeInfos(r,t){let o=[],n=[];for(let c of r){let i=this.insertOrGet(c.treeInfo.tree.toString()),a=this.insertOrGet(c.treeInfo.queue.toString());o.push({rootIndex:c.rootIndex,merkleTreePubkeyIndex:i,queuePubkeyIndex:a,leafIndex:c.leafIndex,proveByIndex:c.proveByIndex});let s=c.treeInfo.nextTreeInfo??c.treeInfo,u=this.packOutputTreeIndex(s);this.outputTreeIndex===-1&&(this.outputTreeIndex=u);}for(let c of t){let i=this.insertOrGet(c.treeInfo.tree.toString()),a=this.insertOrGet(c.treeInfo.queue.toString());n.push({rootIndex:c.rootIndex,addressMerkleTreePubkeyIndex:i,addressQueuePubkeyIndex:a});}return {stateTrees:o.length>0?{packedTreeInfos:o,outputTreeIndex:this.outputTreeIndex}:void 0,addressTrees:n}}hashSetAccountsToMetas(r){return Array.from(r.entries()).sort((o,n)=>o[1].index-n[1].index).map(([,{accountMeta:o}])=>({...o}))}getOffsets(r){let t=r,o=t+this.systemAccounts.length;return [t,o]}toAccountMetas(){let r=this.hashSetAccountsToMetas(this.preMap),t=this.hashSetAccountsToMetas(this.packedMap),[o,n]=this.getOffsets(r.length);return {remainingAccounts:[...r,...this.systemAccounts,...t],systemOffset:o,packedOffset:n}}};async function $a({settings:e,transactionMessageBytes:r,additionalSigners:t,signers:o,addressesByLookupTableAddress:n,secp256r1VerifyInput:c=[]}){let i=J(o),a=await ne(e),[{accountMetas:s,addressLookupTableAccounts:u,transactionMessage:g}]=await Promise.all([Rt({transactionMessageBytes:r,walletAddress:a,additionalSigners:t,addressesByLookupTableAddress:n})]),p=new Z;p.addPreAccounts(s);let{secp256r1VerifyInput:m,transactionSyncSigners:S}=Ue(i,p,c),{remainingAccounts:f}=p.toAccountMetas(),x=[];m.length>0&&x.push(U(m));let I=g1(g,s);return x.push(da({signers:S,settings:e,...I,remainingAccounts:f})),{instructions:x,addressLookupTableAccounts:u}}function g1(e,r){return {numSigners:e.header.numSignerAccounts,numWritableNonSigners:e.staticAccounts.length-e.header.numSignerAccounts-e.header.numReadonlyNonSignerAccounts,numWritableSigners:e.header.numSignerAccounts-e.header.numReadonlySignerAccounts,numAccountKeys:e.staticAccounts.length,instructions:e.instructions.map(t=>({...t,accountIndices:new Uint8Array(t.accountIndices??[]),data:t.data??[]})),addressTableLookups:e.addressTableLookups?.map(t=>({lookupTableAddressIndex:r.findIndex(o=>o.address===t.lookupTableAddress),writableIndexes:new Uint8Array(t.writableIndexes),readonlyIndexes:new Uint8Array(t.readonlyIndexes)}))??[]}}async function U_({settings:e,destination:r,signers:t,amount:o}){let n=J(t),c=await ne(e),{value:i}=await L().getAccountInfo(c,{encoding:"base64"}).send();if((i?.lamports??0)<BigInt(o))throw new W("Insufficient balance for native transfer.");let a=new Z,{secp256r1VerifyInput:s,transactionSyncSigners:u}=Ue(n,a),{remainingAccounts:g}=a.toAccountMetas(),p=[];return s.length>0&&p.push(U(s)),p.push(pc({amount:o,signers:u,source:c,destination:r,settings:e,remainingAccounts:g})),p}var l1=3,p1=500,m1=2,y1=3e4,T1={backoffBase:m1,maxDelayMs:y1,retryOnRateLimit:true,initialDelayMs:p1,maxRetries:l1};function f1(e,r,t,o){let n=r*Math.pow(t,e-1);return Math.min(n,o)}function S1(e){return new Promise(r=>setTimeout(r,e))}async function Qa(e,r){let{maxRetries:t,initialDelayMs:o,backoffBase:n,maxDelayMs:c,shouldRetry:i}={...T1,...r},a;for(let s=1;s<=t;s++)try{return await e()}catch(u){if(a=u,i&&!i(u,s))throw u;if(s>=t)break;let g=f1(s,o,n,c);await S1(g);}throw new xt(e.name||"retryWithBackoff",t,a)}var M1=address("ACXg8a7VaqecBWrSbdu73W4Pg9gsqXJ3EXAqkHyhvVXg"),R1=address("r18WwUxfG8kQ69bQPAB2jV6zGNKy3GosFGctjQoV4ti"),_t=address("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");async function Y_({settings:e,destination:r,mint:t,signers:o,amount:n,payer:c,tokenProgram:i,splInterfacePdaArgs:a={index:0,restricted:false}}){let s=J(o),u=await ne(e),g=await P1(t,r,u,i,a),p=await _1(g),m=h1(p,g,n),[S,f]=await Promise.all([O1(u,t,m.splBalance,m.cTokenBalance,BigInt(n)),L1(m.requireSplInterface,g.splInterfacePda)]),x=BigInt(S.reduce(($e,mi)=>$e+(mi.parsed.amount.toNumber()??0),0));if(m.splBalance+m.cTokenBalance+x<BigInt(n))throw new W("Insufficient balance for token transfer.");let I=new Z;f&&I.addPreAccounts([{address:t,role:AccountRole.WRITABLE}]);let O=U1(S),{proof:N}=await v1(I,O),l=k1(S,N,I),{secp256r1VerifyInput:X,transactionSyncSigners:K}=Ue(s,I),{remainingAccounts:V,systemOffset:de}=I.toAccountMetas(),Wr=w1(N,de),_=[];return X.length>0&&_.push(U(X)),_.push(Ec({settings:e,payer:c,source:u,sourceSplTokenAccount:g.sourceSplAta,sourceCtokenTokenAccount:g.sourceCtokenAta,destination:r,destinationSplTokenAccount:m.destinationSplTokenAccount,destinationCtokenTokenAccount:m.destinationCtokenTokenAccount,tokenProgram:i,mint:t,splInterfacePda:m.requireSplInterface?g.splInterfacePda:void 0,compressibleConfig:M1,rentSponsor:m.requireRentSponsor?R1:void 0,amount:n,signers:K,sourceCompressedTokenAccounts:l,compressedProofArgs:Wr,splInterfacePdaArgs:m.requireSplInterface?some(a):none(),remainingAccounts:V})),_}async function P1(e,r,t,o,n){let c=m=>getProgramDerivedAddress({seeds:[getAddressEncoder().encode(m),getAddressEncoder().encode(_t),getAddressEncoder().encode(e)],programAddress:_t}),i=[getUtf8Encoder().encode("pool"),getAddressEncoder().encode(e)];n.restricted&&i.push(getUtf8Encoder().encode("restricted")),n.index>0&&i.push(getU8Encoder().encode(n.index));let[a,[s],u,[g],[p]]=await Promise.all([findAssociatedTokenPda({mint:e,owner:t,tokenProgram:o}).then(([m])=>m),c(t),findAssociatedTokenPda({mint:e,owner:r,tokenProgram:o}).then(([m])=>m),c(r),getProgramDerivedAddress({seeds:i,programAddress:_t})]);return {sourceSplAta:a,sourceCtokenAta:s,destinationSplAta:u,destinationCTokenAta:g,splInterfacePda:p}}async function _1(e){let[r,t,o]=await Promise.all([L().getAccountInfo(e.destinationSplAta,{encoding:"base64"}).send(),L().getAccountInfo(e.sourceSplAta,{encoding:"base64"}).send(),L().getAccountInfo(e.sourceCtokenAta,{encoding:"base64"}).send()]);return {destinationSplAtaInfo:r,sourceSplAtaInfo:t,sourceCTokenAtaInfo:o}}function h1(e,r,t){let o=!!e.destinationSplAtaInfo.value,n=!!e.sourceSplAtaInfo.value,c=!!e.sourceCTokenAtaInfo.value,i=n?getTokenDecoder().decode(getBase64Encoder().encode(e.sourceSplAtaInfo.value.data[0])).amount:BigInt(0),a=BigInt(c?B1(getBase64Encoder().encode(e.sourceCTokenAtaInfo.value.data[0]))?.amount??0:0),s=o?r.destinationSplAta:void 0,u=o?void 0:r.destinationCTokenAta,g=n&&(i+a<BigInt(t)||a>BigInt(0)||!o)||!n&&o;return {splBalance:i,cTokenBalance:a,destinationSplTokenAccount:s,destinationCtokenTokenAccount:u,requireSplInterface:g,requireRentSponsor:i+a<BigInt(t)||!o}}function U1(e){let r=[];return e.forEach(t=>r.push({hash:t.compressedAccount.hash,tree:t.compressedAccount.treeInfo.tree,queue:t.compressedAccount.treeInfo.queue,data:t.compressedAccount.data,address:t.compressedAccount.address})),r}async function v1(e,r){let t=null;return r.length===0?{proof:t}:(await e.addSystemAccounts(),t=await F1(r,[]),{proof:t})}function k1(e,r,t){return !r||!e.length?[]:e.map(o=>({amount:o.parsed.amount.toNumber(),merkleContext:{leafIndex:o.compressedAccount.leafIndex,merkleTreePubkeyIndex:t.insertOrGet(o.compressedAccount.treeInfo.tree.toString()),queuePubkeyIndex:t.insertOrGet(o.compressedAccount.treeInfo.queue.toString()),proveByIndex:o.compressedAccount.proveByIndex},rootIndex:r.rootIndices[0],version:N1(o.compressedAccount.data?.discriminator),tlv:o.parsed.tlv?some(getArrayDecoder(We()).decode(o.parsed.tlv)):none(),state:o.parsed.state}))}async function L1(e,r){if(!e)return false;let{value:t}=await L().getAccountInfo(r,{encoding:"base64"}).send();return !t}async function O1(e,r,t,o,n){let c=n-t-o;if(c<=0)return [];let a=(await Ye().getCompressedTokenAccountsByOwner(new PublicKey(e),{mint:new PublicKey(r)})).items.filter(u=>!!u.compressedAccount.data?.data.length&&u.compressedAccount.owner.toString()===_t.toString()&&!u.parsed.amount.isZero());return a.length===0?[]:W1(a,Number(c),4,{treeType:TreeType.StateV2})}function W1(e,r,t=4,o){let n=e.filter(u=>u.compressedAccount.treeInfo.treeType===o?.treeType);if(n.length===0)throw new Error("No accounts found");let c=0,i=0,a=0,s=[];n.sort((u,g)=>g.parsed.amount.cmp(u.parsed.amount));for(let u of n){if(s.length>=t||c>=r)break;(!u.parsed.amount.isZero()||!u.compressedAccount.lamports.isZero())&&(c=c+u.parsed.amount.toNumber(),i=i+u.compressedAccount.lamports.toNumber(),s.push(u));}if(a=n.slice(0,t).reduce((u,g)=>u+g.parsed.amount.toNumber(),0),s.length===0)throw new Error("No accounts found.");if(c<r){let u=n.reduce((g,p)=>g+p.parsed.amount.toNumber(),0);throw s.length>=t?new Error(`Account limit exceeded: max ${a.toString()} (${t} accounts) per transaction. Total balance: ${u.toString()} (${n.length} accounts). Consider multiple transfers to spend full balance.`):new Error(`Insufficient balance for transfer. Required: ${r.toString()}, available: ${u.toString()}.`)}if(s.length===0)throw new Error("No accounts found.");return s}function B1(e){if(!e||e.length===0)return null;try{return {amount:getU64Decoder().decode(e.slice(64,72))}}catch(r){return console.error("Token data parsing error:",r),null}}function N1(e){if(!e||e.length<8)return 3;if(e[0]===2)return 1;let r=e[7];return r===3?2:3}function w1(e,r){return {proof:e?.compressedProof?some({a:new Uint8Array(e.compressedProof.a),b:new Uint8Array(e.compressedProof.b),c:new Uint8Array(e.compressedProof.c)}):null,lightCpiAccountsStartIndex:r}}async function F1(e,r){return Qa(()=>Ye().getValidityProofV0(e,r))}function oh({signers:e,payer:r,changeConfigArgs:t}){let{settings:o,configActions:n,packedAccounts:c}=t,i=J(e),a=[],s=[];for(let p of i)if(p instanceof b){let m=s.length,{domainConfig:S,verifyArgs:f,signature:x,publicKey:I,message:O}=G(p,m);if(O&&x&&I&&s.push({message:O,signature:x,publicKey:I}),S){let N=c.addPreAccounts([{address:S,role:AccountRole.READONLY}]).get(S)?.index;f.__option==="Some"&&N!==void 0&&a.push({__kind:"Secp256r1",fields:[{domainConfigIndex:N,verifyArgs:f.value}]});}}else {let m=c.addPreAccounts([{address:p.address,role:AccountRole.READONLY_SIGNER,signer:p}]).get(p.address)?.index;m!==void 0&&a.push({__kind:"Ed25519",fields:[m]});}let{remainingAccounts:u}=c.toAccountMetas(),g=[];return s.length>0&&g.push(U(s)),g.push(As({settings:o,configActions:n,payer:r,remainingAccounts:u,signers:a})),g}async function lh({authority:e,payer:r,createUserArgs:t,domainConfig:o}){return Rs({payer:r,authority:e,member:Ge().decode(t.member.toBuffer()),credentialId:z(t.credentialId),transports:t.transports,role:t.role,domainConfig:o,settings:t.settings,transactionManagerAccount:t.transactionManagerAccount,userAccount:await v(t.member),remainingAccounts:[]})}async function fh({createUserArgs:e,payer:r}){return Os({payer:r,member:e.member,role:e.role,transactionManagerUrl:e.role===0?e.transactionManagerUrl:null,userAccount:await v(e.member.address),remainingAccounts:[]})}async function Dh({index:e,payer:r,initialMember:t}){return Fs({globalCounter:await Dt(),userAccount:await v(t.address),settingsIndex:e,settings:await ue(e),payer:r,initialMember:t,remainingAccounts:[]})}async function Ph({authority:e,domainConfig:r,newAuthority:t,newOrigins:o}){return $s({domainConfig:r,authority:e,newOrigins:o?some(o):none(),newAuthority:t,userAccount:t?await v(t.address):void 0,remainingAccounts:[]})}async function vh({signer:e,transactionManagerUrl:r}){return nc({signer:e,transactionManagerAccount:await v(e.address),transactionManagerUrl:r,remainingAccounts:[]})}async function Fh({payer:e,user:r,oldDelegate:t,newDelegate:o}){let n,c;t!==void 0&&(n=await ue(t)),o!==void 0&&(c=await ue(o));let{domainConfig:i,verifyArgs:a,message:s,signature:u,publicKey:g}=G(r),p=[];s&&u&&g&&p.push({message:s,signature:u,publicKey:g});let m=[];return p.length>0&&m.push(U(p)),m.push(dc({secp256r1VerifyArgs:a,domainConfig:i,delegateTo:o!==void 0?some(o):none(),feePayer:e,signer:r instanceof b?void 0:r,oldSettings:n,newSettings:c,userAccount:await v(r instanceof b?r:r.address),remainingAccounts:[]})),m}function eU({closer:e,payer:r,settings:t,transactionBufferAddress:o}){let{domainConfig:n,verifyArgs:c,message:i,signature:a,publicKey:s}=G(e),u=[];return i&&a&&s&&u.push(U([{message:i,signature:a,publicKey:s}])),u.push(Pc({transactionBuffer:o,domainConfig:n,closer:e instanceof b?void 0:e,settings:t,payer:r,secp256r1VerifyArgs:c,remainingAccounts:[]})),u}function ai({payer:e,creator:r,bufferIndex:t,settings:o,transactionBufferAddress:n,finalBufferHash:c,finalBufferSize:i,preauthorizeExecution:a,bufferExtendHashes:s,expectedSigners:u}){let{domainConfig:g,verifyArgs:p,message:m,signature:S,publicKey:f}=G(r),x=[];return m&&S&&f&&x.push(U([{message:m,signature:S,publicKey:f}])),x.push(Lc({settings:o,transactionBuffer:n,payer:e,secp256r1VerifyArgs:p,creator:r instanceof b?void 0:r,domainConfig:g,bufferIndex:t,finalBufferHash:c,finalBufferSize:i,bufferExtendHashes:s,preauthorizeExecution:a,expectedSigners:u,remainingAccounts:[]})),x}function ii({executor:e,transactionBufferAddress:r,settings:t}){let{domainConfig:o,verifyArgs:n,signature:c,message:i,publicKey:a}=G(e),s=[];return i&&c&&a&&s.push(U([{message:i,signature:c,publicKey:a}])),s.push(Fc({settings:t,transactionBuffer:r,secp256r1VerifyArgs:n,domainConfig:o,executor:e instanceof b?void 0:e,remainingAccounts:[]})),s}function ui({transactionMessageBytes:e,transactionBufferAddress:r,settings:t}){return qc({transactionBuffer:r,buffer:e,settings:t,remainingAccounts:[]})}function di({settings:e,voter:r,transactionBufferAddress:t}){let{domainConfig:o,verifyArgs:n,signature:c,publicKey:i,message:a}=G(r),s=[];return a&&c&&i&&s.push(U([{message:a,signature:c,publicKey:i}])),s.push($c({settings:e,transactionBuffer:t,secp256r1VerifyArgs:n,domainConfig:o,voter:r instanceof b?void 0:r,remainingAccounts:[]})),s}async function FU({settings:e,configActionsArgs:r}){let t=new Z;return {configActions:await K1({configActionsArgs:r,packedAccounts:t}),settings:e,packedAccounts:t}}async function K1({configActionsArgs:e,packedAccounts:r}){let t=[];for(let o of e)switch(o.type){case "AddMembers":{let n=[];for(let c of o.members)r.addPreAccounts([{address:await v(c.member),role:AccountRole.WRITABLE}]),n.push(Y1({permissionArgs:c.permissions,pubkey:c.member}));t.push({__kind:o.type,fields:[n]});break}case "RemoveMembers":{let n=await Promise.all(o.members.map(async c=>(r.addPreAccounts([{address:await v(c.member),role:AccountRole.WRITABLE}]),j1({pubkey:c.member}))));t.push({__kind:o.type,fields:[n]});break}case "EditPermissions":{let n=o.members.map(c=>q1({permissionArgs:c.permissions,pubkey:c.member}));t.push({__kind:o.type,fields:[n]});break}default:t.push({__kind:o.type,fields:[o.threshold]});}return t}function q1({pubkey:e,permissionArgs:r}){return {memberKey:oe(e),permissions:gi(r)}}function j1({pubkey:e}){return {memberKey:oe(e)}}function Y1({pubkey:e,permissionArgs:r}){return {memberKey:oe(e),permissions:gi(r)}}function gi(e){let r=[];return e.initiate&&r.push(te.InitiateTransaction),e.vote&&r.push(te.VoteTransaction),e.execute&&r.push(te.ExecuteTransaction),ce.fromPermissions(r)}async function jU({payer:e,settings:r,transactionMessageBytes:t,creator:o,executor:n,secp256r1VerifyInput:c,jitoBundlesTipAmount:i,addressesByLookupTableAddress:a,additionalVoters:s=[],additionalSigners:u=[],chunkSize:g=Math.ceil(t.length/2)}){let p=Math.floor(Math.random()*255),m=await Ea(r,o instanceof b?o:o.address,p),S=[],f=[];for(let _=0;_<t.length;_+=g){let $e=t.subarray(_,_+g);S.push($e),f.push(sha256($e));}let x=sha256(t),I=J([o,...n?[n]:[],...s]).map(_=>({memberKey:oe(_),messageHash:_ instanceof b?Rr(_.authResponse):null})),O=ai({finalBufferHash:x,finalBufferSize:t.length,bufferIndex:p,payer:e,transactionBufferAddress:m,settings:r,creator:o,preauthorizeExecution:!n,bufferExtendHashes:f,expectedSigners:I}),N=S.map(_=>ui({transactionMessageBytes:_,transactionBufferAddress:m,settings:r})),l=s.map(_=>di({voter:_,transactionBufferAddress:m,settings:r})),X=ii({settings:r,executor:n,transactionBufferAddress:m}),{instructions:K,addressLookupTableAccounts:V}=await Ja({settings:r,transactionMessageBytes:t,transactionBufferAddress:m,payer:e,additionalSigners:u,secp256r1VerifyInput:c,jitoBundlesTipAmount:i,addressesByLookupTableAddress:a}),de=_=>({payer:e,instructions:_,addressesByLookupTableAddress:V});return [de(O),...N.map(_=>de([_])),...l.length?[de(l.flat())]:[],de(X),de(K)]}var Ut=class e{payer;keyMetaMap;constructor(r,t){this.payer=r,this.keyMetaMap=t;}static compile(r,t){let o=new Map,n=i=>{let a=o.get(i);return a===void 0&&(a={isSigner:false,isWritable:false,isInvoked:false},o.set(i,a)),a},c=n(t);c.isSigner=true,c.isWritable=true;for(let i of r){n(i.programAddress).isInvoked=false;for(let a of i.accounts??[]){let s=n(a.address);s.isSigner||=a.role===AccountRole.READONLY_SIGNER||a.role===AccountRole.WRITABLE_SIGNER,s.isWritable||=a.role===AccountRole.WRITABLE||a.role===AccountRole.WRITABLE_SIGNER;}}return new e(t,o)}getMessageComponents(){let r=[...this.keyMetaMap.entries()];if(r.length>256)throw new Error("Max static account keys length exceeded");let t=r.filter(([,u])=>u.isSigner&&u.isWritable),o=r.filter(([,u])=>u.isSigner&&!u.isWritable),n=r.filter(([,u])=>!u.isSigner&&u.isWritable),c=r.filter(([,u])=>!u.isSigner&&!u.isWritable),i={numSignerAccounts:t.length+o.length,numReadonlySignerAccounts:o.length,numReadonlyNonSignerAccounts:c.length};if(t.length===0)throw new Error("Expected at least one writable signer key");let[a]=t[0];if(a!==this.payer)throw new Error("Expected first writable signer key to be the fee payer");let s=[...t.map(([u])=>u),...o.map(([u])=>u),...n.map(([u])=>u),...c.map(([u])=>u)];return [i,s]}extractTableLookup(r){let[t,o]=this.drainKeysFoundInLookupTable(r[1],i=>!i.isSigner&&!i.isInvoked&&i.isWritable),[n,c]=this.drainKeysFoundInLookupTable(r[1],i=>!i.isSigner&&!i.isInvoked&&!i.isWritable);if(!(t.length===0&&n.length===0))return {addressTableLookup:{lookupTableAddress:r[0],writableIndexes:t,readonlyIndexes:n},drainedKeys:{writable:o,readonly:c}}}drainKeysFoundInLookupTable(r,t){let o=new Array,n=new Array;for(let[c,i]of this.keyMetaMap.entries())if(t(i)){let a=c,s=r.findIndex(u=>u===a);if(s>=0){if(s>=256)throw new Error("Max lookup table index exceeded");o.push(s),n.push(a),this.keyMetaMap.delete(c);}}return [o,n]}};var vt=class{staticAccountKeys;accountKeysFromLookups;constructor(r,t){this.staticAccountKeys=r,this.accountKeysFromLookups=t;}keySegments(){let r=[this.staticAccountKeys];return this.accountKeysFromLookups&&(r.push(this.accountKeysFromLookups.writable),r.push(this.accountKeysFromLookups.readonly)),r}get(r){for(let t of this.keySegments()){if(r<t.length)return t[r];r-=t.length;}}get length(){return this.keySegments().flat().length}compileInstructions(r){if(this.length>256)throw new Error("Account index overflow encountered during compilation");let o=new Map;this.keySegments().flat().forEach((c,i)=>{o.set(c,i);});let n=c=>{let i=o.get(c);if(i===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return i};return r.map(c=>({programAddressIndex:n(c.programAddress),accountIndices:c.accounts?.map(i=>n(i.address))??[],data:c.data}))}};function pi({payer:e,recentBlockhash:r,instructions:t,addressesByLookupTableAddress:o}){let n=Ut.compile(t,e),c=new Array,i={writable:[],readonly:[]},a=Object.entries(o??{});for(let m of a){let S=n.extractTableLookup(m);if(S!==void 0){let{addressTableLookup:f,drainedKeys:x}=S;c.push({readonlyIndexes:f.readonlyIndexes,readableIndices:f.readonlyIndexes,writableIndexes:f.writableIndexes,writableIndices:f.writableIndexes,lookupTableAddress:address(f.lookupTableAddress)}),i.writable.push(...x.writable),i.readonly.push(...x.readonly);}}let[s,u]=n.getMessageComponents(),p=new vt(u,i).compileInstructions(t);return {version:0,header:s,instructions:p,lifetimeToken:r,staticAccounts:u,addressTableLookups:c}}function cv({instructions:e,payer:r,addressesByLookupTableAddress:t}){let o=pi({instructions:e,payer:r,recentBlockhash:A,addressesByLookupTableAddress:t});return new Uint8Array(Sa(o))}async function Av({payer:e,settings:r,transactionMessageBytes:t,signers:o,additionalSigners:n,secp256r1VerifyInput:c,addressesByLookupTableAddress:i}){let{instructions:a,addressLookupTableAccounts:s}=await $a({settings:r,signers:o,additionalSigners:n,transactionMessageBytes:t,secp256r1VerifyInput:c,addressesByLookupTableAddress:i});return {payer:e,instructions:a,addressesByLookupTableAddress:s}}
1
+ import {getStructCodec,getU8Codec,getArrayCodec,getAddressCodec,address,fixEncoderSize,getBytesEncoder,transformEncoder,getStructEncoder,getAddressEncoder,getU8Encoder,getStructDecoder,fixDecoderSize,getAddressDecoder,getU8Decoder,getBytesDecoder,combineCodec,decodeAccount,assertAccountExists,fetchEncodedAccount,assertAccountsExist,fetchEncodedAccounts,getU128Encoder,getU128Decoder,getEnumEncoder,getEnumDecoder,addEncoderSizePrefix,getU32Encoder,addDecoderSizePrefix,getU32Decoder,getU64Encoder,getU64Decoder,getU16Encoder,getOptionEncoder,getArrayEncoder,getU16Decoder,getOptionDecoder,getArrayDecoder,getBooleanEncoder,getBooleanDecoder,getDiscriminatedUnionEncoder,getTupleEncoder,getDiscriminatedUnionDecoder,getTupleDecoder,getUnitEncoder,getUnitDecoder,getUtf8Encoder,getUtf8Decoder,getProgramDerivedAddress,containsBytes,isProgramError,getBase58Encoder,getBase58Decoder,getBase64Encoder,getBase64Decoder,getTransactionEncoder,createDecoder,createEncoder,AccountRole,some,none,upgradeRoleToSigner,fetchAddressesForLookupTables,isTransactionSigner}from'@solana/kit';import {sha256}from'@noble/hashes/sha2.js';import d from'zod';import {createRpc,TreeType,getLightSystemAccountMetasV2,selectStateTreeInfo}from'@lightprotocol/stateless.js';import {createSolanaRpc}from'@solana/rpc';import {decodeCBOR,encodeCBOR}from'@levischuck/tiny-cbor';import {p256}from'@noble/curves/nist.js';import {canonicalize}from'json-canonicalize';import {getTransferSolInstruction}from'@solana-program/system';import {PublicKey}from'@solana/web3.js';import {findAssociatedTokenPda,getTokenDecoder}from'@solana-program/token';var Br=new Uint8Array([201,232,212,229,59,241,106,197]);function X1(){return fixEncoderSize(getBytesEncoder(),8).encode(Br)}function Ri(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["authority",getAddressEncoder()],["rpIdHash",fixEncoderSize(getBytesEncoder(),32)],["bump",getU8Encoder()],["isDisabled",getU8Encoder()],["rpIdLength",getU8Encoder()],["numOrigins",getU8Encoder()],["rpId",fixEncoderSize(getBytesEncoder(),255)],["origins",fixEncoderSize(getBytesEncoder(),515)]]),e=>({...e,discriminator:Br}))}function Nr(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["authority",getAddressDecoder()],["rpIdHash",fixDecoderSize(getBytesDecoder(),32)],["bump",getU8Decoder()],["isDisabled",getU8Decoder()],["rpIdLength",getU8Decoder()],["numOrigins",getU8Decoder()],["rpId",fixDecoderSize(getBytesDecoder(),255)],["origins",fixDecoderSize(getBytesDecoder(),515)]])}function $1(){return combineCodec(Ri(),Nr())}function wr(e){return decodeAccount(e,Nr())}async function Fr(e,r,t){let o=await Pi(e,r,t);return assertAccountExists(o),o}async function Pi(e,r,t){let o=await fetchEncodedAccount(e,r,t);return wr(o)}async function Q1(e,r,t){let o=await _i(e,r,t);return assertAccountsExist(o),o}async function _i(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>wr(n))}function eS(){return 846}var Hr=new Uint8Array([42,206,176,58,175,129,130,233]);function rS(){return fixEncoderSize(getBytesEncoder(),8).encode(Hr)}function Hi(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["index",getU128Encoder()]]),e=>({...e,discriminator:Hr}))}function zr(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["index",getU128Decoder()]])}function oS(){return combineCodec(Hi(),zr())}function Kr(e){return decodeAccount(e,zr())}async function sS(e,r,t){let o=await zi(e,r,t);return assertAccountExists(o),o}async function zi(e,r,t){let o=await fetchEncodedAccount(e,r,t);return Kr(o)}async function cS(e,r,t){let o=await Ki(e,r,t);return assertAccountsExist(o),o}async function Ki(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>Kr(n))}function aS(){return 24}var kt=(t=>(t[t.Initialized=0]="Initialized",t[t.Frozen=1]="Frozen",t))(kt||{});function Lt(){return getEnumEncoder(kt)}function Ot(){return getEnumDecoder(kt)}function dS(){return combineCodec(Lt(),Ot())}function Wt(){return getStructEncoder([["key",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["value",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]])}function Bt(){return getStructDecoder([["key",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["value",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function lS(){return combineCodec(Wt(),Bt())}function Nt(){return getStructEncoder([["memberKey",h()],["permissions",Ae()]])}function wt(){return getStructDecoder([["memberKey",k()],["permissions",ge()]])}function TS(){return combineCodec(Nt(),wt())}function Ft(){return getStructEncoder([["programAddressIndex",getU8Encoder()],["accountIndices",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["data",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]])}function Gt(){return getStructDecoder([["programAddressIndex",getU8Decoder()],["accountIndices",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["data",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function xS(){return combineCodec(Ft(),Gt())}function Vt(){return getStructEncoder([["delegatedAmount",getU64Encoder()],["withheldTransferFee",getU64Encoder()],["isAta",getU8Encoder()]])}function Ht(){return getStructDecoder([["delegatedAmount",getU64Decoder()],["withheldTransferFee",getU64Decoder()],["isAta",getU8Decoder()]])}function DS(){return combineCodec(Vt(),Ht())}function Yt(){return getStructEncoder([["a",fixEncoderSize(getBytesEncoder(),32)],["b",fixEncoderSize(getBytesEncoder(),64)],["c",fixEncoderSize(getBytesEncoder(),32)]])}function Jt(){return getStructDecoder([["a",fixDecoderSize(getBytesDecoder(),32)],["b",fixDecoderSize(getBytesDecoder(),64)],["c",fixDecoderSize(getBytesDecoder(),32)]])}function MS(){return combineCodec(Yt(),Jt())}function Zt(){return getStructEncoder([["version",getU8Encoder()],["rootIndex",getU16Encoder()],["amount",getU64Encoder()],["merkleContext",Qt()],["tlv",getOptionEncoder(getArrayEncoder($t()))],["state",Lt()]])}function Xt(){return getStructDecoder([["version",getU8Decoder()],["rootIndex",getU16Decoder()],["amount",getU64Decoder()],["merkleContext",en()],["tlv",getOptionDecoder(getArrayDecoder(We()))],["state",Ot()]])}function hS(){return combineCodec(Zt(),Xt())}function rn(){return getStructEncoder([["decimalsOption",getU8Encoder()],["decimals",getU8Encoder()],["compressionOnly",getBooleanEncoder()],["isAta",getU8Encoder()],["info",sn()]])}function on(){return getStructDecoder([["decimalsOption",getU8Decoder()],["decimals",getU8Decoder()],["compressionOnly",getBooleanDecoder()],["isAta",getU8Decoder()],["info",cn()]])}function LS(){return combineCodec(rn(),on())}function sn(){return getStructEncoder([["configAccountVersion",getU16Encoder()],["compressToPubkey",getU8Encoder()],["accountVersion",getU8Encoder()],["lamportsPerWrite",getU32Encoder()],["compressionAuthority",fixEncoderSize(getBytesEncoder(),32)],["rentSponsor",fixEncoderSize(getBytesEncoder(),32)],["lastClaimedSlot",getU64Encoder()],["rentExemptionPaid",getU32Encoder()],["reserved",getU32Encoder()],["rentConfig",dn()]])}function cn(){return getStructDecoder([["configAccountVersion",getU16Decoder()],["compressToPubkey",getU8Decoder()],["accountVersion",getU8Decoder()],["lamportsPerWrite",getU32Decoder()],["compressionAuthority",fixDecoderSize(getBytesDecoder(),32)],["rentSponsor",fixDecoderSize(getBytesDecoder(),32)],["lastClaimedSlot",getU64Decoder()],["rentExemptionPaid",getU32Decoder()],["reserved",getU32Decoder()],["rentConfig",An()]])}function NS(){return combineCodec(sn(),cn())}function Be(){return getDiscriminatedUnionEncoder([["EditPermissions",getStructEncoder([["fields",getTupleEncoder([getArrayEncoder(pn())])]])],["AddMembers",getStructEncoder([["fields",getTupleEncoder([getArrayEncoder(Nt())])]])],["RemoveMembers",getStructEncoder([["fields",getTupleEncoder([getArrayEncoder(yn())])]])],["SetThreshold",getStructEncoder([["fields",getTupleEncoder([getU8Encoder()])]])]])}function Ne(){return getDiscriminatedUnionDecoder([["EditPermissions",getStructDecoder([["fields",getTupleDecoder([getArrayDecoder(mn())])]])],["AddMembers",getStructDecoder([["fields",getTupleDecoder([getArrayDecoder(wt())])]])],["RemoveMembers",getStructDecoder([["fields",getTupleDecoder([getArrayDecoder(Tn())])]])],["SetThreshold",getStructDecoder([["fields",getTupleDecoder([getU8Decoder()])]])]])}function VS(){return combineCodec(Be(),Ne())}function HS(e,r){return Array.isArray(r)?{__kind:e,fields:r}:{__kind:e,...r??{}}}function zS(e,r){return r.__kind===e}function pn(){return getStructEncoder([["memberKey",h()],["permissions",Ae()]])}function mn(){return getStructDecoder([["memberKey",k()],["permissions",ge()]])}function YS(){return combineCodec(pn(),mn())}function we(){return getStructEncoder([["memberKey",h()],["messageHash",getOptionEncoder(fixEncoderSize(getBytesEncoder(),32))]])}function Fe(){return getStructDecoder([["memberKey",k()],["messageHash",getOptionDecoder(fixDecoderSize(getBytesDecoder(),32))]])}function $S(){return combineCodec(we(),Fe())}function $t(){return getDiscriminatedUnionEncoder([["Placeholder0",getUnitEncoder()],["Placeholder1",getUnitEncoder()],["Placeholder2",getUnitEncoder()],["Placeholder3",getUnitEncoder()],["Placeholder4",getUnitEncoder()],["Placeholder5",getUnitEncoder()],["Placeholder6",getUnitEncoder()],["Placeholder7",getUnitEncoder()],["Placeholder8",getUnitEncoder()],["Placeholder9",getUnitEncoder()],["Placeholder10",getUnitEncoder()],["Placeholder11",getUnitEncoder()],["Placeholder12",getUnitEncoder()],["Placeholder13",getUnitEncoder()],["Placeholder14",getUnitEncoder()],["Placeholder15",getUnitEncoder()],["Placeholder16",getUnitEncoder()],["Placeholder17",getUnitEncoder()],["Placeholder18",getUnitEncoder()],["TokenMetadata",getStructEncoder([["fields",getTupleEncoder([En()])]])],["Placeholder20",getUnitEncoder()],["Placeholder21",getUnitEncoder()],["Placeholder22",getUnitEncoder()],["Placeholder23",getUnitEncoder()],["Placeholder24",getUnitEncoder()],["Placeholder25",getUnitEncoder()],["Placeholder26",getUnitEncoder()],["PausableAccount",getStructEncoder([["fields",getTupleEncoder([fn()])]])],["PermanentDelegateAccount",getStructEncoder([["fields",getTupleEncoder([xn()])]])],["TransferFeeAccount",getStructEncoder([["fields",getTupleEncoder([bn()])]])],["TransferHookAccount",getStructEncoder([["fields",getTupleEncoder([Mn()])]])],["CompressedOnly",getStructEncoder([["fields",getTupleEncoder([Vt()])]])],["Compressible",getStructEncoder([["fields",getTupleEncoder([rn()])]])]])}function We(){return getDiscriminatedUnionDecoder([["Placeholder0",getUnitDecoder()],["Placeholder1",getUnitDecoder()],["Placeholder2",getUnitDecoder()],["Placeholder3",getUnitDecoder()],["Placeholder4",getUnitDecoder()],["Placeholder5",getUnitDecoder()],["Placeholder6",getUnitDecoder()],["Placeholder7",getUnitDecoder()],["Placeholder8",getUnitDecoder()],["Placeholder9",getUnitDecoder()],["Placeholder10",getUnitDecoder()],["Placeholder11",getUnitDecoder()],["Placeholder12",getUnitDecoder()],["Placeholder13",getUnitDecoder()],["Placeholder14",getUnitDecoder()],["Placeholder15",getUnitDecoder()],["Placeholder16",getUnitDecoder()],["Placeholder17",getUnitDecoder()],["Placeholder18",getUnitDecoder()],["TokenMetadata",getStructDecoder([["fields",getTupleDecoder([Dn()])]])],["Placeholder20",getUnitDecoder()],["Placeholder21",getUnitDecoder()],["Placeholder22",getUnitDecoder()],["Placeholder23",getUnitDecoder()],["Placeholder24",getUnitDecoder()],["Placeholder25",getUnitDecoder()],["Placeholder26",getUnitDecoder()],["PausableAccount",getStructDecoder([["fields",getTupleDecoder([Sn()])]])],["PermanentDelegateAccount",getStructDecoder([["fields",getTupleDecoder([In()])]])],["TransferFeeAccount",getStructDecoder([["fields",getTupleDecoder([Cn()])]])],["TransferHookAccount",getStructDecoder([["fields",getTupleDecoder([Rn()])]])],["CompressedOnly",getStructDecoder([["fields",getTupleDecoder([Ht()])]])],["Compressible",getStructDecoder([["fields",getTupleDecoder([on()])]])]])}function nx(){return combineCodec($t(),We())}function rx(e,r){return Array.isArray(r)?{__kind:e,fields:r}:{__kind:e,...r??{}}}function ox(e,r){return r.__kind===e}function hn(){return getStructEncoder([["pubkey",h()],["role",getU8Encoder()],["permissions",Ae()],["padding",getU8Encoder()],["isDelegate",getU8Encoder()]])}function Un(){return getStructDecoder([["pubkey",k()],["role",getU8Decoder()],["permissions",ge()],["padding",getU8Decoder()],["isDelegate",getU8Decoder()]])}function ix(){return combineCodec(hn(),Un())}function h(){return getStructEncoder([["keyType",getU8Encoder()],["key",fixEncoderSize(getBytesEncoder(),33)]])}function k(){return getStructDecoder([["keyType",getU8Decoder()],["key",fixDecoderSize(getBytesDecoder(),33)]])}function Ax(){return combineCodec(h(),k())}function Qt(){return getStructEncoder([["merkleTreePubkeyIndex",getU8Encoder()],["queuePubkeyIndex",getU8Encoder()],["leafIndex",getU32Encoder()],["proveByIndex",getBooleanEncoder()]])}function en(){return getStructDecoder([["merkleTreePubkeyIndex",getU8Decoder()],["queuePubkeyIndex",getU8Decoder()],["leafIndex",getU32Decoder()],["proveByIndex",getBooleanDecoder()]])}function px(){return combineCodec(Qt(),en())}function fn(){return getStructEncoder([])}function Sn(){return getStructDecoder([])}function Tx(){return combineCodec(fn(),Sn())}function xn(){return getStructEncoder([])}function In(){return getStructDecoder([])}function xx(){return combineCodec(xn(),In())}function Ae(){return getStructEncoder([["mask",getU8Encoder()]])}function ge(){return getStructDecoder([["mask",getU8Decoder()]])}function Dx(){return combineCodec(Ae(),ge())}function vn(){return getStructEncoder([["proof",getOptionEncoder(Yt())],["lightCpiAccountsStartIndex",getU8Encoder()]])}function kn(){return getStructDecoder([["proof",getOptionDecoder(Jt())],["lightCpiAccountsStartIndex",getU8Decoder()]])}function Rx(){return combineCodec(vn(),kn())}function yn(){return getStructEncoder([["memberKey",h()]])}function Tn(){return getStructDecoder([["memberKey",k()]])}function Ux(){return combineCodec(yn(),Tn())}function dn(){return getStructEncoder([["baseRent",getU16Encoder()],["compressionCost",getU16Encoder()],["lamportsPerBytePerEpoch",getU8Encoder()],["maxFundedEpochs",getU8Encoder()],["maxTopUp",getU16Encoder()]])}function An(){return getStructDecoder([["baseRent",getU16Decoder()],["compressionCost",getU16Decoder()],["lamportsPerBytePerEpoch",getU8Decoder()],["maxFundedEpochs",getU8Decoder()],["maxTopUp",getU16Decoder()]])}function Lx(){return combineCodec(dn(),An())}function Wn(){return getTupleEncoder([fixEncoderSize(getBytesEncoder(),33)])}function Ge(){return getTupleDecoder([fixDecoderSize(getBytesDecoder(),33)])}function Bx(){return combineCodec(Wn(),Ge())}function w(){return getStructEncoder([["signedMessageIndex",getU8Encoder()],["slotNumber",getU64Encoder()],["originIndex",getU8Encoder()],["crossOrigin",getBooleanEncoder()],["truncatedClientDataJson",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["clientAndDeviceHash",fixEncoderSize(getBytesEncoder(),32)]])}function F(){return getStructDecoder([["signedMessageIndex",getU8Decoder()],["slotNumber",getU64Decoder()],["originIndex",getU8Decoder()],["crossOrigin",getBooleanDecoder()],["truncatedClientDataJson",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["clientAndDeviceHash",fixDecoderSize(getBytesDecoder(),32)]])}function Fx(){return combineCodec(w(),F())}function Bn(){return getStructEncoder([["verifyArgs",w()],["domainConfigIndex",getU8Encoder()]])}function Nn(){return getStructDecoder([["verifyArgs",F()],["domainConfigIndex",getU8Decoder()]])}function zx(){return combineCodec(Bn(),Nn())}function wn(){return getStructEncoder([["index",getU128Encoder()],["isDelegate",getBooleanEncoder()]])}function Fn(){return getStructDecoder([["index",getU128Decoder()],["isDelegate",getBooleanDecoder()]])}function jx(){return combineCodec(wn(),Fn())}function Gn(){return getStructEncoder([["index",getU8Encoder()],["restricted",getBooleanEncoder()]])}function Vn(){return getStructDecoder([["index",getU8Decoder()],["restricted",getBooleanDecoder()]])}function Zx(){return combineCodec(Gn(),Vn())}function En(){return getStructEncoder([["updateAuthority",getAddressEncoder()],["mint",getAddressEncoder()],["name",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["symbol",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["uri",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["additionalMetadata",getArrayEncoder(Wt())]])}function Dn(){return getStructDecoder([["updateAuthority",getAddressDecoder()],["mint",getAddressDecoder()],["name",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["symbol",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["uri",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["additionalMetadata",getArrayDecoder(Bt())]])}function eI(){return combineCodec(En(),Dn())}function Jn(){return getStructEncoder([["lookupTableAddressIndex",getU8Encoder()],["writableIndexes",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["readonlyIndexes",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]])}function Zn(){return getStructDecoder([["lookupTableAddressIndex",getU8Decoder()],["writableIndexes",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["readonlyIndexes",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function rI(){return combineCodec(Jn(),Zn())}function $(){return getDiscriminatedUnionEncoder([["Ed25519",getStructEncoder([["fields",getTupleEncoder([getU8Encoder()])]])],["Secp256r1",getStructEncoder([["fields",getTupleEncoder([Bn()])]])]])}function Q(){return getDiscriminatedUnionDecoder([["Ed25519",getStructDecoder([["fields",getTupleDecoder([getU8Decoder()])]])],["Secp256r1",getStructDecoder([["fields",getTupleDecoder([Nn()])]])]])}function aI(){return combineCodec($(),Q())}function iI(e,r){return Array.isArray(r)?{__kind:e,fields:r}:{__kind:e,...r??{}}}function uI(e,r){return r.__kind===e}function bn(){return getStructEncoder([["withheldAmount",getU64Encoder()]])}function Cn(){return getStructDecoder([["withheldAmount",getU64Decoder()]])}function gI(){return combineCodec(bn(),Cn())}function Mn(){return getStructEncoder([["transferring",getU8Encoder()]])}function Rn(){return getStructDecoder([["transferring",getU8Decoder()]])}function mI(){return combineCodec(Mn(),Rn())}var Xn=(a=>(a[a.Ble=0]="Ble",a[a.Cable=1]="Cable",a[a.Hybrid=2]="Hybrid",a[a.Internal=3]="Internal",a[a.Nfc=4]="Nfc",a[a.SmartCard=5]="SmartCard",a[a.Usb=6]="Usb",a))(Xn||{});function Ve(){return getEnumEncoder(Xn)}function He(){return getEnumDecoder(Xn)}function fI(){return combineCodec(Ve(),He())}var be=(n=>(n[n.TransactionManager=0]="TransactionManager",n[n.Administrator=1]="Administrator",n[n.PermanentMember=2]="PermanentMember",n[n.Member=3]="Member",n))(be||{});function Te(){return getEnumEncoder(be)}function fe(){return getEnumDecoder(be)}function II(){return combineCodec(Te(),fe())}var Oo=new Uint8Array([223,179,163,190,177,224,67,173]);function cE(){return fixEncoderSize(getBytesEncoder(),8).encode(Oo)}function Rg(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["index",getU128Encoder()],["members",getArrayEncoder(hn())],["threshold",getU8Encoder()],["multiWalletBump",getU8Encoder()],["bump",getU8Encoder()],["padding",getU8Encoder()],["latestSlotNumber",getU64Encoder()]]),e=>({...e,discriminator:Oo}))}function ut(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["index",getU128Decoder()],["members",getArrayDecoder(Un())],["threshold",getU8Decoder()],["multiWalletBump",getU8Decoder()],["bump",getU8Decoder()],["padding",getU8Decoder()],["latestSlotNumber",getU64Decoder()]])}function aE(){return combineCodec(Rg(),ut())}function Wo(e){return decodeAccount(e,ut())}async function Bo(e,r,t){let o=await Pg(e,r,t);return assertAccountExists(o),o}async function Pg(e,r,t){let o=await fetchEncodedAccount(e,r,t);return Wo(o)}async function iE(e,r,t){let o=await _g(e,r,t);return assertAccountsExist(o),o}async function _g(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>Wo(n))}var Vo=new Uint8Array([90,36,35,219,93,225,110,96]);function gE(){return fixEncoderSize(getBytesEncoder(),8).encode(Vo)}function jg(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["multiWalletSettings",getAddressEncoder()],["multiWalletBump",getU8Encoder()],["canExecute",getBooleanEncoder()],["preauthorizeExecution",getBooleanEncoder()],["validTill",getU64Encoder()],["payer",getAddressEncoder()],["bump",getU8Encoder()],["bufferIndex",getU8Encoder()],["finalBufferHash",fixEncoderSize(getBytesEncoder(),32)],["finalBufferSize",getU16Encoder()],["creator",h()],["executor",h()],["bufferExtendHashes",getArrayEncoder(fixEncoderSize(getBytesEncoder(),32))],["voters",getArrayEncoder(h())],["expectedSigners",getArrayEncoder(we())],["buffer",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]]),e=>({...e,discriminator:Vo}))}function Ho(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["multiWalletSettings",getAddressDecoder()],["multiWalletBump",getU8Decoder()],["canExecute",getBooleanDecoder()],["preauthorizeExecution",getBooleanDecoder()],["validTill",getU64Decoder()],["payer",getAddressDecoder()],["bump",getU8Decoder()],["bufferIndex",getU8Decoder()],["finalBufferHash",fixDecoderSize(getBytesDecoder(),32)],["finalBufferSize",getU16Decoder()],["creator",k()],["executor",k()],["bufferExtendHashes",getArrayDecoder(fixDecoderSize(getBytesDecoder(),32))],["voters",getArrayDecoder(k())],["expectedSigners",getArrayDecoder(Fe())],["buffer",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function lE(){return combineCodec(jg(),Ho())}function zo(e){return decodeAccount(e,Ho())}async function pE(e,r,t){let o=await Yg(e,r,t);return assertAccountExists(o),o}async function Yg(e,r,t){let o=await fetchEncodedAccount(e,r,t);return zo(o)}async function mE(e,r,t){let o=await Jg(e,r,t);return assertAccountsExist(o),o}async function Jg(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>zo(n))}var Qo=new Uint8Array([159,117,95,227,239,151,58,236]);function SE(){return fixEncoderSize(getBytesEncoder(),8).encode(Qo)}function gl(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),8)],["domainConfig",getOptionEncoder(getAddressEncoder())],["member",h()],["credentialId",getOptionEncoder(addEncoderSizePrefix(getBytesEncoder(),getU32Encoder()))],["transports",getOptionEncoder(getArrayEncoder(Ve()))],["wallets",getArrayEncoder(wn())],["role",Te()],["transactionManagerUrl",getOptionEncoder(addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder()))],["bump",getU8Encoder()]]),e=>({...e,discriminator:Qo}))}function pt(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),8)],["domainConfig",getOptionDecoder(getAddressDecoder())],["member",k()],["credentialId",getOptionDecoder(addDecoderSizePrefix(getBytesDecoder(),getU32Decoder()))],["transports",getOptionDecoder(getArrayDecoder(He()))],["wallets",getArrayDecoder(Fn())],["role",fe()],["transactionManagerUrl",getOptionDecoder(addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder()))],["bump",getU8Decoder()]])}function xE(){return combineCodec(gl(),pt())}function es(e){return decodeAccount(e,pt())}async function ts(e,r,t){let o=await ll(e,r,t);return assertAccountExists(o),o}async function ll(e,r,t){let o=await fetchEncodedAccount(e,r,t);return es(o)}async function IE(e,r,t){let o=await pl(e,r,t);return assertAccountsExist(o),o}async function pl(e,r,t){return (await fetchEncodedAccounts(e,r,t)).map(n=>es(n))}function y({args:e}){if(!e)return [];let{remainingAccounts:r}=e;return r.map(t=>t.signer?{address:t.address,role:t.role,signer:t.signer}:{address:t.address,role:t.role})}function rs(e){if(e==null)throw new Error("Expected a value but received null or undefined.");return e}function P(e){if(!e)throw new Error("Expected a Address.");return typeof e=="object"&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function T(e,r){return t=>{if(!t.value)return Object.freeze({address:e,role:AccountRole.READONLY});let o=t.isWritable?AccountRole.WRITABLE:AccountRole.READONLY;return Object.freeze({address:P(t.value),role:ns(t.value)?upgradeRoleToSigner(o):o,...ns(t.value)?{signer:t.value}:{}})}}function ns(e){return !!e&&typeof e=="object"&&"address"in e&&isTransactionSigner(e)}var is=new Uint8Array([8]);function wE(){return fixEncoderSize(getBytesEncoder(),1).encode(is)}function us(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["configActions",getArrayEncoder(Be())],["signers",getArrayEncoder($())]]),e=>({...e,discriminator:is}))}function ds(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["configActions",getArrayDecoder(Ne())],["signers",getArrayDecoder(Q())]])}function FE(){return combineCodec(us(),ds())}function As(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.systemProgram),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:us().encode(c),programAddress:t})}function GE(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),systemProgram:t(),slotHashSysvar:o(),instructionsSysvar:t()},data:ds().decode(e.data)}}var Ss=new Uint8Array([0]);function jE(){return fixEncoderSize(getBytesEncoder(),1).encode(Ss)}function cr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["rpId",addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder())],["origins",getArrayEncoder(addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder()))]]),e=>({...e,discriminator:Ss}))}function xs(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["rpId",addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder())],["origins",getArrayDecoder(addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder()))]])}function YE(){return combineCodec(cr(),xs())}async function JE(e,r){let t=r?.programAddress??A,n={domainConfig:{value:e.domainConfig??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},authority:{value:e.authority??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.userAccount.value||(n.userAccount.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([117,115,101,114])),getAddressEncoder().encode(P(n.authority.value))]}));let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.domainConfig),s(n.payer),s(n.authority),s(n.systemProgram),s(n.userAccount),...a],data:cr().encode(c),programAddress:t})}function Is(e,r){let t=r?.programAddress??A,n={domainConfig:{value:e.domainConfig??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},authority:{value:e.authority??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.domainConfig),s(n.payer),s(n.authority),s(n.systemProgram),s(n.userAccount),...a],data:cr().encode(c),programAddress:t})}function ZE(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{domainConfig:t(),payer:t(),authority:t(),systemProgram:t(),userAccount:t()},data:xs().decode(e.data)}}var bs=new Uint8Array([4]);function rD(){return fixEncoderSize(getBytesEncoder(),1).encode(bs)}function Cs(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["member",Wn()],["role",Te()],["credentialId",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())],["transports",getArrayEncoder(Ve())]]),e=>({...e,discriminator:bs}))}function Ms(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["member",Ge()],["role",fe()],["credentialId",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())],["transports",getArrayDecoder(He())]])}function oD(){return combineCodec(Cs(),Ms())}function Rs(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},domainConfig:{value:e.domainConfig??null,isWritable:false},authority:{value:e.authority??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true},transactionManagerAccount:{value:e.transactionManagerAccount??null,isWritable:false},settings:{value:e.settings??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.domainConfig),s(n.authority),s(n.userAccount),s(n.transactionManagerAccount),s(n.settings),s(n.systemProgram),...a],data:Cs().encode(c),programAddress:t})}function sD(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{payer:t(),domainConfig:t(),authority:t(),userAccount:t(),transactionManagerAccount:o(),settings:o(),systemProgram:t()},data:Ms().decode(e.data)}}var _s=new Uint8Array([3]);function AD(){return fixEncoderSize(getBytesEncoder(),1).encode(_s)}function ur(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)]]),e=>({...e,discriminator:_s}))}function hs(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)]])}function gD(){return combineCodec(ur(),hs())}async function Us(e,r){let t=r?.programAddress??A,n={globalCounter:{value:e.globalCounter??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={};n.globalCounter.value||(n.globalCounter.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([103,108,111,98,97,108,95,99,111,117,110,116,101,114]))]})),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let i=y(c),a=T(t);return Object.freeze({accounts:[a(n.globalCounter),a(n.payer),a(n.systemProgram),...i],data:ur().encode({}),programAddress:t})}function lD(e,r){let t=r?.programAddress??A,n={globalCounter:{value:e.globalCounter??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let i=y(c),a=T(t);return Object.freeze({accounts:[a(n.globalCounter),a(n.payer),a(n.systemProgram),...i],data:ur().encode({}),programAddress:t})}function pD(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{globalCounter:t(),payer:t(),systemProgram:t()},data:hs().decode(e.data)}}var ks=new Uint8Array([5]);function ID(){return fixEncoderSize(getBytesEncoder(),1).encode(ks)}function Ar(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["role",Te()],["transactionManagerUrl",getOptionEncoder(addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder()))]]),e=>({...e,discriminator:ks}))}function Ls(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["role",fe()],["transactionManagerUrl",getOptionDecoder(addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder()))]])}function ED(){return combineCodec(Ar(),Ls())}async function DD(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},member:{value:e.member??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.userAccount.value||(n.userAccount.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([117,115,101,114])),getAddressEncoder().encode(P(n.member.value))]}));let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.member),s(n.systemProgram),s(n.userAccount),...a],data:Ar().encode(c),programAddress:t})}function Os(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},member:{value:e.member??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.member),s(n.systemProgram),s(n.userAccount),...a],data:Ar().encode(c),programAddress:t})}function bD(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{payer:t(),member:t(),systemProgram:t(),userAccount:t()},data:Ls().decode(e.data)}}var Ns=new Uint8Array([16]);function hD(){return fixEncoderSize(getBytesEncoder(),1).encode(Ns)}function lr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["settingsIndex",getU128Encoder()]]),e=>({...e,discriminator:Ns}))}function ws(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["settingsIndex",getU128Decoder()]])}function UD(){return combineCodec(lr(),ws())}async function vD(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},initialMember:{value:e.initialMember??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},globalCounter:{value:e.globalCounter??null,isWritable:true},userAccount:{value:e.userAccount??null,isWritable:true},settings:{value:e.settings??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.globalCounter.value||(n.globalCounter.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([103,108,111,98,97,108,95,99,111,117,110,116,101,114]))]})),n.userAccount.value||(n.userAccount.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([117,115,101,114])),getAddressEncoder().encode(P(n.initialMember.value))]})),n.settings.value||(n.settings.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([109,117,108,116,105,95,119,97,108,108,101,116])),getU128Encoder().encode(rs(c.settingsIndex))]}));let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.initialMember),s(n.systemProgram),s(n.globalCounter),s(n.userAccount),s(n.settings),...a],data:lr().encode(c),programAddress:t})}function Fs(e,r){let t=r?.programAddress??A,n={payer:{value:e.payer??null,isWritable:true},initialMember:{value:e.initialMember??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},globalCounter:{value:e.globalCounter??null,isWritable:true},userAccount:{value:e.userAccount??null,isWritable:true},settings:{value:e.settings??null,isWritable:true}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.payer),s(n.initialMember),s(n.systemProgram),s(n.globalCounter),s(n.userAccount),s(n.settings),...a],data:lr().encode(c),programAddress:t})}function kD(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{payer:t(),initialMember:t(),systemProgram:t(),globalCounter:t(),userAccount:t(),settings:t()},data:ws().decode(e.data)}}var Hs=new Uint8Array([2]);function wD(){return fixEncoderSize(getBytesEncoder(),1).encode(Hs)}function zs(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["disable",getBooleanEncoder()]]),e=>({...e,discriminator:Hs}))}function Ks(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["disable",getBooleanDecoder()]])}function FD(){return combineCodec(zs(),Ks())}function qs(e,r){let t=r?.programAddress??A,n={domainConfig:{value:e.domainConfig??null,isWritable:true},admin:{value:e.admin??null,isWritable:false}},c={...e},a=y({args:c}),s=T(t);return Object.freeze({accounts:[s(n.domainConfig),s(n.admin),...a],data:zs().encode(c),programAddress:t})}function GD(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{domainConfig:t(),admin:t()},data:Ks().decode(e.data)}}var Js=new Uint8Array([1]);function jD(){return fixEncoderSize(getBytesEncoder(),1).encode(Js)}function Zs(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["newOrigins",getOptionEncoder(getArrayEncoder(addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder())))]]),e=>({...e,discriminator:Js}))}function Xs(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["newOrigins",getOptionDecoder(getArrayDecoder(addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder())))]])}function YD(){return combineCodec(Zs(),Xs())}function $s(e,r){let t=r?.programAddress??A,n={domainConfig:{value:e.domainConfig??null,isWritable:true},authority:{value:e.authority??null,isWritable:true},newAuthority:{value:e.newAuthority??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.domainConfig),s(n.authority),s(n.newAuthority),s(n.userAccount),s(n.systemProgram),...a],data:Zs().encode(c),programAddress:t})}function JD(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{domainConfig:t(),authority:t(),newAuthority:o(),userAccount:o(),systemProgram:t()},data:Xs().decode(e.data)}}var ec=new Uint8Array([6]);function tb(){return fixEncoderSize(getBytesEncoder(),1).encode(ec)}function mr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["transactionManagerUrl",addEncoderSizePrefix(getUtf8Encoder(),getU32Encoder())]]),e=>({...e,discriminator:ec}))}function tc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["transactionManagerUrl",addDecoderSizePrefix(getUtf8Decoder(),getU32Decoder())]])}function nb(){return combineCodec(mr(),tc())}async function rb(e,r){let t=r?.programAddress??A,n={signer:{value:e.signer??null,isWritable:false},transactionManagerAccount:{value:e.transactionManagerAccount??null,isWritable:true}},c={...e},i={args:c};n.transactionManagerAccount.value||(n.transactionManagerAccount.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([117,115,101,114])),getAddressEncoder().encode(P(n.signer.value))]}));let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.signer),s(n.transactionManagerAccount),...a],data:mr().encode(c),programAddress:t})}function nc(e,r){let t=r?.programAddress??A,n={signer:{value:e.signer??null,isWritable:false},transactionManagerAccount:{value:e.transactionManagerAccount??null,isWritable:true}},c={...e},a=y({args:c}),s=T(t);return Object.freeze({accounts:[s(n.signer),s(n.transactionManagerAccount),...a],data:mr().encode(c),programAddress:t})}function ob(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{signer:t(),transactionManagerAccount:t()},data:tc().decode(e.data)}}var ac=new Uint8Array([7]);function Ab(){return fixEncoderSize(getBytesEncoder(),1).encode(ac)}function ic(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["secp256r1VerifyArgs",getOptionEncoder(w())],["delegateTo",getOptionEncoder(getU128Encoder())]]),e=>({...e,discriminator:ac}))}function uc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["secp256r1VerifyArgs",getOptionDecoder(F())],["delegateTo",getOptionDecoder(getU128Decoder())]])}function gb(){return combineCodec(ic(),uc())}function dc(e,r){let t=r?.programAddress??A,n={feePayer:{value:e.feePayer??null,isWritable:true},signer:{value:e.signer??null,isWritable:false},userAccount:{value:e.userAccount??null,isWritable:true},oldSettings:{value:e.oldSettings??null,isWritable:true},newSettings:{value:e.newSettings??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},domainConfig:{value:e.domainConfig??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.feePayer),s(n.signer),s(n.userAccount),s(n.oldSettings),s(n.newSettings),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.domainConfig),...a],data:ic().encode(c),programAddress:t})}function lb(e){if(e.accounts.length<8)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{feePayer:t(),signer:o(),userAccount:t(),oldSettings:o(),newSettings:o(),slotHashSysvar:o(),instructionsSysvar:o(),domainConfig:o()},data:uc().decode(e.data)}}var gc=new Uint8Array([17]);function xb(){return fixEncoderSize(getBytesEncoder(),1).encode(gc)}function yr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["amount",getU64Encoder()],["signers",getArrayEncoder($())]]),e=>({...e,discriminator:gc}))}function lc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["amount",getU64Decoder()],["signers",getArrayDecoder(Q())]])}function Ib(){return combineCodec(yr(),lc())}async function Eb(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},source:{value:e.source??null,isWritable:true},destination:{value:e.destination??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.source.value||(n.source.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([109,117,108,116,105,95,119,97,108,108,101,116])),getAddressEncoder().encode(P(n.settings.value)),getBytesEncoder().encode(new Uint8Array([118,97,117,108,116]))]})),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.source),s(n.destination),s(n.systemProgram),...a],data:yr().encode(c),programAddress:t})}function pc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},source:{value:e.source??null,isWritable:true},destination:{value:e.destination??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.source),s(n.destination),s(n.systemProgram),...a],data:yr().encode(c),programAddress:t})}function Db(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),slotHashSysvar:o(),instructionsSysvar:t(),source:t(),destination:t(),systemProgram:t()},data:lc().decode(e.data)}}var xc=new Uint8Array([18]);function hb(){return fixEncoderSize(getBytesEncoder(),1).encode(xc)}function Tr(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["splInterfacePdaArgs",getOptionEncoder(Gn())],["amount",getU64Encoder()],["sourceCompressedTokenAccounts",getArrayEncoder(Zt())],["compressedProofArgs",getOptionEncoder(vn())],["signers",getArrayEncoder($())]]),e=>({...e,discriminator:xc}))}function Ic(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["splInterfacePdaArgs",getOptionDecoder(Vn())],["amount",getU64Decoder()],["sourceCompressedTokenAccounts",getArrayDecoder(Xt())],["compressedProofArgs",getOptionDecoder(kn())],["signers",getArrayDecoder(Q())]])}function Ub(){return combineCodec(Tr(),Ic())}async function vb(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},source:{value:e.source??null,isWritable:false},sourceSplTokenAccount:{value:e.sourceSplTokenAccount??null,isWritable:true},sourceCtokenTokenAccount:{value:e.sourceCtokenTokenAccount??null,isWritable:true},destination:{value:e.destination??null,isWritable:false},destinationSplTokenAccount:{value:e.destinationSplTokenAccount??null,isWritable:true},destinationCtokenTokenAccount:{value:e.destinationCtokenTokenAccount??null,isWritable:true},tokenProgram:{value:e.tokenProgram??null,isWritable:false},mint:{value:e.mint??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false},compressedTokenProgramAuthority:{value:e.compressedTokenProgramAuthority??null,isWritable:false},splInterfacePda:{value:e.splInterfacePda??null,isWritable:true},compressibleConfig:{value:e.compressibleConfig??null,isWritable:false},rentSponsor:{value:e.rentSponsor??null,isWritable:true},compressedTokenProgram:{value:e.compressedTokenProgram??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.source.value||(n.source.value=await getProgramDerivedAddress({programAddress:t,seeds:[getBytesEncoder().encode(new Uint8Array([109,117,108,116,105,95,119,97,108,108,101,116])),getAddressEncoder().encode(P(n.settings.value)),getBytesEncoder().encode(new Uint8Array([118,97,117,108,116]))]})),n.tokenProgram.value||(n.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n.sourceSplTokenAccount.value||(n.sourceSplTokenAccount.value=await getProgramDerivedAddress({programAddress:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",seeds:[getAddressEncoder().encode(P(n.source.value)),getAddressEncoder().encode(P(n.tokenProgram.value)),getAddressEncoder().encode(P(n.mint.value))]})),n.sourceCtokenTokenAccount.value||(n.sourceCtokenTokenAccount.value=await getProgramDerivedAddress({programAddress:"cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m",seeds:[getAddressEncoder().encode(P(n.source.value)),getBytesEncoder().encode(new Uint8Array([9,21,163,87,35,121,78,143,182,93,7,91,107,114,105,156,56,221,2,229,148,139,117,176,229,160,65,142,128,151,91,68])),getAddressEncoder().encode(P(n.mint.value))]})),n.destinationSplTokenAccount.value||(n.destinationSplTokenAccount.value=await getProgramDerivedAddress({programAddress:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",seeds:[getAddressEncoder().encode(P(n.destination.value)),getAddressEncoder().encode(P(n.tokenProgram.value)),getAddressEncoder().encode(P(n.mint.value))]})),n.destinationCtokenTokenAccount.value||(n.destinationCtokenTokenAccount.value=await getProgramDerivedAddress({programAddress:"cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m",seeds:[getAddressEncoder().encode(P(n.destination.value)),getBytesEncoder().encode(new Uint8Array([9,21,163,87,35,121,78,143,182,93,7,91,107,114,105,156,56,221,2,229,148,139,117,176,229,160,65,142,128,151,91,68])),getAddressEncoder().encode(P(n.mint.value))]})),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.compressedTokenProgramAuthority.value||(n.compressedTokenProgramAuthority.value="GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy"),n.compressedTokenProgram.value||(n.compressedTokenProgram.value="cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.source),s(n.sourceSplTokenAccount),s(n.sourceCtokenTokenAccount),s(n.destination),s(n.destinationSplTokenAccount),s(n.destinationCtokenTokenAccount),s(n.tokenProgram),s(n.mint),s(n.systemProgram),s(n.compressedTokenProgramAuthority),s(n.splInterfacePda),s(n.compressibleConfig),s(n.rentSponsor),s(n.compressedTokenProgram),...a],data:Tr().encode(c),programAddress:t})}function Ec(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},source:{value:e.source??null,isWritable:false},sourceSplTokenAccount:{value:e.sourceSplTokenAccount??null,isWritable:true},sourceCtokenTokenAccount:{value:e.sourceCtokenTokenAccount??null,isWritable:true},destination:{value:e.destination??null,isWritable:false},destinationSplTokenAccount:{value:e.destinationSplTokenAccount??null,isWritable:true},destinationCtokenTokenAccount:{value:e.destinationCtokenTokenAccount??null,isWritable:true},tokenProgram:{value:e.tokenProgram??null,isWritable:false},mint:{value:e.mint??null,isWritable:true},systemProgram:{value:e.systemProgram??null,isWritable:false},compressedTokenProgramAuthority:{value:e.compressedTokenProgramAuthority??null,isWritable:false},splInterfacePda:{value:e.splInterfacePda??null,isWritable:true},compressibleConfig:{value:e.compressibleConfig??null,isWritable:false},rentSponsor:{value:e.rentSponsor??null,isWritable:true},compressedTokenProgram:{value:e.compressedTokenProgram??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.tokenProgram.value||(n.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.compressedTokenProgramAuthority.value||(n.compressedTokenProgramAuthority.value="GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy"),n.compressedTokenProgram.value||(n.compressedTokenProgram.value="cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.slotHashSysvar),s(n.instructionsSysvar),s(n.source),s(n.sourceSplTokenAccount),s(n.sourceCtokenTokenAccount),s(n.destination),s(n.destinationSplTokenAccount),s(n.destinationCtokenTokenAccount),s(n.tokenProgram),s(n.mint),s(n.systemProgram),s(n.compressedTokenProgramAuthority),s(n.splInterfacePda),s(n.compressibleConfig),s(n.rentSponsor),s(n.compressedTokenProgram),...a],data:Tr().encode(c),programAddress:t})}function kb(e){if(e.accounts.length<18)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),slotHashSysvar:o(),instructionsSysvar:t(),source:t(),sourceSplTokenAccount:t(),sourceCtokenTokenAccount:t(),destination:t(),destinationSplTokenAccount:o(),destinationCtokenTokenAccount:o(),tokenProgram:t(),mint:t(),systemProgram:t(),compressedTokenProgramAuthority:t(),splInterfacePda:o(),compressibleConfig:t(),rentSponsor:o(),compressedTokenProgram:t()},data:Ic().decode(e.data)}}var Cc=new Uint8Array([12]);function Fb(){return fixEncoderSize(getBytesEncoder(),1).encode(Cc)}function Mc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["secp256r1VerifyArgs",getOptionEncoder(w())]]),e=>({...e,discriminator:Cc}))}function Rc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["secp256r1VerifyArgs",getOptionDecoder(F())]])}function Gb(){return combineCodec(Mc(),Rc())}function Pc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},domainConfig:{value:e.domainConfig??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true},closer:{value:e.closer??null,isWritable:false},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.domainConfig),s(n.transactionBuffer),s(n.closer),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:Mc().encode(c),programAddress:t})}function Vb(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),domainConfig:o(),transactionBuffer:t(),closer:o(),slotHashSysvar:o(),instructionsSysvar:o()},data:Rc().decode(e.data)}}var Uc=new Uint8Array([9]);function Jb(){return fixEncoderSize(getBytesEncoder(),1).encode(Uc)}function vc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["bufferIndex",getU8Encoder()],["preauthorizeExecution",getBooleanEncoder()],["bufferExtendHashes",getArrayEncoder(fixEncoderSize(getBytesEncoder(),32))],["finalBufferHash",fixEncoderSize(getBytesEncoder(),32)],["finalBufferSize",getU16Encoder()],["expectedSigners",getArrayEncoder(we())],["secp256r1VerifyArgs",getOptionEncoder(w())]]),e=>({...e,discriminator:Uc}))}function kc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["bufferIndex",getU8Decoder()],["preauthorizeExecution",getBooleanDecoder()],["bufferExtendHashes",getArrayDecoder(fixDecoderSize(getBytesDecoder(),32))],["finalBufferHash",fixDecoderSize(getBytesDecoder(),32)],["finalBufferSize",getU16Decoder()],["expectedSigners",getArrayDecoder(Fe())],["secp256r1VerifyArgs",getOptionDecoder(F())]])}function Zb(){return combineCodec(vc(),kc())}function Lc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:false},payer:{value:e.payer??null,isWritable:true},domainConfig:{value:e.domainConfig??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true},creator:{value:e.creator??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111"),n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.domainConfig),s(n.transactionBuffer),s(n.creator),s(n.systemProgram),s(n.instructionsSysvar),s(n.slotHashSysvar),...a],data:vc().encode(c),programAddress:t})}function Xb(e){if(e.accounts.length<8)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),domainConfig:o(),transactionBuffer:t(),creator:o(),systemProgram:t(),instructionsSysvar:t(),slotHashSysvar:o()},data:kc().decode(e.data)}}var Bc=new Uint8Array([13]);function oC(){return fixEncoderSize(getBytesEncoder(),1).encode(Bc)}function Nc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["secp256r1VerifyArgs",getOptionEncoder(w())]]),e=>({...e,discriminator:Bc}))}function wc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["secp256r1VerifyArgs",getOptionDecoder(F())]])}function sC(){return combineCodec(Nc(),wc())}function Fc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},domainConfig:{value:e.domainConfig??null,isWritable:false},executor:{value:e.executor??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.domainConfig),s(n.executor),s(n.transactionBuffer),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:Nc().encode(c),programAddress:t})}function cC(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),domainConfig:o(),executor:o(),transactionBuffer:t(),slotHashSysvar:o(),instructionsSysvar:o()},data:wc().decode(e.data)}}var Hc=new Uint8Array([11]);function gC(){return fixEncoderSize(getBytesEncoder(),1).encode(Hc)}function zc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["buffer",addEncoderSizePrefix(getBytesEncoder(),getU32Encoder())]]),e=>({...e,discriminator:Hc}))}function Kc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["buffer",addDecoderSizePrefix(getBytesDecoder(),getU32Decoder())]])}function lC(){return combineCodec(zc(),Kc())}function qc(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true}},c={...e},a=y({args:c}),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.transactionBuffer),...a],data:zc().encode(c),programAddress:t})}function pC(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{settings:t(),transactionBuffer:t()},data:Kc().decode(e.data)}}var Jc=new Uint8Array([10]);function IC(){return fixEncoderSize(getBytesEncoder(),1).encode(Jc)}function Zc(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["secp256r1VerifyArgs",getOptionEncoder(w())]]),e=>({...e,discriminator:Jc}))}function Xc(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["secp256r1VerifyArgs",getOptionDecoder(F())]])}function EC(){return combineCodec(Zc(),Xc())}function $c(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:false},domainConfig:{value:e.domainConfig??null,isWritable:false},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true},voter:{value:e.voter??null,isWritable:false},systemProgram:{value:e.systemProgram??null,isWritable:false},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.systemProgram.value||(n.systemProgram.value="11111111111111111111111111111111"),n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.domainConfig),s(n.transactionBuffer),s(n.voter),s(n.systemProgram),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:Zc().encode(c),programAddress:t})}function DC(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),domainConfig:o(),transactionBuffer:t(),voter:o(),systemProgram:t(),slotHashSysvar:o(),instructionsSysvar:o()},data:Xc().decode(e.data)}}var ta=new Uint8Array([14]);function _C(){return fixEncoderSize(getBytesEncoder(),1).encode(ta)}function na(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)]]),e=>({...e,discriminator:ta}))}function ra(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)]])}function hC(){return combineCodec(na(),ra())}function oa(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},payer:{value:e.payer??null,isWritable:true},transactionBuffer:{value:e.transactionBuffer??null,isWritable:true}},c={...e},a=y({args:c}),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.payer),s(n.transactionBuffer),...a],data:na().encode({}),programAddress:t})}function UC(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let r=0,t=()=>{let o=e.accounts[r];return r+=1,o};return {programAddress:e.programAddress,accounts:{settings:t(),payer:t(),transactionBuffer:t()},data:ra().decode(e.data)}}var aa=new Uint8Array([15]);function NC(){return fixEncoderSize(getBytesEncoder(),1).encode(aa)}function ia(){return transformEncoder(getStructEncoder([["discriminator",fixEncoderSize(getBytesEncoder(),1)],["numSigners",getU8Encoder()],["numWritableSigners",getU8Encoder()],["numWritableNonSigners",getU8Encoder()],["numAccountKeys",getU8Encoder()],["instructions",getArrayEncoder(Ft())],["addressTableLookups",getArrayEncoder(Jn())],["signers",getArrayEncoder($())]]),e=>({...e,discriminator:aa}))}function ua(){return getStructDecoder([["discriminator",fixDecoderSize(getBytesDecoder(),1)],["numSigners",getU8Decoder()],["numWritableSigners",getU8Decoder()],["numWritableNonSigners",getU8Decoder()],["numAccountKeys",getU8Decoder()],["instructions",getArrayDecoder(Gt())],["addressTableLookups",getArrayDecoder(Zn())],["signers",getArrayDecoder(Q())]])}function wC(){return combineCodec(ia(),ua())}function da(e,r){let t=r?.programAddress??A,n={settings:{value:e.settings??null,isWritable:true},slotHashSysvar:{value:e.slotHashSysvar??null,isWritable:false},instructionsSysvar:{value:e.instructionsSysvar??null,isWritable:false}},c={...e},i={args:c};n.slotHashSysvar.value||(n.slotHashSysvar.value="SysvarS1otHashes111111111111111111111111111"),n.instructionsSysvar.value||(n.instructionsSysvar.value="Sysvar1nstructions1111111111111111111111111");let a=y(i),s=T(t);return Object.freeze({accounts:[s(n.settings),s(n.slotHashSysvar),s(n.instructionsSysvar),...a],data:ia().encode(c),programAddress:t})}function FC(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let r=0,t=()=>{let n=e.accounts[r];return r+=1,n},o=()=>{let n=t();return n.address===A?void 0:n};return {programAddress:e.programAddress,accounts:{settings:t(),slotHashSysvar:o(),instructionsSysvar:t()},data:ua().decode(e.data)}}var A="reviR1xysEChySVSWGa43a6oJ2boJYTJhwRjo8KJhhT",Wy=(c=>(c[c.DomainConfig=0]="DomainConfig",c[c.GlobalCounter=1]="GlobalCounter",c[c.Settings=2]="Settings",c[c.TransactionBuffer=3]="TransactionBuffer",c[c.User=4]="User",c))(Wy||{});function dM(e){let r="data"in e?e.data:e;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([201,232,212,229,59,241,106,197])),0))return 0;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([42,206,176,58,175,129,130,233])),0))return 1;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([223,179,163,190,177,224,67,173])),0))return 2;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([90,36,35,219,93,225,110,96])),0))return 3;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),8).encode(new Uint8Array([159,117,95,227,239,151,58,236])),0))return 4;throw new Error("The provided account could not be identified as a multiWallet account.")}var By=(l=>(l[l.ChangeConfig=0]="ChangeConfig",l[l.CreateDomainConfig=1]="CreateDomainConfig",l[l.CreateDomainUserAccount=2]="CreateDomainUserAccount",l[l.CreateGlobalCounter=3]="CreateGlobalCounter",l[l.CreateUserAccount=4]="CreateUserAccount",l[l.CreateWallet=5]="CreateWallet",l[l.DisableDomainConfig=6]="DisableDomainConfig",l[l.EditDomainConfig=7]="EditDomainConfig",l[l.EditTransactionManagerUrl=8]="EditTransactionManagerUrl",l[l.EditUserDelegate=9]="EditUserDelegate",l[l.NativeTransferIntent=10]="NativeTransferIntent",l[l.TokenTransferIntent=11]="TokenTransferIntent",l[l.TransactionBufferClose=12]="TransactionBufferClose",l[l.TransactionBufferCreate=13]="TransactionBufferCreate",l[l.TransactionBufferExecute=14]="TransactionBufferExecute",l[l.TransactionBufferExtend=15]="TransactionBufferExtend",l[l.TransactionBufferVote=16]="TransactionBufferVote",l[l.TransactionExecute=17]="TransactionExecute",l[l.TransactionExecuteSync=18]="TransactionExecuteSync",l))(By||{});function AM(e){let r="data"in e?e.data:e;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([8])),0))return 0;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([0])),0))return 1;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([4])),0))return 2;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([3])),0))return 3;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([5])),0))return 4;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([16])),0))return 5;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([2])),0))return 6;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([1])),0))return 7;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([6])),0))return 8;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([7])),0))return 9;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([17])),0))return 10;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([18])),0))return 11;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([12])),0))return 12;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([9])),0))return 13;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([13])),0))return 14;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([11])),0))return 15;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([10])),0))return 16;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([14])),0))return 17;if(containsBytes(r,fixEncoderSize(getBytesEncoder(),1).encode(new Uint8Array([15])),0))return 18;throw new Error("The provided instruction could not be identified as a multiWallet instruction.")}var wy=6e3,Fy=6001,Gy=6002,Vy=6003,Hy=6004,zy=6005,Ky=6006,qy=6007,jy=6008,Yy=6009,Jy=6010,Zy=6011,Xy=6012,$y=6013,Qy=6014,eT=6015,tT=6016,nT=6017,rT=6018,oT=6019,sT=6020,cT=6021,aT=6022,iT=6023,uT=6024,dT=6025,AT=6026,gT=6027,lT=6028,pT=6029,mT=6030,yT=6031,TT=6032,fT=6033,ST=6034,xT=6035,IT=6036,ET=6037,DT=6038,bT=6039,CT=6040,MT=6041,RT=6042,PT=6043,_T=6044,hT=6045,UT=6046,vT=6047,kT=6048,LT=6049,OT=6050,WT=6051,BT=6052,NT=6053,wT=6054,FT=6055,GT=6056,VT=6057,HT=6058,zT=6059,KT=6060,qT=6061,jT=6062,YT=6063,JT=6064,ZT=6065,XT=6066,$T=6067,QT=6068,ef=6069,tf=6070,nf=6071,rf=6072,of=6073,sf=6074,Aa;process.env.NODE_ENV!=="production"&&(Aa={[mT]:"This member is already delegated to another wallet.",[qy]:"The clientDataJSON hash extracted from the signature does not match the generated hash.",[OT]:"Missing credential id.",[BT]:"The domain configuration account is disabled. Please contact support or try again later.",[NT]:"Missing domain configuration account.",[QT]:"Domain configuration account key mismatch. The provided domain config does not match the expected value.",[Jy]:"Duplicate public keys detected among members. Each member must have a unique key.",[Yy]:"Durable nonce detected: this program does not support transactions using a durable nonce.",[cT]:"No members provided. A multisig wallet must contain at least one member.",[rT]:"Expected a User with Administrator role for this instruction.",[jy]:"The message hash associated with the signer does not match the pre-declared expected message hash.",[tT]:"Expected a User with Transaction Manager role for this instruction.",[bT]:"Final buffer hash mismatch: the serialized data may be corrupted or altered.",[CT]:"The serialized transaction buffer exceeds the maximum size of 10,128 bytes.",[MT]:"Declared buffer size does not match the actual serialized size.",[FT]:"Failed to compute hash. This may indicate a system error.",[fT]:"Not enough members with vote permission to meet the approval threshold.",[yT]:"At least one signer with execute permission is required to proceed.",[TT]:"At least one signer with initiate permission is required to perform this action.",[AT]:"One or more provided accounts failed validation. Verify that all required accounts are included and correct.",[$T]:"Invalid account index in transaction message. The account index is out of bounds.",[oT]:"User with Administrator role requires a valid domain config, be a ed25519 Signer and have no delegated wallet.",[lT]:"Invalid or missing instruction arguments. Ensure all required arguments are correctly provided.",[DT]:"Buffer validation failed: contents do not match the expected hash (possible tampering detected).",[GT]:"Member key conversion failed. The provided key format is invalid.",[ST]:"Only delegated members are allowed for this transaction.",[dT]:"Unexpected number of accounts provided for this instruction.",[$y]:"User with Permanent Member role must have a delegated wallet.",[Fy]:"The instruction preceding this program invocation is not a secp256r1 verification instruction.",[Hy]:"The extracted public key has an invalid length or encoding.",[wy]:"Malformed or missing WebAuthn verification parameters. Please provide valid secp256r1 signature arguments.",[Vy]:"Failed to deserialize secp256r1 signature offsets from the instruction data.",[LT]:"The specified slot number is not recent enough. Slot must be within the recent slot history window.",[vT]:"Failed to parse the Slot History sysvar: data format is invalid or corrupted.",[iT]:"Invalid threshold: must be at least 1 and cannot exceed the number of voting-eligible members.",[XT]:"Invalid source type for token transfer. The source account type is not supported.",[nT]:"User with Transaction Manager role requires a valid transaction manager url, be a ed25519 Signer and have no delegated wallet.",[eT]:"Invalid Transaction Manager permissions. Only initiate is allowed.",[uT]:"Malformed transaction message: structure or formatting does not match the expected layout.",[nf]:"Invalid user configuration. Credential ID and transports must be none for ed25519 members.",[gT]:"One or more provided user accounts failed validation. Verify that only users with appropriate roles are allowed to perform this action.",[tf]:"Invalid user configuration. Transaction manager URL must be empty for non-transaction-manager users.",[ZT]:"Light CPI account operation failed. The account may be invalid or uninitialized.",[zy]:"The extracted WebAuthn signed message payload is malformed.",[hT]:"An input string exceeds the maximum allowed character length.",[zT]:"Member not found in settings. Cannot remove a member that does not exist.",[pT]:"A required account is missing from the instruction context.",[VT]:"Compressed proof arguments are missing. Required for compressed account operations.",[jT]:"Missing compressed token account. Required for token transfer operations.",[rf]:"Missing destination token account. Required for token transfer operations.",[JT]:"Missing instructions sysvar account. Required for secp256r1 signature verification.",[HT]:"Light CPI accounts are missing. Required for compressed account operations.",[sf]:"Missing new authority account. Required for domain configuration updates.",[of]:"Missing settings account. Required for delegate operations.",[YT]:"Missing SPL interface PDA. Required for token transfer operations.",[UT]:"Missing required sysvar: Slot History must be included as an account in this instruction.",[IT]:"No valid signer found in this transaction.",[sT]:"Only one administrator is allowed per wallet.",[Xy]:"Only one permanent member is allowed per wallet.",[Qy]:"Only one transaction manager is allowed per wallet.",[wT]:"The given origin index is not in the whitelisted origins.",[qT]:"Payer account mismatch. The provided payer does not match the transaction buffer payer.",[Zy]:"Permanent members cannot be removed from a wallet.",[_T]:"Writable CPI calls to protected accounts are not permitted.",[Ky]:"The rpIdHash extracted from the signed message does not match the expected value.",[KT]:"Settings key mismatch. The provided settings key does not match the expected value.",[Gy]:"The signature index provided is out of bounds for the secp256r1 instruction.",[kT]:"The specified slot number was not found in the provided slot history.",[aT]:"Too many members: a maximum of 4 members are supported.",[RT]:"This transaction has expired. It must be executed within 3 minutes of approval.",[PT]:"This transaction has not yet reached the required approval threshold.",[WT]:"Missing transports.",[ET]:"Only the transaction creator or rent payer may close this transaction buffer.",[ef]:"Unauthorized: Only the admin account is allowed to perform this action.",[xT]:"Member is not part of the expected signers for this transaction."});function TM(e){return process.env.NODE_ENV!=="production"?Aa[e]:"Error message not available in production bundles."}function fM(e,r,t){return isProgramError(e,r,A,t)}var se=class extends Error{constructor(t,o,n){super(t);this.code=o;this.cause=n;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor);}},Me=class extends se{constructor(r){super(`${r} is not initialized. Please call initialize() first.`,"NOT_INITIALIZED");}},ee=class extends se{constructor(r,t){super(`${r} not found.${t?` ${t}`:""}`,"NOT_FOUND");}},W=class extends se{constructor(r,t){super(r,"VALIDATION_ERROR",{field:t});}},q=class extends se{constructor(t,o,n){super(t,"NETWORK_ERROR",{statusCode:o,url:n});this.statusCode=o;this.url=n;}},xt=class extends se{constructor(t,o,n){super(`Operation "${t}" failed after ${o} attempts.`,"RETRY_EXHAUSTED",{lastError:n});this.attempts=o;this.lastError=n;}},It=class extends se{constructor(t,o,n){super(t,"PERMISSION_ERROR",{required:o,actual:n});this.required=o;this.actual=n;}};var je={Ed25519:1,Secp256r1:2};var cf=d.looseObject({publicKey:d.string(),walletAddress:d.string().optional(),settingsIndexWithAddress:d.object({index:d.union([d.number(),d.bigint()])}).optional()}),af=d.object({devicePublicKey:d.string(),platform:d.enum(["web","ios","android"]),userAgent:d.string().optional(),browser:d.object({name:d.string().optional(),version:d.string().optional(),major:d.string().optional(),type:d.string().optional()}).optional(),engine:d.object({name:d.string().optional(),version:d.string().optional()}).optional(),cpu:d.object({architecture:d.string().optional()}).optional(),device:d.object({type:d.string().optional(),vendor:d.string().optional(),model:d.string().optional()}).optional(),os:d.object({name:d.string().optional(),version:d.string().optional()}).optional(),app:d.object({name:d.string().optional(),version:d.string().optional(),build:d.string().optional()}).optional(),display:d.object({screenWidth:d.number().optional(),screenHeight:d.number().optional(),viewportWidth:d.number().optional(),viewportHeight:d.number().optional(),devicePixelRatio:d.number().optional()}).optional(),locale:d.string().optional(),timezone:d.string().optional(),push:d.object({provider:d.enum(["expo","fcm","apns"]),token:d.string()}).optional(),website:d.string().optional(),nativeApp:d.string().optional(),createdAt:d.iso.datetime().optional()}).strict(),ga=d.enum(["create","create_with_preauthorized_execution","execute","vote","sync","close","transfer_intent","change_delegate","change_config"]),kM=d.object({transactionActionType:ga,transactionAddress:d.string(),transactionMessageBytes:d.array(d.number().int().min(0).max(255)).transform(e=>new Uint8Array(e))}).strict(),uf=d.object({transactionActionType:ga,transactionAddress:d.string(),transactionMessageBytes:d.base64()}).strict(),la=d.object({phase:d.literal("start"),clientOrigin:d.url(),signer:d.string().optional(),rid:d.string(),validTill:d.number(),providerOrigin:d.string(),rpId:d.string(),data:d.object({type:d.literal("message"),payload:d.string(),requireTwoFactorAuthentication:d.boolean().default(false)}).strict()}).strict(),pa=d.object({phase:d.literal("start"),clientOrigin:d.url(),signer:d.string().optional(),rid:d.string(),validTill:d.number(),providerOrigin:d.string(),rpId:d.string(),data:d.object({type:d.literal("transaction"),payload:uf}).strict()}).strict(),ma=d.object({startRequest:d.union([la,pa]),authResponse:d.custom(),client:d.object({clientOrigin:d.url(),jws:d.string()}).strict(),device:d.object({jwk:d.base64(),jws:d.string(),deviceProfile:af}).strict(),user:cf}).strict(),ya=d.object({signer:d.string(),additionalInfo:d.looseObject({}).optional()}).strict(),df=d.object({slotHash:d.string(),slotNumber:d.string(),estimatedSlotHashExpiry:d.number(),originIndex:d.number(),crossOrigin:d.boolean(),transactionManagerAddress:d.string().optional()}).strict(),LM=d.object({phase:d.literal("complete"),data:d.object({type:d.literal("message"),payload:ya.extend(ma.shape).extend({startRequest:la,transactionManager:d.object({publicKey:d.string(),signature:d.string()}).optional()})}).strict()}).strict(),OM=d.object({phase:d.literal("complete"),data:d.object({type:d.literal("transaction"),payload:ya.extend(ma.shape).extend(df.shape).extend({startRequest:pa})}).strict()}).strict();var te={InitiateTransaction:1,VoteTransaction:2,ExecuteTransaction:4},ce=class e{constructor(r){this.mask=r;}static fromPermissions(r){return new e(r.reduce((t,o)=>t|o,0))}static all(){return new e(Object.values(te).reduce((r,t)=>r|t,0))}static has(r,t){return (r.mask&t)===t}};var Dr=33,ae=class{_bn;constructor(r){typeof r=="string"?this._bn=new Uint8Array(getBase58Encoder().encode(r)):this._bn=new Uint8Array(r),this.validateKeyLength(this._bn);}validateKeyLength(r){if(r.length!==Dr)throw new Error(`Invalid public key length, expected ${Dr} bytes but got ${r.length}`)}toBase58(){return getBase58Decoder().decode(this.toBytes())}toTruncatedBuffer(){let r=this.toBuffer();return r.subarray(1,r.length)}toBuffer(){if(!this._bn)throw new Error("Invalid public key input");let r=this._bn;if(r.byteLength===Dr)return r;throw new Error("Invalid public key input")}toBytes(){let r=this.toBuffer();return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}toString(){return this.toBase58()}toJSON(){return this.toBase58()}},b=class extends ae{verifyArgs;domainConfig;authData;signature;originIndex;crossOrigin;clientAndDeviceHash;authResponse;constructor(r,t){super(r),this.verifyArgs=t.verifyArgs,this.domainConfig=t.domainConfig,this.authData=t.authData,this.signature=t.signature,this.originIndex=t.originIndex,this.crossOrigin=t.crossOrigin,this.clientAndDeviceHash=t.clientAndDeviceHash,this.authResponse=t.authResponse;}};function lf(){return getStructCodec([["programAddressIndex",getU8Codec()],["accountIndices",getArrayCodec(getU8Codec())],["data",getArrayCodec(getU8Codec())]])}function pf(){return getStructCodec([["lookupTableAddress",getAddressCodec()],["writableIndexes",getArrayCodec(getU8Codec())],["readonlyIndexes",getArrayCodec(getU8Codec())]])}var fa=getStructCodec([["numSigners",getU8Codec()],["numWritableSigners",getU8Codec()],["numWritableNonSigners",getU8Codec()],["accountKeys",getArrayCodec(getAddressCodec())],["instructions",getArrayCodec(lf())],["addressTableLookups",getArrayCodec(pf())]]);function Sa(e){return fa.encode({numSigners:e.header.numSignerAccounts,numWritableSigners:e.header.numSignerAccounts-e.header.numReadonlySignerAccounts,numWritableNonSigners:e.staticAccounts.length-e.header.numSignerAccounts-e.header.numReadonlyNonSignerAccounts,accountKeys:e.staticAccounts,instructions:e.instructions.map(t=>({programAddressIndex:t.programAddressIndex,accountIndices:t.accountIndices??[],data:Array.from(t.data??[])})),addressTableLookups:e.version===0?e.addressTableLookups?.map(t=>({lookupTableAddress:t.lookupTableAddress,readonlyIndexes:t.readonlyIndexes,writableIndexes:t.writableIndexes}))??[]:[]})}function xa(e){let r=fa.decode(e);return {header:{numSignerAccounts:r.numSigners,numReadonlySignerAccounts:r.numSigners-r.numWritableSigners,numReadonlyNonSignerAccounts:r.accountKeys.length-r.numSigners-r.numWritableNonSigners},addressTableLookups:r.addressTableLookups.map(t=>({lookupTableAddress:t.lookupTableAddress,readonlyIndexes:t.readonlyIndexes.map(Number),writableIndexes:t.writableIndexes.map(Number),readableIndices:t.readonlyIndexes.map(Number),writableIndices:t.writableIndexes.map(Number)})),instructions:r.instructions.map(t=>({accountIndices:t.accountIndices.map(Number),data:new Uint8Array(t.data),programAddressIndex:t.programAddressIndex})),lifetimeToken:A,staticAccounts:r.accountKeys,version:0}}function Ia(e,r,t,o){if(e<r||e>t)throw new W(`${o} must be between ${r} and ${t} (inclusive), got ${e}`)}async function v(e){let[r]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("user"),e instanceof ae?e.toTruncatedBuffer():getAddressEncoder().encode(e)]});return r}async function Re({rpIdHash:e,rpId:r}){if(!e)if(r)e=sha256(getUtf8Encoder().encode(r));else throw new W("Either rpId or rpIdHash must be provided");let[t]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("domain_config"),e]});return t}async function Dt(){let[e]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("global_counter")]});return e}async function Ea(e,r,t){Ia(t,0,255,"buffer_index");let[o]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("multi_wallet"),getAddressEncoder().encode(e),getUtf8Encoder().encode("transaction_buffer"),r instanceof ae?r.toTruncatedBuffer():getAddressEncoder().encode(r),getU8Encoder().encode(t)]});return o}async function ne(e){let[r]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("multi_wallet"),getAddressEncoder().encode(e),getUtf8Encoder().encode("vault")]});return r}async function ue(e){let[r]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("multi_wallet"),getU128Encoder().encode(e)]});return r}async function cR(e){let r=await ue(e);return await ne(r)}async function aR(){let[e]=await getProgramDerivedAddress({programAddress:A,seeds:[getUtf8Encoder().encode("cpi_authority")]});return e}var re={};function pR(){if(!re.solanaRpcEndpoint)throw new Me("RPC endpoint");return re.solanaRpcEndpoint}function Ye(){if(!re.lightProtocolRpc)throw new Me("Light Protocol RPC");return re.lightProtocolRpc}function L(){if(!re.solanaRpc)throw new Me("Solana RPC");return re.solanaRpc}function mR({rpcEndpoint:e,proverEndpoint:r,compressionApiEndpoint:t}){re.solanaRpcEndpoint=e,re.lightProtocolRpc=createRpc(e,t,r);let o=createSolanaRpc(e);re.solanaRpc=o;}function bt(e){return Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}function If(e){let r=new Uint8Array(e.length/2);for(let t=0;t<r.length;t++)r[t]=parseInt(e.slice(t*2,t*2+2),16);return r}function ba(e){let r=new Set(["type","challenge","origin","crossOrigin"]),t={};for(let n in e)r.has(n)||(t[n]=e[n]);if(Object.keys(t).length===0)return new Uint8Array([]);let o=JSON.stringify(t);return new Uint8Array(new TextEncoder().encode(o.slice(1,-1)))}function Ca(e,r){let t=[],o=0,n=new TextDecoder;for(let c=0;c<r;c++){if(o+2>e.length)throw new Error("MaxLengthExceeded");let i=e[o]|e[o+1]<<8;if(o+=2,o+i>e.length)throw new Error("MaxLengthExceeded");let a=e.slice(o,o+i),s=n.decode(a);t.push(s),o+=i;}return t}function Ma(e){if(e.length===64)return e;if(e[0]!==48)throw new Error("Invalid DER sequence");let r=e[1],t=2;if(r>128){let O=r&127;t+=O;}if(e[t]!==2)throw new Error("Expected INTEGER for r");let o=e[t+1],n=t+2,c=e.slice(n,n+o);if(t=n+o,e[t]!==2)throw new Error("Expected INTEGER for s");let i=e[t+1],a=t+2,s=e.slice(a,a+i),u=c[0]===0&&c.length>32?c.slice(1):c,g=s[0]===0&&s.length>32?s.slice(1):s;if(u.length>32||g.length>32)throw new Error("r or s length > 32 bytes");let p=new Uint8Array(32);p.set(u,32-u.length);let m=p256.Point.CURVE().n>>1n,S=BigInt("0x"+bt(g)),x=(S>m?p256.Point.CURVE().n-S:S).toString(16).padStart(64,"0"),I=If(x);return new Uint8Array([...p,...I])}function Je(e){let r=z(e.response.clientDataJSON),t=z(e.response.authenticatorData),o=sha256(r);return new Uint8Array([...t,...o])}function vR(e){let r=decodeCBOR(e),t=p256.Point.fromAffine({x:BigInt("0x"+bt(r.get(-2))),y:BigInt("0x"+bt(r.get(-3)))});return getBase58Decoder().decode(t.toBytes(true))}function kR(e){let t=p256.Point.fromBytes(getBase58Encoder().encode(e)).toBytes(false),o=new Map;return o.set(1,2),o.set(3,-7),o.set(-1,1),o.set(-2,t.slice(1,33)),o.set(-3,t.slice(33,65)),new Uint8Array(encodeCBOR(o))}async function LR(e){let{authenticatorData:r,clientDataJSON:t,signature:o}=e.authResponse.response,n=z(r),c=JSON.parse(getUtf8Decoder().decode(z(t))),i=ba(c),a=Ma(z(o)),s=await Re({rpIdHash:n.subarray(0,32)});return new b(e.signer,{verifyArgs:{clientDataJson:z(t),truncatedClientDataJson:i,slotNumber:BigInt(e.slotNumber),slotHash:getBase58Encoder().encode(e.slotHash)},clientAndDeviceHash:Mr(e.client.clientOrigin,e.device.jwk,e.startRequest.rid),domainConfig:s,authData:n,signature:a,originIndex:e.originIndex,crossOrigin:e.crossOrigin,authResponse:e.authResponse})}function Mr(e,r,t){return sha256(new Uint8Array([...getUtf8Encoder().encode(e),...getBase64Encoder().encode(r),...getBase64Encoder().encode(t)]))}function OR(e){return sha256(getUtf8Encoder().encode(canonicalize(e)))}function WR(e){return Rr(e.data.payload.authResponse)}function BR(e,r,t,o){let n=Mr(r,t,o);return sha256(new Uint8Array([...getUtf8Encoder().encode(e),...n]))}async function NR(e,r,t,o,n,c,i){let a;if(!n||!c||!i){let p=(await L().getAccountInfo(address("SysvarS1otHashes111111111111111111111111111"),{encoding:"base64",commitment:"confirmed",dataSlice:{offset:8,length:40}}).send()).value?.data;if(!p)throw new ee("Slot sysvar","Unable to fetch slot sysvar data");let m=getBase64Encoder().encode(p[0]);c=getU64Decoder().decode(m.subarray(0,8)).toString(),a=m.subarray(8,40),n=getBase58Decoder().decode(a),i=Date.now()+512*400;}else a=getBase58Encoder().encode(n);let s=sha256(typeof e.transactionMessageBytes=="string"?getBase64Encoder().encode(e.transactionMessageBytes):e.transactionMessageBytes),u=Mr(r,t,o),g=sha256(new Uint8Array([...getUtf8Encoder().encode(e.transactionActionType),...getBase58Encoder().encode(e.transactionAddress),...s,...a,...u]));return {slotNumber:c,slotHash:n,challenge:g,estimatedSlotHashExpiry:i}}function wR(e,r){return new Uint8Array([...Je(e),...getUtf8Encoder().encode(canonicalize(r))])}function Rr(e){let r=Je(e);return sha256(r)}function FR(e){let r="";for(let o of e)r+=String.fromCharCode(o);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function z(e){let r=e.replace(/-/g,"+").replace(/_/g,"/"),t=(4-r.length%4)%4,o=r.padEnd(r.length+t,"="),n=atob(o),c=new ArrayBuffer(n.length),i=new Uint8Array(c);for(let a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return i}async function GR(e,r){let{data:t}=await Fr(L(),e),n=Ca(t.origins,t.numOrigins).findIndex(c=>c===r);if(n===-1)throw new ee("Origin","Origin not found in domain config");return n}function VR(e){return getBase64Decoder().decode(getUtf8Encoder().encode(canonicalize(e)))}function HR(e){return JSON.parse(getUtf8Decoder().decode(getBase64Encoder().encode(e)))}function XR(e,r){if(r.threshold>1)throw new W("Multi-signature transactions with threshold > 1 are not supported yet.");let t=r.members.find(s=>La(s.pubkey)===e);if(!t)throw new ee("Member",`Signer ${e} not found in settings`);let{permissions:o}=t;if(!o)throw new ee("Permissions","No permissions found for the current member");let n=ce.has(o,te.InitiateTransaction),c=ce.has(o,te.VoteTransaction),i=ce.has(o,te.ExecuteTransaction);if(n&&c&&i)return null;if(!c||!i)throw new It("Signer lacks the required Vote/Execute permissions.",["VoteTransaction","ExecuteTransaction"],[c?"VoteTransaction":void 0,i?"ExecuteTransaction":void 0].filter(Boolean));let a=r.members.find(s=>s.role===0);if(!a)throw new ee("Transaction manager","No transaction manager available in wallet");return {transactionManagerAddress:address(La(a.pubkey))}}function Oa(e){let r=new URL(e);return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}function he(e,r){let t=new q(e,void 0,r);return t.retryable=false,t}function vf(e){return e instanceof q?e.retryable!==false:e instanceof Error&&(e.message==="WebSocket connection failed"||e.message==="WebSocket connection timed out")}var Y=()=>{let e=new Error("Aborted");return e.name="AbortError",e};function Wa(e){return e instanceof Error&&e.name==="AbortError"}function Ie(e){if(e.aborted)throw Y();e.throwIfAborted?.();}function Pr(...e){let r=e.filter(n=>n!=null);if(r.length===0)return new AbortController().signal;if(r.length===1)return r[0];if(typeof AbortSignal<"u"&&"any"in AbortSignal)return AbortSignal.any(r);let t=new AbortController,o=()=>t.abort();for(let n of r){if(n.aborted){o();break}n.addEventListener("abort",o,{once:true});}return t.signal}function kf(e){return e<1e12?e*1e3:e}function Lf(e,r,t){return typeof e=="number"&&Number.isFinite(e)?kf(e):r!==null?r:Date.now()+t}function va(e,r){throw e instanceof q?e:new q(e instanceof Error?e.message:"Transaction manager request failed",void 0,r)}function Of(e,r,t){return r.aborted?Promise.reject(Y()):new Promise((o,n)=>{let c=new WebSocket(e),i=false,a=g=>{i||(i=true,s!==void 0&&clearTimeout(s),r.removeEventListener("abort",u),g());},s=t!==void 0?setTimeout(()=>{try{c.close();}catch{}a(()=>n(new Error("WebSocket connection timed out")));},t):void 0,u=()=>{try{c.close();}catch{}a(()=>n(Y()));};r.addEventListener("abort",u,{once:true}),c.onopen=()=>{if(r.aborted){try{c.close();}catch{}a(()=>n(Y()));return}a(()=>o(c));},c.onerror=()=>{a(()=>n(new Error("WebSocket connection failed")));},c.onclose=()=>{a(()=>n(new Error("WebSocket connection failed")));};})}async function Wf(e,r,t){return new Promise((o,n)=>{let c=false,i=false,a=()=>{e.removeEventListener("message",g),e.removeEventListener("error",p),e.removeEventListener("close",m),r.removeEventListener("abort",u);},s=S=>{c||(c=true,a(),S());},u=()=>{try{e.close();}catch{}s(()=>n(Y()));},g=S=>{if(r.aborted){s(()=>n(Y()));return}if(typeof S.data!="string")return;let f;try{f=JSON.parse(S.data);}catch{return}let x=f.event??"message";try{t(x,f.data)&&(i=!0,s(()=>o(!0)));}catch(I){s(()=>n(I));}},p=()=>s(()=>n(new q("Transaction manager request failed",0,e.url))),m=()=>s(()=>o(i));r.addEventListener("abort",u,{once:true}),e.addEventListener("message",g),e.addEventListener("error",p),e.addEventListener("close",m);})}var ka=(e,r)=>new Promise((t,o)=>{if(r.aborted)return o(Y());let n=()=>{clearTimeout(c),o(Y());},c=setTimeout(()=>{r.removeEventListener("abort",n),t();},e);r.addEventListener("abort",n,{once:true});});async function Bf(e){let{url:r,payload:t,expectedSignatureCount:o,callbacks:n,abortSignal:c,opts:i}=e,a=Pr(c),s=Oa(r),u=i?.maxAttempts??10,g=i?.retryDelayMs??400,p=i?.approvalPollMs??2e3,m=i?.defaultApprovalTimeoutMs??3e5,S=i?.connectionTimeoutMs??3e4;if(o===0)throw he("Transaction manager: no signatures requested",s);let f=null,x=0,I=()=>f!==null&&Date.now()<f;for(;;){if(Ie(a),f!==null&&Date.now()>=f)throw he("Transaction manager approval timed out",s);let O,N;try{if(O=await Of(s,a,S),Ie(a),O.send(t),await Wf(O,a,(X,K)=>{if(X==="error"){let V=typeof K=="object"&&K&&typeof K.error=="string"?K.error:"Unknown error";throw he(V,s)}if(X==="signatures"){let V=K.signatures;if(!V?.length)return !1;if(V.length!==o)throw he(`Transaction manager returned ${V.length} signature(s) but ${o} were expected`,s);return N=V,!0}if(X==="pending_transaction_approval"){let V=K.validTill;f=Lf(V,f,m),n?.onPendingApprovalsCallback?.(f);}return X==="transaction_approved"&&n?.onPendingApprovalsSuccess?.(),!1})){if(!N||N.length!==o)throw he("Transaction manager sent an invalid signatures event",s);return N}if(Ie(a),!I())throw new q("Transaction manager closed the connection before returning signatures",void 0,s)}catch(l){if(Wa(l))throw l;Ie(a),vf(l)||va(l,s),I()||(x++,x>=u&&va(l,s));}finally{try{O?.close();}catch{}}if(Ie(a),I()){let l=Math.min(p,f-Date.now());await ka(l>0?l:1,a);continue}if(x>0){await ka(g,a);continue}throw new q("Transaction manager: missing signatures",void 0,s)}}function $R(e){let{address:r,url:t,authResponses:o,transactionMessageBytes:n,onPendingApprovalsCallback:c,onPendingApprovalsSuccess:i,abortSignal:a,opts:s}=e,u=Pr(a),g=Oa(t),p=Promise.resolve();return u.aborted&&(p=Promise.reject(Y())),u.addEventListener("abort",()=>{p=Promise.reject(Y());},{once:true}),{address:r,async signTransactions(m,S){let f=Pr(u,S?.abortSignal);Ie(f);let x=p.then(async()=>{if(Ie(f),m.length===0)throw he("Transaction manager: no transactions to sign",g);let I=new Array(m.length);for(let l=0;l<m.length;l++)I[l]={transaction:getBase64Decoder().decode(getTransactionEncoder().encode(m[l])),transactionMessageBytes:n?getBase64Decoder().decode(n):void 0,authResponses:o};let O=JSON.stringify({type:"transaction",data:{publicKey:r.toString(),payload:I}});return (await Bf({url:t,payload:O,expectedSignatureCount:m.length,callbacks:{onPendingApprovalsCallback:c,onPendingApprovalsSuccess:i},abortSignal:f,opts:s})).map(l=>({[r]:getBase58Encoder().encode(l)}))});return p=x.catch(I=>{if(Wa(I))return Promise.reject(I)}),x}}}function La(e){return e.keyType===je.Ed25519?getBase58Decoder().decode(e.key.subarray(1,33)):getBase58Decoder().decode(e.key)}function QR(e){let r=e.map(c=>Be().encode(c)),t=4+r.reduce((c,i)=>c+i.length,0),o=new Uint8Array(t),n=0;o.set(getU32Encoder().encode(e.length),n),n+=4;for(let c of r)o.set(c,n),n+=c.length;return o}function eP(e){let r=0,[t,o]=getU32Decoder().read(e,r);r=o;let n=new Array(t);for(let c=0;c<t;c++){let i=Ne().read(e,r);n[c]=i[0],r=i[1];}if(r!==e.length)throw new W(`Trailing bytes detected: expected ${e.length} bytes but consumed ${r}`);return n}var _r=["HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe","ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49","96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5","Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY","DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh","ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt","3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT","DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL"];function G(e,r=0){let t=e instanceof b?e:void 0,o=t?.verifyArgs&&r!==-1?some({signedMessageIndex:r,truncatedClientDataJson:t.verifyArgs.truncatedClientDataJson,slotNumber:t.verifyArgs.slotNumber,originIndex:t.originIndex,crossOrigin:t.crossOrigin,clientAndDeviceHash:t.clientAndDeviceHash}):none(),n=t?.domainConfig?t.domainConfig:void 0,c=t?.verifyArgs?t.signature:void 0,i=t?.authData&&t.verifyArgs.clientDataJson?Je(t.authResponse):void 0,a=t?.toBuffer();return {domainConfig:n,verifyArgs:o,signature:c,message:i,publicKey:a}}function Ue(e,r,t=[]){let o=[];for(let n of e)if(n instanceof b){let c=t.length,{domainConfig:i,verifyArgs:a,signature:s,publicKey:u,message:g}=G(n,c);if(g&&s&&u&&t.push({message:g,signature:s,publicKey:u}),i){let p=r.addPreAccounts([{address:i,role:AccountRole.READONLY}]).get(i)?.index;a.__option==="Some"&&p!==void 0&&o.push({__kind:"Secp256r1",fields:[{domainConfigIndex:p,verifyArgs:a.value}]});}}else {let c=r.addPreAccounts([{address:n.address,role:AccountRole.READONLY_SIGNER,signer:n}]).get(n.address)?.index;c!==void 0&&o.push({__kind:"Ed25519",fields:[c]});}return {secp256r1VerifyInput:t,transactionSyncSigners:o}}function oe(e){if(e instanceof ae)return {keyType:je.Secp256r1,key:e.toBytes()};{let r;try{r="address"in e?e.address:e;}catch{r=e;}return {keyType:je.Ed25519,key:new Uint8Array([0,...getAddressEncoder().encode(r)])}}}function Na(e){return e instanceof b?e.toString():e.address.toString()}function J(e){let r=new Set,t=[];for(let n of e)r.has(Na(n))||(t.push(n),r.add(Na(n)));let o=t.filter(n=>n instanceof b);if(o.length>1)throw new W(`More than 1 Secp256r1 signers in an instruction is not supported (found ${o.length})`);return t}function wa({payer:e,tipAmount:r}){let t=_r[Math.floor(Math.random()*_r.length)];return getTransferSolInstruction({source:e,destination:address(t),amount:r})}var Ga=8,Va=1,zf=34,Kf=5,qf=Ga+Va,Ha=Ga+Va+32,jf=Ha+zf+Kf,Yf=20;async function fP(e,{member:r,credentialId:t}){let o=[{memcmp:{offset:BigInt(qf),encoding:"base64",bytes:getBase64Decoder().decode(getAddressEncoder().encode(e))}}];if(r)o.push({memcmp:{offset:BigInt(Ha),encoding:"base64",bytes:getBase64Decoder().decode(h().encode(oe(r)))}});else if(t)o.push({memcmp:{offset:BigInt(jf),encoding:"base64",bytes:getBase64Decoder().decode(z(t))}});else return null;let n=await L().getProgramAccounts(A,{filters:o,encoding:"base64"}).send();return n.length?n.map(c=>pt().decode(getBase64Encoder().encode(c.account.data[0])))[0]:null}async function SP(e){let r=(await ts(L(),await v(e))).data;if(r.role===1||r.role===0){let t=[];return (await L().getProgramAccounts(A,{encoding:"base64",filters:[{memcmp:{offset:BigInt(Yf),encoding:"base64",bytes:getBase64Decoder().decode(h().encode(oe(e)))}}]}).send()).forEach(n=>{let c=ut().decode(getBase64Encoder().encode(n.account.data[0]));t.push({...c});}),t}else return await Promise.all(r.wallets.map(async t=>(await Bo(L(),await ue(t.index))).data))}async function vP({payer:e,rpId:r,origins:t,authority:o}){let n=await Re({rpId:r});return Is({origins:t,authority:o,payer:e,domainConfig:n,rpId:r,userAccount:await v(o.address),remainingAccounts:[]})}async function WP({payer:e}){let r=await Dt();return Us({payer:e,globalCounter:r})}async function FP({admin:e,rpId:r,disable:t}){let o=await Re({rpId:r});return qs({domainConfig:o,admin:e,disable:t,remainingAccounts:[]})}function Zf(e,r,t,o){let n=Xf(e,r),c=$f(e,r)&&t!==o;return n&&c?AccountRole.WRITABLE_SIGNER:n&&!c?AccountRole.WRITABLE:!n&&c?AccountRole.READONLY_SIGNER:AccountRole.READONLY}function Xf(e,r){let t=e.staticAccounts.length,{numSignerAccounts:o,numReadonlySignerAccounts:n,numReadonlyNonSignerAccounts:c}=e.header,i=o-n,a=t-o-c;return r>=t?false:r<i?true:r>=o?r-o<a:false}function $f(e,r){return r<e.header.numSignerAccounts}async function Rt({walletAddress:e,transactionMessageBytes:r,addressesByLookupTableAddress:t,additionalSigners:o}){let n=xa(r),c=t??(n.addressTableLookups?await fetchAddressesForLookupTables(n.addressTableLookups.map(a=>a.lookupTableAddress),L()):{}),i=[];i.push(...n.addressTableLookups?.map(a=>({role:AccountRole.READONLY,address:a.lookupTableAddress}))??[]);for(let[a,s]of n.staticAccounts.entries())i.push({address:s,role:Zf(n,a,s,e)});if(n.addressTableLookups)for(let a of n.addressTableLookups){let s=c[a.lookupTableAddress];if(!s)throw new Error(`Address lookup table account ${a.lookupTableAddress} not found`);for(let u of a.writableIndexes){let g=s[u];if(!g)throw new Error(`Address lookup table account ${a.lookupTableAddress} does not contain address at index ${u}`);i.push({address:g,role:AccountRole.WRITABLE});}for(let u of a.readonlyIndexes){let g=s[u];if(!g)throw new Error(`Address lookup table account ${a.lookupTableAddress} does not contain address at index ${u}`);i.push({address:g,role:AccountRole.READONLY});}}for(let a of o?.filter(s=>s.address!==e)??[]){let s=i.findIndex(u=>u.address===a.address);s===-1?i.push({address:a.address,role:AccountRole.READONLY_SIGNER,signer:a}):i[s].role===AccountRole.READONLY||i[s].role===AccountRole.READONLY_SIGNER?i[s]={address:a.address,role:AccountRole.READONLY_SIGNER,signer:a}:(i[s].role===AccountRole.WRITABLE||i[s].role===AccountRole.WRITABLE_SIGNER)&&(i[s]={address:a.address,role:AccountRole.WRITABLE_SIGNER,signer:a});}return {accountMetas:i,addressLookupTableAccounts:c,transactionMessage:n}}var ve=33,ke=64,kr=14,s1=2,c1=address("Secp256r1SigVerify1111111111111111111111111");function a1(){return getStructEncoder([["signatureOffset",getU16Encoder()],["signatureInstructionIndex",getU16Encoder()],["publicKeyOffset",getU16Encoder()],["publicKeyInstructionIndex",getU16Encoder()],["messageDataOffset",getU16Encoder()],["messageDataSize",getU16Encoder()],["messageInstructionIndex",getU16Encoder()]])}function i1(){return getStructDecoder([["signatureOffset",getU16Decoder()],["signatureInstructionIndex",getU16Decoder()],["publicKeyOffset",getU16Decoder()],["publicKeyInstructionIndex",getU16Decoder()],["messageDataOffset",getU16Decoder()],["messageDataSize",getU16Decoder()],["messageInstructionIndex",getU16Decoder()]])}function ja(){return createDecoder({read:(e,r=0)=>{let t=getU8Decoder().decode(e,r);r+=1;let o=getU8Decoder().decode(e,r);r+=1;let n=[],c=i1();for(let a=0;a<t;a++)n.push(c.decode(e,r)),r+=kr;let i=[];for(let a=0;a<t;a++){let s=fixDecoderSize(getBytesDecoder(),ve).decode(e,r);r+=ve;let u=fixDecoderSize(getBytesDecoder(),ke).decode(e,r);r+=ke;let g=n[a].messageDataSize,p=fixDecoderSize(getBytesDecoder(),g).decode(e,r);r+=g,i.push({publicKey:s,signature:u,message:p});}return [{numSignatures:t,padding:o,offsets:n,payload:i},r]}})}function Ya(){return createEncoder({getSizeFromValue:e=>{let r=kr*e.offsets.length,t=e.payload.reduce((o,n)=>o+ve+ke+n.message.length,0);return 2+r+t},write:(e,r,t=0)=>{t=getU8Encoder().write(e.numSignatures,r,t),t=getU8Encoder().write(e.padding,r,t);let o=a1();for(let n of e.offsets)t=o.write(n,r,t);for(let n of e.payload)t=fixEncoderSize(getBytesEncoder(),ve).write(n.publicKey,r,t),t=fixEncoderSize(getBytesEncoder(),ke).write(n.signature,r,t),t=getBytesEncoder().write(n.message,r,t);return t}})}function XP(){return combineCodec(Ya(),ja())}function U(e,r){let t=e.length,o=s1+t*kr,n=[];for(let s=0;s<t;s++){let{message:u}=e[s],g=o,p=g+ve,m=p+ke;n.push({publicKeyOffset:g,publicKeyInstructionIndex:65535,signatureOffset:p,signatureInstructionIndex:65535,messageDataOffset:m,messageDataSize:u.length,messageInstructionIndex:65535}),o+=ve+ke+u.length;}let c=r?.programAddress??c1,i={numSignatures:t,padding:0,offsets:n,payload:e};return {accounts:[],programAddress:c,data:Ya().encode(i)}}function $P(e){return {programAddress:e.programAddress,accounts:{},data:ja().decode(e.data)}}async function Ja({settings:e,transactionBufferAddress:r,transactionMessageBytes:t,payer:o,addressesByLookupTableAddress:n,secp256r1VerifyInput:c=[],additionalSigners:i=[],jitoBundlesTipAmount:a}){let s=await ne(e),{accountMetas:u,addressLookupTableAccounts:g}=await Rt({transactionMessageBytes:t,walletAddress:s,additionalSigners:i,addressesByLookupTableAddress:n}),p=[];return c.length>0&&p.push(U(c)),p.push(oa({transactionBuffer:r,payer:o.address,remainingAccounts:u,settings:e})),a&&p.push(wa({payer:o,tipAmount:a})),{instructions:p,addressLookupTableAccounts:g}}var Z=class{systemAccounts;nextPreIndex;preMap;nextPackedIndex;packedMap;outputTreeIndex;constructor(){this.systemAccounts=[],this.nextPreIndex=0,this.preMap=new Map,this.nextPackedIndex=0,this.packedMap=new Map,this.outputTreeIndex=-1;}addPreAccounts(r){for(let t of r)this.insertOrGet(t.address.toString(),t,false);return this.preMap}getAccountRole(r,t){return r?t?AccountRole.WRITABLE_SIGNER:AccountRole.READONLY_SIGNER:t?AccountRole.WRITABLE:AccountRole.READONLY}async addSystemAccounts(){this.systemAccounts.push(...getLightSystemAccountMetasV2({selfProgram:new PublicKey(A.toString())}).map(r=>({address:address(r.pubkey.toString()),role:this.getAccountRole(r.isSigner,r.isWritable)})));}insertOrGet(r,t={address:address(r),role:AccountRole.WRITABLE},o=true){let n=o?this.packedMap:this.preMap;if(!n.has(r)){let c=o?this.nextPackedIndex++:this.nextPreIndex++;n.set(r,{index:c,accountMeta:t});}return n.get(r).index}packOutputTreeIndex(r){if(r.treeType===TreeType.StateV1)return this.insertOrGet(r.tree.toString());if(r.treeType===TreeType.StateV2)return this.insertOrGet(r.queue.toString());throw new Error("Tree type not supported")}async getOutputTreeIndex(){if(this.outputTreeIndex!==-1)return this.outputTreeIndex;let r=await Ye().getStateTreeInfos(),t=selectStateTreeInfo(r);return this.packOutputTreeIndex(t)}packTreeInfos(r,t){let o=[],n=[];for(let c of r){let i=this.insertOrGet(c.treeInfo.tree.toString()),a=this.insertOrGet(c.treeInfo.queue.toString());o.push({rootIndex:c.rootIndex,merkleTreePubkeyIndex:i,queuePubkeyIndex:a,leafIndex:c.leafIndex,proveByIndex:c.proveByIndex});let s=c.treeInfo.nextTreeInfo??c.treeInfo,u=this.packOutputTreeIndex(s);this.outputTreeIndex===-1&&(this.outputTreeIndex=u);}for(let c of t){let i=this.insertOrGet(c.treeInfo.tree.toString()),a=this.insertOrGet(c.treeInfo.queue.toString());n.push({rootIndex:c.rootIndex,addressMerkleTreePubkeyIndex:i,addressQueuePubkeyIndex:a});}return {stateTrees:o.length>0?{packedTreeInfos:o,outputTreeIndex:this.outputTreeIndex}:void 0,addressTrees:n}}hashSetAccountsToMetas(r){return Array.from(r.entries()).sort((o,n)=>o[1].index-n[1].index).map(([,{accountMeta:o}])=>({...o}))}getOffsets(r){let t=r,o=t+this.systemAccounts.length;return [t,o]}toAccountMetas(){let r=this.hashSetAccountsToMetas(this.preMap),t=this.hashSetAccountsToMetas(this.packedMap),[o,n]=this.getOffsets(r.length);return {remainingAccounts:[...r,...this.systemAccounts,...t],systemOffset:o,packedOffset:n}}};async function $a({settings:e,transactionMessageBytes:r,additionalSigners:t,signers:o,addressesByLookupTableAddress:n,secp256r1VerifyInput:c=[]}){let i=J(o),a=await ne(e),[{accountMetas:s,addressLookupTableAccounts:u,transactionMessage:g}]=await Promise.all([Rt({transactionMessageBytes:r,walletAddress:a,additionalSigners:t,addressesByLookupTableAddress:n})]),p=new Z;p.addPreAccounts(s);let{secp256r1VerifyInput:m,transactionSyncSigners:S}=Ue(i,p,c),{remainingAccounts:f}=p.toAccountMetas(),x=[];m.length>0&&x.push(U(m));let I=g1(g,s);return x.push(da({signers:S,settings:e,...I,remainingAccounts:f})),{instructions:x,addressLookupTableAccounts:u}}function g1(e,r){return {numSigners:e.header.numSignerAccounts,numWritableNonSigners:e.staticAccounts.length-e.header.numSignerAccounts-e.header.numReadonlyNonSignerAccounts,numWritableSigners:e.header.numSignerAccounts-e.header.numReadonlySignerAccounts,numAccountKeys:e.staticAccounts.length,instructions:e.instructions.map(t=>({...t,accountIndices:new Uint8Array(t.accountIndices??[]),data:t.data??[]})),addressTableLookups:e.addressTableLookups?.map(t=>({lookupTableAddressIndex:r.findIndex(o=>o.address===t.lookupTableAddress),writableIndexes:new Uint8Array(t.writableIndexes),readonlyIndexes:new Uint8Array(t.readonlyIndexes)}))??[]}}async function U_({settings:e,destination:r,signers:t,amount:o}){let n=J(t),c=await ne(e),{value:i}=await L().getAccountInfo(c,{encoding:"base64"}).send();if((i?.lamports??0)<BigInt(o))throw new W("Insufficient balance for native transfer.");let a=new Z,{secp256r1VerifyInput:s,transactionSyncSigners:u}=Ue(n,a),{remainingAccounts:g}=a.toAccountMetas(),p=[];return s.length>0&&p.push(U(s)),p.push(pc({amount:o,signers:u,source:c,destination:r,settings:e,remainingAccounts:g})),p}var l1=3,p1=500,m1=2,y1=3e4,T1={backoffBase:m1,maxDelayMs:y1,retryOnRateLimit:true,initialDelayMs:p1,maxRetries:l1};function f1(e,r,t,o){let n=r*Math.pow(t,e-1);return Math.min(n,o)}function S1(e){return new Promise(r=>setTimeout(r,e))}async function Qa(e,r){let{maxRetries:t,initialDelayMs:o,backoffBase:n,maxDelayMs:c,shouldRetry:i}={...T1,...r},a;for(let s=1;s<=t;s++)try{return await e()}catch(u){if(a=u,i&&!i(u,s))throw u;if(s>=t)break;let g=f1(s,o,n,c);await S1(g);}throw new xt(e.name||"retryWithBackoff",t,a)}var M1=address("ACXg8a7VaqecBWrSbdu73W4Pg9gsqXJ3EXAqkHyhvVXg"),R1=address("r18WwUxfG8kQ69bQPAB2jV6zGNKy3GosFGctjQoV4ti"),_t=address("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m");async function Y_({settings:e,destination:r,mint:t,signers:o,amount:n,payer:c,tokenProgram:i,splInterfacePdaArgs:a={index:0,restricted:false}}){let s=J(o),u=await ne(e),g=await P1(t,r,u,i,a),p=await _1(g),m=h1(p,g,n),[S,f]=await Promise.all([O1(u,t,m.splBalance,m.cTokenBalance,BigInt(n)),L1(m.requireSplInterface,g.splInterfacePda)]),x=BigInt(S.reduce(($e,mi)=>$e+(mi.parsed.amount.toNumber()??0),0));if(m.splBalance+m.cTokenBalance+x<BigInt(n))throw new W("Insufficient balance for token transfer.");let I=new Z;f&&I.addPreAccounts([{address:t,role:AccountRole.WRITABLE}]);let O=U1(S),{proof:N}=await v1(I,O),l=k1(S,N,I),{secp256r1VerifyInput:X,transactionSyncSigners:K}=Ue(s,I),{remainingAccounts:V,systemOffset:de}=I.toAccountMetas(),Wr=w1(N,de),_=[];return X.length>0&&_.push(U(X)),_.push(Ec({settings:e,payer:c,source:u,sourceSplTokenAccount:g.sourceSplAta,sourceCtokenTokenAccount:g.sourceCtokenAta,destination:r,destinationSplTokenAccount:m.destinationSplTokenAccount,destinationCtokenTokenAccount:m.destinationCtokenTokenAccount,tokenProgram:i,mint:t,splInterfacePda:m.requireSplInterface?g.splInterfacePda:void 0,compressibleConfig:M1,rentSponsor:m.requireRentSponsor?R1:void 0,amount:n,signers:K,sourceCompressedTokenAccounts:l,compressedProofArgs:Wr,splInterfacePdaArgs:m.requireSplInterface?some(a):none(),remainingAccounts:V})),_}async function P1(e,r,t,o,n){let c=m=>getProgramDerivedAddress({seeds:[getAddressEncoder().encode(m),getAddressEncoder().encode(_t),getAddressEncoder().encode(e)],programAddress:_t}),i=[getUtf8Encoder().encode("pool"),getAddressEncoder().encode(e)];n.restricted&&i.push(getUtf8Encoder().encode("restricted")),n.index>0&&i.push(getU8Encoder().encode(n.index));let[a,[s],u,[g],[p]]=await Promise.all([findAssociatedTokenPda({mint:e,owner:t,tokenProgram:o}).then(([m])=>m),c(t),findAssociatedTokenPda({mint:e,owner:r,tokenProgram:o}).then(([m])=>m),c(r),getProgramDerivedAddress({seeds:i,programAddress:_t})]);return {sourceSplAta:a,sourceCtokenAta:s,destinationSplAta:u,destinationCTokenAta:g,splInterfacePda:p}}async function _1(e){let[r,t,o]=await Promise.all([L().getAccountInfo(e.destinationSplAta,{encoding:"base64"}).send(),L().getAccountInfo(e.sourceSplAta,{encoding:"base64"}).send(),L().getAccountInfo(e.sourceCtokenAta,{encoding:"base64"}).send()]);return {destinationSplAtaInfo:r,sourceSplAtaInfo:t,sourceCTokenAtaInfo:o}}function h1(e,r,t){let o=!!e.destinationSplAtaInfo.value,n=!!e.sourceSplAtaInfo.value,c=!!e.sourceCTokenAtaInfo.value,i=n?getTokenDecoder().decode(getBase64Encoder().encode(e.sourceSplAtaInfo.value.data[0])).amount:BigInt(0),a=BigInt(c?B1(getBase64Encoder().encode(e.sourceCTokenAtaInfo.value.data[0]))?.amount??0:0),s=o?r.destinationSplAta:void 0,u=o?void 0:r.destinationCTokenAta,g=n&&(i+a<BigInt(t)||a>BigInt(0)||!o)||!n&&o;return {splBalance:i,cTokenBalance:a,destinationSplTokenAccount:s,destinationCtokenTokenAccount:u,requireSplInterface:g,requireRentSponsor:i+a<BigInt(t)||!o}}function U1(e){let r=[];return e.forEach(t=>r.push({hash:t.compressedAccount.hash,tree:t.compressedAccount.treeInfo.tree,queue:t.compressedAccount.treeInfo.queue,data:t.compressedAccount.data,address:t.compressedAccount.address})),r}async function v1(e,r){let t=null;return r.length===0?{proof:t}:(await e.addSystemAccounts(),t=await F1(r,[]),{proof:t})}function k1(e,r,t){return !r||!e.length?[]:e.map(o=>({amount:o.parsed.amount.toNumber(),merkleContext:{leafIndex:o.compressedAccount.leafIndex,merkleTreePubkeyIndex:t.insertOrGet(o.compressedAccount.treeInfo.tree.toString()),queuePubkeyIndex:t.insertOrGet(o.compressedAccount.treeInfo.queue.toString()),proveByIndex:o.compressedAccount.proveByIndex},rootIndex:r.rootIndices[0],version:N1(o.compressedAccount.data?.discriminator),tlv:o.parsed.tlv?some(getArrayDecoder(We()).decode(o.parsed.tlv)):none(),state:o.parsed.state}))}async function L1(e,r){if(!e)return false;let{value:t}=await L().getAccountInfo(r,{encoding:"base64"}).send();return !t}async function O1(e,r,t,o,n){let c=n-t-o;if(c<=0)return [];let a=(await Ye().getCompressedTokenAccountsByOwner(new PublicKey(e),{mint:new PublicKey(r)})).items.filter(u=>!!u.compressedAccount.data?.data.length&&u.compressedAccount.owner.toString()===_t.toString()&&!u.parsed.amount.isZero());return a.length===0?[]:W1(a,Number(c),4,{treeType:TreeType.StateV2})}function W1(e,r,t=4,o){let n=e.filter(u=>u.compressedAccount.treeInfo.treeType===o?.treeType);if(n.length===0)throw new Error("No accounts found");let c=0,i=0,a=0,s=[];n.sort((u,g)=>g.parsed.amount.cmp(u.parsed.amount));for(let u of n){if(s.length>=t||c>=r)break;(!u.parsed.amount.isZero()||!u.compressedAccount.lamports.isZero())&&(c=c+u.parsed.amount.toNumber(),i=i+u.compressedAccount.lamports.toNumber(),s.push(u));}if(a=n.slice(0,t).reduce((u,g)=>u+g.parsed.amount.toNumber(),0),s.length===0)throw new Error("No accounts found.");if(c<r){let u=n.reduce((g,p)=>g+p.parsed.amount.toNumber(),0);throw s.length>=t?new Error(`Account limit exceeded: max ${a.toString()} (${t} accounts) per transaction. Total balance: ${u.toString()} (${n.length} accounts). Consider multiple transfers to spend full balance.`):new Error(`Insufficient balance for transfer. Required: ${r.toString()}, available: ${u.toString()}.`)}if(s.length===0)throw new Error("No accounts found.");return s}function B1(e){if(!e||e.length===0)return null;try{return {amount:getU64Decoder().decode(e.slice(64,72))}}catch(r){return console.error("Token data parsing error:",r),null}}function N1(e){if(!e||e.length<8)return 3;if(e[0]===2)return 1;let r=e[7];return r===3?2:3}function w1(e,r){return {proof:e?.compressedProof?some({a:new Uint8Array(e.compressedProof.a),b:new Uint8Array(e.compressedProof.b),c:new Uint8Array(e.compressedProof.c)}):null,lightCpiAccountsStartIndex:r}}async function F1(e,r){return Qa(()=>Ye().getValidityProofV0(e,r))}function oh({signers:e,payer:r,changeConfigArgs:t}){let{settings:o,configActions:n,packedAccounts:c}=t,i=J(e),a=[],s=[];for(let p of i)if(p instanceof b){let m=s.length,{domainConfig:S,verifyArgs:f,signature:x,publicKey:I,message:O}=G(p,m);if(O&&x&&I&&s.push({message:O,signature:x,publicKey:I}),S){let N=c.addPreAccounts([{address:S,role:AccountRole.READONLY}]).get(S)?.index;f.__option==="Some"&&N!==void 0&&a.push({__kind:"Secp256r1",fields:[{domainConfigIndex:N,verifyArgs:f.value}]});}}else {let m=c.addPreAccounts([{address:p.address,role:AccountRole.READONLY_SIGNER,signer:p}]).get(p.address)?.index;m!==void 0&&a.push({__kind:"Ed25519",fields:[m]});}let{remainingAccounts:u}=c.toAccountMetas(),g=[];return s.length>0&&g.push(U(s)),g.push(As({settings:o,configActions:n,payer:r,remainingAccounts:u,signers:a})),g}async function lh({authority:e,payer:r,createUserArgs:t,domainConfig:o}){return Rs({payer:r,authority:e,member:Ge().decode(t.member.toBuffer()),credentialId:z(t.credentialId),transports:t.transports,role:t.role,domainConfig:o,settings:t.settings,transactionManagerAccount:t.transactionManagerAccount,userAccount:await v(t.member),remainingAccounts:[]})}async function fh({createUserArgs:e,payer:r}){return Os({payer:r,member:e.member,role:e.role,transactionManagerUrl:e.role===0?e.transactionManagerUrl:null,userAccount:await v(e.member.address),remainingAccounts:[]})}async function Dh({index:e,payer:r,initialMember:t}){return Fs({globalCounter:await Dt(),userAccount:await v(t.address),settingsIndex:e,settings:await ue(e),payer:r,initialMember:t,remainingAccounts:[]})}async function Ph({authority:e,domainConfig:r,newAuthority:t,newOrigins:o}){return $s({domainConfig:r,authority:e,newOrigins:o?some(o):none(),newAuthority:t,userAccount:t?await v(t.address):void 0,remainingAccounts:[]})}async function vh({signer:e,transactionManagerUrl:r}){return nc({signer:e,transactionManagerAccount:await v(e.address),transactionManagerUrl:r,remainingAccounts:[]})}async function Fh({payer:e,user:r,oldDelegate:t,newDelegate:o}){let n,c;t!==void 0&&(n=await ue(t)),o!==void 0&&(c=await ue(o));let{domainConfig:i,verifyArgs:a,message:s,signature:u,publicKey:g}=G(r),p=[];s&&u&&g&&p.push({message:s,signature:u,publicKey:g});let m=[];return p.length>0&&m.push(U(p)),m.push(dc({secp256r1VerifyArgs:a,domainConfig:i,delegateTo:o!==void 0?some(o):none(),feePayer:e,signer:r instanceof b?void 0:r,oldSettings:n,newSettings:c,userAccount:await v(r instanceof b?r:r.address),remainingAccounts:[]})),m}function eU({closer:e,payer:r,settings:t,transactionBufferAddress:o}){let{domainConfig:n,verifyArgs:c,message:i,signature:a,publicKey:s}=G(e),u=[];return i&&a&&s&&u.push(U([{message:i,signature:a,publicKey:s}])),u.push(Pc({transactionBuffer:o,domainConfig:n,closer:e instanceof b?void 0:e,settings:t,payer:r,secp256r1VerifyArgs:c,remainingAccounts:[]})),u}function ai({payer:e,creator:r,bufferIndex:t,settings:o,transactionBufferAddress:n,finalBufferHash:c,finalBufferSize:i,preauthorizeExecution:a,bufferExtendHashes:s,expectedSigners:u}){let{domainConfig:g,verifyArgs:p,message:m,signature:S,publicKey:f}=G(r),x=[];return m&&S&&f&&x.push(U([{message:m,signature:S,publicKey:f}])),x.push(Lc({settings:o,transactionBuffer:n,payer:e,secp256r1VerifyArgs:p,creator:r instanceof b?void 0:r,domainConfig:g,bufferIndex:t,finalBufferHash:c,finalBufferSize:i,bufferExtendHashes:s,preauthorizeExecution:a,expectedSigners:u,remainingAccounts:[]})),x}function ii({executor:e,transactionBufferAddress:r,settings:t}){let{domainConfig:o,verifyArgs:n,signature:c,message:i,publicKey:a}=G(e),s=[];return i&&c&&a&&s.push(U([{message:i,signature:c,publicKey:a}])),s.push(Fc({settings:t,transactionBuffer:r,secp256r1VerifyArgs:n,domainConfig:o,executor:e instanceof b?void 0:e,remainingAccounts:[]})),s}function ui({transactionMessageBytes:e,transactionBufferAddress:r,settings:t}){return qc({transactionBuffer:r,buffer:e,settings:t,remainingAccounts:[]})}function di({settings:e,voter:r,transactionBufferAddress:t}){let{domainConfig:o,verifyArgs:n,signature:c,publicKey:i,message:a}=G(r),s=[];return a&&c&&i&&s.push(U([{message:a,signature:c,publicKey:i}])),s.push($c({settings:e,transactionBuffer:t,secp256r1VerifyArgs:n,domainConfig:o,voter:r instanceof b?void 0:r,remainingAccounts:[]})),s}async function FU({settings:e,configActionsArgs:r}){let t=new Z;return {configActions:await K1({configActionsArgs:r,packedAccounts:t}),settings:e,packedAccounts:t}}async function K1({configActionsArgs:e,packedAccounts:r}){let t=[];for(let o of e)switch(o.type){case "AddMembers":{let n=[];for(let c of o.members)r.addPreAccounts([{address:await v(c.member),role:AccountRole.WRITABLE}]),n.push(Y1({permissionArgs:c.permissions,pubkey:c.member}));t.push({__kind:o.type,fields:[n]});break}case "RemoveMembers":{let n=await Promise.all(o.members.map(async c=>(r.addPreAccounts([{address:await v(c.member),role:AccountRole.WRITABLE}]),j1({pubkey:c.member}))));t.push({__kind:o.type,fields:[n]});break}case "EditPermissions":{let n=o.members.map(c=>q1({permissionArgs:c.permissions,pubkey:c.member}));t.push({__kind:o.type,fields:[n]});break}default:t.push({__kind:o.type,fields:[o.threshold]});}return t}function q1({pubkey:e,permissionArgs:r}){return {memberKey:oe(e),permissions:gi(r)}}function j1({pubkey:e}){return {memberKey:oe(e)}}function Y1({pubkey:e,permissionArgs:r}){return {memberKey:oe(e),permissions:gi(r)}}function gi(e){let r=[];return e.initiate&&r.push(te.InitiateTransaction),e.vote&&r.push(te.VoteTransaction),e.execute&&r.push(te.ExecuteTransaction),ce.fromPermissions(r)}async function jU({payer:e,settings:r,transactionMessageBytes:t,creator:o,executor:n,secp256r1VerifyInput:c,jitoBundlesTipAmount:i,addressesByLookupTableAddress:a,additionalVoters:s=[],additionalSigners:u=[],chunkSize:g=Math.ceil(t.length/2)}){let p=Math.floor(Math.random()*255),m=await Ea(r,o instanceof b?o:o.address,p),S=[],f=[];for(let _=0;_<t.length;_+=g){let $e=t.subarray(_,_+g);S.push($e),f.push(sha256($e));}let x=sha256(t),I=J([o,...n?[n]:[],...s]).map(_=>({memberKey:oe(_),messageHash:_ instanceof b?Rr(_.authResponse):null})),O=ai({finalBufferHash:x,finalBufferSize:t.length,bufferIndex:p,payer:e,transactionBufferAddress:m,settings:r,creator:o,preauthorizeExecution:!n,bufferExtendHashes:f,expectedSigners:I}),N=S.map(_=>ui({transactionMessageBytes:_,transactionBufferAddress:m,settings:r})),l=s.map(_=>di({voter:_,transactionBufferAddress:m,settings:r})),X=ii({settings:r,executor:n,transactionBufferAddress:m}),{instructions:K,addressLookupTableAccounts:V}=await Ja({settings:r,transactionMessageBytes:t,transactionBufferAddress:m,payer:e,additionalSigners:u,secp256r1VerifyInput:c,jitoBundlesTipAmount:i,addressesByLookupTableAddress:a}),de=_=>({payer:e,instructions:_,addressesByLookupTableAddress:V});return [de(O),...N.map(_=>de([_])),...l.length?[de(l.flat())]:[],de(X),de(K)]}var Ut=class e{payer;keyMetaMap;constructor(r,t){this.payer=r,this.keyMetaMap=t;}static compile(r,t){let o=new Map,n=i=>{let a=o.get(i);return a===void 0&&(a={isSigner:false,isWritable:false,isInvoked:false},o.set(i,a)),a},c=n(t);c.isSigner=true,c.isWritable=true;for(let i of r){n(i.programAddress).isInvoked=false;for(let a of i.accounts??[]){let s=n(a.address);s.isSigner||=a.role===AccountRole.READONLY_SIGNER||a.role===AccountRole.WRITABLE_SIGNER,s.isWritable||=a.role===AccountRole.WRITABLE||a.role===AccountRole.WRITABLE_SIGNER;}}return new e(t,o)}getMessageComponents(){let r=[...this.keyMetaMap.entries()];if(r.length>256)throw new Error("Max static account keys length exceeded");let t=r.filter(([,u])=>u.isSigner&&u.isWritable),o=r.filter(([,u])=>u.isSigner&&!u.isWritable),n=r.filter(([,u])=>!u.isSigner&&u.isWritable),c=r.filter(([,u])=>!u.isSigner&&!u.isWritable),i={numSignerAccounts:t.length+o.length,numReadonlySignerAccounts:o.length,numReadonlyNonSignerAccounts:c.length};if(t.length===0)throw new Error("Expected at least one writable signer key");let[a]=t[0];if(a!==this.payer)throw new Error("Expected first writable signer key to be the fee payer");let s=[...t.map(([u])=>u),...o.map(([u])=>u),...n.map(([u])=>u),...c.map(([u])=>u)];return [i,s]}extractTableLookup(r){let[t,o]=this.drainKeysFoundInLookupTable(r[1],i=>!i.isSigner&&!i.isInvoked&&i.isWritable),[n,c]=this.drainKeysFoundInLookupTable(r[1],i=>!i.isSigner&&!i.isInvoked&&!i.isWritable);if(!(t.length===0&&n.length===0))return {addressTableLookup:{lookupTableAddress:r[0],writableIndexes:t,readonlyIndexes:n},drainedKeys:{writable:o,readonly:c}}}drainKeysFoundInLookupTable(r,t){let o=new Array,n=new Array;for(let[c,i]of this.keyMetaMap.entries())if(t(i)){let a=c,s=r.findIndex(u=>u===a);if(s>=0){if(s>=256)throw new Error("Max lookup table index exceeded");o.push(s),n.push(a),this.keyMetaMap.delete(c);}}return [o,n]}};var vt=class{staticAccountKeys;accountKeysFromLookups;constructor(r,t){this.staticAccountKeys=r,this.accountKeysFromLookups=t;}keySegments(){let r=[this.staticAccountKeys];return this.accountKeysFromLookups&&(r.push(this.accountKeysFromLookups.writable),r.push(this.accountKeysFromLookups.readonly)),r}get(r){for(let t of this.keySegments()){if(r<t.length)return t[r];r-=t.length;}}get length(){return this.keySegments().flat().length}compileInstructions(r){if(this.length>256)throw new Error("Account index overflow encountered during compilation");let o=new Map;this.keySegments().flat().forEach((c,i)=>{o.set(c,i);});let n=c=>{let i=o.get(c);if(i===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return i};return r.map(c=>({programAddressIndex:n(c.programAddress),accountIndices:c.accounts?.map(i=>n(i.address))??[],data:c.data}))}};function pi({payer:e,recentBlockhash:r,instructions:t,addressesByLookupTableAddress:o}){let n=Ut.compile(t,e),c=new Array,i={writable:[],readonly:[]},a=Object.entries(o??{});for(let m of a){let S=n.extractTableLookup(m);if(S!==void 0){let{addressTableLookup:f,drainedKeys:x}=S;c.push({readonlyIndexes:f.readonlyIndexes,readableIndices:f.readonlyIndexes,writableIndexes:f.writableIndexes,writableIndices:f.writableIndexes,lookupTableAddress:address(f.lookupTableAddress)}),i.writable.push(...x.writable),i.readonly.push(...x.readonly);}}let[s,u]=n.getMessageComponents(),p=new vt(u,i).compileInstructions(t);return {version:0,header:s,instructions:p,lifetimeToken:r,staticAccounts:u,addressTableLookups:c}}function cv({instructions:e,payer:r,addressesByLookupTableAddress:t}){let o=pi({instructions:e,payer:r,recentBlockhash:A,addressesByLookupTableAddress:t});return new Uint8Array(Sa(o))}async function Av({payer:e,settings:r,transactionMessageBytes:t,signers:o,additionalSigners:n,secp256r1VerifyInput:c,addressesByLookupTableAddress:i}){let{instructions:a,addressLookupTableAccounts:s}=await $a({settings:r,signers:o,additionalSigners:n,transactionMessageBytes:t,secp256r1VerifyInput:c,addressesByLookupTableAddress:i});return {payer:e,instructions:a,addressesByLookupTableAddress:s}}
2
2
  export{kt as AccountState,ma as AuthenticationContextSchema,ya as BaseResponseSchema,is as CHANGE_CONFIG_DISCRIMINATOR,Ss as CREATE_DOMAIN_CONFIG_DISCRIMINATOR,bs as CREATE_DOMAIN_USER_ACCOUNT_DISCRIMINATOR,_s as CREATE_GLOBAL_COUNTER_DISCRIMINATOR,ks as CREATE_USER_ACCOUNT_DISCRIMINATOR,Ns as CREATE_WALLET_DISCRIMINATOR,LM as CompleteMessageRequestSchema,OM as CompleteTransactionRequestSchema,Hs as DISABLE_DOMAIN_CONFIG_DISCRIMINATOR,Br as DOMAIN_CONFIG_DISCRIMINATOR,af as DeviceProfileSchema,Js as EDIT_DOMAIN_CONFIG_DISCRIMINATOR,ec as EDIT_TRANSACTION_MANAGER_URL_DISCRIMINATOR,ac as EDIT_USER_DELEGATE_DISCRIMINATOR,Hr as GLOBAL_COUNTER_DISCRIMINATOR,je as KeyType,mT as MULTI_WALLET_ERROR__ALREADY_DELEGATED,qy as MULTI_WALLET_ERROR__CLIENT_DATA_HASH_MISMATCH,OT as MULTI_WALLET_ERROR__CREDENTIAL_ID_IS_MISSING,BT as MULTI_WALLET_ERROR__DOMAIN_CONFIG_IS_DISABLED,NT as MULTI_WALLET_ERROR__DOMAIN_CONFIG_IS_MISSING,QT as MULTI_WALLET_ERROR__DOMAIN_CONFIG_KEY_MISMATCH,Jy as MULTI_WALLET_ERROR__DUPLICATE_MEMBER,Yy as MULTI_WALLET_ERROR__DURABLE_NONCE_DETECTED,cT as MULTI_WALLET_ERROR__EMPTY_MEMBERS,rT as MULTI_WALLET_ERROR__EXPECTED_ADMINISTRATOR_ROLE_MISMATCH,jy as MULTI_WALLET_ERROR__EXPECTED_MESSAGE_HASH_MISMATCH,tT as MULTI_WALLET_ERROR__EXPECTED_TRANSACTION_MANAGER_ROLE_MISMATCH,bT as MULTI_WALLET_ERROR__FINAL_BUFFER_HASH_MISMATCH,CT as MULTI_WALLET_ERROR__FINAL_BUFFER_SIZE_EXCEEDED,MT as MULTI_WALLET_ERROR__FINAL_BUFFER_SIZE_MISMATCH,FT as MULTI_WALLET_ERROR__HASH_COMPUTATION_FAILED,fT as MULTI_WALLET_ERROR__INSUFFICIENT_SIGNERS_WITH_VOTE_PERMISSION,yT as MULTI_WALLET_ERROR__INSUFFICIENT_SIGNER_WITH_EXECUTE_PERMISSION,TT as MULTI_WALLET_ERROR__INSUFFICIENT_SIGNER_WITH_INITIATE_PERMISSION,AT as MULTI_WALLET_ERROR__INVALID_ACCOUNT,$T as MULTI_WALLET_ERROR__INVALID_ACCOUNT_INDEX,oT as MULTI_WALLET_ERROR__INVALID_ADMINISTRATOR_CONFIG,lT as MULTI_WALLET_ERROR__INVALID_ARGUMENTS,DT as MULTI_WALLET_ERROR__INVALID_BUFFER,GT as MULTI_WALLET_ERROR__INVALID_MEMBER_KEY_FORMAT,ST as MULTI_WALLET_ERROR__INVALID_NON_DELEGATED_SIGNERS,dT as MULTI_WALLET_ERROR__INVALID_NUMBER_OF_ACCOUNTS,$y as MULTI_WALLET_ERROR__INVALID_PERMANENT_MEMBER_CONFIG,Fy as MULTI_WALLET_ERROR__INVALID_SECP256R1_INSTRUCTION,Hy as MULTI_WALLET_ERROR__INVALID_SECP256R1_PUBLIC_KEY,wy as MULTI_WALLET_ERROR__INVALID_SECP256R1_VERIFY_ARG,Vy as MULTI_WALLET_ERROR__INVALID_SIGNATURE_OFFSETS,LT as MULTI_WALLET_ERROR__INVALID_SLOT_NUMBER,vT as MULTI_WALLET_ERROR__INVALID_SYSVAR_DATA_FORMAT,iT as MULTI_WALLET_ERROR__INVALID_THRESHOLD,XT as MULTI_WALLET_ERROR__INVALID_TOKEN_SOURCE_TYPE,nT as MULTI_WALLET_ERROR__INVALID_TRANSACTION_MANAGER_CONFIG,eT as MULTI_WALLET_ERROR__INVALID_TRANSACTION_MANAGER_PERMISSION,uT as MULTI_WALLET_ERROR__INVALID_TRANSACTION_MESSAGE,nf as MULTI_WALLET_ERROR__INVALID_USER_ED25519_CONFIG,gT as MULTI_WALLET_ERROR__INVALID_USER_ROLE,tf as MULTI_WALLET_ERROR__INVALID_USER_TRANSACTION_MANAGER_CONFIG,ZT as MULTI_WALLET_ERROR__LIGHT_CPI_ACCOUNT_ERROR,zy as MULTI_WALLET_ERROR__MALFORMED_SIGNED_MESSAGE,hT as MULTI_WALLET_ERROR__MAX_LENGTH_EXCEEDED,zT as MULTI_WALLET_ERROR__MEMBER_NOT_FOUND,pT as MULTI_WALLET_ERROR__MISSING_ACCOUNT,VT as MULTI_WALLET_ERROR__MISSING_COMPRESSED_PROOF_ARGS,jT as MULTI_WALLET_ERROR__MISSING_COMPRESSED_TOKEN_ACCOUNT,rf as MULTI_WALLET_ERROR__MISSING_DESTINATION_TOKEN_ACCOUNT,JT as MULTI_WALLET_ERROR__MISSING_INSTRUCTIONS_SYSVAR,HT as MULTI_WALLET_ERROR__MISSING_LIGHT_CPI_ACCOUNTS,sf as MULTI_WALLET_ERROR__MISSING_NEW_AUTHORITY,of as MULTI_WALLET_ERROR__MISSING_SETTINGS_ACCOUNT_FOR_DELEGATE,YT as MULTI_WALLET_ERROR__MISSING_SPL_INTERFACE_PDA,UT as MULTI_WALLET_ERROR__MISSING_SYSVAR_SLOT_HISTORY,IT as MULTI_WALLET_ERROR__NO_SIGNER_FOUND,sT as MULTI_WALLET_ERROR__ONLY_ONE_ADMINISTRATOR_ALLOWED,Xy as MULTI_WALLET_ERROR__ONLY_ONE_PERMANENT_MEMBER_ALLOWED,Qy as MULTI_WALLET_ERROR__ONLY_ONE_TRANSACTION_MANAGER_ALLOWED,wT as MULTI_WALLET_ERROR__ORIGIN_INDEX_OUT_OF_BOUNDS,qT as MULTI_WALLET_ERROR__PAYER_MISMATCH,Zy as MULTI_WALLET_ERROR__PERMANENT_MEMBER,_T as MULTI_WALLET_ERROR__PROTECTED_ACCOUNT,Ky as MULTI_WALLET_ERROR__RP_ID_HASH_MISMATCH,KT as MULTI_WALLET_ERROR__SETTINGS_KEY_MISMATCH,Gy as MULTI_WALLET_ERROR__SIGNATURE_INDEX_OUT_OF_BOUNDS,kT as MULTI_WALLET_ERROR__SLOT_NUMBER_NOT_FOUND,aT as MULTI_WALLET_ERROR__TOO_MANY_MEMBERS,RT as MULTI_WALLET_ERROR__TRANSACTION_HAS_EXPIRED,PT as MULTI_WALLET_ERROR__TRANSACTION_NOT_APPROVED,WT as MULTI_WALLET_ERROR__TRANSPORTS_IS_MISSING,ET as MULTI_WALLET_ERROR__UNAUTHORISED_TO_CLOSE_TRANSACTION_BUFFER,ef as MULTI_WALLET_ERROR__UNAUTHORIZED_ADMIN_ONLY,xT as MULTI_WALLET_ERROR__UNEXPECTED_SIGNER,A as MULTI_WALLET_PROGRAM_ADDRESS,Wy as MultiWalletAccount,By as MultiWalletInstruction,gc as NATIVE_TRANSFER_INTENT_DISCRIMINATOR,te as Permission,ce as Permissions,Oo as SETTINGS_DISCRIMINATOR,ae as Secp256r1Key,b as SignedSecp256r1Key,la as StartMessageRequestSchema,pa as StartTransactionRequestSchema,xc as TOKEN_TRANSFER_INTENT_DISCRIMINATOR,Cc as TRANSACTION_BUFFER_CLOSE_DISCRIMINATOR,Uc as TRANSACTION_BUFFER_CREATE_DISCRIMINATOR,Vo as TRANSACTION_BUFFER_DISCRIMINATOR,Bc as TRANSACTION_BUFFER_EXECUTE_DISCRIMINATOR,Hc as TRANSACTION_BUFFER_EXTEND_DISCRIMINATOR,Jc as TRANSACTION_BUFFER_VOTE_DISCRIMINATOR,ta as TRANSACTION_EXECUTE_DISCRIMINATOR,aa as TRANSACTION_EXECUTE_SYNC_DISCRIMINATOR,ga as TransactionActionTypeSchema,df as TransactionDetailsSchema,kM as TransactionPayloadSchema,uf as TransactionPayloadWithBase64MessageBytesSchema,Xn as Transports,Qo as USER_DISCRIMINATOR,cf as UserInfoSchema,be as UserRole,z as base64URLStringToBuffer,FR as bufferToBase64URLString,oh as changeConfig,eU as closeTransactionBuffer,HS as configAction,HR as convertBase64StringToJWK,VR as convertJWKToBase64String,La as convertMemberKeyToString,kR as convertPubkeyCompressedToCose,vR as convertPubkeyCoseToCompressed,WR as createClientAuthorizationCompleteRequestChallenge,OR as createClientAuthorizationStartRequestChallenge,vP as createDomainConfig,lh as createDomainUserAccounts,WP as createGlobalCounter,BR as createMessageChallenge,ai as createTransactionBuffer,NR as createTransactionChallenge,$R as createTransactionManagerSigner,fh as createUserAccounts,Dh as createWallet,wr as decodeDomainConfig,Kr as decodeGlobalCounter,Wo as decodeSettings,zo as decodeTransactionBuffer,es as decodeUser,eP as deserializeConfigActions,FP as disableDomainConfig,Ph as editDomainConfig,vh as editTransactionManagerUrl,Fh as editUserDelegate,Ja as executeTransaction,ii as executeTransactionBuffer,$a as executeTransactionSync,ui as extendTransactionBuffer,rx as extensionStruct,Q1 as fetchAllDomainConfig,cS as fetchAllGlobalCounter,_i as fetchAllMaybeDomainConfig,Ki as fetchAllMaybeGlobalCounter,_g as fetchAllMaybeSettings,Jg as fetchAllMaybeTransactionBuffer,pl as fetchAllMaybeUser,iE as fetchAllSettings,SP as fetchAllSettingsAccountByMember,mE as fetchAllTransactionBuffer,IE as fetchAllUser,Fr as fetchDomainConfig,sS as fetchGlobalCounter,Pi as fetchMaybeDomainConfig,zi as fetchMaybeGlobalCounter,Pg as fetchMaybeSettings,Yg as fetchMaybeTransactionBuffer,ll as fetchMaybeUser,Bo as fetchSettings,Bf as fetchSignaturesFromTransactionManager,pE as fetchTransactionBuffer,ts as fetchUser,fP as fetchUserAccountByFilters,dS as getAccountStateCodec,Ot as getAccountStateDecoder,Lt as getAccountStateEncoder,TS as getAddMemberArgsCodec,wt as getAddMemberArgsDecoder,Nt as getAddMemberArgsEncoder,lS as getAdditionalMetadataCodec,Bt as getAdditionalMetadataDecoder,Wt as getAdditionalMetadataEncoder,wE as getChangeConfigDiscriminatorBytes,As as getChangeConfigInstruction,FE as getChangeConfigInstructionDataCodec,ds as getChangeConfigInstructionDataDecoder,us as getChangeConfigInstructionDataEncoder,Mr as getClientAndDeviceHash,xS as getCompiledInstructionCodec,Gt as getCompiledInstructionDecoder,Ft as getCompiledInstructionEncoder,DS as getCompressedOnlyExtensionCodec,Ht as getCompressedOnlyExtensionDecoder,Vt as getCompressedOnlyExtensionEncoder,MS as getCompressedProofCodec,Jt as getCompressedProofDecoder,Yt as getCompressedProofEncoder,hS as getCompressedTokenArgsCodec,Xt as getCompressedTokenArgsDecoder,Zt as getCompressedTokenArgsEncoder,LS as getCompressibleExtensionCodec,on as getCompressibleExtensionDecoder,rn as getCompressibleExtensionEncoder,NS as getCompressionInfoCodec,cn as getCompressionInfoDecoder,sn as getCompressionInfoEncoder,VS as getConfigActionCodec,Ne as getConfigActionDecoder,Be as getConfigActionEncoder,jE as getCreateDomainConfigDiscriminatorBytes,Is as getCreateDomainConfigInstruction,JE as getCreateDomainConfigInstructionAsync,YE as getCreateDomainConfigInstructionDataCodec,xs as getCreateDomainConfigInstructionDataDecoder,cr as getCreateDomainConfigInstructionDataEncoder,rD as getCreateDomainUserAccountDiscriminatorBytes,Rs as getCreateDomainUserAccountInstruction,oD as getCreateDomainUserAccountInstructionDataCodec,Ms as getCreateDomainUserAccountInstructionDataDecoder,Cs as getCreateDomainUserAccountInstructionDataEncoder,AD as getCreateGlobalCounterDiscriminatorBytes,lD as getCreateGlobalCounterInstruction,Us as getCreateGlobalCounterInstructionAsync,gD as getCreateGlobalCounterInstructionDataCodec,hs as getCreateGlobalCounterInstructionDataDecoder,ur as getCreateGlobalCounterInstructionDataEncoder,ID as getCreateUserAccountDiscriminatorBytes,Os as getCreateUserAccountInstruction,DD as getCreateUserAccountInstructionAsync,ED as getCreateUserAccountInstructionDataCodec,Ls as getCreateUserAccountInstructionDataDecoder,Ar as getCreateUserAccountInstructionDataEncoder,hD as getCreateWalletDiscriminatorBytes,Fs as getCreateWalletInstruction,vD as getCreateWalletInstructionAsync,UD as getCreateWalletInstructionDataCodec,ws as getCreateWalletInstructionDataDecoder,lr as getCreateWalletInstructionDataEncoder,wR as getDeviceMessageHash,wD as getDisableDomainConfigDiscriminatorBytes,qs as getDisableDomainConfigInstruction,FD as getDisableDomainConfigInstructionDataCodec,Ks as getDisableDomainConfigInstructionDataDecoder,zs as getDisableDomainConfigInstructionDataEncoder,Re as getDomainConfigAddress,$1 as getDomainConfigCodec,Nr as getDomainConfigDecoder,X1 as getDomainConfigDiscriminatorBytes,Ri as getDomainConfigEncoder,eS as getDomainConfigSize,jD as getEditDomainConfigDiscriminatorBytes,$s as getEditDomainConfigInstruction,YD as getEditDomainConfigInstructionDataCodec,Xs as getEditDomainConfigInstructionDataDecoder,Zs as getEditDomainConfigInstructionDataEncoder,YS as getEditMemberArgsCodec,mn as getEditMemberArgsDecoder,pn as getEditMemberArgsEncoder,tb as getEditTransactionManagerUrlDiscriminatorBytes,nc as getEditTransactionManagerUrlInstruction,rb as getEditTransactionManagerUrlInstructionAsync,nb as getEditTransactionManagerUrlInstructionDataCodec,tc as getEditTransactionManagerUrlInstructionDataDecoder,mr as getEditTransactionManagerUrlInstructionDataEncoder,Ab as getEditUserDelegateDiscriminatorBytes,dc as getEditUserDelegateInstruction,gb as getEditUserDelegateInstructionDataCodec,uc as getEditUserDelegateInstructionDataDecoder,ic as getEditUserDelegateInstructionDataEncoder,$S as getExpectedSignerCodec,Fe as getExpectedSignerDecoder,we as getExpectedSignerEncoder,nx as getExtensionStructCodec,We as getExtensionStructDecoder,$t as getExtensionStructEncoder,Dt as getGlobalCounterAddress,oS as getGlobalCounterCodec,zr as getGlobalCounterDecoder,rS as getGlobalCounterDiscriminatorBytes,Hi as getGlobalCounterEncoder,aS as getGlobalCounterSize,aR as getLightCpiSigner,Ye as getLightProtocolRpc,ix as getMemberCodec,Un as getMemberDecoder,hn as getMemberEncoder,Ax as getMemberKeyCodec,k as getMemberKeyDecoder,h as getMemberKeyEncoder,TM as getMultiWalletErrorMessage,xb as getNativeTransferIntentDiscriminatorBytes,pc as getNativeTransferIntentInstruction,Eb as getNativeTransferIntentInstructionAsync,Ib as getNativeTransferIntentInstructionDataCodec,lc as getNativeTransferIntentInstructionDataDecoder,yr as getNativeTransferIntentInstructionDataEncoder,GR as getOriginIndex,px as getPackedMerkleContextCodec,en as getPackedMerkleContextDecoder,Qt as getPackedMerkleContextEncoder,Tx as getPausableAccountExtensionCodec,Sn as getPausableAccountExtensionDecoder,fn as getPausableAccountExtensionEncoder,xx as getPermanentDelegateAccountExtensionCodec,In as getPermanentDelegateAccountExtensionDecoder,xn as getPermanentDelegateAccountExtensionEncoder,Dx as getPermissionsCodec,ge as getPermissionsDecoder,Ae as getPermissionsEncoder,Rx as getProofArgsCodec,kn as getProofArgsDecoder,vn as getProofArgsEncoder,Ux as getRemoveMemberArgsCodec,Tn as getRemoveMemberArgsDecoder,yn as getRemoveMemberArgsEncoder,Lx as getRentConfigCodec,An as getRentConfigDecoder,dn as getRentConfigEncoder,Rr as getSecp256r1MessageHash,Bx as getSecp256r1PubkeyCodec,Ge as getSecp256r1PubkeyDecoder,Wn as getSecp256r1PubkeyEncoder,i1 as getSecp256r1SignatureOffsetsDataDecoder,a1 as getSecp256r1SignatureOffsetsDataEncoder,Fx as getSecp256r1VerifyArgsCodec,F as getSecp256r1VerifyArgsDecoder,w as getSecp256r1VerifyArgsEncoder,zx as getSecp256r1VerifyArgsWithDomainConfigIndexCodec,Nn as getSecp256r1VerifyArgsWithDomainConfigIndexDecoder,Bn as getSecp256r1VerifyArgsWithDomainConfigIndexEncoder,U as getSecp256r1VerifyInstruction,XP as getSecp256r1VerifyInstructionDataCodec,ja as getSecp256r1VerifyInstructionDataDecoder,Ya as getSecp256r1VerifyInstructionDataEncoder,aE as getSettingsCodec,ut as getSettingsDecoder,cE as getSettingsDiscriminatorBytes,Rg as getSettingsEncoder,ue as getSettingsFromIndex,jx as getSettingsIndexWithDelegateInfoCodec,Fn as getSettingsIndexWithDelegateInfoDecoder,wn as getSettingsIndexWithDelegateInfoEncoder,LR as getSignedSecp256r1Key,L as getSolanaRpc,pR as getSolanaRpcEndpoint,Zx as getSplInterfacePdaArgsCodec,Vn as getSplInterfacePdaArgsDecoder,Gn as getSplInterfacePdaArgsEncoder,eI as getTokenMetadataCodec,Dn as getTokenMetadataDecoder,En as getTokenMetadataEncoder,hb as getTokenTransferIntentDiscriminatorBytes,Ec as getTokenTransferIntentInstruction,vb as getTokenTransferIntentInstructionAsync,Ub as getTokenTransferIntentInstructionDataCodec,Ic as getTokenTransferIntentInstructionDataDecoder,Tr as getTokenTransferIntentInstructionDataEncoder,Ea as getTransactionBufferAddress,Fb as getTransactionBufferCloseDiscriminatorBytes,Pc as getTransactionBufferCloseInstruction,Gb as getTransactionBufferCloseInstructionDataCodec,Rc as getTransactionBufferCloseInstructionDataDecoder,Mc as getTransactionBufferCloseInstructionDataEncoder,lE as getTransactionBufferCodec,Jb as getTransactionBufferCreateDiscriminatorBytes,Lc as getTransactionBufferCreateInstruction,Zb as getTransactionBufferCreateInstructionDataCodec,kc as getTransactionBufferCreateInstructionDataDecoder,vc as getTransactionBufferCreateInstructionDataEncoder,Ho as getTransactionBufferDecoder,gE as getTransactionBufferDiscriminatorBytes,jg as getTransactionBufferEncoder,oC as getTransactionBufferExecuteDiscriminatorBytes,Fc as getTransactionBufferExecuteInstruction,sC as getTransactionBufferExecuteInstructionDataCodec,wc as getTransactionBufferExecuteInstructionDataDecoder,Nc as getTransactionBufferExecuteInstructionDataEncoder,gC as getTransactionBufferExtendDiscriminatorBytes,qc as getTransactionBufferExtendInstruction,lC as getTransactionBufferExtendInstructionDataCodec,Kc as getTransactionBufferExtendInstructionDataDecoder,zc as getTransactionBufferExtendInstructionDataEncoder,IC as getTransactionBufferVoteDiscriminatorBytes,$c as getTransactionBufferVoteInstruction,EC as getTransactionBufferVoteInstructionDataCodec,Xc as getTransactionBufferVoteInstructionDataDecoder,Zc as getTransactionBufferVoteInstructionDataEncoder,_C as getTransactionExecuteDiscriminatorBytes,oa as getTransactionExecuteInstruction,hC as getTransactionExecuteInstructionDataCodec,ra as getTransactionExecuteInstructionDataDecoder,na as getTransactionExecuteInstructionDataEncoder,NC as getTransactionExecuteSyncDiscriminatorBytes,da as getTransactionExecuteSyncInstruction,wC as getTransactionExecuteSyncInstructionDataCodec,ua as getTransactionExecuteSyncInstructionDataDecoder,ia as getTransactionExecuteSyncInstructionDataEncoder,rI as getTransactionMessageAddressTableLookupCodec,Zn as getTransactionMessageAddressTableLookupDecoder,Jn as getTransactionMessageAddressTableLookupEncoder,aI as getTransactionSyncSignersCodec,Q as getTransactionSyncSignersDecoder,$ as getTransactionSyncSignersEncoder,gI as getTransferFeeAccountExtensionCodec,Cn as getTransferFeeAccountExtensionDecoder,bn as getTransferFeeAccountExtensionEncoder,mI as getTransferHookAccountExtensionCodec,Rn as getTransferHookAccountExtensionDecoder,Mn as getTransferHookAccountExtensionEncoder,fI as getTransportsCodec,He as getTransportsDecoder,Ve as getTransportsEncoder,v as getUserAddress,xE as getUserCodec,pt as getUserDecoder,SE as getUserDiscriminatorBytes,gl as getUserEncoder,II as getUserRoleCodec,fe as getUserRoleDecoder,Te as getUserRoleEncoder,N1 as getVersionFromDiscriminator,cR as getWalletAddressFromIndex,ne as getWalletAddressFromSettings,dM as identifyMultiWalletAccount,AM as identifyMultiWalletInstruction,mR as initialize,zS as isConfigAction,ox as isExtensionStruct,fM as isMultiWalletError,uI as isTransactionSyncSigners,U_ as nativeTransferIntent,GE as parseChangeConfigInstruction,ZE as parseCreateDomainConfigInstruction,sD as parseCreateDomainUserAccountInstruction,pD as parseCreateGlobalCounterInstruction,bD as parseCreateUserAccountInstruction,kD as parseCreateWalletInstruction,GD as parseDisableDomainConfigInstruction,JD as parseEditDomainConfigInstruction,ob as parseEditTransactionManagerUrlInstruction,lb as parseEditUserDelegateInstruction,Db as parseNativeTransferIntentInstruction,$P as parseSecp256r1VerifyInstruction,kb as parseTokenTransferIntentInstruction,Vb as parseTransactionBufferCloseInstruction,Xb as parseTransactionBufferCreateInstruction,cC as parseTransactionBufferExecuteInstruction,pC as parseTransactionBufferExtendInstruction,DC as parseTransactionBufferVoteInstruction,UC as parseTransactionExecuteInstruction,FC as parseTransactionExecuteSyncInstruction,FU as prepareChangeConfigArgs,jU as prepareTransactionBundle,cv as prepareTransactionMessage,Av as prepareTransactionSync,XR as retrieveTransactionManager,QR as serializeConfigActions,Y_ as tokenTransferIntent,iI as transactionSyncSigners,xa as vaultTransactionMessageDeserialize,Sa as vaultTransactionMessageSerialize,di as voteTransactionBuffer};//# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map