commit 9dbf7ae796e1c6a6e253eec8137fc77ddb317fe6 Author: Eric Woodward Date: Sun Feb 22 21:26:15 2026 -0500 initial public commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..31393ef --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# EditorConfig is awesome: https://editorconfig.org + +[*] +charset = utf-8 +end_of_line = lf +indent_size = tab +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +indent_style = tab +trim_trailing_whitespace = false + +[*.json] +indent_size = 2 +indent_style = spaces diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..af3ad12 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +/.yarn/** linguist-vendored +/.yarn/releases/* binary +/.yarn/plugins/**/* binary +/.pnp.* binary linguist-generated diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5825556 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + +# Whether you use PnP or not, the node_modules folder is often used to store +# build artifacts that should be gitignored +node_modules + +# Swap the comments on the following lines if you wish to use zero-installs +# In that case, don't forget to run `yarn config set enableGlobalCache false`! +# Documentation here: https://yarnpkg.com/features/caching#zero-installs + +#!.yarn/cache +.pnp.* +NOTES.md +TODO.md diff --git a/.license-fragments/license-begin.txt b/.license-fragments/license-begin.txt new file mode 100644 index 0000000..6998352 --- /dev/null +++ b/.license-fragments/license-begin.txt @@ -0,0 +1 @@ +// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt diff --git a/.license-fragments/license-end.txt b/.license-fragments/license-end.txt new file mode 100644 index 0000000..c2db98d --- /dev/null +++ b/.license-fragments/license-end.txt @@ -0,0 +1 @@ +// @license-end diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..dfcc0e9 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 4, + "useTabs": true +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5bbb656 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "cSpell.words": [ + "blakejs", + "btih", + "twts", + "Twttr", + "Twtxt", + "unplugin" + ] +} \ No newline at end of file diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e0503f5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Eric Woodward [https://www.itsericwoodward.com] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..08895d6 --- /dev/null +++ b/README.md @@ -0,0 +1,217 @@ +# twtxt-lib + +An isomorphic TypeScript library of utility functions for parsing and interacting with +[`twtxt.txt` files](https://twtxt.dev/). + +These functions include: + +- `hashTwt`: takes the constituent parts of a "twt" and generates an + [extension-compatible hash](https://twtxt.dev/exts/twt-hash.html) for it. +- `parseTwtxt`: parses a twtxt file string, returning an object with information about the file and + its owner (including [hashes](https://twtxt.dev/exts/twt-hash.html) for each twt and any + [metadata](https://twtxt.dev/exts/metadata.html) in the file). +- `loadAndParseTwtxt`: fetches a twtxt file from _the internet_ and parses it into an object (as above). + +## Installation + +Browser + +- Download [library](/dist-browser/twtxt-lib.js) (or [minified version](/dist-browser/twtxt-lib.min.js)). +- Import desired function(s) into your project: `import { hashTwt, loadAndParseTwtxtFile } from "./twtxt-lib.js"` + +NPM + +- Coming soon + +JSR + +- Coming soon + +## Features + +- Isomorphic, available as an ([optionally minified](/dist-browser/twtxt-lib.min.js)) + [ES6+ library for the browser](/dist-browser/twtxt-lib.js), with NPM and JSR versions coming soon. +- Fully typed and source-mapped. +- [ESM](https://caniuse.com/es6-module) (and [ESM only](https://antfu.me/posts/move-on-to-esm-only)). +- Includes sample files and an [interactive demo page](https://twtxt-lib.itsericwoodward.com/). + +## Usage + +### loadAndParseText + +This is arguably the most useful function: + +``` +import { loadAndParseTwtxtFile } from "/web/dist/twtxt-lib.js"; + +// run in an IIFE (or event listener) to avoid issues with top-level await +(async () => { + try { + const parsedFile = await loadAndParseTwtxtFile( + "/twtxt-demos/demo-hipster-twtxt.txt", + ); + + console.log(parsedFile); + + } catch (err) { + console.error(err); + } +})(); +``` + +Result: + +``` +{ + "following": [ + { + "nick": "demo_hipster", + "url": "https://example.com/demo-hipster-twtxt.txt" + }, + { + "nick": "demo_pirate", + "url": "https://example.org/~pirate/twtxt.txt" + }, + { + "nick": "demo_sagan", + "url": "https://example.net/~saganos/twtxt.txt" + } + ], + "metadata": { + "nick": "demo_hipster", + "url": "https://example.com/demo-hipster-twtxt.txt", + "avatar": "https://i.pravatar.cc/150?img=67", + "description": "Kitsch ut post-ironic, bruh tilde non shabby chic iceland fixie consequat?" + }, + "twts": [ + { + "content": "Normcore tilde ad selfies, culpa cupping nostrud gatekeep aesthetic PBR&B 3 wolf moon mustache twee.", + "created": "2025-06-02T18:47:01+01:00", + "createdUTC": "2025-06-02T17:47:01.000Z", + "hash": "ymiydvq" + }, + { + "content": "Cardigan jean shorts eu 90's. Kitsch knausgaard culpa, marfa mumblecore portland raclette banjo retro exercitation pariatur snackwave williamsburg.", + "created": "2025-07-05T00:17:46+02:00", + "createdUTC": "2025-07-04T22:17:46.000Z", + "hash": "c6bm4sq" + }, + ... + ], + "lastModified": "2026-02-22T20:56:59.000Z" +} +``` + +When using in a web browser, be aware of potential the potential for issues with [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS). + +### hashTwt + +``` +import { hashTwt } from "/web/dist/twtxt-lib.js"; + +const hash = hashTwt({ + content: "Prow scuttle parley provost Sail ho shrouds spirits boom mizzenmast yardarm.", + created: "2026-02-01T01:23:45Z", + url: "https://example.org/~pirate/twtxt.txt", +}); + +console.log(`Hash: ${hash}`); +``` + +Result + +``` +Hash: 7uftieq +``` + +### parseTwtxt + +``` +import { base32Encode, hashTwt, loadAndParseTwtxt, parseTwtxt } from "twtxt-lib"; + +const fileText = ` +# nick = demo_sagan +# url = https://example.net/~saganos/twtxt.txt +# avatar = https://i.pravatar.cc/150?img=69 +# description = Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit? +# finger = sagaan@example.net +# link = Web https://example.net/~saganos/ +# +# follow = demo_sagan https://example.net/~saganos/twtxt.txt +# follow = demo_pirate https://example.org/~pirate/twtxt.txt +# follow = demo_hipster https://example.com/demo-hipster-twtxt.txt +# +# following = 3 +# + +2026-02-05T23:17:47Z The ash of stellar alchemy permanence of the stars extraordinary claims require extraordinary evidence rings of Uranus vanquish the impossible encyclopaedia galactica? +2026-01-22T12:09:44Z Something incredible is waiting to be known another world hearts of the stars tendrils of gossamer clouds a still more glorious dawn awaits venture. +2026-01-10T13:44:37Z Dream of the mind's eye citizens of distant epochs a still more glorious dawn awaits preserve and cherish that pale blue dot hearts of the stars preserve and cherish that pale blue dot and billions upon billions upon billions upon billions upon billions upon billions upon billions. +2026-01-01T02:05:04Z With pretty stories for which there's little good evidence muse about a billion trillion globular star cluster inconspicuous motes of rock and gas dream of the mind's eye. +`.trim(); + +console.log(parseTwtxt(fileText)); + +``` + +Result: + +``` +{ + "following": [ + { + "nick": "demo_sagan", + "url": "https://example.net/~saganos/twtxt.txt" + }, + { + "nick": "demo_pirate", + "url": "https://example.org/~pirate/twtxt.txt" + }, + { + "nick": "demo_hipster", + "url": "https://example.com/demo-hipster-twtxt.txt" + } + ], + "metadata": { + "nick": "demo_sagan", + "url": "https://example.net/~saganos/twtxt.txt", + "avatar": "https://i.pravatar.cc/150?img=69", + "description": "Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit?", + "finger": "sagaan@example.net", + "link": "Web https://example.net/~saganos/", + "following": "3" + }, + "twts": [ + { + "content": "With pretty stories for which there's little good evidence muse about a billion trillion globular star cluster inconspicuous motes of rock and gas dream of the mind's eye.", + "created": "2026-01-01T02:05:04Z", + "createdUTC": "2026-01-01T02:05:04.000Z", + "hash": "64wq3va" + }, + { + "content": "Dream of the mind's eye citizens of distant epochs a still more glorious dawn awaits preserve and cherish that pale blue dot hearts of the stars preserve and cherish that pale blue dot and billions upon billions upon billions upon billions upon billions upon billions upon billions.", + "created": "2026-01-10T13:44:37Z", + "createdUTC": "2026-01-10T13:44:37.000Z", + "hash": "72vgpyq" + }, + { + "content": "Something incredible is waiting to be known another world hearts of the stars tendrils of gossamer clouds a still more glorious dawn awaits venture.", + "created": "2026-01-22T12:09:44Z", + "createdUTC": "2026-01-22T12:09:44.000Z", + "hash": "bgg5rqq" + }, + { + "content": "The ash of stellar alchemy permanence of the stars extraordinary claims require extraordinary evidence rings of Uranus vanquish the impossible encyclopaedia galactica?", + "created": "2026-02-05T23:17:47Z", + "createdUTC": "2026-02-05T23:17:47.000Z", + "hash": "qa4xrla" + } + ] +} +``` + +See the included tests and demo file for more information on how to use it. + +## License + +Copyright (c) 2026 Eric Woodward, released under the [MIT License](https://www.itsericwoodward.com/licenses/mit/). diff --git a/build.js b/build.js new file mode 100644 index 0000000..72ab269 --- /dev/null +++ b/build.js @@ -0,0 +1,184 @@ +import dts from "unplugin-dts/vite"; +import { + copyFile, + cp, + mkdir, + readdir, + readFile, + rm, + writeFile, +} from "node:fs/promises"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { defineConfig, build as viteBuild } from "vite"; +import noBundlePlugin from "vite-plugin-no-bundle"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +const outputPathPrefix = + process.env.BUILD_ENV !== "production" ? "dist-temp" : "dist"; +const browserOutPath = `${outputPathPrefix}-browser`; +const browserOutDir = resolve(__dirname, browserOutPath); +const demoOutDir = resolve(__dirname, `${outputPathPrefix}-demo`); + +const entry = "src/index.ts"; + +const globalConfig = { + libraryName: "twtxt-lib", + basePath: resolve(__dirname), + outDir: resolve(__dirname, outputPathPrefix), + builds: [ + { + entry, + outDir: browserOutDir, + outfile: "twtxt-lib.js", + target: "browser", + }, + { + entry, + outDir: browserOutDir, + outfile: "twtxt-lib.min.js", + target: "browser", + }, + { + entry, + outDir: resolve(__dirname, `${outputPathPrefix}-node`), + target: "node", + }, + ], + licenseBegin: "", // assigned in init() + licenseEnd: "", // assigned in init() + licensePath: resolve(__dirname, ".license-fragments"), + + /** @type Record|null */ + pkg: null, // assigned in init() + + async init() { + this.pkg = JSON.parse( + await readFile(resolve(this.basePath, "package.json")), + ); + + this.licenseBegin = await readFile( + resolve(this.licensePath, "license-begin.txt"), + ); + this.licenseEnd = await readFile( + resolve(this.licensePath, "license-end.txt"), + ); + + this.builds = this.builds.map((config) => { + config.entry = resolve(globalConfig.basePath, config.entry); + config.minify = config?.outfile?.includes(".min.") ?? false; + config.standalone = config?.target?.includes("browser") ?? false; + config.format = "es"; + + return config; + }); + }, +}; + +const purgeOutDirs = async (config) => { + await rm(config.outDir, { recursive: true, force: true }); +}; + +const buildWithVite = async (config) => { + const plugins = [ + dts({ exclude: ["./vitest.setup.ts", "**/__tests__/*.*"] }), + ]; + if (config.target !== "browser") plugins.push(noBundlePlugin()); + + await viteBuild( + defineConfig({ + define: { + "globalThis.__BUILD_VERSION__": JSON.stringify( + globalConfig.pkg.version, + ), + }, + build: { + lib: { + entry: config.entry, + name: globalConfig.libraryName, + formats: [config.format], + fileName: () => config?.outfile ?? "[name].js", + }, + emptyOutDir: false, + outDir: config.outDir, + minify: config.minify || false, + sourcemap: true, + rollupOptions: { + external: [], + preserveEntrySignatures: "strict", + shimMissingExports: true, + treeshake: false, + }, + target: config.target === "browser" ? "es6" : "node22", + }, + plugins, + publicDir: false, + resolve: { + extensions: [".ts", ".js"], + alias: { + "@": `${globalConfig.basePath}/src`, + }, + }, + }), + ); +}; + +const wrapWithLicense = async (config) => { + const fileText = await readFile( + resolve(config.outDir, config.outfile ?? "index.js"), + ); + + await writeFile( + resolve(config.outDir, config.outfile ?? "index.js"), + [globalConfig.licenseBegin, fileText, globalConfig.licenseEnd].join(""), + { encoding: "utf8", flag: "w" }, + ); +}; + +const copyDir = async (source, destination) => { + const entries = await readdir(source, { withFileTypes: true }); + await mkdir(destination, { recursive: true }); + + return Promise.all( + entries.map(async (entry) => { + const sourcePath = resolve(source, entry.name); + const destinationPath = resolve(destination, entry.name); + + return entry.isDirectory() + ? copyDir(sourcePath, destinationPath) + : copyFile(sourcePath, destinationPath); + }), + ); +}; + +const createDemoSite = async () => { + await rm(demoOutDir, { recursive: true, force: true }); + + await copyDir(resolve(__dirname, "public"), demoOutDir); + + await copyFile( + resolve(__dirname, "index.html"), + resolve(demoOutDir, "index.html"), + ); + + await copyDir(browserOutDir, resolve(demoOutDir, browserOutPath)); +}; + +async function main() { + await globalConfig.init(); + await rm(globalConfig.outDir, { recursive: true, force: true }); + await Promise.all([ + ...globalConfig.builds.map((config) => purgeOutDirs(config)), + ]); + await Promise.all([ + ...globalConfig.builds.map((config) => buildWithVite(config)), + ]); + await Promise.all([ + ...globalConfig.builds.map((config) => wrapWithLicense(config)), + ]); + await createDemoSite(); + console.log("All library file builds complete."); +} + +main(); diff --git a/dist-browser/constants.d.ts b/dist-browser/constants.d.ts new file mode 100644 index 0000000..90ef16e --- /dev/null +++ b/dist-browser/constants.d.ts @@ -0,0 +1 @@ +export declare const __dirname: string; diff --git a/dist-browser/hashTwt.d.ts b/dist-browser/hashTwt.d.ts new file mode 100644 index 0000000..0a94d9c --- /dev/null +++ b/dist-browser/hashTwt.d.ts @@ -0,0 +1,2 @@ +import { Twt } from './types.ts'; +export default function hashTwt(twt: Twt): string; diff --git a/dist-browser/index.d.ts b/dist-browser/index.d.ts new file mode 100644 index 0000000..d5d613c --- /dev/null +++ b/dist-browser/index.d.ts @@ -0,0 +1,5 @@ +export type * from './types.ts'; +export { default as hashTwt } from './hashTwt.ts'; +export { default as loadAndParseTwtxtFile } from './loadAndParseTwtxt.ts'; +export { default as parseTwtxt } from './parseTwtxt.ts'; +export { base32Encode } from './utils.ts'; diff --git a/dist-browser/loadAndParseTwtxt.d.ts b/dist-browser/loadAndParseTwtxt.d.ts new file mode 100644 index 0000000..02f5208 --- /dev/null +++ b/dist-browser/loadAndParseTwtxt.d.ts @@ -0,0 +1,14 @@ +export default function loadAndParseTwtxtFile(url?: string): Promise<{ + lastModified: string; + following: import('./types.ts').Twttr[]; + metadata: import('./types.ts').Metadata; + twts: { + content: string; + created: string; + createdUTC: string; + hash: string; + replyHash: string | undefined; + replyNick: string | undefined; + replyUrl: string | undefined; + }[]; +}>; diff --git a/dist-browser/parseTwtxt.d.ts b/dist-browser/parseTwtxt.d.ts new file mode 100644 index 0000000..9b0a8a6 --- /dev/null +++ b/dist-browser/parseTwtxt.d.ts @@ -0,0 +1,18 @@ +import { Metadata, Twttr } from './types.ts'; +/** + * @param twtxt + * @returns object containing: following, metadata, twts + */ +export default function parseTwtxt(twtxt: string): { + following: Twttr[]; + metadata: Metadata; + twts: { + content: string; + created: string; + createdUTC: string; + hash: string; + replyHash: string | undefined; + replyNick: string | undefined; + replyUrl: string | undefined; + }[]; +}; diff --git a/dist-browser/twtxt-lib.js b/dist-browser/twtxt-lib.js new file mode 100644 index 0000000..92dc517 --- /dev/null +++ b/dist-browser/twtxt-lib.js @@ -0,0 +1,3401 @@ +// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt +var __defProp = Object.defineProperty; +var __defProps = Object.defineProperties; +var __getOwnPropDescs = Object.getOwnPropertyDescriptors; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __pow = Math.pow; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + } + return a; +}; +var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +var buffer = {}; +var base64Js = {}; +base64Js.byteLength = byteLength; +base64Js.toByteArray = toByteArray; +base64Js.fromByteArray = fromByteArray; +var lookup = []; +var revLookup = []; +var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; +var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i]; + revLookup[code.charCodeAt(i)] = i; +} +revLookup["-".charCodeAt(0)] = 62; +revLookup["_".charCodeAt(0)] = 63; +function getLens(b64) { + var len = b64.length; + if (len % 4 > 0) { + throw new Error("Invalid string. Length must be a multiple of 4"); + } + var validLen = b64.indexOf("="); + if (validLen === -1) validLen = len; + var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; + return [validLen, placeHoldersLen]; +} +function byteLength(b64) { + var lens = getLens(b64); + var validLen = lens[0]; + var placeHoldersLen = lens[1]; + return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; +} +function _byteLength(b64, validLen, placeHoldersLen) { + return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; +} +function toByteArray(b64) { + var tmp; + var lens = getLens(b64); + var validLen = lens[0]; + var placeHoldersLen = lens[1]; + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); + var curByte = 0; + var len = placeHoldersLen > 0 ? validLen - 4 : validLen; + var i; + for (i = 0; i < len; i += 4) { + tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; + arr[curByte++] = tmp >> 16 & 255; + arr[curByte++] = tmp >> 8 & 255; + arr[curByte++] = tmp & 255; + } + if (placeHoldersLen === 2) { + tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; + arr[curByte++] = tmp & 255; + } + if (placeHoldersLen === 1) { + tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; + arr[curByte++] = tmp >> 8 & 255; + arr[curByte++] = tmp & 255; + } + return arr; +} +function tripletToBase64(num) { + return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63]; +} +function encodeChunk(uint8, start, end) { + var tmp; + var output = []; + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255); + output.push(tripletToBase64(tmp)); + } + return output.join(""); +} +function fromByteArray(uint8) { + var tmp; + var len = uint8.length; + var extraBytes = len % 3; + var parts = []; + var maxChunkLength = 16383; + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); + } + if (extraBytes === 1) { + tmp = uint8[len - 1]; + parts.push( + lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==" + ); + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1]; + parts.push( + lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=" + ); + } + return parts.join(""); +} +var ieee754 = {}; +ieee754.read = function(buffer2, offset, isLE, mLen, nBytes) { + var e, m; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = -7; + var i = isLE ? nBytes - 1 : 0; + var d = isLE ? -1 : 1; + var s = buffer2[offset + i]; + i += d; + e = s & (1 << -nBits) - 1; + s >>= -nBits; + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) { + } + m = e & (1 << -nBits) - 1; + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) { + } + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : (s ? -1 : 1) * Infinity; + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); +}; +ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) { + var e, m, c; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; + var i = isLE ? 0 : nBytes - 1; + var d = isLE ? 1 : -1; + var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; + value = Math.abs(value); + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) { + } + e = e << mLen | m; + eLen += mLen; + for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) { + } + buffer2[offset + i - d] |= s * 128; +}; +(function(exports$1) { + const base64 = base64Js; + const ieee754$1 = ieee754; + const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; + exports$1.Buffer = Buffer3; + exports$1.SlowBuffer = SlowBuffer2; + exports$1.INSPECT_MAX_BYTES = 50; + const K_MAX_LENGTH = 2147483647; + exports$1.kMaxLength = K_MAX_LENGTH; + const { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis; + Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport(); + if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { + console.error( + "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support." + ); + } + function typedArraySupport() { + try { + const arr = new GlobalUint8Array(1); + const proto = { foo: function() { + return 42; + } }; + Object.setPrototypeOf(proto, GlobalUint8Array.prototype); + Object.setPrototypeOf(arr, proto); + return arr.foo() === 42; + } catch (e) { + return false; + } + } + Object.defineProperty(Buffer3.prototype, "parent", { + enumerable: true, + get: function() { + if (!Buffer3.isBuffer(this)) return void 0; + return this.buffer; + } + }); + Object.defineProperty(Buffer3.prototype, "offset", { + enumerable: true, + get: function() { + if (!Buffer3.isBuffer(this)) return void 0; + return this.byteOffset; + } + }); + function createBuffer(length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"'); + } + const buf = new GlobalUint8Array(length); + Object.setPrototypeOf(buf, Buffer3.prototype); + return buf; + } + function Buffer3(arg, encodingOrOffset, length) { + if (typeof arg === "number") { + if (typeof encodingOrOffset === "string") { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ); + } + return allocUnsafe(arg); + } + return from(arg, encodingOrOffset, length); + } + Buffer3.poolSize = 8192; + function from(value, encodingOrOffset, length) { + if (typeof value === "string") { + return fromString(value, encodingOrOffset); + } + if (GlobalArrayBuffer.isView(value)) { + return fromArrayView(value); + } + if (value == null) { + throw new TypeError( + "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value + ); + } + if (isInstance(value, GlobalArrayBuffer) || value && isInstance(value.buffer, GlobalArrayBuffer)) { + return fromArrayBuffer(value, encodingOrOffset, length); + } + if (typeof GlobalSharedArrayBuffer !== "undefined" && (isInstance(value, GlobalSharedArrayBuffer) || value && isInstance(value.buffer, GlobalSharedArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length); + } + if (typeof value === "number") { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ); + } + const valueOf = value.valueOf && value.valueOf(); + if (valueOf != null && valueOf !== value) { + return Buffer3.from(valueOf, encodingOrOffset, length); + } + const b = fromObject(value); + if (b) return b; + if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { + return Buffer3.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); + } + throw new TypeError( + "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value + ); + } + Buffer3.from = function(value, encodingOrOffset, length) { + return from(value, encodingOrOffset, length); + }; + Object.setPrototypeOf(Buffer3.prototype, GlobalUint8Array.prototype); + Object.setPrototypeOf(Buffer3, GlobalUint8Array); + function assertSize(size) { + if (typeof size !== "number") { + throw new TypeError('"size" argument must be of type number'); + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"'); + } + } + function alloc(size, fill, encoding) { + assertSize(size); + if (size <= 0) { + return createBuffer(size); + } + if (fill !== void 0) { + return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); + } + return createBuffer(size); + } + Buffer3.alloc = function(size, fill, encoding) { + return alloc(size, fill, encoding); + }; + function allocUnsafe(size) { + assertSize(size); + return createBuffer(size < 0 ? 0 : checked(size) | 0); + } + Buffer3.allocUnsafe = function(size) { + return allocUnsafe(size); + }; + Buffer3.allocUnsafeSlow = function(size) { + return allocUnsafe(size); + }; + function fromString(string, encoding) { + if (typeof encoding !== "string" || encoding === "") { + encoding = "utf8"; + } + if (!Buffer3.isEncoding(encoding)) { + throw new TypeError("Unknown encoding: " + encoding); + } + const length = byteLength2(string, encoding) | 0; + let buf = createBuffer(length); + const actual = buf.write(string, encoding); + if (actual !== length) { + buf = buf.slice(0, actual); + } + return buf; + } + function fromArrayLike(array) { + const length = array.length < 0 ? 0 : checked(array.length) | 0; + const buf = createBuffer(length); + for (let i = 0; i < length; i += 1) { + buf[i] = array[i] & 255; + } + return buf; + } + function fromArrayView(arrayView) { + if (isInstance(arrayView, GlobalUint8Array)) { + const copy = new GlobalUint8Array(arrayView); + return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); + } + return fromArrayLike(arrayView); + } + function fromArrayBuffer(array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds'); + } + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds'); + } + let buf; + if (byteOffset === void 0 && length === void 0) { + buf = new GlobalUint8Array(array); + } else if (length === void 0) { + buf = new GlobalUint8Array(array, byteOffset); + } else { + buf = new GlobalUint8Array(array, byteOffset, length); + } + Object.setPrototypeOf(buf, Buffer3.prototype); + return buf; + } + function fromObject(obj) { + if (Buffer3.isBuffer(obj)) { + const len = checked(obj.length) | 0; + const buf = createBuffer(len); + if (buf.length === 0) { + return buf; + } + obj.copy(buf, 0, 0, len); + return buf; + } + if (obj.length !== void 0) { + if (typeof obj.length !== "number" || numberIsNaN(obj.length)) { + return createBuffer(0); + } + return fromArrayLike(obj); + } + if (obj.type === "Buffer" && Array.isArray(obj.data)) { + return fromArrayLike(obj.data); + } + } + function checked(length) { + if (length >= K_MAX_LENGTH) { + throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes"); + } + return length | 0; + } + function SlowBuffer2(length) { + if (+length != length) { + length = 0; + } + return Buffer3.alloc(+length); + } + Buffer3.isBuffer = function isBuffer(b) { + return b != null && b._isBuffer === true && b !== Buffer3.prototype; + }; + Buffer3.compare = function compare(a, b) { + if (isInstance(a, GlobalUint8Array)) a = Buffer3.from(a, a.offset, a.byteLength); + if (isInstance(b, GlobalUint8Array)) b = Buffer3.from(b, b.offset, b.byteLength); + if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ); + } + if (a === b) return 0; + let x = a.length; + let y = b.length; + for (let i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + if (x < y) return -1; + if (y < x) return 1; + return 0; + }; + Buffer3.isEncoding = function isEncoding(encoding) { + switch (String(encoding).toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "latin1": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return true; + default: + return false; + } + }; + Buffer3.concat = function concat(list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + if (list.length === 0) { + return Buffer3.alloc(0); + } + let i; + if (length === void 0) { + length = 0; + for (i = 0; i < list.length; ++i) { + length += list[i].length; + } + } + const buffer2 = Buffer3.allocUnsafe(length); + let pos = 0; + for (i = 0; i < list.length; ++i) { + let buf = list[i]; + if (isInstance(buf, GlobalUint8Array)) { + if (pos + buf.length > buffer2.length) { + if (!Buffer3.isBuffer(buf)) buf = Buffer3.from(buf); + buf.copy(buffer2, pos); + } else { + GlobalUint8Array.prototype.set.call( + buffer2, + buf, + pos + ); + } + } else if (!Buffer3.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } else { + buf.copy(buffer2, pos); + } + pos += buf.length; + } + return buffer2; + }; + function byteLength2(string, encoding) { + if (Buffer3.isBuffer(string)) { + return string.length; + } + if (GlobalArrayBuffer.isView(string) || isInstance(string, GlobalArrayBuffer)) { + return string.byteLength; + } + if (typeof string !== "string") { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string + ); + } + const len = string.length; + const mustMatch = arguments.length > 2 && arguments[2] === true; + if (!mustMatch && len === 0) return 0; + let loweredCase = false; + for (; ; ) { + switch (encoding) { + case "ascii": + case "latin1": + case "binary": + return len; + case "utf8": + case "utf-8": + return utf8ToBytes(string).length; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return len * 2; + case "hex": + return len >>> 1; + case "base64": + return base64ToBytes(string).length; + default: + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length; + } + encoding = ("" + encoding).toLowerCase(); + loweredCase = true; + } + } + } + Buffer3.byteLength = byteLength2; + function slowToString(encoding, start, end) { + let loweredCase = false; + if (start === void 0 || start < 0) { + start = 0; + } + if (start > this.length) { + return ""; + } + if (end === void 0 || end > this.length) { + end = this.length; + } + if (end <= 0) { + return ""; + } + end >>>= 0; + start >>>= 0; + if (end <= start) { + return ""; + } + if (!encoding) encoding = "utf8"; + while (true) { + switch (encoding) { + case "hex": + return hexSlice(this, start, end); + case "utf8": + case "utf-8": + return utf8Slice(this, start, end); + case "ascii": + return asciiSlice(this, start, end); + case "latin1": + case "binary": + return latin1Slice(this, start, end); + case "base64": + return base64Slice(this, start, end); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return utf16leSlice(this, start, end); + default: + if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); + encoding = (encoding + "").toLowerCase(); + loweredCase = true; + } + } + } + Buffer3.prototype._isBuffer = true; + function swap(b, n, m) { + const i = b[n]; + b[n] = b[m]; + b[m] = i; + } + Buffer3.prototype.swap16 = function swap16() { + const len = this.length; + if (len % 2 !== 0) { + throw new RangeError("Buffer size must be a multiple of 16-bits"); + } + for (let i = 0; i < len; i += 2) { + swap(this, i, i + 1); + } + return this; + }; + Buffer3.prototype.swap32 = function swap32() { + const len = this.length; + if (len % 4 !== 0) { + throw new RangeError("Buffer size must be a multiple of 32-bits"); + } + for (let i = 0; i < len; i += 4) { + swap(this, i, i + 3); + swap(this, i + 1, i + 2); + } + return this; + }; + Buffer3.prototype.swap64 = function swap64() { + const len = this.length; + if (len % 8 !== 0) { + throw new RangeError("Buffer size must be a multiple of 64-bits"); + } + for (let i = 0; i < len; i += 8) { + swap(this, i, i + 7); + swap(this, i + 1, i + 6); + swap(this, i + 2, i + 5); + swap(this, i + 3, i + 4); + } + return this; + }; + Buffer3.prototype.toString = function toString() { + const length = this.length; + if (length === 0) return ""; + if (arguments.length === 0) return utf8Slice(this, 0, length); + return slowToString.apply(this, arguments); + }; + Buffer3.prototype.toLocaleString = Buffer3.prototype.toString; + Buffer3.prototype.equals = function equals(b) { + if (!Buffer3.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); + if (this === b) return true; + return Buffer3.compare(this, b) === 0; + }; + Buffer3.prototype.inspect = function inspect() { + let str = ""; + const max = exports$1.INSPECT_MAX_BYTES; + str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); + if (this.length > max) str += " ... "; + return ""; + }; + if (customInspectSymbol) { + Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect; + } + Buffer3.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { + if (isInstance(target, GlobalUint8Array)) { + target = Buffer3.from(target, target.offset, target.byteLength); + } + if (!Buffer3.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target + ); + } + if (start === void 0) { + start = 0; + } + if (end === void 0) { + end = target ? target.length : 0; + } + if (thisStart === void 0) { + thisStart = 0; + } + if (thisEnd === void 0) { + thisEnd = this.length; + } + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError("out of range index"); + } + if (thisStart >= thisEnd && start >= end) { + return 0; + } + if (thisStart >= thisEnd) { + return -1; + } + if (start >= end) { + return 1; + } + start >>>= 0; + end >>>= 0; + thisStart >>>= 0; + thisEnd >>>= 0; + if (this === target) return 0; + let x = thisEnd - thisStart; + let y = end - start; + const len = Math.min(x, y); + const thisCopy = this.slice(thisStart, thisEnd); + const targetCopy = target.slice(start, end); + for (let i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i]; + y = targetCopy[i]; + break; + } + } + if (x < y) return -1; + if (y < x) return 1; + return 0; + }; + function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) { + if (buffer2.length === 0) return -1; + if (typeof byteOffset === "string") { + encoding = byteOffset; + byteOffset = 0; + } else if (byteOffset > 2147483647) { + byteOffset = 2147483647; + } else if (byteOffset < -2147483648) { + byteOffset = -2147483648; + } + byteOffset = +byteOffset; + if (numberIsNaN(byteOffset)) { + byteOffset = dir ? 0 : buffer2.length - 1; + } + if (byteOffset < 0) byteOffset = buffer2.length + byteOffset; + if (byteOffset >= buffer2.length) { + if (dir) return -1; + else byteOffset = buffer2.length - 1; + } else if (byteOffset < 0) { + if (dir) byteOffset = 0; + else return -1; + } + if (typeof val === "string") { + val = Buffer3.from(val, encoding); + } + if (Buffer3.isBuffer(val)) { + if (val.length === 0) { + return -1; + } + return arrayIndexOf(buffer2, val, byteOffset, encoding, dir); + } else if (typeof val === "number") { + val = val & 255; + if (typeof GlobalUint8Array.prototype.indexOf === "function") { + if (dir) { + return GlobalUint8Array.prototype.indexOf.call(buffer2, val, byteOffset); + } else { + return GlobalUint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset); + } + } + return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir); + } + throw new TypeError("val must be string, number or Buffer"); + } + function arrayIndexOf(arr, val, byteOffset, encoding, dir) { + let indexSize = 1; + let arrLength = arr.length; + let valLength = val.length; + if (encoding !== void 0) { + encoding = String(encoding).toLowerCase(); + if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { + if (arr.length < 2 || val.length < 2) { + return -1; + } + indexSize = 2; + arrLength /= 2; + valLength /= 2; + byteOffset /= 2; + } + } + function read(buf, i2) { + if (indexSize === 1) { + return buf[i2]; + } else { + return buf.readUInt16BE(i2 * indexSize); + } + } + let i; + if (dir) { + let foundIndex = -1; + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i; + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; + } else { + if (foundIndex !== -1) i -= i - foundIndex; + foundIndex = -1; + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; + for (i = byteOffset; i >= 0; i--) { + let found = true; + for (let j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false; + break; + } + } + if (found) return i; + } + } + return -1; + } + Buffer3.prototype.includes = function includes(val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1; + }; + Buffer3.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true); + }; + Buffer3.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false); + }; + function hexWrite(buf, string, offset, length) { + offset = Number(offset) || 0; + const remaining = buf.length - offset; + if (!length) { + length = remaining; + } else { + length = Number(length); + if (length > remaining) { + length = remaining; + } + } + const strLen = string.length; + if (length > strLen / 2) { + length = strLen / 2; + } + let i; + for (i = 0; i < length; ++i) { + const parsed = parseInt(string.substr(i * 2, 2), 16); + if (numberIsNaN(parsed)) return i; + buf[offset + i] = parsed; + } + return i; + } + function utf8Write(buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); + } + function asciiWrite(buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length); + } + function base64Write(buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length); + } + function ucs2Write(buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); + } + Buffer3.prototype.write = function write(string, offset, length, encoding) { + if (offset === void 0) { + encoding = "utf8"; + length = this.length; + offset = 0; + } else if (length === void 0 && typeof offset === "string") { + encoding = offset; + length = this.length; + offset = 0; + } else if (isFinite(offset)) { + offset = offset >>> 0; + if (isFinite(length)) { + length = length >>> 0; + if (encoding === void 0) encoding = "utf8"; + } else { + encoding = length; + length = void 0; + } + } else { + throw new Error( + "Buffer.write(string, encoding, offset[, length]) is no longer supported" + ); + } + const remaining = this.length - offset; + if (length === void 0 || length > remaining) length = remaining; + if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { + throw new RangeError("Attempt to write outside buffer bounds"); + } + if (!encoding) encoding = "utf8"; + let loweredCase = false; + for (; ; ) { + switch (encoding) { + case "hex": + return hexWrite(this, string, offset, length); + case "utf8": + case "utf-8": + return utf8Write(this, string, offset, length); + case "ascii": + case "latin1": + case "binary": + return asciiWrite(this, string, offset, length); + case "base64": + return base64Write(this, string, offset, length); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return ucs2Write(this, string, offset, length); + default: + if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); + encoding = ("" + encoding).toLowerCase(); + loweredCase = true; + } + } + }; + Buffer3.prototype.toJSON = function toJSON() { + return { + type: "Buffer", + data: Array.prototype.slice.call(this._arr || this, 0) + }; + }; + function base64Slice(buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf); + } else { + return base64.fromByteArray(buf.slice(start, end)); + } + } + function utf8Slice(buf, start, end) { + end = Math.min(buf.length, end); + const res = []; + let i = start; + while (i < end) { + const firstByte = buf[i]; + let codePoint = null; + let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; + if (i + bytesPerSequence <= end) { + let secondByte, thirdByte, fourthByte, tempCodePoint; + switch (bytesPerSequence) { + case 1: + if (firstByte < 128) { + codePoint = firstByte; + } + break; + case 2: + secondByte = buf[i + 1]; + if ((secondByte & 192) === 128) { + tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; + if (tempCodePoint > 127) { + codePoint = tempCodePoint; + } + } + break; + case 3: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { + tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; + if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { + codePoint = tempCodePoint; + } + } + break; + case 4: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + fourthByte = buf[i + 3]; + if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { + tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; + if (tempCodePoint > 65535 && tempCodePoint < 1114112) { + codePoint = tempCodePoint; + } + } + } + } + if (codePoint === null) { + codePoint = 65533; + bytesPerSequence = 1; + } else if (codePoint > 65535) { + codePoint -= 65536; + res.push(codePoint >>> 10 & 1023 | 55296); + codePoint = 56320 | codePoint & 1023; + } + res.push(codePoint); + i += bytesPerSequence; + } + return decodeCodePointsArray(res); + } + const MAX_ARGUMENTS_LENGTH = 4096; + function decodeCodePointsArray(codePoints) { + const len = codePoints.length; + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints); + } + let res = ""; + let i = 0; + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ); + } + return res; + } + function asciiSlice(buf, start, end) { + let ret = ""; + end = Math.min(buf.length, end); + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 127); + } + return ret; + } + function latin1Slice(buf, start, end) { + let ret = ""; + end = Math.min(buf.length, end); + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]); + } + return ret; + } + function hexSlice(buf, start, end) { + const len = buf.length; + if (!start || start < 0) start = 0; + if (!end || end < 0 || end > len) end = len; + let out = ""; + for (let i = start; i < end; ++i) { + out += hexSliceLookupTable[buf[i]]; + } + return out; + } + function utf16leSlice(buf, start, end) { + const bytes = buf.slice(start, end); + let res = ""; + for (let i = 0; i < bytes.length - 1; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); + } + return res; + } + Buffer3.prototype.slice = function slice(start, end) { + const len = this.length; + start = ~~start; + end = end === void 0 ? len : ~~end; + if (start < 0) { + start += len; + if (start < 0) start = 0; + } else if (start > len) { + start = len; + } + if (end < 0) { + end += len; + if (end < 0) end = 0; + } else if (end > len) { + end = len; + } + if (end < start) end = start; + const newBuf = this.subarray(start, end); + Object.setPrototypeOf(newBuf, Buffer3.prototype); + return newBuf; + }; + function checkOffset(offset, ext, length) { + if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint"); + if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length"); + } + Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = function readUIntLE(offset, byteLength3, noAssert) { + offset = offset >>> 0; + byteLength3 = byteLength3 >>> 0; + if (!noAssert) checkOffset(offset, byteLength3, this.length); + let val = this[offset]; + let mul = 1; + let i = 0; + while (++i < byteLength3 && (mul *= 256)) { + val += this[offset + i] * mul; + } + return val; + }; + Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = function readUIntBE(offset, byteLength3, noAssert) { + offset = offset >>> 0; + byteLength3 = byteLength3 >>> 0; + if (!noAssert) { + checkOffset(offset, byteLength3, this.length); + } + let val = this[offset + --byteLength3]; + let mul = 1; + while (byteLength3 > 0 && (mul *= 256)) { + val += this[offset + --byteLength3] * mul; + } + return val; + }; + Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = function readUInt8(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 1, this.length); + return this[offset]; + }; + Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] | this[offset + 1] << 8; + }; + Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] << 8 | this[offset + 1]; + }; + Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 4, this.length); + return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; + }; + Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 4, this.length); + return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); + }; + Buffer3.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { + offset = offset >>> 0; + validateNumber(offset, "offset"); + const first = this[offset]; + const last = this[offset + 7]; + if (first === void 0 || last === void 0) { + boundsError(offset, this.length - 8); + } + const lo = first + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 24); + const hi = this[++offset] + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + last * __pow(2, 24); + return BigInt(lo) + (BigInt(hi) << BigInt(32)); + }); + Buffer3.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { + offset = offset >>> 0; + validateNumber(offset, "offset"); + const first = this[offset]; + const last = this[offset + 7]; + if (first === void 0 || last === void 0) { + boundsError(offset, this.length - 8); + } + const hi = first * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + this[++offset]; + const lo = this[++offset] * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + last; + return (BigInt(hi) << BigInt(32)) + BigInt(lo); + }); + Buffer3.prototype.readIntLE = function readIntLE(offset, byteLength3, noAssert) { + offset = offset >>> 0; + byteLength3 = byteLength3 >>> 0; + if (!noAssert) checkOffset(offset, byteLength3, this.length); + let val = this[offset]; + let mul = 1; + let i = 0; + while (++i < byteLength3 && (mul *= 256)) { + val += this[offset + i] * mul; + } + mul *= 128; + if (val >= mul) val -= Math.pow(2, 8 * byteLength3); + return val; + }; + Buffer3.prototype.readIntBE = function readIntBE(offset, byteLength3, noAssert) { + offset = offset >>> 0; + byteLength3 = byteLength3 >>> 0; + if (!noAssert) checkOffset(offset, byteLength3, this.length); + let i = byteLength3; + let mul = 1; + let val = this[offset + --i]; + while (i > 0 && (mul *= 256)) { + val += this[offset + --i] * mul; + } + mul *= 128; + if (val >= mul) val -= Math.pow(2, 8 * byteLength3); + return val; + }; + Buffer3.prototype.readInt8 = function readInt8(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 1, this.length); + if (!(this[offset] & 128)) return this[offset]; + return (255 - this[offset] + 1) * -1; + }; + Buffer3.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 2, this.length); + const val = this[offset] | this[offset + 1] << 8; + return val & 32768 ? val | 4294901760 : val; + }; + Buffer3.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 2, this.length); + const val = this[offset + 1] | this[offset] << 8; + return val & 32768 ? val | 4294901760 : val; + }; + Buffer3.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 4, this.length); + return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; + }; + Buffer3.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 4, this.length); + return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; + }; + Buffer3.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { + offset = offset >>> 0; + validateNumber(offset, "offset"); + const first = this[offset]; + const last = this[offset + 7]; + if (first === void 0 || last === void 0) { + boundsError(offset, this.length - 8); + } + const val = this[offset + 4] + this[offset + 5] * __pow(2, 8) + this[offset + 6] * __pow(2, 16) + (last << 24); + return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 24)); + }); + Buffer3.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { + offset = offset >>> 0; + validateNumber(offset, "offset"); + const first = this[offset]; + const last = this[offset + 7]; + if (first === void 0 || last === void 0) { + boundsError(offset, this.length - 8); + } + const val = (first << 24) + // Overflow + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + this[++offset]; + return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + last); + }); + Buffer3.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754$1.read(this, offset, true, 23, 4); + }; + Buffer3.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754$1.read(this, offset, false, 23, 4); + }; + Buffer3.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754$1.read(this, offset, true, 52, 8); + }; + Buffer3.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + offset = offset >>> 0; + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754$1.read(this, offset, false, 52, 8); + }; + function checkInt(buf, value, offset, ext, max, min) { + if (!Buffer3.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); + if (offset + ext > buf.length) throw new RangeError("Index out of range"); + } + Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength3, noAssert) { + value = +value; + offset = offset >>> 0; + byteLength3 = byteLength3 >>> 0; + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength3) - 1; + checkInt(this, value, offset, byteLength3, maxBytes, 0); + } + let mul = 1; + let i = 0; + this[offset] = value & 255; + while (++i < byteLength3 && (mul *= 256)) { + this[offset + i] = value / mul & 255; + } + return offset + byteLength3; + }; + Buffer3.prototype.writeUintBE = Buffer3.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength3, noAssert) { + value = +value; + offset = offset >>> 0; + byteLength3 = byteLength3 >>> 0; + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength3) - 1; + checkInt(this, value, offset, byteLength3, maxBytes, 0); + } + let i = byteLength3 - 1; + let mul = 1; + this[offset + i] = value & 255; + while (--i >= 0 && (mul *= 256)) { + this[offset + i] = value / mul & 255; + } + return offset + byteLength3; + }; + Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 1, 255, 0); + this[offset] = value & 255; + return offset + 1; + }; + Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 2, 65535, 0); + this[offset] = value & 255; + this[offset + 1] = value >>> 8; + return offset + 2; + }; + Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 2, 65535, 0); + this[offset] = value >>> 8; + this[offset + 1] = value & 255; + return offset + 2; + }; + Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0); + this[offset + 3] = value >>> 24; + this[offset + 2] = value >>> 16; + this[offset + 1] = value >>> 8; + this[offset] = value & 255; + return offset + 4; + }; + Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0); + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 255; + return offset + 4; + }; + function wrtBigUInt64LE(buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7); + let lo = Number(value & BigInt(4294967295)); + buf[offset++] = lo; + lo = lo >> 8; + buf[offset++] = lo; + lo = lo >> 8; + buf[offset++] = lo; + lo = lo >> 8; + buf[offset++] = lo; + let hi = Number(value >> BigInt(32) & BigInt(4294967295)); + buf[offset++] = hi; + hi = hi >> 8; + buf[offset++] = hi; + hi = hi >> 8; + buf[offset++] = hi; + hi = hi >> 8; + buf[offset++] = hi; + return offset; + } + function wrtBigUInt64BE(buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7); + let lo = Number(value & BigInt(4294967295)); + buf[offset + 7] = lo; + lo = lo >> 8; + buf[offset + 6] = lo; + lo = lo >> 8; + buf[offset + 5] = lo; + lo = lo >> 8; + buf[offset + 4] = lo; + let hi = Number(value >> BigInt(32) & BigInt(4294967295)); + buf[offset + 3] = hi; + hi = hi >> 8; + buf[offset + 2] = hi; + hi = hi >> 8; + buf[offset + 1] = hi; + hi = hi >> 8; + buf[offset] = hi; + return offset + 8; + } + Buffer3.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); + }); + Buffer3.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); + }); + Buffer3.prototype.writeIntLE = function writeIntLE(value, offset, byteLength3, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) { + const limit = Math.pow(2, 8 * byteLength3 - 1); + checkInt(this, value, offset, byteLength3, limit - 1, -limit); + } + let i = 0; + let mul = 1; + let sub = 0; + this[offset] = value & 255; + while (++i < byteLength3 && (mul *= 256)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1; + } + this[offset + i] = (value / mul >> 0) - sub & 255; + } + return offset + byteLength3; + }; + Buffer3.prototype.writeIntBE = function writeIntBE(value, offset, byteLength3, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) { + const limit = Math.pow(2, 8 * byteLength3 - 1); + checkInt(this, value, offset, byteLength3, limit - 1, -limit); + } + let i = byteLength3 - 1; + let mul = 1; + let sub = 0; + this[offset + i] = value & 255; + while (--i >= 0 && (mul *= 256)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1; + } + this[offset + i] = (value / mul >> 0) - sub & 255; + } + return offset + byteLength3; + }; + Buffer3.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 1, 127, -128); + if (value < 0) value = 255 + value + 1; + this[offset] = value & 255; + return offset + 1; + }; + Buffer3.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768); + this[offset] = value & 255; + this[offset + 1] = value >>> 8; + return offset + 2; + }; + Buffer3.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768); + this[offset] = value >>> 8; + this[offset + 1] = value & 255; + return offset + 2; + }; + Buffer3.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648); + this[offset] = value & 255; + this[offset + 1] = value >>> 8; + this[offset + 2] = value >>> 16; + this[offset + 3] = value >>> 24; + return offset + 4; + }; + Buffer3.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648); + if (value < 0) value = 4294967295 + value + 1; + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 255; + return offset + 4; + }; + Buffer3.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); + }); + Buffer3.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); + }); + function checkIEEE754(buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError("Index out of range"); + if (offset < 0) throw new RangeError("Index out of range"); + } + function writeFloat(buf, value, offset, littleEndian, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) { + checkIEEE754(buf, value, offset, 4); + } + ieee754$1.write(buf, value, offset, littleEndian, 23, 4); + return offset + 4; + } + Buffer3.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert); + }; + Buffer3.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert); + }; + function writeDouble(buf, value, offset, littleEndian, noAssert) { + value = +value; + offset = offset >>> 0; + if (!noAssert) { + checkIEEE754(buf, value, offset, 8); + } + ieee754$1.write(buf, value, offset, littleEndian, 52, 8); + return offset + 8; + } + Buffer3.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert); + }; + Buffer3.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert); + }; + Buffer3.prototype.copy = function copy(target, targetStart, start, end) { + if (!Buffer3.isBuffer(target)) throw new TypeError("argument should be a Buffer"); + if (!start) start = 0; + if (!end && end !== 0) end = this.length; + if (targetStart >= target.length) targetStart = target.length; + if (!targetStart) targetStart = 0; + if (end > 0 && end < start) end = start; + if (end === start) return 0; + if (target.length === 0 || this.length === 0) return 0; + if (targetStart < 0) { + throw new RangeError("targetStart out of bounds"); + } + if (start < 0 || start >= this.length) throw new RangeError("Index out of range"); + if (end < 0) throw new RangeError("sourceEnd out of bounds"); + if (end > this.length) end = this.length; + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start; + } + const len = end - start; + if (this === target && typeof GlobalUint8Array.prototype.copyWithin === "function") { + this.copyWithin(targetStart, start, end); + } else { + GlobalUint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ); + } + return len; + }; + Buffer3.prototype.fill = function fill(val, start, end, encoding) { + if (typeof val === "string") { + if (typeof start === "string") { + encoding = start; + start = 0; + end = this.length; + } else if (typeof end === "string") { + encoding = end; + end = this.length; + } + if (encoding !== void 0 && typeof encoding !== "string") { + throw new TypeError("encoding must be a string"); + } + if (typeof encoding === "string" && !Buffer3.isEncoding(encoding)) { + throw new TypeError("Unknown encoding: " + encoding); + } + if (val.length === 1) { + const code2 = val.charCodeAt(0); + if (encoding === "utf8" && code2 < 128 || encoding === "latin1") { + val = code2; + } + } + } else if (typeof val === "number") { + val = val & 255; + } else if (typeof val === "boolean") { + val = Number(val); + } + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError("Out of range index"); + } + if (end <= start) { + return this; + } + start = start >>> 0; + end = end === void 0 ? this.length : end >>> 0; + if (!val) val = 0; + let i; + if (typeof val === "number") { + for (i = start; i < end; ++i) { + this[i] = val; + } + } else { + const bytes = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding); + const len = bytes.length; + if (len === 0) { + throw new TypeError('The value "' + val + '" is invalid for argument "value"'); + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len]; + } + } + return this; + }; + const errors = {}; + function E(sym, getMessage, Base) { + errors[sym] = class NodeError extends Base { + constructor() { + super(); + Object.defineProperty(this, "message", { + value: getMessage.apply(this, arguments), + writable: true, + configurable: true + }); + this.name = `${this.name} [${sym}]`; + this.stack; + delete this.name; + } + get code() { + return sym; + } + set code(value) { + Object.defineProperty(this, "code", { + configurable: true, + enumerable: true, + value, + writable: true + }); + } + toString() { + return `${this.name} [${sym}]: ${this.message}`; + } + }; + } + E( + "ERR_BUFFER_OUT_OF_BOUNDS", + function(name) { + if (name) { + return `${name} is outside of buffer bounds`; + } + return "Attempt to access memory outside buffer bounds"; + }, + RangeError + ); + E( + "ERR_INVALID_ARG_TYPE", + function(name, actual) { + return `The "${name}" argument must be of type number. Received type ${typeof actual}`; + }, + TypeError + ); + E( + "ERR_OUT_OF_RANGE", + function(str, range, input) { + let msg = `The value of "${str}" is out of range.`; + let received = input; + if (Number.isInteger(input) && Math.abs(input) > __pow(2, 32)) { + received = addNumericalSeparator(String(input)); + } else if (typeof input === "bigint") { + received = String(input); + if (input > __pow(BigInt(2), BigInt(32)) || input < -__pow(BigInt(2), BigInt(32))) { + received = addNumericalSeparator(received); + } + received += "n"; + } + msg += ` It must be ${range}. Received ${received}`; + return msg; + }, + RangeError + ); + function addNumericalSeparator(val) { + let res = ""; + let i = val.length; + const start = val[0] === "-" ? 1 : 0; + for (; i >= start + 4; i -= 3) { + res = `_${val.slice(i - 3, i)}${res}`; + } + return `${val.slice(0, i)}${res}`; + } + function checkBounds(buf, offset, byteLength3) { + validateNumber(offset, "offset"); + if (buf[offset] === void 0 || buf[offset + byteLength3] === void 0) { + boundsError(offset, buf.length - (byteLength3 + 1)); + } + } + function checkIntBI(value, min, max, buf, offset, byteLength3) { + if (value > max || value < min) { + const n = typeof min === "bigint" ? "n" : ""; + let range; + if (byteLength3 > 3) { + if (min === 0 || min === BigInt(0)) { + range = `>= 0${n} and < 2${n} ** ${(byteLength3 + 1) * 8}${n}`; + } else { + range = `>= -(2${n} ** ${(byteLength3 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength3 + 1) * 8 - 1}${n}`; + } + } else { + range = `>= ${min}${n} and <= ${max}${n}`; + } + throw new errors.ERR_OUT_OF_RANGE("value", range, value); + } + checkBounds(buf, offset, byteLength3); + } + function validateNumber(value, name) { + if (typeof value !== "number") { + throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value); + } + } + function boundsError(value, length, type) { + if (Math.floor(value) !== value) { + validateNumber(value, type); + throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value); + } + if (length < 0) { + throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); + } + throw new errors.ERR_OUT_OF_RANGE( + type || "offset", + `>= ${type ? 1 : 0} and <= ${length}`, + value + ); + } + const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; + function base64clean(str) { + str = str.split("=")[0]; + str = str.trim().replace(INVALID_BASE64_RE, ""); + if (str.length < 2) return ""; + while (str.length % 4 !== 0) { + str = str + "="; + } + return str; + } + function utf8ToBytes(string, units) { + units = units || Infinity; + let codePoint; + const length = string.length; + let leadSurrogate = null; + const bytes = []; + for (let i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i); + if (codePoint > 55295 && codePoint < 57344) { + if (!leadSurrogate) { + if (codePoint > 56319) { + if ((units -= 3) > -1) bytes.push(239, 191, 189); + continue; + } else if (i + 1 === length) { + if ((units -= 3) > -1) bytes.push(239, 191, 189); + continue; + } + leadSurrogate = codePoint; + continue; + } + if (codePoint < 56320) { + if ((units -= 3) > -1) bytes.push(239, 191, 189); + leadSurrogate = codePoint; + continue; + } + codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; + } else if (leadSurrogate) { + if ((units -= 3) > -1) bytes.push(239, 191, 189); + } + leadSurrogate = null; + if (codePoint < 128) { + if ((units -= 1) < 0) break; + bytes.push(codePoint); + } else if (codePoint < 2048) { + if ((units -= 2) < 0) break; + bytes.push( + codePoint >> 6 | 192, + codePoint & 63 | 128 + ); + } else if (codePoint < 65536) { + if ((units -= 3) < 0) break; + bytes.push( + codePoint >> 12 | 224, + codePoint >> 6 & 63 | 128, + codePoint & 63 | 128 + ); + } else if (codePoint < 1114112) { + if ((units -= 4) < 0) break; + bytes.push( + codePoint >> 18 | 240, + codePoint >> 12 & 63 | 128, + codePoint >> 6 & 63 | 128, + codePoint & 63 | 128 + ); + } else { + throw new Error("Invalid code point"); + } + } + return bytes; + } + function asciiToBytes(str) { + const byteArray = []; + for (let i = 0; i < str.length; ++i) { + byteArray.push(str.charCodeAt(i) & 255); + } + return byteArray; + } + function utf16leToBytes(str, units) { + let c, hi, lo; + const byteArray = []; + for (let i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break; + c = str.charCodeAt(i); + hi = c >> 8; + lo = c % 256; + byteArray.push(lo); + byteArray.push(hi); + } + return byteArray; + } + function base64ToBytes(str) { + return base64.toByteArray(base64clean(str)); + } + function blitBuffer(src, dst, offset, length) { + let i; + for (i = 0; i < length; ++i) { + if (i + offset >= dst.length || i >= src.length) break; + dst[i + offset] = src[i]; + } + return i; + } + function isInstance(obj, type) { + return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; + } + function numberIsNaN(obj) { + return obj !== obj; + } + const hexSliceLookupTable = (function() { + const alphabet = "0123456789abcdef"; + const table = new Array(256); + for (let i = 0; i < 16; ++i) { + const i16 = i * 16; + for (let j = 0; j < 16; ++j) { + table[i16 + j] = alphabet[i] + alphabet[j]; + } + } + return table; + })(); + function defineBigIntMethod(fn) { + return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn; + } + function BufferBigIntNotDefined() { + throw new Error("BigInt not supported"); + } +})(buffer); +const Buffer2 = buffer.Buffer; +const Blob = buffer.Blob; +const BlobOptions = buffer.BlobOptions; +const Buffer$1 = buffer.Buffer; +const File = buffer.File; +const FileOptions = buffer.FileOptions; +const INSPECT_MAX_BYTES = buffer.INSPECT_MAX_BYTES; +const SlowBuffer = buffer.SlowBuffer; +const TranscodeEncoding = buffer.TranscodeEncoding; +const atob = buffer.atob; +const btoa = buffer.btoa; +const constants = buffer.constants; +const isAscii = buffer.isAscii; +const isUtf8 = buffer.isUtf8; +const kMaxLength = buffer.kMaxLength; +const kStringMaxLength = buffer.kStringMaxLength; +const resolveObjectURL = buffer.resolveObjectURL; +const transcode = buffer.transcode; +var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; +function getDefaultExportFromCjs(x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; +} +function getDefaultExportFromNamespaceIfPresent(n) { + return n && Object.prototype.hasOwnProperty.call(n, "default") ? n["default"] : n; +} +function getDefaultExportFromNamespaceIfNotNamed(n) { + return n && Object.prototype.hasOwnProperty.call(n, "default") && Object.keys(n).length === 1 ? n["default"] : n; +} +function getAugmentedNamespace(n) { + if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n; + var f = n.default; + if (typeof f == "function") { + var a = function a2() { + var isInstance = false; + try { + isInstance = this instanceof a2; + } catch (e) { + } + if (isInstance) { + return Reflect.construct(f, arguments, this.constructor); + } + return f.apply(this, arguments); + }; + a.prototype = f.prototype; + } else a = {}; + Object.defineProperty(a, "__esModule", { value: true }); + Object.keys(n).forEach(function(k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function() { + return n[k]; + } + }); + }); + return a; +} +var util; +var hasRequiredUtil; +function requireUtil() { + if (hasRequiredUtil) return util; + hasRequiredUtil = 1; + const ERROR_MSG_INPUT = "Input must be an string, Buffer or Uint8Array"; + function normalizeInput(input) { + let ret; + if (input instanceof Uint8Array) { + ret = input; + } else if (input instanceof Buffer2) { + ret = new Uint8Array(input); + } else if (typeof input === "string") { + ret = new Uint8Array(Buffer2.from(input, "utf8")); + } else { + throw new Error(ERROR_MSG_INPUT); + } + return ret; + } + function toHex(bytes) { + return Array.prototype.map.call(bytes, function(n) { + return (n < 16 ? "0" : "") + n.toString(16); + }).join(""); + } + function uint32ToHex(val) { + return (4294967296 + val).toString(16).substring(1); + } + function debugPrint(label, arr, size) { + let msg = "\n" + label + " = "; + for (let i = 0; i < arr.length; i += 2) { + if (size === 32) { + msg += uint32ToHex(arr[i]).toUpperCase(); + msg += " "; + msg += uint32ToHex(arr[i + 1]).toUpperCase(); + } else if (size === 64) { + msg += uint32ToHex(arr[i + 1]).toUpperCase(); + msg += uint32ToHex(arr[i]).toUpperCase(); + } else throw new Error("Invalid size " + size); + if (i % 6 === 4) { + msg += "\n" + new Array(label.length + 4).join(" "); + } else if (i < arr.length - 2) { + msg += " "; + } + } + console.log(msg); + } + function testSpeed(hashFn, N, M) { + let startMs = (/* @__PURE__ */ new Date()).getTime(); + const input = new Uint8Array(N); + for (let i = 0; i < N; i++) { + input[i] = i % 256; + } + const genMs = (/* @__PURE__ */ new Date()).getTime(); + console.log("Generated random input in " + (genMs - startMs) + "ms"); + startMs = genMs; + for (let i = 0; i < M; i++) { + const hashHex = hashFn(input); + const hashMs = (/* @__PURE__ */ new Date()).getTime(); + const ms = hashMs - startMs; + startMs = hashMs; + console.log("Hashed in " + ms + "ms: " + hashHex.substring(0, 20) + "..."); + console.log( + Math.round(N / (1 << 20) / (ms / 1e3) * 100) / 100 + " MB PER SECOND" + ); + } + } + util = { + normalizeInput, + toHex, + debugPrint, + testSpeed + }; + return util; +} +var blake2b_1; +var hasRequiredBlake2b; +function requireBlake2b() { + if (hasRequiredBlake2b) return blake2b_1; + hasRequiredBlake2b = 1; + const util2 = requireUtil(); + function ADD64AA(v2, a, b) { + const o0 = v2[a] + v2[b]; + let o1 = v2[a + 1] + v2[b + 1]; + if (o0 >= 4294967296) { + o1++; + } + v2[a] = o0; + v2[a + 1] = o1; + } + function ADD64AC(v2, a, b0, b1) { + let o0 = v2[a] + b0; + if (b0 < 0) { + o0 += 4294967296; + } + let o1 = v2[a + 1] + b1; + if (o0 >= 4294967296) { + o1++; + } + v2[a] = o0; + v2[a + 1] = o1; + } + function B2B_GET32(arr, i) { + return arr[i] ^ arr[i + 1] << 8 ^ arr[i + 2] << 16 ^ arr[i + 3] << 24; + } + function B2B_G(a, b, c, d, ix, iy) { + const x0 = m[ix]; + const x1 = m[ix + 1]; + const y0 = m[iy]; + const y1 = m[iy + 1]; + ADD64AA(v, a, b); + ADD64AC(v, a, x0, x1); + let xor0 = v[d] ^ v[a]; + let xor1 = v[d + 1] ^ v[a + 1]; + v[d] = xor1; + v[d + 1] = xor0; + ADD64AA(v, c, d); + xor0 = v[b] ^ v[c]; + xor1 = v[b + 1] ^ v[c + 1]; + v[b] = xor0 >>> 24 ^ xor1 << 8; + v[b + 1] = xor1 >>> 24 ^ xor0 << 8; + ADD64AA(v, a, b); + ADD64AC(v, a, y0, y1); + xor0 = v[d] ^ v[a]; + xor1 = v[d + 1] ^ v[a + 1]; + v[d] = xor0 >>> 16 ^ xor1 << 16; + v[d + 1] = xor1 >>> 16 ^ xor0 << 16; + ADD64AA(v, c, d); + xor0 = v[b] ^ v[c]; + xor1 = v[b + 1] ^ v[c + 1]; + v[b] = xor1 >>> 31 ^ xor0 << 1; + v[b + 1] = xor0 >>> 31 ^ xor1 << 1; + } + const BLAKE2B_IV32 = new Uint32Array([ + 4089235720, + 1779033703, + 2227873595, + 3144134277, + 4271175723, + 1013904242, + 1595750129, + 2773480762, + 2917565137, + 1359893119, + 725511199, + 2600822924, + 4215389547, + 528734635, + 327033209, + 1541459225 + ]); + const SIGMA8 = [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 14, + 10, + 4, + 8, + 9, + 15, + 13, + 6, + 1, + 12, + 0, + 2, + 11, + 7, + 5, + 3, + 11, + 8, + 12, + 0, + 5, + 2, + 15, + 13, + 10, + 14, + 3, + 6, + 7, + 1, + 9, + 4, + 7, + 9, + 3, + 1, + 13, + 12, + 11, + 14, + 2, + 6, + 5, + 10, + 4, + 0, + 15, + 8, + 9, + 0, + 5, + 7, + 2, + 4, + 10, + 15, + 14, + 1, + 11, + 12, + 6, + 8, + 3, + 13, + 2, + 12, + 6, + 10, + 0, + 11, + 8, + 3, + 4, + 13, + 7, + 5, + 15, + 14, + 1, + 9, + 12, + 5, + 1, + 15, + 14, + 13, + 4, + 10, + 0, + 7, + 6, + 3, + 9, + 2, + 8, + 11, + 13, + 11, + 7, + 14, + 12, + 1, + 3, + 9, + 5, + 0, + 15, + 4, + 8, + 6, + 2, + 10, + 6, + 15, + 14, + 9, + 11, + 3, + 0, + 8, + 12, + 2, + 13, + 7, + 1, + 4, + 10, + 5, + 10, + 2, + 8, + 4, + 7, + 6, + 1, + 5, + 15, + 11, + 9, + 14, + 3, + 12, + 13, + 0, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 14, + 10, + 4, + 8, + 9, + 15, + 13, + 6, + 1, + 12, + 0, + 2, + 11, + 7, + 5, + 3 + ]; + const SIGMA82 = new Uint8Array( + SIGMA8.map(function(x) { + return x * 2; + }) + ); + const v = new Uint32Array(32); + const m = new Uint32Array(32); + function blake2bCompress(ctx, last) { + let i = 0; + for (i = 0; i < 16; i++) { + v[i] = ctx.h[i]; + v[i + 16] = BLAKE2B_IV32[i]; + } + v[24] = v[24] ^ ctx.t; + v[25] = v[25] ^ ctx.t / 4294967296; + if (last) { + v[28] = ~v[28]; + v[29] = ~v[29]; + } + for (i = 0; i < 32; i++) { + m[i] = B2B_GET32(ctx.b, 4 * i); + } + for (i = 0; i < 12; i++) { + B2B_G(0, 8, 16, 24, SIGMA82[i * 16 + 0], SIGMA82[i * 16 + 1]); + B2B_G(2, 10, 18, 26, SIGMA82[i * 16 + 2], SIGMA82[i * 16 + 3]); + B2B_G(4, 12, 20, 28, SIGMA82[i * 16 + 4], SIGMA82[i * 16 + 5]); + B2B_G(6, 14, 22, 30, SIGMA82[i * 16 + 6], SIGMA82[i * 16 + 7]); + B2B_G(0, 10, 20, 30, SIGMA82[i * 16 + 8], SIGMA82[i * 16 + 9]); + B2B_G(2, 12, 22, 24, SIGMA82[i * 16 + 10], SIGMA82[i * 16 + 11]); + B2B_G(4, 14, 16, 26, SIGMA82[i * 16 + 12], SIGMA82[i * 16 + 13]); + B2B_G(6, 8, 18, 28, SIGMA82[i * 16 + 14], SIGMA82[i * 16 + 15]); + } + for (i = 0; i < 16; i++) { + ctx.h[i] = ctx.h[i] ^ v[i] ^ v[i + 16]; + } + } + var parameterBlock = new Uint8Array([ + 0, + 0, + 0, + 0, + // 0: outlen, keylen, fanout, depth + 0, + 0, + 0, + 0, + // 4: leaf length, sequential mode + 0, + 0, + 0, + 0, + // 8: node offset + 0, + 0, + 0, + 0, + // 12: node offset + 0, + 0, + 0, + 0, + // 16: node depth, inner length, rfu + 0, + 0, + 0, + 0, + // 20: rfu + 0, + 0, + 0, + 0, + // 24: rfu + 0, + 0, + 0, + 0, + // 28: rfu + 0, + 0, + 0, + 0, + // 32: salt + 0, + 0, + 0, + 0, + // 36: salt + 0, + 0, + 0, + 0, + // 40: salt + 0, + 0, + 0, + 0, + // 44: salt + 0, + 0, + 0, + 0, + // 48: personal + 0, + 0, + 0, + 0, + // 52: personal + 0, + 0, + 0, + 0, + // 56: personal + 0, + 0, + 0, + 0 + // 60: personal + ]); + function blake2bInit(outlen, key, salt, personal) { + if (outlen === 0 || outlen > 64) { + throw new Error("Illegal output length, expected 0 < length <= 64"); + } + if (key && key.length > 64) { + throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64"); + } + if (salt && salt.length !== 16) { + throw new Error("Illegal salt, expected Uint8Array with length is 16"); + } + if (personal && personal.length !== 16) { + throw new Error("Illegal personal, expected Uint8Array with length is 16"); + } + const ctx = { + b: new Uint8Array(128), + h: new Uint32Array(16), + t: 0, + // input count + c: 0, + // pointer within buffer + outlen + // output length in bytes + }; + parameterBlock.fill(0); + parameterBlock[0] = outlen; + if (key) parameterBlock[1] = key.length; + parameterBlock[2] = 1; + parameterBlock[3] = 1; + if (salt) parameterBlock.set(salt, 32); + if (personal) parameterBlock.set(personal, 48); + for (let i = 0; i < 16; i++) { + ctx.h[i] = BLAKE2B_IV32[i] ^ B2B_GET32(parameterBlock, i * 4); + } + if (key) { + blake2bUpdate(ctx, key); + ctx.c = 128; + } + return ctx; + } + function blake2bUpdate(ctx, input) { + for (let i = 0; i < input.length; i++) { + if (ctx.c === 128) { + ctx.t += ctx.c; + blake2bCompress(ctx, false); + ctx.c = 0; + } + ctx.b[ctx.c++] = input[i]; + } + } + function blake2bFinal(ctx) { + ctx.t += ctx.c; + while (ctx.c < 128) { + ctx.b[ctx.c++] = 0; + } + blake2bCompress(ctx, true); + const out = new Uint8Array(ctx.outlen); + for (let i = 0; i < ctx.outlen; i++) { + out[i] = ctx.h[i >> 2] >> 8 * (i & 3); + } + return out; + } + function blake2b(input, key, outlen, salt, personal) { + outlen = outlen || 64; + input = util2.normalizeInput(input); + if (salt) { + salt = util2.normalizeInput(salt); + } + if (personal) { + personal = util2.normalizeInput(personal); + } + const ctx = blake2bInit(outlen, key, salt, personal); + blake2bUpdate(ctx, input); + return blake2bFinal(ctx); + } + function blake2bHex(input, key, outlen, salt, personal) { + const output = blake2b(input, key, outlen, salt, personal); + return util2.toHex(output); + } + blake2b_1 = { + blake2b, + blake2bHex, + blake2bInit, + blake2bUpdate, + blake2bFinal + }; + return blake2b_1; +} +var blake2s_1; +var hasRequiredBlake2s; +function requireBlake2s() { + if (hasRequiredBlake2s) return blake2s_1; + hasRequiredBlake2s = 1; + const util2 = requireUtil(); + function B2S_GET32(v2, i) { + return v2[i] ^ v2[i + 1] << 8 ^ v2[i + 2] << 16 ^ v2[i + 3] << 24; + } + function B2S_G(a, b, c, d, x, y) { + v[a] = v[a] + v[b] + x; + v[d] = ROTR32(v[d] ^ v[a], 16); + v[c] = v[c] + v[d]; + v[b] = ROTR32(v[b] ^ v[c], 12); + v[a] = v[a] + v[b] + y; + v[d] = ROTR32(v[d] ^ v[a], 8); + v[c] = v[c] + v[d]; + v[b] = ROTR32(v[b] ^ v[c], 7); + } + function ROTR32(x, y) { + return x >>> y ^ x << 32 - y; + } + const BLAKE2S_IV = new Uint32Array([ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 + ]); + const SIGMA = new Uint8Array([ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 14, + 10, + 4, + 8, + 9, + 15, + 13, + 6, + 1, + 12, + 0, + 2, + 11, + 7, + 5, + 3, + 11, + 8, + 12, + 0, + 5, + 2, + 15, + 13, + 10, + 14, + 3, + 6, + 7, + 1, + 9, + 4, + 7, + 9, + 3, + 1, + 13, + 12, + 11, + 14, + 2, + 6, + 5, + 10, + 4, + 0, + 15, + 8, + 9, + 0, + 5, + 7, + 2, + 4, + 10, + 15, + 14, + 1, + 11, + 12, + 6, + 8, + 3, + 13, + 2, + 12, + 6, + 10, + 0, + 11, + 8, + 3, + 4, + 13, + 7, + 5, + 15, + 14, + 1, + 9, + 12, + 5, + 1, + 15, + 14, + 13, + 4, + 10, + 0, + 7, + 6, + 3, + 9, + 2, + 8, + 11, + 13, + 11, + 7, + 14, + 12, + 1, + 3, + 9, + 5, + 0, + 15, + 4, + 8, + 6, + 2, + 10, + 6, + 15, + 14, + 9, + 11, + 3, + 0, + 8, + 12, + 2, + 13, + 7, + 1, + 4, + 10, + 5, + 10, + 2, + 8, + 4, + 7, + 6, + 1, + 5, + 15, + 11, + 9, + 14, + 3, + 12, + 13, + 0 + ]); + const v = new Uint32Array(16); + const m = new Uint32Array(16); + function blake2sCompress(ctx, last) { + let i = 0; + for (i = 0; i < 8; i++) { + v[i] = ctx.h[i]; + v[i + 8] = BLAKE2S_IV[i]; + } + v[12] ^= ctx.t; + v[13] ^= ctx.t / 4294967296; + if (last) { + v[14] = ~v[14]; + } + for (i = 0; i < 16; i++) { + m[i] = B2S_GET32(ctx.b, 4 * i); + } + for (i = 0; i < 10; i++) { + B2S_G(0, 4, 8, 12, m[SIGMA[i * 16 + 0]], m[SIGMA[i * 16 + 1]]); + B2S_G(1, 5, 9, 13, m[SIGMA[i * 16 + 2]], m[SIGMA[i * 16 + 3]]); + B2S_G(2, 6, 10, 14, m[SIGMA[i * 16 + 4]], m[SIGMA[i * 16 + 5]]); + B2S_G(3, 7, 11, 15, m[SIGMA[i * 16 + 6]], m[SIGMA[i * 16 + 7]]); + B2S_G(0, 5, 10, 15, m[SIGMA[i * 16 + 8]], m[SIGMA[i * 16 + 9]]); + B2S_G(1, 6, 11, 12, m[SIGMA[i * 16 + 10]], m[SIGMA[i * 16 + 11]]); + B2S_G(2, 7, 8, 13, m[SIGMA[i * 16 + 12]], m[SIGMA[i * 16 + 13]]); + B2S_G(3, 4, 9, 14, m[SIGMA[i * 16 + 14]], m[SIGMA[i * 16 + 15]]); + } + for (i = 0; i < 8; i++) { + ctx.h[i] ^= v[i] ^ v[i + 8]; + } + } + function blake2sInit(outlen, key) { + if (!(outlen > 0 && outlen <= 32)) { + throw new Error("Incorrect output length, should be in [1, 32]"); + } + const keylen = key ? key.length : 0; + if (key && !(keylen > 0 && keylen <= 32)) { + throw new Error("Incorrect key length, should be in [1, 32]"); + } + const ctx = { + h: new Uint32Array(BLAKE2S_IV), + // hash state + b: new Uint8Array(64), + // input block + c: 0, + // pointer within block + t: 0, + // input count + outlen + // output length in bytes + }; + ctx.h[0] ^= 16842752 ^ keylen << 8 ^ outlen; + if (keylen > 0) { + blake2sUpdate(ctx, key); + ctx.c = 64; + } + return ctx; + } + function blake2sUpdate(ctx, input) { + for (let i = 0; i < input.length; i++) { + if (ctx.c === 64) { + ctx.t += ctx.c; + blake2sCompress(ctx, false); + ctx.c = 0; + } + ctx.b[ctx.c++] = input[i]; + } + } + function blake2sFinal(ctx) { + ctx.t += ctx.c; + while (ctx.c < 64) { + ctx.b[ctx.c++] = 0; + } + blake2sCompress(ctx, true); + const out = new Uint8Array(ctx.outlen); + for (let i = 0; i < ctx.outlen; i++) { + out[i] = ctx.h[i >> 2] >> 8 * (i & 3) & 255; + } + return out; + } + function blake2s(input, key, outlen) { + outlen = outlen || 32; + input = util2.normalizeInput(input); + const ctx = blake2sInit(outlen, key); + blake2sUpdate(ctx, input); + return blake2sFinal(ctx); + } + function blake2sHex(input, key, outlen) { + const output = blake2s(input, key, outlen); + return util2.toHex(output); + } + blake2s_1 = { + blake2s, + blake2sHex, + blake2sInit, + blake2sUpdate, + blake2sFinal + }; + return blake2s_1; +} +var blakejs; +var hasRequiredBlakejs; +function requireBlakejs() { + if (hasRequiredBlakejs) return blakejs; + hasRequiredBlakejs = 1; + const b2b = requireBlake2b(); + const b2s = requireBlake2s(); + blakejs = { + blake2b: b2b.blake2b, + blake2bHex: b2b.blake2bHex, + blake2bInit: b2b.blake2bInit, + blake2bUpdate: b2b.blake2bUpdate, + blake2bFinal: b2b.blake2bFinal, + blake2s: b2s.blake2s, + blake2sHex: b2s.blake2sHex, + blake2sInit: b2s.blake2sInit, + blake2sUpdate: b2s.blake2sUpdate, + blake2sFinal: b2s.blake2sFinal + }; + return blakejs; +} +var blakejsExports = requireBlakejs(); +const index = /* @__PURE__ */ getDefaultExportFromCjs(blakejsExports); +var base32$1 = {}; +var hasRequiredBase32; +function requireBase32() { + if (hasRequiredBase32) return base32$1; + hasRequiredBase32 = 1; + (function(exports$1) { + "use strict"; + var charmap = function(alphabet, mappings) { + mappings || (mappings = {}); + alphabet.split("").forEach(function(c, i) { + if (!(c in mappings)) mappings[c] = i; + }); + return mappings; + }; + var rfc4648 = { + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", + charmap: { + 0: 14, + 1: 8 + } + }; + rfc4648.charmap = charmap(rfc4648.alphabet, rfc4648.charmap); + var crockford = { + alphabet: "0123456789ABCDEFGHJKMNPQRSTVWXYZ", + charmap: { + O: 0, + I: 1, + L: 1 + } + }; + crockford.charmap = charmap(crockford.alphabet, crockford.charmap); + var base32hex = { + alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", + charmap: {} + }; + base32hex.charmap = charmap(base32hex.alphabet, base32hex.charmap); + function Decoder(options) { + this.buf = []; + this.shift = 8; + this.carry = 0; + if (options) { + switch (options.type) { + case "rfc4648": + this.charmap = exports$1.rfc4648.charmap; + break; + case "crockford": + this.charmap = exports$1.crockford.charmap; + break; + case "base32hex": + this.charmap = exports$1.base32hex.charmap; + break; + default: + throw new Error("invalid type"); + } + if (options.charmap) this.charmap = options.charmap; + } + } + Decoder.prototype.charmap = rfc4648.charmap; + Decoder.prototype.write = function(str) { + var charmap2 = this.charmap; + var buf = this.buf; + var shift = this.shift; + var carry = this.carry; + str.toUpperCase().split("").forEach(function(char) { + if (char == "=") return; + var symbol = charmap2[char] & 255; + shift -= 5; + if (shift > 0) { + carry |= symbol << shift; + } else if (shift < 0) { + buf.push(carry | symbol >> -shift); + shift += 8; + carry = symbol << shift & 255; + } else { + buf.push(carry | symbol); + shift = 8; + carry = 0; + } + }); + this.shift = shift; + this.carry = carry; + return this; + }; + Decoder.prototype.finalize = function(str) { + if (str) { + this.write(str); + } + if (this.shift !== 8 && this.carry !== 0) { + this.buf.push(this.carry); + this.shift = 8; + this.carry = 0; + } + return this.buf; + }; + function Encoder(options) { + this.buf = ""; + this.shift = 3; + this.carry = 0; + if (options) { + switch (options.type) { + case "rfc4648": + this.alphabet = exports$1.rfc4648.alphabet; + break; + case "crockford": + this.alphabet = exports$1.crockford.alphabet; + break; + case "base32hex": + this.alphabet = exports$1.base32hex.alphabet; + break; + default: + throw new Error("invalid type"); + } + if (options.alphabet) this.alphabet = options.alphabet; + else if (options.lc) this.alphabet = this.alphabet.toLowerCase(); + } + } + Encoder.prototype.alphabet = rfc4648.alphabet; + Encoder.prototype.write = function(buf) { + var shift = this.shift; + var carry = this.carry; + var symbol; + var byte; + var i; + for (i = 0; i < buf.length; i++) { + byte = buf[i]; + symbol = carry | byte >> shift; + this.buf += this.alphabet[symbol & 31]; + if (shift > 5) { + shift -= 5; + symbol = byte >> shift; + this.buf += this.alphabet[symbol & 31]; + } + shift = 5 - shift; + carry = byte << shift; + shift = 8 - shift; + } + this.shift = shift; + this.carry = carry; + return this; + }; + Encoder.prototype.finalize = function(buf) { + if (buf) { + this.write(buf); + } + if (this.shift !== 3) { + this.buf += this.alphabet[this.carry & 31]; + this.shift = 3; + this.carry = 0; + } + return this.buf; + }; + exports$1.encode = function(buf, options) { + return new Encoder(options).finalize(buf); + }; + exports$1.decode = function(str, options) { + return new Decoder(options).finalize(str); + }; + exports$1.Decoder = Decoder; + exports$1.Encoder = Encoder; + exports$1.charmap = charmap; + exports$1.crockford = crockford; + exports$1.rfc4648 = rfc4648; + exports$1.base32hex = base32hex; + })(base32$1); + return base32$1; +} +var base32Exports = requireBase32(); +const base32 = /* @__PURE__ */ getDefaultExportFromCjs(base32Exports); +const base32Encode = (payload) => { + const encoder = new base32.Encoder({ type: "rfc4648" }); + return encoder.write(payload).finalize(); +}; +const getValueOrFirstEntry = (value) => Array.isArray(value) && value.length ? value[0] : value; +globalThis.Buffer = Buffer$1; +const dateRegex = /^(\d{4})-(\d{2})-(\d{2})([tT ])(\d{2}):(\d{2}):(\d{2})\.?(\d{3})?(?:(?:([+-]\d{2}):?(\d{2}))|Z)?$/; +const formatRFC3339 = (date) => { + const pad = (num = 0) => `${+num < 10 ? 0 : ""}${+num}`; + const padYear = (num = 0) => `${+num < 1e3 ? 0 : ""}${+num < 100 ? 0 : ""}${+num < 10 ? 0 : ""}${+num}`; + let m = dateRegex.exec(date); + if (m && (m == null ? void 0 : m[9]) === void 0) { + m[9] = "+00"; + } + if (m && (m == null ? void 0 : m[10]) === void 0) { + m[10] = "00"; + } + const offset = `${m == null ? void 0 : m[9]}:${m == null ? void 0 : m[10]}`.replace(/[+-]?00:00$/, "Z"); + return [ + padYear(m == null ? void 0 : m[1]), + "-", + pad(m == null ? void 0 : m[2]), + "-", + pad(m == null ? void 0 : m[3]), + m == null ? void 0 : m[4], + pad(m == null ? void 0 : m[5]), + ":", + pad(m == null ? void 0 : m[6]), + ":", + pad(m == null ? void 0 : m[7]), + //ignore milliseconds (m[8]) + offset + ].join(""); +}; +function hashTwt(twt) { + const created = formatRFC3339(twt.created); + const payload = [twt.url, created, twt.content].join("\n"); + return base32Encode(blakejsExports.blake2b(payload, void 0, 32)).toLowerCase().slice(-7); +} +var dayjs_min$1 = { exports: {} }; +var dayjs_min = dayjs_min$1.exports; +var hasRequiredDayjs_min; +function requireDayjs_min() { + if (hasRequiredDayjs_min) return dayjs_min$1.exports; + hasRequiredDayjs_min = 1; + (function(module, exports$1) { + !(function(t, e) { + true ? module.exports = e() : false ? (void 0)(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e(); + })(dayjs_min, (function() { + "use strict"; + var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) { + var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100; + return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]"; + } }, m = function(t2, e2, n2) { + var r2 = String(t2); + return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2; + }, v = { s: m, z: function(t2) { + var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60; + return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0"); + }, m: function t2(e2, n2) { + if (e2.date() < n2.date()) return -t2(n2, e2); + var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c); + return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0); + }, a: function(t2) { + return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2); + }, p: function(t2) { + return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, ""); + }, u: function(t2) { + return void 0 === t2; + } }, g = "en", D = {}; + D[g] = M; + var p = "$isDayjsObject", S = function(t2) { + return t2 instanceof _ || !(!t2 || !t2[p]); + }, w = function t2(e2, n2, r2) { + var i2; + if (!e2) return g; + if ("string" == typeof e2) { + var s2 = e2.toLowerCase(); + D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2); + var u2 = e2.split("-"); + if (!i2 && u2.length > 1) return t2(u2[0]); + } else { + var a2 = e2.name; + D[a2] = e2, i2 = a2; + } + return !r2 && i2 && (g = i2), i2 || !r2 && g; + }, O = function(t2, e2) { + if (S(t2)) return t2.clone(); + var n2 = "object" == typeof e2 ? e2 : {}; + return n2.date = t2, n2.args = arguments, new _(n2); + }, b = v; + b.l = w, b.i = S, b.w = function(t2, e2) { + return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset }); + }; + var _ = (function() { + function M2(t2) { + this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true; + } + var m2 = M2.prototype; + return m2.parse = function(t2) { + this.$d = (function(t3) { + var e2 = t3.date, n2 = t3.utc; + if (null === e2) return /* @__PURE__ */ new Date(NaN); + if (b.u(e2)) return /* @__PURE__ */ new Date(); + if (e2 instanceof Date) return new Date(e2); + if ("string" == typeof e2 && !/Z$/i.test(e2)) { + var r2 = e2.match($); + if (r2) { + var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3); + return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2); + } + } + return new Date(e2); + })(t2), this.init(); + }, m2.init = function() { + var t2 = this.$d; + this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds(); + }, m2.$utils = function() { + return b; + }, m2.isValid = function() { + return !(this.$d.toString() === l); + }, m2.isSame = function(t2, e2) { + var n2 = O(t2); + return this.startOf(e2) <= n2 && n2 <= this.endOf(e2); + }, m2.isAfter = function(t2, e2) { + return O(t2) < this.startOf(e2); + }, m2.isBefore = function(t2, e2) { + return this.endOf(e2) < O(t2); + }, m2.$g = function(t2, e2, n2) { + return b.u(t2) ? this[e2] : this.set(n2, t2); + }, m2.unix = function() { + return Math.floor(this.valueOf() / 1e3); + }, m2.valueOf = function() { + return this.$d.getTime(); + }, m2.startOf = function(t2, e2) { + var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) { + var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2); + return r2 ? i2 : i2.endOf(a); + }, $2 = function(t3, e3) { + return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2); + }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : ""); + switch (f2) { + case h: + return r2 ? l2(1, 0) : l2(31, 11); + case c: + return r2 ? l2(1, M3) : l2(0, M3 + 1); + case o: + var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2; + return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3); + case a: + case d: + return $2(v2 + "Hours", 0); + case u: + return $2(v2 + "Minutes", 1); + case s: + return $2(v2 + "Seconds", 2); + case i: + return $2(v2 + "Milliseconds", 3); + default: + return this.clone(); + } + }, m2.endOf = function(t2) { + return this.startOf(t2, false); + }, m2.$set = function(t2, e2) { + var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2; + if (o2 === c || o2 === h) { + var y2 = this.clone().set(d, 1); + y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d; + } else l2 && this.$d[l2]($2); + return this.init(), this; + }, m2.set = function(t2, e2) { + return this.clone().$set(t2, e2); + }, m2.get = function(t2) { + return this[b.p(t2)](); + }, m2.add = function(r2, f2) { + var d2, l2 = this; + r2 = Number(r2); + var $2 = b.p(f2), y2 = function(t2) { + var e2 = O(l2); + return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2); + }; + if ($2 === c) return this.set(c, this.$M + r2); + if ($2 === h) return this.set(h, this.$y + r2); + if ($2 === a) return y2(1); + if ($2 === o) return y2(7); + var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3; + return b.w(m3, this); + }, m2.subtract = function(t2, e2) { + return this.add(-1 * t2, e2); + }, m2.format = function(t2) { + var e2 = this, n2 = this.$locale(); + if (!this.isValid()) return n2.invalidDate || l; + var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) { + return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3); + }, d2 = function(t3) { + return b.s(s2 % 12 || 12, t3, "0"); + }, $2 = f2 || function(t3, e3, n3) { + var r3 = t3 < 12 ? "AM" : "PM"; + return n3 ? r3.toLowerCase() : r3; + }; + return r2.replace(y, (function(t3, r3) { + return r3 || (function(t4) { + switch (t4) { + case "YY": + return String(e2.$y).slice(-2); + case "YYYY": + return b.s(e2.$y, 4, "0"); + case "M": + return a2 + 1; + case "MM": + return b.s(a2 + 1, 2, "0"); + case "MMM": + return h2(n2.monthsShort, a2, c2, 3); + case "MMMM": + return h2(c2, a2); + case "D": + return e2.$D; + case "DD": + return b.s(e2.$D, 2, "0"); + case "d": + return String(e2.$W); + case "dd": + return h2(n2.weekdaysMin, e2.$W, o2, 2); + case "ddd": + return h2(n2.weekdaysShort, e2.$W, o2, 3); + case "dddd": + return o2[e2.$W]; + case "H": + return String(s2); + case "HH": + return b.s(s2, 2, "0"); + case "h": + return d2(1); + case "hh": + return d2(2); + case "a": + return $2(s2, u2, true); + case "A": + return $2(s2, u2, false); + case "m": + return String(u2); + case "mm": + return b.s(u2, 2, "0"); + case "s": + return String(e2.$s); + case "ss": + return b.s(e2.$s, 2, "0"); + case "SSS": + return b.s(e2.$ms, 3, "0"); + case "Z": + return i2; + } + return null; + })(t3) || i2.replace(":", ""); + })); + }, m2.utcOffset = function() { + return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); + }, m2.diff = function(r2, d2, l2) { + var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() { + return b.m(y2, m3); + }; + switch (M3) { + case h: + $2 = D2() / 12; + break; + case c: + $2 = D2(); + break; + case f: + $2 = D2() / 3; + break; + case o: + $2 = (g2 - v2) / 6048e5; + break; + case a: + $2 = (g2 - v2) / 864e5; + break; + case u: + $2 = g2 / n; + break; + case s: + $2 = g2 / e; + break; + case i: + $2 = g2 / t; + break; + default: + $2 = g2; + } + return l2 ? $2 : b.a($2); + }, m2.daysInMonth = function() { + return this.endOf(c).$D; + }, m2.$locale = function() { + return D[this.$L]; + }, m2.locale = function(t2, e2) { + if (!t2) return this.$L; + var n2 = this.clone(), r2 = w(t2, e2, true); + return r2 && (n2.$L = r2), n2; + }, m2.clone = function() { + return b.w(this.$d, this); + }, m2.toDate = function() { + return new Date(this.valueOf()); + }, m2.toJSON = function() { + return this.isValid() ? this.toISOString() : null; + }, m2.toISOString = function() { + return this.$d.toISOString(); + }, m2.toString = function() { + return this.$d.toUTCString(); + }, M2; + })(), k = _.prototype; + return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach((function(t2) { + k[t2[1]] = function(e2) { + return this.$g(e2, t2[0], t2[1]); + }; + })), O.extend = function(t2, e2) { + return t2.$i || (t2(e2, _, O), t2.$i = true), O; + }, O.locale = w, O.isDayjs = S, O.unix = function(t2) { + return O(1e3 * t2); + }, O.en = D[g], O.Ls = D, O.p = {}, O; + })); + })(dayjs_min$1, dayjs_min$1.exports); + return dayjs_min$1.exports; +} +var dayjs_minExports = requireDayjs_min(); +const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports); +var utc$2 = { exports: {} }; +var utc$1 = utc$2.exports; +var hasRequiredUtc; +function requireUtc() { + if (hasRequiredUtc) return utc$2.exports; + hasRequiredUtc = 1; + (function(module, exports$1) { + !(function(t, i) { + true ? module.exports = i() : false ? (void 0)(i) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_utc = i(); + })(utc$1, (function() { + "use strict"; + var t = "minute", i = /[+-]\d\d(?::?\d\d)?/g, e = /([+-]|\d\d)/g; + return function(s, f, n) { + var u = f.prototype; + n.utc = function(t2) { + var i2 = { date: t2, utc: true, args: arguments }; + return new f(i2); + }, u.utc = function(i2) { + var e2 = n(this.toDate(), { locale: this.$L, utc: true }); + return i2 ? e2.add(this.utcOffset(), t) : e2; + }, u.local = function() { + return n(this.toDate(), { locale: this.$L, utc: false }); + }; + var r = u.parse; + u.parse = function(t2) { + t2.utc && (this.$u = true), this.$utils().u(t2.$offset) || (this.$offset = t2.$offset), r.call(this, t2); + }; + var o = u.init; + u.init = function() { + if (this.$u) { + var t2 = this.$d; + this.$y = t2.getUTCFullYear(), this.$M = t2.getUTCMonth(), this.$D = t2.getUTCDate(), this.$W = t2.getUTCDay(), this.$H = t2.getUTCHours(), this.$m = t2.getUTCMinutes(), this.$s = t2.getUTCSeconds(), this.$ms = t2.getUTCMilliseconds(); + } else o.call(this); + }; + var a = u.utcOffset; + u.utcOffset = function(s2, f2) { + var n2 = this.$utils().u; + if (n2(s2)) return this.$u ? 0 : n2(this.$offset) ? a.call(this) : this.$offset; + if ("string" == typeof s2 && (s2 = (function(t2) { + void 0 === t2 && (t2 = ""); + var s3 = t2.match(i); + if (!s3) return null; + var f3 = ("" + s3[0]).match(e) || ["-", 0, 0], n3 = f3[0], u3 = 60 * +f3[1] + +f3[2]; + return 0 === u3 ? 0 : "+" === n3 ? u3 : -u3; + })(s2), null === s2)) return this; + var u2 = Math.abs(s2) <= 16 ? 60 * s2 : s2; + if (0 === u2) return this.utc(f2); + var r2 = this.clone(); + if (f2) return r2.$offset = u2, r2.$u = false, r2; + var o2 = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset(); + return (r2 = this.local().add(u2 + o2, t)).$offset = u2, r2.$x.$localOffset = o2, r2; + }; + var h = u.format; + u.format = function(t2) { + var i2 = t2 || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : ""); + return h.call(this, i2); + }, u.valueOf = function() { + var t2 = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset()); + return this.$d.valueOf() - 6e4 * t2; + }, u.isUTC = function() { + return !!this.$u; + }, u.toISOString = function() { + return this.toDate().toISOString(); + }, u.toString = function() { + return this.toDate().toUTCString(); + }; + var l = u.toDate; + u.toDate = function(t2) { + return "s" === t2 && this.$offset ? n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : l.call(this); + }; + var c = u.diff; + u.diff = function(t2, i2, e2) { + if (t2 && this.$u === t2.$u) return c.call(this, t2, i2, e2); + var s2 = this.local(), f2 = n(t2).local(); + return c.call(s2, f2, i2, e2); + }; + }; + })); + })(utc$2, utc$2.exports); + return utc$2.exports; +} +var utcExports = requireUtc(); +const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports); +dayjs.extend(utc); +function parseTwtxt(twtxt) { + const allLines = twtxt.split("\n"); + const { commentLines = [], contentLines = [] } = allLines.reduce( + (acc, originalLine) => { + const line = originalLine.trim(); + if (line === "") return acc; + if (line.startsWith("#")) acc.commentLines.push(line); + else acc.contentLines.push(line); + return acc; + }, + { + commentLines: [], + contentLines: [] + } + ); + const { following = [], metadata = {} } = commentLines.filter((line) => line.includes("=")).reduce( + (acc, line) => { + const [key, ...vals] = line.substring(1).split("=").map((field) => field.trim()); + const val = vals.join("="); + if (key === "follow") { + const [nick, url] = val.trim().split(/\s+/); + acc.following.push({ nick, url }); + } else { + if (acc.metadata[key]) { + if (!Array.isArray(acc.metadata[key])) + acc.metadata[key] = [acc.metadata[key], val]; + else acc.metadata[key].push(val); + } else acc.metadata[key] = val; + } + return acc; + }, + { + following: [], + metadata: {} + } + ); + const replyRegEx = /\(#([\w]+)\) (\<\@(\S+) ([^>]+)>)*/; + const twts = contentLines.map((line) => { + var _a; + const [created, content] = line.split(/\t/).map((val) => val.trim()); + if (typeof content === "undefined") + throw new Error(`Content is undefined: ${line}`); + const createdDayjs = dayjs.utc(created); + if (!createdDayjs.isValid()) + throw new Error(`Date is invalid: ${line}`); + const createdUTC = createdDayjs.toISOString(); + const replyMatches = replyRegEx.exec(content); + let replyHash, replyNick, replyUrl; + if (replyMatches == null ? void 0 : replyMatches.length) { + replyHash = replyMatches == null ? void 0 : replyMatches[1]; + replyNick = replyMatches == null ? void 0 : replyMatches[3]; + replyUrl = replyMatches == null ? void 0 : replyMatches[4]; + } + const hash = hashTwt({ + content, + created, + createdUTC, + url: getValueOrFirstEntry((_a = metadata == null ? void 0 : metadata.url) != null ? _a : "") + }); + return { + content, + created, + createdUTC, + hash, + replyHash, + replyNick, + replyUrl + }; + }).sort((a, b) => dayjs(a.created).diff(dayjs(b.created))); + return { + following, + metadata, + twts + }; +} +function loadAndParseTwtxtFile(url = "") { + return __async(this, null, function* () { + if (!url) throw new Error("URL is required"); + try { + const response = yield fetch(url); + const twtxtFile = yield response.text(); + const lastModified = dayjs( + response.headers.get("Last-Modified") + ).toISOString(); + return __spreadProps(__spreadValues({}, parseTwtxt(twtxtFile)), { + lastModified + }); + } catch (err) { + console.error(err); + throw err; + } + }); +} +export { + base32Encode, + hashTwt, + loadAndParseTwtxtFile, + parseTwtxt +}; +//# sourceMappingURL=twtxt-lib.js.map +// @license-end diff --git a/dist-browser/twtxt-lib.js.map b/dist-browser/twtxt-lib.js.map new file mode 100644 index 0000000..f79af3e --- /dev/null +++ b/dist-browser/twtxt-lib.js.map @@ -0,0 +1 @@ +{"version":3,"file":"twtxt-lib.js","sources":["../node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.js","../node_modules/@exodus/blakejs/util.js","../node_modules/@exodus/blakejs/blake2b.js","../node_modules/@exodus/blakejs/blake2s.js","../node_modules/@exodus/blakejs/index.js","../node_modules/base32.js/base32.js","../src/utils.ts","../src/hashTwt.ts","../node_modules/dayjs/dayjs.min.js","../node_modules/dayjs/plugin/utc.js","../src/parseTwtxt.ts","../src/loadAndParseTwtxt.ts"],"sourcesContent":["var buffer = {};\n\nvar base64Js = {};\n\nbase64Js.byteLength = byteLength;\nbase64Js.toByteArray = toByteArray;\nbase64Js.fromByteArray = fromByteArray;\n\nvar lookup = [];\nvar revLookup = [];\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62;\nrevLookup['_'.charCodeAt(0)] = 63;\n\nfunction getLens (b64) {\n var len = b64.length;\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=');\n if (validLen === -1) validLen = len;\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4);\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction 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\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n\n var curByte = 0;\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen;\n\n var i;\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)];\n arr[curByte++] = (tmp >> 16) & 0xFF;\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4);\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2);\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp;\n var output = [];\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF);\n output.push(tripletToBase64(tmp));\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes\n var parts = [];\n var maxChunkLength = 16383; // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n );\n }\n\n return parts.join('')\n}\n\nvar ieee754 = {};\n\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\n\nieee754.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? (nBytes - 1) : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n};\n\nieee754.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);\n var i = isLE ? 0 : (nBytes - 1);\n var d = isLE ? 1 : -1;\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\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\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\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128;\n};\n\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n(function (exports) {\n\n\tconst base64 = base64Js;\n\tconst ieee754$1 = ieee754;\n\tconst customInspectSymbol =\n\t (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n\t ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n\t : null;\n\n\texports.Buffer = Buffer;\n\texports.SlowBuffer = SlowBuffer;\n\texports.INSPECT_MAX_BYTES = 50;\n\n\tconst K_MAX_LENGTH = 0x7fffffff;\n\texports.kMaxLength = K_MAX_LENGTH;\n\tconst { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis;\n\n\t/**\n\t * If `Buffer.TYPED_ARRAY_SUPPORT`:\n\t * === true Use Uint8Array implementation (fastest)\n\t * === false Print warning and recommend using `buffer` v4.x which has an Object\n\t * implementation (most compatible, even IE6)\n\t *\n\t * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n\t * Opera 11.6+, iOS 4.2+.\n\t *\n\t * We report that the browser does not support typed arrays if the are not subclassable\n\t * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n\t * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n\t * for __proto__ and has a buggy typed array implementation.\n\t */\n\tBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport();\n\n\tif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n\t typeof console.error === 'function') {\n\t console.error(\n\t 'This browser lacks typed array (Uint8Array) support which is required by ' +\n\t '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n\t );\n\t}\n\n\tfunction typedArraySupport () {\n\t // Can typed array instances can be augmented?\n\t try {\n\t const arr = new GlobalUint8Array(1);\n\t const proto = { foo: function () { return 42 } };\n\t Object.setPrototypeOf(proto, GlobalUint8Array.prototype);\n\t Object.setPrototypeOf(arr, proto);\n\t return arr.foo() === 42\n\t } catch (e) {\n\t return false\n\t }\n\t}\n\n\tObject.defineProperty(Buffer.prototype, 'parent', {\n\t enumerable: true,\n\t get: function () {\n\t if (!Buffer.isBuffer(this)) return undefined\n\t return this.buffer\n\t }\n\t});\n\n\tObject.defineProperty(Buffer.prototype, 'offset', {\n\t enumerable: true,\n\t get: function () {\n\t if (!Buffer.isBuffer(this)) return undefined\n\t return this.byteOffset\n\t }\n\t});\n\n\tfunction createBuffer (length) {\n\t if (length > K_MAX_LENGTH) {\n\t throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n\t }\n\t // Return an augmented `Uint8Array` instance\n\t const buf = new GlobalUint8Array(length);\n\t Object.setPrototypeOf(buf, Buffer.prototype);\n\t return buf\n\t}\n\n\t/**\n\t * The Buffer constructor returns instances of `Uint8Array` that have their\n\t * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n\t * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n\t * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n\t * returns a single octet.\n\t *\n\t * The `Uint8Array` prototype remains unmodified.\n\t */\n\n\tfunction Buffer (arg, encodingOrOffset, length) {\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new TypeError(\n\t 'The \"string\" argument must be of type string. Received type number'\n\t )\n\t }\n\t return allocUnsafe(arg)\n\t }\n\t return from(arg, encodingOrOffset, length)\n\t}\n\n\tBuffer.poolSize = 8192; // not used by this implementation\n\n\tfunction from (value, encodingOrOffset, length) {\n\t if (typeof value === 'string') {\n\t return fromString(value, encodingOrOffset)\n\t }\n\n\t if (GlobalArrayBuffer.isView(value)) {\n\t return fromArrayView(value)\n\t }\n\n\t if (value == null) {\n\t throw new TypeError(\n\t 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n\t 'or Array-like Object. Received type ' + (typeof value)\n\t )\n\t }\n\n\t if (isInstance(value, GlobalArrayBuffer) ||\n\t (value && isInstance(value.buffer, GlobalArrayBuffer))) {\n\t return fromArrayBuffer(value, encodingOrOffset, length)\n\t }\n\n\t if (typeof GlobalSharedArrayBuffer !== 'undefined' &&\n\t (isInstance(value, GlobalSharedArrayBuffer) ||\n\t (value && isInstance(value.buffer, GlobalSharedArrayBuffer)))) {\n\t return fromArrayBuffer(value, encodingOrOffset, length)\n\t }\n\n\t if (typeof value === 'number') {\n\t throw new TypeError(\n\t 'The \"value\" argument must not be of type number. Received type number'\n\t )\n\t }\n\n\t const valueOf = value.valueOf && value.valueOf();\n\t if (valueOf != null && valueOf !== value) {\n\t return Buffer.from(valueOf, encodingOrOffset, length)\n\t }\n\n\t const b = fromObject(value);\n\t if (b) return b\n\n\t if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n\t typeof value[Symbol.toPrimitive] === 'function') {\n\t return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n\t }\n\n\t throw new TypeError(\n\t 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n\t 'or Array-like Object. Received type ' + (typeof value)\n\t )\n\t}\n\n\t/**\n\t * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n\t * if value is a number.\n\t * Buffer.from(str[, encoding])\n\t * Buffer.from(array)\n\t * Buffer.from(buffer)\n\t * Buffer.from(arrayBuffer[, byteOffset[, length]])\n\t **/\n\tBuffer.from = function (value, encodingOrOffset, length) {\n\t return from(value, encodingOrOffset, length)\n\t};\n\n\t// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n\t// https://github.com/feross/buffer/pull/148\n\tObject.setPrototypeOf(Buffer.prototype, GlobalUint8Array.prototype);\n\tObject.setPrototypeOf(Buffer, GlobalUint8Array);\n\n\tfunction assertSize (size) {\n\t if (typeof size !== 'number') {\n\t throw new TypeError('\"size\" argument must be of type number')\n\t } else if (size < 0) {\n\t throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n\t }\n\t}\n\n\tfunction alloc (size, fill, encoding) {\n\t assertSize(size);\n\t if (size <= 0) {\n\t return createBuffer(size)\n\t }\n\t if (fill !== undefined) {\n\t // Only pay attention to encoding if it's a string. This\n\t // prevents accidentally sending in a number that would\n\t // be interpreted as a start offset.\n\t return typeof encoding === 'string'\n\t ? createBuffer(size).fill(fill, encoding)\n\t : createBuffer(size).fill(fill)\n\t }\n\t return createBuffer(size)\n\t}\n\n\t/**\n\t * Creates a new filled Buffer instance.\n\t * alloc(size[, fill[, encoding]])\n\t **/\n\tBuffer.alloc = function (size, fill, encoding) {\n\t return alloc(size, fill, encoding)\n\t};\n\n\tfunction allocUnsafe (size) {\n\t assertSize(size);\n\t return createBuffer(size < 0 ? 0 : checked(size) | 0)\n\t}\n\n\t/**\n\t * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n\t * */\n\tBuffer.allocUnsafe = function (size) {\n\t return allocUnsafe(size)\n\t};\n\t/**\n\t * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n\t */\n\tBuffer.allocUnsafeSlow = function (size) {\n\t return allocUnsafe(size)\n\t};\n\n\tfunction fromString (string, encoding) {\n\t if (typeof encoding !== 'string' || encoding === '') {\n\t encoding = 'utf8';\n\t }\n\n\t if (!Buffer.isEncoding(encoding)) {\n\t throw new TypeError('Unknown encoding: ' + encoding)\n\t }\n\n\t const length = byteLength(string, encoding) | 0;\n\t let buf = createBuffer(length);\n\n\t const actual = buf.write(string, encoding);\n\n\t if (actual !== length) {\n\t // Writing a hex string, for example, that contains invalid characters will\n\t // cause everything after the first invalid character to be ignored. (e.g.\n\t // 'abxxcd' will be treated as 'ab')\n\t buf = buf.slice(0, actual);\n\t }\n\n\t return buf\n\t}\n\n\tfunction fromArrayLike (array) {\n\t const length = array.length < 0 ? 0 : checked(array.length) | 0;\n\t const buf = createBuffer(length);\n\t for (let i = 0; i < length; i += 1) {\n\t buf[i] = array[i] & 255;\n\t }\n\t return buf\n\t}\n\n\tfunction fromArrayView (arrayView) {\n\t if (isInstance(arrayView, GlobalUint8Array)) {\n\t const copy = new GlobalUint8Array(arrayView);\n\t return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n\t }\n\t return fromArrayLike(arrayView)\n\t}\n\n\tfunction fromArrayBuffer (array, byteOffset, length) {\n\t if (byteOffset < 0 || array.byteLength < byteOffset) {\n\t throw new RangeError('\"offset\" is outside of buffer bounds')\n\t }\n\n\t if (array.byteLength < byteOffset + (length || 0)) {\n\t throw new RangeError('\"length\" is outside of buffer bounds')\n\t }\n\n\t let buf;\n\t if (byteOffset === undefined && length === undefined) {\n\t buf = new GlobalUint8Array(array);\n\t } else if (length === undefined) {\n\t buf = new GlobalUint8Array(array, byteOffset);\n\t } else {\n\t buf = new GlobalUint8Array(array, byteOffset, length);\n\t }\n\n\t // Return an augmented `Uint8Array` instance\n\t Object.setPrototypeOf(buf, Buffer.prototype);\n\n\t return buf\n\t}\n\n\tfunction fromObject (obj) {\n\t if (Buffer.isBuffer(obj)) {\n\t const len = checked(obj.length) | 0;\n\t const buf = createBuffer(len);\n\n\t if (buf.length === 0) {\n\t return buf\n\t }\n\n\t obj.copy(buf, 0, 0, len);\n\t return buf\n\t }\n\n\t if (obj.length !== undefined) {\n\t if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n\t return createBuffer(0)\n\t }\n\t return fromArrayLike(obj)\n\t }\n\n\t if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n\t return fromArrayLike(obj.data)\n\t }\n\t}\n\n\tfunction checked (length) {\n\t // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n\t // length is NaN (which is otherwise coerced to zero.)\n\t if (length >= K_MAX_LENGTH) {\n\t throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n\t 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n\t }\n\t return length | 0\n\t}\n\n\tfunction SlowBuffer (length) {\n\t if (+length != length) { // eslint-disable-line eqeqeq\n\t length = 0;\n\t }\n\t return Buffer.alloc(+length)\n\t}\n\n\tBuffer.isBuffer = function isBuffer (b) {\n\t return b != null && b._isBuffer === true &&\n\t b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n\t};\n\n\tBuffer.compare = function compare (a, b) {\n\t if (isInstance(a, GlobalUint8Array)) a = Buffer.from(a, a.offset, a.byteLength);\n\t if (isInstance(b, GlobalUint8Array)) b = Buffer.from(b, b.offset, b.byteLength);\n\t if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n\t throw new TypeError(\n\t 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n\t )\n\t }\n\n\t if (a === b) return 0\n\n\t let x = a.length;\n\t let y = b.length;\n\n\t for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n\t if (a[i] !== b[i]) {\n\t x = a[i];\n\t y = b[i];\n\t break\n\t }\n\t }\n\n\t if (x < y) return -1\n\t if (y < x) return 1\n\t return 0\n\t};\n\n\tBuffer.isEncoding = function isEncoding (encoding) {\n\t switch (String(encoding).toLowerCase()) {\n\t case 'hex':\n\t case 'utf8':\n\t case 'utf-8':\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t case 'base64':\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return true\n\t default:\n\t return false\n\t }\n\t};\n\n\tBuffer.concat = function concat (list, length) {\n\t if (!Array.isArray(list)) {\n\t throw new TypeError('\"list\" argument must be an Array of Buffers')\n\t }\n\n\t if (list.length === 0) {\n\t return Buffer.alloc(0)\n\t }\n\n\t let i;\n\t if (length === undefined) {\n\t length = 0;\n\t for (i = 0; i < list.length; ++i) {\n\t length += list[i].length;\n\t }\n\t }\n\n\t const buffer = Buffer.allocUnsafe(length);\n\t let pos = 0;\n\t for (i = 0; i < list.length; ++i) {\n\t let buf = list[i];\n\t if (isInstance(buf, GlobalUint8Array)) {\n\t if (pos + buf.length > buffer.length) {\n\t if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);\n\t buf.copy(buffer, pos);\n\t } else {\n\t GlobalUint8Array.prototype.set.call(\n\t buffer,\n\t buf,\n\t pos\n\t );\n\t }\n\t } else if (!Buffer.isBuffer(buf)) {\n\t throw new TypeError('\"list\" argument must be an Array of Buffers')\n\t } else {\n\t buf.copy(buffer, pos);\n\t }\n\t pos += buf.length;\n\t }\n\t return buffer\n\t};\n\n\tfunction byteLength (string, encoding) {\n\t if (Buffer.isBuffer(string)) {\n\t return string.length\n\t }\n\t if (GlobalArrayBuffer.isView(string) || isInstance(string, GlobalArrayBuffer)) {\n\t return string.byteLength\n\t }\n\t if (typeof string !== 'string') {\n\t throw new TypeError(\n\t 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n\t 'Received type ' + typeof string\n\t )\n\t }\n\n\t const len = string.length;\n\t const mustMatch = (arguments.length > 2 && arguments[2] === true);\n\t if (!mustMatch && len === 0) return 0\n\n\t // Use a for loop to avoid recursion\n\t let loweredCase = false;\n\t for (;;) {\n\t switch (encoding) {\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t return len\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8ToBytes(string).length\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return len * 2\n\t case 'hex':\n\t return len >>> 1\n\t case 'base64':\n\t return base64ToBytes(string).length\n\t default:\n\t if (loweredCase) {\n\t return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n\t }\n\t encoding = ('' + encoding).toLowerCase();\n\t loweredCase = true;\n\t }\n\t }\n\t}\n\tBuffer.byteLength = byteLength;\n\n\tfunction slowToString (encoding, start, end) {\n\t let loweredCase = false;\n\n\t // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n\t // property of a typed array.\n\n\t // This behaves neither like String nor Uint8Array in that we set start/end\n\t // to their upper/lower bounds if the value passed is out of range.\n\t // undefined is handled specially as per ECMA-262 6th Edition,\n\t // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n\t if (start === undefined || start < 0) {\n\t start = 0;\n\t }\n\t // Return early if start > this.length. Done here to prevent potential uint32\n\t // coercion fail below.\n\t if (start > this.length) {\n\t return ''\n\t }\n\n\t if (end === undefined || end > this.length) {\n\t end = this.length;\n\t }\n\n\t if (end <= 0) {\n\t return ''\n\t }\n\n\t // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n\t end >>>= 0;\n\t start >>>= 0;\n\n\t if (end <= start) {\n\t return ''\n\t }\n\n\t if (!encoding) encoding = 'utf8';\n\n\t while (true) {\n\t switch (encoding) {\n\t case 'hex':\n\t return hexSlice(this, start, end)\n\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8Slice(this, start, end)\n\n\t case 'ascii':\n\t return asciiSlice(this, start, end)\n\n\t case 'latin1':\n\t case 'binary':\n\t return latin1Slice(this, start, end)\n\n\t case 'base64':\n\t return base64Slice(this, start, end)\n\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return utf16leSlice(this, start, end)\n\n\t default:\n\t if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n\t encoding = (encoding + '').toLowerCase();\n\t loweredCase = true;\n\t }\n\t }\n\t}\n\n\t// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n\t// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n\t// reliably in a browserify context because there could be multiple different\n\t// copies of the 'buffer' package in use. This method works even for Buffer\n\t// instances that were created from another copy of the `buffer` package.\n\t// See: https://github.com/feross/buffer/issues/154\n\tBuffer.prototype._isBuffer = true;\n\n\tfunction swap (b, n, m) {\n\t const i = b[n];\n\t b[n] = b[m];\n\t b[m] = i;\n\t}\n\n\tBuffer.prototype.swap16 = function swap16 () {\n\t const len = this.length;\n\t if (len % 2 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 16-bits')\n\t }\n\t for (let i = 0; i < len; i += 2) {\n\t swap(this, i, i + 1);\n\t }\n\t return this\n\t};\n\n\tBuffer.prototype.swap32 = function swap32 () {\n\t const len = this.length;\n\t if (len % 4 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 32-bits')\n\t }\n\t for (let i = 0; i < len; i += 4) {\n\t swap(this, i, i + 3);\n\t swap(this, i + 1, i + 2);\n\t }\n\t return this\n\t};\n\n\tBuffer.prototype.swap64 = function swap64 () {\n\t const len = this.length;\n\t if (len % 8 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 64-bits')\n\t }\n\t for (let i = 0; i < len; i += 8) {\n\t swap(this, i, i + 7);\n\t swap(this, i + 1, i + 6);\n\t swap(this, i + 2, i + 5);\n\t swap(this, i + 3, i + 4);\n\t }\n\t return this\n\t};\n\n\tBuffer.prototype.toString = function toString () {\n\t const length = this.length;\n\t if (length === 0) return ''\n\t if (arguments.length === 0) return utf8Slice(this, 0, length)\n\t return slowToString.apply(this, arguments)\n\t};\n\n\tBuffer.prototype.toLocaleString = Buffer.prototype.toString;\n\n\tBuffer.prototype.equals = function equals (b) {\n\t if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n\t if (this === b) return true\n\t return Buffer.compare(this, b) === 0\n\t};\n\n\tBuffer.prototype.inspect = function inspect () {\n\t let str = '';\n\t const max = exports.INSPECT_MAX_BYTES;\n\t str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();\n\t if (this.length > max) str += ' ... ';\n\t return ''\n\t};\n\tif (customInspectSymbol) {\n\t Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;\n\t}\n\n\tBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n\t if (isInstance(target, GlobalUint8Array)) {\n\t target = Buffer.from(target, target.offset, target.byteLength);\n\t }\n\t if (!Buffer.isBuffer(target)) {\n\t throw new TypeError(\n\t 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n\t 'Received type ' + (typeof target)\n\t )\n\t }\n\n\t if (start === undefined) {\n\t start = 0;\n\t }\n\t if (end === undefined) {\n\t end = target ? target.length : 0;\n\t }\n\t if (thisStart === undefined) {\n\t thisStart = 0;\n\t }\n\t if (thisEnd === undefined) {\n\t thisEnd = this.length;\n\t }\n\n\t if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n\t throw new RangeError('out of range index')\n\t }\n\n\t if (thisStart >= thisEnd && start >= end) {\n\t return 0\n\t }\n\t if (thisStart >= thisEnd) {\n\t return -1\n\t }\n\t if (start >= end) {\n\t return 1\n\t }\n\n\t start >>>= 0;\n\t end >>>= 0;\n\t thisStart >>>= 0;\n\t thisEnd >>>= 0;\n\n\t if (this === target) return 0\n\n\t let x = thisEnd - thisStart;\n\t let y = end - start;\n\t const len = Math.min(x, y);\n\n\t const thisCopy = this.slice(thisStart, thisEnd);\n\t const targetCopy = target.slice(start, end);\n\n\t for (let i = 0; i < len; ++i) {\n\t if (thisCopy[i] !== targetCopy[i]) {\n\t x = thisCopy[i];\n\t y = targetCopy[i];\n\t break\n\t }\n\t }\n\n\t if (x < y) return -1\n\t if (y < x) return 1\n\t return 0\n\t};\n\n\t// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n\t// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n\t//\n\t// Arguments:\n\t// - buffer - a Buffer to search\n\t// - val - a string, Buffer, or number\n\t// - byteOffset - an index into `buffer`; will be clamped to an int32\n\t// - encoding - an optional encoding, relevant is val is a string\n\t// - dir - true for indexOf, false for lastIndexOf\n\tfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n\t // Empty buffer means no match\n\t if (buffer.length === 0) return -1\n\n\t // Normalize byteOffset\n\t if (typeof byteOffset === 'string') {\n\t encoding = byteOffset;\n\t byteOffset = 0;\n\t } else if (byteOffset > 0x7fffffff) {\n\t byteOffset = 0x7fffffff;\n\t } else if (byteOffset < -0x80000000) {\n\t byteOffset = -0x80000000;\n\t }\n\t byteOffset = +byteOffset; // Coerce to Number.\n\t if (numberIsNaN(byteOffset)) {\n\t // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n\t byteOffset = dir ? 0 : (buffer.length - 1);\n\t }\n\n\t // Normalize byteOffset: negative offsets start from the end of the buffer\n\t if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n\t if (byteOffset >= buffer.length) {\n\t if (dir) return -1\n\t else byteOffset = buffer.length - 1;\n\t } else if (byteOffset < 0) {\n\t if (dir) byteOffset = 0;\n\t else return -1\n\t }\n\n\t // Normalize val\n\t if (typeof val === 'string') {\n\t val = Buffer.from(val, encoding);\n\t }\n\n\t // Finally, search either indexOf (if dir is true) or lastIndexOf\n\t if (Buffer.isBuffer(val)) {\n\t // Special case: looking for empty string/buffer always fails\n\t if (val.length === 0) {\n\t return -1\n\t }\n\t return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n\t } else if (typeof val === 'number') {\n\t val = val & 0xFF; // Search for a byte value [0-255]\n\t if (typeof GlobalUint8Array.prototype.indexOf === 'function') {\n\t if (dir) {\n\t return GlobalUint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n\t } else {\n\t return GlobalUint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n\t }\n\t }\n\t return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n\t }\n\n\t throw new TypeError('val must be string, number or Buffer')\n\t}\n\n\tfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n\t let indexSize = 1;\n\t let arrLength = arr.length;\n\t let valLength = val.length;\n\n\t if (encoding !== undefined) {\n\t encoding = String(encoding).toLowerCase();\n\t if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n\t encoding === 'utf16le' || encoding === 'utf-16le') {\n\t if (arr.length < 2 || val.length < 2) {\n\t return -1\n\t }\n\t indexSize = 2;\n\t arrLength /= 2;\n\t valLength /= 2;\n\t byteOffset /= 2;\n\t }\n\t }\n\n\t function read (buf, i) {\n\t if (indexSize === 1) {\n\t return buf[i]\n\t } else {\n\t return buf.readUInt16BE(i * indexSize)\n\t }\n\t }\n\n\t let i;\n\t if (dir) {\n\t let foundIndex = -1;\n\t for (i = byteOffset; i < arrLength; i++) {\n\t if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n\t if (foundIndex === -1) foundIndex = i;\n\t if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n\t } else {\n\t if (foundIndex !== -1) i -= i - foundIndex;\n\t foundIndex = -1;\n\t }\n\t }\n\t } else {\n\t if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n\t for (i = byteOffset; i >= 0; i--) {\n\t let found = true;\n\t for (let j = 0; j < valLength; j++) {\n\t if (read(arr, i + j) !== read(val, j)) {\n\t found = false;\n\t break\n\t }\n\t }\n\t if (found) return i\n\t }\n\t }\n\n\t return -1\n\t}\n\n\tBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n\t return this.indexOf(val, byteOffset, encoding) !== -1\n\t};\n\n\tBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n\t return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n\t};\n\n\tBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n\t return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n\t};\n\n\tfunction hexWrite (buf, string, offset, length) {\n\t offset = Number(offset) || 0;\n\t const remaining = buf.length - offset;\n\t if (!length) {\n\t length = remaining;\n\t } else {\n\t length = Number(length);\n\t if (length > remaining) {\n\t length = remaining;\n\t }\n\t }\n\n\t const strLen = string.length;\n\n\t if (length > strLen / 2) {\n\t length = strLen / 2;\n\t }\n\t let i;\n\t for (i = 0; i < length; ++i) {\n\t const parsed = parseInt(string.substr(i * 2, 2), 16);\n\t if (numberIsNaN(parsed)) return i\n\t buf[offset + i] = parsed;\n\t }\n\t return i\n\t}\n\n\tfunction utf8Write (buf, string, offset, length) {\n\t return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n\t}\n\n\tfunction asciiWrite (buf, string, offset, length) {\n\t return blitBuffer(asciiToBytes(string), buf, offset, length)\n\t}\n\n\tfunction base64Write (buf, string, offset, length) {\n\t return blitBuffer(base64ToBytes(string), buf, offset, length)\n\t}\n\n\tfunction ucs2Write (buf, string, offset, length) {\n\t return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n\t}\n\n\tBuffer.prototype.write = function write (string, offset, length, encoding) {\n\t // Buffer#write(string)\n\t if (offset === undefined) {\n\t encoding = 'utf8';\n\t length = this.length;\n\t offset = 0;\n\t // Buffer#write(string, encoding)\n\t } else if (length === undefined && typeof offset === 'string') {\n\t encoding = offset;\n\t length = this.length;\n\t offset = 0;\n\t // Buffer#write(string, offset[, length][, encoding])\n\t } else if (isFinite(offset)) {\n\t offset = offset >>> 0;\n\t if (isFinite(length)) {\n\t length = length >>> 0;\n\t if (encoding === undefined) encoding = 'utf8';\n\t } else {\n\t encoding = length;\n\t length = undefined;\n\t }\n\t } else {\n\t throw new Error(\n\t 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n\t )\n\t }\n\n\t const remaining = this.length - offset;\n\t if (length === undefined || length > remaining) length = remaining;\n\n\t if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n\t throw new RangeError('Attempt to write outside buffer bounds')\n\t }\n\n\t if (!encoding) encoding = 'utf8';\n\n\t let loweredCase = false;\n\t for (;;) {\n\t switch (encoding) {\n\t case 'hex':\n\t return hexWrite(this, string, offset, length)\n\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8Write(this, string, offset, length)\n\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t return asciiWrite(this, string, offset, length)\n\n\t case 'base64':\n\t // Warning: maxLength not taken into account in base64Write\n\t return base64Write(this, string, offset, length)\n\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return ucs2Write(this, string, offset, length)\n\n\t default:\n\t if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n\t encoding = ('' + encoding).toLowerCase();\n\t loweredCase = true;\n\t }\n\t }\n\t};\n\n\tBuffer.prototype.toJSON = function toJSON () {\n\t return {\n\t type: 'Buffer',\n\t data: Array.prototype.slice.call(this._arr || this, 0)\n\t }\n\t};\n\n\tfunction base64Slice (buf, start, end) {\n\t if (start === 0 && end === buf.length) {\n\t return base64.fromByteArray(buf)\n\t } else {\n\t return base64.fromByteArray(buf.slice(start, end))\n\t }\n\t}\n\n\tfunction utf8Slice (buf, start, end) {\n\t end = Math.min(buf.length, end);\n\t const res = [];\n\n\t let i = start;\n\t while (i < end) {\n\t const firstByte = buf[i];\n\t let codePoint = null;\n\t let bytesPerSequence = (firstByte > 0xEF)\n\t ? 4\n\t : (firstByte > 0xDF)\n\t ? 3\n\t : (firstByte > 0xBF)\n\t ? 2\n\t : 1;\n\n\t if (i + bytesPerSequence <= end) {\n\t let secondByte, thirdByte, fourthByte, tempCodePoint;\n\n\t switch (bytesPerSequence) {\n\t case 1:\n\t if (firstByte < 0x80) {\n\t codePoint = firstByte;\n\t }\n\t break\n\t case 2:\n\t secondByte = buf[i + 1];\n\t if ((secondByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);\n\t if (tempCodePoint > 0x7F) {\n\t codePoint = tempCodePoint;\n\t }\n\t }\n\t break\n\t case 3:\n\t secondByte = buf[i + 1];\n\t thirdByte = buf[i + 2];\n\t if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);\n\t if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n\t codePoint = tempCodePoint;\n\t }\n\t }\n\t break\n\t case 4:\n\t secondByte = buf[i + 1];\n\t thirdByte = buf[i + 2];\n\t fourthByte = buf[i + 3];\n\t if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);\n\t if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n\t codePoint = tempCodePoint;\n\t }\n\t }\n\t }\n\t }\n\n\t if (codePoint === null) {\n\t // we did not generate a valid codePoint so insert a\n\t // replacement char (U+FFFD) and advance only 1 byte\n\t codePoint = 0xFFFD;\n\t bytesPerSequence = 1;\n\t } else if (codePoint > 0xFFFF) {\n\t // encode to utf16 (surrogate pair dance)\n\t codePoint -= 0x10000;\n\t res.push(codePoint >>> 10 & 0x3FF | 0xD800);\n\t codePoint = 0xDC00 | codePoint & 0x3FF;\n\t }\n\n\t res.push(codePoint);\n\t i += bytesPerSequence;\n\t }\n\n\t return decodeCodePointsArray(res)\n\t}\n\n\t// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n\t// the lowest limit is Chrome, with 0x10000 args.\n\t// We go 1 magnitude less, for safety\n\tconst MAX_ARGUMENTS_LENGTH = 0x1000;\n\n\tfunction decodeCodePointsArray (codePoints) {\n\t const len = codePoints.length;\n\t if (len <= MAX_ARGUMENTS_LENGTH) {\n\t return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n\t }\n\n\t // Decode in chunks to avoid \"call stack size exceeded\".\n\t let res = '';\n\t let i = 0;\n\t while (i < len) {\n\t res += String.fromCharCode.apply(\n\t String,\n\t codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n\t );\n\t }\n\t return res\n\t}\n\n\tfunction asciiSlice (buf, start, end) {\n\t let ret = '';\n\t end = Math.min(buf.length, end);\n\n\t for (let i = start; i < end; ++i) {\n\t ret += String.fromCharCode(buf[i] & 0x7F);\n\t }\n\t return ret\n\t}\n\n\tfunction latin1Slice (buf, start, end) {\n\t let ret = '';\n\t end = Math.min(buf.length, end);\n\n\t for (let i = start; i < end; ++i) {\n\t ret += String.fromCharCode(buf[i]);\n\t }\n\t return ret\n\t}\n\n\tfunction hexSlice (buf, start, end) {\n\t const len = buf.length;\n\n\t if (!start || start < 0) start = 0;\n\t if (!end || end < 0 || end > len) end = len;\n\n\t let out = '';\n\t for (let i = start; i < end; ++i) {\n\t out += hexSliceLookupTable[buf[i]];\n\t }\n\t return out\n\t}\n\n\tfunction utf16leSlice (buf, start, end) {\n\t const bytes = buf.slice(start, end);\n\t let res = '';\n\t // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n\t for (let i = 0; i < bytes.length - 1; i += 2) {\n\t res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));\n\t }\n\t return res\n\t}\n\n\tBuffer.prototype.slice = function slice (start, end) {\n\t const len = this.length;\n\t start = ~~start;\n\t end = end === undefined ? len : ~~end;\n\n\t if (start < 0) {\n\t start += len;\n\t if (start < 0) start = 0;\n\t } else if (start > len) {\n\t start = len;\n\t }\n\n\t if (end < 0) {\n\t end += len;\n\t if (end < 0) end = 0;\n\t } else if (end > len) {\n\t end = len;\n\t }\n\n\t if (end < start) end = start;\n\n\t const newBuf = this.subarray(start, end);\n\t // Return an augmented `Uint8Array` instance\n\t Object.setPrototypeOf(newBuf, Buffer.prototype);\n\n\t return newBuf\n\t};\n\n\t/*\n\t * Need to make sure that buffer isn't trying to write out of bounds.\n\t */\n\tfunction checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}\n\n\tBuffer.prototype.readUintLE =\n\tBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n\t let val = this[offset];\n\t let mul = 1;\n\t let i = 0;\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t val += this[offset + i] * mul;\n\t }\n\n\t return val\n\t};\n\n\tBuffer.prototype.readUintBE =\n\tBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) {\n\t checkOffset(offset, byteLength, this.length);\n\t }\n\n\t let val = this[offset + --byteLength];\n\t let mul = 1;\n\t while (byteLength > 0 && (mul *= 0x100)) {\n\t val += this[offset + --byteLength] * mul;\n\t }\n\n\t return val\n\t};\n\n\tBuffer.prototype.readUint8 =\n\tBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 1, this.length);\n\t return this[offset]\n\t};\n\n\tBuffer.prototype.readUint16LE =\n\tBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 2, this.length);\n\t return this[offset] | (this[offset + 1] << 8)\n\t};\n\n\tBuffer.prototype.readUint16BE =\n\tBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 2, this.length);\n\t return (this[offset] << 8) | this[offset + 1]\n\t};\n\n\tBuffer.prototype.readUint32LE =\n\tBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\n\t return ((this[offset]) |\n\t (this[offset + 1] << 8) |\n\t (this[offset + 2] << 16)) +\n\t (this[offset + 3] * 0x1000000)\n\t};\n\n\tBuffer.prototype.readUint32BE =\n\tBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\n\t return (this[offset] * 0x1000000) +\n\t ((this[offset + 1] << 16) |\n\t (this[offset + 2] << 8) |\n\t this[offset + 3])\n\t};\n\n\tBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n\t offset = offset >>> 0;\n\t validateNumber(offset, 'offset');\n\t const first = this[offset];\n\t const last = this[offset + 7];\n\t if (first === undefined || last === undefined) {\n\t boundsError(offset, this.length - 8);\n\t }\n\n\t const lo = first +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 24;\n\n\t const hi = this[++offset] +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset] * 2 ** 16 +\n\t last * 2 ** 24;\n\n\t return BigInt(lo) + (BigInt(hi) << BigInt(32))\n\t});\n\n\tBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n\t offset = offset >>> 0;\n\t validateNumber(offset, 'offset');\n\t const first = this[offset];\n\t const last = this[offset + 7];\n\t if (first === undefined || last === undefined) {\n\t boundsError(offset, this.length - 8);\n\t }\n\n\t const hi = first * 2 ** 24 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset];\n\n\t const lo = this[++offset] * 2 ** 24 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 8 +\n\t last;\n\n\t return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n\t});\n\n\tBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n\t let val = this[offset];\n\t let mul = 1;\n\t let i = 0;\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t val += this[offset + i] * mul;\n\t }\n\t mul *= 0x80;\n\n\t if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n\t return val\n\t};\n\n\tBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n\t let i = byteLength;\n\t let mul = 1;\n\t let val = this[offset + --i];\n\t while (i > 0 && (mul *= 0x100)) {\n\t val += this[offset + --i] * mul;\n\t }\n\t mul *= 0x80;\n\n\t if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n\t return val\n\t};\n\n\tBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 1, this.length);\n\t if (!(this[offset] & 0x80)) return (this[offset])\n\t return ((0xff - this[offset] + 1) * -1)\n\t};\n\n\tBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 2, this.length);\n\t const val = this[offset] | (this[offset + 1] << 8);\n\t return (val & 0x8000) ? val | 0xFFFF0000 : val\n\t};\n\n\tBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 2, this.length);\n\t const val = this[offset + 1] | (this[offset] << 8);\n\t return (val & 0x8000) ? val | 0xFFFF0000 : val\n\t};\n\n\tBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\n\t return (this[offset]) |\n\t (this[offset + 1] << 8) |\n\t (this[offset + 2] << 16) |\n\t (this[offset + 3] << 24)\n\t};\n\n\tBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\n\t return (this[offset] << 24) |\n\t (this[offset + 1] << 16) |\n\t (this[offset + 2] << 8) |\n\t (this[offset + 3])\n\t};\n\n\tBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n\t offset = offset >>> 0;\n\t validateNumber(offset, 'offset');\n\t const first = this[offset];\n\t const last = this[offset + 7];\n\t if (first === undefined || last === undefined) {\n\t boundsError(offset, this.length - 8);\n\t }\n\n\t const val = this[offset + 4] +\n\t this[offset + 5] * 2 ** 8 +\n\t this[offset + 6] * 2 ** 16 +\n\t (last << 24); // Overflow\n\n\t return (BigInt(val) << BigInt(32)) +\n\t BigInt(first +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 24)\n\t});\n\n\tBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n\t offset = offset >>> 0;\n\t validateNumber(offset, 'offset');\n\t const first = this[offset];\n\t const last = this[offset + 7];\n\t if (first === undefined || last === undefined) {\n\t boundsError(offset, this.length - 8);\n\t }\n\n\t const val = (first << 24) + // Overflow\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset];\n\n\t return (BigInt(val) << BigInt(32)) +\n\t BigInt(this[++offset] * 2 ** 24 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 8 +\n\t last)\n\t});\n\n\tBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\t return ieee754$1.read(this, offset, true, 23, 4)\n\t};\n\n\tBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\t return ieee754$1.read(this, offset, false, 23, 4)\n\t};\n\n\tBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 8, this.length);\n\t return ieee754$1.read(this, offset, true, 52, 8)\n\t};\n\n\tBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 8, this.length);\n\t return ieee754$1.read(this, offset, false, 52, 8)\n\t};\n\n\tfunction checkInt (buf, value, offset, ext, max, min) {\n\t if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n\t if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n\t if (offset + ext > buf.length) throw new RangeError('Index out of range')\n\t}\n\n\tBuffer.prototype.writeUintLE =\n\tBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) {\n\t const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n\t checkInt(this, value, offset, byteLength, maxBytes, 0);\n\t }\n\n\t let mul = 1;\n\t let i = 0;\n\t this[offset] = value & 0xFF;\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t this[offset + i] = (value / mul) & 0xFF;\n\t }\n\n\t return offset + byteLength\n\t};\n\n\tBuffer.prototype.writeUintBE =\n\tBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) {\n\t const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n\t checkInt(this, value, offset, byteLength, maxBytes, 0);\n\t }\n\n\t let i = byteLength - 1;\n\t let mul = 1;\n\t this[offset + i] = value & 0xFF;\n\t while (--i >= 0 && (mul *= 0x100)) {\n\t this[offset + i] = (value / mul) & 0xFF;\n\t }\n\n\t return offset + byteLength\n\t};\n\n\tBuffer.prototype.writeUint8 =\n\tBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);\n\t this[offset] = (value & 0xff);\n\t return offset + 1\n\t};\n\n\tBuffer.prototype.writeUint16LE =\n\tBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n\t this[offset] = (value & 0xff);\n\t this[offset + 1] = (value >>> 8);\n\t return offset + 2\n\t};\n\n\tBuffer.prototype.writeUint16BE =\n\tBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n\t this[offset] = (value >>> 8);\n\t this[offset + 1] = (value & 0xff);\n\t return offset + 2\n\t};\n\n\tBuffer.prototype.writeUint32LE =\n\tBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n\t this[offset + 3] = (value >>> 24);\n\t this[offset + 2] = (value >>> 16);\n\t this[offset + 1] = (value >>> 8);\n\t this[offset] = (value & 0xff);\n\t return offset + 4\n\t};\n\n\tBuffer.prototype.writeUint32BE =\n\tBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n\t this[offset] = (value >>> 24);\n\t this[offset + 1] = (value >>> 16);\n\t this[offset + 2] = (value >>> 8);\n\t this[offset + 3] = (value & 0xff);\n\t return offset + 4\n\t};\n\n\tfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n\t checkIntBI(value, min, max, buf, offset, 7);\n\n\t let lo = Number(value & BigInt(0xffffffff));\n\t buf[offset++] = lo;\n\t lo = lo >> 8;\n\t buf[offset++] = lo;\n\t lo = lo >> 8;\n\t buf[offset++] = lo;\n\t lo = lo >> 8;\n\t buf[offset++] = lo;\n\t let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));\n\t buf[offset++] = hi;\n\t hi = hi >> 8;\n\t buf[offset++] = hi;\n\t hi = hi >> 8;\n\t buf[offset++] = hi;\n\t hi = hi >> 8;\n\t buf[offset++] = hi;\n\t return offset\n\t}\n\n\tfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n\t checkIntBI(value, min, max, buf, offset, 7);\n\n\t let lo = Number(value & BigInt(0xffffffff));\n\t buf[offset + 7] = lo;\n\t lo = lo >> 8;\n\t buf[offset + 6] = lo;\n\t lo = lo >> 8;\n\t buf[offset + 5] = lo;\n\t lo = lo >> 8;\n\t buf[offset + 4] = lo;\n\t let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));\n\t buf[offset + 3] = hi;\n\t hi = hi >> 8;\n\t buf[offset + 2] = hi;\n\t hi = hi >> 8;\n\t buf[offset + 1] = hi;\n\t hi = hi >> 8;\n\t buf[offset] = hi;\n\t return offset + 8\n\t}\n\n\tBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n\t return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n\t});\n\n\tBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n\t return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n\t});\n\n\tBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) {\n\t const limit = Math.pow(2, (8 * byteLength) - 1);\n\n\t checkInt(this, value, offset, byteLength, limit - 1, -limit);\n\t }\n\n\t let i = 0;\n\t let mul = 1;\n\t let sub = 0;\n\t this[offset] = value & 0xFF;\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n\t sub = 1;\n\t }\n\t this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n\t }\n\n\t return offset + byteLength\n\t};\n\n\tBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) {\n\t const limit = Math.pow(2, (8 * byteLength) - 1);\n\n\t checkInt(this, value, offset, byteLength, limit - 1, -limit);\n\t }\n\n\t let i = byteLength - 1;\n\t let mul = 1;\n\t let sub = 0;\n\t this[offset + i] = value & 0xFF;\n\t while (--i >= 0 && (mul *= 0x100)) {\n\t if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n\t sub = 1;\n\t }\n\t this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n\t }\n\n\t return offset + byteLength\n\t};\n\n\tBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);\n\t if (value < 0) value = 0xff + value + 1;\n\t this[offset] = (value & 0xff);\n\t return offset + 1\n\t};\n\n\tBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n\t this[offset] = (value & 0xff);\n\t this[offset + 1] = (value >>> 8);\n\t return offset + 2\n\t};\n\n\tBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n\t this[offset] = (value >>> 8);\n\t this[offset + 1] = (value & 0xff);\n\t return offset + 2\n\t};\n\n\tBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n\t this[offset] = (value & 0xff);\n\t this[offset + 1] = (value >>> 8);\n\t this[offset + 2] = (value >>> 16);\n\t this[offset + 3] = (value >>> 24);\n\t return offset + 4\n\t};\n\n\tBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n\t if (value < 0) value = 0xffffffff + value + 1;\n\t this[offset] = (value >>> 24);\n\t this[offset + 1] = (value >>> 16);\n\t this[offset + 2] = (value >>> 8);\n\t this[offset + 3] = (value & 0xff);\n\t return offset + 4\n\t};\n\n\tBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n\t return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n\t});\n\n\tBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n\t return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n\t});\n\n\tfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n\t if (offset + ext > buf.length) throw new RangeError('Index out of range')\n\t if (offset < 0) throw new RangeError('Index out of range')\n\t}\n\n\tfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) {\n\t checkIEEE754(buf, value, offset, 4);\n\t }\n\t ieee754$1.write(buf, value, offset, littleEndian, 23, 4);\n\t return offset + 4\n\t}\n\n\tBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n\t return writeFloat(this, value, offset, true, noAssert)\n\t};\n\n\tBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n\t return writeFloat(this, value, offset, false, noAssert)\n\t};\n\n\tfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) {\n\t checkIEEE754(buf, value, offset, 8);\n\t }\n\t ieee754$1.write(buf, value, offset, littleEndian, 52, 8);\n\t return offset + 8\n\t}\n\n\tBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n\t return writeDouble(this, value, offset, true, noAssert)\n\t};\n\n\tBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n\t return writeDouble(this, value, offset, false, noAssert)\n\t};\n\n\t// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n\tBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n\t if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n\t if (!start) start = 0;\n\t if (!end && end !== 0) end = this.length;\n\t if (targetStart >= target.length) targetStart = target.length;\n\t if (!targetStart) targetStart = 0;\n\t if (end > 0 && end < start) end = start;\n\n\t // Copy 0 bytes; we're done\n\t if (end === start) return 0\n\t if (target.length === 0 || this.length === 0) return 0\n\n\t // Fatal error conditions\n\t if (targetStart < 0) {\n\t throw new RangeError('targetStart out of bounds')\n\t }\n\t if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n\t if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n\t // Are we oob?\n\t if (end > this.length) end = this.length;\n\t if (target.length - targetStart < end - start) {\n\t end = target.length - targetStart + start;\n\t }\n\n\t const len = end - start;\n\n\t if (this === target && typeof GlobalUint8Array.prototype.copyWithin === 'function') {\n\t // Use built-in when available, missing from IE11\n\t this.copyWithin(targetStart, start, end);\n\t } else {\n\t GlobalUint8Array.prototype.set.call(\n\t target,\n\t this.subarray(start, end),\n\t targetStart\n\t );\n\t }\n\n\t return len\n\t};\n\n\t// Usage:\n\t// buffer.fill(number[, offset[, end]])\n\t// buffer.fill(buffer[, offset[, end]])\n\t// buffer.fill(string[, offset[, end]][, encoding])\n\tBuffer.prototype.fill = function fill (val, start, end, encoding) {\n\t // Handle string cases:\n\t if (typeof val === 'string') {\n\t if (typeof start === 'string') {\n\t encoding = start;\n\t start = 0;\n\t end = this.length;\n\t } else if (typeof end === 'string') {\n\t encoding = end;\n\t end = this.length;\n\t }\n\t if (encoding !== undefined && typeof encoding !== 'string') {\n\t throw new TypeError('encoding must be a string')\n\t }\n\t if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n\t throw new TypeError('Unknown encoding: ' + encoding)\n\t }\n\t if (val.length === 1) {\n\t const code = val.charCodeAt(0);\n\t if ((encoding === 'utf8' && code < 128) ||\n\t encoding === 'latin1') {\n\t // Fast path: If `val` fits into a single byte, use that numeric value.\n\t val = code;\n\t }\n\t }\n\t } else if (typeof val === 'number') {\n\t val = val & 255;\n\t } else if (typeof val === 'boolean') {\n\t val = Number(val);\n\t }\n\n\t // Invalid ranges are not set to a default, so can range check early.\n\t if (start < 0 || this.length < start || this.length < end) {\n\t throw new RangeError('Out of range index')\n\t }\n\n\t if (end <= start) {\n\t return this\n\t }\n\n\t start = start >>> 0;\n\t end = end === undefined ? this.length : end >>> 0;\n\n\t if (!val) val = 0;\n\n\t let i;\n\t if (typeof val === 'number') {\n\t for (i = start; i < end; ++i) {\n\t this[i] = val;\n\t }\n\t } else {\n\t const bytes = Buffer.isBuffer(val)\n\t ? val\n\t : Buffer.from(val, encoding);\n\t const len = bytes.length;\n\t if (len === 0) {\n\t throw new TypeError('The value \"' + val +\n\t '\" is invalid for argument \"value\"')\n\t }\n\t for (i = 0; i < end - start; ++i) {\n\t this[i + start] = bytes[i % len];\n\t }\n\t }\n\n\t return this\n\t};\n\n\t// CUSTOM ERRORS\n\t// =============\n\n\t// Simplified versions from Node, changed for Buffer-only usage\n\tconst errors = {};\n\tfunction E (sym, getMessage, Base) {\n\t errors[sym] = class NodeError extends Base {\n\t constructor () {\n\t super();\n\n\t Object.defineProperty(this, 'message', {\n\t value: getMessage.apply(this, arguments),\n\t writable: true,\n\t configurable: true\n\t });\n\n\t // Add the error code to the name to include it in the stack trace.\n\t this.name = `${this.name} [${sym}]`;\n\t // Access the stack to generate the error message including the error code\n\t // from the name.\n\t this.stack; // eslint-disable-line no-unused-expressions\n\t // Reset the name to the actual name.\n\t delete this.name;\n\t }\n\n\t get code () {\n\t return sym\n\t }\n\n\t set code (value) {\n\t Object.defineProperty(this, 'code', {\n\t configurable: true,\n\t enumerable: true,\n\t value,\n\t writable: true\n\t });\n\t }\n\n\t toString () {\n\t return `${this.name} [${sym}]: ${this.message}`\n\t }\n\t };\n\t}\n\n\tE('ERR_BUFFER_OUT_OF_BOUNDS',\n\t function (name) {\n\t if (name) {\n\t return `${name} is outside of buffer bounds`\n\t }\n\n\t return 'Attempt to access memory outside buffer bounds'\n\t }, RangeError);\n\tE('ERR_INVALID_ARG_TYPE',\n\t function (name, actual) {\n\t return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n\t }, TypeError);\n\tE('ERR_OUT_OF_RANGE',\n\t function (str, range, input) {\n\t let msg = `The value of \"${str}\" is out of range.`;\n\t let received = input;\n\t if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n\t received = addNumericalSeparator(String(input));\n\t } else if (typeof input === 'bigint') {\n\t received = String(input);\n\t if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n\t received = addNumericalSeparator(received);\n\t }\n\t received += 'n';\n\t }\n\t msg += ` It must be ${range}. Received ${received}`;\n\t return msg\n\t }, RangeError);\n\n\tfunction addNumericalSeparator (val) {\n\t let res = '';\n\t let i = val.length;\n\t const start = val[0] === '-' ? 1 : 0;\n\t for (; i >= start + 4; i -= 3) {\n\t res = `_${val.slice(i - 3, i)}${res}`;\n\t }\n\t return `${val.slice(0, i)}${res}`\n\t}\n\n\t// CHECK FUNCTIONS\n\t// ===============\n\n\tfunction checkBounds (buf, offset, byteLength) {\n\t validateNumber(offset, 'offset');\n\t if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n\t boundsError(offset, buf.length - (byteLength + 1));\n\t }\n\t}\n\n\tfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n\t if (value > max || value < min) {\n\t const n = typeof min === 'bigint' ? 'n' : '';\n\t let range;\n\t if (byteLength > 3) {\n\t if (min === 0 || min === BigInt(0)) {\n\t range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;\n\t } else {\n\t range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n\t `${(byteLength + 1) * 8 - 1}${n}`;\n\t }\n\t } else {\n\t range = `>= ${min}${n} and <= ${max}${n}`;\n\t }\n\t throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n\t }\n\t checkBounds(buf, offset, byteLength);\n\t}\n\n\tfunction validateNumber (value, name) {\n\t if (typeof value !== 'number') {\n\t throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n\t }\n\t}\n\n\tfunction boundsError (value, length, type) {\n\t if (Math.floor(value) !== value) {\n\t validateNumber(value, type);\n\t throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n\t }\n\n\t if (length < 0) {\n\t throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n\t }\n\n\t throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n\t `>= ${type ? 1 : 0} and <= ${length}`,\n\t value)\n\t}\n\n\t// HELPER FUNCTIONS\n\t// ================\n\n\tconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n\n\tfunction base64clean (str) {\n\t // Node takes equal signs as end of the Base64 encoding\n\t str = str.split('=')[0];\n\t // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n\t str = str.trim().replace(INVALID_BASE64_RE, '');\n\t // Node converts strings with length < 2 to ''\n\t if (str.length < 2) return ''\n\t // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n\t while (str.length % 4 !== 0) {\n\t str = str + '=';\n\t }\n\t return str\n\t}\n\n\tfunction utf8ToBytes (string, units) {\n\t units = units || Infinity;\n\t let codePoint;\n\t const length = string.length;\n\t let leadSurrogate = null;\n\t const bytes = [];\n\n\t for (let i = 0; i < length; ++i) {\n\t codePoint = string.charCodeAt(i);\n\n\t // is surrogate component\n\t if (codePoint > 0xD7FF && codePoint < 0xE000) {\n\t // last char was a lead\n\t if (!leadSurrogate) {\n\t // no lead yet\n\t if (codePoint > 0xDBFF) {\n\t // unexpected trail\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n\t continue\n\t } else if (i + 1 === length) {\n\t // unpaired lead\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n\t continue\n\t }\n\n\t // valid lead\n\t leadSurrogate = codePoint;\n\n\t continue\n\t }\n\n\t // 2 leads in a row\n\t if (codePoint < 0xDC00) {\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n\t leadSurrogate = codePoint;\n\t continue\n\t }\n\n\t // valid surrogate pair\n\t codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;\n\t } else if (leadSurrogate) {\n\t // valid bmp char, but last char was a lead\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n\t }\n\n\t leadSurrogate = null;\n\n\t // encode utf8\n\t if (codePoint < 0x80) {\n\t if ((units -= 1) < 0) break\n\t bytes.push(codePoint);\n\t } else if (codePoint < 0x800) {\n\t if ((units -= 2) < 0) break\n\t bytes.push(\n\t codePoint >> 0x6 | 0xC0,\n\t codePoint & 0x3F | 0x80\n\t );\n\t } else if (codePoint < 0x10000) {\n\t if ((units -= 3) < 0) break\n\t bytes.push(\n\t codePoint >> 0xC | 0xE0,\n\t codePoint >> 0x6 & 0x3F | 0x80,\n\t codePoint & 0x3F | 0x80\n\t );\n\t } else if (codePoint < 0x110000) {\n\t if ((units -= 4) < 0) break\n\t bytes.push(\n\t codePoint >> 0x12 | 0xF0,\n\t codePoint >> 0xC & 0x3F | 0x80,\n\t codePoint >> 0x6 & 0x3F | 0x80,\n\t codePoint & 0x3F | 0x80\n\t );\n\t } else {\n\t throw new Error('Invalid code point')\n\t }\n\t }\n\n\t return bytes\n\t}\n\n\tfunction asciiToBytes (str) {\n\t const byteArray = [];\n\t for (let i = 0; i < str.length; ++i) {\n\t // Node's code seems to be doing this and not & 0x7F..\n\t byteArray.push(str.charCodeAt(i) & 0xFF);\n\t }\n\t return byteArray\n\t}\n\n\tfunction utf16leToBytes (str, units) {\n\t let c, hi, lo;\n\t const byteArray = [];\n\t for (let i = 0; i < str.length; ++i) {\n\t if ((units -= 2) < 0) break\n\n\t c = str.charCodeAt(i);\n\t hi = c >> 8;\n\t lo = c % 256;\n\t byteArray.push(lo);\n\t byteArray.push(hi);\n\t }\n\n\t return byteArray\n\t}\n\n\tfunction base64ToBytes (str) {\n\t return base64.toByteArray(base64clean(str))\n\t}\n\n\tfunction blitBuffer (src, dst, offset, length) {\n\t let i;\n\t for (i = 0; i < length; ++i) {\n\t if ((i + offset >= dst.length) || (i >= src.length)) break\n\t dst[i + offset] = src[i];\n\t }\n\t return i\n\t}\n\n\t// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n\t// the `instanceof` check but they should be treated as of that type.\n\t// See: https://github.com/feross/buffer/issues/166\n\tfunction isInstance (obj, type) {\n\t return obj instanceof type ||\n\t (obj != null && obj.constructor != null && obj.constructor.name != null &&\n\t obj.constructor.name === type.name)\n\t}\n\tfunction numberIsNaN (obj) {\n\t // For IE11 support\n\t return obj !== obj // eslint-disable-line no-self-compare\n\t}\n\n\t// Create lookup table for `toString('hex')`\n\t// See: https://github.com/feross/buffer/issues/219\n\tconst hexSliceLookupTable = (function () {\n\t const alphabet = '0123456789abcdef';\n\t const table = new Array(256);\n\t for (let i = 0; i < 16; ++i) {\n\t const i16 = i * 16;\n\t for (let j = 0; j < 16; ++j) {\n\t table[i16 + j] = alphabet[i] + alphabet[j];\n\t }\n\t }\n\t return table\n\t})();\n\n\t// Return not function with Error if BigInt not supported\n\tfunction defineBigIntMethod (fn) {\n\t return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n\t}\n\n\tfunction BufferBigIntNotDefined () {\n\t throw new Error('BigInt not supported')\n\t} \n} (buffer));\n\nconst Buffer = buffer.Buffer;\n\nconst Blob = buffer.Blob;\nconst BlobOptions = buffer.BlobOptions;\nconst Buffer$1 = buffer.Buffer;\nconst File = buffer.File;\nconst FileOptions = buffer.FileOptions;\nconst INSPECT_MAX_BYTES = buffer.INSPECT_MAX_BYTES;\nconst SlowBuffer = buffer.SlowBuffer;\nconst TranscodeEncoding = buffer.TranscodeEncoding;\nconst atob = buffer.atob;\nconst btoa = buffer.btoa;\nconst constants = buffer.constants;\nconst isAscii = buffer.isAscii;\nconst isUtf8 = buffer.isUtf8;\nconst kMaxLength = buffer.kMaxLength;\nconst kStringMaxLength = buffer.kStringMaxLength;\nconst resolveObjectURL = buffer.resolveObjectURL;\nconst transcode = buffer.transcode;\nexport { Blob, BlobOptions, Buffer$1 as Buffer, File, FileOptions, INSPECT_MAX_BYTES, SlowBuffer, TranscodeEncoding, atob, btoa, constants, Buffer as default, isAscii, isUtf8, kMaxLength, kStringMaxLength, resolveObjectURL, transcode };\n//# sourceMappingURL=index.js.map\n","const ERROR_MSG_INPUT = 'Input must be an string, Buffer or Uint8Array'\n\n// For convenience, let people hash a string, not just a Uint8Array\nfunction normalizeInput (input) {\n let ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof input === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}\n\n// Converts a Uint8Array to a hexadecimal string\n// For example, toHex([255, 0, 255]) returns \"ff00ff\"\nfunction toHex (bytes) {\n return Array.prototype.map\n .call(bytes, function (n) {\n return (n < 16 ? '0' : '') + n.toString(16)\n })\n .join('')\n}\n\n// Converts any value in [0...2^32-1] to an 8-character hex string\nfunction uint32ToHex (val) {\n return (0x100000000 + val).toString(16).substring(1)\n}\n\n// For debugging: prints out hash state in the same format as the RFC\n// sample computation exactly, so that you can diff\nfunction debugPrint (label, arr, size) {\n let msg = '\\n' + label + ' = '\n for (let i = 0; i < arr.length; i += 2) {\n if (size === 32) {\n msg += uint32ToHex(arr[i]).toUpperCase()\n msg += ' '\n msg += uint32ToHex(arr[i + 1]).toUpperCase()\n } else if (size === 64) {\n msg += uint32ToHex(arr[i + 1]).toUpperCase()\n msg += uint32ToHex(arr[i]).toUpperCase()\n } else throw new Error('Invalid size ' + size)\n if (i % 6 === 4) {\n msg += '\\n' + new Array(label.length + 4).join(' ')\n } else if (i < arr.length - 2) {\n msg += ' '\n }\n }\n console.log(msg)\n}\n\n// For performance testing: generates N bytes of input, hashes M times\n// Measures and prints MB/second hash performance each time\nfunction testSpeed (hashFn, N, M) {\n let startMs = new Date().getTime()\n\n const input = new Uint8Array(N)\n for (let i = 0; i < N; i++) {\n input[i] = i % 256\n }\n const genMs = new Date().getTime()\n console.log('Generated random input in ' + (genMs - startMs) + 'ms')\n startMs = genMs\n\n for (let i = 0; i < M; i++) {\n const hashHex = hashFn(input)\n const hashMs = new Date().getTime()\n const ms = hashMs - startMs\n startMs = hashMs\n console.log('Hashed in ' + ms + 'ms: ' + hashHex.substring(0, 20) + '...')\n console.log(\n Math.round((N / (1 << 20) / (ms / 1000)) * 100) / 100 + ' MB PER SECOND'\n )\n }\n}\n\nmodule.exports = {\n normalizeInput: normalizeInput,\n toHex: toHex,\n debugPrint: debugPrint,\n testSpeed: testSpeed\n}\n","// Blake2B in pure Javascript\n// Adapted from the reference implementation in RFC7693\n// Ported to Javascript by DC - https://github.com/dcposch\n\nconst util = require('./util')\n\n// 64-bit unsigned addition\n// Sets v[a,a+1] += v[b,b+1]\n// v should be a Uint32Array\nfunction ADD64AA (v, a, b) {\n const o0 = v[a] + v[b]\n let o1 = v[a + 1] + v[b + 1]\n if (o0 >= 0x100000000) {\n o1++\n }\n v[a] = o0\n v[a + 1] = o1\n}\n\n// 64-bit unsigned addition\n// Sets v[a,a+1] += b\n// b0 is the low 32 bits of b, b1 represents the high 32 bits\nfunction ADD64AC (v, a, b0, b1) {\n let o0 = v[a] + b0\n if (b0 < 0) {\n o0 += 0x100000000\n }\n let o1 = v[a + 1] + b1\n if (o0 >= 0x100000000) {\n o1++\n }\n v[a] = o0\n v[a + 1] = o1\n}\n\n// Little-endian byte access\nfunction B2B_GET32 (arr, i) {\n return arr[i] ^ (arr[i + 1] << 8) ^ (arr[i + 2] << 16) ^ (arr[i + 3] << 24)\n}\n\n// G Mixing function\n// The ROTRs are inlined for speed\nfunction B2B_G (a, b, c, d, ix, iy) {\n const x0 = m[ix]\n const x1 = m[ix + 1]\n const y0 = m[iy]\n const y1 = m[iy + 1]\n\n ADD64AA(v, a, b) // v[a,a+1] += v[b,b+1] ... in JS we must store a uint64 as two uint32s\n ADD64AC(v, a, x0, x1) // v[a, a+1] += x ... x0 is the low 32 bits of x, x1 is the high 32 bits\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated to the right by 32 bits\n let xor0 = v[d] ^ v[a]\n let xor1 = v[d + 1] ^ v[a + 1]\n v[d] = xor1\n v[d + 1] = xor0\n\n ADD64AA(v, c, d)\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 24 bits\n xor0 = v[b] ^ v[c]\n xor1 = v[b + 1] ^ v[c + 1]\n v[b] = (xor0 >>> 24) ^ (xor1 << 8)\n v[b + 1] = (xor1 >>> 24) ^ (xor0 << 8)\n\n ADD64AA(v, a, b)\n ADD64AC(v, a, y0, y1)\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated right by 16 bits\n xor0 = v[d] ^ v[a]\n xor1 = v[d + 1] ^ v[a + 1]\n v[d] = (xor0 >>> 16) ^ (xor1 << 16)\n v[d + 1] = (xor1 >>> 16) ^ (xor0 << 16)\n\n ADD64AA(v, c, d)\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 63 bits\n xor0 = v[b] ^ v[c]\n xor1 = v[b + 1] ^ v[c + 1]\n v[b] = (xor1 >>> 31) ^ (xor0 << 1)\n v[b + 1] = (xor0 >>> 31) ^ (xor1 << 1)\n}\n\n// Initialization Vector\nconst BLAKE2B_IV32 = new Uint32Array([\n 0xf3bcc908,\n 0x6a09e667,\n 0x84caa73b,\n 0xbb67ae85,\n 0xfe94f82b,\n 0x3c6ef372,\n 0x5f1d36f1,\n 0xa54ff53a,\n 0xade682d1,\n 0x510e527f,\n 0x2b3e6c1f,\n 0x9b05688c,\n 0xfb41bd6b,\n 0x1f83d9ab,\n 0x137e2179,\n 0x5be0cd19\n])\n\nconst SIGMA8 = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 14,\n 10,\n 4,\n 8,\n 9,\n 15,\n 13,\n 6,\n 1,\n 12,\n 0,\n 2,\n 11,\n 7,\n 5,\n 3,\n 11,\n 8,\n 12,\n 0,\n 5,\n 2,\n 15,\n 13,\n 10,\n 14,\n 3,\n 6,\n 7,\n 1,\n 9,\n 4,\n 7,\n 9,\n 3,\n 1,\n 13,\n 12,\n 11,\n 14,\n 2,\n 6,\n 5,\n 10,\n 4,\n 0,\n 15,\n 8,\n 9,\n 0,\n 5,\n 7,\n 2,\n 4,\n 10,\n 15,\n 14,\n 1,\n 11,\n 12,\n 6,\n 8,\n 3,\n 13,\n 2,\n 12,\n 6,\n 10,\n 0,\n 11,\n 8,\n 3,\n 4,\n 13,\n 7,\n 5,\n 15,\n 14,\n 1,\n 9,\n 12,\n 5,\n 1,\n 15,\n 14,\n 13,\n 4,\n 10,\n 0,\n 7,\n 6,\n 3,\n 9,\n 2,\n 8,\n 11,\n 13,\n 11,\n 7,\n 14,\n 12,\n 1,\n 3,\n 9,\n 5,\n 0,\n 15,\n 4,\n 8,\n 6,\n 2,\n 10,\n 6,\n 15,\n 14,\n 9,\n 11,\n 3,\n 0,\n 8,\n 12,\n 2,\n 13,\n 7,\n 1,\n 4,\n 10,\n 5,\n 10,\n 2,\n 8,\n 4,\n 7,\n 6,\n 1,\n 5,\n 15,\n 11,\n 9,\n 14,\n 3,\n 12,\n 13,\n 0,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 14,\n 10,\n 4,\n 8,\n 9,\n 15,\n 13,\n 6,\n 1,\n 12,\n 0,\n 2,\n 11,\n 7,\n 5,\n 3\n]\n\n// These are offsets into a uint64 buffer.\n// Multiply them all by 2 to make them offsets into a uint32 buffer,\n// because this is Javascript and we don't have uint64s\nconst SIGMA82 = new Uint8Array(\n SIGMA8.map(function (x) {\n return x * 2\n })\n)\n\n// Compression function. 'last' flag indicates last block.\n// Note we're representing 16 uint64s as 32 uint32s\nconst v = new Uint32Array(32)\nconst m = new Uint32Array(32)\nfunction blake2bCompress (ctx, last) {\n let i = 0\n\n // init work variables\n for (i = 0; i < 16; i++) {\n v[i] = ctx.h[i]\n v[i + 16] = BLAKE2B_IV32[i]\n }\n\n // low 64 bits of offset\n v[24] = v[24] ^ ctx.t\n v[25] = v[25] ^ (ctx.t / 0x100000000)\n // high 64 bits not supported, offset may not be higher than 2**53-1\n\n // last block flag set ?\n if (last) {\n v[28] = ~v[28]\n v[29] = ~v[29]\n }\n\n // get little-endian words\n for (i = 0; i < 32; i++) {\n m[i] = B2B_GET32(ctx.b, 4 * i)\n }\n\n // twelve rounds of mixing\n // uncomment the DebugPrint calls to log the computation\n // and match the RFC sample documentation\n // util.debugPrint(' m[16]', m, 64)\n for (i = 0; i < 12; i++) {\n // util.debugPrint(' (i=' + (i < 10 ? ' ' : '') + i + ') v[16]', v, 64)\n B2B_G(0, 8, 16, 24, SIGMA82[i * 16 + 0], SIGMA82[i * 16 + 1])\n B2B_G(2, 10, 18, 26, SIGMA82[i * 16 + 2], SIGMA82[i * 16 + 3])\n B2B_G(4, 12, 20, 28, SIGMA82[i * 16 + 4], SIGMA82[i * 16 + 5])\n B2B_G(6, 14, 22, 30, SIGMA82[i * 16 + 6], SIGMA82[i * 16 + 7])\n B2B_G(0, 10, 20, 30, SIGMA82[i * 16 + 8], SIGMA82[i * 16 + 9])\n B2B_G(2, 12, 22, 24, SIGMA82[i * 16 + 10], SIGMA82[i * 16 + 11])\n B2B_G(4, 14, 16, 26, SIGMA82[i * 16 + 12], SIGMA82[i * 16 + 13])\n B2B_G(6, 8, 18, 28, SIGMA82[i * 16 + 14], SIGMA82[i * 16 + 15])\n }\n // util.debugPrint(' (i=12) v[16]', v, 64)\n\n for (i = 0; i < 16; i++) {\n ctx.h[i] = ctx.h[i] ^ v[i] ^ v[i + 16]\n }\n // util.debugPrint('h[8]', ctx.h, 64)\n}\n\n// reusable parameterBlock\nvar parameterBlock = new Uint8Array([\n 0, 0, 0, 0, // 0: outlen, keylen, fanout, depth\n 0, 0, 0, 0, // 4: leaf length, sequential mode\n 0, 0, 0, 0, // 8: node offset\n 0, 0, 0, 0, // 12: node offset\n 0, 0, 0, 0, // 16: node depth, inner length, rfu\n 0, 0, 0, 0, // 20: rfu\n 0, 0, 0, 0, // 24: rfu\n 0, 0, 0, 0, // 28: rfu\n 0, 0, 0, 0, // 32: salt\n 0, 0, 0, 0, // 36: salt\n 0, 0, 0, 0, // 40: salt\n 0, 0, 0, 0, // 44: salt\n 0, 0, 0, 0, // 48: personal\n 0, 0, 0, 0, // 52: personal\n 0, 0, 0, 0, // 56: personal\n 0, 0, 0, 0 // 60: personal\n])\n\n// Creates a BLAKE2b hashing context\n// Requires an output length between 1 and 64 bytes\n// Takes an optional Uint8Array key\n// Takes an optinal Uint8Array salt\n// Takes an optinal Uint8Array personal\nfunction blake2bInit (outlen, key, salt, personal) {\n if (outlen === 0 || outlen > 64) {\n throw new Error('Illegal output length, expected 0 < length <= 64')\n }\n if (key && key.length > 64) {\n throw new Error('Illegal key, expected Uint8Array with 0 < length <= 64')\n }\n if (salt && salt.length !== 16) {\n throw new Error('Illegal salt, expected Uint8Array with length is 16')\n }\n if (personal && personal.length !== 16) {\n throw new Error('Illegal personal, expected Uint8Array with length is 16')\n }\n\n // state, 'param block'\n const ctx = {\n b: new Uint8Array(128),\n h: new Uint32Array(16),\n t: 0, // input count\n c: 0, // pointer within buffer\n outlen: outlen // output length in bytes\n }\n\n // zero out parameterBlock before usage\n parameterBlock.fill(0)\n parameterBlock[0] = outlen\n if (key) parameterBlock[1] = key.length\n parameterBlock[2] = 1 // fanout\n parameterBlock[3] = 1 // depth\n\n if (salt) parameterBlock.set(salt, 32)\n if (personal) parameterBlock.set(personal, 48)\n\n // initialize hash state\n for (let i = 0; i < 16; i++) {\n ctx.h[i] = BLAKE2B_IV32[i] ^ B2B_GET32(parameterBlock, i * 4)\n }\n\n // key the hash, if applicable\n if (key) {\n blake2bUpdate(ctx, key)\n // at the end\n ctx.c = 128\n }\n\n return ctx\n}\n\n// Updates a BLAKE2b streaming hash\n// Requires hash context and Uint8Array (byte array)\nfunction blake2bUpdate (ctx, input) {\n for (let i = 0; i < input.length; i++) {\n if (ctx.c === 128) {\n // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}\n\n// Completes a BLAKE2b streaming hash\n// Returns a Uint8Array containing the message digest\nfunction blake2bFinal (ctx) {\n ctx.t += ctx.c // mark last block offset\n\n while (ctx.c < 128) {\n // fill up with zeros\n ctx.b[ctx.c++] = 0\n }\n blake2bCompress(ctx, true) // final block flag = 1\n\n // little endian convert and store\n const out = new Uint8Array(ctx.outlen)\n for (let i = 0; i < ctx.outlen; i++) {\n out[i] = ctx.h[i >> 2] >> (8 * (i & 3))\n }\n return out\n}\n\n// Computes the BLAKE2B hash of a string or byte array, and returns a Uint8Array\n//\n// Returns a n-byte Uint8Array\n//\n// Parameters:\n// - input - the input bytes, as a string, Buffer or Uint8Array\n// - key - optional key Uint8Array, up to 64 bytes\n// - outlen - optional output length in bytes, default 64\n// - salt - optional salt bytes, string, Buffer or Uint8Array\n// - personal - optional personal bytes, string, Buffer or Uint8Array\nfunction blake2b (input, key, outlen, salt, personal) {\n // preprocess inputs\n outlen = outlen || 64\n input = util.normalizeInput(input)\n if (salt) {\n salt = util.normalizeInput(salt)\n }\n if (personal) {\n personal = util.normalizeInput(personal)\n }\n\n // do the math\n const ctx = blake2bInit(outlen, key, salt, personal)\n blake2bUpdate(ctx, input)\n return blake2bFinal(ctx)\n}\n\n// Computes the BLAKE2B hash of a string or byte array\n//\n// Returns an n-byte hash in hex, all lowercase\n//\n// Parameters:\n// - input - the input bytes, as a string, Buffer, or Uint8Array\n// - key - optional key Uint8Array, up to 64 bytes\n// - outlen - optional output length in bytes, default 64\n// - salt - optional salt bytes, string, Buffer or Uint8Array\n// - personal - optional personal bytes, string, Buffer or Uint8Array\nfunction blake2bHex (input, key, outlen, salt, personal) {\n const output = blake2b(input, key, outlen, salt, personal)\n return util.toHex(output)\n}\n\nmodule.exports = {\n blake2b: blake2b,\n blake2bHex: blake2bHex,\n blake2bInit: blake2bInit,\n blake2bUpdate: blake2bUpdate,\n blake2bFinal: blake2bFinal\n}\n","// BLAKE2s hash function in pure Javascript\n// Adapted from the reference implementation in RFC7693\n// Ported to Javascript by DC - https://github.com/dcposch\n\nconst util = require('./util')\n\n// Little-endian byte access.\n// Expects a Uint8Array and an index\n// Returns the little-endian uint32 at v[i..i+3]\nfunction B2S_GET32 (v, i) {\n return v[i] ^ (v[i + 1] << 8) ^ (v[i + 2] << 16) ^ (v[i + 3] << 24)\n}\n\n// Mixing function G.\nfunction B2S_G (a, b, c, d, x, y) {\n v[a] = v[a] + v[b] + x\n v[d] = ROTR32(v[d] ^ v[a], 16)\n v[c] = v[c] + v[d]\n v[b] = ROTR32(v[b] ^ v[c], 12)\n v[a] = v[a] + v[b] + y\n v[d] = ROTR32(v[d] ^ v[a], 8)\n v[c] = v[c] + v[d]\n v[b] = ROTR32(v[b] ^ v[c], 7)\n}\n\n// 32-bit right rotation\n// x should be a uint32\n// y must be between 1 and 31, inclusive\nfunction ROTR32 (x, y) {\n return (x >>> y) ^ (x << (32 - y))\n}\n\n// Initialization Vector.\nconst BLAKE2S_IV = new Uint32Array([\n 0x6a09e667,\n 0xbb67ae85,\n 0x3c6ef372,\n 0xa54ff53a,\n 0x510e527f,\n 0x9b05688c,\n 0x1f83d9ab,\n 0x5be0cd19\n])\n\nconst SIGMA = new Uint8Array([\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 14,\n 10,\n 4,\n 8,\n 9,\n 15,\n 13,\n 6,\n 1,\n 12,\n 0,\n 2,\n 11,\n 7,\n 5,\n 3,\n 11,\n 8,\n 12,\n 0,\n 5,\n 2,\n 15,\n 13,\n 10,\n 14,\n 3,\n 6,\n 7,\n 1,\n 9,\n 4,\n 7,\n 9,\n 3,\n 1,\n 13,\n 12,\n 11,\n 14,\n 2,\n 6,\n 5,\n 10,\n 4,\n 0,\n 15,\n 8,\n 9,\n 0,\n 5,\n 7,\n 2,\n 4,\n 10,\n 15,\n 14,\n 1,\n 11,\n 12,\n 6,\n 8,\n 3,\n 13,\n 2,\n 12,\n 6,\n 10,\n 0,\n 11,\n 8,\n 3,\n 4,\n 13,\n 7,\n 5,\n 15,\n 14,\n 1,\n 9,\n 12,\n 5,\n 1,\n 15,\n 14,\n 13,\n 4,\n 10,\n 0,\n 7,\n 6,\n 3,\n 9,\n 2,\n 8,\n 11,\n 13,\n 11,\n 7,\n 14,\n 12,\n 1,\n 3,\n 9,\n 5,\n 0,\n 15,\n 4,\n 8,\n 6,\n 2,\n 10,\n 6,\n 15,\n 14,\n 9,\n 11,\n 3,\n 0,\n 8,\n 12,\n 2,\n 13,\n 7,\n 1,\n 4,\n 10,\n 5,\n 10,\n 2,\n 8,\n 4,\n 7,\n 6,\n 1,\n 5,\n 15,\n 11,\n 9,\n 14,\n 3,\n 12,\n 13,\n 0\n])\n\n// Compression function. \"last\" flag indicates last block\nconst v = new Uint32Array(16)\nconst m = new Uint32Array(16)\nfunction blake2sCompress (ctx, last) {\n let i = 0\n for (i = 0; i < 8; i++) {\n // init work variables\n v[i] = ctx.h[i]\n v[i + 8] = BLAKE2S_IV[i]\n }\n\n v[12] ^= ctx.t // low 32 bits of offset\n v[13] ^= ctx.t / 0x100000000 // high 32 bits\n if (last) {\n // last block flag set ?\n v[14] = ~v[14]\n }\n\n for (i = 0; i < 16; i++) {\n // get little-endian words\n m[i] = B2S_GET32(ctx.b, 4 * i)\n }\n\n // ten rounds of mixing\n // uncomment the DebugPrint calls to log the computation\n // and match the RFC sample documentation\n // util.debugPrint(' m[16]', m, 32)\n for (i = 0; i < 10; i++) {\n // util.debugPrint(' (i=' + i + ') v[16]', v, 32)\n B2S_G(0, 4, 8, 12, m[SIGMA[i * 16 + 0]], m[SIGMA[i * 16 + 1]])\n B2S_G(1, 5, 9, 13, m[SIGMA[i * 16 + 2]], m[SIGMA[i * 16 + 3]])\n B2S_G(2, 6, 10, 14, m[SIGMA[i * 16 + 4]], m[SIGMA[i * 16 + 5]])\n B2S_G(3, 7, 11, 15, m[SIGMA[i * 16 + 6]], m[SIGMA[i * 16 + 7]])\n B2S_G(0, 5, 10, 15, m[SIGMA[i * 16 + 8]], m[SIGMA[i * 16 + 9]])\n B2S_G(1, 6, 11, 12, m[SIGMA[i * 16 + 10]], m[SIGMA[i * 16 + 11]])\n B2S_G(2, 7, 8, 13, m[SIGMA[i * 16 + 12]], m[SIGMA[i * 16 + 13]])\n B2S_G(3, 4, 9, 14, m[SIGMA[i * 16 + 14]], m[SIGMA[i * 16 + 15]])\n }\n // util.debugPrint(' (i=10) v[16]', v, 32)\n\n for (i = 0; i < 8; i++) {\n ctx.h[i] ^= v[i] ^ v[i + 8]\n }\n // util.debugPrint('h[8]', ctx.h, 32)\n}\n\n// Creates a BLAKE2s hashing context\n// Requires an output length between 1 and 32 bytes\n// Takes an optional Uint8Array key\nfunction blake2sInit (outlen, key) {\n if (!(outlen > 0 && outlen <= 32)) {\n throw new Error('Incorrect output length, should be in [1, 32]')\n }\n const keylen = key ? key.length : 0\n if (key && !(keylen > 0 && keylen <= 32)) {\n throw new Error('Incorrect key length, should be in [1, 32]')\n }\n\n const ctx = {\n h: new Uint32Array(BLAKE2S_IV), // hash state\n b: new Uint8Array(64), // input block\n c: 0, // pointer within block\n t: 0, // input count\n outlen: outlen // output length in bytes\n }\n ctx.h[0] ^= 0x01010000 ^ (keylen << 8) ^ outlen\n\n if (keylen > 0) {\n blake2sUpdate(ctx, key)\n ctx.c = 64 // at the end\n }\n\n return ctx\n}\n\n// Updates a BLAKE2s streaming hash\n// Requires hash context and Uint8Array (byte array)\nfunction blake2sUpdate (ctx, input) {\n for (let i = 0; i < input.length; i++) {\n if (ctx.c === 64) {\n // buffer full ?\n ctx.t += ctx.c // add counters\n blake2sCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}\n\n// Completes a BLAKE2s streaming hash\n// Returns a Uint8Array containing the message digest\nfunction blake2sFinal (ctx) {\n ctx.t += ctx.c // mark last block offset\n while (ctx.c < 64) {\n // fill up with zeros\n ctx.b[ctx.c++] = 0\n }\n blake2sCompress(ctx, true) // final block flag = 1\n\n // little endian convert and store\n const out = new Uint8Array(ctx.outlen)\n for (let i = 0; i < ctx.outlen; i++) {\n out[i] = (ctx.h[i >> 2] >> (8 * (i & 3))) & 0xff\n }\n return out\n}\n\n// Computes the BLAKE2S hash of a string or byte array, and returns a Uint8Array\n//\n// Returns a n-byte Uint8Array\n//\n// Parameters:\n// - input - the input bytes, as a string, Buffer, or Uint8Array\n// - key - optional key Uint8Array, up to 32 bytes\n// - outlen - optional output length in bytes, default 64\nfunction blake2s (input, key, outlen) {\n // preprocess inputs\n outlen = outlen || 32\n input = util.normalizeInput(input)\n\n // do the math\n const ctx = blake2sInit(outlen, key)\n blake2sUpdate(ctx, input)\n return blake2sFinal(ctx)\n}\n\n// Computes the BLAKE2S hash of a string or byte array\n//\n// Returns an n-byte hash in hex, all lowercase\n//\n// Parameters:\n// - input - the input bytes, as a string, Buffer, or Uint8Array\n// - key - optional key Uint8Array, up to 32 bytes\n// - outlen - optional output length in bytes, default 64\nfunction blake2sHex (input, key, outlen) {\n const output = blake2s(input, key, outlen)\n return util.toHex(output)\n}\n\nmodule.exports = {\n blake2s: blake2s,\n blake2sHex: blake2sHex,\n blake2sInit: blake2sInit,\n blake2sUpdate: blake2sUpdate,\n blake2sFinal: blake2sFinal\n}\n","const b2b = require('./blake2b')\nconst b2s = require('./blake2s')\n\nmodule.exports = {\n blake2b: b2b.blake2b,\n blake2bHex: b2b.blake2bHex,\n blake2bInit: b2b.blake2bInit,\n blake2bUpdate: b2b.blake2bUpdate,\n blake2bFinal: b2b.blake2bFinal,\n blake2s: b2s.blake2s,\n blake2sHex: b2s.blake2sHex,\n blake2sInit: b2s.blake2sInit,\n blake2sUpdate: b2s.blake2sUpdate,\n blake2sFinal: b2s.blake2sFinal\n}\n","\"use strict\";\n\n/**\n * Generate a character map.\n * @param {string} alphabet e.g. \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\"\n * @param {object} mappings map overrides from key to value\n * @method\n */\n\nvar charmap = function (alphabet, mappings) {\n mappings || (mappings = {});\n alphabet.split(\"\").forEach(function (c, i) {\n if (!(c in mappings)) mappings[c] = i;\n });\n return mappings;\n}\n\n/**\n * The RFC 4648 base 32 alphabet and character map.\n * @see {@link https://tools.ietf.org/html/rfc4648}\n */\n\nvar rfc4648 = {\n alphabet: \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\",\n charmap: {\n 0: 14,\n 1: 8\n }\n};\n\nrfc4648.charmap = charmap(rfc4648.alphabet, rfc4648.charmap);\n\n/**\n * The Crockford base 32 alphabet and character map.\n * @see {@link http://www.crockford.com/wrmg/base32.html}\n */\n\nvar crockford = {\n alphabet: \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\",\n charmap: {\n O: 0,\n I: 1,\n L: 1\n }\n};\n\ncrockford.charmap = charmap(crockford.alphabet, crockford.charmap);\n\n/**\n * base32hex\n * @see {@link https://en.wikipedia.org/wiki/Base32#base32hex}\n */\n\nvar base32hex = {\n alphabet: \"0123456789ABCDEFGHIJKLMNOPQRSTUV\",\n charmap: {}\n};\n\nbase32hex.charmap = charmap(base32hex.alphabet, base32hex.charmap);\n\n/**\n * Create a new `Decoder` with the given options.\n *\n * @param {object} [options]\n * @param {string} [type] Supported Base-32 variants are \"rfc4648\" and\n * \"crockford\".\n * @param {object} [charmap] Override the character map used in decoding.\n * @constructor\n */\n\nfunction Decoder (options) {\n this.buf = [];\n this.shift = 8;\n this.carry = 0;\n\n if (options) {\n\n switch (options.type) {\n case \"rfc4648\":\n this.charmap = exports.rfc4648.charmap;\n break;\n case \"crockford\":\n this.charmap = exports.crockford.charmap;\n break;\n case \"base32hex\":\n this.charmap = exports.base32hex.charmap;\n break;\n default:\n throw new Error(\"invalid type\");\n }\n\n if (options.charmap) this.charmap = options.charmap;\n }\n}\n\n/**\n * The default character map coresponds to RFC4648.\n */\n\nDecoder.prototype.charmap = rfc4648.charmap;\n\n/**\n * Decode a string, continuing from the previous state.\n *\n * @param {string} str\n * @return {Decoder} this\n */\n\nDecoder.prototype.write = function (str) {\n var charmap = this.charmap;\n var buf = this.buf;\n var shift = this.shift;\n var carry = this.carry;\n\n // decode string\n str.toUpperCase().split(\"\").forEach(function (char) {\n\n // ignore padding\n if (char == \"=\") return;\n\n // lookup symbol\n var symbol = charmap[char] & 0xff;\n\n // 1: 00000 000\n // 2: 00 00000 0\n // 3: 0000 0000\n // 4: 0 00000 00\n // 5: 000 00000\n // 6: 00000 000\n // 7: 00 00000 0\n\n shift -= 5;\n if (shift > 0) {\n carry |= symbol << shift;\n } else if (shift < 0) {\n buf.push(carry | (symbol >> -shift));\n shift += 8;\n carry = (symbol << shift) & 0xff;\n } else {\n buf.push(carry | symbol);\n shift = 8;\n carry = 0;\n }\n });\n\n // save state\n this.shift = shift;\n this.carry = carry;\n\n // for chaining\n return this;\n};\n\n/**\n * Finish decoding.\n *\n * @param {string} [str] The final string to decode.\n * @return {Array} Decoded byte array.\n */\n\nDecoder.prototype.finalize = function (str) {\n if (str) {\n this.write(str);\n }\n if (this.shift !== 8 && this.carry !== 0) {\n this.buf.push(this.carry);\n this.shift = 8;\n this.carry = 0;\n }\n return this.buf;\n};\n\n/**\n * Create a new `Encoder` with the given options.\n *\n * @param {object} [options]\n * @param {string} [type] Supported Base-32 variants are \"rfc4648\" and\n * \"crockford\".\n * @param {object} [alphabet] Override the alphabet used in encoding.\n * @constructor\n */\n\nfunction Encoder (options) {\n this.buf = \"\";\n this.shift = 3;\n this.carry = 0;\n\n if (options) {\n\n switch (options.type) {\n case \"rfc4648\":\n this.alphabet = exports.rfc4648.alphabet;\n break;\n case \"crockford\":\n this.alphabet = exports.crockford.alphabet;\n break;\n case \"base32hex\":\n this.alphabet = exports.base32hex.alphabet;\n break;\n default:\n throw new Error(\"invalid type\");\n }\n\n if (options.alphabet) this.alphabet = options.alphabet;\n else if (options.lc) this.alphabet = this.alphabet.toLowerCase();\n }\n}\n\n/**\n * The default alphabet coresponds to RFC4648.\n */\n\nEncoder.prototype.alphabet = rfc4648.alphabet;\n\n/**\n * Encode a byte array, continuing from the previous state.\n *\n * @param {byte[]} buf The byte array to encode.\n * @return {Encoder} this\n */\n\nEncoder.prototype.write = function (buf) {\n var shift = this.shift;\n var carry = this.carry;\n var symbol;\n var byte;\n var i;\n\n // encode each byte in buf\n for (i = 0; i < buf.length; i++) {\n byte = buf[i];\n\n // 1: 00000 000\n // 2: 00 00000 0\n // 3: 0000 0000\n // 4: 0 00000 00\n // 5: 000 00000\n // 6: 00000 000\n // 7: 00 00000 0\n\n symbol = carry | (byte >> shift);\n this.buf += this.alphabet[symbol & 0x1f];\n\n if (shift > 5) {\n shift -= 5;\n symbol = byte >> shift;\n this.buf += this.alphabet[symbol & 0x1f];\n }\n\n shift = 5 - shift;\n carry = byte << shift;\n shift = 8 - shift;\n }\n\n // save state\n this.shift = shift;\n this.carry = carry;\n\n // for chaining\n return this;\n};\n\n/**\n * Finish encoding.\n *\n * @param {byte[]} [buf] The final byte array to encode.\n * @return {string} The encoded byte array.\n */\n\nEncoder.prototype.finalize = function (buf) {\n if (buf) {\n this.write(buf);\n }\n if (this.shift !== 3) {\n this.buf += this.alphabet[this.carry & 0x1f];\n this.shift = 3;\n this.carry = 0;\n }\n return this.buf;\n};\n\n/**\n * Convenience encoder.\n *\n * @param {byte[]} buf The byte array to encode.\n * @param {object} [options] Options to pass to the encoder.\n * @return {string} The encoded string.\n */\n\nexports.encode = function (buf, options) {\n return new Encoder(options).finalize(buf);\n};\n\n/**\n * Convenience decoder.\n *\n * @param {string} str The string to decode.\n * @param {object} [options] Options to pass to the decoder.\n * @return {byte[]} The decoded byte array.\n */\n\nexports.decode = function (str, options) {\n return new Decoder(options).finalize(str);\n};\n\n// Exports.\nexports.Decoder = Decoder;\nexports.Encoder = Encoder;\nexports.charmap = charmap;\nexports.crockford = crockford;\nexports.rfc4648 = rfc4648;\nexports.base32hex = base32hex;\n","import base32 from \"base32.js\";\n\nexport const base32Encode = (payload: string | Uint8Array) => {\n\tconst encoder = new base32.Encoder({ type: \"rfc4648\" });\n\treturn encoder.write(payload).finalize();\n};\n\nexport const getValueOrFirstEntry = (value: unknown | unknown[]) =>\n\tArray.isArray(value) && value.length ? value[0] : value;\n","import { Buffer } from \"buffer\";\nglobalThis.Buffer = Buffer;\n\nimport type { Twt } from \"./types.ts\";\n\nimport { blake2b } from \"@exodus/blakejs\";\n\nimport { base32Encode } from \"./utils.ts\";\n\nconst dateRegex =\n\t/^(\\d{4})-(\\d{2})-(\\d{2})([tT ])(\\d{2}):(\\d{2}):(\\d{2})\\.?(\\d{3})?(?:(?:([+-]\\d{2}):?(\\d{2}))|Z)?$/;\n\nconst formatRFC3339 = (date: string) => {\n\tconst pad = (num: number | string = 0) => `${+num < 10 ? 0 : \"\"}${+num}`;\n\tconst padYear = (num: number | string = 0) =>\n\t\t`${+num < 1000 ? 0 : \"\"}${+num < 100 ? 0 : \"\"}${\n\t\t\t+num < 10 ? 0 : \"\"\n\t\t}${+num}`;\n\n\tlet m = dateRegex.exec(date);\n\n\t//if timezone is undefined, it must be Z or nothing (otherwise the group would have captured).\n\tif (m && m?.[9] === undefined) {\n\t\t//Use UTC.\n\t\tm[9] = \"+00\";\n\t}\n\tif (m && m?.[10] === undefined) {\n\t\tm[10] = \"00\";\n\t}\n\n\tconst offset = `${m?.[9]}:${m?.[10]}`.replace(/[+-]?00:00$/, \"Z\");\n\n\treturn [\n\t\tpadYear(m?.[1]),\n\t\t\"-\",\n\t\tpad(m?.[2]),\n\t\t\"-\",\n\t\tpad(m?.[3]),\n\t\tm?.[4],\n\t\tpad(m?.[5]),\n\t\t\":\",\n\t\tpad(m?.[6]),\n\t\t\":\",\n\t\tpad(m?.[7]),\n\t\t//ignore milliseconds (m[8])\n\t\toffset,\n\t].join(\"\");\n};\n\nexport default function hashTwt(twt: Twt): string {\n\tconst created = formatRFC3339(twt.created);\n\tconst payload = [twt.url, created, twt.content].join(\"\\n\");\n\n\treturn base32Encode(blake2b(payload, undefined, 32))\n\t\t.toLowerCase()\n\t\t.slice(-7);\n}\n","!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){\"use strict\";var t=1e3,e=6e4,n=36e5,r=\"millisecond\",i=\"second\",s=\"minute\",u=\"hour\",a=\"day\",o=\"week\",c=\"month\",f=\"quarter\",h=\"year\",d=\"date\",l=\"Invalid Date\",$=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,y=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:\"en\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),ordinal:function(t){var e=[\"th\",\"st\",\"nd\",\"rd\"],n=t%100;return\"[\"+t+(e[(n-20)%10]||e[n]||e[0])+\"]\"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:\"\"+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?\"+\":\"-\")+m(r,2,\"0\")+\":\"+m(i,2,\"0\")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n=\"object\"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if(\"string\"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||\"0\").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t) {\n\t\t\tconst line = originalLine.trim();\n\t\t\tif (line === \"\") return acc;\n\n\t\t\tif (line.startsWith(\"#\")) acc.commentLines.push(line);\n\t\t\telse acc.contentLines.push(line);\n\t\t\treturn acc;\n\t\t},\n\t\t{\n\t\t\tcommentLines: [],\n\t\t\tcontentLines: [],\n\t\t},\n\t);\n\n\tconst { following = [], metadata = {} } = commentLines\n\t\t.filter((line) => line.includes(\"=\"))\n\t\t.reduce(\n\t\t\t(\n\t\t\t\tacc: {\n\t\t\t\t\tfollowing: Twttr[];\n\t\t\t\t\tmetadata: Metadata;\n\t\t\t\t},\n\t\t\t\tline,\n\t\t\t) => {\n\t\t\t\tconst [key, ...vals] = line\n\t\t\t\t\t// remove #\n\t\t\t\t\t.substring(1)\n\t\t\t\t\t.split(\"=\")\n\t\t\t\t\t.map((field) => field.trim());\n\t\t\t\tconst val = vals.join(\"=\");\n\t\t\t\tif (key === \"follow\") {\n\t\t\t\t\tconst [nick, url] = val.trim().split(/\\s+/);\n\t\t\t\t\tacc.following.push({ nick, url });\n\t\t\t\t} else {\n\t\t\t\t\tif (acc.metadata[key]) {\n\t\t\t\t\t\tif (!Array.isArray(acc.metadata[key]))\n\t\t\t\t\t\t\tacc.metadata[key] = [acc.metadata[key], val];\n\t\t\t\t\t\telse acc.metadata[key].push(val);\n\t\t\t\t\t} else acc.metadata[key] = val;\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{\n\t\t\t\tfollowing: [],\n\t\t\t\tmetadata: {},\n\t\t\t},\n\t\t);\n\n\tconst replyRegEx = /\\(#([\\w]+)\\) (\\<\\@(\\S+) ([^>]+)>)*/;\n\n\tconst twts = contentLines\n\t\t.map((line) => {\n\t\t\tconst [created, content] = line\n\t\t\t\t.split(/\\t/)\n\t\t\t\t.map((val) => val.trim());\n\n\t\t\tif (typeof content === \"undefined\")\n\t\t\t\tthrow new Error(`Content is undefined: ${line}`);\n\n\t\t\tconst createdDayjs = dayjs.utc(created);\n\t\t\tif (!createdDayjs.isValid())\n\t\t\t\tthrow new Error(`Date is invalid: ${line}`);\n\n\t\t\tconst createdUTC = createdDayjs.toISOString();\n\n\t\t\tconst replyMatches = replyRegEx.exec(content);\n\t\t\tlet replyHash, replyNick, replyUrl;\n\n\t\t\tif (replyMatches?.length) {\n\t\t\t\treplyHash = replyMatches?.[1];\n\t\t\t\treplyNick = replyMatches?.[3];\n\t\t\t\treplyUrl = replyMatches?.[4];\n\t\t\t}\n\n\t\t\tconst hash = hashTwt({\n\t\t\t\tcontent,\n\t\t\t\tcreated,\n\t\t\t\tcreatedUTC,\n\t\t\t\turl: getValueOrFirstEntry(metadata?.url ?? \"\"),\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tcontent,\n\t\t\t\tcreated,\n\t\t\t\tcreatedUTC,\n\t\t\t\thash,\n\t\t\t\treplyHash,\n\t\t\t\treplyNick,\n\t\t\t\treplyUrl,\n\t\t\t};\n\t\t})\n\t\t.sort((a, b) => dayjs(a.created).diff(dayjs(b.created)));\n\n\treturn {\n\t\tfollowing,\n\t\tmetadata,\n\t\ttwts,\n\t};\n}\n","import dayjs from \"dayjs\";\n\nimport parseTwtxt from \"./parseTwtxt.js\";\n\nexport default async function loadAndParseTwtxtFile(url = \"\") {\n\tif (!url) throw new Error(\"URL is required\");\n\n\ttry {\n\t\tconst response = await fetch(url);\n\t\tconst twtxtFile = await response.text();\n\t\tconst lastModified = dayjs(\n\t\t\tresponse.headers.get(\"Last-Modified\"),\n\t\t).toISOString();\n\n\t\treturn {\n\t\t\t...parseTwtxt(twtxtFile),\n\t\t\tlastModified,\n\t\t};\n\t} catch (err) {\n\t\tconsole.error(err);\n\t\tthrow err;\n\t}\n}\n"],"names":["buffer","exports","Buffer","SlowBuffer","byteLength","i","code","util","require$$0","v","require$$1","charmap","blake2b","define","this","t","e","n","r","s","u","a","M","m","f","l","$","y","g","D","o","d","c","h"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,CAAA;AAEb,IAAI,WAAW,CAAA;AAEf,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AAEzB,IAAI,SAAS,CAAA;AACb,IAAI,YAAY,CAAA;AAChB,IAAI,MAAM,OAAO,eAAe,cAAc,aAAa;AAE3D,IAAI,OAAO;AACX,SAAS,IAAI,GAAG,MAAM,KAAK,QAAQ,IAAI,KAAK,EAAE,GAAG;AAC/C,SAAO,CAAC,IAAI,KAAK,CAAC;AAClB,YAAU,KAAK,WAAW,CAAC,CAAC,IAAI;AAClC;AAIA,UA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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,I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;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA,KAAK,sBAAqB,0CAAU,QAAV,YAAiB,EAAE;AAAA,IAAA,CAC7C;AAED,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEF,CAAC,EACA,KAAK,CAAC,GAAG,MAAM,MAAM,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEF;ACtHA,SAA8B,sBAAsB,MAAM,IAAI;AAAA;AAC7D,QAAI,CAAC,IAAK,OAAM,IAAI,MAAM,iBAAiB;AAE3C,QAAI;AACH,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,YAAM,YAAY,MAAM,SAAS,KAAA;AACjC,YAAM,eAAe;AAAA,QACpB,SAAS,QAAQ,IAAI,eAAe;AAAA,MAAA,EACnC,YAAA;AAEF,aAAO,iCACH,WAAW,SAAS,IADjB;AAAA,QAEN;AAAA,MAAA;AAAA,IAEF,SAAS,KAAK;AACb,cAAQ,MAAM,GAAG;AACjB,YAAM;AAAA,IACP;AAAA,EACD;AAAA;","x_google_ignoreList":[0,1,2,3,4,5,8,9]} \ No newline at end of file diff --git a/dist-browser/twtxt-lib.min.js b/dist-browser/twtxt-lib.min.js new file mode 100644 index 0000000..002d9cc --- /dev/null +++ b/dist-browser/twtxt-lib.min.js @@ -0,0 +1,2318 @@ +// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt +var er = Object.defineProperty, nr = Object.defineProperties; +var ir = Object.getOwnPropertyDescriptors; +var _t = Object.getOwnPropertySymbols; +var or = Object.prototype.hasOwnProperty, ur = Object.prototype.propertyIsEnumerable; +var Y = Math.pow, Rt = (f, l, x) => l in f ? er(f, l, { enumerable: !0, configurable: !0, writable: !0, value: x }) : f[l] = x, Ot = (f, l) => { + for (var x in l || (l = {})) + or.call(l, x) && Rt(f, x, l[x]); + if (_t) + for (var x of _t(l)) + ur.call(l, x) && Rt(f, x, l[x]); + return f; +}, Lt = (f, l) => nr(f, ir(l)); +var Nt = (f, l, x) => new Promise((d, A) => { + var p = (u) => { + try { + a(x.next(u)); + } catch (B) { + A(B); + } + }, h = (u) => { + try { + a(x.throw(u)); + } catch (B) { + A(B); + } + }, a = (u) => u.done ? d(u.value) : Promise.resolve(u.value).then(p, h); + a((x = x.apply(f, l)).next()); +}); +var Z = {}, Bt = {}; +Bt.byteLength = fr; +Bt.toByteArray = hr; +Bt.fromByteArray = dr; +var st = [], et = [], sr = typeof Uint8Array != "undefined" ? Uint8Array : Array, $t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +for (var dt = 0, ar = $t.length; dt < ar; ++dt) + st[dt] = $t[dt], et[$t.charCodeAt(dt)] = dt; +et[45] = 62; +et[95] = 63; +function zt(f) { + var l = f.length; + if (l % 4 > 0) + throw new Error("Invalid string. Length must be a multiple of 4"); + var x = f.indexOf("="); + x === -1 && (x = l); + var d = x === l ? 0 : 4 - x % 4; + return [x, d]; +} +function fr(f) { + var l = zt(f), x = l[0], d = l[1]; + return (x + d) * 3 / 4 - d; +} +function cr(f, l, x) { + return (l + x) * 3 / 4 - x; +} +function hr(f) { + var l, x = zt(f), d = x[0], A = x[1], p = new sr(cr(f, d, A)), h = 0, a = A > 0 ? d - 4 : d, u; + for (u = 0; u < a; u += 4) + l = et[f.charCodeAt(u)] << 18 | et[f.charCodeAt(u + 1)] << 12 | et[f.charCodeAt(u + 2)] << 6 | et[f.charCodeAt(u + 3)], p[h++] = l >> 16 & 255, p[h++] = l >> 8 & 255, p[h++] = l & 255; + return A === 2 && (l = et[f.charCodeAt(u)] << 2 | et[f.charCodeAt(u + 1)] >> 4, p[h++] = l & 255), A === 1 && (l = et[f.charCodeAt(u)] << 10 | et[f.charCodeAt(u + 1)] << 4 | et[f.charCodeAt(u + 2)] >> 2, p[h++] = l >> 8 & 255, p[h++] = l & 255), p; +} +function lr(f) { + return st[f >> 18 & 63] + st[f >> 12 & 63] + st[f >> 6 & 63] + st[f & 63]; +} +function pr(f, l, x) { + for (var d, A = [], p = l; p < x; p += 3) + d = (f[p] << 16 & 16711680) + (f[p + 1] << 8 & 65280) + (f[p + 2] & 255), A.push(lr(d)); + return A.join(""); +} +function dr(f) { + for (var l, x = f.length, d = x % 3, A = [], p = 16383, h = 0, a = x - d; h < a; h += p) + A.push(pr(f, h, h + p > a ? a : h + p)); + return d === 1 ? (l = f[x - 1], A.push( + st[l >> 2] + st[l << 4 & 63] + "==" + )) : d === 2 && (l = (f[x - 2] << 8) + f[x - 1], A.push( + st[l >> 10] + st[l >> 4 & 63] + st[l << 2 & 63] + "=" + )), A.join(""); +} +var Tt = {}; +Tt.read = function(f, l, x, d, A) { + var p, h, a = A * 8 - d - 1, u = (1 << a) - 1, B = u >> 1, i = -7, F = x ? A - 1 : 0, M = x ? -1 : 1, k = f[l + F]; + for (F += M, p = k & (1 << -i) - 1, k >>= -i, i += a; i > 0; p = p * 256 + f[l + F], F += M, i -= 8) + ; + for (h = p & (1 << -i) - 1, p >>= -i, i += d; i > 0; h = h * 256 + f[l + F], F += M, i -= 8) + ; + if (p === 0) + p = 1 - B; + else { + if (p === u) + return h ? NaN : (k ? -1 : 1) * (1 / 0); + h = h + Math.pow(2, d), p = p - B; + } + return (k ? -1 : 1) * h * Math.pow(2, p - d); +}; +Tt.write = function(f, l, x, d, A, p) { + var h, a, u, B = p * 8 - A - 1, i = (1 << B) - 1, F = i >> 1, M = A === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, k = d ? 0 : p - 1, b = d ? 1 : -1, m = l < 0 || l === 0 && 1 / l < 0 ? 1 : 0; + for (l = Math.abs(l), isNaN(l) || l === 1 / 0 ? (a = isNaN(l) ? 1 : 0, h = i) : (h = Math.floor(Math.log(l) / Math.LN2), l * (u = Math.pow(2, -h)) < 1 && (h--, u *= 2), h + F >= 1 ? l += M / u : l += M * Math.pow(2, 1 - F), l * u >= 2 && (h++, u /= 2), h + F >= i ? (a = 0, h = i) : h + F >= 1 ? (a = (l * u - 1) * Math.pow(2, A), h = h + F) : (a = l * Math.pow(2, F - 1) * Math.pow(2, A), h = 0)); A >= 8; f[x + k] = a & 255, k += b, a /= 256, A -= 8) + ; + for (h = h << A | a, B += A; B > 0; f[x + k] = h & 255, k += b, h /= 256, B -= 8) + ; + f[x + k - b] |= m * 128; +}; +(function(f) { + const l = Bt, x = Tt, d = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null; + f.Buffer = i, f.SlowBuffer = N, f.INSPECT_MAX_BYTES = 50; + const A = 2147483647; + f.kMaxLength = A; + const { Uint8Array: p, ArrayBuffer: h, SharedArrayBuffer: a } = globalThis; + i.TYPED_ARRAY_SUPPORT = u(), !i.TYPED_ARRAY_SUPPORT && typeof console != "undefined" && typeof console.error == "function" && console.error( + "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support." + ); + function u() { + try { + const e = new p(1), t = { foo: function() { + return 42; + } }; + return Object.setPrototypeOf(t, p.prototype), Object.setPrototypeOf(e, t), e.foo() === 42; + } catch (e) { + return !1; + } + } + Object.defineProperty(i.prototype, "parent", { + enumerable: !0, + get: function() { + if (i.isBuffer(this)) + return this.buffer; + } + }), Object.defineProperty(i.prototype, "offset", { + enumerable: !0, + get: function() { + if (i.isBuffer(this)) + return this.byteOffset; + } + }); + function B(e) { + if (e > A) + throw new RangeError('The value "' + e + '" is invalid for option "size"'); + const t = new p(e); + return Object.setPrototypeOf(t, i.prototype), t; + } + function i(e, t, r) { + if (typeof e == "number") { + if (typeof t == "string") + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ); + return b(e); + } + return F(e, t, r); + } + i.poolSize = 8192; + function F(e, t, r) { + if (typeof e == "string") + return m(e, t); + if (h.isView(e)) + return y(e); + if (e == null) + throw new TypeError( + "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e + ); + if (ut(e, h) || e && ut(e.buffer, h) || typeof a != "undefined" && (ut(e, a) || e && ut(e.buffer, a))) + return U(e, t, r); + if (typeof e == "number") + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ); + const n = e.valueOf && e.valueOf(); + if (n != null && n !== e) + return i.from(n, t, r); + const o = w(e); + if (o) return o; + if (typeof Symbol != "undefined" && Symbol.toPrimitive != null && typeof e[Symbol.toPrimitive] == "function") + return i.from(e[Symbol.toPrimitive]("string"), t, r); + throw new TypeError( + "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e + ); + } + i.from = function(e, t, r) { + return F(e, t, r); + }, Object.setPrototypeOf(i.prototype, p.prototype), Object.setPrototypeOf(i, p); + function M(e) { + if (typeof e != "number") + throw new TypeError('"size" argument must be of type number'); + if (e < 0) + throw new RangeError('The value "' + e + '" is invalid for option "size"'); + } + function k(e, t, r) { + return M(e), e <= 0 ? B(e) : t !== void 0 ? typeof r == "string" ? B(e).fill(t, r) : B(e).fill(t) : B(e); + } + i.alloc = function(e, t, r) { + return k(e, t, r); + }; + function b(e) { + return M(e), B(e < 0 ? 0 : O(e) | 0); + } + i.allocUnsafe = function(e) { + return b(e); + }, i.allocUnsafeSlow = function(e) { + return b(e); + }; + function m(e, t) { + if ((typeof t != "string" || t === "") && (t = "utf8"), !i.isEncoding(t)) + throw new TypeError("Unknown encoding: " + t); + const r = j(e, t) | 0; + let n = B(r); + const o = n.write(e, t); + return o !== r && (n = n.slice(0, o)), n; + } + function g(e) { + const t = e.length < 0 ? 0 : O(e.length) | 0, r = B(t); + for (let n = 0; n < t; n += 1) + r[n] = e[n] & 255; + return r; + } + function y(e) { + if (ut(e, p)) { + const t = new p(e); + return U(t.buffer, t.byteOffset, t.byteLength); + } + return g(e); + } + function U(e, t, r) { + if (t < 0 || e.byteLength < t) + throw new RangeError('"offset" is outside of buffer bounds'); + if (e.byteLength < t + (r || 0)) + throw new RangeError('"length" is outside of buffer bounds'); + let n; + return t === void 0 && r === void 0 ? n = new p(e) : r === void 0 ? n = new p(e, t) : n = new p(e, t, r), Object.setPrototypeOf(n, i.prototype), n; + } + function w(e) { + if (i.isBuffer(e)) { + const t = O(e.length) | 0, r = B(t); + return r.length === 0 || e.copy(r, 0, 0, t), r; + } + if (e.length !== void 0) + return typeof e.length != "number" || It(e.length) ? B(0) : g(e); + if (e.type === "Buffer" && Array.isArray(e.data)) + return g(e.data); + } + function O(e) { + if (e >= A) + throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + A.toString(16) + " bytes"); + return e | 0; + } + function N(e) { + return +e != e && (e = 0), i.alloc(+e); + } + i.isBuffer = function(t) { + return t != null && t._isBuffer === !0 && t !== i.prototype; + }, i.compare = function(t, r) { + if (ut(t, p) && (t = i.from(t, t.offset, t.byteLength)), ut(r, p) && (r = i.from(r, r.offset, r.byteLength)), !i.isBuffer(t) || !i.isBuffer(r)) + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ); + if (t === r) return 0; + let n = t.length, o = r.length; + for (let s = 0, c = Math.min(n, o); s < c; ++s) + if (t[s] !== r[s]) { + n = t[s], o = r[s]; + break; + } + return n < o ? -1 : o < n ? 1 : 0; + }, i.isEncoding = function(t) { + switch (String(t).toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "latin1": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return !0; + default: + return !1; + } + }, i.concat = function(t, r) { + if (!Array.isArray(t)) + throw new TypeError('"list" argument must be an Array of Buffers'); + if (t.length === 0) + return i.alloc(0); + let n; + if (r === void 0) + for (r = 0, n = 0; n < t.length; ++n) + r += t[n].length; + const o = i.allocUnsafe(r); + let s = 0; + for (n = 0; n < t.length; ++n) { + let c = t[n]; + if (ut(c, p)) + s + c.length > o.length ? (i.isBuffer(c) || (c = i.from(c)), c.copy(o, s)) : p.prototype.set.call( + o, + c, + s + ); + else if (i.isBuffer(c)) + c.copy(o, s); + else + throw new TypeError('"list" argument must be an Array of Buffers'); + s += c.length; + } + return o; + }; + function j(e, t) { + if (i.isBuffer(e)) + return e.length; + if (h.isView(e) || ut(e, h)) + return e.byteLength; + if (typeof e != "string") + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e + ); + const r = e.length, n = arguments.length > 2 && arguments[2] === !0; + if (!n && r === 0) return 0; + let o = !1; + for (; ; ) + switch (t) { + case "ascii": + case "latin1": + case "binary": + return r; + case "utf8": + case "utf-8": + return Et(e).length; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return r * 2; + case "hex": + return r >>> 1; + case "base64": + return Ct(e).length; + default: + if (o) + return n ? -1 : Et(e).length; + t = ("" + t).toLowerCase(), o = !0; + } + } + i.byteLength = j; + function nt(e, t, r) { + let n = !1; + if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, t >>>= 0, r <= t)) + return ""; + for (e || (e = "utf8"); ; ) + switch (e) { + case "hex": + return W(this, t, r); + case "utf8": + case "utf-8": + return S(this, t, r); + case "ascii": + return C(this, t, r); + case "latin1": + case "binary": + return P(this, t, r); + case "base64": + return E(this, t, r); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return J(this, t, r); + default: + if (n) throw new TypeError("Unknown encoding: " + e); + e = (e + "").toLowerCase(), n = !0; + } + } + i.prototype._isBuffer = !0; + function Q(e, t, r) { + const n = e[t]; + e[t] = e[r], e[r] = n; + } + i.prototype.swap16 = function() { + const t = this.length; + if (t % 2 !== 0) + throw new RangeError("Buffer size must be a multiple of 16-bits"); + for (let r = 0; r < t; r += 2) + Q(this, r, r + 1); + return this; + }, i.prototype.swap32 = function() { + const t = this.length; + if (t % 4 !== 0) + throw new RangeError("Buffer size must be a multiple of 32-bits"); + for (let r = 0; r < t; r += 4) + Q(this, r, r + 3), Q(this, r + 1, r + 2); + return this; + }, i.prototype.swap64 = function() { + const t = this.length; + if (t % 8 !== 0) + throw new RangeError("Buffer size must be a multiple of 64-bits"); + for (let r = 0; r < t; r += 8) + Q(this, r, r + 7), Q(this, r + 1, r + 6), Q(this, r + 2, r + 5), Q(this, r + 3, r + 4); + return this; + }, i.prototype.toString = function() { + const t = this.length; + return t === 0 ? "" : arguments.length === 0 ? S(this, 0, t) : nt.apply(this, arguments); + }, i.prototype.toLocaleString = i.prototype.toString, i.prototype.equals = function(t) { + if (!i.isBuffer(t)) throw new TypeError("Argument must be a Buffer"); + return this === t ? !0 : i.compare(this, t) === 0; + }, i.prototype.inspect = function() { + let t = ""; + const r = f.INSPECT_MAX_BYTES; + return t = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (t += " ... "), ""; + }, d && (i.prototype[d] = i.prototype.inspect), i.prototype.compare = function(t, r, n, o, s) { + if (ut(t, p) && (t = i.from(t, t.offset, t.byteLength)), !i.isBuffer(t)) + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t + ); + if (r === void 0 && (r = 0), n === void 0 && (n = t ? t.length : 0), o === void 0 && (o = 0), s === void 0 && (s = this.length), r < 0 || n > t.length || o < 0 || s > this.length) + throw new RangeError("out of range index"); + if (o >= s && r >= n) + return 0; + if (o >= s) + return -1; + if (r >= n) + return 1; + if (r >>>= 0, n >>>= 0, o >>>= 0, s >>>= 0, this === t) return 0; + let c = s - o, R = n - r; + const z = Math.min(c, R), G = this.slice(o, s), V = t.slice(r, n); + for (let H = 0; H < z; ++H) + if (G[H] !== V[H]) { + c = G[H], R = V[H]; + break; + } + return c < R ? -1 : R < c ? 1 : 0; + }; + function rt(e, t, r, n, o) { + if (e.length === 0) return -1; + if (typeof r == "string" ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, It(r) && (r = o ? 0 : e.length - 1), r < 0 && (r = e.length + r), r >= e.length) { + if (o) return -1; + r = e.length - 1; + } else if (r < 0) + if (o) r = 0; + else return -1; + if (typeof t == "string" && (t = i.from(t, n)), i.isBuffer(t)) + return t.length === 0 ? -1 : q(e, t, r, n, o); + if (typeof t == "number") + return t = t & 255, typeof p.prototype.indexOf == "function" ? o ? p.prototype.indexOf.call(e, t, r) : p.prototype.lastIndexOf.call(e, t, r) : q(e, [t], r, n, o); + throw new TypeError("val must be string, number or Buffer"); + } + function q(e, t, r, n, o) { + let s = 1, c = e.length, R = t.length; + if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) { + if (e.length < 2 || t.length < 2) + return -1; + s = 2, c /= 2, R /= 2, r /= 2; + } + function z(V, H) { + return s === 1 ? V[H] : V.readUInt16BE(H * s); + } + let G; + if (o) { + let V = -1; + for (G = r; G < c; G++) + if (z(e, G) === z(t, V === -1 ? 0 : G - V)) { + if (V === -1 && (V = G), G - V + 1 === R) return V * s; + } else + V !== -1 && (G -= G - V), V = -1; + } else + for (r + R > c && (r = c - R), G = r; G >= 0; G--) { + let V = !0; + for (let H = 0; H < R; H++) + if (z(e, G + H) !== z(t, H)) { + V = !1; + break; + } + if (V) return G; + } + return -1; + } + i.prototype.includes = function(t, r, n) { + return this.indexOf(t, r, n) !== -1; + }, i.prototype.indexOf = function(t, r, n) { + return rt(this, t, r, n, !0); + }, i.prototype.lastIndexOf = function(t, r, n) { + return rt(this, t, r, n, !1); + }; + function _(e, t, r, n) { + r = Number(r) || 0; + const o = e.length - r; + n ? (n = Number(n), n > o && (n = o)) : n = o; + const s = t.length; + n > s / 2 && (n = s / 2); + let c; + for (c = 0; c < n; ++c) { + const R = parseInt(t.substr(c * 2, 2), 16); + if (It(R)) return c; + e[r + c] = R; + } + return c; + } + function X(e, t, r, n) { + return bt(Et(t, e.length - r), e, r, n); + } + function mt(e, t, r, n) { + return bt(Kt(t), e, r, n); + } + function T(e, t, r, n) { + return bt(Ct(t), e, r, n); + } + function $(e, t, r, n) { + return bt(Qt(t, e.length - r), e, r, n); + } + i.prototype.write = function(t, r, n, o) { + if (r === void 0) + o = "utf8", n = this.length, r = 0; + else if (n === void 0 && typeof r == "string") + o = r, n = this.length, r = 0; + else if (isFinite(r)) + r = r >>> 0, isFinite(n) ? (n = n >>> 0, o === void 0 && (o = "utf8")) : (o = n, n = void 0); + else + throw new Error( + "Buffer.write(string, encoding, offset[, length]) is no longer supported" + ); + const s = this.length - r; + if ((n === void 0 || n > s) && (n = s), t.length > 0 && (n < 0 || r < 0) || r > this.length) + throw new RangeError("Attempt to write outside buffer bounds"); + o || (o = "utf8"); + let c = !1; + for (; ; ) + switch (o) { + case "hex": + return _(this, t, r, n); + case "utf8": + case "utf-8": + return X(this, t, r, n); + case "ascii": + case "latin1": + case "binary": + return mt(this, t, r, n); + case "base64": + return T(this, t, r, n); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return $(this, t, r, n); + default: + if (c) throw new TypeError("Unknown encoding: " + o); + o = ("" + o).toLowerCase(), c = !0; + } + }, i.prototype.toJSON = function() { + return { + type: "Buffer", + data: Array.prototype.slice.call(this._arr || this, 0) + }; + }; + function E(e, t, r) { + return t === 0 && r === e.length ? l.fromByteArray(e) : l.fromByteArray(e.slice(t, r)); + } + function S(e, t, r) { + r = Math.min(e.length, r); + const n = []; + let o = t; + for (; o < r; ) { + const s = e[o]; + let c = null, R = s > 239 ? 4 : s > 223 ? 3 : s > 191 ? 2 : 1; + if (o + R <= r) { + let z, G, V, H; + switch (R) { + case 1: + s < 128 && (c = s); + break; + case 2: + z = e[o + 1], (z & 192) === 128 && (H = (s & 31) << 6 | z & 63, H > 127 && (c = H)); + break; + case 3: + z = e[o + 1], G = e[o + 2], (z & 192) === 128 && (G & 192) === 128 && (H = (s & 15) << 12 | (z & 63) << 6 | G & 63, H > 2047 && (H < 55296 || H > 57343) && (c = H)); + break; + case 4: + z = e[o + 1], G = e[o + 2], V = e[o + 3], (z & 192) === 128 && (G & 192) === 128 && (V & 192) === 128 && (H = (s & 15) << 18 | (z & 63) << 12 | (G & 63) << 6 | V & 63, H > 65535 && H < 1114112 && (c = H)); + } + } + c === null ? (c = 65533, R = 1) : c > 65535 && (c -= 65536, n.push(c >>> 10 & 1023 | 55296), c = 56320 | c & 1023), n.push(c), o += R; + } + return D(n); + } + const I = 4096; + function D(e) { + const t = e.length; + if (t <= I) + return String.fromCharCode.apply(String, e); + let r = "", n = 0; + for (; n < t; ) + r += String.fromCharCode.apply( + String, + e.slice(n, n += I) + ); + return r; + } + function C(e, t, r) { + let n = ""; + r = Math.min(e.length, r); + for (let o = t; o < r; ++o) + n += String.fromCharCode(e[o] & 127); + return n; + } + function P(e, t, r) { + let n = ""; + r = Math.min(e.length, r); + for (let o = t; o < r; ++o) + n += String.fromCharCode(e[o]); + return n; + } + function W(e, t, r) { + const n = e.length; + (!t || t < 0) && (t = 0), (!r || r < 0 || r > n) && (r = n); + let o = ""; + for (let s = t; s < r; ++s) + o += tr[e[s]]; + return o; + } + function J(e, t, r) { + const n = e.slice(t, r); + let o = ""; + for (let s = 0; s < n.length - 1; s += 2) + o += String.fromCharCode(n[s] + n[s + 1] * 256); + return o; + } + i.prototype.slice = function(t, r) { + const n = this.length; + t = ~~t, r = r === void 0 ? n : ~~r, t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), r < 0 ? (r += n, r < 0 && (r = 0)) : r > n && (r = n), r < t && (r = t); + const o = this.subarray(t, r); + return Object.setPrototypeOf(o, i.prototype), o; + }; + function L(e, t, r) { + if (e % 1 !== 0 || e < 0) throw new RangeError("offset is not uint"); + if (e + t > r) throw new RangeError("Trying to access beyond buffer length"); + } + i.prototype.readUintLE = i.prototype.readUIntLE = function(t, r, n) { + t = t >>> 0, r = r >>> 0, n || L(t, r, this.length); + let o = this[t], s = 1, c = 0; + for (; ++c < r && (s *= 256); ) + o += this[t + c] * s; + return o; + }, i.prototype.readUintBE = i.prototype.readUIntBE = function(t, r, n) { + t = t >>> 0, r = r >>> 0, n || L(t, r, this.length); + let o = this[t + --r], s = 1; + for (; r > 0 && (s *= 256); ) + o += this[t + --r] * s; + return o; + }, i.prototype.readUint8 = i.prototype.readUInt8 = function(t, r) { + return t = t >>> 0, r || L(t, 1, this.length), this[t]; + }, i.prototype.readUint16LE = i.prototype.readUInt16LE = function(t, r) { + return t = t >>> 0, r || L(t, 2, this.length), this[t] | this[t + 1] << 8; + }, i.prototype.readUint16BE = i.prototype.readUInt16BE = function(t, r) { + return t = t >>> 0, r || L(t, 2, this.length), this[t] << 8 | this[t + 1]; + }, i.prototype.readUint32LE = i.prototype.readUInt32LE = function(t, r) { + return t = t >>> 0, r || L(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216; + }, i.prototype.readUint32BE = i.prototype.readUInt32BE = function(t, r) { + return t = t >>> 0, r || L(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]); + }, i.prototype.readBigUInt64LE = ht(function(t) { + t = t >>> 0, pt(t, "offset"); + const r = this[t], n = this[t + 7]; + (r === void 0 || n === void 0) && yt(t, this.length - 8); + const o = r + this[++t] * Y(2, 8) + this[++t] * Y(2, 16) + this[++t] * Y(2, 24), s = this[++t] + this[++t] * Y(2, 8) + this[++t] * Y(2, 16) + n * Y(2, 24); + return BigInt(o) + (BigInt(s) << BigInt(32)); + }), i.prototype.readBigUInt64BE = ht(function(t) { + t = t >>> 0, pt(t, "offset"); + const r = this[t], n = this[t + 7]; + (r === void 0 || n === void 0) && yt(t, this.length - 8); + const o = r * Y(2, 24) + this[++t] * Y(2, 16) + this[++t] * Y(2, 8) + this[++t], s = this[++t] * Y(2, 24) + this[++t] * Y(2, 16) + this[++t] * Y(2, 8) + n; + return (BigInt(o) << BigInt(32)) + BigInt(s); + }), i.prototype.readIntLE = function(t, r, n) { + t = t >>> 0, r = r >>> 0, n || L(t, r, this.length); + let o = this[t], s = 1, c = 0; + for (; ++c < r && (s *= 256); ) + o += this[t + c] * s; + return s *= 128, o >= s && (o -= Math.pow(2, 8 * r)), o; + }, i.prototype.readIntBE = function(t, r, n) { + t = t >>> 0, r = r >>> 0, n || L(t, r, this.length); + let o = r, s = 1, c = this[t + --o]; + for (; o > 0 && (s *= 256); ) + c += this[t + --o] * s; + return s *= 128, c >= s && (c -= Math.pow(2, 8 * r)), c; + }, i.prototype.readInt8 = function(t, r) { + return t = t >>> 0, r || L(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t]; + }, i.prototype.readInt16LE = function(t, r) { + t = t >>> 0, r || L(t, 2, this.length); + const n = this[t] | this[t + 1] << 8; + return n & 32768 ? n | 4294901760 : n; + }, i.prototype.readInt16BE = function(t, r) { + t = t >>> 0, r || L(t, 2, this.length); + const n = this[t + 1] | this[t] << 8; + return n & 32768 ? n | 4294901760 : n; + }, i.prototype.readInt32LE = function(t, r) { + return t = t >>> 0, r || L(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24; + }, i.prototype.readInt32BE = function(t, r) { + return t = t >>> 0, r || L(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]; + }, i.prototype.readBigInt64LE = ht(function(t) { + t = t >>> 0, pt(t, "offset"); + const r = this[t], n = this[t + 7]; + (r === void 0 || n === void 0) && yt(t, this.length - 8); + const o = this[t + 4] + this[t + 5] * Y(2, 8) + this[t + 6] * Y(2, 16) + (n << 24); + return (BigInt(o) << BigInt(32)) + BigInt(r + this[++t] * Y(2, 8) + this[++t] * Y(2, 16) + this[++t] * Y(2, 24)); + }), i.prototype.readBigInt64BE = ht(function(t) { + t = t >>> 0, pt(t, "offset"); + const r = this[t], n = this[t + 7]; + (r === void 0 || n === void 0) && yt(t, this.length - 8); + const o = (r << 24) + // Overflow + this[++t] * Y(2, 16) + this[++t] * Y(2, 8) + this[++t]; + return (BigInt(o) << BigInt(32)) + BigInt(this[++t] * Y(2, 24) + this[++t] * Y(2, 16) + this[++t] * Y(2, 8) + n); + }), i.prototype.readFloatLE = function(t, r) { + return t = t >>> 0, r || L(t, 4, this.length), x.read(this, t, !0, 23, 4); + }, i.prototype.readFloatBE = function(t, r) { + return t = t >>> 0, r || L(t, 4, this.length), x.read(this, t, !1, 23, 4); + }, i.prototype.readDoubleLE = function(t, r) { + return t = t >>> 0, r || L(t, 8, this.length), x.read(this, t, !0, 52, 8); + }, i.prototype.readDoubleBE = function(t, r) { + return t = t >>> 0, r || L(t, 8, this.length), x.read(this, t, !1, 52, 8); + }; + function v(e, t, r, n, o, s) { + if (!i.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance'); + if (t > o || t < s) throw new RangeError('"value" argument is out of bounds'); + if (r + n > e.length) throw new RangeError("Index out of range"); + } + i.prototype.writeUintLE = i.prototype.writeUIntLE = function(t, r, n, o) { + if (t = +t, r = r >>> 0, n = n >>> 0, !o) { + const R = Math.pow(2, 8 * n) - 1; + v(this, t, r, n, R, 0); + } + let s = 1, c = 0; + for (this[r] = t & 255; ++c < n && (s *= 256); ) + this[r + c] = t / s & 255; + return r + n; + }, i.prototype.writeUintBE = i.prototype.writeUIntBE = function(t, r, n, o) { + if (t = +t, r = r >>> 0, n = n >>> 0, !o) { + const R = Math.pow(2, 8 * n) - 1; + v(this, t, r, n, R, 0); + } + let s = n - 1, c = 1; + for (this[r + s] = t & 255; --s >= 0 && (c *= 256); ) + this[r + s] = t / c & 255; + return r + n; + }, i.prototype.writeUint8 = i.prototype.writeUInt8 = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 1, 255, 0), this[r] = t & 255, r + 1; + }, i.prototype.writeUint16LE = i.prototype.writeUInt16LE = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 2, 65535, 0), this[r] = t & 255, this[r + 1] = t >>> 8, r + 2; + }, i.prototype.writeUint16BE = i.prototype.writeUInt16BE = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 2, 65535, 0), this[r] = t >>> 8, this[r + 1] = t & 255, r + 2; + }, i.prototype.writeUint32LE = i.prototype.writeUInt32LE = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 4, 4294967295, 0), this[r + 3] = t >>> 24, this[r + 2] = t >>> 16, this[r + 1] = t >>> 8, this[r] = t & 255, r + 4; + }, i.prototype.writeUint32BE = i.prototype.writeUInt32BE = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 4, 4294967295, 0), this[r] = t >>> 24, this[r + 1] = t >>> 16, this[r + 2] = t >>> 8, this[r + 3] = t & 255, r + 4; + }; + function at(e, t, r, n, o) { + Dt(t, n, o, e, r, 7); + let s = Number(t & BigInt(4294967295)); + e[r++] = s, s = s >> 8, e[r++] = s, s = s >> 8, e[r++] = s, s = s >> 8, e[r++] = s; + let c = Number(t >> BigInt(32) & BigInt(4294967295)); + return e[r++] = c, c = c >> 8, e[r++] = c, c = c >> 8, e[r++] = c, c = c >> 8, e[r++] = c, r; + } + function it(e, t, r, n, o) { + Dt(t, n, o, e, r, 7); + let s = Number(t & BigInt(4294967295)); + e[r + 7] = s, s = s >> 8, e[r + 6] = s, s = s >> 8, e[r + 5] = s, s = s >> 8, e[r + 4] = s; + let c = Number(t >> BigInt(32) & BigInt(4294967295)); + return e[r + 3] = c, c = c >> 8, e[r + 2] = c, c = c >> 8, e[r + 1] = c, c = c >> 8, e[r] = c, r + 8; + } + i.prototype.writeBigUInt64LE = ht(function(t, r = 0) { + return at(this, t, r, BigInt(0), BigInt("0xffffffffffffffff")); + }), i.prototype.writeBigUInt64BE = ht(function(t, r = 0) { + return it(this, t, r, BigInt(0), BigInt("0xffffffffffffffff")); + }), i.prototype.writeIntLE = function(t, r, n, o) { + if (t = +t, r = r >>> 0, !o) { + const z = Math.pow(2, 8 * n - 1); + v(this, t, r, n, z - 1, -z); + } + let s = 0, c = 1, R = 0; + for (this[r] = t & 255; ++s < n && (c *= 256); ) + t < 0 && R === 0 && this[r + s - 1] !== 0 && (R = 1), this[r + s] = (t / c >> 0) - R & 255; + return r + n; + }, i.prototype.writeIntBE = function(t, r, n, o) { + if (t = +t, r = r >>> 0, !o) { + const z = Math.pow(2, 8 * n - 1); + v(this, t, r, n, z - 1, -z); + } + let s = n - 1, c = 1, R = 0; + for (this[r + s] = t & 255; --s >= 0 && (c *= 256); ) + t < 0 && R === 0 && this[r + s + 1] !== 0 && (R = 1), this[r + s] = (t / c >> 0) - R & 255; + return r + n; + }, i.prototype.writeInt8 = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[r] = t & 255, r + 1; + }, i.prototype.writeInt16LE = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 2, 32767, -32768), this[r] = t & 255, this[r + 1] = t >>> 8, r + 2; + }, i.prototype.writeInt16BE = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 2, 32767, -32768), this[r] = t >>> 8, this[r + 1] = t & 255, r + 2; + }, i.prototype.writeInt32LE = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 4, 2147483647, -2147483648), this[r] = t & 255, this[r + 1] = t >>> 8, this[r + 2] = t >>> 16, this[r + 3] = t >>> 24, r + 4; + }, i.prototype.writeInt32BE = function(t, r, n) { + return t = +t, r = r >>> 0, n || v(this, t, r, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[r] = t >>> 24, this[r + 1] = t >>> 16, this[r + 2] = t >>> 8, this[r + 3] = t & 255, r + 4; + }, i.prototype.writeBigInt64LE = ht(function(t, r = 0) { + return at(this, t, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); + }), i.prototype.writeBigInt64BE = ht(function(t, r = 0) { + return it(this, t, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); + }); + function ct(e, t, r, n, o, s) { + if (r + n > e.length) throw new RangeError("Index out of range"); + if (r < 0) throw new RangeError("Index out of range"); + } + function ot(e, t, r, n, o) { + return t = +t, r = r >>> 0, o || ct(e, t, r, 4), x.write(e, t, r, n, 23, 4), r + 4; + } + i.prototype.writeFloatLE = function(t, r, n) { + return ot(this, t, r, !0, n); + }, i.prototype.writeFloatBE = function(t, r, n) { + return ot(this, t, r, !1, n); + }; + function K(e, t, r, n, o) { + return t = +t, r = r >>> 0, o || ct(e, t, r, 8), x.write(e, t, r, n, 52, 8), r + 8; + } + i.prototype.writeDoubleLE = function(t, r, n) { + return K(this, t, r, !0, n); + }, i.prototype.writeDoubleBE = function(t, r, n) { + return K(this, t, r, !1, n); + }, i.prototype.copy = function(t, r, n, o) { + if (!i.isBuffer(t)) throw new TypeError("argument should be a Buffer"); + if (n || (n = 0), !o && o !== 0 && (o = this.length), r >= t.length && (r = t.length), r || (r = 0), o > 0 && o < n && (o = n), o === n || t.length === 0 || this.length === 0) return 0; + if (r < 0) + throw new RangeError("targetStart out of bounds"); + if (n < 0 || n >= this.length) throw new RangeError("Index out of range"); + if (o < 0) throw new RangeError("sourceEnd out of bounds"); + o > this.length && (o = this.length), t.length - r < o - n && (o = t.length - r + n); + const s = o - n; + return this === t && typeof p.prototype.copyWithin == "function" ? this.copyWithin(r, n, o) : p.prototype.set.call( + t, + this.subarray(n, o), + r + ), s; + }, i.prototype.fill = function(t, r, n, o) { + if (typeof t == "string") { + if (typeof r == "string" ? (o = r, r = 0, n = this.length) : typeof n == "string" && (o = n, n = this.length), o !== void 0 && typeof o != "string") + throw new TypeError("encoding must be a string"); + if (typeof o == "string" && !i.isEncoding(o)) + throw new TypeError("Unknown encoding: " + o); + if (t.length === 1) { + const c = t.charCodeAt(0); + (o === "utf8" && c < 128 || o === "latin1") && (t = c); + } + } else typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t)); + if (r < 0 || this.length < r || this.length < n) + throw new RangeError("Out of range index"); + if (n <= r) + return this; + r = r >>> 0, n = n === void 0 ? this.length : n >>> 0, t || (t = 0); + let s; + if (typeof t == "number") + for (s = r; s < n; ++s) + this[s] = t; + else { + const c = i.isBuffer(t) ? t : i.from(t, o), R = c.length; + if (R === 0) + throw new TypeError('The value "' + t + '" is invalid for argument "value"'); + for (s = 0; s < n - r; ++s) + this[s + r] = c[s % R]; + } + return this; + }; + const tt = {}; + function ft(e, t, r) { + tt[e] = class extends r { + constructor() { + super(), Object.defineProperty(this, "message", { + value: t.apply(this, arguments), + writable: !0, + configurable: !0 + }), this.name = `${this.name} [${e}]`, this.stack, delete this.name; + } + get code() { + return e; + } + set code(o) { + Object.defineProperty(this, "code", { + configurable: !0, + enumerable: !0, + value: o, + writable: !0 + }); + } + toString() { + return `${this.name} [${e}]: ${this.message}`; + } + }; + } + ft( + "ERR_BUFFER_OUT_OF_BOUNDS", + function(e) { + return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds"; + }, + RangeError + ), ft( + "ERR_INVALID_ARG_TYPE", + function(e, t) { + return `The "${e}" argument must be of type number. Received type ${typeof t}`; + }, + TypeError + ), ft( + "ERR_OUT_OF_RANGE", + function(e, t, r) { + let n = `The value of "${e}" is out of range.`, o = r; + return Number.isInteger(r) && Math.abs(r) > Y(2, 32) ? o = lt(String(r)) : typeof r == "bigint" && (o = String(r), (r > Y(BigInt(2), BigInt(32)) || r < -Y(BigInt(2), BigInt(32))) && (o = lt(o)), o += "n"), n += ` It must be ${t}. Received ${o}`, n; + }, + RangeError + ); + function lt(e) { + let t = "", r = e.length; + const n = e[0] === "-" ? 1 : 0; + for (; r >= n + 4; r -= 3) + t = `_${e.slice(r - 3, r)}${t}`; + return `${e.slice(0, r)}${t}`; + } + function Jt(e, t, r) { + pt(t, "offset"), (e[t] === void 0 || e[t + r] === void 0) && yt(t, e.length - (r + 1)); + } + function Dt(e, t, r, n, o, s) { + if (e > r || e < t) { + const c = typeof t == "bigint" ? "n" : ""; + let R; + throw s > 3 ? t === 0 || t === BigInt(0) ? R = `>= 0${c} and < 2${c} ** ${(s + 1) * 8}${c}` : R = `>= -(2${c} ** ${(s + 1) * 8 - 1}${c}) and < 2 ** ${(s + 1) * 8 - 1}${c}` : R = `>= ${t}${c} and <= ${r}${c}`, new tt.ERR_OUT_OF_RANGE("value", R, e); + } + Jt(n, o, s); + } + function pt(e, t) { + if (typeof e != "number") + throw new tt.ERR_INVALID_ARG_TYPE(t, "number", e); + } + function yt(e, t, r) { + throw Math.floor(e) !== e ? (pt(e, r), new tt.ERR_OUT_OF_RANGE(r || "offset", "an integer", e)) : t < 0 ? new tt.ERR_BUFFER_OUT_OF_BOUNDS() : new tt.ERR_OUT_OF_RANGE( + r || "offset", + `>= ${r ? 1 : 0} and <= ${t}`, + e + ); + } + const Zt = /[^+/0-9A-Za-z-_]/g; + function Xt(e) { + if (e = e.split("=")[0], e = e.trim().replace(Zt, ""), e.length < 2) return ""; + for (; e.length % 4 !== 0; ) + e = e + "="; + return e; + } + function Et(e, t) { + t = t || 1 / 0; + let r; + const n = e.length; + let o = null; + const s = []; + for (let c = 0; c < n; ++c) { + if (r = e.charCodeAt(c), r > 55295 && r < 57344) { + if (!o) { + if (r > 56319) { + (t -= 3) > -1 && s.push(239, 191, 189); + continue; + } else if (c + 1 === n) { + (t -= 3) > -1 && s.push(239, 191, 189); + continue; + } + o = r; + continue; + } + if (r < 56320) { + (t -= 3) > -1 && s.push(239, 191, 189), o = r; + continue; + } + r = (o - 55296 << 10 | r - 56320) + 65536; + } else o && (t -= 3) > -1 && s.push(239, 191, 189); + if (o = null, r < 128) { + if ((t -= 1) < 0) break; + s.push(r); + } else if (r < 2048) { + if ((t -= 2) < 0) break; + s.push( + r >> 6 | 192, + r & 63 | 128 + ); + } else if (r < 65536) { + if ((t -= 3) < 0) break; + s.push( + r >> 12 | 224, + r >> 6 & 63 | 128, + r & 63 | 128 + ); + } else if (r < 1114112) { + if ((t -= 4) < 0) break; + s.push( + r >> 18 | 240, + r >> 12 & 63 | 128, + r >> 6 & 63 | 128, + r & 63 | 128 + ); + } else + throw new Error("Invalid code point"); + } + return s; + } + function Kt(e) { + const t = []; + for (let r = 0; r < e.length; ++r) + t.push(e.charCodeAt(r) & 255); + return t; + } + function Qt(e, t) { + let r, n, o; + const s = []; + for (let c = 0; c < e.length && !((t -= 2) < 0); ++c) + r = e.charCodeAt(c), n = r >> 8, o = r % 256, s.push(o), s.push(n); + return s; + } + function Ct(e) { + return l.toByteArray(Xt(e)); + } + function bt(e, t, r, n) { + let o; + for (o = 0; o < n && !(o + r >= t.length || o >= e.length); ++o) + t[o + r] = e[o]; + return o; + } + function ut(e, t) { + return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name; + } + function It(e) { + return e !== e; + } + const tr = (function() { + const e = "0123456789abcdef", t = new Array(256); + for (let r = 0; r < 16; ++r) { + const n = r * 16; + for (let o = 0; o < 16; ++o) + t[n + o] = e[r] + e[o]; + } + return t; + })(); + function ht(e) { + return typeof BigInt == "undefined" ? rr : e; + } + function rr() { + throw new Error("BigInt not supported"); + } +})(Z); +const jt = Z.Buffer, Nr = Z.Blob, jr = Z.BlobOptions, yr = Z.Buffer, Pr = Z.File, vr = Z.FileOptions, Hr = Z.INSPECT_MAX_BYTES, Yr = Z.SlowBuffer, Gr = Z.TranscodeEncoding, qr = Z.atob, Wr = Z.btoa, zr = Z.constants, Vr = Z.isAscii, Jr = Z.isUtf8, Zr = Z.kMaxLength, Xr = Z.kStringMaxLength, Kr = Z.resolveObjectURL, Qr = Z.transcode; +function Mt(f) { + return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f; +} +var Ft, Pt; +function Vt() { + if (Pt) return Ft; + Pt = 1; + const f = "Input must be an string, Buffer or Uint8Array"; + function l(h) { + let a; + if (h instanceof Uint8Array) + a = h; + else if (h instanceof jt) + a = new Uint8Array(h); + else if (typeof h == "string") + a = new Uint8Array(jt.from(h, "utf8")); + else + throw new Error(f); + return a; + } + function x(h) { + return Array.prototype.map.call(h, function(a) { + return (a < 16 ? "0" : "") + a.toString(16); + }).join(""); + } + function d(h) { + return (4294967296 + h).toString(16).substring(1); + } + function A(h, a, u) { + let B = ` +` + h + " = "; + for (let i = 0; i < a.length; i += 2) { + if (u === 32) + B += d(a[i]).toUpperCase(), B += " ", B += d(a[i + 1]).toUpperCase(); + else if (u === 64) + B += d(a[i + 1]).toUpperCase(), B += d(a[i]).toUpperCase(); + else throw new Error("Invalid size " + u); + i % 6 === 4 ? B += ` +` + new Array(h.length + 4).join(" ") : i < a.length - 2 && (B += " "); + } + console.log(B); + } + function p(h, a, u) { + let B = (/* @__PURE__ */ new Date()).getTime(); + const i = new Uint8Array(a); + for (let M = 0; M < a; M++) + i[M] = M % 256; + const F = (/* @__PURE__ */ new Date()).getTime(); + console.log("Generated random input in " + (F - B) + "ms"), B = F; + for (let M = 0; M < u; M++) { + const k = h(i), b = (/* @__PURE__ */ new Date()).getTime(), m = b - B; + B = b, console.log("Hashed in " + m + "ms: " + k.substring(0, 20) + "..."), console.log( + Math.round(a / (1 << 20) / (m / 1e3) * 100) / 100 + " MB PER SECOND" + ); + } + } + return Ft = { + normalizeInput: l, + toHex: x, + debugPrint: A, + testSpeed: p + }, Ft; +} +var Ut, vt; +function wr() { + if (vt) return Ut; + vt = 1; + const f = Vt(); + function l(y, U, w) { + const O = y[U] + y[w]; + let N = y[U + 1] + y[w + 1]; + O >= 4294967296 && N++, y[U] = O, y[U + 1] = N; + } + function x(y, U, w, O) { + let N = y[U] + w; + w < 0 && (N += 4294967296); + let j = y[U + 1] + O; + N >= 4294967296 && j++, y[U] = N, y[U + 1] = j; + } + function d(y, U) { + return y[U] ^ y[U + 1] << 8 ^ y[U + 2] << 16 ^ y[U + 3] << 24; + } + function A(y, U, w, O, N, j) { + const nt = B[N], Q = B[N + 1], rt = B[j], q = B[j + 1]; + l(u, y, U), x(u, y, nt, Q); + let _ = u[O] ^ u[y], X = u[O + 1] ^ u[y + 1]; + u[O] = X, u[O + 1] = _, l(u, w, O), _ = u[U] ^ u[w], X = u[U + 1] ^ u[w + 1], u[U] = _ >>> 24 ^ X << 8, u[U + 1] = X >>> 24 ^ _ << 8, l(u, y, U), x(u, y, rt, q), _ = u[O] ^ u[y], X = u[O + 1] ^ u[y + 1], u[O] = _ >>> 16 ^ X << 16, u[O + 1] = X >>> 16 ^ _ << 16, l(u, w, O), _ = u[U] ^ u[w], X = u[U + 1] ^ u[w + 1], u[U] = X >>> 31 ^ _ << 1, u[U + 1] = _ >>> 31 ^ X << 1; + } + const p = new Uint32Array([ + 4089235720, + 1779033703, + 2227873595, + 3144134277, + 4271175723, + 1013904242, + 1595750129, + 2773480762, + 2917565137, + 1359893119, + 725511199, + 2600822924, + 4215389547, + 528734635, + 327033209, + 1541459225 + ]), h = [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 14, + 10, + 4, + 8, + 9, + 15, + 13, + 6, + 1, + 12, + 0, + 2, + 11, + 7, + 5, + 3, + 11, + 8, + 12, + 0, + 5, + 2, + 15, + 13, + 10, + 14, + 3, + 6, + 7, + 1, + 9, + 4, + 7, + 9, + 3, + 1, + 13, + 12, + 11, + 14, + 2, + 6, + 5, + 10, + 4, + 0, + 15, + 8, + 9, + 0, + 5, + 7, + 2, + 4, + 10, + 15, + 14, + 1, + 11, + 12, + 6, + 8, + 3, + 13, + 2, + 12, + 6, + 10, + 0, + 11, + 8, + 3, + 4, + 13, + 7, + 5, + 15, + 14, + 1, + 9, + 12, + 5, + 1, + 15, + 14, + 13, + 4, + 10, + 0, + 7, + 6, + 3, + 9, + 2, + 8, + 11, + 13, + 11, + 7, + 14, + 12, + 1, + 3, + 9, + 5, + 0, + 15, + 4, + 8, + 6, + 2, + 10, + 6, + 15, + 14, + 9, + 11, + 3, + 0, + 8, + 12, + 2, + 13, + 7, + 1, + 4, + 10, + 5, + 10, + 2, + 8, + 4, + 7, + 6, + 1, + 5, + 15, + 11, + 9, + 14, + 3, + 12, + 13, + 0, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 14, + 10, + 4, + 8, + 9, + 15, + 13, + 6, + 1, + 12, + 0, + 2, + 11, + 7, + 5, + 3 + ], a = new Uint8Array( + h.map(function(y) { + return y * 2; + }) + ), u = new Uint32Array(32), B = new Uint32Array(32); + function i(y, U) { + let w = 0; + for (w = 0; w < 16; w++) + u[w] = y.h[w], u[w + 16] = p[w]; + for (u[24] = u[24] ^ y.t, u[25] = u[25] ^ y.t / 4294967296, U && (u[28] = ~u[28], u[29] = ~u[29]), w = 0; w < 32; w++) + B[w] = d(y.b, 4 * w); + for (w = 0; w < 12; w++) + A(0, 8, 16, 24, a[w * 16 + 0], a[w * 16 + 1]), A(2, 10, 18, 26, a[w * 16 + 2], a[w * 16 + 3]), A(4, 12, 20, 28, a[w * 16 + 4], a[w * 16 + 5]), A(6, 14, 22, 30, a[w * 16 + 6], a[w * 16 + 7]), A(0, 10, 20, 30, a[w * 16 + 8], a[w * 16 + 9]), A(2, 12, 22, 24, a[w * 16 + 10], a[w * 16 + 11]), A(4, 14, 16, 26, a[w * 16 + 12], a[w * 16 + 13]), A(6, 8, 18, 28, a[w * 16 + 14], a[w * 16 + 15]); + for (w = 0; w < 16; w++) + y.h[w] = y.h[w] ^ u[w] ^ u[w + 16]; + } + var F = new Uint8Array([ + 0, + 0, + 0, + 0, + // 0: outlen, keylen, fanout, depth + 0, + 0, + 0, + 0, + // 4: leaf length, sequential mode + 0, + 0, + 0, + 0, + // 8: node offset + 0, + 0, + 0, + 0, + // 12: node offset + 0, + 0, + 0, + 0, + // 16: node depth, inner length, rfu + 0, + 0, + 0, + 0, + // 20: rfu + 0, + 0, + 0, + 0, + // 24: rfu + 0, + 0, + 0, + 0, + // 28: rfu + 0, + 0, + 0, + 0, + // 32: salt + 0, + 0, + 0, + 0, + // 36: salt + 0, + 0, + 0, + 0, + // 40: salt + 0, + 0, + 0, + 0, + // 44: salt + 0, + 0, + 0, + 0, + // 48: personal + 0, + 0, + 0, + 0, + // 52: personal + 0, + 0, + 0, + 0, + // 56: personal + 0, + 0, + 0, + 0 + // 60: personal + ]); + function M(y, U, w, O) { + if (y === 0 || y > 64) + throw new Error("Illegal output length, expected 0 < length <= 64"); + if (U && U.length > 64) + throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64"); + if (w && w.length !== 16) + throw new Error("Illegal salt, expected Uint8Array with length is 16"); + if (O && O.length !== 16) + throw new Error("Illegal personal, expected Uint8Array with length is 16"); + const N = { + b: new Uint8Array(128), + h: new Uint32Array(16), + t: 0, + // input count + c: 0, + // pointer within buffer + outlen: y + // output length in bytes + }; + F.fill(0), F[0] = y, U && (F[1] = U.length), F[2] = 1, F[3] = 1, w && F.set(w, 32), O && F.set(O, 48); + for (let j = 0; j < 16; j++) + N.h[j] = p[j] ^ d(F, j * 4); + return U && (k(N, U), N.c = 128), N; + } + function k(y, U) { + for (let w = 0; w < U.length; w++) + y.c === 128 && (y.t += y.c, i(y, !1), y.c = 0), y.b[y.c++] = U[w]; + } + function b(y) { + for (y.t += y.c; y.c < 128; ) + y.b[y.c++] = 0; + i(y, !0); + const U = new Uint8Array(y.outlen); + for (let w = 0; w < y.outlen; w++) + U[w] = y.h[w >> 2] >> 8 * (w & 3); + return U; + } + function m(y, U, w, O, N) { + w = w || 64, y = f.normalizeInput(y), O && (O = f.normalizeInput(O)), N && (N = f.normalizeInput(N)); + const j = M(w, U, O, N); + return k(j, y), b(j); + } + function g(y, U, w, O, N) { + const j = m(y, U, w, O, N); + return f.toHex(j); + } + return Ut = { + blake2b: m, + blake2bHex: g, + blake2bInit: M, + blake2bUpdate: k, + blake2bFinal: b + }, Ut; +} +var At, Ht; +function gr() { + if (Ht) return At; + Ht = 1; + const f = Vt(); + function l(b, m) { + return b[m] ^ b[m + 1] << 8 ^ b[m + 2] << 16 ^ b[m + 3] << 24; + } + function x(b, m, g, y, U, w) { + h[b] = h[b] + h[m] + U, h[y] = d(h[y] ^ h[b], 16), h[g] = h[g] + h[y], h[m] = d(h[m] ^ h[g], 12), h[b] = h[b] + h[m] + w, h[y] = d(h[y] ^ h[b], 8), h[g] = h[g] + h[y], h[m] = d(h[m] ^ h[g], 7); + } + function d(b, m) { + return b >>> m ^ b << 32 - m; + } + const A = new Uint32Array([ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 + ]), p = new Uint8Array([ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 14, + 10, + 4, + 8, + 9, + 15, + 13, + 6, + 1, + 12, + 0, + 2, + 11, + 7, + 5, + 3, + 11, + 8, + 12, + 0, + 5, + 2, + 15, + 13, + 10, + 14, + 3, + 6, + 7, + 1, + 9, + 4, + 7, + 9, + 3, + 1, + 13, + 12, + 11, + 14, + 2, + 6, + 5, + 10, + 4, + 0, + 15, + 8, + 9, + 0, + 5, + 7, + 2, + 4, + 10, + 15, + 14, + 1, + 11, + 12, + 6, + 8, + 3, + 13, + 2, + 12, + 6, + 10, + 0, + 11, + 8, + 3, + 4, + 13, + 7, + 5, + 15, + 14, + 1, + 9, + 12, + 5, + 1, + 15, + 14, + 13, + 4, + 10, + 0, + 7, + 6, + 3, + 9, + 2, + 8, + 11, + 13, + 11, + 7, + 14, + 12, + 1, + 3, + 9, + 5, + 0, + 15, + 4, + 8, + 6, + 2, + 10, + 6, + 15, + 14, + 9, + 11, + 3, + 0, + 8, + 12, + 2, + 13, + 7, + 1, + 4, + 10, + 5, + 10, + 2, + 8, + 4, + 7, + 6, + 1, + 5, + 15, + 11, + 9, + 14, + 3, + 12, + 13, + 0 + ]), h = new Uint32Array(16), a = new Uint32Array(16); + function u(b, m) { + let g = 0; + for (g = 0; g < 8; g++) + h[g] = b.h[g], h[g + 8] = A[g]; + for (h[12] ^= b.t, h[13] ^= b.t / 4294967296, m && (h[14] = ~h[14]), g = 0; g < 16; g++) + a[g] = l(b.b, 4 * g); + for (g = 0; g < 10; g++) + x(0, 4, 8, 12, a[p[g * 16 + 0]], a[p[g * 16 + 1]]), x(1, 5, 9, 13, a[p[g * 16 + 2]], a[p[g * 16 + 3]]), x(2, 6, 10, 14, a[p[g * 16 + 4]], a[p[g * 16 + 5]]), x(3, 7, 11, 15, a[p[g * 16 + 6]], a[p[g * 16 + 7]]), x(0, 5, 10, 15, a[p[g * 16 + 8]], a[p[g * 16 + 9]]), x(1, 6, 11, 12, a[p[g * 16 + 10]], a[p[g * 16 + 11]]), x(2, 7, 8, 13, a[p[g * 16 + 12]], a[p[g * 16 + 13]]), x(3, 4, 9, 14, a[p[g * 16 + 14]], a[p[g * 16 + 15]]); + for (g = 0; g < 8; g++) + b.h[g] ^= h[g] ^ h[g + 8]; + } + function B(b, m) { + if (!(b > 0 && b <= 32)) + throw new Error("Incorrect output length, should be in [1, 32]"); + const g = m ? m.length : 0; + if (m && !(g > 0 && g <= 32)) + throw new Error("Incorrect key length, should be in [1, 32]"); + const y = { + h: new Uint32Array(A), + // hash state + b: new Uint8Array(64), + // input block + c: 0, + // pointer within block + t: 0, + // input count + outlen: b + // output length in bytes + }; + return y.h[0] ^= 16842752 ^ g << 8 ^ b, g > 0 && (i(y, m), y.c = 64), y; + } + function i(b, m) { + for (let g = 0; g < m.length; g++) + b.c === 64 && (b.t += b.c, u(b, !1), b.c = 0), b.b[b.c++] = m[g]; + } + function F(b) { + for (b.t += b.c; b.c < 64; ) + b.b[b.c++] = 0; + u(b, !0); + const m = new Uint8Array(b.outlen); + for (let g = 0; g < b.outlen; g++) + m[g] = b.h[g >> 2] >> 8 * (g & 3) & 255; + return m; + } + function M(b, m, g) { + g = g || 32, b = f.normalizeInput(b); + const y = B(g, m); + return i(y, b), F(y); + } + function k(b, m, g) { + const y = M(b, m, g); + return f.toHex(y); + } + return At = { + blake2s: M, + blake2sHex: k, + blake2sInit: B, + blake2sUpdate: i, + blake2sFinal: F + }, At; +} +var St, Yt; +function xr() { + if (Yt) return St; + Yt = 1; + const f = wr(), l = gr(); + return St = { + blake2b: f.blake2b, + blake2bHex: f.blake2bHex, + blake2bInit: f.blake2bInit, + blake2bUpdate: f.blake2bUpdate, + blake2bFinal: f.blake2bFinal, + blake2s: l.blake2s, + blake2sHex: l.blake2sHex, + blake2sInit: l.blake2sInit, + blake2sUpdate: l.blake2sUpdate, + blake2sFinal: l.blake2sFinal + }, St; +} +var mr = xr(); +var kt = {}, Gt; +function br() { + return Gt || (Gt = 1, (function(f) { + "use strict"; + var l = function(a, u) { + return u || (u = {}), a.split("").forEach(function(B, i) { + B in u || (u[B] = i); + }), u; + }, x = { + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", + charmap: { + 0: 14, + 1: 8 + } + }; + x.charmap = l(x.alphabet, x.charmap); + var d = { + alphabet: "0123456789ABCDEFGHJKMNPQRSTVWXYZ", + charmap: { + O: 0, + I: 1, + L: 1 + } + }; + d.charmap = l(d.alphabet, d.charmap); + var A = { + alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV", + charmap: {} + }; + A.charmap = l(A.alphabet, A.charmap); + function p(a) { + if (this.buf = [], this.shift = 8, this.carry = 0, a) { + switch (a.type) { + case "rfc4648": + this.charmap = f.rfc4648.charmap; + break; + case "crockford": + this.charmap = f.crockford.charmap; + break; + case "base32hex": + this.charmap = f.base32hex.charmap; + break; + default: + throw new Error("invalid type"); + } + a.charmap && (this.charmap = a.charmap); + } + } + p.prototype.charmap = x.charmap, p.prototype.write = function(a) { + var u = this.charmap, B = this.buf, i = this.shift, F = this.carry; + return a.toUpperCase().split("").forEach(function(M) { + if (M != "=") { + var k = u[M] & 255; + i -= 5, i > 0 ? F |= k << i : i < 0 ? (B.push(F | k >> -i), i += 8, F = k << i & 255) : (B.push(F | k), i = 8, F = 0); + } + }), this.shift = i, this.carry = F, this; + }, p.prototype.finalize = function(a) { + return a && this.write(a), this.shift !== 8 && this.carry !== 0 && (this.buf.push(this.carry), this.shift = 8, this.carry = 0), this.buf; + }; + function h(a) { + if (this.buf = "", this.shift = 3, this.carry = 0, a) { + switch (a.type) { + case "rfc4648": + this.alphabet = f.rfc4648.alphabet; + break; + case "crockford": + this.alphabet = f.crockford.alphabet; + break; + case "base32hex": + this.alphabet = f.base32hex.alphabet; + break; + default: + throw new Error("invalid type"); + } + a.alphabet ? this.alphabet = a.alphabet : a.lc && (this.alphabet = this.alphabet.toLowerCase()); + } + } + h.prototype.alphabet = x.alphabet, h.prototype.write = function(a) { + var u = this.shift, B = this.carry, i, F, M; + for (M = 0; M < a.length; M++) + F = a[M], i = B | F >> u, this.buf += this.alphabet[i & 31], u > 5 && (u -= 5, i = F >> u, this.buf += this.alphabet[i & 31]), u = 5 - u, B = F << u, u = 8 - u; + return this.shift = u, this.carry = B, this; + }, h.prototype.finalize = function(a) { + return a && this.write(a), this.shift !== 3 && (this.buf += this.alphabet[this.carry & 31], this.shift = 3, this.carry = 0), this.buf; + }, f.encode = function(a, u) { + return new h(u).finalize(a); + }, f.decode = function(a, u) { + return new p(u).finalize(a); + }, f.Decoder = p, f.Encoder = h, f.charmap = l, f.crockford = d, f.rfc4648 = x, f.base32hex = A; + })(kt)), kt; +} +var Br = br(); +const Er = /* @__PURE__ */ Mt(Br), Ir = (f) => new Er.Encoder({ type: "rfc4648" }).write(f).finalize(), $r = (f) => Array.isArray(f) && f.length ? f[0] : f; +globalThis.Buffer = yr; +const Fr = /^(\d{4})-(\d{2})-(\d{2})([tT ])(\d{2}):(\d{2}):(\d{2})\.?(\d{3})?(?:(?:([+-]\d{2}):?(\d{2}))|Z)?$/, Ur = (f) => { + const l = (p = 0) => `${+p < 10 ? 0 : ""}${+p}`, x = (p = 0) => `${+p < 1e3 ? 0 : ""}${+p < 100 ? 0 : ""}${+p < 10 ? 0 : ""}${+p}`; + let d = Fr.exec(f); + d && (d == null ? void 0 : d[9]) === void 0 && (d[9] = "+00"), d && (d == null ? void 0 : d[10]) === void 0 && (d[10] = "00"); + const A = `${d == null ? void 0 : d[9]}:${d == null ? void 0 : d[10]}`.replace(/[+-]?00:00$/, "Z"); + return [ + x(d == null ? void 0 : d[1]), + "-", + l(d == null ? void 0 : d[2]), + "-", + l(d == null ? void 0 : d[3]), + d == null ? void 0 : d[4], + l(d == null ? void 0 : d[5]), + ":", + l(d == null ? void 0 : d[6]), + ":", + l(d == null ? void 0 : d[7]), + //ignore milliseconds (m[8]) + A + ].join(""); +}; +function Ar(f) { + const l = Ur(f.created), x = [f.url, l, f.content].join(` +`); + return Ir(mr.blake2b(x, void 0, 32)).toLowerCase().slice(-7); +} +var wt = { exports: {} }, Sr = wt.exports, qt; +function kr() { + return qt || (qt = 1, (function(f, l) { + (function(x, d) { + f.exports = d(); + })(Sr, (function() { + "use strict"; + var x = 1e3, d = 6e4, A = 36e5, p = "millisecond", h = "second", a = "minute", u = "hour", B = "day", i = "week", F = "month", M = "quarter", k = "year", b = "date", m = "Invalid Date", g = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, U = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(T) { + var $ = ["th", "st", "nd", "rd"], E = T % 100; + return "[" + T + ($[(E - 20) % 10] || $[E] || $[0]) + "]"; + } }, w = function(T, $, E) { + var S = String(T); + return !S || S.length >= $ ? T : "" + Array($ + 1 - S.length).join(E) + T; + }, O = { s: w, z: function(T) { + var $ = -T.utcOffset(), E = Math.abs($), S = Math.floor(E / 60), I = E % 60; + return ($ <= 0 ? "+" : "-") + w(S, 2, "0") + ":" + w(I, 2, "0"); + }, m: function T($, E) { + if ($.date() < E.date()) return -T(E, $); + var S = 12 * (E.year() - $.year()) + (E.month() - $.month()), I = $.clone().add(S, F), D = E - I < 0, C = $.clone().add(S + (D ? -1 : 1), F); + return +(-(S + (E - I) / (D ? I - C : C - I)) || 0); + }, a: function(T) { + return T < 0 ? Math.ceil(T) || 0 : Math.floor(T); + }, p: function(T) { + return { M: F, y: k, w: i, d: B, D: b, h: u, m: a, s: h, ms: p, Q: M }[T] || String(T || "").toLowerCase().replace(/s$/, ""); + }, u: function(T) { + return T === void 0; + } }, N = "en", j = {}; + j[N] = U; + var nt = "$isDayjsObject", Q = function(T) { + return T instanceof X || !(!T || !T[nt]); + }, rt = function T($, E, S) { + var I; + if (!$) return N; + if (typeof $ == "string") { + var D = $.toLowerCase(); + j[D] && (I = D), E && (j[D] = E, I = D); + var C = $.split("-"); + if (!I && C.length > 1) return T(C[0]); + } else { + var P = $.name; + j[P] = $, I = P; + } + return !S && I && (N = I), I || !S && N; + }, q = function(T, $) { + if (Q(T)) return T.clone(); + var E = typeof $ == "object" ? $ : {}; + return E.date = T, E.args = arguments, new X(E); + }, _ = O; + _.l = rt, _.i = Q, _.w = function(T, $) { + return q(T, { locale: $.$L, utc: $.$u, x: $.$x, $offset: $.$offset }); + }; + var X = (function() { + function T(E) { + this.$L = rt(E.locale, null, !0), this.parse(E), this.$x = this.$x || E.x || {}, this[nt] = !0; + } + var $ = T.prototype; + return $.parse = function(E) { + this.$d = (function(S) { + var I = S.date, D = S.utc; + if (I === null) return /* @__PURE__ */ new Date(NaN); + if (_.u(I)) return /* @__PURE__ */ new Date(); + if (I instanceof Date) return new Date(I); + if (typeof I == "string" && !/Z$/i.test(I)) { + var C = I.match(g); + if (C) { + var P = C[2] - 1 || 0, W = (C[7] || "0").substring(0, 3); + return D ? new Date(Date.UTC(C[1], P, C[3] || 1, C[4] || 0, C[5] || 0, C[6] || 0, W)) : new Date(C[1], P, C[3] || 1, C[4] || 0, C[5] || 0, C[6] || 0, W); + } + } + return new Date(I); + })(E), this.init(); + }, $.init = function() { + var E = this.$d; + this.$y = E.getFullYear(), this.$M = E.getMonth(), this.$D = E.getDate(), this.$W = E.getDay(), this.$H = E.getHours(), this.$m = E.getMinutes(), this.$s = E.getSeconds(), this.$ms = E.getMilliseconds(); + }, $.$utils = function() { + return _; + }, $.isValid = function() { + return this.$d.toString() !== m; + }, $.isSame = function(E, S) { + var I = q(E); + return this.startOf(S) <= I && I <= this.endOf(S); + }, $.isAfter = function(E, S) { + return q(E) < this.startOf(S); + }, $.isBefore = function(E, S) { + return this.endOf(S) < q(E); + }, $.$g = function(E, S, I) { + return _.u(E) ? this[S] : this.set(I, E); + }, $.unix = function() { + return Math.floor(this.valueOf() / 1e3); + }, $.valueOf = function() { + return this.$d.getTime(); + }, $.startOf = function(E, S) { + var I = this, D = !!_.u(S) || S, C = _.p(E), P = function(ot, K) { + var tt = _.w(I.$u ? Date.UTC(I.$y, K, ot) : new Date(I.$y, K, ot), I); + return D ? tt : tt.endOf(B); + }, W = function(ot, K) { + return _.w(I.toDate()[ot].apply(I.toDate("s"), (D ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(K)), I); + }, J = this.$W, L = this.$M, v = this.$D, at = "set" + (this.$u ? "UTC" : ""); + switch (C) { + case k: + return D ? P(1, 0) : P(31, 11); + case F: + return D ? P(1, L) : P(0, L + 1); + case i: + var it = this.$locale().weekStart || 0, ct = (J < it ? J + 7 : J) - it; + return P(D ? v - ct : v + (6 - ct), L); + case B: + case b: + return W(at + "Hours", 0); + case u: + return W(at + "Minutes", 1); + case a: + return W(at + "Seconds", 2); + case h: + return W(at + "Milliseconds", 3); + default: + return this.clone(); + } + }, $.endOf = function(E) { + return this.startOf(E, !1); + }, $.$set = function(E, S) { + var I, D = _.p(E), C = "set" + (this.$u ? "UTC" : ""), P = (I = {}, I[B] = C + "Date", I[b] = C + "Date", I[F] = C + "Month", I[k] = C + "FullYear", I[u] = C + "Hours", I[a] = C + "Minutes", I[h] = C + "Seconds", I[p] = C + "Milliseconds", I)[D], W = D === B ? this.$D + (S - this.$W) : S; + if (D === F || D === k) { + var J = this.clone().set(b, 1); + J.$d[P](W), J.init(), this.$d = J.set(b, Math.min(this.$D, J.daysInMonth())).$d; + } else P && this.$d[P](W); + return this.init(), this; + }, $.set = function(E, S) { + return this.clone().$set(E, S); + }, $.get = function(E) { + return this[_.p(E)](); + }, $.add = function(E, S) { + var I, D = this; + E = Number(E); + var C = _.p(S), P = function(L) { + var v = q(D); + return _.w(v.date(v.date() + Math.round(L * E)), D); + }; + if (C === F) return this.set(F, this.$M + E); + if (C === k) return this.set(k, this.$y + E); + if (C === B) return P(1); + if (C === i) return P(7); + var W = (I = {}, I[a] = d, I[u] = A, I[h] = x, I)[C] || 1, J = this.$d.getTime() + E * W; + return _.w(J, this); + }, $.subtract = function(E, S) { + return this.add(-1 * E, S); + }, $.format = function(E) { + var S = this, I = this.$locale(); + if (!this.isValid()) return I.invalidDate || m; + var D = E || "YYYY-MM-DDTHH:mm:ssZ", C = _.z(this), P = this.$H, W = this.$m, J = this.$M, L = I.weekdays, v = I.months, at = I.meridiem, it = function(K, tt, ft, lt) { + return K && (K[tt] || K(S, D)) || ft[tt].slice(0, lt); + }, ct = function(K) { + return _.s(P % 12 || 12, K, "0"); + }, ot = at || function(K, tt, ft) { + var lt = K < 12 ? "AM" : "PM"; + return ft ? lt.toLowerCase() : lt; + }; + return D.replace(y, (function(K, tt) { + return tt || (function(ft) { + switch (ft) { + case "YY": + return String(S.$y).slice(-2); + case "YYYY": + return _.s(S.$y, 4, "0"); + case "M": + return J + 1; + case "MM": + return _.s(J + 1, 2, "0"); + case "MMM": + return it(I.monthsShort, J, v, 3); + case "MMMM": + return it(v, J); + case "D": + return S.$D; + case "DD": + return _.s(S.$D, 2, "0"); + case "d": + return String(S.$W); + case "dd": + return it(I.weekdaysMin, S.$W, L, 2); + case "ddd": + return it(I.weekdaysShort, S.$W, L, 3); + case "dddd": + return L[S.$W]; + case "H": + return String(P); + case "HH": + return _.s(P, 2, "0"); + case "h": + return ct(1); + case "hh": + return ct(2); + case "a": + return ot(P, W, !0); + case "A": + return ot(P, W, !1); + case "m": + return String(W); + case "mm": + return _.s(W, 2, "0"); + case "s": + return String(S.$s); + case "ss": + return _.s(S.$s, 2, "0"); + case "SSS": + return _.s(S.$ms, 3, "0"); + case "Z": + return C; + } + return null; + })(K) || C.replace(":", ""); + })); + }, $.utcOffset = function() { + return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); + }, $.diff = function(E, S, I) { + var D, C = this, P = _.p(S), W = q(E), J = (W.utcOffset() - this.utcOffset()) * d, L = this - W, v = function() { + return _.m(C, W); + }; + switch (P) { + case k: + D = v() / 12; + break; + case F: + D = v(); + break; + case M: + D = v() / 3; + break; + case i: + D = (L - J) / 6048e5; + break; + case B: + D = (L - J) / 864e5; + break; + case u: + D = L / A; + break; + case a: + D = L / d; + break; + case h: + D = L / x; + break; + default: + D = L; + } + return I ? D : _.a(D); + }, $.daysInMonth = function() { + return this.endOf(F).$D; + }, $.$locale = function() { + return j[this.$L]; + }, $.locale = function(E, S) { + if (!E) return this.$L; + var I = this.clone(), D = rt(E, S, !0); + return D && (I.$L = D), I; + }, $.clone = function() { + return _.w(this.$d, this); + }, $.toDate = function() { + return new Date(this.valueOf()); + }, $.toJSON = function() { + return this.isValid() ? this.toISOString() : null; + }, $.toISOString = function() { + return this.$d.toISOString(); + }, $.toString = function() { + return this.$d.toUTCString(); + }, T; + })(), mt = X.prototype; + return q.prototype = mt, [["$ms", p], ["$s", h], ["$m", a], ["$H", u], ["$W", B], ["$M", F], ["$y", k], ["$D", b]].forEach((function(T) { + mt[T[1]] = function($) { + return this.$g($, T[0], T[1]); + }; + })), q.extend = function(T, $) { + return T.$i || (T($, X, q), T.$i = !0), q; + }, q.locale = rt, q.isDayjs = Q, q.unix = function(T) { + return q(1e3 * T); + }, q.en = j[N], q.Ls = j, q.p = {}, q; + })); + })(wt, wt.exports)), wt.exports; +} +var Tr = kr(); +const xt = /* @__PURE__ */ Mt(Tr); +var gt = { exports: {} }, Mr = gt.exports, Wt; +function Dr() { + return Wt || (Wt = 1, (function(f, l) { + (function(x, d) { + f.exports = d(); + })(Mr, (function() { + "use strict"; + var x = "minute", d = /[+-]\d\d(?::?\d\d)?/g, A = /([+-]|\d\d)/g; + return function(p, h, a) { + var u = h.prototype; + a.utc = function(m) { + var g = { date: m, utc: !0, args: arguments }; + return new h(g); + }, u.utc = function(m) { + var g = a(this.toDate(), { locale: this.$L, utc: !0 }); + return m ? g.add(this.utcOffset(), x) : g; + }, u.local = function() { + return a(this.toDate(), { locale: this.$L, utc: !1 }); + }; + var B = u.parse; + u.parse = function(m) { + m.utc && (this.$u = !0), this.$utils().u(m.$offset) || (this.$offset = m.$offset), B.call(this, m); + }; + var i = u.init; + u.init = function() { + if (this.$u) { + var m = this.$d; + this.$y = m.getUTCFullYear(), this.$M = m.getUTCMonth(), this.$D = m.getUTCDate(), this.$W = m.getUTCDay(), this.$H = m.getUTCHours(), this.$m = m.getUTCMinutes(), this.$s = m.getUTCSeconds(), this.$ms = m.getUTCMilliseconds(); + } else i.call(this); + }; + var F = u.utcOffset; + u.utcOffset = function(m, g) { + var y = this.$utils().u; + if (y(m)) return this.$u ? 0 : y(this.$offset) ? F.call(this) : this.$offset; + if (typeof m == "string" && (m = (function(N) { + N === void 0 && (N = ""); + var j = N.match(d); + if (!j) return null; + var nt = ("" + j[0]).match(A) || ["-", 0, 0], Q = nt[0], rt = 60 * +nt[1] + +nt[2]; + return rt === 0 ? 0 : Q === "+" ? rt : -rt; + })(m), m === null)) return this; + var U = Math.abs(m) <= 16 ? 60 * m : m; + if (U === 0) return this.utc(g); + var w = this.clone(); + if (g) return w.$offset = U, w.$u = !1, w; + var O = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset(); + return (w = this.local().add(U + O, x)).$offset = U, w.$x.$localOffset = O, w; + }; + var M = u.format; + u.format = function(m) { + var g = m || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : ""); + return M.call(this, g); + }, u.valueOf = function() { + var m = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset()); + return this.$d.valueOf() - 6e4 * m; + }, u.isUTC = function() { + return !!this.$u; + }, u.toISOString = function() { + return this.toDate().toISOString(); + }, u.toString = function() { + return this.toDate().toUTCString(); + }; + var k = u.toDate; + u.toDate = function(m) { + return m === "s" && this.$offset ? a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : k.call(this); + }; + var b = u.diff; + u.diff = function(m, g, y) { + if (m && this.$u === m.$u) return b.call(this, m, g, y); + var U = this.local(), w = a(m).local(); + return b.call(U, w, g, y); + }; + }; + })); + })(gt, gt.exports)), gt.exports; +} +var Cr = Dr(); +const _r = /* @__PURE__ */ Mt(Cr); +xt.extend(_r); +function Rr(f) { + const l = f.split(` +`), { commentLines: x = [], contentLines: d = [] } = l.reduce( + (u, B) => { + const i = B.trim(); + return i === "" || (i.startsWith("#") ? u.commentLines.push(i) : u.contentLines.push(i)), u; + }, + { + commentLines: [], + contentLines: [] + } + ), { following: A = [], metadata: p = {} } = x.filter((u) => u.includes("=")).reduce( + (u, B) => { + const [i, ...F] = B.substring(1).split("=").map((k) => k.trim()), M = F.join("="); + if (i === "follow") { + const [k, b] = M.trim().split(/\s+/); + u.following.push({ nick: k, url: b }); + } else + u.metadata[i] ? Array.isArray(u.metadata[i]) ? u.metadata[i].push(M) : u.metadata[i] = [u.metadata[i], M] : u.metadata[i] = M; + return u; + }, + { + following: [], + metadata: {} + } + ), h = /\(#([\w]+)\) (\<\@(\S+) ([^>]+)>)*/, a = d.map((u) => { + var U; + const [B, i] = u.split(/\t/).map((w) => w.trim()); + if (typeof i == "undefined") + throw new Error(`Content is undefined: ${u}`); + const F = xt.utc(B); + if (!F.isValid()) + throw new Error(`Date is invalid: ${u}`); + const M = F.toISOString(), k = h.exec(i); + let b, m, g; + k != null && k.length && (b = k == null ? void 0 : k[1], m = k == null ? void 0 : k[3], g = k == null ? void 0 : k[4]); + const y = Ar({ + content: i, + created: B, + createdUTC: M, + url: $r((U = p == null ? void 0 : p.url) != null ? U : "") + }); + return { + content: i, + created: B, + createdUTC: M, + hash: y, + replyHash: b, + replyNick: m, + replyUrl: g + }; + }).sort((u, B) => xt(u.created).diff(xt(B.created))); + return { + following: A, + metadata: p, + twts: a + }; +} +function te(f = "") { + return Nt(this, null, function* () { + if (!f) throw new Error("URL is required"); + try { + const l = yield fetch(f), x = yield l.text(), d = xt( + l.headers.get("Last-Modified") + ).toISOString(); + return Lt(Ot({}, Rr(x)), { + lastModified: d + }); + } catch (l) { + throw console.error(l), l; + } + }); +} +export { + Ir as base32Encode, + Ar as hashTwt, + te as loadAndParseTwtxtFile, + Rr as parseTwtxt +}; +//# sourceMappingURL=twtxt-lib.min.js.map +// @license-end diff --git a/dist-browser/twtxt-lib.min.js.map b/dist-browser/twtxt-lib.min.js.map new file mode 100644 index 0000000..e9a216c --- /dev/null +++ b/dist-browser/twtxt-lib.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"twtxt-lib.min.js","sources":["../node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.js","../node_modules/@exodus/blakejs/util.js","../node_modules/@exodus/blakejs/blake2b.js","../node_modules/@exodus/blakejs/blake2s.js","../node_modules/@exodus/blakejs/index.js","../node_modules/base32.js/base32.js","../src/utils.ts","../src/hashTwt.ts","../node_modules/dayjs/dayjs.min.js","../node_modules/dayjs/plugin/utc.js","../src/parseTwtxt.ts","../src/loadAndParseTwtxt.ts"],"sourcesContent":["var buffer = {};\n\nvar base64Js = {};\n\nbase64Js.byteLength = byteLength;\nbase64Js.toByteArray = toByteArray;\nbase64Js.fromByteArray = fromByteArray;\n\nvar lookup = [];\nvar revLookup = [];\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62;\nrevLookup['_'.charCodeAt(0)] = 63;\n\nfunction getLens (b64) {\n var len = b64.length;\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=');\n if (validLen === -1) validLen = len;\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4);\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction 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\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n\n var curByte = 0;\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen;\n\n var i;\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)];\n arr[curByte++] = (tmp >> 16) & 0xFF;\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4);\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2);\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp;\n var output = [];\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF);\n output.push(tripletToBase64(tmp));\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes\n var parts = [];\n var maxChunkLength = 16383; // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n );\n }\n\n return parts.join('')\n}\n\nvar ieee754 = {};\n\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\n\nieee754.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? (nBytes - 1) : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n};\n\nieee754.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);\n var i = isLE ? 0 : (nBytes - 1);\n var d = isLE ? 1 : -1;\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\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\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\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128;\n};\n\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n(function (exports) {\n\n\tconst base64 = base64Js;\n\tconst ieee754$1 = ieee754;\n\tconst customInspectSymbol =\n\t (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n\t ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n\t : null;\n\n\texports.Buffer = Buffer;\n\texports.SlowBuffer = SlowBuffer;\n\texports.INSPECT_MAX_BYTES = 50;\n\n\tconst K_MAX_LENGTH = 0x7fffffff;\n\texports.kMaxLength = K_MAX_LENGTH;\n\tconst { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis;\n\n\t/**\n\t * If `Buffer.TYPED_ARRAY_SUPPORT`:\n\t * === true Use Uint8Array implementation (fastest)\n\t * === false Print warning and recommend using `buffer` v4.x which has an Object\n\t * implementation (most compatible, even IE6)\n\t *\n\t * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n\t * Opera 11.6+, iOS 4.2+.\n\t *\n\t * We report that the browser does not support typed arrays if the are not subclassable\n\t * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n\t * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n\t * for __proto__ and has a buggy typed array implementation.\n\t */\n\tBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport();\n\n\tif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n\t typeof console.error === 'function') {\n\t console.error(\n\t 'This browser lacks typed array (Uint8Array) support which is required by ' +\n\t '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n\t );\n\t}\n\n\tfunction typedArraySupport () {\n\t // Can typed array instances can be augmented?\n\t try {\n\t const arr = new GlobalUint8Array(1);\n\t const proto = { foo: function () { return 42 } };\n\t Object.setPrototypeOf(proto, GlobalUint8Array.prototype);\n\t Object.setPrototypeOf(arr, proto);\n\t return arr.foo() === 42\n\t } catch (e) {\n\t return false\n\t }\n\t}\n\n\tObject.defineProperty(Buffer.prototype, 'parent', {\n\t enumerable: true,\n\t get: function () {\n\t if (!Buffer.isBuffer(this)) return undefined\n\t return this.buffer\n\t }\n\t});\n\n\tObject.defineProperty(Buffer.prototype, 'offset', {\n\t enumerable: true,\n\t get: function () {\n\t if (!Buffer.isBuffer(this)) return undefined\n\t return this.byteOffset\n\t }\n\t});\n\n\tfunction createBuffer (length) {\n\t if (length > K_MAX_LENGTH) {\n\t throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n\t }\n\t // Return an augmented `Uint8Array` instance\n\t const buf = new GlobalUint8Array(length);\n\t Object.setPrototypeOf(buf, Buffer.prototype);\n\t return buf\n\t}\n\n\t/**\n\t * The Buffer constructor returns instances of `Uint8Array` that have their\n\t * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n\t * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n\t * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n\t * returns a single octet.\n\t *\n\t * The `Uint8Array` prototype remains unmodified.\n\t */\n\n\tfunction Buffer (arg, encodingOrOffset, length) {\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new TypeError(\n\t 'The \"string\" argument must be of type string. Received type number'\n\t )\n\t }\n\t return allocUnsafe(arg)\n\t }\n\t return from(arg, encodingOrOffset, length)\n\t}\n\n\tBuffer.poolSize = 8192; // not used by this implementation\n\n\tfunction from (value, encodingOrOffset, length) {\n\t if (typeof value === 'string') {\n\t return fromString(value, encodingOrOffset)\n\t }\n\n\t if (GlobalArrayBuffer.isView(value)) {\n\t return fromArrayView(value)\n\t }\n\n\t if (value == null) {\n\t throw new TypeError(\n\t 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n\t 'or Array-like Object. Received type ' + (typeof value)\n\t )\n\t }\n\n\t if (isInstance(value, GlobalArrayBuffer) ||\n\t (value && isInstance(value.buffer, GlobalArrayBuffer))) {\n\t return fromArrayBuffer(value, encodingOrOffset, length)\n\t }\n\n\t if (typeof GlobalSharedArrayBuffer !== 'undefined' &&\n\t (isInstance(value, GlobalSharedArrayBuffer) ||\n\t (value && isInstance(value.buffer, GlobalSharedArrayBuffer)))) {\n\t return fromArrayBuffer(value, encodingOrOffset, length)\n\t }\n\n\t if (typeof value === 'number') {\n\t throw new TypeError(\n\t 'The \"value\" argument must not be of type number. Received type number'\n\t )\n\t }\n\n\t const valueOf = value.valueOf && value.valueOf();\n\t if (valueOf != null && valueOf !== value) {\n\t return Buffer.from(valueOf, encodingOrOffset, length)\n\t }\n\n\t const b = fromObject(value);\n\t if (b) return b\n\n\t if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n\t typeof value[Symbol.toPrimitive] === 'function') {\n\t return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n\t }\n\n\t throw new TypeError(\n\t 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n\t 'or Array-like Object. Received type ' + (typeof value)\n\t )\n\t}\n\n\t/**\n\t * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n\t * if value is a number.\n\t * Buffer.from(str[, encoding])\n\t * Buffer.from(array)\n\t * Buffer.from(buffer)\n\t * Buffer.from(arrayBuffer[, byteOffset[, length]])\n\t **/\n\tBuffer.from = function (value, encodingOrOffset, length) {\n\t return from(value, encodingOrOffset, length)\n\t};\n\n\t// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n\t// https://github.com/feross/buffer/pull/148\n\tObject.setPrototypeOf(Buffer.prototype, GlobalUint8Array.prototype);\n\tObject.setPrototypeOf(Buffer, GlobalUint8Array);\n\n\tfunction assertSize (size) {\n\t if (typeof size !== 'number') {\n\t throw new TypeError('\"size\" argument must be of type number')\n\t } else if (size < 0) {\n\t throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n\t }\n\t}\n\n\tfunction alloc (size, fill, encoding) {\n\t assertSize(size);\n\t if (size <= 0) {\n\t return createBuffer(size)\n\t }\n\t if (fill !== undefined) {\n\t // Only pay attention to encoding if it's a string. This\n\t // prevents accidentally sending in a number that would\n\t // be interpreted as a start offset.\n\t return typeof encoding === 'string'\n\t ? createBuffer(size).fill(fill, encoding)\n\t : createBuffer(size).fill(fill)\n\t }\n\t return createBuffer(size)\n\t}\n\n\t/**\n\t * Creates a new filled Buffer instance.\n\t * alloc(size[, fill[, encoding]])\n\t **/\n\tBuffer.alloc = function (size, fill, encoding) {\n\t return alloc(size, fill, encoding)\n\t};\n\n\tfunction allocUnsafe (size) {\n\t assertSize(size);\n\t return createBuffer(size < 0 ? 0 : checked(size) | 0)\n\t}\n\n\t/**\n\t * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n\t * */\n\tBuffer.allocUnsafe = function (size) {\n\t return allocUnsafe(size)\n\t};\n\t/**\n\t * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n\t */\n\tBuffer.allocUnsafeSlow = function (size) {\n\t return allocUnsafe(size)\n\t};\n\n\tfunction fromString (string, encoding) {\n\t if (typeof encoding !== 'string' || encoding === '') {\n\t encoding = 'utf8';\n\t }\n\n\t if (!Buffer.isEncoding(encoding)) {\n\t throw new TypeError('Unknown encoding: ' + encoding)\n\t }\n\n\t const length = byteLength(string, encoding) | 0;\n\t let buf = createBuffer(length);\n\n\t const actual = buf.write(string, encoding);\n\n\t if (actual !== length) {\n\t // Writing a hex string, for example, that contains invalid characters will\n\t // cause everything after the first invalid character to be ignored. (e.g.\n\t // 'abxxcd' will be treated as 'ab')\n\t buf = buf.slice(0, actual);\n\t }\n\n\t return buf\n\t}\n\n\tfunction fromArrayLike (array) {\n\t const length = array.length < 0 ? 0 : checked(array.length) | 0;\n\t const buf = createBuffer(length);\n\t for (let i = 0; i < length; i += 1) {\n\t buf[i] = array[i] & 255;\n\t }\n\t return buf\n\t}\n\n\tfunction fromArrayView (arrayView) {\n\t if (isInstance(arrayView, GlobalUint8Array)) {\n\t const copy = new GlobalUint8Array(arrayView);\n\t return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n\t }\n\t return fromArrayLike(arrayView)\n\t}\n\n\tfunction fromArrayBuffer (array, byteOffset, length) {\n\t if (byteOffset < 0 || array.byteLength < byteOffset) {\n\t throw new RangeError('\"offset\" is outside of buffer bounds')\n\t }\n\n\t if (array.byteLength < byteOffset + (length || 0)) {\n\t throw new RangeError('\"length\" is outside of buffer bounds')\n\t }\n\n\t let buf;\n\t if (byteOffset === undefined && length === undefined) {\n\t buf = new GlobalUint8Array(array);\n\t } else if (length === undefined) {\n\t buf = new GlobalUint8Array(array, byteOffset);\n\t } else {\n\t buf = new GlobalUint8Array(array, byteOffset, length);\n\t }\n\n\t // Return an augmented `Uint8Array` instance\n\t Object.setPrototypeOf(buf, Buffer.prototype);\n\n\t return buf\n\t}\n\n\tfunction fromObject (obj) {\n\t if (Buffer.isBuffer(obj)) {\n\t const len = checked(obj.length) | 0;\n\t const buf = createBuffer(len);\n\n\t if (buf.length === 0) {\n\t return buf\n\t }\n\n\t obj.copy(buf, 0, 0, len);\n\t return buf\n\t }\n\n\t if (obj.length !== undefined) {\n\t if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n\t return createBuffer(0)\n\t }\n\t return fromArrayLike(obj)\n\t }\n\n\t if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n\t return fromArrayLike(obj.data)\n\t }\n\t}\n\n\tfunction checked (length) {\n\t // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n\t // length is NaN (which is otherwise coerced to zero.)\n\t if (length >= K_MAX_LENGTH) {\n\t throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n\t 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n\t }\n\t return length | 0\n\t}\n\n\tfunction SlowBuffer (length) {\n\t if (+length != length) { // eslint-disable-line eqeqeq\n\t length = 0;\n\t }\n\t return Buffer.alloc(+length)\n\t}\n\n\tBuffer.isBuffer = function isBuffer (b) {\n\t return b != null && b._isBuffer === true &&\n\t b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n\t};\n\n\tBuffer.compare = function compare (a, b) {\n\t if (isInstance(a, GlobalUint8Array)) a = Buffer.from(a, a.offset, a.byteLength);\n\t if (isInstance(b, GlobalUint8Array)) b = Buffer.from(b, b.offset, b.byteLength);\n\t if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n\t throw new TypeError(\n\t 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n\t )\n\t }\n\n\t if (a === b) return 0\n\n\t let x = a.length;\n\t let y = b.length;\n\n\t for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n\t if (a[i] !== b[i]) {\n\t x = a[i];\n\t y = b[i];\n\t break\n\t }\n\t }\n\n\t if (x < y) return -1\n\t if (y < x) return 1\n\t return 0\n\t};\n\n\tBuffer.isEncoding = function isEncoding (encoding) {\n\t switch (String(encoding).toLowerCase()) {\n\t case 'hex':\n\t case 'utf8':\n\t case 'utf-8':\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t case 'base64':\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return true\n\t default:\n\t return false\n\t }\n\t};\n\n\tBuffer.concat = function concat (list, length) {\n\t if (!Array.isArray(list)) {\n\t throw new TypeError('\"list\" argument must be an Array of Buffers')\n\t }\n\n\t if (list.length === 0) {\n\t return Buffer.alloc(0)\n\t }\n\n\t let i;\n\t if (length === undefined) {\n\t length = 0;\n\t for (i = 0; i < list.length; ++i) {\n\t length += list[i].length;\n\t }\n\t }\n\n\t const buffer = Buffer.allocUnsafe(length);\n\t let pos = 0;\n\t for (i = 0; i < list.length; ++i) {\n\t let buf = list[i];\n\t if (isInstance(buf, GlobalUint8Array)) {\n\t if (pos + buf.length > buffer.length) {\n\t if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);\n\t buf.copy(buffer, pos);\n\t } else {\n\t GlobalUint8Array.prototype.set.call(\n\t buffer,\n\t buf,\n\t pos\n\t );\n\t }\n\t } else if (!Buffer.isBuffer(buf)) {\n\t throw new TypeError('\"list\" argument must be an Array of Buffers')\n\t } else {\n\t buf.copy(buffer, pos);\n\t }\n\t pos += buf.length;\n\t }\n\t return buffer\n\t};\n\n\tfunction byteLength (string, encoding) {\n\t if (Buffer.isBuffer(string)) {\n\t return string.length\n\t }\n\t if (GlobalArrayBuffer.isView(string) || isInstance(string, GlobalArrayBuffer)) {\n\t return string.byteLength\n\t }\n\t if (typeof string !== 'string') {\n\t throw new TypeError(\n\t 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n\t 'Received type ' + typeof string\n\t )\n\t }\n\n\t const len = string.length;\n\t const mustMatch = (arguments.length > 2 && arguments[2] === true);\n\t if (!mustMatch && len === 0) return 0\n\n\t // Use a for loop to avoid recursion\n\t let loweredCase = false;\n\t for (;;) {\n\t switch (encoding) {\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t return len\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8ToBytes(string).length\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return len * 2\n\t case 'hex':\n\t return len >>> 1\n\t case 'base64':\n\t return base64ToBytes(string).length\n\t default:\n\t if (loweredCase) {\n\t return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n\t }\n\t encoding = ('' + encoding).toLowerCase();\n\t loweredCase = true;\n\t }\n\t }\n\t}\n\tBuffer.byteLength = byteLength;\n\n\tfunction slowToString (encoding, start, end) {\n\t let loweredCase = false;\n\n\t // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n\t // property of a typed array.\n\n\t // This behaves neither like String nor Uint8Array in that we set start/end\n\t // to their upper/lower bounds if the value passed is out of range.\n\t // undefined is handled specially as per ECMA-262 6th Edition,\n\t // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n\t if (start === undefined || start < 0) {\n\t start = 0;\n\t }\n\t // Return early if start > this.length. Done here to prevent potential uint32\n\t // coercion fail below.\n\t if (start > this.length) {\n\t return ''\n\t }\n\n\t if (end === undefined || end > this.length) {\n\t end = this.length;\n\t }\n\n\t if (end <= 0) {\n\t return ''\n\t }\n\n\t // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n\t end >>>= 0;\n\t start >>>= 0;\n\n\t if (end <= start) {\n\t return ''\n\t }\n\n\t if (!encoding) encoding = 'utf8';\n\n\t while (true) {\n\t switch (encoding) {\n\t case 'hex':\n\t return hexSlice(this, start, end)\n\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8Slice(this, start, end)\n\n\t case 'ascii':\n\t return asciiSlice(this, start, end)\n\n\t case 'latin1':\n\t case 'binary':\n\t return latin1Slice(this, start, end)\n\n\t case 'base64':\n\t return base64Slice(this, start, end)\n\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return utf16leSlice(this, start, end)\n\n\t default:\n\t if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n\t encoding = (encoding + '').toLowerCase();\n\t loweredCase = true;\n\t }\n\t }\n\t}\n\n\t// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n\t// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n\t// reliably in a browserify context because there could be multiple different\n\t// copies of the 'buffer' package in use. This method works even for Buffer\n\t// instances that were created from another copy of the `buffer` package.\n\t// See: https://github.com/feross/buffer/issues/154\n\tBuffer.prototype._isBuffer = true;\n\n\tfunction swap (b, n, m) {\n\t const i = b[n];\n\t b[n] = b[m];\n\t b[m] = i;\n\t}\n\n\tBuffer.prototype.swap16 = function swap16 () {\n\t const len = this.length;\n\t if (len % 2 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 16-bits')\n\t }\n\t for (let i = 0; i < len; i += 2) {\n\t swap(this, i, i + 1);\n\t }\n\t return this\n\t};\n\n\tBuffer.prototype.swap32 = function swap32 () {\n\t const len = this.length;\n\t if (len % 4 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 32-bits')\n\t }\n\t for (let i = 0; i < len; i += 4) {\n\t swap(this, i, i + 3);\n\t swap(this, i + 1, i + 2);\n\t }\n\t return this\n\t};\n\n\tBuffer.prototype.swap64 = function swap64 () {\n\t const len = this.length;\n\t if (len % 8 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 64-bits')\n\t }\n\t for (let i = 0; i < len; i += 8) {\n\t swap(this, i, i + 7);\n\t swap(this, i + 1, i + 6);\n\t swap(this, i + 2, i + 5);\n\t swap(this, i + 3, i + 4);\n\t }\n\t return this\n\t};\n\n\tBuffer.prototype.toString = function toString () {\n\t const length = this.length;\n\t if (length === 0) return ''\n\t if (arguments.length === 0) return utf8Slice(this, 0, length)\n\t return slowToString.apply(this, arguments)\n\t};\n\n\tBuffer.prototype.toLocaleString = Buffer.prototype.toString;\n\n\tBuffer.prototype.equals = function equals (b) {\n\t if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n\t if (this === b) return true\n\t return Buffer.compare(this, b) === 0\n\t};\n\n\tBuffer.prototype.inspect = function inspect () {\n\t let str = '';\n\t const max = exports.INSPECT_MAX_BYTES;\n\t str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();\n\t if (this.length > max) str += ' ... ';\n\t return ''\n\t};\n\tif (customInspectSymbol) {\n\t Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;\n\t}\n\n\tBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n\t if (isInstance(target, GlobalUint8Array)) {\n\t target = Buffer.from(target, target.offset, target.byteLength);\n\t }\n\t if (!Buffer.isBuffer(target)) {\n\t throw new TypeError(\n\t 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n\t 'Received type ' + (typeof target)\n\t )\n\t }\n\n\t if (start === undefined) {\n\t start = 0;\n\t }\n\t if (end === undefined) {\n\t end = target ? target.length : 0;\n\t }\n\t if (thisStart === undefined) {\n\t thisStart = 0;\n\t }\n\t if (thisEnd === undefined) {\n\t thisEnd = this.length;\n\t }\n\n\t if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n\t throw new RangeError('out of range index')\n\t }\n\n\t if (thisStart >= thisEnd && start >= end) {\n\t return 0\n\t }\n\t if (thisStart >= thisEnd) {\n\t return -1\n\t }\n\t if (start >= end) {\n\t return 1\n\t }\n\n\t start >>>= 0;\n\t end >>>= 0;\n\t thisStart >>>= 0;\n\t thisEnd >>>= 0;\n\n\t if (this === target) return 0\n\n\t let x = thisEnd - thisStart;\n\t let y = end - start;\n\t const len = Math.min(x, y);\n\n\t const thisCopy = this.slice(thisStart, thisEnd);\n\t const targetCopy = target.slice(start, end);\n\n\t for (let i = 0; i < len; ++i) {\n\t if (thisCopy[i] !== targetCopy[i]) {\n\t x = thisCopy[i];\n\t y = targetCopy[i];\n\t break\n\t }\n\t }\n\n\t if (x < y) return -1\n\t if (y < x) return 1\n\t return 0\n\t};\n\n\t// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n\t// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n\t//\n\t// Arguments:\n\t// - buffer - a Buffer to search\n\t// - val - a string, Buffer, or number\n\t// - byteOffset - an index into `buffer`; will be clamped to an int32\n\t// - encoding - an optional encoding, relevant is val is a string\n\t// - dir - true for indexOf, false for lastIndexOf\n\tfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n\t // Empty buffer means no match\n\t if (buffer.length === 0) return -1\n\n\t // Normalize byteOffset\n\t if (typeof byteOffset === 'string') {\n\t encoding = byteOffset;\n\t byteOffset = 0;\n\t } else if (byteOffset > 0x7fffffff) {\n\t byteOffset = 0x7fffffff;\n\t } else if (byteOffset < -0x80000000) {\n\t byteOffset = -0x80000000;\n\t }\n\t byteOffset = +byteOffset; // Coerce to Number.\n\t if (numberIsNaN(byteOffset)) {\n\t // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n\t byteOffset = dir ? 0 : (buffer.length - 1);\n\t }\n\n\t // Normalize byteOffset: negative offsets start from the end of the buffer\n\t if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n\t if (byteOffset >= buffer.length) {\n\t if (dir) return -1\n\t else byteOffset = buffer.length - 1;\n\t } else if (byteOffset < 0) {\n\t if (dir) byteOffset = 0;\n\t else return -1\n\t }\n\n\t // Normalize val\n\t if (typeof val === 'string') {\n\t val = Buffer.from(val, encoding);\n\t }\n\n\t // Finally, search either indexOf (if dir is true) or lastIndexOf\n\t if (Buffer.isBuffer(val)) {\n\t // Special case: looking for empty string/buffer always fails\n\t if (val.length === 0) {\n\t return -1\n\t }\n\t return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n\t } else if (typeof val === 'number') {\n\t val = val & 0xFF; // Search for a byte value [0-255]\n\t if (typeof GlobalUint8Array.prototype.indexOf === 'function') {\n\t if (dir) {\n\t return GlobalUint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n\t } else {\n\t return GlobalUint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n\t }\n\t }\n\t return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n\t }\n\n\t throw new TypeError('val must be string, number or Buffer')\n\t}\n\n\tfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n\t let indexSize = 1;\n\t let arrLength = arr.length;\n\t let valLength = val.length;\n\n\t if (encoding !== undefined) {\n\t encoding = String(encoding).toLowerCase();\n\t if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n\t encoding === 'utf16le' || encoding === 'utf-16le') {\n\t if (arr.length < 2 || val.length < 2) {\n\t return -1\n\t }\n\t indexSize = 2;\n\t arrLength /= 2;\n\t valLength /= 2;\n\t byteOffset /= 2;\n\t }\n\t }\n\n\t function read (buf, i) {\n\t if (indexSize === 1) {\n\t return buf[i]\n\t } else {\n\t return buf.readUInt16BE(i * indexSize)\n\t }\n\t }\n\n\t let i;\n\t if (dir) {\n\t let foundIndex = -1;\n\t for (i = byteOffset; i < arrLength; i++) {\n\t if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n\t if (foundIndex === -1) foundIndex = i;\n\t if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n\t } else {\n\t if (foundIndex !== -1) i -= i - foundIndex;\n\t foundIndex = -1;\n\t }\n\t }\n\t } else {\n\t if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n\t for (i = byteOffset; i >= 0; i--) {\n\t let found = true;\n\t for (let j = 0; j < valLength; j++) {\n\t if (read(arr, i + j) !== read(val, j)) {\n\t found = false;\n\t break\n\t }\n\t }\n\t if (found) return i\n\t }\n\t }\n\n\t return -1\n\t}\n\n\tBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n\t return this.indexOf(val, byteOffset, encoding) !== -1\n\t};\n\n\tBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n\t return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n\t};\n\n\tBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n\t return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n\t};\n\n\tfunction hexWrite (buf, string, offset, length) {\n\t offset = Number(offset) || 0;\n\t const remaining = buf.length - offset;\n\t if (!length) {\n\t length = remaining;\n\t } else {\n\t length = Number(length);\n\t if (length > remaining) {\n\t length = remaining;\n\t }\n\t }\n\n\t const strLen = string.length;\n\n\t if (length > strLen / 2) {\n\t length = strLen / 2;\n\t }\n\t let i;\n\t for (i = 0; i < length; ++i) {\n\t const parsed = parseInt(string.substr(i * 2, 2), 16);\n\t if (numberIsNaN(parsed)) return i\n\t buf[offset + i] = parsed;\n\t }\n\t return i\n\t}\n\n\tfunction utf8Write (buf, string, offset, length) {\n\t return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n\t}\n\n\tfunction asciiWrite (buf, string, offset, length) {\n\t return blitBuffer(asciiToBytes(string), buf, offset, length)\n\t}\n\n\tfunction base64Write (buf, string, offset, length) {\n\t return blitBuffer(base64ToBytes(string), buf, offset, length)\n\t}\n\n\tfunction ucs2Write (buf, string, offset, length) {\n\t return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n\t}\n\n\tBuffer.prototype.write = function write (string, offset, length, encoding) {\n\t // Buffer#write(string)\n\t if (offset === undefined) {\n\t encoding = 'utf8';\n\t length = this.length;\n\t offset = 0;\n\t // Buffer#write(string, encoding)\n\t } else if (length === undefined && typeof offset === 'string') {\n\t encoding = offset;\n\t length = this.length;\n\t offset = 0;\n\t // Buffer#write(string, offset[, length][, encoding])\n\t } else if (isFinite(offset)) {\n\t offset = offset >>> 0;\n\t if (isFinite(length)) {\n\t length = length >>> 0;\n\t if (encoding === undefined) encoding = 'utf8';\n\t } else {\n\t encoding = length;\n\t length = undefined;\n\t }\n\t } else {\n\t throw new Error(\n\t 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n\t )\n\t }\n\n\t const remaining = this.length - offset;\n\t if (length === undefined || length > remaining) length = remaining;\n\n\t if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n\t throw new RangeError('Attempt to write outside buffer bounds')\n\t }\n\n\t if (!encoding) encoding = 'utf8';\n\n\t let loweredCase = false;\n\t for (;;) {\n\t switch (encoding) {\n\t case 'hex':\n\t return hexWrite(this, string, offset, length)\n\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8Write(this, string, offset, length)\n\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t return asciiWrite(this, string, offset, length)\n\n\t case 'base64':\n\t // Warning: maxLength not taken into account in base64Write\n\t return base64Write(this, string, offset, length)\n\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return ucs2Write(this, string, offset, length)\n\n\t default:\n\t if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n\t encoding = ('' + encoding).toLowerCase();\n\t loweredCase = true;\n\t }\n\t }\n\t};\n\n\tBuffer.prototype.toJSON = function toJSON () {\n\t return {\n\t type: 'Buffer',\n\t data: Array.prototype.slice.call(this._arr || this, 0)\n\t }\n\t};\n\n\tfunction base64Slice (buf, start, end) {\n\t if (start === 0 && end === buf.length) {\n\t return base64.fromByteArray(buf)\n\t } else {\n\t return base64.fromByteArray(buf.slice(start, end))\n\t }\n\t}\n\n\tfunction utf8Slice (buf, start, end) {\n\t end = Math.min(buf.length, end);\n\t const res = [];\n\n\t let i = start;\n\t while (i < end) {\n\t const firstByte = buf[i];\n\t let codePoint = null;\n\t let bytesPerSequence = (firstByte > 0xEF)\n\t ? 4\n\t : (firstByte > 0xDF)\n\t ? 3\n\t : (firstByte > 0xBF)\n\t ? 2\n\t : 1;\n\n\t if (i + bytesPerSequence <= end) {\n\t let secondByte, thirdByte, fourthByte, tempCodePoint;\n\n\t switch (bytesPerSequence) {\n\t case 1:\n\t if (firstByte < 0x80) {\n\t codePoint = firstByte;\n\t }\n\t break\n\t case 2:\n\t secondByte = buf[i + 1];\n\t if ((secondByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);\n\t if (tempCodePoint > 0x7F) {\n\t codePoint = tempCodePoint;\n\t }\n\t }\n\t break\n\t case 3:\n\t secondByte = buf[i + 1];\n\t thirdByte = buf[i + 2];\n\t if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);\n\t if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n\t codePoint = tempCodePoint;\n\t }\n\t }\n\t break\n\t case 4:\n\t secondByte = buf[i + 1];\n\t thirdByte = buf[i + 2];\n\t fourthByte = buf[i + 3];\n\t if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);\n\t if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n\t codePoint = tempCodePoint;\n\t }\n\t }\n\t }\n\t }\n\n\t if (codePoint === null) {\n\t // we did not generate a valid codePoint so insert a\n\t // replacement char (U+FFFD) and advance only 1 byte\n\t codePoint = 0xFFFD;\n\t bytesPerSequence = 1;\n\t } else if (codePoint > 0xFFFF) {\n\t // encode to utf16 (surrogate pair dance)\n\t codePoint -= 0x10000;\n\t res.push(codePoint >>> 10 & 0x3FF | 0xD800);\n\t codePoint = 0xDC00 | codePoint & 0x3FF;\n\t }\n\n\t res.push(codePoint);\n\t i += bytesPerSequence;\n\t }\n\n\t return decodeCodePointsArray(res)\n\t}\n\n\t// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n\t// the lowest limit is Chrome, with 0x10000 args.\n\t// We go 1 magnitude less, for safety\n\tconst MAX_ARGUMENTS_LENGTH = 0x1000;\n\n\tfunction decodeCodePointsArray (codePoints) {\n\t const len = codePoints.length;\n\t if (len <= MAX_ARGUMENTS_LENGTH) {\n\t return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n\t }\n\n\t // Decode in chunks to avoid \"call stack size exceeded\".\n\t let res = '';\n\t let i = 0;\n\t while (i < len) {\n\t res += String.fromCharCode.apply(\n\t String,\n\t codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n\t );\n\t }\n\t return res\n\t}\n\n\tfunction asciiSlice (buf, start, end) {\n\t let ret = '';\n\t end = Math.min(buf.length, end);\n\n\t for (let i = start; i < end; ++i) {\n\t ret += String.fromCharCode(buf[i] & 0x7F);\n\t }\n\t return ret\n\t}\n\n\tfunction latin1Slice (buf, start, end) {\n\t let ret = '';\n\t end = Math.min(buf.length, end);\n\n\t for (let i = start; i < end; ++i) {\n\t ret += String.fromCharCode(buf[i]);\n\t }\n\t return ret\n\t}\n\n\tfunction hexSlice (buf, start, end) {\n\t const len = buf.length;\n\n\t if (!start || start < 0) start = 0;\n\t if (!end || end < 0 || end > len) end = len;\n\n\t let out = '';\n\t for (let i = start; i < end; ++i) {\n\t out += hexSliceLookupTable[buf[i]];\n\t }\n\t return out\n\t}\n\n\tfunction utf16leSlice (buf, start, end) {\n\t const bytes = buf.slice(start, end);\n\t let res = '';\n\t // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n\t for (let i = 0; i < bytes.length - 1; i += 2) {\n\t res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));\n\t }\n\t return res\n\t}\n\n\tBuffer.prototype.slice = function slice (start, end) {\n\t const len = this.length;\n\t start = ~~start;\n\t end = end === undefined ? len : ~~end;\n\n\t if (start < 0) {\n\t start += len;\n\t if (start < 0) start = 0;\n\t } else if (start > len) {\n\t start = len;\n\t }\n\n\t if (end < 0) {\n\t end += len;\n\t if (end < 0) end = 0;\n\t } else if (end > len) {\n\t end = len;\n\t }\n\n\t if (end < start) end = start;\n\n\t const newBuf = this.subarray(start, end);\n\t // Return an augmented `Uint8Array` instance\n\t Object.setPrototypeOf(newBuf, Buffer.prototype);\n\n\t return newBuf\n\t};\n\n\t/*\n\t * Need to make sure that buffer isn't trying to write out of bounds.\n\t */\n\tfunction checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}\n\n\tBuffer.prototype.readUintLE =\n\tBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n\t let val = this[offset];\n\t let mul = 1;\n\t let i = 0;\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t val += this[offset + i] * mul;\n\t }\n\n\t return val\n\t};\n\n\tBuffer.prototype.readUintBE =\n\tBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) {\n\t checkOffset(offset, byteLength, this.length);\n\t }\n\n\t let val = this[offset + --byteLength];\n\t let mul = 1;\n\t while (byteLength > 0 && (mul *= 0x100)) {\n\t val += this[offset + --byteLength] * mul;\n\t }\n\n\t return val\n\t};\n\n\tBuffer.prototype.readUint8 =\n\tBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 1, this.length);\n\t return this[offset]\n\t};\n\n\tBuffer.prototype.readUint16LE =\n\tBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 2, this.length);\n\t return this[offset] | (this[offset + 1] << 8)\n\t};\n\n\tBuffer.prototype.readUint16BE =\n\tBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 2, this.length);\n\t return (this[offset] << 8) | this[offset + 1]\n\t};\n\n\tBuffer.prototype.readUint32LE =\n\tBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\n\t return ((this[offset]) |\n\t (this[offset + 1] << 8) |\n\t (this[offset + 2] << 16)) +\n\t (this[offset + 3] * 0x1000000)\n\t};\n\n\tBuffer.prototype.readUint32BE =\n\tBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\n\t return (this[offset] * 0x1000000) +\n\t ((this[offset + 1] << 16) |\n\t (this[offset + 2] << 8) |\n\t this[offset + 3])\n\t};\n\n\tBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n\t offset = offset >>> 0;\n\t validateNumber(offset, 'offset');\n\t const first = this[offset];\n\t const last = this[offset + 7];\n\t if (first === undefined || last === undefined) {\n\t boundsError(offset, this.length - 8);\n\t }\n\n\t const lo = first +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 24;\n\n\t const hi = this[++offset] +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset] * 2 ** 16 +\n\t last * 2 ** 24;\n\n\t return BigInt(lo) + (BigInt(hi) << BigInt(32))\n\t});\n\n\tBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n\t offset = offset >>> 0;\n\t validateNumber(offset, 'offset');\n\t const first = this[offset];\n\t const last = this[offset + 7];\n\t if (first === undefined || last === undefined) {\n\t boundsError(offset, this.length - 8);\n\t }\n\n\t const hi = first * 2 ** 24 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset];\n\n\t const lo = this[++offset] * 2 ** 24 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 8 +\n\t last;\n\n\t return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n\t});\n\n\tBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n\t let val = this[offset];\n\t let mul = 1;\n\t let i = 0;\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t val += this[offset + i] * mul;\n\t }\n\t mul *= 0x80;\n\n\t if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n\t return val\n\t};\n\n\tBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n\t let i = byteLength;\n\t let mul = 1;\n\t let val = this[offset + --i];\n\t while (i > 0 && (mul *= 0x100)) {\n\t val += this[offset + --i] * mul;\n\t }\n\t mul *= 0x80;\n\n\t if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n\t return val\n\t};\n\n\tBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 1, this.length);\n\t if (!(this[offset] & 0x80)) return (this[offset])\n\t return ((0xff - this[offset] + 1) * -1)\n\t};\n\n\tBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 2, this.length);\n\t const val = this[offset] | (this[offset + 1] << 8);\n\t return (val & 0x8000) ? val | 0xFFFF0000 : val\n\t};\n\n\tBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 2, this.length);\n\t const val = this[offset + 1] | (this[offset] << 8);\n\t return (val & 0x8000) ? val | 0xFFFF0000 : val\n\t};\n\n\tBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\n\t return (this[offset]) |\n\t (this[offset + 1] << 8) |\n\t (this[offset + 2] << 16) |\n\t (this[offset + 3] << 24)\n\t};\n\n\tBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\n\t return (this[offset] << 24) |\n\t (this[offset + 1] << 16) |\n\t (this[offset + 2] << 8) |\n\t (this[offset + 3])\n\t};\n\n\tBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n\t offset = offset >>> 0;\n\t validateNumber(offset, 'offset');\n\t const first = this[offset];\n\t const last = this[offset + 7];\n\t if (first === undefined || last === undefined) {\n\t boundsError(offset, this.length - 8);\n\t }\n\n\t const val = this[offset + 4] +\n\t this[offset + 5] * 2 ** 8 +\n\t this[offset + 6] * 2 ** 16 +\n\t (last << 24); // Overflow\n\n\t return (BigInt(val) << BigInt(32)) +\n\t BigInt(first +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 24)\n\t});\n\n\tBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n\t offset = offset >>> 0;\n\t validateNumber(offset, 'offset');\n\t const first = this[offset];\n\t const last = this[offset + 7];\n\t if (first === undefined || last === undefined) {\n\t boundsError(offset, this.length - 8);\n\t }\n\n\t const val = (first << 24) + // Overflow\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 8 +\n\t this[++offset];\n\n\t return (BigInt(val) << BigInt(32)) +\n\t BigInt(this[++offset] * 2 ** 24 +\n\t this[++offset] * 2 ** 16 +\n\t this[++offset] * 2 ** 8 +\n\t last)\n\t});\n\n\tBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\t return ieee754$1.read(this, offset, true, 23, 4)\n\t};\n\n\tBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 4, this.length);\n\t return ieee754$1.read(this, offset, false, 23, 4)\n\t};\n\n\tBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 8, this.length);\n\t return ieee754$1.read(this, offset, true, 52, 8)\n\t};\n\n\tBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n\t offset = offset >>> 0;\n\t if (!noAssert) checkOffset(offset, 8, this.length);\n\t return ieee754$1.read(this, offset, false, 52, 8)\n\t};\n\n\tfunction checkInt (buf, value, offset, ext, max, min) {\n\t if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n\t if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n\t if (offset + ext > buf.length) throw new RangeError('Index out of range')\n\t}\n\n\tBuffer.prototype.writeUintLE =\n\tBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) {\n\t const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n\t checkInt(this, value, offset, byteLength, maxBytes, 0);\n\t }\n\n\t let mul = 1;\n\t let i = 0;\n\t this[offset] = value & 0xFF;\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t this[offset + i] = (value / mul) & 0xFF;\n\t }\n\n\t return offset + byteLength\n\t};\n\n\tBuffer.prototype.writeUintBE =\n\tBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t byteLength = byteLength >>> 0;\n\t if (!noAssert) {\n\t const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n\t checkInt(this, value, offset, byteLength, maxBytes, 0);\n\t }\n\n\t let i = byteLength - 1;\n\t let mul = 1;\n\t this[offset + i] = value & 0xFF;\n\t while (--i >= 0 && (mul *= 0x100)) {\n\t this[offset + i] = (value / mul) & 0xFF;\n\t }\n\n\t return offset + byteLength\n\t};\n\n\tBuffer.prototype.writeUint8 =\n\tBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);\n\t this[offset] = (value & 0xff);\n\t return offset + 1\n\t};\n\n\tBuffer.prototype.writeUint16LE =\n\tBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n\t this[offset] = (value & 0xff);\n\t this[offset + 1] = (value >>> 8);\n\t return offset + 2\n\t};\n\n\tBuffer.prototype.writeUint16BE =\n\tBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n\t this[offset] = (value >>> 8);\n\t this[offset + 1] = (value & 0xff);\n\t return offset + 2\n\t};\n\n\tBuffer.prototype.writeUint32LE =\n\tBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n\t this[offset + 3] = (value >>> 24);\n\t this[offset + 2] = (value >>> 16);\n\t this[offset + 1] = (value >>> 8);\n\t this[offset] = (value & 0xff);\n\t return offset + 4\n\t};\n\n\tBuffer.prototype.writeUint32BE =\n\tBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n\t this[offset] = (value >>> 24);\n\t this[offset + 1] = (value >>> 16);\n\t this[offset + 2] = (value >>> 8);\n\t this[offset + 3] = (value & 0xff);\n\t return offset + 4\n\t};\n\n\tfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n\t checkIntBI(value, min, max, buf, offset, 7);\n\n\t let lo = Number(value & BigInt(0xffffffff));\n\t buf[offset++] = lo;\n\t lo = lo >> 8;\n\t buf[offset++] = lo;\n\t lo = lo >> 8;\n\t buf[offset++] = lo;\n\t lo = lo >> 8;\n\t buf[offset++] = lo;\n\t let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));\n\t buf[offset++] = hi;\n\t hi = hi >> 8;\n\t buf[offset++] = hi;\n\t hi = hi >> 8;\n\t buf[offset++] = hi;\n\t hi = hi >> 8;\n\t buf[offset++] = hi;\n\t return offset\n\t}\n\n\tfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n\t checkIntBI(value, min, max, buf, offset, 7);\n\n\t let lo = Number(value & BigInt(0xffffffff));\n\t buf[offset + 7] = lo;\n\t lo = lo >> 8;\n\t buf[offset + 6] = lo;\n\t lo = lo >> 8;\n\t buf[offset + 5] = lo;\n\t lo = lo >> 8;\n\t buf[offset + 4] = lo;\n\t let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));\n\t buf[offset + 3] = hi;\n\t hi = hi >> 8;\n\t buf[offset + 2] = hi;\n\t hi = hi >> 8;\n\t buf[offset + 1] = hi;\n\t hi = hi >> 8;\n\t buf[offset] = hi;\n\t return offset + 8\n\t}\n\n\tBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n\t return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n\t});\n\n\tBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n\t return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n\t});\n\n\tBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) {\n\t const limit = Math.pow(2, (8 * byteLength) - 1);\n\n\t checkInt(this, value, offset, byteLength, limit - 1, -limit);\n\t }\n\n\t let i = 0;\n\t let mul = 1;\n\t let sub = 0;\n\t this[offset] = value & 0xFF;\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n\t sub = 1;\n\t }\n\t this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n\t }\n\n\t return offset + byteLength\n\t};\n\n\tBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) {\n\t const limit = Math.pow(2, (8 * byteLength) - 1);\n\n\t checkInt(this, value, offset, byteLength, limit - 1, -limit);\n\t }\n\n\t let i = byteLength - 1;\n\t let mul = 1;\n\t let sub = 0;\n\t this[offset + i] = value & 0xFF;\n\t while (--i >= 0 && (mul *= 0x100)) {\n\t if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n\t sub = 1;\n\t }\n\t this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n\t }\n\n\t return offset + byteLength\n\t};\n\n\tBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);\n\t if (value < 0) value = 0xff + value + 1;\n\t this[offset] = (value & 0xff);\n\t return offset + 1\n\t};\n\n\tBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n\t this[offset] = (value & 0xff);\n\t this[offset + 1] = (value >>> 8);\n\t return offset + 2\n\t};\n\n\tBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n\t this[offset] = (value >>> 8);\n\t this[offset + 1] = (value & 0xff);\n\t return offset + 2\n\t};\n\n\tBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n\t this[offset] = (value & 0xff);\n\t this[offset + 1] = (value >>> 8);\n\t this[offset + 2] = (value >>> 16);\n\t this[offset + 3] = (value >>> 24);\n\t return offset + 4\n\t};\n\n\tBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n\t if (value < 0) value = 0xffffffff + value + 1;\n\t this[offset] = (value >>> 24);\n\t this[offset + 1] = (value >>> 16);\n\t this[offset + 2] = (value >>> 8);\n\t this[offset + 3] = (value & 0xff);\n\t return offset + 4\n\t};\n\n\tBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n\t return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n\t});\n\n\tBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n\t return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n\t});\n\n\tfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n\t if (offset + ext > buf.length) throw new RangeError('Index out of range')\n\t if (offset < 0) throw new RangeError('Index out of range')\n\t}\n\n\tfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) {\n\t checkIEEE754(buf, value, offset, 4);\n\t }\n\t ieee754$1.write(buf, value, offset, littleEndian, 23, 4);\n\t return offset + 4\n\t}\n\n\tBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n\t return writeFloat(this, value, offset, true, noAssert)\n\t};\n\n\tBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n\t return writeFloat(this, value, offset, false, noAssert)\n\t};\n\n\tfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n\t value = +value;\n\t offset = offset >>> 0;\n\t if (!noAssert) {\n\t checkIEEE754(buf, value, offset, 8);\n\t }\n\t ieee754$1.write(buf, value, offset, littleEndian, 52, 8);\n\t return offset + 8\n\t}\n\n\tBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n\t return writeDouble(this, value, offset, true, noAssert)\n\t};\n\n\tBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n\t return writeDouble(this, value, offset, false, noAssert)\n\t};\n\n\t// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n\tBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n\t if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n\t if (!start) start = 0;\n\t if (!end && end !== 0) end = this.length;\n\t if (targetStart >= target.length) targetStart = target.length;\n\t if (!targetStart) targetStart = 0;\n\t if (end > 0 && end < start) end = start;\n\n\t // Copy 0 bytes; we're done\n\t if (end === start) return 0\n\t if (target.length === 0 || this.length === 0) return 0\n\n\t // Fatal error conditions\n\t if (targetStart < 0) {\n\t throw new RangeError('targetStart out of bounds')\n\t }\n\t if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n\t if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n\t // Are we oob?\n\t if (end > this.length) end = this.length;\n\t if (target.length - targetStart < end - start) {\n\t end = target.length - targetStart + start;\n\t }\n\n\t const len = end - start;\n\n\t if (this === target && typeof GlobalUint8Array.prototype.copyWithin === 'function') {\n\t // Use built-in when available, missing from IE11\n\t this.copyWithin(targetStart, start, end);\n\t } else {\n\t GlobalUint8Array.prototype.set.call(\n\t target,\n\t this.subarray(start, end),\n\t targetStart\n\t );\n\t }\n\n\t return len\n\t};\n\n\t// Usage:\n\t// buffer.fill(number[, offset[, end]])\n\t// buffer.fill(buffer[, offset[, end]])\n\t// buffer.fill(string[, offset[, end]][, encoding])\n\tBuffer.prototype.fill = function fill (val, start, end, encoding) {\n\t // Handle string cases:\n\t if (typeof val === 'string') {\n\t if (typeof start === 'string') {\n\t encoding = start;\n\t start = 0;\n\t end = this.length;\n\t } else if (typeof end === 'string') {\n\t encoding = end;\n\t end = this.length;\n\t }\n\t if (encoding !== undefined && typeof encoding !== 'string') {\n\t throw new TypeError('encoding must be a string')\n\t }\n\t if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n\t throw new TypeError('Unknown encoding: ' + encoding)\n\t }\n\t if (val.length === 1) {\n\t const code = val.charCodeAt(0);\n\t if ((encoding === 'utf8' && code < 128) ||\n\t encoding === 'latin1') {\n\t // Fast path: If `val` fits into a single byte, use that numeric value.\n\t val = code;\n\t }\n\t }\n\t } else if (typeof val === 'number') {\n\t val = val & 255;\n\t } else if (typeof val === 'boolean') {\n\t val = Number(val);\n\t }\n\n\t // Invalid ranges are not set to a default, so can range check early.\n\t if (start < 0 || this.length < start || this.length < end) {\n\t throw new RangeError('Out of range index')\n\t }\n\n\t if (end <= start) {\n\t return this\n\t }\n\n\t start = start >>> 0;\n\t end = end === undefined ? this.length : end >>> 0;\n\n\t if (!val) val = 0;\n\n\t let i;\n\t if (typeof val === 'number') {\n\t for (i = start; i < end; ++i) {\n\t this[i] = val;\n\t }\n\t } else {\n\t const bytes = Buffer.isBuffer(val)\n\t ? val\n\t : Buffer.from(val, encoding);\n\t const len = bytes.length;\n\t if (len === 0) {\n\t throw new TypeError('The value \"' + val +\n\t '\" is invalid for argument \"value\"')\n\t }\n\t for (i = 0; i < end - start; ++i) {\n\t this[i + start] = bytes[i % len];\n\t }\n\t }\n\n\t return this\n\t};\n\n\t// CUSTOM ERRORS\n\t// =============\n\n\t// Simplified versions from Node, changed for Buffer-only usage\n\tconst errors = {};\n\tfunction E (sym, getMessage, Base) {\n\t errors[sym] = class NodeError extends Base {\n\t constructor () {\n\t super();\n\n\t Object.defineProperty(this, 'message', {\n\t value: getMessage.apply(this, arguments),\n\t writable: true,\n\t configurable: true\n\t });\n\n\t // Add the error code to the name to include it in the stack trace.\n\t this.name = `${this.name} [${sym}]`;\n\t // Access the stack to generate the error message including the error code\n\t // from the name.\n\t this.stack; // eslint-disable-line no-unused-expressions\n\t // Reset the name to the actual name.\n\t delete this.name;\n\t }\n\n\t get code () {\n\t return sym\n\t }\n\n\t set code (value) {\n\t Object.defineProperty(this, 'code', {\n\t configurable: true,\n\t enumerable: true,\n\t value,\n\t writable: true\n\t });\n\t }\n\n\t toString () {\n\t return `${this.name} [${sym}]: ${this.message}`\n\t }\n\t };\n\t}\n\n\tE('ERR_BUFFER_OUT_OF_BOUNDS',\n\t function (name) {\n\t if (name) {\n\t return `${name} is outside of buffer bounds`\n\t }\n\n\t return 'Attempt to access memory outside buffer bounds'\n\t }, RangeError);\n\tE('ERR_INVALID_ARG_TYPE',\n\t function (name, actual) {\n\t return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n\t }, TypeError);\n\tE('ERR_OUT_OF_RANGE',\n\t function (str, range, input) {\n\t let msg = `The value of \"${str}\" is out of range.`;\n\t let received = input;\n\t if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n\t received = addNumericalSeparator(String(input));\n\t } else if (typeof input === 'bigint') {\n\t received = String(input);\n\t if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n\t received = addNumericalSeparator(received);\n\t }\n\t received += 'n';\n\t }\n\t msg += ` It must be ${range}. Received ${received}`;\n\t return msg\n\t }, RangeError);\n\n\tfunction addNumericalSeparator (val) {\n\t let res = '';\n\t let i = val.length;\n\t const start = val[0] === '-' ? 1 : 0;\n\t for (; i >= start + 4; i -= 3) {\n\t res = `_${val.slice(i - 3, i)}${res}`;\n\t }\n\t return `${val.slice(0, i)}${res}`\n\t}\n\n\t// CHECK FUNCTIONS\n\t// ===============\n\n\tfunction checkBounds (buf, offset, byteLength) {\n\t validateNumber(offset, 'offset');\n\t if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n\t boundsError(offset, buf.length - (byteLength + 1));\n\t }\n\t}\n\n\tfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n\t if (value > max || value < min) {\n\t const n = typeof min === 'bigint' ? 'n' : '';\n\t let range;\n\t if (byteLength > 3) {\n\t if (min === 0 || min === BigInt(0)) {\n\t range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;\n\t } else {\n\t range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n\t `${(byteLength + 1) * 8 - 1}${n}`;\n\t }\n\t } else {\n\t range = `>= ${min}${n} and <= ${max}${n}`;\n\t }\n\t throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n\t }\n\t checkBounds(buf, offset, byteLength);\n\t}\n\n\tfunction validateNumber (value, name) {\n\t if (typeof value !== 'number') {\n\t throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n\t }\n\t}\n\n\tfunction boundsError (value, length, type) {\n\t if (Math.floor(value) !== value) {\n\t validateNumber(value, type);\n\t throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n\t }\n\n\t if (length < 0) {\n\t throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n\t }\n\n\t throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n\t `>= ${type ? 1 : 0} and <= ${length}`,\n\t value)\n\t}\n\n\t// HELPER FUNCTIONS\n\t// ================\n\n\tconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n\n\tfunction base64clean (str) {\n\t // Node takes equal signs as end of the Base64 encoding\n\t str = str.split('=')[0];\n\t // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n\t str = str.trim().replace(INVALID_BASE64_RE, '');\n\t // Node converts strings with length < 2 to ''\n\t if (str.length < 2) return ''\n\t // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n\t while (str.length % 4 !== 0) {\n\t str = str + '=';\n\t }\n\t return str\n\t}\n\n\tfunction utf8ToBytes (string, units) {\n\t units = units || Infinity;\n\t let codePoint;\n\t const length = string.length;\n\t let leadSurrogate = null;\n\t const bytes = [];\n\n\t for (let i = 0; i < length; ++i) {\n\t codePoint = string.charCodeAt(i);\n\n\t // is surrogate component\n\t if (codePoint > 0xD7FF && codePoint < 0xE000) {\n\t // last char was a lead\n\t if (!leadSurrogate) {\n\t // no lead yet\n\t if (codePoint > 0xDBFF) {\n\t // unexpected trail\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n\t continue\n\t } else if (i + 1 === length) {\n\t // unpaired lead\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n\t continue\n\t }\n\n\t // valid lead\n\t leadSurrogate = codePoint;\n\n\t continue\n\t }\n\n\t // 2 leads in a row\n\t if (codePoint < 0xDC00) {\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n\t leadSurrogate = codePoint;\n\t continue\n\t }\n\n\t // valid surrogate pair\n\t codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;\n\t } else if (leadSurrogate) {\n\t // valid bmp char, but last char was a lead\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n\t }\n\n\t leadSurrogate = null;\n\n\t // encode utf8\n\t if (codePoint < 0x80) {\n\t if ((units -= 1) < 0) break\n\t bytes.push(codePoint);\n\t } else if (codePoint < 0x800) {\n\t if ((units -= 2) < 0) break\n\t bytes.push(\n\t codePoint >> 0x6 | 0xC0,\n\t codePoint & 0x3F | 0x80\n\t );\n\t } else if (codePoint < 0x10000) {\n\t if ((units -= 3) < 0) break\n\t bytes.push(\n\t codePoint >> 0xC | 0xE0,\n\t codePoint >> 0x6 & 0x3F | 0x80,\n\t codePoint & 0x3F | 0x80\n\t );\n\t } else if (codePoint < 0x110000) {\n\t if ((units -= 4) < 0) break\n\t bytes.push(\n\t codePoint >> 0x12 | 0xF0,\n\t codePoint >> 0xC & 0x3F | 0x80,\n\t codePoint >> 0x6 & 0x3F | 0x80,\n\t codePoint & 0x3F | 0x80\n\t );\n\t } else {\n\t throw new Error('Invalid code point')\n\t }\n\t }\n\n\t return bytes\n\t}\n\n\tfunction asciiToBytes (str) {\n\t const byteArray = [];\n\t for (let i = 0; i < str.length; ++i) {\n\t // Node's code seems to be doing this and not & 0x7F..\n\t byteArray.push(str.charCodeAt(i) & 0xFF);\n\t }\n\t return byteArray\n\t}\n\n\tfunction utf16leToBytes (str, units) {\n\t let c, hi, lo;\n\t const byteArray = [];\n\t for (let i = 0; i < str.length; ++i) {\n\t if ((units -= 2) < 0) break\n\n\t c = str.charCodeAt(i);\n\t hi = c >> 8;\n\t lo = c % 256;\n\t byteArray.push(lo);\n\t byteArray.push(hi);\n\t }\n\n\t return byteArray\n\t}\n\n\tfunction base64ToBytes (str) {\n\t return base64.toByteArray(base64clean(str))\n\t}\n\n\tfunction blitBuffer (src, dst, offset, length) {\n\t let i;\n\t for (i = 0; i < length; ++i) {\n\t if ((i + offset >= dst.length) || (i >= src.length)) break\n\t dst[i + offset] = src[i];\n\t }\n\t return i\n\t}\n\n\t// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n\t// the `instanceof` check but they should be treated as of that type.\n\t// See: https://github.com/feross/buffer/issues/166\n\tfunction isInstance (obj, type) {\n\t return obj instanceof type ||\n\t (obj != null && obj.constructor != null && obj.constructor.name != null &&\n\t obj.constructor.name === type.name)\n\t}\n\tfunction numberIsNaN (obj) {\n\t // For IE11 support\n\t return obj !== obj // eslint-disable-line no-self-compare\n\t}\n\n\t// Create lookup table for `toString('hex')`\n\t// See: https://github.com/feross/buffer/issues/219\n\tconst hexSliceLookupTable = (function () {\n\t const alphabet = '0123456789abcdef';\n\t const table = new Array(256);\n\t for (let i = 0; i < 16; ++i) {\n\t const i16 = i * 16;\n\t for (let j = 0; j < 16; ++j) {\n\t table[i16 + j] = alphabet[i] + alphabet[j];\n\t }\n\t }\n\t return table\n\t})();\n\n\t// Return not function with Error if BigInt not supported\n\tfunction defineBigIntMethod (fn) {\n\t return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n\t}\n\n\tfunction BufferBigIntNotDefined () {\n\t throw new Error('BigInt not supported')\n\t} \n} (buffer));\n\nconst Buffer = buffer.Buffer;\n\nconst Blob = buffer.Blob;\nconst BlobOptions = buffer.BlobOptions;\nconst Buffer$1 = buffer.Buffer;\nconst File = buffer.File;\nconst FileOptions = buffer.FileOptions;\nconst INSPECT_MAX_BYTES = buffer.INSPECT_MAX_BYTES;\nconst SlowBuffer = buffer.SlowBuffer;\nconst TranscodeEncoding = buffer.TranscodeEncoding;\nconst atob = buffer.atob;\nconst btoa = buffer.btoa;\nconst constants = buffer.constants;\nconst isAscii = buffer.isAscii;\nconst isUtf8 = buffer.isUtf8;\nconst kMaxLength = buffer.kMaxLength;\nconst kStringMaxLength = buffer.kStringMaxLength;\nconst resolveObjectURL = buffer.resolveObjectURL;\nconst transcode = buffer.transcode;\nexport { Blob, BlobOptions, Buffer$1 as Buffer, File, FileOptions, INSPECT_MAX_BYTES, SlowBuffer, TranscodeEncoding, atob, btoa, constants, Buffer as default, isAscii, isUtf8, kMaxLength, kStringMaxLength, resolveObjectURL, transcode };\n//# sourceMappingURL=index.js.map\n","const ERROR_MSG_INPUT = 'Input must be an string, Buffer or Uint8Array'\n\n// For convenience, let people hash a string, not just a Uint8Array\nfunction normalizeInput (input) {\n let ret\n if (input instanceof Uint8Array) {\n ret = input\n } else if (input instanceof Buffer) {\n ret = new Uint8Array(input)\n } else if (typeof input === 'string') {\n ret = new Uint8Array(Buffer.from(input, 'utf8'))\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n}\n\n// Converts a Uint8Array to a hexadecimal string\n// For example, toHex([255, 0, 255]) returns \"ff00ff\"\nfunction toHex (bytes) {\n return Array.prototype.map\n .call(bytes, function (n) {\n return (n < 16 ? '0' : '') + n.toString(16)\n })\n .join('')\n}\n\n// Converts any value in [0...2^32-1] to an 8-character hex string\nfunction uint32ToHex (val) {\n return (0x100000000 + val).toString(16).substring(1)\n}\n\n// For debugging: prints out hash state in the same format as the RFC\n// sample computation exactly, so that you can diff\nfunction debugPrint (label, arr, size) {\n let msg = '\\n' + label + ' = '\n for (let i = 0; i < arr.length; i += 2) {\n if (size === 32) {\n msg += uint32ToHex(arr[i]).toUpperCase()\n msg += ' '\n msg += uint32ToHex(arr[i + 1]).toUpperCase()\n } else if (size === 64) {\n msg += uint32ToHex(arr[i + 1]).toUpperCase()\n msg += uint32ToHex(arr[i]).toUpperCase()\n } else throw new Error('Invalid size ' + size)\n if (i % 6 === 4) {\n msg += '\\n' + new Array(label.length + 4).join(' ')\n } else if (i < arr.length - 2) {\n msg += ' '\n }\n }\n console.log(msg)\n}\n\n// For performance testing: generates N bytes of input, hashes M times\n// Measures and prints MB/second hash performance each time\nfunction testSpeed (hashFn, N, M) {\n let startMs = new Date().getTime()\n\n const input = new Uint8Array(N)\n for (let i = 0; i < N; i++) {\n input[i] = i % 256\n }\n const genMs = new Date().getTime()\n console.log('Generated random input in ' + (genMs - startMs) + 'ms')\n startMs = genMs\n\n for (let i = 0; i < M; i++) {\n const hashHex = hashFn(input)\n const hashMs = new Date().getTime()\n const ms = hashMs - startMs\n startMs = hashMs\n console.log('Hashed in ' + ms + 'ms: ' + hashHex.substring(0, 20) + '...')\n console.log(\n Math.round((N / (1 << 20) / (ms / 1000)) * 100) / 100 + ' MB PER SECOND'\n )\n }\n}\n\nmodule.exports = {\n normalizeInput: normalizeInput,\n toHex: toHex,\n debugPrint: debugPrint,\n testSpeed: testSpeed\n}\n","// Blake2B in pure Javascript\n// Adapted from the reference implementation in RFC7693\n// Ported to Javascript by DC - https://github.com/dcposch\n\nconst util = require('./util')\n\n// 64-bit unsigned addition\n// Sets v[a,a+1] += v[b,b+1]\n// v should be a Uint32Array\nfunction ADD64AA (v, a, b) {\n const o0 = v[a] + v[b]\n let o1 = v[a + 1] + v[b + 1]\n if (o0 >= 0x100000000) {\n o1++\n }\n v[a] = o0\n v[a + 1] = o1\n}\n\n// 64-bit unsigned addition\n// Sets v[a,a+1] += b\n// b0 is the low 32 bits of b, b1 represents the high 32 bits\nfunction ADD64AC (v, a, b0, b1) {\n let o0 = v[a] + b0\n if (b0 < 0) {\n o0 += 0x100000000\n }\n let o1 = v[a + 1] + b1\n if (o0 >= 0x100000000) {\n o1++\n }\n v[a] = o0\n v[a + 1] = o1\n}\n\n// Little-endian byte access\nfunction B2B_GET32 (arr, i) {\n return arr[i] ^ (arr[i + 1] << 8) ^ (arr[i + 2] << 16) ^ (arr[i + 3] << 24)\n}\n\n// G Mixing function\n// The ROTRs are inlined for speed\nfunction B2B_G (a, b, c, d, ix, iy) {\n const x0 = m[ix]\n const x1 = m[ix + 1]\n const y0 = m[iy]\n const y1 = m[iy + 1]\n\n ADD64AA(v, a, b) // v[a,a+1] += v[b,b+1] ... in JS we must store a uint64 as two uint32s\n ADD64AC(v, a, x0, x1) // v[a, a+1] += x ... x0 is the low 32 bits of x, x1 is the high 32 bits\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated to the right by 32 bits\n let xor0 = v[d] ^ v[a]\n let xor1 = v[d + 1] ^ v[a + 1]\n v[d] = xor1\n v[d + 1] = xor0\n\n ADD64AA(v, c, d)\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 24 bits\n xor0 = v[b] ^ v[c]\n xor1 = v[b + 1] ^ v[c + 1]\n v[b] = (xor0 >>> 24) ^ (xor1 << 8)\n v[b + 1] = (xor1 >>> 24) ^ (xor0 << 8)\n\n ADD64AA(v, a, b)\n ADD64AC(v, a, y0, y1)\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated right by 16 bits\n xor0 = v[d] ^ v[a]\n xor1 = v[d + 1] ^ v[a + 1]\n v[d] = (xor0 >>> 16) ^ (xor1 << 16)\n v[d + 1] = (xor1 >>> 16) ^ (xor0 << 16)\n\n ADD64AA(v, c, d)\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 63 bits\n xor0 = v[b] ^ v[c]\n xor1 = v[b + 1] ^ v[c + 1]\n v[b] = (xor1 >>> 31) ^ (xor0 << 1)\n v[b + 1] = (xor0 >>> 31) ^ (xor1 << 1)\n}\n\n// Initialization Vector\nconst BLAKE2B_IV32 = new Uint32Array([\n 0xf3bcc908,\n 0x6a09e667,\n 0x84caa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\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 14,\n 10,\n 4,\n 8,\n 9,\n 15,\n 13,\n 6,\n 1,\n 12,\n 0,\n 2,\n 11,\n 7,\n 5,\n 3\n]\n\n// These are offsets into a uint64 buffer.\n// Multiply them all by 2 to make them offsets into a uint32 buffer,\n// because this is Javascript and we don't have uint64s\nconst SIGMA82 = new Uint8Array(\n SIGMA8.map(function (x) {\n return x * 2\n })\n)\n\n// Compression function. 'last' flag indicates last block.\n// Note we're representing 16 uint64s as 32 uint32s\nconst v = new Uint32Array(32)\nconst m = new Uint32Array(32)\nfunction blake2bCompress (ctx, last) {\n let i = 0\n\n // init work variables\n for (i = 0; i < 16; i++) {\n v[i] = ctx.h[i]\n v[i + 16] = BLAKE2B_IV32[i]\n }\n\n // low 64 bits of offset\n v[24] = v[24] ^ ctx.t\n v[25] = v[25] ^ (ctx.t / 0x100000000)\n // high 64 bits not supported, offset may not be higher than 2**53-1\n\n // last block flag set ?\n if (last) {\n v[28] = ~v[28]\n v[29] = ~v[29]\n }\n\n // get little-endian words\n for (i = 0; i < 32; i++) {\n m[i] = B2B_GET32(ctx.b, 4 * i)\n }\n\n // twelve rounds of mixing\n // uncomment the DebugPrint calls to log the computation\n // and match the RFC sample documentation\n // util.debugPrint(' m[16]', m, 64)\n for (i = 0; i < 12; i++) {\n // util.debugPrint(' (i=' + (i < 10 ? ' ' : '') + i + ') v[16]', v, 64)\n B2B_G(0, 8, 16, 24, SIGMA82[i * 16 + 0], SIGMA82[i * 16 + 1])\n B2B_G(2, 10, 18, 26, SIGMA82[i * 16 + 2], SIGMA82[i * 16 + 3])\n B2B_G(4, 12, 20, 28, SIGMA82[i * 16 + 4], SIGMA82[i * 16 + 5])\n B2B_G(6, 14, 22, 30, SIGMA82[i * 16 + 6], SIGMA82[i * 16 + 7])\n B2B_G(0, 10, 20, 30, SIGMA82[i * 16 + 8], SIGMA82[i * 16 + 9])\n B2B_G(2, 12, 22, 24, SIGMA82[i * 16 + 10], SIGMA82[i * 16 + 11])\n B2B_G(4, 14, 16, 26, SIGMA82[i * 16 + 12], SIGMA82[i * 16 + 13])\n B2B_G(6, 8, 18, 28, SIGMA82[i * 16 + 14], SIGMA82[i * 16 + 15])\n }\n // util.debugPrint(' (i=12) v[16]', v, 64)\n\n for (i = 0; i < 16; i++) {\n ctx.h[i] = ctx.h[i] ^ v[i] ^ v[i + 16]\n }\n // util.debugPrint('h[8]', ctx.h, 64)\n}\n\n// reusable parameterBlock\nvar parameterBlock = new Uint8Array([\n 0, 0, 0, 0, // 0: outlen, keylen, fanout, depth\n 0, 0, 0, 0, // 4: leaf length, sequential mode\n 0, 0, 0, 0, // 8: node offset\n 0, 0, 0, 0, // 12: node offset\n 0, 0, 0, 0, // 16: node depth, inner length, rfu\n 0, 0, 0, 0, // 20: rfu\n 0, 0, 0, 0, // 24: rfu\n 0, 0, 0, 0, // 28: rfu\n 0, 0, 0, 0, // 32: salt\n 0, 0, 0, 0, // 36: salt\n 0, 0, 0, 0, // 40: salt\n 0, 0, 0, 0, // 44: salt\n 0, 0, 0, 0, // 48: personal\n 0, 0, 0, 0, // 52: personal\n 0, 0, 0, 0, // 56: personal\n 0, 0, 0, 0 // 60: personal\n])\n\n// Creates a BLAKE2b hashing context\n// Requires an output length between 1 and 64 bytes\n// Takes an optional Uint8Array key\n// Takes an optinal Uint8Array salt\n// Takes an optinal Uint8Array personal\nfunction blake2bInit (outlen, key, salt, personal) {\n if (outlen === 0 || outlen > 64) {\n throw new Error('Illegal output length, expected 0 < length <= 64')\n }\n if (key && key.length > 64) {\n throw new Error('Illegal key, expected Uint8Array with 0 < length <= 64')\n }\n if (salt && salt.length !== 16) {\n throw new Error('Illegal salt, expected Uint8Array with length is 16')\n }\n if (personal && personal.length !== 16) {\n throw new Error('Illegal personal, expected Uint8Array with length is 16')\n }\n\n // state, 'param block'\n const ctx = {\n b: new Uint8Array(128),\n h: new Uint32Array(16),\n t: 0, // input count\n c: 0, // pointer within buffer\n outlen: outlen // output length in bytes\n }\n\n // zero out parameterBlock before usage\n parameterBlock.fill(0)\n parameterBlock[0] = outlen\n if (key) parameterBlock[1] = key.length\n parameterBlock[2] = 1 // fanout\n parameterBlock[3] = 1 // depth\n\n if (salt) parameterBlock.set(salt, 32)\n if (personal) parameterBlock.set(personal, 48)\n\n // initialize hash state\n for (let i = 0; i < 16; i++) {\n ctx.h[i] = BLAKE2B_IV32[i] ^ B2B_GET32(parameterBlock, i * 4)\n }\n\n // key the hash, if applicable\n if (key) {\n blake2bUpdate(ctx, key)\n // at the end\n ctx.c = 128\n }\n\n return ctx\n}\n\n// Updates a BLAKE2b streaming hash\n// Requires hash context and Uint8Array (byte array)\nfunction blake2bUpdate (ctx, input) {\n for (let i = 0; i < input.length; i++) {\n if (ctx.c === 128) {\n // buffer full ?\n ctx.t += ctx.c // add counters\n blake2bCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}\n\n// Completes a BLAKE2b streaming hash\n// Returns a Uint8Array containing the message digest\nfunction blake2bFinal (ctx) {\n ctx.t += ctx.c // mark last block offset\n\n while (ctx.c < 128) {\n // fill up with zeros\n ctx.b[ctx.c++] = 0\n }\n blake2bCompress(ctx, true) // final block flag = 1\n\n // little endian convert and store\n const out = new Uint8Array(ctx.outlen)\n for (let i = 0; i < ctx.outlen; i++) {\n out[i] = ctx.h[i >> 2] >> (8 * (i & 3))\n }\n return out\n}\n\n// Computes the BLAKE2B hash of a string or byte array, and returns a Uint8Array\n//\n// Returns a n-byte Uint8Array\n//\n// Parameters:\n// - input - the input bytes, as a string, Buffer or Uint8Array\n// - key - optional key Uint8Array, up to 64 bytes\n// - outlen - optional output length in bytes, default 64\n// - salt - optional salt bytes, string, Buffer or Uint8Array\n// - personal - optional personal bytes, string, Buffer or Uint8Array\nfunction blake2b (input, key, outlen, salt, personal) {\n // preprocess inputs\n outlen = outlen || 64\n input = util.normalizeInput(input)\n if (salt) {\n salt = util.normalizeInput(salt)\n }\n if (personal) {\n personal = util.normalizeInput(personal)\n }\n\n // do the math\n const ctx = blake2bInit(outlen, key, salt, personal)\n blake2bUpdate(ctx, input)\n return blake2bFinal(ctx)\n}\n\n// Computes the BLAKE2B hash of a string or byte array\n//\n// Returns an n-byte hash in hex, all lowercase\n//\n// Parameters:\n// - input - the input bytes, as a string, Buffer, or Uint8Array\n// - key - optional key Uint8Array, up to 64 bytes\n// - outlen - optional output length in bytes, default 64\n// - salt - optional salt bytes, string, Buffer or Uint8Array\n// - personal - optional personal bytes, string, Buffer or Uint8Array\nfunction blake2bHex (input, key, outlen, salt, personal) {\n const output = blake2b(input, key, outlen, salt, personal)\n return util.toHex(output)\n}\n\nmodule.exports = {\n blake2b: blake2b,\n blake2bHex: blake2bHex,\n blake2bInit: blake2bInit,\n blake2bUpdate: blake2bUpdate,\n blake2bFinal: blake2bFinal\n}\n","// BLAKE2s hash function in pure Javascript\n// Adapted from the reference implementation in RFC7693\n// Ported to Javascript by DC - https://github.com/dcposch\n\nconst util = require('./util')\n\n// Little-endian byte access.\n// Expects a Uint8Array and an index\n// Returns the little-endian uint32 at v[i..i+3]\nfunction B2S_GET32 (v, i) {\n return v[i] ^ (v[i + 1] << 8) ^ (v[i + 2] << 16) ^ (v[i + 3] << 24)\n}\n\n// Mixing function G.\nfunction B2S_G (a, b, c, d, x, y) {\n v[a] = v[a] + v[b] + x\n v[d] = ROTR32(v[d] ^ v[a], 16)\n v[c] = v[c] + v[d]\n v[b] = ROTR32(v[b] ^ v[c], 12)\n v[a] = v[a] + v[b] + y\n v[d] = ROTR32(v[d] ^ v[a], 8)\n v[c] = v[c] + v[d]\n v[b] = ROTR32(v[b] ^ v[c], 7)\n}\n\n// 32-bit right rotation\n// x should be a uint32\n// y must be between 1 and 31, inclusive\nfunction ROTR32 (x, y) {\n return (x >>> y) ^ (x << (32 - y))\n}\n\n// Initialization Vector.\nconst BLAKE2S_IV = new Uint32Array([\n 0x6a09e667,\n 0xbb67ae85,\n 0x3c6ef372,\n 0xa54ff53a,\n 0x510e527f,\n 0x9b05688c,\n 0x1f83d9ab,\n 0x5be0cd19\n])\n\nconst SIGMA = new Uint8Array([\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 14,\n 10,\n 4,\n 8,\n 9,\n 15,\n 13,\n 6,\n 1,\n 12,\n 0,\n 2,\n 11,\n 7,\n 5,\n 3,\n 11,\n 8,\n 12,\n 0,\n 5,\n 2,\n 15,\n 13,\n 10,\n 14,\n 3,\n 6,\n 7,\n 1,\n 9,\n 4,\n 7,\n 9,\n 3,\n 1,\n 13,\n 12,\n 11,\n 14,\n 2,\n 6,\n 5,\n 10,\n 4,\n 0,\n 15,\n 8,\n 9,\n 0,\n 5,\n 7,\n 2,\n 4,\n 10,\n 15,\n 14,\n 1,\n 11,\n 12,\n 6,\n 8,\n 3,\n 13,\n 2,\n 12,\n 6,\n 10,\n 0,\n 11,\n 8,\n 3,\n 4,\n 13,\n 7,\n 5,\n 15,\n 14,\n 1,\n 9,\n 12,\n 5,\n 1,\n 15,\n 14,\n 13,\n 4,\n 10,\n 0,\n 7,\n 6,\n 3,\n 9,\n 2,\n 8,\n 11,\n 13,\n 11,\n 7,\n 14,\n 12,\n 1,\n 3,\n 9,\n 5,\n 0,\n 15,\n 4,\n 8,\n 6,\n 2,\n 10,\n 6,\n 15,\n 14,\n 9,\n 11,\n 3,\n 0,\n 8,\n 12,\n 2,\n 13,\n 7,\n 1,\n 4,\n 10,\n 5,\n 10,\n 2,\n 8,\n 4,\n 7,\n 6,\n 1,\n 5,\n 15,\n 11,\n 9,\n 14,\n 3,\n 12,\n 13,\n 0\n])\n\n// Compression function. \"last\" flag indicates last block\nconst v = new Uint32Array(16)\nconst m = new Uint32Array(16)\nfunction blake2sCompress (ctx, last) {\n let i = 0\n for (i = 0; i < 8; i++) {\n // init work variables\n v[i] = ctx.h[i]\n v[i + 8] = BLAKE2S_IV[i]\n }\n\n v[12] ^= ctx.t // low 32 bits of offset\n v[13] ^= ctx.t / 0x100000000 // high 32 bits\n if (last) {\n // last block flag set ?\n v[14] = ~v[14]\n }\n\n for (i = 0; i < 16; i++) {\n // get little-endian words\n m[i] = B2S_GET32(ctx.b, 4 * i)\n }\n\n // ten rounds of mixing\n // uncomment the DebugPrint calls to log the computation\n // and match the RFC sample documentation\n // util.debugPrint(' m[16]', m, 32)\n for (i = 0; i < 10; i++) {\n // util.debugPrint(' (i=' + i + ') v[16]', v, 32)\n B2S_G(0, 4, 8, 12, m[SIGMA[i * 16 + 0]], m[SIGMA[i * 16 + 1]])\n B2S_G(1, 5, 9, 13, m[SIGMA[i * 16 + 2]], m[SIGMA[i * 16 + 3]])\n B2S_G(2, 6, 10, 14, m[SIGMA[i * 16 + 4]], m[SIGMA[i * 16 + 5]])\n B2S_G(3, 7, 11, 15, m[SIGMA[i * 16 + 6]], m[SIGMA[i * 16 + 7]])\n B2S_G(0, 5, 10, 15, m[SIGMA[i * 16 + 8]], m[SIGMA[i * 16 + 9]])\n B2S_G(1, 6, 11, 12, m[SIGMA[i * 16 + 10]], m[SIGMA[i * 16 + 11]])\n B2S_G(2, 7, 8, 13, m[SIGMA[i * 16 + 12]], m[SIGMA[i * 16 + 13]])\n B2S_G(3, 4, 9, 14, m[SIGMA[i * 16 + 14]], m[SIGMA[i * 16 + 15]])\n }\n // util.debugPrint(' (i=10) v[16]', v, 32)\n\n for (i = 0; i < 8; i++) {\n ctx.h[i] ^= v[i] ^ v[i + 8]\n }\n // util.debugPrint('h[8]', ctx.h, 32)\n}\n\n// Creates a BLAKE2s hashing context\n// Requires an output length between 1 and 32 bytes\n// Takes an optional Uint8Array key\nfunction blake2sInit (outlen, key) {\n if (!(outlen > 0 && outlen <= 32)) {\n throw new Error('Incorrect output length, should be in [1, 32]')\n }\n const keylen = key ? key.length : 0\n if (key && !(keylen > 0 && keylen <= 32)) {\n throw new Error('Incorrect key length, should be in [1, 32]')\n }\n\n const ctx = {\n h: new Uint32Array(BLAKE2S_IV), // hash state\n b: new Uint8Array(64), // input block\n c: 0, // pointer within block\n t: 0, // input count\n outlen: outlen // output length in bytes\n }\n ctx.h[0] ^= 0x01010000 ^ (keylen << 8) ^ outlen\n\n if (keylen > 0) {\n blake2sUpdate(ctx, key)\n ctx.c = 64 // at the end\n }\n\n return ctx\n}\n\n// Updates a BLAKE2s streaming hash\n// Requires hash context and Uint8Array (byte array)\nfunction blake2sUpdate (ctx, input) {\n for (let i = 0; i < input.length; i++) {\n if (ctx.c === 64) {\n // buffer full ?\n ctx.t += ctx.c // add counters\n blake2sCompress(ctx, false) // compress (not last)\n ctx.c = 0 // counter to zero\n }\n ctx.b[ctx.c++] = input[i]\n }\n}\n\n// Completes a BLAKE2s streaming hash\n// Returns a Uint8Array containing the message digest\nfunction blake2sFinal (ctx) {\n ctx.t += ctx.c // mark last block offset\n while (ctx.c < 64) {\n // fill up with zeros\n ctx.b[ctx.c++] = 0\n }\n blake2sCompress(ctx, true) // final block flag = 1\n\n // little endian convert and store\n const out = new Uint8Array(ctx.outlen)\n for (let i = 0; i < ctx.outlen; i++) {\n out[i] = (ctx.h[i >> 2] >> (8 * (i & 3))) & 0xff\n }\n return out\n}\n\n// Computes the BLAKE2S hash of a string or byte array, and returns a Uint8Array\n//\n// Returns a n-byte Uint8Array\n//\n// Parameters:\n// - input - the input bytes, as a string, Buffer, or Uint8Array\n// - key - optional key Uint8Array, up to 32 bytes\n// - outlen - optional output length in bytes, default 64\nfunction blake2s (input, key, outlen) {\n // preprocess inputs\n outlen = outlen || 32\n input = util.normalizeInput(input)\n\n // do the math\n const ctx = blake2sInit(outlen, key)\n blake2sUpdate(ctx, input)\n return blake2sFinal(ctx)\n}\n\n// Computes the BLAKE2S hash of a string or byte array\n//\n// Returns an n-byte hash in hex, all lowercase\n//\n// Parameters:\n// - input - the input bytes, as a string, Buffer, or Uint8Array\n// - key - optional key Uint8Array, up to 32 bytes\n// - outlen - optional output length in bytes, default 64\nfunction blake2sHex (input, key, outlen) {\n const output = blake2s(input, key, outlen)\n return util.toHex(output)\n}\n\nmodule.exports = {\n blake2s: blake2s,\n blake2sHex: blake2sHex,\n blake2sInit: blake2sInit,\n blake2sUpdate: blake2sUpdate,\n blake2sFinal: blake2sFinal\n}\n","const b2b = require('./blake2b')\nconst b2s = require('./blake2s')\n\nmodule.exports = {\n blake2b: b2b.blake2b,\n blake2bHex: b2b.blake2bHex,\n blake2bInit: b2b.blake2bInit,\n blake2bUpdate: b2b.blake2bUpdate,\n blake2bFinal: b2b.blake2bFinal,\n blake2s: b2s.blake2s,\n blake2sHex: b2s.blake2sHex,\n blake2sInit: b2s.blake2sInit,\n blake2sUpdate: b2s.blake2sUpdate,\n blake2sFinal: b2s.blake2sFinal\n}\n","\"use strict\";\n\n/**\n * Generate a character map.\n * @param {string} alphabet e.g. \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\"\n * @param {object} mappings map overrides from key to value\n * @method\n */\n\nvar charmap = function (alphabet, mappings) {\n mappings || (mappings = {});\n alphabet.split(\"\").forEach(function (c, i) {\n if (!(c in mappings)) mappings[c] = i;\n });\n return mappings;\n}\n\n/**\n * The RFC 4648 base 32 alphabet and character map.\n * @see {@link https://tools.ietf.org/html/rfc4648}\n */\n\nvar rfc4648 = {\n alphabet: \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\",\n charmap: {\n 0: 14,\n 1: 8\n }\n};\n\nrfc4648.charmap = charmap(rfc4648.alphabet, rfc4648.charmap);\n\n/**\n * The Crockford base 32 alphabet and character map.\n * @see {@link http://www.crockford.com/wrmg/base32.html}\n */\n\nvar crockford = {\n alphabet: \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\",\n charmap: {\n O: 0,\n I: 1,\n L: 1\n }\n};\n\ncrockford.charmap = charmap(crockford.alphabet, crockford.charmap);\n\n/**\n * base32hex\n * @see {@link https://en.wikipedia.org/wiki/Base32#base32hex}\n */\n\nvar base32hex = {\n alphabet: \"0123456789ABCDEFGHIJKLMNOPQRSTUV\",\n charmap: {}\n};\n\nbase32hex.charmap = charmap(base32hex.alphabet, base32hex.charmap);\n\n/**\n * Create a new `Decoder` with the given options.\n *\n * @param {object} [options]\n * @param {string} [type] Supported Base-32 variants are \"rfc4648\" and\n * \"crockford\".\n * @param {object} [charmap] Override the character map used in decoding.\n * @constructor\n */\n\nfunction Decoder (options) {\n this.buf = [];\n this.shift = 8;\n this.carry = 0;\n\n if (options) {\n\n switch (options.type) {\n case \"rfc4648\":\n this.charmap = exports.rfc4648.charmap;\n break;\n case \"crockford\":\n this.charmap = exports.crockford.charmap;\n break;\n case \"base32hex\":\n this.charmap = exports.base32hex.charmap;\n break;\n default:\n throw new Error(\"invalid type\");\n }\n\n if (options.charmap) this.charmap = options.charmap;\n }\n}\n\n/**\n * The default character map coresponds to RFC4648.\n */\n\nDecoder.prototype.charmap = rfc4648.charmap;\n\n/**\n * Decode a string, continuing from the previous state.\n *\n * @param {string} str\n * @return {Decoder} this\n */\n\nDecoder.prototype.write = function (str) {\n var charmap = this.charmap;\n var buf = this.buf;\n var shift = this.shift;\n var carry = this.carry;\n\n // decode string\n str.toUpperCase().split(\"\").forEach(function (char) {\n\n // ignore padding\n if (char == \"=\") return;\n\n // lookup symbol\n var symbol = charmap[char] & 0xff;\n\n // 1: 00000 000\n // 2: 00 00000 0\n // 3: 0000 0000\n // 4: 0 00000 00\n // 5: 000 00000\n // 6: 00000 000\n // 7: 00 00000 0\n\n shift -= 5;\n if (shift > 0) {\n carry |= symbol << shift;\n } else if (shift < 0) {\n buf.push(carry | (symbol >> -shift));\n shift += 8;\n carry = (symbol << shift) & 0xff;\n } else {\n buf.push(carry | symbol);\n shift = 8;\n carry = 0;\n }\n });\n\n // save state\n this.shift = shift;\n this.carry = carry;\n\n // for chaining\n return this;\n};\n\n/**\n * Finish decoding.\n *\n * @param {string} [str] The final string to decode.\n * @return {Array} Decoded byte array.\n */\n\nDecoder.prototype.finalize = function (str) {\n if (str) {\n this.write(str);\n }\n if (this.shift !== 8 && this.carry !== 0) {\n this.buf.push(this.carry);\n this.shift = 8;\n this.carry = 0;\n }\n return this.buf;\n};\n\n/**\n * Create a new `Encoder` with the given options.\n *\n * @param {object} [options]\n * @param {string} [type] Supported Base-32 variants are \"rfc4648\" and\n * \"crockford\".\n * @param {object} [alphabet] Override the alphabet used in encoding.\n * @constructor\n */\n\nfunction Encoder (options) {\n this.buf = \"\";\n this.shift = 3;\n this.carry = 0;\n\n if (options) {\n\n switch (options.type) {\n case \"rfc4648\":\n this.alphabet = exports.rfc4648.alphabet;\n break;\n case \"crockford\":\n this.alphabet = exports.crockford.alphabet;\n break;\n case \"base32hex\":\n this.alphabet = exports.base32hex.alphabet;\n break;\n default:\n throw new Error(\"invalid type\");\n }\n\n if (options.alphabet) this.alphabet = options.alphabet;\n else if (options.lc) this.alphabet = this.alphabet.toLowerCase();\n }\n}\n\n/**\n * The default alphabet coresponds to RFC4648.\n */\n\nEncoder.prototype.alphabet = rfc4648.alphabet;\n\n/**\n * Encode a byte array, continuing from the previous state.\n *\n * @param {byte[]} buf The byte array to encode.\n * @return {Encoder} this\n */\n\nEncoder.prototype.write = function (buf) {\n var shift = this.shift;\n var carry = this.carry;\n var symbol;\n var byte;\n var i;\n\n // encode each byte in buf\n for (i = 0; i < buf.length; i++) {\n byte = buf[i];\n\n // 1: 00000 000\n // 2: 00 00000 0\n // 3: 0000 0000\n // 4: 0 00000 00\n // 5: 000 00000\n // 6: 00000 000\n // 7: 00 00000 0\n\n symbol = carry | (byte >> shift);\n this.buf += this.alphabet[symbol & 0x1f];\n\n if (shift > 5) {\n shift -= 5;\n symbol = byte >> shift;\n this.buf += this.alphabet[symbol & 0x1f];\n }\n\n shift = 5 - shift;\n carry = byte << shift;\n shift = 8 - shift;\n }\n\n // save state\n this.shift = shift;\n this.carry = carry;\n\n // for chaining\n return this;\n};\n\n/**\n * Finish encoding.\n *\n * @param {byte[]} [buf] The final byte array to encode.\n * @return {string} The encoded byte array.\n */\n\nEncoder.prototype.finalize = function (buf) {\n if (buf) {\n this.write(buf);\n }\n if (this.shift !== 3) {\n this.buf += this.alphabet[this.carry & 0x1f];\n this.shift = 3;\n this.carry = 0;\n }\n return this.buf;\n};\n\n/**\n * Convenience encoder.\n *\n * @param {byte[]} buf The byte array to encode.\n * @param {object} [options] Options to pass to the encoder.\n * @return {string} The encoded string.\n */\n\nexports.encode = function (buf, options) {\n return new Encoder(options).finalize(buf);\n};\n\n/**\n * Convenience decoder.\n *\n * @param {string} str The string to decode.\n * @param {object} [options] Options to pass to the decoder.\n * @return {byte[]} The decoded byte array.\n */\n\nexports.decode = function (str, options) {\n return new Decoder(options).finalize(str);\n};\n\n// Exports.\nexports.Decoder = Decoder;\nexports.Encoder = Encoder;\nexports.charmap = charmap;\nexports.crockford = crockford;\nexports.rfc4648 = rfc4648;\nexports.base32hex = base32hex;\n","import base32 from \"base32.js\";\n\nexport const base32Encode = (payload: string | Uint8Array) => {\n\tconst encoder = new base32.Encoder({ type: \"rfc4648\" });\n\treturn encoder.write(payload).finalize();\n};\n\nexport const getValueOrFirstEntry = (value: unknown | unknown[]) =>\n\tArray.isArray(value) && value.length ? value[0] : value;\n","import { Buffer } from \"buffer\";\nglobalThis.Buffer = Buffer;\n\nimport type { Twt } from \"./types.ts\";\n\nimport { blake2b } from \"@exodus/blakejs\";\n\nimport { base32Encode } from \"./utils.ts\";\n\nconst dateRegex =\n\t/^(\\d{4})-(\\d{2})-(\\d{2})([tT ])(\\d{2}):(\\d{2}):(\\d{2})\\.?(\\d{3})?(?:(?:([+-]\\d{2}):?(\\d{2}))|Z)?$/;\n\nconst formatRFC3339 = (date: string) => {\n\tconst pad = (num: number | string = 0) => `${+num < 10 ? 0 : \"\"}${+num}`;\n\tconst padYear = (num: number | string = 0) =>\n\t\t`${+num < 1000 ? 0 : \"\"}${+num < 100 ? 0 : \"\"}${\n\t\t\t+num < 10 ? 0 : \"\"\n\t\t}${+num}`;\n\n\tlet m = dateRegex.exec(date);\n\n\t//if timezone is undefined, it must be Z or nothing (otherwise the group would have captured).\n\tif (m && m?.[9] === undefined) {\n\t\t//Use UTC.\n\t\tm[9] = \"+00\";\n\t}\n\tif (m && m?.[10] === undefined) {\n\t\tm[10] = \"00\";\n\t}\n\n\tconst offset = `${m?.[9]}:${m?.[10]}`.replace(/[+-]?00:00$/, \"Z\");\n\n\treturn [\n\t\tpadYear(m?.[1]),\n\t\t\"-\",\n\t\tpad(m?.[2]),\n\t\t\"-\",\n\t\tpad(m?.[3]),\n\t\tm?.[4],\n\t\tpad(m?.[5]),\n\t\t\":\",\n\t\tpad(m?.[6]),\n\t\t\":\",\n\t\tpad(m?.[7]),\n\t\t//ignore milliseconds (m[8])\n\t\toffset,\n\t].join(\"\");\n};\n\nexport default function hashTwt(twt: Twt): string {\n\tconst created = formatRFC3339(twt.created);\n\tconst payload = [twt.url, created, twt.content].join(\"\\n\");\n\n\treturn base32Encode(blake2b(payload, undefined, 32))\n\t\t.toLowerCase()\n\t\t.slice(-7);\n}\n","!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){\"use strict\";var t=1e3,e=6e4,n=36e5,r=\"millisecond\",i=\"second\",s=\"minute\",u=\"hour\",a=\"day\",o=\"week\",c=\"month\",f=\"quarter\",h=\"year\",d=\"date\",l=\"Invalid Date\",$=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,y=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:\"en\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),ordinal:function(t){var e=[\"th\",\"st\",\"nd\",\"rd\"],n=t%100;return\"[\"+t+(e[(n-20)%10]||e[n]||e[0])+\"]\"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:\"\"+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?\"+\":\"-\")+m(r,2,\"0\")+\":\"+m(i,2,\"0\")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n=\"object\"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if(\"string\"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||\"0\").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t) {\n\t\t\tconst line = originalLine.trim();\n\t\t\tif (line === \"\") return acc;\n\n\t\t\tif (line.startsWith(\"#\")) acc.commentLines.push(line);\n\t\t\telse acc.contentLines.push(line);\n\t\t\treturn acc;\n\t\t},\n\t\t{\n\t\t\tcommentLines: [],\n\t\t\tcontentLines: [],\n\t\t},\n\t);\n\n\tconst { following = [], metadata = {} } = commentLines\n\t\t.filter((line) => line.includes(\"=\"))\n\t\t.reduce(\n\t\t\t(\n\t\t\t\tacc: {\n\t\t\t\t\tfollowing: Twttr[];\n\t\t\t\t\tmetadata: Metadata;\n\t\t\t\t},\n\t\t\t\tline,\n\t\t\t) => {\n\t\t\t\tconst [key, ...vals] = line\n\t\t\t\t\t// remove #\n\t\t\t\t\t.substring(1)\n\t\t\t\t\t.split(\"=\")\n\t\t\t\t\t.map((field) => field.trim());\n\t\t\t\tconst val = vals.join(\"=\");\n\t\t\t\tif (key === \"follow\") {\n\t\t\t\t\tconst [nick, url] = val.trim().split(/\\s+/);\n\t\t\t\t\tacc.following.push({ nick, url });\n\t\t\t\t} else {\n\t\t\t\t\tif (acc.metadata[key]) {\n\t\t\t\t\t\tif (!Array.isArray(acc.metadata[key]))\n\t\t\t\t\t\t\tacc.metadata[key] = [acc.metadata[key], val];\n\t\t\t\t\t\telse acc.metadata[key].push(val);\n\t\t\t\t\t} else acc.metadata[key] = val;\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{\n\t\t\t\tfollowing: [],\n\t\t\t\tmetadata: {},\n\t\t\t},\n\t\t);\n\n\tconst replyRegEx = /\\(#([\\w]+)\\) (\\<\\@(\\S+) ([^>]+)>)*/;\n\n\tconst twts = contentLines\n\t\t.map((line) => {\n\t\t\tconst [created, content] = line\n\t\t\t\t.split(/\\t/)\n\t\t\t\t.map((val) => val.trim());\n\n\t\t\tif (typeof content === \"undefined\")\n\t\t\t\tthrow new Error(`Content is undefined: ${line}`);\n\n\t\t\tconst createdDayjs = dayjs.utc(created);\n\t\t\tif (!createdDayjs.isValid())\n\t\t\t\tthrow new Error(`Date is invalid: ${line}`);\n\n\t\t\tconst createdUTC = createdDayjs.toISOString();\n\n\t\t\tconst replyMatches = replyRegEx.exec(content);\n\t\t\tlet replyHash, replyNick, replyUrl;\n\n\t\t\tif (replyMatches?.length) {\n\t\t\t\treplyHash = replyMatches?.[1];\n\t\t\t\treplyNick = replyMatches?.[3];\n\t\t\t\treplyUrl = replyMatches?.[4];\n\t\t\t}\n\n\t\t\tconst hash = hashTwt({\n\t\t\t\tcontent,\n\t\t\t\tcreated,\n\t\t\t\tcreatedUTC,\n\t\t\t\turl: getValueOrFirstEntry(metadata?.url ?? \"\"),\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tcontent,\n\t\t\t\tcreated,\n\t\t\t\tcreatedUTC,\n\t\t\t\thash,\n\t\t\t\treplyHash,\n\t\t\t\treplyNick,\n\t\t\t\treplyUrl,\n\t\t\t};\n\t\t})\n\t\t.sort((a, b) => dayjs(a.created).diff(dayjs(b.created)));\n\n\treturn {\n\t\tfollowing,\n\t\tmetadata,\n\t\ttwts,\n\t};\n}\n","import dayjs from \"dayjs\";\n\nimport parseTwtxt from \"./parseTwtxt.js\";\n\nexport default async function loadAndParseTwtxtFile(url = \"\") {\n\tif (!url) throw new Error(\"URL is required\");\n\n\ttry {\n\t\tconst response = await fetch(url);\n\t\tconst twtxtFile = await response.text();\n\t\tconst lastModified = dayjs(\n\t\t\tresponse.headers.get(\"Last-Modified\"),\n\t\t).toISOString();\n\n\t\treturn {\n\t\t\t...parseTwtxt(twtxtFile),\n\t\t\tlastModified,\n\t\t};\n\t} catch (err) {\n\t\tconsole.error(err);\n\t\tthrow err;\n\t}\n}\n"],"names":["buffer","base64Js","byteLength","toByteArray","fromByteArray","lookup","revLookup","Arr","code","i","len","getLens","b64","validLen","placeHoldersLen","lens","_byteLength","tmp","arr","curByte","tripletToBase64","num","encodeChunk","uint8","start","end","output","extraBytes","parts","maxChunkLength","len2","ieee754","offset","isLE","mLen","nBytes","e","m","eLen","eMax","eBias","nBits","d","s","value","c","rt","exports","base64","ieee754$1","customInspectSymbol","Buffer","SlowBuffer","K_MAX_LENGTH","GlobalUint8Array","GlobalArrayBuffer","GlobalSharedArrayBuffer","typedArraySupport","proto","createBuffer","length","buf","arg","encodingOrOffset","allocUnsafe","from","fromString","fromArrayView","isInstance","fromArrayBuffer","valueOf","b","fromObject","assertSize","size","alloc","fill","encoding","checked","string","actual","fromArrayLike","array","arrayView","copy","byteOffset","obj","numberIsNaN","a","x","y","list","pos","mustMatch","loweredCase","utf8ToBytes","base64ToBytes","slowToString","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","n","str","max","target","thisStart","thisEnd","thisCopy","targetCopy","bidirectionalIndexOf","val","dir","arrayIndexOf","indexSize","arrLength","valLength","read","foundIndex","found","j","hexWrite","remaining","strLen","parsed","utf8Write","blitBuffer","asciiWrite","asciiToBytes","base64Write","ucs2Write","utf16leToBytes","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","decodeCodePointsArray","MAX_ARGUMENTS_LENGTH","codePoints","ret","out","hexSliceLookupTable","bytes","newBuf","checkOffset","ext","noAssert","mul","defineBigIntMethod","validateNumber","first","last","boundsError","lo","__pow","hi","checkInt","min","maxBytes","wrtBigUInt64LE","checkIntBI","wrtBigUInt64BE","limit","sub","checkIEEE754","writeFloat","littleEndian","writeDouble","targetStart","errors","E","sym","getMessage","Base","name","range","input","msg","received","addNumericalSeparator","checkBounds","type","INVALID_BASE64_RE","base64clean","units","leadSurrogate","byteArray","src","dst","alphabet","table","i16","fn","BufferBigIntNotDefined","Blob","BlobOptions","Buffer$1","File","FileOptions","INSPECT_MAX_BYTES","TranscodeEncoding","atob","btoa","constants","isAscii","isUtf8","kMaxLength","kStringMaxLength","resolveObjectURL","transcode","ERROR_MSG_INPUT","normalizeInput","toHex","uint32ToHex","debugPrint","label","testSpeed","hashFn","N","M","startMs","genMs","hashHex","hashMs","ms","util","require$$0","ADD64AA","v","o0","o1","ADD64AC","b0","b1","B2B_GET32","B2B_G","ix","iy","x0","x1","y0","y1","xor0","xor1","BLAKE2B_IV32","SIGMA8","SIGMA82","blake2bCompress","ctx","parameterBlock","blake2bInit","outlen","key","salt","personal","blake2bUpdate","blake2bFinal","blake2b","blake2bHex","blake2b_1","B2S_GET32","B2S_G","ROTR32","BLAKE2S_IV","SIGMA","blake2sCompress","blake2sInit","keylen","blake2sUpdate","blake2sFinal","blake2s","blake2sHex","blake2s_1","b2b","b2s","require$$1","blakejs","charmap","mappings","rfc4648","crockford","base32hex","Decoder","options","shift","carry","char","symbol","Encoder","byte","base32Encode","payload","base32","getValueOrFirstEntry","dateRegex","formatRFC3339","date","pad","padYear","hashTwt","twt","created","t","module","this","r","o","f","h","l","$","u","g","D","p","S","_","w","O","k","dayjs","utc","parseTwtxt","twtxt","allLines","commentLines","contentLines","acc","originalLine","line","following","metadata","vals","field","nick","url","replyRegEx","twts","_a","content","createdDayjs","createdUTC","replyMatches","replyHash","replyNick","replyUrl","hash","loadAndParseTwtxtFile","__async","response","twtxtFile","lastModified","__spreadProps","__spreadValues","err"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAIA,IAAS,CAAA,GAETC,KAAW,CAAA;AAEfA,GAAS,aAAaC;AACtBD,GAAS,cAAcE;AACvBF,GAAS,gBAAgBG;AAEzB,IAAIC,KAAS,CAAA,GACTC,KAAY,CAAA,GACZC,KAAM,OAAO,cAAe,cAAc,aAAa,OAEvDC,KAAO;AACX,SAASC,KAAI,GAAGC,KAAMF,GAAK,QAAQC,KAAIC,IAAK,EAAED;AAC5C,EAAAJ,GAAOI,EAAC,IAAID,GAAKC,EAAC,GAClBH,GAAUE,GAAK,WAAWC,EAAC,CAAC,IAAIA;AAKlCH,GAAU,EAAiB,IAAI;AAC/BA,GAAU,EAAiB,IAAI;AAE/B,SAASK,GAASC,GAAK;AACrB,MAAIF,IAAME,EAAI;AAEd,MAAIF,IAAM,IAAI;AACZ,UAAM,IAAI,MAAM,gDA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ACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA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AYF,KAAA,gBAAAA,EAAe,IAC3BG,IAAWH,KAAA,gBAAAA,EAAe;AAG3B,UAAMI,IAAO/C,GAAQ;AAAA,MACpB,SAAAwC;AAAA,MACA,SAAAtC;AAAA,MACA,YAAAwC;AAAA,MACA,KAAKhD,IAAqB6C,IAAAP,KAAA,gBAAAA,EAAU,QAAV,OAAAO,IAAiB,EAAE;AAAA,IAAA,CAC7C;AAED,WAAO;AAAA,MACN,SAAAC;AAAA,MACA,SAAAtC;AAAA,MACA,YAAAwC;AAAA,MACA,MAAAK;AAAA,MACA,WAAAH;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC;AAAA,IAAA;AAAA,EAEF,CAAC,EACA,KAAK,CAACxQ,GAAGjB,MAAMgQ,GAAM/O,EAAE,OAAO,EAAE,KAAK+O,GAAMhQ,EAAE,OAAO,CAAC,CAAC;AAExD,SAAO;AAAA,IACN,WAAA0Q;AAAA,IACA,UAAAC;AAAA,IACA,MAAAM;AAAA,EAAA;AAEF;ACtHA,SAA8BU,GAAsBZ,IAAM,IAAI;AAAA,SAAAa,GAAA;AAC7D,QAAI,CAACb,EAAK,OAAM,IAAI,MAAM,iBAAiB;AAE3C,QAAI;AACH,YAAMc,IAAW,MAAM,MAAMd,CAAG,GAC1Be,IAAY,MAAMD,EAAS,KAAA,GAC3BE,IAAe/B;AAAA,QACpB6B,EAAS,QAAQ,IAAI,eAAe;AAAA,MAAA,EACnC,YAAA;AAEF,aAAOG,GAAAC,GAAA,IACH/B,GAAW4B,CAAS,IADjB;AAAA,QAEN,cAAAC;AAAA,MAAA;AAAA,IAEF,SAASG,GAAK;AACb,oBAAQ,MAAMA,CAAG,GACXA;AAAA,IACP;AAAA,EACD;AAAA;","x_google_ignoreList":[0,1,2,3,4,5,8,9]} \ No newline at end of file diff --git a/dist-browser/types.d.ts b/dist-browser/types.d.ts new file mode 100644 index 0000000..621a657 --- /dev/null +++ b/dist-browser/types.d.ts @@ -0,0 +1,31 @@ +export interface LoadAndParseTwtxtWithCacheConfig { + cacheKeyPrefix: string; + onLoad?: (data: Twtxt) => void; + user?: Twttr; +} +export interface Metadata { + [key: string]: string | string[]; +} +export interface Twt { + avatar?: string; + content: string; + created: string; + createdUTC: string; + hash?: string; + nick?: string; + noDom?: boolean; + replyHash?: string; + replyNick?: string; + replyUrl?: string; + url?: string; +} +export interface Twttr { + avatar?: string; + nick: string; + url: string; +} +export interface Twtxt { + following: Twttr[]; + metadata: Metadata; + twts: Twt[]; +} diff --git a/dist-browser/utils.d.ts b/dist-browser/utils.d.ts new file mode 100644 index 0000000..ae257be --- /dev/null +++ b/dist-browser/utils.d.ts @@ -0,0 +1,2 @@ +export declare const base32Encode: (payload: string | Uint8Array) => any; +export declare const getValueOrFirstEntry: (value: unknown | unknown[]) => any; diff --git a/dist-demo/demo/add-default-route.js b/dist-demo/demo/add-default-route.js new file mode 100644 index 0000000..34d509e --- /dev/null +++ b/dist-demo/demo/add-default-route.js @@ -0,0 +1,6 @@ +document.addEventListener("DOMContentLoaded", () => { + // add default #overview route + if (!window.location.hash) { + window.location.hash = "overview"; + } +}); diff --git a/dist-demo/demo/external-links.js b/dist-demo/demo/external-links.js new file mode 100644 index 0000000..6c42ca4 --- /dev/null +++ b/dist-demo/demo/external-links.js @@ -0,0 +1,12 @@ +document.addEventListener("DOMContentLoaded", () => { + const currentHost = window.location.hostname; + + const links = document.querySelectorAll("a"); + + links.forEach((link) => { + if (link.hostname && link.hostname !== currentHost) { + link.setAttribute("target", "_blank"); + link.setAttribute("rel", "noopener noreferrer"); + } + }); +}); diff --git a/dist-demo/demo/format-source.js b/dist-demo/demo/format-source.js new file mode 100644 index 0000000..bd34285 --- /dev/null +++ b/dist-demo/demo/format-source.js @@ -0,0 +1,44 @@ +export default function formatSource(source, panelId) { + source = (source ?? "").trim(); + + if (!source || !panelId) return; + + const sourceSplit = source.split(/\r?\n/); + const spaceCount = sourceSplit[sourceSplit.length - 1].search(/\S/); + if (spaceCount <= 0) return; // empty string + + const trimRE = new RegExp(`^\\s{${spaceCount}}`); + + const preDom = document.createElement("pre"); + preDom.append(sourceSplit.map((val) => val.replace(trimRE, "")).join("\n")); + + preDom.innerHTML = preDom.innerHTML + // strRegEx must be applied first to prevent false positives + .replace(/\"[^"]+\"/g, (val) => + val !== '"module"' ? `${val}` : val, + ) + .replace(/\/\/.*/g, (val) => `${val}`) + .replace(/\`[^`]+\`/g, (val) => `${val}`) + .replace(/\.\w+/g, (val) => + val !== ".js" ? `${val}` : val, + ) + .replace( + /<\/?script[^&]*>/g, + (val) => `${val}`, + ); + + const sourceHTML = ` +
+ Source +
+
+ ${preDom.outerHTML} +
+
+
+ `.trim(); + + document + .getElementById(panelId) + .insertAdjacentHTML("beforeend", sourceHTML); +} diff --git a/dist-demo/demo/hashTwt-example-result.js b/dist-demo/demo/hashTwt-example-result.js new file mode 100644 index 0000000..0b4463a --- /dev/null +++ b/dist-demo/demo/hashTwt-example-result.js @@ -0,0 +1,63 @@ +import { hashTwt } from "/dist-browser/twtxt-lib.js"; + +let wasHashTwtResultAppended = false; + +const formHash = document.forms["formHash"]; +formHash.addEventListener("submit", (e) => { + e.preventDefault(); + const content = formHash.elements["content"].value; + const created = formHash.elements["created"].value; + const url = formHash.elements["url"].value; + const hash = hashTwt({ + content, + created, + url, + }); + + const result = [ + `content: ${content}`, + `created: ${created}`, + `url: ${url}`, + `hash: ${hash}`, + ].join("\n"); + + console.log((wasHashTwtResultAppended ? "\n" : "") + result); + + const resultHTML = result + .split("\n") + .map((line) => + line.replace( + // to color properties + /^\w+:/, + (val) => `${val}`, + ), + ) + .join("\n"); + + if (wasHashTwtResultAppended) { + document + .getElementById("preHashTwtResult") + .insertAdjacentHTML("afterbegin", resultHTML + "
\n"); + return; + } + + const resultsHTML = ` +
+ Results +
+
${resultHTML}
+
+
+ `.trim(); + + document + .getElementById("tabHashTwt-panel") + .insertAdjacentHTML("beforeend", resultsHTML); + + document + .querySelector("#tabHashTwt-panel .js-sourceDetails") + ?.removeAttribute("open"); + + document.body.classList.add("isLoaded"); + wasHashTwtResultAppended = true; +}); diff --git a/dist-demo/demo/hashTwt-example-source.js b/dist-demo/demo/hashTwt-example-source.js new file mode 100644 index 0000000..220a194 --- /dev/null +++ b/dist-demo/demo/hashTwt-example-source.js @@ -0,0 +1,40 @@ +import formatSource from "./format-source.js"; + +formatSource( + ` + \ + + + + + + + + + + + + + diff --git a/dist-demo/twtxt-demos/demo-hipster-twtxt.txt b/dist-demo/twtxt-demos/demo-hipster-twtxt.txt new file mode 100644 index 0000000..beb4982 --- /dev/null +++ b/dist-demo/twtxt-demos/demo-hipster-twtxt.txt @@ -0,0 +1,20 @@ +# nick = demo_hipster +# url = https://example.com/demo-hipster-twtxt.txt +# avatar = https://i.pravatar.cc/150?img=67 +# description = Kitsch ut post-ironic, bruh tilde non shabby chic iceland fixie consequat? +# +# follow = demo_hipster https://example.com/demo-hipster-twtxt.txt +# follow = demo_pirate https://example.org/~pirate/twtxt.txt +# follow = demo_sagan https://example.net/~saganos/twtxt.txt + +2025-06-02T18:47:01+01:00 Normcore tilde ad selfies, culpa cupping nostrud gatekeep aesthetic PBR&B 3 wolf moon mustache twee. +2025-07-05T00:17:46+02:00 Cardigan jean shorts eu 90's. Kitsch knausgaard culpa, marfa mumblecore portland raclette banjo retro exercitation pariatur snackwave williamsburg. +2025-07-05T19:35:33+03:00 Literally deep v snackwave nostrud pug YOLO yes plz anim. JOMO crucifix bespoke chambray lomo keytar, labore ipsum. +2025-08-05T22:46:11+04:00 Ut letterpress synth hoodie, wayfarers kitsch air plant eu selvage tilde taiyaki grailed cliche ex. Skateboard pariatur non leggings. +2025-08-08T13:49:20+05:00 Ad pug ex hashtag live-edge distillery affogato. Succulents hammock taiyaki biodiesel chartreuse, nulla you probably haven't heard of them four dollar toast quinoa keytar cornhole. +2025-09-09T12:48:04+05:00 Cardigan JOMO blackbird spyplane, whatever commodo pop-up normcore ad yr in eiusmod forage echo park exercitation +1. +2025-10-09T20:33:15+04:00 Culpa snackwave williamsburg, asymmetrical wolf microdosing literally. La croix coloring book jean shorts poutine, 3 wolf moon chicharrones hashtag chillwave affogato green juice. +2025-11-11T12:54:43+03:00 Kickstarter kale chips williamsburg swag sunt disrupt chartreuse jianbing banh mi craft beer anim vaporware readymade. +2025-12-05T17:15:28+02:00 Pinterest Brooklyn direct trade freegan. Health goth consequat bespoke ad hoodie in est ugh. IPhone typewriter lomo venmo. Hashtag chillwave hella lumbersexual in blackbird spyplane yr tbh. Yr waistcoat kogi est neutra hammock mollit. Drinking vinegar godard hell of occaecat direct trade. In 3 wolf moon jianbing bitters, roof party mixtape yuccie. +2026-01-01T11:32:39+01:00 Ethical twee swag, farm-to-table irure semiotics bodega boys umami sriracha stumptown cred four dollar toast tofu photo booth tbh. +2026-02-01T13:13:13+02:00 (#4f5dlsa) <@demo_pirate https://example.org/~pirate/twtxt.txt> Asymmetrical kombucha trust fund jawn gentrify sartorial cloud bread artisan live-edge. diff --git a/dist-demo/twtxt-demos/demo-pirate-twtxt.txt b/dist-demo/twtxt-demos/demo-pirate-twtxt.txt new file mode 100644 index 0000000..7fec88b --- /dev/null +++ b/dist-demo/twtxt-demos/demo-pirate-twtxt.txt @@ -0,0 +1,30 @@ +# nick = demo_pirate +# url = https://example.org/~pirate/twtxt.txt +# avatar = https://i.pravatar.cc/150?img=22 +# description = Drink up me hearties, yo ho! +# finger = demo_pirate@example.org +# link = Web https://example.org/~pirate/ +# link = Ship https://example.org/~pirate/vessel/ +# link = Profile https://example.org/~pirate/profile/ +# +# follow = demo_pirate https://example.org/~pirate/twtxt.txt +# follow = demo_hipster https://example.com/demo-hipster-twtxt.txt +# follow = demo_sagan https://example.net/~saganos/twtxt.txt +# +# following = 3 +# +2026-02-01T01:23:45Z Prow scuttle parley provost Sail ho shrouds spirits boom mizzenmast yardarm. +2026-02-02T02:24:36Z Swab barque interloper chantey doubloon starboard grog black jack gangway rutters. + +2026-02-03T10:48:44Z Pinnace holystone mizzenmast quarter crow's nest nipperkin grog yardarm hempen halter furl. +2026-02-04T11:54:12Z Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to. +2026-02-05T13:56:12Z Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. +2026-02-06T14:57:58Z Bring a spring upon her cable holystone blow the man down spanker Shiver me timbers to go on account lookout wherry doubloon chase. + +2026-02-07T13:58:56Z Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. +2026-02-08T14:26:54Z Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. +2026-02-09T15:01:53Z Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits. +2026-02-10T19:20:15Z Spyglass snow quarter wench cutlass coxswain scurvy landlubber or just lubber parley walk the plank. + +2026-02-11T19:34:20Z Barbary Coast transom broadside clap of thunder dead men tell no tales gangplank barque bilge rat brigantine list. +2026-02-12T13:17:54Z Prow swab tender case shot aye capstan brigantine loot bucko take a caulk. diff --git a/dist-demo/twtxt-demos/demo-sagan-twtxt.txt b/dist-demo/twtxt-demos/demo-sagan-twtxt.txt new file mode 100644 index 0000000..261e62f --- /dev/null +++ b/dist-demo/twtxt-demos/demo-sagan-twtxt.txt @@ -0,0 +1,30 @@ +# nick = demo_sagan +# url = https://example.net/~saganos/twtxt.txt +# avatar = https://i.pravatar.cc/150?img=69 +# description = Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit? +# finger = sagaan@example.net +# link = Web https://example.net/~saganos/ +# +# follow = demo_sagan https://example.net/~saganos/twtxt.txt +# follow = demo_pirate https://example.org/~pirate/twtxt.txt +# follow = demo_hipster https://example.com/demo-hipster-twtxt.txt +# +# following = 3 +# + +2026-02-05T23:17:47Z The ash of stellar alchemy permanence of the stars extraordinary claims require extraordinary evidence rings of Uranus vanquish the impossible encyclopaedia galactica? +2026-01-22T12:09:44Z Something incredible is waiting to be known another world hearts of the stars tendrils of gossamer clouds a still more glorious dawn awaits venture. +2026-01-10T13:44:37Z Dream of the mind's eye citizens of distant epochs a still more glorious dawn awaits preserve and cherish that pale blue dot hearts of the stars preserve and cherish that pale blue dot and billions upon billions upon billions upon billions upon billions upon billions upon billions. +2026-01-01T02:05:04Z With pretty stories for which there's little good evidence muse about a billion trillion globular star cluster inconspicuous motes of rock and gas dream of the mind's eye. +2025-12-19T20:34:01Z Emerged into consciousness the carbon in our apple pies a very small stage in a vast cosmic arena extraordinary claims require extraordinary evidence from which we spring a mote of dust suspended in a sunbeam. +2025-12-15T20:18:08Z Finite but unbounded kindling the energy hidden in matter from which we spring vastness is bearable only through love vastness is bearable only through love billions upon billions. +2025-12-11T18:54:56Z Venture emerged into consciousness Vangelis how far away rings of Uranus radio telescope. +2025-12-10T17:53:00Z A mote of dust suspended in a sunbeam concept of the number one made in the interiors of collapsing stars vastness is bearable only through love across the centuries inconspicuous motes of rock and gas. +2025-11-08T15:23:30Z The ash of stellar alchemy another world at the edge of forever kindling the energy hidden in matter bits of moving fluff star stuff harvesting star light. +2025-11-07T14:49:29Z Network of wormholes citizens of distant epochs a mote of dust suspended in a sunbeam hearts of the stars are creatures of the cosmos network of wormholes. +2025-11-03T14:06:39Z Ship of the imagination the carbon in our apple pies dream of the mind's eye concept of the number one science as a patch of light. +2025-11-02T14:25:45Z The sky calls to us of brilliant syntheses tingling of the spine a very small stage in a vast cosmic arena venture the only home we've ever known. +2025-11-01T13:46:45Z Across the centuries take root and flourish preserve and cherish that pale blue dot from which we spring great turbulent clouds muse about. +2025-10-25T12:58:20Z White dwarf a mote of dust suspended in a sunbeam muse about globular star cluster cosmic ocean circumnavigated. +2025-10-24T12:29:20Z Are creatures of the cosmos another world citizens of distant epochs courage of our questions are creatures of the cosmos venture. +2025-10-23T12:49:02Z Something incredible is waiting to be known the only home we've ever known courage of our questions hydrogen atoms vastness is bearable only through love a very small stage in a vast cosmic arena. diff --git a/dist-node/constants.d.ts b/dist-node/constants.d.ts new file mode 100644 index 0000000..90ef16e --- /dev/null +++ b/dist-node/constants.d.ts @@ -0,0 +1 @@ +export declare const __dirname: string; diff --git a/dist-node/hashTwt.d.ts b/dist-node/hashTwt.d.ts new file mode 100644 index 0000000..0a94d9c --- /dev/null +++ b/dist-node/hashTwt.d.ts @@ -0,0 +1,2 @@ +import { Twt } from './types.ts'; +export default function hashTwt(twt: Twt): string; diff --git a/dist-node/hashTwt.js b/dist-node/hashTwt.js new file mode 100644 index 0000000..ec01727 --- /dev/null +++ b/dist-node/hashTwt.js @@ -0,0 +1,41 @@ +import { Buffer } from "vite-plugin-node-polyfills/shims/buffer"; +import { blake2b } from "@exodus/blakejs"; +import { base32Encode } from "./utils.js"; +globalThis.Buffer = Buffer; +const dateRegex = /^(\d{4})-(\d{2})-(\d{2})([tT ])(\d{2}):(\d{2}):(\d{2})\.?(\d{3})?(?:(?:([+-]\d{2}):?(\d{2}))|Z)?$/; +const formatRFC3339 = (date) => { + const pad = (num = 0) => `${+num < 10 ? 0 : ""}${+num}`; + const padYear = (num = 0) => `${+num < 1e3 ? 0 : ""}${+num < 100 ? 0 : ""}${+num < 10 ? 0 : ""}${+num}`; + let m = dateRegex.exec(date); + if (m && m?.[9] === void 0) { + m[9] = "+00"; + } + if (m && m?.[10] === void 0) { + m[10] = "00"; + } + const offset = `${m?.[9]}:${m?.[10]}`.replace(/[+-]?00:00$/, "Z"); + return [ + padYear(m?.[1]), + "-", + pad(m?.[2]), + "-", + pad(m?.[3]), + m?.[4], + pad(m?.[5]), + ":", + pad(m?.[6]), + ":", + pad(m?.[7]), + //ignore milliseconds (m[8]) + offset + ].join(""); +}; +function hashTwt(twt) { + const created = formatRFC3339(twt.created); + const payload = [twt.url, created, twt.content].join("\n"); + return base32Encode(blake2b(payload, void 0, 32)).toLowerCase().slice(-7); +} +export { + hashTwt as default +}; +//# sourceMappingURL=hashTwt.js.map diff --git a/dist-node/hashTwt.js.map b/dist-node/hashTwt.js.map new file mode 100644 index 0000000..71af87a --- /dev/null +++ b/dist-node/hashTwt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hashTwt.js","sources":["../src/hashTwt.ts"],"sourcesContent":["import { Buffer } from \"buffer\";\nglobalThis.Buffer = Buffer;\n\nimport type { Twt } from \"./types.ts\";\n\nimport { blake2b } from \"@exodus/blakejs\";\n\nimport { base32Encode } from \"./utils.ts\";\n\nconst dateRegex =\n\t/^(\\d{4})-(\\d{2})-(\\d{2})([tT ])(\\d{2}):(\\d{2}):(\\d{2})\\.?(\\d{3})?(?:(?:([+-]\\d{2}):?(\\d{2}))|Z)?$/;\n\nconst formatRFC3339 = (date: string) => {\n\tconst pad = (num: number | string = 0) => `${+num < 10 ? 0 : \"\"}${+num}`;\n\tconst padYear = (num: number | string = 0) =>\n\t\t`${+num < 1000 ? 0 : \"\"}${+num < 100 ? 0 : \"\"}${\n\t\t\t+num < 10 ? 0 : \"\"\n\t\t}${+num}`;\n\n\tlet m = dateRegex.exec(date);\n\n\t//if timezone is undefined, it must be Z or nothing (otherwise the group would have captured).\n\tif (m && m?.[9] === undefined) {\n\t\t//Use UTC.\n\t\tm[9] = \"+00\";\n\t}\n\tif (m && m?.[10] === undefined) {\n\t\tm[10] = \"00\";\n\t}\n\n\tconst offset = `${m?.[9]}:${m?.[10]}`.replace(/[+-]?00:00$/, \"Z\");\n\n\treturn [\n\t\tpadYear(m?.[1]),\n\t\t\"-\",\n\t\tpad(m?.[2]),\n\t\t\"-\",\n\t\tpad(m?.[3]),\n\t\tm?.[4],\n\t\tpad(m?.[5]),\n\t\t\":\",\n\t\tpad(m?.[6]),\n\t\t\":\",\n\t\tpad(m?.[7]),\n\t\t//ignore milliseconds (m[8])\n\t\toffset,\n\t].join(\"\");\n};\n\nexport default function hashTwt(twt: Twt): string {\n\tconst created = formatRFC3339(twt.created);\n\tconst payload = [twt.url, created, twt.content].join(\"\\n\");\n\n\treturn base32Encode(blake2b(payload, undefined, 32))\n\t\t.toLowerCase()\n\t\t.slice(-7);\n}\n"],"names":[],"mappings":";;;AACA,WAAW,SAAS;AAQpB,MAAM,YACL;AAED,MAAM,gBAAgB,CAAC,SAAiB;AACvC,QAAM,MAAM,CAAC,MAAuB,MAAM,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE,GAAG,CAAC,GAAG;AACtE,QAAM,UAAU,CAAC,MAAuB,MACvC,GAAG,CAAC,MAAM,MAAO,IAAI,EAAE,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,GAC5C,CAAC,MAAM,KAAK,IAAI,EACjB,GAAG,CAAC,GAAG;AAER,MAAI,IAAI,UAAU,KAAK,IAAI;AAG3B,MAAI,KAAK,IAAI,CAAC,MAAM,QAAW;AAE9B,MAAE,CAAC,IAAI;AAAA,EACR;AACA,MAAI,KAAK,IAAI,EAAE,MAAM,QAAW;AAC/B,MAAE,EAAE,IAAI;AAAA,EACT;AAEA,QAAM,SAAS,GAAG,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,QAAQ,eAAe,GAAG;AAEhE,SAAO;AAAA,IACN,QAAQ,IAAI,CAAC,CAAC;AAAA,IACd;AAAA,IACA,IAAI,IAAI,CAAC,CAAC;AAAA,IACV;AAAA,IACA,IAAI,IAAI,CAAC,CAAC;AAAA,IACV,IAAI,CAAC;AAAA,IACL,IAAI,IAAI,CAAC,CAAC;AAAA,IACV;AAAA,IACA,IAAI,IAAI,CAAC,CAAC;AAAA,IACV;AAAA,IACA,IAAI,IAAI,CAAC,CAAC;AAAA;AAAA,IAEV;AAAA,EAAA,EACC,KAAK,EAAE;AACV;AAEA,SAAwB,QAAQ,KAAkB;AACjD,QAAM,UAAU,cAAc,IAAI,OAAO;AACzC,QAAM,UAAU,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,EAAE,KAAK,IAAI;AAEzD,SAAO,aAAa,QAAQ,SAAS,QAAW,EAAE,CAAC,EACjD,YAAA,EACA,MAAM,EAAE;AACX;"} \ No newline at end of file diff --git a/dist-node/index.d.ts b/dist-node/index.d.ts new file mode 100644 index 0000000..d5d613c --- /dev/null +++ b/dist-node/index.d.ts @@ -0,0 +1,5 @@ +export type * from './types.ts'; +export { default as hashTwt } from './hashTwt.ts'; +export { default as loadAndParseTwtxtFile } from './loadAndParseTwtxt.ts'; +export { default as parseTwtxt } from './parseTwtxt.ts'; +export { base32Encode } from './utils.ts'; diff --git a/dist-node/index.js b/dist-node/index.js new file mode 100644 index 0000000..8f9eb15 --- /dev/null +++ b/dist-node/index.js @@ -0,0 +1,13 @@ +// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt +import { default as default2 } from "./hashTwt.js"; +import { default as default3 } from "./loadAndParseTwtxt.js"; +import { default as default4 } from "./parseTwtxt.js"; +import { base32Encode } from "./utils.js"; +export { + base32Encode, + default2 as hashTwt, + default3 as loadAndParseTwtxtFile, + default4 as parseTwtxt +}; +//# sourceMappingURL=index.js.map +// @license-end diff --git a/dist-node/index.js.map b/dist-node/index.js.map new file mode 100644 index 0000000..7f6f626 --- /dev/null +++ b/dist-node/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"} \ No newline at end of file diff --git a/dist-node/loadAndParseTwtxt.d.ts b/dist-node/loadAndParseTwtxt.d.ts new file mode 100644 index 0000000..02f5208 --- /dev/null +++ b/dist-node/loadAndParseTwtxt.d.ts @@ -0,0 +1,14 @@ +export default function loadAndParseTwtxtFile(url?: string): Promise<{ + lastModified: string; + following: import('./types.ts').Twttr[]; + metadata: import('./types.ts').Metadata; + twts: { + content: string; + created: string; + createdUTC: string; + hash: string; + replyHash: string | undefined; + replyNick: string | undefined; + replyUrl: string | undefined; + }[]; +}>; diff --git a/dist-node/loadAndParseTwtxt.js b/dist-node/loadAndParseTwtxt.js new file mode 100644 index 0000000..c8c0162 --- /dev/null +++ b/dist-node/loadAndParseTwtxt.js @@ -0,0 +1,23 @@ +import dayjs from "dayjs"; +import parseTwtxt from "./parseTwtxt.js"; +async function loadAndParseTwtxtFile(url = "") { + if (!url) throw new Error("URL is required"); + try { + const response = await fetch(url); + const twtxtFile = await response.text(); + const lastModified = dayjs( + response.headers.get("Last-Modified") + ).toISOString(); + return { + ...parseTwtxt(twtxtFile), + lastModified + }; + } catch (err) { + console.error(err); + throw err; + } +} +export { + loadAndParseTwtxtFile as default +}; +//# sourceMappingURL=loadAndParseTwtxt.js.map diff --git a/dist-node/loadAndParseTwtxt.js.map b/dist-node/loadAndParseTwtxt.js.map new file mode 100644 index 0000000..0b2c74e --- /dev/null +++ b/dist-node/loadAndParseTwtxt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loadAndParseTwtxt.js","sources":["../src/loadAndParseTwtxt.ts"],"sourcesContent":["import dayjs from \"dayjs\";\n\nimport parseTwtxt from \"./parseTwtxt.js\";\n\nexport default async function loadAndParseTwtxtFile(url = \"\") {\n\tif (!url) throw new Error(\"URL is required\");\n\n\ttry {\n\t\tconst response = await fetch(url);\n\t\tconst twtxtFile = await response.text();\n\t\tconst lastModified = dayjs(\n\t\t\tresponse.headers.get(\"Last-Modified\"),\n\t\t).toISOString();\n\n\t\treturn {\n\t\t\t...parseTwtxt(twtxtFile),\n\t\t\tlastModified,\n\t\t};\n\t} catch (err) {\n\t\tconsole.error(err);\n\t\tthrow err;\n\t}\n}\n"],"names":[],"mappings":";;AAIA,eAA8B,sBAAsB,MAAM,IAAI;AAC7D,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,iBAAiB;AAE3C,MAAI;AACH,UAAM,WAAW,MAAM,MAAM,GAAG;AAChC,UAAM,YAAY,MAAM,SAAS,KAAA;AACjC,UAAM,eAAe;AAAA,MACpB,SAAS,QAAQ,IAAI,eAAe;AAAA,IAAA,EACnC,YAAA;AAEF,WAAO;AAAA,MACN,GAAG,WAAW,SAAS;AAAA,MACvB;AAAA,IAAA;AAAA,EAEF,SAAS,KAAK;AACb,YAAQ,MAAM,GAAG;AACjB,UAAM;AAAA,EACP;AACD;"} \ No newline at end of file diff --git a/dist-node/parseTwtxt.d.ts b/dist-node/parseTwtxt.d.ts new file mode 100644 index 0000000..9b0a8a6 --- /dev/null +++ b/dist-node/parseTwtxt.d.ts @@ -0,0 +1,18 @@ +import { Metadata, Twttr } from './types.ts'; +/** + * @param twtxt + * @returns object containing: following, metadata, twts + */ +export default function parseTwtxt(twtxt: string): { + following: Twttr[]; + metadata: Metadata; + twts: { + content: string; + created: string; + createdUTC: string; + hash: string; + replyHash: string | undefined; + replyNick: string | undefined; + replyUrl: string | undefined; + }[]; +}; diff --git a/dist-node/parseTwtxt.js b/dist-node/parseTwtxt.js new file mode 100644 index 0000000..af05cb6 --- /dev/null +++ b/dist-node/parseTwtxt.js @@ -0,0 +1,83 @@ +import dayjs from "dayjs"; +import utc from "dayjs/plugin/utc.js"; +import hashTwt from "./hashTwt.js"; +import { getValueOrFirstEntry } from "./utils.js"; +dayjs.extend(utc); +function parseTwtxt(twtxt) { + const allLines = twtxt.split("\n"); + const { commentLines = [], contentLines = [] } = allLines.reduce( + (acc, originalLine) => { + const line = originalLine.trim(); + if (line === "") return acc; + if (line.startsWith("#")) acc.commentLines.push(line); + else acc.contentLines.push(line); + return acc; + }, + { + commentLines: [], + contentLines: [] + } + ); + const { following = [], metadata = {} } = commentLines.filter((line) => line.includes("=")).reduce( + (acc, line) => { + const [key, ...vals] = line.substring(1).split("=").map((field) => field.trim()); + const val = vals.join("="); + if (key === "follow") { + const [nick, url] = val.trim().split(/\s+/); + acc.following.push({ nick, url }); + } else { + if (acc.metadata[key]) { + if (!Array.isArray(acc.metadata[key])) + acc.metadata[key] = [acc.metadata[key], val]; + else acc.metadata[key].push(val); + } else acc.metadata[key] = val; + } + return acc; + }, + { + following: [], + metadata: {} + } + ); + const replyRegEx = /\(#([\w]+)\) (\<\@(\S+) ([^>]+)>)*/; + const twts = contentLines.map((line) => { + const [created, content] = line.split(/\t/).map((val) => val.trim()); + if (typeof content === "undefined") + throw new Error(`Content is undefined: ${line}`); + const createdDayjs = dayjs.utc(created); + if (!createdDayjs.isValid()) + throw new Error(`Date is invalid: ${line}`); + const createdUTC = createdDayjs.toISOString(); + const replyMatches = replyRegEx.exec(content); + let replyHash, replyNick, replyUrl; + if (replyMatches?.length) { + replyHash = replyMatches?.[1]; + replyNick = replyMatches?.[3]; + replyUrl = replyMatches?.[4]; + } + const hash = hashTwt({ + content, + created, + createdUTC, + url: getValueOrFirstEntry(metadata?.url ?? "") + }); + return { + content, + created, + createdUTC, + hash, + replyHash, + replyNick, + replyUrl + }; + }).sort((a, b) => dayjs(a.created).diff(dayjs(b.created))); + return { + following, + metadata, + twts + }; +} +export { + parseTwtxt as default +}; +//# sourceMappingURL=parseTwtxt.js.map diff --git a/dist-node/parseTwtxt.js.map b/dist-node/parseTwtxt.js.map new file mode 100644 index 0000000..ac5a960 --- /dev/null +++ b/dist-node/parseTwtxt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseTwtxt.js","sources":["../src/parseTwtxt.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc.js\";\n\nimport type { Metadata, Twttr } from \"./types.ts\";\n\nimport hashTwt from \"./hashTwt.js\";\nimport { getValueOrFirstEntry } from \"./utils.ts\";\n\ndayjs.extend(utc);\n\n/**\n * @param twtxt\n * @returns object containing: following, metadata, twts\n */\nexport default function parseTwtxt(twtxt: string) {\n\tconst allLines = twtxt.split(\"\\n\");\n\n\tconst { commentLines = [], contentLines = [] } = allLines.reduce(\n\t\t(\n\t\t\tacc: {\n\t\t\t\tcommentLines: string[];\n\t\t\t\tcontentLines: string[];\n\t\t\t},\n\t\t\toriginalLine,\n\t\t) => {\n\t\t\tconst line = originalLine.trim();\n\t\t\tif (line === \"\") return acc;\n\n\t\t\tif (line.startsWith(\"#\")) acc.commentLines.push(line);\n\t\t\telse acc.contentLines.push(line);\n\t\t\treturn acc;\n\t\t},\n\t\t{\n\t\t\tcommentLines: [],\n\t\t\tcontentLines: [],\n\t\t},\n\t);\n\n\tconst { following = [], metadata = {} } = commentLines\n\t\t.filter((line) => line.includes(\"=\"))\n\t\t.reduce(\n\t\t\t(\n\t\t\t\tacc: {\n\t\t\t\t\tfollowing: Twttr[];\n\t\t\t\t\tmetadata: Metadata;\n\t\t\t\t},\n\t\t\t\tline,\n\t\t\t) => {\n\t\t\t\tconst [key, ...vals] = line\n\t\t\t\t\t// remove #\n\t\t\t\t\t.substring(1)\n\t\t\t\t\t.split(\"=\")\n\t\t\t\t\t.map((field) => field.trim());\n\t\t\t\tconst val = vals.join(\"=\");\n\t\t\t\tif (key === \"follow\") {\n\t\t\t\t\tconst [nick, url] = val.trim().split(/\\s+/);\n\t\t\t\t\tacc.following.push({ nick, url });\n\t\t\t\t} else {\n\t\t\t\t\tif (acc.metadata[key]) {\n\t\t\t\t\t\tif (!Array.isArray(acc.metadata[key]))\n\t\t\t\t\t\t\tacc.metadata[key] = [acc.metadata[key], val];\n\t\t\t\t\t\telse acc.metadata[key].push(val);\n\t\t\t\t\t} else acc.metadata[key] = val;\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{\n\t\t\t\tfollowing: [],\n\t\t\t\tmetadata: {},\n\t\t\t},\n\t\t);\n\n\tconst replyRegEx = /\\(#([\\w]+)\\) (\\<\\@(\\S+) ([^>]+)>)*/;\n\n\tconst twts = contentLines\n\t\t.map((line) => {\n\t\t\tconst [created, content] = line\n\t\t\t\t.split(/\\t/)\n\t\t\t\t.map((val) => val.trim());\n\n\t\t\tif (typeof content === \"undefined\")\n\t\t\t\tthrow new Error(`Content is undefined: ${line}`);\n\n\t\t\tconst createdDayjs = dayjs.utc(created);\n\t\t\tif (!createdDayjs.isValid())\n\t\t\t\tthrow new Error(`Date is invalid: ${line}`);\n\n\t\t\tconst createdUTC = createdDayjs.toISOString();\n\n\t\t\tconst replyMatches = replyRegEx.exec(content);\n\t\t\tlet replyHash, replyNick, replyUrl;\n\n\t\t\tif (replyMatches?.length) {\n\t\t\t\treplyHash = replyMatches?.[1];\n\t\t\t\treplyNick = replyMatches?.[3];\n\t\t\t\treplyUrl = replyMatches?.[4];\n\t\t\t}\n\n\t\t\tconst hash = hashTwt({\n\t\t\t\tcontent,\n\t\t\t\tcreated,\n\t\t\t\tcreatedUTC,\n\t\t\t\turl: getValueOrFirstEntry(metadata?.url ?? \"\"),\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tcontent,\n\t\t\t\tcreated,\n\t\t\t\tcreatedUTC,\n\t\t\t\thash,\n\t\t\t\treplyHash,\n\t\t\t\treplyNick,\n\t\t\t\treplyUrl,\n\t\t\t};\n\t\t})\n\t\t.sort((a, b) => dayjs(a.created).diff(dayjs(b.created)));\n\n\treturn {\n\t\tfollowing,\n\t\tmetadata,\n\t\ttwts,\n\t};\n}\n"],"names":[],"mappings":";;;;AAQA,MAAM,OAAO,GAAG;AAMhB,SAAwB,WAAW,OAAe;AACjD,QAAM,WAAW,MAAM,MAAM,IAAI;AAEjC,QAAM,EAAE,eAAe,CAAA,GAAI,eAAe,CAAA,EAAC,IAAM,SAAS;AAAA,IACzD,CACC,KAIA,iBACI;AACJ,YAAM,OAAO,aAAa,KAAA;AAC1B,UAAI,SAAS,GAAI,QAAO;AAExB,UAAI,KAAK,WAAW,GAAG,EAAG,KAAI,aAAa,KAAK,IAAI;AAAA,UAC/C,KAAI,aAAa,KAAK,IAAI;AAC/B,aAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC,cAAc,CAAA;AAAA,MACd,cAAc,CAAA;AAAA,IAAC;AAAA,EAChB;AAGD,QAAM,EAAE,YAAY,CAAA,GAAI,WAAW,CAAA,EAAC,IAAM,aACxC,OAAO,CAAC,SAAS,KAAK,SAAS,GAAG,CAAC,EACnC;AAAA,IACA,CACC,KAIA,SACI;AACJ,YAAM,CAAC,KAAK,GAAG,IAAI,IAAI,KAErB,UAAU,CAAC,EACX,MAAM,GAAG,EACT,IAAI,CAAC,UAAU,MAAM,MAAM;AAC7B,YAAM,MAAM,KAAK,KAAK,GAAG;AACzB,UAAI,QAAQ,UAAU;AACrB,cAAM,CAAC,MAAM,GAAG,IAAI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AAC,EACA,KAAK,CAAC,GAAG,MAAM,MAAM,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEF;"} \ No newline at end of file diff --git a/dist-node/types.d.ts b/dist-node/types.d.ts new file mode 100644 index 0000000..621a657 --- /dev/null +++ b/dist-node/types.d.ts @@ -0,0 +1,31 @@ +export interface LoadAndParseTwtxtWithCacheConfig { + cacheKeyPrefix: string; + onLoad?: (data: Twtxt) => void; + user?: Twttr; +} +export interface Metadata { + [key: string]: string | string[]; +} +export interface Twt { + avatar?: string; + content: string; + created: string; + createdUTC: string; + hash?: string; + nick?: string; + noDom?: boolean; + replyHash?: string; + replyNick?: string; + replyUrl?: string; + url?: string; +} +export interface Twttr { + avatar?: string; + nick: string; + url: string; +} +export interface Twtxt { + following: Twttr[]; + metadata: Metadata; + twts: Twt[]; +} diff --git a/dist-node/utils.d.ts b/dist-node/utils.d.ts new file mode 100644 index 0000000..ae257be --- /dev/null +++ b/dist-node/utils.d.ts @@ -0,0 +1,2 @@ +export declare const base32Encode: (payload: string | Uint8Array) => any; +export declare const getValueOrFirstEntry: (value: unknown | unknown[]) => any; diff --git a/dist-node/utils.js b/dist-node/utils.js new file mode 100644 index 0000000..713c91b --- /dev/null +++ b/dist-node/utils.js @@ -0,0 +1,11 @@ +import base32 from "base32.js"; +const base32Encode = (payload) => { + const encoder = new base32.Encoder({ type: "rfc4648" }); + return encoder.write(payload).finalize(); +}; +const getValueOrFirstEntry = (value) => Array.isArray(value) && value.length ? value[0] : value; +export { + base32Encode, + getValueOrFirstEntry +}; +//# sourceMappingURL=utils.js.map diff --git a/dist-node/utils.js.map b/dist-node/utils.js.map new file mode 100644 index 0000000..22472af --- /dev/null +++ b/dist-node/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import base32 from \"base32.js\";\n\nexport const base32Encode = (payload: string | Uint8Array) => {\n\tconst encoder = new base32.Encoder({ type: \"rfc4648\" });\n\treturn encoder.write(payload).finalize();\n};\n\nexport const getValueOrFirstEntry = (value: unknown | unknown[]) =>\n\tArray.isArray(value) && value.length ? value[0] : value;\n"],"names":[],"mappings":";AAEO,MAAM,eAAe,CAAC,YAAkD;AAC9E,QAAM,UAAU,IAAI,OAAO,QAAQ,EAAE,MAAM,WAAW;AACtD,SAAO,QAAQ,MAAM,OAAO,EAAE,SAAA;AAC/B;AAEO,MAAM,uBAAuB,CAAC,UACpC,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,MAAM,CAAC,IAAI;"} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..9b52c7f --- /dev/null +++ b/index.html @@ -0,0 +1,297 @@ + + + + + + twtxt-lib Demo + + + + +
    +
  • + Overview +
    +

    twtxt-lib

    +

    + An isomorphic TypeScript library of + utility functions for parsing and interacting with + twtxt.txt files. +

    + +

    These functions include:

    + +
      +
    • hashTwt: takes the constituent parts of a + “twt” and generates an + extension-compatible + hash for it.
    • +
    • parseTwtxt: parses a twtxt file string, + returning an object with information about the file and its owner + (including hashes + for each twt and any + metadata in the + file).
    • +
    • loadAndParseTwtxtFile: fetches a + twtxt file from the internet and parses it into an object (as + above).
    • +
    + +

    Features

    + + + +

    Installation

    + +

    + Browser +

      +
    • Download library (or + minified version).
    • +
    • Import desired function(s) into your project: `import { hashTwt, loadAndParseTwtxtFile } from "./twtxt-lib.js"`
    • +
    +

    +

    + JSR +

      +
    • Coming soon
    • +
    +

    +

    + NPM +

      +
    • Coming soon
    • +
    +

    + +

    Use the tabs to learn more.

    + +
    + +
    +

    + Example parsed file from + + /twtxt-demos/demo-hipster-twtxt.txt : +

    + +
    + +
    +
  • + +
  • + hashTwt +
    +

    + A function that takes the constituent parts of a “twt” and + generates an + extension-compatible hash + for it. +

    +
    +
    +
    + + +
    +
    + + + +
    +
    +
    +
    +
  • + +
  • + parseTwtxt +
    +

    + A function that parses a twtxt file string, + returning an object with information about the file and its owner + (including hashes + for each twt and any + metadata in the + file). +

    + +

    Pre-included examples:

    +
      +
    • + /twtxt-demos/demo-hipster-twtxt.txt + +
    • +
    • + /twtxt-demos/demo-pirate-twtxt.txt + +
    • +
    • + /twtxt-demos/demo-sagan-twtxt.txt + +
    • +
    +

    + Note that CORS restrictions may limit the + effectiveness of using this function from another + domain. +

    + +
    +
    +
    + + + +
    +
    +
    +
    +
  • + +
  • + loadAndParseTwtxtFile +
    +

    + An async function that fetches a twtxt.txt-compatible file + from a URL and parses it into an object +

    +

    Pre-included examples:

    +
      +
    • + /twtxt-demos/demo-hipster-twtxt.txt + +
    • +
    • + /twtxt-demos/demo-pirate-twtxt.txt + +
    • +
    • + /twtxt-demos/demo-sagan-twtxt.txt + +
    • +
    +

    + Note that CORS restrictions may limit the + effectiveness of using this function from another + domain. +

    + +
    +
    +
    + + + +
    +
    +
    +
    +
  • +
+ + + + + + + + + + + + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..d541997 --- /dev/null +++ b/package.json @@ -0,0 +1,44 @@ +{ + "name": "twtxt-lib", + "version": "0.9.0", + "description": "", + "license": "MIT", + "exports": { + ".": { + "import": "./dist-node/index.js" + } + }, + "type": "module", + "files": [ + "dist-node" + ], + "module": "./dist-node/index.js", + "types": "./dist-node/index.d.ts", + "scripts": { + "build:dev": "BUILD_ENV=development node ./build.js", + "build": "BUILD_ENV=production node ./build.js", + "build-tsc": "tsc", + "ci": "yarn build:release", + "dev": "vite", + "preview": "vite preview", + "prepublishOnly": "yarn build", + "postpublish": "git push && git push --tags", + "test": "vitest" + }, + "devDependencies": { + "@types/node": "^25.3.0", + "prettier": "^3.8.1", + "typescript": "^5.9.3", + "unplugin-dts": "1.0.0-beta.6", + "vite": "^7.3.1", + "vite-plugin-no-bundle": "^4.0.0", + "vite-plugin-node-polyfills": "^0.25.0", + "vitest": "^4.0.18" + }, + "packageManager": "yarn@4.12.0", + "dependencies": { + "@exodus/blakejs": "^1.1.1-exodus.0", + "base32.js": "^0.1.0", + "dayjs": "^1.11.19" + } +} diff --git a/public/demo/add-default-route.js b/public/demo/add-default-route.js new file mode 100644 index 0000000..34d509e --- /dev/null +++ b/public/demo/add-default-route.js @@ -0,0 +1,6 @@ +document.addEventListener("DOMContentLoaded", () => { + // add default #overview route + if (!window.location.hash) { + window.location.hash = "overview"; + } +}); diff --git a/public/demo/external-links.js b/public/demo/external-links.js new file mode 100644 index 0000000..6c42ca4 --- /dev/null +++ b/public/demo/external-links.js @@ -0,0 +1,12 @@ +document.addEventListener("DOMContentLoaded", () => { + const currentHost = window.location.hostname; + + const links = document.querySelectorAll("a"); + + links.forEach((link) => { + if (link.hostname && link.hostname !== currentHost) { + link.setAttribute("target", "_blank"); + link.setAttribute("rel", "noopener noreferrer"); + } + }); +}); diff --git a/public/demo/format-source.js b/public/demo/format-source.js new file mode 100644 index 0000000..bd34285 --- /dev/null +++ b/public/demo/format-source.js @@ -0,0 +1,44 @@ +export default function formatSource(source, panelId) { + source = (source ?? "").trim(); + + if (!source || !panelId) return; + + const sourceSplit = source.split(/\r?\n/); + const spaceCount = sourceSplit[sourceSplit.length - 1].search(/\S/); + if (spaceCount <= 0) return; // empty string + + const trimRE = new RegExp(`^\\s{${spaceCount}}`); + + const preDom = document.createElement("pre"); + preDom.append(sourceSplit.map((val) => val.replace(trimRE, "")).join("\n")); + + preDom.innerHTML = preDom.innerHTML + // strRegEx must be applied first to prevent false positives + .replace(/\"[^"]+\"/g, (val) => + val !== '"module"' ? `${val}` : val, + ) + .replace(/\/\/.*/g, (val) => `${val}`) + .replace(/\`[^`]+\`/g, (val) => `${val}`) + .replace(/\.\w+/g, (val) => + val !== ".js" ? `${val}` : val, + ) + .replace( + /<\/?script[^&]*>/g, + (val) => `${val}`, + ); + + const sourceHTML = ` +
+ Source +
+
+ ${preDom.outerHTML} +
+
+
+ `.trim(); + + document + .getElementById(panelId) + .insertAdjacentHTML("beforeend", sourceHTML); +} diff --git a/public/demo/hashTwt-example-result.js b/public/demo/hashTwt-example-result.js new file mode 100644 index 0000000..0b4463a --- /dev/null +++ b/public/demo/hashTwt-example-result.js @@ -0,0 +1,63 @@ +import { hashTwt } from "/dist-browser/twtxt-lib.js"; + +let wasHashTwtResultAppended = false; + +const formHash = document.forms["formHash"]; +formHash.addEventListener("submit", (e) => { + e.preventDefault(); + const content = formHash.elements["content"].value; + const created = formHash.elements["created"].value; + const url = formHash.elements["url"].value; + const hash = hashTwt({ + content, + created, + url, + }); + + const result = [ + `content: ${content}`, + `created: ${created}`, + `url: ${url}`, + `hash: ${hash}`, + ].join("\n"); + + console.log((wasHashTwtResultAppended ? "\n" : "") + result); + + const resultHTML = result + .split("\n") + .map((line) => + line.replace( + // to color properties + /^\w+:/, + (val) => `${val}`, + ), + ) + .join("\n"); + + if (wasHashTwtResultAppended) { + document + .getElementById("preHashTwtResult") + .insertAdjacentHTML("afterbegin", resultHTML + "
\n"); + return; + } + + const resultsHTML = ` +
+ Results +
+
${resultHTML}
+
+
+ `.trim(); + + document + .getElementById("tabHashTwt-panel") + .insertAdjacentHTML("beforeend", resultsHTML); + + document + .querySelector("#tabHashTwt-panel .js-sourceDetails") + ?.removeAttribute("open"); + + document.body.classList.add("isLoaded"); + wasHashTwtResultAppended = true; +}); diff --git a/public/demo/hashTwt-example-source.js b/public/demo/hashTwt-example-source.js new file mode 100644 index 0000000..220a194 --- /dev/null +++ b/public/demo/hashTwt-example-source.js @@ -0,0 +1,40 @@ +import formatSource from "./format-source.js"; + +formatSource( + ` + \