FRE-651: CEO coordination notes for founder bio/headshot assets

This commit is contained in:
2026-04-26 07:41:45 -04:00
parent 3d5ff8650c
commit 5f4eb60a98
476 changed files with 67971 additions and 125 deletions

21
node_modules/@stablelib/base64/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
This software is licensed under the MIT license:
Copyright (C) 2016 Dmitry Chestnykh
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.

25
node_modules/@stablelib/base64/base64.bench.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
// Copyright (C) 2016 Dmitry Chestnykh
// MIT License. See LICENSE file for details.
import { encode, decode } from "./base64";
import { benchmark, report, byteSeq } from "@stablelib/benchmark";
let buf = byteSeq(1024);
const encBuf = encode(buf);
report("Base64 encode", benchmark(() => encode(buf), buf.length));
// Decode benchmark reports MiB/s for decoded MiB, not input.
report("Base64 decode", benchmark(() => decode(encBuf), buf.length));
declare var Buffer: any;
if (typeof Buffer !== "undefined") {
// For comparison with Node.js buffer speed.
const nodeBuf = Buffer.from(buf);
const nodeEncBuf = nodeBuf.toString("base64");
report("Buffer - Base64 encode", benchmark(() =>
nodeBuf.toString("base64"), nodeBuf.length));
report("Buffer - Base64 decode", benchmark(() =>
Buffer.from(nodeEncBuf, "base64"), nodeBuf.length));
}

85
node_modules/@stablelib/base64/base64.test.ts generated vendored Normal file
View File

