first commit

This commit is contained in:
Ale
2025-05-13 12:01:17 +02:00
commit d7881a4461
4852 changed files with 537159 additions and 0 deletions

11
node_modules/pdf-lib/cjs/utils/Cache.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
declare class Cache<T> {
static readonly populatedBy: <T_1>(populate: () => T_1) => Cache<T_1>;
private readonly populate;
private value;
private constructor();
getValue(): T | undefined;
access(): T;
invalidate(): void;
}
export default Cache;
//# sourceMappingURL=Cache.d.ts.map

1
node_modules/pdf-lib/cjs/utils/Cache.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../src/utils/Cache.ts"],"names":[],"mappings":"AAAA,cAAM,KAAK,CAAC,CAAC;IACX,MAAM,CAAC,QAAQ,CAAC,WAAW,2CAAiD;IAE5E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO;IAKP,QAAQ,IAAI,CAAC,GAAG,SAAS;IAIzB,MAAM,IAAI,CAAC;IAKX,UAAU,IAAI,IAAI;CAGnB;AAED,eAAe,KAAK,CAAC"}

23
node_modules/pdf-lib/cjs/utils/Cache.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Cache = /** @class */ (function () {
function Cache(populate) {
this.populate = populate;
this.value = undefined;
}
Cache.prototype.getValue = function () {
return this.value;
};
Cache.prototype.access = function () {
if (!this.value)
this.value = this.populate();
return this.value;
};
Cache.prototype.invalidate = function () {
this.value = undefined;
};
Cache.populatedBy = function (populate) { return new Cache(populate); };
return Cache;
}());
exports.default = Cache;
//# sourceMappingURL=Cache.js.map

1
node_modules/pdf-lib/cjs/utils/Cache.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../src/utils/Cache.ts"],"names":[],"mappings":";;AAAA;IAME,eAAoB,QAAiB;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,wBAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,sBAAM,GAAN;QACE,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,0BAAU,GAAV;QACE,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IArBe,iBAAW,GAAG,UAAI,QAAiB,IAAK,OAAA,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAnB,CAAmB,CAAC;IAsB9E,YAAC;CAAA,AAvBD,IAuBC;AAED,kBAAe,KAAK,CAAC"}

16
node_modules/pdf-lib/cjs/utils/arrays.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
export declare const last: <T>(array: T[]) => T;
export declare const typedArrayFor: (value: string | Uint8Array) => Uint8Array;
export declare const mergeIntoTypedArray: (...arrays: (string | Uint8Array)[]) => Uint8Array;
export declare const mergeUint8Arrays: (arrays: Uint8Array[]) => Uint8Array;
export declare const arrayAsString: (array: Uint8Array | number[]) => string;
export declare const byAscendingId: <T extends {
id: any;
}>(a: T, b: T) => number;
export declare const sortedUniq: <T>(array: T[], indexer: (elem: T) => any) => T[];
export declare const reverseArray: (array: Uint8Array) => Uint8Array;
export declare const sum: (array: number[] | Uint8Array) => number;
export declare const range: (start: number, end: number) => number[];
export declare const pluckIndices: <T>(arr: T[], indices: number[]) => T[];
export declare const canBeConvertedToUint8Array: (input: any) => input is string | Uint8Array | ArrayBuffer;
export declare const toUint8Array: (input: string | ArrayBuffer | Uint8Array) => Uint8Array;
//# sourceMappingURL=arrays.d.ts.map

1
node_modules/pdf-lib/cjs/utils/arrays.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../../src/utils/arrays.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,sBAAgD,CAAC;AAKlE,eAAO,MAAM,aAAa,UAAW,MAAM,GAAG,UAAU,KAAG,UAQ1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,cAAe,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,eAyBrE,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,UAAU,EAAE,KAAG,UAevD,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,UAAU,GAAG,MAAM,EAAE,KAAG,MAM5D,CAAC;AAEF,eAAO,MAAM,aAAa;QAAoB,GAAG;wBAA8B,CAAC;AAEhF,eAAO,MAAM,UAAU,wCAAyC,GAAG,QAYlE,CAAC;AAKF,eAAO,MAAM,YAAY,UAAW,UAAU,eAW7C,CAAC;AAEF,eAAO,MAAM,GAAG,UAAW,MAAM,EAAE,GAAG,UAAU,KAAG,MAMlD,CAAC;AAEF,eAAO,MAAM,KAAK,UAAW,MAAM,OAAO,MAAM,KAAG,MAAM,EAMxD,CAAC;AAEF,eAAO,MAAM,YAAY,yBAA0B,MAAM,EAAE,QAM1D,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAC9B,GAAG,+CAIe,CAAC;AAE5B,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,WAAW,GAAG,UAAU,eAYpE,CAAC"}

132
node_modules/pdf-lib/cjs/utils/arrays.js generated vendored Normal file
View File

@@ -0,0 +1,132 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUint8Array = exports.canBeConvertedToUint8Array = exports.pluckIndices = exports.range = exports.sum = exports.reverseArray = exports.sortedUniq = exports.byAscendingId = exports.arrayAsString = exports.mergeUint8Arrays = exports.mergeIntoTypedArray = exports.typedArrayFor = exports.last = void 0;
var base64_1 = require("./base64");
var strings_1 = require("./strings");
exports.last = function (array) { return array[array.length - 1]; };
// export const dropLast = <T>(array: T[]): T[] =>
// array.slice(0, array.length - 1);
exports.typedArrayFor = function (value) {
if (value instanceof Uint8Array)
return value;
var length = value.length;
var typedArray = new Uint8Array(length);
for (var idx = 0; idx < length; idx++) {
typedArray[idx] = value.charCodeAt(idx);
}
return typedArray;
};
exports.mergeIntoTypedArray = function () {
var arrays = [];
for (var _i = 0; _i < arguments.length; _i++) {
arrays[_i] = arguments[_i];
}
var arrayCount = arrays.length;
var typedArrays = [];
for (var idx = 0; idx < arrayCount; idx++) {
var element = arrays[idx];
typedArrays[idx] =
element instanceof Uint8Array ? element : exports.typedArrayFor(element);
}
var totalSize = 0;
for (var idx = 0; idx < arrayCount; idx++) {
totalSize += arrays[idx].length;
}
var merged = new Uint8Array(totalSize);
var offset = 0;
for (var arrIdx = 0; arrIdx < arrayCount; arrIdx++) {
var arr = typedArrays[arrIdx];
for (var byteIdx = 0, arrLen = arr.length; byteIdx < arrLen; byteIdx++) {
merged[offset++] = arr[byteIdx];
}
}
return merged;
};
exports.mergeUint8Arrays = function (arrays) {
var totalSize = 0;
for (var idx = 0, len = arrays.length; idx < len; idx++) {
totalSize += arrays[idx].length;
}
var mergedBuffer = new Uint8Array(totalSize);
var offset = 0;
for (var idx = 0, len = arrays.length; idx < len; idx++) {
var array = arrays[idx];
mergedBuffer.set(array, offset);
offset += array.length;
}
return mergedBuffer;
};
exports.arrayAsString = function (array) {
var str = '';
for (var idx = 0, len = array.length; idx < len; idx++) {
str += strings_1.charFromCode(array[idx]);
}
return str;
};
exports.byAscendingId = function (a, b) { return a.id - b.id; };
exports.sortedUniq = function (array, indexer) {
var uniq = [];
for (var idx = 0, len = array.length; idx < len; idx++) {
var curr = array[idx];
var prev = array[idx - 1];
if (idx === 0 || indexer(curr) !== indexer(prev)) {
uniq.push(curr);
}
}
return uniq;
};
// Arrays and TypedArrays in JS both have .reverse() methods, which would seem
// to negate the need for this function. However, not all runtimes support this
// method (e.g. React Native). This function compensates for that fact.
exports.reverseArray = function (array) {
var arrayLen = array.length;
for (var idx = 0, len = Math.floor(arrayLen / 2); idx < len; idx++) {
var leftIdx = idx;
var rightIdx = arrayLen - idx - 1;
var temp = array[idx];
array[leftIdx] = array[rightIdx];
array[rightIdx] = temp;
}
return array;
};
exports.sum = function (array) {
var total = 0;
for (var idx = 0, len = array.length; idx < len; idx++) {
total += array[idx];
}
return total;
};
exports.range = function (start, end) {
var arr = new Array(end - start);
for (var idx = 0, len = arr.length; idx < len; idx++) {
arr[idx] = start + idx;
}
return arr;
};
exports.pluckIndices = function (arr, indices) {
var plucked = new Array(indices.length);
for (var idx = 0, len = indices.length; idx < len; idx++) {
plucked[idx] = arr[indices[idx]];
}
return plucked;
};
exports.canBeConvertedToUint8Array = function (input) {
return input instanceof Uint8Array ||
input instanceof ArrayBuffer ||
typeof input === 'string';
};
exports.toUint8Array = function (input) {
if (typeof input === 'string') {
return base64_1.decodeFromBase64DataUri(input);
}
else if (input instanceof ArrayBuffer) {
return new Uint8Array(input);
}
else if (input instanceof Uint8Array) {
return input;
}
else {
throw new TypeError('`input` must be one of `string | ArrayBuffer | Uint8Array`');
}
};
//# sourceMappingURL=arrays.js.map

1
node_modules/pdf-lib/cjs/utils/arrays.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../src/utils/arrays.ts"],"names":[],"mappings":";;;AAAA,mCAA2D;AAC3D,qCAAiD;AAEpC,QAAA,IAAI,GAAG,UAAI,KAAU,IAAQ,OAAA,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAvB,CAAuB,CAAC;AAElE,kDAAkD;AAClD,oCAAoC;AAEvB,QAAA,aAAa,GAAG,UAAC,KAA0B;IACtD,IAAI,KAAK,YAAY,UAAU;QAAE,OAAO,KAAK,CAAC;IAC9C,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,IAAM,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1C,KAAK,I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;KAC9B;SAAM,IAAI,KAAK,YAAY,UAAU,EAAE;QACtC,OAAO,KAAK,CAAC;KACd;SAAM;QACL,MAAM,IAAI,SAAS,CACjB,4DAA4D,CAC7D,CAAC;KACH;AACH,CAAC,CAAC"}

