{"version":3,"file":"client.cjs","names":["versions","JsSHA","JsSHA","isHex","isBytes","aobject","randomBytes","B","shake256","randb","N","Q","PRF","opts","shake256","MlKEM1024","MlKEM768","JsSHA","kcore.wotsAddress","kcore.mlkemKeypair","kcore.mlkemEncaps","kcore.mlkemDecaps","kcore.KcoreUnavailable","Meta","Meta","kcore.chainsHex","JsSHA","versions","kcore.chainsHex","JsSHA","textEncoder","GCM_IV_LENGTH","textEncoder","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","Response","cacheExchange","fetchExchange","createWSClient","subscriptionExchange","createClient","pipe","map","subscribe","getFingerprint","getFingerprintData","Response","textDecoder","KEY_PREFIX","KEY_PREFIX","GCM_IV_LENGTH","textEncoder","textDecoder","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__copyProps","from","keys","i","n","key","to","except","k","desc","__toESM","mod","isNodeMode","target","jssha","_urql_core","graphql_ws","wonka","Hex","numberToHex","set","uppercase","val","opts","options","str","group","column","arr","buffer","curr","c","chr","letter","chunkSubstr","numChunks","size","chunks","chunkIndex","o","randomString","array","length","result","alphabet","charsetBaseConvert","srcSymbolTable","fromBase","toBase","destSymbolTable","src","charIndex","res","r","bufferToHexString","byteArray","hexStringToBuffer","hexString","hexToBase64","bytes","string","binary","CHUNK_SIZE","base64ToHex","isHex","isNumeric","Meta","meta","entry","property","raw","aggregate","metaEntry","chunkArray","deepCloning","x","t","s","h","diff","arrays","others","unique","item","intersect","first","second","PolicyMeta","policy","metaKeys","policyMeta","policyKey","value","content","readPolicy","writePolicy","type","AtomMeta","walletMeta","wallet","shadowWalletClaim","BaseException","message","fileName","lineNumber","AtomsMissingException","HashAtom","parameters","atom","object","structure","versions_default","position","walletAddress","isotope","token","batchId","metaType","metaId","index","createdAt","version","Atom","otsFragment","json","properties","validateFields","field","serialized","includeOtsFragments","error","data","strictMode","validateStructure","molecularSponge","atomList","atoms","numberOfAtoms","hashableValues","hashableValue","output","generateSecret","seed","sponge","generateBundleHash","secret","shake256","input","outputLength","generateBatchId","molecularHash","TokenUnit","id","name","metas","ABI_VERSION","DEFAULT_SPECIFIER","HEX","MLKEM_SIZES","SEED_BYTES","COINS_BYTES","KcoreUnavailable","state","lib","reason","mode","readMode","load","gbm","specifier","base","candidate","abi","ensure","isHex$1","isBytes$1","wotsAddress","chainsHex","counts","mlkemKeypair","mlkemEncaps","sizes","publicKey","coins","mlkemDecaps","cipherText","secretKey","WalletCredentialException","U32_MASK64","_32n","fromBig","le","split","len","lst","Ah","Al","l","isBytes","a","atitle","title","anumber","abool","abytes","ofLen","got","aobject$1","label","aopts","proto","aexists","instance","checkFinished","aoutput","out","min","u32","clean","isLE","byteSwap","word","byteSwap32","swap32IfBE","u","checkOpts","defaults","createHasher","hashCons","info","hashC","msg","tmp","randomBytes$1","bytesLength","cr","oidNist","suffix","_0n","_1n","_2n","_7n","_256n","_0x71n","SHA3_PI","SHA3_ROTL","_SHA3_IOTA","round","R","y","j","IOTAS","SHA3_IOTA_H","SHA3_IOTA_L","rotlSH","rotlSL","rotlBH","rotlBL","rotlH","rotlL","B$1","keccakP","rounds","idx1","idx0","B0","B1","Th","Tl","curH","curL","shift","PI","b0","b1","b2","b3","Keccak","blockLen","enableXOF","outputLen","canUseU32","blockLen32","data32","pos","take","bufferOut","genKeccak","sha3_256","sha3_512","genShake","shake128","shake256$1","aobject","validateObject","fields","optFields","checkField","fieldName","isOpt","expectedType","current","iter","f","v","checkU32","isPowerOfTwo","reverseBits","bits","reversed","log2","bitReversalInplace","values","FFTCore","coreOpts","N","skipStages","maxSkipStages","roots","isDit","dit","invertButterflies","brp","g","m","m2","stride","grp","rootPos","i0","i1","omega","b","F","abytesDoc","randomBytes","aarray","inner","equalBytes","copyBytes","splitCoder","lengths","getLength","bytesLen","sum","bufs","buf","vecCoder","coder","vecLen","uArr","cleanBytes","list","getMask","genCrystals","Q","modulo","smod","getZettas","newPoly","brvBits","p","ROOT_OF_UNITY","nttZetas","inv","isKyber","nttOpts","dif","NTT","bufLen","d","mask","poly","poly_","XOF128","shake","_seed","seedLen","calls","xofs","N$1","Q$1","crystals","PARAMS","compress","byteCoder","polyCoder","polyAdd","a_","b_","polySub","BaseCaseMultiply","a1","zeta","a0","MultiplyNTTs","f_","g_","z","c0","c1","SampleNTT","xof","xof_","d1","d2","sampleCBDBytes","b32","bb","t0","eta","sampleCBD","PRF_","nonce","genKPKE","opts_","poly1","polyV","dv","polyU","du","publicCoder","K","secretCoder","cipherCoder","seedCoder","encryptCore","rHat","PRF","ETA1","tmp2","e1","ETA2","getA","tHat","e2","seedDst","seedHash","HASH512","rho","sigma","sHat","XOF","e","A","sk","privateKey","createKyber","rawOpts","KPKE","KPKESecretCoder","validateModulus","eke","ek","ok","fn","kemLengths","ownSeed","publicKeyHash","HASH256","_sk","_publicKeyHash","_z","ownMsg","kr","k768","start","Khat","cipherText2","isValid","Kbar","KDF","cached","ekEmbedded","storedHash","shakePRF","mk","params","ml_kem768","ML_KEM_PARAMS","DEFAULT_ML_KEM_PARAMETER_SET","Wallet","paramSetNum","mlKemParameterSet","address","bundle","characters","maybeBundleHash","unitsData","unitData","secretHex","positionHex","indexedKey","intermediateKeySponge","privateKeySponge","viaKcore","keyFragments","digestSponge","workingFragment","fragmentCount","workingSponge","outputSponge","saltLength","parameterSet","seedHex","derived","serializedKey","binaryString","pubkey","byteLength","intPart","tokenUnit","units","recipientTokenUnits","remainderTokenUnits","recipientWallet","sentIds","recipientUnitLists","unitList","recipientWallets","ids","remainderWallet","sourceWallet","isRemainder","messageString","messageUint8","deserializedPubkey","recipientPubkey","encryptedMessage","sharedSecret","decryptedString","encryptedData","deserializedCipherText","configuredParams","otherSet","decapsParams","decapsPrivkey","deserializedEncryptedMessage","decryptedUint8","hex","envelope","map","other","iv","algorithm","encryptedContent","decryptedContent","AtomIndexException","MolecularHashMismatchException","MolecularHashMissingException","PolicyInvalidException","SignatureMalformedException","SignatureMismatchException","TransferBalanceException","TransferMalformedException","TransferMismatchedException","TransferRemainderException","TransferToSelfException","TransferUnbalancedException","MetaMissingException","WrongTokenTypeException","BatchIdException","Meta$1","args","RuleArgumentException","CodeException","Callback","action","amount","comparison","callback","Condition","Rule","element","condition","rule","CheckMolecule","molecule","senderWallet","signingAtom","remainderAtom","policyArray","policyName","policyValue","rules","isotopeB","vAtoms","isotopeF","isotopeV","hasCrossIsotope","firstAtom","endAtom","vAtom","remainder","normalizedHash","ots","accumulator","otsChunks","workingChunk","iterationCount","digest","addressSponge","mappedAtoms","serverAtom","parsed","Molecule","bundleHash","moleculeData","BalanceInsufficientException","NegativeAmountException","StackableUnitAmountException","BURN_BUNDLE","cellSlug","continuIdPosition","hashes","isotopes","mapped","hashList","hash","symbol","total","mappedHashArray","num","totalCondition","continuIdMeta","atomMeta","fusedTokenUnitIds","sourceUnits","sourceUnitIds","tokenUnitId","newUnit","newTokenUnit","balance","fusedCount","fusedUnits","burnWallet","tokenUnits","creditedWallet","amounts","bufferWallet","tradeRates","recipientAmount","recipients","recipientBundle","$rules","$rule","creationAtom","contact","host","anonymous","keyChunks","signatureFragments","compressed","chunkedSignature","lastPosition","chunkCount","includeValidationContext","atomData","AuthToken","expiresAt","encrypt","authToken","explicit","snapshot","Dot","numberKey","obj","def","parts","lastIndex","useNumberKey","lastKey","lastNumberKey","SecretStorageException","provider","textEncoder$3","zeroizeBytes","withSecureBytes","withSecureString","constantTimeCompare","bytesA","bytesB","ENVELOPE_ALGORITHM","DEFAULT_ITERATIONS","SECRET_KEY_PREFIX","RECOVERY_KEY_PREFIX","GCM_IV_LENGTH$2","SALT_LENGTH","textEncoder$2","uint8ArrayToBase64","byte","base64ToUint8Array","base64","deriveEnvelopeKey","passphraseBytes","passphrase","baseKey","sealEnvelope","salt","secretBytes","encryptedBuffer","openEnvelope","payload","ciphertext","decryptedBuffer","MemorySecretStorageProvider","metadata","recoveryMetadata","recoveryPayload","recoveryPassphrase","decryptedBytes","err","secretStr","multiplier","Decimal","val1","value1","val2","value2","InvalidResponseException","UnauthenticatedException","Response$1","dataKey","query","errorMessage","debugPrefix","mappedPayload","mapper","newResponse","errorResponse","Query","graphQLClient","knishIOClient","response","variables","mergedContext","context","ResponseContinuId","continuId","QueryContinuId","ResponseWalletBundle","bundleData","QueryWalletBundle","ResponseWalletList","tokenUnitData","tradeRate","wallets","QueryWalletList","ResponseBalance","walletData","QueryBalance","ResponseMetaType","metaTypeData","metaData","QueryMetaType","latest","filter","queryArgs","count","countBy","QueryBatch","responseObject","QueryBatchHistory","ResponseProposeMolecule","payloadJson","Mutation","request","mutationParams","MutationProposeMolecule","ResponseRequestAuthorization","ea","timeValue","MutationRequestAuthorization","ResponseCreateToken","MutationCreateToken","ResponseRequestTokens","MutationRequestTokens","ResponseTransferTokens","MutationTransferTokens","ResponseCreateIdentifier","MutationCreateIdentifier","ResponseClaimShadowWallet","MutationClaimShadowWallet","ResponseCreateMeta","MutationCreateMeta","ResponsePeering","MutationPeering","ResponseAppendRequest","MutationAppendRequest","ResponseLinkIdentifier","MutationLinkIdentifier","ResponseCreateWallet","MutationCreateWallet","ResponseRequestAuthorizationGuest","MutationRequestAuthorizationGuest","WalletShadowException","StackableUnitDecimalsException","Subscribe","closure","CreateMoleculeSubscribe","WalletStatusSubscribe","ActiveWalletSubscribe","ActiveSessionSubscribe","ResponseActiveSession","MutationActiveSession","ResponseQueryActiveSession","activeUsers","activeSession","QueryActiveSession","QueryToken","AuthorizationRejectedException","ResponseAtom","instanceKey","QueryAtom","molecularHashes","bundleHashes","positions","walletAddresses","tokenSlug","tokenSlugs","cellSlugs","batchIds","metaTypes","metaIds","indexes","ResponsePolicy","QueryPolicy","ResponseMetaTypeViaAtom","QueryMetaTypeViaAtom","atomValues","ResponseMetaTypeViaMolecule","results","instances","QueryMetaTypeViaMolecule","ResponseEmbeddingStatus","items","QueryEmbeddingStatus","ResponseCreateRule","MutationCreateRule","MutationDepositBufferToken","MutationWithdrawBufferToken","w","S","_","P","M","C","E","T","O","I","B","L","D","U","$","W","G","H","q","J","Y","X","Z","ee","ne","te","re","oe","ie","ae","se","ce","ue","de","me","pe","fe","he","ge","CIPHER_HASH_QUERY","parseOperation","typeMatch","braceIdx","nameMatch","UrqlClientWrapper","serverUri","socket","exchanges","wsClient","operation","sink","init","body","serverPubkey","encryptedRequest","requestInit","hashVar","text","init2","decrypted","callerSignal","signal","mutation","subscription","operationName","uri","KnishIOClient","secretStorage","logging","defaultRequestPolicy","uriKey","url","serverSdkVersion","client","paramNum","rand","randomUri","authTokenObject","memStorage","source","storage","userWallet","QueryClass","SubscribeClass","MutationClass","_molecule","authSecret","abortController","queryKey","requestContext","controller","throughMolecule","throughAtom","requestPolicy","cacheKey","supported","newWallet","fungibility","walletQuery","queryToken","tokenResponse","isStackable","shadowWallets","shadowWallet","responses","recipient","previous","authorize","authMeta","pointerWallet","level","ResponseAuthorizationGuest","MemoryStorageBackend","textDecoder$2","KEY_PREFIX$2","WebCryptoSecretStorageProvider","iterations","recoveryKey","matchingKeys","storePassphrase","FileStorageBackend","filePath","fs","dir","path","tmpPath","existed","WebStorageBackend","prefix","PRF_SALT_LABEL","KEK_INFO","KEY_PREFIX$1","GCM_IV_LENGTH$1","textEncoder$1","textDecoder$1","base64UrlEncode","base64UrlDecode","toUint8Array","computePrfSalt","deriveKekFromPrf","hkdfKey","prfOutput","prfSalt","WebAuthnPrfSecretStorageProvider","hasWebCrypto","hasCredentials","challenge","credential","credentialIdBytes","getChallenge","assertion","firstOutput","kek","devicePassphraseBytes","devicePassphrase","record","rawRecord","KEY_PREFIX","GCM_IV_LENGTH","textEncoder","textDecoder","MemoryKeyStore","IndexedDbKeyStore","dbName","db","resolve","reject","NonExtractableKeySecretStorageProvider","createDefaultSecretStorage"],"sources":["../src/libraries/Hex.js","../src/libraries/strings.js","../src/Meta.js","../src/libraries/array.js","../src/PolicyMeta.js","../src/AtomMeta.js","../src/exception/BaseException.js","../src/exception/AtomsMissingException.js","../src/versions/HashAtom.js","../src/versions/Version4.js","../src/versions/index.js","../src/Atom.js","../src/libraries/crypto.js","../src/TokenUnit.js","../src/libraries/kcore.js","../src/exception/WalletCredentialException.js","../node_modules/@noble/hashes/_u64.js","../node_modules/@noble/hashes/utils.js","../node_modules/@noble/hashes/sha3.js","../node_modules/@noble/curves/utils.js","../node_modules/@noble/curves/abstract/fft.js","../node_modules/@noble/post-quantum/utils.js","../node_modules/@noble/post-quantum/_crystals.js","../node_modules/@noble/post-quantum/ml-kem.js","../src/Wallet.js","../src/exception/AtomIndexException.js","../src/exception/MolecularHashMismatchException.js","../src/exception/MolecularHashMissingException.js","../src/exception/PolicyInvalidException.js","../src/exception/SignatureMalformedException.js","../src/exception/SignatureMismatchException.js","../src/exception/TransferBalanceException.js","../src/exception/TransferMalformedException.js","../src/exception/TransferMismatchedException.js","../src/exception/TransferRemainderException.js","../src/exception/TransferToSelfException.js","../src/exception/TransferUnbalancedException.js","../src/exception/MetaMissingException.js","../src/exception/WrongTokenTypeException.js","../src/exception/BatchIdException.js","../src/instance/Rules/Meta.js","../src/instance/Rules/exception/RuleArgumentException.js","../src/exception/CodeException.js","../src/instance/Rules/Callback.js","../src/instance/Rules/Condition.js","../src/instance/Rules/Rule.js","../src/libraries/CheckMolecule.js","../src/exception/BalanceInsufficientException.js","../src/exception/NegativeAmountException.js","../src/exception/StackableUnitAmountException.js","../src/Molecule.js","../src/AuthToken.js","../src/libraries/Dot.js","../src/exception/SecretStorageException.js","../src/libraries/secureMemory.js","../src/storage/secretEnvelope.js","../src/storage/MemorySecretStorageProvider.js","../src/libraries/Decimal.js","../src/exception/InvalidResponseException.js","../src/exception/UnauthenticatedException.js","../src/response/Response.js","../src/query/Query.js","../src/response/ResponseContinuId.js","../src/query/QueryContinuId.js","../src/response/ResponseWalletBundle.js","../src/query/QueryWalletBundle.js","../src/response/ResponseWalletList.js","../src/query/QueryWalletList.js","../src/response/ResponseBalance.js","../src/query/QueryBalance.js","../src/response/ResponseMetaType.js","../src/query/QueryMetaType.js","../src/query/QueryBatch.js","../src/query/QueryBatchHistory.js","../src/response/ResponseProposeMolecule.js","../src/mutation/Mutation.js","../src/mutation/MutationProposeMolecule.js","../src/response/ResponseRequestAuthorization.js","../src/mutation/MutationRequestAuthorization.js","../src/response/ResponseCreateToken.js","../src/mutation/MutationCreateToken.js","../src/response/ResponseRequestTokens.js","../src/mutation/MutationRequestTokens.js","../src/response/ResponseTransferTokens.js","../src/mutation/MutationTransferTokens.js","../src/response/ResponseCreateIdentifier.js","../src/mutation/MutationCreateIdentifier.js","../src/response/ResponseClaimShadowWallet.js","../src/mutation/MutationClaimShadowWallet.js","../src/response/ResponseCreateMeta.js","../src/mutation/MutationCreateMeta.js","../src/response/ResponsePeering.js","../src/mutation/MutationPeering.js","../src/response/ResponseAppendRequest.js","../src/mutation/MutationAppendRequest.js","../src/response/ResponseLinkIdentifier.js","../src/mutation/MutationLinkIdentifier.js","../src/response/ResponseCreateWallet.js","../src/mutation/MutationCreateWallet.js","../src/response/ResponseRequestAuthorizationGuest.js","../src/mutation/MutationRequestAuthorizationGuest.js","../src/exception/WalletShadowException.js","../src/exception/StackableUnitDecimalsException.js","../src/subscribe/Subscribe.js","../src/subscribe/CreateMoleculeSubscribe.js","../src/subscribe/WalletStatusSubscribe.js","../src/subscribe/ActiveWalletSubscribe.js","../src/subscribe/ActiveSessionSubscribe.js","../src/response/ResponseActiveSession.js","../src/mutation/MutationActiveSession.js","../src/response/ResponseQueryActiveSession.js","../src/query/QueryActiveSession.js","../src/query/QueryToken.js","../src/exception/AuthorizationRejectedException.js","../src/response/ResponseAtom.js","../src/query/QueryAtom.js","../src/response/ResponsePolicy.js","../src/query/QueryPolicy.js","../src/response/ResponseMetaTypeViaAtom.js","../src/query/QueryMetaTypeViaAtom.js","../src/response/ResponseMetaTypeViaMolecule.js","../src/query/QueryMetaTypeViaMolecule.js","../src/response/ResponseEmbeddingStatus.js","../src/query/QueryEmbeddingStatus.js","../src/response/ResponseCreateRule.js","../src/mutation/MutationCreateRule.js","../src/mutation/MutationDepositBufferToken.js","../src/mutation/MutationWithdrawBufferToken.js","../node_modules/@thumbmarkjs/thumbmarkjs/dist/thumbmark.esm.js","../src/libraries/urql/UrqlClientWrapper.js","../src/KnishIOClient.js","../src/response/ResponseAuthorizationGuest.js","../src/storage/WebCryptoSecretStorageProvider.js","../src/storage/FileStorageBackend.js","../src/storage/WebStorageBackend.js","../src/storage/WebAuthnPrfSecretStorageProvider.js","../src/storage/NonExtractableKeySecretStorageProvider.js","../src/storage/index.js"],"sourcesContent":["/**\n * Create Uint8Array buffers from hexadecimal strings, and vice versa.\n */\n\nif (typeof self === 'undefined') {\n  global.self = global\n}\n\nexport default class Hex {\n  /**\n   * Converts the given buffer to a string containing its hexadecimal representation.\n   *\n   * arr a Uint8Array buffer to convert.\n   *\n   * options an optional object with the following members:\n   *     grouping this number of hex bytes are grouped together with spaces between groups. 0 means no grouping is applied. 0 if unspecified.\n   *     rowlength the number of groups which make up a row. When 0, no splitting into rows occurs. 0 if unspecified.\n   *     uppercase if true, the output will be in uppercase. true by default.\n   *\n   * return a hexadecimal string representing the buffer.\n   *\n   * @param {array|ArrayBuffer|Uint8Array} arr\n   * @param {object} options\n   * @return {string}\n   */\n  static toHex (arr, options) {\n    /**\n     * @param {number} val\n     * @param {boolean} uppercase\n     * @return {*}\n     */\n    const numberToHex = (val, uppercase) => {\n      const set = uppercase\n        ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']\n        : ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']\n\n      return set[Math.floor(val / 16)] + set[val % 16]\n    }\n    const opts = Object.assign(\n      {\n        grouping: 0,\n        rowlength: 0,\n        uppercase: false\n      },\n      options || {}\n    )\n\n    let str = ''\n    let group = 0\n    let column = 0\n\n    for (let i = 0; i < arr.length; ++i) {\n      str += numberToHex(arr[i], opts.uppercase)\n\n      if (i === arr.length - 1) {\n        break\n      }\n\n      if (opts.grouping > 0 && ++group === opts.grouping) {\n        group = 0\n\n        if (opts.rowlength > 0 && ++column === opts.rowlength) {\n          column = 0\n          str += '\\n'\n        } else {\n          str += ' '\n        }\n      }\n    }\n\n    return str\n  }\n\n  /**\n   * Takes a string containing hexadecimal and returns the equivalent as a Uint8Array buffer.\n   *\n   * str The string to convert. Whitespace is ignored. If an odd number of characters are specified,\n   * it will act as if preceeded with a leading 0; that is, \"FFF\" is equivalent to \"0FFF\".\n   *\n   * return a Uint8Array array.\n   *\n   * @param {string} str\n   * @return {Uint8Array}\n   */\n  static toUint8Array (str) {\n    let target = str.toLowerCase().replace(/\\s/g, '')\n\n    if (target.length % 2 === 1) {\n      target = `0${ target }`\n    }\n\n    const buffer = new Uint8Array(Math.floor(target.length / 2))\n    let curr = -1\n\n    for (let i = 0; i < target.length; ++i) {\n      const c = target[i]\n      const val = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'].indexOf(c)\n\n      if (val === -1) {\n        throw Error('unexpected character')\n      }\n\n      if (curr === -1) {\n        curr = 16 * val\n      } else {\n        buffer[Math.floor(i / 2)] = curr + val\n        curr = -1\n      }\n    }\n\n    return buffer\n  }\n}\n","import Hex from './Hex.js'\n\n/* eslint-disable no-extend-native -- intentional guarded String.prototype polyfill (trim) + SDK camel/snake-case helpers relied on across the codebase */\nif (!String.prototype.trim) {\n  String.prototype.trim = function () {\n    return this.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '')\n  }\n}\n\nif (!String.prototype.toCamelCase) {\n  String.prototype.toCamelCase = function () {\n    return this.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase())\n  }\n}\n\nif (!String.prototype.toSnakeCase) {\n  String.prototype.toSnakeCase = function () {\n    return this.replace(/[A-Z]/g, letter => `_${ letter.toLowerCase() }`)\n  }\n}\n\n/**\n * Chunks a string into array segments of equal size\n *\n * @param str\n * @param size\n * @return {any[]}\n */\nexport function chunkSubstr (str, size) {\n  const numChunks = Math.ceil(str.length / size)\n  const chunks = []\n\n  for (let chunkIndex = 0, o = 0; chunkIndex < numChunks; ++chunkIndex, o += size) {\n    chunks[chunkIndex] = str.substr(o, size)\n  }\n\n  return chunks\n}\n\n/**\n * Generates a cryptographically-secure pseudo-random string of the given length out of the given alphabet\n *\n * @param length\n * @param alphabet\n * @return {string}\n */\nexport function randomString (length = 256, alphabet = 'abcdef0123456789') {\n  const array = new Uint8Array(length)\n\n  crypto.getRandomValues(array)\n\n  // Build in a loop: String.fromCharCode.apply(null, array) spread every byte as a\n  // function argument and overflowed the call stack for a large caller-supplied length.\n  // `alphabet.charAt(x % len)` is the same mapping as the old fromCharCode(charCodeAt).\n  let result = ''\n  for (let i = 0; i < length; i++) {\n    result += alphabet.charAt(array[i] % alphabet.length)\n  }\n  return result\n}\n\n/**\n * Convert charset between bases and alphabets\n *\n * @param src\n * @param {int} fromBase\n * @param {int} toBase\n * @param { string} srcSymbolTable\n * @param {string} destSymbolTable\n * @return {boolean|string|number}\n */\nexport function charsetBaseConvert (src, fromBase, toBase, srcSymbolTable, destSymbolTable) {\n  const baseSymbols = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()-_=+[{]}\\\\|;:\\'\",<.>/?¿¡'\n  srcSymbolTable = srcSymbolTable || baseSymbols\n  destSymbolTable = destSymbolTable || srcSymbolTable\n\n  if (fromBase > srcSymbolTable.length || toBase > destSymbolTable.length) {\n    console.warn('Strings::charsetBaseConvert() - Can\\'t convert', src, 'to base', toBase, 'greater than symbol table length. src-table:', srcSymbolTable.length, 'dest-table:', destSymbolTable.length)\n    return false\n  }\n\n  // Convert from source base to BigInt in base 10\n  let val = BigInt(0)\n  for (let charIndex = 0; charIndex < src.length; charIndex++) {\n    val = val * BigInt(fromBase) + BigInt(srcSymbolTable.indexOf(src.charAt(charIndex)))\n  }\n\n  // Convert from BigInt in base 10 to destination base\n  let res = ''\n  while (val > 0) {\n    const r = val % BigInt(toBase)\n    res = destSymbolTable.charAt(Number(r)) + res\n    val /= BigInt(toBase)\n  }\n\n  // If the result is empty, it means the source was 0\n  return res || '0'\n}\n\n/**\n * Converts a buffer into a hexadecimal string\n *\n * @param byteArray\n * @return {string}\n */\nexport function bufferToHexString (byteArray) {\n  return Hex.toHex(byteArray, {})\n}\n\n/**\n * Converts a hexadecimal string into a buffer\n *\n * @param hexString\n * @return {Uint8Array}\n */\nexport function hexStringToBuffer (hexString) {\n  return Hex.toUint8Array(hexString)\n}\n\n/**\n * Compresses a given string for web sharing\n *\n * @param string\n * @return {string}\n */\nexport function hexToBase64 (string) {\n  const bytes = hexStringToBuffer(string)\n  // Buffer fast path (Node). Byte-identical to the btoa encoding below.\n  if (typeof Buffer !== 'undefined') {\n    return Buffer.from(bytes).toString('base64')\n  }\n  // Browser fallback: String.fromCharCode.apply(null, bytes) spreads every byte as a\n  // function argument and overflows the call stack past the engine's argument limit\n  // (~64K), so convert in chunks.\n  let binary = ''\n  const CHUNK_SIZE = 0x8000\n  for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {\n    binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE))\n  }\n  return btoa(binary)\n}\n\n/**\n * Decompresses a compressed string\n *\n * @param {string} string\n * @return {string}\n */\nexport function base64ToHex (string) {\n  // Buffer fast path (Node); index loop otherwise. The old `atob(string).split('')`\n  // allocated one single-char string per byte — prohibitive for multi-MB payloads.\n  if (typeof Buffer !== 'undefined') {\n    return bufferToHexString(new Uint8Array(Buffer.from(string, 'base64')))\n  }\n  const binary = atob(string)\n  const bytes = new Uint8Array(binary.length)\n  for (let i = 0; i < binary.length; i++) {\n    bytes[i] = binary.charCodeAt(i)\n  }\n  return bufferToHexString(bytes)\n}\n\n/**\n * @param {string} str\n * @return {boolean}\n */\nexport function isHex (str) {\n  return /^[A-F0-9]+$/i.test(str)\n}\n\n/**\n * @param {string} str\n * @return {boolean}\n */\nexport function isNumeric (str) {\n  return (typeof (str) === 'number' || (typeof (str) === 'string' && str.trim() !== '')) && !isNaN(str)\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n */\n\n/**\n * Meta class to represent metadata conveyed by Atoms\n */\nexport default class Meta {\n  /**\n   * Normalizes the meta array into the standard {key: ..., value: ...} format\n   *\n   * @param {array|object} meta\n   * @return {array}\n   */\n  static normalizeMeta (meta) {\n    // Ensuring that only object-based meta gets normalized\n    if (Array.isArray(meta)) {\n      return meta.map(entry => ({\n        key: entry.key,\n        value: entry.value == null ? null : String(entry.value)\n      }))\n    }\n\n    // Converting object-based meta into array-based notation\n    const target = []\n    for (const property in meta) {\n      if (Object.prototype.hasOwnProperty.call(meta, property)) {\n        const raw = meta[property]\n        target.push({ key: property, value: raw == null ? null : String(raw) })\n      }\n    }\n\n    return target\n  }\n\n  /**\n   * Condenses metadata array into object-based key: value notation\n   *\n   * @param {array|object} meta\n   * @return {object}\n   */\n  static aggregateMeta (meta) {\n    let aggregate = {}\n\n    // Ensuring that only array-based meta gets aggregated\n    if (Array.isArray(meta)) {\n      for (const metaEntry of meta) {\n        aggregate[metaEntry.key] = metaEntry.value\n      }\n    } else {\n      aggregate = meta\n    }\n\n    return aggregate\n  }\n}\n","/**\n * Split an array into chunks\n *\n * @param {array} arr\n * @param {number} size\n * @return {array}\n */\nexport function chunkArray (arr, size) {\n  // Iterative: the previous recursive form (`concat` + `slice(size)` per level) blew\n  // the call stack and allocated O(n^2) once arr grew past a few thousand elements.\n  const chunks = []\n  for (let i = 0; i < arr.length; i += size) {\n    chunks.push(arr.slice(i, i + size))\n  }\n  return chunks\n}\n\nexport function deepCloning (\n  o // The only argument passed by user: object to clone\n  , h // Cache (organized as array: [key,value,key,value,...])\n) {\n  let i\n  let r\n  let x // Property indexer, result, temporary variable\n\n  const t = [Array, Date, Number, String, Boolean] // Types to treat in a special way\n\n  const s = Object.prototype.toString // Shortcut to Object.prototype.toString\n  h = h || [] // If cache is not created yet, create it!\n  // Search cache for our object\n  for (i = 0; i < h.length; i += 2) {\n    if (o === h[i]) {\n      r = h[i + 1]\n    }\n  }\n  // Clone o if it is uncached object and not null\n  if (!r && o && typeof o === 'object') {\n    r = {} // Default result template: plain hash\n    // To handle multiframe environment, search for type by\n    for (i = 0; i < t.length; i++) {\n      //   comparing Object.prototype.toString's of our object\n      //   and new object x created with the constructor t[i]\n      // Notice that it will create new Date(o), new String(o)\n      //   which is good and new Array(o) which is bad\n      if (s.call(o) === s.call(x = new t[i](o))) {\n        r = i ? x : []\n      }\n    } // If i==0, t==Array. We need to recreate it. Else use x\n    h.push(o, r) // Add object to cache before (!) making recursive call\n    // Just copy properties recursively\n    for (i in o) {\n      // As o might have key 'hasOwnProperty', use something\n      if (h.hasOwnProperty.call(o, i)) {\n        r[i] = deepCloning(o[i], h)\n      }\n    } //   we defined right instead\n  }\n  return r || o // Return r if it was found in cache or built in if(){}\n}\n\n/**\n * @param arrays\n * @returns {*[]}\n */\nexport function diff (...arrays) {\n  return [].concat(...arrays.map((arr, i) => {\n    const others = arrays.slice(0)\n\n    others.splice(i, 1)\n\n    const unique = [...new Set([].concat(...others))]\n\n    return arr.filter(item => !unique.includes(item))\n  }))\n}\n\n/**\n *\n * @param arrays\n * @return {*[]}\n */\nexport function intersect (...arrays) {\n  return arrays.reduce((first, second) => first.filter(item => second.includes(item)))\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport { diff } from './libraries/array.js'\n\n/**\n *\n */\nexport default class PolicyMeta {\n  /**\n   *\n   * @param policy\n   * @param metaKeys\n   */\n  constructor (policy = {}, metaKeys = {}) {\n    this.policy = PolicyMeta.normalizePolicy(policy)\n    this.fillDefault(metaKeys)\n  }\n\n  /**\n   *\n   * @param policy\n   * @returns {{}}\n   */\n  static normalizePolicy (policy = {}) {\n    const policyMeta = {}\n    for (const [policyKey, value] of Object.entries(policy)) {\n      if (value !== null && ['read', 'write'].includes(policyKey)) {\n        policyMeta[policyKey] = {}\n        for (const [key, content] of Object.entries(value)) {\n          policyMeta[policyKey][key] = content\n        }\n      }\n    }\n    return policyMeta\n  }\n\n  /**\n   *\n   */\n  fillDefault (metaKeys = {}) {\n    const readPolicy = Array.from(this.policy).filter(item => item.action === 'read')\n    const writePolicy = Array.from(this.policy).filter(item => item.action === 'write')\n\n    for (const [type, value] of Object.entries({\n      read: readPolicy,\n      write: writePolicy\n    })) {\n      const policyKey = value.map(item => item.key)\n\n      if (!this.policy[type]) {\n        this.policy[type] = {}\n      }\n\n      for (const key of diff(metaKeys, policyKey)) {\n        if (!this.policy[type][key]) {\n          this.policy[type][key] = (type === 'write' && !['characters', 'pubkey'].includes(key)) ? ['self'] : ['all']\n        }\n      }\n    }\n  }\n\n  /**\n   *\n   * @returns {{}|*}\n   */\n  get () {\n    return this.policy\n  }\n\n  /**\n   *\n   * @returns {string}\n   */\n  toJson () {\n    return JSON.stringify(this.get())\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport PolicyMeta from './PolicyMeta.js'\nimport Meta from './Meta.js'\n\nconst USE_META_CONTEXT = false\nconst DEFAULT_META_CONTEXT = 'https://www.schema.org'\n\n/**\n *\n */\nexport default class AtomMeta {\n  /**\n   *\n   * @param {object|array} meta\n   */\n  constructor (meta = []) {\n    this.meta = Meta.normalizeMeta(meta)\n  }\n\n  /**\n   *\n   * @param {object|array} meta\n   * @returns {AtomMeta}\n   */\n  merge (meta) {\n    this.meta = Array.from(new Set([...this.meta, ...Meta.normalizeMeta(meta)]))\n    return this\n  }\n\n  /**\n   *\n   * @param context\n   * @returns {AtomMeta}\n   */\n  addContext (context = null) {\n    // Add context key if it is enabled\n    if (USE_META_CONTEXT) {\n      this.merge({ context: context || DEFAULT_META_CONTEXT })\n    }\n\n    return this\n  }\n\n  /**\n   *\n   * @param {Wallet} wallet\n   * @returns {AtomMeta}\n   */\n  setAtomWallet (wallet) {\n    const walletMeta = {}\n\n    // Add token units meta key\n    if (wallet.tokenUnits && wallet.tokenUnits.length) {\n      walletMeta.tokenUnits = JSON.stringify(wallet.getTokenUnitsData())\n    }\n    // Add trade rates meta key\n    if (wallet.tradeRates && wallet.tradeRates.length) {\n      walletMeta.tradeRates = JSON.stringify(wallet.tradeRates)\n    }\n\n    // Merge all wallet's metas (if any)\n    if (Object.keys(walletMeta).length > 0) {\n      this.merge(walletMeta)\n    }\n    return this\n  }\n\n  /**\n   * Set full NEW wallet metadata\n   * Used for shadow wallet claim & wallet creation & token creation\n   *\n   * @param {Wallet} wallet\n   * @returns {AtomMeta}\n   */\n  setMetaWallet (wallet) {\n    this.merge({\n      walletTokenSlug: wallet.token,\n      walletBundleHash: wallet.bundle,\n      walletAddress: wallet.address,\n      walletPosition: wallet.position,\n      walletBatchId: wallet.batchId,\n      walletPubkey: wallet.pubkey,\n      walletCharacters: wallet.characters\n    })\n    return this\n  }\n\n  /**\n   *\n   * @param shadowWalletClaim\n   * @returns {AtomMeta}\n   */\n  setShadowWalletClaim (shadowWalletClaim) {\n    this.merge({ shadowWalletClaim: shadowWalletClaim * 1 })\n    return this\n  }\n\n  /**\n   *\n   * @param policy\n   * @todo move logic to the separated class\n   * @returns {AtomMeta}\n   */\n  addPolicy (policy) {\n    // Policy meta initialization\n    const policyMeta = new PolicyMeta(policy, Object.keys(this.meta))\n\n    this.merge({\n      policy: policyMeta.toJson()\n    })\n\n    return this\n  }\n\n  /**\n   *\n   * @returns {array}\n   */\n  get () {\n    return this.meta\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n/**\n * Base exception class\n */\nexport default class BaseException extends TypeError {\n  /**\n   * @param {string|null} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = null, fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n\n    if (message === null) {\n      throw new this(`Unknown ${ this.constructor.name }`)\n    }\n\n    this.name = 'BaseException'\n  }\n\n  /**\n   * @return {string}\n   */\n  toString () {\n    return `${ this.name }: ${ this.message }.\\nStack:\\n${ this.stack }`\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Empty molecules are not allowed\n */\nexport default class AtomsMissingException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'The molecule does not contain atoms', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'AtomsMissingException'\n  }\n}\n","export default class HashAtom {\n  /**\n   *\n   * @param {Atom} atom\n   */\n  static create (atom) {\n    const parameters = {}\n\n    for (const key of Object.keys(atom)) {\n      if (Object.prototype.hasOwnProperty.call(atom, key)) {\n        parameters[key] = atom[key]\n      }\n    }\n\n    return new this(parameters)\n  }\n\n  /**\n   *\n   * @param {Object|Array} object\n   * @returns {Object|Array[]}\n   */\n  static structure (object) {\n    switch (Object.prototype.toString.call(object)) {\n      case '[object Array]': {\n        const result = []\n        for (const key in object) {\n          result.push(HashAtom.isStructure(object[key]) ? HashAtom.structure(object[key]) : object[key])\n        }\n\n        return result\n      }\n\n      case '[object Object]': {\n        const result = []\n        const keys = Object.keys(object).sort((first, second) => {\n          if (first === second) {\n            return 0\n          }\n          return (first < second) ? -1 : 1\n        })\n\n        for (const key of keys) {\n          if (Object.prototype.hasOwnProperty.call(object, key)) {\n            const item = {}\n            item[key] = HashAtom.isStructure(object[key]) ? HashAtom.structure(object[key]) : object[key]\n            result.push(item)\n          }\n        }\n\n        if (result.length > 0) {\n          return result\n        }\n\n        break\n      }\n    }\n\n    return object\n  }\n\n  /**\n   *\n   * @param {*} structure\n   * @returns {boolean}\n   */\n  static isStructure (structure) {\n    return ['[object Object]', '[object Array]'].includes(Object.prototype.toString.call(structure))\n  }\n\n  /**\n   *\n   * @returns {Object[]}\n   */\n  view () {\n    return HashAtom.structure(this)\n  }\n}\n","import HashAtom from './HashAtom.js'\n\nexport default class Version4 extends HashAtom {\n  constructor ({\n    position = null,\n    walletAddress = null,\n    isotope = null,\n    token = null,\n    value = null,\n    batchId = null,\n    metaType = null,\n    metaId = null,\n    meta = null,\n    index = null,\n    createdAt = null,\n    version = null\n  }) {\n    super()\n    this.position = position\n    this.walletAddress = walletAddress\n    this.isotope = isotope\n    this.token = token\n    this.value = value\n    this.batchId = batchId\n\n    this.metaType = metaType\n    this.metaId = metaId\n    this.meta = meta\n\n    this.index = index\n    this.createdAt = createdAt\n    this.version = version\n  }\n}\n","import Version4 from './Version4.js'\n\nexport default {\n  4: Version4\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport JsSHA from 'jssha'\nimport { charsetBaseConvert } from './libraries/strings.js'\nimport Meta from './Meta.js'\nimport AtomMeta from './AtomMeta.js'\nimport AtomsMissingException from './exception/AtomsMissingException.js'\nimport versions from './versions/index.js'\n\n/**\n * Atom class used to form microtransactions within a Molecule\n */\nexport default class Atom {\n  /**\n   * Class constructor\n   *\n   * @param {string|null} position\n   * @param {string|null} walletAddress\n   * @param {string|null} isotope\n   * @param {string|null} token\n   * @param {string|number|null} value\n   * @param {string|null} batchId\n   * @param {string|null} metaType\n   * @param {string|null} metaId\n   * @param {array|object|null} meta\n   * @param {string|null} otsFragment\n   * @param {number|null} index\n   * @param {string|null} version\n   */\n  constructor ({\n    position = null,\n    walletAddress = null,\n    isotope = null,\n    token = null,\n    value = null,\n    batchId = null,\n    metaType = null,\n    metaId = null,\n    meta = null,\n    otsFragment = null,\n    index = null,\n    version = null\n  }) {\n    this.position = position\n    this.walletAddress = walletAddress\n    this.isotope = isotope\n    this.token = token\n    this.value = value !== null ? String(value) : null\n    this.batchId = batchId\n\n    this.metaType = metaType\n    this.metaId = metaId\n    this.meta = meta ? Meta.normalizeMeta(meta) : []\n\n    this.index = index\n    this.otsFragment = otsFragment\n    this.createdAt = String(+new Date())\n    if (version !== null && Object.prototype.hasOwnProperty.call(versions, version)) {\n      this.version = String(version)\n    }\n  }\n\n  /**\n   *\n   * @returns {string[]}\n   */\n  static getHashableProps () {\n    return [\n      'position',\n      'walletAddress',\n      'isotope',\n      'token',\n      'value',\n      'batchId',\n      'metaType',\n      'metaId',\n      'meta',\n      'createdAt'\n    ]\n  }\n\n  /**\n   *\n   * @returns {string[]}\n   */\n  static getUnclaimedProps () {\n    return [\n      'otsFragment'\n    ]\n  }\n\n  /**\n   *\n   * @param {string} isotope\n   * @param {Wallet|null} wallet\n   * @param {int|null} value\n   * @param {string|null} metaType\n   * @param {string|null} metaId\n   * @param {AtomMeta|array|object|null} meta\n   * @param {string|null} batchId\n   * @returns {Atom}\n   */\n  static create ({\n    isotope,\n    wallet = null,\n    value = null,\n    metaType = null,\n    metaId = null,\n    meta = null,\n    batchId = null\n  }) {\n    // If meta object is not passed - create it\n    if (!meta) {\n      meta = new AtomMeta()\n    }\n\n    // If meta object is not an instance of AtomMeta - create it from meta\n    if (!(meta instanceof AtomMeta)) {\n      meta = new AtomMeta(meta)\n    }\n\n    // If wallet has been passed => add related metas\n    if (wallet) {\n      // Add wallet's meta\n      meta.setAtomWallet(wallet)\n\n      // If batch ID does not passed: set it from the wallet\n      if (!batchId) {\n        batchId = wallet.batchId\n      }\n    }\n\n    // Create the final atom's object\n    // walletAddress is null for atoms without a pre-existing wallet (e.g., recipient V-atoms).\n    // toJSON() serializes null as '' for GraphQL compatibility; hash computation treats both identically.\n    return new Atom({\n      position: wallet ? wallet.position : null,\n      walletAddress: wallet ? wallet.address : null,\n      isotope,\n      token: wallet ? wallet.token : null,\n      value,\n      batchId,\n      metaType,\n      metaId,\n      meta: meta.get()\n    })\n  }\n\n  /**\n   * Converts a compliant JSON string into an Atom class instance\n   *\n   * @param {string} json\n   * @return {object}\n   */\n  static jsonToObject (json) {\n    const target = Object.assign(new Atom({}), JSON.parse(json))\n    const properties = Object.keys(new Atom({}))\n\n    for (const property in target) {\n      if (Object.prototype.hasOwnProperty.call(target, property) && !properties.includes(property)) {\n        delete target[property]\n      }\n    }\n\n    return target\n  }\n\n  /**\n   * Returns JSON-ready object for cross-SDK compatibility (2025 JS best practices)\n   *\n   * Provides clean serialization of atomic operations with optional OTS fragments.\n   * Follows 2025 JavaScript best practices with proper type safety and validation.\n   *\n   * @param {Object} options - Serialization options\n   * @param {boolean} options.includeOtsFragments - Include OTS signature fragments (default: true)\n   * @param {boolean} options.validateFields - Validate required fields (default: false)\n   * @return {Object} JSON-serializable object\n   * @throws {Error} If atom is in invalid state for serialization\n   */\n  toJSON (options = {}) {\n    const {\n      includeOtsFragments = true,\n      validateFields = false\n    } = options\n\n    try {\n      // Validate required fields if requested\n      if (validateFields) {\n        const requiredFields = ['position', 'walletAddress', 'isotope', 'token']\n        for (const field of requiredFields) {\n          if (!this[field]) {\n            throw new Error(`Required field '${field}' is missing or empty`)\n          }\n        }\n      }\n\n      // Core atom properties (always included)\n      // Coerce null position/walletAddress/token to empty string for GraphQL compatibility.\n      // The molecular hash computation (getHashableValues) already treats null as '' (line 448),\n      // so this coercion does NOT change the hash. Required because the Rust validator's\n      // GraphQL schema uses String! (non-null) with #[graphql(default)] for these fields,\n      // which accepts omitted values but rejects explicit null.\n      const serialized = {\n        position: this.position ?? '',\n        walletAddress: this.walletAddress ?? '',\n        isotope: this.isotope,\n        token: this.token ?? '',\n        value: this.value,\n        batchId: this.batchId,\n        metaType: this.metaType,\n        metaId: this.metaId,\n        meta: this.meta || [],\n        index: this.index,\n        createdAt: this.createdAt,\n        version: this.version\n      }\n\n      // Optional OTS fragments (can be large, so optional)\n      if (includeOtsFragments && this.otsFragment) {\n        serialized.otsFragment = this.otsFragment\n      }\n\n      return serialized\n    } catch (error) {\n      throw new Error(`Atom serialization failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Creates an Atom instance from JSON data (2025 JS best practices)\n   *\n   * Handles cross-SDK atom deserialization with robust error handling.\n   * Essential for reconstructing atoms from other SDK implementations.\n   *\n   * @param {string|Object} json - JSON string or object to deserialize\n   * @param {Object} options - Deserialization options\n   * @param {boolean} options.validateStructure - Validate required fields (default: true)\n   * @param {boolean} options.strictMode - Strict validation mode (default: false)\n   * @return {Atom} Reconstructed atom instance\n   * @throws {Error} If JSON is invalid or required fields are missing\n   */\n  static fromJSON (json, options = {}) {\n    const {\n      validateStructure = true,\n      strictMode = false\n    } = options\n\n    try {\n      // Parse JSON safely\n      const data = typeof json === 'string' ? JSON.parse(json) : json\n\n      // Validate required fields in strict mode\n      if (strictMode || validateStructure) {\n        const requiredFields = ['position', 'walletAddress', 'isotope', 'token']\n        for (const field of requiredFields) {\n          if (!data[field]) {\n            throw new Error(`Required field '${field}' is missing or empty`)\n          }\n        }\n      }\n\n      // Create atom instance with required fields\n      const atom = new Atom({\n        position: data.position,\n        walletAddress: data.walletAddress,\n        isotope: data.isotope,\n        token: data.token,\n        value: data.value,\n        batchId: data.batchId,\n        metaType: data.metaType,\n        metaId: data.metaId,\n        meta: data.meta,\n        index: data.index,\n        version: data.version\n      })\n\n      // Set additional properties that may not be in constructor\n      if (data.otsFragment) {\n        atom.otsFragment = data.otsFragment\n      }\n      if (data.createdAt) {\n        atom.createdAt = data.createdAt\n      }\n\n      return atom\n    } catch (error) {\n      throw new Error(`Atom deserialization failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Produces a hash of the atoms inside a molecule.\n   * Used to generate the molecularHash field for Molecules.\n   *\n   * @param {array} atoms\n   * @param {string} output\n   * @return {number[]|*}\n   */\n  static hashAtoms ({\n    atoms,\n    output = 'base17'\n  }) {\n    const molecularSponge = new JsSHA('SHAKE256', 'TEXT')\n    const atomList = Atom.sortAtoms(atoms)\n\n    if (atomList.length === 0) {\n      throw new AtomsMissingException()\n    }\n\n    atomList.map(atom => {\n      if (!(atom instanceof Atom)) {\n        throw new AtomsMissingException()\n      }\n      return atom\n    })\n\n    // Hashing each atom in the molecule to produce a molecular hash\n    if (atomList.every(atom => atom.version && Object.prototype.hasOwnProperty.call(versions, atom.version))) {\n      molecularSponge.update(JSON.stringify(atomList.map(atom => versions[atom.version].create(atom).view())))\n    } else {\n      const numberOfAtoms = String(atoms.length)\n      let hashableValues = []\n\n      for (const atom of atomList) {\n        // Add number of atoms (???)\n        hashableValues.push(numberOfAtoms)\n\n        // Add atom's properties\n        hashableValues = hashableValues.concat(atom.getHashableValues())\n      }\n\n      // Add hash values to the sponge\n      for (const hashableValue of hashableValues) {\n        molecularSponge.update(hashableValue)\n      }\n    }\n\n    // Return the hash in the requested format\n    switch (output) {\n      case 'hex': {\n        return molecularSponge.getHash('HEX', { outputLen: 256 })\n      }\n      case 'array': {\n        return molecularSponge.getHash('ARRAYBUFFER', { outputLen: 256 })\n      }\n      default: {\n        return charsetBaseConvert(molecularSponge.getHash('HEX', { outputLen: 256 }), 16, 17, '0123456789abcdef', '0123456789abcdefg').padStart(64, '0')\n      }\n    }\n  }\n\n  static jsonSerialization (key, value) {\n    if (!Atom.getUnclaimedProps().includes(key)) {\n      return value\n    }\n\n    return undefined\n  }\n\n  /**\n   * Sort the atoms in a Molecule\n   *\n   * @param {array} atoms\n   * @return {array}\n   */\n  static sortAtoms (atoms) {\n    const atomList = [...atoms]\n\n    // Sort based on atomic index\n    atomList.sort((first, second) => {\n      return first.index < second.index ? -1 : 1\n    })\n\n    return atomList\n  }\n\n  /**\n   * Get aggregated meta from stored normalized ones\n   */\n  aggregatedMeta () {\n    return Meta.aggregateMeta(this.meta)\n  }\n\n  /**\n   *\n   * @returns {*[]}\n   */\n  getHashableValues () {\n    const hashableValues = []\n    for (const property of Atom.getHashableProps()) {\n      const value = this[property]\n\n      // All nullable values are not hashed (only custom keys)\n      if (value === null && !['position', 'walletAddress'].includes(property)) {\n        continue\n      }\n\n      // Hashing individual meta keys and values\n      if (property === 'meta') {\n        for (const meta of value) {\n          if (typeof meta.value !== 'undefined' && meta.value !== null) {\n            hashableValues.push(String(meta.key))\n            hashableValues.push(String(meta.value))\n          }\n        }\n      } else {\n        // Default value\n        hashableValues.push(value === null ? '' : String(value))\n      }\n    }\n    return hashableValues\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n */\nimport { randomString } from './strings.js'\nimport JsSHA from 'jssha'\n\n/**\n * Generates a secret based on an optional seed\n *\n * @param seed\n * @param length\n * @return {string|*}\n */\nexport function generateSecret (seed = null, length = 2048) {\n  // console.info(`Crypto::generateSecret() - Computing new secret${ seed ? ' from existing seed' : '' }...`)\n  if (seed) {\n    const sponge = new JsSHA('SHAKE256', 'TEXT')\n    sponge.update(seed)\n    // outputLen is in BITS. For `length` hex chars = length/2 bytes = length*4 bits.\n    // (length=2048 → 8192 bits → 1024 bytes → 2048 hex chars, matching all SDKs.)\n    return sponge.getHash('HEX', { outputLen: length * 4 })\n  } else {\n    return randomString(length)\n  }\n}\n\n/**\n * Hashes the user secret to produce a bundle hash\n *\n * @param {string} secret\n * @param {string|null} source\n * @return {string}\n */\nexport function generateBundleHash (secret, source = null) {\n  const sponge = new JsSHA('SHAKE256', 'TEXT')\n  sponge.update(secret)\n  return sponge.getHash('HEX', { outputLen: 64 * 4 }) // 64 bytes = 512 bits\n}\n\n/**\n * SHAKE256 hash function\n *\n * @param {string} input - The input string to hash\n * @param {number} outputLength - The desired output length in bits\n * @return {string} The hex-encoded hash\n */\nexport function shake256 (input, outputLength) {\n  const sponge = new JsSHA('SHAKE256', 'TEXT')\n  sponge.update(input)\n  return sponge.getHash('HEX', { outputLen: outputLength })\n}\n\n/**\n * Returns a new batch ID for stackable tokens\n *\n * @param {string|null} molecularHash\n * @param {number|null} index\n *\n * @return {string}\n */\nexport function generateBatchId ({\n  molecularHash = null,\n  index = null\n}) {\n  if (molecularHash !== null && index !== null) {\n    return generateBundleHash(String(molecularHash) + String(index), 'generateBatchId')\n  }\n\n  return randomString(64)\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\n/**\n * AuthToken class\n */\nexport default class TokenUnit {\n  /**\n   *\n   * @param id\n   * @param name\n   * @param metas\n   */\n  constructor (id, name, metas) {\n    this.id = id\n    this.name = name\n    this.metas = metas || {}\n  }\n\n  /**\n   *\n   * @param data\n   * @returns {*}\n   */\n  static createFromGraphQL (data) {\n    let metas = data.metas || {}\n    if (metas.length) {\n      metas = JSON.parse(metas)\n      if (!metas) { // set an empty object instead of an array\n        metas = {}\n      }\n    }\n    return new TokenUnit(\n      data.id,\n      data.name,\n      metas\n    )\n  }\n\n  /**\n   *\n   * @param data\n   * @returns {TokenUnit}\n   */\n  static createFromDB (data) {\n    return new TokenUnit(\n      data[0],\n      data[1],\n      data.length > 2 ? data[2] : {}\n    )\n  }\n\n  /**\n   *\n   * @returns {*|null}\n   */\n  getFragmentZone () {\n    return this.metas.fragmentZone || null\n  }\n\n  /**\n   *\n   * @returns {*|null}\n   */\n  getFusedTokenUnits () {\n    return this.metas.fusedTokenUnits || null\n  }\n\n  /**\n   * @return array\n   */\n  toData () {\n    return [this.id, this.name, this.metas]\n  }\n\n  /**\n   *\n   * @returns {{metas: string, name: *, id: *}}\n   */\n  toGraphQLResponse () {\n    return {\n      id: this.id,\n      name: this.name,\n      metas: JSON.stringify(this.metas)\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\n/**\n * Optional kcore backend (KnishIO-Crypto-Core through @wishknish/knishio-kcore) for the WOTS+\n * hot paths and ML-KEM.\n *\n * The package is an optionalDependency of this SDK, so npm installs it where it can and the SDK\n * still works where it cannot (or in browsers). Every function returns `null` when kcore is off,\n * missing, or the input is not one it is guaranteed to treat exactly like the pure-JS path, and\n * the caller then runs its existing code.\n *\n * Environment, read on first use:\n *   KNISHIO_KCORE         auto (default) | off | require. `require` turns a failed load into a\n *                         KcoreUnavailable thrown from every call.\n *   KNISHIO_KCORE_MODULE  module specifier or absolute directory to load instead of\n *                         '@wishknish/knishio-kcore'.\n *\n * Loading needs `process.getBuiltinModule` (Node >= 20.16 or 22.3); without it, as in browsers,\n * kcore is simply unavailable.\n */\n\nconst ABI_VERSION = 1\nconst DEFAULT_SPECIFIER = '@wishknish/knishio-kcore'\nconst HEX = /^[0-9a-f]+$/\nconst MLKEM_SIZES = {\n  1024: { pk: 1568, sk: 3168, ct: 1568 },\n  768: { pk: 1184, sk: 2400, ct: 1088 }\n}\nconst SEED_BYTES = 64\nconst COINS_BYTES = 32\n\nexport class KcoreUnavailable extends Error {\n  constructor (message) {\n    super(message)\n    this.name = 'KcoreUnavailable'\n  }\n}\n\n// Load result: state is null (not attempted), 'off', 'ok' or 'failed'.\nlet state = null\nlet lib = null\nlet reason = null\nlet mode = 'auto'\n\nfunction readMode () {\n  const value = String(globalThis.process?.env?.KNISHIO_KCORE ?? 'auto').toLowerCase()\n  if (value !== 'auto' && value !== 'off' && value !== 'require') {\n    throw new Error(`KNISHIO_KCORE must be auto, off or require, got '${value}'`)\n  }\n  return value\n}\n\nfunction load () {\n  const gbm = globalThis.process?.getBuiltinModule\n  if (typeof gbm !== 'function') {\n    return 'process.getBuiltinModule unavailable (Node >= 20.16 or 22.3 required)'\n  }\n  const specifier = globalThis.process?.env?.KNISHIO_KCORE_MODULE || DEFAULT_SPECIFIER\n  try {\n    // The vite CJS/IIFE bundles replace `import.meta` with `{}`; CJS has `__filename` instead.\n    const base = typeof __filename === 'string' ? __filename : import.meta.url\n    const candidate = gbm('node:module').createRequire(base)(specifier)\n    const abi = candidate.abiVersion()\n    if (abi !== ABI_VERSION) {\n      return `ABI version ${abi}, expected ${ABI_VERSION} (${specifier})`\n    }\n    lib = candidate\n    return null\n  } catch (e) {\n    return `${e && e.message ? e.message : e} (${specifier})`\n  }\n}\n\n/**\n * True when kcore is loaded. In `require` mode a failed load throws on every call.\n */\nfunction ensure () {\n  if (state === null) {\n    mode = readMode()\n    if (mode === 'off') {\n      state = 'off'\n    } else {\n      reason = load()\n      state = reason === null ? 'ok' : 'failed'\n    }\n  }\n  if (state === 'failed' && mode === 'require') {\n    throw new KcoreUnavailable(`kcore unavailable: ${reason}`)\n  }\n  return state === 'ok'\n}\n\n/**\n * Forget the load result so the next call re-reads the environment (tests only).\n */\nexport function _reset () {\n  state = null\n  lib = null\n  reason = null\n  mode = 'auto'\n}\n\n/**\n * @return {boolean}\n */\nexport function available () {\n  return ensure()\n}\n\n/**\n * @return {'napi'|'wasm'|null}\n */\nexport function backend () {\n  return ensure() ? lib.backend : null\n}\n\nfunction isHex (value, length) {\n  return typeof value === 'string' && value.length === length && HEX.test(value)\n}\n\nfunction isBytes (value, length) {\n  return value instanceof Uint8Array && value.length === length\n}\n\n/**\n * WOTS+ address of a 2048-hex private key (`Wallet.generateAddress`).\n *\n * @param {string} key\n * @return {string|null}\n */\nexport function wotsAddress (key) {\n  if (!ensure() || !isHex(key, 2048)) {\n    return null\n  }\n  try {\n    return lib.wotsAddress(key)\n  } catch {\n    return null\n  }\n}\n\n/**\n * Advances `counts.length` WOTS+ chains of 128 lowercase hex characters each.\n * `CheckMolecule.ots()` passes peer-supplied text here, so anything outside lowercase hex and\n * integer counts 0..64 stays on the caller's own loop.\n *\n * @param {string} chunks\n * @param {number[]} counts\n * @return {string|null}\n */\nexport function chainsHex (chunks, counts) {\n  if (!ensure()) {\n    return null\n  }\n  const n = Array.isArray(counts) ? counts.length : 0\n  if (n < 1 || n > 64 || !isHex(chunks, 128 * n)) {\n    return null\n  }\n  if (!counts.every(c => Number.isInteger(c) && c >= 0 && c <= 64)) {\n    return null\n  }\n  try {\n    return lib.chainsHex(chunks, counts)\n  } catch {\n    return null\n  }\n}\n\n/**\n * @param {number} set - 1024 or 768\n * @param {Uint8Array} seed - 64 bytes\n * @return {{publicKey: Uint8Array, secretKey: Uint8Array}|null}\n */\nexport function mlkemKeypair (set, seed) {\n  if (!ensure() || !MLKEM_SIZES[set] || !isBytes(seed, SEED_BYTES)) {\n    return null\n  }\n  try {\n    return lib.mlkemKeypair(set, seed)\n  } catch {\n    return null\n  }\n}\n\n/**\n * Encapsulates against `publicKey` with fresh coins on every call: repeating coins against one\n * key would repeat the ciphertext and the shared secret.\n *\n * @param {number} set - 1024 or 768\n * @param {Uint8Array} publicKey\n * @return {{cipherText: Uint8Array, sharedSecret: Uint8Array}|null}\n */\nexport function mlkemEncaps (set, publicKey) {\n  if (!ensure()) {\n    return null\n  }\n  const sizes = MLKEM_SIZES[set]\n  if (!sizes || !isBytes(publicKey, sizes.pk)) {\n    return null\n  }\n  const coins = globalThis.crypto.getRandomValues(new Uint8Array(COINS_BYTES))\n  try {\n    return lib.mlkemEncaps(set, publicKey, coins)\n  } catch {\n    return null\n  } finally {\n    coins.fill(0)\n  }\n}\n\n/**\n * @param {number} set - 1024 or 768\n * @param {Uint8Array} cipherText\n * @param {Uint8Array} secretKey\n * @return {Uint8Array|null} the 32-byte shared secret\n */\nexport function mlkemDecaps (set, cipherText, secretKey) {\n  if (!ensure()) {\n    return null\n  }\n  const sizes = MLKEM_SIZES[set]\n  if (!sizes || !isBytes(cipherText, sizes.ct) || !isBytes(secretKey, sizes.sk)) {\n    return null\n  }\n  try {\n    return lib.mlkemDecaps(set, cipherText, secretKey)\n  } catch {\n    return null\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when failing to retrieve shadow wallets\n */\nexport default class WalletCredentialException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Attempting to create a wallet with no credentials (secret or bundle hash)', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'WalletCredentialException'\n  }\n}\n","const U32_MASK64 = /* @__PURE__ */ (() => BigInt(2 ** 32 - 1))();\nconst _32n = /* @__PURE__ */ BigInt(32);\n// Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high\n// }` to match little-endian word order rather than the property names.\nfunction fromBig(n, le = false) {\n    if (le)\n        return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n    return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\n// Split bigint list into `[highWords, lowWords]` when `le=false`; with `le=true`, the first array\n// holds the low halves because `fromBig(...)` swaps the semantic meaning of `h` and `l`.\nfunction split(lst, le = false) {\n    const len = lst.length;\n    let Ah = new Uint32Array(len);\n    let Al = new Uint32Array(len);\n    for (let i = 0; i < len; i++) {\n        const { h, l } = fromBig(lst[i], le);\n        [Ah[i], Al[i]] = [h, l];\n    }\n    return [Ah, Al];\n}\n// Combine explicit `(high, low)` 32-bit halves into a bigint; `>>> 0` normalizes signed JS\n// bitwise results back to uint32 first, and little-endian callers must swap.\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// Split a JS number into u32 halves without a BigInt allocation. Exact only for integers\n// `0 <= n < 2**53`; callers use it on byte / bit counters, which JS length math caps far below\n// that (an ArrayBuffer cannot exceed 2**53 - 1 bytes).\nconst fromNumH = (n) => (n / 2 ** 32) | 0;\nconst fromNumL = (n) => n >>> 0;\n// Drop-in replacement for `view.setBigUint64(byteOffset, BigInt(n), isLE)` without the per-call\n// BigInt allocation. Same `n < 2**53` precondition as `fromNumH`/`fromNumL`.\nfunction setU64FromNum(view, byteOffset, n, isLE) {\n    const h = fromNumH(n);\n    const l = fromNumL(n);\n    view.setUint32(byteOffset, isLE ? l : h, isLE);\n    view.setUint32(byteOffset + 4, isLE ? h : l, isLE);\n}\n// High 32-bit half of a 64-bit logical right shift for `s` in `0..31`.\nconst shrSH = (h, _l, s) => h >>> s;\n// Low 32-bit half of a 64-bit logical right shift, valid for `s` in `1..31`.\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half.\nconst rotr32H = (_h, l) => l;\n// Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half.\nconst rotr32L = (h, _l) => h;\n// 64-bit left rotates (rotl*) are not defined here: sha3.ts, their only consumer, keeps\n// local copies so V8 inlines them into keccakP.\n// Add two split 64-bit words and return the split `{ h, l }` sum.\n// JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out\n// of the low sum and instead use division.\nfunction add(Ah, Al, Bh, Bl) {\n    const l = (Al >>> 0) + (Bl >>> 0);\n    return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\n// Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`.\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\n// High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`.\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 4-way addition; pass the raw result into `add4H(...)`.\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\n// High-word finalize step for 4-way addition; `low` must be the untruncated output of `add4L(...)`.\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 5-way addition; pass the raw result into `add5H(...)`.\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\n// High-word finalize step for 5-way addition; `low` must be the untruncated output of `add5L(...)`.\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, fromNumH, fromNumL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, setU64FromNum, shrSH, shrSL, split, toBig };\n","/**\n * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true.\n * @param a - value to test\n * @returns `true` when the value is a Uint8Array-compatible view.\n * @example\n * Check whether a value is a Uint8Array-compatible view.\n * ```ts\n * isBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function isBytes(a) {\n    // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases.\n    // The fallback still requires a real ArrayBuffer view, so plain\n    // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and\n    // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views.\n    return (a instanceof Uint8Array ||\n        (ArrayBuffer.isView(a) &&\n            a.constructor.name === 'Uint8Array' &&\n            'BYTES_PER_ELEMENT' in a &&\n            a.BYTES_PER_ELEMENT === 1));\n}\n// Shared error-message prefix builder. Only called on throw paths, so assert\n// success paths never pay for the string concatenation.\nconst atitle = (title) => (title ? `\"${title}\" ` : '');\n/**\n * Asserts something is a non-negative integer.\n * @param n - number to validate\n * @param title - label included in thrown errors\n * @returns The validated number.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a non-negative integer option.\n * ```ts\n * anumber(32, 'length');\n * ```\n */\nexport function anumber(n, title = '') {\n    if (typeof n !== 'number')\n        throw new TypeError(atitle(title) + 'expected number, got ' + typeof n);\n    if (!Number.isSafeInteger(n) || n < 0)\n        throw new RangeError(atitle(title) + 'expected integer >= 0, got ' + n);\n    return n;\n}\n/**\n * Asserts something is a boolean.\n * @param value - value to validate\n * @param title - label included in thrown errors\n * @returns The validated boolean.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a boolean option.\n * ```ts\n * abool(true, 'enableXOF');\n * ```\n */\nexport function abool(value, title = '') {\n    if (typeof value !== 'boolean')\n        throw new TypeError(atitle(title) + 'expected boolean, got type=' + typeof value);\n    return value;\n}\n/**\n * Asserts something is Uint8Array.\n * @param value - value to validate\n * @param length - optional exact length constraint\n * @param title - label included in thrown errors\n * @returns The validated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate that a value is a byte array.\n * ```ts\n * abytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function abytes(value, length, title = '') {\n    // Success path first: this runs at the start of every update() / digestInto(), and the\n    // common `abytes(data)` form must not pay for length handling it does not use.\n    if (isBytes(value) && (length === undefined || value.length === length))\n        return value;\n    // Error path: recompute freely to build the exact message.\n    if (length !== undefined)\n        anumber(length, 'length');\n    const bytes = isBytes(value);\n    const ofLen = length !== undefined ? ` of length ${length}` : '';\n    const got = bytes ? `length=${value.length}` : `type=${typeof value}`;\n    const message = atitle(title) + 'expected Uint8Array' + ofLen + ', got ' + got;\n    if (!bytes)\n        throw new TypeError(message);\n    throw new RangeError(message);\n}\n/**\n * Copies bytes into a fresh Uint8Array.\n * Buffer-style slices can alias the same backing store, so callers that need ownership should copy.\n * @param bytes - source bytes to clone\n * @returns Freshly allocated copy of `bytes`.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Clone a byte array before mutating it.\n * ```ts\n * const copy = copyBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function copyBytes(bytes) {\n    // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict\n    // because callers use it at byte-validation boundaries before mutating the detached copy.\n    return Uint8Array.from(abytes(bytes));\n}\n/**\n * Asserts something is a wrapped hash constructor.\n * @param h - hash constructor to validate\n * @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError}\n * @throws On invalid hash metadata ranges or values. {@link RangeError}\n * @throws If the hash metadata allows empty outputs or block sizes. {@link Error}\n * @example\n * Validate a callable hash wrapper.\n * ```ts\n * import { ahash } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * ahash(sha256);\n * ```\n */\nexport function ahash(h) {\n    if (typeof h !== 'function' || typeof h.create !== 'function')\n        throw new TypeError('expected hash wrapped by utils.createHasher');\n    anumber(h.outputLen);\n    anumber(h.blockLen);\n    // HMAC and KDF callers treat these as real byte lengths; allowing zero lets fake wrappers pass\n    // validation and can produce empty outputs instead of failing fast.\n    if (h.outputLen < 1 || h.blockLen < 1)\n        throw new Error('hash blockLen / outputLen must be >= 1');\n}\nconst aobject = (value, label) => {\n    if (value === null || typeof value !== 'object' || Array.isArray(value))\n        throw new TypeError((label === 'object' ? '' : `\"${label}\" `) + 'expected object, got type=' + typeof value);\n};\nconst aopts = (value, label) => {\n    aobject(value, label);\n    const proto = Object.getPrototypeOf(value);\n    if (proto !== Object.prototype && proto !== null)\n        throw new TypeError(`\"${label}\" expected plain object`);\n    // Object.assign() treats an own \"__proto__\" source key as a write to the target's legacy\n    // prototype setter. Reject it before merging so inherited option values cannot be injected.\n    if (Object.hasOwn(value, '__proto__'))\n        throw new TypeError(`\"${label}.__proto__\" is not allowed`);\n};\n/**\n * Asserts a hash instance has not been destroyed or finished.\n * @param instance - hash instance to validate\n * @param checkFinished - whether to reject finalized instances\n * @throws If the hash instance has already been destroyed or finalized. {@link Error}\n * @example\n * Validate that a hash instance is still usable.\n * ```ts\n * import { aexists } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aexists(hash);\n * ```\n */\nexport function aexists(instance, checkFinished = true) {\n    // Runs on every update()/digestInto(); the flags are library-owned booleans, so only their\n    // truthiness is checked - re-validating their type per call was pure hot-path overhead.\n    if (instance.destroyed)\n        throw new Error('hash was destroyed');\n    if (checkFinished && instance.finished)\n        throw new Error('digest() was already called');\n}\n/**\n * Asserts output is a sufficiently-sized byte array.\n * @param out - destination buffer\n * @param instance - hash instance providing output length\n * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a caller-provided digest buffer.\n * ```ts\n * import { aoutput } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aoutput(new Uint8Array(hash.outputLen), hash);\n * ```\n */\nexport function aoutput(out, instance) {\n    abytes(out, undefined, 'output');\n    // `outputLen` is a library-owned readonly number; the negated comparison keeps failing fast\n    // when it is missing/NaN (comparisons with undefined/NaN are false) without an anumber() call.\n    const min = instance.outputLen;\n    if (!(out.length >= min)) {\n        throw new RangeError('\"output\" expected length >= ' + min);\n    }\n}\n/**\n * Casts a typed array view to Uint8Array.\n * @param arr - source typed array\n * @returns Uint8Array view over the same buffer.\n * @example\n * Reinterpret a typed array as bytes.\n * ```ts\n * u8(new Uint32Array([1, 2]));\n * ```\n */\nexport function u8(arr) {\n    return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Casts a typed array view to Uint32Array.\n * `arr.byteOffset` must already be 4-byte aligned or the platform\n * Uint32Array constructor will throw.\n * @param arr - source typed array\n * @returns Uint32Array view over the same buffer.\n * @example\n * Reinterpret a byte array as 32-bit words.\n * ```ts\n * u32(new Uint8Array(8));\n * ```\n */\nexport function u32(arr) {\n    return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/**\n * Zeroizes typed arrays in place. Warning: JS provides no guarantees.\n * @param arrays - arrays to overwrite with zeros\n * @example\n * Zeroize sensitive buffers in place.\n * ```ts\n * clean(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function clean(...arrays) {\n    for (let i = 0; i < arrays.length; i++) {\n        arrays[i].fill(0);\n    }\n}\n/**\n * Creates a DataView for byte-level manipulation.\n * @param arr - source typed array\n * @returns DataView over the same buffer region.\n * @example\n * Create a DataView over an existing buffer.\n * ```ts\n * createView(new Uint8Array(4));\n * ```\n */\nexport function createView(arr) {\n    return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Rotate-right operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the right.\n * ```ts\n * rotr(0x12345678, 8);\n * ```\n */\nexport function rotr(word, shift) {\n    return (word << (32 - shift)) | (word >>> shift);\n}\n/**\n * Rotate-left operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the left.\n * ```ts\n * rotl(0x12345678, 8);\n * ```\n */\nexport function rotl(word, shift) {\n    return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n/** Whether the current platform is little-endian. */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n/**\n * Byte-swap operation for uint32 values.\n * @param word - source word\n * @returns Word with reversed byte order.\n * @example\n * Reverse the byte order of a 32-bit word.\n * ```ts\n * byteSwap(0x11223344);\n * ```\n */\nexport function byteSwap(word) {\n    return (((word << 24) & 0xff000000) |\n        ((word << 8) & 0xff0000) |\n        ((word >>> 8) & 0xff00) |\n        ((word >>> 24) & 0xff));\n}\n/**\n * Conditionally byte-swaps one 32-bit word on big-endian platforms.\n * @param n - source word\n * @returns Original or byte-swapped word depending on platform endianness.\n * @example\n * Normalize a 32-bit word for host endianness.\n * ```ts\n * swap8IfBE(0x11223344);\n * ```\n */\nexport const swap8IfBE = isLE\n    ? (n) => n\n    : (n) => byteSwap(n) >>> 0;\n/**\n * Byte-swaps every word of a Uint32Array in place.\n * @param arr - array to mutate\n * @returns The same array after mutation; callers pass live state arrays here.\n * @example\n * Reverse the byte order of every word in place.\n * ```ts\n * byteSwap32(new Uint32Array([0x11223344]));\n * ```\n */\nexport function byteSwap32(arr) {\n    for (let i = 0; i < arr.length; i++) {\n        arr[i] = byteSwap(arr[i]);\n    }\n    return arr;\n}\n/**\n * Conditionally byte-swaps a Uint32Array on big-endian platforms.\n * @param u - array to normalize for host endianness\n * @returns Original or byte-swapped array depending on platform endianness.\n *   On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`.\n * @example\n * Normalize a word array for host endianness.\n * ```ts\n * swap32IfBE(new Uint32Array([0x11223344]));\n * ```\n */\nexport const swap32IfBE = isLE\n    ? (u) => u\n    : byteSwap32;\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string.\n * Uses the built-in function when available and assumes it matches the tested\n * fallback semantics.\n * @param bytes - bytes to encode\n * @returns Lowercase hexadecimal string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Convert bytes to lowercase hexadecimal.\n * ```ts\n * bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123'\n * ```\n */\nexport function bytesToHex(bytes) {\n    abytes(bytes);\n    // @ts-ignore\n    if (hasHexBuiltin)\n        return bytes.toHex();\n    // pre-caching improves the speed 6x\n    let hex = '';\n    for (let i = 0; i < bytes.length; i++) {\n        hex += hexes[bytes[i]];\n    }\n    return hex;\n}\n// Strict ASCII nibble parser: non-ASCII hex lookalikes are rejected as undefined.\n// ASCII codes: '0'..'9' = 48..57, 'A'..'F' = 65..70, 'a'..'f' = 97..102.\n// prettier-ignore\nfunction asciiToBase16(ch) {\n    return ch >= 48 && ch <= 57 ? ch - 48 // '2' => 50-48\n        : ch >= 65 && ch <= 70 ? ch - (65 - 10) // 'B' => 66-(65-10)\n            : ch >= 97 && ch <= 102 ? ch - (97 - 10) // 'b' => 98-(97-10)\n                : undefined;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @param hex - hexadecimal string to decode\n * @returns Decoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Decode lowercase hexadecimal into bytes.\n * ```ts\n * hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n * ```\n */\nexport function hexToBytes(hex) {\n    if (typeof hex !== 'string')\n        throw new TypeError('hex string expected, got ' + typeof hex);\n    if (hasHexBuiltin) {\n        try {\n            return Uint8Array.fromHex(hex);\n        }\n        catch (error) {\n            if (error instanceof SyntaxError)\n                throw new RangeError(error.message);\n            throw error;\n        }\n    }\n    const hl = hex.length;\n    const al = hl / 2;\n    if (hl % 2)\n        throw new RangeError('hex string expected, got unpadded hex of length ' + hl);\n    const array = new Uint8Array(al);\n    for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n        const n1 = asciiToBase16(hex.charCodeAt(hi)); // parse first char, multiply it by 16\n        const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); // parse second char\n        if (n1 === undefined || n2 === undefined) {\n            const char = hex[hi] + hex[hi + 1];\n            throw new RangeError('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n        }\n        array[ai] = n1 * 16 + n2; // example: 'A9' => 10*16 + 9\n    }\n    return array;\n}\n/**\n * Yields to the host task scheduler so timers, I/O, and rendering can make progress.\n * Uses the Web Scheduling API when available or `setTimeout` as a cross-platform fallback.\n * Host-task yields are much slower than microtasks (roughly 1ms with the timer fallback), so\n * async loops should use `asyncTick >= 10` to amortize scheduling overhead to about 10% while\n * still allowing other event-loop work to proceed.\n * @param onReject - optional cleanup invoked only if the host yield fails\n * @example\n * Yield to the next scheduler tick.\n * ```ts\n * await nextTick();\n * ```\n */\nexport function nextTick(onReject) {\n    const host = globalThis;\n    if (typeof host.scheduler?.yield === 'function') {\n        const promise = host.scheduler.yield();\n        // Keep the original scheduler rejection; this handler exists only for cleanup.\n        if (onReject)\n            promise.catch(onReject);\n        return promise;\n    }\n    return new Promise((resolve) => host.setTimeout(resolve, 0));\n}\n/**\n * Returns control to the host event loop every `tick` milliseconds to avoid blocking long loops.\n * @param iters - number of loop iterations to run\n * @param tick - maximum time slice in milliseconds\n * @param cb - callback executed on each iteration\n * @param onReject - optional cleanup invoked only if a host yield fails\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Run a loop that periodically yields back to the event loop.\n * ```ts\n * await asyncLoop(2, 0, () => {});\n * ```\n */\nexport async function asyncLoop(iters, tick, cb, onReject) {\n    anumber(iters, 'iters');\n    anumber(tick, 'tick');\n    if (typeof cb !== 'function')\n        throw new TypeError('callback must be a function');\n    // Callback is synchronous by contract; asyncLoop only yields between sync work windows.\n    let ts = Date.now();\n    for (let i = 0; i < iters; i++) {\n        cb(i);\n        // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n        const diff = Date.now() - ts;\n        if (diff >= 0 && diff < tick)\n            continue;\n        await nextTick(onReject);\n        // Track only synchronous work time; scheduler delay after yielding is outside our budget.\n        ts = Date.now();\n    }\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * Built-in doesn't validate input to be string: we do the check.\n * Non-ASCII details are delegated to the platform `TextEncoder`.\n * @param str - string to encode\n * @returns UTF-8 encoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Encode a string as UTF-8 bytes.\n * ```ts\n * utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99])\n * ```\n */\nexport function utf8ToBytes(str) {\n    if (typeof str !== 'string')\n        throw new TypeError('string expected');\n    const encoded = new TextEncoder().encode(str);\n    try {\n        // Copy into the current realm for Firefox extension contexts. Callers that own the returned\n        // buffer can then wipe it independently of TextEncoder's temporary result.\n        return new Uint8Array(encoded); // https://bugzil.la/1681809\n    }\n    finally {\n        clean(encoded);\n    }\n}\n/**\n * Helper for KDFs: consumes Uint8Array or string.\n * String inputs are UTF-8 encoded; byte-array inputs stay aliased to the caller buffer.\n * @param data - user-provided KDF input\n * @param errorTitle - label included in thrown errors\n * @returns Byte representation of the input.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Normalize KDF input to bytes.\n * ```ts\n * kdfInputToBytes('password');\n * ```\n */\nexport function kdfInputToBytes(data, errorTitle = '') {\n    if (typeof data === 'string')\n        return utf8ToBytes(data);\n    return abytes(data, undefined, errorTitle);\n}\n/**\n * Copies several Uint8Arrays into one.\n * @param arrays - arrays to concatenate\n * @returns Concatenated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Concatenate multiple byte arrays.\n * ```ts\n * concatBytes(new Uint8Array([1]), new Uint8Array([2]));\n * ```\n */\nexport function concatBytes(...arrays) {\n    let sum = 0;\n    for (let i = 0; i < arrays.length; i++) {\n        const a = arrays[i];\n        abytes(a);\n        sum += a.length;\n    }\n    const res = new Uint8Array(sum);\n    for (let i = 0, pad = 0; i < arrays.length; i++) {\n        const a = arrays[i];\n        res.set(a, pad);\n        pad += a.length;\n    }\n    return res;\n}\n/**\n * Validates declared required and optional field types on a plain object.\n * This walks field schemas and formats detailed errors, so avoid it on hot paths; use direct\n * one-line guards such as `abytes()`, `abool()`, or `anumber()` instead.\n * @param object - object to validate\n * @param fields - map of required field names to expected types\n * @param optFields - map of optional field names to expected types\n * @param title - label included in thrown errors\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate required and optional option fields.\n * ```ts\n * validateObject({ N: 1024, dkLen: 32 }, { N: 'number' }, { dkLen: 'number' });\n * ```\n */\nexport const validateObject = (object, fields = {}, optFields = {}, title = 'object') => {\n    aobject(object, title);\n    aobject(fields, 'fields');\n    aobject(optFields, 'optFields');\n    function checkField(fieldName, expectedType, isOpt) {\n        const label = title === 'object' ? `param \"${String(fieldName)}\"` : `\"${title}.${String(fieldName)}\"`;\n        // Config fields must be explicit own properties. Optional inherited values are rejected too\n        // because callers keep reading the same options object after validation.\n        const val = object[fieldName];\n        // Runtime objects such as Field instances intentionally satisfy required method slots\n        // via their shared prototype.\n        if (!Object.hasOwn(object, fieldName) &&\n            (isOpt ? val !== undefined : expectedType !== 'function')) {\n            throw new TypeError(`${label} is invalid: expected own property`);\n        }\n        if (isOpt && val === undefined)\n            return;\n        const current = typeof val;\n        if (current !== expectedType || val === null)\n            throw new TypeError(`${label} is invalid: expected ${expectedType}, got ${current}`);\n    }\n    const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt));\n    iter(fields, false);\n    iter(optFields, true);\n};\n/**\n * Merges default options and passed options.\n * @param defaults - base option object\n * @param opts - user overrides\n * @param title - label included in thrown override errors\n * @returns Fresh merged option object with a null prototype.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Merge user overrides onto default options.\n * ```ts\n * checkOpts({ dkLen: 32 }, { asyncTick: 10 });\n * ```\n */\nexport function checkOpts(defaults, opts, title = 'opts') {\n    aopts(defaults, 'defaults');\n    if (opts !== undefined)\n        aopts(opts, title);\n    // Callers read optional fields directly, so omitted values must not fall through to ambient\n    // Object.prototype pollution (for example a forged `dkLen` changing SHAKE's default output).\n    const merged = Object.assign(Object.create(null), defaults, opts);\n    return merged;\n}\n/**\n * Creates a callable hash function from a stateful class constructor.\n * @param hashCons - hash constructor or factory\n * @param info - optional metadata such as DER OID\n * @returns Frozen callable hash wrapper with `.create()`.\n *   Wrapper construction eagerly calls `hashCons(undefined)` once to read\n *   `outputLen` / `blockLen`, so constructor side effects happen at module\n *   init time.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Wrap a stateful hash constructor into a callable helper.\n * ```ts\n * import { createHasher } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const wrapped = createHasher(sha256.create, { oid: sha256.oid });\n * wrapped(new Uint8Array([1]));\n * ```\n */\nexport function createHasher(hashCons, info = {}) {\n    if (typeof hashCons !== 'function')\n        throw new TypeError('\"hashCons\" expected function, got type=' + typeof hashCons);\n    info = checkOpts({}, info, 'info');\n    const hashC = (msg, opts) => hashCons(opts)\n        .update(msg)\n        .digest();\n    const tmp = hashCons(undefined);\n    hashC.outputLen = tmp.outputLen;\n    hashC.blockLen = tmp.blockLen;\n    hashC.canXOF = tmp.canXOF;\n    hashC.create = (opts) => hashCons(opts);\n    Object.assign(hashC, info);\n    return Object.freeze(hashC);\n}\n/**\n * Cryptographically secure PRNG backed by `crypto.getRandomValues`.\n * @param bytesLength - number of random bytes to generate\n * @returns Random bytes.\n * The platform `getRandomValues()` implementation still defines any\n * single-call length cap, and this helper rejects oversize requests\n * with a stable library `RangeError` instead of host-specific errors.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If the current runtime does not provide `crypto.getRandomValues`. {@link Error}\n * @example\n * Generate a fresh random key or nonce.\n * ```ts\n * const key = randomBytes(16);\n * ```\n */\nexport function randomBytes(bytesLength = 32) {\n    // Match the repo's other length-taking helpers instead of relying on Uint8Array coercion.\n    anumber(bytesLength, 'bytesLength');\n    const cr = typeof globalThis === 'object' ? globalThis.crypto : null;\n    if (typeof cr?.getRandomValues !== 'function')\n        throw new Error('crypto.getRandomValues must be defined');\n    // Web Cryptography API Level 2 §10.1.1:\n    // if `byteLength > 65536`, throw `QuotaExceededError`.\n    // Keep the guard explicit so callers can see the quota in code\n    // instead of discovering it by reading the spec or host errors.\n    // This wrapper surfaces the same quota as a stable library RangeError.\n    if (bytesLength > 65536)\n        throw new RangeError(`\"bytesLength\" expected <= 65536, got ${bytesLength}`);\n    return cr.getRandomValues(new Uint8Array(bytesLength));\n}\n/**\n * Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`.\n * @param suffix - final OID byte for the selected hash.\n *   The helper accepts any byte even though only the documented NIST hash\n *   suffixes are meaningful downstream.\n * @returns Object containing the DER-encoded OID.\n * @example\n * Build OID metadata for a NIST hash.\n * ```ts\n * oidNist(0x01);\n * ```\n */\nexport const oidNist = (suffix) => ({\n    // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet.\n    // Larger suffix values would need base-128 OID encoding and a different length byte.\n    oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),\n});\n","/**\n * SHA3 (keccak) hash function, based on a new \"Sponge function\" design.\n * Different from older hashes, the internal state is bigger than output size.\n *\n * Check out\n * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf | FIPS-202},\n * {@link https://keccak.team/keccak.html | Website}, and\n * {@link https://crypto.stackexchange.com/q/15727 | the differences between\n * SHA-3 and Keccak}.\n *\n * Check out `sha3-addons` module for cSHAKE, k12, and others.\n * @module\n */\nimport { split } from \"./_u64.js\";\n// prettier-ignore\nimport { abool, abytes, aexists, anumber, aoutput, checkOpts, clean, createHasher, oidNist, swap32IfBE, u32 } from \"./utils.js\";\n// No __PURE__ annotations in sha3 header:\n// EVERYTHING is in fact used on every export.\n// Various per round constants calculations\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst _7n = BigInt(7);\nconst _256n = BigInt(256);\n// FIPS 202 Algorithm 5 rc(): when the outgoing bit is 1, the 8-bit LFSR xors\n// taps 0, 4, 5, and 6, which compresses to the feedback mask `0x71`.\nconst _0x71n = BigInt(0x71);\nconst SHA3_PI = [];\nconst SHA3_ROTL = [];\nconst _SHA3_IOTA = []; // no pure annotation: var is always used\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n    // Pi\n    [x, y] = [y, (2 * x + 3 * y) % 5];\n    SHA3_PI.push(2 * (5 * y + x));\n    // Rotational\n    SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n    // Iota\n    let t = _0n;\n    for (let j = 0; j < 7; j++) {\n        R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n        if (R & _2n)\n            t ^= _1n << ((_1n << BigInt(j)) - _1n);\n    }\n    _SHA3_IOTA.push(t);\n}\nconst IOTAS = split(_SHA3_IOTA, true);\n// `split(..., true)` keeps the local little-endian lane-word layout used by\n// `state32`, so these `H` / `L` tables follow the file's first-word /\n// second-word lane slots rather than `_u64.ts`'s usual high/low naming.\nconst SHA3_IOTA_H = IOTAS[0];\nconst SHA3_IOTA_L = IOTAS[1];\n// 64-bit left rotates as u32 pairs. Inlined here (not imported from _u64) so V8 can\n// inline them into keccakP — the import path costs ~24% on sha3_256. SHA3 is the only\n// consumer of left-rotates; other hashes use right-rotates from _u64.\n// Valid for s in 1..31 (SH/SL) and 33..63 (BH/BL); keccak never rotates by 0/32/64.\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Reused Theta scratch buffer (column parities), same pattern as SHA256_W in sha2.\n// keccakP never calls user code, so the shared buffer cannot be observed mid-permutation.\nconst B = new Uint32Array(5 * 2);\n/**\n * `keccakf1600` internal permutation, additionally allows adjusting the round count.\n * @param s - 5x5 Keccak state encoded as 25 lanes split into 50 uint32 words\n *   in this file's local little-endian lane-word order\n * @param rounds - number of rounds to execute\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If `rounds` is outside the supported `1..24` range. {@link Error}\n * @example\n * Permute a Keccak state with the default 24 rounds.\n * ```ts\n * keccakP(new Uint32Array(50));\n * ```\n */\nexport function keccakP(s, rounds = 24) {\n    if (!(s instanceof Uint32Array))\n        throw new TypeError('\"s\" expected Uint32Array(50), got type=' + typeof s);\n    if (s.length !== 50)\n        throw new RangeError('\"s\" expected Uint32Array(50), got length=' + s.length);\n    anumber(rounds, 'rounds');\n    // This implementation precomputes only the standard Keccak-f[1600] 24-round Iota table.\n    if (rounds < 1 || rounds > 24)\n        throw new Error('\"rounds\" expected integer 1..24');\n    // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n    for (let round = 24 - rounds; round < 24; round++) {\n        // Theta θ\n        for (let x = 0; x < 10; x++)\n            B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n        for (let x = 0; x < 10; x += 2) {\n            const idx1 = (x + 8) % 10;\n            const idx0 = (x + 2) % 10;\n            const B0 = B[idx0];\n            const B1 = B[idx0 + 1];\n            const Th = rotlH(B0, B1, 1) ^ B[idx1];\n            const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n            for (let y = 0; y < 50; y += 10) {\n                s[x + y] ^= Th;\n                s[x + y + 1] ^= Tl;\n            }\n        }\n        // Rho (ρ) and Pi (π)\n        let curH = s[2];\n        let curL = s[3];\n        for (let t = 0; t < 24; t++) {\n            const shift = SHA3_ROTL[t];\n            const Th = rotlH(curH, curL, shift);\n            const Tl = rotlL(curH, curL, shift);\n            const PI = SHA3_PI[t];\n            curH = s[PI];\n            curL = s[PI + 1];\n            s[PI] = Th;\n            s[PI + 1] = Tl;\n        }\n        // Chi (χ)\n        // Same as:\n        // for (let x = 0; x < 10; x++) B[x] = s[y + x];\n        // for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n        for (let y = 0; y < 50; y += 10) {\n            const b0 = s[y], b1 = s[y + 1], b2 = s[y + 2], b3 = s[y + 3];\n            s[y] ^= ~s[y + 2] & s[y + 4];\n            s[y + 1] ^= ~s[y + 3] & s[y + 5];\n            s[y + 2] ^= ~s[y + 4] & s[y + 6];\n            s[y + 3] ^= ~s[y + 5] & s[y + 7];\n            s[y + 4] ^= ~s[y + 6] & s[y + 8];\n            s[y + 5] ^= ~s[y + 7] & s[y + 9];\n            s[y + 6] ^= ~s[y + 8] & b0;\n            s[y + 7] ^= ~s[y + 9] & b1;\n            s[y + 8] ^= ~b0 & b2;\n            s[y + 9] ^= ~b1 & b3;\n        }\n        // Iota (ι)\n        s[0] ^= SHA3_IOTA_H[round];\n        s[1] ^= SHA3_IOTA_L[round];\n    }\n    clean(B);\n}\n/**\n * Keccak sponge function.\n * @param blockLen - absorb/squeeze rate in bytes\n * @param suffix - domain separation suffix byte\n * @param outputLen - default digest length in bytes. This base sponge only\n *   requires a non-negative integer; wrappers that need positive output\n *   lengths must enforce that themselves.\n * @param enableXOF - whether XOF output is allowed\n * @param rounds - number of Keccak-f rounds\n * @example\n * Build a sponge state, absorb bytes, then finalize a digest.\n * ```ts\n * const hash = new Keccak(136, 0x06, 32);\n * hash.update(new Uint8Array([1, 2, 3]));\n * hash.digest();\n * ```\n */\nexport class Keccak {\n    state;\n    pos = 0;\n    posOut = 0;\n    finished = false;\n    state32;\n    destroyed = false;\n    blockLen;\n    suffix;\n    outputLen;\n    canXOF;\n    enableXOF = false;\n    rounds;\n    // NOTE: we accept arguments in bytes instead of bits here.\n    constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n        anumber(blockLen, 'blockLen');\n        anumber(suffix, 'suffix');\n        anumber(rounds, 'rounds');\n        abool(enableXOF, 'enableXOF');\n        this.blockLen = blockLen;\n        this.suffix = suffix;\n        this.outputLen = outputLen;\n        this.enableXOF = enableXOF;\n        this.canXOF = enableXOF;\n        this.rounds = rounds;\n        // Can be passed from user as dkLen\n        anumber(outputLen, 'outputLen');\n        // Only keccak-f1600 is supported: 1600 bits (5x5 matrix of 64bit) === 200 bytes of state.\n        if (!(0 < blockLen && blockLen < 200))\n            throw new Error('\"blockLen\" must be 1..199');\n        this.state = new Uint8Array(200);\n        this.state32 = u32(this.state);\n    }\n    clone() {\n        return this._cloneInto();\n    }\n    keccak() {\n        swap32IfBE(this.state32);\n        keccakP(this.state32, this.rounds);\n        swap32IfBE(this.state32);\n        this.posOut = 0;\n        this.pos = 0;\n    }\n    update(data) {\n        aexists(this);\n        abytes(data);\n        const { blockLen, state, state32 } = this;\n        const len = data.length;\n        // Absorb full blocks with u32 XORs when both sides are 4-byte aligned.\n        // XOR of same-position words equals XOR of same-position bytes, so this is endianness-safe.\n        const canUseU32 = blockLen % 4 === 0 && data.byteOffset % 4 === 0;\n        const blockLen32 = blockLen / 4;\n        const data32 = canUseU32 && len >= blockLen ? u32(data) : undefined;\n        for (let pos = 0; pos < len;) {\n            if (data32 !== undefined && this.pos === 0 && pos % 4 === 0 && len - pos >= blockLen) {\n                for (let i = 0, o = pos / 4; i < blockLen32; i++)\n                    state32[i] ^= data32[o + i];\n                pos += blockLen;\n                // Subclasses (_KeccakPRG) read `this.pos` inside their `keccak()` override,\n                // so it must reflect the fully-absorbed block before the permutation fires.\n                this.pos = blockLen;\n                this.keccak();\n                continue;\n            }\n            const take = Math.min(blockLen - this.pos, len - pos);\n            for (let i = 0; i < take; i++)\n                state[this.pos++] ^= data[pos++];\n            if (this.pos === blockLen)\n                this.keccak();\n        }\n        return this;\n    }\n    finish() {\n        if (this.finished)\n            return;\n        this.finished = true;\n        const { state, suffix, pos, blockLen } = this;\n        // FIPS 202 appends the SHA3/SHAKE domain-separation suffix before pad10*1.\n        // These byte values already include the first padding bit, while the\n        // final `0x80` below supplies the closing `1` bit in the last rate byte.\n        state[pos] ^= suffix;\n        // If that combined suffix lands in the last rate byte and already sets\n        // bit 7, absorb it first so the final pad10*1 bit can be xored into a\n        // fresh block.\n        if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n            this.keccak();\n        state[blockLen - 1] ^= 0x80;\n        this.keccak();\n    }\n    writeInto(out) {\n        aexists(this, false);\n        abytes(out);\n        this.finish();\n        const bufferOut = this.state;\n        const { blockLen } = this;\n        for (let pos = 0, len = out.length; pos < len;) {\n            if (this.posOut >= blockLen)\n                this.keccak();\n            const take = Math.min(blockLen - this.posOut, len - pos);\n            out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n            this.posOut += take;\n            pos += take;\n        }\n        return out;\n    }\n    xofInto(out) {\n        // Plain SHA3/Keccak usage with XOF is probably a mistake, but this base\n        // class is also reused by SHAKE/cSHAKE/KMAC/TupleHash/ParallelHash/\n        // TurboSHAKE/KangarooTwelve wrappers that intentionally enable XOF.\n        if (!this.enableXOF)\n            throw new Error('XOF is not enabled');\n        return this.writeInto(out);\n    }\n    xof(bytes) {\n        anumber(bytes);\n        return this.xofInto(new Uint8Array(bytes));\n    }\n    digestInto(out) {\n        aoutput(out, this);\n        if (this.finished)\n            throw new Error('digest() was already called');\n        // `aoutput(...)` allows oversized buffers; digestInto() must fill only the advertised digest.\n        this.writeInto(out.length === this.outputLen ? out : out.subarray(0, this.outputLen));\n        this.destroy();\n    }\n    digest() {\n        const out = new Uint8Array(this.outputLen);\n        this.digestInto(out);\n        return out;\n    }\n    destroy() {\n        this.destroyed = true;\n        clean(this.state);\n    }\n    _cloneInto(to) {\n        const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n        to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);\n        // Reused destinations can come from a different rate/capacity variant, so clone must rewrite\n        // the sponge geometry as well as the state words.\n        to.blockLen = blockLen;\n        to.state32.set(this.state32);\n        // Sponge padding and XOF output are positional, so both offsets are part of the clone state.\n        to.pos = this.pos;\n        to.posOut = this.posOut;\n        to.finished = this.finished;\n        to.rounds = rounds;\n        // Suffix can change in cSHAKE\n        to.suffix = suffix;\n        to.outputLen = outputLen;\n        to.enableXOF = enableXOF;\n        // Clones must preserve the public capability bit too; `_KMAC` reuses this path and deep clone\n        // tests compare instance fields directly, so leaving `canXOF` behind makes the clone lie.\n        to.canXOF = this.canXOF;\n        to.destroyed = this.destroyed;\n        return to;\n    }\n}\nconst genKeccak = (suffix, blockLen, outputLen, info = {}) => createHasher(() => new Keccak(blockLen, suffix, outputLen), info);\n/**\n * SHA3-224 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA3-224.\n * ```ts\n * sha3_224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha3_224 = /* @__PURE__ */ genKeccak(0x06, 144, 28, \n/* @__PURE__ */ oidNist(0x07));\n/**\n * SHA3-256 hash function. Different from keccak-256.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA3-256.\n * ```ts\n * sha3_256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32, \n/* @__PURE__ */ oidNist(0x08));\n/**\n * SHA3-384 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA3-384.\n * ```ts\n * sha3_384(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48, \n/* @__PURE__ */ oidNist(0x09));\n/**\n * SHA3-512 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA3-512.\n * ```ts\n * sha3_512(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64, \n/* @__PURE__ */ oidNist(0x0a));\n/**\n * Keccak-224 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with Keccak-224.\n * ```ts\n * keccak_224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const keccak_224 = /* @__PURE__ */ genKeccak(0x01, 144, 28);\n/**\n * Keccak-256 hash function. Different from SHA3-256.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with Keccak-256.\n * ```ts\n * keccak_256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const keccak_256 = /* @__PURE__ */ genKeccak(0x01, 136, 32);\n/**\n * Keccak-384 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with Keccak-384.\n * ```ts\n * keccak_384(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const keccak_384 = /* @__PURE__ */ genKeccak(0x01, 104, 48);\n/**\n * Keccak-512 hash function.\n * @param msg - message bytes to hash\n * @param opts - Reserved hash options.\n * @returns Digest bytes.\n * @example\n * Hash a message with Keccak-512.\n * ```ts\n * keccak_512(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const keccak_512 = /* @__PURE__ */ genKeccak(0x01, 72, 64);\nconst genShake = (suffix, blockLen, outputLen, info = {}) => createHasher((opts = {}) => {\n    opts = checkOpts({}, opts);\n    return new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true);\n}, info);\n/**\n * SHAKE128 XOF with 128-bit security and a 16-byte default output.\n * @param msg - message bytes to hash\n * @param opts - Optional output-length override. See {@link ShakeOpts}.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHAKE128.\n * ```ts\n * shake128(new Uint8Array([97, 98, 99]), { dkLen: 32 });\n * ```\n */\nexport const shake128 = \n/* @__PURE__ */\ngenShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b));\n/**\n * SHAKE256 XOF with 256-bit security and a 32-byte default output.\n * @param msg - message bytes to hash\n * @param opts - Optional output-length override. See {@link ShakeOpts}.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHAKE256.\n * ```ts\n * shake256(new Uint8Array([97, 98, 99]), { dkLen: 64 });\n * ```\n */\nexport const shake256 = \n/* @__PURE__ */\ngenShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c));\n/**\n * SHAKE128 XOF with 256-bit output (NIST version).\n * @param msg - message bytes to hash\n * @param opts - Optional output-length override. See {@link ShakeOpts}.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHAKE128 using a 32-byte default output.\n * ```ts\n * shake128_32(new Uint8Array([97, 98, 99]), { dkLen: 32 });\n * ```\n */\nexport const shake128_32 = \n/* @__PURE__ */\ngenShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b));\n/**\n * SHAKE256 XOF with 512-bit output (NIST version).\n * @param msg - message bytes to hash\n * @param opts - Optional output-length override. See {@link ShakeOpts}.\n * @returns Digest bytes.\n * @example\n * Hash a message with SHAKE256 using a 64-byte default output.\n * ```ts\n * shake256_64(new Uint8Array([97, 98, 99]), { dkLen: 64 });\n * ```\n */\nexport const shake256_64 = \n/* @__PURE__ */\ngenShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c));\n","/**\n * Hex, bytes and number utilities.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { abytes as abytes_, anumber as anumber_, bytesToHex as bytesToHex_, concatBytes as concatBytes_, hexToBytes as hexToBytes_, isBytes as isBytes_, randomBytes as randomBytes_, } from '@noble/hashes/utils.js';\n/**\n * Validates that a value is an array, optionally validating each element.\n * @param item - Value to validate.\n * @param title - Label included in thrown errors.\n * @param inner - Optional per-element validator, called with the element and its label.\n * @returns The validated array.\n * @example\n * Validate an array of points before batch processing.\n *\n * ```ts\n * aarray([1n, 2n], 'scalars');\n * ```\n */\nexport function aarray(item, title, inner = () => { }) {\n    if (!Array.isArray(item))\n        throw new TypeError(`\"${title}\" expected array, got type=${typeof item}`);\n    for (let i = 0; i < item.length; i++)\n        inner(item[i], `${title}[${i}]`);\n    return item;\n}\n/**\n * Validates that a value is a byte array.\n * @param value - Value to validate.\n * @param length - Optional exact byte length.\n * @param title - Optional field name.\n * @returns Original byte array.\n * @example\n * Reject non-byte input before passing data into curve code.\n *\n * ```ts\n * abytes(new Uint8Array(1));\n * ```\n */\nexport const abytes = (value, length, title) => abytes_(value, length, title);\n/**\n * Validates that a value is a non-negative safe integer.\n * @param n - Value to validate.\n * @param title - Optional field name.\n * @returns The validated number.\n * @example\n * Validate a numeric length before allocating buffers.\n *\n * ```ts\n * anumber(1);\n * ```\n */\nexport const anumber = anumber_;\n/**\n * Asserts something is a string.\n * @param value - Value to validate.\n * @param title - Label included in thrown errors.\n * @returns The validated string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a label string.\n *\n * ```ts\n * astring('example', 'label');\n * ```\n */\nexport function astring(value, title = '') {\n    if (typeof value !== 'string') {\n        const prefix = title && `\"${title}\" `;\n        throw new TypeError(prefix + 'expected string, got type=' + typeof value);\n    }\n    return value;\n}\n/**\n * Asserts something is a plain object-ish value, not null or array.\n * @param value - Value to validate.\n * @param title - Label included in thrown errors.\n * @returns The validated object.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate an options object before checking fields.\n *\n * ```ts\n * aobject({ flag: true });\n * ```\n */\nexport function aobject(value, title = 'object') {\n    if (value === null || typeof value !== 'object' || Array.isArray(value))\n        throw new TypeError(title === 'object'\n            ? 'expected valid options object'\n            : `\"${title}\" expected object, got type=${typeof value}`);\n    return value;\n}\n/**\n * Asserts something is a function.\n * @param value - Value to validate.\n * @param title - Label included in thrown errors.\n * @returns The validated function.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a required method before calling it.\n *\n * ```ts\n * afunction(() => true, 'predicate');\n * ```\n */\nexport function afunction(value, title) {\n    if (typeof value !== 'function')\n        throw new TypeError(`\"${title}\" is invalid: expected function, got ${typeof value}`);\n    return value;\n}\n/**\n * Encodes bytes as lowercase hex.\n * @param bytes - Bytes to encode.\n * @returns Lowercase hex string.\n * @example\n * Serialize bytes as hex for logging or fixtures.\n *\n * ```ts\n * bytesToHex(Uint8Array.of(1, 2, 3));\n * ```\n */\nexport const bytesToHex = bytesToHex_;\n/**\n * Concatenates byte arrays.\n * @param arrays - Byte arrays to join.\n * @returns Concatenated bytes.\n * @example\n * Join domain-separated chunks into one buffer.\n *\n * ```ts\n * concatBytes(Uint8Array.of(1), Uint8Array.of(2));\n * ```\n */\nexport const concatBytes = (...arrays) => concatBytes_(...arrays);\n/**\n * Decodes lowercase or uppercase hex into bytes.\n * @param hex - Hex string to decode.\n * @returns Decoded bytes.\n * @example\n * Parse fixture hex into bytes before hashing.\n *\n * ```ts\n * hexToBytes('0102');\n * ```\n */\nexport const hexToBytes = (hex) => hexToBytes_(hex);\n/**\n * Checks whether a value is a Uint8Array.\n * @param a - Value to inspect.\n * @returns `true` when `a` is a Uint8Array.\n * @example\n * Branch on byte input before decoding it.\n *\n * ```ts\n * isBytes(new Uint8Array(1));\n * ```\n */\nexport const isBytes = isBytes_;\n/**\n * Reads random bytes from the platform CSPRNG.\n * @param bytesLength - Number of random bytes to read.\n * @returns Fresh random bytes.\n * @example\n * Generate a random seed for a keypair.\n *\n * ```ts\n * randomBytes(2);\n * ```\n */\nexport const randomBytes = (bytesLength) => randomBytes_(bytesLength);\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\n// Shared error-message prefix builder. Only called on throw paths, so assert\n// success paths never pay for the string concatenation.\nconst atitle = (title) => (title ? `\"${title}\" ` : '');\n/**\n * Validates that a flag is boolean.\n * @param value - Value to validate.\n * @param title - Optional field name.\n * @returns Original value.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Reject non-boolean option flags early.\n *\n * ```ts\n * abool(true);\n * ```\n */\nexport function abool(value, title = '') {\n    if (typeof value !== 'boolean')\n        throw new TypeError(atitle(title) + 'expected boolean, got type=' + typeof value);\n    return value;\n}\n/**\n * Validates that a value is a non-negative bigint or safe integer.\n * @param n - Value to validate.\n * @returns The same validated value.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate one integer-like value before serializing it.\n *\n * ```ts\n * abignumber(1n);\n * ```\n */\nexport function abignumber(n) {\n    if (typeof n === 'bigint') {\n        if (!isPosBig(n))\n            throw new RangeError('positive bigint expected, got ' + n);\n    }\n    else\n        anumber(n);\n    return n;\n}\n/**\n * Validates that a value is a safe integer.\n * @param value - Integer to validate.\n * @param title - Optional field name.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a window size before scalar arithmetic uses it.\n *\n * ```ts\n * asafenumber(1);\n * ```\n */\nexport function asafenumber(value, title = '') {\n    if (typeof value !== 'number') {\n        const prefix = title && `\"${title}\" `;\n        throw new TypeError(prefix + 'expected number, got type=' + typeof value);\n    }\n    if (!Number.isSafeInteger(value)) {\n        const prefix = title && `\"${title}\" `;\n        throw new RangeError(prefix + 'expected safe integer, got ' + value);\n    }\n}\n/**\n * Encodes a bigint into even-length big-endian hex.\n * The historical \"unpadded\" name only means \"no fixed-width field padding\"; odd-length hex still\n * gets one leading zero nibble so the result always represents whole bytes.\n * @param num - Number to encode.\n * @returns Big-endian hex string.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Encode a scalar into hex without a `0x` prefix.\n *\n * ```ts\n * numberToHexUnpadded(255n);\n * ```\n */\nexport function numberToHexUnpadded(num) {\n    const hex = abignumber(num).toString(16);\n    return hex.length & 1 ? '0' + hex : hex;\n}\n/**\n * Parses a big-endian hex string into bigint.\n * Accepts odd-length hex through the native `BigInt('0x' + hex)` parser and currently surfaces the\n * same native `SyntaxError` for malformed hex instead of wrapping it in a library-specific error.\n * @param hex - Hex string without `0x`.\n * @returns Parsed bigint value.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Parse a scalar from fixture hex.\n *\n * ```ts\n * hexToNumber('ff');\n * ```\n */\nexport function hexToNumber(hex) {\n    if (typeof hex !== 'string')\n        throw new TypeError('hex string expected, got ' + typeof hex);\n    return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian\n}\n// BE: Big Endian, LE: Little Endian\n/**\n * Parses big-endian bytes into bigint.\n * @param bytes - Bytes in big-endian order.\n * @returns Parsed bigint value.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Read a scalar encoded in network byte order.\n *\n * ```ts\n * bytesToNumberBE(Uint8Array.of(1, 0));\n * ```\n */\nexport function bytesToNumberBE(bytes) {\n    return hexToNumber(bytesToHex_(bytes));\n}\n/**\n * Parses little-endian bytes into bigint.\n * @param bytes - Bytes in little-endian order.\n * @returns Parsed bigint value.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Read a scalar encoded in little-endian form.\n *\n * ```ts\n * bytesToNumberLE(Uint8Array.of(1, 0));\n * ```\n */\nexport function bytesToNumberLE(bytes) {\n    return hexToNumber(bytesToHex_(copyBytes(abytes_(bytes)).reverse()));\n}\n/**\n * Encodes a bigint into fixed-length big-endian bytes.\n * @param n - Number to encode.\n * @param len - Output length in bytes. Must be greater than zero.\n * @returns Big-endian byte array.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If a documented runtime validation or state check fails. {@link Error}\n * @example\n * Serialize a scalar into a 32-byte field element.\n *\n * ```ts\n * numberToBytesBE(255n, 2);\n * ```\n */\nexport function numberToBytesBE(n, len) {\n    anumber_(len);\n    if (len === 0)\n        throw new Error('zero output length is invalid');\n    n = abignumber(n);\n    const expectedLen = len * 2;\n    const hex = n.toString(16);\n    // Detect overflow before hex parsing so oversized values don't leak the shared odd-hex error.\n    if (hex.length > expectedLen)\n        throw new RangeError('number is too large');\n    return hexToBytes_(hex.padStart(expectedLen, '0'));\n}\n/**\n * Encodes a bigint into fixed-length little-endian bytes.\n * @param n - Number to encode.\n * @param len - Output length in bytes.\n * @returns Little-endian byte array.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If a documented runtime validation or state check fails. {@link Error}\n * @example\n * Serialize a scalar for little-endian protocols.\n *\n * ```ts\n * numberToBytesLE(255n, 2);\n * ```\n */\nexport function numberToBytesLE(n, len) {\n    return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\n/**\n * Encodes a bigint into variable-length big-endian bytes.\n * @param n - Number to encode.\n * @returns Variable-length big-endian bytes.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Serialize a bigint without fixed-width padding.\n *\n * ```ts\n * numberToVarBytesBE(255n);\n * ```\n */\nexport function numberToVarBytesBE(n) {\n    return hexToBytes_(numberToHexUnpadded(abignumber(n)));\n}\n// Compares 2 u8a-s in kinda constant time\n/**\n * Compares two byte arrays in constant-ish time.\n * @param a - Left byte array.\n * @param b - Right byte array.\n * @returns `true` when bytes match.\n * @example\n * Compare two encoded points without early exit.\n *\n * ```ts\n * equalBytes(Uint8Array.of(1), Uint8Array.of(1));\n * ```\n */\nexport function equalBytes(a, b) {\n    a = abytes(a);\n    b = abytes(b);\n    if (a.length !== b.length)\n        return false;\n    let diff = 0;\n    for (let i = 0; i < a.length; i++)\n        diff |= a[i] ^ b[i];\n    return diff === 0;\n}\n/**\n * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer,\n * and Buffer#slice creates mutable copy. Never use Buffers!\n * @param bytes - Bytes to copy.\n * @returns Detached copy.\n * @example\n * Make an isolated copy before mutating serialized bytes.\n *\n * ```ts\n * copyBytes(Uint8Array.of(1, 2, 3));\n * ```\n */\nexport function copyBytes(bytes) {\n    // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict\n    // because callers use it at byte-validation boundaries before mutating the detached copy.\n    return Uint8Array.from(abytes(bytes));\n}\n/**\n * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols\n * Should be safe to use for things expected to be ASCII.\n * Returns exact same result as `TextEncoder` for ASCII or throws.\n * @param ascii - ASCII input text.\n * @returns Encoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Encode an ASCII domain-separation tag.\n *\n * ```ts\n * asciiToBytes('ABC');\n * ```\n */\nexport function asciiToBytes(ascii) {\n    if (typeof ascii !== 'string')\n        throw new TypeError('ascii string expected, got ' + typeof ascii);\n    return Uint8Array.from(ascii, (c, i) => {\n        const charCode = c.charCodeAt(0);\n        if (c.length !== 1 || charCode > 127) {\n            throw new RangeError(`string contains non-ASCII character \"${ascii[i]}\" with code ${charCode} at position ${i}`);\n        }\n        return charCode;\n    });\n}\n/**\n * Checks whether n is non-negative bigint. Historical name.\n * @param n - candidate value\n * @returns `true` when the value is bigint and 0 or larger\n * @example\n * Check a candidate scalar before range validation.\n *\n * ```ts\n * isPosBig(2n);\n * ```\n */\nexport function isPosBig(n) {\n    return typeof n === 'bigint' && _0n <= n;\n}\n/**\n * Checks whether a bigint lies inside a half-open range.\n * @param n - Candidate value.\n * @param min - Inclusive lower bound.\n * @param max - Exclusive upper bound.\n * @returns `true` when the value is inside the range.\n * @example\n * Check whether a candidate scalar fits the field order.\n *\n * ```ts\n * inRange(2n, 1n, 3n);\n * ```\n */\nexport function inRange(n, min, max) {\n    return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;\n}\n/**\n * Asserts `min <= n < max`. NOTE: upper bound is exclusive.\n * @param title - Value label for error messages.\n * @param n - Candidate value.\n * @param min - Inclusive lower bound.\n * @param max - Exclusive upper bound.\n * Wrong-type inputs are not separated from out-of-range values here: they still flow through the\n * shared `RangeError` path because this is only a throwing wrapper around `inRange(...)`.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Assert that a bigint stays within one half-open range.\n *\n * ```ts\n * aInRange('x', 2n, 1n, 256n);\n * ```\n */\nexport function aInRange(title, n, min, max) {\n    // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?\n    // consider P=256n, min=0n, max=P\n    // - a for min=0 would require -1:          `inRange('x', x, -1n, P)`\n    // - b would commonly require subtraction:  `inRange('x', x, 0n, P - 1n)`\n    // - our way is the cleanest:               `inRange('x', x, 0n, P)\n    if (!inRange(n, min, max))\n        throw new RangeError('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n);\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n * TODO: merge with nLength in modular\n * @param n - Value to inspect.\n * @returns Bit length.\n * @throws If the value is negative. {@link Error}\n * @example\n * Measure the bit length of a scalar before serialization.\n *\n * ```ts\n * bitLen(8n);\n * ```\n */\nexport function bitLen(n) {\n    // Size callers in this repo only use non-negative orders / scalars, so negative inputs are a\n    // contract bug and must not silently collapse to zero bits.\n    if (n < _0n)\n        throw new Error('expected non-negative bigint, got ' + n);\n    // Native radix conversion beats a shift loop at every size, and the loop is quadratic in bits.\n    return n === _0n ? 0 : n.toString(2).length;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n * @param n - Source value.\n * @param pos - Bit position. Negative positions are passed through to raw\n *   bigint shift semantics; because the mask is built as `1n << pos`,\n *   they currently collapse to `0n` and make the helper a no-op.\n * @returns Bit as bigint.\n * @example\n * Gets single bit at position.\n *\n * ```ts\n * bitGet(5n, 0);\n * ```\n */\nexport function bitGet(n, pos) {\n    if (typeof n !== 'bigint')\n        throw new TypeError('\"n\" expected bigint, got type=' + typeof n);\n    asafenumber(pos, 'pos');\n    return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n * @param n - Source value.\n * @param pos - Bit position. Negative positions are passed through to raw bigint shift semantics,\n *   so they currently behave like left shifts.\n * @param value - Whether the bit should be set.\n * @returns Updated bigint.\n * @example\n * Sets single bit at position.\n *\n * ```ts\n * bitSet(0n, 1, true);\n * ```\n */\nexport function bitSet(n, pos, value) {\n    if (typeof n !== 'bigint')\n        throw new TypeError('\"n\" expected bigint, got type=' + typeof n);\n    asafenumber(pos, 'pos');\n    abool(value, 'value');\n    const mask = _1n << BigInt(pos);\n    // Clearing needs AND-not here; OR with zero leaves an already-set bit untouched.\n    return value ? n | mask : n & ~mask;\n}\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n * @param n - Number of bits. Negative widths are currently passed through to raw bigint shift\n *   semantics and therefore produce `-1n`.\n * @returns Bitmask value.\n * @example\n * Calculate mask for N bits.\n *\n * ```ts\n * bitMask(4);\n * ```\n */\nexport const bitMask = (n) => {\n    asafenumber(n, 'n');\n    return (_1n << BigInt(n)) - _1n;\n};\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @param hashLen - Hash output size in bytes. Callers are expected to pass a positive length; `0`\n *   is not rejected here and would make the internal generate loop non-progressing.\n * @param qByteLen - Requested output size in bytes. Callers are expected to pass a positive length.\n * @param hmacFn - HMAC implementation.\n * @returns Function that will call DRBG until the predicate returns anything\n *   other than `undefined`.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Build a deterministic nonce generator for RFC6979-style signing.\n *\n * ```ts\n * import { createHmacDrbg } from '@noble/curves/utils.js';\n * import { hmac } from '@noble/hashes/hmac.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hmacFn = (key: Uint8Array, msg: Uint8Array) => hmac(sha256, key, msg);\n * const drbg = createHmacDrbg(32, 32, hmacFn);\n * const seed = new Uint8Array(32);\n * drbg(seed, (bytes) => bytes);\n * ```\n */\nexport function createHmacDrbg(hashLen, qByteLen, hmacFn) {\n    anumber_(hashLen, 'hashLen');\n    anumber_(qByteLen, 'qByteLen');\n    if (typeof hmacFn !== 'function')\n        throw new TypeError('hmacFn must be a function');\n    // creates Uint8Array\n    const u8n = (len) => new Uint8Array(len);\n    const NULL = Uint8Array.of();\n    const byte0 = Uint8Array.of(0x00);\n    const byte1 = Uint8Array.of(0x01);\n    const _maxDrbgIters = 1000;\n    // Step B, Step C: set hashLen to 8*ceil(hlen/8).\n    // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 signatures.\n    let v = u8n(hashLen);\n    // Steps B and C of RFC6979 3.2.\n    let k = u8n(hashLen);\n    let i = 0; // Iterations counter, will throw when over 1000\n    const reset = () => {\n        v.fill(1);\n        k.fill(0);\n        i = 0;\n    };\n    // hmac(k)(v, ...values)\n    const h = (...msgs) => hmacFn(k, concatBytes(v, ...msgs));\n    const reseed = (seed = NULL) => {\n        // HMAC-DRBG reseed() function. Steps D-G\n        k = h(byte0, seed); // k = hmac(k || v || 0x00 || seed)\n        v = h(); // v = hmac(k || v)\n        if (seed.length === 0)\n            return;\n        k = h(byte1, seed); // k = hmac(k || v || 0x01 || seed)\n        v = h(); // v = hmac(k || v)\n    };\n    const gen = () => {\n        // HMAC-DRBG generate() function\n        if (i++ >= _maxDrbgIters)\n            throw new Error('drbg: tried max amount of iterations');\n        let len = 0;\n        const out = [];\n        while (len < qByteLen) {\n            v = h();\n            const sl = v.slice();\n            out.push(sl);\n            len += v.length;\n        }\n        return concatBytes(...out);\n    };\n    const genUntil = (seed, pred) => {\n        reset();\n        reseed(seed); // Steps D-G\n        let res = undefined; // Step H: grind until the predicate accepts a candidate.\n        // Falsy values like 0 are valid outputs.\n        while ((res = pred(gen())) === undefined)\n            reseed();\n        reset();\n        return res;\n    };\n    return genUntil;\n}\n/**\n * Validates declared required and optional field types on a plain object.\n * Extra keys are intentionally ignored because many callers validate only the subset they use from\n * richer option bags or runtime objects.\n * This walks field schemas and formats detailed errors, so avoid it on hot paths; use direct\n * one-line guards such as `aobject()`, `afunction()`, `abool()`, or `asafenumber()` instead.\n * @param object - Object to validate.\n * @param fields - Required field types.\n * @param optFields - Optional field types.\n * @param title - Object label included in thrown errors.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Check user options before building a curve helper.\n *\n * ```ts\n * validateObject({ flag: true }, { flag: 'boolean' });\n * ```\n */\nexport function validateObject(object, fields = {}, optFields = {}, title = 'object') {\n    aobject(object, title);\n    aobject(fields, 'fields');\n    aobject(optFields, 'optFields');\n    function checkField(fieldName, expectedType, isOpt) {\n        const label = title === 'object' ? `param \"${String(fieldName)}\"` : `\"${title}.${String(fieldName)}\"`;\n        // Config fields must be explicit own properties. Optional inherited values are rejected too\n        // because callers keep reading the same options object after validation.\n        const val = object[fieldName];\n        // Runtime objects such as Field instances intentionally satisfy required method slots\n        // via their shared prototype.\n        if (!Object.hasOwn(object, fieldName) &&\n            (isOpt ? val !== undefined : expectedType !== 'function')) {\n            throw new TypeError(`${label} is invalid: expected own property`);\n        }\n        if (isOpt && val === undefined)\n            return;\n        const current = typeof val;\n        if (current !== expectedType || val === null)\n            throw new TypeError(`${label} is invalid: expected ${expectedType}, got ${current}`);\n    }\n    const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt));\n    iter(fields, false);\n    iter(optFields, true);\n}\n/**\n * Throws not implemented error.\n * @returns Never returns.\n * @throws If the unfinished code path is reached. {@link Error}\n * @example\n * Surface the placeholder error from an unfinished code path.\n *\n * ```ts\n * try {\n *   notImplemented();\n * } catch {}\n * ```\n */\nexport const notImplemented = () => {\n    throw new Error('not implemented');\n};\n","/**\n * Experimental implementation of NTT / FFT (Fast Fourier Transform) over finite fields.\n * API may change at any time. The code has not been audited. Feature requests are welcome.\n * @module\n */\nimport { aarray, validateObject } from \"../utils.js\";\nimport { validateField } from \"./modular.js\";\nfunction checkU32(n, title = 'n') {\n    // 0xff_ff_ff_ff\n    if (typeof n !== 'number')\n        throw new TypeError(`wrong u32 integer \"${title}\": expected number, got type=${typeof n}`);\n    if (!Number.isSafeInteger(n) || n < 0 || n > 0xffffffff)\n        throw new RangeError(`wrong u32 integer \"${title}\": expected 0..4294967295, got ${n}`);\n    return n;\n}\n/**\n * Checks if integer is in form of `1 << X`.\n * @param x - Integer to inspect.\n * @returns `true` when the value is a power of two.\n * @example\n * Validate that an FFT size is a power of two.\n *\n * ```ts\n * isPowerOfTwo(8);\n * ```\n */\nexport function isPowerOfTwo(x) {\n    checkU32(x, 'x');\n    return (x & (x - 1)) === 0 && x !== 0;\n}\n/**\n * @param n - Input value.\n * @returns Next power of two within the u32/array-length domain.\n * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error}\n * @example\n * Round an integer up to the FFT size it needs.\n *\n * ```ts\n * nextPowerOfTwo(9);\n * ```\n */\nexport function nextPowerOfTwo(n) {\n    checkU32(n);\n    if (n <= 1)\n        return 1;\n    // FFT sizes here are used as JS array lengths, so `2^32` is not a meaningful result:\n    // keep the fast u32 bit-twiddling path and fail explicitly instead of wrapping to 1.\n    if (n > 0x8000_0000)\n        throw new Error('nextPowerOfTwo overflow: result does not fit u32');\n    return (1 << (log2(n - 1) + 1)) >>> 0;\n}\n/**\n * @param n - Value to reverse.\n * @param bits - Number of bits to use.\n * @returns Bit-reversed integer.\n * @throws If `n` is not a valid unsigned 32-bit integer. {@link Error}\n * @example\n * Reverse the low `bits` bits of one index.\n *\n * ```ts\n * reverseBits(3, 3);\n * ```\n */\nexport function reverseBits(n, bits) {\n    checkU32(n);\n    if (typeof bits !== 'number')\n        throw new TypeError('\"bits\" expected number, got type=' + typeof bits);\n    if (!Number.isSafeInteger(bits) || bits < 0 || bits > 32)\n        throw new Error(`expected integer 0 <= bits <= 32, got ${bits}`);\n    let reversed = 0;\n    for (let i = 0; i < bits; i++, n >>>= 1)\n        reversed = (reversed << 1) | (n & 1);\n    // JS bitwise ops are signed i32; cast back so 32-bit reversals stay in the unsigned u32 domain.\n    return reversed >>> 0;\n}\n/**\n * Similar to `bitLen(x)-1` but much faster for small integers, like indices.\n * @param n - Input value.\n * @returns Base-2 logarithm. For `n = 0`, the current implementation returns `-1`.\n * @example\n * Compute the radix-2 stage count for one transform size.\n *\n * ```ts\n * log2(8);\n * ```\n */\nexport function log2(n) {\n    checkU32(n);\n    return 31 - Math.clz32(n);\n}\n/**\n * Moves lowest bit to highest position, which at first step splits\n * array on even and odd indices, then it applied again to each part,\n * which is core of fft\n * @param values - Mutable coefficient array.\n * @returns Mutated input array.\n * @throws If the array length is not a positive power of two. {@link Error}\n * @example\n * Reorder coefficients into bit-reversed order in place.\n *\n * ```ts\n * const values = Uint8Array.from([0, 1, 2, 3]);\n * bitReversalInplace(values);\n * ```\n */\nexport function bitReversalInplace(values) {\n    if (!values ||\n        typeof values !== 'object' ||\n        typeof values.length !== 'number')\n        throw new TypeError('\"values\" expected array-like, got type=' + typeof values);\n    const n = values.length;\n    // Size-1 FFT is the identity, so bit-reversal must stay a no-op there instead of rejecting it.\n    if (!isPowerOfTwo(n))\n        throw new Error('expected positive power-of-two length, got ' + n);\n    const bits = log2(n);\n    for (let i = 0; i < n; i++) {\n        const j = reverseBits(i, bits);\n        if (i < j) {\n            const tmp = values[i];\n            values[i] = values[j];\n            values[j] = tmp;\n        }\n    }\n    return values;\n}\n/**\n * @param values - Input values.\n * @returns Reordered copy.\n * @throws If the array length is not a positive power of two. {@link Error}\n * @example\n * Return a reordered copy instead of mutating the input in place.\n *\n * ```ts\n * const reordered = bitReversalPermutation([0, 1, 2, 3]);\n * ```\n */\nexport function bitReversalPermutation(values) {\n    aarray(values, 'values');\n    return bitReversalInplace(values.slice());\n}\nconst _1n = /** @__PURE__ */ BigInt(1);\nfunction findGenerator(field) {\n    let G = BigInt(2);\n    for (; field.eql(field.pow(G, field.ORDER >> _1n), field.ONE); G++)\n        ;\n    return G;\n}\n/**\n * We limit roots up to 2**31, which is a lot: 2-billion polynomial should be rare.\n * @param field - Field implementation.\n * @param generator - Optional trusted non-quadratic-residue override for callers that already know the field.\n * @returns Roots-of-unity cache.\n * @example\n * Cache roots once, then ask for the omega table of one FFT size.\n *\n * ```ts\n * import { rootsOfUnity } from '@noble/curves/abstract/fft.js';\n * import { Field } from '@noble/curves/abstract/modular.js';\n * const roots = rootsOfUnity(Field(17n));\n * const omega = roots.omega(4);\n * ```\n */\nexport function rootsOfUnity(field, generator) {\n    validateField(field);\n    if (generator !== undefined && typeof generator !== 'bigint')\n        throw new TypeError('\"generator\" expected bigint, got type=' + typeof generator);\n    // Factor field.ORDER-1 as oddFactor * 2^powerOfTwo\n    let oddFactor = field.ORDER - _1n;\n    let powerOfTwo = 0;\n    for (; (oddFactor & _1n) !== _1n; powerOfTwo++, oddFactor >>= _1n)\n        ;\n    // Find non quadratic residue\n    let G = generator !== undefined ? BigInt(generator) : findGenerator(field);\n    // Powers of generator\n    const omegas = new Array(powerOfTwo + 1);\n    omegas[powerOfTwo] = field.pow(G, oddFactor);\n    for (let i = powerOfTwo; i > 0; i--)\n        omegas[i - 1] = field.sqr(omegas[i]);\n    // Compute all roots of unity for powers up to maxPower\n    const rootsCache = [];\n    const checkBits = (bits) => {\n        checkU32(bits, 'bits');\n        if (bits > 31 || bits > powerOfTwo)\n            throw new Error('rootsOfUnity: wrong bits ' + bits + ' powerOfTwo=' + powerOfTwo);\n        return bits;\n    };\n    const precomputeRoots = (maxPower) => {\n        checkBits(maxPower);\n        for (let power = maxPower; power >= 0; power--) {\n            if (rootsCache[power])\n                continue; // Skip if we've already computed roots for this power\n            const above = rootsCache[power + 1];\n            const rootsAtPower = [];\n            if (above) {\n                // ω_{2^p} = ω_{2^{p+1}}², so the smaller table is the even-index stride of the bigger\n                // one: only the largest requested power pays for the multiplication chain.\n                for (let j = 0; j < 2 ** power; j++)\n                    rootsAtPower.push(above[2 * j]);\n            }\n            else {\n                for (let j = 0, cur = field.ONE; j < 2 ** power; j++, cur = field.mul(cur, omegas[power]))\n                    rootsAtPower.push(cur);\n            }\n            rootsCache[power] = rootsAtPower;\n        }\n        return rootsCache[maxPower];\n    };\n    const brpCache = new Map();\n    const inverseCache = new Map();\n    // roots()/brp()/inverse() expose shared cached arrays by reference for speed; callers must treat them as read-only.\n    // NOTE: we use bits instead of power, because power = 2**bits,\n    // but power is not necessarily isPowerOfTwo(power)!\n    return {\n        info: { G, powerOfTwo, oddFactor },\n        roots: (bits) => {\n            const b = checkBits(bits);\n            return precomputeRoots(b);\n        },\n        brp(bits) {\n            const b = checkBits(bits);\n            if (brpCache.has(b))\n                return brpCache.get(b);\n            else {\n                const res = bitReversalPermutation(this.roots(b));\n                brpCache.set(b, res);\n                return res;\n            }\n        },\n        inverse(bits) {\n            const b = checkBits(bits);\n            if (inverseCache.has(b))\n                return inverseCache.get(b);\n            else {\n                // ωᴺ = 1, so inv(ωᵏ) = ωᴺ⁻ᵏ: the inverse table is the reversed roots table.\n                // Value-identical to field.invertBatch(roots), but skips its 3N muls + inversion.\n                const r = this.roots(b);\n                const res = [r[0]].concat(r.slice(1).reverse());\n                inverseCache.set(b, res);\n                return res;\n            }\n        },\n        omega: (bits) => omegas[checkBits(bits)],\n        clear: () => {\n            rootsCache.splice(0, rootsCache.length);\n            brpCache.clear();\n            inverseCache.clear();\n        },\n    };\n}\n/**\n * Constructs different flavors of FFT. radix2 implementation of low level mutating API. Flavors:\n *\n * - DIT (Decimation-in-Time): Bottom-Up (leaves to root), Cooley-Tukey\n * - DIF (Decimation-in-Frequency): Top-Down (root to leaves), Gentleman-Sande\n *\n * DIT takes brp input, returns natural output.\n * DIF takes natural input, returns brp output.\n *\n * The output is actually identical. Time / frequence distinction is not meaningful\n * for Polynomial multiplication in fields.\n * Which means if protocol supports/needs brp output/inputs, then we can skip this step.\n *\n * Cyclic NTT: Rq = Zq[x]/(x^n-1). butterfly_DIT+loop_DIT OR butterfly_DIF+loop_DIT, roots are omega\n * Negacyclic NTT: Rq = Zq[x]/(x^n+1). butterfly_DIT+loop_DIF, at least for mlkem / mldsa\n *\n * `invertButterflies` indexes roots by a per-butterfly-group counter (`grp`): forward\n * (`dit: false`) reads `roots[grp]` with grp = 1..; inverse (`dit: true`) reads `roots[N - grp]`\n * with grp restarting at 1. With `skipStages: 0` one table serves both directions (ωᴺ = 1 makes\n * the reversed walk self-inverse). With `skipStages > 0` the inverse walk starts at `N - 1`\n * instead of continuing where the skipped stages would have left off, so the caller must supply\n * a table shaped for that (ML-KEM: `ζ^BitRev7(i)` over all N=256 indices, whose aliased upper\n * half is exactly the FIPS 203 inverse walk).\n * @param F - Field operations.\n * @param coreOpts - FFT configuration. See {@link FFTCoreOpts}:\n *   - `N`: Transform size. Must be a power of two.\n *   - `roots`: Stage roots for the selected transform size.\n *   - `dit`: Whether to run the DIT variant instead of DIF.\n *   - `invertButterflies` (optional): Whether to invert butterfly placement.\n *   - `skipStages` (optional): Number of initial stages to skip.\n *   - `brp` (optional): Whether to apply bit-reversal permutation at the boundary.\n * @returns Low-level FFT loop.\n * @throws If the FFT options or cached roots are invalid for the requested size. {@link Error}\n * @example\n * Constructs different flavors of FFT.\n *\n * ```ts\n * import { FFTCore, rootsOfUnity } from '@noble/curves/abstract/fft.js';\n * import { Field } from '@noble/curves/abstract/modular.js';\n * const Fp = Field(17n);\n * const roots = rootsOfUnity(Fp).roots(2);\n * const loop = FFTCore(Fp, { N: 4, roots, dit: true });\n * const values = loop([1n, 2n, 3n, 4n]);\n * ```\n */\nexport const FFTCore = (F, coreOpts) => {\n    validateObject(coreOpts, { N: 'number', roots: 'object', dit: 'boolean' }, { invertButterflies: 'boolean', skipStages: 'number', brp: 'boolean' }, 'coreOpts');\n    const { N, roots, dit, invertButterflies = false, skipStages = 0, brp = true } = coreOpts;\n    checkU32(N, 'coreOpts.N');\n    const bits = log2(N);\n    if (!isPowerOfTwo(N))\n        throw new Error('FFT: Polynomial size should be power of two');\n    checkU32(skipStages, 'coreOpts.skipStages');\n    const maxSkipStages = bits === 0 ? 0 : bits - 1;\n    // Skipping every stage leaves only boundary layout changes, not a valid FFT loop shape.\n    if (skipStages > maxSkipStages)\n        throw new Error(`FFT: wrong skipStages: expected 0 <= skipStages <= ${maxSkipStages}`);\n    // Wrong-sized root tables can stay in-bounds for some loop shapes and silently compute nonsense.\n    if (roots.length !== N)\n        throw new Error(`FFT: wrong roots length: expected ${N}, got ${roots.length}`);\n    const isDit = dit !== invertButterflies;\n    return (values) => {\n        if (values.length !== N)\n            throw new Error('FFT: wrong Polynomial length');\n        if (dit && brp)\n            bitReversalInplace(values);\n        for (let i = 0, g = 1; i < bits - skipStages; i++) {\n            // For each stage s (sub-FFT length m = 2^s)\n            const s = dit ? i + 1 + skipStages : bits - i;\n            const m = 1 << s;\n            const m2 = m >> 1;\n            const stride = N >> s;\n            // Loop over each subarray of length m\n            for (let k = 0; k < N; k += m) {\n                // Loop over each butterfly within the subarray\n                for (let j = 0, grp = g++; j < m2; j++) {\n                    const rootPos = invertButterflies ? (dit ? N - grp : grp) : j * stride;\n                    const i0 = k + j;\n                    const i1 = k + j + m2;\n                    const omega = roots[rootPos];\n                    const b = values[i1];\n                    const a = values[i0];\n                    // Inlining gives us 10% perf in kyber vs functions\n                    if (isDit) {\n                        const t = F.mul(b, omega); // Standard DIT butterfly\n                        values[i0] = F.add(a, t);\n                        values[i1] = F.sub(a, t);\n                    }\n                    else if (invertButterflies) {\n                        values[i0] = F.add(b, a); // DIT loop + inverted butterflies (Kyber decode)\n                        values[i1] = F.mul(F.sub(b, a), omega);\n                    }\n                    else {\n                        values[i0] = F.add(a, b); // Standard DIF butterfly\n                        values[i1] = F.mul(F.sub(a, b), omega);\n                    }\n                }\n            }\n        }\n        if (!dit && brp)\n            bitReversalInplace(values);\n        return values;\n    };\n};\n/**\n * NTT aka FFT over finite field (NOT over complex numbers).\n * Naming mirrors other libraries.\n * @param roots - Roots-of-unity cache.\n * @param opts - Field operations. See {@link FFTOpts}.\n * @returns Forward and inverse FFT helpers.\n * @example\n * NTT aka FFT over finite field (NOT over complex numbers).\n *\n * ```ts\n * import { FFT, rootsOfUnity } from '@noble/curves/abstract/fft.js';\n * import { Field } from '@noble/curves/abstract/modular.js';\n * const Fp = Field(17n);\n * const fft = FFT(rootsOfUnity(Fp), Fp);\n * const values = fft.direct([1n, 2n, 3n, 4n]);\n * ```\n */\nexport function FFT(roots, opts) {\n    // Loops are cached per (size, direction, brp flags): FFTCore construction validates options\n    // and allocates closures, which costs more than a small transform itself. The cached loop\n    // closes over the root table active at first use; `roots.clear()` rebuilds value-identical\n    // tables, so a stale reference stays correct.\n    const loops = new Map();\n    const getLoop = (N, rootsTable, key) => {\n        const cached = loops.get(key);\n        if (cached)\n            return cached;\n        const brpInput = !!(key & 2);\n        const brpOutput = !!(key & 1);\n        let loop;\n        if (brpInput && brpOutput) {\n            // we cannot optimize this case, but lets support it anyway\n            const core = FFTCore(opts, { N, roots: rootsTable, dit: false, brp: false });\n            loop = (values) => core(bitReversalInplace(values));\n        }\n        else if (brpInput)\n            loop = FFTCore(opts, { N, roots: rootsTable, dit: true, brp: false });\n        else if (brpOutput)\n            loop = FFTCore(opts, { N, roots: rootsTable, dit: false, brp: false });\n        else\n            loop = FFTCore(opts, { N, roots: rootsTable, dit: true, brp: true }); // all natural\n        loops.set(key, loop);\n        return loop;\n    };\n    const loopKey = (bits, isInverse, brpInput, brpOutput) => (bits << 3) | (isInverse ? 4 : 0) | (brpInput ? 2 : 0) | (brpOutput ? 1 : 0);\n    return {\n        direct(values, brpInput = false, brpOutput = false) {\n            const N = values.length;\n            if (!isPowerOfTwo(N))\n                throw new Error('FFT: Polynomial size should be power of two');\n            const bits = log2(N);\n            const key = loopKey(bits, false, brpInput, brpOutput);\n            return getLoop(N, roots.roots(bits), key)(values.slice());\n        },\n        inverse(values, brpInput = false, brpOutput = false) {\n            const N = values.length;\n            if (!isPowerOfTwo(N))\n                throw new Error('FFT: Polynomial size should be power of two');\n            const bits = log2(N);\n            const key = loopKey(bits, true, brpInput, brpOutput);\n            const res = getLoop(N, roots.inverse(bits), key)(values.slice());\n            const ivm = opts.inv(BigInt(values.length)); // scale\n            // we can get brp output if we use dif instead of dit!\n            for (let i = 0; i < res.length; i++)\n                res[i] = opts.mul(res[i], ivm);\n            // Allows to re-use non-inverted roots, but is VERY fragile\n            // return [res[0]].concat(res.slice(1).reverse());\n            // inverse calculated as pow(-1), which transforms into ω^{-kn} (-> reverses indices)\n            return res;\n        },\n    };\n}\nexport function poly(field, roots, create, fft, length) {\n    validateField(field);\n    const F = field;\n    const _create = create ||\n        ((len, elm) => new Array(len).fill(elm ?? F.ZERO));\n    // `poly.mul(a, b)` distinguishes polynomial-vs-scalar at runtime, so keep accepted\n    // polynomial containers concrete instead of trying to support arbitrary wrappers.\n    const isPoly = (x) => {\n        if (Array.isArray(x))\n            return true;\n        if (!ArrayBuffer.isView(x))\n            return false;\n        const v = x;\n        return (typeof v.length === 'number' &&\n            typeof v.slice === 'function' &&\n            typeof v[Symbol.iterator] === 'function');\n    };\n    const checkPoly = (title, value) => {\n        if (!isPoly(value))\n            throw new TypeError(`\"${title}\" expected polynomial, got type=${typeof value}`);\n    };\n    const checkLength = (a, b) => {\n        checkPoly('a', a);\n        const L = a.length;\n        if (b !== undefined) {\n            checkPoly('b', b);\n            if (b.length !== L)\n                throw new Error(`poly: mismatched lengths ${L} vs ${b.length}`);\n        }\n        if (length !== undefined && L !== length)\n            throw new Error(`poly: expected fixed length ${length}, got ${L}`);\n        return L;\n    };\n    function findOmegaIndex(x, n, brp = false, weights) {\n        if (!isPowerOfTwo(n))\n            throw new Error('poly.lagrange: expected power of two length, got ' + n);\n        // Explicit weights define the interpolation domain, including the Kronecker-δ shortcut.\n        const omega = weights || (brp ? roots.brp(log2(n)) : roots.roots(log2(n)));\n        for (let i = 0; i < n; i++)\n            if (F.eql(x, omega[i]))\n                return i;\n        return -1;\n    }\n    // TODO: mutating versions for mlkem/mldsa\n    return {\n        roots,\n        create: _create,\n        length,\n        extend: (a, len) => {\n            checkLength(a);\n            const out = _create(len, F.ZERO);\n            // Plain arrays grow when writing past `out.length`, so cap the copy explicitly to keep\n            // `extend()` consistent with typed arrays and with its documented truncate behavior.\n            for (let i = 0; i < Math.min(a.length, len); i++)\n                out[i] = a[i];\n            return out;\n        },\n        degree: (a) => {\n            checkLength(a);\n            for (let i = a.length - 1; i >= 0; i--)\n                if (!F.is0(a[i]))\n                    return i;\n            return -1;\n        },\n        add: (a, b) => {\n            const len = checkLength(a, b);\n            const out = _create(len);\n            for (let i = 0; i < len; i++)\n                out[i] = F.add(a[i], b[i]);\n            return out;\n        },\n        sub: (a, b) => {\n            const len = checkLength(a, b);\n            const out = _create(len);\n            for (let i = 0; i < len; i++)\n                out[i] = F.sub(a[i], b[i]);\n            return out;\n        },\n        dot: (a, b) => {\n            const len = checkLength(a, b);\n            const out = _create(len);\n            for (let i = 0; i < len; i++)\n                out[i] = F.mul(a[i], b[i]);\n            return out;\n        },\n        mul: (a, b) => {\n            if (isPoly(b)) {\n                const len = checkLength(a, b);\n                if (fft) {\n                    const A = fft.direct(a, false, true);\n                    const B = fft.direct(b, false, true);\n                    for (let i = 0; i < A.length; i++)\n                        A[i] = F.mul(A[i], B[i]);\n                    return fft.inverse(A, true, false);\n                }\n                else {\n                    // NOTE: this is quadratic and mostly for compat tests with FFT\n                    const res = _create(len);\n                    for (let i = 0; i < len; i++) {\n                        for (let j = 0; j < len; j++) {\n                            const k = (i + j) % len; // wrap mod length\n                            res[k] = F.add(res[k], F.mul(a[i], b[j]));\n                        }\n                    }\n                    return res;\n                }\n            }\n            else {\n                const out = _create(checkLength(a));\n                for (let i = 0; i < out.length; i++)\n                    out[i] = F.mul(a[i], b);\n                return out;\n            }\n        },\n        convolve(a, b) {\n            checkPoly('a', a);\n            checkPoly('b', b);\n            const len = nextPowerOfTwo(a.length + b.length - 1);\n            return this.mul(this.extend(a, len), this.extend(b, len));\n        },\n        shift(p, factor) {\n            checkPoly('p', p);\n            const out = _create(p.length);\n            if (length !== undefined && p.length !== length)\n                throw new Error(`poly: expected fixed length ${length}, got ${p.length}`);\n            if (!p.length)\n                return out;\n            out[0] = p[0];\n            for (let i = 1, power = F.ONE; i < p.length; i++) {\n                power = F.mul(power, factor);\n                out[i] = F.mul(p[i], power);\n            }\n            return out;\n        },\n        clone: (a) => {\n            checkLength(a);\n            const out = _create(a.length);\n            for (let i = 0; i < a.length; i++)\n                out[i] = a[i];\n            return out;\n        },\n        eval: (a, basis) => {\n            checkLength(a, basis);\n            let acc = F.ZERO;\n            for (let i = 0; i < a.length; i++)\n                acc = F.add(acc, F.mul(a[i], basis[i]));\n            return acc;\n        },\n        monomial: {\n            basis: (x, n) => {\n                const out = _create(n);\n                let pow = F.ONE;\n                for (let i = 0; i < n; i++) {\n                    out[i] = pow;\n                    pow = F.mul(pow, x);\n                }\n                return out;\n            },\n            eval: (a, x) => {\n                checkLength(a);\n                // Same as eval(a, monomialBasis(x, a.length)), but it is faster this way\n                let acc = F.ZERO;\n                for (let i = a.length - 1; i >= 0; i--)\n                    acc = F.add(F.mul(acc, x), a[i]);\n                return acc;\n            },\n        },\n        lagrange: {\n            basis: (x, n, brp = false, weights) => {\n                if (!isPowerOfTwo(n))\n                    throw new Error('poly.lagrange: expected power of two length, got ' + n);\n                const bits = log2(n);\n                const cache = weights || (brp ? roots.brp(bits) : roots.roots(bits)); // [ω⁰, ω¹, ..., ωⁿ⁻¹]\n                const out = _create(n);\n                // Fast Kronecker-δ shortcut\n                const idx = findOmegaIndex(x, n, brp, weights);\n                if (idx !== -1) {\n                    out[idx] = F.ONE;\n                    return out;\n                }\n                const tm = F.pow(x, BigInt(n));\n                const c = F.mul(F.sub(tm, F.ONE), F.inv(BigInt(n))); // c = (xⁿ - 1)/n\n                const denom = _create(n);\n                for (let i = 0; i < n; i++)\n                    denom[i] = F.sub(x, cache[i]);\n                const inv = F.invertBatch(denom);\n                for (let i = 0; i < n; i++)\n                    out[i] = F.mul(c, F.mul(cache[i], inv[i]));\n                return out;\n            },\n            eval(a, x, brp = false) {\n                checkLength(a);\n                const idx = findOmegaIndex(x, a.length, brp);\n                if (idx !== -1)\n                    return a[idx]; // fast path\n                const L = this.basis(x, a.length, brp); // Lᵢ(x)\n                let acc = F.ZERO;\n                for (let i = 0; i < a.length; i++)\n                    if (!F.is0(a[i]))\n                        acc = F.add(acc, F.mul(a[i], L[i]));\n                return acc;\n            },\n        },\n        vanishing(roots) {\n            checkPoly('roots', roots);\n            if (length !== undefined && roots.length !== length)\n                throw new Error(`poly: expected fixed length ${length}, got ${roots.length}`);\n            const out = _create(roots.length + 1, F.ZERO);\n            out[0] = F.ONE;\n            for (const r of roots) {\n                const neg = F.neg(r);\n                for (let j = out.length - 1; j > 0; j--)\n                    out[j] = F.add(F.mul(out[j], neg), out[j - 1]);\n                out[0] = F.mul(out[0], neg);\n            }\n            return out;\n        },\n    };\n}\n","/**\n * Utilities for hex, bytearray and number handling.\n * @module\n */\n/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */\nimport { abytes, abytes as abytes_, ahash as ahash_, anumber, bytesToHex, concatBytes, isBytes, isLE, randomBytes as randb, } from '@noble/hashes/utils.js';\n/**\n * Asserts that a value is a byte array and optionally checks its length.\n * Returns the original reference unchanged on success, and currently also accepts Node `Buffer`\n * values through the upstream validator.\n * This helper throws on malformed input, so APIs that must return `false` need to guard lengths\n * before decoding or before calling it.\n * @example\n * Validate that a value is a byte array with the expected length.\n * ```ts\n * abytes(new Uint8Array([1]), 1);\n * ```\n */\nconst abytesDoc = abytes;\nexport { abytesDoc as abytes };\n/**\n * Concatenates byte arrays into a new `Uint8Array`.\n * Zero arguments return an empty `Uint8Array`.\n * Invalid segments throw before allocation because each argument is validated first.\n * @example\n * Concatenate two byte arrays into one result.\n * ```ts\n * concatBytes(new Uint8Array([1]), new Uint8Array([2]));\n * ```\n */\nconst concatBytesDoc = concatBytes;\nexport { concatBytesDoc as concatBytes };\n/**\n * Returns cryptographically secure random bytes.\n * Requires `globalThis.crypto.getRandomValues` and throws if that API is unavailable.\n * `bytesLength` is validated by the upstream helper as a non-negative integer before allocation,\n * so negative and fractional values both throw instead of truncating through JS `ToIndex`.\n * @param bytesLength - Number of random bytes to generate.\n * @returns Fresh random bytes.\n * @example\n * Generate a fresh random seed.\n * ```ts\n * const seed = randomBytes(4);\n * ```\n */\nexport const randomBytes = randb;\nexport function aarray(item, title, inner = () => { }) {\n    if (!Array.isArray(item))\n        throw new TypeError(`\"${title}\" expected array, got type=${typeof item}`);\n    for (let i = 0; i < item.length; i++)\n        inner(item[i], `${title}[${i}]`);\n    return item;\n}\nexport function aobject(value, title = 'object') {\n    if (value === null || typeof value !== 'object' || Array.isArray(value))\n        throw new TypeError(title === 'object'\n            ? 'expected valid options object'\n            : `\"${title}\" expected object, got type=${typeof value}`);\n    return value;\n}\n/**\n * Compares two byte arrays in a length-constant way for equal lengths.\n * Inputs are validated as byte arrays; unequal lengths return `false` immediately.\n * @param a - First byte array.\n * @param b - Second byte array.\n * @returns Whether both arrays contain the same bytes.\n * @example\n * Compare two byte arrays for equality.\n * ```ts\n * equalBytes(new Uint8Array([1]), new Uint8Array([1]));\n * ```\n */\nexport function equalBytes(a, b) {\n    a = abytes(a);\n    b = abytes(b);\n    if (a.length !== b.length)\n        return false;\n    let diff = 0;\n    for (let i = 0; i < a.length; i++)\n        diff |= a[i] ^ b[i];\n    return diff === 0;\n}\n/**\n * Copies bytes into a fresh `Uint8Array`.\n * Returns a detached plain `Uint8Array` after validating that the input is real bytes.\n * @param bytes - Source bytes.\n * @returns Copy of the input bytes.\n * @example\n * Copy bytes into a fresh array.\n * ```ts\n * copyBytes(new Uint8Array([1, 2]));\n * ```\n */\nexport function copyBytes(bytes) {\n    // The typed-array constructor copies a typed-array source through its internal byte storage.\n    // Unlike `Uint8Array.from`, it does not invoke a subclass-overridden iterator. Keep the explicit\n    // validation because the constructor itself would also accept arrays and other typed arrays.\n    return new Uint8Array(abytes(bytes));\n}\n/**\n * Byte-swaps each 64-bit lane in place.\n * Falcon's exact binary64 tables are stored as little-endian byte payloads, so BE runtimes need\n * this boundary helper before aliasing them as host `Float64Array` lanes.\n * @param arr - Byte buffer whose length is a multiple of 8.\n * @returns The same buffer after in-place 64-bit lane byte swaps.\n * @example\n * Byte-swap one 64-bit lane in place.\n * ```ts\n * byteSwap64(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]));\n * ```\n */\nexport function byteSwap64(arr) {\n    const bytes = new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n    for (let i = 0; i < bytes.length; i += 8) {\n        const a0 = bytes[i + 0];\n        const a1 = bytes[i + 1];\n        const a2 = bytes[i + 2];\n        const a3 = bytes[i + 3];\n        bytes[i + 0] = bytes[i + 7];\n        bytes[i + 1] = bytes[i + 6];\n        bytes[i + 2] = bytes[i + 5];\n        bytes[i + 3] = bytes[i + 4];\n        bytes[i + 4] = a3;\n        bytes[i + 5] = a2;\n        bytes[i + 6] = a1;\n        bytes[i + 7] = a0;\n    }\n    return arr;\n}\n/**\n * Byte-swaps 64-bit lanes on big-endian runtimes and returns the input unchanged on little-endian.\n * This keeps Falcon's binary64 tables in canonical little-endian order before aliasing them as\n * `Float64Array` lanes on the current host.\n * @param arr - Buffer to pass through or swap in place.\n * @returns The same buffer, normalized for Falcon's little-endian table layout.\n * @example\n * Normalize one host-endian buffer for Falcon's float tables.\n * ```ts\n * baswap64If(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]));\n * ```\n */\nexport const baswap64If = isLE\n    ? (arr) => arr\n    : byteSwap64;\n/**\n * Validates that an options bag is a plain object.\n * @param opts - Options object to validate.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate that an options bag is a plain object.\n * ```ts\n * validateOpts({});\n * ```\n */\nexport function validateOpts(opts) {\n    // Arrays silently passed here before, but these call sites expect named option-bag fields.\n    if (isBytes(opts))\n        throw new TypeError('\"opts\" expected object, got Uint8Array');\n    aobject(opts, 'opts');\n    const proto = Object.getPrototypeOf(opts);\n    // Options are security parameters, not general class instances. Restricting the bag to own\n    // properties prevents values injected through Object.prototype (or a custom shared prototype)\n    // from silently changing signing behavior. Null-prototype records remain supported.\n    if (proto !== null && proto !== Object.prototype)\n        throw new TypeError('\"opts\" expected a plain object');\n}\n// Frozen because they are exported: an unfrozen array export lets anything in the\n// process push a key onto the accepted set and silently re-open exactly the hole this\n// validation closes.\n/** Keys accepted by `verify`. */\nexport const VER_OPT_KEYS = /* @__PURE__ */ Object.freeze([\n    'context',\n]);\n/** Keys accepted by `sign`. */\nexport const SIG_OPT_KEYS = /* @__PURE__ */ Object.freeze([\n    'context',\n    'extraEntropy',\n]);\n/**\n * Rejects option keys the caller did not mean to set.\n *\n * Validating the types of known keys while ignoring unknown ones makes a typo\n * indistinguishable from an omission, and for these options an omission is a\n * security downgrade rather than a no-op: `{ ctx }` instead of `{ context }` signs\n * with no domain separation, succeeds, and verifies for anyone who also supplies\n * none. Nothing at any layer reports it. TypeScript catches this through excess\n * property checks, so the exposure is JavaScript callers specifically.\n *\n * @param opts - Options object to check.\n * @param allowed - The keys this call site accepts.\n * Returns a frozen null-prototype snapshot so later reads cannot fall through to a polluted\n * prototype. Like `checkOpts()` in noble-hashes, only enumerable own properties are copied.\n * @throws If any other copied key is present or the bag has a custom prototype. {@link TypeError}\n * @returns Sanitized snapshot of the enumerable own options.\n * @example\n * Accept a known option key. A key the list does not name, such as `ctx`, throws instead.\n * ```ts\n * import { checkOptKeys } from '@noble/post-quantum/utils.js';\n * checkOptKeys({ context: new Uint8Array() }, ['context']);\n * ```\n */\nexport function checkOptKeys(opts, allowed) {\n    validateOpts(opts);\n    // Snapshot once before validation: Object.assign follows the same own-enumerable option-bag\n    // semantics as noble-hashes, while the null prototype keeps omitted fields immune to pollution.\n    const normalized = Object.assign(Object.create(null), opts);\n    for (const [k, v] of Object.entries(normalized)) {\n        // `undefined` means unset everywhere else in these validators, and building an options bag by\n        // spread is a normal way to reach these calls, so present-but-undefined stays equivalent to\n        // omission.\n        if (v === undefined)\n            continue;\n        if (!allowed.includes(k))\n            throw new TypeError('unexpected option \"' + String(k) + '\"; expected one of: ' + allowed.join(', '));\n    }\n    return Object.freeze(normalized);\n}\n/**\n * Validates common verification options.\n * `context` itself is validated with `abytes(...)`, and individual algorithms may narrow support\n * further after this shared plain-object gate.\n * @param opts - Verification options. See {@link VerOpts}.\n * @param allowed - Keys this call site accepts. Defaults to {@link VER_OPT_KEYS}; surfaces that\n * take extra keys, or take fewer, pass their own list.\n * @throws On wrong argument types. {@link TypeError}\n * @returns Frozen null-prototype snapshot of the validated options.\n * @example\n * Validate common verification options.\n * ```ts\n * validateVerOpts({ context: new Uint8Array([1]) });\n * ```\n */\nexport function validateVerOpts(opts, allowed = VER_OPT_KEYS) {\n    const normalized = checkOptKeys(opts, allowed);\n    if (normalized.context !== undefined)\n        abytes(normalized.context, undefined, 'opts.context');\n    return normalized;\n}\n/**\n * Validates common signing options.\n * `extraEntropy` is validated with `abytes(...)`; exact lengths and extra algorithm-specific\n * restrictions are enforced later by callers.\n * @param opts - Signing options. See {@link SigOpts}.\n * @param allowed - Keys this call site accepts. Defaults to {@link SIG_OPT_KEYS}; surfaces that\n * take extra keys, or take fewer, pass their own list.\n * @throws On wrong argument types. {@link TypeError}\n * @returns Frozen null-prototype snapshot of the validated options.\n * @example\n * Validate common signing options.\n * ```ts\n * validateSigOpts({ extraEntropy: new Uint8Array([1]) });\n * ```\n */\nexport function validateSigOpts(opts, allowed = SIG_OPT_KEYS) {\n    const normalized = checkOptKeys(opts, allowed);\n    if (normalized.context !== undefined)\n        abytes(normalized.context, undefined, 'opts.context');\n    if (normalized.extraEntropy !== false && normalized.extraEntropy !== undefined)\n        abytes(normalized.extraEntropy, undefined, 'opts.extraEntropy');\n    return normalized;\n}\n/**\n * Builds a fixed-layout coder from byte lengths and nested coders.\n * Raw-length fields decode as zero-copy `subarray(...)` views, and nested coders may preserve that\n * aliasing too. Nested coder `encode(...)` results are treated as owned scratch: `splitCoder`\n * copies them into the output and then zeroizes them with `fill(0)`. If a nested encoder forwards\n * caller-owned bytes, it must do so only after detaching them into a disposable copy.\n * @param label - Label used in validation errors.\n * @param lengths - Field lengths or nested coders.\n * @returns Composite fixed-length coder.\n * @example\n * Build a fixed-layout coder from byte lengths and nested coders.\n * ```ts\n * splitCoder('demo', 1, 2).encode([new Uint8Array([1]), new Uint8Array([2, 3])]);\n * ```\n */\nexport function splitCoder(label, ...lengths) {\n    const getLength = (c) => typeof c === 'number' ? c : c.bytesLen;\n    const bytesLen = lengths.reduce((sum, a) => sum + getLength(a), 0);\n    return {\n        bytesLen,\n        encode: (bufs) => {\n            const res = new Uint8Array(bytesLen);\n            for (let i = 0, pos = 0; i < lengths.length; i++) {\n                const c = lengths[i];\n                const l = getLength(c);\n                const b = typeof c === 'number' ? bufs[i] : c.encode(bufs[i]);\n                abytes_(b, l, label);\n                res.set(b, pos);\n                if (typeof c !== 'number')\n                    b.fill(0); // clean\n                pos += l;\n            }\n            return res;\n        },\n        decode: (buf) => {\n            abytes_(buf, bytesLen, label);\n            const res = [];\n            for (const c of lengths) {\n                const l = getLength(c);\n                const b = buf.subarray(0, l);\n                res.push(typeof c === 'number' ? b : c.decode(b));\n                buf = buf.subarray(l);\n            }\n            return res;\n        },\n    };\n}\n// nano-packed.array (fixed size)\n/**\n * Builds a fixed-length vector coder from another fixed-length coder.\n * Element decoding receives `subarray(...)` views, so aliasing depends on the element coder.\n * Element coder `encode(...)` results are treated as owned scratch: `vecCoder` copies them into\n * the output and then zeroizes them with `fill(0)`. If an element encoder forwards caller-owned\n * bytes, it must do so only after detaching them into a disposable copy. `vecCoder` also trusts\n * the `BytesCoderLen` contract: each encoded element must already be exactly `c.bytesLen` bytes.\n * @param c - Element coder.\n * @param vecLen - Number of elements in the vector.\n * @returns Fixed-length vector coder.\n * @example\n * Build a fixed-length vector coder from another fixed-length coder.\n * ```ts\n * vecCoder(\n *   { bytesLen: 1, encode: (n: number) => Uint8Array.of(n), decode: (b: Uint8Array) => b[0] || 0 },\n *   2\n * ).encode([1, 2]);\n * ```\n */\nexport function vecCoder(c, vecLen) {\n    const coder = c;\n    const bytesLen = vecLen * coder.bytesLen;\n    return {\n        bytesLen,\n        encode: (u) => {\n            const uArr = aarray(u, 'u');\n            if (uArr.length !== vecLen)\n                throw new RangeError(`vecCoder.encode: wrong length=${uArr.length}. Expected: ${vecLen}`);\n            const res = new Uint8Array(bytesLen);\n            for (let i = 0, pos = 0; i < uArr.length; i++) {\n                const b = coder.encode(uArr[i]);\n                res.set(b, pos);\n                b.fill(0); // clean\n                pos += b.length;\n            }\n            return res;\n        },\n        decode: (a) => {\n            abytes_(a, bytesLen);\n            const r = [];\n            for (let i = 0; i < a.length; i += coder.bytesLen)\n                r.push(coder.decode(a.subarray(i, i + coder.bytesLen)));\n            return r;\n        },\n    };\n}\n/**\n * Overwrites supported typed-array inputs with zeroes in place.\n * Accepts direct typed arrays and one-level arrays of them.\n * @param list - Typed arrays or one-level lists of typed arrays to clear.\n * @example\n * Overwrite typed arrays with zeroes.\n * ```ts\n * const buf = Uint8Array.of(1, 2, 3);\n * cleanBytes(buf);\n * ```\n */\nexport function cleanBytes(...list) {\n    for (const t of list) {\n        if (Array.isArray(t))\n            for (const b of t)\n                b.fill(0);\n        else\n            t.fill(0);\n    }\n}\n/**\n * Creates a 32-bit mask with the lowest `bits` bits set.\n * @param bits - Number of low bits to keep.\n * @returns Bit mask with `bits` ones.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Create a low-bit mask for packed-field operations.\n * ```ts\n * const mask = getMask(4);\n * ```\n */\nexport function getMask(bits) {\n    anumber(bits, 'bits');\n    if (bits > 32)\n        throw new RangeError('\"bits\" expected <= 32, got ' + bits);\n    // JS shifts are modulo 32, so bit 32 needs an explicit full-width mask.\n    return bits === 32 ? 0xffffffff : ~(-1 << bits) >>> 0;\n}\n/** Shared empty byte array used as the default context. */\nexport const EMPTY = /* @__PURE__ */ Uint8Array.of();\n/**\n * Builds the domain-separated message payload for the pure sign/verify paths.\n * Context length `255` is valid; only `ctx.length > 255` is rejected.\n * @param msg - Message bytes.\n * @param ctx - Optional context bytes.\n * @returns Domain-separated message payload.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Build the domain-separated payload before direct signing.\n * ```ts\n * const payload = getMessage(new Uint8Array([1, 2]));\n * ```\n */\nexport function getMessage(msg, ctx = EMPTY) {\n    abytes_(msg, undefined, 'msg');\n    abytes_(ctx, undefined, 'ctx');\n    if (ctx.length > 255)\n        throw new RangeError('context should be 255 bytes or less');\n    return concatBytes(new Uint8Array([0, ctx.length]), ctx, msg);\n}\n// DER tag+length plus the shared NIST hash OID arc 2.16.840.1.101.3.4.2.* used by the\n// FIPS 204 / FIPS 205 pre-hash wrappers; the final byte selects SHA-256, SHA-512, SHAKE128,\n// SHAKE256, or another approved hash/XOF under that subtree.\n// 06 09 60 86 48 01 65 03 04 02\nconst oidNistP = /* @__PURE__ */ Uint8Array.from([6, 9, 0x60, 0x86, 0x48, 1, 0x65, 3, 4, 2]);\n/**\n * Output length, in bytes, that each XOF OID under this arc denotes.\n *\n * Unlike a fixed hash, an XOF's OID is a promise about the digest length: RFC 8702\n * defines id-shake128 as SHAKE128 with 256-bit output and id-shake256 as SHAKE256 with\n * 512-bit output, and FIPS 204 / FIPS 205 use exactly those pairings for pre-hash. Both\n * bare noble-hashes defaults are half these values, so neither can be signed under its\n * own OID.\n */\nconst XOF_OID_OUTPUT_LEN = /* @__PURE__ */ (() => ({\n    '060960864801650304020b': 32, // id-shake128, SHAKE128(M, 256)\n    '060960864801650304020c': 64, // id-shake256, SHAKE256(M, 512)\n}))();\n/**\n * Validates that a hash exposes a NIST hash OID and enough collision resistance.\n * Current accepted surface is broader than the FIPS algorithm tables: any hash/XOF under the NIST\n * `2.16.840.1.101.3.4.2.*` subtree is accepted if its effective `outputLen` is strong enough.\n * XOF callers must pass a callable whose `outputLen` matches the digest length they actually intend\n * to sign; bare `shake128` / `shake256` defaults are too short for the stronger prehash modes.\n * @param hash - Hash function to validate.\n * @param requiredStrength - Minimum required collision-resistance strength in bits.\n * @throws If the hash metadata or collision resistance is insufficient. {@link Error}\n * @example\n * Validate that a hash exposes a NIST hash OID and enough collision resistance.\n * ```ts\n * import { sha256 } from '@noble/hashes/sha2.js';\n * import { checkHash } from '@noble/post-quantum/utils.js';\n * checkHash(sha256, 128);\n * ```\n */\nexport function checkHash(hash, requiredStrength = 0) {\n    if (typeof hash !== 'function' || typeof hash.create !== 'function')\n        throw new TypeError('\"hash\" expected hash function, got type=' + typeof hash);\n    ahash_(hash);\n    anumber(requiredStrength, 'requiredStrength');\n    const oid = hash.oid;\n    abytes_(oid, undefined, 'hash.oid');\n    if (!equalBytes(oid.subarray(0, 10), oidNistP))\n        throw new Error('\"hash.oid\" is invalid: expected NIST hash');\n    // FIPS 204 / FIPS 205 require both collision and second-preimage strength; for approved NIST\n    // hashes/XOFs under this OID subtree, the collision bound from the configured digest length is\n    // the tighter runtime check, so enforce that lower bound here.\n    // XOFs under this arc are identified by an OID that fixes their output length:\n    // FIPS 204 §5.4.1 (SHAKE128) and FIPS 205 §10.2.2 (both SHAKEs), matching RFC 8702, pair\n    // id-shake128 with SHAKE128(M, 256) and id-shake256 with SHAKE256(M, 512). getMessagePrehash embeds\n    // hash.oid beside hash(msg), so a shorter digest signs an M' that claims a length\n    // it does not have: noble-hashes' bare shake256 defaults to 32 bytes and cleared\n    // the collision bound at the 128-bit level, producing signatures a conformant\n    // verifier rejects because it recomputes 512 bits. Check the length the OID\n    // denotes rather than the generic bound.\n    const xofLen = XOF_OID_OUTPUT_LEN[bytesToHex(oid)];\n    if (xofLen !== undefined && hash.outputLen !== xofLen) {\n        throw new Error('Pre-hash XOF output length must be ' + xofLen + ' bytes for this OID, got: ' + hash.outputLen);\n    }\n    const collisionResistance = (hash.outputLen * 8) / 2;\n    if (requiredStrength > collisionResistance) {\n        throw new Error('Pre-hash security strength too low: ' +\n            collisionResistance +\n            ', required: ' +\n            requiredStrength);\n    }\n}\n/**\n * Builds the domain-separated prehash payload for the prehash sign/verify paths.\n * Callers are expected to vet `hash.oid` first, e.g. via `checkHash(...)`; calling this helper\n * directly with a hash object that lacks `oid` currently throws later inside `concatBytes(...)`.\n * Context length `255` is valid; only `ctx.length > 255` is rejected.\n * @param hash - Prehash function.\n * @param msg - Message bytes.\n * @param ctx - Optional context bytes.\n * @returns Domain-separated prehash payload.\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Build the domain-separated prehash payload for external hashing.\n * ```ts\n * import { sha256 } from '@noble/hashes/sha2.js';\n * import { getMessagePrehash } from '@noble/post-quantum/utils.js';\n * getMessagePrehash(sha256, new Uint8Array([1, 2]));\n * ```\n */\nexport function getMessagePrehash(hash, msg, ctx = EMPTY) {\n    checkHash(hash);\n    abytes_(msg, undefined, 'msg');\n    abytes_(ctx, undefined, 'ctx');\n    if (ctx.length > 255)\n        throw new RangeError('context should be 255 bytes or less');\n    const hashed = hash(msg);\n    return concatBytes(new Uint8Array([1, ctx.length]), ctx, hash.oid, hashed);\n}\n/**\n * Asserts something is a string.\n * @param value - Value to validate.\n * @param title - Label included in thrown errors.\n * @returns The validated string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Validate a label string.\n *\n * ```ts\n * astring('example', 'label');\n * ```\n */\nexport function astring(value, title = '') {\n    if (typeof value !== 'string') {\n        const prefix = title && `\"${title}\" `;\n        throw new TypeError(prefix + 'expected string, got type=' + typeof value);\n    }\n    return value;\n}\n","/**\n * Internal methods for lattice-based ML-KEM and ML-DSA.\n * @module\n */\n/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */\nimport { FFTCore, reverseBits } from '@noble/curves/abstract/fft.js';\nimport { shake128, shake256 } from '@noble/hashes/sha3.js';\nimport { cleanBytes, getMask, } from \"./utils.js\";\n/**\n * Creates shared modular arithmetic, NTT, and packing helpers for CRYSTALS schemes.\n * @param opts - Polynomial and transform parameters. See {@link CrystalOpts}.\n * @returns CRYSTALS arithmetic and encoding helpers.\n * @example\n * Create shared modular arithmetic and NTT helpers for a CRYSTALS parameter set.\n * ```ts\n * const crystals = genCrystals({\n *   newPoly: (n) => new Uint16Array(n),\n *   N: 256,\n *   Q: 3329,\n *   F: 3303,\n *   ROOT_OF_UNITY: 17,\n *   brvBits: 7,\n *   isKyber: true,\n * });\n * const reduced = crystals.mod(-1);\n * ```\n */\nexport const genCrystals = (opts) => {\n    // isKyber: true means Kyber, false means Dilithium\n    const { newPoly, N, Q, F, ROOT_OF_UNITY, brvBits, isKyber } = opts;\n    // Normalize JS `%` into the canonical Z_m representative `[0, modulo-1]` expected by\n    // FIPS 203 §2.3 / FIPS 204 §2.3 before downstream mod-q arithmetic.\n    const mod = (a, modulo = Q) => {\n        const result = (a % modulo) | 0;\n        return (result >= 0 ? result | 0 : (modulo + result) | 0) | 0;\n    };\n    // FIPS 204 §7.4 uses the centered `mod ±` representative for low bits, keeping the\n    // positive midpoint when `modulo` is even.\n    // Center to `[-floor((modulo-1)/2), floor(modulo/2)]`.\n    const smod = (a, modulo = Q) => {\n        const r = mod(a, modulo) | 0;\n        return (r > modulo >> 1 ? (r - modulo) | 0 : r) | 0;\n    };\n    // Kyber uses the FIPS 203 Appendix A `BitRev_7` table here via the first 128 entries, while\n    // Dilithium uses the FIPS 204 §7.5 / Appendix B `BitRev_8` zetas table over all 256 entries.\n    function getZettas() {\n        const out = newPoly(N);\n        for (let i = 0; i < N; i++) {\n            const b = reverseBits(i, brvBits);\n            const p = BigInt(ROOT_OF_UNITY) ** BigInt(b) % BigInt(Q);\n            out[i] = Number(p) | 0;\n        }\n        return out;\n    }\n    const nttZetas = getZettas();\n    // Number-Theoretic Transform\n    // Explained: https://electricdusk.com/ntt.html\n    // Kyber has slightly different params, since there is no 512th primitive root of unity mod q,\n    // only 256th primitive root of unity mod. Which also complicates MultiplyNTT.\n    const inv = (_a) => {\n        throw new Error('not implemented');\n    };\n    // ML-KEM (Kyber) polynomials always enter the transform reduced to [0, Q), so add/sub only\n    // need one conditional correction instead of `%`; measured ~20% faster NTT there.\n    // ML-DSA keeps the generic mod() path on purpose: its first forward stage sees centered\n    // (negative) coefficients, and `sub(a, t)` can drop below -Q (t is a mul output in [0, Q)),\n    // so a single correction is not enough. A guarded fast path with mod() fallback was measured\n    // slower than plain `%` for the 23-bit Q (V8 int32 modulo is one div; the branches lose).\n    const field = isKyber\n        ? {\n            add: (a, b) => {\n                const r = (a + b) | 0;\n                return r >= Q ? (r - Q) | 0 : r;\n            },\n            sub: (a, b) => {\n                const r = (a - b) | 0;\n                return r < 0 ? (r + Q) | 0 : r;\n            },\n            mul: (a, b) => mod((a | 0) * (b | 0)) | 0,\n            inv,\n        }\n        : {\n            add: (a, b) => mod((a | 0) + (b | 0)) | 0,\n            sub: (a, b) => mod((a | 0) - (b | 0)) | 0,\n            mul: (a, b) => mod((a | 0) * (b | 0)) | 0,\n            inv,\n        };\n    const nttOpts = {\n        N,\n        roots: nttZetas,\n        invertButterflies: true,\n        skipStages: isKyber ? 1 : 0,\n        brp: false,\n    };\n    const dif = FFTCore(field, { dit: false, ...nttOpts });\n    const dit = FFTCore(field, { dit: true, ...nttOpts });\n    const NTT = {\n        encode: (r) => {\n            return dif(r);\n        },\n        decode: (r) => {\n            dit(r);\n            // The inverse-NTT normalization factor is family-specific: FIPS 203 Algorithm 10 line 14\n            // uses `128^-1 mod q` for Kyber, while FIPS 204 Algorithm 42 lines 21-23 use `256^-1 mod q`.\n            // kyber uses 128 here, because brv && stuff\n            for (let i = 0; i < r.length; i++)\n                r[i] = mod(F * r[i]);\n            return r;\n        },\n    };\n    // Pack one little-endian `d`-bit word per coefficient, matching FIPS 203 ByteEncode /\n    // ByteDecode and the FIPS 204 BitsToBytes-based polynomial packing helpers.\n    const bitsCoder = (d, c) => {\n        // Validate the carry shape once: JS bitwise operations silently truncate wider accumulators.\n        for (let i = 0, bufLen = 0; i < N; i++) {\n            bufLen += d;\n            if (bufLen > 32)\n                getMask(bufLen);\n            bufLen %= 8;\n        }\n        const mask = getMask(d);\n        const bytesLen = d * (N / 8);\n        return {\n            bytesLen,\n            encode: (poly_) => {\n                const poly = poly_;\n                const r = new Uint8Array(bytesLen);\n                for (let i = 0, buf = 0, bufLen = 0, pos = 0; i < poly.length; i++) {\n                    buf |= (c.encode(poly[i]) & mask) << bufLen;\n                    bufLen += d;\n                    // Take the low byte directly: `& 0xff` matches the previous getMask(bufLen) result\n                    // after Uint8Array truncation, without a validated function call per output byte.\n                    for (; bufLen >= 8; bufLen -= 8, buf >>= 8)\n                        r[pos++] = buf & 0xff;\n                }\n                return r;\n            },\n            decode: (bytes) => {\n                const r = newPoly(N);\n                for (let i = 0, buf = 0, bufLen = 0, pos = 0; i < bytes.length; i++) {\n                    buf |= bytes[i] << bufLen;\n                    bufLen += 8;\n                    for (; bufLen >= d; bufLen -= d, buf >>= d)\n                        r[pos++] = c.decode(buf & mask);\n                }\n                return r;\n            },\n        };\n    };\n    return {\n        mod,\n        smod,\n        nttZetas: nttZetas,\n        NTT: {\n            encode: (r) => NTT.encode(r),\n            decode: (r) => NTT.decode(r),\n        },\n        bitsCoder: bitsCoder,\n    };\n};\nconst createXofShake = (shake) => (seed, blockLen) => {\n    if (!blockLen)\n        blockLen = shake.blockLen;\n    // Optimizations that won't mater:\n    // - cached seed update (two .update(), on start and on the end)\n    // - another cache which cloned into working copy\n    // Faster than multiple updates, since seed less than blockLen\n    const _seed = new Uint8Array(seed.length + 2);\n    _seed.set(seed);\n    const seedLen = seed.length;\n    const buf = new Uint8Array(blockLen); // == shake128.blockLen\n    let h = shake.create({});\n    let calls = 0;\n    let xofs = 0;\n    return {\n        stats: () => ({ calls, xofs }),\n        get: (x, y) => {\n            // Rebind to `seed || x || y` so callers can implement the spec's per-coordinate\n            // SHAKE inputs like `rho || j || i` and `rho || IntegerToBytes(counter, 2)`.\n            _seed[seedLen + 0] = x;\n            _seed[seedLen + 1] = y;\n            h.destroy();\n            h = shake.create({}).update(_seed);\n            calls++;\n            return () => {\n                xofs++;\n                return h.xofInto(buf);\n            };\n        },\n        clean: () => {\n            h.destroy();\n            cleanBytes(buf, _seed);\n        },\n    };\n};\n/**\n * SHAKE128-based extendable-output reader factory used by ML-KEM.\n * `get(x, y)` selects one coordinate pair at a time; calling it again invalidates previously\n * returned readers, and each squeeze reuses one mutable internal output buffer.\n * @param seed - Seed bytes for the reader.\n * @param blockLen - Optional output block length.\n * @returns Stateful XOF reader.\n * @example\n * Build the ML-KEM SHAKE128 matrix expander and read one block.\n * ```ts\n * import { randomBytes } from '@noble/post-quantum/utils.js';\n * import { XOF128 } from '@noble/post-quantum/_crystals.js';\n * const reader = XOF128(randomBytes(32));\n * const block = reader.get(0, 0)();\n * ```\n */\nexport const XOF128 = /* @__PURE__ */ createXofShake(shake128);\n/**\n * SHAKE256-based extendable-output reader factory used by ML-DSA.\n * `get(x, y)` appends raw one-byte coordinates to the seed, invalidates previously returned\n * readers, and reuses one mutable internal output buffer for each squeeze.\n * @param seed - Seed bytes for the reader.\n * @param blockLen - Optional output block length.\n * @returns Stateful XOF reader.\n * @example\n * Build the ML-DSA SHAKE256 coefficient expander and read one block.\n * ```ts\n * import { randomBytes } from '@noble/post-quantum/utils.js';\n * import { XOF256 } from '@noble/post-quantum/_crystals.js';\n * const reader = XOF256(randomBytes(32));\n * const block = reader.get(0, 0)();\n * ```\n */\nexport const XOF256 = /* @__PURE__ */ createXofShake(shake256);\n","/**\n * ML-KEM: Module Lattice-based Key Encapsulation Mechanism from\n * [FIPS-203](https://csrc.nist.gov/pubs/fips/203/ipd). A.k.a. CRYSTALS-Kyber.\n *\n * Key encapsulation is similar to DH / ECDH (think X25519), with important differences:\n * * Unlike in ECDH, we can't verify if it was \"Bob\" who've sent the shared secret\n * * Unlike ECDH, it is probabalistic and relies on quality of randomness (CSPRNG).\n * * Decapsulation never throws an error, even when shared secret was\n *   encrypted by a different public key. It will just return a different shared secret.\n *\n * There are some concerns with regards to security: see\n * [djb blog](https://blog.cr.yp.to/20231003-countcorrectly.html) and\n * [mailing list](https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/W2VOzy0wz_E).\n *\n * Has similar internals to ML-DSA, but their keys and params are different.\n *\n * Check out [official site](https://www.pq-crystals.org/kyber/resources.shtml),\n * [repo](https://github.com/pq-crystals/kyber),\n * [spec](https://datatracker.ietf.org/doc/draft-cfrg-schwabe-kyber/).\n * @module\n */\n/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */\nimport { sha3_256, sha3_512, shake256 } from '@noble/hashes/sha3.js';\nimport { swap32IfBE, u32 } from '@noble/hashes/utils.js';\nimport { genCrystals, XOF128 } from \"./_crystals.js\";\nimport { abytes, cleanBytes, copyBytes, equalBytes, getMask, randomBytes, splitCoder, vecCoder, } from \"./utils.js\";\n/** Key encapsulation mechanism interface */\nconst N = 256; // Kyber (not FIPS-203) supports different lengths, but all std modes were using 256\nconst Q = 3329; // 13*(2**8)+1, modulo prime\nconst F = 3303; // 3303 ≡ 128**(−1) mod q (FIPS-203)\nconst ROOT_OF_UNITY = 17; // ζ = 17 ∈ Zq is a primitive 256-th root of unity modulo Q. ζ**128 ≡−1\n// treeshake: keep genCrystals behind the object so PARAMS-only bundles can drop it entirely.\n// Shared CRYSTALS helper in the ML-KEM branch: Kyber mode, 7-bit bit-reversal,\n// and Uint16Array polys because current coefficients stay reduced modulo q.\nconst crystals = /* @__PURE__ */ genCrystals({\n    N,\n    Q,\n    F,\n    ROOT_OF_UNITY,\n    newPoly: (n) => new Uint16Array(n),\n    brvBits: 7,\n    isKyber: true,\n});\n/** Internal params of ML-KEM versions */\n// prettier-ignore\n/** Built-in ML-KEM parameter presets keyed by the public export names\n * `ml_kem512` / `ml_kem768` / `ml_kem1024`.\n * `RBGstrength` is Table 2's required randomness-source strength in bits,\n * not a generic security label.\n */\nexport const PARAMS = /* @__PURE__ */ (() => Object.freeze({\n    512: Object.freeze({ N, Q, K: 2, ETA1: 3, ETA2: 2, du: 10, dv: 4, RBGstrength: 128 }),\n    768: Object.freeze({ N, Q, K: 3, ETA1: 2, ETA2: 2, du: 10, dv: 4, RBGstrength: 192 }),\n    1024: Object.freeze({ N, Q, K: 4, ETA1: 2, ETA2: 2, du: 11, dv: 5, RBGstrength: 256 }),\n}))();\n// FIPS-203: compress/decompress\nconst compress = (d) => {\n    // d=12 is the ByteEncode12/ByteDecode12 path, not lossy compression.\n    // ByteDecode12 interprets each 12-bit word modulo q; without that reduction the public-key\n    // modulus check in encapsulate() becomes a no-op for malformed coefficients like 4095.\n    if (d >= 12)\n        return { encode: (i) => i, decode: (i) => (i >= Q ? i - Q : i) };\n    // Comments map to python implementation in RFC (draft-cfrg-schwabe-kyber)\n    // const round = (i: number) => Math.floor(i + 0.5) | 0;\n    const a = 2 ** (d - 1);\n    return {\n        // This only matches standalone Compress_d after bitsCoder masks the result into Z_(2^d).\n        encode: (i) => ((i << d) + Q / 2) / Q,\n        // const decompress = (i: number) => round((Q / 2 ** d) * i);\n        decode: (i) => (i * Q + a) >>> d,\n    };\n};\n// Raw ByteEncode_d / ByteDecode_d from FIPS 203 operate on d-bit words directly.\n// That differs from `polyCoder(d)` for d<12, where noble folds packing together with the lossy\n// ciphertext compression step used by u/v. Tests that exercise the spec's raw packing surface need\n// this exact non-lossy variant instead.\nconst byteCoder = (d) => crystals.bitsCoder(d, d === 12\n    ? { encode: (i) => i, decode: (i) => (i >= Q ? i - Q : i) }\n    : { encode: (i) => i, decode: (i) => i });\n// NOTE: we merge encoding and compress because it is faster, also both require same d param\n// d=12 is the ByteEncode12/ByteDecode12 path rather than compression, and caller-side\n// public-key modulus checks route through this helper's decode/encode roundtrip.\n// Converts between bytes and d-bits compressed representation.\n// Kinda like convertRadix2 from @scure/base.\n// decode(encode(t)) == t, but there is loss of information on encode(decode(t))\nconst polyCoder = (d) => (d === 12 ? byteCoder(12) : crystals.bitsCoder(d, compress(d)));\n// Coefficients always stay reduced in [0, Q) here (samplers, NTT and coders all reduce),\n// so one conditional correction replaces the generic mod().\nfunction polyAdd(a_, b_) {\n    const a = a_;\n    const b = b_;\n    // Mutates `a` in place; callers must pass two N=256 polynomials.\n    for (let i = 0; i < N; i++) {\n        const r = a[i] + b[i]; // a += b\n        a[i] = r >= Q ? r - Q : r;\n    }\n}\nfunction polySub(a_, b_) {\n    const a = a_;\n    const b = b_;\n    // Mutates `a` in place; callers must pass two N=256 polynomials.\n    for (let i = 0; i < N; i++) {\n        const r = a[i] - b[i]; // a -= b\n        a[i] = r < 0 ? r + Q : r;\n    }\n}\n// FIPS-203: Computes the product of two degree-one polynomials with respect to a quadratic modulus\nfunction BaseCaseMultiply(a0, a1, b0, b1, zeta) {\n    // `zeta` here is Algorithm 11's γ = ζ^(2BitRev_7(i)+1).\n    // Reduce a1*b1 before multiplying by zeta: a1*b1*zeta would reach ~2^35, forcing JS engines\n    // into slow float fmod; with the extra reduction every intermediate fits int32.\n    const c0 = crystals.mod(crystals.mod(a1 * b1) * zeta + a0 * b0);\n    const c1 = crystals.mod(a0 * b1 + a1 * b0);\n    return { c0, c1 };\n}\n// FIPS-203: Computes the product (in the ring Tq) of two NTT representations.\n// Works in place on `f`; `g` is read-only and both inputs must already be in NTT form.\nfunction MultiplyNTTs(f_, g_) {\n    const f = f_;\n    const g = g_;\n    for (let i = 0; i < N / 2; i++) {\n        let z = crystals.nttZetas[64 + (i >> 1)];\n        if (i & 1)\n            z = -z;\n        const { c0, c1 } = BaseCaseMultiply(f[2 * i + 0], f[2 * i + 1], g[2 * i + 0], g[2 * i + 1], z);\n        f[2 * i + 0] = c0;\n        f[2 * i + 1] = c1;\n    }\n    return f;\n}\n// Return poly in NTT representation\nfunction SampleNTT(xof_) {\n    const xof = xof_;\n    // The reader must already bind the Algorithm 7 seed||j||i bytes\n    // and return block lengths divisible by 3.\n    const r = new Uint16Array(N);\n    for (let j = 0; j < N;) {\n        const b = xof();\n        if (b.length % 3)\n            throw new Error('SampleNTT: unaligned block');\n        for (let i = 0; j < N && i + 3 <= b.length; i += 3) {\n            const d1 = ((b[i + 0] >> 0) | (b[i + 1] << 8)) & 0xfff;\n            const d2 = ((b[i + 1] >> 4) | (b[i + 2] << 4)) & 0xfff;\n            if (d1 < Q)\n                r[j++] = d1;\n            if (j < N && d2 < Q)\n                r[j++] = d2;\n        }\n    }\n    return r;\n}\n// Sampling from the centered binomial distribution\n// Returns poly with small coefficients (noise/errors) stored modulo q in ordinary coefficient form.\n// Current callers only use Table 2 eta values {2,3} and PRF outputs of exactly 64*eta bytes.\nconst sampleCBDBytes = (buf, eta) => {\n    const r = new Uint16Array(N);\n    // CBD consumes the PRF bitstream in little-endian byte order; normalize the word view on BE,\n    // then swap it back so callers still observe `buf` as read-only.\n    const b32 = u32(buf);\n    swap32IfBE(b32);\n    let len = 0;\n    for (let i = 0, p = 0, bb = 0, t0 = 0; i < b32.length; i++) {\n        let b = b32[i];\n        for (let j = 0; j < 32; j++) {\n            bb += b & 1;\n            b >>= 1;\n            len += 1;\n            if (len === eta) {\n                t0 = bb;\n                bb = 0;\n            }\n            else if (len === 2 * eta) {\n                r[p++] = crystals.mod(t0 - bb);\n                bb = 0;\n                len = 0;\n            }\n        }\n    }\n    swap32IfBE(b32);\n    if (len)\n        throw new Error(`sampleCBD: leftover bits: ${len}`);\n    return r;\n};\nfunction sampleCBD(PRF_, seed, nonce, eta) {\n    const PRF = PRF_;\n    return sampleCBDBytes(PRF((eta * N) / 4, seed, nonce), eta);\n}\n// K-PKE\n// Internal ML-KEM subroutine only: exact 32-byte `seed` / `msg` inputs\n// come from Algorithms 13-15, and the helper mutates decoded temporary\n// polynomials in place while leaving caller byte arrays unchanged.\nconst genKPKE = (opts_) => {\n    const opts = opts_;\n    const { K, PRF, XOF, HASH512, ETA1, ETA2, du, dv } = opts;\n    const poly1 = polyCoder(1);\n    const polyV = polyCoder(dv);\n    const polyU = polyCoder(du);\n    const publicCoder = splitCoder('publicKey', vecCoder(polyCoder(12), K), 32);\n    const secretCoder = vecCoder(polyCoder(12), K);\n    const cipherCoder = splitCoder('ciphertext', vecCoder(polyU, K), polyV);\n    const seedCoder = splitCoder('seed', 32, 32);\n    // Algorithm 14 (K-PKE.Encrypt) core, after ek parsing. `tHat` and every poly returned by\n    // `getA(i, j)` are treated as disposable scratch: they are mutated in place and wiped/dropped,\n    // so callers holding cached copies must pass fresh copies.\n    const encryptCore = (tHat, getA, msg, seed) => {\n        const rHat = [];\n        for (let i = 0; i < K; i++)\n            rHat.push(crystals.NTT.encode(sampleCBD(PRF, seed, i, ETA1)));\n        const tmp2 = new Uint16Array(N);\n        const u = [];\n        for (let i = 0; i < K; i++) {\n            const e1 = sampleCBD(PRF, seed, K + i, ETA2);\n            const tmp = new Uint16Array(N);\n            for (let j = 0; j < K; j++) {\n                const aij = getA(i, j); // A[j][i], inplace transpose access\n                polyAdd(tmp, MultiplyNTTs(aij, rHat[j])); // t += aij * rHat[j]\n            }\n            polyAdd(e1, crystals.NTT.decode(tmp)); // e1 += tmp\n            u.push(e1);\n            polyAdd(tmp2, MultiplyNTTs(tHat[i], rHat[i])); // t2 += tHat[i] * rHat[i]\n            cleanBytes(tmp);\n        }\n        const e2 = sampleCBD(PRF, seed, 2 * K, ETA2);\n        polyAdd(e2, crystals.NTT.decode(tmp2)); // e2 += tmp2\n        const v = poly1.decode(msg); // encode plaintext m into polynomial v\n        polyAdd(v, e2); // v += e2\n        cleanBytes(tHat, rHat, tmp2, e2);\n        return cipherCoder.encode([u, v]);\n    };\n    return {\n        secretCoder,\n        lengths: {\n            secretKey: secretCoder.bytesLen,\n            publicKey: publicCoder.bytesLen,\n            cipherText: cipherCoder.bytesLen,\n        },\n        keygen: (seed) => {\n            abytes(seed, 32, 'seed');\n            const seedDst = new Uint8Array(33);\n            seedDst.set(seed);\n            // FIPS 203 Algorithm 13 appends the parameter-set byte `k`\n            // before `G(d || k)`, so expanding the same 32-byte seed\n            // under a different ML-KEM parameter set yields unrelated keys.\n            seedDst[32] = K;\n            const seedHash = HASH512(seedDst);\n            const [rho, sigma] = seedCoder.decode(seedHash);\n            const sHat = [];\n            const tHat = [];\n            for (let i = 0; i < K; i++)\n                sHat.push(crystals.NTT.encode(sampleCBD(PRF, sigma, i, ETA1)));\n            const x = XOF(rho);\n            for (let i = 0; i < K; i++) {\n                const e = crystals.NTT.encode(sampleCBD(PRF, sigma, K + i, ETA1));\n                for (let j = 0; j < K; j++) {\n                    const aji = SampleNTT(x.get(j, i)); // A[i][j], inplace\n                    polyAdd(e, MultiplyNTTs(aji, sHat[j]));\n                }\n                tHat.push(e); // t ← A ◦ s + e\n            }\n            x.clean();\n            const res = {\n                publicKey: publicCoder.encode([tHat, rho]),\n                secretKey: secretCoder.encode(sHat),\n            };\n            cleanBytes(rho, sigma, sHat, tHat, seedDst, seedHash);\n            return res;\n        },\n        encrypt: (publicKey, msg, seed) => {\n            const [tHat, rho] = publicCoder.decode(publicKey);\n            const x = XOF(rho);\n            const res = encryptCore(tHat, (i, j) => SampleNTT(x.get(i, j)), msg, seed);\n            x.clean();\n            return res;\n        },\n        // Expands the full Â matrix (public data derived from rho) once, so repeated encryptions\n        // against the same ek skip the K² SampleNTT XOF expansions. Cached polys are copied per\n        // call because encryptCore mutates its inputs in place.\n        prepare: (publicKey) => {\n            const [tHat, rho] = publicCoder.decode(publicKey);\n            const x = XOF(rho);\n            const A = [];\n            for (let i = 0; i < K; i++)\n                for (let j = 0; j < K; j++)\n                    A.push(SampleNTT(x.get(i, j)));\n            x.clean();\n            return {\n                encrypt: (msg, seed) => encryptCore(tHat.map((p) => p.slice()), (i, j) => A[i * K + j].slice(), msg, seed),\n                clean: () => cleanBytes(tHat, A),\n            };\n        },\n        decrypt: (cipherText, privateKey) => {\n            const [u, v] = cipherCoder.decode(cipherText);\n            const sk = secretCoder.decode(privateKey); // s  ← ByteDecode_12(dkPKE)\n            const tmp = new Uint16Array(N);\n            // tmp += sk[i] * u[i]\n            for (let i = 0; i < K; i++)\n                polyAdd(tmp, MultiplyNTTs(sk[i], crystals.NTT.encode(u[i])));\n            polySub(v, crystals.NTT.decode(tmp)); // w = v' - tmp\n            // `v` now holds w, from which the plaintext is just a 1-bit threshold away, so wipe it too.\n            // encode() allocates its own buffer, so the returned bytes do not alias `v`.\n            const res = poly1.encode(v);\n            cleanBytes(tmp, sk, u, v);\n            return res;\n        },\n    };\n};\n/**\n * Public ML-KEM wrapper over the internal K-PKE subroutine.\n * `keygen(seed)` and `encapsulate(publicKey, msg)` are deterministic/test-oriented hooks that map\n * more directly to Algorithms 16-17 than to the pure no-input / random-internal Algorithms 19-20.\n * `encapsulate`'s optional `msg` is the 32-byte message randomness `m` of Algorithm 17, the\n * pre-image the shared secret is derived from, NOT a plaintext to encrypt: ML-KEM is a key\n * encapsulation mechanism, not a cipher. Omit it to draw fresh randomness; pass it only to\n * reproduce a known-answer vector, and only as 32 uniformly random bytes, since a low-entropy or\n * reused value makes the shared secret predictable. The same holds for `keygen`'s optional `seed`.\n * decapsulate() tries to follow the Algorithms 18/21 implicit-reject structure as closely as\n * practical here by re-encrypting, comparing ciphertexts, returning `Khat` on match or `Kbar` on\n * mismatch, and zeroizing the non-returned shared-secret candidate; JS/JIT still provides no\n * constant-time guarantees for that path.\n */\nfunction createKyber(opts) {\n    const rawOpts = opts;\n    const KPKE = genKPKE(rawOpts);\n    const { HASH256, HASH512, KDF } = rawOpts;\n    const { secretCoder: KPKESecretCoder, lengths } = KPKE;\n    const secretCoder = splitCoder('secretKey', lengths.secretKey, lengths.publicKey, 32, 32);\n    const msgLen = 32;\n    const seedLen = 64;\n    // FIPS-203 includes additional verification check for modulus\n    const validateModulus = (publicKey, fn) => {\n        const eke = publicKey.subarray(0, 384 * rawOpts.K);\n        // Copy because of inplace encoding\n        const ek = KPKESecretCoder.encode(KPKESecretCoder.decode(copyBytes(eke)));\n        // (Modulus check.) Perform the computation ek ← ByteEncode12(ByteDecode12(eke)).\n        // If ek = ̸ eke, the input is invalid. (See Section 4.2.1.)\n        const ok = equalBytes(ek, eke);\n        cleanBytes(ek);\n        if (!ok)\n            throw new Error(`ML-KEM.${fn}: wrong publicKey modulus`);\n    };\n    const kemLengths = Object.freeze({\n        ...lengths,\n        seed: 64,\n        msg: msgLen,\n        msgRand: msgLen,\n        secretKey: secretCoder.bytesLen,\n    });\n    return Object.freeze({\n        info: Object.freeze({ type: 'ml-kem' }),\n        lengths: kemLengths,\n        keygen: (seed) => {\n            // A generated seed carries z (the implicit-rejection secret) and must be wiped once the\n            // secret key holds a copy, matching ml-dsa / slh-dsa / falcon keygen. A caller-supplied\n            // seed is the caller's to manage (and the immutability test requires it stay untouched).\n            const ownSeed = seed === undefined;\n            const s = ownSeed ? randomBytes(seedLen) : seed;\n            let sk;\n            let publicKeyHash;\n            try {\n                abytes(s, seedLen, 'seed');\n                const keys = KPKE.keygen(s.subarray(0, 32));\n                const publicKey = keys.publicKey;\n                sk = keys.secretKey;\n                publicKeyHash = HASH256(publicKey);\n                // (dkPKE||ek||H(ek)||z)\n                const secretKey = secretCoder.encode([sk, publicKey, publicKeyHash, s.subarray(32)]);\n                return {\n                    publicKey: publicKey,\n                    secretKey: secretKey,\n                };\n            }\n            finally {\n                if (sk !== undefined)\n                    cleanBytes(sk);\n                if (publicKeyHash !== undefined)\n                    cleanBytes(publicKeyHash);\n                if (ownSeed)\n                    cleanBytes(s);\n            }\n        },\n        getPublicKey: (secretKey) => {\n            const [_sk, publicKey, _publicKeyHash, _z] = secretCoder.decode(secretKey);\n            return Uint8Array.from(publicKey);\n        },\n        encapsulate: (publicKey, msg) => {\n            // A generated message is the preimage of the shared secret (K = G(m || H(ek))[0:32]) and\n            // must be wiped. A caller-supplied message is the deterministic-randomness hook and the\n            // caller's to manage (the immutability test requires it stay untouched).\n            const ownMsg = msg === undefined;\n            const m = ownMsg ? randomBytes(msgLen) : msg;\n            let kr;\n            try {\n                abytes(publicKey, lengths.publicKey, 'publicKey');\n                abytes(m, msgLen, 'message');\n                validateModulus(publicKey, 'encapsulate');\n                // derive randomness\n                kr = HASH512.create().update(m).update(HASH256(publicKey)).digest();\n                const cipherText = KPKE.encrypt(publicKey, m, kr.subarray(32, 64));\n                return {\n                    cipherText: cipherText,\n                    sharedSecret: kr.subarray(0, 32),\n                };\n            }\n            finally {\n                if (kr !== undefined)\n                    cleanBytes(kr.subarray(32));\n                if (ownMsg)\n                    cleanBytes(m);\n            }\n        },\n        decapsulate: (cipherText, secretKey) => {\n            abytes(secretKey, secretCoder.bytesLen, 'secretKey'); // 768*k + 96\n            abytes(cipherText, lengths.cipherText, 'cipherText'); // 32(du*k + dv)\n            // test ← H(dk[384𝑘 ∶ 768𝑘 + 32])) .\n            const k768 = secretCoder.bytesLen - 96;\n            const start = k768 + 32;\n            const test = HASH256(secretKey.subarray(k768 / 2, start));\n            // If test ≠ dk[768𝑘 + 32 ∶ 768𝑘 + 64], then input checking has failed.\n            if (!equalBytes(test, secretKey.subarray(start, start + 32)))\n                throw new Error('invalid secretKey: hash check failed');\n            const [sk, publicKey, publicKeyHash, z] = secretCoder.decode(secretKey);\n            const msg = KPKE.decrypt(cipherText, sk);\n            // derive randomness, Khat, rHat = G(mHat || h)\n            const kr = HASH512.create().update(msg).update(publicKeyHash).digest();\n            const Khat = kr.subarray(0, 32);\n            // re-encrypt using the derived randomness\n            const cipherText2 = KPKE.encrypt(publicKey, msg, kr.subarray(32, 64));\n            // if ciphertexts do not match, “implicitly reject”\n            const isValid = equalBytes(cipherText, cipherText2);\n            const Kbar = KDF.create({ dkLen: 32 }).update(z).update(cipherText).digest();\n            // kr[32:64] is the derived K-PKE encryption randomness: wipe it like encapsulate() does.\n            cleanBytes(msg, cipherText2, kr.subarray(32), !isValid ? Khat : Kbar);\n            return (isValid ? Khat : Kbar);\n        },\n        /**\n         * Experimental prototype: pre-expand a public key so repeated encapsulate/decapsulate\n         * against the same key skip re-validation, H(ek), t̂ decoding and the K² SampleNTT\n         * XOF expansions of Â. Only public data is cached; see {@link KEMPrepared}.\n         */\n        prepare: (publicKey) => {\n            abytes(publicKey, lengths.publicKey, 'publicKey');\n            validateModulus(publicKey, 'prepare');\n            const ek = copyBytes(publicKey); // detach from the caller before caching\n            const publicKeyHash = HASH256(ek);\n            const cached = KPKE.prepare(ek);\n            return Object.freeze({\n                publicKey: ek,\n                encapsulate: (msg) => {\n                    // As in the non-prepared encapsulate: a generated message is the shared-secret\n                    // preimage and is wiped; a caller-supplied one is left untouched.\n                    const ownMsg = msg === undefined;\n                    const m = ownMsg ? randomBytes(msgLen) : msg;\n                    let kr;\n                    try {\n                        abytes(m, msgLen, 'message');\n                        kr = HASH512.create().update(m).update(publicKeyHash).digest();\n                        const cipherText = cached.encrypt(m, kr.subarray(32, 64));\n                        return {\n                            cipherText: cipherText,\n                            sharedSecret: kr.subarray(0, 32),\n                        };\n                    }\n                    finally {\n                        if (kr !== undefined)\n                            cleanBytes(kr.subarray(32));\n                        if (ownMsg)\n                            cleanBytes(m);\n                    }\n                },\n                decapsulate: (cipherText, secretKey) => {\n                    abytes(secretKey, secretCoder.bytesLen, 'secretKey');\n                    abytes(cipherText, lengths.cipherText, 'cipherText');\n                    const [sk, ekEmbedded, storedHash, z] = secretCoder.decode(secretKey);\n                    // Under KEMPrepared's read-only publicKey contract, bind dk to the prepared key.\n                    // Together with publicKeyHash = H(ek) computed in prepare(), this is equivalent to (and\n                    // stronger than) FIPS 203 §7.3's `H(dk[384k : 768k+32]) == dk[768k+32 : 768k+64]`.\n                    if (!equalBytes(ekEmbedded, ek) || !equalBytes(storedHash, publicKeyHash))\n                        throw new Error('ML-KEM.decapsulate: secretKey does not match prepared publicKey');\n                    const msg = KPKE.decrypt(cipherText, sk);\n                    // derive randomness, Khat, rHat = G(mHat || h)\n                    const kr = HASH512.create().update(msg).update(publicKeyHash).digest();\n                    const Khat = kr.subarray(0, 32);\n                    // re-encrypt using the derived randomness and cached Â/t̂\n                    const cipherText2 = cached.encrypt(msg, kr.subarray(32, 64));\n                    // if ciphertexts do not match, “implicitly reject”\n                    const isValid = equalBytes(cipherText, cipherText2);\n                    const Kbar = KDF.create({ dkLen: 32 }).update(z).update(cipherText).digest();\n                    cleanBytes(msg, cipherText2, kr.subarray(32), !isValid ? Khat : Kbar);\n                    return (isValid ? Khat : Kbar);\n                },\n                clean: cached.clean,\n            });\n        },\n    });\n}\n// FIPS 203's PRF_eta binding: current callers use only 32-byte keys, one-byte nonces,\n// and dkLen values {128, 192}; out-of-range nonce numbers still wrap modulo 256 here.\nfunction shakePRF(dkLen, key, nonce) {\n    return shake256\n        .create({ dkLen })\n        .update(key)\n        .update(new Uint8Array([nonce]))\n        .digest();\n}\n// Fixed ML-KEM hash/XOF bindings. `KDF` here is the spec's fixed 32-byte `J` call,\n// and swapping any field changes the scheme rather than tuning an internal dependency.\nconst opts = /* @__PURE__ */ (() => ({\n    HASH256: sha3_256,\n    HASH512: sha3_512,\n    KDF: shake256,\n    XOF: XOF128,\n    PRF: shakePRF,\n}))();\n// Parameter-set instantiation step for the spec's \"ML-KEM-x\" names; current correctness relies\n// on the internal PARAMS rows rather than local validation of arbitrary KEMParam objects.\nconst mk = (params) => createKyber({\n    ...opts,\n    ...params,\n});\n/**\n * ML-KEM-512: Table 2 row `k=2, η1=3, η2=2, du=10, dv=4`; Table 3 sizes `800/1632/768/32`.\n * The ASD lifecycle note here is external policy guidance, not a FIPS 203 requirement.\n * @example\n * Generate deterministic ML-KEM-512 keys, encapsulate a shared secret, and decapsulate it.\n * ```ts\n * import { ml_kem512 } from '@noble/post-quantum/ml-kem.js';\n * const seed = new Uint8Array(ml_kem512.lengths.seed!);\n * const { secretKey, publicKey } = ml_kem512.keygen(seed);\n * const msg = new Uint8Array(ml_kem512.lengths.msgRand!);\n * const { cipherText, sharedSecret } = ml_kem512.encapsulate(publicKey, msg);\n * const recovered = ml_kem512.decapsulate(cipherText, secretKey);\n * const publicKey2 = ml_kem512.getPublicKey(secretKey);\n * ```\n */\nexport const ml_kem512 = /* @__PURE__ */ (() => mk(PARAMS[512]))();\n/**\n * ML-KEM-768: Table 2 row `k=3, η1=2, η2=2, du=10, dv=4`; Table 3 sizes `1184/2400/1088/32`.\n * The ASD lifecycle note here is external policy guidance, not a FIPS 203 requirement.\n */\nexport const ml_kem768 = /* @__PURE__ */ (() => mk(PARAMS[768]))();\n/**\n * ML-KEM-1024: Table 2 row `k=4, η1=2, η2=2, du=11, dv=5`; Table 3 sizes `1568/3168/1568/32`.\n * The ASD lifecycle note here is external policy guidance, not a FIPS 203 requirement.\n */\nexport const ml_kem1024 = /* @__PURE__ */ (() => mk(PARAMS[1024]))();\n// NOTE: for tests only, don't use. This keeps the exact internal ML-KEM math surfaces available\n// without re-implementing them in separate test code.\nexport const __tests = /* @__PURE__ */ (() => Object.freeze({\n    Compress_d: (x, d) => {\n        if (d < 1 || d > 11)\n            throw new Error(`Compress_d: expected d in [1..11], got ${d}`);\n        return compress(d).encode(x) & getMask(d);\n    },\n    Decompress_d: (y, d) => {\n        if (d < 1 || d > 11)\n            throw new Error(`Decompress_d: expected d in [1..11], got ${d}`);\n        return compress(d).decode(y);\n    },\n    ByteEncode_d: (F, d) => {\n        if (d < 1 || d > 12)\n            throw new Error(`ByteEncode_d: expected d in [1..12], got ${d}`);\n        return byteCoder(d).encode(F);\n    },\n    ByteDecode_d: (B, d) => {\n        if (d < 1 || d > 12)\n            throw new Error(`ByteDecode_d: expected d in [1..12], got ${d}`);\n        return byteCoder(d).decode(B);\n    },\n    NTT: (f) => crystals.NTT.encode(Uint16Array.from(f)),\n    NTT_inv: (fHat) => crystals.NTT.decode(Uint16Array.from(fHat)),\n    MultiplyNTTs: (fHat, gHat) => MultiplyNTTs(Uint16Array.from(fHat), Uint16Array.from(gHat)),\n    SamplePolyCBD: (B, eta) => {\n        abytes(B, 64 * eta, 'B');\n        return sampleCBDBytes(B, eta);\n    },\n    SampleNTT: (B) => {\n        abytes(B, 34, 'B');\n        const xof = XOF128(B.subarray(0, 32));\n        try {\n            return SampleNTT(xof.get(B[32], B[33]));\n        }\n        finally {\n            xof.clean();\n        }\n    },\n}))();\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport JsSHA from 'jssha'\nimport {\n  chunkSubstr,\n  isHex,\n  randomString\n} from './libraries/strings.js'\nimport {\n  generateBatchId,\n  generateBundleHash,\n  generateSecret,\n  shake256\n} from './libraries/crypto.js'\nimport TokenUnit from './TokenUnit.js'\nimport * as kcore from './libraries/kcore.js'\nimport WalletCredentialException from './exception/WalletCredentialException.js'\nimport { ml_kem768 as MlKEM768, ml_kem1024 as MlKEM1024 } from '@noble/post-quantum/ml-kem.js'\n\nconst ML_KEM_PARAMS = {\n  1024: { set: 1024, kem: MlKEM1024, pkBytes: 1568, skBytes: 3168, ctBytes: 1568 },\n  768: { set: 768, kem: MlKEM768, pkBytes: 1184, skBytes: 2400, ctBytes: 1088 }\n}\nconst DEFAULT_ML_KEM_PARAMETER_SET = 1024\n\n/**\n * Wallet class represents the set of public and private\n * keys to sign Molecules\n */\nexport default class Wallet {\n  /**\n   * Class constructor\n   *\n   * @param {string|null} secret - typically a 2048-character biometric hash\n   * @param {string|null} bundle - 64-character hexadecimal user identifier\n   * @param {string} token - slug for the token this wallet is intended for\n   * @param {string|null} address - hexadecimal public key for the signature of this wallet\n   * @param {string|null} position - hexadecimal string used to salt the secret and produce one-time signatures\n   * @param {string|null} batchId\n   * @param {string|null} characters\n   */\n  constructor ({\n    secret = null,\n    bundle = null,\n    token = 'USER',\n    address = null,\n    position = null,\n    batchId = null,\n    characters = null,\n    mlKemParameterSet = DEFAULT_ML_KEM_PARAMETER_SET\n  }) {\n    const paramSetNum = Number(mlKemParameterSet)\n    if (!ML_KEM_PARAMS[paramSetNum]) {\n      throw new Error(`KnishIO: unsupported ML-KEM parameter set ${mlKemParameterSet}; expected 1024 or 768.`)\n    }\n    this.mlKemParameterSet = paramSetNum\n    this.token = token\n    this.balance = '0'\n    this.molecules = {}\n\n    // Empty values\n    this.key = null\n    this.privkey = null\n    this.pubkey = null\n    this.tokenUnits = []\n    this.tradeRates = {}\n\n    this.address = address\n    this.position = position\n    this.bundle = bundle\n    this.batchId = batchId\n    this.characters = characters\n\n    if (secret) {\n      // Set bundle from the secret\n      this.bundle = this.bundle || generateBundleHash(secret, 'Wallet::constructor')\n\n      // Generate a position for non-shadow wallet if not initialized\n      this.position = this.position || Wallet.generatePosition()\n\n      // Key & address initialization\n      this.key = Wallet.generateKey({\n        secret,\n        token: this.token,\n        position: this.position\n      })\n      this.address = this.address || Wallet.generateAddress(this.key)\n\n      // Set characters\n      this.characters = this.characters || 'BASE64'\n\n      // Initialize ML-KEM keys\n      this.initializeMLKEM()\n    }\n  }\n\n  /**\n   * Creates a new Wallet instance\n   *\n   * @param {string|null} secret\n   * @param {string|null} bundle\n   * @param {string} token\n   * @param {string|null} batchId\n   * @param {string|null} characters\n   * @return {Wallet}\n   */\n  static create ({\n    secret = null,\n    bundle = null,\n    token,\n    batchId = null,\n    characters = null,\n    mlKemParameterSet = DEFAULT_ML_KEM_PARAMETER_SET\n  }) {\n    let position = null\n\n    // No credentials parameters provided?\n    if (!secret && !bundle) {\n      throw new WalletCredentialException()\n    }\n\n    // Secret, but no bundle?\n    if (secret && !bundle) {\n      position = Wallet.generatePosition()\n      bundle = generateBundleHash(secret, 'Wallet::create')\n    }\n\n    // Wallet initialization\n    return new Wallet({\n      secret,\n      bundle,\n      token,\n      position,\n      batchId,\n      characters,\n      mlKemParameterSet\n    })\n  }\n\n  /**\n   * Determines if the provided string is a bundle hash\n   *\n   * @param {string} maybeBundleHash\n   * @return {boolean}\n   */\n  static isBundleHash (maybeBundleHash) {\n    if (typeof maybeBundleHash !== 'string') {\n      return false\n    }\n\n    return maybeBundleHash.length === 64 && isHex(maybeBundleHash)\n  }\n\n  /**\n   * Get formatted token units from the raw data\n   *\n   * @param unitsData\n   * @return {[]}\n   */\n  static getTokenUnits (unitsData) {\n    const result = []\n    unitsData.forEach(unitData => {\n      result.push(TokenUnit.createFromDB(unitData))\n    })\n    return result\n  }\n\n  /**\n   * Generates a private key for the given parameters\n   *\n   * @param {string} secret\n   * @param {string} token\n   * @param {string} position\n   * @return {string}\n   */\n  static generateKey ({\n    secret,\n    token,\n    position\n  }) {\n    if (!secret) {\n      throw new WalletCredentialException('Wallet::generateKey() - Secret is required!')\n    }\n    if (!position) {\n      throw new WalletCredentialException('Wallet::generateKey() - Position is required!')\n    }\n\n    // Normalize non-hex secret via SHAKE256 (matching Rust/Kotlin behavior)\n    const secretHex = isHex(secret) ? secret : shake256(secret, 1024)\n    // Normalize non-hex position via SHAKE256\n    const positionHex = isHex(position) ? position : shake256(position, 256)\n\n    // Converting secret to bigInt\n    const bigIntSecret = BigInt(`0x${ secretHex }`)\n\n    // Adding new position to the user secret to produce the indexed key\n    const indexedKey = bigIntSecret + BigInt(`0x${ positionHex }`)\n\n    // Hashing the indexed key to produce the intermediate key\n    const intermediateKeySponge = new JsSHA('SHAKE256', 'TEXT')\n\n    intermediateKeySponge.update(indexedKey.toString(16))\n\n    if (token) {\n      intermediateKeySponge.update(token)\n    }\n\n    // Hashing the intermediate key to produce the private key\n    const privateKeySponge = new JsSHA('SHAKE256', 'TEXT')\n    privateKeySponge.update(intermediateKeySponge.getHash('HEX', { outputLen: 8192 }))\n    return privateKeySponge.getHash('HEX', { outputLen: 8192 })\n  }\n\n  /**\n   * Generates a wallet address\n   *\n   * @param {string} key\n   * @return {string}\n   */\n  static generateAddress (key) {\n    const viaKcore = kcore.wotsAddress(key)\n    if (viaKcore !== null) return viaKcore\n    // Subdivide private key into 16 fragments of 128 characters each\n    const keyFragments = chunkSubstr(key, 128)\n    // Generating wallet digest\n    const digestSponge = new JsSHA('SHAKE256', 'TEXT')\n\n    for (const index in keyFragments) {\n      let workingFragment = keyFragments[index]\n      for (let fragmentCount = 1; fragmentCount <= 16; fragmentCount++) {\n        const workingSponge = new JsSHA('SHAKE256', 'TEXT')\n        workingSponge.update(workingFragment)\n        workingFragment = workingSponge.getHash('HEX', { outputLen: 512 })\n      }\n\n      digestSponge.update(workingFragment)\n    }\n\n    // Producing wallet address\n    const outputSponge = new JsSHA('SHAKE256', 'TEXT')\n    outputSponge.update(digestSponge.getHash('HEX', { outputLen: 8192 }))\n    return outputSponge.getHash('HEX', { outputLen: 256 })\n  }\n\n  /**\n   *\n   * @param saltLength\n   * @returns {string}\n   */\n  static generatePosition (saltLength = 64) {\n    return randomString(saltLength, 'abcdef0123456789')\n  }\n\n  /**\n   * Derive an ML-KEM keypair for an arbitrary parameter set from the wallet's key seed.\n   *\n   * Returns `null` when the wallet holds no key — a secret-less wallet, which is what\n   * {@link Molecule.fromJSON} builds for validation context. `generateSecret(null, …)` does NOT\n   * throw, so without this the wallet would derive a plausible-looking identity from a bogus seed\n   * and fail three layers down at AES-GCM instead of at the missing key. The guard lives here\n   * rather than at each call site so a new caller cannot miss it.\n   *\n   * @param {number} parameterSet - 1024 or 768\n   * @return {{pubkey: string, privkey: Uint8Array, params: object}|null}\n   */\n  _deriveMlKemKeypair (parameterSet) {\n    const params = ML_KEM_PARAMS[parameterSet]\n    if (!params) {\n      throw new Error(`KnishIO: unsupported ML-KEM parameter set ${parameterSet}; expected 1024 or 768.`)\n    }\n    if (!this.key) {\n      return null\n    }\n    const seedHex = generateSecret(this.key, 128) // 128 hex chars = 64 bytes\n    const seed = new Uint8Array(64)\n    for (let i = 0; i < 64; i++) {\n      seed[i] = parseInt(seedHex.substr(i * 2, 2), 16)\n    }\n    const { publicKey, secretKey } = kcore.mlkemKeypair(params.set, seed) ?? params.kem.keygen(seed)\n    return {\n      pubkey: this.serializeKey(publicKey),\n      privkey: secretKey,\n      params\n    }\n  }\n\n  /**\n   * Initializes the ML-KEM key pair. Only ever reached from the constructor's `secret` branch,\n   * so the derivation cannot come back empty here.\n   */\n  initializeMLKEM () {\n    const derived = this._deriveMlKemKeypair(this.mlKemParameterSet)\n    if (!derived) {\n      return\n    }\n    this.pubkey = derived.pubkey\n    this.privkey = derived.privkey\n  }\n\n  serializeKey (key) {\n    if (typeof Buffer !== 'undefined') {\n      return Buffer.from(key).toString('base64')\n    }\n    // String.fromCharCode.apply(null, key) overflows the call stack once the\n    // payload exceeds the engine's argument limit (~64K), so convert in chunks.\n    let binary = ''\n    const CHUNK_SIZE = 0x8000\n    for (let i = 0; i < key.length; i += CHUNK_SIZE) {\n      binary += String.fromCharCode(...key.subarray(i, i + CHUNK_SIZE))\n    }\n    return btoa(binary)\n  }\n\n  deserializeKey (serializedKey) {\n    if (typeof Buffer !== 'undefined') {\n      return new Uint8Array(Buffer.from(serializedKey, 'base64'))\n    }\n    const binaryString = atob(serializedKey)\n    return new Uint8Array(binaryString.length).map((_, i) => binaryString.charCodeAt(i))\n  }\n\n  /**\n   * ML-KEM parameter set implied by a serialized public key's raw byte length. FIPS 203's\n   * key lengths are disjoint (1568 bytes → ML-KEM-1024, 1184 bytes → ML-KEM-768), so a stored\n   * peer key recovers the parameter set of the session it belongs to without a wire-format\n   * change. Used by {@link AuthToken.restore} to resolve a snapshot that predates the field.\n   *\n   * @param {string|null} pubkey - Base64-serialized ML-KEM public key\n   * @return {number|null} 1024, 768, or null when the length matches neither\n   */\n  static mlKemParameterSetFromPubkey (pubkey) {\n    if (!pubkey) {\n      return null\n    }\n    let byteLength\n    try {\n      byteLength = typeof Buffer !== 'undefined'\n        ? Buffer.from(pubkey, 'base64').length\n        : atob(pubkey).length\n    } catch (e) {\n      return null\n    }\n    for (const [set, params] of Object.entries(ML_KEM_PARAMS)) {\n      if (params.pkBytes === byteLength) {\n        return Number(set)\n      }\n    }\n    return null\n  }\n\n  /**\n   * Returns balance as a Number for arithmetic operations.\n   * WARNING: Precision loss for values > 2^53.\n   *\n   * @return {number}\n   */\n  balanceAsNumber () {\n    return Number(this.balance)\n  }\n\n  /**\n   * Returns balance as a BigInt for precision-safe integer arithmetic.\n   * Truncates any fractional component.\n   *\n   * @return {bigint}\n   */\n  balanceAsBigInt () {\n    const str = String(this.balance)\n    const intPart = str.includes('.') ? str.split('.')[0] : str\n    return BigInt(intPart || '0')\n  }\n\n  /**\n   * Sets balance from a BigInt value\n   *\n   * @param {bigint} value\n   */\n  setBalanceBigInt (value) {\n    this.balance = value.toString()\n  }\n\n  /**\n   * Sets balance from a Number value, storing as String\n   *\n   * @param {number} value\n   */\n  setBalanceNumber (value) {\n    this.balance = String(value)\n  }\n\n  /**\n   *\n   * @returns {*[]}\n   */\n  getTokenUnitsData () {\n    const result = []\n    this.tokenUnits.forEach(tokenUnit => {\n      result.push(tokenUnit.toData())\n    })\n    return result\n  }\n\n  /**\n   * Split token units\n   *\n   * @param {array} units\n   * @param remainderWallet\n   * @param recipientWallet\n   */\n  splitUnits (\n    units, // Array: token unit IDs\n    remainderWallet,\n    recipientWallet = null\n  ) {\n    // No units supplied, nothing to split\n    if (units.length === 0) {\n      return\n    }\n\n    // Init recipient & remainder token units\n    const recipientTokenUnits = []\n    const remainderTokenUnits = []\n    this.tokenUnits.forEach(tokenUnit => {\n      if (units.includes(tokenUnit.id)) {\n        recipientTokenUnits.push(tokenUnit)\n      } else {\n        remainderTokenUnits.push(tokenUnit)\n      }\n    })\n\n    // Reset token units to the sending value\n    this.tokenUnits = recipientTokenUnits\n\n    // Set token units to recipient & remainder\n    if (recipientWallet !== null) {\n      recipientWallet.tokenUnits = recipientTokenUnits\n    }\n    remainderWallet.tokenUnits = remainderTokenUnits\n  }\n\n  /**\n   * Split token units across MULTIPLE recipients (WP line 544).\n   *\n   * The source retains the SENT union (all units leaving), each recipient gets its own subset,\n   * and the remainder gets the KEPT units (those not assigned to any recipient). Mirrors\n   * splitUnits() but N-way: the source's tokenUnits become the union (not a single recipient's\n   * subset) so the source atom carries the full SENT set the validator reads as the authority.\n   *\n   * @param {array[]} recipientUnitLists - array of unit-id arrays, parallel to recipientWallets\n   * @param {Wallet[]} recipientWallets\n   * @param {Wallet} remainderWallet\n   */\n  splitUnitsMulti (\n    recipientUnitLists,\n    recipientWallets,\n    remainderWallet\n  ) {\n    // The union of all unit ids leaving the source\n    const sentIds = new Set()\n    recipientUnitLists.forEach(unitList => {\n      unitList.forEach(id => sentIds.add(id))\n    })\n\n    // Nothing to split (fungible transfer) — leave token units untouched\n    if (sentIds.size === 0) {\n      return\n    }\n\n    // Each recipient gets its own subset of the source's token units\n    recipientWallets.forEach((recipientWallet, index) => {\n      const ids = recipientUnitLists[index]\n      recipientWallet.tokenUnits = this.tokenUnits.filter(tokenUnit => ids.includes(tokenUnit.id))\n    })\n\n    // The remainder keeps everything not sent to any recipient\n    remainderWallet.tokenUnits = this.tokenUnits.filter(tokenUnit => !sentIds.has(tokenUnit.id))\n\n    // The source carries the SENT union (the ownership authority the validator reads)\n    this.tokenUnits = this.tokenUnits.filter(tokenUnit => sentIds.has(tokenUnit.id))\n  }\n\n  /**\n   * Create a remainder wallet from the source one\n   *\n   * @param secret\n   */\n  createRemainder (secret) {\n    const remainderWallet = Wallet.create({\n      secret,\n      token: this.token,\n      characters: this.characters\n    })\n    remainderWallet.initBatchId({\n      sourceWallet: this,\n      isRemainder: true\n    })\n    return remainderWallet\n  }\n\n  /**\n   * @return boolean\n   */\n  isShadow () {\n    return (\n      (typeof this.position === 'undefined' || this.position === null) &&\n      (typeof this.address === 'undefined' || this.address === null)\n    )\n  }\n\n  /**\n   * Sets up a batch ID - either using the sender's, or a new one\n   *\n   * @param {Wallet} sourceWallet\n   * @param {boolean} isRemainder\n   */\n  initBatchId ({\n    sourceWallet,\n    isRemainder = false\n  }) {\n    if (sourceWallet.batchId) {\n      this.batchId = isRemainder ? sourceWallet.batchId : generateBatchId({})\n    }\n  }\n\n  async encryptMessage (message, recipientPubkey) {\n    const messageString = JSON.stringify(message)\n    const messageUint8 = new TextEncoder().encode(messageString)\n    const deserializedPubkey = this.deserializeKey(recipientPubkey)\n    // ML-KEM public keys are exactly 1568 bytes (ML-KEM-1024) or 1184 bytes (ML-KEM-768). A wrong-length key here\n    // almost always means the node did not advertise an ML-KEM public key in its auth `key` field (e.g. a validator\n    // predating the PQ-transport build). Fail with an actionable message rather than the crypto lib's cryptic\n    // `\"publicKey\" expected Uint8Array of length N, got length=M` assertion.\n    const params = ML_KEM_PARAMS[this.mlKemParameterSet]\n    if (deserializedPubkey.length !== params.pkBytes) {\n      throw new Error(\n        `KnishIO: cannot ML-KEM-encrypt — recipient public key is ${deserializedPubkey.length} bytes, ` +\n        `expected ${params.pkBytes} (ML-KEM-${this.mlKemParameterSet}). The peer is not running ML-KEM-${this.mlKemParameterSet}; ` +\n        'upgrade the peer, or step this client back to the other parameter set.'\n      )\n    }\n    const { cipherText, sharedSecret } = kcore.mlkemEncaps(params.set, deserializedPubkey) ?? params.kem.encapsulate(deserializedPubkey)\n    const encryptedMessage = await this.encryptWithSharedSecret(messageUint8, sharedSecret)\n    return {\n      cipherText: this.serializeKey(cipherText),\n      encryptedMessage: this.serializeKey(encryptedMessage)\n    }\n  }\n\n  async decryptMessage (encryptedData) {\n    const decryptedString = await this._mlkemDecryptToString(encryptedData)\n    return decryptedString === null ? null : JSON.parse(decryptedString)\n  }\n\n  /**\n   * ML-KEM decapsulate + AES-256-GCM decrypt → the RAW decrypted UTF-8 string\n   * (no JSON.parse). Shared by {@link decryptMessage} (which JSON.parses the result)\n   * and the PQ CipherHash transport ({@link decryptMyMessageML}, which needs the raw\n   * response JSON text). PQ-transport Phase E (cycle 163).\n   */\n  async _mlkemDecryptToString (encryptedData) {\n    const { cipherText, encryptedMessage } = encryptedData\n\n    const deserializedCipherText = this.deserializeKey(cipherText)\n    const configuredParams = ML_KEM_PARAMS[this.mlKemParameterSet]\n    const otherSet = this.mlKemParameterSet === 1024 ? 768 : 1024\n\n    // Inbound is PERMISSIVE: a ciphertext at either parameter set decrypts, provided it is addressed\n    // to one of THIS wallet's own ML-KEM identities. The 64-byte seed is parameter-set-independent,\n    // so the other identity is derived on demand and its private key is released with this call's\n    // scope — never cached on the wallet. Outbound encapsulation stays STRICT (see encryptMessage);\n    // reading a 768 record we own downgrades nothing, but encapsulating at 768 would.\n    let decapsParams = configuredParams\n    let decapsPrivkey = this.privkey\n    if (deserializedCipherText.length !== configuredParams.ctBytes) {\n      if (deserializedCipherText.length !== ML_KEM_PARAMS[otherSet].ctBytes) {\n        console.error(\n          `Wallet::decryptMessage() - Ciphertext length mismatch: got ${deserializedCipherText.length}, expected ${configuredParams.ctBytes}`\n        )\n        return null\n      }\n      // `null` here means the wallet holds no key to derive from (a secret-less validation\n      // wallet); preserve the existing failure observable rather than decapsulating with nothing.\n      const derived = this._deriveMlKemKeypair(otherSet)\n      if (!derived) {\n        console.error(`Wallet::decryptMessage() - cannot derive the ML-KEM-${otherSet} identity: wallet has no key`)\n        return null\n      }\n      decapsParams = derived.params\n      decapsPrivkey = derived.privkey\n    }\n\n    let sharedSecret\n    try {\n      sharedSecret = kcore.mlkemDecaps(decapsParams.set, deserializedCipherText, decapsPrivkey) ??\n        decapsParams.kem.decapsulate(deserializedCipherText, decapsPrivkey)\n    } catch (e) {\n      // KNISHIO_KCORE=require with no loadable kcore must fail loudly, not read as a bad ciphertext.\n      if (e instanceof kcore.KcoreUnavailable) throw e\n      console.error('Wallet::decryptMessage() - Decapsulation failed', e)\n      console.info('Wallet::decryptMessage() - my public key', this.pubkey)\n      return null\n    }\n\n    let deserializedEncryptedMessage\n    try {\n      deserializedEncryptedMessage = this.deserializeKey(encryptedMessage)\n    } catch (e) {\n      console.warn('Wallet::decryptMessage() - Deserialization failed', e)\n      console.info('Wallet::decryptMessage() - my public key', this.pubkey)\n      console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)\n      return null\n    }\n\n    let decryptedUint8\n    try {\n      decryptedUint8 = await this.decryptWithSharedSecret(deserializedEncryptedMessage, sharedSecret)\n    } catch (e) {\n      console.warn('Wallet::decryptMessage() - Decryption failed', e)\n      console.info('Wallet::decryptMessage() - my public key', this.pubkey)\n      console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)\n      console.info('Wallet::decryptMessage() - deserialized encrypted message', deserializedEncryptedMessage)\n      return null\n    }\n\n    try {\n      return new TextDecoder().decode(decryptedUint8)\n    } catch (e) {\n      console.warn('Wallet::decryptMessage() - Decoding failed', e)\n      console.info('Wallet::decryptMessage() - my public key', this.pubkey)\n      console.info('Wallet::decryptMessage() - our shared secret', sharedSecret)\n      console.info('Wallet::decryptMessage() - deserialized encrypted message', deserializedEncryptedMessage)\n      console.info('Wallet::decryptMessage() - decrypted Uint8Array', decryptedUint8)\n      return null\n    }\n  }\n\n  /**\n   * Multi-recipient map key for a public key: `Base64_standard(SHAKE256(pubkey_utf8, 8 bytes))`\n   * — matches the validator's `hash_share` and the other SDKs' `hashShare`/`shortHash`.\n   * `shake256(pubkey, 64)` = 64 bits = 8 bytes, hex; hex-decode → standard base64. PQ Phase E.\n   */\n  hashShare (pubkey) {\n    const hex = shake256(pubkey, 64)\n    const bytes = Uint8Array.from(hex.match(/.{2}/g).map(b => parseInt(b, 16)))\n    return this.serializeKey(bytes)\n  }\n\n  /**\n   * Post-quantum (ML-KEM) `CipherHash` request envelope: a stringified single-recipient\n   * map `{ \"<hashShare(recipientPubkey)>\": {cipherText, encryptedMessage} }` (object-valued,\n   * via {@link encryptMessage}). Matches the Rust validator's CipherHash handler. PQ Phase E.\n   */\n  async encryptStringML (message, recipientPubkey) {\n    const envelope = await this.encryptMessage(message, recipientPubkey)\n    return JSON.stringify({ [this.hashShare(recipientPubkey)]: envelope })\n  }\n\n  /**\n   * Decrypt a `CipherHash` response map addressed to THIS wallet's ML-KEM pubkey\n   * (`hashShare(this.pubkey)`) → the RAW decrypted GraphQL response JSON text (NOT JSON.parsed;\n   * it replaces the HTTP response body for the normal parser). `null` if no entry / decrypt fails.\n   */\n  async decryptMyMessageML (map) {\n    let envelope = map[this.hashShare(this.pubkey)]\n    if (!envelope) {\n      // Inbound permissive: try the hash share of the on-demand derived other-set pubkey.\n      // A secret-less wallet derives nothing, so the lookup is simply skipped.\n      const otherSet = this.mlKemParameterSet === 1024 ? 768 : 1024\n      const other = this._deriveMlKemKeypair(otherSet)\n      if (other) {\n        envelope = map[this.hashShare(other.pubkey)]\n      }\n    }\n    if (!envelope) {\n      return null\n    }\n    return this._mlkemDecryptToString(envelope)\n  }\n\n  async encryptWithSharedSecret (message, sharedSecret) {\n    const iv = crypto.getRandomValues(new Uint8Array(12))\n    const algorithm = { name: 'AES-GCM', iv }\n\n    // Convert the shared secret to a CryptoKey\n    const key = await crypto.subtle.importKey(\n      'raw',\n      sharedSecret,\n      { name: 'AES-GCM' },\n      false,\n      ['encrypt']\n    )\n\n    // Encrypt the message\n    const encryptedContent = await crypto.subtle.encrypt(\n      algorithm,\n      key,\n      message\n    )\n\n    // Combine IV and encrypted content\n    const result = new Uint8Array(iv.length + encryptedContent.byteLength)\n    result.set(iv)\n    result.set(new Uint8Array(encryptedContent), iv.length)\n\n    return result\n  }\n\n  /**\n   * Decrypts the given message using the shared secret\n   * @param encryptedMessage\n   * @param sharedSecret\n   * @returns {Promise<Uint8Array>}\n   */\n  async decryptWithSharedSecret (encryptedMessage, sharedSecret) {\n    // Extract IV from the encrypted message\n    const iv = encryptedMessage.slice(0, 12)\n    const algorithm = { name: 'AES-GCM', iv }\n\n    // Convert the shared secret to a CryptoKey\n    const key = await crypto.subtle.importKey(\n      'raw',\n      sharedSecret,\n      { name: 'AES-GCM' },\n      false,\n      ['decrypt']\n    )\n\n    // Decrypt the message\n    const decryptedContent = await crypto.subtle.decrypt(\n      algorithm,\n      key,\n      encryptedMessage.slice(12)\n    )\n\n    return new Uint8Array(decryptedContent)\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Atoms must have an index so that they can be sorted in a Molecule\n */\nexport default class AtomIndexException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'There is an atom without an index', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'AtomIndexException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Molecular hash does not match - contents may have been tampered with\n */\nexport default class MolecularHashMismatchException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'The molecular hash does not match', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'MolecularHashMismatchException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * A molecular hash is always required.\n */\nexport default class MolecularHashMissingException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'The molecular hash is missing', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'MolecularHashMissingException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Exception for bad GraphQL responses\n */\nexport default class PolicyInvalidException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = '', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'PolicyInvalidException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when a molecular signature is malformed\n */\nexport default class SignatureMalformedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'OTS malformed', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'SignatureMalformedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when signature does not match the public key\n */\nexport default class SignatureMismatchException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'One-time signature (OTS) does not match!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'SignatureMismatchException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when you try to transfer more tokens than you have available\n */\nexport default class TransferBalanceException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Insufficient balance to make transfer', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferBalanceException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when V isotope atoms are arranged incorrectly\n */\nexport default class TransferMalformedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Token transfer atoms are malformed', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferMalformedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when the token slugs of wallets involved in a transfer do not match\n */\nexport default class TransferMismatchedException extends BaseException {\n  /**\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Token slugs for wallets in transfer do not match!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferMismatchedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when the remainder atom in a V isotope transfer is incorrect\n */\nexport default class TransferRemainderException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Invalid remainder provided', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferRemainderException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when attempting to transfer tokens to yourself\n */\nexport default class TransferToSelfException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Sender and recipient(s) cannot be the same', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferToSelfException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when V isotope atom amounts do not add up to zero\n */\nexport default class TransferUnbalancedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Token transfer atoms are unbalanced', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'TransferUnbalancedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * M isotope atoms must always contain metadata\n */\nexport default class MetaMissingException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Empty meta data.', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'MetaMissingException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when trying to use an inappropriate token slug for a particular isotope\n */\nexport default class WrongTokenTypeException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Wrong type of token for this isotope', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'WrongTokenTypeException'\n  }\n}\n","import BaseException from './BaseException.js'\n\n/**\n * Generic code exception\n */\nexport default class BatchIdException extends BaseException {\n  /**\n   * @param {string|null} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Incorrect BatchId', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'BatchIdException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nexport default class Meta {\n  constructor (args = {}) {\n    for (const key in args) {\n      this[`__${ key }`] = args[key]\n    }\n  }\n\n  static toObject (object) {\n    return new this(object)\n  }\n\n  /**\n   *\n   * @returns {{}}\n   */\n  toJSON () {\n    const object = {}\n\n    for (const item of Object.keys(this)) {\n      if (item.substring(0, 2) === '__') {\n        object[item.substring(2, item.length)] = this[item]\n      }\n    }\n\n    return object\n  }\n}\n","import BaseException from '../../../exception/BaseException.js'\n\nexport default class RuleArgumentException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'An incorrect argument!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'RuleArgumentException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Generic code exception\n */\nexport default class CodeException extends BaseException {\n  /**\n   * @param {string|null} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Code exception', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'CodeException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Meta from './Meta.js'\nimport RuleArgumentException from './exception/RuleArgumentException.js'\nimport { isNumeric } from '../../libraries/strings.js'\nimport { intersect } from '../../libraries/array.js'\nimport CodeException from '../../exception/CodeException.js'\n\n/* eslint-disable accessor-pairs -- intentional setter-only fluent rule builder; values are read directly via __field, no getter needed */\nexport default class Callback {\n  /**\n   *\n   * @param {string} action\n   * @param {string|null} metaType\n   * @param {string|null} metaId\n   * @param {Meta|null} meta\n   * @param {string|null} address\n   * @param {string|null} token\n   * @param {string|null} amount\n   * @param {string|null} comparison\n   */\n  constructor ({\n    action,\n    metaType = null,\n    metaId = null,\n    meta = null,\n    address = null,\n    token = null,\n    amount = null,\n    comparison = null\n  }) {\n    if (meta) {\n      this.meta = meta\n    }\n\n    if (!action) {\n      throw new RuleArgumentException('Callback structure violated, missing mandatory \"action\" parameter.')\n    }\n\n    this.__metaId = metaId\n    this.__metaType = metaType\n    this.__action = action\n    this.__address = address\n    this.__token = token\n    this.__amount = amount\n    this.__comparison = comparison\n  }\n\n  /**\n   *\n   * @param {string} comparison\n   */\n  set comparison (comparison) {\n    this.__comparison = comparison\n  }\n\n  /**\n   *\n   * @param {string} amount\n   */\n  set amount (amount) {\n    if (!isNumeric(amount)) {\n      throw new CodeException('Parameter amount should be a string containing numbers')\n    }\n    this.__amount = amount\n  }\n\n  /**\n   *\n   * @param {string} token\n   */\n  set token (token) {\n    this.__token = token\n  }\n\n  /**\n   *\n   * @param {string} address\n   */\n  set address (address) {\n    this.__address = address\n  }\n\n  /**\n   *\n   * @param {Meta|object} meta\n   */\n  set meta (meta) {\n    this.__meta = meta instanceof Meta ? meta : Meta.toObject(meta)\n  }\n\n  /**\n   *\n   * @param {string} metaType\n   */\n  set metaType (metaType) {\n    this.__metaType = metaType\n  }\n\n  /**\n   *\n   * @param {string} metaId\n   */\n  set metaId (metaId) {\n    this.__metaId = metaId\n  }\n\n  /**\n   *\n   * @param {object} object\n   *\n   * @return Callback\n   */\n  static toObject (object) {\n    const callback = new Callback({\n      action: object.action\n    })\n\n    if (object.metaType) {\n      callback.metaType = object.metaType\n    }\n\n    if (object.metaId) {\n      callback.metaId = object.metaId\n    }\n\n    if (object.meta) {\n      callback.meta = object.meta\n    }\n\n    if (object.address) {\n      callback.address = object.address\n    }\n\n    if (object.token) {\n      callback.token = object.token\n    }\n\n    if (object.amount) {\n      callback.amount = object.amount\n    }\n\n    if (object.comparison) {\n      callback.comparison = object.comparison\n    }\n\n    return callback\n  }\n\n  /**\n   *\n   * @return {{action: string}}\n   */\n  toJSON () {\n    const meta = {\n      action: this.__action\n    }\n\n    if (this.__metaType) {\n      meta.metaType = this.__metaType\n    }\n    if (this.__metaId) {\n      meta.metaId = this.__metaId\n    }\n    if (this.__meta) {\n      meta.meta = this.__meta\n    }\n\n    if (this.__address) {\n      meta.address = this.__address\n    }\n\n    if (this.__token) {\n      meta.token = this.__token\n    }\n\n    if (this.__amount) {\n      meta.amount = this.__amount\n    }\n\n    if (this.__comparison) {\n      meta.comparison = this.__comparison\n    }\n\n    return meta\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isReject () {\n    return this._is('reject')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isMeta () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'metaId', 'metaType', 'meta'])\n\n    return prop.length === 4 && this._is('meta')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isCollect () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'address', 'token', 'amount', 'comparison'])\n\n    return prop.length === 5 && this._is('collect')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isBuffer () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'address', 'token', 'amount', 'comparison'])\n\n    return prop.length === 5 && this._is('buffer')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isRemit () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'token', 'amount'])\n\n    return prop.length === 3 && this._is('remit')\n  }\n\n  /**\n   * @return {boolean}\n   */\n  isBurn () {\n    const prop = intersect(Object.keys(this.toJSON()), ['action', 'token', 'amount', 'comparison'])\n\n    return prop.length === 4 && this._is('burn')\n  }\n\n  /**\n   * @param {string} type\n   *\n   * @return {boolean}\n   * @private\n   */\n  _is (type) {\n    return this.__action.toLowerCase() === type.toLowerCase()\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport RuleArgumentException from './exception/RuleArgumentException.js'\n\nexport default class Condition {\n  /**\n   *\n   * @param key\n   * @param value\n   * @param comparison\n   */\n  constructor ({\n    key,\n    value,\n    comparison\n  }) {\n    if ([key, value, comparison].some(item => !item)) {\n      throw new RuleArgumentException('Condition::constructor( { key, value, comparison } ) - not all class parameters are initialised!')\n    }\n\n    this.__key = key\n    this.__value = value\n    this.__comparison = comparison\n  }\n\n  /**\n   * @param object\n   * @return {Condition}\n   */\n  static toObject (object) {\n    return new this({\n      key: object.key,\n      value: object.value,\n      comparison: object.comparison\n    })\n  }\n\n  /**\n   * @return {{comparison, value, key}}\n   */\n  toJSON () {\n    return {\n      key: this.__key,\n      value: this.__value,\n      comparison: this.__comparison\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Callback from './Callback.js'\nimport Condition from './Condition.js'\nimport RuleArgumentException from './exception/RuleArgumentException.js'\nimport MetaMissingException from '../../exception/MetaMissingException.js'\n\n/* eslint-disable accessor-pairs -- intentional setter-only fluent rule builder; values are read directly via __field, no getter needed */\nexport default class Rule {\n  /**\n   *\n   * @param {Condition[]} condition\n   * @param  {Callback[]} callback\n   */\n  constructor ({\n    condition = [],\n    callback = []\n  }) {\n    for (const element of condition) {\n      if (!(element instanceof Condition)) {\n        throw new RuleArgumentException()\n      }\n    }\n\n    for (const element of callback) {\n      if (!(element instanceof Callback)) {\n        throw new RuleArgumentException()\n      }\n    }\n\n    this.__condition = condition\n    this.__callback = callback\n  }\n\n  /**\n   *\n   * @param {Condition[]|{}} condition\n   */\n  set comparison (condition) {\n    this.__condition.push(condition instanceof Condition ? condition : Condition.toObject(condition))\n  }\n\n  /**\n   * @param {Callback[]|{}} callback\n   */\n  set callback (callback) {\n    this.__callback.push(callback instanceof Callback ? callback : Callback.toObject(callback))\n  }\n\n  /**\n   *\n   * @param {object} object\n   *\n   * @return {Rule}\n   */\n  static toObject (object) {\n    if (!object.condition) {\n      throw new MetaMissingException('Rule::toObject() - Incorrect rule format! There is no condition field.')\n    }\n    if (!object.callback) {\n      throw new MetaMissingException('Rule::toObject() - Incorrect rule format! There is no callback field.')\n    }\n\n    const rule = new Rule({})\n\n    for (const condition of object.condition) {\n      rule.comparison = condition\n    }\n\n    for (const callback of object.callback) {\n      rule.callback = callback\n    }\n\n    return rule\n  }\n\n  /**\n   * @returns {{condition: *, callback: Callback[]}}\n   */\n  toJSON () {\n    return {\n      condition: this.__condition,\n      callback: this.__callback\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n */\nimport AtomIndexException from './../exception/AtomIndexException.js'\nimport AtomsMissingException from './../exception/AtomsMissingException.js'\nimport MolecularHashMismatchException from './../exception/MolecularHashMismatchException.js'\nimport MolecularHashMissingException from './../exception/MolecularHashMissingException.js'\nimport PolicyInvalidException from './../exception/PolicyInvalidException.js'\nimport SignatureMalformedException from './../exception/SignatureMalformedException.js'\nimport SignatureMismatchException from './../exception/SignatureMismatchException.js'\nimport TransferBalanceException from './../exception/TransferBalanceException.js'\nimport TransferMalformedException from './../exception/TransferMalformedException.js'\nimport TransferMismatchedException from './../exception/TransferMismatchedException.js'\nimport TransferRemainderException from './../exception/TransferRemainderException.js'\nimport TransferToSelfException from './../exception/TransferToSelfException.js'\nimport TransferUnbalancedException from './../exception/TransferUnbalancedException.js'\nimport MetaMissingException from './../exception/MetaMissingException.js'\nimport WrongTokenTypeException from './../exception/WrongTokenTypeException.js'\nimport BatchIdException from './../exception/BatchIdException.js'\nimport Atom from './../Atom.js'\nimport Meta from './../Meta.js'\nimport Molecule from './../Molecule.js'\nimport Wallet from './../Wallet.js'\nimport Rule from '../instance/Rules/Rule.js'\nimport {\n  base64ToHex,\n  chunkSubstr\n} from './strings.js'\nimport JsSHA from 'jssha'\nimport * as kcore from './kcore.js'\n\n/**\n *\n */\nexport default class CheckMolecule {\n  /**\n   *\n   * @param molecule\n   */\n  constructor (molecule) {\n    // No molecular hash?\n    if (molecule.molecularHash === null) {\n      throw new MolecularHashMissingException()\n    }\n\n    // No atoms?\n    if (!molecule.atoms.length) {\n      throw new AtomsMissingException()\n    }\n\n    // Check atom indexes\n    for (const atom of molecule.atoms) {\n      if (atom.index === null) {\n        throw new AtomIndexException()\n      }\n    }\n\n    this.molecule = molecule\n  }\n\n  /**\n   *\n   * @param senderWallet\n   * @returns {false|*|boolean}\n   */\n  verify (senderWallet) {\n    return this.molecularHash() &&\n      this.ots() &&\n      this.batchId() &&\n      this.continuId() &&\n      this.isotopeM() &&\n      this.isotopeT() &&\n      this.isotopeC() &&\n      this.isotopeU() &&\n      this.isotopeI() &&\n      this.isotopeR() &&\n      this.isotopeP() &&\n      this.isotopeA() &&\n      this.isotopeB() &&\n      this.isotopeF() &&\n      this.isotopeV(senderWallet)\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  continuId () {\n    const firstAtom = this.molecule.atoms[0]\n\n    if (firstAtom.token === 'USER' && this.molecule.getIsotopes('I').length < 1) {\n      throw new AtomsMissingException('Check::continuId() - Molecule is missing required ContinuID Atom!')\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  batchId () {\n    if (this.molecule.atoms.length > 0) {\n      const signingAtom = this.molecule.atoms[0]\n\n      if (signingAtom.isotope === 'V' && signingAtom.batchId !== null) {\n        const atoms = this.molecule.getIsotopes('V')\n        const remainderAtom = atoms[atoms.length - 1]\n\n        if (signingAtom.batchId !== remainderAtom.batchId) {\n          throw new BatchIdException()\n        }\n\n        for (const atom of atoms) {\n          if (atom.batchId === null) {\n            throw new BatchIdException()\n          }\n        }\n      }\n\n      return true\n    }\n\n    throw new BatchIdException()\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeI () {\n    for (const atom of this.molecule.getIsotopes('I')) {\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeI() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (atom.index === 0) {\n        throw new AtomIndexException(`Check::isotopeI() - Isotope \"${ atom.isotope }\" Atoms must have a non-zero index!`)\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeU () {\n    for (const atom of this.molecule.getIsotopes('U')) {\n      // AUTH for a first login; USER for a re-login signed from the identity's ContinuID wallet\n      if (atom.token !== 'AUTH' && atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeU() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (atom.index !== 0) {\n        throw new AtomIndexException(`Check::isotopeU() - Isotope \"${ atom.isotope }\" Atoms must have an index equal to 0!`)\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeM () {\n    const policyArray = ['readPolicy', 'writePolicy']\n\n    for (/** @type {Atom} */ const atom of this.molecule.getIsotopes('M')) {\n      if (atom.meta.length < 1) {\n        throw new MetaMissingException()\n      }\n\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeM() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      const metas = Meta.aggregateMeta(atom.meta)\n\n      for (const key of policyArray) {\n        let policy = metas[key]\n\n        if (policy) {\n          policy = JSON.parse(policy)\n\n          for (const [policyName, policyValue] of Object.entries(policy)) {\n            if (!policyArray.includes(policyName)) {\n              if (!Object.keys(metas).includes(policyName)) {\n                throw new PolicyInvalidException(`${ policyName } is missing from the meta.`)\n              }\n\n              for (const value of policyValue) {\n                if (!Wallet.isBundleHash(value) && !['all', 'self'].includes(value)) {\n                  throw new PolicyInvalidException(`${ value } does not correspond to the format of the policy.`)\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeC () {\n    for (const atom of this.molecule.getIsotopes('C')) {\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeC() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (atom.index !== 0) {\n        throw new AtomIndexException(`Check::isotopeC() - Isotope \"${ atom.isotope }\" Atoms must have an index equal to 0!`)\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeT () {\n    for (const atom of this.molecule.getIsotopes('T')) {\n      const meta = atom.aggregatedMeta()\n      const metaType = String(atom.metaType).toLowerCase()\n\n      if (metaType === 'wallet') {\n        for (const key of ['position', 'bundle']) {\n          if (!Object.prototype.hasOwnProperty.call(meta, key) || !meta[key]) {\n            throw new MetaMissingException(`Check::isotopeT() - Required meta field \"${ key }\" is missing!`)\n          }\n        }\n      }\n\n      for (const key of ['token']) {\n        if (!Object.prototype.hasOwnProperty.call(meta, key) || !meta[key]) {\n          throw new MetaMissingException(`Check::isotopeT() - Required meta field \"${ key }\" is missing!`)\n        }\n      }\n\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeT() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (atom.index !== 0) {\n        throw new AtomIndexException(`Check::isotopeT() - Isotope \"${ atom.isotope }\" Atoms must have an index equal to 0!`)\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @returns {boolean}\n   */\n  isotopeR () {\n    for (const atom of this.molecule.getIsotopes('R')) {\n      const metas = atom.aggregatedMeta()\n\n      if (metas.policy) {\n        const policy = JSON.parse(metas.policy)\n\n        if (!Object.keys(policy).every(i => ['read', 'write'].includes(i))) {\n          throw new MetaMissingException('Check::isotopeR() - Mixing rules with politics!')\n        }\n      }\n\n      if (metas.rule) {\n        const rules = JSON.parse(metas.rule)\n\n        if (!Array.isArray(rules)) {\n          throw new MetaMissingException('Check::isotopeR() - Incorrect rule format!')\n        }\n\n        for (const item of rules) {\n          Rule.toObject(item)\n        }\n\n        if (rules.length < 1) {\n          throw new MetaMissingException('Check::isotopeR() - No rules!')\n        }\n      }\n    }\n\n    return true\n  }\n\n  /**\n   * Validates P-isotope (Peering) atoms\n   *\n   * @returns {boolean}\n   */\n  isotopeP () {\n    for (const atom of this.molecule.getIsotopes('P')) {\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeP() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      const metas = atom.aggregatedMeta()\n\n      if (!Object.prototype.hasOwnProperty.call(metas, 'peerHost') || !metas.peerHost) {\n        throw new MetaMissingException('Check::isotopeP() - Required meta field \"peerHost\" is missing!')\n      }\n    }\n\n    return true\n  }\n\n  /**\n   * Validates A-isotope (Append Request) atoms\n   *\n   * @returns {boolean}\n   */\n  isotopeA () {\n    for (const atom of this.molecule.getIsotopes('A')) {\n      if (atom.token !== 'USER') {\n        throw new WrongTokenTypeException(`Check::isotopeA() - \"${ atom.token }\" is not a valid Token slug for \"${ atom.isotope }\" isotope Atoms!`)\n      }\n\n      if (!atom.metaType) {\n        throw new MetaMissingException('Check::isotopeA() - Required field \"metaType\" is missing!')\n      }\n\n      if (!atom.metaId) {\n        throw new MetaMissingException('Check::isotopeA() - Required field \"metaId\" is missing!')\n      }\n\n      const metas = atom.aggregatedMeta()\n\n      if (!Object.prototype.hasOwnProperty.call(metas, 'action') || !metas.action) {\n        throw new MetaMissingException('Check::isotopeA() - Required meta field \"action\" is missing!')\n      }\n    }\n\n    return true\n  }\n\n  /**\n   * Validates B-isotope (Buffer/Exchange) atoms\n   *\n   * @returns {boolean}\n   */\n  isotopeB () {\n    const isotopeB = this.molecule.getIsotopes('B')\n\n    if (isotopeB.length === 0) {\n      return true\n    }\n\n    for (const atom of isotopeB) {\n      // B atoms must reference a wallet bundle\n      if (!atom.metaType || atom.metaType !== 'walletBundle') {\n        throw new MetaMissingException('Check::isotopeB() - B-isotope atoms must have metaType \"walletBundle\"!')\n      }\n\n      if (!atom.metaId) {\n        throw new MetaMissingException('Check::isotopeB() - B-isotope atoms must have a metaId!')\n      }\n\n      // Value must be parseable as a number\n      const value = Number(atom.value)\n      if (Number.isNaN(value)) {\n        throw new TransferMalformedException('Check::isotopeB() - B-isotope atom value is not a valid number!')\n      }\n    }\n\n    // V+B balance conservation: sum of all V and B atom values must equal zero\n    const vAtoms = this.molecule.getIsotopes('V')\n    if (vAtoms.length > 0) {\n      let sum = 0\n      for (const atom of [...vAtoms, ...isotopeB]) {\n        const value = Number(atom.value)\n        if (!Number.isNaN(value)) {\n          sum += value\n        }\n      }\n      if (sum !== 0) {\n        throw new TransferUnbalancedException('Check::isotopeB() - V+B atom values do not balance to zero!')\n      }\n    }\n\n    return true\n  }\n\n  /**\n   * Validates F-isotope (Fusion/NFT) atoms\n   *\n   * @returns {boolean}\n   */\n  isotopeF () {\n    const isotopeF = this.molecule.getIsotopes('F')\n\n    if (isotopeF.length === 0) {\n      return true\n    }\n\n    for (const atom of isotopeF) {\n      // F atoms must reference a wallet bundle\n      if (!atom.metaType || atom.metaType !== 'walletBundle') {\n        throw new MetaMissingException('Check::isotopeF() - F-isotope atoms must have metaType \"walletBundle\"!')\n      }\n\n      if (!atom.metaId) {\n        throw new MetaMissingException('Check::isotopeF() - F-isotope atoms must have a metaId!')\n      }\n\n      // Value must be parseable\n      const value = Number(atom.value)\n      if (Number.isNaN(value)) {\n        throw new TransferMalformedException('Check::isotopeF() - F-isotope atom value is not a valid number!')\n      }\n\n      if (value < 0) {\n        throw new TransferMalformedException('Check::isotopeF() - F-isotope atom value must not be negative!')\n      }\n    }\n\n    // V+F balance conservation: sum of all V and F atom values must equal zero\n    const vAtoms = this.molecule.getIsotopes('V')\n    if (vAtoms.length > 0) {\n      let sum = 0\n      for (const atom of [...vAtoms, ...isotopeF]) {\n        const value = Number(atom.value)\n        if (!Number.isNaN(value)) {\n          sum += value\n        }\n      }\n      if (sum !== 0) {\n        throw new TransferUnbalancedException('Check::isotopeF() - V+F atom values do not balance to zero!')\n      }\n    }\n\n    return true\n  }\n\n  /**\n   *\n   * @param senderWallet\n   * @returns {boolean}\n   */\n  isotopeV (senderWallet = null) {\n    const isotopeV = this.molecule.getIsotopes('V')\n\n    if (isotopeV.length === 0) {\n      return true\n    }\n\n    // When B or F atoms are present, cross-isotope conservation is validated\n    // by isotopeB()/isotopeF() — skip V-only conservation check\n    const hasCrossIsotope = this.molecule.getIsotopes('B').length > 0 ||\n      this.molecule.getIsotopes('F').length > 0\n\n    const firstAtom = this.molecule.atoms[0]\n\n    if (!hasCrossIsotope && firstAtom.isotope === 'V' && isotopeV.length === 2) {\n      const endAtom = isotopeV[isotopeV.length - 1]\n\n      if (firstAtom.token !== endAtom.token) {\n        throw new TransferMismatchedException()\n      }\n\n      if (endAtom.value < 0) {\n        throw new TransferMalformedException()\n      }\n\n      // Conservation check for 2-atom transfers\n      if ((Number(firstAtom.value) + Number(endAtom.value)) !== 0) {\n        throw new TransferUnbalancedException()\n      }\n\n      return true\n    }\n\n    let sum = 0\n    let value = 0\n\n    for (const index in this.molecule.atoms) {\n      if (Object.prototype.hasOwnProperty.call(this.molecule.atoms, index)) {\n        const vAtom = this.molecule.atoms[index]\n\n        // Not V? Next...\n        if (vAtom.isotope !== 'V') {\n          continue\n        }\n\n        // Making sure we're in integer land\n        value = vAtom.value * 1\n\n        if (Number.isNaN(value)) {\n          throw new TypeError('Invalid isotope \"V\" values')\n        }\n\n        // Making sure all V atoms of the same token\n        if (vAtom.token !== firstAtom.token) {\n          throw new TransferMismatchedException()\n        }\n\n        // Checking non-primary atoms\n        if (index > 0) {\n          // Negative V atom in a non-primary position?\n          if (value < 0) {\n            throw new TransferMalformedException()\n          }\n\n          // Cannot be sending and receiving from the same address\n          if (vAtom.walletAddress === firstAtom.walletAddress) {\n            throw new TransferToSelfException()\n          }\n        }\n\n        // Adding this Atom's value to the total sum\n        sum += value\n      }\n    }\n\n    // V-only conservation: all V atoms must sum to zero (skip for B/F cross-isotope)\n    if (!hasCrossIsotope && sum !== 0) {\n      throw new TransferUnbalancedException()\n    }\n\n    // If we're provided with a senderWallet argument, we can perform additional checks\n    if (senderWallet) {\n      value = firstAtom.value * 1\n\n      if (Number.isNaN(value)) {\n        throw new TypeError('Invalid isotope \"V\" values')\n      }\n\n      const remainder = Number(senderWallet.balance) + value\n\n      // Is there enough balance to send?\n      if (remainder < 0) {\n        throw new TransferBalanceException()\n      }\n\n      // Does the remainder match what should be there in the source wallet, if provided?\n      // Skip for cross-isotope (B/F) — conservation is validated by isotopeB()/isotopeF()\n      if (!hasCrossIsotope && remainder !== sum) {\n        throw new TransferRemainderException()\n      }\n    } else if (value !== 0) {\n      // No senderWallet, but have a remainder?\n      throw new TransferRemainderException()\n    }\n\n    // Looks like we passed all the tests!\n    return true\n  }\n\n  /**\n   * Verifies if the hash of all the atoms matches the molecular hash to ensure content has not been messed with\n   *\n   * @returns {boolean}\n   */\n  molecularHash () {\n    if (this.molecule.molecularHash !== Atom.hashAtoms({\n      atoms: this.molecule.atoms\n    })) {\n      throw new MolecularHashMismatchException()\n    }\n\n    // Looks like we passed all the tests!\n    return true\n  }\n\n  /**\n   * Checks if the provided molecule was signed properly by transforming a collection of signature\n   * fragments from its atoms and its molecular hash into a single-use wallet address to be matched\n   * against the sender’s address. If it matches, the molecule was correctly signed.\n   *\n   * @returns {boolean}\n   */\n  ots () {\n    // Convert Hm to numeric notation via EnumerateMolecule(Hm)\n    const normalizedHash = this.molecule.normalizedHash()\n\n    // Rebuilding OTS out of all the atoms\n    let ots = this.molecule.atoms.map(\n      atom => atom.otsFragment\n    ).reduce(\n      (accumulator, otsFragment) => accumulator + otsFragment\n    )\n\n    // Wrong size? Maybe it's compressed\n    if (ots.length !== 2048) {\n      // Attempting decompression\n      ots = base64ToHex(ots)\n\n      // Still wrong? That's a failure\n      if (ots.length !== 2048) {\n        throw new SignatureMalformedException()\n      }\n    }\n\n    // Subdivide Kk into 16 segments of 256 bytes (128 characters) each\n    const otsChunks = chunkSubstr(ots, 128)\n\n    // kcore advances the 16 chains at once for lowercase-hex input; anything else (peer-supplied\n    // text) runs the per-chunk SHAKE256 loop, so the verdict never depends on kcore being present.\n    let keyFragments = kcore.chainsHex(ots, otsChunks.map((_, i) => 8 + normalizedHash[i]))\n\n    if (keyFragments === null) {\n      keyFragments = ''\n      for (const index in otsChunks) {\n        let workingChunk = otsChunks[index]\n\n        for (let iterationCount = 0, condition = 8 + normalizedHash[index]; iterationCount < condition; iterationCount++) {\n          workingChunk = (new JsSHA('SHAKE256', 'TEXT')).update(workingChunk).getHash('HEX', { outputLen: 512 })\n        }\n\n        keyFragments += workingChunk\n      }\n    }\n\n    // Absorb the hashed Kk into the sponge to receive the digest Dk\n    const digestSponge = new JsSHA('SHAKE256', 'TEXT')\n    digestSponge.update(keyFragments)\n    const digest = digestSponge.getHash('HEX', { outputLen: 8192 })\n\n    // Squeeze the sponge to retrieve a 128 byte (64 character) string that should match the sender’s wallet address\n    const addressSponge = new JsSHA('SHAKE256', 'TEXT')\n    addressSponge.update(digest)\n    const address = addressSponge.getHash('HEX', { outputLen: 256 })\n\n    // The recovered address must be the address the first atom claims\n    if (address !== this.molecule.atoms[0].walletAddress) {\n      throw new SignatureMismatchException()\n    }\n\n    // Looks like we passed all the tests!\n    return true\n  }\n\n  /**\n   * Converts server-side molecule data (from GraphQL meta query responses)\n   * into a Molecule instance suitable for verification via CheckMolecule.\n   *\n   * Handles field mapping differences between server and client:\n   * - tokenSlug → token\n   * - metasJson (JSON string) → meta (array of {key, value})\n   * - bundleHash → bundle\n   *\n   * @param {object} serverData - Molecule data from GraphQL response\n   * @param {string} serverData.molecularHash\n   * @param {string} serverData.bundleHash\n   * @param {string|null} serverData.cellSlug\n   * @param {string|null} serverData.status\n   * @param {string|null} serverData.createdAt\n   * @param {array} serverData.atoms - Array of server-format atom objects\n   * @return {Molecule}\n   */\n  static fromServerData ({\n    molecularHash,\n    bundleHash,\n    cellSlug = null,\n    status = null,\n    createdAt = null,\n    atoms = []\n  }) {\n    const mappedAtoms = atoms.map(serverAtom => {\n      let meta = []\n      if (serverAtom.metasJson) {\n        try {\n          const parsed = JSON.parse(serverAtom.metasJson)\n          if (Array.isArray(parsed)) {\n            // Already in [{key, value}] format\n            meta = parsed\n          } else if (parsed && typeof parsed === 'object') {\n            // Object format {key1: val1, key2: val2} — convert to [{key, value}] pairs\n            meta = Object.entries(parsed).map(([key, value]) => ({ key, value }))\n          }\n        } catch (e) {\n          meta = []\n        }\n      }\n\n      return {\n        position: serverAtom.position || null,\n        walletAddress: serverAtom.walletAddress || null,\n        isotope: serverAtom.isotope || null,\n        token: serverAtom.tokenSlug || serverAtom.token || null,\n        value: serverAtom.value != null ? String(serverAtom.value) : null,\n        batchId: serverAtom.batchId || null,\n        metaType: serverAtom.metaType || null,\n        metaId: serverAtom.metaId || null,\n        meta,\n        index: serverAtom.index != null ? serverAtom.index : null,\n        otsFragment: serverAtom.otsFragment || null,\n        createdAt: serverAtom.createdAt || null\n      }\n    })\n\n    return Molecule.fromJSON({\n      molecularHash,\n      bundle: bundleHash,\n      cellSlug,\n      status,\n      createdAt,\n      atoms: mappedAtoms\n    })\n  }\n\n  /**\n   * Verifies a molecule reconstructed from server-side GraphQL data.\n   * Returns an object with verification result and any error details.\n   *\n   * @param {object} moleculeData - Server molecule data (same format as fromServerData)\n   * @return {{ molecularHash: string, verified: boolean, error: string|null }}\n   */\n  static verifyFromServerData (moleculeData) {\n    try {\n      const molecule = CheckMolecule.fromServerData(moleculeData)\n      new CheckMolecule(molecule).verify()\n      return {\n        molecularHash: moleculeData.molecularHash,\n        verified: true,\n        error: null\n      }\n    } catch (error) {\n      return {\n        molecularHash: moleculeData.molecularHash || null,\n        verified: false,\n        error: error.message || String(error)\n      }\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when the node does not have enough tokens to fulfill a T request\n */\nexport default class BalanceInsufficientException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Insufficient balance for requested transfer', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'BalanceInsufficientException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when a negative amount is provided\n */\nexport default class NegativeAmountException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Amount cannot be negative!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'NegativeAmountException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when a stackable token is being transferred with both unit IDs AND an amount specified (ambiguous)\n */\nexport default class StackableUnitAmountException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Stackable tokens with unit IDs cannot have an amount!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'StackableUnitAmountException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Atom from './Atom.js'\nimport AtomMeta from './AtomMeta.js'\nimport Wallet from './Wallet.js'\nimport JsSHA from 'jssha'\nimport * as kcore from './libraries/kcore.js'\nimport {\n  chunkSubstr,\n  hexToBase64\n} from './libraries/strings.js'\nimport CheckMolecule from './libraries/CheckMolecule.js'\nimport {\n  generateBatchId,\n  generateBundleHash\n} from './libraries/crypto.js'\nimport Rule from './instance/Rules/Rule.js'\nimport AtomsMissingException from './exception/AtomsMissingException.js'\nimport BalanceInsufficientException from './exception/BalanceInsufficientException.js'\nimport NegativeAmountException from './exception/NegativeAmountException.js'\nimport SignatureMalformedException from './exception/SignatureMalformedException.js'\nimport StackableUnitAmountException from './exception/StackableUnitAmountException.js'\nimport TransferBalanceException from './exception/TransferBalanceException.js'\nimport TokenUnit from './TokenUnit.js'\nimport versions from './versions/index.js'\n\n// Bundle of the burn (token destruction) wallet\nconst BURN_BUNDLE = '0000000000000000000000000000000000000000000000000000000000000000'\n\n/**\n * Molecule class used for committing changes to the ledger\n */\nexport default class Molecule {\n  /**\n   * Class constructor\n   *\n   * @param {string|null} secret\n   * @param {string|null} bundle\n   * @param {Wallet|null} sourceWallet\n   * @param {Wallet|null} remainderWallet\n   * @param {string|null} cellSlug\n   * @param {string|number|null} version\n   */\n  constructor ({\n    secret = null,\n    bundle = null,\n    sourceWallet = null,\n    remainderWallet = null,\n    cellSlug = null,\n    version = null,\n    continuIdPosition = null,\n    mlKemParameterSet = null\n  }) {\n    this.mlKemParameterSet = mlKemParameterSet || (sourceWallet && sourceWallet.mlKemParameterSet) || 1024\n    this.status = null\n    this.molecularHash = null\n    this.createdAt = String(+new Date())\n    this.cellSlugOrigin = this.cellSlug = cellSlug\n    this.secret = secret\n    this.bundle = bundle\n    this.sourceWallet = sourceWallet\n    this.continuIdPosition = continuIdPosition\n    this.atoms = []\n    this.parentHashes = []\n    if (version !== null && Object.prototype.hasOwnProperty.call(versions, version)) {\n      this.version = String(version)\n    }\n\n    // Set the remainder wallet for this transaction\n    if (remainderWallet || sourceWallet) {\n      this.remainderWallet = remainderWallet || Wallet.create({\n        secret,\n        bundle,\n        token: sourceWallet.token,\n        batchId: sourceWallet.batchId,\n        characters: sourceWallet.characters,\n        mlKemParameterSet: this.mlKemParameterSet\n      })\n    }\n  }\n\n  /**\n   * Sets parent molecular hashes for DAG linkage\n   *\n   * @param {string[]} hashes - Array of parent molecular hash strings\n   * @return {Molecule} this instance for chaining\n   */\n  withParentHashes (hashes) {\n    this.parentHashes = Array.isArray(hashes) ? [...hashes] : []\n    return this\n  }\n\n  /**\n   * Returns the cell slug delimiter\n   *\n   * @return {string}\n   */\n  get cellSlugDelimiter () {\n    return '.'\n  }\n\n  /**\n   * Filters the atoms array by the supplied isotope list\n   *\n   * @param {string|array} isotopes\n   * @param {array} atoms\n   * @returns {*[]}\n   */\n  static isotopeFilter (isotopes, atoms) {\n    if (!Array.isArray(isotopes)) {\n      isotopes = [isotopes]\n    }\n    return atoms.filter(atom => isotopes.includes(atom.isotope))\n  }\n\n  /**\n   * Generates the next atomic index\n   *\n   * @param {array} atoms\n   * @return {number}\n   */\n  static generateNextAtomIndex (atoms) {\n    return atoms.length\n  }\n\n  /**\n   * Converts a JSON object into a Molecule Structure instance\n   *\n   * @param {string} json\n   * @return {object}\n   * @throws {AtomsMissingException}\n   */\n  static jsonToObject (json) {\n    const target = Object.assign(new Molecule({}), JSON.parse(json))\n    const properties = Object.keys(new Molecule({}))\n\n    if (!Array.isArray(target.atoms)) {\n      throw new AtomsMissingException()\n    }\n\n    for (const index in Object.keys(target.atoms)) {\n      target.atoms[index] = Atom.jsonToObject(JSON.stringify(target.atoms[index]))\n\n      for (const property of ['position', 'walletAddress', 'isotope']) {\n        if (target.atoms[index].isotope.toLowerCase() !== 'r' && (typeof target.atoms[index][property] === 'undefined' || target.atoms[index][property] === null)) {\n          throw new AtomsMissingException('MolecularStructure::jsonToObject() - Required Atom properties are missing!')\n        }\n      }\n    }\n\n    for (const property in target) {\n      if (Object.prototype.hasOwnProperty.call(target, property) && !properties.includes(property)) {\n        delete target[property]\n      }\n    }\n\n    target.atoms = Atom.sortAtoms(target.atoms)\n\n    return target\n  }\n\n  /**\n   * Accept a string of letters and numbers, and outputs a collection of decimals representing each\n   * character according to a pre-defined dictionary. Input string would typically be 64-character\n   * hexadecimal string featuring numbers from 0 to 9 and characters from a to f - a total of 15\n   * unique symbols. To ensure that string has an even number of symbols, convert it to Base 17\n   * (adding G as a possible symbol). Map each symbol to integer values as follows:\n   *  0   1   2   3   4   5   6   7  8  9  a   b   c   d   e   f   g\n   * -8  -7  -6  -5  -4  -3  -2  -1  0  1  2   3   4   5   6   7   8\n   *\n   * @param {string} hash\n   * @return {array}\n   */\n  static enumerate (hash) {\n    const mapped = {\n      0: -8,\n      1: -7,\n      2: -6,\n      3: -5,\n      4: -4,\n      5: -3,\n      6: -2,\n      7: -1,\n      8: 0,\n      9: 1,\n      a: 2,\n      b: 3,\n      c: 4,\n      d: 5,\n      e: 6,\n      f: 7,\n      g: 8\n    }\n    const target = []\n    const hashList = hash.toLowerCase().split('')\n\n    for (let index = 0, len = hashList.length; index < len; ++index) {\n      const symbol = hashList[index]\n\n      if (typeof mapped[symbol] !== 'undefined') {\n        target[index] = mapped[symbol]\n      }\n    }\n\n    return target\n  }\n\n  /**\n   * Normalize enumerated string to ensure that the total sum of all symbols is exactly zero. This\n   * ensures that exactly 50% of the WOTS+ key is leaked with each usage, ensuring predictable key\n   * safety:\n   * The sum of each symbol within Hm shall be presented by m\n   *  While m0 iterate across that set’s integers as Im:\n   *    If m0 and Im>-8 , let Im=Im-1\n   *    If m<0 and Im<8 , let Im=Im+1\n   *    If m=0, stop the iteration\n   *\n   * @param {array} mappedHashArray\n   * @return {array}\n   */\n  static normalize (mappedHashArray) {\n    let total = mappedHashArray.reduce((total, num) => total + num)\n\n    const totalCondition = total < 0\n\n    while (total < 0 || total > 0) {\n      for (const index of Object.keys(mappedHashArray)) {\n        const condition = totalCondition ? mappedHashArray[index] < 8 : mappedHashArray[index] > -8\n\n        if (condition) {\n          if (totalCondition) {\n            ++mappedHashArray[index]\n            ++total\n          } else {\n            --mappedHashArray[index]\n            --total\n          }\n\n          if (total === 0) {\n            break\n          }\n        }\n      }\n    }\n\n    return mappedHashArray\n  }\n\n  /**\n   *\n   * @param isotopes\n   * @returns {*[]}\n   */\n  getIsotopes (isotopes) {\n    return Molecule.isotopeFilter(isotopes, this.atoms)\n  }\n\n  /**\n   * Generates the next atomic index\n   *\n   * @return {number}\n   */\n  generateIndex () {\n    return Molecule.generateNextAtomIndex(this.atoms)\n  }\n\n  /**\n   * Fills a Molecule's properties with the provided object\n   *\n   * @param {Molecule} molecule\n   */\n  fill (molecule) {\n    for (const key in Object.keys(molecule)) {\n      this[key] = molecule[key]\n    }\n  }\n\n  /**\n   *\n   * @param {Atom} atom\n   * @returns {Molecule}\n   */\n  addAtom (atom) {\n    // Reset the molecular hash\n    this.molecularHash = null\n\n    // Set atom's index\n    atom.index = this.generateIndex()\n    atom.version = this.version\n\n    // Add atom\n    this.atoms.push(atom)\n\n    // Sort atoms\n    this.atoms = Atom.sortAtoms(this.atoms)\n\n    return this\n  }\n\n  /**\n   * Add user remainder atom for ContinuID\n   *\n   * @return {Molecule}\n   */\n  addContinuIdAtom () {\n    // If remainder wallet is not USER token, create a new USER remainder wallet\n    if (!this.remainderWallet || this.remainderWallet.token !== 'USER') {\n      this.remainderWallet = Wallet.create({\n        secret: this.secret,\n        bundle: this.bundle,\n        mlKemParameterSet: this.mlKemParameterSet\n      })\n    }\n\n    // ContinuID metadata for chain integrity validation (matching Rust SDK GAP-07-002).\n    // These are atom meta fields (not core fields), so they don't affect molecular hash.\n    const continuIdMeta = {}\n\n    // previousPosition: the current USER ContinuID position being consumed.\n    // For non-USER source wallets (V/B isotopes), use the explicitly passed\n    // continuIdPosition from createMolecule() instead of the TOKEN wallet position.\n    if (this.continuIdPosition) {\n      continuIdMeta.previousPosition = this.continuIdPosition\n    } else if (this.sourceWallet && this.sourceWallet.position) {\n      continuIdMeta.previousPosition = this.sourceWallet.position\n    }\n\n    // pubkey: ML-KEM public key for encrypted communication\n    if (this.remainderWallet.pubkey) {\n      continuIdMeta.pubkey = this.remainderWallet.pubkey\n    }\n\n    // characters: encoding format for the wallet\n    if (this.remainderWallet.characters) {\n      continuIdMeta.characters = this.remainderWallet.characters\n    }\n\n    this.addAtom(Atom.create({\n      isotope: 'I',\n      wallet: this.remainderWallet,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle,\n      meta: new AtomMeta(continuIdMeta)\n    }))\n    return this\n  }\n\n  /**\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object} meta\n   * @param {object} policy\n   *\n   * @return {Molecule}\n   */\n  addPolicyAtom ({\n    metaType,\n    metaId,\n    meta = {},\n    policy = {}\n  }) {\n    // AtomMeta object initialization\n    const atomMeta = new AtomMeta(meta)\n    atomMeta.addPolicy(policy)\n\n    // F-3 (E2E gauntlet 2026-06-02): sign the policy (R-isotope) atom from the\n    // established ContinuID source wallet, NOT a freshly-derived Wallet.create() at a\n    // random position. As the signing (first) atom in createPolicy(), a fresh-wallet\n    // position is unknown to the validator → \"ContinuID chain validation failed:\n    // signing position … not found as wallet\" (a different position each retry). This\n    // mirrors createRule(), which adds its R-atom at this.sourceWallet.\n    this.addAtom(Atom.create({\n      wallet: this.sourceWallet,\n      isotope: 'R',\n      metaType,\n      metaId,\n      meta: atomMeta\n    }))\n    return this\n  }\n\n  /**\n   * Fuses M >= 2 units of a stackable token held by the source wallet into ONE new unit\n   * delivered to the recipient wallet (contract 9.2). Atoms, in order:\n   *  0 V  source,     -B      tokenUnits = the fused units in source order (the SENT set)\n   *  1 V  burn wallet, +(M-1) tokenUnits = the fused units except the last, caller order\n   *  2 F  recipient,   +1     tokenUnits = [N], N.metas.fusedTokenUnits = all fused triples\n   *  3 V  remainder,   +(B-M) tokenUnits = the source units minus the fused ones\n   * No ContinuID atom: the source token wallet signs at its own position.\n   *\n   * @param {string[]} fusedTokenUnitIds - the unit ids to fuse, caller order\n   * @param {TokenUnit|string} newTokenUnit - the new unit (a string is used as id and name)\n   * @param {Wallet} recipientWallet - the wallet receiving the new unit\n   * @returns {Molecule}\n   */\n  fuseToken ({\n    fusedTokenUnitIds,\n    newTokenUnit,\n    recipientWallet\n  }) {\n    if (fusedTokenUnitIds.length < 2) {\n      throw new TransferBalanceException('Token fusion requires at least two token units')\n    }\n\n    const sourceUnits = this.sourceWallet.tokenUnits\n    const sourceUnitIds = sourceUnits.map(tokenUnit => tokenUnit.id)\n    for (const tokenUnitId of fusedTokenUnitIds) {\n      if (!sourceUnitIds.includes(tokenUnitId)) {\n        throw new TransferBalanceException(`Fused token unit ID = ${ tokenUnitId } does not found in the source wallet.`)\n      }\n    }\n\n    const newUnit = typeof newTokenUnit === 'string'\n      ? new TokenUnit(newTokenUnit, newTokenUnit, {})\n      : newTokenUnit\n    if (sourceUnitIds.includes(newUnit.id)) {\n      throw new TransferBalanceException('Token fusion unit id already exists in the source wallet')\n    }\n\n    const balance = Number(this.sourceWallet.balance)\n    const fusedCount = fusedTokenUnitIds.length\n    if (balance < fusedCount) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Fused units in caller order; SENT (source) and KEPT (remainder) sets in source order\n    const fusedUnits = fusedTokenUnitIds.map(tokenUnitId => sourceUnits.find(tokenUnit => tokenUnit.id === tokenUnitId))\n    this.sourceWallet.tokenUnits = sourceUnits.filter(tokenUnit => fusedTokenUnitIds.includes(tokenUnit.id))\n    this.remainderWallet.tokenUnits = sourceUnits.filter(tokenUnit => !fusedTokenUnitIds.includes(tokenUnit.id))\n\n    // Burn recipient built as burnToken() builds it; it takes all fused units but the last\n    const burnWallet = new Wallet({\n      bundle: BURN_BUNDLE,\n      token: this.sourceWallet.token,\n      mlKemParameterSet: this.mlKemParameterSet\n    })\n    burnWallet.initBatchId({ sourceWallet: this.sourceWallet })\n    burnWallet.tokenUnits = fusedUnits.slice(0, -1)\n\n    // The new unit records every fused unit; the last one is absorbed by the F atom\n    recipientWallet.tokenUnits = [\n      new TokenUnit(newUnit.id, newUnit.name, {\n        ...newUnit.metas,\n        fusedTokenUnits: fusedUnits.map(tokenUnit => tokenUnit.toData())\n      })\n    ]\n\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -balance\n    }))\n\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: burnWallet,\n      value: fusedCount - 1,\n      metaType: 'walletBundle',\n      metaId: BURN_BUNDLE\n    }))\n\n    this.addAtom(Atom.create({\n      isotope: 'F',\n      wallet: recipientWallet,\n      value: 1,\n      metaType: 'walletBundle',\n      metaId: recipientWallet.bundle\n    }))\n\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: balance - fusedCount,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   * Burns some amount of tokens from a wallet\n   *\n   * @param {number} amount\n   * @param {string|null} walletBundle\n   * @return {Molecule}\n   */\n  burnToken ({\n    amount,\n    walletBundle = null\n  }) {\n    if (amount < 0.0) {\n      throw new NegativeAmountException('Molecule::burnToken() - Amount to burn must be positive!')\n    }\n\n    if ((this.sourceWallet.balance - amount) < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Create burn address wallet (null bundle = token destruction)\n    const burnWallet = new Wallet({\n      bundle: BURN_BUNDLE,\n      token: this.sourceWallet.token,\n      mlKemParameterSet: this.mlKemParameterSet\n    })\n\n    // V-atom 1: Debit full balance from source\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance\n    }))\n\n    // V-atom 2: Credit burn amount to burn address\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: burnWallet,\n      value: amount,\n      metaType: 'walletBundle',\n      metaId: burnWallet.bundle\n    }))\n\n    // V-atom 3: Remainder back to source identity\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   * Mints more supply of an existing token (contract 9.1): a C atom signed by the source\n   * (USER) wallet like the createToken C atom, then the ContinuID atom. Metas, in order:\n   * action = add; address, position, pubkey of the credited wallet; batchId only when the\n   * credited wallet has one; tokenUnits only when units are given.\n   *\n   * @param {Wallet} creditedWallet - the identity's wallet for the token that receives the supply\n   * @param {number|null} amount - the fungible amount; with units, null or the unit count\n   * @param {array} units - new token units as [id, name, metas] triples (stackable)\n   * @return {Molecule}\n   */\n  replenishToken ({\n    creditedWallet,\n    amount = null,\n    units = []\n  }) {\n    const tokenUnits = Wallet.getTokenUnits(units)\n    if (tokenUnits.length > 0) {\n      if (amount !== null && Number(amount) !== tokenUnits.length) {\n        throw new StackableUnitAmountException()\n      }\n      amount = tokenUnits.length\n    }\n\n    if (!(Number(amount) > 0)) {\n      throw new NegativeAmountException('Molecule::replenishToken() - Amount to replenish must be positive!')\n    }\n\n    const meta = {\n      action: 'add',\n      address: creditedWallet.address,\n      position: creditedWallet.position,\n      pubkey: creditedWallet.pubkey\n    }\n    if (creditedWallet.batchId) {\n      meta.batchId = creditedWallet.batchId\n    }\n    if (tokenUnits.length > 0) {\n      meta.tokenUnits = JSON.stringify(tokenUnits.map(tokenUnit => tokenUnit.toData()))\n    }\n\n    this.addAtom(Atom.create({\n      isotope: 'C',\n      wallet: this.sourceWallet,\n      value: amount,\n      metaType: 'token',\n      metaId: creditedWallet.token,\n      meta: new AtomMeta(meta),\n      batchId: creditedWallet.batchId\n    }))\n\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Initialize a V-type molecule to transfer value from one wallet to another, with a third,\n   * regenerated wallet receiving the remainder\n   *\n   * @param {Wallet} recipientWallet\n   * @param {number} amount\n   * @return {Molecule}\n   */\n  initValue ({\n    recipientWallet,\n    amount\n  }) {\n    // Canonical token transfer (incl. stackable): a UTXO-style FULL-balance debit + remainder.\n    // The source wallet is fully drained (-balance) and the change returns via the remainder atom,\n    // so the 3 V-atoms conserve (sum == 0) and the validator's stackable full-drain guard accepts.\n    // Per-unit (stackable) movement is layered by calling Wallet.splitUnits(units, remainder,\n    // recipient) BEFORE this — there is no separate partial-debit transfer mode.\n    if (this.sourceWallet.balance - amount < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Initializing a new Atom to remove tokens from source (debit full balance)\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance\n    }))\n    // Initializing a new Atom to add tokens to recipient\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: recipientWallet,\n      value: amount,\n      metaType: 'walletBundle',\n      metaId: recipientWallet.bundle\n    }))\n    // Initializing a remainder atom\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   * Multi-recipient value transfer (WP line 544: one molecule funds N recipients).\n   *\n   * Builds 1 source atom (full-balance debit, carrying the SENT union of all units) + one atom\n   * per recipient (its amount + its own units, walletBundle-bonded) + 1 remainder atom (the KEPT\n   * change). Conservation: -balance + Σ amounts + (balance - Σ amounts) == 0.\n   *\n   * Per-unit (stackable) routing is layered by calling Wallet.splitUnitsMulti(...) BEFORE this —\n   * it sets the source's tokenUnits to the union, each recipient's to its subset, and the\n   * remainder's to the kept units. The single-recipient initValue() is the N=1 special case.\n   *\n   * @param {Wallet[]} recipientWallets\n   * @param {number[]} amounts - parallel to recipientWallets\n   * @return {Molecule}\n   */\n  initValues ({\n    recipientWallets,\n    amounts\n  }) {\n    const total = amounts.reduce((sum, value) => sum + Number(value), 0)\n\n    if (this.sourceWallet.balance - total < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Source atom: debit the full balance (UTXO); carries the SENT union of all units\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance\n    }))\n\n    // One atom per recipient: its amount + its own units, bonded to the recipient bundle\n    recipientWallets.forEach((recipientWallet, index) => {\n      this.addAtom(Atom.create({\n        isotope: 'V',\n        wallet: recipientWallet,\n        value: amounts[index],\n        metaType: 'walletBundle',\n        metaId: recipientWallet.bundle\n      }))\n    })\n\n    // Remainder atom: the change back to the sender; carries the KEPT units\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - total,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   *\n   * @param amount\n   * @param tradeRates\n   */\n  initDepositBuffer ({\n    amount,\n    tradeRates\n  }) {\n    if (this.sourceWallet.balance - amount < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Create a buffer wallet\n    const bufferWallet = Wallet.create({\n      secret: this.secret,\n      bundle: this.bundle,\n      token: this.sourceWallet.token,\n      batchId: this.sourceWallet.batchId,\n      mlKemParameterSet: this.mlKemParameterSet\n    })\n    bufferWallet.tradeRates = tradeRates\n\n    // Initializing a new Atom to remove tokens from source (debit full balance)\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance\n    }))\n\n    // Initializing a new Atom to add tokens to recipient\n    this.addAtom(Atom.create({\n      isotope: 'B',\n      wallet: bufferWallet,\n      value: amount,\n      metaType: 'walletBundle',\n      metaId: this.sourceWallet.bundle\n    }))\n\n    this.addAtom(Atom.create({\n      isotope: 'V',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.sourceWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   *\n   * @param {{}} recipients\n   * @returns {Molecule}\n   */\n  initWithdrawBuffer ({\n    recipients\n  }) {\n    // Calculate final amount from all recipients\n    let amount = 0\n    for (const recipientAmount of Object.values(recipients || {})) {\n      amount += recipientAmount\n    }\n    if (this.sourceWallet.balance - amount < 0) {\n      throw new BalanceInsufficientException()\n    }\n\n    // Initializing a new Atom to remove tokens from source (debit full balance)\n    this.addAtom(Atom.create({\n      isotope: 'B',\n      wallet: this.sourceWallet,\n      value: -this.sourceWallet.balance,\n      metaType: 'walletBundle',\n      metaId: this.sourceWallet.bundle\n    }))\n\n    // Initializing a new Atom to add tokens to recipient\n    for (const [recipientBundle, recipientAmount] of Object.entries(recipients || {})) {\n      this.addAtom(new Atom({\n        isotope: 'V',\n        token: this.sourceWallet.token,\n        value: recipientAmount,\n        batchId: this.sourceWallet.batchId ? generateBatchId({}) : null,\n        metaType: 'walletBundle',\n        metaId: recipientBundle\n      }))\n    }\n\n    this.addAtom(Atom.create({\n      isotope: 'B',\n      wallet: this.remainderWallet,\n      value: this.sourceWallet.balance - amount,\n      metaType: 'walletBundle',\n      metaId: this.remainderWallet.bundle\n    }))\n\n    return this\n  }\n\n  /**\n   * Initialize a C-type molecule to issue a new type of token\n   *\n   * @param {Wallet} recipientWallet - wallet receiving the tokens. Needs to be initialized for the new token beforehand.\n   * @param {number} amount - how many of the token we are initially issuing (for fungible tokens only)\n   * @param {array|object} meta - additional fields to configure the token\n   * @return {Molecule}\n   */\n  initTokenCreation ({\n    recipientWallet,\n    amount,\n    meta\n  }) {\n    const atomMeta = new AtomMeta(meta)\n    atomMeta.setMetaWallet(recipientWallet)\n\n    // The primary atom tells the ledger that a certain amount of the new token is being issued.\n    this.addAtom(Atom.create({\n      isotope: 'C',\n      wallet: this.sourceWallet,\n      value: amount,\n      metaType: 'token',\n      metaId: recipientWallet.token,\n      meta: atomMeta,\n      batchId: recipientWallet.batchId\n    }))\n\n    // User remainder atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object[]} rule,\n   * @param {object} policy\n   * @return {Molecule}\n   */\n  createRule ({\n    metaType,\n    metaId,\n    rule,\n    policy = {}\n  }) {\n    const $rules = []\n\n    for (const $rule of rule) {\n      $rules.push($rule instanceof Rule ? $rule : Rule.toObject($rule))\n    }\n\n    // Create atom meta with rules\n    const atomMeta = new AtomMeta({\n      rule: JSON.stringify($rules)\n    })\n\n    // Add policies to meta object\n    atomMeta.addPolicy(policy)\n\n    this.addAtom(Atom.create({\n      isotope: 'R',\n      wallet: this.sourceWallet,\n      metaType,\n      metaId,\n      meta: atomMeta\n    }))\n\n    // User continuID atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Builds Atoms to define a new wallet on the ledger\n   *\n   * @param {Wallet} wallet\n   * @param {AtomMeta|null} atomMeta\n   * @return {Molecule}\n   */\n  initWalletCreation (wallet, atomMeta = null) {\n    if (!atomMeta) {\n      atomMeta = new AtomMeta()\n    }\n    atomMeta.setMetaWallet(wallet)\n    const creationAtom = Atom.create({\n      isotope: 'C',\n      wallet: this.sourceWallet,\n      metaType: 'wallet',\n      metaId: wallet.address,\n      meta: atomMeta,\n      batchId: wallet.batchId\n    })\n    this.addAtom(creationAtom)\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Init shadow wallet claim\n   *\n   * @param wallet\n   */\n  initShadowWalletClaim (wallet) {\n    const atomMeta = (new AtomMeta()).setShadowWalletClaim(true)\n    return this.initWalletCreation(wallet, atomMeta)\n  }\n\n  /**\n   * Builds Atoms to define a new identifier on the ledger\n   *\n   * @param {string} type - phone or email\n   * @param {string} contact - phone number or email string\n   * @param {string} code -\n   *\n   * @return {Molecule}\n   */\n  initIdentifierCreation ({\n    type,\n    contact,\n    code\n  }) {\n    const meta = {\n      code,\n      hash: generateBundleHash(contact.trim(), 'Molecule::initIdentifierCreation')\n    }\n\n    this.addAtom(Atom.create({\n      isotope: 'C',\n      wallet: this.sourceWallet,\n      metaType: 'identifier',\n      metaId: type,\n      meta: new AtomMeta(meta)\n    }))\n\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Initialize an M-type molecule with the given data\n   *\n   * @param {array|object} meta\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object} policy\n   * @return {Molecule}\n   */\n  initMeta ({\n    meta,\n    metaType,\n    metaId,\n    policy\n  }) {\n    // Initializing a new Atom to hold our metadata\n    this.addAtom(Atom.create({\n      isotope: 'M',\n      wallet: this.sourceWallet,\n      metaType,\n      metaId,\n      meta: new AtomMeta(meta)\n    }))\n\n    // Only add policy atom if policy is provided and not empty\n    if (policy && Object.keys(policy).length > 0) {\n      this.addPolicyAtom({\n        metaType,\n        metaId,\n        meta,\n        policy\n      })\n    }\n\n    // User remainder atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Initialize a P-type molecule for peer registration\n   *\n   * @param {string} host - The peer host URL to register\n   * @return {Molecule}\n   */\n  initPeering ({\n    host\n  }) {\n    this.addAtom(Atom.create({\n      isotope: 'P',\n      wallet: this.sourceWallet,\n      metaType: 'walletBundle',\n      metaId: this.bundle,\n      meta: new AtomMeta({ peerHost: host })\n    }))\n\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Initialize an A-type molecule for an append request\n   *\n   * @param {string} metaType - The target MetaType to append to\n   * @param {string} metaId - The target MetaId to append to\n   * @param {string} action - The action to perform\n   * @param {object} meta - Additional metadata\n   * @return {Molecule}\n   */\n  initAppendRequest ({\n    metaType,\n    metaId,\n    action,\n    meta = {}\n  }) {\n    this.addAtom(Atom.create({\n      isotope: 'A',\n      wallet: this.sourceWallet,\n      metaType,\n      metaId,\n      meta: new AtomMeta({ action, ...meta })\n    }))\n\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Arranges atoms to request tokens from the node itself\n   *\n   * @param {string} token\n   * @param {Number} amount\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {array|object} meta\n   * @param {string|null} batchId\n   *\n   * @return {Molecule}\n   */\n  initTokenRequest ({\n    token,\n    amount,\n    metaType,\n    metaId,\n    meta = {},\n    batchId = null\n  }) {\n    meta.token = token\n    meta.amount = String(amount)\n\n    this.addAtom(Atom.create({\n      isotope: 'T',\n      wallet: this.sourceWallet,\n      value: amount,\n      metaType,\n      metaId,\n      meta: new AtomMeta(meta),\n      batchId\n    }))\n\n    // User remainder atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Arranges atoms to request an authorization token from the node\n   *\n   * @param {object} meta\n   *\n   * @return {Molecule}\n   */\n  initAuthorization ({ meta }) {\n    this.addAtom(Atom.create({\n      isotope: 'U',\n      wallet: this.sourceWallet,\n      meta: new AtomMeta(meta)\n    }))\n\n    // User remainder atom\n    this.addContinuIdAtom()\n\n    return this\n  }\n\n  /**\n   * Creates a one-time signature for a molecule and breaks it up across multiple atoms within that\n   * molecule. Resulting 4096 byte (2048 character) string is the one-time signature, which is then compressed.\n   *\n   * @param {string|null} bundle\n   * @param {boolean} anonymous\n   * @param {boolean} compressed\n   * @return {string|null}\n   * @throws {AtomsMissingException}\n   */\n  sign ({\n    bundle = null,\n    anonymous = false,\n    compressed = true\n  } = {}) {\n    // Do we have atoms?\n    if (this.atoms.length === 0 || this.atoms.filter(atom => !(atom instanceof Atom)).length !== 0) {\n      throw new AtomsMissingException()\n    }\n\n    // Derive the user's bundle\n    if (!anonymous && !this.bundle) {\n      this.bundle = bundle || generateBundleHash(this.secret, 'Molecule::sign')\n    }\n\n    // Hash atoms to get molecular hash\n    this.molecularHash = Atom.hashAtoms({\n      atoms: this.atoms\n    })\n\n    // Signing atom\n    const signingAtom = this.atoms[0]\n\n    // Signing position is required\n    if (!signingAtom.position) {\n      throw new SignatureMalformedException('Signing wallet must have a position!')\n    }\n\n    // Generate the private signing key for this molecule\n    const key = Wallet.generateKey({\n      secret: this.secret,\n      token: signingAtom.token,\n      position: signingAtom.position\n    })\n    // Subdivide Kk into 16 segments of 256 bytes (128 characters) each\n    const keyChunks = chunkSubstr(key, 128)\n    // Convert Hm to numeric notation, and then normalize\n    const normalizedHash = this.normalizedHash()\n\n    // Building a one-time-signature: kcore advances all 16 chains at once when it is available\n    // and the inputs are eligible; otherwise the per-chunk SHAKE256 loop below does the same work.\n    let signatureFragments = kcore.chainsHex(key, keyChunks.map((_, i) => 8 - normalizedHash[i]))\n\n    if (signatureFragments === null) {\n      signatureFragments = ''\n      for (const index in keyChunks) {\n        let workingChunk = keyChunks[index]\n\n        for (let iterationCount = 0, condition = 8 - normalizedHash[index]; iterationCount < condition; iterationCount++) {\n          workingChunk = (new JsSHA('SHAKE256', 'TEXT')).update(workingChunk).getHash('HEX', { outputLen: 512 })\n        }\n        signatureFragments += workingChunk\n      }\n    }\n\n    // Compressing the OTS\n    if (compressed) {\n      signatureFragments = hexToBase64(signatureFragments)\n    }\n\n    // Chunking the signature across multiple atoms\n    const chunkedSignature = chunkSubstr(signatureFragments, Math.ceil(signatureFragments.length / this.atoms.length))\n\n    let lastPosition = null\n\n    for (let chunkCount = 0, condition = chunkedSignature.length; chunkCount < condition; chunkCount++) {\n      this.atoms[chunkCount].otsFragment = chunkedSignature[chunkCount]\n      lastPosition = this.atoms[chunkCount].position\n    }\n\n    return lastPosition\n  }\n\n  /**\n   * Synchronous signing — identical to sign() since all operations are CPU-bound.\n   * Provided for API parity with Rust SDK's sign_sync().\n   *\n   * @param {object} options\n   * @param {string|null} options.bundle\n   * @param {boolean} options.anonymous\n   * @param {boolean} options.compressed\n   * @return {string|null}\n   */\n  signSync (options = {}) {\n    return this.sign(options)\n  }\n\n  /**\n   * Returns the base cell slug portion\n   *\n   * @return {string}\n   */\n  cellSlugBase () {\n    return (this.cellSlug || '').split(this.cellSlugDelimiter)[0]\n  }\n\n  /**\n   * Returns JSON-ready object for cross-SDK compatibility (2025 JS best practices)\n   *\n   * Includes all necessary fields for cross-SDK validation while excluding sensitive data.\n   * Follows 2025 JavaScript best practices with proper error handling and type safety.\n   *\n   * @param {Object} options - Serialization options\n   * @param {boolean} options.includeValidationContext - Include sourceWallet/remainderWallet for validation (default: false)\n   * @param {boolean} options.includeOtsFragments - Include OTS signature fragments (default: true)\n   * @param {boolean} options.secureMode - Extra security checks (default: false)\n   * @return {Object} JSON-serializable object\n   * @throws {Error} If molecule is in invalid state for serialization\n   */\n  toJSON (options = {}) {\n    const {\n      includeValidationContext = false,\n      includeOtsFragments = true\n    } = options\n\n    try {\n      // Core molecule properties (server-compatible fields only)\n      const serialized = {\n        status: this.status,\n        molecularHash: this.molecularHash,\n        createdAt: this.createdAt,\n        cellSlug: this.cellSlug,\n        bundle: this.bundle,\n\n        // Serialized atoms array with optional OTS fragments\n        atoms: this.atoms.map(atom => atom.toJSON({\n          includeOtsFragments\n        }))\n      }\n\n      // Parent molecular hashes for DAG linkage (only include when non-empty\n      // to maintain backward compatibility with servers that don't support it)\n      if (this.parentHashes && this.parentHashes.length > 0) {\n        serialized.parentHashes = this.parentHashes\n      }\n\n      // Extended context for Rust validator and local validation\n      if (includeValidationContext) {\n        serialized.cellSlugOrigin = this.cellSlugOrigin\n        serialized.version = this.version\n\n        if (this.sourceWallet) {\n          serialized.sourceWallet = {\n            address: this.sourceWallet.address,\n            position: this.sourceWallet.position,\n            token: this.sourceWallet.token,\n            balance: this.sourceWallet.balance || '0',\n            bundle: this.sourceWallet.bundle,\n            batchId: this.sourceWallet.batchId || null,\n            characters: this.sourceWallet.characters || 'BASE64',\n            pubkey: this.sourceWallet.pubkey || null,\n            tokenUnits: this.sourceWallet.tokenUnits || [],\n            tradeRates: this.sourceWallet.tradeRates || {},\n            molecules: this.sourceWallet.molecules || {}\n          }\n        }\n\n        if (this.remainderWallet) {\n          serialized.remainderWallet = {\n            address: this.remainderWallet.address,\n            position: this.remainderWallet.position,\n            token: this.remainderWallet.token,\n            balance: this.remainderWallet.balance || '0',\n            bundle: this.remainderWallet.bundle,\n            batchId: this.remainderWallet.batchId || null,\n            characters: this.remainderWallet.characters || 'BASE64',\n            pubkey: this.remainderWallet.pubkey || null,\n            tokenUnits: this.remainderWallet.tokenUnits || [],\n            tradeRates: this.remainderWallet.tradeRates || {},\n            molecules: this.remainderWallet.molecules || {}\n          }\n        }\n      }\n\n      return serialized\n    } catch (error) {\n      throw new Error(`Molecule serialization failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Creates a Molecule instance from JSON data (2025 JS best practices)\n   *\n   * Handles cross-SDK deserialization with robust error handling and validation.\n   * Essential for cross-platform molecule validation and compatibility testing.\n   *\n   * @param {string|Object} json - JSON string or object to deserialize\n   * @param {Object} options - Deserialization options\n   * @param {boolean} options.includeValidationContext - Reconstruct sourceWallet/remainderWallet (default: false)\n   * @param {boolean} options.validateStructure - Validate required fields (default: true)\n   * @return {Molecule} Reconstructed molecule instance\n   * @throws {Error} If JSON is invalid or required fields are missing\n   */\n  static fromJSON (json, options = {}) {\n    const {\n      includeValidationContext = false,\n      validateStructure = true\n    } = options\n\n    try {\n      // Parse JSON safely\n      const data = typeof json === 'string' ? JSON.parse(json) : json\n\n      // Validate required fields in strict mode\n      if (validateStructure) {\n        if (!data.molecularHash || !Array.isArray(data.atoms)) {\n          throw new Error('Invalid molecule data: missing molecularHash or atoms array')\n        }\n      }\n\n      // Create minimal molecule instance (never include secret from JSON)\n      const molecule = new Molecule({\n        secret: null,\n        bundle: data.bundle || null,\n        cellSlug: data.cellSlug || null,\n        version: data.version || null\n      })\n\n      // Populate core properties\n      molecule.status = data.status\n      molecule.molecularHash = data.molecularHash\n      molecule.createdAt = data.createdAt || String(+new Date())\n      molecule.cellSlugOrigin = data.cellSlugOrigin\n      molecule.parentHashes = Array.isArray(data.parentHashes) ? [...data.parentHashes] : []\n\n      // Reconstruct atoms array with proper Atom instances\n      if (Array.isArray(data.atoms)) {\n        molecule.atoms = data.atoms.map((atomData, index) => {\n          try {\n            return Atom.fromJSON(atomData)\n          } catch (error) {\n            throw new Error(`Failed to reconstruct atom ${index}: ${error.message}`)\n          }\n        })\n      }\n\n      // Reconstruct validation context if available and requested\n      if (includeValidationContext) {\n        if (data.sourceWallet) {\n          // Create source wallet for validation (without secret for security)\n          molecule.sourceWallet = new Wallet({\n            secret: null,\n            token: data.sourceWallet.token,\n            position: data.sourceWallet.position,\n            bundle: data.sourceWallet.bundle,\n            batchId: data.sourceWallet.batchId,\n            characters: data.sourceWallet.characters,\n            mlKemParameterSet: molecule.mlKemParameterSet\n          })\n\n          // Set additional properties for validation context\n          molecule.sourceWallet.balance = String(data.sourceWallet.balance != null ? data.sourceWallet.balance : 0)\n          molecule.sourceWallet.address = data.sourceWallet.address\n          if (data.sourceWallet.pubkey) {\n            molecule.sourceWallet.pubkey = data.sourceWallet.pubkey\n          }\n          molecule.sourceWallet.tokenUnits = data.sourceWallet.tokenUnits || []\n          molecule.sourceWallet.tradeRates = data.sourceWallet.tradeRates || {}\n          molecule.sourceWallet.molecules = data.sourceWallet.molecules || {}\n        }\n\n        if (data.remainderWallet) {\n          // Create remainder wallet for validation (without secret for security)\n          molecule.remainderWallet = new Wallet({\n            secret: null,\n            token: data.remainderWallet.token,\n            position: data.remainderWallet.position,\n            bundle: data.remainderWallet.bundle,\n            batchId: data.remainderWallet.batchId,\n            characters: data.remainderWallet.characters,\n            mlKemParameterSet: molecule.mlKemParameterSet\n          })\n\n          // Set additional properties for validation context\n          molecule.remainderWallet.balance = String(data.remainderWallet.balance != null ? data.remainderWallet.balance : 0)\n          molecule.remainderWallet.address = data.remainderWallet.address\n          if (data.remainderWallet.pubkey) {\n            molecule.remainderWallet.pubkey = data.remainderWallet.pubkey\n          }\n          molecule.remainderWallet.tokenUnits = data.remainderWallet.tokenUnits || []\n          molecule.remainderWallet.tradeRates = data.remainderWallet.tradeRates || {}\n          molecule.remainderWallet.molecules = data.remainderWallet.molecules || {}\n        }\n      }\n\n      return molecule\n    } catch (error) {\n      throw new Error(`Molecule deserialization failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Validates the current molecular structure\n   *\n   * @param senderWallet\n   */\n  check (senderWallet = null) {\n    return (new CheckMolecule(this)).verify(senderWallet)\n  }\n\n  /**\n   * Convert Hm to numeric notation via EnumerateMolecule(Hm)\n   *\n   * @returns {Array}\n   */\n  normalizedHash () {\n    return Molecule.normalize(Molecule.enumerate(this.molecularHash))\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Wallet from './Wallet.js'\n\n/**\n *\n */\nexport default class AuthToken {\n  /**\n   *\n   * @param {string} token\n   * @param {number} expiresAt\n   * @param {boolean} encrypt\n   * @param {string} pubkey\n   */\n  constructor ({\n    token,\n    expiresAt,\n    encrypt,\n    pubkey\n  }) {\n    this.$__token = token\n    this.$__expiresAt = expiresAt\n    this.$__pubkey = pubkey\n    this.$__encrypt = encrypt\n  }\n\n  /**\n   *\n   * @param data\n   * @param wallet\n   * @returns {AuthToken}\n   */\n  static create (data, wallet) {\n    const authToken = new AuthToken(data)\n    authToken.setWallet(wallet)\n    return authToken\n  }\n\n  /**\n   * ML-KEM parameter set a restored session must use, resolved in three tiers:\n   * an explicit snapshot field, then the stored validator key's length, then ML-KEM-768.\n   *\n   * The final tier is deliberately NOT the constructor default. A snapshot with neither an\n   * explicit field nor a recognisable key can only have come from a pre-bump build, and every\n   * pre-bump build was 768-only — defaulting to 1024 would make the restored wallet advertise\n   * a public key the validator never recorded for that token.\n   *\n   * @param {object} snapshot\n   * @return {number}\n   */\n  static resolveMlKemParameterSet (snapshot) {\n    const explicit = snapshot.wallet && snapshot.wallet.mlKemParameterSet\n    if (explicit) {\n      return Number(explicit)\n    }\n    return Wallet.mlKemParameterSetFromPubkey(snapshot.pubkey) || 768\n  }\n\n  /**\n   * Rebuilds a session from {@link AuthToken#getSnapshot}. A snapshot without a wallet token\n   * predates re-logins signed from the ContinuID USER wallet, so it was bound to an AUTH wallet.\n   *\n   * @param {object} snapshot\n   * @param {string} secret\n   * @return {AuthToken}\n   */\n  static restore (snapshot, secret) {\n    const wallet = new Wallet({\n      secret,\n      token: snapshot.wallet.token || 'AUTH',\n      position: snapshot.wallet.position,\n      characters: snapshot.wallet.characters,\n      mlKemParameterSet: AuthToken.resolveMlKemParameterSet(snapshot)\n    })\n    return AuthToken.create({\n      token: snapshot.token,\n      expiresAt: snapshot.expiresAt,\n      pubkey: snapshot.pubkey,\n      encrypt: snapshot.encrypt\n    }, wallet)\n  }\n\n  /**\n   *\n   * @param {Wallet} wallet\n   */\n  setWallet (wallet) {\n    this.$__wallet = wallet\n  }\n\n  /**\n   * Get a wallet\n   * @return {Wallet}\n   */\n  getWallet () {\n    return this.$__wallet\n  }\n\n  /**\n   *\n   * @return {{wallet: {token, characters, position, mlKemParameterSet}, encrypt, expiresAt, token, pubkey}}\n   */\n  getSnapshot () {\n    return {\n      token: this.$__token,\n      expiresAt: this.$__expiresAt,\n      pubkey: this.$__pubkey,\n      encrypt: this.$__encrypt,\n      wallet: {\n        token: this.$__wallet.token,\n        position: this.$__wallet.position,\n        characters: this.$__wallet.characters,\n        mlKemParameterSet: this.$__wallet.mlKemParameterSet\n      }\n    }\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  getToken () {\n    return this.$__token\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  getPubkey () {\n    return this.$__pubkey\n  }\n\n  /**\n   *\n   * @return {number}\n   */\n  getExpireInterval () {\n    return (this.$__expiresAt * 1000) - Date.now()\n  }\n\n  /**\n   *\n   * @return {boolean}\n   */\n  isExpired () {\n    return !this.$__expiresAt || this.getExpireInterval() < 0\n  }\n\n  /**\n   * Get auth data for the final GraphQL client\n   * @return {{wallet: Wallet, token: string, pubkey: string}}\n   */\n  getAuthData () {\n    return {\n      token: this.getToken(),\n      pubkey: this.getPubkey(),\n      wallet: this.getWallet()\n    }\n  }\n}\n","/**\n * Utility class for accessing nested object properties using dot notation\n */\nexport default class Dot {\n  /**\n   * Initialize the Dot utility with the given object and key path\n   * @param {object|array} obj - The object or array to traverse\n   * @param {string} keys - The dot-notated string of keys\n   * @private\n   */\n  static __init (obj, keys) {\n    this.arr = String(keys).split('.')\n    this.key = this.arr.shift()\n\n    // Convert to number if the key is a valid integer\n    const numberKey = Number(this.key)\n    if (Number.isInteger(numberKey)) {\n      this.key = numberKey\n    }\n\n    this.__nextKey = this.arr.length\n    this.__next = this.__tic(obj)\n  }\n\n  /**\n   * Check if the current key exists in the object\n   * @param {object|array} obj - The object or array to check\n   * @return {boolean} - Whether the key exists\n   * @private\n   */\n  static __tic (obj) {\n    if (!Array.isArray(obj) && !(obj instanceof Object)) {\n      return false\n    }\n\n    return typeof obj[this.key] !== 'undefined'\n  }\n\n  /**\n   * Check if a nested property exists in an object using dot notation\n   * @param {object|array} obj - The object or array to search\n   * @param {string} keys - The path to the property, using dot notation\n   * @return {boolean} - True if the property exists, false otherwise\n   */\n  static has (obj, keys) {\n    this.__init(obj, keys)\n\n    if (!this.__next) {\n      return false\n    }\n    if (this.__nextKey === 0) {\n      return true\n    }\n\n    return this.has(obj[this.key], this.arr.join('.'))\n  }\n\n  /**\n   * Get a nested property from an object using dot notation\n   * @param {object|array} obj - The object or array to search\n   * @param {string} keys - The path to the property, using dot notation\n   * @param {*} [def=null] - The default value to return if the property is not found\n   * @return {*} - The value of the property, or the default value if not found\n   */\n  static get (obj, keys, def = null) {\n    this.__init(obj, keys)\n\n    if (!this.__next) {\n      return def\n    }\n    if (this.__nextKey === 0) {\n      return obj[this.key]\n    }\n\n    return this.get(obj[this.key], this.arr.join('.'), def)\n  }\n\n  /**\n   * Set a nested property in an object using dot notation\n   * @param {object|array} obj - The object or array to modify\n   * @param {string} keys - The path to the property, using dot notation\n   * @param {*} value - The value to set\n   * @return {object|array} - The modified object or array\n   */\n  static set (obj, keys, value) {\n    const parts = keys.split('.')\n    let current = obj\n    const lastIndex = parts.length - 1\n\n    for (let i = 0; i < lastIndex; i++) {\n      const key = parts[i]\n      const numberKey = Number(key)\n      const useNumberKey = Number.isInteger(numberKey)\n\n      if (!(useNumberKey ? numberKey : key in current)) {\n        current[useNumberKey ? numberKey : key] = parts[i + 1].match(/^\\d+$/) ? [] : {}\n      }\n      current = current[useNumberKey ? numberKey : key]\n    }\n\n    const lastKey = parts[lastIndex]\n    const lastNumberKey = Number(lastKey)\n    current[Number.isInteger(lastNumberKey) ? lastNumberKey : lastKey] = value\n\n    return obj\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport BaseException from './BaseException.js'\n\n/**\n * Exception thrown when secret storage or hardware envelope encryption fails\n */\nexport default class SecretStorageException extends BaseException {\n  /**\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Secret storage operation failed', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'SecretStorageException'\n  }\n\n  /**\n   * Factory method: secret not found for bundle\n   *\n   * @param {string} bundleHash\n   * @returns {SecretStorageException}\n   */\n  static notFound (bundleHash) {\n    return new SecretStorageException(`Secret not found for bundle: ${bundleHash}`)\n  }\n\n  /**\n   * Factory method: decryption failed\n   *\n   * @param {string} [reason]\n   * @returns {SecretStorageException}\n   */\n  static decryptionFailed (reason = 'Invalid passphrase or corrupted ciphertext') {\n    return new SecretStorageException(`Failed to decrypt master secret: ${reason}`)\n  }\n\n  /**\n   * Factory method: provider unavailable\n   *\n   * @param {string} provider\n   * @param {string} [reason]\n   * @returns {SecretStorageException}\n   */\n  static unavailable (provider, reason = 'Hardware or API not accessible') {\n    return new SecretStorageException(`Secret storage provider '${provider}' is unavailable: ${reason}`)\n  }\n\n  /**\n   * Factory method: validation error\n   *\n   * @param {string} message\n   * @returns {SecretStorageException}\n   */\n  static validationError (message) {\n    return new SecretStorageException(message)\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\n/**\n * Memory hygiene and zeroization utilities for sensitive cryptographic material\n */\n\nconst textEncoder = new TextEncoder()\n\n/**\n * Overwrite byte array contents with zeros\n *\n * @param {Uint8Array|number[]} buffer\n */\nexport function zeroizeBytes (buffer) {\n  if (buffer instanceof Uint8Array) {\n    buffer.fill(0)\n  } else if (Array.isArray(buffer)) {\n    for (let i = 0; i < buffer.length; i++) {\n      buffer[i] = 0\n    }\n  }\n}\n\n/**\n * Execute a callback with a byte buffer and guarantee zeroization upon completion\n *\n * @template T\n * @param {Uint8Array} bytes\n * @param {(bytes: Uint8Array) => Promise<T>|T} fn\n * @returns {Promise<T>}\n */\nexport async function withSecureBytes (bytes, fn) {\n  try {\n    return await fn(bytes)\n  } finally {\n    zeroizeBytes(bytes)\n  }\n}\n\n/**\n * Execute a callback with a secret string, ensuring temporary byte buffers are cleared\n *\n * @template T\n * @param {string} secret\n * @param {(cleanSecret: string) => Promise<T>|T} fn\n * @returns {Promise<T>}\n */\nexport async function withSecureString (secret, fn) {\n  const bytes = textEncoder.encode(secret)\n  try {\n    return await fn(secret)\n  } finally {\n    zeroizeBytes(bytes)\n  }\n}\n\n/**\n * Constant-time comparison of two byte arrays or strings to prevent timing attacks\n *\n * @param {Uint8Array|string} a\n * @param {Uint8Array|string} b\n * @returns {boolean}\n */\nexport function constantTimeCompare (a, b) {\n  const bytesA = typeof a === 'string' ? textEncoder.encode(a) : a\n  const bytesB = typeof b === 'string' ? textEncoder.encode(b) : b\n\n  let result = bytesA.length === bytesB.length ? 0 : 1\n  const len = Math.min(bytesA.length, bytesB.length)\n\n  for (let i = 0; i < len; i++) {\n    result |= (bytesA[i] ?? 0) ^ (bytesB[i] ?? 0)\n  }\n\n  if (typeof a === 'string') zeroizeBytes(bytesA)\n  if (typeof b === 'string') zeroizeBytes(bytesB)\n\n  return result === 0\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                            (//////////(                      (////)\n                            (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { zeroizeBytes } from '../libraries/secureMemory.js'\n\nexport const ENVELOPE_ALGORITHM = 'AES-GCM'\nexport const DEFAULT_ITERATIONS = 100000\nexport const SECRET_KEY_PREFIX = 'knishio:secret:'\nexport const RECOVERY_KEY_PREFIX = 'knishio:recovery:'\nconst GCM_IV_LENGTH = 12\nconst SALT_LENGTH = 16\n\nconst textEncoder = new TextEncoder()\n\n/**\n * Helper to convert Uint8Array to base64\n *\n * @param {Uint8Array} bytes\n * @returns {string}\n */\nexport function uint8ArrayToBase64 (bytes) {\n  let binary = ''\n  const len = bytes.byteLength\n  for (let i = 0; i < len; i++) {\n    const byte = bytes[i]\n    if (byte !== undefined) {\n      binary += String.fromCharCode(byte)\n    }\n  }\n  return btoa(binary)\n}\n\n/**\n * Helper to convert base64 to Uint8Array\n *\n * @param {string} base64\n * @returns {Uint8Array}\n */\nexport function base64ToUint8Array (base64) {\n  const binary = atob(base64)\n  const len = binary.length\n  const bytes = new Uint8Array(len)\n  for (let i = 0; i < len; i++) {\n    bytes[i] = binary.charCodeAt(i)\n  }\n  return bytes\n}\n\n/**\n * Derive an AES-GCM CryptoKey from a passphrase and salt using PBKDF2\n *\n * @param {string} passphrase\n * @param {Uint8Array} salt\n * @param {number} [iterations]\n * @returns {Promise<CryptoKey>}\n */\nexport async function deriveEnvelopeKey (passphrase, salt, iterations = DEFAULT_ITERATIONS) {\n  if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle === 'undefined') {\n    throw new SecretStorageException('WebCrypto API is not available')\n  }\n\n  const passphraseBytes = textEncoder.encode(passphrase)\n  try {\n    const baseKey = await globalThis.crypto.subtle.importKey(\n      'raw',\n      passphraseBytes,\n      'PBKDF2',\n      false,\n      ['deriveKey']\n    )\n\n    return await globalThis.crypto.subtle.deriveKey(\n      {\n        name: 'PBKDF2',\n        salt,\n        iterations,\n        hash: 'SHA-256'\n      },\n      baseKey,\n      { name: 'AES-GCM', length: 256 },\n      false,\n      ['encrypt', 'decrypt']\n    )\n  } finally {\n    zeroizeBytes(passphraseBytes)\n  }\n}\n\n/**\n * Seal a secret string into an EncryptedSecretPayload envelope\n *\n * @param {string} secret\n * @param {string} passphrase\n * @param {object} metadata\n * @returns {Promise<object>}\n */\nexport async function sealEnvelope (secret, passphrase, metadata) {\n  if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle === 'undefined') {\n    throw new SecretStorageException('WebCrypto API is not available')\n  }\n\n  const salt = new Uint8Array(SALT_LENGTH)\n  const iv = new Uint8Array(GCM_IV_LENGTH)\n  globalThis.crypto.getRandomValues(salt)\n  globalThis.crypto.getRandomValues(iv)\n\n  const key = await deriveEnvelopeKey(passphrase, salt, DEFAULT_ITERATIONS)\n  const secretBytes = textEncoder.encode(secret)\n\n  try {\n    const encryptedBuffer = await globalThis.crypto.subtle.encrypt(\n      {\n        name: ENVELOPE_ALGORITHM,\n        iv\n      },\n      key,\n      secretBytes\n    )\n\n    const ciphertext = uint8ArrayToBase64(new Uint8Array(encryptedBuffer))\n    return {\n      version: 1,\n      ciphertext,\n      iv: uint8ArrayToBase64(iv),\n      salt: uint8ArrayToBase64(salt),\n      algorithm: ENVELOPE_ALGORITHM,\n      iterations: DEFAULT_ITERATIONS,\n      metadata\n    }\n  } finally {\n    zeroizeBytes(secretBytes)\n  }\n}\n\n/**\n * Open an EncryptedSecretPayload envelope with a passphrase, returning the decrypted secret bytes\n *\n * @param {object} payload\n * @param {string} passphrase\n * @returns {Promise<Uint8Array>}\n */\nexport async function openEnvelope (payload, passphrase) {\n  if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle === 'undefined') {\n    throw new SecretStorageException('WebCrypto API is not available')\n  }\n\n  const salt = base64ToUint8Array(payload.salt)\n  const iv = base64ToUint8Array(payload.iv)\n  const ciphertext = base64ToUint8Array(payload.ciphertext)\n\n  const key = await deriveEnvelopeKey(passphrase, salt, payload.iterations ?? DEFAULT_ITERATIONS)\n  const decryptedBuffer = await globalThis.crypto.subtle.decrypt(\n    {\n      name: ENVELOPE_ALGORITHM,\n      iv\n    },\n    key,\n    ciphertext\n  )\n\n  return new Uint8Array(decryptedBuffer)\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { withSecureString, zeroizeBytes } from '../libraries/secureMemory.js'\nimport { sealEnvelope, openEnvelope } from './secretEnvelope.js'\n\n/**\n * In-memory secret storage provider\n * Used for testing, headless runners, and backward-compatible fallback\n */\nexport default class MemorySecretStorageProvider {\n  constructor () {\n    this.providerType = 'memory'\n    this.secrets = new Map()\n    this.recoverySecrets = new Map()\n  }\n\n  /**\n   * Memory storage is not hardware backed\n   *\n   * @returns {boolean}\n   */\n  isHardwareBacked () {\n    return false\n  }\n\n  /**\n   * Memory storage is always available\n   *\n   * @returns {Promise<boolean>}\n   */\n  async isAvailable () {\n    return true\n  }\n\n  /**\n   * Store a secret in memory\n   *\n   * @param {string} bundleHash\n   * @param {string} secret\n   * @param {{ label?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async storeSecret (bundleHash, secret, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!secret) {\n      throw new SecretStorageException('Secret cannot be empty')\n    }\n\n    const metadata = {\n      bundleHash,\n      label: options.label,\n      createdAt: Date.now(),\n      hardwareBacked: false,\n      providerType: this.providerType\n    }\n\n    this.secrets.set(bundleHash, { secret, metadata })\n\n    if (options.recoveryPassphrase) {\n      const recoveryMetadata = {\n        bundleHash,\n        label: options.label,\n        createdAt: Date.now(),\n        hardwareBacked: false,\n        providerType: 'webcrypto-aes-gcm'\n      }\n      const recoveryPayload = await sealEnvelope(secret, options.recoveryPassphrase, recoveryMetadata)\n      this.recoverySecrets.set(bundleHash, JSON.stringify(recoveryPayload))\n    }\n  }\n\n  /**\n   * Retrieve a secret from memory\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<string|null>}\n   */\n  async retrieveSecret (bundleHash) {\n    const entry = this.secrets.get(bundleHash)\n    return entry ? entry.secret : null\n  }\n\n  /**\n   * Delete a stored secret\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<boolean>}\n   */\n  async deleteSecret (bundleHash) {\n    this.recoverySecrets.delete(bundleHash)\n    return this.secrets.delete(bundleHash)\n  }\n\n  /**\n   * Check if a secret exists\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<boolean>}\n   */\n  async hasSecret (bundleHash) {\n    return this.secrets.has(bundleHash)\n  }\n\n  /**\n   * List all stored secret metadata\n   *\n   * @returns {Promise<Array<{ bundleHash: string, label?: string, createdAt: number, hardwareBacked: boolean, providerType: string }>>}\n   */\n  async listSecrets () {\n    return Array.from(this.secrets.values()).map(entry => ({ ...entry.metadata }))\n  }\n\n  /**\n   * Execute callback with unwrapped secret and ensure cleanup\n   *\n   * @template T\n   * @param {string} bundleHash\n   * @param {(secret: string) => Promise<T>|T} fn\n   * @returns {Promise<T>}\n   */\n  async withSecret (bundleHash, fn) {\n    const entry = this.secrets.get(bundleHash)\n    if (!entry) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    return withSecureString(entry.secret, fn)\n  }\n\n  /**\n   * Clear all secrets from memory\n   */\n  clear () {\n    this.secrets.clear()\n    this.recoverySecrets.clear()\n  }\n\n  /**\n   * Recover a secret using its recovery envelope and restore it\n   *\n   * @param {string} bundleHash\n   * @param {string} recoveryPassphrase\n   * @param {{ label?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async recoverSecret (bundleHash, recoveryPassphrase, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!recoveryPassphrase) {\n      throw new SecretStorageException('Recovery passphrase cannot be empty')\n    }\n\n    const raw = this.recoverySecrets.get(bundleHash)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted recovery payload format')\n    }\n\n    let decryptedBytes\n    try {\n      decryptedBytes = await openEnvelope(payload, recoveryPassphrase)\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n\n    let secretStr\n    try {\n      secretStr = new TextDecoder().decode(decryptedBytes)\n    } finally {\n      zeroizeBytes(decryptedBytes)\n    }\n\n    await this.storeSecret(bundleHash, secretStr, {\n      ...options,\n      recoveryPassphrase\n    })\n  }\n}\n","// Value determines by min sql decimal precision\nconst multiplier = 10 ** 18\n\nexport default class Decimal {\n  /**\n   * @param {number} value\n   * @return {number}\n   */\n  static val (value) {\n    if (Math.abs(value * multiplier) < 1) {\n      return 0.0\n    }\n\n    return value\n  }\n\n  /**\n   * @param {number} value1\n   * @param {number} value2\n   * @param {boolean} debug\n   * @return {number}\n   */\n  static cmp (value1, value2, debug = false) {\n    const val1 = Decimal.val(value1) * multiplier\n    const val2 = Decimal.val(value2) * multiplier\n\n    // Equal\n    if (Math.abs(val1 - val2) < 1) {\n      return 0\n    }\n\n    // Greater or smaller\n    return (val1 > val2) ? 1 : -1\n  }\n\n  /**\n   * @param {number} value1\n   * @param {number} value2\n   * @return {boolean}\n   */\n  static equal (value1, value2) {\n    return (Decimal.cmp(value1, value2) === 0)\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Exception for bad GraphQL responses\n */\nexport default class InvalidResponseException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'GraphQL did not provide a valid response.', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'InvalidResponseException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when attempting to transact without an auth token\n */\nexport default class UnauthenticatedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Authorization token missing or invalid.', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'UnauthenticatedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport InvalidResponseException from '../exception/InvalidResponseException.js'\nimport UnauthenticatedException from '../exception/UnauthenticatedException.js'\nimport Dot from '../libraries/Dot.js'\n\n/**\n * Base Response class for processing node responses\n */\nexport default class Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   * @param {string|null} dataKey\n   */\n  constructor ({\n    query,\n    json,\n    dataKey = null\n  }) {\n    this.dataKey = dataKey\n    this.errorKey = 'exception'\n    this.$__payload = null\n    this.$__query = query\n    this.$__originResponse = json\n    this.$__response = json\n\n    if (typeof this.$__response === 'undefined' || this.$__response === null) {\n      throw new InvalidResponseException()\n    }\n\n    if (Dot.has(this.$__response, this.errorKey)) {\n      const error = Dot.get(this.$__response, this.errorKey)\n\n      if (String(error).includes('Unauthenticated')) {\n        throw new UnauthenticatedException()\n      }\n\n      throw new InvalidResponseException()\n    }\n\n    // Check for GraphQL errors array\n    if (this.$__response.errors && Array.isArray(this.$__response.errors) && this.$__response.errors.length > 0) {\n      const errorMessage = this.$__response.errors[0].message || 'Unknown GraphQL error'\n\n      if (errorMessage.includes('Unauthenticated')) {\n        throw new UnauthenticatedException()\n      }\n\n      throw new InvalidResponseException(`GraphQL Error: ${errorMessage}`)\n    }\n\n    this.init()\n  }\n\n  /**\n   *\n   */\n  init () {\n  }\n\n  /**\n   * @return {*}\n   */\n  data () {\n    if (!this.dataKey) {\n      return this.response()\n    }\n\n    // Check if response has data field\n    if (!this.response().data) {\n      throw new InvalidResponseException('Response has no data field')\n    }\n\n    // Check key & return custom data from the response\n    if (!Dot.has(this.response(), this.dataKey)) {\n      throw new InvalidResponseException(`Missing expected field: ${this.dataKey}`)\n    }\n\n    return Dot.get(this.response(), this.dataKey)\n  }\n\n  /**\n   * @return {object}\n   */\n  response () {\n    return this.$__response\n  }\n\n  /**\n   * @return {*}\n   */\n  payload () {\n    return null\n  }\n\n  /**\n   * @return {Query}\n   */\n  query () {\n    return this.$__query\n  }\n\n  /**\n   * @return {*}\n   */\n  status () {\n    return null\n  }\n\n  /**\n   * Check if response was successful\n   * @return {boolean}\n   */\n  success () {\n    // Default implementation - can be overridden by subclasses\n    return !this.$__response?.errors?.length\n  }\n\n  /**\n   * Get error message if any\n   *\n   * @return {string|null}\n   */\n  error () {\n    return this.$__response?.errors?.length ? this.$__response.errors[0].message || 'Unknown error' : null\n  }\n\n  /**\n   * Enhanced interface methods for standardized response handling\n   */\n\n  /**\n   * Get error reason (alias for error() to match standardized interface)\n   * @return {string|null}\n   */\n  reason () {\n    return this.error()\n  }\n\n  /**\n   * Convert to ValidationResult for enhanced error handling\n   * @return {object}\n   */\n  toValidationResult () {\n    if (this.success() && this.payload() !== null) {\n      return {\n        success: true,\n        data: this.payload(),\n        warnings: []\n      }\n    } else {\n      return {\n        success: false,\n        error: {\n          message: this.reason() || 'Unknown error',\n          context: this.constructor.name,\n          details: this.$__response?.errors || []\n        }\n      }\n    }\n  }\n\n  /**\n   * Enhanced error handling with callbacks\n   * @param {function} callback\n   * @return {Response}\n   */\n  onSuccess (callback) {\n    if (this.success() && this.payload() !== null) {\n      try {\n        callback(this.payload())\n      } catch (error) {\n        console.warn('Response.onSuccess callback failed:', error)\n      }\n    }\n    return this\n  }\n\n  /**\n   * Enhanced failure handling with callbacks\n   * @param {function} callback\n   * @return {Response}\n   */\n  onFailure (callback) {\n    if (!this.success()) {\n      try {\n        callback(this.reason() || 'Unknown error')\n      } catch (error) {\n        console.warn('Response.onFailure callback failed:', error)\n      }\n    }\n    return this\n  }\n\n  /**\n   * Debug logging with enhanced context\n   * @param {string|null} label\n   * @return {Response}\n   */\n  debug (label = null) {\n    const debugPrefix = label ? `[${label}]` : `[${this.constructor.name}]`\n\n    if (this.success()) {\n      console.debug(`${debugPrefix} Success:`, {\n        payload: this.payload(),\n        query: this.$__query?.constructor?.name,\n        dataKey: this.dataKey\n      })\n    } else {\n      console.debug(`${debugPrefix} Failure:`, {\n        error: this.reason(),\n        errors: this.$__response?.errors,\n        rawData: this.$__response\n      })\n    }\n\n    return this\n  }\n\n  /**\n   * Promise conversion for enhanced async patterns\n   * @return {Promise}\n   */\n  toPromise () {\n    if (this.success() && this.payload() !== null) {\n      return Promise.resolve(this.payload())\n    } else {\n      return Promise.reject(new Error(this.reason() || 'Unknown error'))\n    }\n  }\n\n  /**\n   * Functional programming map operation\n   * @param {function} mapper\n   * @return {Response}\n   */\n  map (mapper) {\n    if (this.success() && this.payload() !== null) {\n      try {\n        const mappedPayload = mapper(this.payload())\n        // Create new response with mapped payload\n        const newResponse = Object.create(Object.getPrototypeOf(this))\n        Object.assign(newResponse, this)\n        newResponse.$__payload = mappedPayload\n        return newResponse\n      } catch (error) {\n        // Create error response\n        const errorResponse = Object.create(Object.getPrototypeOf(this))\n        Object.assign(errorResponse, this)\n        errorResponse.$__response = { errors: [{ message: `Mapping failed: ${error.message}` }] }\n        return errorResponse\n      }\n    } else {\n      return this\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport CodeException from '../exception/CodeException.js'\nimport Response from '../response/Response.js'\n\nexport default class Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    this.client = graphQLClient\n    this.knishIOClient = knishIOClient\n    this.$__variables = null\n    this.$__query = null\n    this.$__response = null\n    this.$__request = null\n  }\n\n  /**\n   * Return a response object\n   * Used at KnishIOClient::createMolecule => sets the source wallet from the remainder one stored in response object\n   * @return {Response}\n   */\n  response () {\n    return this.$__response\n  }\n\n  /**\n   * Builds a Response based on JSON input\n   *\n   * @param response\n   * @return {Promise<Response>}\n   */\n  async createResponseRaw (response) {\n    return this.createResponse(response)\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {Response}\n   */\n  createResponse (json) {\n    return new Response({\n      query: this,\n      json\n    })\n  }\n\n  /**\n   * Creates a new Request for the given parameters\n   *\n   * @param {{}} variables\n   * @returns {{variables: (Object|null), query: null}}\n   */\n  createQuery ({ variables = null }) {\n    this.$__variables = this.compiledVariables(variables)\n\n    // Uri is a required parameter\n    const uri = this.uri()\n\n    if (!uri) {\n      throw new CodeException('Query::createQuery() - Node URI was not initialized for this client instance!')\n    }\n\n    if (this.$__query === null) {\n      throw new CodeException('Query::createQuery() - GraphQL subscription was not initialized!')\n    }\n\n    return {\n      query: this.$__query,\n      variables: this.variables()\n    }\n  }\n\n  /**\n   * Sends the Query to a Knish.IO node and returns the Response\n   *\n   * @param {object} variables\n   * @param {object} context\n   * @return {Promise<Response>}\n   */\n  async execute ({ variables = null, context = {} }) {\n    this.$__request = this.createQuery({ variables })\n\n    const mergedContext = {\n      ...context,\n      ...this.createQueryContext()\n    }\n\n    try {\n      const response = await this.client.query({\n        ...this.$__request,\n        context: mergedContext\n      })\n\n      this.$__response = await this.createResponseRaw(response)\n\n      return this.$__response\n    } catch (error) {\n      if (error.name === 'AbortError') {\n        this.knishIOClient.log('warn', 'Query was cancelled')\n        // You might want to create a custom response for cancelled queries\n        return new Response({\n          query: this,\n          json: { data: null, errors: [{ message: 'Query was cancelled' }] }\n        })\n      } else {\n        throw error\n      }\n    }\n  }\n\n  /**\n   * Returns a variables object for the Query\n   *\n   * @param {object} variables\n   * @return {object}\n   */\n  compiledVariables (variables = null) {\n    return variables || {}\n  }\n\n  /**\n   * Returns the Knish.IO endpoint URI\n   *\n   * @return {string}\n   */\n  uri () {\n    return this.client.getUri()\n  }\n\n  /**\n   * Returns the query variables object\n   *\n   * @return {object|null}\n   */\n  variables () {\n    return this.$__variables\n  }\n\n  createQueryContext () {\n    // Override this method in subclasses if needed\n    return {}\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Wallet from '../Wallet.js'\n\n/**\n * Response for ContinuID query\n */\nexport default class ResponseContinuId extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.ContinuId'\n    })\n  }\n\n  /**\n   * Returns the ContinuID wallet\n   *\n   * @return {Wallet|null}\n   */\n  payload () {\n    let wallet = null\n\n    const continuId = this.data()\n\n    if (continuId) {\n      wallet = new Wallet({\n        secret: null,\n        token: continuId.tokenSlug\n      })\n      wallet.address = continuId.address\n      wallet.position = continuId.position\n      wallet.bundle = continuId.bundleHash\n      wallet.batchId = continuId.batchId\n      wallet.characters = continuId.characters\n      wallet.pubkey = continuId.pubkey\n      wallet.balance = String(continuId.amount != null ? continuId.amount : 0)\n    }\n\n    return wallet\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseContinuId from '../response/ResponseContinuId.js'\nimport { gql } from '@urql/core'\n\n/**\n * Queries the node for the next wallet to sign with for ContinuID\n */\nexport default class QueryContinuId extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query ($bundle: String!, $token: String) {\n      ContinuId(bundle: $bundle, token: $token) {\n        address,\n        bundleHash,\n        tokenSlug,\n        position,\n        batchId,\n        characters,\n        pubkey,\n        amount,\n        createdAt\n      }\n    }`\n  }\n\n  /**\n   * Force network-only for ContinuID queries to prevent URQL cache from\n   * returning stale wallet positions after mutations advance the ContinuID chain\n   */\n  createQueryContext () {\n    return { requestPolicy: 'network-only' }\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseContinuId}\n   */\n  createResponse (json) {\n    return new ResponseContinuId({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Meta from '../Meta.js'\n\n/**\n * Response for Wallet Bundle query\n */\nexport default class ResponseWalletBundle extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.WalletBundle'\n    })\n  }\n\n  /**\n   * Returns a wallet bundle with normalized metadata\n   *\n   * @return {{}|null}\n   */\n  payload () {\n    const bundleData = this.data()\n\n    if (!bundleData || bundleData.length === 0) {\n      return null\n    }\n\n    const aggregate = {}\n\n    bundleData.forEach(bundle => {\n      bundle.metas = Meta.aggregateMeta(bundle.metas)\n      aggregate[bundle.bundleHash] = bundle\n    })\n\n    return aggregate\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseWalletBundle from '../response/ResponseWalletBundle.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving information about Wallet Bundles\n */\nexport default class QueryWalletBundle extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $bundleHashes: [ String! ] ) {\n      WalletBundle( bundleHashes: $bundleHashes ) {\n        bundleHash,\n        metas {\n          molecularHash,\n          position,\n          key,\n          value,\n          createdAt\n        },\n        createdAt\n      }\n    }`\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseWalletBundle}\n   */\n  createResponse (json) {\n    return new ResponseWalletBundle({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Wallet from '../Wallet.js'\nimport TokenUnit from '../TokenUnit.js'\n\n/**\n * Response for Wallet List query\n */\nexport default class ResponseWalletList extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.Wallet'\n    })\n  }\n\n  /**\n   * Returns a Knish.IO client Wallet class instance out of object data\n   *\n   * @param {object} data\n   * @param {string|null} secret\n   * @return {Wallet}\n   */\n  static toClientWallet ({\n    data,\n    secret = null\n  }) {\n    let wallet\n\n    if (data.position === null || typeof data.position === 'undefined') {\n      wallet = Wallet.create({\n        bundle: data.bundleHash,\n        token: data.tokenSlug,\n        batchId: data.batchId,\n        characters: data.characters\n      })\n    } else {\n      wallet = new Wallet({\n        secret,\n        token: data.tokenSlug,\n        position: data.position,\n        batchId: data.batchId,\n        characters: data.characters\n      })\n      wallet.address = data.address\n      wallet.bundle = data.bundleHash\n    }\n\n    if (data.token) {\n      wallet.tokenName = data.token.name\n      wallet.tokenAmount = data.token.amount\n      wallet.tokenSupply = data.token.supply\n      wallet.tokenFungibility = data.token.fungibility\n    }\n\n    if (data.tokenUnits.length) {\n      for (const tokenUnitData of data.tokenUnits) {\n        wallet.tokenUnits.push(TokenUnit.createFromGraphQL(tokenUnitData))\n      }\n    }\n\n    if (data.tradeRates.length) {\n      for (const tradeRate of data.tradeRates) {\n        wallet.tradeRates[tradeRate.tokenSlug] = tradeRate.amount\n      }\n    }\n\n    wallet.balance = String(data.amount != null ? data.amount : 0)\n    wallet.pubkey = data.pubkey\n    wallet.createdAt = data.createdAt\n\n    return wallet\n  }\n\n  /**\n   * Returns a list of Wallet class instances\n   *\n   * @param secret\n   * @return {null|[Wallet]}\n   */\n  getWallets (secret = null) {\n    const list = this.data()\n\n    if (!list) {\n      return null\n    }\n\n    const wallets = []\n\n    for (const data of list) {\n      wallets.push(ResponseWalletList.toClientWallet({\n        data,\n        secret\n      }))\n    }\n\n    return wallets\n  }\n\n  /**\n   * Returns response payload\n   *\n   * @return {null|[Wallet]}\n   */\n  payload () {\n    return this.getWallets()\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseWalletList from '../response/ResponseWalletList.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for getting a list of Wallets\n */\nexport default class QueryWalletList extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $bundleHash: String, $token: String ) {\n      Wallet( bundleHash: $bundleHash, token: $token ) {\n        address,\n        bundleHash,\n        token {\n          name,\n          amount,\n          fungibility,\n          supply\n        },\n        tokenSlug,\n        batchId,\n        position,\n        amount,\n        characters,\n        pubkey,\n        createdAt,\n        tokenUnits {\n          id,\n          name,\n          metas\n        },\n        tradeRates {\n          tokenSlug,\n          amount\n        }\n      }\n    }`\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseWalletList}\n   */\n  createResponse (json) {\n    return new ResponseWalletList({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport ResponseWalletList from './ResponseWalletList.js'\n\n/**\n * Response for balance query\n */\nexport default class ResponseBalance extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.Balance'\n    })\n  }\n\n  /**\n   * Returns a wallet with balance\n   *\n   * @return {null|Wallet}\n   */\n  payload () {\n    let walletData = this.data()\n\n    // Handle array response (e.g. from Rust validator which returns Vec<Wallet>)\n    if (Array.isArray(walletData)) {\n      walletData = walletData.length > 0 ? walletData[0] : null\n    }\n\n    if (!walletData || !walletData.bundleHash || !walletData.tokenSlug) {\n      return null\n    }\n\n    return ResponseWalletList.toClientWallet({\n      data: walletData\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseBalance from '../response/ResponseBalance.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for getting the balance of a given wallet or token slug\n */\nexport default class QueryBalance extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $address: String, $bundleHash: String, $type: String, $token: String, $position: String ) {\n      Balance( address: $address, bundleHash: $bundleHash, type: $type, token: $token, position: $position ) {\n        address,\n        bundleHash,\n        type,\n        tokenSlug,\n        batchId,\n        position,\n        amount,\n        characters,\n        pubkey,\n        createdAt,\n        tokenUnits {\n          id,\n          name,\n          metas\n        },\n        tradeRates {\n          tokenSlug,\n          amount\n        }\n      }\n    }`\n  }\n\n  /**\n   * @param {object} json\n   * @return {ResponseBalance}\n   */\n  createResponse (json) {\n    return new ResponseBalance({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\n/**\n * Response for MetaType Query\n */\nexport default class ResponseMetaType extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.MetaType'\n    })\n  }\n\n  /**\n   * Returns meta type instance results\n   *\n   * @return {null|*}\n   */\n  payload () {\n    const metaTypeData = this.data()\n\n    if (!metaTypeData || metaTypeData.length === 0) {\n      return null\n    }\n\n    const response = {\n      instances: {},\n      instanceCount: {},\n      paginatorInfo: {}\n    }\n\n    const metaData = metaTypeData.pop()\n\n    if (metaData.instances) {\n      response.instances = metaData.instances\n    }\n\n    if (metaData.instanceCount) {\n      response.instanceCount = metaData.instanceCount\n    }\n\n    if (metaData.paginatorInfo) {\n      response.paginatorInfo = metaData.paginatorInfo\n    }\n\n    return response\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseMetaType from '../response/ResponseMetaType.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving Meta Asset information\n */\nexport default class QueryMetaType extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $metaType: String, $metaTypes: [ String! ], $metaId: String, $metaIds: [ String! ], $key: String, $keys: [ String! ], $value: String, $values: [ String! ], $count: String, $latest: Boolean, $filter: [ MetaFilter! ], $queryArgs: QueryArgs, $countBy: String, $cellSlug: String ) {\n      MetaType( metaType: $metaType, metaTypes: $metaTypes, metaId: $metaId, metaIds: $metaIds, key: $key, keys: $keys, value: $value, values: $values, count: $count, filter: $filter, queryArgs: $queryArgs, countBy: $countBy, cellSlug: $cellSlug ) {\n        metaType,\n        instanceCount {\n          key,\n          value\n        },\n        instances {\n          metaType,\n          metaId,\n          createdAt,\n          metas(latest:$latest) {\n            molecularHash,\n            position,\n            key,\n            value,\n            createdAt\n          }\n        },\n        paginatorInfo {\n          currentPage,\n          total\n        }\n      }\n    }`\n  }\n\n  /**\n   * Builds a GraphQL-friendly variables object based on input fields\n   *\n   * @param {string|array|null} metaType\n   * @param {string|array|null} metaId\n   * @param {string|array|null} key\n   * @param {string|array|null} value\n   * @param {boolean|null} latest\n   * @param {object|null} filter\n   * @param {object|null} queryArgs\n   * @param {string|null} count\n   * @param {string|null} countBy\n   * @param {string|null} cellSlug\n   * @return {{}}\n   */\n  static createVariables ({\n    metaType = null,\n    metaId = null,\n    key = null,\n    value = null,\n    latest = null,\n    filter = null,\n    queryArgs = null,\n    count = null,\n    countBy = null,\n    cellSlug = null\n  }) {\n    const variables = {}\n\n    if (metaType) {\n      variables[typeof metaType === 'string' ? 'metaType' : 'metaTypes'] = metaType\n    }\n\n    if (metaId) {\n      variables[typeof metaId === 'string' ? 'metaId' : 'metaIds'] = metaId\n    }\n\n    if (key) {\n      variables[typeof key === 'string' ? 'key' : 'keys'] = key\n    }\n\n    if (value) {\n      variables[typeof value === 'string' ? 'value' : 'values'] = value\n    }\n\n    variables.latest = latest === true\n\n    if (filter) {\n      variables.filter = filter\n    }\n\n    if (queryArgs) {\n      if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {\n        queryArgs.limit = '*'\n      }\n\n      variables.queryArgs = queryArgs\n    }\n\n    if (count) {\n      variables.count = count\n    }\n\n    if (countBy) {\n      variables.countBy = countBy\n    }\n\n    if (cellSlug) {\n      variables.cellSlug = cellSlug\n    }\n\n    return variables\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseMetaType}\n   */\n  createResponse (json) {\n    return new ResponseMetaType({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport Response from '../response/Response.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving Meta Asset information\n */\nexport default class QueryBatch extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $batchId: String ) {\n      Batch( batchId: $batchId ) {\n        ${ QueryBatch.getFields() },\n        children {\n          ${ QueryBatch.getFields() }\n        }\n      }\n    }`\n  }\n\n  static getFields () {\n    return `batchId,\n              molecularHash,\n              type,\n              status,\n              createdAt,\n              wallet {\n                  address,\n                  bundleHash,\n                  amount,\n                  tokenSlug,\n                  token {\n                      name,\n                      amount\n                  },\n                  tokenUnits {\n                      id,\n                      name,\n                      metas\n                  }\n              },\n              fromWallet {\n                  address,\n                  bundleHash,\n                  amount,\n                  batchId\n              },\n              toWallet {\n                  address,\n                  bundleHash,\n                  amount,\n                  batchId\n              },\n              sourceTokenUnits {\n                  id,\n                  name,\n                  metas\n              },\n              transferTokenUnits {\n                  id,\n                  name,\n                  metas\n              },\n              metas {\n                  key,\n                  value,\n              },\n              throughMetas {\n                  key,\n                  value\n              }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {Response}\n   */\n  createResponse (json) {\n    const responseObject = new Response({\n      query: this,\n      json\n    })\n    responseObject.dataKey = 'data.Batch'\n    return responseObject\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport QueryBatch from './QueryBatch.js'\nimport Response from '../response/Response.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving Meta Asset information\n */\nexport default class QueryBatchHistory extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $batchId: String ) {\n      BatchHistory( batchId: $batchId ) {\n        ${ QueryBatch.getFields() }\n      }\n    }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {Response}\n   */\n  createResponse (json) {\n    const responseObject = new Response({\n      query: this,\n      json\n    })\n    responseObject.dataKey = 'data.BatchHistory'\n    return responseObject\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Dot from '../libraries/Dot.js'\nimport Molecule from '../Molecule.js'\n\n/**\n * Response for proposing new Molecules\n */\nexport default class ResponseProposeMolecule extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {MutationProposeMolecule} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.ProposeMolecule'\n    })\n    this.$__clientMolecule = query.molecule()\n  }\n\n  /**\n   * Initialize response object with payload data\n   */\n  init () {\n    const payloadJson = Dot.get(this.data(), 'payload')\n    try {\n      this.$__payload = Object.prototype.toString.call(payloadJson) === '[object String]'\n        ? JSON.parse(payloadJson)\n        : payloadJson\n    } catch (err) {\n      this.$__payload = null\n    }\n  }\n\n  /**\n   * Returns the client molecule\n   */\n  clientMolecule () {\n    return this.$__clientMolecule\n  }\n\n  /**\n   * Returns the resulting molecule\n   *\n   * @return {Molecule|null}\n   */\n  molecule () {\n    const data = this.data()\n\n    if (!data) {\n      return null\n    }\n\n    const molecule = new Molecule({})\n\n    molecule.molecularHash = Dot.get(data, 'molecularHash')\n    molecule.status = Dot.get(data, 'status')\n    molecule.createdAt = Dot.get(data, 'createdAt')\n\n    return molecule\n  }\n\n  /**\n   * Returns whether molecule was accepted or not\n   *\n   * @return {boolean}\n   */\n  success () {\n    return this.status() === 'accepted'\n  }\n\n  /**\n   * Returns the status of the proposal\n   *\n   * @return {string}\n   */\n  status () {\n    return Dot.get(this.data(), 'status', 'rejected')\n  }\n\n  /**\n   * Returns the reason for rejection\n   *\n   * @return {string}\n   */\n  reason () {\n    return Dot.get(this.data(), 'reason', 'Invalid response from server')\n  }\n\n  /**\n   * Returns payload object\n   *\n   * @return {null}\n   */\n  payload () {\n    return this.$__payload\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from '../query/Query.js'\nimport Response from '../response/Response.js'\n\n/**\n * Base class used to construct various GraphQL mutations\n */\nexport default class Mutation extends Query {\n  /**\n   * Creates a new Request for the given parameters\n   *\n   * @param {{}} variables\n   * @returns {{variables: (Object|null), query: null}}\n   */\n  createQuery ({ variables = null }) {\n    const request = super.createQuery({ variables })\n    request.mutation = request.query\n    delete request.query\n    return request\n  }\n\n  /**\n   * Sends the Mutation to a Knish.IO node and returns the Response\n   * @param {Object||null} variables\n   * @param {Object||null} context\n   * @returns {Promise<Response|null>}\n   */\n  async execute ({ variables = {}, context = {} }) {\n    this.$__request = this.createQuery({\n      variables\n    })\n\n    const mergedContext = {\n      ...context,\n      ...this.createQueryContext()\n    }\n\n    try {\n      const mutationParams = {\n        ...this.$__request,\n        context: mergedContext\n      }\n      const response = await this.client.mutate(mutationParams)\n\n      this.$__response = await this.createResponseRaw(response)\n\n      return this.$__response\n    } catch (error) {\n      if (error.name === 'AbortError') {\n        this.knishIOClient.log('warn', 'Mutation was cancelled')\n        // You might want to create a custom response for cancelled mutations\n        return new Response({\n          query: this,\n          json: { data: null, errors: [{ message: 'Mutation was cancelled' }] }\n        })\n      } else {\n        throw error\n      }\n    }\n  }\n\n  createQueryContext () {\n    // Override this method in subclasses if needed\n    return {}\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from '../response/ResponseProposeMolecule.js'\nimport Mutation from './Mutation.js'\nimport { gql } from '@urql/core'\n\nexport default class MutationProposeMolecule extends Mutation {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   * @param molecule\n   */\n  constructor (graphQLClient, knishIOClient, molecule) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__molecule = molecule\n    this.$__remainderWallet = null\n    this.$__query = gql`mutation( $molecule: MoleculeInput! ) {\n      ProposeMolecule( molecule: $molecule ) {\n        molecularHash,\n        height,\n        depth,\n        status,\n        reason,\n        payload,\n        createdAt,\n        receivedAt,\n        processedAt,\n        broadcastedAt,\n      }\n    }`\n  }\n\n  /**\n   * Returns an object of query variables\n   *\n   * @param {object} variables\n   * @return {object}\n   */\n  compiledVariables (variables) {\n    const _variables = super.compiledVariables(variables)\n\n    return { ..._variables, ...{ molecule: this.molecule() } }\n  }\n\n  /**\n   * Creates a new response from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseProposeMolecule}\n   */\n  createResponse (json) {\n    return new ResponseProposeMolecule({\n      query: this,\n      json\n    })\n  }\n\n  /**\n   * Executes the query\n   *\n   * @param {object} variables\n   * @return {Promise}\n   */\n  async execute ({ variables = null }) {\n    variables = variables || {}\n    variables.molecule = this.molecule()\n\n    return super.execute({\n      variables\n    })\n  }\n\n  /**\n   * Returns the remainder wallet\n   *\n   * @return {null}\n   */\n  remainderWallet () {\n    return this.$__remainderWallet\n  }\n\n  /**\n   * Returns the molecule we are proposing\n   *\n   * @return {Molecule}\n   */\n  molecule () {\n    return this.$__molecule\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Dot from '../libraries/Dot.js'\nimport InvalidResponseException from '../exception/InvalidResponseException.js'\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for auth token mutation\n */\nexport default class ResponseRequestAuthorization extends ResponseProposeMolecule {\n  /**\n   * return the authorization key\n   *\n   * @param key\n   * @return {*}\n   */\n  payloadKey (key) {\n    if (!Dot.has(this.payload(), key)) {\n      throw new InvalidResponseException(`ResponseRequestAuthorization::payloadKey() - '${ key }' key was not found in the payload!`)\n    }\n    return Dot.get(this.payload(), key)\n  }\n\n  /**\n   * Returns the auth token\n   *\n   * @return {string}\n   */\n  token () {\n    return this.payloadKey('token')\n  }\n\n  /**\n   * Returns raw time value from payload\n   *\n   * @return {string}\n   */\n  time () {\n    return this.payloadKey('time')\n  }\n\n  /**\n   * Returns the expiration timestamp as Unix seconds.\n   * Handles both server formats:\n   * - PHP server: time = lifetime in ms, expiresAt = Unix timestamp in payload\n   * - Rust server: time = Unix timestamp in seconds\n   *\n   * @return {number}\n   */\n  expiresAt () {\n    // Try the explicit expiresAt payload key first (PHP server provides this)\n    try {\n      const ea = this.payloadKey('expiresAt')\n      if (ea) {\n        return Number(ea)\n      }\n    } catch (_e) {\n      // Not available in payload, fall back\n    }\n\n    // Use time field with heuristic detection\n    const timeValue = Number(this.time())\n\n    // If timeValue looks like a valid Unix timestamp (>= year 2020), use directly\n    // Rust server sets time = Unix timestamp in seconds\n    if (timeValue >= 1577836800) {\n      return timeValue\n    }\n\n    // Otherwise, time is a lifetime in milliseconds (PHP server format)\n    // Convert to Unix timestamp: now_seconds + lifetime_seconds\n    return Math.floor(Date.now() / 1000) + Math.floor(timeValue / 1000)\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  encrypt () {\n    return this.payloadKey('encrypt')\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  pubKey () {\n    return this.payloadKey('key')\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseRequestAuthorization from '../response/ResponseRequestAuthorization.js'\n\n/**\n * Query for requesting an authorization token from the node\n */\nexport default class MutationRequestAuthorization extends MutationProposeMolecule {\n  /**\n   *\n   * @param {object} meta\n   */\n  fillMolecule ({ meta }) {\n    this.$__molecule.initAuthorization({ meta })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseRequestAuthorization}\n   */\n  createResponse (json) {\n    return new ResponseRequestAuthorization({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for token creation\n */\nexport default class ResponseCreateToken extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateToken from '../response/ResponseCreateToken.js'\n\n/**\n * Query for creating new Tokens\n */\nexport default class MutationCreateToken extends MutationProposeMolecule {\n  /**\n   * @param {Wallet|null} recipientWallet\n   * @param {number|null} amount\n   * @param {object|null} meta\n   */\n  fillMolecule ({\n    recipientWallet,\n    amount,\n    meta = null\n  }) {\n    this.$__molecule.initTokenCreation({\n      recipientWallet,\n      amount,\n      meta: meta || {}\n    })\n    this.$__molecule.sign({\n      bundle: recipientWallet.bundle\n    })\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseCreateToken}\n   */\n  createResponse (json) {\n    return new ResponseCreateToken({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for identifier creation\n */\nexport default class ResponseRequestTokens extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseRequestTokens from '../response/ResponseRequestTokens.js'\n\nexport default class MutationRequestTokens extends MutationProposeMolecule {\n  /**\n   * Fills a Molecule with the appropriate atoms and prepares for broadcast\n   *\n   * @param {string} token\n   * @param {Number} amount\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object} meta\n   * @param {string|null} batchId\n   */\n  fillMolecule ({\n    token,\n    amount,\n    metaType,\n    metaId,\n    meta = null,\n    batchId = null\n  }) {\n    this.$__molecule.initTokenRequest({\n      token,\n      amount,\n      metaType,\n      metaId,\n      meta: meta || {},\n      batchId\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseRequestTokens}\n   */\n  createResponse (json) {\n    return new ResponseRequestTokens({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for token transfer queries\n */\nexport default class ResponseTransferTokens extends ResponseProposeMolecule {\n  /**\n   * Returns result of the transfer\n   *\n   * @return {{reason: null, status: null}}\n   */\n  payload () {\n    const result = {\n      reason: null,\n      status: null\n    }\n    const data = this.data()\n\n    result.reason = typeof data.reason === 'undefined' ? 'Invalid response from server' : data.reason\n    result.status = typeof data.status === 'undefined' ? 'rejected' : data.status\n\n    return result\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseTransferTokens from '../response/ResponseTransferTokens.js'\n\n/**\n * Query for moving tokens between wallets\n */\nexport default class MutationTransferTokens extends MutationProposeMolecule {\n  /**\n   * Fills the Molecule with provided wallet and amount data\n   *\n   * @param recipientWallet\n   * @param amount\n   */\n  fillMolecule ({\n    recipientWallet,\n    amount\n  }) {\n    this.$__molecule.initValue({\n      recipientWallet,\n      amount\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check(this.$__molecule.sourceWallet)\n  }\n\n  /**\n   * Fills the Molecule for a MULTI-recipient transfer (WP line 544)\n   *\n   * @param {Wallet[]} recipientWallets\n   * @param {number[]} amounts - parallel to recipientWallets\n   */\n  fillMoleculeMulti ({\n    recipientWallets,\n    amounts\n  }) {\n    this.$__molecule.initValues({\n      recipientWallets,\n      amounts\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check(this.$__molecule.sourceWallet)\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseTransferTokens}\n   */\n  createResponse (json) {\n    return new ResponseTransferTokens({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for identifier creation\n */\nexport default class ResponseCreateIdentifier extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateIdentifier from '../response/ResponseCreateIdentifier.js'\n\n/**\n * Query for creating a new Identifier\n */\nexport default class MutationCreateIdentifier extends MutationProposeMolecule {\n  fillMolecule ({\n    type,\n    contact,\n    code\n  }) {\n    this.$__molecule.initIdentifierCreation({\n      type,\n      contact,\n      code\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseCreateIdentifier}\n   */\n  createResponse (json) {\n    return new ResponseCreateIdentifier({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for identifier creation\n */\nexport default class ResponseClaimShadowWallet extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport Wallet from '../Wallet.js'\nimport ResponseClaimShadowWallet from '../response/ResponseClaimShadowWallet.js'\n\n/**\n * Mutation for claiming a Shadow Wallet\n */\nexport default class MutationClaimShadowWallet extends MutationProposeMolecule {\n  /**\n   * Class constructor\n   *\n   * @param {string} token\n   * @param {string|null} batchId\n   */\n  fillMolecule ({\n    token,\n    batchId = null\n  }) {\n    const wallet = Wallet.create({\n      secret: this.$__molecule.secret,\n      bundle: this.$__molecule.bundle,\n      token,\n      batchId\n    })\n\n    this.$__molecule.initShadowWalletClaim(wallet)\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseClaimShadowWallet}\n   */\n  createResponse (json) {\n    return new ResponseClaimShadowWallet({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for token creation\n */\nexport default class ResponseCreateMeta extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateMeta from '../response/ResponseCreateMeta.js'\n\n/**\n * Query for creating new Meta attached to some MetaType\n */\nexport default class MutationCreateMeta extends MutationProposeMolecule {\n  /**\n   * Fills a molecule with an appropriate metadata atom\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {array|object} meta\n   * @param {object} policy\n   */\n  fillMolecule ({\n    metaType,\n    metaId,\n    meta,\n    policy\n  }) {\n    this.$__molecule.initMeta({\n      meta,\n      metaType,\n      metaId,\n      policy\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseCreateMeta}\n   */\n  createResponse (json) {\n    return new ResponseCreateMeta({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for peer registration via P-isotope\n */\nexport default class ResponsePeering extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponsePeering from '../response/ResponsePeering.js'\n\n/**\n * Mutation for registering a peer node via the P-isotope\n */\nexport default class MutationPeering extends MutationProposeMolecule {\n  /**\n   * Fills a molecule with a P-isotope peering atom\n   *\n   * @param {string} host\n   */\n  fillMolecule ({\n    host\n  }) {\n    this.$__molecule.initPeering({\n      host\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponsePeering}\n   */\n  createResponse (json) {\n    return new ResponsePeering({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for append requests via A-isotope\n */\nexport default class ResponseAppendRequest extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseAppendRequest from '../response/ResponseAppendRequest.js'\n\n/**\n * Mutation for submitting an append request via the A-isotope\n */\nexport default class MutationAppendRequest extends MutationProposeMolecule {\n  /**\n   * Fills a molecule with an A-isotope append request atom\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {string} action\n   * @param {object} meta\n   */\n  fillMolecule ({\n    metaType,\n    metaId,\n    action,\n    meta = {}\n  }) {\n    this.$__molecule.initAppendRequest({\n      metaType,\n      metaId,\n      action,\n      meta\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseAppendRequest}\n   */\n  createResponse (json) {\n    return new ResponseAppendRequest({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Dot from '../libraries/Dot.js'\n\n/**\n * Response for mutation to create / link an Identifier to a Wallet Bundle\n */\nexport default class ResponseLinkIdentifier extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.LinkIdentifier'\n    })\n  }\n\n  /**\n   * Returns success status\n   *\n   * @return {*}\n   */\n  success () {\n    return Dot.get(this.data(), 'set')\n  }\n\n  /**\n   * Returns message\n   *\n   * @return {*}\n   */\n  message () {\n    return Dot.get(this.data(), 'message')\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Mutation from '../mutation/Mutation.js'\nimport ResponseLinkIdentifier from '../response/ResponseLinkIdentifier.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for linking an Identifier to a Wallet Bundle\n */\nexport default class MutationLinkIdentifier extends Mutation {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`mutation( $bundle: String!, $type: String!, $content: String! ) {\n      LinkIdentifier( bundle: $bundle, type: $type, content: $content ) {\n        type,\n        bundle,\n        content,\n        set,\n        message\n      }\n    }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseLinkIdentifier}\n   */\n  createResponse (json) {\n    return new ResponseLinkIdentifier({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for Wallet creation\n */\nexport default class ResponseCreateWallet extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateWallet from '../response/ResponseCreateWallet.js'\n\n/**\n * Query for creating new Wallets\n */\nexport default class MutationCreateWallet extends MutationProposeMolecule {\n  fillMolecule (wallet) {\n    this.$__molecule.initWalletCreation(wallet)\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseCreateWallet}\n   */\n  createResponse (json) {\n    return new ResponseCreateWallet({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Response from './Response.js'\nimport Dot from '../libraries/Dot.js'\nimport InvalidResponseException from '../exception/InvalidResponseException.js'\n\n/**\n * Response for guest auth mutation\n */\nexport default class ResponseRequestAuthorizationGuest extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {MutationRequestAuthorizationGuest} query\n   * @param json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.AccessToken'\n    })\n  }\n\n  /**\n   * Returns the reason for rejection\n   *\n   * @return {string}\n   */\n  reason () {\n    return 'Invalid response from server'\n  }\n\n  /**\n   * Returns whether molecule was accepted or not\n   *\n   * @return {boolean}\n   */\n  success () {\n    return this.payload() !== null\n  }\n\n  /**\n   * Returns a wallet with balance\n   *\n   * @return {null|Wallet}\n   */\n  payload () {\n    return this.data()\n  }\n\n  /**\n   * Returns the authorization key\n   *\n   * @param key\n   * @return {*}\n   */\n  payloadKey (key) {\n    if (!Dot.has(this.payload(), key)) {\n      throw new InvalidResponseException(`ResponseAuthorizationGuest::payloadKey() - '${ key }' key is not found in the payload!`)\n    }\n    return Dot.get(this.payload(), key)\n  }\n\n  /**\n   * Returns the auth token\n   *\n   * @return {*}\n   */\n  token () {\n    return this.payloadKey('token')\n  }\n\n  /**\n   * Returns raw time value from payload\n   *\n   * @return {*}\n   */\n  time () {\n    return this.payloadKey('time')\n  }\n\n  /**\n   * Returns the expiration timestamp as Unix seconds.\n   * Handles both server formats:\n   * - PHP server: time = lifetime in ms, expiresAt = Unix timestamp in payload\n   * - Rust server: time = Unix timestamp in seconds\n   *\n   * @return {number}\n   */\n  expiresAt () {\n    // Try the explicit expiresAt payload key first (PHP server provides this)\n    try {\n      const ea = this.payloadKey('expiresAt')\n      if (ea) {\n        return Number(ea)\n      }\n    } catch (_e) {\n      // Not available in payload, fall back\n    }\n\n    // Use time field with heuristic detection\n    const timeValue = Number(this.time())\n\n    // If timeValue looks like a valid Unix timestamp (>= year 2020), use directly\n    if (timeValue >= 1577836800) {\n      return timeValue\n    }\n\n    // Otherwise, time is a lifetime in milliseconds (PHP server format)\n    return Math.floor(Date.now() / 1000) + Math.floor(timeValue / 1000)\n  }\n\n  /**\n   * Returns timestamp\n   *\n   * @return {string}\n   */\n  pubKey () {\n    return this.payloadKey('key')\n  }\n\n  /**\n   *\n   * @return {string}\n   */\n  encrypt () {\n    return this.payloadKey('encrypt')\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Mutation from '../mutation/Mutation.js'\nimport ResponseRequestAuthorizationGuest from '../response/ResponseRequestAuthorizationGuest.js'\nimport { gql } from '@urql/core'\n\nexport default class MutationRequestAuthorizationGuest extends Mutation {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`mutation( $cellSlug: String, $pubkey: String, $encrypt: Boolean ) {\n      AccessToken( cellSlug: $cellSlug, pubkey: $pubkey, encrypt: $encrypt ) {\n        token,\n        pubkey,\n        expiresAt\n      }\n    }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseRequestAuthorizationGuest}\n   */\n  createResponse (json) {\n    return new ResponseRequestAuthorizationGuest({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when failing to retrieve shadow wallets\n */\nexport default class WalletShadowException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'The shadow wallet does not exist', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'WalletShadowException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when a stackable token is being created with units and non-zero decimals\n */\nexport default class StackableUnitDecimalsException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Stackable tokens with unit IDs cannot have decimal places!', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'StackableUnitDecimalsException'\n  }\n}\n","import CodeException from '../exception/CodeException.js'\n\nexport default class Subscribe {\n  /**\n   *\n   * @param {UrqlClientWrapper} graphQLClient\n   */\n  constructor (graphQLClient) {\n    this.client = graphQLClient\n    this.$__variables = null\n    this.$__subscribe = null\n  }\n\n  /**\n   * Creates a new Request for the given parameters\n   *\n   * @param {{}} variables\n   * @returns {{variables: (Object|null), fetchPolicy: string, query: null}}\n   */\n  createSubscribe ({\n    variables = null\n  }) {\n    this.$__variables = this.compiledVariables(variables)\n\n    // Uri is a required parameter\n    const uri = this.uri()\n\n    if (!uri) {\n      throw new CodeException('Subscribe::createSubscribe() - Node URI was not initialized for this client instance!')\n    }\n\n    if (this.$__subscribe === null) {\n      throw new CodeException('Subscribe::createSubscribe() - GraphQL subscription was not initialized!')\n    }\n\n    return {\n      query: this.$__subscribe,\n      variables: this.variables(),\n      fetchPolicy: 'no-cache'\n    }\n  }\n\n  /**\n   * Sends the Query to a Knish.IO node and returns the Response\n   *\n   * @param {{}} variables\n   * @param {function} closure\n   * @return {string}\n   */\n  async execute ({\n    variables = null,\n    closure\n  }) {\n    if (!closure) {\n      throw new CodeException(`${ this.constructor.name }::execute() - closure parameter is required!`)\n    }\n\n    this.$__request = this.createSubscribe({\n      variables\n    })\n\n    return this.client.subscribe(this.$__request, closure)\n  }\n\n  /**\n   * Returns a variables object for the Query\n   *\n   * @param variables\n   * @return {object}\n   */\n  compiledVariables (variables = null) {\n    return variables || {}\n  }\n\n  /**\n   * Returns the Knish.IO endpoint URI\n   *\n   * @return {string}\n   */\n  uri () {\n    return this.client.getUri()\n  }\n\n  /**\n   * Returns the query variables object\n   *\n   * @return {object|null}\n   */\n  variables () {\n    return this.$__variables\n  }\n}\n","import Subscribe from './Subscribe.js'\nimport { gql } from '@urql/core'\n\nexport default class CreateMoleculeSubscribe extends Subscribe {\n  constructor (graphQLClient) {\n    super(graphQLClient)\n    this.$__subscribe = gql`\n      subscription onCreateMolecule ( $bundle: String! ) {\n        CreateMolecule( bundle: $bundle ) {\n          molecularHash,\n          cellSlug,\n          counterparty,\n          bundleHash,\n          status,\n          local,\n          height,\n          depth,\n          createdAt,\n          receivedAt,\n          processedAt,\n          broadcastedAt,\n          reason,\n          reasonPayload,\n          payload,\n          status,\n          atoms {\n            molecularHash,\n            position,\n            isotope,\n            walletAddress,\n            tokenSlug,\n            batchId,\n            value,\n            index,\n            metaType,\n            metaId,\n            metasJson,\n            otsFragment,\n            createdAt,\n            metas {\n              molecularHash,\n              position,\n              metaType,\n              metaId,\n              key,\n              value,\n              createdAt,\n            }\n          }\n        }\n      }\n    `\n  }\n}\n","import Subscribe from './Subscribe.js'\nimport { gql } from '@urql/core'\n\nexport default class WalletStatusSubscribe extends Subscribe {\n  constructor (graphQLClient) {\n    super(graphQLClient)\n    this.$__subscribe = gql`\n      subscription onWalletStatus ( $bundle: String!, $token: String! ) {\n        WalletStatus( bundle: $bundle, token: $token ) {\n          bundle,\n          token,\n          admission,\n          balance,\n        }\n      }\n    `\n  }\n}\n","import Subscribe from './Subscribe.js'\nimport { gql } from '@urql/core'\n\nexport default class ActiveWalletSubscribe extends Subscribe {\n  constructor (graphQLClient) {\n    super(graphQLClient)\n    this.$__subscribe = gql`\n      subscription onActiveWallet ( $bundle: String! ) {\n        ActiveWallet( bundle: $bundle ) {\n          address,\n          bundleHash,\n          walletBundle {\n            bundleHash,\n            slug,\n            createdAt,\n          },\n          tokenSlug,\n          token {\n            slug,\n            name,\n            fungibility,\n            supply,\n            decimals,\n            amount,\n            icon,\n            createdAt\n          },\n          batchId,\n          position,\n          characters,\n          pubkey,\n          amount,\n          createdAt,\n          metas {\n            molecularHash,\n            position,\n            metaType,\n            metaId,\n            key,\n            value,\n            createdAt,\n          }\n        }\n      }\n    `\n  }\n}\n","import Subscribe from './Subscribe.js'\nimport { gql } from '@urql/core'\n\nexport default class ActiveSessionSubscribe extends Subscribe {\n  constructor (graphQLClient) {\n    super(graphQLClient)\n    this.$__subscribe = gql`\n      subscription onActiveUser ( $metaType: String!, $metaId: String! ) {\n        ActiveUser( metaType: $metaType, metaId: $metaId ) {\n          bundleHash,\n          metaType,\n          metaId,\n          jsonData,\n          createdAt,\n          updatedAt\n        }\n      }`\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\nexport default class ResponseActiveSession extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.ActiveSession'\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Mutation from '../mutation/Mutation.js'\nimport ResponseActiveSession from '../response/ResponseActiveSession.js'\nimport { gql } from '@urql/core'\n\n/**\n * Mutation for declaring an active User Session with a given MetaAsset\n */\nexport default class MutationActiveSession extends Mutation {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`mutation(\n      $bundleHash: String!,\n      $metaType: String!,\n      $metaId: String!,\n      $ipAddress: String,\n      $browser: String,\n      $osCpu: String,\n      $resolution: String,\n      $timeZone: String,\n      $json: String ) {\n      ActiveSession(\n        bundleHash: $bundleHash,\n        metaType: $metaType,\n        metaId: $metaId,\n        ipAddress: $ipAddress,\n        browser: $browser,\n        osCpu: $osCpu,\n        resolution: $resolution,\n        timeZone: $timeZone,\n        json: $json\n      ) {\n        bundleHash,\n        metaType,\n        metaId,\n        jsonData,\n        createdAt,\n        updatedAt\n      }\n    }`\n  }\n\n  /**\n   * Builds a Response object out of a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseActiveSession}\n   */\n  createResponse (json) {\n    return new ResponseActiveSession({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\n/**\n * Response for QueryActiveSession\n */\nexport default class ResponseQueryActiveSession extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.ActiveUser'\n    })\n  }\n\n  payload () {\n    const list = this.data()\n\n    if (!list) {\n      return null\n    }\n\n    const activeUsers = []\n\n    for (const item of list) {\n      const activeSession = { ...item }\n\n      if (activeSession.jsonData) {\n        activeSession.jsonData = JSON.parse(activeSession.jsonData)\n      }\n\n      if (activeSession.createdAt) {\n        activeSession.createdAt = new Date(activeSession.createdAt)\n      }\n\n      if (activeSession.updatedAt) {\n        activeSession.updatedAt = new Date(activeSession.updatedAt)\n      }\n\n      activeUsers.push(activeSession)\n    }\n\n    return activeUsers\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseQueryActiveSession from '../response/ResponseQueryActiveSession.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving a list of active User Sessions\n */\nexport default class QueryActiveSession extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query ActiveUserQuery ($bundleHash:String, $metaType: String, $metaId: String) {\n      ActiveUser (bundleHash: $bundleHash, metaType: $metaType, metaId: $metaId) {\n        bundleHash,\n        metaType,\n        metaId,\n        jsonData,\n        createdAt,\n        updatedAt\n      }\n    }`\n  }\n\n  /**\n   * @param {object} json\n   * @return {ResponseQueryActiveSession}\n   */\n  createResponse (json) {\n    return new ResponseQueryActiveSession({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport Response from '../response/Response.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for getting the token info\n */\nexport default class QueryToken extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $slug: String, $slugs: [ String! ], $limit: Int, $order: String ) {\n      Token( slug: $slug, slugs: $slugs, limit: $limit, order: $order ) {\n        slug,\n        name,\n        fungibility,\n        supply,\n        decimals,\n        amount,\n        icon,\n      }\n    }`\n  }\n\n  /**\n   *\n   * @param json\n   * @returns {Response}\n   */\n  createResponse (json) {\n    return new Response({\n      query: this,\n      json,\n      dataKey: 'data.Token'\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport BaseException from './BaseException.js'\n\n/**\n * Thrown when attempt to authorize is rejected by the node\n */\nexport default class AuthorizationRejectedException extends BaseException {\n  /**\n   * Class constructor\n   *\n   * @param {string} message\n   * @param {string|null} fileName\n   * @param {number|null} lineNumber\n   */\n  constructor (message = 'Authorization attempt rejected by ledger.', fileName = null, lineNumber = null) {\n    super(message, fileName, lineNumber)\n    this.name = 'AuthorizationRejectedException'\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\n/**\n * Response for MetaType Query\n */\nexport default class ResponseAtom extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.Atom'\n    })\n  }\n\n  /**\n   * Returns meta type instance results\n   *\n   * @return {null|*}\n   */\n  payload () {\n    const metaTypeData = this.data()\n\n    if (!metaTypeData) {\n      return null\n    }\n\n    const response = {\n      instances: [],\n      instanceCount: {},\n      paginatorInfo: {}\n    }\n\n    if (metaTypeData.instances) {\n      response.instances = metaTypeData.instances\n\n      for (const instanceKey in response.instances) {\n        const instance = response.instances[instanceKey]\n        if (instance.metasJson) {\n          response.instances[instanceKey].metas = JSON.parse(instance.metasJson)\n        }\n      }\n    }\n\n    if (metaTypeData.instanceCount) {\n      response.instanceCount = metaTypeData.instanceCount\n    }\n\n    if (metaTypeData.paginatorInfo) {\n      response.paginatorInfo = metaTypeData.paginatorInfo\n    }\n\n    return response\n  }\n\n  metas () {\n    const response = this.payload()\n    const metas = []\n\n    if (response && response.instances) {\n      for (const instance of response.instances) {\n        if (instance.metasJson) {\n          metas.push(JSON.parse(instance.metasJson))\n        }\n      }\n    }\n\n    return metas\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseAtom from '../response/ResponseAtom.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for getting the balance of a given wallet or token slug\n */\nexport default class QueryAtom extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query(\n      $molecularHashes: [String!],\n      $bundleHashes: [String!],\n      $positions:[String!],\n      $walletAddresses: [String!],\n      $isotopes: [String!],\n      $tokenSlugs: [String!],\n      $cellSlugs: [String!],\n      $batchIds: [String!],\n      $values: [String!],\n      $metaTypes: [String!],\n      $metaIds: [String!],\n      $indexes: [String!],\n      $filter: [ MetaFilter! ],\n      $latest: Boolean,\n      $queryArgs: QueryArgs,\n    ) {\n      Atom(\n        molecularHashes: $molecularHashes,\n        bundleHashes: $bundleHashes,\n        positions: $positions,\n        walletAddresses: $walletAddresses,\n        isotopes: $isotopes,\n        tokenSlugs: $tokenSlugs,\n        cellSlugs: $cellSlugs,\n        batchIds: $batchIds,\n        values: $values,\n        metaTypes: $metaTypes,\n        metaIds: $metaIds,\n        indexes: $indexes,\n        filter: $filter,\n        latest: $latest,\n        queryArgs: $queryArgs,\n      ) {\n        instances {\n          position,\n          walletAddress,\n          tokenSlug,\n          isotope,\n          index,\n          molecularHash,\n          metaId,\n          metaType,\n          metasJson,\n          batchId,\n          value,\n          bundleHashes,\n          cellSlugs,\n          createdAt,\n          otsFragment\n        },\n        paginatorInfo {\n          currentPage,\n          total\n        }\n      }\n    }`\n  }\n\n  /**\n   * Queries Knish.IO Atoms\n   *\n   * @param {string[]} molecularHashes\n   * @param {string} molecularHash\n   * @param {string[]} bundleHashes\n   * @param {string} bundleHash\n   * @param {string[]} positions\n   * @param {string} position\n   * @param {string[]} walletAddresses\n   * @param {string} walletAddress\n   * @param {string[]} isotopes\n   * @param {string} isotope\n   * @param {string[]} tokenSlugs\n   * @param {string} tokenSlug\n   * @param {string[]} cellSlugs\n   * @param {string} cellSlug\n   * @param {string[]} batchIds\n   * @param {string} batchId\n   * @param {string[]} values\n   * @param {string|number} value\n   * @param {string[]} metaTypes\n   * @param {string} metaType\n   * @param {string[]} metaIds\n   * @param {string} metaId\n   * @param {number[]} indexes\n   * @param {number} index\n   * @param {object[]} filter,\n   * @param {boolean} latest\n   * @param {object} queryArgs\n   * @return {object}\n   */\n  static createVariables ({\n    molecularHashes,\n    molecularHash,\n    bundleHashes,\n    bundleHash,\n    positions,\n    position,\n    walletAddresses,\n    walletAddress,\n    isotopes,\n    isotope,\n    tokenSlugs,\n    tokenSlug,\n    cellSlugs,\n    cellSlug,\n    batchIds,\n    batchId,\n    values,\n    value,\n    metaTypes,\n    metaType,\n    metaIds,\n    metaId,\n    indexes,\n    index,\n    filter,\n    latest,\n    queryArgs\n  }) {\n    if (molecularHash) {\n      molecularHashes = molecularHashes || []\n      molecularHashes.push(molecularHash)\n    }\n\n    if (bundleHash) {\n      bundleHashes = bundleHashes || []\n      bundleHashes.push(bundleHash)\n    }\n\n    if (position) {\n      positions = positions || []\n      positions.push(position)\n    }\n\n    if (walletAddress) {\n      walletAddresses = walletAddresses || []\n      walletAddresses.push(walletAddress)\n    }\n\n    if (isotope) {\n      isotopes = isotopes || []\n      isotopes.push(isotope)\n    }\n\n    if (tokenSlug) {\n      tokenSlugs = tokenSlugs || []\n      tokenSlugs.push(tokenSlug)\n    }\n\n    if (cellSlug) {\n      cellSlugs = cellSlugs || []\n      cellSlugs.push(cellSlug)\n    }\n\n    if (batchId) {\n      batchIds = batchIds || []\n      batchIds.push(batchId)\n    }\n\n    if (value) {\n      values = values || []\n      values.push(value)\n    }\n\n    if (metaType) {\n      metaTypes = metaTypes || []\n      metaTypes.push(metaType)\n    }\n\n    if (metaId) {\n      metaIds = metaIds || []\n      metaIds.push(metaId)\n    }\n\n    if (index) {\n      indexes = indexes || []\n      indexes.push(index)\n    }\n\n    return {\n      molecularHashes,\n      bundleHashes,\n      positions,\n      walletAddresses,\n      isotopes,\n      tokenSlugs,\n      cellSlugs,\n      batchIds,\n      values,\n      metaTypes,\n      metaIds,\n      indexes,\n      filter,\n      latest,\n      queryArgs\n    }\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseAtom}\n   */\n  createResponse (json) {\n    return new ResponseAtom({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\nexport default class ResponsePolicy extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json\n    })\n    this.dataKey = 'data.Policy'\n    this.init()\n  }\n\n  /**\n   *\n   * @returns {null|object}\n   */\n  payload () {\n    const policy = this.data()\n\n    if (!policy) {\n      return null\n    }\n\n    if (policy.callback) {\n      return JSON.parse(policy.callback)\n    }\n\n    return null\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Query from './Query.js'\nimport ResponsePolicy from '../response/ResponsePolicy.js'\nimport { gql } from '@urql/core'\n\nexport default class QueryPolicy extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $metaType: String, $metaId: String, ) {\n      Policy( metaType: $metaType, metaId: $metaId ) {\n        molecularHash,\n        position,\n        metaType,\n        metaId,\n        conditions,\n        callback,\n        rule,\n        createdAt\n      }\n    }`\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponsePolicy}\n   */\n  createResponse (json) {\n    return new ResponsePolicy({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\nexport default class ResponseMetaTypeViaAtom extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.MetaTypeViaAtom'\n    })\n  }\n\n  payload () {\n    const metaTypeData = this.data()\n\n    if (!metaTypeData || metaTypeData.length === 0) {\n      return null\n    }\n\n    const response = {\n      instances: {},\n      instanceCount: {},\n      paginatorInfo: {}\n    }\n\n    const metaData = metaTypeData.pop()\n\n    if (metaData.instances) {\n      response.instances = metaData.instances\n    }\n\n    if (metaData.instanceCount) {\n      response.instanceCount = metaData.instanceCount\n    }\n\n    if (metaData.paginatorInfo) {\n      response.paginatorInfo = metaData.paginatorInfo\n    }\n\n    return response\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseMetaTypeViaAtom from '../response/ResponseMetaTypeViaAtom.js'\nimport { gql } from '@urql/core'\n\nexport default class QueryMetaTypeViaAtom extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!], $cellSlugs: [String!] ) {\n      MetaTypeViaAtom(\n        metaTypes: $metaTypes\n        metaIds: $metaIds\n        atomValues: $atomValues\n        cellSlugs: $cellSlugs\n        filter: $filter,\n        latest: $latest,\n        queryArgs: $queryArgs\n        countBy: $countBy\n      ) {\n        metaType,\n        instanceCount {\n          key,\n          value\n        },\n        instances {\n          metaType,\n          metaId,\n          createdAt,\n          metas( values: $values, keys: $keys ) {\n            molecularHash,\n            position,\n            key,\n            value,\n            createdAt\n          }\n        },\n        paginatorInfo {\n          currentPage,\n          total\n        }\n      }\n    }`\n  }\n\n  /**\n   * Builds a GraphQL-friendly variables object based on input fields\n   *\n   * @param {string|array|null} metaType\n   * @param {string|array|null} metaId\n   * @param {string|null} key\n   * @param {string|null} value\n   * @param {array|null} values\n   * @param {array|null} keys\n   * @param {array|null} atomValues\n   * @param {boolean|null} latest\n   * @param {array|null} filter\n   * @param {object|null} queryArgs\n   * @param {string|null} countBy\n   * @param {string|null} cellSlug\n   * @return {{}}\n   */\n  static createVariables ({\n    metaType = null,\n    metaId = null,\n    key = null,\n    value = null,\n    keys = null,\n    values = null,\n    atomValues = null,\n    latest = null,\n    filter = null,\n    queryArgs = null,\n    countBy = null,\n    cellSlug = null\n  }) {\n    const variables = {}\n\n    if (atomValues) {\n      variables.atomValues = atomValues\n    }\n\n    if (keys) {\n      variables.keys = keys\n    }\n\n    if (values) {\n      variables.values = values\n    }\n\n    if (metaType) {\n      variables.metaTypes = typeof metaType === 'string' ? [metaType] : metaType\n    }\n\n    if (metaId) {\n      variables.metaIds = typeof metaId === 'string' ? [metaId] : metaId\n    }\n\n    if (cellSlug) {\n      variables.cellSlugs = typeof cellSlug === 'string' ? [cellSlug] : cellSlug\n    }\n\n    if (countBy) {\n      variables.countBy = countBy\n    }\n\n    if (filter) {\n      variables.filter = filter\n    }\n\n    if (key && value) {\n      variables.filter = variables.filter || []\n      variables.filter.push({\n        key,\n        value,\n        comparison: '='\n      })\n    }\n\n    variables.latest = latest === true\n\n    if (queryArgs) {\n      if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {\n        queryArgs.limit = '*'\n      }\n\n      variables.queryArgs = queryArgs\n    }\n\n    return variables\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseMetaTypeViaAtom}\n   */\n  createResponse (json) {\n    return new ResponseMetaTypeViaAtom({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (//////////////)\n                       (////////////////(               (///////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\nimport CheckMolecule from '../libraries/CheckMolecule.js'\n\n/**\n * Response for MetaType queries via Molecule data.\n *\n * Instead of using the redundant instance-level `metas` field,\n * this response extracts metadata from molecule atoms' `metasJson`,\n * producing a payload format compatible with ResponseMetaType and\n * ResponseMetaTypeViaAtom for drop-in replacement usage.\n */\nexport default class ResponseMetaTypeViaMolecule extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.MetaTypeViaAtom'\n    })\n  }\n\n  /**\n   * Extracts metas from a molecule's atoms' metasJson for a specific instance.\n   * Filters atoms by matching metaType and metaId, then parses metasJson.\n   *\n   * @param {object} molecule - Molecule data with atoms array\n   * @param {string} metaType - Instance meta type to filter by\n   * @param {string} metaId - Instance meta ID to filter by\n   * @return {Array<{molecularHash: string, position: string, key: string, value: string, createdAt: string}>}\n   */\n  static extractMetasFromMolecule (molecule, metaType, metaId) {\n    if (!molecule || !molecule.atoms) {\n      return []\n    }\n\n    const metas = []\n\n    for (const atom of molecule.atoms) {\n      // Filter atoms to those matching this instance's metaType and metaId\n      if (atom.metaType !== metaType || atom.metaId !== metaId) {\n        continue\n      }\n\n      if (!atom.metasJson) {\n        continue\n      }\n\n      let parsed\n      try {\n        parsed = JSON.parse(atom.metasJson)\n        if (!Array.isArray(parsed)) {\n          continue\n        }\n      } catch (e) {\n        continue\n      }\n\n      for (const entry of parsed) {\n        metas.push({\n          molecularHash: molecule.molecularHash,\n          position: atom.position,\n          key: entry.key,\n          value: entry.value,\n          createdAt: atom.createdAt\n        })\n      }\n    }\n\n    return metas\n  }\n\n  /**\n   * Returns meta type instance results with metas synthesized from molecule data.\n   * Produces the same payload format as ResponseMetaType and ResponseMetaTypeViaAtom:\n   * { instances, instanceCount, paginatorInfo }\n   *\n   * @return {null|{instances: Array, instanceCount: Array, paginatorInfo: object}}\n   */\n  payload () {\n    const metaTypeData = this.data()\n\n    if (!metaTypeData || metaTypeData.length === 0) {\n      return null\n    }\n\n    const response = {\n      instances: {},\n      instanceCount: {},\n      paginatorInfo: {}\n    }\n\n    const metaData = metaTypeData.pop()\n\n    if (metaData.instances) {\n      response.instances = metaData.instances.map(instance => {\n        // Prefer server-filtered metas (from metas sub-field) when available\n        let metas = instance.metas\n        if (!metas || metas.length === 0) {\n          // Fallback: synthesize from molecule atoms' metasJson\n          metas = ResponseMetaTypeViaMolecule.extractMetasFromMolecule(\n            instance.molecule,\n            instance.metaType,\n            instance.metaId\n          )\n        }\n\n        return {\n          ...instance,\n          metas\n        }\n      })\n    }\n\n    if (metaData.instanceCount) {\n      response.instanceCount = metaData.instanceCount\n    }\n\n    if (metaData.paginatorInfo) {\n      response.paginatorInfo = metaData.paginatorInfo\n    }\n\n    return response\n  }\n\n  /**\n   * Verifies the cryptographic integrity of all molecules associated\n   * with meta instances in this response. For each instance, reconstructs\n   * the molecule from server data and runs CheckMolecule.verify() to validate\n   * the molecular hash and OTS signature.\n   *\n   * @return {{ verified: boolean, molecules: Array<{ molecularHash: string, verified: boolean, error: string|null }> }}\n   */\n  verifyIntegrity () {\n    const results = []\n    const metaTypeData = this.data()\n\n    if (!metaTypeData || metaTypeData.length === 0) {\n      return { verified: true, molecules: results }\n    }\n\n    const instances = metaTypeData[metaTypeData.length - 1]?.instances || []\n\n    for (const instance of instances) {\n      if (!instance.molecule) continue\n      results.push(CheckMolecule.verifyFromServerData(instance.molecule))\n    }\n\n    return {\n      verified: results.length === 0 || results.every(r => r.verified),\n      molecules: results\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (//////////////)\n                       (////////////////(               (///////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseMetaTypeViaMolecule from '../response/ResponseMetaTypeViaMolecule.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving Meta Asset information via Molecule data.\n *\n * Unlike QueryMetaTypeViaAtom, this query does NOT request the redundant\n * instance-level `metas` field. Instead, metadata is extracted client-side\n * from molecule atoms' `metasJson`, eliminating duplicate data transfer.\n */\nexport default class QueryMetaTypeViaMolecule extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!], $cellSlugs: [String!] ) {\n      MetaTypeViaAtom(\n        metaTypes: $metaTypes\n        metaIds: $metaIds\n        atomValues: $atomValues\n        cellSlugs: $cellSlugs\n        filter: $filter,\n        latest: $latest,\n        queryArgs: $queryArgs\n        countBy: $countBy\n      ) {\n        metaType,\n        instanceCount {\n          key,\n          value\n        },\n        instances {\n          metaType,\n          metaId,\n          createdAt,\n          metas( values: $values, keys: $keys ) {\n            molecularHash,\n            position,\n            key,\n            value,\n            createdAt\n          },\n          molecule {\n            molecularHash,\n            bundleHash,\n            cellSlug,\n            status,\n            createdAt,\n            atoms {\n              position,\n              walletAddress,\n              isotope,\n              tokenSlug,\n              value,\n              batchId,\n              metaType,\n              metaId,\n              index,\n              createdAt,\n              otsFragment,\n              metasJson\n            }\n          }\n        },\n        paginatorInfo {\n          currentPage,\n          total\n        }\n      }\n    }`\n  }\n\n  /**\n   * Builds a GraphQL-friendly variables object based on input fields\n   *\n   * @param {string|array|null} metaType\n   * @param {string|array|null} metaId\n   * @param {string|null} key\n   * @param {string|null} value\n   * @param {array|null} values\n   * @param {array|null} keys\n   * @param {array|null} atomValues\n   * @param {boolean|null} latest\n   * @param {array|null} filter\n   * @param {object|null} queryArgs\n   * @param {string|null} countBy\n   * @param {string|null} cellSlug\n   * @return {{}}\n   */\n  static createVariables ({\n    metaType = null,\n    metaId = null,\n    key = null,\n    value = null,\n    keys = null,\n    values = null,\n    atomValues = null,\n    latest = null,\n    filter = null,\n    queryArgs = null,\n    countBy = null,\n    cellSlug = null\n  }) {\n    const variables = {}\n\n    if (atomValues) {\n      variables.atomValues = atomValues\n    }\n\n    if (keys) {\n      variables.keys = keys\n    }\n\n    if (values) {\n      variables.values = values\n    }\n\n    if (metaType) {\n      variables.metaTypes = typeof metaType === 'string' ? [metaType] : metaType\n    }\n\n    if (metaId) {\n      variables.metaIds = typeof metaId === 'string' ? [metaId] : metaId\n    }\n\n    if (cellSlug) {\n      variables.cellSlugs = typeof cellSlug === 'string' ? [cellSlug] : cellSlug\n    }\n\n    if (countBy) {\n      variables.countBy = countBy\n    }\n\n    if (filter) {\n      variables.filter = filter\n    }\n\n    if (key && value) {\n      variables.filter = variables.filter || []\n      variables.filter.push({\n        key,\n        value,\n        comparison: '='\n      })\n    }\n\n    variables.latest = latest === true\n\n    if (queryArgs) {\n      if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {\n        queryArgs.limit = '*'\n      }\n\n      variables.queryArgs = queryArgs\n    }\n\n    return variables\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseMetaTypeViaMolecule}\n   */\n  createResponse (json) {\n    return new ResponseMetaTypeViaMolecule({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\n\n/**\n * Response for EmbeddingStatus Query\n *\n * Payload is an array of EmbeddingStatusItem objects:\n *   { metaType, metaId, state, totalMetas, embeddedCount, embeddedAt, model }\n *\n * state is one of: 'PENDING' | 'STALE' | 'COMPLETE'\n */\nexport default class ResponseEmbeddingStatus extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.embeddingStatus'\n    })\n  }\n\n  /**\n   * Returns the array of embedding status items, or null if empty.\n   *\n   * Each item contains:\n   * - metaType {string} - Metadata type (echoed from input)\n   * - metaId {string} - Instance identifier (echoed from input)\n   * - state {string} - PENDING | STALE | COMPLETE\n   * - totalMetas {number} - Total meta rows for this instance\n   * - embeddedCount {number} - Rows with current-model embeddings\n   * - embeddedAt {number|null} - Unix epoch of most recent embedding\n   * - model {string|null} - Model name used for embeddings\n   *\n   * @return {Array<object>|null}\n   */\n  payload () {\n    const items = this.data()\n\n    if (!items || !Array.isArray(items) || items.length === 0) {\n      return null\n    }\n\n    return items\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport Query from './Query.js'\nimport ResponseEmbeddingStatus from '../response/ResponseEmbeddingStatus.js'\nimport { gql } from '@urql/core'\n\n/**\n * Query for retrieving DataBraid embedding status for meta instances.\n *\n * Supports both single-instance and bulk modes:\n * - Single: { metaType: 'product', metaId: 'SKU-001' }\n * - Bulk:   { instances: [{ metaType: 'product', metaId: 'SKU-001' }, ...] }\n *\n * Returns embedding state (PENDING, STALE, COMPLETE) for each instance,\n * allowing apps to render spinner badges and completion indicators.\n *\n * NOTE: Only available on servers with EMBEDDING_ENABLED=true.\n * Use KnishIOClient.queryEmbeddingStatus() which handles capability\n * detection and returns null for unsupported servers.\n */\nexport default class QueryEmbeddingStatus extends Query {\n  /**\n   * @param {UrqlClientWrapper} graphQLClient\n   * @param {KnishIOClient} knishIOClient\n   */\n  constructor (graphQLClient, knishIOClient) {\n    super(graphQLClient, knishIOClient)\n\n    this.$__query = gql`query( $metaType: String, $metaId: String, $instances: [EmbeddingStatusInput!] ) {\n      embeddingStatus( metaType: $metaType, metaId: $metaId, instances: $instances ) {\n        metaType,\n        metaId,\n        state,\n        totalMetas,\n        embeddedCount,\n        embeddedAt,\n        model\n      }\n    }`\n  }\n\n  /**\n   * Builds a GraphQL-friendly variables object for embedding status queries.\n   *\n   * Single mode: createVariables({ metaType: 'product', metaId: 'SKU-001' })\n   * Bulk mode:   createVariables({ instances: [{ metaType: 'product', metaId: 'SKU-001' }, ...] })\n   *\n   * @param {string|null} metaType\n   * @param {string|null} metaId\n   * @param {Array<{metaType: string, metaId: string}>|null} instances\n   * @return {{}}\n   */\n  static createVariables ({\n    metaType = null,\n    metaId = null,\n    instances = null\n  }) {\n    const variables = {}\n\n    if (instances && instances.length > 0) {\n      variables.instances = instances\n    }\n\n    if (metaType) {\n      variables.metaType = metaType\n    }\n\n    if (metaId) {\n      variables.metaId = metaId\n    }\n\n    return variables\n  }\n\n  /**\n   * Returns a Response object\n   *\n   * @param {object} json\n   * @return {ResponseEmbeddingStatus}\n   */\n  createResponse (json) {\n    return new ResponseEmbeddingStatus({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport ResponseProposeMolecule from './ResponseProposeMolecule.js'\n\n/**\n * Response for rule creation\n */\nexport default class ResponseCreateRule extends ResponseProposeMolecule {\n\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\nimport ResponseCreateRule from '../response/ResponseCreateRule.js'\n\n/**\n * Query for creating new Meta attached to some MetaType\n */\nexport default class MutationCreateRule extends MutationProposeMolecule {\n  /**\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {object[]} rule\n   * @param {object} policy\n   */\n  fillMolecule ({\n    metaType,\n    metaId,\n    rule,\n    policy\n  }) {\n    this.$__molecule.createRule({\n      metaType,\n      metaId,\n      rule,\n      policy\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check()\n  }\n\n  /**\n   * Builds a new Response object from a JSON string\n   *\n   * @param {object} json\n   * @return {ResponseCreateRule}\n   */\n  createResponse (json) {\n    return new ResponseCreateRule({\n      query: this,\n      json\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\n\n/**\n *\n */\nexport default class MutationDepositBufferToken extends MutationProposeMolecule {\n  /**\n   * Fills the Molecule with provided wallet and amount data\n   *\n   * @param amount\n   * @param tradeRates\n   */\n  fillMolecule ({\n    amount,\n    tradeRates\n  }) {\n    this.$__molecule.initDepositBuffer({\n      amount,\n      tradeRates\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check(this.$__molecule.sourceWallet)\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\nimport MutationProposeMolecule from './MutationProposeMolecule.js'\n\n/**\n *\n */\nexport default class MutationWithdrawBufferToken extends MutationProposeMolecule {\n  /**\n   *\n   * @param recipients\n   */\n  fillMolecule ({\n    recipients\n  }) {\n    this.$__molecule.initWithdrawBuffer({\n      recipients\n    })\n    this.$__molecule.sign({})\n    this.$__molecule.check(this.$__molecule.sourceWallet)\n  }\n}\n","const e=2592e5,n=\"thumbmark\",t=\"https://api.thumbmarkjs.com\",r={exclude:[],include:[],stabilize:[\"private\",\"iframe\"],logging:!0,collect_beacon:!0,timeout:5e3,cache_api_call:!0,cache_lifetime_in_ms:0,performance:!1,experimental:!1,simple_request:!1,property_name_factory:e=>`${n}_${e}`};let o={...r};function i(e,n){o[e]=n}const a={private:[{exclude:[\"canvas\"],browsers:[\"firefox\",\"safari>=17\",\"brave\"]},{exclude:[\"audio\"],browsers:[\"samsungbrowser\",\"safari\"]},{exclude:[\"fonts\"],browsers:[\"firefox\"]},{exclude:[\"audio.sampleHash\",\"hardware.deviceMemory\",\"header.acceptLanguage.q\",\"system.hardwareConcurrency\",\"plugins\"],browsers:[\"brave\"]},{exclude:[\"tls.extensions\"],browsers:[\"firefox\",\"chrome\",\"safari\"]},{exclude:[\"header.acceptLanguage\"],browsers:[\"edge\",\"chrome\"]}],iframe:[{exclude:[\"system.applePayVersion\",\"system.cookieEnabled\"],browsers:[\"safari\"]},{exclude:[\"permissions\"]}],vpn:[{exclude:[\"ip\"]}],always:[{exclude:[\"speech\"],browsers:[\"brave\",\"firefox\"]}]},s=\"undefined\"!=typeof window?window.OfflineAudioContext||window.webkitOfflineAudioContext:null;function c(e){let n=0;for(let t=0;t<e.length;++t)n+=Math.abs(e[t]);return n}function l(e,n,t){if(1===e.length)return e[0];if(3===e.length){const r=e[0].data,o=e[1].data,i=e[2].data,a=new Uint8ClampedArray(r.length);for(let e=0;e<r.length;e++){const n=r[e],t=o[e],s=i[e];a[e]=n===t||n===s?n:t===s?t:n}return new ImageData(a,n,t)}let r=[];for(let n=0;n<e[0].data.length;n++){let t=[];for(let r=0;r<e.length;r++)t.push(e[r].data[n]);r.push(u(t))}const o=new Uint8ClampedArray(r);return new ImageData(o,n,t)}function u(e){if(0===e.length)return 0;const n={};for(const t of e)n[t]=(n[t]||0)+1;let t=e[0];for(const e in n)n[e]>n[t]&&(t=parseInt(e,10));return t}function d(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),(e^=e>>>16)>>>0}const m=new Uint32Array([597399067,2869860233,951274213,2716044179]);function p(e,n){return e<<n|e>>>32-n}function f(e,n=0){if(n=n?0|n:0,\"string\"==typeof e&&(e=function(e){if(\"undefined\"!=typeof TextEncoder)return(new TextEncoder).encode(e).buffer;const n=[];for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);r<128?n.push(r):r<2048?n.push(192|r>>6,128|63&r):r<55296||r>=57344?n.push(224|r>>12,128|r>>6&63,128|63&r):(t++,r=65536+((1023&r)<<10|1023&e.charCodeAt(t)),n.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return new Uint8Array(n).buffer}(e)),!(e instanceof ArrayBuffer))throw new TypeError(\"Expected key to be ArrayBuffer or string\");const t=new Uint32Array([n,n,n,n]);!function(e,n){const t=e.byteLength/16|0,r=new Uint32Array(e,0,4*t);for(let e=0;e<t;e++){const t=r.subarray(4*e,4*(e+1));t[0]=Math.imul(t[0],m[0]),t[0]=p(t[0],15),t[0]=Math.imul(t[0],m[1]),n[0]=n[0]^t[0],n[0]=p(n[0],19),n[0]=n[0]+n[1],n[0]=Math.imul(n[0],5)+1444728091,t[1]=Math.imul(t[1],m[1]),t[1]=p(t[1],16),t[1]=Math.imul(t[1],m[2]),n[1]=n[1]^t[1],n[1]=p(n[1],17),n[1]=n[1]+n[2],n[1]=Math.imul(n[1],5)+197830471,t[2]=Math.imul(t[2],m[2]),t[2]=p(t[2],17),t[2]=Math.imul(t[2],m[3]),n[2]=n[2]^t[2],n[2]=p(n[2],15),n[2]=n[2]+n[3],n[2]=Math.imul(n[2],5)+2530024501,t[3]=Math.imul(t[3],m[3]),t[3]=p(t[3],18),t[3]=Math.imul(t[3],m[0]),n[3]=n[3]^t[3],n[3]=p(n[3],13),n[3]=n[3]+n[0],n[3]=Math.imul(n[3],5)+850148119}}(e,t),function(e,n){const t=e.byteLength/16|0,r=e.byteLength%16,o=new Uint32Array(4),i=new Uint8Array(e,16*t,r);switch(r){case 15:o[3]=o[3]^i[14]<<16;case 14:o[3]=o[3]^i[13]<<8;case 13:o[3]=o[3]^i[12],o[3]=Math.imul(o[3],m[3]),o[3]=p(o[3],18),o[3]=Math.imul(o[3],m[0]),n[3]=n[3]^o[3];case 12:o[2]=o[2]^i[11]<<24;case 11:o[2]=o[2]^i[10]<<16;case 10:o[2]=o[2]^i[9]<<8;case 9:o[2]=o[2]^i[8],o[2]=Math.imul(o[2],m[2]),o[2]=p(o[2],17),o[2]=Math.imul(o[2],m[3]),n[2]=n[2]^o[2];case 8:o[1]=o[1]^i[7]<<24;case 7:o[1]=o[1]^i[6]<<16;case 6:o[1]=o[1]^i[5]<<8;case 5:o[1]=o[1]^i[4],o[1]=Math.imul(o[1],m[1]),o[1]=p(o[1],16),o[1]=Math.imul(o[1],m[2]),n[1]=n[1]^o[1];case 4:o[0]=o[0]^i[3]<<24;case 3:o[0]=o[0]^i[2]<<16;case 2:o[0]=o[0]^i[1]<<8;case 1:o[0]=o[0]^i[0],o[0]=Math.imul(o[0],m[0]),o[0]=p(o[0],15),o[0]=Math.imul(o[0],m[1]),n[0]=n[0]^o[0]}}(e,t),function(e,n){n[0]=n[0]^e.byteLength,n[1]=n[1]^e.byteLength,n[2]=n[2]^e.byteLength,n[3]=n[3]^e.byteLength,n[0]=n[0]+n[1]|0,n[0]=n[0]+n[2]|0,n[0]=n[0]+n[3]|0,n[1]=n[1]+n[0]|0,n[2]=n[2]+n[0]|0,n[3]=n[3]+n[0]|0,n[0]=d(n[0]),n[1]=d(n[1]),n[2]=d(n[2]),n[3]=d(n[3]),n[0]=n[0]+n[1]|0,n[0]=n[0]+n[2]|0,n[0]=n[0]+n[3]|0,n[1]=n[1]+n[0]|0,n[2]=n[2]+n[0]|0,n[3]=n[3]+n[0]|0}(e,t);const r=new Uint8Array(t.buffer);return Array.from(r).map((e=>e.toString(16).padStart(2,\"0\"))).join(\"\")}const h=280;function g(e,n){return new Promise((t=>setTimeout(t,e,n)))}const v=[\"Arial\",\"Arial Black\",\"Arial Narrow\",\"Arial Rounded MT\",\"Arimo\",\"Archivo\",\"Barlow\",\"Bebas Neue\",\"Bitter\",\"Bookman\",\"Calibri\",\"Cabin\",\"Candara\",\"Century\",\"Century Gothic\",\"Comic Sans MS\",\"Constantia\",\"Courier\",\"Courier New\",\"Crimson Text\",\"DM Mono\",\"DM Sans\",\"DM Serif Display\",\"DM Serif Text\",\"Dosis\",\"Droid Sans\",\"Exo\",\"Fira Code\",\"Fira Sans\",\"Franklin Gothic Medium\",\"Garamond\",\"Geneva\",\"Georgia\",\"Gill Sans\",\"Helvetica\",\"Impact\",\"Inconsolata\",\"Indie Flower\",\"Inter\",\"Josefin Sans\",\"Karla\",\"Lato\",\"Lexend\",\"Lucida Bright\",\"Lucida Console\",\"Lucida Sans Unicode\",\"Manrope\",\"Merriweather\",\"Merriweather Sans\",\"Montserrat\",\"Myriad\",\"Noto Sans\",\"Nunito\",\"Nunito Sans\",\"Open Sans\",\"Optima\",\"Orbitron\",\"Oswald\",\"Pacifico\",\"Palatino\",\"Perpetua\",\"PT Sans\",\"PT Serif\",\"Poppins\",\"Prompt\",\"Public Sans\",\"Quicksand\",\"Rajdhani\",\"Recursive\",\"Roboto\",\"Roboto Condensed\",\"Rockwell\",\"Rubik\",\"Segoe Print\",\"Segoe Script\",\"Segoe UI\",\"Sora\",\"Source Sans Pro\",\"Space Mono\",\"Tahoma\",\"Taviraj\",\"Times\",\"Times New Roman\",\"Titillium Web\",\"Trebuchet MS\",\"Ubuntu\",\"Varela Round\",\"Verdana\",\"Work Sans\"],y=[\"monospace\",\"sans-serif\",\"serif\"];function w(e,n){return e.font=`72px ${n}`,e.measureText(\"WwMmLli0Oo\").width}function S(){var e;const n=document.createElement(\"canvas\"),t=null!==(e=n.getContext(\"webgl\"))&&void 0!==e?e:n.getContext(\"experimental-webgl\");if(t&&\"getParameter\"in t)try{const e=(t.getParameter(t.VENDOR)||\"\").toString(),n=(t.getParameter(t.RENDERER)||\"\").toString();let r={vendor:e,renderer:n,version:(t.getParameter(t.VERSION)||\"\").toString(),shadingLanguageVersion:(t.getParameter(t.SHADING_LANGUAGE_VERSION)||\"\").toString()};if(!n.length||!e.length){const e=t.getExtension(\"WEBGL_debug_renderer_info\");if(e){const n=(t.getParameter(e.UNMASKED_VENDOR_WEBGL)||\"\").toString(),o=(t.getParameter(e.UNMASKED_RENDERER_WEBGL)||\"\").toString();n&&(r.vendorUnmasked=n),o&&(r.rendererUnmasked=o)}}return r}catch(e){}return\"undefined\"}function b(){const e=new Float32Array(1),n=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],n[3]}const _=(e,n,t,r)=>{const o=(t-n)/r;let i=0;for(let t=0;t<r;t++){i+=e(n+(t+.5)*o)}return i*o};function P(e,n){const t={};return n.forEach((n=>{const r=function(e){if(0===e.length)return null;const n={};e.forEach((e=>{const t=String(e);n[t]=(n[t]||0)+1}));let t=e[0],r=1;return Object.keys(n).forEach((e=>{n[e]>r&&(t=e,r=n[e])})),t}(e.map((e=>n in e?e[n]:void 0)).filter((e=>void 0!==e)));r&&(t[n]=r)})),t}const A=[\"accelerometer\",\"accessibility\",\"accessibility-events\",\"ambient-light-sensor\",\"background-fetch\",\"background-sync\",\"bluetooth\",\"camera\",\"clipboard-read\",\"clipboard-write\",\"device-info\",\"display-capture\",\"gyroscope\",\"geolocation\",\"local-fonts\",\"magnetometer\",\"microphone\",\"midi\",\"nfc\",\"notifications\",\"payment-handler\",\"persistent-storage\",\"push\",\"speaker\",\"storage-access\",\"top-level-storage-access\",\"window-management\",\"query\"];const x=new Map;function M(){if(\"undefined\"==typeof navigator)return{name:\"unknown\",version:\"unknown\"};const e=!!navigator.brave,n=(e?\"B|\":\"N|\")+navigator.userAgent,t=x.get(n);if(t)return t;const r=[{name:\"Brave\",detect:()=>e}];let o;for(const e of r)if(e.detect()){const t=C(navigator.userAgent);return o={name:e.name,version:t.version},x.set(n,o),o}return o=C(navigator.userAgent),x.set(n,o),o}function C(e){var n,t,r,o,i,a;const s=[/(?<name>SamsungBrowser)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>EdgA|EdgiOS|Edg)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>OPR|OPX)\\/(?<version>\\d+(?:\\.\\d+)+)/,/Opera[\\s\\/](?<version>\\d+(?:\\.\\d+)+)/,/Opera Mini\\/(?<version>\\d+(?:\\.\\d+)+)/,/Opera Mobi\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>Vivaldi)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>CriOS)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>FxiOS)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>Chrome|Chromium)\\/(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>Firefox|Waterfox|Iceweasel|IceCat)\\/(?<version>\\d+(?:\\.\\d+)+)/,/Version\\/(?<version1>[\\d.]+).*Safari\\/[\\d.]+|(?<name>Safari)\\/(?<version2>[\\d.]+)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\\d+(?:\\.\\d+)+)/,/(?<name>[A-Za-z]+)\\/(?<version>\\d+(?:\\.\\d+)+)/],c={edg:\"Edge\",edga:\"Edge\",edgios:\"Edge\",opr:\"Opera\",opx:\"Opera\",crios:\"Chrome\",fxios:\"Firefox\",samsung:\"SamsungBrowser\",vivaldi:\"Vivaldi\"};for(const l of s){const s=e.match(l);if(s){let e=null===(n=s.groups)||void 0===n?void 0:n.name,u=(null===(t=s.groups)||void 0===t?void 0:t.version)||(null===(r=s.groups)||void 0===r?void 0:r.version1)||(null===(o=s.groups)||void 0===o?void 0:o.version2);if(e||!(null===(i=s.groups)||void 0===i?void 0:i.version1)&&!(null===(a=s.groups)||void 0===a?void 0:a.version2)||(e=\"Safari\"),!e&&l.source.includes(\"Opera Mini\")&&(e=\"Opera Mini\"),!e&&l.source.includes(\"Opera Mobi\")&&(e=\"Opera Mobi\"),!e&&l.source.includes(\"Opera\")&&(e=\"Opera\"),!e&&s[1]&&(e=s[1]),!u&&s[2]&&(u=s[2]),e){return{name:c[e.toLowerCase()]||e,version:u||\"unknown\"}}}}return{name:\"unknown\",version:\"unknown\"}}function E(){if(\"undefined\"==typeof navigator||!navigator.userAgent)return!1;const e=navigator.userAgent;return/Mobi|Android|iPhone|iPod|IEMobile|Opera Mini|Opera Mobi|webOS|BlackBerry|Windows Phone/i.test(e)&&!/iPad/i.test(e)}function T(){let e=[];const n={\"prefers-contrast\":[\"high\",\"more\",\"low\",\"less\",\"forced\",\"no-preference\"],\"any-hover\":[\"hover\",\"none\"],\"any-pointer\":[\"none\",\"coarse\",\"fine\"],pointer:[\"none\",\"coarse\",\"fine\"],hover:[\"hover\",\"none\"],update:[\"fast\",\"slow\"],\"inverted-colors\":[\"inverted\",\"none\"],\"prefers-reduced-motion\":[\"reduce\",\"no-preference\"],\"prefers-reduced-transparency\":[\"reduce\",\"no-preference\"],scripting:[\"none\",\"initial-only\",\"enabled\"],\"forced-colors\":[\"active\",\"none\"]};return Object.keys(n).forEach((t=>{n[t].forEach((n=>{matchMedia(`(${t}: ${n})`).matches&&e.push(`${t}: ${n}`)}))})),e}function k(){if(\"https:\"===window.location.protocol&&\"function\"==typeof window.ApplePaySession)try{const e=window.ApplePaySession.supportsVersion;for(let n=15;n>0;n--)if(e(n))return n}catch(e){return 0}return 0}const R=\"SamsungBrowser\"!==M().name?1:3,O=\"Brave\"!==M().name,I=137,B=(()=>{const e=new Float32Array(548),n=2*Math.PI/I;for(let t=0;t<I;t++){const r=t*n;e[4*t]=0,e[4*t+1]=0,e[4*t+2]=100*Math.cos(r),e[4*t+3]=50*Math.sin(r)}return e})();let L=null;function D(){try{if(\"undefined\"==typeof document)return null;const e=document.createElement(\"canvas\");e.width=200,e.height=100;const n=e.getContext(\"webgl\");if(!n)return null;e.addEventListener(\"webglcontextlost\",(e=>{e.preventDefault(),L=null}),{once:!0});const t=n.createShader(n.VERTEX_SHADER),r=n.createShader(n.FRAGMENT_SHADER);if(!t||!r)return null;if(n.shaderSource(t,\"\\n    attribute vec2 position;\\n    void main() {\\n        gl_Position = vec4(position, 0.0, 1.0);\\n    }\\n\"),n.compileShader(t),!n.getShaderParameter(t,n.COMPILE_STATUS))return null;if(n.shaderSource(r,\"\\n    precision mediump float;\\n    void main() {\\n        gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color\\n    }\\n\"),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))return null;const o=n.createProgram();if(!o)return null;if(n.attachShader(o,t),n.attachShader(o,r),n.linkProgram(o),!n.getProgramParameter(o,n.LINK_STATUS))return null;const i=n.createBuffer();return i?(n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,B,n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),{canvas:e,gl:n,program:o,buffer:i}):null}catch(e){return null}}function N(e){const n=new Set;return function e(t){if(t&&t.toJSON&&\"function\"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if(\"number\"==typeof t)return isFinite(t)?\"\"+t:\"null\";if(\"object\"!=typeof t)return JSON.stringify(t);let r,o;if(Array.isArray(t)){for(o=\"[\",r=0;r<t.length;r++)r&&(o+=\",\"),o+=e(t[r])||\"null\";return o+\"]\"}if(null===t)return\"null\";if(n.has(t))throw new TypeError(\"Converting circular structure to JSON\");n.add(t);const i=Object.keys(t).sort();for(o=\"\",r=0;r<i.length;r++){const n=i[r],a=e(t[n]);a&&(o&&(o+=\",\"),o+=JSON.stringify(n)+\":\"+a)}return n.delete(t),\"{\"+o+\"}\"}(e)||\"\"}const j={audio:async function(){return s?async function(){return new Promise(((e,n)=>{try{const n=new s(1,5e3,44100),t=n.createBufferSource(),r=n.createOscillator();r.frequency.value=1e3;const o=n.createDynamicsCompressor();let i;o.threshold.value=-50,o.knee.value=40,o.ratio.value=12,o.attack.value=0,o.release.value=.2,r.connect(o),o.connect(n.destination),r.start(),n.oncomplete=r=>{i=r.renderedBuffer.getChannelData(0),e({sampleHash:c(i),maxChannels:n.destination.maxChannelCount,channelCountMode:t.channelCountMode})},n.startRendering()}catch(e){n(e)}}))}():null},canvas:async function(){return new Promise((e=>{const n=Array.from({length:3},(()=>function(){const e=document.createElement(\"canvas\"),n=e.getContext(\"2d\");if(!n)return null;e.width=h,e.height=20;const t=n.createLinearGradient(0,0,e.width,e.height);t.addColorStop(0,\"red\"),t.addColorStop(1/6,\"orange\"),t.addColorStop(2/6,\"yellow\"),t.addColorStop(.5,\"green\"),t.addColorStop(4/6,\"blue\"),t.addColorStop(5/6,\"indigo\"),t.addColorStop(1,\"violet\"),n.fillStyle=t,n.fillRect(0,0,e.width,e.height);const r=\"Random Text WMwmil10Oo\";return n.font=\"23.123px Arial\",n.fillStyle=\"black\",n.fillText(r,-5,15),n.fillStyle=\"rgba(0, 0, 255, 0.5)\",n.fillText(r,-3.3,17.7),n.beginPath(),n.moveTo(0,0),n.lineTo(2*e.width/7,e.height),n.strokeStyle=\"white\",n.lineWidth=2,n.stroke(),n.getImageData(0,0,e.width,e.height)}())).filter((e=>null!==e));0!==n.length?e({commonPixelsHash:f(l(n,h,20).data.toString()).toString()}):e(null)}))},fonts:async function(e){return new Promise((e=>{try{!async function(e){for(var n;!document.body;)await g(50);const t=document.createElement(\"iframe\");t.setAttribute(\"frameBorder\",\"0\");const r=t.style;r.setProperty(\"position\",\"fixed\"),r.setProperty(\"display\",\"block\",\"important\"),r.setProperty(\"visibility\",\"visible\"),r.setProperty(\"border\",\"0\"),r.setProperty(\"opacity\",\"0\"),t.src=\"about:blank\",document.body.appendChild(t);const o=t.contentDocument||(null===(n=t.contentWindow)||void 0===n?void 0:n.document);if(!o)throw new Error(\"Iframe document is not accessible\");e({iframe:o}),setTimeout((()=>{document.body.removeChild(t)}),0)}((async({iframe:n})=>{const t=n.createElement(\"canvas\").getContext(\"2d\");if(!t)return void e(null);const r=y.map((e=>w(t,e)));let o={};v.forEach((e=>{const n=w(t,e);r.includes(n)||(o[e]=n)})),e(o)}))}catch(n){e(null)}}))},hardware:function(){return new Promise(((e,n)=>{const t=void 0!==navigator.deviceMemory?navigator.deviceMemory:0,r=window.performance&&window.performance.memory?window.performance.memory:0;e({videocard:S(),architecture:b(),deviceMemory:t.toString()||\"undefined\",jsHeapSizeLimit:r.jsHeapSizeLimit||0})}))},locales:function(){return new Promise((e=>{e({languages:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}))},math:function(){return new Promise((e=>{e({acos:Math.acos(.5),asin:_(Math.asin,-1,1,97),cos:_(Math.cos,0,Math.PI,97),largeCos:Math.cos(1e20),largeSin:Math.sin(1e20),largeTan:Math.tan(1e20),sin:_(Math.sin,-Math.PI,Math.PI,97),tan:_(Math.tan,0,2*Math.PI,97)})}))},permissions:async function(e){const n=(null==e?void 0:e.permissions_to_check)||A;return P(await Promise.all(Array.from({length:3},(()=>async function(e){const n={};for(const t of e)try{const e=await navigator.permissions.query({name:t});n[t]=e.state.toString()}catch(e){}return n}(n)))),n)},plugins:async function(){const e=[];if(navigator.plugins)for(let n=0;n<navigator.plugins.length;n++){const t=navigator.plugins[n];e.push([t.name,t.filename,t.description].join(\"|\"))}return new Promise((n=>{n({plugins:e})}))},screen:function(){return new Promise((e=>{if(\"undefined\"==typeof matchMedia||\"undefined\"==typeof screen)return void e(null);const n={is_touchscreen:navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints,colorDepth:screen.colorDepth,mediaMatches:T()};E()&&navigator.maxTouchPoints>0&&(n.resolution=function(){const e=window.screen.width,n=window.screen.height,t=Math.max(e,n).toString(),r=Math.min(e,n).toString();return`${t}x${r}`}()),e(n)}))},system:function(){return new Promise((e=>{const n=M();e({platform:window.navigator.platform,productSub:navigator.productSub,product:navigator.product,useragent:navigator.userAgent,hardwareConcurrency:navigator.hardwareConcurrency,browser:{name:n.name,version:n.version},mobile:E(),applePayVersion:k(),cookieEnabled:window.navigator.cookieEnabled})}))},webgl:async function(){const e=O?(L||(L=D()),L):D();if(!e)return{webgl:\"unsupported\"};try{const n=Array.from({length:R},(()=>function(e){const{canvas:n,gl:t,program:r,buffer:o}=e;try{t.useProgram(r),t.bindBuffer(t.ARRAY_BUFFER,o);const e=t.getAttribLocation(r,\"position\");t.enableVertexAttribArray(e),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),t.viewport(0,0,n.width,n.height),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.LINES,0,274);const i=new Uint8ClampedArray(n.width*n.height*4);return t.readPixels(0,0,n.width,n.height,t.RGBA,t.UNSIGNED_BYTE,i),new ImageData(i,n.width,n.height)}catch(e){return L=null,new ImageData(1,1)}finally{t.bindBuffer(t.ARRAY_BUFFER,null),t.useProgram(null),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(0,0,0,0)}}(e)));return{commonPixelsHash:f(l(n,e.canvas.width,e.canvas.height).data.toString()).toString()}}catch(e){return{webgl:\"unsupported\"}}},webrtc:async function(e){return new Promise((e=>{let n;try{const t=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection;if(!t)return void e({supported:!1,error:\"WebRTC not supported\"});n=new t({iceCandidatePoolSize:1,iceServers:[]});const r=n;r.createDataChannel(\"\");(async()=>{try{const n={offerToReceiveAudio:!0,offerToReceiveVideo:!0},t=await r.createOffer(n);await r.setLocalDescription(t);const o=t.sdp||\"\",i=[...new Set((o.match(/extmap:\\d+ [^\\n\\r]+/g)||[]).map((e=>e.replace(/extmap:\\d+ /,\"\"))))].sort(),a=e=>{const n=o.match(new RegExp(`m=${e} [^\\\\s]+ [^\\\\s]+ ([^\\\\n\\\\r]+)`));return n?n[1].split(\" \"):[]},s=(e,n)=>n.map((n=>{const t=new RegExp(`(rtpmap|fmtp|rtcp-fb):${n} (.+)`,\"g\"),r=[...o.matchAll(t)];if(!r.length)return null;const i={};return r.forEach((n=>{const[t,r,o]=n,a=o.split(\"/\");\"rtpmap\"===r?(i.mimeType=`${e}/${a[0]}`,i.clockRate=+a[1],\"audio\"===e&&(i.channels=+a[2]||1)):\"rtcp-fb\"===r?(i.feedbackSupport=i.feedbackSupport||[],i.feedbackSupport.push(o)):\"fmtp\"===r&&(i.sdpFmtpLine=o)})),i})).filter(Boolean),c=s(\"audio\",a(\"audio\")),l=s(\"video\",a(\"video\")),u={audio:{count:c.length,hash:f(N(c))},video:{count:l.length,hash:f(N(l))},extensionsHash:f(N(i))};r.close();const d={supported:!0,...u,candidateType:\"host\"};e({details:d,hash:f(N(d))})}catch(n){r.close(),e({supported:!0,error:`WebRTC offer failed: ${n.message}`})}})()}catch(t){null==n||n.close(),e({supported:!1,error:`WebRTC error: ${t.message}`})}}))},speech:async function(){return new Promise((e=>{try{if(\"undefined\"==typeof window||!window.speechSynthesis||\"function\"!=typeof window.speechSynthesis.getVoices)return void e({supported:!1,error:\"Speech Synthesis API not supported\"});let n=!1,t=null;const r=r=>{if(!n){n=!0,t&&clearTimeout(t);try{const n=r.map((e=>{const n=e=>e.replace(/\\\\/g,\"\\\\\\\\\").replace(/,/g,\"\\\\,\");return[n(e.voiceURI||\"\"),n(e.name||\"\"),n(e.lang||\"\"),e.localService?\"1\":\"0\",e.default?\"1\":\"0\"].join(\",\")}));n.sort();const t={voiceCount:r.length,voicesHash:f(N(n))};e({details:t,hash:f(N(t))})}catch(n){e({supported:!0,error:`Voice processing failed: ${n.message}`})}}},o=window.speechSynthesis.getVoices();if(o.length>0)return void r(o);t=setTimeout((()=>{const e=window.speechSynthesis.getVoices();r(e)}),800);const i=()=>{window.speechSynthesis.removeEventListener(\"voiceschanged\",i);const e=window.speechSynthesis.getVoices();r(e)};window.speechSynthesis.addEventListener(\"voiceschanged\",i)}catch(n){e({supported:!1,error:`Speech Synthesis error: ${n.message}`})}}))}},U={},$={timeout:\"true\"},F=(e,n,t)=>{U[e]=n};function V(){return\"1.12.0\"}function W(e,n){var t,r;let o=M();if(\"unknown\"===o.name&&n){const e=null===(t=n.system)||void 0===t?void 0:t.browser;(null==e?void 0:e.name)&&(o={name:String(e.name),version:String(e.version||\"unknown\")})}const i=o.name.toLowerCase(),s=parseInt(o.version.split(\".\")[0]||\"0\",10),c=Array.isArray(null==e?void 0:e.exclude)?[...e.exclude]:[],l=[...new Set([...(null==e?void 0:e.stabilize)||[],\"always\"])];for(const e of l){const n=a[e];if(n)for(const e of n)\"browsers\"in e&&!(null===(r=e.browsers)||void 0===r?void 0:r.some((e=>{const n=e.match(/(.+?)(>=)(\\d+)/);return n?i===n[1]&&s>=+n[3]:i===e})))||c.push(...e.exclude)}return c}function G(e,n){const t=W(n,e),r=Array.isArray(null==n?void 0:n.include)?n.include:[];return function e(n,o=\"\"){const i={};for(const[a,s]of Object.entries(n)){const n=o?`${o}.${a}`:a;if(\"object\"!=typeof s||Array.isArray(s)||null===s){const e=t.some((e=>n.startsWith(e))),o=r.some((e=>n.startsWith(e)));e&&!o||(i[a]=s)}else{const t=e(s,n);Object.keys(t).length>0&&(i[a]=t)}}return i}(e)}const H=\"https://experimental.thumbmarkjs.com/experimental.min.js\",q=131072;function J(e,n){const t={target:\"request\",type:e};return n&&(t.message=n.slice(0,200)),{schema:0,payload_id:\"none\",signals:{},errors:[t]}}function z(e){if(\"object\"!=typeof e||null===e||Array.isArray(e))return!1;const n=Object.getPrototypeOf(e);return n===Object.prototype||null===n}function Y(e){return e instanceof Error?e.message:void 0}async function K(){var e;try{return null!==(e=await function(e,n){let t;const r=new Promise((e=>{t=setTimeout((()=>e(null)),n)}));return Promise.race([e,r]).finally((()=>clearTimeout(t)))}(async function(){let e,n;try{const n=await fetch(H,{method:\"GET\"});if(!n.ok)return J(\"http\",`HTTP ${n.status}`);e=await n.text()}catch(e){return J(\"fetch\",Y(e))}if(!e)return J(\"empty\");if(e.length>q)return J(\"oversized\",`${e.length} chars`);try{const t=eval;n=await Promise.resolve(t(e))}catch(e){return J(function(e){return e instanceof SyntaxError?\"syntax\":e instanceof EvalError?\"eval_blocked\":\"threw\"}(e),Y(e))}return function(e){return!!z(e)&&!(\"number\"!=typeof e.schema||e.schema<1)&&\"string\"==typeof e.payload_id&&z(e.signals)}(n)?{...n,errors:Array.isArray(n.errors)?n.errors:[]}:J(\"malformed\")}(),2e3))&&void 0!==e?e:J(\"timeout\",\"exceeded 2000ms\")}catch(e){return J(\"threw\",Y(e))}}const X=\"_tmjs_c\";function Z(e){return(new TextEncoder).encode(e).length}function Q(){try{if(\"undefined\"==typeof sessionStorage)return;sessionStorage.setItem(X,\"1\")}catch(e){}}function ee(e,n,t){try{if(!1===n.collect_beacon)return;if(!e||Z(e)>64)return;if(function(){try{return\"undefined\"!=typeof sessionStorage&&!!sessionStorage.getItem(X)}catch(e){return!1}}())return;const r=n.collect_endpoint||\"https://collect.thumbmarkjs.com/beacon\",o=\"undefined\"!=typeof navigator?navigator.userAgent:\"\",i={thumbmark:e};o&&Z(o)<=512&&(i.ua=o),(null==t?void 0:t.ja4)&&Z(t.ja4)<=64&&(i.ja4=t.ja4),(null==t?void 0:t.source)&&Z(t.source)<=32&&(i.ja4_source=t.source);const a=JSON.stringify(i);if(\"undefined\"!=typeof navigator&&\"function\"==typeof navigator.sendBeacon){let e=!1;try{e=navigator.sendBeacon(r,a)}catch(n){e=!1}if(e)return void Q()}try{const e=fetch(r,{method:\"POST\",mode:\"no-cors\",keepalive:!0,headers:{\"Content-Type\":\"text/plain;charset=UTF-8\"},body:a});Q(),e.catch((()=>{}))}catch(e){}}catch(e){}}const ne=\"visitor_id\";function te(e){return e.storage_property_name?e.storage_property_name:e.property_name_factory(ne)}const re=`${n}_${ne}`;function oe(e,n){try{localStorage.setItem(te(n),e)}catch(e){}}const ie=\"cache\";function ae(e){try{const n=localStorage.getItem(e.property_name_factory(ie)),t=JSON.parse(n);return t||{}}catch(e){}return{}}function se(n){return n.cache_lifetime_in_ms>e?Date.now()+e:Date.now()+n.cache_lifetime_in_ms}class ce extends Error{constructor(e){super(`HTTP error! status: ${e}`),this.status=e}}let le=null,ue=null;async function de(e,n,t,r){const o=t.simple_request?{\"Content-Type\":\"text/plain\"}:{\"x-api-key\":t.api_key,Authorization:\"custom-authorized\",\"Content-Type\":\"application/json\"},i=await fetch(e,{method:\"POST\",headers:o,body:JSON.stringify(n)});if(!i.ok)throw new ce(i.status);const a=await i.json();return a.visitorId&&a.visitorId!==r&&oe(a.visitorId,t),ue=a,function(e,n){if(!e.cache_api_call||!e.cache_lifetime_in_ms)return;const{collect:t,...r}=n;!function(e,n){const t={...ae(e),...n};try{localStorage.setItem(e.property_name_factory(ie),JSON.stringify(t))}catch(e){}}(e,{apiResponseExpiry:se(e),apiResponse:r})}(t,a),a}const me=(e,n)=>{var r;if(e.cache_api_call){if(ue)return Promise.resolve(ue);const n=function(e){const n=ae(e);if(n&&n.apiResponse&&n.apiResponseExpiry&&Date.now()<=n.apiResponseExpiry)return n.apiResponse;return}(e);if(n)return Promise.resolve(n);if(le)return le}const o=e.api_endpoint||t;let i;try{const e=new URL(o);i=\"/\"!==e.pathname||o.endsWith(\"/\")?o:`${e.origin}/thumbmark`}catch(e){i=`${o}/thumbmark`}const a=function(e){try{const n=te(e);let t=localStorage.getItem(n);return t||n===re||(t=localStorage.getItem(re),t&&oe(t,e)),t}catch(e){return null}}(e),{api_key:s,...c}=e,l={components:n,options:c,clientHash:f(N(n)),version:\"1.12.0\",path:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.pathname};if(a&&(l.visitorId=a),e.metadata){const n=\"function\"==typeof e.metadata?e.metadata():e.metadata;if(n){(\"string\"==typeof n?n.length:JSON.stringify(n).length)>1e3?console.error(\"ThumbmarkJS: Metadata exceeds 1000 characters. Skipping metadata.\"):l.metadata=n}}const u=e.timeout||5e3,d=async function(e,n,t,r){for(let o=0;o<3;o++){o>0&&await new Promise((e=>setTimeout(e,200*o)));try{return await de(e,n,t,r)}catch(e){if(e instanceof ce||2===o)throw e}}throw new Error(\"Unreachable\")}(i,l,e,a).finally((()=>{le=null})),m=new Promise((n=>{setTimeout((()=>{const t=ae(e);n((null==t?void 0:t.apiResponse)||{info:{timed_out:!0},...a&&{visitorId:a}})}),u)}));return le=Promise.race([d,m]),le};async function pe(e,n={}){var o;if(\"undefined\"==typeof document||\"undefined\"==typeof window)return{thumbmark:\"\",components:{},info:{},version:\"1.12.0\",error:[{type:\"fatal\",message:\"Browser environment required\"}]};try{const i={...r,...e},a=[],s=i.logging&&!sessionStorage.getItem(\"_tmjs_l\")&&Math.random()<1e-4,c={...j,...U,...n},{elapsed:l,resolvedComponents:u,errors:d,pipelineTimings:m}=await fe(c,i);a.push(...d);const p=i.api_key||i.simple_request?me(i,u):null;let h=null;if(p)try{h=await p}catch(e){if(e instanceof ce&&403===e.status)return{error:[{type:\"api_unauthorized\",message:\"Invalid API key or quota exceeded\"}],components:{},info:{},version:\"1.12.0\",thumbmark:\"\"};a.push({type:e instanceof ce?\"api_error\":\"network_error\",message:e instanceof Error?e.message:String(e)})}(null===(o=null==h?void 0:h.info)||void 0===o?void 0:o.timed_out)&&a.push({type:\"api_timeout\",message:\"API request timed out\"});const g=performance.now(),v=G((null==h?void 0:h.components)||{},i),y=performance.now()-g,w={...u,...v},S=(null==h?void 0:h.info)||{uniqueness:{score:\"api only\"}};let b,_=0,P=0;if(null==h?void 0:h.thumbmark)b=h.thumbmark;else{const e=performance.now(),n=N(w);_=performance.now()-e;const t=performance.now();b=f(n),P=performance.now()-t}const A=\"1.12.0\";s&&async function(e,n,r,o=[]){var i;const a=`${t}/log`;sessionStorage.setItem(\"_tmjs_l\",\"1\");const s={thumbmark:e,components:n,experimental:await K(),version:\"1.12.0\",options:r,path:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.pathname,...o.length>0&&{errors:o}};try{await fetch(a,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(s)})}catch(e){}}(b,w,i,a).catch((()=>{})),(null==h?void 0:h.collect)&&\"object\"==typeof h.collect&&ee(b,i,h.collect);const x={\"_pipeline.dispatch\":m[\"_pipeline.dispatch\"],\"_pipeline.resolve\":m[\"_pipeline.resolve\"],\"_pipeline.filter\":m[\"_pipeline.filter\"]+y,\"_pipeline.stringify\":_,\"_pipeline.hash\":P,\"_pipeline.assembly\":0},M={...l,...m,...x},C=i.performance?{elapsed:M}:{},E=performance.now(),T={...(null==h?void 0:h.visitorId)&&{visitorId:h.visitorId},thumbmark:b,components:w,info:S,version:A,...C,...a.length>0&&{error:a},...(null==h?void 0:h.requestId)&&{requestId:h.requestId},...(null==h?void 0:h.metadata)&&{metadata:h.metadata}};return M[\"_pipeline.assembly\"]=performance.now()-E,T}catch(e){return{thumbmark:\"\",components:{},info:{},version:\"1.12.0\",error:[{type:\"fatal\",message:e instanceof Error?e.message:String(e)}]}}}async function fe(e,n){const t={...r,...n},o=W(t).filter((e=>!e.includes(\".\"))),i=Object.entries(e).filter((([e])=>{var n;return!(null===(n=null==t?void 0:t.exclude)||void 0===n?void 0:n.includes(e))})).filter((([e])=>!o.includes(e))).filter((([e])=>{var n,r,o,i;return(null===(n=null==t?void 0:t.include)||void 0===n?void 0:n.some((e=>e.includes(\".\"))))?null===(r=null==t?void 0:t.include)||void 0===r?void 0:r.some((n=>n.startsWith(e))):0===(null===(o=null==t?void 0:t.include)||void 0===o?void 0:o.length)||(null===(i=null==t?void 0:t.include)||void 0===i?void 0:i.includes(e))})),a=i.map((([e])=>e)),s={},c=performance.now(),l=i.map((([e,t])=>{const r=performance.now(),o=t(n);return s[`_dispatch.${e}`]=performance.now()-r,o})),u=performance.now()-c,d=performance.now(),m=await function(e,n,t){return Promise.all(e.map((e=>{const r=performance.now();let o;const i=e.then((e=>(void 0!==o&&clearTimeout(o),{value:e,elapsed:performance.now()-r}))).catch((e=>(void 0!==o&&clearTimeout(o),{value:t,elapsed:performance.now()-r,error:e instanceof Error?e.message:String(e)}))),a=new Promise((e=>{o=setTimeout((()=>{e({value:t,elapsed:performance.now()-r,error:\"timeout\"})}),n)}));return Promise.race([i,a])})))}(l,(null==t?void 0:t.timeout)||5e3,$),p=performance.now()-d,f={},h={},g=[];m.forEach(((e,n)=>{var t;const r=a[n];f[r]=null!==(t=e.elapsed)&&void 0!==t?t:0,\"timeout\"===e.error?g.push({type:\"component_timeout\",message:`Component '${r}' timed out`,component:r}):e.error&&g.push({type:\"component_error\",message:e.error,component:r}),null!=e.value&&(h[r]=e.value)}));const v=performance.now(),y=G(h,t),w={\"_pipeline.dispatch\":u,\"_pipeline.resolve\":p,\"_pipeline.filter\":performance.now()-v,...s};return{elapsed:f,resolvedComponents:y,errors:g,pipelineTimings:w}}async function he(){return(await pe(o)).components}async function ge(e){try{const n=await pe(o);return e?{hash:n.thumbmark.toString(),data:n.components}:n.thumbmark.toString()}catch(e){throw e}}async function ve(){try{const{elapsed:e,resolvedComponents:n}=await fe(j,o);return{...n,elapsed:e}}catch(e){throw e}}class ye{constructor(e){this.options={...r,...e},this.customComponents={}}async get(e){return pe({...this.options,...e},this.customComponents)}getVersion(){return\"1.12.0\"}includeComponent(e,n){this.customComponents[e]=n}}export{ye as Thumbmark,G as filterThumbmarkData,ge as getFingerprint,he as getFingerprintData,ve as getFingerprintPerformance,pe as getThumbmark,V as getVersion,F as includeComponent,i as setOption,a as stabilizationExclusionRules,N as stableStringify};\n//# sourceMappingURL=thumbmark.esm.js.map\n","import {\n  createClient,\n  subscriptionExchange,\n  cacheExchange,\n  fetchExchange\n} from '@urql/core'\nimport { createClient as createWSClient } from 'graphql-ws'\nimport { pipe, map, subscribe } from 'wonka'\nimport CodeException from '../../exception/CodeException.js'\n\n// PQ-transport Phase E (cycle 163): the post-quantum CipherHash wrapper query. The validator\n// intercepts the `CipherHash` op, decrypts `$Hash`, executes the inner request, and returns the\n// encrypted response in `{ data: { CipherHash: { hash } } }`.\nconst CIPHER_HASH_QUERY = 'query ( $Hash: String! ) { CipherHash ( Hash: $Hash ) { hash } }'\n\n/**\n * Light parse of a GraphQL request body's operation type + root field name, for the CipherHash\n * bypass decision (no full GraphQL parse needed). Operation type = the first query/mutation/\n * subscription keyword (default 'query' for an anonymous `{ ... }`); root field = the first\n * identifier inside the top-level selection set.\n */\nfunction parseOperation (query) {\n  const typeMatch = (query || '').match(/\\b(query|mutation|subscription)\\b/i)\n  const type = typeMatch ? typeMatch[1].toLowerCase() : 'query'\n  const braceIdx = (query || '').indexOf('{')\n  const nameMatch = braceIdx >= 0 ? query.slice(braceIdx + 1).match(/[A-Za-z_][A-Za-z0-9_]*/) : null\n  return { type, name: nameMatch ? nameMatch[0] : '' }\n}\n\nclass UrqlClientWrapper {\n  constructor ({ serverUri, socket = null, encrypt = false }) {\n    this.$__client = this.createUrqlClient({ serverUri, socket, encrypt })\n    this.$__authToken = ''\n    this.$__pubkey = null\n    this.$__wallet = null\n    this.serverUri = serverUri\n    this.soketi = socket\n    this.cipherLink = !!encrypt\n    this.$__subscriptionManager = new Map()\n  }\n\n  createUrqlClient ({ serverUri, socket, encrypt }) {\n    const exchanges = [cacheExchange, fetchExchange]\n\n    // Add subscription support if socket is configured\n    if (socket && socket.socketUri) {\n      const wsClient = createWSClient({\n        url: socket.socketUri,\n        connectionParams: () => ({\n          authToken: this.$__authToken\n        })\n      })\n\n      exchanges.push(subscriptionExchange({\n        forwardSubscription: operation => ({\n          subscribe: sink => {\n            const disposable = wsClient.subscribe(operation, sink)\n            return { unsubscribe: disposable }\n          }\n        })\n      }))\n    }\n\n    return createClient({\n      url: serverUri,\n      exchanges,\n      // urql 5 had no default and always POSTed; urql 6 defaults to 'within-url-limit', which\n      // URL-encodes short queries and sends NO body. That would silently disable the CipherHash\n      // envelope below — cipherFetch's `typeof init.body === 'string'` guard fails on a GET, so\n      // the query would leave as plaintext URL parameters with no error. Pin POST explicitly.\n      preferGetMethod: false,\n      // PQ-transport Phase E: when encryption is on, route fetch through the CipherHash\n      // wrapper (encrypt the request body to the validator's ML-KEM pubkey, decrypt the\n      // response). Undefined → urql uses the global fetch (plaintext).\n      ...(encrypt ? { fetch: (input, init) => this.cipherFetch(input, init) } : {}),\n      fetchOptions: () => ({\n        headers: {\n          'X-Auth-Token': this.$__authToken\n        },\n        // Add 60 second timeout for debugging\n        signal: AbortSignal.timeout(60000)\n      })\n    })\n  }\n\n  /**\n   * Whether an outgoing GraphQL request body should be wrapped in CipherHash. Bypass (plaintext):\n   * introspection `__schema`, `ContinuId`, the `AccessToken` mutation, and the U-isotope\n   * `ProposeMolecule` (auth bootstrap — the key exchange itself can't be encrypted). Mirrors the\n   * Kotlin/validator bypass set.\n   */\n  shouldEncrypt (body) {\n    let parsed\n    try {\n      parsed = JSON.parse(body)\n    } catch (e) {\n      return false\n    }\n    const { type, name } = parseOperation(parsed.query)\n    if (type === 'query' && (name === '__schema' || name === 'ContinuId')) return false\n    if (type === 'mutation' && name === 'AccessToken') return false\n    if (type === 'mutation' && name === 'ProposeMolecule') {\n      const isotope = parsed.variables && parsed.variables.molecule &&\n        parsed.variables.molecule.atoms && parsed.variables.molecule.atoms[0] &&\n        parsed.variables.molecule.atoms[0].isotope\n      if (isotope === 'U') return false\n    }\n    return true\n  }\n\n  /**\n   * Custom `fetch` that wraps a GraphQL request in the ML-KEM CipherHash envelope and decrypts the\n   * response (PQ-transport Phase E). Operates on the raw POST body (mirrors Kotlin's\n   * encryptBody/decryptBody). Reads the CURRENT client wallet + validator pubkey from auth.\n   */\n  async cipherFetch (input, init) {\n    const wallet = this.getWallet()\n    const serverPubkey = this.getPubKey()\n    let encryptedRequest = false\n    let requestInit = init\n\n    // Decide the bypass FIRST, then demand the keys: a bypassed operation (`__schema`,\n    // `ContinuId`, `AccessToken`, U-isotope `ProposeMolecule`) must still go out in plaintext or\n    // the auth bootstrap would deadlock encrypting to a server pubkey it has not learned yet.\n    // Anything else on an encryption-enabled client fails closed rather than silently\n    // downgrading to plaintext (matches PHP Cipher.php / Kotlin HttpClient).\n    if (init && typeof init.body === 'string' && this.shouldEncrypt(init.body)) {\n      if (!wallet) {\n        throw new CodeException('Authorized wallet missing.')\n      }\n      if (!serverPubkey) {\n        throw new CodeException('Server public key missing.')\n      }\n      const hashVar = await wallet.encryptStringML(init.body, serverPubkey)\n      requestInit = { ...init, body: JSON.stringify({ query: CIPHER_HASH_QUERY, variables: { Hash: hashVar } }) }\n      encryptedRequest = true\n    }\n\n    const response = await fetch(input, requestInit)\n    if (!encryptedRequest) {\n      return response\n    }\n\n    // Decrypt the CipherHash response back to the inner GraphQL response JSON.\n    const text = await response.text()\n    const init2 = { status: response.status, statusText: response.statusText, headers: response.headers }\n    let parsed\n    try {\n      parsed = JSON.parse(text)\n    } catch (e) {\n      return new Response(text, init2)\n    }\n    const hash = parsed && parsed.data && parsed.data.CipherHash && parsed.data.CipherHash.hash\n    if (typeof hash !== 'string') {\n      // Plaintext (e.g. a validator-side error response) — pass through unchanged.\n      return new Response(text, init2)\n    }\n    const decrypted = await wallet.decryptMyMessageML(JSON.parse(hash))\n    return new Response(decrypted != null ? decrypted : text, init2)\n  }\n\n  setAuthData ({ token, pubkey, wallet }) {\n    this.$__authToken = token\n    this.$__pubkey = pubkey\n    this.$__wallet = wallet\n\n    // Recreate client with new auth data\n    this.$__client = this.createUrqlClient({\n      serverUri: this.serverUri,\n      socket: this.soketi,\n      encrypt: !!this.cipherLink\n    })\n  }\n\n  /**\n   * Builds the urql operation options forwarded with a query/mutation.\n   *\n   * Forwards the requestPolicy (so a long-lived client does not serve stale\n   * cache-first reads) and, when the caller supplied a per-query abort signal,\n   * the signal too — while re-supplying the X-Auth-Token header. urql REPLACES\n   * (not merges) the client-level fetchOptions with any operation-context\n   * fetchOptions (createRequestOperation builds the op context as\n   * {...baseOpts, ...opts}), so forwarding fetchOptions WITHOUT the header would\n   * drop X-Auth-Token and break auth. The header here is byte-identical to the\n   * client-level one set in createUrqlClient.\n   *\n   * @param {object} context\n   * @returns {object|undefined}\n   */\n  buildRequestOptions (context) {\n    if (!context) {\n      return undefined\n    }\n    const opts = {}\n    if (context.requestPolicy) {\n      opts.requestPolicy = context.requestPolicy\n    }\n    const callerSignal = context.fetchOptions && context.fetchOptions.signal\n    if (callerSignal) {\n      // Combine the per-query abort signal with the 60s timeout so either can\n      // cancel the request; fall back to the caller signal where AbortSignal.any\n      // is unavailable.\n      const signal = (typeof AbortSignal !== 'undefined' && typeof AbortSignal.any === 'function')\n        ? AbortSignal.any([callerSignal, AbortSignal.timeout(60000)])\n        : callerSignal\n      opts.fetchOptions = {\n        headers: { 'X-Auth-Token': this.$__authToken },\n        signal\n      }\n    }\n    return Object.keys(opts).length ? opts : undefined\n  }\n\n  async query (request) {\n    const { query, variables, context } = request\n    const opts = this.buildRequestOptions(context)\n    const result = await this.$__client.query(query, variables || {}, opts).toPromise()\n    return this.formatResponse(result)\n  }\n\n  async mutate (request) {\n    const { mutation, variables, context } = request\n    const opts = this.buildRequestOptions(context)\n    const result = await this.$__client.mutation(mutation, variables || {}, opts).toPromise()\n    return this.formatResponse(result)\n  }\n\n  subscribe (request, closure) {\n    const { query, variables, operationName } = request\n\n    // F-22 fix: wonka v3 — `subscribe` is a function applied via pipe, not a\n    // method on the result. The pipe-with-subscribe expression returns the\n    // subscription object directly (already shaped as `{ unsubscribe }`).\n    const subscription = pipe(\n      this.$__client.subscription(query, variables),\n      map(result => {\n        closure(this.formatResponse(result))\n      }),\n      subscribe(() => {})\n    )\n\n    // Store subscription for later cleanup\n    this.$__subscriptionManager.set(operationName, subscription)\n\n    return {\n      unsubscribe: () => this.unsubscribe(operationName)\n    }\n  }\n\n  formatResponse (result) {\n    // Match old Apollo response format\n    return {\n      data: result.data,\n      errors: result.error ? [result.error] : undefined\n    }\n  }\n\n  socketDisconnect () {\n    if (this.soketi) {\n      // Unsubscribe from all active subscriptions\n      this.unsubscribeAll()\n    }\n  }\n\n  unsubscribe (operationName) {\n    const subscription = this.$__subscriptionManager.get(operationName)\n    if (subscription) {\n      subscription.unsubscribe()\n      this.$__subscriptionManager.delete(operationName)\n    }\n  }\n\n  unsubscribeAll () {\n    this.$__subscriptionManager.forEach((subscription, operationName) => {\n      this.unsubscribe(operationName)\n    })\n  }\n\n  unsubscribeFromChannel (operationName) {\n    this.unsubscribe(operationName)\n  }\n\n  setEncryption (encrypt = false) {\n    this.cipherLink = encrypt\n    this.$__client = this.createUrqlClient({\n      serverUri: this.serverUri,\n      socket: this.soketi,\n      encrypt\n    })\n  }\n\n  getAuthToken () { return this.$__authToken }\n  getPubKey () { return this.$__pubkey }\n  getWallet () { return this.$__wallet }\n  getServerUri () { return this.serverUri }\n  getSocketUri () { return this.soketi ? this.soketi.socketUri : null }\n  getUri () { return this.serverUri }\n\n  setUri (uri) {\n    this.serverUri = uri\n    this.$__client = this.createUrqlClient({\n      serverUri: uri,\n      socket: this.soketi,\n      encrypt: !!this.cipherLink\n    })\n  }\n\n  setSocketUri ({ socketUri, appKey }) {\n    this.soketi = { socketUri, appKey }\n    this.$__client = this.createUrqlClient({\n      serverUri: this.serverUri,\n      socket: this.soketi,\n      encrypt: !!this.cipherLink\n    })\n  }\n}\n\nexport default UrqlClientWrapper\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n */\nimport Dot from './libraries/Dot.js'\nimport MemorySecretStorageProvider from './storage/MemorySecretStorageProvider.js'\nimport Decimal from './libraries/Decimal.js'\nimport {\n  generateBatchId,\n  generateBundleHash,\n  generateSecret\n} from './libraries/crypto.js'\nimport Molecule from './Molecule.js'\nimport Wallet from './Wallet.js'\nimport NegativeAmountException from './exception/NegativeAmountException.js'\nimport AuthToken from './AuthToken.js'\nimport QueryContinuId from './query/QueryContinuId.js'\nimport QueryWalletBundle from './query/QueryWalletBundle.js'\nimport QueryWalletList from './query/QueryWalletList.js'\nimport QueryBalance from './query/QueryBalance.js'\nimport QueryMetaType from './query/QueryMetaType.js'\nimport QueryBatch from './query/QueryBatch.js'\nimport QueryBatchHistory from './query/QueryBatchHistory.js'\nimport MutationRequestAuthorization from './mutation/MutationRequestAuthorization.js'\nimport MutationCreateToken from './mutation/MutationCreateToken.js'\nimport MutationRequestTokens from './mutation/MutationRequestTokens.js'\nimport MutationTransferTokens from './mutation/MutationTransferTokens.js'\nimport MutationProposeMolecule from './mutation/MutationProposeMolecule.js'\nimport MutationCreateIdentifier from './mutation/MutationCreateIdentifier.js'\nimport MutationClaimShadowWallet from './mutation/MutationClaimShadowWallet.js'\nimport MutationCreateMeta from './mutation/MutationCreateMeta.js'\nimport MutationPeering from './mutation/MutationPeering.js'\nimport MutationAppendRequest from './mutation/MutationAppendRequest.js'\nimport MutationLinkIdentifier from './mutation/MutationLinkIdentifier.js'\nimport MutationCreateWallet from './mutation/MutationCreateWallet.js'\nimport MutationRequestAuthorizationGuest from './mutation/MutationRequestAuthorizationGuest.js'\nimport TransferBalanceException from './exception/TransferBalanceException.js'\nimport CodeException from './exception/CodeException.js'\nimport UnauthenticatedException from './exception/UnauthenticatedException.js'\nimport WalletShadowException from './exception/WalletShadowException.js'\nimport StackableUnitDecimalsException from './exception/StackableUnitDecimalsException.js'\nimport StackableUnitAmountException from './exception/StackableUnitAmountException.js'\nimport TokenUnit from './TokenUnit.js'\nimport CreateMoleculeSubscribe from './subscribe/CreateMoleculeSubscribe.js'\nimport WalletStatusSubscribe from './subscribe/WalletStatusSubscribe.js'\nimport ActiveWalletSubscribe from './subscribe/ActiveWalletSubscribe.js'\nimport ActiveSessionSubscribe from './subscribe/ActiveSessionSubscribe.js'\nimport MutationActiveSession from './mutation/MutationActiveSession.js'\nimport QueryActiveSession from './query/QueryActiveSession.js'\nimport QueryToken from './query/QueryToken.js'\nimport BatchIdException from './exception/BatchIdException.js'\nimport AuthorizationRejectedException from './exception/AuthorizationRejectedException.js'\nimport QueryAtom from './query/QueryAtom.js'\nimport QueryPolicy from './query/QueryPolicy.js'\nimport QueryMetaTypeViaAtom from './query/QueryMetaTypeViaAtom.js'\nimport QueryMetaTypeViaMolecule from './query/QueryMetaTypeViaMolecule.js'\nimport QueryEmbeddingStatus from './query/QueryEmbeddingStatus.js'\nimport MutationCreateRule from './mutation/MutationCreateRule.js'\nimport MutationDepositBufferToken from './mutation/MutationDepositBufferToken.js'\nimport MutationWithdrawBufferToken from './mutation/MutationWithdrawBufferToken.js'\nimport {\n  getFingerprint,\n  getFingerprintData\n} from '@thumbmarkjs/thumbmarkjs'\nimport UrqlClientWrapper from './libraries/urql/UrqlClientWrapper.js'\n\n/**\n * Base client class providing a powerful but user-friendly wrapper\n * around complex Knish.IO ledger transactions.\n */\nexport default class KnishIOClient {\n  /**\n   * Class constructor\n   *\n   * @param {string} uri\n   * @param {string|null} cellSlug\n   * @param {object|null} socket\n   * @param {UrqlClientWrapper|null} client\n   * @param {number} serverSdkVersion\n   * @param {boolean} logging\n   */\n  constructor ({\n    uri,\n    cellSlug = null,\n    client = null,\n    socket = null,\n    serverSdkVersion = 3,\n    logging = false,\n    defaultRequestPolicy = null,\n    secretStorage = null,\n    mlKemParameterSet = 1024\n  }) {\n    this.initialize({\n      uri,\n      cellSlug,\n      socket,\n      client,\n      serverSdkVersion,\n      logging,\n      defaultRequestPolicy,\n      secretStorage,\n      mlKemParameterSet\n    })\n  }\n\n  /**\n   * Initializes a new Knish.IO client session\n   *\n   * @param {string|[]} uri\n   * @param {string|null} cellSlug\n   * @param {object|null} socket\n   * @param {UrqlClientWrapper|null} client\n   * @param {number} serverSdkVersion\n   * @param {boolean} logging\n   */\n  initialize ({\n    uri,\n    cellSlug = null,\n    socket = null,\n    client = null,\n    serverSdkVersion = 3,\n    logging = false,\n    defaultRequestPolicy = null,\n    secretStorage = null,\n    mlKemParameterSet = 1024\n  }) {\n    this.reset()\n\n    this.$__secretStorage = secretStorage\n    this.$__logging = logging\n    // Client-level urql request policy applied to reads that omit a per-call\n    // policy. A long-lived server/sync client set to 'network-only' never serves\n    // a stale cache-first read; browser/SPA consumers leave this null (cache-first).\n    this.$__defaultRequestPolicy = defaultRequestPolicy\n    this.setMlKemParameterSet(mlKemParameterSet)\n    this.$__authTokenObjects = {}\n    this.$__authInProcess = false\n    this.abortControllers = new Map()\n\n    this.setUri(uri)\n\n    if (cellSlug) {\n      this.setCellSlug(cellSlug)\n    }\n\n    for (const uriKey in this.$__uris) {\n      const url = this.$__uris[uriKey]\n      this.$__authTokenObjects[url] = null\n    }\n\n    this.log('info', `KnishIOClient::initialize() - Initializing new Knish.IO client session for SDK version ${ serverSdkVersion }...`)\n\n    this.$__client = client || new UrqlClientWrapper({\n      socket: {\n        ...{\n          socketUri: null,\n          appKey: 'knishio'\n        },\n        ...socket || {}\n      },\n      serverUri: this.getRandomUri()\n    })\n\n    this.$__serverSdkVersion = serverSdkVersion\n  }\n\n  /**\n   * Get active ML-KEM parameter set (1024 default or 768 step-back)\n   *\n   * @return {number}\n   */\n  getMlKemParameterSet () {\n    return this.$__mlKemParameterSet || 1024\n  }\n\n  /**\n   * Set active ML-KEM parameter set (1024 default or 768 step-back)\n   *\n   * @param {number|string} parameterSet\n   * @return {KnishIOClient}\n   */\n  setMlKemParameterSet (parameterSet) {\n    const paramNum = Number(parameterSet)\n    if (![1024, 768].includes(paramNum)) {\n      throw new Error(`KnishIO: unsupported ML-KEM parameter set ${parameterSet}; expected 1024 or 768.`)\n    }\n    this.$__mlKemParameterSet = paramNum\n    return this\n  }\n\n  /**\n   * Get random uri from specified this.$__uris\n   *\n   * @return {string}\n   */\n  getRandomUri () {\n    const rand = Math.floor(Math.random() * (this.$__uris.length))\n    return this.$__uris[rand]\n  }\n\n  /**\n   *\n   * @param encrypt\n   * @return {boolean}\n   */\n  switchEncryption (encrypt) {\n    if (this.$__encrypt === encrypt) {\n      return false\n    }\n    this.log('info', `KnishIOClient::switchEncryption() - Forcing encryption ${ encrypt ? 'on' : 'off' } to match node...`)\n\n    // Set encryption\n    this.$__encrypt = encrypt\n    this.$__client.setEncryption(encrypt)\n    return true\n  }\n\n  /**\n   * De-initializes the Knish.IO client session so that a new session can replace it\n   */\n  deinitialize () {\n    this.log('info', 'KnishIOClient::deinitialize() - Clearing the Knish.IO client session...')\n    this.reset()\n  }\n\n  /**\n   * Subscribes the client to the node's broadcast socket\n   *\n   * @return {UrqlClientWrapper}\n   */\n  subscribe () {\n    if (!this.client().getSocketUri()) {\n      throw new CodeException('KnishIOClient::subscribe() - Socket client not initialized!')\n    }\n    return this.client()\n  }\n\n  /**\n   * Gets the client's SDK version\n   *\n   * @return {number}\n   */\n  getServerSdkVersion () {\n    return this.$__serverSdkVersion\n  }\n\n  /**\n   * Returns the client-level default urql request policy (or null)\n   *\n   * @return {string|null}\n   */\n  getDefaultRequestPolicy () {\n    return this.$__defaultRequestPolicy || null\n  }\n\n  /**\n   * Sets the client-level default urql request policy applied to reads that\n   * omit a per-call policy (e.g. 'network-only' for a long-lived server client)\n   *\n   * @param {string|null} policy - 'cache-first'|'cache-only'|'network-only'|'cache-and-network'|null\n   */\n  setDefaultRequestPolicy (policy) {\n    this.$__defaultRequestPolicy = policy\n  }\n\n  /**\n   * Reset common properties\n   */\n  reset () {\n    this.$__secret = ''\n    this.$__bundle = ''\n    this.$__secretStorage = null\n    this.remainderWallet = null\n    this.$__capabilityCache = {}\n    this.$__defaultRequestPolicy = null\n  }\n\n  /**\n   * Returns the currently defined Cell identifier for this session\n   *\n   * @return {string|null}\n   */\n  getCellSlug () {\n    return this.$__cellSlug || null\n  }\n\n  /**\n   * Sets the Cell identifier for this session\n   *\n   * @param {string} cellSlug\n   */\n  setCellSlug (cellSlug) {\n    this.$__cellSlug = cellSlug\n  }\n\n  /**\n   * Sets the endpoint URI for this session\n   *\n   * @param {string|object} uri\n   */\n  setUri (uri) {\n    this.$__uris = typeof uri === 'object' ? uri : [uri]\n\n    // If client exists, update its URI with a random one from the new array\n    if (this.$__client) {\n      const randomUri = this.getRandomUri()\n      this.$__client.setUri(randomUri)\n    }\n  }\n\n  /**\n   * Sets the WebSocket (subscription) endpoint for this session.\n   *\n   * `setUri()` only updates the HTTP endpoint; the subscription socket is built once\n   * at construction from the `socket.socketUri` passed in. This lets a caller re-point\n   * the socket when the endpoint changes (F-8a, E2E gauntlet 2026-06-02).\n   *\n   * @param {string} socketUri\n   */\n  setSocketUri (socketUri) {\n    if (this.$__client && typeof this.$__client.setSocketUri === 'function') {\n      this.$__client.setSocketUri({ socketUri, appKey: 'knishio' })\n    }\n  }\n\n  /**\n   * Retrieves the endpoint URI for this session\n   *\n   * @return {string}\n   */\n  getUri () {\n    return this.$__client.getUri()\n  }\n\n  /**\n   * Returns the GraphQL client class session\n   *\n   * @return {UrqlClientWrapper}\n   */\n  client () {\n    if (!this.$__authInProcess) {\n      const randomUri = this.getRandomUri()\n      this.$__client.setUri(randomUri)\n\n      // Try to get stored auth token object\n      const authTokenObject = this.$__authTokenObjects[randomUri]\n\n      // Not authorized - try to do it\n      if (!authTokenObject) {\n        this.requestAuthToken({\n          secret: this.$__secret,\n          cellSlug: this.$__cellSlug,\n          encrypt: this.$__encrypt\n        }).catch(err => {\n          this.log('warn', `KnishIOClient::client() - Background authorization failed: ${ err.message }`)\n        })\n      } else {\n        // Use stored authorization data\n        this.$__client.setAuthData(authTokenObject.getAuthData())\n      }\n    }\n    return this.$__client\n  }\n\n  /**\n   * Returns whether a secret is being stored for this session\n   *\n   * @return {boolean}\n   */\n  hasSecret () {\n    return (!!this.$__secret && this.$__secret.length > 0) || (!!this.$__secretStorage && !!this.$__bundle && this.$__bundle.length > 0)\n  }\n\n  /**\n   * Set the client's secret\n   *\n   * @param secret\n   */\n  setSecret (secret) {\n    this.$__secret = secret\n    this.$__bundle = this.hashSecret(secret, 'setSecret')\n    if (!this.$__secretStorage) {\n      const memStorage = new MemorySecretStorageProvider()\n      memStorage.storeSecret(this.$__bundle, secret)\n      this.$__secretStorage = memStorage\n    } else {\n      this.$__secretStorage.storeSecret(this.$__bundle, secret)\n    }\n  }\n\n  /**\n   * Hashes the user secret to produce a bundle hash\n   * @param {string} secret\n   * @param {string|null} source\n   * @returns {string}\n   */\n  hashSecret (secret, source = null) {\n    this.log('info', `KnishIOClient::hashSecret(${ source ? `source: ${ source }` : '' }) - Computing wallet bundle from secret...`)\n    return generateBundleHash(secret)\n  }\n\n  /**\n   * Retrieves the stored secret for this session\n   *\n   * @return {string}\n   */\n  getSecret () {\n    if (!this.hasSecret()) {\n      throw new UnauthenticatedException('KnishIOClient::getSecret() - Unable to find a stored secret! Have you set a secret?')\n    }\n    return this.$__secret\n  }\n\n  /**\n   * Sets the secret storage provider and optionally sets the bundle hash\n   *\n   * @param {object} storage\n   * @param {string|null} [bundleHash]\n   */\n  setSecretStorage (storage, bundleHash = null) {\n    this.$__secretStorage = storage\n    if (bundleHash) {\n      this.$__bundle = bundleHash\n    }\n  }\n\n  /**\n   * Returns current secret storage provider\n   *\n   * @returns {object|null}\n   */\n  getSecretStorage () {\n    return this.$__secretStorage\n  }\n\n  /**\n   * Asynchronously retrieves the secret from storage or returns in-memory secret\n   *\n   * @param {object} [options]\n   * @returns {Promise<string|null>}\n   */\n  async retrieveSecret (options = {}) {\n    if (this.$__secret && this.$__secret.length > 0) {\n      return this.$__secret\n    }\n    if (this.$__secretStorage && this.$__bundle && this.$__bundle.length > 0) {\n      return await this.$__secretStorage.retrieveSecret(this.$__bundle, options)\n    }\n    return null\n  }\n\n  /**\n   * Returns whether a bundle hash is being stored for this session\n   *\n   * @return {boolean}\n   */\n  hasBundle () {\n    return !!this.$__bundle\n  }\n\n  /**\n   * Returns the bundle hash for this session\n   *\n   * @return {string}\n   */\n  getBundle () {\n    if (!this.hasBundle()) {\n      throw new UnauthenticatedException('KnishIOClient::getBundle() - Unable to find a stored bundle! Have you set a secret?')\n    }\n    return this.$__bundle\n  }\n\n  /**\n   * Retrieves the device fingerprint.\n   *\n   * @returns {Promise<string>} A promise that resolves to the device fingerprint as a string.\n   */\n  getFingerprint () {\n    return getFingerprint()\n  }\n\n  getFingerprintData () {\n    return getFingerprintData()\n  }\n\n  /**\n   * Retrieves this session's wallet used for signing the next Molecule\n   *\n   * @return {Promise<*|Wallet|null>}\n   */\n  async getSourceWallet () {\n    let sourceWallet = (await this.queryContinuId({\n      bundle: this.getBundle()\n    })).payload()\n\n    if (!sourceWallet) {\n      sourceWallet = new Wallet({\n        secret: this.getSecret(),\n        mlKemParameterSet: this.getMlKemParameterSet()\n      })\n    } else {\n      sourceWallet.key = Wallet.generateKey({\n        secret: this.getSecret(),\n        token: sourceWallet.token,\n        position: sourceWallet.position\n      })\n    }\n\n    return sourceWallet\n  }\n\n  /**\n   * Retrieves this session's remainder wallet\n   *\n   * @return {null}\n   */\n  getRemainderWallet () {\n    return this.remainderWallet\n  }\n\n  /**\n   * Instantiates a new Molecule and prepares this client session to operate on it\n   *\n   * @param secret\n   * @param bundle\n   * @param sourceWallet\n   * @param remainderWallet\n   * @return {Promise<Molecule>}\n   */\n  async createMolecule ({\n    secret = null,\n    bundle = null,\n    sourceWallet = null,\n    remainderWallet = null\n  }) {\n    this.log('info', 'KnishIOClient::createMolecule() - Creating a new molecule...')\n    if (!secret) {\n      if (this.$__secret && this.$__secret.length > 0) {\n        secret = this.getSecret()\n      } else if (this.$__secretStorage && this.$__bundle && this.$__bundle.length > 0) {\n        secret = await this.$__secretStorage.retrieveSecret(this.$__bundle)\n      }\n    }\n\n    secret = secret || this.getSecret()\n    bundle = bundle || this.getBundle()\n    // For non-USER source wallets (V/B isotopes), capture the current USER\n    // ContinuID position BEFORE overwriting the client's remainder wallet.\n    // This position is needed by addContinuIdAtom() for previousPosition metadata.\n    let continuIdPosition = null\n    if (sourceWallet && sourceWallet.token !== 'USER') {\n      if (this.lastMoleculeQuery &&\n        this.getRemainderWallet() &&\n        this.getRemainderWallet().token === 'USER' &&\n        this.lastMoleculeQuery.response() &&\n        this.lastMoleculeQuery.response().success()\n      ) {\n        // Carry-forward: use last successful USER remainder wallet position\n        continuIdPosition = this.getRemainderWallet().position\n      } else {\n        // Query server for current ContinuID position\n        const userWallet = await this.getSourceWallet()\n        continuIdPosition = userWallet ? userWallet.position : null\n      }\n    }\n\n    // Sets the source wallet as the last remainder wallet (to maintain ContinuID)\n    if (!sourceWallet &&\n      this.lastMoleculeQuery &&\n      this.getRemainderWallet().token === 'USER' &&\n      this.lastMoleculeQuery.response() &&\n      this.lastMoleculeQuery.response().success()\n    ) {\n      sourceWallet = this.getRemainderWallet()\n    }\n\n    // Unable to use last remainder wallet; Figure out what wallet to use:\n    if (sourceWallet === null) {\n      sourceWallet = await this.getSourceWallet()\n    }\n\n    // Set the remainder wallet for the next transaction\n    this.remainderWallet = remainderWallet || Wallet.create({\n      secret,\n      bundle,\n      token: 'USER',\n      batchId: sourceWallet.batchId,\n      characters: sourceWallet.characters,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    return new Molecule({\n      secret,\n      bundle,\n      sourceWallet,\n      remainderWallet: this.getRemainderWallet(),\n      cellSlug: this.getCellSlug(),\n      version: this.getServerSdkVersion(),\n      continuIdPosition,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n  }\n\n  /**\n   * Builds a new instance of the provided Query class\n   *\n   * @param QueryClass\n   * @return {*}\n   */\n  createQuery (QueryClass) {\n    return new QueryClass(this.client(), this)\n  }\n\n  /**\n   * Builds a new instance of the provided Subscription class\n   *\n   * @param SubscribeClass\n   * @return {*}\n   */\n  createSubscribe (SubscribeClass) {\n    return new SubscribeClass(this.subscribe())\n  }\n\n  /**\n   * Uses the supplied Mutation class to build a new tailored Molecule\n   *\n   * @param mutationClass\n   * @param molecule\n   */\n  async createMoleculeMutation ({\n    mutationClass: MutationClass,\n    molecule = null\n  }) {\n    this.log('info', `KnishIOClient::createMoleculeQuery() - Creating a new ${ MutationClass.name } query...`)\n\n    // If you don't supply the molecule, we'll generate one for you\n    const _molecule = molecule || await this.createMolecule({})\n\n    const mutation = new MutationClass(this.client(), this, _molecule)\n\n    if (!(mutation instanceof MutationProposeMolecule)) {\n      throw new CodeException(`${ this.constructor.name }::createMoleculeMutation() - This method only accepts MutationProposeMolecule!`)\n    }\n\n    this.lastMoleculeQuery = mutation\n\n    return mutation\n  }\n\n  /**\n   *\n   * @param query\n   * @param variables\n   * @returns {Promise<*>}\n   */\n  async executeQuery (query, variables = null, context = {}) {\n    // Check and refresh authorization token if needed\n    // Guard with $__authInProcess to prevent concurrent auth requests\n    if (this.$__authToken && this.$__authToken.isExpired() && !this.$__authInProcess) {\n      this.log('info', 'KnishIOClient::executeQuery() - Access token is expired. Getting new one...')\n      const authSecret = this.$__secret || (await this.retrieveSecret()) || ''\n      await this.requestAuthToken({\n        secret: authSecret,\n        cellSlug: this.$__cellSlug,\n        encrypt: this.$__encrypt\n      })\n    }\n\n    // Create a new AbortController for this query\n    const abortController = new AbortController()\n    const queryKey = JSON.stringify({\n      query: query.$__query,\n      variables\n    })\n    this.abortControllers.set(queryKey, abortController)\n\n    try {\n      // Apply the client-level default request policy when neither the caller\n      // nor the query's own createQueryContext specifies one, so a long-lived\n      // server/sync client (defaultRequestPolicy:'network-only') never serves a\n      // stale cache-first read. Precedence: a query's own createQueryContext\n      // (e.g. ContinuId's network-only, applied in Query.execute's merge) >\n      // per-call context.requestPolicy > this client default > urql default.\n      const requestContext = { ...context }\n      if (this.$__defaultRequestPolicy && !requestContext.requestPolicy) {\n        requestContext.requestPolicy = this.$__defaultRequestPolicy\n      }\n\n      // Use the existing query execution method, but add the abort signal\n      const result = await query.execute({\n        variables,\n        context: {\n          fetchOptions: {\n            signal: abortController.signal\n          },\n          ...requestContext\n        }\n      })\n\n      // Remove the AbortController after the query is complete\n      this.abortControllers.delete(queryKey)\n\n      return result\n    } catch (error) {\n      if (error.name === 'AbortError') {\n        this.log('warn', 'Query was cancelled')\n      } else {\n        throw error\n      }\n    }\n  }\n\n  cancelQuery (query, variables = null) {\n    const queryKey = JSON.stringify({\n      query: query.$__query,\n      variables\n    })\n    const controller = this.abortControllers.get(queryKey)\n    if (controller) {\n      controller.abort()\n      this.abortControllers.delete(queryKey)\n    }\n  }\n\n  cancelAllQueries () {\n    for (const controller of this.abortControllers.values()) {\n      controller.abort()\n    }\n    this.abortControllers.clear()\n  }\n\n  /**\n   * Retrieves the balance wallet for a specified Knish.IO identity and token slug\n   *\n   * @param {string} token\n   * @param {string|null} bundle\n   * @param {string} type\n   * @returns {Promise<*>}\n   */\n  async queryBalance ({\n    token,\n    bundle = null,\n    type = 'regular'\n  }) {\n    /**\n     * @type {QueryBalance}\n     */\n    const query = this.createQuery(QueryBalance)\n\n    // Execute query with either the provided bundle hash or the active client's bundle\n    return this.executeQuery(query, {\n      bundleHash: bundle || this.getBundle(),\n      token,\n      type\n    })\n  }\n\n  /**\n   *\n   * @param {string} token\n   * @param {number} amount\n   * @param {string} type\n   * @returns {Promise<{address}|{position}|*>}\n   */\n  async querySourceWallet ({\n    token,\n    amount,\n    type = 'regular'\n  }) {\n    const sourceWallet = (await this.queryBalance({\n      token,\n      type\n    })).payload()\n\n    // Do you have enough tokens?\n    if (sourceWallet === null || Decimal.cmp(sourceWallet.balance, amount) < 0) {\n      throw new TransferBalanceException()\n    }\n\n    // Check shadow wallet\n    if (!sourceWallet.position || !sourceWallet.address) {\n      throw new TransferBalanceException('Source wallet can not be a shadow wallet.')\n    }\n\n    return sourceWallet\n  }\n\n  /**\n   * @param {string|null} bundle\n   * @param {function} closure\n   * @return {Promise<string>}\n   */\n  async subscribeCreateMolecule ({\n    bundle,\n    closure\n  }) {\n    const subscribe = this.createSubscribe(CreateMoleculeSubscribe)\n\n    return await subscribe.execute({\n      variables: {\n        bundle: bundle || this.getBundle()\n      },\n      closure\n    })\n  }\n\n  /**\n   * Creates a subscription for updating Wallet status\n   *\n   * @param {string|null} bundle\n   * @param {string} token\n   * @param {function} closure\n   * @return {string}\n   */\n  subscribeWalletStatus ({\n    bundle,\n    token,\n    closure\n  }) {\n    if (!token) {\n      throw new CodeException(`${ this.constructor.name }::subscribeWalletStatus() - Token parameter is required!`)\n    }\n\n    const subscribe = this.createSubscribe(WalletStatusSubscribe)\n\n    return subscribe.execute({\n      variables: {\n        bundle: bundle || this.getBundle(),\n        token\n      },\n      closure\n    })\n  }\n\n  /**\n   *  Creates a subscription for updating active Wallet\n   *\n   * @param {string|null} bundle\n   * @param {function} closure\n   * @return {string}\n   */\n  subscribeActiveWallet ({\n    bundle,\n    closure\n  }) {\n    const subscribe = this.createSubscribe(ActiveWalletSubscribe)\n\n    return subscribe.execute({\n      variables: {\n        bundle: bundle || this.getBundle()\n      },\n      closure\n    })\n  }\n\n  /**\n   * Creates a subscription for updating list of active sessions for a given MetaType\n   *\n   * @param {string} metaType\n   * @param {string} metaId\n   * @param {function} closure\n   * @return {*}\n   */\n  subscribeActiveSession ({\n    metaType,\n    metaId,\n    closure\n  }) {\n    const subscribe = this.createSubscribe(ActiveSessionSubscribe)\n\n    return subscribe.execute({\n      variables: {\n        metaType,\n        metaId\n      },\n      closure\n    })\n  }\n\n  /**\n   * Unsubscribes from a given subscription name\n   *\n   * @param {string} operationName\n   */\n  unsubscribe (operationName) {\n    this.subscribe().unsubscribe(operationName)\n  }\n\n  unsubscribeAll () {\n    this.subscribe().unsubscribeAll()\n  }\n\n  /**\n   * Retrieves metadata for the given metaType and provided parameters\n   *\n   * @param {string|array|null} metaType\n   * @param {string|array|null} metaId\n   * @param {string|array|null} key\n   * @param {string|array|null} value\n   * @param {boolean|null} latest\n   * @param {object|null} fields\n   * @param {object|null} filter\n   * @param {object|null} queryArgs\n   * @param {string|null} count\n   * @param {string|null} countBy\n   * @param {boolean} throughAtom\n   * @param {boolean} throughMolecule\n   * @param {array|null} values\n   * @param {array|null} keys\n   * @param {array|null} atomValues\n   * @return {Promise<ResponseMetaType|ResponseMetaTypeViaAtom|ResponseMetaTypeViaMolecule>}\n   */\n  queryMeta ({\n    metaType,\n    metaId = null,\n    key = null,\n    value = null,\n    latest = true,\n    fields = null,\n    filter = null,\n    queryArgs = null,\n    count = null,\n    countBy = null,\n    throughAtom = true,\n    throughMolecule = false,\n    values = null,\n    keys = null,\n    atomValues = null,\n    requestPolicy = null\n  }) {\n    this.log('info', `KnishIOClient::queryMeta() - Querying metaType: ${ metaType }, metaId: ${ metaId }...`)\n\n    let query\n    let variables\n\n    if (throughMolecule) {\n      /**\n       * @type {QueryMetaTypeViaMolecule}\n       */\n      query = this.createQuery(QueryMetaTypeViaMolecule)\n      variables = QueryMetaTypeViaMolecule.createVariables({\n        metaType,\n        metaId,\n        key,\n        value,\n        latest,\n        filter,\n        queryArgs,\n        countBy,\n        values,\n        keys,\n        atomValues,\n        cellSlug: this.getCellSlug()\n      })\n    } else if (throughAtom) {\n      /**\n       * @type {QueryMetaTypeViaAtom}\n       */\n      query = this.createQuery(QueryMetaTypeViaAtom)\n      variables = QueryMetaTypeViaAtom.createVariables({\n        metaType,\n        metaId,\n        key,\n        value,\n        latest,\n        filter,\n        queryArgs,\n        countBy,\n        values,\n        keys,\n        atomValues,\n        cellSlug: this.getCellSlug()\n      })\n    } else {\n      /**\n       * @type {QueryMetaType}\n       */\n      query = this.createQuery(QueryMetaType)\n      variables = QueryMetaType.createVariables({\n        metaType,\n        metaId,\n        key,\n        value,\n        latest,\n        filter,\n        queryArgs,\n        count,\n        countBy,\n        cellSlug: this.getCellSlug()\n      })\n    }\n\n    return this.executeQuery(query, variables, requestPolicy ? { requestPolicy } : {})\n  }\n\n  /**\n   * Queries meta assets and verifies cryptographic integrity of associated molecules.\n   * Returns the same response as queryMeta(), with an additional `integrity` field on the payload\n   * containing verification results for each molecule.\n   *\n   * @param {object} params - Same parameters as queryMeta()\n   * @return {Promise<ResponseMetaType|ResponseMetaTypeViaAtom|ResponseMetaTypeViaMolecule>}\n   */\n  async queryMetaVerified (params) {\n    const response = await this.queryMeta(params)\n    const payload = response.payload()\n    if (payload) {\n      payload.integrity = response.verifyIntegrity()\n    }\n    return response\n  }\n\n  /**\n   * Probes the connected server to check whether it supports a named root query field.\n   * Result is cached per URI so the network round-trip happens at most once per URI.\n   *\n   * Uses GraphQL introspection which is universally supported by spec-compliant servers.\n   *\n   * @param {string} fieldName - The root Query field name to check (e.g. 'embeddingStatus')\n   * @return {Promise<boolean>}\n   */\n  async hasQueryField (fieldName) {\n    const uri = this.getUri()\n    const cacheKey = `${ uri }::${ fieldName }`\n\n    if (typeof this.$__capabilityCache[cacheKey] === 'boolean') {\n      return this.$__capabilityCache[cacheKey]\n    }\n\n    try {\n      const result = await this.$__client.query({\n        query: '{ __schema { queryType { fields { name } } } }',\n        variables: {}\n      })\n\n      const fields = result?.data?.__schema?.queryType?.fields || []\n      const supported = fields.some(f => f.name === fieldName)\n      this.$__capabilityCache[cacheKey] = supported\n      return supported\n    } catch (err) {\n      this.log('warn', `KnishIOClient::hasQueryField() - Capability probe for '${ fieldName }' failed: ${ err.message }`)\n      this.$__capabilityCache[cacheKey] = false\n      return false\n    }\n  }\n\n  /**\n   * Queries embedding status for one or more meta instances (DataBraid observability).\n   *\n   * If the connected server does not support the embeddingStatus query,\n   * returns null without throwing an error (graceful degradation).\n   *\n   * Single mode: queryEmbeddingStatus({ metaType: 'product', metaId: 'SKU-001' })\n   * Bulk mode:   queryEmbeddingStatus({ instances: [{ metaType: 'product', metaId: 'SKU-001' }, ...] })\n   *\n   * @param {string|null} metaType - Metadata type (single-instance mode)\n   * @param {string|null} metaId - Instance identifier (single-instance mode)\n   * @param {Array<{metaType: string, metaId: string}>|null} instances - Bulk mode input\n   * @return {Promise<ResponseEmbeddingStatus|null>} Response with payload(), or null if unsupported\n   */\n  async queryEmbeddingStatus ({\n    metaType = null,\n    metaId = null,\n    instances = null\n  }) {\n    this.log('info', `KnishIOClient::queryEmbeddingStatus() - Checking embedding status for metaType: ${ metaType || '(bulk)' }...`)\n\n    const supported = await this.hasQueryField('embeddingStatus')\n\n    if (!supported) {\n      this.log('warn', 'KnishIOClient::queryEmbeddingStatus() - Server does not support embeddingStatus query. Returning null.')\n      return null\n    }\n\n    const query = this.createQuery(QueryEmbeddingStatus)\n    const variables = QueryEmbeddingStatus.createVariables({ metaType, metaId, instances })\n\n    return this.executeQuery(query, variables)\n  }\n\n  /**\n   * Query batch to get cascading meta instances by batchID\n   *\n   * @param batchId\n   * @return {Promise<*>}\n   */\n  async queryBatch ({\n    batchId\n  }) {\n    this.log('info', `KnishIOClient::queryBatch() - Querying cascading meta instances for batchId: ${ batchId }...`)\n    const query = this.createQuery(QueryBatch)\n    return await this.executeQuery(query, {\n      batchId\n    })\n  }\n\n  /**\n   * Query batch history to get cascading meta instances by batchID\n   *\n   * @param batchId\n   * @return {Promise<*>}\n   */\n  async queryBatchHistory ({\n    batchId\n  }) {\n    this.log('info', `KnishIOClient::queryBatchHistory() - Querying cascading meta instances for batchId: ${ batchId }...`)\n\n    const query = this.createQuery(QueryBatchHistory)\n\n    return await this.executeQuery(query, {\n      batchId\n    })\n  }\n\n  /**\n   * Queries atom instances based on the provided parameters.\n   *\n   * @param {string[]} molecularHashes - Array of multiple molecular hashes.\n   * @param {string} molecularHash - Single molecular hash.\n   * @param {string[]} bundleHashes - Array of multiple bundle hashes.\n   * @param {string} bundleHash - Single bundle hash.\n   * @param {number[]} positions - Array of multiple positions.\n   * @param {number} position - Single position.\n   * @param {string[]} walletAddresses - Array of multiple wallet addresses.\n   * @param {string} walletAddress - Single wallet address.\n   * @param {string[]} isotopes - Array of multiple isotopes.\n   * @param {string} isotope - Single isotope.\n   * @param {string[]} tokenSlugs - Array of multiple token slugs.\n   * @param {string} tokenSlug - Single token slug.\n   * @param {string[]} cellSlugs - Array of multiple cell slugs.\n   * @param {string} cellSlug - Single cell slug.\n   * @param {string[]} batchIds - Array of multiple batch IDs.\n   * @param {string} batchId - Single batch ID.\n   * @param {any[]} values - Array of multiple values.\n   * @param {any} value - Single value.\n   * @param {string[]} metaTypes - Array of multiple meta types.\n   * @param {string} metaType - Single meta type.\n   * @param {string[]} metaIds - Array of multiple meta IDs.\n   * @param {string} metaId - Single meta ID.\n   * @param {string[]} indexes - Array of multiple atom indices.\n   * @param {string} index - Single atom index.\n   * @param {object} filter - The filter object.\n   * @param {boolean} latest - The latest flag.\n   * @param {object} [queryArgs] - The query arguments (limit, offset).\n   * @param {number} [queryArgs.limit=15] - The limit.\n   * @param {number} [queryArgs.offset=1] - The offset.\n   *\n   * @returns {Promise<ResponseAtom>} - A promise that resolves with the queried atom instances.\n   */\n  async queryAtom ({\n    molecularHashes,\n    molecularHash,\n    bundleHashes,\n    bundleHash,\n    positions,\n    position,\n    walletAddresses,\n    walletAddress,\n    isotopes,\n    isotope,\n    tokenSlugs,\n    tokenSlug,\n    cellSlugs,\n    cellSlug,\n    batchIds,\n    batchId,\n    values,\n    value,\n    metaTypes,\n    metaType,\n    metaIds,\n    metaId,\n    indexes,\n    index,\n    filter,\n    latest,\n    queryArgs = {\n      limit: 15,\n      offset: 1\n    }\n  }) {\n    this.log('info', 'KnishIOClient::queryAtom() - Querying atom instances')\n\n    /** @type QueryAtom */\n    const query = this.createQuery(QueryAtom)\n\n    return await this.executeQuery(query, QueryAtom.createVariables({\n      molecularHashes,\n      molecularHash,\n      bundleHashes,\n      bundleHash,\n      positions,\n      position,\n      walletAddresses,\n      walletAddress,\n      isotopes,\n      isotope,\n      tokenSlugs,\n      tokenSlug,\n      cellSlugs,\n      cellSlug,\n      batchIds,\n      batchId,\n      values,\n      value,\n      metaTypes,\n      metaType,\n      metaIds,\n      metaId,\n      indexes,\n      index,\n      filter,\n      latest,\n      queryArgs\n    }))\n  }\n\n  /**\n   * Builds and executes a molecule to issue a new Wallet on the ledger\n   *\n   * @param {string} token - The token slug for the new wallet\n   * @returns {Promise<ResponseCreateWallet>} - A Promise that resolves with the result of the execution.\n   */\n  async createWallet ({\n    token\n  }) {\n    const newWallet = new Wallet({\n      secret: this.getSecret(),\n      token,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    /**\n     * @type {MutationCreateWallet}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationCreateWallet\n    })\n\n    query.fillMolecule(newWallet)\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Queries the ledger to retrieve a list of active sessions for the given MetaType\n   *\n   * @param {string} bundleHash - The hash of the session bundle.\n   * @param {string} metaType - The type of metadata associated with the session.\n   * @param {string} metaId - The ID of the metadata associated with the session.\n   * @returns {Promise<ResponseQueryActiveSession>} - Returns a promise containing the result of the query.\n   */\n  async queryActiveSession ({\n    bundleHash,\n    metaType,\n    metaId\n  }) {\n    const query = this.createQuery(QueryActiveSession)\n\n    return await this.executeQuery(query, {\n      bundleHash,\n      metaType,\n      metaId\n    })\n  }\n\n  /**\n   * Builds and executes a molecule to declare an active session for the given MetaType\n   *\n   * @param {Object} options - The options for activating a session.\n   * @param {string} options.bundle - The bundle hash.\n   * @param {string} options.metaType - The meta type.\n   * @param {string} options.metaId - The meta ID.\n   * @param {string} options.ipAddress - The client's IP address.\n   * @param {string} options.browser - The client's browser.\n   * @param {string} options.osCpu - The client's operating system and CPU.\n   * @param {string} options.resolution - The client's screen resolution.\n   * @param {string} options.timeZone - The client's time zone.\n   * @param {Object} [options.json={}] - Additional JSON data.\n   * @returns {Promise<ResponseActiveSession>} A promise that resolves with the result of the activation.\n   */\n  async activeSession ({\n    bundle,\n    metaType,\n    metaId,\n    ipAddress,\n    browser,\n    osCpu,\n    resolution,\n    timeZone,\n    json = {}\n  }) {\n    const query = this.createQuery(MutationActiveSession)\n\n    return await this.executeQuery(query, {\n      bundleHash: bundle,\n      metaType,\n      metaId,\n      ipAddress,\n      browser,\n      osCpu,\n      resolution,\n      timeZone,\n      json: JSON.stringify(json)\n    })\n  }\n\n  /**\n   * Creates a new token with the given parameters.\n   *\n   * @param {object} options - The options for creating the token.\n   * @param {string} options.token - The token identifier.\n   * @param {number} [options.amount] - The amount of tokens to create.\n   * @param {object} [options.meta] - Additional metadata for the token.\n   * @param {string} [options.batchId] - The batch identifier for stackable tokens.\n   * @param {Array<string|Array|TokenUnit>} [options.units] - The token units: a bare id (sent as [id, id, {}]),\n   *   an [id, name, metas] triple or a TokenUnit.\n   *\n   * @throws {StackableUnitDecimalsException} If a stackable token has decimals.\n   * @throws {StackableUnitAmountException} If stackable units are provided with an amount.\n   *\n   * @returns {Promise<ResponseCreateToken>} A Promise that resolves to the result of creating the token.\n   */\n  async createToken ({\n    token,\n    amount = null,\n    meta = null,\n    batchId = null,\n    units = []\n  }) {\n    // What is the fungibility mode for this token?\n    const fungibility = Dot.get(meta || {}, 'fungibility')\n\n    // For stackable token - create a batch ID\n    if (fungibility === 'stackable') {\n      meta.batchId = batchId || generateBatchId({})\n    }\n\n    // Special logic for token unit initialization (nonfungible || stackable)\n    if (['nonfungible', 'stackable'].includes(fungibility) && units.length > 0) {\n      // Stackable tokens with Unit IDs must not use decimals\n      if (Dot.get(meta || {}, 'decimals') > 0) {\n        throw new StackableUnitDecimalsException()\n      }\n\n      // Can't create stackable units AND provide amount\n      if (amount > 0) {\n        throw new StackableUnitAmountException()\n      }\n\n      // Calculating amount based on Unit IDs\n      amount = units.length\n      meta.splittable = 1\n      meta.decimals = 0\n      meta.tokenUnits = JSON.stringify(units.map(u => typeof u === 'string'\n        ? new TokenUnit(u, u, {}).toData()\n        : Array.isArray(u)\n          ? new TokenUnit(u[0], u[1] ?? u[0], u[2] || {}).toData()\n          : u.toData()))\n    }\n\n    // Creating the wallet that will receive the new tokens\n    const recipientWallet = new Wallet({\n      secret: this.getSecret(),\n      bundle: this.getBundle(),\n      token,\n      batchId,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    /**\n     * @type {MutationCreateToken}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationCreateToken\n    })\n\n    query.fillMolecule({\n      recipientWallet,\n      amount,\n      meta: meta || {}\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Creates a new rule with the specified parameters.\n   *\n   * @param {string} metaType - The type of the metadata associated with the rule.\n   * @param {string} metaId - The ID of the metadata associated with the rule.\n   * @param {object} rule - The rule object.\n   * @param {object} [policy={}] - The policy object. (optional)\n   * @returns {Promise<ResponseCreateRule>} - A promise that resolves to the created rule.\n   */\n  async createRule ({\n    metaType,\n    metaId,\n    rule,\n    policy = {}\n  }) {\n    /**\n     * @type {MutationCreateRule}\n     */\n    const query = await this.createMoleculeMutation({\n        mutationClass: MutationCreateRule,\n        molecule: await this.createMolecule({\n          secret: this.getSecret()\n        })\n      }\n    )\n\n    query.fillMolecule({\n      metaType,\n      metaId,\n      rule,\n      policy\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to convey new metadata to the ledger\n   *\n   * @param {string} metaType - The type of the metadata entry.\n   * @param {string} metaId - The ID of the metadata entry.\n   * @param {object|array} meta - The metadata object.\n   * @param {object} [policy={}] - The policy object.\n   * @returns {Promise<ResponseCreateMeta>} - A Promise that resolves with the created metadata entry.\n   */\n  async createMeta ({\n    metaType,\n    metaId,\n    meta = null,\n    policy = {}\n  }) {\n    /**\n     * @type {MutationCreateMeta}\n     */\n    const query = await this.createMoleculeMutation({\n        mutationClass: MutationCreateMeta,\n        molecule: await this.createMolecule({\n          secret: this.getSecret()\n        })\n      }\n    )\n\n    const metas = meta || {}\n\n    query.fillMolecule({\n      metaType,\n      metaId,\n      meta: metas,\n      policy\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to register a peer node via P-isotope\n   *\n   * @param {string} host - The peer host URL to register\n   * @returns {Promise<ResponsePeering>} - A Promise that resolves with the peering response.\n   */\n  async registerPeer ({\n    host\n  }) {\n    /**\n     * @type {MutationPeering}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationPeering,\n      molecule: await this.createMolecule({\n        secret: this.getSecret()\n      })\n    })\n\n    query.fillMolecule({\n      host\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to submit an append request via A-isotope\n   *\n   * @param {string} metaType - The target MetaType to append to\n   * @param {string} metaId - The target MetaId to append to\n   * @param {string} action - The action to perform\n   * @param {object} [meta={}] - Additional metadata\n   * @returns {Promise<ResponseAppendRequest>} - A Promise that resolves with the append request response.\n   */\n  async appendRequest ({\n    metaType,\n    metaId,\n    action,\n    meta = {}\n  }) {\n    /**\n     * @type {MutationAppendRequest}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationAppendRequest,\n      molecule: await this.createMolecule({\n        secret: this.getSecret()\n      })\n    })\n\n    query.fillMolecule({\n      metaType,\n      metaId,\n      action,\n      meta\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to create a new identifier on the ledger\n   *\n   * @param {string} type - The type of the identifier.\n   * @param {string} contact - The contact associated with the identifier.\n   * @param {string} code - The code for the identifier.\n   * @returns {Promise<ResponseCreateIdentifier>} - A promise that resolves to the created identifier.\n   */\n  async createIdentifier ({\n    type,\n    contact,\n    code\n  }) {\n    /**\n     * @type {MutationCreateIdentifier}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationCreateIdentifier\n    })\n\n    query.fillMolecule({\n      type,\n      contact,\n      code\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Links an identifier to the current wallet bundle\n   *\n   * @param {string} type - The type of the identifier.\n   * @param {string} contact - The contact associated with the identifier.\n   * @returns {Promise<ResponseLinkIdentifier>} - A promise that resolves to the link result.\n   */\n  async linkIdentifier ({\n    type,\n    contact\n  }) {\n    const query = this.createQuery(MutationLinkIdentifier)\n    return await this.executeQuery(query, {\n      bundle: this.getBundle(),\n      type,\n      content: contact\n    })\n  }\n\n  /**\n   * Creates a policy for a given metaType and metaId.\n   *\n   * @param {Object} options - The options for creating the policy.\n   * @param {string} options.metaType - The type of the meta.\n   * @param {string} options.metaId - The ID of the meta.\n   * @param {Object} [options.policy={}] - The policy object.\n   * @returns {Promise<*>} - A promise that resolves with the result of the execution.\n   */\n  async createPolicy ({\n    metaType,\n    metaId,\n    policy = {}\n  }) {\n    // Create a molecule. F-3 (E2E gauntlet 2026-06-02): the ContinuID-rejection bug\n    // here was NOT this construction — it was molecule.addPolicyAtom() signing the\n    // R-isotope atom from a fresh random wallet (now fixed in Molecule.addPolicyAtom\n    // to use this.sourceWallet). A policy is a policy-only R-atom (no rules), so this\n    // path is kept as-is: routing through createRule with an empty rule list would\n    // fail the SDK's own `Check::isotopeR() - No rules!` validation.\n    const molecule = await this.createMolecule({})\n    molecule.addPolicyAtom({\n      metaType,\n      metaId,\n      meta: {},\n      policy\n    })\n    molecule.addContinuIdAtom()\n    molecule.sign({\n      bundle: this.getBundle()\n    })\n    molecule.check()\n\n    // Create & execute a mutation\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationProposeMolecule,\n      molecule\n    })\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Queries the policy based on the provided metaType and metaId.\n   *\n   * @param {string} metaType - The type of the meta.\n   * @param {string} metaId - The ID of the meta.\n   * @returns {Promise<ResponsePolicy>} - A Promise that resolves to the query result.\n   */\n  async queryPolicy ({\n    metaType,\n    metaId\n  }) {\n    const query = this.createQuery(QueryPolicy)\n    return await this.executeQuery(query, {\n      metaType,\n      metaId\n    })\n  }\n\n  /**\n   * Queries wallets based on the provided parameters.\n   *\n   * @param {object} options - The options for querying wallets.\n   * @param {string|null} options.bundle - The bundle to query wallets for.\n   * @param {string|null} options.token - The token to query wallets for.\n   * @param {boolean} [options.unspent=true] - Whether to include unspent wallets or not.\n   *\n   * @returns {Promise<ResponseWalletList>} - A promise that resolves to the response payload of the query.\n   */\n  queryWallets ({\n    bundle = null,\n    token = null,\n    unspent = true\n  }) {\n    this.log('info', `KnishIOClient::queryWallets() - Querying wallets${ bundle ? ` for ${ bundle }` : '' }...`)\n\n    /**\n     * @type {QueryWalletList}\n     */\n    const walletQuery = this.createQuery(QueryWalletList)\n\n    return this.executeQuery(walletQuery, {\n      bundleHash: bundle || this.getBundle(),\n      token,\n      unspent\n    })\n      .then((response) => {\n        return response.payload()\n      })\n  }\n\n  /**\n   * Queries wallet bundle metadata.\n   *\n   * @param {Object} options - The options for the query.\n   * @param {string|null} options.bundle - The bundle to query. Default is null.\n   * @param {string|null} options.fields - The fields to retrieve. Default is null.\n   * @param {boolean} options.raw - Whether to return the raw response or the payload. Default is false.\n   * @returns {Promise<ResponseWalletBundle|{}|null>} - A promise that resolves to the response or payload.\n   */\n  queryBundle ({\n    bundle = null,\n    fields = null,\n    raw = false\n  }) {\n    this.log('info', `KnishIOClient::queryBundle() - Querying wallet bundle metadata${ bundle ? ` for ${ bundle }` : '' }...`)\n\n    // Bundle default init & to array convertion\n    if (!bundle) {\n      bundle = this.getBundle()\n    }\n    if (typeof bundle === 'string') {\n      bundle = [bundle]\n    }\n\n    /**\n     * @type {QueryWalletBundle}\n     */\n    const query = this.createQuery(QueryWalletBundle)\n    return this.executeQuery(query, { bundleHashes: bundle })\n      .then((/** ResponseWalletBundle */ response) => {\n        return raw ? response : response.payload()\n      })\n  }\n\n  /**\n   * Queries the ledger for the next ContinuId wallet\n   *\n   * @param {String} bundle - The bundle hash used in the query.\n   * @param {String|null} [token=null] - Only return a wallet of this token (e.g. 'USER'). Without\n   *   it the validator falls back to the bundle's newest wallet of any token when the bundle has\n   *   no ContinuID pointer yet.\n   * @returns {Promise<ResponseContinuId>} - A promise that resolves to the result of the query.\n   */\n  async queryContinuId ({\n    bundle,\n    token = null\n  }) {\n    /**\n     * @type {QueryContinuId}\n     */\n    const query = this.createQuery(QueryContinuId)\n\n    return this.executeQuery(query, token ? { bundle, token } : { bundle })\n  }\n\n  /**\n   * Requests tokens for a specific recipient or for the current wallet bundle.\n   *\n   * @param {Object} options - The options for the token request.\n   * @param {string} options.token - The token slug.\n   * @param {string|Wallet} [options.to] - The recipient of the tokens. If not provided, tokens will be requested for the current wallet bundle.\n   * @param {number|null} [options.amount=null] - The amount of tokens to request. If not provided and `options.units` are provided, the amount will be calculated based on the number of\n   * units.\n   * @param {Array} [options.units=[]] - The array of unit IDs. If provided, the amount will be calculated based on the length of `options.units`.\n   * @param {Object|null} [options.meta=null] - Additional metadata for the token request.\n   * @param {string|null} [options.batchId=null] - The batch ID for the token request. If not provided and the token is stackable, a new batch ID will be generated.\n   *\n   * @returns {Promise<ResponseRequestTokens>} - A promise that resolves with the response from the token request.\n   *\n   * @throws {BatchIdException} - When a non-stackable token is used and `options.batchId` is not null.\n   * @throws {StackableUnitAmountException} - When both `options.units` and `options.amount` are provided for stackable tokens.\n   */\n  async requestTokens ({\n    token,\n    to,\n    amount = null,\n    units = [],\n    meta = null,\n    batchId = null\n  }) {\n    let metaType,\n      metaId\n\n    meta = meta || {}\n\n    // Get a token & init is Stackable flag for batch ID initialization\n    const queryToken = this.createQuery(QueryToken)\n    const tokenResponse = await this.executeQuery(queryToken, {\n      slug: token\n    })\n    const isStackable = Dot.get(tokenResponse.data(), '0.fungibility') === 'stackable'\n\n    // NON-stackable tokens & batch ID is NOT NULL - error\n    if (!isStackable && batchId !== null) {\n      throw new BatchIdException('Expected Batch ID = null for non-stackable tokens.')\n    }\n    // Stackable tokens & batch ID is NULL - generate new one\n    if (isStackable && batchId === null) {\n      batchId = generateBatchId({})\n    }\n\n    // Calculate amount & set meta key\n    if (units.length > 0) {\n      // Can't move stackable units AND provide amount\n      if (amount > 0) {\n        throw new StackableUnitAmountException()\n      }\n\n      // Calculating amount based on Unit IDs\n      amount = units.length\n      meta.tokenUnits = JSON.stringify(units)\n    }\n\n    // Are we specifying a specific recipient?\n    if (to) {\n      // If the recipient is provided as an object, try to figure out the actual recipient\n      if (Object.prototype.toString.call(to) === '[object String]') {\n        if (Wallet.isBundleHash(to)) {\n          metaType = 'walletBundle'\n          metaId = to\n        } else {\n          to = Wallet.create({\n            secret: to,\n            token,\n            mlKemParameterSet: this.getMlKemParameterSet()\n          })\n        }\n      }\n\n      // If recipient is a Wallet, we need to help the node triangulate\n      // the transfer by providing position and bundle hash\n      if (to instanceof Wallet) {\n        metaType = 'wallet'\n        meta.position = to.position\n        meta.bundle = to.bundle\n        metaId = to.address\n      }\n    } else {\n      // No recipient, so request tokens for ourselves\n      metaType = 'walletBundle'\n      metaId = this.getBundle()\n    }\n\n    /**\n     * @type {MutationRequestTokens}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationRequestTokens\n    })\n\n    query.fillMolecule({\n      token,\n      amount,\n      metaType,\n      metaId,\n      meta,\n      batchId\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Claims a shadow wallet for a given token.\n   *\n   * @param {string} token - The token for which to claim the shadow wallet.\n   * @param {string|null} batchId - The batch ID of the shadow wallet. When omitted, the first shadow wallet\n   *   `queryWallets({ token })` returns is claimed; the validator rejects a claim without a batch ID.\n   * @param {string|null} molecule - The molecule associated with the shadow wallet (optional).\n   *\n   * @returns {Promise<ResponseClaimShadowWallet>} - A promise that resolves to the result of the claim operation.\n   * @throws {WalletShadowException} - If no batch ID is given and the token has no shadow wallet.\n   */\n  async claimShadowWallet ({\n    token,\n    batchId = null,\n    molecule = null\n  }) {\n    if (!batchId) {\n      const shadowWallets = ((await this.queryWallets({ token })) || []).filter(wallet => wallet.isShadow())\n      if (!shadowWallets.length) {\n        throw new WalletShadowException(`KnishIOClient::claimShadowWallet() - No shadow wallets found for token ${ token }`)\n      }\n      batchId = shadowWallets[0].batchId\n    }\n\n    /**\n     * @type {MutationClaimShadowWallet}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationClaimShadowWallet,\n      molecule\n    })\n\n    query.fillMolecule({\n      token,\n      batchId\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Claims all shadow wallets for a given token.\n   *\n   * @param {Object} options - The options for claiming shadow wallets.\n   * @param {string} options.token - The token to claim shadow wallets for.\n   * @returns {Promise<*>} - A promise that resolves to an array of responses from claiming shadow wallets.\n   * @throws {WalletShadowException} - If the shadow wallet list is invalid or if a non-shadow wallet is found.\n   */\n  async claimShadowWallets ({\n    token\n  }) {\n    // --- Get & check a shadow wallet list\n    const shadowWallets = await this.queryWallets({ token })\n    if (!shadowWallets || !Array.isArray(shadowWallets)) {\n      throw new WalletShadowException()\n    }\n\n    shadowWallets.forEach(shadowWallet => {\n      if (!shadowWallet.isShadow()) {\n        throw new WalletShadowException()\n      }\n    })\n    // ----\n\n    const responses = []\n    for (const shadowWallet of shadowWallets) {\n      responses.push(await this.claimShadowWallet({\n        token,\n        batchId: shadowWallet.batchId\n      }))\n    }\n    return responses\n  }\n\n  /**\n   * Transfers tokens from one wallet to another.\n   *\n   * @param {Object} options - The transfer options.\n   * @param {string} options.bundleHash - The bundle hash of the source wallet.\n   * @param {string} options.token - The token to transfer.\n   * @param {number} [options.amount=null] - The amount of tokens to transfer. Not required if units are provided.\n   * @param {Array} [options.units=[]] - An array of units to transfer. Overrides the amount if provided.\n   * @param {string} [options.batchId=null] - The batch ID for the recipient wallet.\n   * @param {Object} [options.sourceWallet=null] - The source wallet object. If not provided, it will be queried.\n   *\n   * @returns {Promise} - A Promise that resolves to the transaction result.\n   *\n   * @throws {StackableUnitAmountException} - If both amount and units are provided.\n   * @throws {TransferBalanceException} - If the source wallet does not have enough balance.\n   */\n  async transferToken ({\n    bundleHash,\n    token,\n    amount = null,\n    units = [],\n    batchId = null,\n    sourceWallet = null\n  }) {\n    // Calculate amount & set meta key\n    if (units.length > 0) {\n      // Can't move stackable units AND provide amount\n      if (amount > 0) {\n        throw new StackableUnitAmountException()\n      }\n\n      amount = units.length\n    }\n\n    // Get a source wallet\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token,\n        amount\n      })\n    }\n\n    // Do you have enough tokens?\n    if (sourceWallet === null || Decimal.cmp(sourceWallet.balance, amount) < 0) {\n      throw new TransferBalanceException()\n    }\n\n    // Attempt to get the recipient's wallet, if not provided\n    const recipientWallet = Wallet.create({\n      bundle: bundleHash,\n      token,\n      mlKemParameterSet: this.getMlKemParameterSet()\n    })\n\n    // Compute the batch ID for the recipient\n    // (typically used by stackable tokens)\n    if (batchId !== null) {\n      recipientWallet.batchId = batchId\n    } else {\n      recipientWallet.initBatchId({\n        sourceWallet\n      })\n    }\n\n    // Create a remainder from the source wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // --- Token units splitting\n    sourceWallet.splitUnits(\n      units,\n      remainderWallet,\n      recipientWallet\n    )\n    // ---\n\n    // Build the molecule itself\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    /**\n     * @type {MutationTransferTokens}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationTransferTokens,\n      molecule\n    })\n\n    query.fillMolecule({\n      recipientWallet,\n      amount\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Transfers tokens from one source wallet to MULTIPLE recipients in a single molecule.\n   *\n   * One molecule funds N recipients (WP line 544: \"utilizing the sender's Wallet to fund multiple\n   * recipients with one transaction\"). Each recipient receives its own amount and, for stackable\n   * tokens, its own subset of token units. The source is fully drained and the unsent change\n   * returns via the remainder atom (UTXO), so the V-atoms conserve. Single-recipient transfers\n   * should keep using transferToken(); this is its N-recipient generalization.\n   *\n   * @param {Object} options - The transfer options.\n   * @param {string} options.token - The token to transfer.\n   * @param {Array} options.recipients - [{ bundleHash, amount?, units?, batchId? }] per recipient.\n   * @param {Object} [options.sourceWallet=null] - The source wallet; queried if not provided.\n   *\n   * @returns {Promise} - A Promise that resolves to the transaction result.\n   *\n   * @throws {StackableUnitAmountException} - If a recipient provides both amount and units.\n   * @throws {TransferBalanceException} - If the source wallet does not have enough balance.\n   */\n  async transferTokens ({\n    token,\n    recipients,\n    sourceWallet = null\n  }) {\n    // Per-recipient amount: units.length for stackable, else the explicit amount\n    const amounts = recipients.map(recipient => {\n      const units = recipient.units || []\n      if (units.length > 0) {\n        // Can't move stackable units AND provide amount\n        if (recipient.amount > 0) {\n          throw new StackableUnitAmountException()\n        }\n        return units.length\n      }\n      return recipient.amount || 0\n    })\n    const total = amounts.reduce((sum, value) => sum + value, 0)\n\n    // Get a source wallet (loads its token units)\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token,\n        amount: total\n      })\n    }\n\n    // Do you have enough tokens?\n    if (sourceWallet === null || Decimal.cmp(sourceWallet.balance, total) < 0) {\n      throw new TransferBalanceException()\n    }\n\n    // Build a shadow recipient wallet per recipient, each with its own batch ID\n    const recipientWallets = recipients.map(recipient => {\n      const recipientWallet = Wallet.create({\n        bundle: recipient.bundleHash,\n        token,\n        mlKemParameterSet: this.getMlKemParameterSet()\n      })\n\n      // Compute the batch ID for the recipient (typically used by stackable tokens)\n      if (recipient.batchId !== undefined && recipient.batchId !== null) {\n        recipientWallet.batchId = recipient.batchId\n      } else {\n        recipientWallet.initBatchId({\n          sourceWallet\n        })\n      }\n\n      return recipientWallet\n    })\n\n    // Create a remainder from the source wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // --- Token units splitting (N-way): source keeps the union, each recipient its subset,\n    //     remainder the kept units\n    sourceWallet.splitUnitsMulti(\n      recipients.map(recipient => recipient.units || []),\n      recipientWallets,\n      remainderWallet\n    )\n    // ---\n\n    // Build the molecule itself\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    /**\n     * @type {MutationTransferTokens}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationTransferTokens,\n      molecule\n    })\n\n    query.fillMoleculeMulti({\n      recipientWallets,\n      amounts\n    })\n\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Deposits buffer token into the source wallet.\n   *\n   * @param {Object} options - The options for depositing buffer token.\n   * @param {string} options.tokenSlug - The slug of the token to deposit.\n   * @param {number} options.amount - The amount of token to deposit.\n   * @param {Object} options.tradeRates - The trade rates for the deposit.\n   * @param {Wallet|null} options.sourceWallet - The source wallet for the deposit. If not provided, a source wallet will be queried.\n   *\n   * @returns {Promise<*>} - A promise that resolves with the result of the deposit.\n   */\n  async depositBufferToken ({\n    tokenSlug,\n    amount,\n    tradeRates,\n    sourceWallet = null\n  }) {\n    // Get a source wallet\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token: tokenSlug,\n        amount\n      })\n    }\n\n    // Remainder wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // Build the molecule itself\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    /**\n     * @type {MutationDepositBufferToken}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationDepositBufferToken,\n      molecule\n    })\n    query.fillMolecule({\n      amount,\n      tradeRates\n    })\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Withdraws buffer tokens back to this identity (contract 9.6): the source is the\n   * identity's buffer wallet, and the change goes to a fresh remainder position.\n   *\n   * @param {Object} options - The options for withdrawing buffer tokens.\n   * @param {string} options.tokenSlug - The token slug.\n   * @param {number} options.amount - The amount of tokens to withdraw.\n   * @param {Object} [options.sourceWallet=null] - The buffer wallet to withdraw from. If not provided, the identity's buffer balance wallet is queried.\n   * @returns {Promise<Object>} A promise that resolves to the result of the withdrawal transaction.\n   */\n  async withdrawBufferToken ({\n    tokenSlug,\n    amount,\n    sourceWallet = null\n  }) {\n    // Get the buffer wallet\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token: tokenSlug,\n        amount,\n        type: 'buffer'\n      })\n    }\n\n    // The remainder takes a fresh position: the source position is consumed by signing\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // Build the molecule itself\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    /**\n     * @type {MutationWithdrawBufferToken}\n     */\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationWithdrawBufferToken,\n      molecule\n    })\n    const recipients = {}\n    recipients[this.getBundle()] = amount\n    query.fillMolecule({\n      recipients\n    })\n    return await this.executeQuery(query)\n  }\n\n  /**\n   * Builds and executes a molecule to destroy the specified Token units\n   *\n   * @param {string} token\n   * @param {number|null} amount\n   * @param {array|null} units\n   * @param {Wallet|null} sourceWallet\n   * @return {Promise<unknown>}\n   */\n  async burnTokens ({\n    token,\n    amount = null,\n    units = [],\n    sourceWallet = null\n  }) {\n    // Get a source wallet\n    if (sourceWallet === null) {\n      sourceWallet = await this.querySourceWallet({\n        token,\n        amount\n      })\n    }\n\n    // Remainder wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // Calculate amount & set meta key\n    if (units.length > 0) {\n      // Can't burn stackable units AND provide amount\n      if (amount > 0) {\n        throw new StackableUnitAmountException()\n      }\n\n      // Calculating amount based on Unit IDs\n      amount = units.length\n\n      // --- Token units splitting\n      sourceWallet.splitUnits(\n        units,\n        remainderWallet\n      )\n      // ---\n    }\n\n    // Create a molecule\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    molecule.burnToken({ amount })\n    molecule.sign({\n      bundle: this.getBundle()\n    })\n    molecule.check(sourceWallet)\n\n    // Create & execute a mutation\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationProposeMolecule,\n      molecule\n    })\n    return this.executeQuery(query)\n  }\n\n  /**\n   * Mints more supply of an existing token this identity created (contract 9.1). The\n   * supply is credited to the identity's existing wallet for the token, or to a new one.\n   *\n   * @param {string} token\n   * @param {number|null} amount - the fungible amount; with units, null or the unit count\n   * @param {array} units - new token units as [id, name, metas] triples (stackable tokens)\n   * @param {Wallet|null} sourceWallet - the wallet to credit; queried when not given\n   * @return {Promise<unknown>}\n   */\n  async replenishToken ({\n    token,\n    amount = null,\n    units = [],\n    sourceWallet = null\n  }) {\n    if (units.length === 0) {\n      if (!(Number(amount) > 0)) {\n        throw new NegativeAmountException('KnishIOClient::replenishToken() - Amount to replenish must be positive!')\n      }\n\n      // A stackable token is replenished with new units, never with a bare amount\n      const tokenResponse = await this.executeQuery(this.createQuery(QueryToken), {\n        slug: token\n      })\n      if (Dot.get(tokenResponse.data(), '0.fungibility') === 'stackable') {\n        throw new StackableUnitAmountException('KnishIOClient::replenishToken() - Replenishing a stackable token requires token units!')\n      }\n    }\n\n    // The credited wallet: the identity's existing wallet for the token, or a new one\n    let creditedWallet = sourceWallet\n    if (creditedWallet === null) {\n      creditedWallet = (await this.queryBalance({ token })).payload()\n    }\n    if (!creditedWallet) {\n      creditedWallet = Wallet.create({\n        secret: this.getSecret(),\n        token,\n        mlKemParameterSet: this.getMlKemParameterSet()\n      })\n    }\n\n    // Signed by the identity's USER wallet, like createToken\n    const molecule = await this.createMolecule({})\n    molecule.replenishToken({\n      creditedWallet,\n      amount,\n      units\n    })\n    molecule.sign({\n      bundle: this.getBundle()\n    })\n    molecule.check()\n\n    // Create & execute a mutation\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationProposeMolecule,\n      molecule\n    })\n    return this.executeQuery(query)\n  }\n\n  /**\n   * Fuses stackable token units of this identity into one new unit (contract 9.2).\n   *\n   * @param {string} bundleHash - the bundle receiving the new unit\n   * @param {string} tokenSlug - the stackable token\n   * @param {TokenUnit|string} newTokenUnit - the new unit (a string is used as id and name)\n   * @param {string[]} fusedTokenUnitIds - the unit ids to fuse (at least two)\n   * @param {Wallet|null} sourceWallet - the wallet holding the units; queried when not given\n   * @returns {Promise<*>}\n   */\n  async fuseToken ({\n    bundleHash,\n    tokenSlug,\n    newTokenUnit,\n    fusedTokenUnitIds,\n    sourceWallet = null\n  }) {\n    if (sourceWallet === null) {\n      sourceWallet = (await this.queryBalance({ token: tokenSlug })).payload()\n    }\n    if (!sourceWallet) {\n      throw new TransferBalanceException('Source wallet is missing or invalid.')\n    }\n\n    // The new unit goes to a fresh own wallet, or to the recipient bundle\n    const recipientWallet = bundleHash === this.getBundle()\n      ? Wallet.create({\n        secret: this.getSecret(),\n        token: tokenSlug,\n        mlKemParameterSet: this.getMlKemParameterSet()\n      })\n      : Wallet.create({\n        bundle: bundleHash,\n        token: tokenSlug,\n        mlKemParameterSet: this.getMlKemParameterSet()\n      })\n    recipientWallet.initBatchId({ sourceWallet })\n\n    // Remainder wallet\n    const remainderWallet = sourceWallet.createRemainder(this.getSecret())\n\n    // Create a molecule\n    const molecule = await this.createMolecule({\n      sourceWallet,\n      remainderWallet\n    })\n    molecule.fuseToken({\n      fusedTokenUnitIds,\n      newTokenUnit,\n      recipientWallet\n    })\n    molecule.sign({\n      bundle: this.getBundle()\n    })\n    molecule.check(sourceWallet)\n\n    // Create & execute a mutation\n    const query = await this.createMoleculeMutation({\n      mutationClass: MutationProposeMolecule,\n      molecule\n    })\n    return this.executeQuery(query)\n  }\n\n  /**\n   * Requests a guest authentication token using the fingerprint of the user.\n   * @param {Object} options - The options for the guest authentication token request.\n   * @param {string} options.cellSlug - The slug of the cell to request the token for.\n   * @param {boolean} options.encrypt - Indicates whether the session should be encrypted.\n   * @returns {Promise<ResponseRequestAuthorizationGuest>} - A promise that resolves to the response of the guest authentication token request.\n   */\n  async requestGuestAuthToken ({\n    cellSlug,\n    encrypt\n  }) {\n    // Mark the login in progress so client() does not start a second one. Restore the previous\n    // value afterwards: when requestAuthToken is the caller, it clears the flag itself.\n    const previous = this.$__authInProcess\n    this.$__authInProcess = true\n\n    try {\n      this.setCellSlug(cellSlug)\n\n      // Create a wallet for encryption\n      const wallet = new Wallet({\n        secret: generateSecret(await this.getFingerprint()),\n        token: 'AUTH',\n        mlKemParameterSet: this.getMlKemParameterSet()\n      })\n\n      /**\n       * @type {MutationRequestAuthorizationGuest}\n       */\n      const query = await this.createQuery(MutationRequestAuthorizationGuest)\n\n      const variables = {\n        cellSlug,\n        pubkey: wallet.pubkey,\n        encrypt\n      }\n\n      /**\n       * @type {ResponseRequestAuthorizationGuest}\n       */\n      const response = await query.execute({ variables })\n\n      // Did the authorization molecule get accepted?\n      if (response.success()) {\n        // Create & set an auth token from the response data\n        // Map server payload field names (time/key) to AuthToken constructor names (expiresAt/pubkey)\n        const authToken = AuthToken.create({\n          token: response.token(),\n          expiresAt: response.expiresAt(),\n          pubkey: response.pubKey(),\n          encrypt: response.encrypt()\n        }, wallet)\n        this.setAuthToken(authToken)\n      } else {\n        throw new AuthorizationRejectedException(`KnishIOClient::requestGuestAuthToken() - Authorization attempt rejected by ledger. Reason: ${ response.reason() }`)\n      }\n\n      return response\n    } finally {\n      this.$__authInProcess = previous\n    }\n  }\n\n  /**\n   * Request a profile auth token\n   *\n   * A returning identity signs from the USER wallet registered at its ContinuID pointer: validator\n   * 0.5.0 marks only such a token proven, and only a proven token reads and subscribes to\n   * permissioned and private cells. A first login (no pointer) signs from a fresh AUTH wallet, and\n   * so does a single fallback when the ledger rejects the pointer-signed attempt.\n   *\n   * @param secret\n   * @param encrypt\n   * @returns {Promise<ResponseRequestAuthorization>}\n   */\n  async requestProfileAuthToken ({\n    secret,\n    encrypt\n  }) {\n    // Mark the login in progress so client() does not start a second one. Restore the previous\n    // value afterwards: when requestAuthToken is the caller, it clears the flag itself.\n    const previous = this.$__authInProcess\n    this.$__authInProcess = true\n\n    try {\n      this.setSecret(secret)\n\n      const authorize = async (wallet) => {\n        const molecule = await this.createMolecule({\n          secret,\n          sourceWallet: wallet\n        })\n\n        /**\n         * @type {MutationRequestAuthorization}\n         */\n        const query = await this.createMoleculeMutation({\n          mutationClass: MutationRequestAuthorization,\n          molecule\n        })\n\n        // PQ-transport Phase E (cycle 163): convey the source wallet's ML-KEM public key as a\n        // SIGNED `walletPubkey` meta on the U-atom (fillMolecule → initAuthorization → sign), so the\n        // validator can encrypt CipherHash responses back to THIS wallet (the one that decrypts them).\n        // Signed → tamper-proof. Only when present (PQ-capable wallet).\n        const authMeta = { encrypt: (encrypt ? 'true' : 'false') }\n        if (wallet.pubkey) {\n          authMeta.walletPubkey = wallet.pubkey\n        }\n        query.fillMolecule({ meta: authMeta })\n\n        /**\n         * @type {ResponseRequestAuthorization}\n         */\n        const response = await query.execute({})\n\n        if (response.success()) {\n          // Create & set an auth token from the response data\n          // Map server payload field names (time/key) to AuthToken constructor names (expiresAt/pubkey)\n          const authToken = AuthToken.create({\n            token: response.token(),\n            expiresAt: response.expiresAt(),\n            pubkey: response.pubKey(),\n            encrypt: response.encrypt()\n          }, wallet)\n          this.setAuthToken(authToken)\n          this.lastMoleculeQuery = null\n        }\n\n        return response\n      }\n\n      // The token filter matters: without it a bundle with no pointer yet falls back to its newest\n      // wallet of any token.\n      const continuId = (await this.queryContinuId({\n        bundle: this.getBundle(),\n        token: 'USER'\n      })).payload()\n\n      if (continuId && continuId.token === 'USER' && continuId.position) {\n        const pointerWallet = new Wallet({\n          secret,\n          token: 'USER',\n          position: continuId.position,\n          mlKemParameterSet: this.getMlKemParameterSet()\n        })\n\n        if (continuId.address && pointerWallet.address !== continuId.address) {\n          this.log('warn', `KnishIOClient::requestProfileAuthToken() - ContinuID wallet ${ continuId.address } is not derived from this secret at position ${ continuId.position }; signing from an AUTH wallet...`)\n        } else {\n          const response = await authorize(pointerWallet)\n\n          if (response.success()) {\n            this.log('info', `KnishIOClient::requestProfileAuthToken() - Authorization signed from the ContinuID pointer ${ continuId.position }.`)\n            return response\n          }\n\n          this.log('warn', `KnishIOClient::requestProfileAuthToken() - Authorization signed from the ContinuID pointer was rejected (${ response.reason() }); retrying once from an AUTH wallet...`)\n        }\n      }\n\n      const response = await authorize(new Wallet({\n        secret,\n        token: 'AUTH',\n        mlKemParameterSet: this.getMlKemParameterSet()\n      }))\n\n      if (!response.success()) {\n        throw new AuthorizationRejectedException(`KnishIOClient::requestProfileAuthToken() - Authorization attempt rejected by ledger. Reason: ${ response.reason() }`)\n      }\n\n      this.log('info', 'KnishIOClient::requestProfileAuthToken() - Authorization signed from a fresh AUTH wallet.')\n\n      return response\n    } finally {\n      this.$__authInProcess = previous\n    }\n  }\n\n  /**\n   * Request an auth token (guest or profile)\n   *\n   * @param secret\n   * @param seed\n   * @param cellSlug\n   * @param encrypt\n   * @returns {Promise<ResponseRequestAuthorizationGuest|ResponseRequestAuthorization|null>}\n   */\n  async requestAuthToken ({\n    secret = null,\n    seed = null,\n    cellSlug = null,\n    encrypt = false\n  }) {\n    // SDK versions 2 and below do not utilize an authorization token\n    if (this.$__serverSdkVersion < 3) {\n      this.log('warn', 'KnishIOClient::authorize() - Server SDK version does not require an authorization...')\n      return null\n    }\n\n    // Generate a secret from the seed if it has been passed\n    if (secret === null && seed) {\n      secret = generateSecret(seed)\n    }\n\n    // Set cell slug if it has been passed\n    if (cellSlug) {\n      this.setCellSlug(cellSlug)\n    }\n\n    // Retrieve secret from storage provider if available\n    if (secret === null && this.$__secretStorage && this.$__bundle) {\n      secret = await this.$__secretStorage.retrieveSecret(this.$__bundle)\n    }\n\n    // Auth in process...\n    this.$__authInProcess = true\n\n    try {\n      // Auth token response\n      let response\n\n      // Authorized user\n      if (secret) {\n        response = await this.requestProfileAuthToken({\n          secret,\n          encrypt\n        })\n      } else {\n        // Guest\n        response = await this.requestGuestAuthToken({\n          cellSlug,\n          encrypt\n        })\n      }\n\n      // Set auth token\n      this.log('info', `KnishIOClient::authorize() - Successfully retrieved auth token ${ this.$__authToken.getToken() }...`)\n\n      // Switch encryption mode if it has been changed\n      this.switchEncryption(encrypt)\n\n      // Return full response\n      return response\n    } finally {\n      // Auth process is stopped, whether the login succeeded or not\n      this.$__authInProcess = false\n    }\n  }\n\n  /**\n   * Sets the auth token\n   *\n   * @param {AuthToken} authToken\n   */\n  setAuthToken (authToken) {\n    // An empty auth token\n    if (!authToken) {\n      this.log('info', 'KnishIOClient::setAuthToken() - authToken object is empty.')\n      return\n    }\n\n    // Save auth token object to global list\n    this.$__authTokenObjects[this.getUri()] = authToken\n\n    // Set auth data to GraphQL client\n    this.client().setAuthData(authToken.getAuthData())\n\n    // Save a full auth token object with expireAt key\n    this.$__authToken = authToken\n  }\n\n  /**\n   * Returns the current authorization token\n   *\n   * @return {AuthToken}\n   */\n  getAuthToken () {\n    return this.$__authToken\n  }\n\n  /**\n   * Writes the specified message to the console.\n   * @param {string} level\n   * @param {string} message\n   */\n  log (level, message) {\n    if (this.$__logging) {\n      switch (level) {\n        case 'info':\n          console.info(message)\n          break\n        case 'warn':\n          console.warn(message)\n          break\n        case 'error':\n          console.error(message)\n          break\n        default:\n          console.log(message)\n      }\n    }\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport Response from './Response.js'\nimport Dot from '../libraries/Dot.js'\nimport InvalidResponseException from '../exception/InvalidResponseException.js'\n\n/**\n * Response for Guest Authorization Request\n */\nexport default class ResponseAuthorizationGuest extends Response {\n  /**\n   * Class constructor\n   *\n   * @param {Query} query\n   * @param {object} json\n   */\n  constructor ({\n    query,\n    json\n  }) {\n    super({\n      query,\n      json,\n      dataKey: 'data.AccessToken'\n    })\n  }\n\n  /**\n   * Returns the reason for rejection\n   *\n   * @return {string}\n   */\n  reason () {\n    return 'Invalid response from server'\n  }\n\n  /**\n   * Returns whether molecule was accepted or not\n   *\n   * @return {boolean}\n   */\n  success () {\n    return this.payload() !== null\n  }\n\n  /**\n   * Returns a wallet with balance\n   *\n   * @return {null|Wallet}\n   */\n  payload () {\n    return this.data()\n  }\n\n  /**\n   * Returns the authorization key\n   *\n   * @param key\n   * @return {*}\n   */\n  payloadKey (key) {\n    if (!Dot.has(this.payload(), key)) {\n      throw new InvalidResponseException(`ResponseAuthorizationGuest::payloadKey() - '${ key }' key is not found in the payload!`)\n    }\n    return Dot.get(this.payload(), key)\n  }\n\n  /**\n   * Returns the auth token\n   *\n   * @return {*}\n   */\n  token () {\n    return this.payloadKey('token')\n  }\n\n  /**\n   * Returns timestamp\n   *\n   * @return {*}\n   */\n  time () {\n    return this.payloadKey('time')\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { zeroizeBytes, withSecureBytes } from '../libraries/secureMemory.js'\nimport {\n  sealEnvelope,\n  openEnvelope,\n  deriveEnvelopeKey,\n  DEFAULT_ITERATIONS,\n  SECRET_KEY_PREFIX,\n  RECOVERY_KEY_PREFIX\n} from './secretEnvelope.js'\n\n/**\n * Default in-memory backend for WebCrypto encrypted payloads\n */\nexport class MemoryStorageBackend {\n  constructor () {\n    this.store = new Map()\n  }\n\n  getItem (key) {\n    return this.store.get(key) ?? null\n  }\n\n  setItem (key, value) {\n    this.store.set(key, value)\n  }\n\n  removeItem (key) {\n    return this.store.delete(key)\n  }\n\n  keys () {\n    return Array.from(this.store.keys())\n  }\n}\n\nconst textDecoder = new TextDecoder()\nconst KEY_PREFIX = SECRET_KEY_PREFIX\n\n/**\n * Software envelope-encryption secret storage provider: WebCrypto AES-256-GCM with PBKDF2-HMAC-SHA256.\n * Writes the cross-SDK envelope format; never hardware-backed.\n */\nexport default class WebCryptoSecretStorageProvider {\n  /**\n   * @param {{ backend?: object, defaultPassphrase?: string }} [options]\n   */\n  constructor (options = {}) {\n    this.providerType = 'webcrypto-aes-gcm'\n    this.backend = options.backend || new MemoryStorageBackend()\n    this.defaultPassphrase = options.defaultPassphrase\n  }\n\n  /**\n   * True only when this provider holds a non-exportable key inside platform-secure\n   * hardware (Android TEE/StrongBox, Secure Enclave, TPM) and learned that from the\n   * platform itself — never from a caller argument. Software envelope providers\n   * return false. The value is persisted as `metadata.hardwareBacked` in every\n   * envelope this provider writes.\n   *\n   * @returns {boolean}\n   */\n  isHardwareBacked () {\n    return false\n  }\n\n  /**\n   * Check if WebCrypto subtle API is available\n   *\n   * @returns {Promise<boolean>}\n   */\n  async isAvailable () {\n    return (\n      typeof globalThis.crypto !== 'undefined' &&\n      typeof globalThis.crypto.subtle !== 'undefined'\n    )\n  }\n\n  /**\n   * Derive an AES-GCM CryptoKey from a passphrase and salt using PBKDF2\n   *\n   * @param {string} passphrase\n   * @param {Uint8Array} salt\n   * @param {number} [iterations]\n   * @returns {Promise<CryptoKey>}\n   */\n  async deriveKey (passphrase, salt, iterations = DEFAULT_ITERATIONS) {\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebCrypto API is not available')\n    }\n    return await deriveEnvelopeKey(passphrase, salt, iterations)\n  }\n\n  /**\n   * Store and encrypt a master secret\n   *\n   * @param {string} bundleHash\n   * @param {string} secret\n   * @param {{ label?: string, passphrase?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async storeSecret (bundleHash, secret, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!secret) {\n      throw new SecretStorageException('Secret cannot be empty')\n    }\n\n    const passphrase = options.passphrase || this.defaultPassphrase\n    if (!passphrase) {\n      throw new SecretStorageException('Passphrase required for envelope encryption')\n    }\n\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebCrypto API is not available')\n    }\n\n    try {\n      const metadata = {\n        bundleHash,\n        label: options.label,\n        createdAt: Date.now(),\n        hardwareBacked: false,\n        providerType: this.providerType\n      }\n\n      const payload = await sealEnvelope(secret, passphrase, metadata)\n      await this.backend.setItem(`${KEY_PREFIX}${bundleHash}`, JSON.stringify(payload))\n\n      if (options.recoveryPassphrase) {\n        const recoveryMetadata = {\n          bundleHash,\n          label: options.label,\n          createdAt: Date.now(),\n          hardwareBacked: false,\n          providerType: 'webcrypto-aes-gcm'\n        }\n        const recoveryPayload = await sealEnvelope(secret, options.recoveryPassphrase, recoveryMetadata)\n        await this.backend.setItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`, JSON.stringify(recoveryPayload))\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw new SecretStorageException(`Encryption failed: ${msg}`)\n    }\n  }\n\n  /**\n   * Retrieve and decrypt the master secret\n   *\n   * @param {string} bundleHash\n   * @param {{ passphrase?: string }} [options]\n   * @returns {Promise<string|null>}\n   */\n  async retrieveSecret (bundleHash, options = {}) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      return null\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = options.passphrase || this.defaultPassphrase\n    if (!passphrase) {\n      throw new SecretStorageException('Passphrase required for secret decryption')\n    }\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebCrypto API is not available')\n    }\n\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      try {\n        return textDecoder.decode(decryptedBytes)\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  /**\n   * Delete a stored secret\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<boolean>}\n   */\n  async deleteSecret (bundleHash) {\n    const key = `${KEY_PREFIX}${bundleHash}`\n    const recoveryKey = `${RECOVERY_KEY_PREFIX}${bundleHash}`\n    const result = await this.backend.removeItem(key)\n    await this.backend.removeItem(recoveryKey)\n    return result !== false\n  }\n\n  /**\n   * Check if a secret exists\n   *\n   * @param {string} bundleHash\n   * @returns {Promise<boolean>}\n   */\n  async hasSecret (bundleHash) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    return raw !== null\n  }\n\n  /**\n   * List all stored secret metadata\n   *\n   * @returns {Promise<Array<{ bundleHash: string, label?: string, createdAt: number, hardwareBacked: boolean, providerType: string }>>}\n   */\n  async listSecrets () {\n    const keys = await this.backend.keys()\n    const matchingKeys = keys.filter(k => k.startsWith(KEY_PREFIX) && !k.startsWith(RECOVERY_KEY_PREFIX))\n    const results = []\n\n    for (const key of matchingKeys) {\n      const raw = await this.backend.getItem(key)\n      if (raw) {\n        try {\n          const payload = JSON.parse(raw)\n          if (payload.metadata) {\n            results.push(payload.metadata)\n          }\n        } catch {\n          // Ignore corrupted entries\n        }\n      }\n    }\n\n    return results\n  }\n\n  /**\n   * Execute callback with unwrapped secret, zeroizing the decrypted buffer upon completion\n   *\n   * @template T\n   * @param {string} bundleHash\n   * @param {(secret: string) => Promise<T>|T} fn\n   * @param {{ passphrase?: string }} [options]\n   * @returns {Promise<T>}\n   */\n  async withSecret (bundleHash, fn, options = {}) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = options.passphrase || this.defaultPassphrase\n    if (!passphrase) {\n      throw new SecretStorageException('Passphrase required for secret decryption')\n    }\n\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebCrypto API is not available')\n    }\n\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      return await withSecureBytes(decryptedBytes, async (bytes) => {\n        const secretString = textDecoder.decode(bytes)\n        return await fn(secretString)\n      })\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  /**\n   * Recover a secret using its recovery envelope and re-enroll it\n   *\n   * @param {string} bundleHash\n   * @param {string} recoveryPassphrase\n   * @param {{ label?: string, passphrase?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async recoverSecret (bundleHash, recoveryPassphrase, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!recoveryPassphrase) {\n      throw new SecretStorageException('Recovery passphrase cannot be empty')\n    }\n\n    const raw = await this.backend.getItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted recovery payload format')\n    }\n\n    let decryptedBytes\n    try {\n      decryptedBytes = await openEnvelope(payload, recoveryPassphrase)\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n\n    let secretStr\n    try {\n      secretStr = textDecoder.decode(decryptedBytes)\n    } finally {\n      zeroizeBytes(decryptedBytes)\n    }\n\n    const storePassphrase = options.passphrase || this.defaultPassphrase || recoveryPassphrase\n    await this.storeSecret(bundleHash, secretStr, {\n      ...options,\n      passphrase: storePassphrase,\n      recoveryPassphrase\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\n\n/**\n * Node-only persistent file storage backend.\n * Stores key-value entries in a JSON file with restrictive permissions (0o600).\n * Uses temporary file writing followed by atomic rename to prevent corruption.\n */\nexport default class FileStorageBackend {\n  /**\n   * @param {string} filePath\n   */\n  constructor (filePath) {\n    if (!filePath) {\n      throw new SecretStorageException('Storage file path cannot be empty')\n    }\n    this.filePath = filePath\n    this.store = new Map()\n    this.loaded = false\n  }\n\n  /**\n   * @private\n   */\n  async getFs () {\n    try {\n      // Platform-specific: node:fs and node:path do not exist in browser runtimes\n      // and cannot be statically imported without breaking browser bundles.\n      const fs = await import('node:fs/promises')\n      const path = await import('node:path')\n      return { fs, path }\n    } catch {\n      throw SecretStorageException.unavailable(\n        'file-storage',\n        'FileStorageBackend is only supported in Node.js environments with node:fs access'\n      )\n    }\n  }\n\n  /**\n   * @private\n   */\n  async ensureLoaded () {\n    if (this.loaded) {\n      return this.store\n    }\n\n    const { fs } = await this.getFs()\n\n    try {\n      const content = await fs.readFile(this.filePath, 'utf8')\n      let parsed\n      try {\n        parsed = JSON.parse(content)\n      } catch {\n        throw SecretStorageException.decryptionFailed('Corrupted storage file format')\n      }\n\n      if (parsed && typeof parsed === 'object') {\n        this.store = new Map(Object.entries(parsed).map(([k, v]) => [k, String(v)]))\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      if (err?.code !== 'ENOENT') {\n        const msg = err instanceof Error ? err.message : String(err)\n        throw new SecretStorageException(`Failed to read storage file: ${msg}`)\n      }\n      this.store = new Map()\n    }\n\n    this.loaded = true\n    return this.store\n  }\n\n  /**\n   * @private\n   */\n  async persist () {\n    const { fs, path } = await this.getFs()\n\n    const dir = path.dirname(this.filePath)\n    if (dir && dir !== '.') {\n      await fs.mkdir(dir, { recursive: true })\n    }\n\n    const tmpPath = `${this.filePath}.tmp.${Date.now()}_${Math.random().toString(36).slice(2)}`\n    const data = JSON.stringify(Object.fromEntries(this.store), null, 2)\n\n    try {\n      await fs.writeFile(tmpPath, data, { mode: 0o600, encoding: 'utf8' })\n      if (typeof process !== 'undefined' && process.platform !== 'win32') {\n        try {\n          await fs.chmod(tmpPath, 0o600)\n        } catch {\n          // Ignore chmod error if file system does not support it\n        }\n      }\n      await fs.rename(tmpPath, this.filePath)\n    } catch (err) {\n      try {\n        await fs.unlink(tmpPath)\n      } catch {\n        // Ignore cleanup error\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw new SecretStorageException(`Failed to persist storage file: ${msg}`)\n    }\n  }\n\n  /**\n   * @param {string} key\n   * @returns {Promise<string|null>}\n   */\n  async getItem (key) {\n    await this.ensureLoaded()\n    return this.store.get(key) ?? null\n  }\n\n  /**\n   * @param {string} key\n   * @param {string} value\n   * @returns {Promise<void>}\n   */\n  async setItem (key, value) {\n    await this.ensureLoaded()\n    this.store.set(key, value)\n    await this.persist()\n  }\n\n  /**\n   * @param {string} key\n   * @returns {Promise<boolean>}\n   */\n  async removeItem (key) {\n    await this.ensureLoaded()\n    const existed = this.store.delete(key)\n    if (existed) {\n      await this.persist()\n    }\n    return existed\n  }\n\n  /**\n   * @returns {Promise<string[]>}\n   */\n  async keys () {\n    await this.ensureLoaded()\n    return Array.from(this.store.keys())\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\n\n/**\n * Browser persistent storage backend wrapping Web Storage (localStorage or sessionStorage).\n * Adapts the Web Storage API (length + key(i)) to IStorageBackend.keys(), filtering\n * by a prefix (defaults to 'knishio:') so unrelated items are ignored.\n */\nexport default class WebStorageBackend {\n  /**\n   * @param {Storage} [storage]\n   * @param {string} [prefix]\n   */\n  constructor (storage, prefix = 'knishio:') {\n    if (storage) {\n      this.storage = storage\n    } else if (typeof globalThis !== 'undefined' && globalThis.localStorage) {\n      this.storage = globalThis.localStorage\n    } else {\n      throw SecretStorageException.unavailable(\n        'web-storage',\n        'WebStorageBackend requires a Storage object or global localStorage'\n      )\n    }\n    this.prefix = prefix\n  }\n\n  /**\n   * @param {string} key\n   * @returns {string|null}\n   */\n  getItem (key) {\n    return this.storage.getItem(key)\n  }\n\n  /**\n   * @param {string} key\n   * @param {string} value\n   */\n  setItem (key, value) {\n    this.storage.setItem(key, value)\n  }\n\n  /**\n   * @param {string} key\n   * @returns {boolean}\n   */\n  removeItem (key) {\n    const existed = this.storage.getItem(key) !== null\n    this.storage.removeItem(key)\n    return existed\n  }\n\n  /**\n   * @returns {string[]}\n   */\n  keys () {\n    const result = []\n    const len = this.storage.length\n    for (let i = 0; i < len; i++) {\n      const k = this.storage.key(i)\n      if (k !== null) {\n        if (!this.prefix || k.startsWith(this.prefix)) {\n          result.push(k)\n        }\n      }\n    }\n    return result\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                            (//////////(                      (////)\n                            (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { zeroizeBytes, withSecureBytes } from '../libraries/secureMemory.js'\nimport {\n  sealEnvelope,\n  openEnvelope,\n  uint8ArrayToBase64,\n  base64ToUint8Array,\n  SECRET_KEY_PREFIX,\n  RECOVERY_KEY_PREFIX\n} from './secretEnvelope.js'\n\nexport const PRF_SALT_LABEL = 'knishio:secret-storage:webauthn-prf:v1'\nexport const KEK_INFO = 'knishio:secret-storage:kek:v1'\nconst KEY_PREFIX = SECRET_KEY_PREFIX\nconst GCM_IV_LENGTH = 12\n\nconst textEncoder = new TextEncoder()\nconst textDecoder = new TextDecoder()\n\nfunction base64UrlEncode (bytes) {\n  return uint8ArrayToBase64(bytes)\n    .replace(/\\+/g, '-')\n    .replace(/\\//g, '_')\n    .replace(/=+$/, '')\n}\n\nfunction base64UrlDecode (str) {\n  let base64 = str.replace(/-/g, '+').replace(/_/g, '/')\n  while (base64.length % 4 !== 0) {\n    base64 += '='\n  }\n  return base64ToUint8Array(base64)\n}\n\nfunction toUint8Array (buf) {\n  if (buf instanceof Uint8Array) {\n    return buf\n  }\n  if (ArrayBuffer.isView(buf)) {\n    return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength)\n  }\n  return new Uint8Array(buf)\n}\n\nasync function computePrfSalt () {\n  const hash = await globalThis.crypto.subtle.digest('SHA-256', textEncoder.encode(PRF_SALT_LABEL))\n  return new Uint8Array(hash)\n}\n\nasync function deriveKekFromPrf (prfOutput, prfSalt) {\n  const hkdfKey = await globalThis.crypto.subtle.importKey(\n    'raw',\n    prfOutput,\n    'HKDF',\n    false,\n    ['deriveKey']\n  )\n\n  return await globalThis.crypto.subtle.deriveKey(\n    {\n      name: 'HKDF',\n      hash: 'SHA-256',\n      salt: prfSalt,\n      info: textEncoder.encode(KEK_INFO)\n    },\n    hkdfKey,\n    { name: 'AES-GCM', length: 256 },\n    false,\n    ['encrypt', 'decrypt']\n  )\n}\n\n/**\n * Hardware-attested passkey PRF secret storage provider.\n * Wraps a random device passphrase under a KEK derived from the WebAuthn PRF extension.\n */\nexport default class WebAuthnPrfSecretStorageProvider {\n  /**\n   * @param {object} options\n   * @param {object} options.backend\n   * @param {{ id?: string, name: string }} options.rp\n   * @param {{ id: Uint8Array, name: string, displayName: string }} options.user\n   * @param {object} [options.credentials]\n   * @param {string} [options.alias]\n   */\n  constructor (options) {\n    this.providerType = 'webauthn-prf'\n    this.backend = options.backend\n    this.rp = options.rp\n    this.user = options.user\n    this.credentialsContainer = options.credentials\n    this.alias = options.alias || 'default'\n    this.cachedPassphrase = undefined\n  }\n\n  get credentials () {\n    if (this.credentialsContainer) {\n      return this.credentialsContainer\n    }\n    if (typeof globalThis.navigator !== 'undefined' && globalThis.navigator.credentials) {\n      return globalThis.navigator.credentials\n    }\n    throw SecretStorageException.unavailable(\n      this.providerType,\n      'WebAuthn credentials container is not available'\n    )\n  }\n\n  get recordKey () {\n    return `knishio:webauthn-prf:${this.alias}`\n  }\n\n  isHardwareBacked () {\n    // The PRF secret is bound to the authenticator hardware, but the derived KEK\n    // material is handled by page JS and passkey attestation is not verified here.\n    return false\n  }\n\n  async isAvailable () {\n    const hasWebCrypto =\n      typeof globalThis.crypto !== 'undefined' &&\n      typeof globalThis.crypto.subtle !== 'undefined'\n    const hasCredentials = Boolean(\n      this.credentialsContainer ||\n      (typeof globalThis.navigator !== 'undefined' &&\n        globalThis.navigator.credentials &&\n        typeof globalThis.PublicKeyCredential !== 'undefined')\n    )\n    return hasWebCrypto && hasCredentials\n  }\n\n  /**\n   * Enroll a new passkey credential with PRF support and wrap a random device passphrase\n   */\n  async enroll () {\n    const existing = await this.backend.getItem(this.recordKey)\n    if (existing) {\n      return\n    }\n\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(this.providerType, 'WebAuthn PRF is not available')\n    }\n\n    const challenge = new Uint8Array(32)\n    globalThis.crypto.getRandomValues(challenge)\n\n    const credential = await this.credentials.create({\n      publicKey: {\n        rp: this.rp,\n        user: {\n          id: this.user.id,\n          name: this.user.name,\n          displayName: this.user.displayName\n        },\n        challenge,\n        pubKeyCredParams: [\n          { type: 'public-key', alg: -7 },\n          { type: 'public-key', alg: -257 }\n        ],\n        authenticatorSelection: {\n          residentKey: 'required',\n          userVerification: 'required'\n        },\n        extensions: {\n          prf: {}\n        }\n      }\n    })\n\n    if (!credential) {\n      throw SecretStorageException.unavailable(this.providerType, 'Authenticator creation returned null')\n    }\n\n    const extResults = credential.getClientExtensionResults?.()\n    if (extResults?.prf?.enabled !== true) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator does not support the PRF extension'\n      )\n    }\n\n    const credentialIdBytes = new Uint8Array(credential.rawId)\n    const prfSalt = await computePrfSalt()\n\n    const getChallenge = new Uint8Array(32)\n    globalThis.crypto.getRandomValues(getChallenge)\n\n    let assertion\n    try {\n      assertion = await this.credentials.get({\n        publicKey: {\n          challenge: getChallenge,\n          rpId: this.rp.id,\n          allowCredentials: [\n            {\n              type: 'public-key',\n              id: credentialIdBytes\n            }\n          ],\n          userVerification: 'required',\n          extensions: {\n            prf: {\n              eval: {\n                first: prfSalt\n              }\n            }\n          }\n        }\n      })\n    } catch (err) {\n      if (err?.name === 'NotAllowedError') {\n        throw SecretStorageException.unavailable(\n          this.providerType,\n          'authenticator refused or credential missing'\n        )\n      }\n      throw err\n    }\n\n    if (!assertion) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator refused or credential missing'\n      )\n    }\n\n    const getExtResults = assertion?.getClientExtensionResults?.()\n    const firstOutput = getExtResults?.prf?.results?.first\n    if (!firstOutput) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator returned no PRF result'\n      )\n    }\n\n    const prfBytes = toUint8Array(firstOutput)\n    const kek = await deriveKekFromPrf(prfBytes, prfSalt)\n\n    const devicePassphraseBytes = new Uint8Array(32)\n    globalThis.crypto.getRandomValues(devicePassphraseBytes)\n    const devicePassphrase = uint8ArrayToBase64(devicePassphraseBytes)\n\n    const iv = new Uint8Array(GCM_IV_LENGTH)\n    globalThis.crypto.getRandomValues(iv)\n\n    const passphraseBytes = textEncoder.encode(devicePassphrase)\n    try {\n      const encryptedBuffer = await globalThis.crypto.subtle.encrypt(\n        {\n          name: 'AES-GCM',\n          iv\n        },\n        kek,\n        passphraseBytes\n      )\n\n      const record = {\n        version: 1,\n        credentialId: base64UrlEncode(credentialIdBytes),\n        iv: uint8ArrayToBase64(iv),\n        ciphertext: uint8ArrayToBase64(new Uint8Array(encryptedBuffer))\n      }\n\n      await this.backend.setItem(this.recordKey, JSON.stringify(record))\n      this.cachedPassphrase = devicePassphrase\n    } finally {\n      zeroizeBytes(passphraseBytes)\n      zeroizeBytes(devicePassphraseBytes)\n    }\n  }\n\n  /**\n   * Unlock the device passphrase using the enrolled WebAuthn PRF credential\n   */\n  async unlock () {\n    if (this.cachedPassphrase) {\n      return this.cachedPassphrase\n    }\n\n    const rawRecord = await this.backend.getItem(this.recordKey)\n    if (!rawRecord) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'no enrolled credential; call enroll() first'\n      )\n    }\n\n    let record\n    try {\n      record = JSON.parse(rawRecord)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted PRF record format')\n    }\n\n    const credentialIdBytes = base64UrlDecode(record.credentialId)\n    const prfSalt = await computePrfSalt()\n\n    const challenge = new Uint8Array(32)\n    globalThis.crypto.getRandomValues(challenge)\n\n    let assertion\n    try {\n      assertion = await this.credentials.get({\n        publicKey: {\n          challenge,\n          rpId: this.rp.id,\n          allowCredentials: [\n            {\n              type: 'public-key',\n              id: credentialIdBytes\n            }\n          ],\n          userVerification: 'required',\n          extensions: {\n            prf: {\n              eval: {\n                first: prfSalt\n              }\n            }\n          }\n        }\n      })\n    } catch (err) {\n      if (err?.name === 'NotAllowedError') {\n        throw SecretStorageException.unavailable(\n          this.providerType,\n          'authenticator refused or credential missing'\n        )\n      }\n      throw err\n    }\n\n    if (!assertion) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator refused or credential missing'\n      )\n    }\n\n    const extResults = assertion?.getClientExtensionResults?.()\n    const firstOutput = extResults?.prf?.results?.first\n    if (!firstOutput) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'authenticator returned no PRF result'\n      )\n    }\n\n    const prfBytes = toUint8Array(firstOutput)\n    const kek = await deriveKekFromPrf(prfBytes, prfSalt)\n\n    const iv = base64ToUint8Array(record.iv)\n    const ciphertext = base64ToUint8Array(record.ciphertext)\n\n    try {\n      const decryptedBuffer = await globalThis.crypto.subtle.decrypt(\n        {\n          name: 'AES-GCM',\n          iv\n        },\n        kek,\n        ciphertext\n      )\n\n      const decryptedBytes = new Uint8Array(decryptedBuffer)\n      try {\n        this.cachedPassphrase = textDecoder.decode(decryptedBytes)\n        return this.cachedPassphrase\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch {\n      throw SecretStorageException.decryptionFailed(\n        'wrapped device passphrase failed authentication under the enrolled credential'\n      )\n    }\n  }\n\n  /**\n   * Lock the provider by clearing cached passphrase material\n   */\n  lock () {\n    this.cachedPassphrase = undefined\n  }\n\n  /**\n   * Unenroll the current credential, removing the stored PRF record and clearing cached passphrase\n   *\n   * @returns {Promise<void>}\n   */\n  async unenroll () {\n    this.lock()\n    await this.backend.removeItem(this.recordKey)\n  }\n\n  async storeSecret (bundleHash, secret, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!secret) {\n      throw new SecretStorageException('Secret cannot be empty')\n    }\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'WebAuthnPrfSecretStorageProvider derives its passphrase from the authenticator; options.passphrase is not accepted'\n      )\n    }\n\n    if (!options.recoveryPassphrase && !options.allowUnrecoverable) {\n      throw SecretStorageException.validationError(\n        'Recovery passphrase required for non-exportable hardware key unless allowUnrecoverable is true'\n      )\n    }\n\n    const passphrase = await this.unlock()\n    const metadata = {\n      bundleHash,\n      label: options.label,\n      createdAt: Date.now(),\n      hardwareBacked: false,\n      providerType: this.providerType\n    }\n\n    const payload = await sealEnvelope(secret, passphrase, metadata)\n    await this.backend.setItem(`${KEY_PREFIX}${bundleHash}`, JSON.stringify(payload))\n\n    if (options.recoveryPassphrase) {\n      const recoveryMetadata = {\n        bundleHash,\n        label: options.label,\n        createdAt: Date.now(),\n        hardwareBacked: false,\n        providerType: 'webcrypto-aes-gcm'\n      }\n      const recoveryPayload = await sealEnvelope(secret, options.recoveryPassphrase, recoveryMetadata)\n      await this.backend.setItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`, JSON.stringify(recoveryPayload))\n    }\n  }\n\n  async retrieveSecret (bundleHash, options = {}) {\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'WebAuthnPrfSecretStorageProvider derives its passphrase from the authenticator; options.passphrase is not accepted'\n      )\n    }\n\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      return null\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = await this.unlock()\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      try {\n        return textDecoder.decode(decryptedBytes)\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  async withSecret (bundleHash, fn, options = {}) {\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'WebAuthnPrfSecretStorageProvider derives its passphrase from the authenticator; options.passphrase is not accepted'\n      )\n    }\n\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = await this.unlock()\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      return await withSecureBytes(decryptedBytes, async (bytes) => {\n        const secretString = textDecoder.decode(bytes)\n        return await fn(secretString)\n      })\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  async deleteSecret (bundleHash) {\n    const key = `${KEY_PREFIX}${bundleHash}`\n    const recoveryKey = `${RECOVERY_KEY_PREFIX}${bundleHash}`\n    const result = await this.backend.removeItem(key)\n    await this.backend.removeItem(recoveryKey)\n    return result !== false\n  }\n\n  async hasSecret (bundleHash) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    return raw !== null\n  }\n\n  async listSecrets () {\n    const keys = await this.backend.keys()\n    const matchingKeys = keys.filter(k => k.startsWith(KEY_PREFIX) && !k.startsWith(RECOVERY_KEY_PREFIX))\n    const results = []\n\n    for (const key of matchingKeys) {\n      const raw = await this.backend.getItem(key)\n      if (raw) {\n        try {\n          const payload = JSON.parse(raw)\n          if (payload.metadata) {\n            results.push(payload.metadata)\n          }\n        } catch {\n          // Ignore unparseable entries\n        }\n      }\n    }\n\n    return results\n  }\n\n  /**\n   * Recover a secret using its recovery envelope and re-enroll it under a fresh WebAuthn PRF credential\n   *\n   * @param {string} bundleHash\n   * @param {string} recoveryPassphrase\n   * @param {{ label?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async recoverSecret (bundleHash, recoveryPassphrase, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!recoveryPassphrase) {\n      throw new SecretStorageException('Recovery passphrase cannot be empty')\n    }\n\n    const raw = await this.backend.getItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted recovery payload format')\n    }\n\n    let decryptedBytes\n    try {\n      decryptedBytes = await openEnvelope(payload, recoveryPassphrase)\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n\n    let secretStr\n    try {\n      secretStr = textDecoder.decode(decryptedBytes)\n    } finally {\n      zeroizeBytes(decryptedBytes)\n    }\n\n    await this.storeSecret(bundleHash, secretStr, {\n      ...options,\n      recoveryPassphrase\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                            (//////////(                      (////)\n                            (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nimport SecretStorageException from '../exception/SecretStorageException.js'\nimport { zeroizeBytes, withSecureBytes } from '../libraries/secureMemory.js'\nimport {\n  sealEnvelope,\n  openEnvelope,\n  uint8ArrayToBase64,\n  base64ToUint8Array,\n  SECRET_KEY_PREFIX,\n  RECOVERY_KEY_PREFIX\n} from './secretEnvelope.js'\n\nconst KEY_PREFIX = SECRET_KEY_PREFIX\nconst GCM_IV_LENGTH = 12\n\nconst textEncoder = new TextEncoder()\nconst textDecoder = new TextDecoder()\n\n/**\n * In-memory key store for tests and non-browser environments\n */\nexport class MemoryKeyStore {\n  constructor () {\n    this.keys = new Map()\n  }\n\n  async get (name) {\n    return this.keys.get(name)\n  }\n\n  async put (name, key) {\n    this.keys.set(name, key)\n  }\n\n  async delete (name) {\n    return this.keys.delete(name)\n  }\n}\n\n/**\n * IndexedDB key store for browser environments\n */\nexport class IndexedDbKeyStore {\n  constructor (dbName = 'knishio-secret-storage') {\n    this.dbName = dbName\n    this.storeName = 'keys'\n  }\n\n  async getDb () {\n    if (typeof globalThis.indexedDB === 'undefined') {\n      throw SecretStorageException.unavailable(\n        'webcrypto-nonextractable',\n        'IndexedDB is not available'\n      )\n    }\n\n    return new Promise((resolve, reject) => {\n      const request = globalThis.indexedDB.open(this.dbName, 1)\n      request.onupgradeneeded = () => {\n        const db = request.result\n        if (!db.objectStoreNames.contains(this.storeName)) {\n          db.createObjectStore(this.storeName)\n        }\n      }\n      request.onsuccess = () => resolve(request.result)\n      request.onerror = () => reject(request.error)\n    })\n  }\n\n  async get (name) {\n    const db = await this.getDb()\n    return new Promise((resolve, reject) => {\n      const tx = db.transaction(this.storeName, 'readonly')\n      const store = tx.objectStore(this.storeName)\n      const request = store.get(name)\n      request.onsuccess = () => resolve(request.result)\n      request.onerror = () => reject(request.error)\n    })\n  }\n\n  async put (name, key) {\n    const db = await this.getDb()\n    return new Promise((resolve, reject) => {\n      const tx = db.transaction(this.storeName, 'readwrite')\n      const store = tx.objectStore(this.storeName)\n      const request = store.put(key, name)\n      request.onsuccess = () => resolve()\n      request.onerror = () => reject(request.error)\n    })\n  }\n\n  async delete (name) {\n    const db = await this.getDb()\n    return new Promise((resolve, reject) => {\n      const tx = db.transaction(this.storeName, 'readwrite')\n      const store = tx.objectStore(this.storeName)\n      const request = store.delete(name)\n      request.onsuccess = () => resolve(true)\n      request.onerror = () => reject(request.error)\n    })\n  }\n}\n\n/**\n * Secret storage provider backed by a non-extractable CryptoKey stored in IndexedDB.\n * The KEK cannot be exported from the browser's WebCrypto context.\n */\nexport default class NonExtractableKeySecretStorageProvider {\n  /**\n   * @param {object} options\n   * @param {object} options.backend\n   * @param {object} [options.keyStore]\n   * @param {string} [options.alias]\n   */\n  constructor (options) {\n    this.providerType = 'webcrypto-nonextractable'\n    this.backend = options.backend\n    this.keyStore = options.keyStore || new IndexedDbKeyStore()\n    this.alias = options.alias || 'default'\n    this.cachedPassphrase = undefined\n  }\n\n  get recordKey () {\n    return `knishio:kek:webcrypto-nonextractable:${this.alias}`\n  }\n\n  get kekStoreKey () {\n    return `knishio:kek:${this.alias}`\n  }\n\n  isHardwareBacked () {\n    // Non-extractable WebCrypto keys prevent JS extraction, but are not verified\n    // hardware-enclave keys.\n    return false\n  }\n\n  async isAvailable () {\n    return (\n      typeof globalThis.crypto !== 'undefined' &&\n      typeof globalThis.crypto.subtle !== 'undefined'\n    )\n  }\n\n  /**\n   * Unlock or initialize the device passphrase using the non-extractable KEK\n   */\n  async unlock () {\n    if (this.cachedPassphrase) {\n      return this.cachedPassphrase\n    }\n\n    if (!await this.isAvailable()) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        'WebCrypto API is not available'\n      )\n    }\n\n    const rawRecord = await this.backend.getItem(this.recordKey)\n    if (!rawRecord) {\n      // First use: create non-extractable KEK and wrap new device passphrase\n      let kek = await this.keyStore.get(this.kekStoreKey)\n      if (!kek) {\n        kek = await globalThis.crypto.subtle.generateKey(\n          { name: 'AES-GCM', length: 256 },\n          false,\n          ['encrypt', 'decrypt']\n        )\n        await this.keyStore.put(this.kekStoreKey, kek)\n      }\n\n      const devicePassphraseBytes = new Uint8Array(32)\n      globalThis.crypto.getRandomValues(devicePassphraseBytes)\n      const devicePassphrase = uint8ArrayToBase64(devicePassphraseBytes)\n\n      const iv = new Uint8Array(GCM_IV_LENGTH)\n      globalThis.crypto.getRandomValues(iv)\n\n      const passphraseBytes = textEncoder.encode(devicePassphrase)\n      try {\n        const encryptedBuffer = await globalThis.crypto.subtle.encrypt(\n          {\n            name: 'AES-GCM',\n            iv\n          },\n          kek,\n          passphraseBytes\n        )\n\n        const record = {\n          version: 1,\n          iv: uint8ArrayToBase64(iv),\n          ciphertext: uint8ArrayToBase64(new Uint8Array(encryptedBuffer))\n        }\n\n        await this.backend.setItem(this.recordKey, JSON.stringify(record))\n        this.cachedPassphrase = devicePassphrase\n        return devicePassphrase\n      } finally {\n        zeroizeBytes(passphraseBytes)\n        zeroizeBytes(devicePassphraseBytes)\n      }\n    }\n\n    // Subsequent use: unwrap device passphrase with stored KEK\n    let record\n    try {\n      record = JSON.parse(rawRecord)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted key record format')\n    }\n\n    const kek = await this.keyStore.get(this.kekStoreKey)\n    if (!kek) {\n      throw SecretStorageException.unavailable(\n        this.providerType,\n        `no non-extractable key found for alias '${this.alias}'`\n      )\n    }\n\n    const iv = base64ToUint8Array(record.iv)\n    const ciphertext = base64ToUint8Array(record.ciphertext)\n\n    try {\n      const decryptedBuffer = await globalThis.crypto.subtle.decrypt(\n        {\n          name: 'AES-GCM',\n          iv\n        },\n        kek,\n        ciphertext\n      )\n\n      const decryptedBytes = new Uint8Array(decryptedBuffer)\n      try {\n        this.cachedPassphrase = textDecoder.decode(decryptedBytes)\n        return this.cachedPassphrase\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch {\n      throw SecretStorageException.decryptionFailed(\n        'wrapped device passphrase failed authentication under non-extractable key'\n      )\n    }\n  }\n\n  /**\n   * Lock the provider by clearing cached passphrase material\n   */\n  lock () {\n    this.cachedPassphrase = undefined\n  }\n\n  /**\n   * Unenroll the non-extractable key, removing the stored wrapped record and KEK\n   *\n   * @returns {Promise<void>}\n   */\n  async unenroll () {\n    this.lock()\n    await this.backend.removeItem(this.recordKey)\n    await this.keyStore.delete(this.kekStoreKey)\n  }\n\n  async storeSecret (bundleHash, secret, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!secret) {\n      throw new SecretStorageException('Secret cannot be empty')\n    }\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'NonExtractableKeySecretStorageProvider derives its passphrase from the non-extractable device key; options.passphrase is not accepted'\n      )\n    }\n\n    if (!options.recoveryPassphrase && !options.allowUnrecoverable) {\n      throw SecretStorageException.validationError(\n        'Recovery passphrase required for non-exportable hardware key unless allowUnrecoverable is true'\n      )\n    }\n\n    const passphrase = await this.unlock()\n    const metadata = {\n      bundleHash,\n      label: options.label,\n      createdAt: Date.now(),\n      hardwareBacked: false,\n      providerType: this.providerType\n    }\n\n    const payload = await sealEnvelope(secret, passphrase, metadata)\n    await this.backend.setItem(`${KEY_PREFIX}${bundleHash}`, JSON.stringify(payload))\n\n    if (options.recoveryPassphrase) {\n      const recoveryMetadata = {\n        bundleHash,\n        label: options.label,\n        createdAt: Date.now(),\n        hardwareBacked: false,\n        providerType: 'webcrypto-aes-gcm'\n      }\n      const recoveryPayload = await sealEnvelope(secret, options.recoveryPassphrase, recoveryMetadata)\n      await this.backend.setItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`, JSON.stringify(recoveryPayload))\n    }\n  }\n\n  async retrieveSecret (bundleHash, options = {}) {\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'NonExtractableKeySecretStorageProvider derives its passphrase from the non-extractable device key; options.passphrase is not accepted'\n      )\n    }\n\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      return null\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = await this.unlock()\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      try {\n        return textDecoder.decode(decryptedBytes)\n      } finally {\n        zeroizeBytes(decryptedBytes)\n      }\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  async withSecret (bundleHash, fn, options = {}) {\n    if (options.passphrase) {\n      throw new SecretStorageException(\n        'NonExtractableKeySecretStorageProvider derives its passphrase from the non-extractable device key; options.passphrase is not accepted'\n      )\n    }\n\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted payload format')\n    }\n\n    const passphrase = await this.unlock()\n    try {\n      const decryptedBytes = await openEnvelope(payload, passphrase)\n      return await withSecureBytes(decryptedBytes, async (bytes) => {\n        const secretString = textDecoder.decode(bytes)\n        return await fn(secretString)\n      })\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n  }\n\n  async deleteSecret (bundleHash) {\n    const key = `${KEY_PREFIX}${bundleHash}`\n    const recoveryKey = `${RECOVERY_KEY_PREFIX}${bundleHash}`\n    const result = await this.backend.removeItem(key)\n    await this.backend.removeItem(recoveryKey)\n    return result !== false\n  }\n\n  async hasSecret (bundleHash) {\n    const raw = await this.backend.getItem(`${KEY_PREFIX}${bundleHash}`)\n    return raw !== null\n  }\n\n  async listSecrets () {\n    const keys = await this.backend.keys()\n    const matchingKeys = keys.filter(k => k.startsWith(KEY_PREFIX) && !k.startsWith(RECOVERY_KEY_PREFIX))\n    const results = []\n\n    for (const key of matchingKeys) {\n      const raw = await this.backend.getItem(key)\n      if (raw) {\n        try {\n          const payload = JSON.parse(raw)\n          if (payload.metadata) {\n            results.push(payload.metadata)\n          }\n        } catch {\n          // Ignore unparseable entries\n        }\n      }\n    }\n\n    return results\n  }\n\n  /**\n   * Recover a secret using its recovery envelope and re-enroll it under a fresh non-extractable KEK\n   *\n   * @param {string} bundleHash\n   * @param {string} recoveryPassphrase\n   * @param {{ label?: string }} [options]\n   * @returns {Promise<void>}\n   */\n  async recoverSecret (bundleHash, recoveryPassphrase, options = {}) {\n    if (!bundleHash) {\n      throw new SecretStorageException('Bundle hash cannot be empty')\n    }\n    if (!recoveryPassphrase) {\n      throw new SecretStorageException('Recovery passphrase cannot be empty')\n    }\n\n    const raw = await this.backend.getItem(`${RECOVERY_KEY_PREFIX}${bundleHash}`)\n    if (!raw) {\n      throw SecretStorageException.notFound(bundleHash)\n    }\n\n    let payload\n    try {\n      payload = JSON.parse(raw)\n    } catch {\n      throw SecretStorageException.decryptionFailed('Corrupted recovery payload format')\n    }\n\n    let decryptedBytes\n    try {\n      decryptedBytes = await openEnvelope(payload, recoveryPassphrase)\n    } catch (err) {\n      if (err instanceof SecretStorageException) {\n        throw err\n      }\n      const msg = err instanceof Error ? err.message : String(err)\n      throw SecretStorageException.decryptionFailed(msg)\n    }\n\n    let secretStr\n    try {\n      secretStr = textDecoder.decode(decryptedBytes)\n    } finally {\n      zeroizeBytes(decryptedBytes)\n    }\n\n    await this.storeSecret(bundleHash, secretStr, {\n      ...options,\n      recoveryPassphrase\n    })\n  }\n}\n","/*\n                               (\n                              (/(\n                              (//(\n                              (///(\n                             (/////(\n                             (//////(                          )\n                            (////////(                        (/)\n                            (////////(                       (///)\n                           (//////////(                      (////)\n                           (//////////(                     (//////)\n                          (////////////(                    (///////)\n                         (/////////////(                   (/////////)\n                        (//////////////(                  (///////////)\n                        (///////////////(                (/////////////)\n                       (////////////////(               (//////////////)\n                      (((((((((((((((((((              (((((((((((((((\n                     (((((((((((((((((((              ((((((((((((((\n                     (((((((((((((((((((            ((((((((((((((\n                    ((((((((((((((((((((           (((((((((((((\n                    ((((((((((((((((((((          ((((((((((((\n                    (((((((((((((((((((         ((((((((((((\n                    (((((((((((((((((((        ((((((((((\n                    ((((((((((((((((((/      (((((((((\n                    ((((((((((((((((((     ((((((((\n                    (((((((((((((((((    (((((((\n                   ((((((((((((((((((  (((((\n                   #################  ##\n                   ################  #\n                  ################# ##\n                 %################  ###\n                 ###############(   ####\n                ###############      ####\n               ###############       ######\n              %#############(        (#######\n             %#############           #########\n            ############(              ##########\n           ###########                  #############\n          #########                      ##############\n        %######\n\n        Powered by Knish.IO: Connecting a Decentralized World\n\nPlease visit https://github.com/WishKnish/KnishIO-Client-JS for information.\n\nLicense: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE\n*/\n\nexport { default as MemorySecretStorageProvider } from './MemorySecretStorageProvider.js'\nexport {\n  default as WebCryptoSecretStorageProvider,\n  MemoryStorageBackend\n} from './WebCryptoSecretStorageProvider.js'\nexport { default as FileStorageBackend } from './FileStorageBackend.js'\nexport { default as WebStorageBackend } from './WebStorageBackend.js'\nexport {\n  default as WebAuthnPrfSecretStorageProvider,\n  PRF_SALT_LABEL,\n  KEK_INFO\n} from './WebAuthnPrfSecretStorageProvider.js'\nexport {\n  default as NonExtractableKeySecretStorageProvider,\n  IndexedDbKeyStore,\n  MemoryKeyStore\n} from './NonExtractableKeySecretStorageProvider.js'\nexport {\n  sealEnvelope,\n  openEnvelope,\n  uint8ArrayToBase64,\n  base64ToUint8Array,\n  deriveEnvelopeKey,\n  ENVELOPE_ALGORITHM,\n  DEFAULT_ITERATIONS,\n  SECRET_KEY_PREFIX,\n  RECOVERY_KEY_PREFIX\n} from './secretEnvelope.js'\n\nimport MemorySecretStorageProvider from './MemorySecretStorageProvider.js'\nimport WebCryptoSecretStorageProvider from './WebCryptoSecretStorageProvider.js'\n\n/**\n * Factory function to create a secret storage provider\n *\n * @param {{ type?: 'webcrypto'|'memory', defaultPassphrase?: string, backend?: object }} [options]\n * @returns {object}\n */\nexport function createDefaultSecretStorage (options = {}) {\n  if (options.type === 'memory') {\n    return new MemorySecretStorageProvider()\n  }\n\n  // Default to WebCrypto if available\n  if (typeof globalThis.crypto !== 'undefined' && typeof globalThis.crypto.subtle !== 'undefined') {\n    return new WebCryptoSecretStorageProvider({\n      backend: options.backend,\n      defaultPassphrase: options.defaultPassphrase\n    })\n  }\n\n  return new MemorySecretStorageProvider()\n}\n"],"ignoreList":[16,17,18,19,20,21,22,23,128],"mappings":"8pBAII,OAAO,KAAS,MAClB,OAAO,KAAO,QAGhB,IAAqB+F,EAArB,KAAyB,CAiBvB,OAAO,MAAO,EAAK,EAAS,CAM1B,IAAMC,GAAe,EAAK,IAAc,CACtC,IAAMC,EAAMC,EACR,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,GAAG,EAC/E,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,GAAG,EAEnF,OAAOD,EAAI,KAAK,MAAME,EAAM,EAAE,GAAKF,EAAIE,EAAM,GAC/C,EACMC,EAAO,OAAO,OAClB,CACE,SAAU,EACV,UAAW,EACX,UAAW,EACb,EACAC,GAAW,CAAC,CACd,EAEIC,EAAM,GACNC,EAAQ,EACRC,EAAS,EAEb,IAAK,IAAIxB,EAAI,EAAGA,EAAIyB,EAAI,SACtB,GAAOT,EAAYS,EAAIzB,GAAIoB,EAAK,SAAS,EAErCpB,IAAMyB,EAAI,OAAS,GAHO,EAAEzB,EAO5BoB,EAAK,SAAW,GAAK,EAAEG,IAAUH,EAAK,WACxC,EAAQ,EAEJA,EAAK,UAAY,GAAK,EAAEI,IAAWJ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