@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 • 414 kB
Source Map (JSON)
{"version":3,"file":"index-q9fHE6nD-ViqYa2kM.cjs","sources":["../../node_modules/@kiloscribe/inscription-sdk/dist/es/index-q9fHE6nD.js"],"sourcesContent":["import { e as process$1 } from \"./index-DwrbEad5.js\";\nvar commonjsGlobal = typeof globalThis !== \"undefined\" ? globalThis : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : {};\nfunction getDefaultExportFromCjs(x) {\n return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, \"default\") ? x[\"default\"] : x;\n}\nvar dist = {};\nvar hasRequiredDist;\nfunction requireDist() {\n if (hasRequiredDist) return dist;\n hasRequiredDist = 1;\n (function(exports) {\n Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: \"Module\" } });\n var buffer = {};\n var base64Js = {};\n base64Js.byteLength = byteLength;\n base64Js.toByteArray = toByteArray;\n base64Js.fromByteArray = fromByteArray;\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== \"undefined\" ? Uint8Array : Array;\n var code = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n for (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n revLookup[\"-\".charCodeAt(0)] = 62;\n revLookup[\"_\".charCodeAt(0)] = 63;\n function getLens(b64) {\n var len2 = b64.length;\n if (len2 % 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 = len2;\n var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n }\n function byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function _byteLength(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i2;\n for (i2 = 0; i2 < len2; i2 += 4) {\n tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 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[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n }\n function tripletToBase64(num) {\n return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\n }\n function encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i2 = start; i2 < end; i2 += 3) {\n tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);\n output.push(tripletToBase64(tmp));\n }\n return output.join(\"\");\n }\n function fromByteArray(uint8) {\n var tmp;\n var len2 = uint8.length;\n var extraBytes = len2 % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {\n parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));\n }\n if (extraBytes === 1) {\n tmp = uint8[len2 - 1];\n parts.push(\n lookup[tmp >> 2] + lookup[tmp << 4 & 63] + \"==\"\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];\n parts.push(\n lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + \"=\"\n );\n }\n return parts.join(\"\");\n }\n var ieee754 = {};\n /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\n ieee754.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 i2 = isLE ? nBytes - 1 : 0;\n var d = isLE ? -1 : 1;\n var s = buffer2[offset + i2];\n i2 += d;\n e = s & (1 << -nBits) - 1;\n s >>= -nBits;\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer2[offset + i2], i2 += 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 + i2], i2 += 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 };\n ieee754.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 i2 = 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 + i2] = m & 255, i2 += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer2[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {\n }\n buffer2[offset + i2 - 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(exports2) {\n const base64 = base64Js;\n const ieee754$1 = ieee754;\n const customInspectSymbol = typeof Symbol === \"function\" && typeof Symbol[\"for\"] === \"function\" ? Symbol[\"for\"](\"nodejs.util.inspect.custom\") : null;\n exports2.Buffer = Buffer2;\n exports2.SlowBuffer = SlowBuffer;\n exports2.INSPECT_MAX_BYTES = 50;\n const K_MAX_LENGTH = 2147483647;\n exports2.kMaxLength = K_MAX_LENGTH;\n const { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis;\n Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();\n if (!Buffer2.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(Buffer2.prototype, \"parent\", {\n enumerable: true,\n get: function() {\n if (!Buffer2.isBuffer(this)) return void 0;\n return this.buffer;\n }\n });\n Object.defineProperty(Buffer2.prototype, \"offset\", {\n enumerable: true,\n get: function() {\n if (!Buffer2.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, Buffer2.prototype);\n return buf;\n }\n function Buffer2(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 Buffer2.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 Buffer2.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 Buffer2.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 Buffer2.from = function(value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length);\n };\n Object.setPrototypeOf(Buffer2.prototype, GlobalUint8Array.prototype);\n Object.setPrototypeOf(Buffer2, 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 Buffer2.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 Buffer2.allocUnsafe = function(size) {\n return allocUnsafe(size);\n };\n Buffer2.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 (!Buffer2.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 i2 = 0; i2 < length; i2 += 1) {\n buf[i2] = array[i2] & 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, Buffer2.prototype);\n return buf;\n }\n function fromObject(obj) {\n if (Buffer2.isBuffer(obj)) {\n const len2 = checked(obj.length) | 0;\n const buf = createBuffer(len2);\n if (buf.length === 0) {\n return buf;\n }\n obj.copy(buf, 0, 0, len2);\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 Buffer2.alloc(+length);\n }\n Buffer2.isBuffer = function isBuffer(b) {\n return b != null && b._isBuffer === true && b !== Buffer2.prototype;\n };\n Buffer2.compare = function compare(a, b) {\n if (isInstance(a, GlobalUint8Array)) a = Buffer2.from(a, a.offset, a.byteLength);\n if (isInstance(b, GlobalUint8Array)) b = Buffer2.from(b, b.offset, b.byteLength);\n if (!Buffer2.isBuffer(a) || !Buffer2.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 i2 = 0, len2 = Math.min(x, y); i2 < len2; ++i2) {\n if (a[i2] !== b[i2]) {\n x = a[i2];\n y = b[i2];\n break;\n }\n }\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n };\n Buffer2.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 Buffer2.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 Buffer2.alloc(0);\n }\n let i2;\n if (length === void 0) {\n length = 0;\n for (i2 = 0; i2 < list.length; ++i2) {\n length += list[i2].length;\n }\n }\n const buffer2 = Buffer2.allocUnsafe(length);\n let pos = 0;\n for (i2 = 0; i2 < list.length; ++i2) {\n let buf = list[i2];\n if (isInstance(buf, GlobalUint8Array)) {\n if (pos + buf.length > buffer2.length) {\n if (!Buffer2.isBuffer(buf)) buf = Buffer2.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 (!Buffer2.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 (Buffer2.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 len2 = string.length;\n const mustMatch = arguments.length > 2 && arguments[2] === true;\n if (!mustMatch && len2 === 0) return 0;\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n return len2;\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 len2 * 2;\n case \"hex\":\n return len2 >>> 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 Buffer2.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 Buffer2.prototype._isBuffer = true;\n function swap(b, n, m) {\n const i2 = b[n];\n b[n] = b[m];\n b[m] = i2;\n }\n Buffer2.prototype.swap16 = function swap16() {\n const len2 = this.length;\n if (len2 % 2 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 16-bits\");\n }\n for (let i2 = 0; i2 < len2; i2 += 2) {\n swap(this, i2, i2 + 1);\n }\n return this;\n };\n Buffer2.prototype.swap32 = function swap32() {\n const len2 = this.length;\n if (len2 % 4 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 32-bits\");\n }\n for (let i2 = 0; i2 < len2; i2 += 4) {\n swap(this, i2, i2 + 3);\n swap(this, i2 + 1, i2 + 2);\n }\n return this;\n };\n Buffer2.prototype.swap64 = function swap64() {\n const len2 = this.length;\n if (len2 % 8 !== 0) {\n throw new RangeError(\"Buffer size must be a multiple of 64-bits\");\n }\n for (let i2 = 0; i2 < len2; i2 += 8) {\n swap(this, i2, i2 + 7);\n swap(this, i2 + 1, i2 + 6);\n swap(this, i2 + 2, i2 + 5);\n swap(this, i2 + 3, i2 + 4);\n }\n return this;\n };\n Buffer2.prototype.toString = function toString() {\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 Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;\n Buffer2.prototype.equals = function equals(b) {\n if (!Buffer2.isBuffer(b)) throw new TypeError(\"Argument must be a Buffer\");\n if (this === b) return true;\n return Buffer2.compare(this, b) === 0;\n };\n Buffer2.prototype.inspect = function inspect() {\n let str = \"\";\n const max2 = exports2.INSPECT_MAX_BYTES;\n str = this.toString(\"hex\", 0, max2).replace(/(.{2})/g, \"$1 \").trim();\n if (this.length > max2) str += \" ... \";\n return \"<Buffer \" + str + \">\";\n };\n if (customInspectSymbol) {\n Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect;\n }\n Buffer2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (isInstance(target, GlobalUint8Array)) {\n target = Buffer2.from(target, target.offset, target.byteLength);\n }\n if (!Buffer2.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 len2 = Math.min(x, y);\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n for (let i2 = 0; i2 < len2; ++i2) {\n if (thisCopy[i2] !== targetCopy[i2]) {\n x = thisCopy[i2];\n y = targetCopy[i2];\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 = Buffer2.from(val, encoding);\n }\n if (Buffer2.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, i3) {\n if (indexSize === 1) {\n return buf[i3];\n } else {\n return buf.readUInt16BE(i3 * indexSize);\n }\n }\n let i2;\n if (dir) {\n let foundIndex = -1;\n for (i2 = byteOffset; i2 < arrLength; i2++) {\n if (read(arr, i2) === read(val, foundIndex === -1 ? 0 : i2 - foundIndex)) {\n if (foundIndex === -1) foundIndex = i2;\n if (i2 - foundIndex + 1 === valLength) return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1) i2 -= i2 - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n for (i2 = byteOffset; i2 >= 0; i2--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i2 + j) !== read(val, j)) {\n found = false;\n break;\n }\n }\n if (found) return i2;\n }\n }\n return -1;\n }\n Buffer2.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n };\n Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n };\n Buffer2.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 i2;\n for (i2 = 0; i2 < length; ++i2) {\n const parsed = parseInt(string.substr(i2 * 2, 2), 16);\n if (numberIsNaN(parsed)) return i2;\n buf[offset + i2] = parsed;\n }\n return i2;\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 Buffer2.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 Buffer2.prototype.toJSON = function toJSON() {\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 i2 = start;\n while (i2 < end) {\n const firstByte = buf[i2];\n let codePoint = null;\n let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\n if (i2 + 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[i2 + 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[i2 + 1];\n thirdByte = buf[i2 + 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[i2 + 1];\n thirdByte = buf[i2 + 2];\n fourthByte = buf[i2 + 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 i2 += bytesPerSequence;\n }\n return decodeCodePointsArray(res);\n }\n const MAX_ARGUMENTS_LENGTH = 4096;\n function decodeCodePointsArray(codePoints) {\n const len2 = codePoints.length;\n if (len2 <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints);\n }\n let res = \"\";\n let i2 = 0;\n while (i2 < len2) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i2, i2 += 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 i2 = start; i2 < end; ++i2) {\n ret += String.fromCharCode(buf[i2] & 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 i2 = start; i2 < end; ++i2) {\n ret += String.fromCharCode(buf[i2]);\n }\n return ret;\n }\n function hexSlice(buf, start, end) {\n const len2 = buf.length;\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len2) end = len2;\n let out = \"\";\n for (let i2 = start; i2 < end; ++i2) {\n out += hexSliceLookupTable[buf[i2]];\n }\n return out;\n }\n function utf16leSlice(buf, start, end) {\n const bytes = buf.slice(start, end);\n let res = \"\";\n for (let i2 = 0; i2 < bytes.length - 1; i2 += 2) {\n res += String.fromCharCode(bytes[i2] + bytes[i2 + 1] * 256);\n }\n return res;\n }\n Buffer2.prototype.slice = function slice(start, end) {\n const len2 = this.length;\n start = ~~start;\n end = end === void 0 ? len2 : ~~end;\n if (start < 0) {\n start += len2;\n if (start < 0) start = 0;\n } else if (start > len2) {\n start = len2;\n }\n if (end < 0) {\n end += len2;\n if (end < 0) end = 0;\n } else if (end > len2) {\n end = len2;\n }\n if (end < start) end = start;\n const newBuf = this.subarray(start, end);\n Object.setPrototypeOf(newBuf, Buffer2.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 Buffer2.prototype.readUintLE = Buffer2.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 i2 = 0;\n while (++i2 < byteLength3 && (mul *= 256)) {\n val += this[offset + i2] * mul;\n }\n return val;\n };\n Buffer2.prototype.readUintBE = Buffer2.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 Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset];\n };\n Buffer2.prototype.readUint16LE = Buffer2.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 Buffer2.prototype.readUint16BE = Buffer2.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 Buffer2.prototype.readUint32LE = Buffer2.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 Buffer2.prototype.readUint32BE = Buffer2.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 Buffer2.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 Buffer2.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 Buffer2.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 i2 = 0;\n while (++i2 < byteLength3 && (mul *= 256)) {\n val += this[offset + i2] * mul;\n }\n mul *= 128;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength3);\n return val;\n };\n Buffer2.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 i2 = byteLength3;\n let mul = 1;\n let val = this[offset + --i2];\n while (i2 > 0 && (mul *= 256)) {\n val += this[offset + --i2] * mul;\n }\n mul *= 128;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength3);\n return val;\n };\n Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 128)) return this[offset];\n return (255 - this[offset] + 1) * -1;\n };\n Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n const val = this[offset] | this[offset + 1] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n const val = this[offset + 1] | this[offset] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer2.prototype.readInt32LE = function readInt32LE(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] << 24;\n };\n Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n };\n Buffer2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(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 val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);\n return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);\n });\n Buffer2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(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 val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);\n });\n Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754$1.read(this, offset, true, 23, 4);\n };\n Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754$1.read(this, offset, false, 23, 4);\n };\n Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754$1.read(this, offset, true, 52, 8);\n };\n Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754$1.read(this, offset, false, 52, 8);\n };\n function checkInt(buf, value, offset, ext, max2, min2) {\n if (!Buffer2.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance');\n if (value > max2 || value < min2) throw new RangeError('\"value\" argument is out of bounds');\n if (offset + ext > buf.length) throw new RangeError(\"Index out of range\");\n }\n Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength3, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength3 = byteLength3 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength3) - 1;\n checkInt(this, value, offset, byteLength3, maxBytes, 0);\n }\n let mul = 1;\n let i2 = 0;\n this[offset] = value & 255;\n while (++i2 < byteLength3 && (mul *= 256)) {\n this[offset + i2] = value / mul & 255;\n }\n return offset + byteLength3;\n };\n Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength3, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength3 = byteLength3 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength3) - 1;\n checkInt(this, value, offset, byteLength3, maxBytes, 0);\n }\n let i2 = byteLength3 - 1;\n let mul = 1;\n this[offset + i2] = value & 255;\n while (--i2 >= 0 && (mul *= 256)) {\n this[offset + i2] = value / mul & 255;\n }\n return offset + byteLength3;\n };\n Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 255, 0);\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value >>> 8;\n this[offset + 1