6
node_modules/pdf-lib/cjs/utils/async.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
/**
* Returns a Promise that resolves after at least one tick of the
* Macro Task Queue occurs.
*/
export declare const waitForTick: () => Promise<void>;
//# sourceMappingURL=async.d.ts.map

1
node_modules/pdf-lib/cjs/utils/async.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/utils/async.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAO,OAAO,CAAC,IAAI,CAGvC,CAAC"}

13
node_modules/pdf-lib/cjs/utils/async.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.waitForTick = void 0;
/**
* Returns a Promise that resolves after at least one tick of the
* Macro Task Queue occurs.
*/
exports.waitForTick = function () {
return new Promise(function (resolve) {
setTimeout(function () { return resolve(); }, 0);
});
};
//# sourceMappingURL=async.js.map

1
node_modules/pdf-lib/cjs/utils/async.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../src/utils/async.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB,OAAA,IAAI,OAAO,CAAC,UAAC,OAAO;QAClB,UAAU,CAAC,cAAM,OAAA,OAAO,EAAE,EAAT,CAAS,EAAE,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC;AAFF,CAEE,CAAC"}

11
node_modules/pdf-lib/cjs/utils/base64.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
export declare const encodeToBase64: (bytes: Uint8Array) => string;
export declare const decodeFromBase64: (base64: string) => Uint8Array;
/**
* If the `dataUri` input is a data URI, then the data URI prefix must not be
* longer than 100 characters, or this function will fail to decode it.
*
* @param dataUri a base64 data URI or plain base64 string
* @returns a Uint8Array containing the decoded input
*/
export declare const decodeFromBase64DataUri: (dataUri: string) => Uint8Array;
//# sourceMappingURL=base64.d.ts.map

1
node_modules/pdf-lib/cjs/utils/base64.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/utils/base64.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,cAAc,UAAW,UAAU,KAAG,MAiBlD,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,MAAM,KAAG,UA+BjD,CAAC;AAMF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,YAAa,MAAM,KAAG,UAczD,CAAC"}

87
node_modules/pdf-lib/cjs/utils/base64.js generated vendored Normal file
View File

@@ -0,0 +1,87 @@
"use strict";
/*
* The `chars`, `lookup`, `encode`, and `decode` members of this file are
* licensed under the following:
*
* base64-arraybuffer
* https://github.com/niklasvh/base64-arraybuffer
*
* Copyright (c) 2012 Niklas von Hertzen
* Licensed under the MIT license.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeFromBase64DataUri = exports.decodeFromBase64 = exports.encodeToBase64 = void 0;
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup = new Uint8Array(256);
for (var i = 0; i < chars.length; i++) {
lookup[chars.charCodeAt(i)] = i;
}
exports.encodeToBase64 = function (bytes) {
var base64 = '';
var len = bytes.length;
for (var i = 0; i < len; i += 3) {
base64 += chars[bytes[i] >> 2];
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
base64 += chars[bytes[i + 2] & 63];
}
if (len % 3 === 2) {
base64 = base64.substring(0, base64.length - 1) + '=';
}
else if (len % 3 === 1) {
base64 = base64.substring(0, base64.length - 2) + '==';
}
return base64;
};
exports.decodeFromBase64 = function (base64) {
var bufferLength = base64.length * 0.75;
var len = base64.length;
var i;
var p = 0;
var encoded1;
var encoded2;
var encoded3;
var encoded4;
if (base64[base64.length - 1] === '=') {
bufferLength--;
if (base64[base64.length - 2] === '=') {
bufferLength--;
}
}
var bytes = new Uint8Array(bufferLength);
for (i = 0; i < len; i += 4) {
encoded1 = lookup[base64.charCodeAt(i)];
encoded2 = lookup[base64.charCodeAt(i + 1)];
encoded3 = lookup[base64.charCodeAt(i + 2)];
encoded4 = lookup[base64.charCodeAt(i + 3)];
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
}
return bytes;
};
// This regex is designed to be as flexible as possible. It will parse certain
// invalid data URIs.
var DATA_URI_PREFIX_REGEX = /^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i;
/**
* If the `dataUri` input is a data URI, then the data URI prefix must not be
* longer than 100 characters, or this function will fail to decode it.
*
* @param dataUri a base64 data URI or plain base64 string
* @returns a Uint8Array containing the decoded input
*/
exports.decodeFromBase64DataUri = function (dataUri) {
var trimmedUri = dataUri.trim();
var prefix = trimmedUri.substring(0, 100);
var res = prefix.match(DATA_URI_PREFIX_REGEX);
// Assume it's not a data URI - just a plain base64 string
if (!res)
return exports.decodeFromBase64(trimmedUri);
// Remove the data URI prefix and parse the remainder as a base64 string
var fullMatch = res[0];
var data = trimmedUri.substring(fullMatch.length);
return exports.decodeFromBase64(data);
};
//# sourceMappingURL=base64.js.map

1
node_modules/pdf-lib/cjs/utils/base64.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/utils/base64.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,IAAM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AC,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;QAC/C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;QACtD,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;KACtD;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,8EAA8E;AAC9E,qBAAqB;AACrB,IAAM,qBAAqB,GAAG,sDAAsD,CAAC;AAErF;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAG,UAAC,OAAe;IACrD,IAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAElC,IAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5C,IAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAEhD,0DAA0D;IAC1D,IAAI,CAAC,GAAG;QAAE,OAAO,wBAAgB,CAAC,UAAU,CAAC,CAAC;IAE9C,wEAAwE;IACjE,IAAA,SAAS,GAAI,GAAG,GAAP,CAAQ;IACxB,IAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAEpD,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC"}

2
node_modules/pdf-lib/cjs/utils/errors.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export declare const error: (msg: string) => never;
//# sourceMappingURL=errors.d.ts.map

1
node_modules/pdf-lib/cjs/utils/errors.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,QAAS,MAAM,UAEhC,CAAC"}

7
node_modules/pdf-lib/cjs/utils/errors.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.error = void 0;
exports.error = function (msg) {
throw new Error(msg);
};
//# sourceMappingURL=errors.js.map

1
node_modules/pdf-lib/cjs/utils/errors.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG,UAAC,GAAW;IAC/B,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC"}

12
node_modules/pdf-lib/cjs/utils/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
export * from "./arrays";
export * from "./async";
export * from "./strings";
export * from "./unicode";
export * from "./numbers";
export * from "./errors";
export * from "./base64";
export * from "./objects";
export * from "./validators";
export * from "./pdfDocEncoding";
export { default as Cache } from "./Cache";
//# sourceMappingURL=index.d.ts.map

1
node_modules/pdf-lib/cjs/utils/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAW4H,UAAU,CAXrG;AACjC,cAUsI,SAAS,CAV/G;AAChC,cAS+I,WAAW,CATxH;AAClC,cAQ0J,WAAW,CARnI;AAClC,cAOqK,WAAW,CAP9I;AAClC,cAMgL,UAAU,CANzJ;AACjC,cAK0L,UAAU,CALnK;AACjC,cAIoM,WAAW,CAJ7K;AAClC,cAG+M,cAAc,CAHxL;AACrC,cAE6N,kBAAkB,CAFtM;AACzC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MACoN,SAAS,CADrM"}

16
node_modules/pdf-lib/cjs/utils/index.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./arrays"), exports);
tslib_1.__exportStar(require("./async"), exports);
tslib_1.__exportStar(require("./strings"), exports);
tslib_1.__exportStar(require("./unicode"), exports);
tslib_1.__exportStar(require("./numbers"), exports);
tslib_1.__exportStar(require("./errors"), exports);
tslib_1.__exportStar(require("./base64"), exports);
tslib_1.__exportStar(require("./objects"), exports);
tslib_1.__exportStar(require("./validators"), exports);
tslib_1.__exportStar(require("./pdfDocEncoding"), exports);
var Cache_1 = require("./Cache");
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_1.default; } });
//# sourceMappingURL=index.js.map

1
node_modules/pdf-lib/cjs/utils/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,oDAAkC;AAClC,oDAAkC;AAClC,mDAAiC;AACjC,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,2DAAyC;AACzC,iCAAmD;AAA1C,8FAAA,OAAO,OAAS"}

24
node_modules/pdf-lib/cjs/utils/numbers.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
/**
* Converts a number to its string representation in decimal. This function
* differs from simply converting a number to a string with `.toString()`
* because this function's output string will **not** contain exponential
* notation.
*
* Credit: https://stackoverflow.com/a/46545519
*/
export declare const numberToString: (num: number) => string;
export declare const sizeInBytes: (n: number) => number;
/**
* Converts a number into its constituent bytes and returns them as
* a number[].
*
* Returns most significant byte as first element in array. It may be necessary
* to call .reverse() to get the bits in the desired order.
*
* Example:
* bytesFor(0x02A41E) => [ 0b10, 0b10100100, 0b11110 ]
*
* Credit for algorithm: https://stackoverflow.com/a/1936865
*/
export declare const bytesFor: (n: number) => Uint8Array;
//# sourceMappingURL=numbers.d.ts.map

1
node_modules/pdf-lib/cjs/utils/numbers.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,QAAS,MAAM,WAsBzC,CAAC;AAEF,eAAO,MAAM,WAAW,MAAO,MAAM,WAAwC,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,MAAO,MAAM,eAMjC,CAAC"}

57
node_modules/pdf-lib/cjs/utils/numbers.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
"use strict";
// tslint:disable radix
Object.defineProperty(exports, "__esModule", { value: true });
exports.bytesFor = exports.sizeInBytes = exports.numberToString = void 0;
/**
* Converts a number to its string representation in decimal. This function
* differs from simply converting a number to a string with `.toString()`
* because this function's output string will **not** contain exponential
* notation.
*
* Credit: https://stackoverflow.com/a/46545519
*/
exports.numberToString = function (num) {
var numStr = String(num);
if (Math.abs(num) < 1.0) {
var e = parseInt(num.toString().split('e-')[1]);
if (e) {
var negative = num < 0;
if (negative)
num *= -1;
num *= Math.pow(10, e - 1);
numStr = '0.' + new Array(e).join('0') + num.toString().substring(2);
if (negative)
numStr = '-' + numStr;
}
}
else {
var e = parseInt(num.toString().split('+')[1]);
if (e > 20) {
e -= 20;
num /= Math.pow(10, e);
numStr = num.toString() + new Array(e + 1).join('0');
}
}
return numStr;
};
exports.sizeInBytes = function (n) { return Math.ceil(n.toString(2).length / 8); };
/**
* Converts a number into its constituent bytes and returns them as
* a number[].
*
* Returns most significant byte as first element in array. It may be necessary
* to call .reverse() to get the bits in the desired order.
*
* Example:
* bytesFor(0x02A41E) => [ 0b10, 0b10100100, 0b11110 ]
*
* Credit for algorithm: https://stackoverflow.com/a/1936865
*/
exports.bytesFor = function (n) {
var bytes = new Uint8Array(exports.sizeInBytes(n));
for (var i = 1; i <= bytes.length; i++) {
bytes[i - 1] = n >> ((bytes.length - i) * 8);
}
return bytes;
};
//# sourceMappingURL=numbers.js.map