@@ -0,0 +1,85 @@
// Copyright (C) 2016 Dmitry Chestnykh
// MIT License. See LICENSE file for details.
import { encode, decode, encodeURLSafe, decodeURLSafe } from "./base64";
const testVectors: [number[], string][] = [
// https://tools.ietf.org/html/rfc4648
[[], ""],
[[102], "Zg=="],
[[102, 111], "Zm8="],
[[102, 111, 111], "Zm9v"],
[[102, 111, 111, 98], "Zm9vYg=="],
[[102, 111, 111, 98, 97], "Zm9vYmE="],
[[102, 111, 111, 98, 97, 114], "Zm9vYmFy"],
// "hello world"
[[104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100], "aGVsbG8gd29ybGQ="],
// zeros
[[0], "AA=="],
[[0, 0], "AAA="],
[[0, 0, 0], "AAAA"],
[[0, 0, 0, 0], "AAAAAA=="],
[[0, 0, 0, 0, 0], "AAAAAAA="],
[[0, 0, 0, 0, 0, 0], "AAAAAAAA"],
// random
[
[111, 16, 164, 40, 38, 216, 61, 120, 247, 118, 115, 82, 77, 65, 170, 155],
"bxCkKCbYPXj3dnNSTUGqmw=="
],
[
[216, 8, 213, 125, 61, 133, 254, 192, 132, 229, 47, 151, 14, 63, 142, 230, 59, 143, 232, 228],
"2AjVfT2F/sCE5S+XDj+O5juP6OQ="
]
];
const badVectors = [
"=",
"==",
"Zg===",
"AAA",
"=Zm8",
"что"
];
describe("Base64", () => {
it("should correctly encode test vectors", () => {
testVectors.forEach((v) => {
const input = new Uint8Array(v[0] as Array<number>);
expect(encode(input)).toBe(v[1]);
});
});
it("should correctly decode test vectors", () => {
testVectors.forEach((v) => {
const output = new Uint8Array(v[0] as Array<number>);
expect(decode(v[1] as string).toString()).toBe(output.toString());
});
});
it("should throw when decoding incorrect strings", () => {
badVectors.forEach((v) => {
expect(() => decode(v)).toThrow();
});
});
});
describe("Base64 URL-safe", () => {
// Converts strings from standard to URL-safe encoding.
const urlSafe = (s: string) => s.replace(/\+/g, "-").replace(/\//g, "_");
it("should correctly encode test vectors", () => {
testVectors.forEach((v) => {
const input = new Uint8Array(v[0] as Array<number>);
expect(encodeURLSafe(input)).toBe(urlSafe(v[1] as string));
});
});
it("should correctly decode test vectors", () => {
testVectors.forEach((v) => {
const output = new Uint8Array(v[0] as Array<number>);
expect(decodeURLSafe(urlSafe(v[1] as string)).toString()).toBe(output.toString());
});
});
it("should throw when decoding incorrect strings", () => {
badVectors.forEach((v) => {
expect(() => decodeURLSafe(urlSafe(v))).toThrow();
});
});
});

283
node_modules/@stablelib/base64/base64.ts generated vendored Normal file
View File

@@ -0,0 +1,283 @@
// Copyright (C) 2016 Dmitry Chestnykh
// MIT License. See LICENSE file for details.
/**
* Package base64 implements Base64 encoding and decoding.
*/
// Invalid character used in decoding to indicate
// that the character to decode is out of range of
// alphabet and cannot be decoded.
const INVALID_BYTE = 256;
/**
* Implements standard Base64 encoding.
*
* Operates in constant time.
*/
export class Coder {
// TODO(dchest): methods to encode chunk-by-chunk.
constructor(private _paddingCharacter = "=") { }
encodedLength(length: number): number {
if (!this._paddingCharacter) {
return (length * 8 + 5) / 6 | 0;
}
return (length + 2) / 3 * 4 | 0;
}
encode(data: Uint8Array): string {
let out = "";
let i = 0;
for (; i < data.length - 2; i += 3) {
let c = (data[i] << 16) | (data[i + 1] << 8) | (data[i + 2]);
out += this._encodeByte((c >>> 3 * 6) & 63);
out += this._encodeByte((c >>> 2 * 6) & 63);
out += this._encodeByte((c >>> 1 * 6) & 63);
out += this._encodeByte((c >>> 0 * 6) & 63);
}
const left = data.length - i;
if (left > 0) {
let c = (data[i] << 16) | (left === 2 ? data[i + 1] << 8 : 0);
out += this._encodeByte((c >>> 3 * 6) & 63);
out += this._encodeByte((c >>> 2 * 6) & 63);
if (left === 2) {
out += this._encodeByte((c >>> 1 * 6) & 63);
} else {
out += this._paddingCharacter || "";
}
out += this._paddingCharacter || "";
}
return out;
}
maxDecodedLength(length: number): number {
if (!this._paddingCharacter) {
return (length * 6 + 7) / 8 | 0;
}
return length / 4 * 3 | 0;
}
decodedLength(s: string): number {
return this.maxDecodedLength(s.length - this._getPaddingLength(s));
}
decode(s: string): Uint8Array {
if (s.length === 0) {
return new Uint8Array(0);
}
const paddingLength = this._getPaddingLength(s);
const length = s.length - paddingLength;
const out = new Uint8Array(this.maxDecodedLength(length));
let op = 0;
let i = 0;
let haveBad = 0;
let v0 = 0, v1 = 0, v2 = 0, v3 = 0;
for (; i < length - 4; i += 4) {
v0 = this._decodeChar(s.charCodeAt(i + 0));
v1 = this._decodeChar(s.charCodeAt(i + 1));
v2 = this._decodeChar(s.charCodeAt(i + 2));
v3 = this._decodeChar(s.charCodeAt(i + 3));
out[op++] = (v0 << 2) | (v1 >>> 4);
out[op++] = (v1 << 4) | (v2 >>> 2);
out[op++] = (v2 << 6) | v3;
haveBad |= v0 & INVALID_BYTE;
haveBad |= v1 & INVALID_BYTE;
haveBad |= v2 & INVALID_BYTE;
haveBad |= v3 & INVALID_BYTE;
}
if (i < length - 1) {
v0 = this._decodeChar(s.charCodeAt(i));
v1 = this._decodeChar(s.charCodeAt(i + 1));
out[op++] = (v0 << 2) | (v1 >>> 4);
haveBad |= v0 & INVALID_BYTE;
haveBad |= v1 & INVALID_BYTE;
}
if (i < length - 2) {
v2 = this._decodeChar(s.charCodeAt(i + 2));
out[op++] = (v1 << 4) | (v2 >>> 2);
haveBad |= v2 & INVALID_BYTE;
}
if (i < length - 3) {
v3 = this._decodeChar(s.charCodeAt(i + 3));
out[op++] = (v2 << 6) | v3;
haveBad |= v3 & INVALID_BYTE;
}
if (haveBad !== 0) {
throw new Error("Base64Coder: incorrect characters for decoding");
}
return out;
}
// Standard encoding have the following encoded/decoded ranges,
// which we need to convert between.
//
// ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 + /
// Index: 0 - 25 26 - 51 52 - 61 62 63
// ASCII: 65 - 90 97 - 122 48 - 57 43 47
//
// Encode 6 bits in b into a new character.
protected _encodeByte(b: number): string {
// Encoding uses constant time operations as follows:
//
// 1. Define comparison of A with B using (A - B) >>> 8:
// if A > B, then result is positive integer
// if A <= B, then result is 0
//
// 2. Define selection of C or 0 using bitwise AND: X & C:
// if X == 0, then result is 0
// if X != 0, then result is C
//
// 3. Start with the smallest comparison (b >= 0), which is always
// true, so set the result to the starting ASCII value (65).
//
// 4. Continue comparing b to higher ASCII values, and selecting
// zero if comparison isn't true, otherwise selecting a value
// to add to result, which:
//
// a) undoes the previous addition
// b) provides new value to add
//
let result = b;
// b >= 0
result += 65;
// b > 25
result += ((25 - b) >>> 8) & ((0 - 65) - 26 + 97);
// b > 51
result += ((51 - b) >>> 8) & ((26 - 97) - 52 + 48);
// b > 61
result += ((61 - b) >>> 8) & ((52 - 48) - 62 + 43);
// b > 62
result += ((62 - b) >>> 8) & ((62 - 43) - 63 + 47);
return String.fromCharCode(result);
}
// Decode a character code into a byte.
// Must return 256 if character is out of alphabet range.
protected _decodeChar(c: number): number {
// Decoding works similar to encoding: using the same comparison
// function, but now it works on ranges: result is always incremented
// by value, but this value becomes zero if the range is not
// satisfied.
//
// Decoding starts with invalid value, 256, which is then
// subtracted when the range is satisfied. If none of the ranges
// apply, the function returns 256, which is then checked by
// the caller to throw error.
let result = INVALID_BYTE; // start with invalid character
// c == 43 (c > 42 and c < 44)
result += (((42 - c) & (c - 44)) >>> 8) & (-INVALID_BYTE + c - 43 + 62);
// c == 47 (c > 46 and c < 48)
result += (((46 - c) & (c - 48)) >>> 8) & (-INVALID_BYTE + c - 47 + 63);
// c > 47 and c < 58
result += (((47 - c) & (c - 58)) >>> 8) & (-INVALID_BYTE + c - 48 + 52);
// c > 64 and c < 91
result += (((64 - c) & (c - 91)) >>> 8) & (-INVALID_BYTE + c - 65 + 0);
// c > 96 and c < 123
result += (((96 - c) & (c - 123)) >>> 8) & (-INVALID_BYTE + c - 97 + 26);
return result;
}
private _getPaddingLength(s: string): number {
let paddingLength = 0;
if (this._paddingCharacter) {
for (let i = s.length - 1; i >= 0; i--) {
if (s[i] !== this._paddingCharacter) {
break;
}
paddingLength++;
}
if (s.length < 4 || paddingLength > 2) {
throw new Error("Base64Coder: incorrect padding");
}
}
return paddingLength;
}
}
const stdCoder = new Coder();
export function encode(data: Uint8Array): string {
return stdCoder.encode(data);
}
export function decode(s: string): Uint8Array {
return stdCoder.decode(s);
}
/**
* Implements URL-safe Base64 encoding.
* (Same as Base64, but '+' is replaced with '-', and '/' with '_').
*
* Operates in constant time.
*/
export class URLSafeCoder extends Coder {
// URL-safe encoding have the following encoded/decoded ranges:
//
// ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 - _
// Index: 0 - 25 26 - 51 52 - 61 62 63
// ASCII: 65 - 90 97 - 122 48 - 57 45 95
//
protected _encodeByte(b: number): string {
let result = b;
// b >= 0
result += 65;
// b > 25
result += ((25 - b) >>> 8) & ((0 - 65) - 26 + 97);
// b > 51
result += ((51 - b) >>> 8) & ((26 - 97) - 52 + 48);
// b > 61
result += ((61 - b) >>> 8) & ((52 - 48) - 62 + 45);
// b > 62
result += ((62 - b) >>> 8) & ((62 - 45) - 63 + 95);
return String.fromCharCode(result);
}
protected _decodeChar(c: number): number {
let result = INVALID_BYTE;
// c == 45 (c > 44 and c < 46)
result += (((44 - c) & (c - 46)) >>> 8) & (-INVALID_BYTE + c - 45 + 62);
// c == 95 (c > 94 and c < 96)
result += (((94 - c) & (c - 96)) >>> 8) & (-INVALID_BYTE + c - 95 + 63);
// c > 47 and c < 58
result += (((47 - c) & (c - 58)) >>> 8) & (-INVALID_BYTE + c - 48 + 52);
// c > 64 and c < 91
result += (((64 - c) & (c - 91)) >>> 8) & (-INVALID_BYTE + c - 65 + 0);
// c > 96 and c < 123
result += (((96 - c) & (c - 123)) >>> 8) & (-INVALID_BYTE + c - 97 + 26);
return result;
}
}
const urlSafeCoder = new URLSafeCoder();
export function encodeURLSafe(data: Uint8Array): string {
return urlSafeCoder.encode(data);
}
export function decodeURLSafe(s: string): Uint8Array {
return urlSafeCoder.decode(s);
}
export const encodedLength = (length: number) =>
stdCoder.encodedLength(length);
export const maxDecodedLength = (length: number) =>
stdCoder.maxDecodedLength(length);
export const decodedLength = (s: string) =>
stdCoder.decodedLength(s);

1
node_modules/@stablelib/base64/lib/base64.bench.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

23
node_modules/@stablelib/base64/lib/base64.bench.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
"use strict";
// Copyright (C) 2016 Dmitry Chestnykh
// MIT License. See LICENSE file for details.
Object.defineProperty(exports, "__esModule", { value: true });
var base64_1 = require("./base64");
var benchmark_1 = require("@stablelib/benchmark");
var buf = benchmark_1.byteSeq(1024);
var encBuf = base64_1.encode(buf);
benchmark_1.report("Base64 encode", benchmark_1.benchmark(function () { return base64_1.encode(buf); }, buf.length));
// Decode benchmark reports MiB/s for decoded MiB, not input.
benchmark_1.report("Base64 decode", benchmark_1.benchmark(function () { return base64_1.decode(encBuf); }, buf.length));
if (typeof Buffer !== "undefined") {
// For comparison with Node.js buffer speed.
var nodeBuf_1 = Buffer.from(buf);
var nodeEncBuf_1 = nodeBuf_1.toString("base64");
benchmark_1.report("Buffer - Base64 encode", benchmark_1.benchmark(function () {
return nodeBuf_1.toString("base64");
}, nodeBuf_1.length));
benchmark_1.report("Buffer - Base64 decode", benchmark_1.benchmark(function () {
return Buffer.from(nodeEncBuf_1, "base64");
}, nodeBuf_1.length));
}
//# sourceMappingURL=base64.bench.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"base64.bench.js","sourceRoot":"","sources":["../base64.bench.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,6CAA6C;;AAE7C,mCAA0C;AAC1C,kDAAkE;AAElE,IAAI,GAAG,GAAG,mBAAO,CAAC,IAAI,CAAC,CAAC;AACxB,IAAM,MAAM,GAAG,eAAM,CAAC,GAAG,CAAC,CAAC;AAE3B,kBAAM,CAAC,eAAe,EAAE,qBAAS,CAAC,cAAM,OAAA,eAAM,CAAC,GAAG,CAAC,EAAX,CAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAClE,6DAA6D;AAC7D,kBAAM,CAAC,eAAe,EAAE,qBAAS,CAAC,cAAM,OAAA,eAAM,CAAC,MAAM,CAAC,EAAd,CAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAIrE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,4CAA4C;IAC5C,IAAM,SAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,IAAM,YAAU,GAAG,SAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE9C,kBAAM,CAAC,wBAAwB,EAAE,qBAAS,CAAC;QACvC,OAAA,SAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAA1B,CAA0B,EAAE,SAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,kBAAM,CAAC,wBAAwB,EAAE,qBAAS,CAAC;QACvC,OAAA,MAAM,CAAC,IAAI,CAAC,YAAU,EAAE,QAAQ,CAAC;IAAjC,CAAiC,EAAE,SAAO,CAAC,MAAM,CAAC,CAAC,CAAC;CAC3D"}

34
node_modules/@stablelib/base64/lib/base64.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
/**
* Implements standard Base64 encoding.
*
* Operates in constant time.
*/
export declare class Coder {
private _paddingCharacter;
constructor(_paddingCharacter?: string);
encodedLength(length: number): number;
encode(data: Uint8Array): string;
maxDecodedLength(length: number): number;
decodedLength(s: string): number;
decode(s: string): Uint8Array;
protected _encodeByte(b: number): string;
protected _decodeChar(c: number): number;
private _getPaddingLength;
}
export declare function encode(data: Uint8Array): string;
export declare function decode(s: string): Uint8Array;
/**
* Implements URL-safe Base64 encoding.
* (Same as Base64, but '+' is replaced with '-', and '/' with '_').
*
* Operates in constant time.
*/
export declare class URLSafeCoder extends Coder {
protected _encodeByte(b: number): string;
protected _decodeChar(c: number): number;
}
export declare function encodeURLSafe(data: Uint8Array): string;
export declare function decodeURLSafe(s: string): Uint8Array;
export declare const encodedLength: (length: number) => number;
export declare const maxDecodedLength: (length: number) => number;
export declare const decodedLength: (s: string) => number;

282
node_modules/@stablelib/base64/lib/base64.js generated vendored Normal file
View File

@@ -0,0 +1,282 @@
"use strict";
// Copyright (C) 2016 Dmitry Chestnykh
// MIT License. See LICENSE file for details.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Package base64 implements Base64 encoding and decoding.
*/
// Invalid character used in decoding to indicate
// that the character to decode is out of range of
// alphabet and cannot be decoded.
var INVALID_BYTE = 256;
/**
* Implements standard Base64 encoding.
*
* Operates in constant time.
*/
var Coder = /** @class */ (function () {
// TODO(dchest): methods to encode chunk-by-chunk.
function Coder(_paddingCharacter) {
if (_paddingCharacter === void 0) { _paddingCharacter = "="; }
this._paddingCharacter = _paddingCharacter;
}
Coder.prototype.encodedLength = function (length) {
if (!this._paddingCharacter) {
return (length * 8 + 5) / 6 | 0;
}
return (length + 2) / 3 * 4 | 0;
};
Coder.prototype.encode = function (data) {
var out = "";
var i = 0;
for (; i < data.length - 2; i += 3) {
var c = (data[i] << 16) | (data[i + 1] << 8) | (data[i + 2]);
out += this._encodeByte((c >>> 3 * 6) & 63);
out += this._encodeByte((c >>> 2 * 6) & 63);
out += this._encodeByte((c >>> 1 * 6) & 63);
out += this._encodeByte((c >>> 0 * 6) & 63);
}
var left = data.length - i;
if (left > 0) {
var c = (data[i] << 16) | (left === 2 ? data[i + 1] << 8 : 0);
out += this._encodeByte((c >>> 3 * 6) & 63);
out += this._encodeByte((c >>> 2 * 6) & 63);
if (left === 2) {
out += this._encodeByte((c >>> 1 * 6) & 63);
}
else {
out += this._paddingCharacter || "";
}
out += this._paddingCharacter || "";
}
return out;
};
Coder.prototype.maxDecodedLength = function (length) {
if (!this._paddingCharacter) {
return (length * 6 + 7) / 8 | 0;
}
return length / 4 * 3 | 0;
};
Coder.prototype.decodedLength = function (s) {
return this.maxDecodedLength(s.length - this._getPaddingLength(s));
};
Coder.prototype.decode = function (s) {
if (s.length === 0) {
return new Uint8Array(0);
}
var paddingLength = this._getPaddingLength(s);
var length = s.length - paddingLength;
var out = new Uint8Array(this.maxDecodedLength(length));
var op = 0;
var i = 0;
var haveBad = 0;
var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
for (; i < length - 4; i += 4) {
v0 = this._decodeChar(s.charCodeAt(i + 0));
v1 = this._decodeChar(s.charCodeAt(i + 1));
v2 = this._decodeChar(s.charCodeAt(i + 2));
v3 = this._decodeChar(s.charCodeAt(i + 3));
out[op++] = (v0 << 2) | (v1 >>> 4);
out[op++] = (v1 << 4) | (v2 >>> 2);
out[op++] = (v2 << 6) | v3;
haveBad |= v0 & INVALID_BYTE;
haveBad |= v1 & INVALID_BYTE;
haveBad |= v2 & INVALID_BYTE;
haveBad |= v3 & INVALID_BYTE;
}
if (i < length - 1) {
v0 = this._decodeChar(s.charCodeAt(i));
v1 = this._decodeChar(s.charCodeAt(i + 1));
out[op++] = (v0 << 2) | (v1 >>> 4);
haveBad |= v0 & INVALID_BYTE;
haveBad |= v1 & INVALID_BYTE;
}
if (i < length - 2) {
v2 = this._decodeChar(s.charCodeAt(i + 2));
out[op++] = (v1 << 4) | (v2 >>> 2);
haveBad |= v2 & INVALID_BYTE;
}
if (i < length - 3) {
v3 = this._decodeChar(s.charCodeAt(i + 3));
out[op++] = (v2 << 6) | v3;
haveBad |= v3 & INVALID_BYTE;
}
if (haveBad !== 0) {
throw new Error("Base64Coder: incorrect characters for decoding");
}
return out;
};
// Standard encoding have the following encoded/decoded ranges,
// which we need to convert between.
//
// ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 + /
// Index: 0 - 25 26 - 51 52 - 61 62 63
// ASCII: 65 - 90 97 - 122 48 - 57 43 47
//
// Encode 6 bits in b into a new character.
Coder.prototype._encodeByte = function (b) {
// Encoding uses constant time operations as follows:
//
// 1. Define comparison of A with B using (A - B) >>> 8:
// if A > B, then result is positive integer
// if A <= B, then result is 0
//
// 2. Define selection of C or 0 using bitwise AND: X & C:
// if X == 0, then result is 0
// if X != 0, then result is C
//
// 3. Start with the smallest comparison (b >= 0), which is always
// true, so set the result to the starting ASCII value (65).
//
// 4. Continue comparing b to higher ASCII values, and selecting
// zero if comparison isn't true, otherwise selecting a value
// to add to result, which:
//
// a) undoes the previous addition
// b) provides new value to add
//
var result = b;
// b >= 0
result += 65;
// b > 25
result += ((25 - b) >>> 8) & ((0 - 65) - 26 + 97);
// b > 51
result += ((51 - b) >>> 8) & ((26 - 97) - 52 + 48);
// b > 61
result += ((61 - b) >>> 8) & ((52 - 48) - 62 + 43);
// b > 62
result += ((62 - b) >>> 8) & ((62 - 43) - 63 + 47);
return String.fromCharCode(result);
};
// Decode a character code into a byte.
// Must return 256 if character is out of alphabet range.
Coder.prototype._decodeChar = function (c) {
// Decoding works similar to encoding: using the same comparison
// function, but now it works on ranges: result is always incremented
// by value, but this value becomes zero if the range is not
// satisfied.
//
// Decoding starts with invalid value, 256, which is then
// subtracted when the range is satisfied. If none of the ranges
// apply, the function returns 256, which is then checked by
// the caller to throw error.
var result = INVALID_BYTE; // start with invalid character
// c == 43 (c > 42 and c < 44)
result += (((42 - c) & (c - 44)) >>> 8) & (-INVALID_BYTE + c - 43 + 62);
// c == 47 (c > 46 and c < 48)
result += (((46 - c) & (c - 48)) >>> 8) & (-INVALID_BYTE + c - 47 + 63);
// c > 47 and c < 58
result += (((47 - c) & (c - 58)) >>> 8) & (-INVALID_BYTE + c - 48 + 52);
// c > 64 and c < 91
result += (((64 - c) & (c - 91)) >>> 8) & (-INVALID_BYTE + c - 65 + 0);
// c > 96 and c < 123
result += (((96 - c) & (c - 123)) >>> 8) & (-INVALID_BYTE + c - 97 + 26);
return result;
};
Coder.prototype._getPaddingLength = function (s) {
var paddingLength = 0;
if (this._paddingCharacter) {
for (var i = s.length - 1; i >= 0; i--) {
if (s[i] !== this._paddingCharacter) {
break;
}
paddingLength++;
}
if (s.length < 4 || paddingLength > 2) {
throw new Error("Base64Coder: incorrect padding");
}
}
return paddingLength;
};
return Coder;
}());
exports.Coder = Coder;
var stdCoder = new Coder();
function encode(data) {
return stdCoder.encode(data);
}
exports.encode = encode;
function decode(s) {
return stdCoder.decode(s);
}
exports.decode = decode;
/**
* Implements URL-safe Base64 encoding.
* (Same as Base64, but '+' is replaced with '-', and '/' with '_').
*
* Operates in constant time.
*/
var URLSafeCoder = /** @class */ (function (_super) {
__extends(URLSafeCoder, _super);
function URLSafeCoder() {
return _super !== null && _super.apply(this, arguments) || this;
}
// URL-safe encoding have the following encoded/decoded ranges:
//
// ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 - _
// Index: 0 - 25 26 - 51 52 - 61 62 63
// ASCII: 65 - 90 97 - 122 48 - 57 45 95
//
URLSafeCoder.prototype._encodeByte = function (b) {
var result = b;
// b >= 0
result += 65;
// b > 25
result += ((25 - b) >>> 8) & ((0 - 65) - 26 + 97);
// b > 51
result += ((51 - b) >>> 8) & ((26 - 97) - 52 + 48);
// b > 61
result += ((61 - b) >>> 8) & ((52 - 48) - 62 + 45);
// b > 62
result += ((62 - b) >>> 8) & ((62 - 45) - 63 + 95);
return String.fromCharCode(result);
};
URLSafeCoder.prototype._decodeChar = function (c) {
var result = INVALID_BYTE;
// c == 45 (c > 44 and c < 46)
result += (((44 - c) & (c - 46)) >>> 8) & (-INVALID_BYTE + c - 45 + 62);
// c == 95 (c > 94 and c < 96)
result += (((94 - c) & (c - 96)) >>> 8) & (-INVALID_BYTE + c - 95 + 63);
// c > 47 and c < 58
result += (((47 - c) & (c - 58)) >>> 8) & (-INVALID_BYTE + c - 48 + 52);
// c > 64 and c < 91
result += (((64 - c) & (c - 91)) >>> 8) & (-INVALID_BYTE + c - 65 + 0);
// c > 96 and c < 123
result += (((96 - c) & (c - 123)) >>> 8) & (-INVALID_BYTE + c - 97 + 26);
return result;
};
return URLSafeCoder;
}(Coder));
exports.URLSafeCoder = URLSafeCoder;
var urlSafeCoder = new URLSafeCoder();
function encodeURLSafe(data) {
return urlSafeCoder.encode(data);
}
exports.encodeURLSafe = encodeURLSafe;
function decodeURLSafe(s) {
return urlSafeCoder.decode(s);
}
exports.decodeURLSafe = decodeURLSafe;
exports.encodedLength = function (length) {
return stdCoder.encodedLength(length);
};
exports.maxDecodedLength = function (length) {
return stdCoder.maxDecodedLength(length);
};
exports.decodedLength = function (s) {
return stdCoder.decodedLength(s);
};
//# sourceMappingURL=base64.js.map

1
node_modules/@stablelib/base64/lib/base64.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/@stablelib/base64/lib/base64.test.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

82
node_modules/@stablelib/base64/lib/base64.test.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
"use strict";
// Copyright (C) 2016 Dmitry Chestnykh
// MIT License. See LICENSE file for details.
Object.defineProperty(exports, "__esModule", { value: true });
var base64_1 = require("./base64");
var testVectors = [
// https://tools.ietf.org/html/rfc4648
[[], ""],
[[102], "Zg=="],
[[102, 111], "Zm8="],
[[102, 111, 111], "Zm9v"],
[[102, 111, 111, 98], "Zm9vYg=="],
[[102, 111, 111, 98, 97], "Zm9vYmE="],
[[102, 111, 111, 98, 97, 114], "Zm9vYmFy"],
// "hello world"
[[104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100], "aGVsbG8gd29ybGQ="],
// zeros
[[0], "AA=="],
[[0, 0], "AAA="],
[[0, 0, 0], "AAAA"],
[[0, 0, 0, 0], "AAAAAA=="],
[[0, 0, 0, 0, 0], "AAAAAAA="],
[[0, 0, 0, 0, 0, 0], "AAAAAAAA"],
// random
[
[111, 16, 164, 40, 38, 216, 61, 120, 247, 118, 115, 82, 77, 65, 170, 155],
"bxCkKCbYPXj3dnNSTUGqmw=="
],
[
[216, 8, 213, 125, 61, 133, 254, 192, 132, 229, 47, 151, 14, 63, 142, 230, 59, 143, 232, 228],
"2AjVfT2F/sCE5S+XDj+O5juP6OQ="
]
];
var badVectors = [
"=",
"==",
"Zg===",
"AAA",
"=Zm8",
"что"
];
describe("Base64", function () {
it("should correctly encode test vectors", function () {
testVectors.forEach(function (v) {
var input = new Uint8Array(v[0]);
expect(base64_1.encode(input)).toBe(v[1]);
});
});
it("should correctly decode test vectors", function () {
testVectors.forEach(function (v) {
var output = new Uint8Array(v[0]);
expect(base64_1.decode(v[1]).toString()).toBe(output.toString());
});
});
it("should throw when decoding incorrect strings", function () {
badVectors.forEach(function (v) {
expect(function () { return base64_1.decode(v); }).toThrow();
});
});
});
describe("Base64 URL-safe", function () {
// Converts strings from standard to URL-safe encoding.
var urlSafe = function (s) { return s.replace(/\+/g, "-").replace(/\//g, "_"); };
it("should correctly encode test vectors", function () {
testVectors.forEach(function (v) {
var input = new Uint8Array(v[0]);
expect(base64_1.encodeURLSafe(input)).toBe(urlSafe(v[1]));
});
});
it("should correctly decode test vectors", function () {
testVectors.forEach(function (v) {
var output = new Uint8Array(v[0]);
expect(base64_1.decodeURLSafe(urlSafe(v[1])).toString()).toBe(output.toString());
});
});
it("should throw when decoding incorrect strings", function () {
badVectors.forEach(function (v) {
expect(function () { return base64_1.decodeURLSafe(urlSafe(v)); }).toThrow();
});
});
});
//# sourceMappingURL=base64.test.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"base64.test.js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tF,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,8CAA8C,EAAE;QAC/C,UAAU,CAAC,OAAO,CAAC,UAAC,CAAC;YACjB,MAAM,CAAC,cAAM,OAAA,sBAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAzB,CAAyB,CAAC,CAAC,OAAO,EAAE,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

25
node_modules/@stablelib/base64/package.json generated vendored Normal file
View File

@@ -0,0 +1,25 @@
{
"name": "@stablelib/base64",
"version": "1.0.1",
"description": "Base64 encoding and decoding",
"main": "./lib/base64.js",
"typings": "./lib/base64.d.ts",
"author": "Dmitry Chestnykh",
"license": "MIT",
"repository": {
"url": "https://github.com/StableLib/stablelib"
},
"homepage": "https://github.com/StableLib/stablelib/tree/master/packages/base64",
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc",
"test": "jasmine JASMINE_CONFIG_PATH=../../configs/jasmine.json",
"bench": "node ./lib/base64.bench.js"
},
"devDependencies": {
"@stablelib/benchmark": "^1.0.1"
},
"gitHead": "03dadf27703120d54e6be8436525228ee1c4299b"
}

27
node_modules/@stablelib/base64/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"removeComments": false,
"preserveConstEnums": true,
"moduleResolution": "node",
"newLine": "LF",
"sourceMap": true,
"declaration": true,
"outDir": "lib",
"lib": [
"es5",
"es2015.promise",
"dom",
"scripthost"
]
},
"exclude": [
"node_modules",
"lib"
]
}