aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/nanoid
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-13 21:34:48 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-13 21:34:48 -0800
commit76cb9c2a39d477a64824a985ade40507e3bbade1 (patch)
tree41e997aa9c6f538d3a136af61dae9424db2005a9 /vanilla/node_modules/nanoid
parent819a39a21ac992b1393244a4c283bbb125208c69 (diff)
downloadneko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.gz
neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.bz2
neko-76cb9c2a39d477a64824a985ade40507e3bbade1.zip
feat(vanilla): add testing infrastructure and tests (NK-wjnczv)
Diffstat (limited to 'vanilla/node_modules/nanoid')
-rw-r--r--vanilla/node_modules/nanoid/LICENSE20
-rw-r--r--vanilla/node_modules/nanoid/README.md39
-rw-r--r--vanilla/node_modules/nanoid/async/index.browser.cjs69
-rw-r--r--vanilla/node_modules/nanoid/async/index.browser.js34
-rw-r--r--vanilla/node_modules/nanoid/async/index.cjs71
-rw-r--r--vanilla/node_modules/nanoid/async/index.d.ts56
-rw-r--r--vanilla/node_modules/nanoid/async/index.js35
-rw-r--r--vanilla/node_modules/nanoid/async/index.native.js26
-rw-r--r--vanilla/node_modules/nanoid/async/package.json12
-rwxr-xr-xvanilla/node_modules/nanoid/bin/nanoid.cjs55
-rw-r--r--vanilla/node_modules/nanoid/index.browser.cjs72
-rw-r--r--vanilla/node_modules/nanoid/index.browser.js34
-rw-r--r--vanilla/node_modules/nanoid/index.cjs85
-rw-r--r--vanilla/node_modules/nanoid/index.d.cts91
-rw-r--r--vanilla/node_modules/nanoid/index.d.ts91
-rw-r--r--vanilla/node_modules/nanoid/index.js45
-rw-r--r--vanilla/node_modules/nanoid/nanoid.js1
-rw-r--r--vanilla/node_modules/nanoid/non-secure/index.cjs34
-rw-r--r--vanilla/node_modules/nanoid/non-secure/index.d.ts33
-rw-r--r--vanilla/node_modules/nanoid/non-secure/index.js21
-rw-r--r--vanilla/node_modules/nanoid/non-secure/package.json6
-rw-r--r--vanilla/node_modules/nanoid/package.json89
-rw-r--r--vanilla/node_modules/nanoid/url-alphabet/index.cjs7
-rw-r--r--vanilla/node_modules/nanoid/url-alphabet/index.js3
-rw-r--r--vanilla/node_modules/nanoid/url-alphabet/package.json6
25 files changed, 1035 insertions, 0 deletions
diff --git a/vanilla/node_modules/nanoid/LICENSE b/vanilla/node_modules/nanoid/LICENSE
new file mode 100644
index 0000000..37f56aa
--- /dev/null
+++ b/vanilla/node_modules/nanoid/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright 2017 Andrey Sitnik <andrey@sitnik.ru>
+
+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/vanilla/node_modules/nanoid/README.md b/vanilla/node_modules/nanoid/README.md
new file mode 100644
index 0000000..35abb57
--- /dev/null
+++ b/vanilla/node_modules/nanoid/README.md
@@ -0,0 +1,39 @@
+# Nano ID
+
+<img src="https://ai.github.io/nanoid/logo.svg" align="right"
+ alt="Nano ID logo by Anton Lovchikov" width="180" height="94">
+
+**English** | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md)
+
+A tiny, secure, URL-friendly, unique string ID generator for JavaScript.
+
+> “An amazing level of senseless perfectionism,
+> which is simply impossible not to respect.”
+
+* **Small.** 130 bytes (minified and gzipped). No dependencies.
+ [Size Limit] controls the size.
+* **Fast.** It is 2 times faster than UUID.
+* **Safe.** It uses hardware random generator. Can be used in clusters.
+* **Short IDs.** It uses a larger alphabet than UUID (`A-Za-z0-9_-`).
+ So ID size was reduced from 36 to 21 symbols.
+* **Portable.** Nano ID was ported
+ to [20 programming languages](#other-programming-languages).
+
+```js
+import { nanoid } from 'nanoid'
+model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"
+```
+
+Supports modern browsers, IE [with Babel], Node.js and React Native.
+
+[online tool]: https://gitpod.io/#https://github.com/ai/nanoid/
+[with Babel]: https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/
+[Size Limit]: https://github.com/ai/size-limit
+
+<a href="https://evilmartians.com/?utm_source=nanoid">
+ <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
+ alt="Sponsored by Evil Martians" width="236" height="54">
+</a>
+
+## Docs
+Read full docs **[here](https://github.com/ai/nanoid#readme)**.
diff --git a/vanilla/node_modules/nanoid/async/index.browser.cjs b/vanilla/node_modules/nanoid/async/index.browser.cjs
new file mode 100644
index 0000000..80d1871
--- /dev/null
+++ b/vanilla/node_modules/nanoid/async/index.browser.cjs
@@ -0,0 +1,69 @@
+let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
+
+let customAlphabet = (alphabet, defaultSize = 21) => {
+ // First, a bitmask is necessary to generate the ID. The bitmask makes bytes
+ // values closer to the alphabet size. The bitmask calculates the closest
+ // `2^31 - 1` number, which exceeds the alphabet size.
+ // For example, the bitmask for the alphabet size 30 is 31 (00011111).
+ // `Math.clz32` is not used, because it is not available in browsers.
+ let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
+ // Though, the bitmask solution is not perfect since the bytes exceeding
+ // the alphabet size are refused. Therefore, to reliably generate the ID,
+ // the random bytes redundancy has to be satisfied.
+
+ // Note: every hardware random generator call is performance expensive,
+ // because the system call for entropy collection takes a lot of time.
+ // So, to avoid additional system calls, extra bytes are requested in advance.
+
+ // Next, a step determines how many random bytes to generate.
+ // The number of random bytes gets decided upon the ID size, mask,
+ // alphabet size, and magic number 1.6 (using 1.6 peaks at performance
+ // according to benchmarks).
+
+ // `-~f => Math.ceil(f)` if f is a float
+ // `-~i => i + 1` if i is an integer
+ let step = -~((1.6 * mask * defaultSize) / alphabet.length)
+
+ return async (size = defaultSize) => {
+ let id = ''
+ while (true) {
+ let bytes = crypto.getRandomValues(new Uint8Array(step))
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
+ let i = step | 0
+ while (i--) {
+ // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
+ id += alphabet[bytes[i] & mask] || ''
+ if (id.length === size) return id
+ }
+ }
+ }
+}
+
+let nanoid = async (size = 21) => {
+ let id = ''
+ let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))
+
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
+ while (size--) {
+ // It is incorrect to use bytes exceeding the alphabet size.
+ // The following mask reduces the random byte in the 0-255 value
+ // range to the 0-63 value range. Therefore, adding hacks, such
+ // as empty string fallback or magic numbers, is unneccessary because
+ // the bitmask trims bytes down to the alphabet size.
+ let byte = bytes[size] & 63
+ if (byte < 36) {
+ // `0-9a-z`
+ id += byte.toString(36)
+ } else if (byte < 62) {
+ // `A-Z`
+ id += (byte - 26).toString(36).toUpperCase()
+ } else if (byte < 63) {
+ id += '_'
+ } else {
+ id += '-'
+ }
+ }
+ return id
+}
+
+module.exports = { nanoid, customAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/async/index.browser.js b/vanilla/node_modules/nanoid/async/index.browser.js
new file mode 100644
index 0000000..fbaa230
--- /dev/null
+++ b/vanilla/node_modules/nanoid/async/index.browser.js
@@ -0,0 +1,34 @@
+let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
+let customAlphabet = (alphabet, defaultSize = 21) => {
+ let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
+ let step = -~((1.6 * mask * defaultSize) / alphabet.length)
+ return async (size = defaultSize) => {
+ let id = ''
+ while (true) {
+ let bytes = crypto.getRandomValues(new Uint8Array(step))
+ let i = step | 0
+ while (i--) {
+ id += alphabet[bytes[i] & mask] || ''
+ if (id.length === size) return id
+ }
+ }
+ }
+}
+let nanoid = async (size = 21) => {
+ let id = ''
+ let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))
+ while (size--) {
+ let byte = bytes[size] & 63
+ if (byte < 36) {
+ id += byte.toString(36)
+ } else if (byte < 62) {
+ id += (byte - 26).toString(36).toUpperCase()
+ } else if (byte < 63) {
+ id += '_'
+ } else {
+ id += '-'
+ }
+ }
+ return id
+}
+export { nanoid, customAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/async/index.cjs b/vanilla/node_modules/nanoid/async/index.cjs
new file mode 100644
index 0000000..f1b0ad0
--- /dev/null
+++ b/vanilla/node_modules/nanoid/async/index.cjs
@@ -0,0 +1,71 @@
+let crypto = require('crypto')
+
+let { urlAlphabet } = require('../url-alphabet/index.cjs')
+
+// `crypto.randomFill()` is a little faster than `crypto.randomBytes()`,
+// because it is possible to use in combination with `Buffer.allocUnsafe()`.
+let random = bytes =>
+ new Promise((resolve, reject) => {
+ // `Buffer.allocUnsafe()` is faster because it doesn’t flush the memory.
+ // Memory flushing is unnecessary since the buffer allocation itself resets
+ // the memory with the new bytes.
+ crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => {
+ if (err) {
+ reject(err)
+ } else {
+ resolve(buf)
+ }
+ })
+ })
+
+let customAlphabet = (alphabet, defaultSize = 21) => {
+ // First, a bitmask is necessary to generate the ID. The bitmask makes bytes
+ // values closer to the alphabet size. The bitmask calculates the closest
+ // `2^31 - 1` number, which exceeds the alphabet size.
+ // For example, the bitmask for the alphabet size 30 is 31 (00011111).
+ let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
+ // Though, the bitmask solution is not perfect since the bytes exceeding
+ // the alphabet size are refused. Therefore, to reliably generate the ID,
+ // the random bytes redundancy has to be satisfied.
+
+ // Note: every hardware random generator call is performance expensive,
+ // because the system call for entropy collection takes a lot of time.
+ // So, to avoid additional system calls, extra bytes are requested in advance.
+
+ // Next, a step determines how many random bytes to generate.
+ // The number of random bytes gets decided upon the ID size, mask,
+ // alphabet size, and magic number 1.6 (using 1.6 peaks at performance
+ // according to benchmarks).
+ let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
+
+ let tick = (id, size = defaultSize) =>
+ random(step).then(bytes => {
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
+ let i = step
+ while (i--) {
+ // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
+ id += alphabet[bytes[i] & mask] || ''
+ if (id.length >= size) return id
+ }
+ return tick(id, size)
+ })
+
+ return size => tick('', size)
+}
+
+let nanoid = (size = 21) =>
+ random((size |= 0)).then(bytes => {
+ let id = ''
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
+ while (size--) {
+ // It is incorrect to use bytes exceeding the alphabet size.
+ // The following mask reduces the random byte in the 0-255 value
+ // range to the 0-63 value range. Therefore, adding hacks, such
+ // as empty string fallback or magic numbers, is unneccessary because
+ // the bitmask trims bytes down to the alphabet size.
+ id += urlAlphabet[bytes[size] & 63]
+ }
+ return id
+ })
+
+module.exports = { nanoid, customAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/async/index.d.ts b/vanilla/node_modules/nanoid/async/index.d.ts
new file mode 100644
index 0000000..9e91965
--- /dev/null
+++ b/vanilla/node_modules/nanoid/async/index.d.ts
@@ -0,0 +1,56 @@
+/**
+ * Generate secure URL-friendly unique ID. The non-blocking version.
+ *
+ * By default, the ID will have 21 symbols to have a collision probability
+ * similar to UUID v4.
+ *
+ * ```js
+ * import { nanoid } from 'nanoid/async'
+ * nanoid().then(id => {
+ * model.id = id
+ * })
+ * ```
+ *
+ * @param size Size of the ID. The default size is 21.
+ * @returns A promise with a random string.
+ */
+export function nanoid(size?: number): Promise<string>
+
+/**
+ * A low-level function.
+ * Generate secure unique ID with custom alphabet. The non-blocking version.
+ *
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
+ * will not be secure.
+ *
+ * @param alphabet Alphabet used to generate the ID.
+ * @param defaultSize Size of the ID. The default size is 21.
+ * @returns A function that returns a promise with a random string.
+ *
+ * ```js
+ * import { customAlphabet } from 'nanoid/async'
+ * const nanoid = customAlphabet('0123456789абвгдеё', 5)
+ * nanoid().then(id => {
+ * model.id = id //=> "8ё56а"
+ * })
+ * ```
+ */
+export function customAlphabet(
+ alphabet: string,
+ defaultSize?: number
+): (size?: number) => Promise<string>
+
+/**
+ * Generate an array of random bytes collected from hardware noise.
+ *
+ * ```js
+ * import { random } from 'nanoid/async'
+ * random(5).then(bytes => {
+ * bytes //=> [10, 67, 212, 67, 89]
+ * })
+ * ```
+ *
+ * @param bytes Size of the array.
+ * @returns A promise with a random bytes array.
+ */
+export function random(bytes: number): Promise<Uint8Array>
diff --git a/vanilla/node_modules/nanoid/async/index.js b/vanilla/node_modules/nanoid/async/index.js
new file mode 100644
index 0000000..cec454a
--- /dev/null
+++ b/vanilla/node_modules/nanoid/async/index.js
@@ -0,0 +1,35 @@
+import crypto from 'crypto'
+import { urlAlphabet } from '../url-alphabet/index.js'
+let random = bytes =>
+ new Promise((resolve, reject) => {
+ crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => {
+ if (err) {
+ reject(err)
+ } else {
+ resolve(buf)
+ }
+ })
+ })
+let customAlphabet = (alphabet, defaultSize = 21) => {
+ let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
+ let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
+ let tick = (id, size = defaultSize) =>
+ random(step).then(bytes => {
+ let i = step
+ while (i--) {
+ id += alphabet[bytes[i] & mask] || ''
+ if (id.length >= size) return id
+ }
+ return tick(id, size)
+ })
+ return size => tick('', size)
+}
+let nanoid = (size = 21) =>
+ random((size |= 0)).then(bytes => {
+ let id = ''
+ while (size--) {
+ id += urlAlphabet[bytes[size] & 63]
+ }
+ return id
+ })
+export { nanoid, customAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/async/index.native.js b/vanilla/node_modules/nanoid/async/index.native.js
new file mode 100644
index 0000000..7c1d6f3
--- /dev/null
+++ b/vanilla/node_modules/nanoid/async/index.native.js
@@ -0,0 +1,26 @@
+import { getRandomBytesAsync } from 'expo-random'
+import { urlAlphabet } from '../url-alphabet/index.js'
+let random = getRandomBytesAsync
+let customAlphabet = (alphabet, defaultSize = 21) => {
+ let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
+ let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
+ let tick = (id, size = defaultSize) =>
+ random(step).then(bytes => {
+ let i = step
+ while (i--) {
+ id += alphabet[bytes[i] & mask] || ''
+ if (id.length >= size) return id
+ }
+ return tick(id, size)
+ })
+ return size => tick('', size)
+}
+let nanoid = (size = 21) =>
+ random((size |= 0)).then(bytes => {
+ let id = ''
+ while (size--) {
+ id += urlAlphabet[bytes[size] & 63]
+ }
+ return id
+ })
+export { nanoid, customAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/async/package.json b/vanilla/node_modules/nanoid/async/package.json
new file mode 100644
index 0000000..578cdb4
--- /dev/null
+++ b/vanilla/node_modules/nanoid/async/package.json
@@ -0,0 +1,12 @@
+{
+ "type": "module",
+ "main": "index.cjs",
+ "module": "index.js",
+ "react-native": {
+ "./index.js": "./index.native.js"
+ },
+ "browser": {
+ "./index.js": "./index.browser.js",
+ "./index.cjs": "./index.browser.cjs"
+ }
+} \ No newline at end of file
diff --git a/vanilla/node_modules/nanoid/bin/nanoid.cjs b/vanilla/node_modules/nanoid/bin/nanoid.cjs
new file mode 100755
index 0000000..c76db0f
--- /dev/null
+++ b/vanilla/node_modules/nanoid/bin/nanoid.cjs
@@ -0,0 +1,55 @@
+#!/usr/bin/env node
+
+let { nanoid, customAlphabet } = require('..')
+
+function print(msg) {
+ process.stdout.write(msg + '\n')
+}
+
+function error(msg) {
+ process.stderr.write(msg + '\n')
+ process.exit(1)
+}
+
+if (process.argv.includes('--help') || process.argv.includes('-h')) {
+ print(`
+ Usage
+ $ nanoid [options]
+
+ Options
+ -s, --size Generated ID size
+ -a, --alphabet Alphabet to use
+ -h, --help Show this help
+
+ Examples
+ $ nanoid --s 15
+ S9sBF77U6sDB8Yg
+
+ $ nanoid --size 10 --alphabet abc
+ bcabababca`)
+ process.exit()
+}
+
+let alphabet, size
+for (let i = 2; i < process.argv.length; i++) {
+ let arg = process.argv[i]
+ if (arg === '--size' || arg === '-s') {
+ size = Number(process.argv[i + 1])
+ i += 1
+ if (Number.isNaN(size) || size <= 0) {
+ error('Size must be positive integer')
+ }
+ } else if (arg === '--alphabet' || arg === '-a') {
+ alphabet = process.argv[i + 1]
+ i += 1
+ } else {
+ error('Unknown argument ' + arg)
+ }
+}
+
+if (alphabet) {
+ let customNanoid = customAlphabet(alphabet, size)
+ print(customNanoid())
+} else {
+ print(nanoid(size))
+}
diff --git a/vanilla/node_modules/nanoid/index.browser.cjs b/vanilla/node_modules/nanoid/index.browser.cjs
new file mode 100644
index 0000000..d21a91f
--- /dev/null
+++ b/vanilla/node_modules/nanoid/index.browser.cjs
@@ -0,0 +1,72 @@
+// This file replaces `index.js` in bundlers like webpack or Rollup,
+// according to `browser` config in `package.json`.
+
+let { urlAlphabet } = require('./url-alphabet/index.cjs')
+
+let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
+
+let customRandom = (alphabet, defaultSize, getRandom) => {
+ // First, a bitmask is necessary to generate the ID. The bitmask makes bytes
+ // values closer to the alphabet size. The bitmask calculates the closest
+ // `2^31 - 1` number, which exceeds the alphabet size.
+ // For example, the bitmask for the alphabet size 30 is 31 (00011111).
+ // `Math.clz32` is not used, because it is not available in browsers.
+ let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
+ // Though, the bitmask solution is not perfect since the bytes exceeding
+ // the alphabet size are refused. Therefore, to reliably generate the ID,
+ // the random bytes redundancy has to be satisfied.
+
+ // Note: every hardware random generator call is performance expensive,
+ // because the system call for entropy collection takes a lot of time.
+ // So, to avoid additional system calls, extra bytes are requested in advance.
+
+ // Next, a step determines how many random bytes to generate.
+ // The number of random bytes gets decided upon the ID size, mask,
+ // alphabet size, and magic number 1.6 (using 1.6 peaks at performance
+ // according to benchmarks).
+
+ // `-~f => Math.ceil(f)` if f is a float
+ // `-~i => i + 1` if i is an integer
+ let step = -~((1.6 * mask * defaultSize) / alphabet.length)
+
+ return (size = defaultSize) => {
+ let id = ''
+ while (true) {
+ let bytes = getRandom(step)
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
+ let j = step | 0
+ while (j--) {
+ // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
+ id += alphabet[bytes[j] & mask] || ''
+ if (id.length === size) return id
+ }
+ }
+ }
+}
+
+let customAlphabet = (alphabet, size = 21) =>
+ customRandom(alphabet, size, random)
+
+let nanoid = (size = 21) =>
+ crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
+ // It is incorrect to use bytes exceeding the alphabet size.
+ // The following mask reduces the random byte in the 0-255 value
+ // range to the 0-63 value range. Therefore, adding hacks, such
+ // as empty string fallback or magic numbers, is unneccessary because
+ // the bitmask trims bytes down to the alphabet size.
+ byte &= 63
+ if (byte < 36) {
+ // `0-9a-z`
+ id += byte.toString(36)
+ } else if (byte < 62) {
+ // `A-Z`
+ id += (byte - 26).toString(36).toUpperCase()
+ } else if (byte > 62) {
+ id += '-'
+ } else {
+ id += '_'
+ }
+ return id
+ }, '')
+
+module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/index.browser.js b/vanilla/node_modules/nanoid/index.browser.js
new file mode 100644
index 0000000..7d3b876
--- /dev/null
+++ b/vanilla/node_modules/nanoid/index.browser.js
@@ -0,0 +1,34 @@
+import { urlAlphabet } from './url-alphabet/index.js'
+let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
+let customRandom = (alphabet, defaultSize, getRandom) => {
+ let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
+ let step = -~((1.6 * mask * defaultSize) / alphabet.length)
+ return (size = defaultSize) => {
+ let id = ''
+ while (true) {
+ let bytes = getRandom(step)
+ let j = step | 0
+ while (j--) {
+ id += alphabet[bytes[j] & mask] || ''
+ if (id.length === size) return id
+ }
+ }
+ }
+}
+let customAlphabet = (alphabet, size = 21) =>
+ customRandom(alphabet, size, random)
+let nanoid = (size = 21) =>
+ crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
+ byte &= 63
+ if (byte < 36) {
+ id += byte.toString(36)
+ } else if (byte < 62) {
+ id += (byte - 26).toString(36).toUpperCase()
+ } else if (byte > 62) {
+ id += '-'
+ } else {
+ id += '_'
+ }
+ return id
+ }, '')
+export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/index.cjs b/vanilla/node_modules/nanoid/index.cjs
new file mode 100644
index 0000000..c20e374
--- /dev/null
+++ b/vanilla/node_modules/nanoid/index.cjs
@@ -0,0 +1,85 @@
+let crypto = require('crypto')
+
+let { urlAlphabet } = require('./url-alphabet/index.cjs')
+
+// It is best to make fewer, larger requests to the crypto module to
+// avoid system call overhead. So, random numbers are generated in a
+// pool. The pool is a Buffer that is larger than the initial random
+// request size by this multiplier. The pool is enlarged if subsequent
+// requests exceed the maximum buffer size.
+const POOL_SIZE_MULTIPLIER = 128
+let pool, poolOffset
+
+let fillPool = bytes => {
+ if (!pool || pool.length < bytes) {
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
+ crypto.randomFillSync(pool)
+ poolOffset = 0
+ } else if (poolOffset + bytes > pool.length) {
+ crypto.randomFillSync(pool)
+ poolOffset = 0
+ }
+ poolOffset += bytes
+}
+
+let random = bytes => {
+ // `|=` convert `bytes` to number to prevent `valueOf` abusing and pool pollution
+ fillPool((bytes |= 0))
+ return pool.subarray(poolOffset - bytes, poolOffset)
+}
+
+let customRandom = (alphabet, defaultSize, getRandom) => {
+ // First, a bitmask is necessary to generate the ID. The bitmask makes bytes
+ // values closer to the alphabet size. The bitmask calculates the closest
+ // `2^31 - 1` number, which exceeds the alphabet size.
+ // For example, the bitmask for the alphabet size 30 is 31 (00011111).
+ let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
+ // Though, the bitmask solution is not perfect since the bytes exceeding
+ // the alphabet size are refused. Therefore, to reliably generate the ID,
+ // the random bytes redundancy has to be satisfied.
+
+ // Note: every hardware random generator call is performance expensive,
+ // because the system call for entropy collection takes a lot of time.
+ // So, to avoid additional system calls, extra bytes are requested in advance.
+
+ // Next, a step determines how many random bytes to generate.
+ // The number of random bytes gets decided upon the ID size, mask,
+ // alphabet size, and magic number 1.6 (using 1.6 peaks at performance
+ // according to benchmarks).
+ let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
+
+ return (size = defaultSize) => {
+ let id = ''
+ while (true) {
+ let bytes = getRandom(step)
+ // A compact alternative for `for (let i = 0; i < step; i++)`.
+ let i = step
+ while (i--) {
+ // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
+ id += alphabet[bytes[i] & mask] || ''
+ if (id.length === size) return id
+ }
+ }
+ }
+}
+
+let customAlphabet = (alphabet, size = 21) =>
+ customRandom(alphabet, size, random)
+
+let nanoid = (size = 21) => {
+ // `|=` convert `size` to number to prevent `valueOf` abusing and pool pollution
+ fillPool((size |= 0))
+ let id = ''
+ // We are reading directly from the random pool to avoid creating new array
+ for (let i = poolOffset - size; i < poolOffset; i++) {
+ // It is incorrect to use bytes exceeding the alphabet size.
+ // The following mask reduces the random byte in the 0-255 value
+ // range to the 0-63 value range. Therefore, adding hacks, such
+ // as empty string fallback or magic numbers, is unneccessary because
+ // the bitmask trims bytes down to the alphabet size.
+ id += urlAlphabet[pool[i] & 63]
+ }
+ return id
+}
+
+module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/index.d.cts b/vanilla/node_modules/nanoid/index.d.cts
new file mode 100644
index 0000000..3e111a3
--- /dev/null
+++ b/vanilla/node_modules/nanoid/index.d.cts
@@ -0,0 +1,91 @@
+/**
+ * Generate secure URL-friendly unique ID.
+ *
+ * By default, the ID will have 21 symbols to have a collision probability
+ * similar to UUID v4.
+ *
+ * ```js
+ * import { nanoid } from 'nanoid'
+ * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
+ * ```
+ *
+ * @param size Size of the ID. The default size is 21.
+ * @returns A random string.
+ */
+export function nanoid(size?: number): string
+
+/**
+ * Generate secure unique ID with custom alphabet.
+ *
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
+ * will not be secure.
+ *
+ * @param alphabet Alphabet used to generate the ID.
+ * @param defaultSize Size of the ID. The default size is 21.
+ * @returns A random string generator.
+ *
+ * ```js
+ * const { customAlphabet } = require('nanoid')
+ * const nanoid = customAlphabet('0123456789абвгдеё', 5)
+ * nanoid() //=> "8ё56а"
+ * ```
+ */
+export function customAlphabet(
+ alphabet: string,
+ defaultSize?: number
+): (size?: number) => string
+
+/**
+ * Generate unique ID with custom random generator and alphabet.
+ *
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
+ * will not be secure.
+ *
+ * ```js
+ * import { customRandom } from 'nanoid/format'
+ *
+ * const nanoid = customRandom('abcdef', 5, size => {
+ * const random = []
+ * for (let i = 0; i < size; i++) {
+ * random.push(randomByte())
+ * }
+ * return random
+ * })
+ *
+ * nanoid() //=> "fbaef"
+ * ```
+ *
+ * @param alphabet Alphabet used to generate a random string.
+ * @param size Size of the random string.
+ * @param random A random bytes generator.
+ * @returns A random string generator.
+ */
+export function customRandom(
+ alphabet: string,
+ size: number,
+ random: (bytes: number) => Uint8Array
+): () => string
+
+/**
+ * URL safe symbols.
+ *
+ * ```js
+ * import { urlAlphabet } from 'nanoid'
+ * const nanoid = customAlphabet(urlAlphabet, 10)
+ * nanoid() //=> "Uakgb_J5m9"
+ * ```
+ */
+export const urlAlphabet: string
+
+/**
+ * Generate an array of random bytes collected from hardware noise.
+ *
+ * ```js
+ * import { customRandom, random } from 'nanoid'
+ * const nanoid = customRandom("abcdef", 5, random)
+ * ```
+ *
+ * @param bytes Size of the array.
+ * @returns An array of random bytes.
+ */
+export function random(bytes: number): Uint8Array
diff --git a/vanilla/node_modules/nanoid/index.d.ts b/vanilla/node_modules/nanoid/index.d.ts
new file mode 100644
index 0000000..3e111a3
--- /dev/null
+++ b/vanilla/node_modules/nanoid/index.d.ts
@@ -0,0 +1,91 @@
+/**
+ * Generate secure URL-friendly unique ID.
+ *
+ * By default, the ID will have 21 symbols to have a collision probability
+ * similar to UUID v4.
+ *
+ * ```js
+ * import { nanoid } from 'nanoid'
+ * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
+ * ```
+ *
+ * @param size Size of the ID. The default size is 21.
+ * @returns A random string.
+ */
+export function nanoid(size?: number): string
+
+/**
+ * Generate secure unique ID with custom alphabet.
+ *
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
+ * will not be secure.
+ *
+ * @param alphabet Alphabet used to generate the ID.
+ * @param defaultSize Size of the ID. The default size is 21.
+ * @returns A random string generator.
+ *
+ * ```js
+ * const { customAlphabet } = require('nanoid')
+ * const nanoid = customAlphabet('0123456789абвгдеё', 5)
+ * nanoid() //=> "8ё56а"
+ * ```
+ */
+export function customAlphabet(
+ alphabet: string,
+ defaultSize?: number
+): (size?: number) => string
+
+/**
+ * Generate unique ID with custom random generator and alphabet.
+ *
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
+ * will not be secure.
+ *
+ * ```js
+ * import { customRandom } from 'nanoid/format'
+ *
+ * const nanoid = customRandom('abcdef', 5, size => {
+ * const random = []
+ * for (let i = 0; i < size; i++) {
+ * random.push(randomByte())
+ * }
+ * return random
+ * })
+ *
+ * nanoid() //=> "fbaef"
+ * ```
+ *
+ * @param alphabet Alphabet used to generate a random string.
+ * @param size Size of the random string.
+ * @param random A random bytes generator.
+ * @returns A random string generator.
+ */
+export function customRandom(
+ alphabet: string,
+ size: number,
+ random: (bytes: number) => Uint8Array
+): () => string
+
+/**
+ * URL safe symbols.
+ *
+ * ```js
+ * import { urlAlphabet } from 'nanoid'
+ * const nanoid = customAlphabet(urlAlphabet, 10)
+ * nanoid() //=> "Uakgb_J5m9"
+ * ```
+ */
+export const urlAlphabet: string
+
+/**
+ * Generate an array of random bytes collected from hardware noise.
+ *
+ * ```js
+ * import { customRandom, random } from 'nanoid'
+ * const nanoid = customRandom("abcdef", 5, random)
+ * ```
+ *
+ * @param bytes Size of the array.
+ * @returns An array of random bytes.
+ */
+export function random(bytes: number): Uint8Array
diff --git a/vanilla/node_modules/nanoid/index.js b/vanilla/node_modules/nanoid/index.js
new file mode 100644
index 0000000..9bc909d
--- /dev/null
+++ b/vanilla/node_modules/nanoid/index.js
@@ -0,0 +1,45 @@
+import crypto from 'crypto'
+import { urlAlphabet } from './url-alphabet/index.js'
+const POOL_SIZE_MULTIPLIER = 128
+let pool, poolOffset
+let fillPool = bytes => {
+ if (!pool || pool.length < bytes) {
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
+ crypto.randomFillSync(pool)
+ poolOffset = 0
+ } else if (poolOffset + bytes > pool.length) {
+ crypto.randomFillSync(pool)
+ poolOffset = 0
+ }
+ poolOffset += bytes
+}
+let random = bytes => {
+ fillPool((bytes |= 0))
+ return pool.subarray(poolOffset - bytes, poolOffset)
+}
+let customRandom = (alphabet, defaultSize, getRandom) => {
+ let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
+ let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
+ return (size = defaultSize) => {
+ let id = ''
+ while (true) {
+ let bytes = getRandom(step)
+ let i = step
+ while (i--) {
+ id += alphabet[bytes[i] & mask] || ''
+ if (id.length === size) return id
+ }
+ }
+ }
+}
+let customAlphabet = (alphabet, size = 21) =>
+ customRandom(alphabet, size, random)
+let nanoid = (size = 21) => {
+ fillPool((size |= 0))
+ let id = ''
+ for (let i = poolOffset - size; i < poolOffset; i++) {
+ id += urlAlphabet[pool[i] & 63]
+ }
+ return id
+}
+export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
diff --git a/vanilla/node_modules/nanoid/nanoid.js b/vanilla/node_modules/nanoid/nanoid.js
new file mode 100644
index 0000000..ec242ea
--- /dev/null
+++ b/vanilla/node_modules/nanoid/nanoid.js
@@ -0,0 +1 @@
+export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),""); \ No newline at end of file
diff --git a/vanilla/node_modules/nanoid/non-secure/index.cjs b/vanilla/node_modules/nanoid/non-secure/index.cjs
new file mode 100644
index 0000000..d51fcb6
--- /dev/null
+++ b/vanilla/node_modules/nanoid/non-secure/index.cjs
@@ -0,0 +1,34 @@
+// This alphabet uses `A-Za-z0-9_-` symbols.
+// The order of characters is optimized for better gzip and brotli compression.
+// References to the same file (works both for gzip and brotli):
+// `'use`, `andom`, and `rict'`
+// References to the brotli default dictionary:
+// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
+let urlAlphabet =
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
+
+let customAlphabet = (alphabet, defaultSize = 21) => {
+ return (size = defaultSize) => {
+ let id = ''
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
+ let i = size | 0
+ while (i--) {
+ // `| 0` is more compact and faster than `Math.floor()`.
+ id += alphabet[(Math.random() * alphabet.length) | 0]
+ }
+ return id
+ }
+}
+
+let nanoid = (size = 21) => {
+ let id = ''
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
+ let i = size | 0
+ while (i--) {
+ // `| 0` is more compact and faster than `Math.floor()`.
+ id += urlAlphabet[(Math.random() * 64) | 0]
+ }
+ return id
+}
+
+module.exports = { nanoid, customAlphabet }
diff --git a/vanilla/node_modules/nanoid/non-secure/index.d.ts b/vanilla/node_modules/nanoid/non-secure/index.d.ts
new file mode 100644
index 0000000..4965322
--- /dev/null
+++ b/vanilla/node_modules/nanoid/non-secure/index.d.ts
@@ -0,0 +1,33 @@
+/**
+ * Generate URL-friendly unique ID. This method uses the non-secure
+ * predictable random generator with bigger collision probability.
+ *
+ * ```js
+ * import { nanoid } from 'nanoid/non-secure'
+ * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
+ * ```
+ *
+ * @param size Size of the ID. The default size is 21.
+ * @returns A random string.
+ */
+export function nanoid(size?: number): string
+
+/**
+ * Generate a unique ID based on a custom alphabet.
+ * This method uses the non-secure predictable random generator
+ * with bigger collision probability.
+ *
+ * @param alphabet Alphabet used to generate the ID.
+ * @param defaultSize Size of the ID. The default size is 21.
+ * @returns A random string generator.
+ *
+ * ```js
+ * import { customAlphabet } from 'nanoid/non-secure'
+ * const nanoid = customAlphabet('0123456789абвгдеё', 5)
+ * model.id = //=> "8ё56а"
+ * ```
+ */
+export function customAlphabet(
+ alphabet: string,
+ defaultSize?: number
+): (size?: number) => string
diff --git a/vanilla/node_modules/nanoid/non-secure/index.js b/vanilla/node_modules/nanoid/non-secure/index.js
new file mode 100644
index 0000000..2ea5827
--- /dev/null
+++ b/vanilla/node_modules/nanoid/non-secure/index.js
@@ -0,0 +1,21 @@
+let urlAlphabet =
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
+let customAlphabet = (alphabet, defaultSize = 21) => {
+ return (size = defaultSize) => {
+ let id = ''
+ let i = size | 0
+ while (i--) {
+ id += alphabet[(Math.random() * alphabet.length) | 0]
+ }
+ return id
+ }
+}
+let nanoid = (size = 21) => {
+ let id = ''
+ let i = size | 0
+ while (i--) {
+ id += urlAlphabet[(Math.random() * 64) | 0]
+ }
+ return id
+}
+export { nanoid, customAlphabet }
diff --git a/vanilla/node_modules/nanoid/non-secure/package.json b/vanilla/node_modules/nanoid/non-secure/package.json
new file mode 100644
index 0000000..9930d6a
--- /dev/null
+++ b/vanilla/node_modules/nanoid/non-secure/package.json
@@ -0,0 +1,6 @@
+{
+ "type": "module",
+ "main": "index.cjs",
+ "module": "index.js",
+ "react-native": "index.js"
+} \ No newline at end of file
diff --git a/vanilla/node_modules/nanoid/package.json b/vanilla/node_modules/nanoid/package.json
new file mode 100644
index 0000000..a3d3f44
--- /dev/null
+++ b/vanilla/node_modules/nanoid/package.json
@@ -0,0 +1,89 @@
+{
+ "name": "nanoid",
+ "version": "3.3.11",
+ "description": "A tiny (116 bytes), secure URL-friendly unique string ID generator",
+ "keywords": [
+ "uuid",
+ "random",
+ "id",
+ "url"
+ ],
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ },
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "author": "Andrey Sitnik <andrey@sitnik.ru>",
+ "license": "MIT",
+ "repository": "ai/nanoid",
+ "browser": {
+ "./index.js": "./index.browser.js",
+ "./async/index.js": "./async/index.browser.js",
+ "./async/index.cjs": "./async/index.browser.cjs",
+ "./index.cjs": "./index.browser.cjs"
+ },
+ "react-native": "index.js",
+ "bin": "./bin/nanoid.cjs",
+ "sideEffects": false,
+ "types": "./index.d.ts",
+ "type": "module",
+ "main": "index.cjs",
+ "module": "index.js",
+ "exports": {
+ ".": {
+ "react-native": "./index.browser.js",
+ "browser": "./index.browser.js",
+ "require": {
+ "types": "./index.d.cts",
+ "default": "./index.cjs"
+ },
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./index.js"
+ },
+ "default": "./index.js"
+ },
+ "./package.json": "./package.json",
+ "./async/package.json": "./async/package.json",
+ "./async": {
+ "browser": "./async/index.browser.js",
+ "require": {
+ "types": "./index.d.cts",
+ "default": "./async/index.cjs"
+ },
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./async/index.js"
+ },
+ "default": "./async/index.js"
+ },
+ "./non-secure/package.json": "./non-secure/package.json",
+ "./non-secure": {
+ "require": {
+ "types": "./index.d.cts",
+ "default": "./non-secure/index.cjs"
+ },
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./non-secure/index.js"
+ },
+ "default": "./non-secure/index.js"
+ },
+ "./url-alphabet/package.json": "./url-alphabet/package.json",
+ "./url-alphabet": {
+ "require": {
+ "types": "./index.d.cts",
+ "default": "./url-alphabet/index.cjs"
+ },
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./url-alphabet/index.js"
+ },
+ "default": "./url-alphabet/index.js"
+ }
+ }
+}
diff --git a/vanilla/node_modules/nanoid/url-alphabet/index.cjs b/vanilla/node_modules/nanoid/url-alphabet/index.cjs
new file mode 100644
index 0000000..a332f0b
--- /dev/null
+++ b/vanilla/node_modules/nanoid/url-alphabet/index.cjs
@@ -0,0 +1,7 @@
+// This alphabet uses `A-Za-z0-9_-` symbols.
+// The order of characters is optimized for better gzip and brotli compression.
+// Same as in non-secure/index.js
+let urlAlphabet =
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
+
+module.exports = { urlAlphabet }
diff --git a/vanilla/node_modules/nanoid/url-alphabet/index.js b/vanilla/node_modules/nanoid/url-alphabet/index.js
new file mode 100644
index 0000000..c2782e5
--- /dev/null
+++ b/vanilla/node_modules/nanoid/url-alphabet/index.js
@@ -0,0 +1,3 @@
+let urlAlphabet =
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
+export { urlAlphabet }
diff --git a/vanilla/node_modules/nanoid/url-alphabet/package.json b/vanilla/node_modules/nanoid/url-alphabet/package.json
new file mode 100644
index 0000000..9930d6a
--- /dev/null
+++ b/vanilla/node_modules/nanoid/url-alphabet/package.json
@@ -0,0 +1,6 @@
+{
+ "type": "module",
+ "main": "index.cjs",
+ "module": "index.js",
+ "react-native": "index.js"
+} \ No newline at end of file