1
node_modules/pdf-lib/cjs/utils/numbers.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":";AAAA,uBAAuB;;;AAEvB;;;;;;;GAOG;AACU,QAAA,cAAc,GAAG,UAAC,GAAW;IACxC,IAAI,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAEzB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE;QACvB,IAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,EAAE;YACL,IAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC;YACzB,IAAI,QAAQ;gBAAE,GAAG,IAAI,CAAC,CAAC,CAAC;YACxB,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3B,MAAM,GAAG,IAAI,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACrE,IAAI,QAAQ;gBAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;SACrC;KACF;SAAM;QACL,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,GAAG,EAAE,EAAE;YACV,CAAC,IAAI,EAAE,CAAC;YACR,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtD;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEW,QAAA,WAAW,GAAG,UAAC,CAAS,IAAK,OAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,EAAnC,CAAmC,CAAC;AAE9E;;;;;;;;;;;GAWG;AACU,QAAA,QAAQ,GAAG,UAAC,CAAS;IAChC,IAAM,KAAK,GAAG,IAAI,UAAU,CAAC,mBAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;KAC9C;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}

16
node_modules/pdf-lib/cjs/utils/objects.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import { FontNames } from '@pdf-lib/standard-fonts';
export declare const values: (obj: any) => any[];
export declare const StandardFontValues: any[];
export declare const isStandardFont: (input: any) => input is FontNames;
export declare const rectanglesAreEqual: (a: {
x: number;
y: number;
width: number;
height: number;
}, b: {
x: number;
y: number;
width: number;
height: number;
}) => boolean;
//# sourceMappingURL=objects.d.ts.map

1
node_modules/pdf-lib/cjs/utils/objects.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../src/utils/objects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,eAAO,MAAM,MAAM,QAAS,GAAG,UAAwC,CAAC;AAExE,eAAO,MAAM,kBAAkB,OAAoB,CAAC;AAEpD,eAAO,MAAM,cAAc,UAAW,GAAG,uBACL,CAAC;AAErC,eAAO,MAAM,kBAAkB,MAC1B;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,KACvD;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,YACmB,CAAC"}

11
node_modules/pdf-lib/cjs/utils/objects.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rectanglesAreEqual = exports.isStandardFont = exports.StandardFontValues = exports.values = void 0;
var standard_fonts_1 = require("@pdf-lib/standard-fonts");
exports.values = function (obj) { return Object.keys(obj).map(function (k) { return obj[k]; }); };
exports.StandardFontValues = exports.values(standard_fonts_1.FontNames);
exports.isStandardFont = function (input) {
return exports.StandardFontValues.includes(input);
};
exports.rectanglesAreEqual = function (a, b) { return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; };
//# sourceMappingURL=objects.js.map

1
node_modules/pdf-lib/cjs/utils/objects.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/utils/objects.ts"],"names":[],"mappings":";;;AAAA,0DAAoD;AAEvC,QAAA,MAAM,GAAG,UAAC,GAAQ,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,GAAG,CAAC,CAAC,CAAC,EAAN,CAAM,CAAC,EAAnC,CAAmC,CAAC;AAE3D,QAAA,kBAAkB,GAAG,cAAM,CAAC,0BAAS,CAAC,CAAC;AAEvC,QAAA,cAAc,GAAG,UAAC,KAAU;IACvC,OAAA,0BAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAlC,CAAkC,CAAC;AAExB,QAAA,kBAAkB,GAAG,UAChC,CAA0D,EAC1D,CAA0D,IACvD,OAAA,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAA1E,CAA0E,CAAC"}

8
node_modules/pdf-lib/cjs/utils/pdfDocEncoding.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* Decode a byte array into a string using PDFDocEncoding.
*
* @param bytes a byte array (decimal representation) containing a string
* encoded with PDFDocEncoding.
*/
export declare const pdfDocEncodingDecode: (bytes: Uint8Array) => string;
//# sourceMappingURL=pdfDocEncoding.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"pdfDocEncoding.d.ts","sourceRoot":"","sources":["../../src/utils/pdfDocEncoding.ts"],"names":[],"mappings":"AAwDA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,UAAW,UAAU,KAAG,MAMxD,CAAC"}

