UNPKG

@prisma/client

Version:

Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.

4 lines • 1 MB
{ "version": 3, "sources": ["../../../helpers/compile/plugins/fill-plugin/fillers/buffer-small.ts", "../../../helpers/compile/plugins/fill-plugin/fillers/process.ts", "../../../helpers/compile/plugins/fill-plugin/fillers/perf_hooks.ts", "../../../helpers/compile/plugins/fill-plugin/fillers/function.ts", "../../../helpers/compile/plugins/fill-plugin/fillers/weakref.ts", "../../../node_modules/.pnpm/decimal.js-light@2.5.1/node_modules/decimal.js-light/decimal.mjs", "../../../helpers/compile/plugins/fill-plugin/fillers/decimal-small.ts", "../../../helpers/compile/plugins/fill-plugin/fillers/fs.ts", "fill-plugin-v6egpc:os", "../../../helpers/compile/plugins/fill-plugin/fillers/path.ts", "../../internals/package.json", "../../../helpers/compile/plugins/fill-plugin/fillers/crypto.ts", "../../../node_modules/.pnpm/@prisma+engines-version@6.14.0-25.717184b7b35ea05dfa71a3236b7af656013e1e49/node_modules/@prisma/engines-version/package.json", "../../../node_modules/.pnpm/@prisma+engines-version@6.14.0-25.717184b7b35ea05dfa71a3236b7af656013e1e49/node_modules/@prisma/engines-version/index.js", "../../../node_modules/.pnpm/indent-string@4.0.0/node_modules/indent-string/index.js", "../../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js", "../../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js", "../../../node_modules/.pnpm/new-github-issue-url@0.2.1/node_modules/new-github-issue-url/index.js", "../../../node_modules/.pnpm/js-levenshtein@1.1.6/node_modules/js-levenshtein/index.js", "../../ts-builders/src/TypeBuilder.ts", "../../ts-builders/src/KeyType.ts", "../../../helpers/compile/plugins/fill-plugin/fillers/events.ts", "../../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/src/_assert.ts", "../../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/src/_u64.ts", "../../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/src/cryptoNode.ts", "../../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/src/utils.ts", "../../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/src/sha3.ts", "../../../node_modules/.pnpm/@paralleldrive+cuid2@2.2.2/node_modules/@paralleldrive/cuid2/src/index.js", "../../../node_modules/.pnpm/@paralleldrive+cuid2@2.2.2/node_modules/@paralleldrive/cuid2/index.js", "../src/runtime/index.ts", "../src/runtime/core/extensions/index.ts", "../src/runtime/core/extensions/defineExtension.ts", "../src/runtime/core/extensions/getExtensionContext.ts", "../src/runtime/core/public/index.ts", "../src/runtime/core/public/validator.ts", "../src/runtime/core/errors/PrismaClientInitializationError.ts", "../../internals/src/index.ts", "../../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs", "../../debug/src/index.ts", "../../get-platform/src/index.ts", "../../internals/src/utils/getVersionFromPackageJson.ts", "../../internals/src/client/getClientEngineType.ts", "../../driver-adapter-utils/src/index.ts", "../../driver-adapter-utils/src/error.ts", "../../driver-adapter-utils/src/const.ts", "../../internals/src/utils/prismaPostgres.ts", "../../internals/src/logger.ts", "../../internals/src/utils/assertNever.ts", "../../internals/src/utils/hasOwnProperty.ts", "../../internals/src/utils/mapObjectValues.ts", "../../internals/src/utils/max.ts", "../../internals/src/utils/setClassName.ts", "../../internals/src/warnOnce.ts", "../src/runtime/core/errors/PrismaClientKnownRequestError.ts", "../src/runtime/core/errors/PrismaClientRustPanicError.ts", "../src/runtime/core/errors/PrismaClientUnknownRequestError.ts", "../src/runtime/core/errors/PrismaClientValidationError.ts", "../src/runtime/core/jsonProtocol/serializeJsonQuery.ts", "../../client-common/src/index.ts", "../../client-common/src/Cache.ts", "../../client-common/src/casing.ts", "../../client-common/src/Dictionary.ts", "../../client-common/src/lazyProperty.ts", "../../client-common/src/runtimeDataModel.ts", "../src/runtime/utils/date.ts", "../src/runtime/utils/decimalJsLike.ts", "../src/runtime/core/errorRendering/throwValidationException.ts", "../src/runtime/utils/createErrorMessageWithContext.ts", "../../dmmf/src/index.ts", "../../dmmf/src/convert.ts", "../../dmmf/src/dmmf.ts", "../src/runtime/core/errorRendering/applyValidationError.ts", "../src/runtime/core/errorRendering/applyUnionError.ts", "../src/runtime/core/errorRendering/ObjectFieldSuggestion.ts", "../src/runtime/core/errorRendering/ObjectValue.ts", "../../ts-builders/src/index.ts", "../../ts-builders/src/Writer.ts", "../src/runtime/core/errorRendering/ArrayValue.ts", "../src/runtime/core/errorRendering/ArrayField.ts", "../src/runtime/core/errorRendering/base.ts", "../src/runtime/core/errorRendering/FormattedString.ts", "../src/runtime/core/errorRendering/Value.ts", "../src/runtime/core/errorRendering/ScalarValue.ts", "../src/runtime/core/errorRendering/SuggestionObjectValue.ts", "../src/runtime/core/errorRendering/ArgumentsRenderingTree.ts", "../src/runtime/core/model/FieldRef.ts", "../src/runtime/core/types/exported/ObjectEnums.ts", "../src/runtime/core/errorRendering/ObjectField.ts", "../src/runtime/core/extensions/MergedExtensionsList.ts", "../src/runtime/core/model/utils/dmmfToJSModelName.ts", "../src/runtime/core/extensions/resultUtils.ts", "../src/runtime/core/model/Param.ts", "../src/runtime/core/types/index.ts", "../src/runtime/core/types/exported/Skip.ts", "../src/runtime/core/metrics/MetricsClient.ts", "../src/runtime/core/runtimeDataModel.ts", "../src/runtime/core/types/exported/TypedSql.ts", "../src/runtime/getPrismaClient.ts", "fill-plugin-v6egpc:async_hooks", "../../../node_modules/.pnpm/sql-template-tag@5.2.1/node_modules/sql-template-tag/src/index.ts", "../src/runtime/core/compositeProxy/index.ts", "../src/runtime/core/compositeProxy/addObjectProperties.ts", "../src/runtime/core/compositeProxy/addProperty.ts", "../src/runtime/core/compositeProxy/cacheProperties.ts", "../src/runtime/core/compositeProxy/createCompositeProxy.ts", "../src/runtime/core/model/utils/defaultProxyHandlers.ts", "../src/runtime/core/compositeProxy/removeProperties.ts", "../src/runtime/core/engines/common/utils/getBatchRequestPayload.ts", "../src/runtime/core/errorRendering/prettyPrintArguments.ts", "../src/runtime/core/errors/utils/prismaGraphQLToJSError.ts", "../src/runtime/core/extensions/$extends.ts", "../src/runtime/core/model/applyModelsAndClientExtensions.ts", "../src/runtime/core/model/applyModel.ts", "../src/runtime/utils/CallSite.ts", "../../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js", "../src/runtime/core/model/applyAggregates.ts", "../src/runtime/core/model/aggregates/aggregate.ts", "../src/runtime/core/model/aggregates/utils/aggregateMap.ts", "../src/runtime/core/model/aggregates/count.ts", "../src/runtime/core/model/aggregates/groupBy.ts", "../src/runtime/core/model/applyFieldsProxy.ts", "../src/runtime/core/model/applyFluent.ts", "../src/runtime/utils/deep-set.ts", "../src/runtime/core/model/utils/jsToDMMFModelName.ts", "../src/runtime/core/extensions/applyAllResultExtensions.ts", "../src/runtime/core/extensions/applyResultExtensions.ts", "../src/runtime/core/extensions/visitQueryResult.ts", "../src/runtime/core/extensions/applyQueryExtensions.ts", "../src/runtime/utils/deepCloneArgs.ts", "../src/runtime/core/types/exported/itxClientDenyList.ts", "../src/runtime/core/init/checkPlatformCaching.ts", "../src/runtime/core/init/getDatasourceOverrides.ts", "../src/runtime/core/init/getEngineInstance.ts", "../src/runtime/utils/getRuntime.ts", "../src/runtime/core/engines/index.ts", "../src/runtime/core/engines/common/utils/getErrorMessageWithLink.ts", "../src/runtime/core/engines/common/utils/maskQuery.ts", "../src/runtime/core/engines/common/utils/normalizeLogs.ts", "../src/runtime/core/engines/common/utils/util.ts", "../src/runtime/core/engines/client/ClientEngine.ts", "../../client-engine-runtime/src/index.ts", "../../client-engine-runtime/src/batch.ts", "../../client-engine-runtime/src/json-protocol.ts", "../../client-engine-runtime/src/utils.ts", "../../client-engine-runtime/src/user-facing-error.ts", "../../client-engine-runtime/src/interpreter/data-mapper.ts", "../../client-engine-runtime/src/interpreter/query-interpreter.ts", "../../client-engine-runtime/src/tracing.ts", "../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/src/index.ts", "../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/src/trace/span_kind.ts", "../../client-engine-runtime/src/interpreter/generators.ts", "../../../node_modules/.pnpm/@bugsnag+cuid@3.2.1/node_modules/@bugsnag/cuid/index.esm.mjs", "../../../node_modules/.pnpm/@bugsnag+cuid@3.2.1/node_modules/@bugsnag/cuid/lib/fingerprint.mjs", "../../../node_modules/.pnpm/@bugsnag+cuid@3.2.1/node_modules/@bugsnag/cuid/lib/pad.mjs", "../../../node_modules/.pnpm/@bugsnag+cuid@3.2.1/node_modules/@bugsnag/cuid/lib/cuid.mjs", "../../../node_modules/.pnpm/@bugsnag+cuid@3.2.1/node_modules/@bugsnag/cuid/lib/is-cuid.mjs", "../../../node_modules/.pnpm/nanoid@5.1.5/node_modules/nanoid/index.js", "../../../node_modules/.pnpm/nanoid@5.1.5/node_modules/nanoid/url-alphabet/index.js", "../../../node_modules/.pnpm/ulid@3.0.0/node_modules/ulid/dist/node/index.js", "../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/index.js", "../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/stringify.js", "../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/rng.js", "../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/v4.js", "../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/native.js", "../../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/v7.js", "../../client-engine-runtime/src/interpreter/in-memory-processing.ts", "../../client-engine-runtime/src/interpreter/render-query.ts", "../../client-engine-runtime/src/query-plan.ts", "../../client-engine-runtime/src/interpreter/serialize-sql.ts", "../../client-engine-runtime/src/interpreter/validation.ts", "../../client-engine-runtime/src/transaction-manager/transaction-manager.ts", "../../client-engine-runtime/src/crypto.ts", "../../client-engine-runtime/src/transaction-manager/transaction-manager-error.ts", "../package.json", "../src/runtime/core/engines/client/LocalExecutor.ts", "../src/runtime/core/engines/client/RemoteExecutor.ts", "../../../node_modules/.pnpm/cookie-es@2.0.0/node_modules/cookie-es/dist/index.mjs", "../src/runtime/core/engines/common/accelerate/getUrlAndApiKey.ts", "../src/runtime/core/init/resolveDatasourceUrl.ts", "../src/runtime/core/engines/data-proxy/errors/InvalidDatasourceError.ts", "../src/runtime/core/engines/data-proxy/errors/DataProxyError.ts", "../src/runtime/core/errors/PrismaClientError.ts", "../src/runtime/core/engines/data-proxy/errors/utils/setRetryable.ts", "../src/runtime/core/engines/common/accelerate/HeaderBuilder.ts", "../src/runtime/core/engines/data-proxy/utils/EngineTimestamp.ts", "../src/runtime/core/engines/client/WasmQueryCompilerLoader.ts", "../src/runtime/core/engines/data-proxy/DataProxyEngine.ts", "../src/runtime/core/engines/data-proxy/errors/ForcedRetryError.ts", "../src/runtime/core/engines/data-proxy/errors/NotImplementedYetError.ts", "../src/runtime/core/engines/data-proxy/errors/SchemaMissingError.ts", "../src/runtime/core/engines/data-proxy/errors/DataProxyAPIError.ts", "../src/runtime/core/engines/data-proxy/errors/utils/responseToError.ts", "../src/runtime/core/engines/data-proxy/errors/BadRequestError.ts", "../src/runtime/core/engines/data-proxy/errors/EngineHealthcheckTimeoutError.ts", "../src/runtime/core/engines/data-proxy/errors/EngineStartupError.ts", "../src/runtime/core/engines/data-proxy/errors/EngineVersionNotSupportedError.ts", "../src/runtime/core/engines/data-proxy/errors/GatewayTimeoutError.ts", "../src/runtime/core/engines/data-proxy/errors/InteractiveTransactionError.ts", "../src/runtime/core/engines/data-proxy/errors/InvalidRequestError.ts", "../src/runtime/core/engines/data-proxy/errors/NotFoundError.ts", "../src/runtime/core/engines/data-proxy/errors/ServerError.ts", "../src/runtime/core/engines/data-proxy/errors/UnauthorizedError.ts", "../src/runtime/core/engines/data-proxy/errors/UsageExceededError.ts", "../src/runtime/core/engines/data-proxy/utils/backOff.ts", "../src/runtime/core/engines/data-proxy/utils/base64.ts", "../src/runtime/core/engines/data-proxy/utils/checkForbiddenMetrics.ts", "../src/runtime/core/engines/data-proxy/utils/getClientVersion.ts", "../../engines/package.json", "../src/runtime/core/engines/data-proxy/utils/request.ts", "../src/runtime/core/engines/data-proxy/errors/NetworkError.ts", "../src/runtime/core/init/validateEngineInstanceConfig.ts", "../src/runtime/core/init/getPreviewFeatures.ts", "../src/runtime/core/raw-query/rawCommandArgsMapper.ts", "../src/runtime/core/raw-query/rawQueryArgsMapper.ts", "../src/runtime/utils/mssqlPreparedStatement.ts", "../src/runtime/utils/serializeRawParameters.ts", "../src/runtime/core/request/createPrismaPromise.ts", "../src/runtime/core/tracing/TracingHelper.ts", "../src/runtime/core/transaction/utils/createLockCountPromise.ts", "../src/runtime/getLogLevel.ts", "../src/runtime/RequestHandler.ts", "../src/runtime/core/errors/ErrorWithBatchIndex.ts", "../src/runtime/core/jsonProtocol/getBatchId.ts", "../src/runtime/core/jsonProtocol/isWrite.ts", "../src/runtime/DataLoader.ts", "../src/runtime/utils/deserializeRawResults.ts", "../src/runtime/utils/clientVersion.ts", "../src/runtime/utils/validatePrismaClientOptions.ts", "../src/runtime/core/errors/PrismaClientConstructorValidationError.ts", "../src/runtime/utils/waitForBatch.ts", "../src/runtime/strictEnum.ts", "fill-plugin-v6egpc:./warnEnvConflicts"], "sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\nexport interface BufferClass {\n readBigInt64BE(offset: number): bigint\n readBigInt64BE(offset: number): bigint\n readBigInt64LE(offset: number): bigint\n readBigInt64LE(offset: number): bigint\n readBigUint64BE(offset: number): bigint\n readBigUInt64BE(offset: number): bigint\n readBigUint64LE(offset: number): bigint\n readBigUInt64LE(offset: number): bigint\n readDoubleBE(offset: number): number\n readDoubleLE(offset: number): number\n readFloatBE(offset: number): number\n readFloatLE(offset: number): number\n readInt16BE(offset: number): number\n readInt16LE(offset: number): number\n readInt32BE(offset: number): number\n readInt32LE(offset: number): number\n readInt8(offset: number): number\n readIntBE(offset: number, byteLength: number): number\n readIntLE(offset: number, byteLength: number): number\n readUint16BE(offset: number): number\n readUInt16BE(offset: number): number\n readUint16LE(offset: number): number\n readUInt16LE(offset: number): number\n readUint32BE(offset: number): number\n readUInt32BE(offset: number): number\n readUint32LE(offset: number): number\n readUInt32LE(offset: number): number\n readUint8(offset: number): number\n readUInt8(offset: number): number\n readUInt8(offset: number): number\n readUintBE(offset: number, byteLength: number): number\n readUIntBE(offset: number, byteLength: number): number\n readUintLE(offset: number, byteLength: number): number\n readUIntLE(offset: number, byteLength: number): number\n writeBigInt64BE(value: bigint, offset: number): number\n writeBigInt64BE(value: bigint, offset: number): number\n writeBigInt64LE(value: bigint, offset: number): number\n writeBigInt64LE(value: bigint, offset: number): number\n writeBigUint64BE(value: bigint, offset: number): number\n writeBigUInt64BE(value: bigint, offset: number): number\n writeBigUint64LE(value: bigint, offset: number): number\n writeBigUInt64LE(value: bigint, offset: number): number\n writeDoubleBE(value: number, offset: number): number\n writeDoubleLE(value: number, offset: number): number\n writeFloatBE(value: number, offset: number): number\n writeFloatLE(value: number, offset: number): number\n writeInt16BE(value: number, offset: number): number\n writeInt16LE(value: number, offset: number): number\n writeInt32BE(value: number, offset: number): number\n writeInt32LE(value: number, offset: number): number\n writeInt8(value: number, offset: number): number\n writeIntBE(value: number, offset: number, byteLength: number): number\n writeIntLE(value: number, offset: number, byteLength: number): number\n writeUint16BE(value: number, offset: number): number\n writeUInt16BE(value: number, offset: number): number\n writeUint16LE(value: number, offset: number): number\n writeUInt16LE(value: number, offset: number): number\n writeUint32BE(value: number, offset: number): number\n writeUInt32BE(value: number, offset: number): number\n writeUint32LE(value: number, offset: number): number\n writeUInt32LE(value: number, offset: number): number\n writeUint8(value: number, offset: number): number\n writeUInt8(value: number, offset: number): number\n writeUintBE(value: number, offset: number, byteLength: number): number\n writeUIntBE(value: number, offset: number, byteLength: number): number\n writeUintLE(value: number, offset: number, byteLength: number): number\n writeUIntLE(value: number, offset: number, byteLength: number): number\n}\n\nexport class BufferClass extends Uint8Array /* implements NodeBuffer */ {\n readonly _isBuffer = true\n\n get offset() {\n return this.byteOffset\n }\n\n static alloc(size: number, fill: string | number | Uint8Array = 0, encoding: Encoding = 'utf8') {\n assertString(encoding, 'encoding')\n\n return BufferClass.allocUnsafe(size).fill(fill, encoding)\n }\n\n static allocUnsafe(size: number) {\n return BufferClass.from(size)\n }\n\n static allocUnsafeSlow(size: number) {\n return BufferClass.from(size)\n }\n\n static isBuffer(arg: any): arg is BufferClass {\n return arg && !!arg._isBuffer\n }\n\n static byteLength(string: unknown, encoding: Encoding = 'utf8') {\n if (typeof string === 'string') return stringToBuffer(string, encoding).byteLength\n if (string && string['byteLength']) return string['byteLength']\n\n const e = new TypeError('The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer.')\n e['code'] = 'ERR_INVALID_ARG_TYPE'\n throw e\n }\n\n static isEncoding(encoding: string): encoding is Encoding {\n return Encodings.includes(encoding as any)\n }\n\n static compare(buff1: Uint8Array, buff2: Uint8Array) {\n assertUint8Array(buff1, 'buff1')\n assertUint8Array(buff2, 'buff2')\n\n for (let i = 0; i < buff1.length; i++) {\n if (buff1[i] < buff2[i]) return -1\n if (buff1[i] > buff2[i]) return 1\n }\n\n return buff1.length === buff2.length ? 0 : buff1.length > buff2.length ? 1 : -1\n }\n\n static from(value: unknown, encoding: any = 'utf8'): BufferClass {\n if (value && typeof value === 'object' && value['type'] === 'Buffer') {\n return new BufferClass(value['data'])\n }\n\n if (typeof value === 'number') {\n return new BufferClass(new Uint8Array(value))\n }\n\n if (typeof value === 'string') {\n return stringToBuffer(value, encoding)\n }\n\n if (ArrayBuffer.isView(value)) {\n const { byteOffset, byteLength, buffer } = value\n\n if ('map' in value && typeof value.map === 'function') {\n return new BufferClass(\n value.map((v) => v % 256),\n byteOffset,\n byteLength,\n )\n }\n\n return new BufferClass(buffer, byteOffset, byteLength)\n }\n\n if (value && typeof value === 'object' && ('length' in value || 'byteLength' in value || 'buffer' in value)) {\n return new BufferClass(value as ArrayLike<number>)\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n }\n\n static concat(list: readonly Uint8Array[], totalLength?: number) {\n if (list.length === 0) return BufferClass.alloc(0)\n\n const concat = ([] as number[]).concat(...list.map((item) => [...item]))\n const result = BufferClass.alloc(totalLength !== undefined ? totalLength : concat.length)\n\n result.set(totalLength !== undefined ? concat.slice(0, totalLength) : concat)\n\n return result\n }\n\n slice(start = 0, end = this.length) {\n return this.subarray(start, end)\n }\n\n subarray(start = 0, end = this.length) {\n return Object.setPrototypeOf(super.subarray(start, end), BufferClass.prototype) as BufferClass\n }\n\n reverse() {\n super.reverse()\n\n return this\n }\n\n readIntBE(offset: number, byteLength: number) {\n assertNumber(offset, 'offset')\n assertInteger(offset, 'offset')\n assertUnsigned(offset, 'offset', this.length - 1)\n assertNumber(byteLength, 'byteLength')\n assertInteger(byteLength, 'byteLength')\n\n const view = new DataView(this.buffer, offset, byteLength)\n let val = 0\n for (let i = 0; i < byteLength; i++) {\n val = val * 0x100 + view.getUint8(i)\n }\n\n if (view.getUint8(0) & 0x80) {\n val -= Math.pow(0x100, byteLength)\n }\n\n return val\n }\n\n readIntLE(offset: number, byteLength: number) {\n assertNumber(offset, 'offset')\n assertInteger(offset, 'offset')\n assertUnsigned(offset, 'offset', this.length - 1)\n assertNumber(byteLength, 'byteLength')\n assertInteger(byteLength, 'byteLength')\n\n const view = new DataView(this.buffer, offset, byteLength)\n let val = 0\n for (let i = 0; i < byteLength; i++) {\n val += view.getUint8(i) * Math.pow(0x100, i)\n }\n\n if (view.getUint8(byteLength - 1) & 0x80) {\n val -= Math.pow(0x100, byteLength)\n }\n\n return val\n }\n\n readUIntBE(offset: number, byteLength: number) {\n assertNumber(offset, 'offset')\n assertInteger(offset, 'offset')\n assertUnsigned(offset, 'offset', this.length - 1)\n assertNumber(byteLength, 'byteLength')\n assertInteger(byteLength, 'byteLength')\n\n const view = new DataView(this.buffer, offset, byteLength)\n let val = 0\n for (let i = 0; i < byteLength; i++) {\n val = val * 0x100 + view.getUint8(i)\n }\n\n return val\n }\n\n readUintBE(offset: number, byteLength: number) {\n return this.readUIntBE(offset, byteLength)\n }\n\n readUIntLE(offset: number, byteLength: number) {\n assertNumber(offset, 'offset')\n assertInteger(offset, 'offset')\n assertUnsigned(offset, 'offset', this.length - 1)\n assertNumber(byteLength, 'byteLength')\n assertInteger(byteLength, 'byteLength')\n\n const view = new DataView(this.buffer, offset, byteLength)\n let val = 0\n for (let i = 0; i < byteLength; i++) {\n val += view.getUint8(i) * Math.pow(0x100, i)\n }\n\n return val\n }\n\n readUintLE(offset: number, byteLength: number) {\n return this.readUIntLE(offset, byteLength)\n }\n\n writeIntBE(value: number, offset: number, byteLength: number) {\n value = value < 0 ? value + Math.pow(0x100, byteLength) : value\n return this.writeUIntBE(value, offset, byteLength)\n }\n\n writeIntLE(value: number, offset: number, byteLength: number) {\n value = value < 0 ? value + Math.pow(0x100, byteLength) : value\n return this.writeUIntLE(value, offset, byteLength)\n }\n\n writeUIntBE(value: number, offset: number, byteLength: number) {\n assertNumber(offset, 'offset')\n assertInteger(offset, 'offset')\n assertUnsigned(offset, 'offset', this.length - 1)\n assertNumber(byteLength, 'byteLength')\n assertInteger(byteLength, 'byteLength')\n\n const view = new DataView(this.buffer, offset, byteLength)\n for (let i = byteLength - 1; i >= 0; i--) {\n view.setUint8(i, value & 0xff)\n value = value / 0x100\n }\n\n return offset + byteLength\n }\n\n writeUintBE(value: number, offset: number, byteLength: number) {\n return this.writeUIntBE(value, offset, byteLength)\n }\n\n writeUIntLE(value: number, offset: number, byteLength: number) {\n assertNumber(offset, 'offset')\n assertInteger(offset, 'offset')\n assertUnsigned(offset, 'offset', this.length - 1)\n assertNumber(byteLength, 'byteLength')\n assertInteger(byteLength, 'byteLength')\n\n const view = new DataView(this.buffer, offset, byteLength)\n for (let i = 0; i < byteLength; i++) {\n view.setUint8(i, value & 0xff) // bitwise 0xff is to get the last 8 bits\n value = value / 0x100 // shift 8 bits to the right to iterate\n }\n\n return offset + byteLength\n }\n\n writeUintLE(value: number, offset: number, byteLength: number) {\n return this.writeUIntLE(value, offset, byteLength)\n }\n\n toJSON() {\n return { type: 'Buffer', data: Array.from(this) } as const\n }\n\n swap16() {\n const buffer = new DataView(this.buffer, this.byteOffset, this.byteLength)\n for (let i = 0; i < this.length; i += 2) {\n buffer.setUint16(i, buffer.getUint16(i, true), false)\n }\n return this\n }\n\n swap32() {\n const buffer = new DataView(this.buffer, this.byteOffset, this.byteLength)\n for (let i = 0; i < this.length; i += 4) {\n buffer.setUint32(i, buffer.getUint32(i, true), false)\n }\n return this\n }\n\n swap64() {\n const view = new DataView(this.buffer, this.byteOffset, this.byteLength)\n for (let i = 0; i < this.length; i += 8) {\n view.setBigUint64(i, view.getBigUint64(i, true), false)\n }\n return this\n }\n\n compare(target: Uint8Array, targetStart = 0, targetEnd = target.length, sourceStart = 0, sourceEnd = this.length) {\n assertUint8Array(target, 'target')\n assertNumber(targetStart, 'targetStart')\n assertNumber(targetEnd, 'targetEnd')\n assertNumber(sourceStart, 'sourceStart')\n assertNumber(sourceEnd, 'sourceEnd')\n assertUnsigned(targetStart, 'targetStart')\n assertUnsigned(targetEnd, 'targetEnd', target.length)\n assertUnsigned(sourceStart, 'sourceStart')\n assertUnsigned(sourceEnd, 'sourceEnd', this.length)\n\n return BufferClass.compare(this.slice(sourceStart, sourceEnd), target.slice(targetStart, targetEnd))\n }\n\n equals(otherBuffer: Uint8Array) {\n assertUint8Array(otherBuffer, 'otherBuffer')\n\n return this.length === otherBuffer.length && this.every((v, i) => v === otherBuffer[i])\n }\n\n copy(target: Uint8Array, targetStart = 0, sourceStart = 0, sourceEnd = this.length) {\n assertUnsigned(targetStart, 'targetStart')\n assertUnsigned(sourceStart, 'sourceStart', this.length)\n assertUnsigned(sourceEnd, 'sourceEnd')\n\n targetStart >>>= 0\n sourceStart >>>= 0\n sourceEnd >>>= 0\n\n let copiedBytes = 0\n while (sourceStart < sourceEnd) {\n if (this[sourceStart] === undefined) break\n if (target[targetStart] === undefined) break\n\n target[targetStart] = this[sourceStart]\n copiedBytes++\n sourceStart++\n targetStart++\n }\n\n return copiedBytes\n }\n\n write(string: string, encoding?: Encoding): number\n write(string: string, offset: number, encoding?: Encoding): number\n write(string: string, offset: number, length: number, encoding?: Encoding): number\n write(string: string, offsetEnc?: number | Encoding, lengthEnc?: number | Encoding, encoding: Encoding = 'utf8') {\n const offset = typeof offsetEnc === 'string' ? 0 : offsetEnc ?? 0\n let length = typeof lengthEnc === 'string' ? this.length - offset : lengthEnc ?? this.length - offset\n encoding = typeof offsetEnc === 'string' ? offsetEnc : typeof lengthEnc === 'string' ? lengthEnc : encoding\n\n assertNumber(offset, 'offset')\n assertNumber(length, 'length')\n assertUnsigned(offset, 'offset', this.length)\n assertUnsigned(length, 'length', this.length)\n\n if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {\n length = length - (length % 2)\n }\n\n return stringToBuffer(string, encoding).copy(this, offset, 0, length)\n }\n\n fill(\n value: string | number | Uint8Array = 0,\n offsetEnc: number | Encoding = 0,\n endEnc: number | Encoding = this.length,\n encoding: Encoding = 'utf-8',\n ) {\n const offset = typeof offsetEnc === 'string' ? 0 : offsetEnc\n const end = typeof endEnc === 'string' ? this.length : endEnc\n encoding = typeof offsetEnc === 'string' ? offsetEnc : typeof endEnc === 'string' ? endEnc : encoding\n value = BufferClass.from(typeof value === 'number' ? [value] : value ?? [], encoding)\n\n assertString(encoding, 'encoding')\n assertUnsigned(offset, 'offset', this.length)\n assertUnsigned(end, 'end', this.length)\n\n if (value.length !== 0) {\n for (let i = offset; i < end; i += value.length) {\n super.set(value.slice(0, value.length + i >= this.length ? this.length - i : value.length), i)\n }\n }\n\n return this\n }\n\n includes(value: string | number | Uint8Array, byteOffset: number | null = null, encoding: Encoding = 'utf-8') {\n return this.indexOf(value, byteOffset, encoding) !== -1\n }\n\n lastIndexOf(\n value: string | number | Uint8Array,\n byteOffsetOrEncoding: number | Encoding | null = null,\n encoding: Encoding = 'utf-8',\n ) {\n return this.indexOf(value, byteOffsetOrEncoding, encoding, true)\n }\n\n indexOf(\n value: string | number | Uint8Array,\n byteOffsetOrEncoding: number | Encoding | null = null,\n encoding: Encoding = 'utf-8',\n lastIndexOf = false,\n ) {\n const method = lastIndexOf ? this.findLastIndex.bind(this) : this.findIndex.bind(this)\n encoding = typeof byteOffsetOrEncoding === 'string' ? byteOffsetOrEncoding : encoding\n const toSearch = BufferClass.from(typeof value === 'number' ? [value] : value, encoding)\n let byteOffset = typeof byteOffsetOrEncoding === 'string' ? 0 : byteOffsetOrEncoding\n byteOffset = typeof byteOffsetOrEncoding === 'number' ? byteOffset : null\n byteOffset = Number.isNaN(byteOffset) ? null : byteOffset\n byteOffset ??= lastIndexOf ? this.length : 0\n byteOffset = byteOffset < 0 ? this.length + byteOffset : byteOffset\n\n if (toSearch.length === 0 && lastIndexOf === false) {\n return byteOffset >= this.length ? this.length : byteOffset\n }\n if (toSearch.length === 0 && lastIndexOf === true) {\n return (byteOffset >= this.length ? this.length : byteOffset) || this.length\n }\n\n return method((_, i) => {\n const searchIf = lastIndexOf ? i <= byteOffset! : i >= byteOffset!\n return searchIf && this[i] === toSearch[0] && toSearch.every((val, j) => this[i + j] === val)\n })\n }\n\n toString(encoding: Encoding = 'utf8', start = 0, end = this.length) {\n start = start < 0 ? 0 : start\n encoding = encoding.toString().toLowerCase() as Encoding\n\n if (end <= 0) return ''\n\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return decoder.decode(this.slice(start, end))\n }\n if (encoding === 'base64' || encoding === 'base64url') {\n const string = btoa(this.reduce((s, v) => s + c2s(v), ''))\n\n if (encoding === 'base64url') {\n return string.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n }\n\n return string\n }\n if (encoding === 'binary' || encoding === 'ascii' || encoding === 'latin1' || encoding === 'latin-1') {\n return this.slice(start, end).reduce((s, v) => s + c2s(v & (encoding === 'ascii' ? 0x7f : 0xff)), '')\n }\n if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {\n const view = new DataView(this.buffer.slice(start, end))\n return Array.from({ length: view.byteLength / 2 }, (_, i) => {\n // if the byte length is odd, the last character will be ignored\n return i * 2 + 1 < view.byteLength ? c2s(view.getUint16(i * 2, true)) : ''\n }).join('')\n }\n if (encoding === 'hex') {\n return this.slice(start, end).reduce((s, v) => s + v.toString(16).padStart(2, '0'), '')\n }\n\n bufferPolyfillDoesNotImplement(`encoding \"${encoding}\"`)\n }\n\n toLocaleString() {\n return this.toString()\n }\n\n inspect() {\n const hex = this.toString('hex')\n const byteHex = hex.match(/.{1,2}/g)!.join(' ')\n\n return `<Buffer ${byteHex}>`\n }\n}\n\nfunction stringToBuffer(value: string, encoding: string) {\n encoding = encoding.toLowerCase() as Encoding\n\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return new BufferClass(encoder.encode(value))\n }\n if (encoding === 'base64' || encoding === 'base64url') {\n value = value.replace(/-/g, '+').replace(/_/g, '/')\n value = value.replace(/[^A-Za-z0-9+/]/g, '')\n\n return new BufferClass([...atob(value)].map((v) => v.charCodeAt(0)))\n }\n if (encoding === 'binary' || encoding === 'ascii' || encoding === 'latin1' || encoding === 'latin-1') {\n return new BufferClass([...value].map((v) => v.charCodeAt(0)))\n }\n if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {\n const buffer = new BufferClass(value.length * 2)\n const view = new DataView(buffer.buffer)\n for (let i = 0; i < value.length; i++) {\n view.setUint16(i * 2, value.charCodeAt(i), true)\n }\n return buffer\n }\n if (encoding === 'hex') {\n const bytes = new BufferClass(value.length / 2)\n for (let byteIndex = 0, i = 0; i < value.length; i += 2, byteIndex++) {\n bytes[byteIndex] = parseInt(value.slice(i, i + 2), 16)\n }\n\n return bytes\n }\n\n bufferPolyfillDoesNotImplement(`encoding \"${encoding}\"`)\n}\n\nfunction initReadMethods(prototype: BufferClass) {\n const dataViewProtoProps = Object.getOwnPropertyNames(DataView.prototype)\n const dataViewMethods = dataViewProtoProps.filter((m) => m.startsWith('get') || m.startsWith('set'))\n const bufferBaseMethods = dataViewMethods.map((m) => m.replace('get', 'read').replace('set', 'write'))\n\n const genericReadMethod = (i: number, littleEndian: boolean) => {\n return function (this: BufferClass, offset = 0) {\n assertNumber(offset, 'offset')\n assertInteger(offset, 'offset')\n assertUnsigned(offset, 'offset', this.length - 1)\n return new DataView(this.buffer)[dataViewMethods[i]](offset, littleEndian)\n }\n }\n\n const genericWriteMethod = (i: number, littleEndian: boolean) => {\n return function (this: BufferClass, value: any, offset = 0) {\n const boundKey = dataViewMethods[i].match(/set(\\w+\\d+)/)![1].toLowerCase()\n const bound = bounds[boundKey as keyof typeof bounds]\n\n assertNumber(offset, 'offset')\n assertInteger(offset, 'offset')\n assertUnsigned(offset, 'offset', this.length - 1)\n assertBounds(value, 'value', bound[0], bound[1])\n new DataView(this.buffer)[dataViewMethods[i]](offset, value, littleEndian)\n return offset + parseInt(dataViewMethods[i].match(/\\d+/)![0]) / 8\n }\n }\n\n const createAlias = (methods: string[]) => {\n methods.forEach((method) => {\n if (method.includes('Uint')) prototype[method.replace('Uint', 'UInt')] = prototype[method]\n if (method.includes('Float64')) prototype[method.replace('Float64', 'Double')] = prototype[method]\n if (method.includes('Float32')) prototype[method.replace('Float32', 'Float')] = prototype[method]\n })\n }\n\n bufferBaseMethods.forEach((method, i) => {\n if (method.startsWith('read')) {\n prototype[method] = genericReadMethod(i, false)\n prototype[method + 'LE'] = genericReadMethod(i, true)\n prototype[method + 'BE'] = genericReadMethod(i, false)\n }\n if (method.startsWith('write')) {\n prototype[method] = genericWriteMethod(i, false)\n prototype[method + 'LE'] = genericWriteMethod(i, true)\n prototype[method + 'BE'] = genericWriteMethod(i, false)\n }\n createAlias([method, method + 'LE', method + 'BE'])\n })\n}\n\nfunction bufferPolyfillDoesNotImplement(message: string): never {\n throw new Error(`Buffer polyfill does not implement \"${message}\"`)\n}\n\nfunction assertUint8Array(value: any, argName: string): asserts value is Uint8Array {\n if (!(value instanceof Uint8Array)) {\n throw new TypeError(`The \"${argName}\" argument must be an instance of Buffer or Uint8Array`)\n }\n}\n\nfunction assertUnsigned(value: number, argName: string, maxValue = MAX_UNSIGNED_32_BIT + 1) {\n if (value < 0 || value > maxValue) {\n const e = new RangeError(\n `The value of \"${argName}\" is out of range. It must be >= 0 && <= ${maxValue}. Received ${value}`,\n )\n e['code'] = 'ERR_OUT_OF_RANGE'\n throw e\n }\n}\n\nfunction assertNumber(value: any, argName: string): asserts value is number {\n if (typeof value !== 'number') {\n const e = new TypeError(`The \"${argName}\" argument must be of type number. Received type ${typeof value}.`)\n e['code'] = 'ERR_INVALID_ARG_TYPE'\n throw e\n }\n}\n\nfunction assertInteger(value: any, argName: string): asserts value is number {\n if (!Number.isInteger(value) || Number.isNaN(value)) {\n const e = new RangeError(`The value of \"${argName}\" is out of range. It must be an integer. Received ${value}`)\n e['code'] = 'ERR_OUT_OF_RANGE'\n throw e\n }\n}\n\nfunction assertBounds(value: number, argName: string, min: any, max: any) {\n if (value < min || value > max) {\n const e = new RangeError(\n `The value of \"${argName}\" is out of range. It must be >= ${min} and <= ${max}. Received ${value}`,\n )\n e['code'] = 'ERR_OUT_OF_RANGE'\n throw e\n }\n}\n\nfunction assertString(value: any, argName: string): asserts value is string {\n if (typeof value !== 'string') {\n const e = new TypeError(`The \"${argName}\" argument must be of type string. Received type ${typeof value}`)\n e['code'] = 'ERR_INVALID_ARG_TYPE'\n throw e\n }\n}\n\nconst bounds = {\n int8: [-0x80, 0x7f],\n int16: [-0x8000, 0x7fff],\n int32: [-0x80000000, 0x7fffffff],\n uint8: [0, 0xff],\n uint16: [0, 0xffff],\n uint32: [0, 0xffffffff],\n float32: [-Infinity, Infinity],\n float64: [-Infinity, Infinity],\n bigint64: [-0x8000000000000000n, 0x7fffffffffffffffn],\n biguint64: [0n, 0xffffffffffffffffn],\n} as const\n\nconst encoder = new TextEncoder()\nconst decoder = new TextDecoder()\n\nexport type Encoding = (typeof Encodings)[number]\n\nconst Encodings = [\n 'utf8',\n 'utf-8',\n 'hex',\n 'base64',\n 'ascii',\n 'binary',\n 'base64url',\n 'ucs2',\n 'ucs-2',\n 'utf16le',\n 'utf-16le',\n 'latin1',\n 'latin-1',\n] as const\n\nconst MAX_UNSIGNED_32_BIT = 0xffffffff\n\ninitReadMethods(BufferClass.prototype)\n\nfunction $Buffer(value: unknown, encoding: any = 'utf8') {\n return BufferClass.from(value, encoding)\n}\n\nexport const Buffer = new Proxy($Buffer, {\n construct(_, [value, encoding]) {\n return BufferClass.from(value, encoding)\n },\n get(_, prop) {\n return BufferClass[prop]\n },\n}) as typeof $Buffer & typeof BufferClass\n\nconst c2s = String.fromCodePoint\n\nexport default Buffer\n", "export const process: Partial<NodeJS.Process> = {\n nextTick: (fn: Function, ...args: unknown[]) => {\n setTimeout(() => {\n fn(...args)\n }, 0)\n },\n env: {},\n version: '',\n cwd: () => '/',\n stderr: {} as any,\n argv: ['/bin/node'],\n pid: 10000,\n}\n\nexport const { cwd } = process\nexport default process\n", "const performance =\n globalThis['performance'] ??\n (() => {\n const origin = Date.now()\n return {\n now: () => Date.now() - origin,\n }\n })()\n\nexport { performance }\nexport default { performance }\n", "export const fn = () => {}\n\nfn.prototype = fn\n", "export class WeakRef<T> {\n value: T\n\n constructor(value: T) {\n this.value = value\n }\n\n deref() {\n return this.value\n }\n}\n", "/*\r\n * decimal.js-light v2.5.1\r\n * An arbitrary-precision Decimal type for JavaScript.\r\n * https://github.com/MikeMcl/decimal.js-light\r\n * Copyright (c) 2020 Michael Mclaughlin <M8ch88l@gmail.com>\r\n * MIT Expat Licence\r\n */\r\n\r\n\r\n// ------------------------------------ EDITABLE DEFAULTS ------------------------------------- //\r\n\r\n\r\n// The limit on the value of `precision`, and on the value of the first argument to\r\n// `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.\r\nvar MAX_DIGITS = 1e9, // 0 to 1e9\r\n\r\n\r\n // The initial configuration properties of the Decimal constructor.\r\n defaults = {\r\n\r\n // These values must be integers within the stated ranges (inclusive).\r\n // Most of these values can be changed during run-time using `Decimal.config`.\r\n\r\n // The maximum number of significant digits of the result of a calculation or base conversion.\r\n // E.g. `Decimal.config({ precision: 20 });`\r\n precision: 20, // 1 to MAX_DIGITS\r\n\r\n // The rounding mode used by default by `toInteger`, `toDecimalPlaces`, `toExponential`,\r\n // `toFixed`, `toPrecision` and `toSignificantDigits`.\r\n //\r\n // ROUND_UP 0 Away from zero.\r\n // ROUND_DOWN 1 Towards zero.\r\n // ROUND_CEIL 2 Towards +Infinity.\r\n // ROUND_FLOOR 3 Towards -Infinity.\r\n // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n //\r\n // E.g.\r\n // `Decimal.rounding = 4;`\r\n // `Decimal.rounding = Decimal.ROUND_HALF_UP;`\r\n rounding: 4, // 0 to 8\r\n\r\n // The exponent value at and beneath which `toString` returns exponential notation.\r\n // JavaScript numbers: -7\r\n toExpNeg: -7, // 0 to -MAX_E\r\n\r\n // The exponent value at and above which `toString` returns exponential notation.\r\n // JavaScript numbers: 21\r\n toExpPos: 21, // 0 to MAX_E\r\n\r\n // The natural logarithm of 10.\r\n // 115 digits\r\n LN10: '2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286'\r\n },\r\n\r\n\r\n// ------------------------------------ END OF EDITABLE DEFAULTS -------------------------------- //\r\n\r\n\r\n Decimal,\r\n external = true,\r\n\r\n decimalError = '[DecimalError] ',\r\n invalidArgument = decimalError + 'Invalid argument: ',\r\n exponentOutOfRange = decimalError + 'Exponent out of range: ',\r\n\r\n mathfloor = Math.floor,\r\n mathpow = Math.pow,\r\n\r\n isDecimal = /^(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,\r\n\r\n ONE,\r\n BASE = 1e7,\r\n LOG_BASE = 7,\r\n MAX_SAFE_INTEGER = 9007199254740991,\r\n MAX_E = mathfloor(MAX_SAFE_INTEGER / LOG_BASE), // 1286742750677284\r\n\r\n // Decimal.prototype object\r\n P = {};\r\n\r\n\r\n// Decimal prototype methods\r\n\r\n\r\n/*\r\n * absoluteValue abs\r\n * comparedTo cmp\r\n * decimalPlaces dp\r\n * dividedBy div\r\n * dividedToIntegerBy idiv\r\n * equals eq\r\n * exponent\r\n * greaterThan gt\r\n * greaterThanOrEqualTo gte\r\n * isInteger isint\r\n * isNegative isneg\r\n * isPositive ispos\r\n * isZero\r\n * lessThan lt\r\n * lessThanOrEqualTo lte\r\n * logarithm log\r\n * minus sub\r\n * modulo mod\r\n * naturalExponential exp\r\n * naturalLogarithm ln\r\n * negated neg\r\n * plus add\r\n * precision sd\r\n * squareRoot sqrt\r\n * times mul\r\n * toDecimalPlaces todp\r\n * toExponential\r\n * toFixed\r\n * toInteger toint\r\n * toNumber\r\n * toPower pow\r\n * toPrecision\r\n * toSignificantDigits tosd\r\n * toString\r\n * valueOf val\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the absolute value of this Decimal.\r\n *\r\n */\r\nP.absoluteValue = P.abs = function () {\r\n var x = new this.constructor(this);\r\n if (x.s) x.s = 1;\r\n return x;\r\n};\r\n\r\n\r\n/*\r\n * Return\r\n * 1 if the value of this Decimal is greater than the value of `y`,\r\n * -1 if the value of this Decimal is less than the value of `y`,\r\n * 0 if they have the same value\r\n *\r\n */\r\nP.comparedTo = P.cmp = function (y) {\r\n var i, j, xdL, ydL,\r\n x = this;\r\n\r\n y = new x.constructor(y);\r\n\r\n // Signs differ?\r\n if (x.s !== y.s) return x.s || -y.s;\r\n\r\n // Compare exponents.\r\n if (x.e !== y.e) return x.e > y.e ^ x.s < 0 ? 1 : -1;\r\n\r\n xdL = x.d.length;\r\n ydL = y.d.length;\r\n\r\n // Compare digit by digit.\r\n for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {\r\n if (x.d[i] !== y.d[i]) return x.d[i] > y.d[i] ^ x.s < 0 ? 1 : -1;\r\n }\r\n\r\n // Compare lengths.\r\n return xdL === ydL ? 0 : xdL > ydL ^ x.s < 0 ? 1 : -1;\r\n};\r\n\r\n\r\n/*\r\n * Return the number of decimal places of the value of this Decimal.\r\n *\r\n */\r\nP.decimalPlaces = P.dp = function () {\r\n var x = this,\r\n w = x.d.length - 1,\r\n dp = (w - x.e) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n w = x.d[w];\r\n if (w) for (; w % 10 == 0; w /= 10) dp--;\r\n\r\n return dp < 0 ? 0 : dp;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal divided by `y`, truncated to\r\n * `precision` significant digits.\r\n *\r\n */\r\nP.dividedBy = P.div = function (y) {\r\n return divide(this, new this.constructor(y));\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the integer part of dividing the value of this Decimal\r\n * by the value of `y`, truncated to `precision` significant digits.\r\n *\r\n */\r\nP.dividedToIntegerBy = P.idiv = function (y) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n return round(divide(x, new Ctor(y), 0, 1), Ctor.precision);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.\r\n *\r\n */\r\nP.equals = P.eq = function (y) {\r\n return !this.cmp(y);\r\n};\r\n\r\n\r\n/*\r\n * Return the (base 10) exponent value of this Decimal (this.e is the base 10000000 exponent).\r\n *\r\n */\r\nP.exponent = function () {\r\n return getBase10Exponent(this);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than the value of `y`, otherwise return\r\n * false.\r\n *\r\n */\r\nP.greaterThan = P.gt = function (y) {\r\n return this.cmp(y) > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than or equal to the value of `y`,\r\n * otherwise return false.\r\n *\r\n */\r\nP.greaterThanOrEqualTo = P.gte = function (y) {\r\n return this.cmp(y) >= 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is an integer, otherwise return false.\r\n *\r\n */\r\nP.isInteger = P.isint = function () {\r\n return this.e > this.d.length - 2;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is negative, otherwise return false.\r\n *\r\n */\r\nP.isNegative = P.isneg = function () {\r\n return this.s < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is positive, otherwise return false.\r\n *\r\n */\r\nP.isPositive = P.ispos = function () {\r\n return this.s > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is 0, otherwise return false.\r\n *\r\n */\r\nP.isZero = function () {\r\n return this.s === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThan = P.lt = function (y) {\r\n return this.cmp(y) < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThanOrEqualTo = P.lte = function (y) {\r\n return this.cmp(y) < 1;\r\n};\r\n\r\n\r\n/*\r\n * Return the logarithm of the value of this Decimal to the specified base, truncated to\r\n * `precision` significant digits.\r\n *\r\n * If no base is specified, return log[10](x).\r\n *\r\n * log[base](x) = ln(x) / ln(base)\r\n *\r\n * The maximum error of the result is 1 ulp (unit in the last place).\r\n *\r\n * [base] {number|string|Decimal} The base of the logarithm.\r\n *\r\n */\r\nP.logarithm = P.log = function (base) {\r\n var r,\r\n x = this,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision,\r\n wpr = pr + 5;\r\n\r\n // Default base is 10.\r\n if (base === void 0) {\r\n base = new Ctor(10);\r\n } else {\r\n base = new Ctor(base);\r\n\r\n // log[-b](x) = NaN\r\n // log[0](x) = NaN\r\n // log[1](x) = NaN\r\n if (base.s < 1 || base.eq(ONE)) throw Error(decimalError + 'NaN');\r\n }\r\n\r\n // log[b](-x) = NaN\r\n // log[b](0) = -Infinity\r\n if (x.s < 1) throw Error(decimalError + (x.s ? 'NaN' : '-Infinity'));\r\n\r\n // log[b](1) = 0\r\n if (x.eq(ONE)) return new Ctor(0);\r\n\r\n external = false;\r\n r = divide(ln(x, wpr), ln(base, wpr), wpr);\r\n external = true;\r\n\r\n return round(r, pr);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal minus `y`, truncated to\r\n * `pre