@neoware_inc/neozipkit 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -0
- package/dist/browser/ZipkitBrowser.d.ts +27 -0
- package/dist/browser/ZipkitBrowser.d.ts.map +1 -0
- package/dist/browser/ZipkitBrowser.js +303 -0
- package/dist/browser/ZipkitBrowser.js.map +1 -0
- package/dist/browser/index.d.ts +9 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.esm.d.ts +12 -0
- package/dist/browser/index.esm.d.ts.map +1 -0
- package/dist/browser/index.esm.js +46 -0
- package/dist/browser/index.esm.js.map +1 -0
- package/dist/browser/index.js +38 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser-esm/index.d.ts +9 -0
- package/dist/browser-esm/index.js +50211 -0
- package/dist/browser-esm/index.js.map +7 -0
- package/dist/browser-umd/index.d.ts +9 -0
- package/dist/browser-umd/index.js +50221 -0
- package/dist/browser-umd/index.js.map +7 -0
- package/dist/browser-umd/index.min.js +39 -0
- package/dist/browser.d.ts +9 -0
- package/dist/browser.js +38 -0
- package/dist/core/ZipCompress.d.ts +99 -0
- package/dist/core/ZipCompress.d.ts.map +1 -0
- package/dist/core/ZipCompress.js +287 -0
- package/dist/core/ZipCompress.js.map +1 -0
- package/dist/core/ZipCopy.d.ts +175 -0
- package/dist/core/ZipCopy.d.ts.map +1 -0
- package/dist/core/ZipCopy.js +310 -0
- package/dist/core/ZipCopy.js.map +1 -0
- package/dist/core/ZipDecompress.d.ts +57 -0
- package/dist/core/ZipDecompress.d.ts.map +1 -0
- package/dist/core/ZipDecompress.js +155 -0
- package/dist/core/ZipDecompress.js.map +1 -0
- package/dist/core/ZipEntry.d.ts +138 -0
- package/dist/core/ZipEntry.d.ts.map +1 -0
- package/dist/core/ZipEntry.js +829 -0
- package/dist/core/ZipEntry.js.map +1 -0
- package/dist/core/Zipkit.d.ts +315 -0
- package/dist/core/Zipkit.d.ts.map +1 -0
- package/dist/core/Zipkit.js +647 -0
- package/dist/core/Zipkit.js.map +1 -0
- package/dist/core/ZstdManager.d.ts +56 -0
- package/dist/core/ZstdManager.d.ts.map +1 -0
- package/dist/core/ZstdManager.js +144 -0
- package/dist/core/ZstdManager.js.map +1 -0
- package/dist/core/components/HashCalculator.d.ts +138 -0
- package/dist/core/components/HashCalculator.d.ts.map +1 -0
- package/dist/core/components/HashCalculator.js +360 -0
- package/dist/core/components/HashCalculator.js.map +1 -0
- package/dist/core/components/Logger.d.ts +73 -0
- package/dist/core/components/Logger.d.ts.map +1 -0
- package/dist/core/components/Logger.js +156 -0
- package/dist/core/components/Logger.js.map +1 -0
- package/dist/core/components/ProgressTracker.d.ts +43 -0
- package/dist/core/components/ProgressTracker.d.ts.map +1 -0
- package/dist/core/components/ProgressTracker.js +112 -0
- package/dist/core/components/ProgressTracker.js.map +1 -0
- package/dist/core/components/Support.d.ts +64 -0
- package/dist/core/components/Support.d.ts.map +1 -0
- package/dist/core/components/Support.js +71 -0
- package/dist/core/components/Support.js.map +1 -0
- package/dist/core/components/Util.d.ts +26 -0
- package/dist/core/components/Util.d.ts.map +1 -0
- package/dist/core/components/Util.js +95 -0
- package/dist/core/components/Util.js.map +1 -0
- package/dist/core/constants/Errors.d.ts +52 -0
- package/dist/core/constants/Errors.d.ts.map +1 -0
- package/dist/core/constants/Errors.js +67 -0
- package/dist/core/constants/Errors.js.map +1 -0
- package/dist/core/constants/Headers.d.ts +170 -0
- package/dist/core/constants/Headers.d.ts.map +1 -0
- package/dist/core/constants/Headers.js +194 -0
- package/dist/core/constants/Headers.js.map +1 -0
- package/dist/core/encryption/Manager.d.ts +58 -0
- package/dist/core/encryption/Manager.d.ts.map +1 -0
- package/dist/core/encryption/Manager.js +121 -0
- package/dist/core/encryption/Manager.js.map +1 -0
- package/dist/core/encryption/ZipCrypto.d.ts +172 -0
- package/dist/core/encryption/ZipCrypto.d.ts.map +1 -0
- package/dist/core/encryption/ZipCrypto.js +554 -0
- package/dist/core/encryption/ZipCrypto.js.map +1 -0
- package/dist/core/encryption/index.d.ts +9 -0
- package/dist/core/encryption/index.d.ts.map +1 -0
- package/dist/core/encryption/index.js +17 -0
- package/dist/core/encryption/index.js.map +1 -0
- package/dist/core/encryption/types.d.ts +29 -0
- package/dist/core/encryption/types.d.ts.map +1 -0
- package/dist/core/encryption/types.js +12 -0
- package/dist/core/encryption/types.js.map +1 -0
- package/dist/core/index.d.ts +27 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +59 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/version.d.ts +5 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +31 -0
- package/dist/core/version.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/node/ZipCompressNode.d.ts +123 -0
- package/dist/node/ZipCompressNode.d.ts.map +1 -0
- package/dist/node/ZipCompressNode.js +565 -0
- package/dist/node/ZipCompressNode.js.map +1 -0
- package/dist/node/ZipCopyNode.d.ts +165 -0
- package/dist/node/ZipCopyNode.d.ts.map +1 -0
- package/dist/node/ZipCopyNode.js +347 -0
- package/dist/node/ZipCopyNode.js.map +1 -0
- package/dist/node/ZipDecompressNode.d.ts +197 -0
- package/dist/node/ZipDecompressNode.d.ts.map +1 -0
- package/dist/node/ZipDecompressNode.js +678 -0
- package/dist/node/ZipDecompressNode.js.map +1 -0
- package/dist/node/ZipkitNode.d.ts +466 -0
- package/dist/node/ZipkitNode.d.ts.map +1 -0
- package/dist/node/ZipkitNode.js +1426 -0
- package/dist/node/ZipkitNode.js.map +1 -0
- package/dist/node/index.d.ts +25 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +54 -0
- package/dist/node/index.js.map +1 -0
- package/dist/types/index.d.ts +45 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/examples/README.md +261 -0
- package/examples/append-data.json +44 -0
- package/examples/copy-zip-append.ts +139 -0
- package/examples/copy-zip.ts +152 -0
- package/examples/create-zip.ts +172 -0
- package/examples/extract-zip.ts +118 -0
- package/examples/list-zip.ts +161 -0
- package/examples/test-files/data.json +116 -0
- package/examples/test-files/document.md +80 -0
- package/examples/test-files/document.txt +6 -0
- package/examples/test-files/file1.txt +48 -0
- package/examples/test-files/file2.txt +80 -0
- package/examples/tsconfig.json +44 -0
- package/package.json +167 -0
- package/src/browser/ZipkitBrowser.ts +305 -0
- package/src/browser/index.esm.ts +32 -0
- package/src/browser/index.ts +19 -0
- package/src/core/ZipCompress.ts +370 -0
- package/src/core/ZipCopy.ts +434 -0
- package/src/core/ZipDecompress.ts +191 -0
- package/src/core/ZipEntry.ts +917 -0
- package/src/core/Zipkit.ts +794 -0
- package/src/core/ZstdManager.ts +165 -0
- package/src/core/components/HashCalculator.ts +384 -0
- package/src/core/components/Logger.ts +180 -0
- package/src/core/components/ProgressTracker.ts +134 -0
- package/src/core/components/Support.ts +77 -0
- package/src/core/components/Util.ts +91 -0
- package/src/core/constants/Errors.ts +78 -0
- package/src/core/constants/Headers.ts +205 -0
- package/src/core/encryption/Manager.ts +137 -0
- package/src/core/encryption/ZipCrypto.ts +650 -0
- package/src/core/encryption/index.ts +15 -0
- package/src/core/encryption/types.ts +33 -0
- package/src/core/index.ts +42 -0
- package/src/core/version.ts +33 -0
- package/src/index.ts +19 -0
- package/src/node/ZipCompressNode.ts +618 -0
- package/src/node/ZipCopyNode.ts +437 -0
- package/src/node/ZipDecompressNode.ts +793 -0
- package/src/node/ZipkitNode.ts +1706 -0
- package/src/node/index.ts +40 -0
- package/src/types/index.ts +68 -0
- package/src/types/modules.d.ts +22 -0
- package/src/types/opentimestamps.d.ts +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressTracker = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Progress tracker for streaming operations
|
|
6
|
+
* Provides real-time progress updates and ETA calculations
|
|
7
|
+
*/
|
|
8
|
+
class ProgressTracker {
|
|
9
|
+
constructor(fileName, totalBytes) {
|
|
10
|
+
this.lastReportedPercent = -1;
|
|
11
|
+
this.fileName = fileName;
|
|
12
|
+
this.totalBytes = totalBytes;
|
|
13
|
+
this.processedBytes = 0;
|
|
14
|
+
this.startTime = Date.now();
|
|
15
|
+
this.lastUpdateTime = this.startTime;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Update progress with bytes processed
|
|
19
|
+
* @param bytesProcessed - Number of bytes processed in this update
|
|
20
|
+
*/
|
|
21
|
+
update(bytesProcessed) {
|
|
22
|
+
this.processedBytes += bytesProcessed;
|
|
23
|
+
this.reportProgress();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Set total bytes (useful when file size changes)
|
|
27
|
+
*/
|
|
28
|
+
setTotalBytes(totalBytes) {
|
|
29
|
+
this.totalBytes = totalBytes;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Report progress if enough time has passed or significant progress made
|
|
33
|
+
*/
|
|
34
|
+
reportProgress() {
|
|
35
|
+
const now = Date.now();
|
|
36
|
+
const percent = Math.floor((this.processedBytes / this.totalBytes) * 100);
|
|
37
|
+
// Report if:
|
|
38
|
+
// 1. 1% or more progress made, OR
|
|
39
|
+
// 2. 500ms have passed since last report
|
|
40
|
+
const shouldReport = percent > this.lastReportedPercent ||
|
|
41
|
+
(now - this.lastUpdateTime) > 500;
|
|
42
|
+
if (shouldReport) {
|
|
43
|
+
this.lastReportedPercent = percent;
|
|
44
|
+
this.lastUpdateTime = now;
|
|
45
|
+
this.printProgress();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Print progress information
|
|
50
|
+
*/
|
|
51
|
+
printProgress() {
|
|
52
|
+
const elapsed = (Date.now() - this.startTime) / 1000;
|
|
53
|
+
const rate = this.processedBytes / elapsed;
|
|
54
|
+
const eta = this.totalBytes > this.processedBytes
|
|
55
|
+
? (this.totalBytes - this.processedBytes) / rate
|
|
56
|
+
: 0;
|
|
57
|
+
const percent = Math.floor((this.processedBytes / this.totalBytes) * 100);
|
|
58
|
+
const formatBytes = (bytes) => {
|
|
59
|
+
const units = ['B', 'KB', 'MB', 'GB'];
|
|
60
|
+
let size = bytes;
|
|
61
|
+
let unitIndex = 0;
|
|
62
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
63
|
+
size /= 1024;
|
|
64
|
+
unitIndex++;
|
|
65
|
+
}
|
|
66
|
+
return `${size.toFixed(1)}${units[unitIndex]}`;
|
|
67
|
+
};
|
|
68
|
+
const formatTime = (seconds) => {
|
|
69
|
+
if (seconds < 60)
|
|
70
|
+
return `${seconds.toFixed(0)}s`;
|
|
71
|
+
if (seconds < 3600)
|
|
72
|
+
return `${Math.floor(seconds / 60)}m ${(seconds % 60).toFixed(0)}s`;
|
|
73
|
+
return `${Math.floor(seconds / 3600)}h ${Math.floor((seconds % 3600) / 60)}m`;
|
|
74
|
+
};
|
|
75
|
+
process.stdout.write(`\r${this.fileName}: ${percent}% (${formatBytes(this.processedBytes)}/${formatBytes(this.totalBytes)}) ` +
|
|
76
|
+
`[${formatBytes(rate)}/s] ETA: ${formatTime(eta)}`);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Complete progress tracking
|
|
80
|
+
*/
|
|
81
|
+
complete() {
|
|
82
|
+
const elapsed = (Date.now() - this.startTime) / 1000;
|
|
83
|
+
const rate = this.processedBytes / elapsed;
|
|
84
|
+
const formatBytes = (bytes) => {
|
|
85
|
+
const units = ['B', 'KB', 'MB', 'GB'];
|
|
86
|
+
let size = bytes;
|
|
87
|
+
let unitIndex = 0;
|
|
88
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
89
|
+
size /= 1024;
|
|
90
|
+
unitIndex++;
|
|
91
|
+
}
|
|
92
|
+
return `${size.toFixed(1)}${units[unitIndex]}`;
|
|
93
|
+
};
|
|
94
|
+
console.log(`\r${this.fileName}: 100% (${formatBytes(this.processedBytes)}) ` +
|
|
95
|
+
`[${formatBytes(rate)}/s] completed in ${elapsed.toFixed(1)}s`);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get current progress percentage
|
|
99
|
+
*/
|
|
100
|
+
getProgressPercent() {
|
|
101
|
+
return Math.floor((this.processedBytes / this.totalBytes) * 100);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get processing rate in bytes per second
|
|
105
|
+
*/
|
|
106
|
+
getProcessingRate() {
|
|
107
|
+
const elapsed = (Date.now() - this.startTime) / 1000;
|
|
108
|
+
return this.processedBytes / elapsed;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.ProgressTracker = ProgressTracker;
|
|
112
|
+
//# sourceMappingURL=ProgressTracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressTracker.js","sourceRoot":"","sources":["../../../src/core/components/ProgressTracker.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,eAAe;IAQ1B,YAAY,QAAgB,EAAE,UAAkB;QAFxC,wBAAmB,GAAW,CAAC,CAAC,CAAC;QAGvC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,cAAsB;QAC3B,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC;QACtC,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,aAAa,CAAC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AC;QACrD,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAE3C,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE;YAC5C,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACtC,IAAI,IAAI,GAAG,KAAK,CAAC;YACjB,IAAI,SAAS,GAAG,CAAC,CAAC;YAElB,OAAO,IAAI,IAAI,IAAI,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpD,IAAI,IAAI,IAAI,CAAC;gBACb,SAAS,EAAE,CAAC;YACd,CAAC;YAED,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QACjD,CAAC,CAAC;QAEF,OAAO,CAAC,GAAG,CACT,KAAK,IAAI,CAAC,QAAQ,WAAW,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI;YACjE,IAAI,WAAW,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAC/D,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;QACrD,OAAO,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IACvC,CAAC;CACF;AAjID,0CAiIC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform and environment feature detection utility
|
|
3
|
+
* Provides boolean flags indicating support for various features needed by NeoZip
|
|
4
|
+
*
|
|
5
|
+
* @namespace Support
|
|
6
|
+
* @property {boolean} base64 - Always true, indicates base64 encoding support
|
|
7
|
+
* @property {boolean} array - Always true, indicates Array support
|
|
8
|
+
* @property {boolean} string - Always true, indicates String support
|
|
9
|
+
* @property {boolean} isNode - True if running in Node.js environment
|
|
10
|
+
* @property {boolean} buffer - True if Node.js Buffer is available
|
|
11
|
+
* @property {boolean} uint8array - True if Uint8Array is supported
|
|
12
|
+
* @property {boolean} arrayBuffer - True if both ArrayBuffer and Uint8Array are supported
|
|
13
|
+
* @property {boolean} blob - True if Blob creation with ArrayBuffer is supported
|
|
14
|
+
* @property {boolean} streams - True if ReadableStream and WritableStream are supported
|
|
15
|
+
* @property {boolean} fileReader - True if FileReader is supported
|
|
16
|
+
*/
|
|
17
|
+
declare const Support: {
|
|
18
|
+
/** Base64 encoding support (always true) */
|
|
19
|
+
base64: boolean;
|
|
20
|
+
/** Array support (always true) */
|
|
21
|
+
array: boolean;
|
|
22
|
+
/** String support (always true) */
|
|
23
|
+
string: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Detects if code is running in Node.js environment
|
|
26
|
+
* True if process.versions.node exists, undefined in browser
|
|
27
|
+
*/
|
|
28
|
+
isNode: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Detects if Node.js Buffer is available
|
|
31
|
+
* True in Node.js, undefined in browser
|
|
32
|
+
*/
|
|
33
|
+
buffer: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Detects support for Uint8Array typed array
|
|
36
|
+
* Used for binary data handling
|
|
37
|
+
*/
|
|
38
|
+
uint8array: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Detects support for both ArrayBuffer and Uint8Array
|
|
41
|
+
* Required for binary data operations
|
|
42
|
+
*/
|
|
43
|
+
arrayBuffer: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Detects support for Blob with ArrayBuffer
|
|
46
|
+
* Tests by attempting to create an empty ZIP Blob
|
|
47
|
+
* @returns {boolean} True if Blob creation succeeds
|
|
48
|
+
*/
|
|
49
|
+
blob: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Detects support for Streams API
|
|
52
|
+
* Checks for ReadableStream/WritableStream in browser
|
|
53
|
+
* or 'stream' module in Node.js
|
|
54
|
+
* @returns {boolean} True if streams are supported in current environment
|
|
55
|
+
*/
|
|
56
|
+
streams: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Detects support for FileReader
|
|
59
|
+
* @returns {boolean} True if FileReader is supported
|
|
60
|
+
*/
|
|
61
|
+
fileReader: boolean;
|
|
62
|
+
};
|
|
63
|
+
export default Support;
|
|
64
|
+
//# sourceMappingURL=Support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Support.d.ts","sourceRoot":"","sources":["../../../src/core/components/Support.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,OAAO;IACX,4CAA4C;;IAE5C,kCAAkC;;IAElC,mCAAmC;;IAGnC;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;;IAGH;;;OAGG;;CAEJ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ======================================
|
|
3
|
+
// Support.ts
|
|
4
|
+
// A utility module for detecting platform capabilities and features
|
|
5
|
+
// Copyright (c) 2024 NeoWare, Inc. All rights reserved.
|
|
6
|
+
// ======================================
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
/**
|
|
9
|
+
* Platform and environment feature detection utility
|
|
10
|
+
* Provides boolean flags indicating support for various features needed by NeoZip
|
|
11
|
+
*
|
|
12
|
+
* @namespace Support
|
|
13
|
+
* @property {boolean} base64 - Always true, indicates base64 encoding support
|
|
14
|
+
* @property {boolean} array - Always true, indicates Array support
|
|
15
|
+
* @property {boolean} string - Always true, indicates String support
|
|
16
|
+
* @property {boolean} isNode - True if running in Node.js environment
|
|
17
|
+
* @property {boolean} buffer - True if Node.js Buffer is available
|
|
18
|
+
* @property {boolean} uint8array - True if Uint8Array is supported
|
|
19
|
+
* @property {boolean} arrayBuffer - True if both ArrayBuffer and Uint8Array are supported
|
|
20
|
+
* @property {boolean} blob - True if Blob creation with ArrayBuffer is supported
|
|
21
|
+
* @property {boolean} streams - True if ReadableStream and WritableStream are supported
|
|
22
|
+
* @property {boolean} fileReader - True if FileReader is supported
|
|
23
|
+
*/
|
|
24
|
+
const Support = {
|
|
25
|
+
/** Base64 encoding support (always true) */
|
|
26
|
+
base64: true,
|
|
27
|
+
/** Array support (always true) */
|
|
28
|
+
array: true,
|
|
29
|
+
/** String support (always true) */
|
|
30
|
+
string: true,
|
|
31
|
+
/**
|
|
32
|
+
* Detects if code is running in Node.js environment
|
|
33
|
+
* True if process.versions.node exists, undefined in browser
|
|
34
|
+
*/
|
|
35
|
+
isNode: true,
|
|
36
|
+
/**
|
|
37
|
+
* Detects if Node.js Buffer is available
|
|
38
|
+
* True in Node.js, undefined in browser
|
|
39
|
+
*/
|
|
40
|
+
buffer: true,
|
|
41
|
+
/**
|
|
42
|
+
* Detects support for Uint8Array typed array
|
|
43
|
+
* Used for binary data handling
|
|
44
|
+
*/
|
|
45
|
+
uint8array: true,
|
|
46
|
+
/**
|
|
47
|
+
* Detects support for both ArrayBuffer and Uint8Array
|
|
48
|
+
* Required for binary data operations
|
|
49
|
+
*/
|
|
50
|
+
arrayBuffer: typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined",
|
|
51
|
+
/**
|
|
52
|
+
* Detects support for Blob with ArrayBuffer
|
|
53
|
+
* Tests by attempting to create an empty ZIP Blob
|
|
54
|
+
* @returns {boolean} True if Blob creation succeeds
|
|
55
|
+
*/
|
|
56
|
+
blob: true,
|
|
57
|
+
/**
|
|
58
|
+
* Detects support for Streams API
|
|
59
|
+
* Checks for ReadableStream/WritableStream in browser
|
|
60
|
+
* or 'stream' module in Node.js
|
|
61
|
+
* @returns {boolean} True if streams are supported in current environment
|
|
62
|
+
*/
|
|
63
|
+
streams: true,
|
|
64
|
+
/**
|
|
65
|
+
* Detects support for FileReader
|
|
66
|
+
* @returns {boolean} True if FileReader is supported
|
|
67
|
+
*/
|
|
68
|
+
fileReader: false
|
|
69
|
+
};
|
|
70
|
+
exports.default = Support;
|
|
71
|
+
//# sourceMappingURL=Support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Support.js","sourceRoot":"","sources":["../../../src/core/components/Support.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,aAAa;AACb,qEAAqE;AACrE,yDAAyD;AACzD,yCAAyC;;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,GAAG;IACd,4CAA4C;IAC5C,MAAM,EAAE,IAAI;IACZ,kCAAkC;IAClC,KAAK,EAAE,IAAI;IACX,mCAAmC;IACnC,MAAM,EAAE,IAAI;IAEZ;;;OAGG;IACH,MAAM,EAAE,IAAI;IAEZ;;;OAGG;IACH,MAAM,EAAE,IAAI;IAEZ;;;OAGG;IACH,UAAU,EAAE,IAAI;IAEhB;;;OAGG;IACH,WAAW,EAAE,OAAO,WAAW,KAAK,WAAW,IAAI,OAAO,UAAU,KAAK,WAAW;IAEpF;;;;OAIG;IACH,IAAI,EAAE,IAAI;IAEV;;;;;OAKG;IACH,OAAO,EAAE,IAAI;IAEb;;;OAGG;IACH,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const DATATYPE: {
|
|
2
|
+
STRING: string;
|
|
3
|
+
BUFFER: string;
|
|
4
|
+
ARRAY: string;
|
|
5
|
+
ARRAYBUFFER: string;
|
|
6
|
+
U8ARRAY: string;
|
|
7
|
+
BLOB: string;
|
|
8
|
+
STREAM: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function readBigUInt64LE(buffer: Buffer, index: number): number;
|
|
11
|
+
export declare const uMul: (a: number, b: number) => number;
|
|
12
|
+
interface StreamLike {
|
|
13
|
+
on: Function;
|
|
14
|
+
pause: Function;
|
|
15
|
+
resume: Function;
|
|
16
|
+
}
|
|
17
|
+
export declare function isStream(obj: unknown): obj is StreamLike;
|
|
18
|
+
export declare function getTypeOf(input: string | Buffer | Blob | Array<any> | ArrayBuffer | Uint8Array): string;
|
|
19
|
+
/**
|
|
20
|
+
* Check if a filename is a metadata file
|
|
21
|
+
* @param filename The filename to check
|
|
22
|
+
* @returns True if the file is a metadata file (META-INF)
|
|
23
|
+
*/
|
|
24
|
+
export declare const isMetadataFile: (filename: string) => boolean;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=Util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../../src/core/components/Util.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ;;;;;;;;CAQpB,CAAC;AAGF,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAKrE;AAGD,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,WAA0B,CAAC;AAEpE,UAAU,UAAU;IAClB,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;CAClB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU,CAMxD;AAKD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAC,MAAM,GAAC,IAAI,GAAC,KAAK,CAAC,GAAG,CAAC,GAAC,WAAW,GAAC,UAAU,GAAG,MAAM,CA+B7F;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,OAIjD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ======================================
|
|
3
|
+
// Util.ts
|
|
4
|
+
// Copyright (c) 2024 NeoWare, Inc. All rights reserved.
|
|
5
|
+
// ======================================
|
|
6
|
+
// Utility functions
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.isMetadataFile = exports.uMul = exports.DATATYPE = void 0;
|
|
12
|
+
exports.readBigUInt64LE = readBigUInt64LE;
|
|
13
|
+
exports.isStream = isStream;
|
|
14
|
+
exports.getTypeOf = getTypeOf;
|
|
15
|
+
const Support_1 = __importDefault(require("./Support"));
|
|
16
|
+
const Errors_1 = __importDefault(require("../constants/Errors"));
|
|
17
|
+
const Headers_1 = require("../constants/Headers");
|
|
18
|
+
exports.DATATYPE = {
|
|
19
|
+
STRING: "string",
|
|
20
|
+
BUFFER: "buffer",
|
|
21
|
+
ARRAY: "array",
|
|
22
|
+
ARRAYBUFFER: "arraybuffer",
|
|
23
|
+
U8ARRAY: "uint8array",
|
|
24
|
+
BLOB: "blob",
|
|
25
|
+
STREAM: "stream",
|
|
26
|
+
};
|
|
27
|
+
// Parse a 64-bit unsigned integer from a buffer
|
|
28
|
+
function readBigUInt64LE(buffer, index) {
|
|
29
|
+
var buf = Buffer.from(buffer.subarray(index, index + 8));
|
|
30
|
+
buf.swap64();
|
|
31
|
+
return parseInt(`0x${buf.toString("hex")}`);
|
|
32
|
+
}
|
|
33
|
+
;
|
|
34
|
+
// C-style uInt32 Multiply (discards higher bits, when JS multiply discards lower bits)
|
|
35
|
+
const uMul = (a, b) => Math.imul(a, b) >>> 0;
|
|
36
|
+
exports.uMul = uMul;
|
|
37
|
+
function isStream(obj) {
|
|
38
|
+
if (!obj || typeof obj !== 'object')
|
|
39
|
+
return false;
|
|
40
|
+
const streamLike = obj;
|
|
41
|
+
return typeof streamLike.on === "function" &&
|
|
42
|
+
typeof streamLike.pause === "function" &&
|
|
43
|
+
typeof streamLike.resume === "function";
|
|
44
|
+
}
|
|
45
|
+
// Return the type of the input.
|
|
46
|
+
// The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.
|
|
47
|
+
// If the type is not supported, throw an exception.
|
|
48
|
+
function getTypeOf(input) {
|
|
49
|
+
if (typeof input === "string") {
|
|
50
|
+
if (!Support_1.default.string)
|
|
51
|
+
throw new Error(Errors_1.default.DATATYPE_STRING_UNSUPPORTED);
|
|
52
|
+
return exports.DATATYPE.STRING;
|
|
53
|
+
}
|
|
54
|
+
else if (Object.prototype.toString.call(input) === "[object Array]") {
|
|
55
|
+
if (!Support_1.default.array)
|
|
56
|
+
throw new Error(Errors_1.default.DATATYPE_ARRAY_UNSUPPORTED);
|
|
57
|
+
return exports.DATATYPE.ARRAY;
|
|
58
|
+
}
|
|
59
|
+
else if (Buffer.isBuffer(input)) {
|
|
60
|
+
if (!Support_1.default.buffer)
|
|
61
|
+
throw new Error(Errors_1.default.DATATYPE_BUFFER_UNSUPPORTED);
|
|
62
|
+
return exports.DATATYPE.BUFFER;
|
|
63
|
+
}
|
|
64
|
+
else if (input instanceof Blob) {
|
|
65
|
+
if (!Support_1.default.blob)
|
|
66
|
+
throw new Error(Errors_1.default.DATATYPE_BLOB_UNSUPPORTED);
|
|
67
|
+
return exports.DATATYPE.BLOB;
|
|
68
|
+
}
|
|
69
|
+
else if (input instanceof Uint8Array) {
|
|
70
|
+
if (!Support_1.default.uint8array)
|
|
71
|
+
throw new Error(Errors_1.default.DATATYPE_U8ARRAY_UNSUPPORTED);
|
|
72
|
+
return exports.DATATYPE.U8ARRAY;
|
|
73
|
+
}
|
|
74
|
+
else if (input instanceof ArrayBuffer) {
|
|
75
|
+
if (!Support_1.default.arrayBuffer)
|
|
76
|
+
throw new Error(Errors_1.default.DATATYPE_ARRAYBUFFER_UNSUPPORTED);
|
|
77
|
+
return exports.DATATYPE.ARRAYBUFFER;
|
|
78
|
+
}
|
|
79
|
+
else { // Add an else block to handle unsupported types
|
|
80
|
+
throw new Error(Errors_1.default.DATATYPE_UNSUPPORTED);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
;
|
|
84
|
+
/**
|
|
85
|
+
* Check if a filename is a metadata file
|
|
86
|
+
* @param filename The filename to check
|
|
87
|
+
* @returns True if the file is a metadata file (META-INF)
|
|
88
|
+
*/
|
|
89
|
+
const isMetadataFile = (filename) => {
|
|
90
|
+
return filename === Headers_1.TIMESTAMP_SUBMITTED ||
|
|
91
|
+
filename === Headers_1.TIMESTAMP_METADATA ||
|
|
92
|
+
filename === Headers_1.TOKENIZED_METADATA;
|
|
93
|
+
};
|
|
94
|
+
exports.isMetadataFile = isMetadataFile;
|
|
95
|
+
//# sourceMappingURL=Util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Util.js","sourceRoot":"","sources":["../../../src/core/components/Util.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,UAAU;AACV,yDAAyD;AACzD,yCAAyC;AACzC,oBAAoB;;;;;;AAiBpB,0CAKC;AAWD,4BAMC;AAKD,8BA+BC;AAzED,wDAAgC;AAChC,iEAAyC;AACzC,kDAAmG;AAEtF,QAAA,QAAQ,GAAG;IACtB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,gDAAgD;AAChD,SAAgB,eAAe,CAAC,MAAc,EAAE,KAAa;IAC3D,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,GAAG,CAAC,MAAM,EAAE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
|
8
|
+
STRONG_ENCRYPT_UNSUPPORTED: string;
|
|
9
|
+
INVALID_TIMESTAMP: string;
|
|
10
|
+
TIMESTAMP_FAILED: string;
|
|
11
|
+
AVAIL_DATA: string;
|
|
12
|
+
INVALID_DISTANCE: string;
|
|
13
|
+
TO_MANY_CODES: string;
|
|
14
|
+
INVALID_REPEAT_LEN: string;
|
|
15
|
+
INVALID_REPEAT_FIRST: string;
|
|
16
|
+
INCOMPLETE_CODES: string;
|
|
17
|
+
INVALID_DYN_DISTANCE: string;
|
|
18
|
+
INVALID_CODES_LEN: string;
|
|
19
|
+
INVALID_STORE_BLOCK: string;
|
|
20
|
+
INVALID_BLOCK_TYPE: string;
|
|
21
|
+
INVALID_CMP_DATA_LENGTH: string;
|
|
22
|
+
EXTRACT_FAILED: string;
|
|
23
|
+
INVALID_CRC: string;
|
|
24
|
+
UNKNOWN_SHA256: string;
|
|
25
|
+
INVALID_SHA256: string;
|
|
26
|
+
CANT_EXTRACT_FILE: string;
|
|
27
|
+
CANT_OVERRIDE: string;
|
|
28
|
+
NO_ZIP: string;
|
|
29
|
+
NO_ENTRY: string;
|
|
30
|
+
DIRECTORY_CONTENT_ERROR: string;
|
|
31
|
+
FILE_NOT_FOUND: string;
|
|
32
|
+
NOT_IMPLEMENTED: string;
|
|
33
|
+
INVALID_FILENAME: string;
|
|
34
|
+
INVALID_FORMAT: string;
|
|
35
|
+
NO_STREAM_SUPPORT: string;
|
|
36
|
+
NO_BLOB_SUPPORT: string;
|
|
37
|
+
NO_FILE_READER_SUPPORT: string;
|
|
38
|
+
NO_FILES: string;
|
|
39
|
+
DATATYPE_STRING_UNSUPPORTED: string;
|
|
40
|
+
DATATYPE_ARRAY_UNSUPPORTED: string;
|
|
41
|
+
DATATYPE_BUFFER_UNSUPPORTED: string;
|
|
42
|
+
DATATYPE_BLOB_UNSUPPORTED: string;
|
|
43
|
+
DATATYPE_U8ARRAY_UNSUPPORTED: string;
|
|
44
|
+
DATATYPE_ARRAYBUFFER_UNSUPPORTED: string;
|
|
45
|
+
DATATYPE_UNSUPPORTED: string;
|
|
46
|
+
COMPRESS_FAILED: string;
|
|
47
|
+
COMPRESSION_ERROR: string;
|
|
48
|
+
DECOMPRESSION_ERROR: string;
|
|
49
|
+
ENCRYPT_FAILED: string;
|
|
50
|
+
};
|
|
51
|
+
export default _default;
|
|
52
|
+
//# sourceMappingURL=Errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../../../src/core/constants/Errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAqEE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ======================================
|
|
3
|
+
// Errors.ts
|
|
4
|
+
// Copyright (c) 2024 NeoWare, Inc. All rights reserved.
|
|
5
|
+
// ======================================
|
|
6
|
+
// Error messages
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.default = {
|
|
9
|
+
/* Header error messages */
|
|
10
|
+
INVALID_LOC: "Invalid LOC header (bad signature)",
|
|
11
|
+
INVALID_CEN: "Invalid CEN header (bad signature)",
|
|
12
|
+
INVALID_END: "Invalid END header (bad signature)",
|
|
13
|
+
/* ZipEntry error messages*/
|
|
14
|
+
NO_DATA: "Nothing to decompress",
|
|
15
|
+
FILE_IN_THE_WAY: "There is a file in the way: %s",
|
|
16
|
+
UNKNOWN_METHOD: "Invalid/unsupported compression method",
|
|
17
|
+
/* Encryption Errors */
|
|
18
|
+
STRONG_ENCRYPT_UNSUPPORTED: "Strong Encryption is not supported",
|
|
19
|
+
/* Timestamp error messages */
|
|
20
|
+
INVALID_TIMESTAMP: "Invalid timestamp",
|
|
21
|
+
TIMESTAMP_FAILED: "Failed to create the timestamp",
|
|
22
|
+
/* Inflater error messages */
|
|
23
|
+
AVAIL_DATA: "inflate::Available inflate data did not terminate",
|
|
24
|
+
INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
|
|
25
|
+
TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
|
|
26
|
+
INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
|
|
27
|
+
INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
|
|
28
|
+
INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
|
|
29
|
+
INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
|
|
30
|
+
INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
|
|
31
|
+
INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
|
|
32
|
+
INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",
|
|
33
|
+
/* Extract error messages */
|
|
34
|
+
INVALID_CMP_DATA_LENGTH: "Compressed data length does not match the expected length",
|
|
35
|
+
EXTRACT_FAILED: "Failed to extract file",
|
|
36
|
+
INVALID_CRC: "CRC32 checksum does not match the expected value",
|
|
37
|
+
UNKNOWN_SHA256: "The SHA-256 hash has not been saved",
|
|
38
|
+
INVALID_SHA256: "The SHA-256 hash does not match the expected value",
|
|
39
|
+
/* NEO-ZIP error messages */
|
|
40
|
+
CANT_EXTRACT_FILE: "Could not extract the file",
|
|
41
|
+
CANT_OVERRIDE: "Target file already exists",
|
|
42
|
+
NO_ZIP: "No zip file was loaded",
|
|
43
|
+
NO_ENTRY: "Entry doesn't exist",
|
|
44
|
+
DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
|
|
45
|
+
FILE_NOT_FOUND: "File not found: %s",
|
|
46
|
+
NOT_IMPLEMENTED: "Not implemented",
|
|
47
|
+
INVALID_FILENAME: "Invalid filename",
|
|
48
|
+
INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
|
|
49
|
+
// NeoZipKit error messages
|
|
50
|
+
NO_STREAM_SUPPORT: "Streams are not supported in this environment",
|
|
51
|
+
NO_BLOB_SUPPORT: "Blobs are not supported in this environment",
|
|
52
|
+
NO_FILE_READER_SUPPORT: "FileReader is not supported in this environment",
|
|
53
|
+
// Create Zip error messages
|
|
54
|
+
NO_FILES: "No files added, Zip file not created",
|
|
55
|
+
DATATYPE_STRING_UNSUPPORTED: "The String type is not supported by this platform.",
|
|
56
|
+
DATATYPE_ARRAY_UNSUPPORTED: "The Array type is not supported by this platform.",
|
|
57
|
+
DATATYPE_BUFFER_UNSUPPORTED: "The Buffer type is not supported by this platform.",
|
|
58
|
+
DATATYPE_BLOB_UNSUPPORTED: "The Blob type is not supported by this platform.",
|
|
59
|
+
DATATYPE_U8ARRAY_UNSUPPORTED: "The uint8Array type is not supported by this platform.",
|
|
60
|
+
DATATYPE_ARRAYBUFFER_UNSUPPORTED: "The ArrayBuffer type is not supported by this platform.",
|
|
61
|
+
DATATYPE_UNSUPPORTED: "Unsupported input type.",
|
|
62
|
+
COMPRESS_FAILED: 'Failed to compress data',
|
|
63
|
+
COMPRESSION_ERROR: 'Error occurred during compression',
|
|
64
|
+
DECOMPRESSION_ERROR: 'Error occurred during decompression',
|
|
65
|
+
ENCRYPT_FAILED: 'Encryption failed',
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=Errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../../src/core/constants/Errors.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,YAAY;AACZ,yDAAyD;AACzD,yCAAyC;AACzC,iBAAiB;;AAEjB,kBAAe;IACX,2BAA2B;IAC3B,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE,oCAAoC;IAEjD,4BAA4B;IAC5B,OAAO,EAAE,uBAAuB;IAChC,eAAe,EAAE,gCAAgC;IACjD,cAAc,EAAE,wCAAwC;IAExD,uBAAuB;IACvB,0BAA0B,EAAE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