69
node_modules/pdf-lib/cjs/utils/pdfDocEncoding.js generated vendored Normal file
View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pdfDocEncodingDecode = void 0;
var strings_1 = require("./strings");
// Mapping from PDFDocEncoding to Unicode code point
var pdfDocEncodingToUnicode = new Uint16Array(256);
// Initialize the code points which are the same
for (var idx = 0; idx < 256; idx++) {
pdfDocEncodingToUnicode[idx] = idx;
}
// Set differences (see "Table D.2 PDFDocEncoding Character Set" of the PDF spec)
pdfDocEncodingToUnicode[0x16] = strings_1.toCharCode('\u0017'); // SYNCRONOUS IDLE
pdfDocEncodingToUnicode[0x18] = strings_1.toCharCode('\u02D8'); // BREVE
pdfDocEncodingToUnicode[0x19] = strings_1.toCharCode('\u02C7'); // CARON
pdfDocEncodingToUnicode[0x1a] = strings_1.toCharCode('\u02C6'); // MODIFIER LETTER CIRCUMFLEX ACCENT
pdfDocEncodingToUnicode[0x1b] = strings_1.toCharCode('\u02D9'); // DOT ABOVE
pdfDocEncodingToUnicode[0x1c] = strings_1.toCharCode('\u02DD'); // DOUBLE ACUTE ACCENT
pdfDocEncodingToUnicode[0x1d] = strings_1.toCharCode('\u02DB'); // OGONEK
pdfDocEncodingToUnicode[0x1e] = strings_1.toCharCode('\u02DA'); // RING ABOVE
pdfDocEncodingToUnicode[0x1f] = strings_1.toCharCode('\u02DC'); // SMALL TILDE
pdfDocEncodingToUnicode[0x7f] = strings_1.toCharCode('\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)
pdfDocEncodingToUnicode[0x80] = strings_1.toCharCode('\u2022'); // BULLET
pdfDocEncodingToUnicode[0x81] = strings_1.toCharCode('\u2020'); // DAGGER
pdfDocEncodingToUnicode[0x82] = strings_1.toCharCode('\u2021'); // DOUBLE DAGGER
pdfDocEncodingToUnicode[0x83] = strings_1.toCharCode('\u2026'); // HORIZONTAL ELLIPSIS
pdfDocEncodingToUnicode[0x84] = strings_1.toCharCode('\u2014'); // EM DASH
pdfDocEncodingToUnicode[0x85] = strings_1.toCharCode('\u2013'); // EN DASH
pdfDocEncodingToUnicode[0x86] = strings_1.toCharCode('\u0192'); // LATIN SMALL LETTER SCRIPT F
pdfDocEncodingToUnicode[0x87] = strings_1.toCharCode('\u2044'); // FRACTION SLASH (solidus)
pdfDocEncodingToUnicode[0x88] = strings_1.toCharCode('\u2039'); // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
pdfDocEncodingToUnicode[0x89] = strings_1.toCharCode('\u203A'); // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
pdfDocEncodingToUnicode[0x8a] = strings_1.toCharCode('\u2212'); // MINUS SIGN
pdfDocEncodingToUnicode[0x8b] = strings_1.toCharCode('\u2030'); // PER MILLE SIGN
pdfDocEncodingToUnicode[0x8c] = strings_1.toCharCode('\u201E'); // DOUBLE LOW-9 QUOTATION MARK (quotedblbase)
pdfDocEncodingToUnicode[0x8d] = strings_1.toCharCode('\u201C'); // LEFT DOUBLE QUOTATION MARK (quotedblleft)
pdfDocEncodingToUnicode[0x8e] = strings_1.toCharCode('\u201D'); // RIGHT DOUBLE QUOTATION MARK (quotedblright)
pdfDocEncodingToUnicode[0x8f] = strings_1.toCharCode('\u2018'); // LEFT SINGLE QUOTATION MARK (quoteleft)
pdfDocEncodingToUnicode[0x90] = strings_1.toCharCode('\u2019'); // RIGHT SINGLE QUOTATION MARK (quoteright)
pdfDocEncodingToUnicode[0x91] = strings_1.toCharCode('\u201A'); // SINGLE LOW-9 QUOTATION MARK (quotesinglbase)
pdfDocEncodingToUnicode[0x92] = strings_1.toCharCode('\u2122'); // TRADE MARK SIGN
pdfDocEncodingToUnicode[0x93] = strings_1.toCharCode('\uFB01'); // LATIN SMALL LIGATURE FI
pdfDocEncodingToUnicode[0x94] = strings_1.toCharCode('\uFB02'); // LATIN SMALL LIGATURE FL
pdfDocEncodingToUnicode[0x95] = strings_1.toCharCode('\u0141'); // LATIN CAPITAL LETTER L WITH STROKE
pdfDocEncodingToUnicode[0x96] = strings_1.toCharCode('\u0152'); // LATIN CAPITAL LIGATURE OE
pdfDocEncodingToUnicode[0x97] = strings_1.toCharCode('\u0160'); // LATIN CAPITAL LETTER S WITH CARON
pdfDocEncodingToUnicode[0x98] = strings_1.toCharCode('\u0178'); // LATIN CAPITAL LETTER Y WITH DIAERESIS
pdfDocEncodingToUnicode[0x99] = strings_1.toCharCode('\u017D'); // LATIN CAPITAL LETTER Z WITH CARON
pdfDocEncodingToUnicode[0x9a] = strings_1.toCharCode('\u0131'); // LATIN SMALL LETTER DOTLESS I
pdfDocEncodingToUnicode[0x9b] = strings_1.toCharCode('\u0142'); // LATIN SMALL LETTER L WITH STROKE
pdfDocEncodingToUnicode[0x9c] = strings_1.toCharCode('\u0153'); // LATIN SMALL LIGATURE OE
pdfDocEncodingToUnicode[0x9d] = strings_1.toCharCode('\u0161'); // LATIN SMALL LETTER S WITH CARON
pdfDocEncodingToUnicode[0x9e] = strings_1.toCharCode('\u017E'); // LATIN SMALL LETTER Z WITH CARON
pdfDocEncodingToUnicode[0x9f] = strings_1.toCharCode('\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)
pdfDocEncodingToUnicode[0xa0] = strings_1.toCharCode('\u20AC'); // EURO SIGN
pdfDocEncodingToUnicode[0xad] = strings_1.toCharCode('\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)
/**
* Decode a byte array into a string using PDFDocEncoding.
*
* @param bytes a byte array (decimal representation) containing a string
* encoded with PDFDocEncoding.
*/
exports.pdfDocEncodingDecode = function (bytes) {
var codePoints = new Array(bytes.length);
for (var idx = 0, len = bytes.length; idx < len; idx++) {
codePoints[idx] = pdfDocEncodingToUnicode[bytes[idx]];
}
return String.fromCodePoint.apply(String, codePoints);
};
//# sourceMappingURL=pdfDocEncoding.js.map

1
node_modules/pdf-lib/cjs/utils/pdfDocEncoding.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"pdfDocEncoding.js","sourceRoot":"","sources":["../../src/utils/pdfDocEncoding.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAE/C,oDAAoD;AACpD,IAAM,uBAAuB,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;AAErD,gDAAgD;AAChD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;IAClC,uBAAuB,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;CACpC;AAED,mFAAmF;AACnF,uBAAuB,CAAC,IAAI,CAAC,GAAG,oBAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB;AACxE,uBAAuB,CAAC,IAAI,CAAC,GAAG,oBAAU,CAAC,QAAQ,CAAC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,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;QACtD,UAAU,CAAC,GAAG,CAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;KACvD;IACD,OAAO,MAAM,CAAC,aAAa,OAApB,MAAM,EAAkB,UAAU,EAAE;AAC7C,CAAC,CAAC"}

18
node_modules/pdf-lib/cjs/utils/png.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
export declare enum PngType {
Greyscale = "Greyscale",
Truecolour = "Truecolour",
IndexedColour = "IndexedColour",
GreyscaleWithAlpha = "GreyscaleWithAlpha",
TruecolourWithAlpha = "TruecolourWithAlpha"
}
export declare class PNG {
static load: (pngData: Uint8Array) => PNG;
readonly rgbChannel: Uint8Array;
readonly alphaChannel?: Uint8Array;
readonly type: PngType;
readonly width: number;
readonly height: number;
readonly bitsPerComponent: number;
private constructor();
}
//# sourceMappingURL=png.d.ts.map

1
node_modules/pdf-lib/cjs/utils/png.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../../src/utils/png.ts"],"names":[],"mappings":"AA+BA,oBAAY,OAAO;IACjB,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;CAC5C;AAED,qBAAa,GAAG;IACd,MAAM,CAAC,IAAI,YAAa,UAAU,SAAsB;IAExD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAElC,OAAO;CAoBR"}

63
node_modules/pdf-lib/cjs/utils/png.js generated vendored Normal file
View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PNG = exports.PngType = void 0;
var tslib_1 = require("tslib");
var upng_1 = tslib_1.__importDefault(require("@pdf-lib/upng"));
var getImageType = function (ctype) {
if (ctype === 0)
return PngType.Greyscale;
if (ctype === 2)
return PngType.Truecolour;
if (ctype === 3)
return PngType.IndexedColour;
if (ctype === 4)
return PngType.GreyscaleWithAlpha;
if (ctype === 6)
return PngType.TruecolourWithAlpha;
throw new Error("Unknown color type: " + ctype);
};
var splitAlphaChannel = function (rgbaChannel) {
var pixelCount = Math.floor(rgbaChannel.length / 4);
var rgbChannel = new Uint8Array(pixelCount * 3);
var alphaChannel = new Uint8Array(pixelCount * 1);
var rgbaOffset = 0;
var rgbOffset = 0;
var alphaOffset = 0;
while (rgbaOffset < rgbaChannel.length) {
rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];
rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];
rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];
alphaChannel[alphaOffset++] = rgbaChannel[rgbaOffset++];
}
return { rgbChannel: rgbChannel, alphaChannel: alphaChannel };
};
var PngType;
(function (PngType) {
PngType["Greyscale"] = "Greyscale";
PngType["Truecolour"] = "Truecolour";
PngType["IndexedColour"] = "IndexedColour";
PngType["GreyscaleWithAlpha"] = "GreyscaleWithAlpha";
PngType["TruecolourWithAlpha"] = "TruecolourWithAlpha";
})(PngType = exports.PngType || (exports.PngType = {}));
var PNG = /** @class */ (function () {
function PNG(pngData) {
var upng = upng_1.default.decode(pngData);
var frames = upng_1.default.toRGBA8(upng);
if (frames.length > 1)
throw new Error("Animated PNGs are not supported");
var frame = new Uint8Array(frames[0]);
var _a = splitAlphaChannel(frame), rgbChannel = _a.rgbChannel, alphaChannel = _a.alphaChannel;
this.rgbChannel = rgbChannel;
var hasAlphaValues = alphaChannel.some(function (a) { return a < 255; });
if (hasAlphaValues)
this.alphaChannel = alphaChannel;
this.type = getImageType(upng.ctype);
this.width = upng.width;
this.height = upng.height;
this.bitsPerComponent = 8;
}
PNG.load = function (pngData) { return new PNG(pngData); };
return PNG;
}());
exports.PNG = PNG;
//# sourceMappingURL=png.js.map

1
node_modules/pdf-lib/cjs/utils/png.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"png.js","sourceRoot":"","sources":["../../src/utils/png.ts"],"names":[],"mappings":";;;;AAAA,+DAAiC;AAEjC,IAAM,YAAY,GAAG,UAAC,KAAa;IACjC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,SAAS,CAAC;IAC1C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,UAAU,CAAC;IAC3C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,aAAa,CAAC;IAC9C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,kBAAkB,CAAC;IACnD,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,mBAAmB,CAAC;IACpD,MAAM,IAAI,KAAK,CAAC,yBAAuB,KAAO,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,IAAM,iBAAiB,GAAG,UAAC,WAAuB;IAChD,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEtD,IAAM,UAAU,GAAG,IAAI,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAClD,IAAM,YAAY,GAAG,IAAI,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAEpD,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,WAAW,GAAG,CAAC,CAAC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cAAc;YAAE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAErD,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAErC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;IAC5B,CAAC;IA5BM,QAAI,GAAG,UAAC,OAAmB,IAAK,OAAA,IAAI,GAAG,CAAC,OAAO,CAAC,EAAhB,CAAgB,CAAC;IA6B1D,UAAC;CAAA,AA9BD,IA8BC;AA9BY,kBAAG"}

14
node_modules/pdf-lib/cjs/utils/rng.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/**
* Generates a pseudo random number. Although it is not cryptographically secure
* and uniformly distributed, it is not a concern for the intended use-case,
* which is to generate distinct numbers.
*
* Credit: https://stackoverflow.com/a/19303725/10254049
*/
export declare class SimpleRNG {
static withSeed: (seed: number) => SimpleRNG;
private seed;
private constructor();
nextInt(): number;
}
//# sourceMappingURL=rng.d.ts.map

1
node_modules/pdf-lib/cjs/utils/rng.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../src/utils/rng.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,MAAM,CAAC,QAAQ,SAAU,MAAM,eAAyB;IAExD,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO;IAIP,OAAO,IAAI,MAAM;CAIlB"}

23
node_modules/pdf-lib/cjs/utils/rng.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SimpleRNG = void 0;
/**
* Generates a pseudo random number. Although it is not cryptographically secure
* and uniformly distributed, it is not a concern for the intended use-case,
* which is to generate distinct numbers.
*
* Credit: https://stackoverflow.com/a/19303725/10254049
*/
var SimpleRNG = /** @class */ (function () {
function SimpleRNG(seed) {
this.seed = seed;
}
SimpleRNG.prototype.nextInt = function () {
var x = Math.sin(this.seed++) * 10000;
return x - Math.floor(x);
};
SimpleRNG.withSeed = function (seed) { return new SimpleRNG(seed); };
return SimpleRNG;
}());
exports.SimpleRNG = SimpleRNG;
//# sourceMappingURL=rng.js.map

1
node_modules/pdf-lib/cjs/utils/rng.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"rng.js","sourceRoot":"","sources":["../../src/utils/rng.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH;IAKE,mBAAoB,IAAY;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,2BAAO,GAAP;QACE,IAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;QACxC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAXM,kBAAQ,GAAG,UAAC,IAAY,IAAK,OAAA,IAAI,SAAS,CAAC,IAAI,CAAC,EAAnB,CAAmB,CAAC;IAY1D,gBAAC;CAAA,AAbD,IAaC;AAbY,8BAAS"}

25
node_modules/pdf-lib/cjs/utils/strings.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
export declare const toCharCode: (character: string) => number;
export declare const toCodePoint: (character: string) => number | undefined;
export declare const toHexStringOfMinLength: (num: number, minLength: number) => string;
export declare const toHexString: (num: number) => string;
export declare const charFromCode: (code: number) => string;
export declare const charFromHexCode: (hex: string) => string;
export declare const padStart: (value: string, length: number, padChar: string) => string;
export declare const copyStringIntoBuffer: (str: string, buffer: Uint8Array, offset: number) => number;
export declare const addRandomSuffix: (prefix: string, suffixLength?: number) => string;
export declare const escapeRegExp: (str: string) => string;
export declare const cleanText: (text: string) => string;
export declare const escapedNewlineChars: string[];
export declare const newlineChars: string[];
export declare const isNewlineChar: (text: string) => boolean;
export declare const lineSplit: (text: string) => string[];
export declare const mergeLines: (text: string) => string;
export declare const charAtIndex: (text: string, index: number) => [string, number];
export declare const charSplit: (text: string) => string[];
export declare const breakTextIntoLines: (text: string, wordBreaks: string[], maxWidth: number, computeWidthOfText: (t: string) => number) => string[];
export declare const parseDate: (dateStr: string) => Date | undefined;
export declare const findLastMatch: (value: string, regex: RegExp) => {
match: RegExpMatchArray | undefined;
pos: number;
};
//# sourceMappingURL=strings.d.ts.map

