@etherna/sdk-js
Version:
Etherna SDKs for operations on the network
1 lines • 916 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../src/clients/bee/utils/contants.ts","../../src/utils/batches.ts","../../src/utils/buffer.ts","../../src/utils/bzz.ts","../../node_modules/.pnpm/tslib@1.14.1/node_modules/tslib/tslib.es6.js","../../node_modules/.pnpm/crypto-ts@1.0.2_@angular+common@19.2.8_@angular+core@19.2.8/node_modules/crypto-ts/esm5/crypto-ts.js","../../node_modules/.pnpm/@fairdatasociety+bmt-js@2.1.0/node_modules/@fairdatasociety/bmt-js/dist/index.js","../../node_modules/.pnpm/js-sha3@0.9.3/node_modules/js-sha3/src/sha3.js","../../node_modules/.pnpm/@noble+secp256k1@2.1.0/node_modules/@noble/secp256k1/index.js","../../src/utils/bytes.ts","../../src/handlers/mantaray/types.ts","../../src/handlers/mantaray/utils.ts","../../src/handlers/mantaray/index.ts","../../src/utils/mantaray.ts","../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs","../../src/schemas/base.ts","../../src/utils/time.ts","../../src/utils/urls.ts","../../node_modules/.pnpm/cookiejs@2.1.3/node_modules/cookiejs/dist/cookie.esm.js","../../src/clients/bee/auth.ts","../../src/clients/bee/utils/bytes.ts","../../src/clients/bee/utils/headers.ts","../../src/clients/bee/bytes.ts","../../src/clients/bee/bzz.ts","../../src/clients/bee/chainstate.ts","../../src/clients/bee/chunk.ts","../../src/classes/EpochIndex.ts","../../src/classes/EpochFeedChunk.ts","../../src/classes/EpochFeed.ts","../../node_modules/.pnpm/zustand@4.5.2_immer@10.0.4_react@18.3.1/node_modules/zustand/esm/middleware.mjs","../../node_modules/.pnpm/zustand@4.5.2_immer@10.0.4_react@18.3.1/node_modules/zustand/esm/middleware/immer.mjs","../../node_modules/.pnpm/zustand@4.5.2_immer@10.0.4_react@18.3.1/node_modules/zustand/esm/vanilla.mjs","../../src/stores/batches.ts","../../src/clients/bee/utils/hex.ts","../../src/clients/bee/utils/reference.ts","../../src/clients/bee/utils/uint64.ts","../../src/clients/bee/feeds.ts","../../src/clients/bee/pins.ts","../../src/clients/bee/utils/bmt.ts","../../src/clients/bee/utils/chunk.ts","../../src/clients/bee/utils/signer.ts","../../src/clients/bee/soc.ts","../../src/clients/bee/stamps.ts","../../src/clients/bee/tags.ts","../../src/clients/bee/index.ts","../../src/clients/base-client.ts","../../src/clients/index/comments.ts","../../src/clients/index/moderation.ts","../../src/clients/index/search.ts","../../src/clients/index/system.ts","../../src/clients/index/users.ts","../../src/clients/index/videos.ts","../../src/clients/index/index.ts","../../src/clients/gateway/postage.ts","../../src/clients/gateway/resources.ts","../../src/clients/gateway/system.ts","../../src/clients/gateway/users.ts","../../src/clients/gateway/index.ts","../../src/clients/sso/identity.ts","../../src/clients/sso/index.ts"],"sourcesContent":["export const SPAN_SIZE = 8\nexport const MAX_SPAN_LENGTH = 2 ** 32 - 1\nexport const SECTION_SIZE = 32\nexport const BRANCHES = 128\nexport const CHUNK_SIZE = SECTION_SIZE * BRANCHES\n\nexport const MAX_CHUNK_PAYLOAD_SIZE = 4096\nexport const SEGMENT_SIZE = 32\nexport const SEGMENT_PAIR_SIZE = 2 * SEGMENT_SIZE\nexport const HASH_SIZE = 32\n\nexport const MIN_PAYLOAD_SIZE = 1\nexport const MAX_PAYLOAD_SIZE = 4096\nexport const CAC_SPAN_OFFSET = 0\nexport const CAC_PAYLOAD_OFFSET = CAC_SPAN_OFFSET + SPAN_SIZE\n\nexport const IDENTIFIER_SIZE = 32\nexport const SIGNATURE_SIZE = 65\nexport const SOC_IDENTIFIER_OFFSET = 0\nexport const SOC_SIGNATURE_OFFSET = SOC_IDENTIFIER_OFFSET + IDENTIFIER_SIZE\nexport const SOC_SPAN_OFFSET = SOC_SIGNATURE_OFFSET + SIGNATURE_SIZE\nexport const SOC_PAYLOAD_OFFSET = SOC_SPAN_OFFSET + SPAN_SIZE\n\nexport const ADDRESS_HEX_LENGTH = 64\nexport const PSS_TARGET_HEX_LENGTH_MAX = 6\nexport const PUBKEY_HEX_LENGTH = 66\nexport const BATCH_ID_HEX_LENGTH = 64\nexport const REFERENCE_HEX_LENGTH = 64\nexport const ENCRYPTED_REFERENCE_HEX_LENGTH = 128\nexport const REFERENCE_BYTES_LENGTH = 32\nexport const ENCRYPTED_REFERENCE_BYTES_LENGTH = 64\n\nexport const BUCKET_DEPTH = 16\nexport const STAMPS_DEPTH_MIN = 17\nexport const STAMPS_DEPTH_MAX = 255\n\nexport const TAGS_LIMIT_MIN = 1\nexport const TAGS_LIMIT_MAX = 1000\n\nexport const FEED_INDEX_HEX_LENGTH = 16\n","import type { GatewayBatch, PostageBatch } from \"../clients\"\n\n/**\n * Get postage batch space utilization (in bytes)\n *\n * @param batch Batch data\n * @returns An object with total, used and available space\n */\nexport const getBatchSpace = (batch: PostageBatch | GatewayBatch) => {\n const { utilization, depth, bucketDepth } = batch\n\n const usage = utilization / 2 ** (depth - bucketDepth)\n const total = 2 ** depth * 4096\n const used = total * usage\n const available = total - used\n\n return {\n total,\n used,\n available,\n }\n}\n\n/**\n * Get batch capacity\n *\n * @param batchOrDepth Batch data or depth\n * @returns Batch total capcity in bytes\n */\nexport const getBatchCapacity = (batchOrDepth: PostageBatch | GatewayBatch | number) => {\n const depth = typeof batchOrDepth === \"number\" ? batchOrDepth : batchOrDepth.depth\n return 2 ** depth * 4096\n}\n\n/**\n * Get batch utilization in percentage (0-1)\n *\n * @param batch Batch data\n * @returns Batch percent usage\n */\nexport const getBatchPercentUtilization = (batch: PostageBatch | GatewayBatch) => {\n const { utilization, depth, bucketDepth } = batch\n return utilization / 2 ** (depth - bucketDepth)\n}\n\n/**\n * Get the batch expiration day\n *\n * @param batch Batch data\n * @returns Expiration dayjs object\n */\nexport const getBatchExpiration = (batch: PostageBatch | GatewayBatch): \"unlimited\" | Date => {\n if (batch.batchTTL === -1) {\n return \"unlimited\"\n }\n const date = new Date()\n date.setSeconds(date.getSeconds() + batch.batchTTL)\n return date\n}\n\n/**\n * Parse a default postage batch to a gateway batch\n *\n * @param batch Postage batch\n * @returns Gateway batch\n */\nexport const parsePostageBatch = (batch: PostageBatch): GatewayBatch => {\n return {\n id: batch.batchID,\n amountPaid: 0,\n normalisedBalance: 0,\n amount: batch.amount,\n batchTTL: batch.batchTTL,\n blockNumber: batch.blockNumber,\n bucketDepth: batch.bucketDepth,\n depth: batch.depth,\n exists: batch.exists,\n immutableFlag: batch.immutableFlag,\n label: batch.label,\n usable: batch.usable,\n utilization: batch.utilization,\n }\n}\n\n/**\n * Parse a gateway batch to a standard postage batch\n *\n * @param batch Gateway batch\n * @returns Postage batch\n */\nexport const parseGatewayBatch = (batch: GatewayBatch): PostageBatch => {\n return {\n batchID: batch.id,\n amount: batch.amount,\n batchTTL: batch.batchTTL,\n blockNumber: batch.blockNumber,\n bucketDepth: batch.bucketDepth,\n depth: batch.depth,\n exists: batch.exists,\n immutableFlag: batch.immutableFlag,\n label: batch.label,\n usable: batch.usable,\n utilization: batch.utilization,\n }\n}\n\n/**\n * Convert TTL to batch amount\n *\n * @param ttl TTL in seconds\n * @param price Token price\n * @param blockTime Chain blocktime\n * @returns Batch amount\n */\nexport const ttlToAmount = (ttl: number, price: number, blockTime: number): bigint => {\n return (BigInt(ttl) * BigInt(price)) / BigInt(blockTime)\n}\n\n/**\n * Calc batch price from depth & amount\n *\n * @param depth Batch depth\n * @param amount Batch amount\n * @returns Price in BZZ\n */\nexport const calcBatchPrice = (depth: number, amount: bigint | string): string => {\n const hasInvalidInput = BigInt(amount) <= BigInt(0) || isNaN(depth) || depth < 17 || depth > 255\n\n if (hasInvalidInput) {\n return \"-\"\n }\n\n const tokenDecimals = 16\n const price = BigInt(amount) * BigInt(2 ** depth)\n // @ts-ignore\n const readablePrice = price.toString() / 10 ** tokenDecimals\n\n return `${readablePrice} BZZ`\n}\n\n/**\n * Calculate the batch TTL after a dilute\n *\n * @param currentTTL Current batch TTL\n * @param currentDepth Current batch depth\n * @param newDepth New batch depth\n * @returns The projected batch TTL\n */\nexport const calcDilutedTTL = (\n currentTTL: number,\n currentDepth: number,\n newDepth: number,\n): number => {\n return Math.ceil(currentTTL / 2 ** (newDepth - currentDepth))\n}\n","/**\n * Get the array buffer of a file\n *\n * @param file File to convert\n * @returns The array buffer data\n */\nexport const fileToBuffer = (file: File | Blob) => {\n return new Promise<ArrayBuffer>((resolve, reject) => {\n let fr = new FileReader()\n fr.onload = () => {\n resolve(fr.result as ArrayBuffer)\n }\n fr.onabort = reject\n fr.onerror = reject\n fr.readAsArrayBuffer(file)\n })\n}\n/**\n * Get the array buffer of a file\n *\n * @param file File to convert\n * @returns The array buffer data\n */\nexport const fileToUint8Array = async (file: File) => {\n const buffer = await fileToBuffer(file)\n return new Uint8Array(buffer)\n}\n\n/**\n * Convert a file to a data URL string\n *\n * @param file File to convert\n * @returns The base64 data URL\n */\nexport const fileToDataURL = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const fr = new FileReader()\n fr.onload = () => {\n resolve(fr.result as string)\n }\n fr.onabort = reject\n fr.onerror = reject\n fr.readAsDataURL(file)\n })\n}\n\n/**\n * Convert a buffer to a File object\n *\n * @param buffer Buffer to convert\n * @param contentType Mime type of the array buffer\n * @returns The file object\n */\nexport const bufferToFile = (buffer: ArrayBuffer, contentType?: string) => {\n return new Blob([buffer], { type: contentType }) as File\n}\n\n/**\n * Convert a buffer to a data URL string\n *\n * @param buffer Buffer to convert\n * @returns The base64 data URL\n */\nexport const bufferToDataURL = (buffer: ArrayBuffer) => fileToDataURL(bufferToFile(buffer))\n\n/**\n * Convert a string to bae64\n *\n * @param str String to convert\n * @returns\n */\nexport const stringToBase64 = (str: string): string => {\n if (typeof window === \"undefined\") {\n return Buffer.from(str).toString(\"base64\")\n } else {\n return window.btoa(str)\n }\n}\n\nexport const buffersEquals = (a: Uint8Array, b: Uint8Array) => {\n return a.length === b.length && a.every((value, index) => value === b[index])\n}\n","import type { Reference } from \"../clients\"\n\nexport const BZZ_REFERENCE_REGEX = /^[0-9a-f]{64}$/\n\nexport const isValidReference = (reference: string): reference is Reference => {\n return BZZ_REFERENCE_REGEX.test(reference)\n}\n\nexport function getBzzUrl(origin: string, reference: string, path?: string): string {\n const baseReference = (() => {\n if (path && isValidReference(path)) return path\n if (isValidReference(reference)) return reference\n return null\n })()\n const basePath = (() => {\n if (path && isValidReference(path)) return \"\"\n return path ?? \"\"\n })()\n\n if (!baseReference) {\n throw new Error(\"Provide a valid reference\")\n }\n const url = new URL(`/bzz/${baseReference}/${basePath}`, origin)\n // add trailing slash to root to avoid CORS errors due to redirects\n if (!basePath) {\n url.pathname = url.pathname.replace(/\\/?$/, \"/\")\n }\n return url.href\n}\n\nexport function extractReference(bzzUrl: string): string {\n if (isValidReference(bzzUrl)) return bzzUrl\n\n const reference = bzzUrl.match(/\\/bzz\\/([A-Fa-f0-9]{64})/)?.[1]\n\n if (!reference) {\n throw new Error(`Invalid bzz URL: ${bzzUrl}`)\n }\n\n return reference\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * @license crypto-ts\n * MIT license\n */\n\nimport { __extends } from 'tslib';\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nvar Hex = /** @class */ (function () {\n function Hex() {\n }\n /**\n * Converts a word array to a hex string.\n *\n * \\@example\n *\n * let hexString = Hex.stringify(wordArray);\n * @param {?} wordArray The word array.\n *\n * @return {?} The hex string.\n *\n */\n Hex.stringify = /**\n * Converts a word array to a hex string.\n *\n * \\@example\n *\n * let hexString = Hex.stringify(wordArray);\n * @param {?} wordArray The word array.\n *\n * @return {?} The hex string.\n *\n */\n function (wordArray) {\n // Convert\n var /** @type {?} */ hexChars = [];\n for (var /** @type {?} */ i = 0; i < wordArray.sigBytes; i++) {\n var /** @type {?} */ bite = (wordArray.words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n hexChars.push((bite >>> 4).toString(16));\n hexChars.push((bite & 0x0f).toString(16));\n }\n return hexChars.join('');\n };\n /**\n * Converts a hex string to a word array.\n *\n * \\@example\n *\n * let wordArray = Hex.parse(hexString);\n * @param {?} hexStr The hex string.\n *\n * @return {?} The word array.\n *\n */\n Hex.parse = /**\n * Converts a hex string to a word array.\n *\n * \\@example\n *\n * let wordArray = Hex.parse(hexString);\n * @param {?} hexStr The hex string.\n *\n * @return {?} The word array.\n *\n */\n function (hexStr) {\n // Shortcut\n var /** @type {?} */ hexStrLength = hexStr.length;\n // Convert\n var /** @type {?} */ words = [];\n for (var /** @type {?} */ i = 0; i < hexStrLength; i += 2) {\n words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n }\n return new WordArray(words, hexStrLength / 2);\n };\n return Hex;\n}());\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nvar WordArray = /** @class */ (function () {\n /**\n * Initializes a newly created word array.\n *\n * @param words (Optional) An array of 32-bit words.\n * @param sigBytes (Optional) The number of significant bytes in the words.\n *\n * @example\n *\n * let wordArray = new WordArray();\n * let wordArray = new WordArray([0x00010203, 0x04050607]);\n * let wordArray = new WordArray([0x00010203, 0x04050607], 6);\n */\n function WordArray(words, sigBytes) {\n this.words = words || [];\n if (sigBytes !== undefined) {\n this.sigBytes = sigBytes;\n }\n else {\n this.sigBytes = this.words.length * 4;\n }\n }\n /**\n * Creates a word array filled with random bytes.\n *\n * \\@example\n *\n * let wordArray = WordArray.random(16);\n * @param {?} nBytes The number of random bytes to generate.\n *\n * @return {?} The random word array.\n *\n */\n WordArray.random = /**\n * Creates a word array filled with random bytes.\n *\n * \\@example\n *\n * let wordArray = WordArray.random(16);\n * @param {?} nBytes The number of random bytes to generate.\n *\n * @return {?} The random word array.\n *\n */\n function (nBytes) {\n var /** @type {?} */ words = [];\n var /** @type {?} */ r = (function (m_w) {\n var /** @type {?} */ m_z = 0x3ade68b1;\n var /** @type {?} */ mask = 0xffffffff;\n return function () {\n m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\n m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\n var /** @type {?} */ result = ((m_z << 0x10) + m_w) & mask;\n result /= 0x100000000;\n result += 0.5;\n return result * (Math.random() > .5 ? 1 : -1);\n };\n });\n for (var /** @type {?} */ i = 0, /** @type {?} */ rcache = void 0; i < nBytes; i += 4) {\n var /** @type {?} */ _r = r((rcache || Math.random()) * 0x100000000);\n rcache = _r() * 0x3ade67b7;\n words.push((_r() * 0x100000000) | 0);\n }\n return new WordArray(words, nBytes);\n };\n /**\n * Converts this word array to a string.\n *\n * @param encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n *\n * @return The stringified word array.\n *\n * @example\n *\n * let string = wordArray + '';\n * let string = wordArray.toString();\n * let string = wordArray.toString(CryptoJS.enc.Utf8);\n */\n /**\n * Converts this word array to a string.\n *\n * \\@example\n *\n * let string = wordArray + '';\n * let string = wordArray.toString();\n * let string = wordArray.toString(CryptoJS.enc.Utf8);\n * @param {?=} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n *\n * @return {?} The stringified word array.\n *\n */\n WordArray.prototype.toString = /**\n * Converts this word array to a string.\n *\n * \\@example\n *\n * let string = wordArray + '';\n * let string = wordArray.toString();\n * let string = wordArray.toString(CryptoJS.enc.Utf8);\n * @param {?=} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n *\n * @return {?} The stringified word array.\n *\n */\n function (encoder) {\n return (encoder || Hex).stringify(this);\n };\n /**\n * Concatenates a word array to this word array.\n *\n * @param wordArray The word array to append.\n *\n * @return This word array.\n *\n * @example\n *\n * wordArray1.concat(wordArray2);\n */\n /**\n * Concatenates a word array to this word array.\n *\n * \\@example\n *\n * wordArray1.concat(wordArray2);\n * @param {?} wordArray The word array to append.\n *\n * @return {?} This word array.\n *\n */\n WordArray.prototype.concat = /**\n * Concatenates a word array to this word array.\n *\n * \\@example\n *\n * wordArray1.concat(wordArray2);\n * @param {?} wordArray The word array to append.\n *\n * @return {?} This word array.\n *\n */\n function (wordArray) {\n // Clamp excess bits\n this.clamp();\n // Concat\n if (this.sigBytes % 4) {\n // Copy one byte at a time\n for (var /** @type {?} */ i = 0; i < wordArray.sigBytes; i++) {\n var /** @type {?} */ thatByte = (wordArray.words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n this.words[(this.sigBytes + i) >>> 2] |= thatByte << (24 - ((this.sigBytes + i) % 4) * 8);\n }\n }\n else {\n // Copy one word at a time\n for (var /** @type {?} */ i = 0; i < wordArray.sigBytes; i += 4) {\n this.words[(this.sigBytes + i) >>> 2] = wordArray.words[i >>> 2];\n }\n }\n this.sigBytes += wordArray.sigBytes;\n // Chainable\n return this;\n };\n /**\n * Removes insignificant bits.\n *\n * @example\n *\n * wordArray.clamp();\n */\n /**\n * Removes insignificant bits.\n *\n * \\@example\n *\n * wordArray.clamp();\n * @return {?}\n */\n WordArray.prototype.clamp = /**\n * Removes insignificant bits.\n *\n * \\@example\n *\n * wordArray.clamp();\n * @return {?}\n */\n function () {\n // Clamp\n this.words[this.sigBytes >>> 2] &= 0xffffffff << (32 - (this.sigBytes % 4) * 8);\n this.words.length = Math.ceil(this.sigBytes / 4);\n };\n /**\n * Creates a copy of this word array.\n *\n * @return The clone.\n *\n * @example\n *\n * let clone = wordArray.clone();\n */\n /**\n * Creates a copy of this word array.\n *\n * \\@example\n *\n * let clone = wordArray.clone();\n * @return {?} The clone.\n *\n */\n WordArray.prototype.clone = /**\n * Creates a copy of this word array.\n *\n * \\@example\n *\n * let clone = wordArray.clone();\n * @return {?} The clone.\n *\n */\n function () {\n return new WordArray(this.words.slice(0), this.sigBytes);\n };\n return WordArray;\n}());\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nvar Latin1 = /** @class */ (function () {\n function Latin1() {\n }\n /**\n * Converts a word array to a Latin1 string.\n *\n * \\@example\n *\n * let latin1String = Latin1.stringify(wordArray);\n * @param {?} wordArray The word array.\n *\n * @return {?} The Latin1 string.\n *\n */\n Latin1.stringify = /**\n * Converts a word array to a Latin1 string.\n *\n * \\@example\n *\n * let latin1String = Latin1.stringify(wordArray);\n * @param {?} wordArray The word array.\n *\n * @return {?} The Latin1 string.\n *\n */\n function (wordArray) {\n // Convert\n var /** @type {?} */ latin1Chars = [];\n for (var /** @type {?} */ i = 0; i < wordArray.sigBytes; i++) {\n var /** @type {?} */ bite = (wordArray.words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n latin1Chars.push(String.fromCharCode(bite));\n }\n return latin1Chars.join('');\n };\n /**\n * Converts a Latin1 string to a word array.\n *\n * \\@example\n *\n * let wordArray = Latin1.parse(latin1String);\n * @param {?} latin1Str The Latin1 string.\n *\n * @return {?} The word array.\n *\n */\n Latin1.parse = /**\n * Converts a Latin1 string to a word array.\n *\n * \\@example\n *\n * let wordArray = Latin1.parse(latin1String);\n * @param {?} latin1Str The Latin1 string.\n *\n * @return {?} The word array.\n *\n */\n function (latin1Str) {\n // Shortcut\n var /** @type {?} */ latin1StrLength = latin1Str.length;\n // Convert\n var /** @type {?} */ words = [];\n for (var /** @type {?} */ i = 0; i < latin1StrLength; i++) {\n words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n }\n return new WordArray(words, latin1StrLength);\n };\n return Latin1;\n}());\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nvar Utf8 = /** @class */ (function () {\n function Utf8() {\n }\n /**\n * Converts a word array to a UTF-8 string.\n *\n * \\@example\n *\n * let utf8String = Utf8.stringify(wordArray);\n * @param {?} wordArray The word array.\n *\n * @return {?} The UTF-8 string.\n *\n */\n Utf8.stringify = /**\n * Converts a word array to a UTF-8 string.\n *\n * \\@example\n *\n * let utf8String = Utf8.stringify(wordArray);\n * @param {?} wordArray The word array.\n *\n * @return {?} The UTF-8 string.\n *\n */\n function (wordArray) {\n try {\n return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n }\n catch (/** @type {?} */ e) {\n throw new Error('Malformed UTF-8 data');\n }\n };\n /**\n * Converts a UTF-8 string to a word array.\n *\n * \\@example\n *\n * let wordArray = Utf8.parse(utf8String);\n * @param {?} utf8Str The UTF-8 string.\n *\n * @return {?} The word array.\n *\n */\n Utf8.parse = /**\n * Converts a UTF-8 string to a word array.\n *\n * \\@example\n *\n * let wordArray = Utf8.parse(utf8String);\n * @param {?} utf8Str The UTF-8 string.\n *\n * @return {?} The word array.\n *\n */\n function (utf8Str) {\n return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n };\n return Utf8;\n}());\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\n/**\n * @abstract\n */\nvar /**\n * @abstract\n */\nBufferedBlockAlgorithm = /** @class */ (function () {\n function BufferedBlockAlgorithm(cfg) {\n this._minBufferSize = 0;\n this.cfg = Object.assign({\n blockSize: 1\n }, cfg);\n // Initial values\n this._data = new WordArray();\n this._nDataBytes = 0;\n }\n /**\n * Resets this block algorithm's data buffer to its initial state.\n *\n * @example\n *\n * bufferedBlockAlgorithm.reset();\n */\n /**\n * Resets this block algorithm's data buffer to its initial state.\n *\n * \\@example\n *\n * bufferedBlockAlgorithm.reset();\n * @return {?}\n */\n BufferedBlockAlgorithm.prototype.reset = /**\n * Resets this block algorithm's data buffer to its initial state.\n *\n * \\@example\n *\n * bufferedBlockAlgorithm.reset();\n * @return {?}\n */\n function () {\n // Initial values\n this._data = new WordArray();\n this._nDataBytes = 0;\n };\n /**\n * Adds new data to this block algorithm's buffer.\n *\n * @param data The data to append. Strings are converted to a WordArray using UTF-8.\n *\n * @example\n *\n * bufferedBlockAlgorithm._append('data');\n * bufferedBlockAlgorithm._append(wordArray);\n */\n /**\n * Adds new data to this block algorithm's buffer.\n *\n * \\@example\n *\n * bufferedBlockAlgorithm._append('data');\n * bufferedBlockAlgorithm._append(wordArray);\n * @param {?} data The data to append. Strings are converted to a WordArray using UTF-8.\n *\n * @return {?}\n */\n BufferedBlockAlgorithm.prototype._append = /**\n * Adds new data to this block algorithm's buffer.\n *\n * \\@example\n *\n * bufferedBlockAlgorithm._append('data');\n * bufferedBlockAlgorithm._append(wordArray);\n * @param {?} data The data to append. Strings are converted to a WordArray using UTF-8.\n *\n * @return {?}\n */\n function (data) {\n // Convert string to WordArray, else assume WordArray already\n if (typeof data === 'string') {\n data = Utf8.parse(data);\n }\n // Append\n this._data.concat(data);\n this._nDataBytes += data.sigBytes;\n };\n /**\n * Processes available data blocks.\n *\n * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n *\n * @param doFlush Whether all blocks and partial blocks should be processed.\n *\n * @return The processed data.\n *\n * @example\n *\n * let processedData = bufferedBlockAlgorithm._process();\n * let processedData = bufferedBlockAlgorithm._process(!!'flush');\n */\n /**\n * Processes available data blocks.\n *\n * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n *\n * \\@example\n *\n * let processedData = bufferedBlockAlgorithm._process();\n * let processedData = bufferedBlockAlgorithm._process(!!'flush');\n * @param {?=} doFlush Whether all blocks and partial blocks should be processed.\n *\n * @return {?} The processed data.\n *\n */\n BufferedBlockAlgorithm.prototype._process = /**\n * Processes available data blocks.\n *\n * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n *\n * \\@example\n *\n * let processedData = bufferedBlockAlgorithm._process();\n * let processedData = bufferedBlockAlgorithm._process(!!'flush');\n * @param {?=} doFlush Whether all blocks and partial blocks should be processed.\n *\n * @return {?} The processed data.\n *\n */\n function (doFlush) {\n if (!this.cfg.blockSize) {\n throw new Error('missing blockSize in config');\n }\n // Shortcuts\n var /** @type {?} */ blockSizeBytes = this.cfg.blockSize * 4;\n // Count blocks ready\n var /** @type {?} */ nBlocksReady = this._data.sigBytes / blockSizeBytes;\n if (doFlush) {\n // Round up to include partial blocks\n nBlocksReady = Math.ceil(nBlocksReady);\n }\n else {\n // Round down to include only full blocks,\n // less the number of blocks that must remain in the buffer\n nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n }\n // Count words ready\n var /** @type {?} */ nWordsReady = nBlocksReady * this.cfg.blockSize;\n // Count bytes ready\n var /** @type {?} */ nBytesReady = Math.min(nWordsReady * 4, this._data.sigBytes);\n // Process blocks\n var /** @type {?} */ processedWords;\n if (nWordsReady) {\n for (var /** @type {?} */ offset = 0; offset < nWordsReady; offset += this.cfg.blockSize) {\n // Perform concrete-algorithm logic\n this._doProcessBlock(this._data.words, offset);\n }\n // Remove processed words\n processedWords = this._data.words.splice(0, nWordsReady);\n this._data.sigBytes -= nBytesReady;\n }\n // Return processed words\n return new WordArray(processedWords, nBytesReady);\n };\n /**\n * Creates a copy of this object.\n *\n * @return The clone.\n *\n * @example\n *\n * let clone = bufferedBlockAlgorithm.clone();\n */\n /**\n * Creates a copy of this object.\n *\n * \\@example\n *\n * let clone = bufferedBlockAlgorithm.clone();\n * @return {?} The clone.\n *\n */\n BufferedBlockAlgorithm.prototype.clone = /**\n * Creates a copy of this object.\n *\n * \\@example\n *\n * let clone = bufferedBlockAlgorithm.clone();\n * @return {?} The clone.\n *\n */\n function () {\n var /** @type {?} */ clone = this.constructor();\n for (var /** @type {?} */ attr in this) {\n if (this.hasOwnProperty(attr)) {\n clone[attr] = this[attr];\n }\n }\n clone._data = this._data.clone();\n return clone;\n };\n return BufferedBlockAlgorithm;\n}());\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nvar Base = /** @class */ (function () {\n function Base() {\n }\n return Base;\n}());\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nvar CipherParams = /** @class */ (function (_super) {\n __extends(CipherParams, _super);\n function CipherParams(cipherParams) {\n var _this = _super.call(this) || this;\n _this.ciphertext = cipherParams.ciphertext;\n _this.key = cipherParams.key;\n _this.iv = cipherParams.iv;\n _this.salt = cipherParams.salt;\n _this.algorithm = cipherParams.algorithm;\n _this.mode = cipherParams.mode;\n _this.padding = cipherParams.padding;\n _this.blockSize = cipherParams.blockSize;\n _this.formatter = cipherParams.formatter;\n return _this;\n }\n /**\n * @param {?} additionalParams\n * @return {?}\n */\n CipherParams.prototype.extend = /**\n * @param {?} additionalParams\n * @return {?}\n */\n function (additionalParams) {\n if (additionalParams.ciphertext !== undefined) {\n this.ciphertext = additionalParams.ciphertext;\n }\n if (additionalParams.key !== undefined) {\n this.key = additionalParams.key;\n }\n if (additionalParams.iv !== undefined) {\n this.iv = additionalParams.iv;\n }\n if (additionalParams.salt !== undefined) {\n this.salt = additionalParams.salt;\n }\n if (additionalParams.algorithm !== undefined) {\n this.algorithm = additionalParams.algorithm;\n }\n if (additionalParams.mode !== undefined) {\n this.mode = additionalParams.mode;\n }\n if (additionalParams.padding !== undefined) {\n this.padding = additionalParams.padding;\n }\n if (additionalParams.blockSize !== undefined) {\n this.blockSize = additionalParams.blockSize;\n }\n if (additionalParams.formatter !== undefined) {\n this.formatter = additionalParams.formatter;\n }\n return this;\n };\n /**\n * Converts this cipher params object to a string.\n *\n * @throws Error If neither the formatter nor the default formatter is set.\n *\n * \\@example\n *\n * let string = cipherParams + '';\n * let string = cipherParams.toString();\n * let string = cipherParams.toString(CryptoJS.format.OpenSSL);\n * @param {?=} formatter (Optional) The formatting strategy to use.\n *\n * @return {?} The stringified cipher params.\n *\n */\n CipherParams.prototype.toString = /**\n * Converts this cipher params object to a string.\n *\n * @throws Error If neither the formatter nor the default formatter is set.\n *\n * \\@example\n *\n * let string = cipherParams + '';\n * let string = cipherParams.toString();\n * let string = cipherParams.toString(CryptoJS.format.OpenSSL);\n * @param {?=} formatter (Optional) The formatting strategy to use.\n *\n * @return {?} The stringified cipher params.\n *\n */\n function (formatter) {\n if (formatter) {\n return formatter.stringify(this);\n }\n else if (this.formatter) {\n return this.formatter.stringify(this);\n }\n else {\n throw new Error('cipher needs a formatter to be able to convert the result into a string');\n }\n };\n return CipherParams;\n}(Base));\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nvar Base64 = /** @class */ (function () {\n function Base64() {\n }\n /**\n * Converts a word array to a Base64 string.\n *\n * \\@example\n *\n * let base64String = Base64.stringify(wordArray);\n * @param {?} wordArray The word array.\n *\n * @return {?} The Base64 string.\n *\n */\n Base64.stringify = /**\n * Converts a word array to a Base64 string.\n *\n * \\@example\n *\n * let base64String = Base64.stringify(wordArray);\n * @param {?} wordArray The word array.\n *\n * @return {?} The Base64 string.\n *\n */\n function (wordArray) {\n // Clamp excess bits\n wordArray.clamp();\n // Convert\n var /** @type {?} */ base64Chars = [];\n for (var /** @type {?} */ i = 0; i < wordArray.sigBytes; i += 3) {\n var /** @type {?} */ byte1 = (wordArray.words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n var /** @type {?} */ byte2 = (wordArray.words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;\n var /** @type {?} */ byte3 = (wordArray.words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;\n var /** @type {?} */ triplet = (byte1 << 16) | (byte2 << 8) | byte3;\n for (var /** @type {?} */ j = 0; (j < 4) && (i + j * 0.75 < wordArray.sigBytes); j++) {\n base64Chars.push(this._map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));\n }\n }\n // Add padding\n var /** @type {?} */ paddingChar = this._map.charAt(64);\n if (paddingChar) {\n while (base64Chars.length % 4) {\n base64Chars.push(paddingChar);\n }\n }\n return base64Chars.join('');\n };\n /**\n * Converts a Base64 string to a word array.\n *\n * \\@example\n *\n * let wordArray = Base64.parse(base64String);\n * @param {?} base64Str The Base64 string.\n *\n * @return {?} The word array.\n *\n */\n Base64.parse = /**\n * Converts a Base64 string to a word array.\n *\n * \\@example\n *\n * let wordArray = Base64.parse(base64String);\n * @param {?} base64Str The Base64 string.\n *\n * @return {?} The word array.\n *\n */\n function (base64Str) {\n // Shortcuts\n var /** @type {?} */ base64StrLength = base64Str.length;\n if (this._reverseMap === undefined) {\n this._reverseMap = [];\n for (var /** @type {?} */ j = 0; j < this._map.length; j++) {\n this._reverseMap[this._map.charCodeAt(j)] = j;\n }\n }\n // Ignore padding\n var /** @type {?} */ paddingChar = this._map.charAt(64);\n if (paddingChar) {\n var /** @type {?} */ paddingIndex = base64Str.indexOf(paddingChar);\n if (paddingIndex !== -1) {\n base64StrLength = paddingIndex;\n }\n }\n // Convert\n return this.parseLoop(base64Str, base64StrLength, this._reverseMap);\n };\n /**\n * @param {?} base64Str\n * @param {?} base64StrLength\n * @param {?} reverseMap\n * @return {?}\n */\n Base64.parseLoop = /**\n * @param {?} base64Str\n * @param {?} base64StrLength\n * @param {?} reverseMap\n * @return {?}\n */\n function (base64Str, base64StrLength, reverseMap) {\n var /** @type {?} */ words = [];\n var /** @type {?} */ nBytes = 0;\n for (var /** @type {?} */ i = 0; i < base64StrLength; i++) {\n if (i % 4) {\n var /** @type {?} */ bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);\n var /** @type {?} */ bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);\n words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);\n nBytes++;\n }\n }\n return new WordArray(words, nBytes);\n };\n Base64._map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n Base64._reverseMap = undefined;\n return Base64;\n}());\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nvar OpenSSL = /** @class */ (function () {\n function OpenSSL() {\n }\n /**\n * Converts a cipher params object to an OpenSSL-compatible string.\n *\n * \\@example\n *\n * let openSSLString = OpenSSLFormatter.stringify(cipherParams);\n * @param {?} cipherParams The cipher params object.\n *\n * @return {?} The OpenSSL-compatible string.\n *\n */\n OpenSSL.stringify = /**\n * Converts a cipher params object to an OpenSSL-compatible string.\n *\n * \\@example\n *\n * let openSSLString = OpenSSLFormatter.stringify(cipherParams);\n * @param {?} cipherParams The cipher params object.\n *\n * @return {?} The OpenSSL-compatible string.\n *\n */\n function (cipherParams) {\n if (!cipherParams.ciphertext) {\n