UNPKG

@hashgraphonline/standards-sdk

Version:

The Hashgraph Online Standards SDK provides a complete implementation of the Hashgraph Consensus Standards (HCS), giving developers all the tools needed to build applications on Hedera.

1 lines • 3.92 MB
{"version":3,"file":"index-CZd_6-Rg.cjs","sources":["../../src/utils/logger.ts","../../src/hcs-7/evm-bridge.ts","../../node_modules/@kiloscribe/inscription-sdk/dist/es/index-DwrbEad5.js","../../src/utils/progress-reporter.ts","../../src/inscribe/inscriber.ts","../../src/services/mirror-node.ts","../../src/utils/topic-fee-utils.ts","../../src/utils/hrl-resolver.ts","../../src/utils/parsers/parser-utils.ts","../../src/utils/parsers/hts-parser.ts","../../src/utils/parsers/hcs-parser.ts","../../src/utils/parsers/file-parser.ts","../../src/utils/parsers/crypto-parser.ts","../../src/utils/parsers/scs-parser.ts","../../src/utils/parsers/util-parser.ts","../../src/utils/key-type-detector.ts","../../src/hcs-11/types.ts","../../src/hcs-11/client.ts","../../src/utils/sleep.ts","../../src/hcs-10/registrations.ts","../../src/hcs-10/base-client.ts","../../src/hcs-10/errors.ts","../../src/hcs-11/agent-builder.ts","../../src/hcs-10/sdk.ts","../../src/hcs-10/browser.ts","../../src/hcs-20/types.ts","../../src/hcs-20/errors.ts","../../src/hcs-20/base-client.ts","../../src/fees/types.ts","../../src/fees/fee-config-builder.ts","../../src/hcs-20/browser.ts","../../src/hcs-10/connections-manager.ts","../../src/hcs-3/src/index.ts","../../src/hcs-20/sdk.ts","../../src/hcs-20/points-indexer.ts","../../src/hcs-11/mcp-server-builder.ts","../../src/hcs-11/person-builder.ts","../../src/utils/transaction-parser.ts","../../src/hcs-7/wasm-bridge.ts"],"sourcesContent":["import pino from 'pino';\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';\n\nexport interface LoggerOptions {\n level?: LogLevel;\n module?: string;\n prettyPrint?: boolean;\n silent?: boolean;\n}\nexport class Logger {\n private static instances: Map<string, Logger> = new Map();\n private logger: pino.Logger;\n private moduleContext: string;\n\n constructor(options: LoggerOptions = {}) {\n const globalDisable = process.env.DISABLE_LOGS === 'true';\n\n const shouldSilence = options.silent || globalDisable;\n const level = shouldSilence ? 'silent' : options.level || 'info';\n this.moduleContext = options.module || 'app';\n\n const shouldEnablePrettyPrint =\n !shouldSilence && options.prettyPrint !== false;\n const pinoOptions: pino.LoggerOptions = {\n level,\n enabled: !shouldSilence,\n transport: shouldEnablePrettyPrint\n ? {\n target: 'pino-pretty',\n options: {\n colorize: true,\n translateTime: 'SYS:standard',\n ignore: 'pid,hostname',\n },\n }\n : undefined,\n };\n\n this.logger = pino(pinoOptions);\n }\n\n static getInstance(options: LoggerOptions = {}): Logger {\n const moduleKey = options.module || 'default';\n\n const globalDisable = process.env.DISABLE_LOGS === 'true';\n\n if (globalDisable && Logger.instances.has(moduleKey)) {\n const existingLogger = Logger.instances.get(moduleKey)!;\n if (existingLogger.getLevel() !== 'silent') {\n Logger.instances.delete(moduleKey);\n }\n }\n\n if (!Logger.instances.has(moduleKey)) {\n Logger.instances.set(moduleKey, new Logger(options));\n }\n\n return Logger.instances.get(moduleKey)!;\n }\n\n setLogLevel(level: LogLevel): void {\n this.logger.level = level;\n }\n\n getLevel(): LogLevel {\n return this.logger.level as LogLevel;\n }\n\n setSilent(silent: boolean): void {\n if (silent) {\n this.logger.level = 'silent';\n }\n }\n\n setModule(module: string): void {\n this.moduleContext = module;\n }\n\n debug(...args: any[]): void {\n this.logger.debug({ module: this.moduleContext }, ...args);\n }\n\n info(...args: any[]): void {\n this.logger.info({ module: this.moduleContext }, ...args);\n }\n\n warn(...args: any[]): void {\n this.logger.warn({ module: this.moduleContext }, ...args);\n }\n\n error(...args: any[]): void {\n this.logger.error({ module: this.moduleContext }, ...args);\n }\n\n trace(...args: any[]): void {\n this.logger.trace({ module: this.moduleContext }, ...args);\n }\n}\n","import { AccountId, ContractId } from '@hashgraph/sdk';\nimport { EVMConfig } from './wasm-bridge';\nimport { ethers } from 'ethers';\nimport { Logger } from '../utils/logger';\n\nexport interface EVMCache {\n get(key: string): Promise<string | undefined> | string | undefined;\n set(key: string, value: string): Promise<void> | void;\n delete(key: string): Promise<void> | void;\n clear(): Promise<void> | void;\n}\n\nclass MapCache implements EVMCache {\n private cache: Map<string, string>;\n\n constructor() {\n this.cache = new Map();\n }\n\n get(key: string): string | undefined {\n return this.cache.get(key);\n }\n\n set(key: string, value: string): void {\n this.cache.set(key, value);\n }\n\n delete(key: string): void {\n this.cache.delete(key);\n }\n\n clear(): void {\n this.cache.clear();\n }\n}\n\nexport class EVMBridge {\n public network: string;\n public mirrorNodeUrl: string;\n private cache: EVMCache;\n private logger: Logger;\n\n constructor(\n network: string = 'mainnet-public',\n mirrorNodeUrl: string = `mirrornode.hedera.com/api/v1/contracts/call`,\n cache?: EVMCache,\n ) {\n this.network = network;\n this.mirrorNodeUrl = mirrorNodeUrl;\n this.cache = cache || new MapCache();\n this.logger = Logger.getInstance({ module: 'EVMBridge' });\n }\n\n async executeCommands(\n evmConfigs: EVMConfig[],\n initialState: Record<string, string> = {},\n ): Promise<{\n results: Record<string, any>;\n stateData: Record<string, any>;\n }> {\n let stateData: Record<string, any> = { ...initialState };\n const results: Record<string, any> = {};\n\n for (const config of evmConfigs) {\n const cacheKey = `${config.c.contractAddress}-${config.c.abi.name}`;\n\n // Check cache first\n const cachedResult = await this.cache.get(cacheKey);\n if (cachedResult) {\n results[config.c.abi.name] = JSON.parse(cachedResult);\n Object.assign(stateData, results[config.c.abi.name]); // Flatten the values into stateData\n continue;\n }\n\n try {\n const iface = new ethers.Interface([\n {\n ...config.c.abi,\n },\n ]);\n const command = iface.encodeFunctionData(config.c.abi.name);\n const contractId = ContractId.fromSolidityAddress(\n config.c.contractAddress,\n );\n\n const result = await this.readFromMirrorNode(\n command,\n AccountId.fromString('0.0.800'),\n contractId,\n );\n\n this.logger.info(\n `Result for ${config.c.contractAddress}:`,\n result?.result,\n );\n\n if (!result?.result) {\n this.logger.warn(\n `Failed to get result from mirror node for ${config.c.contractAddress}`,\n );\n results[config.c.abi.name] = '0';\n Object.assign(stateData, results[config.c.abi.name]); // Flatten the values into stateData\n continue;\n }\n\n const decodedResult = iface?.decodeFunctionResult(\n config.c.abi.name,\n result.result,\n );\n let processedResult: Record<string, any> = {\n values: [], // Initialize array for values\n };\n\n // Handle tuple returns and array-like results\n if (decodedResult) {\n // For tuples, ethers.js provides both array-like and named properties\n // We want to use the array-like access to ensure we get each value in order\n config.c.abi.outputs?.forEach((output, idx) => {\n const value = decodedResult[idx];\n const formattedValue = formatValue(value, output.type);\n\n // Add to values array\n processedResult.values.push(formattedValue);\n\n if (output.name) {\n processedResult[output.name] = formattedValue;\n }\n });\n }\n\n await this.cache.set(cacheKey, JSON.stringify(processedResult));\n\n results[config.c.abi.name] = processedResult;\n stateData[config.c.abi.name] = processedResult;\n } catch (error) {\n this.logger.error(\n `Error executing command for ${config.c.contractAddress}:`,\n error,\n );\n results[config.c.abi.name] = '0';\n Object.assign(stateData, results[config.c.abi.name]); // Flatten the values into stateData\n }\n }\n\n return { results, stateData };\n }\n\n async executeCommand(\n evmConfig: EVMConfig,\n stateData: Record<string, string> = {},\n ): Promise<any> {\n const { results, stateData: newStateData } = await this.executeCommands(\n [evmConfig],\n stateData,\n );\n return {\n result: results[evmConfig.c.abi.name],\n stateData: newStateData,\n };\n }\n\n async readFromMirrorNode(\n command: string,\n from: AccountId,\n to: ContractId,\n ): Promise<any> {\n try {\n const toAddress = to.toSolidityAddress();\n const fromAddress = from.toSolidityAddress();\n const response = await fetch(\n `https://${this.network}.${this.mirrorNodeUrl}`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n block: 'latest',\n data: command,\n estimate: false,\n gas: 300_000,\n gasPrice: 100000000,\n from: fromAddress.startsWith('0x')\n ? fromAddress\n : `0x${fromAddress}`,\n to: toAddress?.startsWith('0x') ? toAddress : `0x${toAddress}`,\n value: 0,\n }),\n },\n );\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n return await response.json();\n } catch (error) {\n this.logger.error('Error reading from mirror node:', error);\n return null;\n }\n }\n\n // Add method to clear cache if needed\n public async clearCache(): Promise<void> {\n await this.cache.clear();\n }\n\n // Add method to remove specific cache entry\n public async clearCacheForContract(\n contractAddress: string,\n functionName: string,\n ): Promise<void> {\n await this.cache.delete(`${contractAddress}-${functionName}`);\n }\n\n // Method to set log level for this bridge instance\n public setLogLevel(level: 'debug' | 'info' | 'warn' | 'error'): void {\n this.logger.setLogLevel(level);\n }\n}\n\nfunction formatValue(value: any, type: string): string {\n if (value === null || value === undefined) {\n return '0';\n }\n\n // Handle BigNumber objects from ethers.js\n if (value._isBigNumber) {\n return value.toString();\n }\n\n if (type.startsWith('uint') || type.startsWith('int')) {\n return String(value);\n } else if (type === 'bool') {\n return value ? 'true' : 'false';\n } else if (type === 'string') {\n return value;\n } else if (type === 'address') {\n return String(value).toLowerCase();\n } else if (type.endsWith('[]')) {\n // Handle arrays\n // @ts-ignore\n return Array.isArray(value) ? value.map(v => String(v)) : [];\n } else {\n // Default to string conversion for unknown types\n return String(value);\n }\n}\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar _a;\nimport { Client, PrivateKey, TransferTransaction } from \"@hashgraph/sdk\";\nimport \"@hashgraph/proto\";\nvar buffer$3 = {};\nvar base64Js$3 = {};\nbase64Js$3.byteLength = byteLength$3;\nbase64Js$3.toByteArray = toByteArray$3;\nbase64Js$3.fromByteArray = fromByteArray$3;\nvar lookup$3 = [];\nvar revLookup$3 = [];\nvar Arr$3 = typeof Uint8Array !== \"undefined\" ? Uint8Array : Array;\nvar code$3 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nfor (var i$3 = 0, len$3 = code$3.length; i$3 < len$3; ++i$3) {\n lookup$3[i$3] = code$3[i$3];\n revLookup$3[code$3.charCodeAt(i$3)] = i$3;\n}\nrevLookup$3[\"-\".charCodeAt(0)] = 62;\nrevLookup$3[\"_\".charCodeAt(0)] = 63;\nfunction getLens$3(b64) {\n var len = b64.length;\n if (len % 4 > 0) {\n throw new Error(\"Invalid string. Length must be a multiple of 4\");\n }\n var validLen = b64.indexOf(\"=\");\n if (validLen === -1) validLen = len;\n var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n}\nfunction byteLength$3(b64) {\n var lens = getLens$3(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n}\nfunction _byteLength$3(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n}\nfunction toByteArray$3(b64) {\n var tmp;\n var lens = getLens$3(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr$3(_byteLength$3(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i;\n for (i = 0; i < len; i += 4) {\n tmp = revLookup$3[b64.charCodeAt(i)] << 18 | revLookup$3[b64.charCodeAt(i + 1)] << 12 | revLookup$3[b64.charCodeAt(i + 2)] << 6 | revLookup$3[b64.charCodeAt(i + 3)];\n arr[curByte++] = tmp >> 16 & 255;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 2) {\n tmp = revLookup$3[b64.charCodeAt(i)] << 2 | revLookup$3[b64.charCodeAt(i + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup$3[b64.charCodeAt(i)] << 10 | revLookup$3[b64.charCodeAt(i + 1)] << 4 | revLookup$3[b64.charCodeAt(i + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n}\nfunction tripletToBase64$3(num) {\n return lookup$3[num >> 18 & 63] + lookup$3[num >> 12 & 63] + lookup$3[num >> 6 & 63] + lookup$3[num & 63];\n}\nfunction encodeChunk$3(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);\n output.push(tripletToBase64$3(tmp));\n }\n return output.join(\"\");\n}\nfunction fromByteArray$3(uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk$3(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));\n }\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(\n lookup$3[tmp >> 2] + lookup$3[tmp << 4 & 63] + \"==\"\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(\n lookup$3[tmp >> 10] + lookup$3[tmp >> 4 & 63] + lookup$3[tmp << 2 & 63] + \"=\"\n );\n }\n return parts.join(\"\");\n}\nvar ieee754$4 = {};\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nieee754$4.read = function(buffer2, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? nBytes - 1 : 0;\n var d = isLE ? -1 : 1;\n var s = buffer2[offset + i];\n i += d;\n e = s & (1 << -nBits) - 1;\n s >>= -nBits;\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) {\n }\n m = e & (1 << -nBits) - 1;\n e >>= -nBits;\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) {\n }\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : (s ? -1 : 1) * Infinity;\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\nieee754$4.write = function(buffer2, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;\n var i = isLE ? 0 : nBytes - 1;\n var d = isLE ? 1 : -1;\n var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n value = Math.abs(value);\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {\n }\n buffer2[offset + i - d] |= s * 128;\n};\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n(function(exports) {\n const base64 = base64Js$3;\n const ieee754$12 = ieee754$4;\n const customInspectSymbol = typeof Symbol === \"function\" && typeof Symbol[\"for\"] === \"function\" ? Symbol[\"for\"](\"nodejs.util.inspect.custom\") : null;\n exports.Buffer = Buffer3;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n const K_MAX_LENGTH = 2147483647;\n exports.kMaxLength = K_MAX_LENGTH;\n const { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis;\n Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();\n if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== \"undefined\" && typeof console.error === \"function\") {\n console.error(\n \"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\"\n );\n }\n function typedArraySupport() {\n try {\n const arr = new GlobalUint8Array(1);\n const proto = { foo: function() {\n return 42;\n } };\n Object.setPrototypeOf(proto, GlobalUint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42;\n } catch (e) {\n return false;\n }\n }\n Object.defineProperty(Buffer3.prototype, \"parent\", {\n enumerable: true,\n get: function() {\n if (!Buffer3.isBuffer(this)) return void 0;\n return this.buffer;\n }\n });\n Object.defineProperty(Buffer3.prototype, \"offset\", {\n enumerable: true,\n get: function() {\n if (!Buffer3.isBuffer(this)) return void 0;\n return this.byteOffset;\n }\n });\n function createBuffer(length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"');\n }\n const buf = new GlobalUint8Array(length);\n Object.setPrototypeOf(buf, Buffer3.prototype);\n return buf;\n }\n function Buffer3(arg, encodingOrOffset, length) {\n if (typeof arg === \"number\") {\n if (typeof encodingOrOffset === \"string\") {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n );\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }\n Buffer3.poolSize = 8192;\n function from(value, encodingOrOffset, length) {\n if (typeof value === \"string\") {\n return fromString(value, encodingOrOffset);\n }\n if (GlobalArrayBuffer.isView(value)) {\n return fromArrayView(value);\n }\n if (value == null) {\n throw new TypeError(\n \"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + typeof value\n );\n }\n if (isInstance(value, GlobalArrayBuffer) || value && isInstance(value.buffer, GlobalArrayBuffer)) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof GlobalSharedArrayBuffer !== \"undefined\" && (isInstance(value, GlobalSharedArrayBuffer) || value && isInstance(value.buffer, GlobalSharedArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof value === \"number\") {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n );\n }\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer3.from(valueOf, encodingOrOffset, length);\n }\n const b = fromObject(value);\n if (b) return b;\n if (typeof Symbol !== \"undefined\" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === \"function\") {\n return Buffer3.from(value[Symbol.toPrimitive](\"string\"), encodingOrOffset, length);\n }\n throw new TypeError(\n \"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \" + typeof value\n );\n }\n Buffer3.from = function(value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length);\n };\n Object.setPrototypeOf(Buffer3.prototype, GlobalUint8Array.prototype);\n Object.setPrototypeOf(Buffer3, GlobalUint8Array);\n function assertSize(size) {\n if (typeof size !== \"number\") {\n throw new TypeError('\"size\" argument must be of type number');\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"');\n }\n }\n function alloc(size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size);\n }\n if (fill !== void 0) {\n return typeof encoding === \"string\" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);\n }\n return createBuffer(size);\n }\n Buffer3.alloc = function(size, fill, encoding) {\n return alloc(size, fill, encoding);\n };\n function allocUnsafe(size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0);\n }\n Buffer3.allocUnsafe = function(size) {\n return allocUnsafe(size);\n };\n Buffer3.allocUnsafeSlow = function(size) {\n return allocUnsafe(size);\n };\n function fromString(string, encoding) {\n if (typeof encoding !== \"string\" || encoding === \"\") {\n encoding = \"utf8\";\n }\n if (!Buffer3.isEncoding(encoding)) {\n throw new TypeError(\"Unknown encoding: \" + encoding);\n }\n const length = byteLength2(string, encoding) | 0;\n let buf = createBuffer(length);\n const actual = buf.write(string, encoding);\n if (actual !== length) {\n buf = buf.slice(0, actual);\n }\n return buf;\n }\n function fromArrayLike(array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0;\n const buf = createBuffer(length);\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255;\n }\n return buf;\n }\n function fromArrayView(arrayView) {\n if (isInstance(arrayView, GlobalUint8Array)) {\n const copy = new GlobalUint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);\n }\n return fromArrayLike(arrayView);\n }\n function fromArrayBuffer(array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds');\n }\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds');\n }\n let buf;\n if (byteOffset === void 0 && length === void 0) {\n buf = new GlobalUint8Array(array);\n } else if (length === void 0) {\n buf = new GlobalUint8Array(array, byteOffset);\n } else {\n buf = new GlobalUint8Array(array, byteOffset, length);\n }\n Object.setPrototypeOf(buf, Buffer3.prototype);\n return buf;\n }\n function fromObject(obj) {\n if (Buffer3.isBuffer(obj)) {\n const len = checked(obj.length) | 0;\n const buf = createBuffer(len);\n if (buf.length === 0) {\n return buf;\n }\n obj.copy(buf, 0, 0, len);\n return buf;\n }\n if (obj.length !== void 0) {\n if (typeof obj.length !== \"number\" || numberIsNaN(obj.length)) {\n return createBuffer(0);\n }\n return fromArrayLike(obj);\n }\n if (obj.type === \"Buffer\" && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n }\n function checked(length) {\n if (length >= K_MAX_LENGTH) {\n throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\" + K_MAX_LENGTH.toString(16) + \" bytes\");\n }\n return length | 0;\n }\n function SlowBuffer(length) {\n if (+length != length) {\n length = 0;\n }\n return Buffer3.alloc(+length);\n }\n Buffer3.isBuffer = function isBuffer2(b) {\n return b != null && b._isBuffer === true && b !== Buffer3.prototype;\n };\n Buffer3.compare = function compare(a, b) {\n if (isInstance(a, GlobalUint8Array)) a = Buffer3.from(a, a.offset, a.byteLength);\n if (isInstance(b, GlobalUint8Array)) b = Buffer3.from(b, b.offset, b.byteLength);\n if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n );\n }\n if (a === b) return 0;\n let x = a.length;\n let y = b.length;\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n };\n Buffer3.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case \"hex\":\n case \"utf8\":\n case \"utf-8\":\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n case \"base64\":\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return true;\n default:\n return false;\n }\n };\n Buffer3.concat = function concat(list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n }\n if (list.length === 0) {\n return Buffer3.alloc(0);\n }\n let i;\n if (length === void 0) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n const buffer2 = Buffer3.allocUnsafe(length);\n let pos = 0;\n for (i = 0; i < list.length; ++i) {\n let buf = list[i];\n if (isInstance(buf, GlobalUint8Array)) {\n if (pos + buf.length > buffer2.length) {\n if (!Buffer3.isBuffer(buf)) buf = Buffer3.from(buf);\n buf.copy(buffer2, pos);\n } else {\n GlobalUint8Array.prototype.set.call(\n buffer2,\n buf,\n pos\n );\n }\n } else if (!Buffer3.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n } else {\n buf.copy(buffer2, pos);\n }\n pos += buf.length;\n }\n return buffer2;\n };\n function byteLength2(string, encoding) {\n if (Buffer3.isBuffer(string)) {\n return string.length;\n }\n if (GlobalArrayBuffer.isView(string) || isInstance(string, GlobalArrayBuffer)) {\n return string.byteLength;\n }\n if (typeof string !== \"string\") {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string\n );\n }\n const len = string.length;\n const mustMatch = arguments.length > 2 && arguments[2] === true;\n if (!mustMatch && len === 0) return 0;\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n return len;\n case \"utf8\":\n case \"utf-8\":\n return utf8ToBytes(string).length;\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return len * 2;\n case \"hex\":\n return len >>> 1;\n case \"base64\":\n return base64ToBytes(string).length;\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length;\n }\n encoding = (\"\" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer3.byteLength = byteLength2;\n function slowToString(encoding, start, end) {\n let loweredCase = false;\n if (start === void 0 || start < 0) {\n start = 0;\n }\n if (start > this.length) {\n return \"\";\n }\n if (end === void 0 || end > this.length) {\n end = this.length;\n }\n if (end <= 0) {\n return \"\";\n }\n end >>>= 0;\n start >>>= 0;\n if (end <= start) {\n return \"\";\n }\n if (!encoding) encoding = \"utf8\";\n while (true) {\n switch (encoding) {\n case \"hex\":\n return hexSlice(this, start, end);\n case \"utf8\":\n case \"utf-8\":\n return utf8Slice(this, start, end);\n case \"ascii\":\n return asciiSlice(this, start, end);\n case \"latin1\":\n case \"binary\":\n return latin1Slice(this, start, end);\n case \"base64\":\n return base64Slice(this, start, end);\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return utf16leSlice(this, start, end);\n default:\n if (loweredCase) throw new TypeError(\"Unknown encoding: \" + encoding);\n encoding = (encoding + \"\").toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer3.prototype._isBuffer = true;\n function swap(b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n Buffer3.prototype.swap16 = function swap16() {\n const len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 16-bits\");\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this;\n };\n Buffer3.prototype.swap32 = function swap32() {\n const len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 32-bits\");\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n };\n Buffer3.prototype.swap64 = function swap64() {\n const len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 64-bits\");\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n };\n Buffer3.prototype.toString = function toString4() {\n const length = this.length;\n if (length === 0) return \"\";\n if (arguments.length === 0) return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n };\n Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;\n Buffer3.prototype.equals = function equals(b) {\n if (!Buffer3.isBuffer(b)) throw new TypeError(\"Argument must be a Buffer\");\n if (this === b) return true;\n return Buffer3.compare(this, b) === 0;\n };\n Buffer3.prototype.inspect = function inspect() {\n let str = \"\";\n const max = exports.INSPECT_MAX_BYTES;\n str = this.toString(\"hex\", 0, max).replace(/(.{2})/g, \"$1 \").trim();\n if (this.length > max) str += \" ... \";\n return \"<Buffer \" + str + \">\";\n };\n if (customInspectSymbol) {\n Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect;\n }\n Buffer3.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (isInstance(target, GlobalUint8Array)) {\n target = Buffer3.from(target, target.offset, target.byteLength);\n }\n if (!Buffer3.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target\n );\n }\n if (start === void 0) {\n start = 0;\n }\n if (end === void 0) {\n end = target ? target.length : 0;\n }\n if (thisStart === void 0) {\n thisStart = 0;\n }\n if (thisEnd === void 0) {\n thisEnd = this.length;\n }\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError(\"out of range index\");\n }\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n if (thisStart >= thisEnd) {\n return -1;\n }\n if (start >= end) {\n return 1;\n }\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target) return 0;\n let x = thisEnd - thisStart;\n let y = end - start;\n const len = Math.min(x, y);\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n };\n function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {\n if (buffer2.length === 0) return -1;\n if (typeof byteOffset === \"string\") {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 2147483647) {\n byteOffset = 2147483647;\n } else if (byteOffset < -2147483648) {\n byteOffset = -2147483648;\n }\n byteOffset = +byteOffset;\n if (numberIsNaN(byteOffset)) {\n byteOffset = dir ? 0 : buffer2.length - 1;\n }\n if (byteOffset < 0) byteOffset = buffer2.length + byteOffset;\n if (byteOffset >= buffer2.length) {\n if (dir) return -1;\n else byteOffset = buffer2.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;\n else return -1;\n }\n if (typeof val === \"string\") {\n val = Buffer3.from(val, encoding);\n }\n if (Buffer3.isBuffer(val)) {\n if (val.length === 0) {\n return -1;\n }\n return arrayIndexOf(buffer2, val, byteOffset, encoding, dir);\n } else if (typeof val === \"number\") {\n val = val & 255;\n if (typeof GlobalUint8Array.prototype.indexOf === \"function\") {\n if (dir) {\n return GlobalUint8Array.prototype.indexOf.call(buffer2, val, byteOffset);\n } else {\n return GlobalUint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset);\n }\n }\n return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir);\n }\n throw new TypeError(\"val must be string, number or Buffer\");\n }\n function arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n let indexSize = 1;\n let arrLength = arr.length;\n let valLength = val.length;\n if (encoding !== void 0) {\n encoding = String(encoding).toLowerCase();\n if (encoding === \"ucs2\" || encoding === \"ucs-2\" || encoding === \"utf16le\" || encoding === \"utf-16le\") {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n function read(buf, i2) {\n if (indexSize === 1) {\n return buf[i2];\n } else {\n return buf.readUInt16BE(i2 * indexSize);\n }\n }\n let i;\n if (dir) {\n let foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break;\n }\n }\n if (found) return i;\n }\n }\n return -1;\n }\n Buffer3.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n };\n Buffer3.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n };\n Buffer3.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n };\n function hexWrite(buf, string, offset, length) {\n offset = Number(offset) || 0;\n const remaining = buf.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n const strLen = string.length;\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n let i;\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed)) return i;\n buf[offset + i] = parsed;\n }\n return i;\n }\n function utf8Write(buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);\n }\n function asciiWrite(buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length);\n }\n function base64Write(buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length);\n }\n function ucs2Write(buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);\n }\n Buffer3.prototype.write = function write(string, offset, length, encoding) {\n if (offset === void 0) {\n encoding = \"utf8\";\n length = this.length;\n offset = 0;\n } else if (length === void 0 && typeof offset === \"string\") {\n encoding = offset;\n length = this.length;\n offset = 0;\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === void 0) encoding = \"utf8\";\n } else {\n encoding = length;\n length = void 0;\n }\n } else {\n throw new Error(\n \"Buffer.write(string, encoding, offset[, length]) is no longer supported\"\n );\n }\n const remaining = this.length - offset;\n if (length === void 0 || length > remaining) length = remaining;\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError(\"Attempt to write outside buffer bounds\");\n }\n if (!encoding) encoding = \"utf8\";\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case \"hex\":\n return hexWrite(this, string, offset, length);\n case \"utf8\":\n case \"utf-8\":\n return utf8Write(this, string, offset, length);\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n return asciiWrite(this, string, offset, length);\n case \"base64\":\n return base64Write(this, string, offset, length);\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return ucs2Write(this, string, offset, length);\n default:\n if (loweredCase) throw new TypeError(\"Unknown encoding: \" + encoding);\n encoding = (\"\" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n Buffer3.prototype.toJSON = function toJSON3() {\n return {\n type: \"Buffer\",\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n };\n function base64Slice(buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf);\n } else {\n return base64.fromByteArray(buf.slice(start, end));\n }\n }\n function utf8Slice(buf, start, end) {\n end = Math.min(buf.length, end);\n const res = [];\n let i = start;\n while (i < end) {\n const firstByte = buf[i];\n let codePoint = null;\n let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint;\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 128) {\n codePoint = firstByte;\n }\n break;\n case 2:\n secondByte = buf[i + 1];\n if ((secondByte & 192) === 128) {\n tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;\n if (tempCodePoint > 127) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;\n if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;\n if (tempCodePoint > 65535 && tempCodePoint < 1114112) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n if (codePoint === null) {\n codePoint = 65533;\n bytesPerSequence = 1;\n } else if (codePoint > 65535) {\n codePoint -= 65536;\n res.push(codePoint >>> 10 & 1023 | 55296);\n codePoint = 56320 | codePoint & 1023;\n }\n res.push(codePoint);\n i += bytesPerSequence;\n }\n return decodeCodePointsArray(res);\n }\n const MAX_ARGUMENTS_LENGTH = 4096;\n function decodeCodePointsArray(codePoints) {\n const len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints);\n }\n let res = \"\";\n let i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n );\n }\n return res;\n }\n function asciiSlice(buf, start, end) {\n let ret = \"\";\n end = Math.min(buf.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 127);\n }\n return ret;\n }\n function latin1Slice(buf, start, end) {\n let ret = \"\";\n end = Math.min(buf.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n return ret;\n }\n function hexSlice(buf, start, end) {\n const len = buf.length;\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n let out = \"\";\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]];\n }\n return out;\n }\n function utf16leSlice(buf, start, end) {\n const bytes = buf.slice(start, end);\n let res = \"\";\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n return res;\n }\n Buffer3.prototype.slice = function slice(start, end) {\n const len = this.length;\n start = ~~start;\n end = end === void 0 ? len : ~~end;\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n if (end < start) end = start;\n const newBuf = this.subarray(start, end);\n Object.setPrototypeOf(newBuf, Buffer3.prototype);\n return newBuf;\n };\n function checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0) throw new RangeError(\"offset is not uint\");\n if (offset + ext > length) throw new RangeError(\"Trying to access beyond buffer length\");\n }\n Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = function readUIntLE(offset, byteLength3, noAssert) {\n offset = offset >>> 0;\n byteLength3 = byteLength3 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength3, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength3 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n return val;\n };\n Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = function readUIntBE(offset, byteLength3, noAssert) {\n offset = offset >>> 0;\n byteLength3 = byteLength3 >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength3, this.length);\n }\n let val = this[offset + --byteLength3];\n let mul = 1;\n while (byteLength3 > 0 && (mul *= 256)) {\n val += this[offset + --byteLength3] * mul;\n }\n return val;\n };\n Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset];\n };\n Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n };\n Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n };\n Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;\n };\n Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n };\n Buffer3.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;\n const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;\n return BigInt(lo) + (BigInt(hi) << BigInt(32));\n });\n Buffer3.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, \"offset\");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;\n return (BigInt(hi) << BigInt(32)) + BigInt(lo);\n });\n Buffer3.prototype.readIntLE = function readIntLE(offset, byteLength3, noAssert) {\n offset = offset >>> 0;\n byteLength3 = byteLength3 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength3, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength3 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n mul *= 128;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength3);\n return val;\n };\n Buffer3.prototype.readIntBE = function readIntBE(offset, byteLength3, noAssert) {\n offset = offset >>> 0;\n byteLength3 = byteLength3 >>> 0;\n if (!noAssert) checkOffset(offset, byteLength3, this.length);\n let i = byteLength3;\n let mul = 1;\n let val = this[offset + --i];\n while (i > 0 && (mul *= 256)) {\n val += this[offset + --i] * mul;\n