1
node_modules/pdf-lib/cjs/utils/strings.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,cAAe,MAAM,WAA4B,CAAC;AAEzE,eAAO,MAAM,WAAW,cAAe,MAAM,uBAA6B,CAAC;AAE3E,eAAO,MAAM,sBAAsB,QAAS,MAAM,aAAa,MAAM,WACX,CAAC;AAE3D,eAAO,MAAM,WAAW,QAAS,MAAM,WAAmC,CAAC;AAE3E,eAAO,MAAM,YAAY,SAAU,MAAM,WAA8B,CAAC;AAExE,eAAO,MAAM,eAAe,QAAS,MAAM,WAAoC,CAAC;AAEhF,eAAO,MAAM,QAAQ,UAAW,MAAM,UAAU,MAAM,WAAW,MAAM,WAMtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAC1B,MAAM,UACH,UAAU,UACV,MAAM,KACb,MAMF,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,MAAM,kCACiB,CAAC;AAEhE,eAAO,MAAM,YAAY,QAAS,MAAM,WACI,CAAC;AAE7C,eAAO,MAAM,SAAS,SAAU,MAAM,WACmC,CAAC;AAE1E,eAAO,MAAM,mBAAmB,UAAmC,CAAC;AAEpE,eAAO,MAAM,YAAY,UAA+B,CAAC;AAEzD,eAAO,MAAM,aAAa,SAAU,MAAM,YAAkC,CAAC;AAE7E,eAAO,MAAM,SAAS,SAAU,MAAM,aAAiC,CAAC;AAExE,eAAO,MAAM,UAAU,SAAU,MAAM,WACD,CAAC;AAOvC,eAAO,MAAM,WAAW,SAAU,MAAM,SAAS,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,CAgBxE,CAAC;AAEF,eAAO,MAAM,SAAS,SAAU,MAAM,aAUrC,CAAC;AAkBF,eAAO,MAAM,kBAAkB,SACvB,MAAM,cACA,MAAM,EAAE,YACV,MAAM,0BACQ,MAAM,KAAK,MAAM,KACxC,MAAM,EA6BR,CAAC;AAKF,eAAO,MAAM,SAAS,YAAa,MAAM,KAAG,IAAI,GAAG,SA0BlD,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,MAAM,SAAS,MAAM;;;CAUzD,CAAC"}

141
node_modules/pdf-lib/cjs/utils/strings.js generated vendored Normal file
View File

@@ -0,0 +1,141 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findLastMatch = exports.parseDate = exports.breakTextIntoLines = exports.charSplit = exports.charAtIndex = exports.mergeLines = exports.lineSplit = exports.isNewlineChar = exports.newlineChars = exports.escapedNewlineChars = exports.cleanText = exports.escapeRegExp = exports.addRandomSuffix = exports.copyStringIntoBuffer = exports.padStart = exports.charFromHexCode = exports.charFromCode = exports.toHexString = exports.toHexStringOfMinLength = exports.toCodePoint = exports.toCharCode = void 0;
exports.toCharCode = function (character) { return character.charCodeAt(0); };
exports.toCodePoint = function (character) { return character.codePointAt(0); };
exports.toHexStringOfMinLength = function (num, minLength) {
return exports.padStart(num.toString(16), minLength, '0').toUpperCase();
};
exports.toHexString = function (num) { return exports.toHexStringOfMinLength(num, 2); };
exports.charFromCode = function (code) { return String.fromCharCode(code); };
exports.charFromHexCode = function (hex) { return exports.charFromCode(parseInt(hex, 16)); };
exports.padStart = function (value, length, padChar) {
var padding = '';
for (var idx = 0, len = length - value.length; idx < len; idx++) {
padding += padChar;
}
return padding + value;
};
exports.copyStringIntoBuffer = function (str, buffer, offset) {
var length = str.length;
for (var idx = 0; idx < length; idx++) {
buffer[offset++] = str.charCodeAt(idx);
}
return length;
};
exports.addRandomSuffix = function (prefix, suffixLength) {
if (suffixLength === void 0) { suffixLength = 4; }
return prefix + "-" + Math.floor(Math.random() * Math.pow(10, suffixLength));
};
exports.escapeRegExp = function (str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
};
exports.cleanText = function (text) {
return text.replace(/\t|\u0085|\u2028|\u2029/g, ' ').replace(/[\b\v]/g, '');
};
exports.escapedNewlineChars = ['\\n', '\\f', '\\r', '\\u000B'];
exports.newlineChars = ['\n', '\f', '\r', '\u000B'];
exports.isNewlineChar = function (text) { return /^[\n\f\r\u000B]$/.test(text); };
exports.lineSplit = function (text) { return text.split(/[\n\f\r\u000B]/); };
exports.mergeLines = function (text) {
return text.replace(/[\n\f\r\u000B]/g, ' ');
};
// JavaScript's String.charAt() method doesn work on strings containing UTF-16
// characters (with high and low surrogate pairs), such as 💩 (poo emoji). This
// `charAtIndex()` function does.
//
// Credit: https://github.com/mathiasbynens/String.prototype.at/blob/master/at.js#L14-L48
exports.charAtIndex = function (text, index) {
// Get the first code unit and code unit value
var cuFirst = text.charCodeAt(index);
var cuSecond;
var nextIndex = index + 1;
var length = 1;
if (
// Check if it's the start of a surrogate pair.
cuFirst >= 0xd800 &&
cuFirst <= 0xdbff && // high surrogate
text.length > nextIndex // there is a next code unit
) {
cuSecond = text.charCodeAt(nextIndex);
if (cuSecond >= 0xdc00 && cuSecond <= 0xdfff)
length = 2; // low surrogate
}
return [text.slice(index, index + length), length];
};
exports.charSplit = function (text) {
var chars = [];
for (var idx = 0, len = text.length; idx < len;) {
var _a = exports.charAtIndex(text, idx), c = _a[0], cLen = _a[1];
chars.push(c);
idx += cLen;
}
return chars;
};
var buildWordBreakRegex = function (wordBreaks) {
var newlineCharUnion = exports.escapedNewlineChars.join('|');
var escapedRules = ['$'];
for (var idx = 0, len = wordBreaks.length; idx < len; idx++) {
var wordBreak = wordBreaks[idx];
if (exports.isNewlineChar(wordBreak)) {
throw new TypeError("`wordBreak` must not include " + newlineCharUnion);
}
escapedRules.push(wordBreak === '' ? '.' : exports.escapeRegExp(wordBreak));
}
var breakRules = escapedRules.join('|');
return new RegExp("(" + newlineCharUnion + ")|((.*?)(" + breakRules + "))", 'gm');
};
exports.breakTextIntoLines = function (text, wordBreaks, maxWidth, computeWidthOfText) {
var regex = buildWordBreakRegex(wordBreaks);
var words = exports.cleanText(text).match(regex);
var currLine = '';
var currWidth = 0;
var lines = [];
var pushCurrLine = function () {
if (currLine !== '')
lines.push(currLine);
currLine = '';
currWidth = 0;
};
for (var idx = 0, len = words.length; idx < len; idx++) {
var word = words[idx];
if (exports.isNewlineChar(word)) {
pushCurrLine();
}
else {
var width = computeWidthOfText(word);
if (currWidth + width > maxWidth)
pushCurrLine();
currLine += word;
currWidth += width;
}
}
pushCurrLine();
return lines;
};
// See section "7.9.4 Dates" of the PDF specification
var dateRegex = /^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/;
exports.parseDate = function (dateStr) {
var match = dateStr.match(dateRegex);
if (!match)
return undefined;
var year = match[1], _a = match[2], month = _a === void 0 ? '01' : _a, _b = match[3], day = _b === void 0 ? '01' : _b, _c = match[4], hours = _c === void 0 ? '00' : _c, _d = match[5], mins = _d === void 0 ? '00' : _d, _e = match[6], secs = _e === void 0 ? '00' : _e, _f = match[7], offsetSign = _f === void 0 ? 'Z' : _f, _g = match[8], offsetHours = _g === void 0 ? '00' : _g, _h = match[9], offsetMins = _h === void 0 ? '00' : _h;
// http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15
var tzOffset = offsetSign === 'Z' ? 'Z' : "" + offsetSign + offsetHours + ":" + offsetMins;
var date = new Date(year + "-" + month + "-" + day + "T" + hours + ":" + mins + ":" + secs + tzOffset);
return date;
};
exports.findLastMatch = function (value, regex) {
var _a;
var position = 0;
var lastMatch;
while (position < value.length) {
var match = value.substring(position).match(regex);
if (!match)
return { match: lastMatch, pos: position };
lastMatch = match;
position += ((_a = match.index) !== null && _a !== void 0 ? _a : 0) + match[0].length;
}
return { match: lastMatch, pos: position };
};
//# sourceMappingURL=strings.js.map

1
node_modules/pdf-lib/cjs/utils/strings.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

187
node_modules/pdf-lib/cjs/utils/unicode.d.ts generated vendored Normal file
View File

