diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-11-09 11:15:19 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-11-09 11:15:19 +0800 |
| commit | 8eff962cab608341a6f2fedc640a0e32d96f26e2 (patch) | |
| tree | 05534d1a720ddc3691d346c69b4972555820a061 /frontend-old/node_modules/@protobufjs/base64 | |
pain
Diffstat (limited to 'frontend-old/node_modules/@protobufjs/base64')
6 files changed, 283 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@protobufjs/base64/LICENSE b/frontend-old/node_modules/@protobufjs/base64/LICENSE new file mode 100644 index 0000000..2a2d560 --- /dev/null +++ b/frontend-old/node_modules/@protobufjs/base64/LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2016, Daniel Wirtz All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of its author, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/frontend-old/node_modules/@protobufjs/base64/README.md b/frontend-old/node_modules/@protobufjs/base64/README.md new file mode 100644 index 0000000..0e2eb33 --- /dev/null +++ b/frontend-old/node_modules/@protobufjs/base64/README.md @@ -0,0 +1,19 @@ +@protobufjs/base64
+==================
+[](https://www.npmjs.com/package/@protobufjs/base64)
+
+A minimal base64 implementation for number arrays.
+
+API
+---
+
+* **base64.length(string: `string`): `number`**<br />
+ Calculates the byte length of a base64 encoded string.
+
+* **base64.encode(buffer: `Uint8Array`, start: `number`, end: `number`): `string`**<br />
+ Encodes a buffer to a base64 encoded string.
+
+* **base64.decode(string: `string`, buffer: `Uint8Array`, offset: `number`): `number`**<br />
+ Decodes a base64 encoded string to a buffer.
+
+**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
diff --git a/frontend-old/node_modules/@protobufjs/base64/index.d.ts b/frontend-old/node_modules/@protobufjs/base64/index.d.ts new file mode 100644 index 0000000..16fd7db --- /dev/null +++ b/frontend-old/node_modules/@protobufjs/base64/index.d.ts @@ -0,0 +1,32 @@ +/**
+ * Calculates the byte length of a base64 encoded string.
+ * @param {string} string Base64 encoded string
+ * @returns {number} Byte length
+ */
+export function length(string: string): number;
+
+/**
+ * Encodes a buffer to a base64 encoded string.
+ * @param {Uint8Array} buffer Source buffer
+ * @param {number} start Source start
+ * @param {number} end Source end
+ * @returns {string} Base64 encoded string
+ */
+export function encode(buffer: Uint8Array, start: number, end: number): string;
+
+/**
+ * Decodes a base64 encoded string to a buffer.
+ * @param {string} string Source string
+ * @param {Uint8Array} buffer Destination buffer
+ * @param {number} offset Destination offset
+ * @returns {number} Number of bytes written
+ * @throws {Error} If encoding is invalid
+ */
+export function decode(string: string, buffer: Uint8Array, offset: number): number;
+
+/**
+ * Tests if the specified string appears to be base64 encoded.
+ * @param {string} string String to test
+ * @returns {boolean} `true` if it appears to be base64 encoded, otherwise false
+ */
+export function test(string: string): boolean;
diff --git a/frontend-old/node_modules/@protobufjs/base64/index.js b/frontend-old/node_modules/@protobufjs/base64/index.js new file mode 100644 index 0000000..26d5443 --- /dev/null +++ b/frontend-old/node_modules/@protobufjs/base64/index.js @@ -0,0 +1,139 @@ +"use strict";
+
+/**
+ * A minimal base64 implementation for number arrays.
+ * @memberof util
+ * @namespace
+ */
+var base64 = exports;
+
+/**
+ * Calculates the byte length of a base64 encoded string.
+ * @param {string} string Base64 encoded string
+ * @returns {number} Byte length
+ */
+base64.length = function length(string) {
+ var p = string.length;
+ if (!p)
+ return 0;
+ var n = 0;
+ while (--p % 4 > 1 && string.charAt(p) === "=")
+ ++n;
+ return Math.ceil(string.length * 3) / 4 - n;
+};
+
+// Base64 encoding table
+var b64 = new Array(64);
+
+// Base64 decoding table
+var s64 = new Array(123);
+
+// 65..90, 97..122, 48..57, 43, 47
+for (var i = 0; i < 64;)
+ s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
+
+/**
+ * Encodes a buffer to a base64 encoded string.
+ * @param {Uint8Array} buffer Source buffer
+ * @param {number} start Source start
+ * @param {number} end Source end
+ * @returns {string} Base64 encoded string
+ */
+base64.encode = function encode(buffer, start, end) {
+ var parts = null,
+ chunk = [];
+ var i = 0, // output index
+ j = 0, // goto index
+ t; // temporary
+ while (start < end) {
+ var b = buffer[start++];
+ switch (j) {
+ case 0:
+ chunk[i++] = b64[b >> 2];
+ t = (b & 3) << 4;
+ j = 1;
+ break;
+ case 1:
+ chunk[i++] = b64[t | b >> 4];
+ t = (b & 15) << 2;
+ j = 2;
+ break;
+ case 2:
+ chunk[i++] = b64[t | b >> 6];
+ chunk[i++] = b64[b & 63];
+ j = 0;
+ break;
+ }
+ if (i > 8191) {
+ (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
+ i = 0;
+ }
+ }
+ if (j) {
+ chunk[i++] = b64[t];
+ chunk[i++] = 61;
+ if (j === 1)
+ chunk[i++] = 61;
+ }
+ if (parts) {
+ if (i)
+ parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
+ return parts.join("");
+ }
+ return String.fromCharCode.apply(String, chunk.slice(0, i));
+};
+
+var invalidEncoding = "invalid encoding";
+
+/**
+ * Decodes a base64 encoded string to a buffer.
+ * @param {string} string Source string
+ * @param {Uint8Array} buffer Destination buffer
+ * @param {number} offset Destination offset
+ * @returns {number} Number of bytes written
+ * @throws {Error} If encoding is invalid
+ */
+base64.decode = function decode(string, buffer, offset) {
+ var start = offset;
+ var j = 0, // goto index
+ t; // temporary
+ for (var i = 0; i < string.length;) {
+ var c = string.charCodeAt(i++);
+ if (c === 61 && j > 1)
+ break;
+ if ((c = s64[c]) === undefined)
+ throw Error(invalidEncoding);
+ switch (j) {
+ case 0:
+ t = c;
+ j = 1;
+ break;
+ case 1:
+ buffer[offset++] = t << 2 | (c & 48) >> 4;
+ t = c;
+ j = 2;
+ break;
+ case 2:
+ buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
+ t = c;
+ j = 3;
+ break;
+ case 3:
+ buffer[offset++] = (t & 3) << 6 | c;
+ j = 0;
+ break;
+ }
+ }
+ if (j === 1)
+ throw Error(invalidEncoding);
+ return offset - start;
+};
+
+/**
+ * Tests if the specified string appears to be base64 encoded.
+ * @param {string} string String to test
+ * @returns {boolean} `true` if probably base64 encoded, otherwise false
+ */
+base64.test = function test(string) {
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
+};
diff --git a/frontend-old/node_modules/@protobufjs/base64/package.json b/frontend-old/node_modules/@protobufjs/base64/package.json new file mode 100644 index 0000000..46e71d4 --- /dev/null +++ b/frontend-old/node_modules/@protobufjs/base64/package.json @@ -0,0 +1,21 @@ +{
+ "name": "@protobufjs/base64",
+ "description": "A minimal base64 implementation for number arrays.",
+ "version": "1.1.2",
+ "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
+ },
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "devDependencies": {
+ "istanbul": "^0.4.5",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "tape tests/*.js",
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
+ }
+}
\ No newline at end of file diff --git a/frontend-old/node_modules/@protobufjs/base64/tests/index.js b/frontend-old/node_modules/@protobufjs/base64/tests/index.js new file mode 100644 index 0000000..89828f2 --- /dev/null +++ b/frontend-old/node_modules/@protobufjs/base64/tests/index.js @@ -0,0 +1,46 @@ +var tape = require("tape");
+
+var base64 = require("..");
+
+var strings = {
+ "": "",
+ "a": "YQ==",
+ "ab": "YWI=",
+ "abcdefg": "YWJjZGVmZw==",
+ "abcdefgh": "YWJjZGVmZ2g=",
+ "abcdefghi": "YWJjZGVmZ2hp"
+};
+
+tape.test("base64", function(test) {
+
+ Object.keys(strings).forEach(function(str) {
+ var enc = strings[str];
+
+ test.equal(base64.test(enc), true, "should detect '" + enc + "' to be base64 encoded");
+
+ var len = base64.length(enc);
+ test.equal(len, str.length, "should calculate '" + enc + "' as " + str.length + " bytes");
+
+ var buf = new Array(len);
+ var len2 = base64.decode(enc, buf, 0);
+ test.equal(len2, len, "should decode '" + enc + "' to " + len + " bytes");
+
+ test.equal(String.fromCharCode.apply(String, buf), str, "should decode '" + enc + "' to '" + str + "'");
+
+ var enc2 = base64.encode(buf, 0, buf.length);
+ test.equal(enc2, enc, "should encode '" + str + "' to '" + enc + "'");
+
+ });
+
+ test.throws(function() {
+ var buf = new Array(10);
+ base64.decode("YQ!", buf, 0);
+ }, Error, "should throw if encoding is invalid");
+
+ test.throws(function() {
+ var buf = new Array(10);
+ base64.decode("Y", buf, 0);
+ }, Error, "should throw if string is truncated");
+
+ test.end();
+});
|