@@ -0,0 +1,187 @@
/**
* Encodes a string to UTF-8.
*
* @param input The string to be encoded.
* @param byteOrderMark Whether or not a byte order marker (BOM) should be added
* to the start of the encoding. (default `true`)
* @returns A Uint8Array containing the UTF-8 encoding of the input string.
*
* -----------------------------------------------------------------------------
*
* JavaScript strings are composed of Unicode code points. Code points are
* integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string,
* it must be encoded as a sequence of words. A word is typically 8, 16, or 32
* bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16,
* and UTF-32. These encoding forms are described in the Unicode standard [1].
* This function implements the UTF-8 encoding form.
*
* -----------------------------------------------------------------------------
*
* In UTF-8, each code point is mapped to a sequence of 1, 2, 3, or 4 bytes.
* Note that the logic which defines this mapping is slightly convoluted, and
* not as straightforward as the mapping logic for UTF-16 or UTF-32. The UTF-8
* mapping logic is as follows [2]:
*
* • If a code point is in the range U+0000..U+007F, then view it as a 7-bit
* integer: 0bxxxxxxx. Map the code point to 1 byte with the first high order
* bit set to 0:
*
* b1=0b0xxxxxxx
*
* • If a code point is in the range U+0080..U+07FF, then view it as an 11-bit
* integer: 0byyyyyxxxxxx. Map the code point to 2 bytes with the first 5 bits
* of the code point stored in the first byte, and the last 6 bits stored in
* the second byte:
*
* b1=0b110yyyyy b2=0b10xxxxxx
*
* • If a code point is in the range U+0800..U+FFFF, then view it as a 16-bit
* integer, 0bzzzzyyyyyyxxxxxx. Map the code point to 3 bytes with the first
* 4 bits stored in the first byte, the next 6 bits stored in the second byte,
* and the last 6 bits in the third byte:
*
* b1=0b1110zzzz b2=0b10yyyyyy b3=0b10xxxxxx
*
* • If a code point is in the range U+10000...U+10FFFF, then view it as a
* 21-bit integer, 0bvvvzzzzzzyyyyyyxxxxxx. Map the code point to 4 bytes with
* the first 3 bits stored in the first byte, the next 6 bits stored in the
* second byte, the next 6 bits stored in the third byte, and the last 6 bits
* stored in the fourth byte:
*
* b1=0b11110xxx b2=0b10zzzzzz b3=0b10yyyyyy b4=0b10xxxxxx
*
* -----------------------------------------------------------------------------
*
* It is important to note, when iterating through the code points of a string
* in JavaScript, that if a character is encoded as a surrogate pair it will
* increase the string's length by 2 instead of 1 [4]. For example:
*
* ```
* > 'a'.length
* 1
* > '💩'.length
* 2
* > '語'.length
* 1
* > 'a💩語'.length
* 4
* ```
*
* The results of the above example are explained by the fact that the
* characters 'a' and '語' are not represented by surrogate pairs, but '💩' is.
*
* Because of this idiosyncrasy in JavaScript's string implementation and APIs,
* we must "jump" an extra index after encoding a character as a surrogate
* pair. In practice, this means we must increment the index of our for loop by
* 2 if we encode a surrogate pair, and 1 in all other cases.
*
* -----------------------------------------------------------------------------
*
* References:
* - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf
* 3.9 Unicode Encoding Forms - UTF-8
* - [2] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding.html
* - [3] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding-Algorithm.html
* - [4] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description
*
*/
export declare const utf8Encode: (input: string, byteOrderMark?: boolean) => Uint8Array;
/**
* Encodes a string to UTF-16.
*
* @param input The string to be encoded.
* @param byteOrderMark Whether or not a byte order marker (BOM) should be added
* to the start of the encoding. (default `true`)
* @returns A Uint16Array containing the UTF-16 encoding of the input string.
*
* -----------------------------------------------------------------------------
*
* JavaScript strings are composed of Unicode code points. Code points are
* integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string,
* it must be encoded as a sequence of words. A word is typically 8, 16, or 32
* bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16,
* and UTF-32. These encoding forms are described in the Unicode standard [1].
* This function implements the UTF-16 encoding form.
*
* -----------------------------------------------------------------------------
*
* In UTF-16, each code point is mapped to one or two 16-bit integers. The
* UTF-16 mapping logic is as follows [2]:
*
* • If a code point is in the range U+0000..U+FFFF, then map the code point to
* a 16-bit integer with the most significant byte first.
*
* • If a code point is in the range U+10000..U+10000, then map the code point
* to two 16-bit integers. The first integer should contain the high surrogate
* and the second integer should contain the low surrogate. Both surrogates
* should be written with the most significant byte first.
*
* -----------------------------------------------------------------------------
*
* It is important to note, when iterating through the code points of a string
* in JavaScript, that if a character is encoded as a surrogate pair it will
* increase the string's length by 2 instead of 1 [4]. For example:
*
* ```
* > 'a'.length
* 1
* > '💩'.length
* 2
* > '語'.length
* 1
* > 'a💩語'.length
* 4
* ```
*
* The results of the above example are explained by the fact that the
* characters 'a' and '語' are not represented by surrogate pairs, but '💩' is.
*
* Because of this idiosyncrasy in JavaScript's string implementation and APIs,
* we must "jump" an extra index after encoding a character as a surrogate
* pair. In practice, this means we must increment the index of our for loop by
* 2 if we encode a surrogate pair, and 1 in all other cases.
*
* -----------------------------------------------------------------------------
*
* References:
* - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf
* 3.9 Unicode Encoding Forms - UTF-8
* - [2] http://www.herongyang.com/Unicode/UTF-16-UTF-16-Encoding.html
* - [3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description
*
*/
export declare const utf16Encode: (input: string, byteOrderMark?: boolean) => Uint16Array;
/**
* Returns `true` if the `codePoint` is within the
* Basic Multilingual Plane (BMP). Code points inside the BMP are not encoded
* with surrogate pairs.
* @param codePoint The code point to be evaluated.
*
* Reference: https://en.wikipedia.org/wiki/UTF-16#Description
*/
export declare const isWithinBMP: (codePoint: number) => boolean;
/**
* Returns `true` if the given `codePoint` is valid and must be represented
* with a surrogate pair when encoded.
* @param codePoint The code point to be evaluated.
*
* Reference: https://en.wikipedia.org/wiki/UTF-16#Description
*/
export declare const hasSurrogates: (codePoint: number) => boolean;
export declare const highSurrogate: (codePoint: number) => number;
export declare const lowSurrogate: (codePoint: number) => number;
/**
* Decodes a Uint8Array of data to a string using UTF-16.
*
* Note that this function attempts to recover from erronous input by
* inserting the replacement character (<28>) to mark invalid code points
* and surrogate pairs.
*
* @param input A Uint8Array containing UTF-16 encoded data
* @param byteOrderMark Whether or not a byte order marker (BOM) should be read
* at the start of the encoding. (default `true`)
* @returns The decoded string.
*/
export declare const utf16Decode: (input: Uint8Array, byteOrderMark?: boolean) => string;
export declare const hasUtf16BOM: (bytes: Uint8Array) => boolean;
//# sourceMappingURL=unicode.d.ts.map

1
node_modules/pdf-lib/cjs/utils/unicode.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"unicode.d.ts","sourceRoot":"","sources":["../../src/utils/unicode.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,eAAO,MAAM,UAAU,UAAW,MAAM,8BAAyB,UA+ChE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,eAAO,MAAM,WAAW,UACf,MAAM,8BAEZ,WAyBF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,cAAe,MAAM,YACN,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,cAAe,MAAM,YACC,CAAC;AAIjD,eAAO,MAAM,aAAa,cAAe,MAAM,WACK,CAAC;AAIrD,eAAO,MAAM,YAAY,cAAe,MAAM,WACJ,CAAC;AAS3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,UACf,UAAU,8BAEhB,MAyCF,CAAC;AA0DF,eAAO,MAAM,WAAW,UAAW,UAAU,YACkB,CAAC"}

370
node_modules/pdf-lib/cjs/utils/unicode.js generated vendored Normal file
View File

@@ -0,0 +1,370 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasUtf16BOM = exports.utf16Decode = exports.lowSurrogate = exports.highSurrogate = exports.hasSurrogates = exports.isWithinBMP = exports.utf16Encode = exports.utf8Encode = void 0;
var strings_1 = require("./strings");
/**
* Encodes a string to UTF-8.
*
* @param input The string to be encoded.
* @param byteOrderMark Whether or not a byte order marker (BOM) should be added
* to the start of the encoding. (default `true`)
* @returns A Uint8Array containing the UTF-8 encoding of the input string.
*
* -----------------------------------------------------------------------------
*
* JavaScript strings are composed of Unicode code points. Code points are
* integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string,
* it must be encoded as a sequence of words. A word is typically 8, 16, or 32
* bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16,
* and UTF-32. These encoding forms are described in the Unicode standard [1].
* This function implements the UTF-8 encoding form.
*
* -----------------------------------------------------------------------------
*
* In UTF-8, each code point is mapped to a sequence of 1, 2, 3, or 4 bytes.
* Note that the logic which defines this mapping is slightly convoluted, and
* not as straightforward as the mapping logic for UTF-16 or UTF-32. The UTF-8
* mapping logic is as follows [2]:
*
* • If a code point is in the range U+0000..U+007F, then view it as a 7-bit
* integer: 0bxxxxxxx. Map the code point to 1 byte with the first high order
* bit set to 0:
*
* b1=0b0xxxxxxx
*
* • If a code point is in the range U+0080..U+07FF, then view it as an 11-bit
* integer: 0byyyyyxxxxxx. Map the code point to 2 bytes with the first 5 bits
* of the code point stored in the first byte, and the last 6 bits stored in
* the second byte:
*
* b1=0b110yyyyy b2=0b10xxxxxx
*
* • If a code point is in the range U+0800..U+FFFF, then view it as a 16-bit
* integer, 0bzzzzyyyyyyxxxxxx. Map the code point to 3 bytes with the first
* 4 bits stored in the first byte, the next 6 bits stored in the second byte,
* and the last 6 bits in the third byte:
*
* b1=0b1110zzzz b2=0b10yyyyyy b3=0b10xxxxxx
*
* • If a code point is in the range U+10000...U+10FFFF, then view it as a
* 21-bit integer, 0bvvvzzzzzzyyyyyyxxxxxx. Map the code point to 4 bytes with
* the first 3 bits stored in the first byte, the next 6 bits stored in the
* second byte, the next 6 bits stored in the third byte, and the last 6 bits
* stored in the fourth byte:
*
* b1=0b11110xxx b2=0b10zzzzzz b3=0b10yyyyyy b4=0b10xxxxxx
*
* -----------------------------------------------------------------------------
*
* It is important to note, when iterating through the code points of a string
* in JavaScript, that if a character is encoded as a surrogate pair it will
* increase the string's length by 2 instead of 1 [4]. For example:
*
* ```
* > 'a'.length
* 1
* > '💩'.length
* 2
* > '語'.length
* 1
* > 'a💩語'.length
* 4
* ```
*
* The results of the above example are explained by the fact that the
* characters 'a' and '語' are not represented by surrogate pairs, but '💩' is.
*
* Because of this idiosyncrasy in JavaScript's string implementation and APIs,
* we must "jump" an extra index after encoding a character as a surrogate
* pair. In practice, this means we must increment the index of our for loop by
* 2 if we encode a surrogate pair, and 1 in all other cases.
*
* -----------------------------------------------------------------------------
*
* References:
* - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf
* 3.9 Unicode Encoding Forms - UTF-8
* - [2] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding.html
* - [3] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding-Algorithm.html
* - [4] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description
*
*/
exports.utf8Encode = function (input, byteOrderMark) {
if (byteOrderMark === void 0) { byteOrderMark = true; }
var encoded = [];
if (byteOrderMark)
encoded.push(0xef, 0xbb, 0xbf);
for (var idx = 0, len = input.length; idx < len;) {
var codePoint = input.codePointAt(idx);
// One byte encoding
if (codePoint < 0x80) {
var byte1 = codePoint & 0x7f;
encoded.push(byte1);
idx += 1;
}
// Two byte encoding
else if (codePoint < 0x0800) {
var byte1 = ((codePoint >> 6) & 0x1f) | 0xc0;
var byte2 = (codePoint & 0x3f) | 0x80;
encoded.push(byte1, byte2);
idx += 1;
}
// Three byte encoding
else if (codePoint < 0x010000) {
var byte1 = ((codePoint >> 12) & 0x0f) | 0xe0;
var byte2 = ((codePoint >> 6) & 0x3f) | 0x80;
var byte3 = (codePoint & 0x3f) | 0x80;
encoded.push(byte1, byte2, byte3);
idx += 1;
}
// Four byte encoding (surrogate pair)
else if (codePoint < 0x110000) {
var byte1 = ((codePoint >> 18) & 0x07) | 0xf0;
var byte2 = ((codePoint >> 12) & 0x3f) | 0x80;
var byte3 = ((codePoint >> 6) & 0x3f) | 0x80;
var byte4 = ((codePoint >> 0) & 0x3f) | 0x80;
encoded.push(byte1, byte2, byte3, byte4);
idx += 2;
}
// Should never reach this case
else
throw new Error("Invalid code point: 0x" + strings_1.toHexString(codePoint));
}
return new Uint8Array(encoded);
};
/**
* Encodes a string to UTF-16.
*
* @param input The string to be encoded.
* @param byteOrderMark Whether or not a byte order marker (BOM) should be added
* to the start of the encoding. (default `true`)
* @returns A Uint16Array containing the UTF-16 encoding of the input string.
*
* -----------------------------------------------------------------------------
*
* JavaScript strings are composed of Unicode code points. Code points are
* integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string,
* it must be encoded as a sequence of words. A word is typically 8, 16, or 32
* bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16,
* and UTF-32. These encoding forms are described in the Unicode standard [1].
* This function implements the UTF-16 encoding form.
*
* -----------------------------------------------------------------------------
*
* In UTF-16, each code point is mapped to one or two 16-bit integers. The
* UTF-16 mapping logic is as follows [2]:
*
* • If a code point is in the range U+0000..U+FFFF, then map the code point to
* a 16-bit integer with the most significant byte first.
*
* • If a code point is in the range U+10000..U+10000, then map the code point
* to two 16-bit integers. The first integer should contain the high surrogate
* and the second integer should contain the low surrogate. Both surrogates
* should be written with the most significant byte first.
*
* -----------------------------------------------------------------------------
*
* It is important to note, when iterating through the code points of a string
* in JavaScript, that if a character is encoded as a surrogate pair it will
* increase the string's length by 2 instead of 1 [4]. For example:
*
* ```
* > 'a'.length
* 1
* > '💩'.length
* 2
* > '語'.length
* 1
* > 'a💩語'.length
* 4
* ```
*
* The results of the above example are explained by the fact that the
* characters 'a' and '語' are not represented by surrogate pairs, but '💩' is.
*
* Because of this idiosyncrasy in JavaScript's string implementation and APIs,
* we must "jump" an extra index after encoding a character as a surrogate
* pair. In practice, this means we must increment the index of our for loop by
* 2 if we encode a surrogate pair, and 1 in all other cases.
*
* -----------------------------------------------------------------------------
*
* References:
* - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf
* 3.9 Unicode Encoding Forms - UTF-8
* - [2] http://www.herongyang.com/Unicode/UTF-16-UTF-16-Encoding.html
* - [3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description
*
*/
exports.utf16Encode = function (input, byteOrderMark) {
if (byteOrderMark === void 0) { byteOrderMark = true; }
var encoded = [];
if (byteOrderMark)
encoded.push(0xfeff);
for (var idx = 0, len = input.length; idx < len;) {
var codePoint = input.codePointAt(idx);
// Two byte encoding
if (codePoint < 0x010000) {
encoded.push(codePoint);
idx += 1;
}
// Four byte encoding (surrogate pair)
else if (codePoint < 0x110000) {
encoded.push(exports.highSurrogate(codePoint), exports.lowSurrogate(codePoint));
idx += 2;
}
// Should never reach this case
else
throw new Error("Invalid code point: 0x" + strings_1.toHexString(codePoint));
}
return new Uint16Array(encoded);
};
/**
* Returns `true` if the `codePoint` is within the
* Basic Multilingual Plane (BMP). Code points inside the BMP are not encoded
* with surrogate pairs.
* @param codePoint The code point to be evaluated.
*
* Reference: https://en.wikipedia.org/wiki/UTF-16#Description
*/
exports.isWithinBMP = function (codePoint) {
return codePoint >= 0 && codePoint <= 0xffff;
};
/**
* Returns `true` if the given `codePoint` is valid and must be represented
* with a surrogate pair when encoded.
* @param codePoint The code point to be evaluated.
*
* Reference: https://en.wikipedia.org/wiki/UTF-16#Description
*/
exports.hasSurrogates = function (codePoint) {
return codePoint >= 0x010000 && codePoint <= 0x10ffff;
};
// From Unicode 3.0 spec, section 3.7:
// http://unicode.org/versions/Unicode3.0.0/ch03.pdf
exports.highSurrogate = function (codePoint) {
return Math.floor((codePoint - 0x10000) / 0x400) + 0xd800;
};
// From Unicode 3.0 spec, section 3.7:
// http://unicode.org/versions/Unicode3.0.0/ch03.pdf
exports.lowSurrogate = function (codePoint) {
return ((codePoint - 0x10000) % 0x400) + 0xdc00;
};
var ByteOrder;
(function (ByteOrder) {
ByteOrder["BigEndian"] = "BigEndian";
ByteOrder["LittleEndian"] = "LittleEndian";
})(ByteOrder || (ByteOrder = {}));
var REPLACEMENT = '<27>'.codePointAt(0);
/**
* Decodes a Uint8Array of data to a string using UTF-16.
*
* Note that this function attempts to recover from erronous input by
* inserting the replacement character (<28>) to mark invalid code points
* and surrogate pairs.
*
* @param input A Uint8Array containing UTF-16 encoded data
* @param byteOrderMark Whether or not a byte order marker (BOM) should be read
* at the start of the encoding. (default `true`)
* @returns The decoded string.
*/
exports.utf16Decode = function (input, byteOrderMark) {
if (byteOrderMark === void 0) { byteOrderMark = true; }
// Need at least 2 bytes of data in UTF-16 encodings
if (input.length <= 1)
return String.fromCodePoint(REPLACEMENT);
var byteOrder = byteOrderMark ? readBOM(input) : ByteOrder.BigEndian;
// Skip byte order mark if needed
var idx = byteOrderMark ? 2 : 0;
var codePoints = [];
while (input.length - idx >= 2) {
var first = decodeValues(input[idx++], input[idx++], byteOrder);
if (isHighSurrogate(first)) {
if (input.length - idx < 2) {
// Need at least 2 bytes left for the low surrogate that is required
codePoints.push(REPLACEMENT);
}
else {
var second = decodeValues(input[idx++], input[idx++], byteOrder);
if (isLowSurrogate(second)) {
codePoints.push(first, second);
}
else {
// Low surrogates should always follow high surrogates
codePoints.push(REPLACEMENT);
}
}
}
else if (isLowSurrogate(first)) {
// High surrogates should always come first since `decodeValues()`
// accounts for the byte ordering
idx += 2;
codePoints.push(REPLACEMENT);
}
else {
codePoints.push(first);
}
}
// There shouldn't be extra byte(s) left over
if (idx < input.length)
codePoints.push(REPLACEMENT);
return String.fromCodePoint.apply(String, codePoints);
};
/**
* Returns `true` if the given `codePoint` is a high surrogate.
* @param codePoint The code point to be evaluated.
*
* Reference: https://en.wikipedia.org/wiki/UTF-16#Description
*/
var isHighSurrogate = function (codePoint) {
return codePoint >= 0xd800 && codePoint <= 0xdbff;
};
/**
* Returns `true` if the given `codePoint` is a low surrogate.
* @param codePoint The code point to be evaluated.
*
* Reference: https://en.wikipedia.org/wiki/UTF-16#Description
*/
var isLowSurrogate = function (codePoint) {
return codePoint >= 0xdc00 && codePoint <= 0xdfff;
};
/**
* Decodes the given utf-16 values first and second using the specified
* byte order.
* @param first The first byte of the encoding.
* @param second The second byte of the encoding.
* @param byteOrder The byte order of the encoding.
* Reference: https://en.wikipedia.org/wiki/UTF-16#Examples
*/
var decodeValues = function (first, second, byteOrder) {
// Append the binary representation of the preceding byte by shifting the
// first one 8 to the left and than applying a bitwise or-operator to append
// the second one.
if (byteOrder === ByteOrder.LittleEndian)
return (second << 8) | first;
if (byteOrder === ByteOrder.BigEndian)
return (first << 8) | second;
throw new Error("Invalid byteOrder: " + byteOrder);
};
/**
* Returns whether the given array contains a byte order mark for the
* UTF-16BE or UTF-16LE encoding. If it has neither, BigEndian is assumed.
*
* Reference: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-16
*
* @param bytes The byte array to be evaluated.
*/
// prettier-ignore
var readBOM = function (bytes) { return (hasUtf16BigEndianBOM(bytes) ? ByteOrder.BigEndian
: hasUtf16LittleEndianBOM(bytes) ? ByteOrder.LittleEndian
: ByteOrder.BigEndian); };
var hasUtf16BigEndianBOM = function (bytes) {
return bytes[0] === 0xfe && bytes[1] === 0xff;
};
var hasUtf16LittleEndianBOM = function (bytes) {
return bytes[0] === 0xff && bytes[1] === 0xfe;
};
exports.hasUtf16BOM = function (bytes) {
return hasUtf16BigEndianBOM(bytes) || hasUtf16LittleEndianBOM(bytes);
};
//# sourceMappingURL=unicode.js.map

1
node_modules/pdf-lib/cjs/utils/unicode.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

27
node_modules/pdf-lib/cjs/utils/validators.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
export declare const backtick: (val: any) => string;
export declare const singleQuote: (val: any) => string;
declare type Primitive = string | number | boolean | undefined | null;
export declare const createValueErrorMsg: (value: any, valueName: string, values: Primitive[]) => string;
export declare const assertIsOneOf: (value: any, valueName: string, allowedValues: Primitive[] | {
[key: string]: Primitive;
}) => void;
export declare const assertIsOneOfOrUndefined: (value: any, valueName: string, allowedValues: Primitive[] | {
[key: string]: Primitive;
}) => void;
export declare const assertIsSubset: (values: any[], valueName: string, allowedValues: Primitive[] | {
[key: string]: Primitive;
}) => void;
export declare const getType: (val: any) => any;
export declare type TypeDescriptor = 'null' | 'undefined' | 'string' | 'number' | 'boolean' | 'symbol' | 'bigint' | DateConstructor | ArrayConstructor | Uint8ArrayConstructor | ArrayBufferConstructor | FunctionConstructor | [Function, string];
export declare const isType: (value: any, type: TypeDescriptor) => boolean;
export declare const createTypeErrorMsg: (value: any, valueName: string, types: TypeDescriptor[]) => string;
export declare const assertIs: (value: any, valueName: string, types: TypeDescriptor[]) => void;
export declare const assertOrUndefined: (value: any, valueName: string, types: TypeDescriptor[]) => void;
export declare const assertEachIs: (values: any[], valueName: string, types: TypeDescriptor[]) => void;
export declare const assertRange: (value: any, valueName: string, min: number, max: number) => void;
export declare const assertRangeOrUndefined: (value: any, valueName: string, min: number, max: number) => void;
export declare const assertMultiple: (value: any, valueName: string, multiplier: number) => void;
export declare const assertInteger: (value: any, valueName: string) => void;
export declare const assertPositive: (value: number, valueName: string) => void;
export {};
//# sourceMappingURL=validators.d.ts.map

1
node_modules/pdf-lib/cjs/utils/validators.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,QAAS,GAAG,WA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,eAAO,MAAM,cAAc,UAClB,GAAG,aACC,MAAM,cACL,MAAM,SAOnB,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,GAAG,aAAa,MAAM,SAM1D,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,MAAM,aAAa,MAAM,SAK9D,CAAC"}

183
node_modules/pdf-lib/cjs/utils/validators.js generated vendored Normal file
View File

@@ -0,0 +1,183 @@
"use strict";
/* tslint:disable:ban-types */
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertPositive = exports.assertInteger = exports.assertMultiple = exports.assertRangeOrUndefined = exports.assertRange = exports.assertEachIs = exports.assertOrUndefined = exports.assertIs = exports.createTypeErrorMsg = exports.isType = exports.getType = exports.assertIsSubset = exports.assertIsOneOfOrUndefined = exports.assertIsOneOf = exports.createValueErrorMsg = exports.singleQuote = exports.backtick = void 0;
var objects_1 = require("./objects");
exports.backtick = function (val) { return "`" + val + "`"; };
exports.singleQuote = function (val) { return "'" + val + "'"; };
// prettier-ignore
var formatValue = function (value) {
var type = typeof value;
if (type === 'string')
return exports.singleQuote(value);
else if (type === 'undefined')
return exports.backtick(value);
else
return value;
};
exports.createValueErrorMsg = function (value, valueName, values) {
var allowedValues = new Array(values.length);
for (var idx = 0, len = values.length; idx < len; idx++) {
var v = values[idx];
allowedValues[idx] = formatValue(v);
}
var joinedValues = allowedValues.join(' or ');
// prettier-ignore
return exports.backtick(valueName) + " must be one of " + joinedValues + ", but was actually " + formatValue(value);
};
exports.assertIsOneOf = function (value, valueName, allowedValues) {
if (!Array.isArray(allowedValues)) {
allowedValues = objects_1.values(allowedValues);
}
for (var idx = 0, len = allowedValues.length; idx < len; idx++) {
if (value === allowedValues[idx])
return;
}
throw new TypeError(exports.createValueErrorMsg(value, valueName, allowedValues));
};
exports.assertIsOneOfOrUndefined = function (value, valueName, allowedValues) {
if (!Array.isArray(allowedValues)) {
allowedValues = objects_1.values(allowedValues);
}
exports.assertIsOneOf(value, valueName, allowedValues.concat(undefined));
};
exports.assertIsSubset = function (values, valueName, allowedValues) {
if (!Array.isArray(allowedValues)) {
allowedValues = objects_1.values(allowedValues);
}
for (var idx = 0, len = values.length; idx < len; idx++) {
exports.assertIsOneOf(values[idx], valueName, allowedValues);
}
};
exports.getType = function (val) {
if (val === null)
return 'null';
if (val === undefined)
return 'undefined';
if (typeof val === 'string')
return 'string';
if (isNaN(val))
return 'NaN';
if (typeof val === 'number')
return 'number';
if (typeof val === 'boolean')
return 'boolean';
if (typeof val === 'symbol')
return 'symbol';
if (typeof val === 'bigint')
return 'bigint';
if (val.constructor && val.constructor.name)
return val.constructor.name;
if (val.name)
return val.name;
if (val.constructor)
return String(val.constructor);
return String(val);
};
exports.isType = function (value, type) {
if (type === 'null')
return value === null;
if (type === 'undefined')
return value === undefined;
if (type === 'string')
return typeof value === 'string';
if (type === 'number')
return typeof value === 'number' && !isNaN(value);
if (type === 'boolean')
return typeof value === 'boolean';
if (type === 'symbol')
return typeof value === 'symbol';
if (type === 'bigint')
return typeof value === 'bigint';
if (type === Date)
return value instanceof Date;
if (type === Array)
return value instanceof Array;
if (type === Uint8Array)
return value instanceof Uint8Array;
if (type === ArrayBuffer)
return value instanceof ArrayBuffer;
if (type === Function)
return value instanceof Function;
return value instanceof type[0];
};
exports.createTypeErrorMsg = function (value, valueName, types) {
var allowedTypes = new Array(types.length);
for (var idx = 0, len = types.length; idx < len; idx++) {
var type = types[idx];
if (type === 'null')
allowedTypes[idx] = exports.backtick('null');
if (type === 'undefined')
allowedTypes[idx] = exports.backtick('undefined');
if (type === 'string')
allowedTypes[idx] = exports.backtick('string');
else if (type === 'number')
allowedTypes[idx] = exports.backtick('number');
else if (type === 'boolean')
allowedTypes[idx] = exports.backtick('boolean');
else if (type === 'symbol')
allowedTypes[idx] = exports.backtick('symbol');
else if (type === 'bigint')
allowedTypes[idx] = exports.backtick('bigint');
else if (type === Array)
allowedTypes[idx] = exports.backtick('Array');
else if (type === Uint8Array)
allowedTypes[idx] = exports.backtick('Uint8Array');
else if (type === ArrayBuffer)
allowedTypes[idx] = exports.backtick('ArrayBuffer');
else
allowedTypes[idx] = exports.backtick(type[1]);
}
var joinedTypes = allowedTypes.join(' or ');
// prettier-ignore
return exports.backtick(valueName) + " must be of type " + joinedTypes + ", but was actually of type " + exports.backtick(exports.getType(value));
};
exports.assertIs = function (value, valueName, types) {
for (var idx = 0, len = types.length; idx < len; idx++) {
if (exports.isType(value, types[idx]))
return;
}
throw new TypeError(exports.createTypeErrorMsg(value, valueName, types));
};
exports.assertOrUndefined = function (value, valueName, types) {
exports.assertIs(value, valueName, types.concat('undefined'));
};
exports.assertEachIs = function (values, valueName, types) {
for (var idx = 0, len = values.length; idx < len; idx++) {
exports.assertIs(values[idx], valueName, types);
}
};
exports.assertRange = function (value, valueName, min, max) {
exports.assertIs(value, valueName, ['number']);
exports.assertIs(min, 'min', ['number']);
exports.assertIs(max, 'max', ['number']);
max = Math.max(min, max);
if (value < min || value > max) {
// prettier-ignore
throw new Error(exports.backtick(valueName) + " must be at least " + min + " and at most " + max + ", but was actually " + value);
}
};
exports.assertRangeOrUndefined = function (value, valueName, min, max) {
exports.assertIs(value, valueName, ['number', 'undefined']);
if (typeof value === 'number')
exports.assertRange(value, valueName, min, max);
};
exports.assertMultiple = function (value, valueName, multiplier) {
exports.assertIs(value, valueName, ['number']);
if (value % multiplier !== 0) {
// prettier-ignore
throw new Error(exports.backtick(valueName) + " must be a multiple of " + multiplier + ", but was actually " + value);
}
};
exports.assertInteger = function (value, valueName) {
if (!Number.isInteger(value)) {
throw new Error(exports.backtick(valueName) + " must be an integer, but was actually " + value);
}
};
exports.assertPositive = function (value, valueName) {
if (![1, 0].includes(Math.sign(value))) {
// prettier-ignore
throw new Error(exports.backtick(valueName) + " must be a positive number or 0, but was actually " + value);
}
};
//# sourceMappingURL=validators.js.map

1
node_modules/pdf-lib/cjs/utils/validators.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long