document-model 1.6.0 → 1.8.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/dist/browser/cjs/document-model.js +2 -2
- package/dist/browser/cjs/document.js +2 -2
- package/dist/browser/cjs/index.js +2 -2
- package/dist/browser/cjs/internal/{index-vlbA6Asd.js → index-UG6TQ_ad.js} +5 -10
- package/dist/browser/{es/internal/index-CuhiYn-8.js.map → cjs/internal/index-UG6TQ_ad.js.map} +1 -1
- package/dist/browser/cjs/internal/{index-BImZF-Wk.js → index-jRdLtWv9.js} +12 -4
- package/dist/browser/cjs/internal/index-jRdLtWv9.js.map +1 -0
- package/dist/browser/cjs/internal/{object-9Wvjprnm.js → object-CCclzskm.js} +640 -2287
- package/dist/browser/cjs/internal/object-CCclzskm.js.map +1 -0
- package/dist/browser/es/document-model.js +2 -2
- package/dist/browser/es/document.js +8 -8
- package/dist/browser/es/index.js +2 -2
- package/dist/browser/es/internal/{index-CuhiYn-8.js → index-CDwXQBxG.js} +5 -10
- package/dist/{node/es/internal/index-BNAE-_Hg.js.map → browser/es/internal/index-CDwXQBxG.js.map} +1 -1
- package/dist/browser/es/internal/index-v4H3kbAF.js +58 -0
- package/dist/browser/es/internal/index-v4H3kbAF.js.map +1 -0
- package/dist/browser/es/internal/{object-CyAog_F_.js → object-CU5T1DpX.js} +664 -2311
- package/dist/browser/es/internal/object-CU5T1DpX.js.map +1 -0
- package/dist/browser/src/document/actions/creators.d.ts +1 -1
- package/dist/browser/src/document/reducer.d.ts +4 -1
- package/dist/browser/src/document/schema/zod.d.ts +18 -18
- package/dist/browser/src/document/types.d.ts +13 -1
- package/dist/browser/src/document/utils/base.d.ts +3 -3
- package/dist/browser/src/document/utils/crypto.d.ts +10 -0
- package/dist/browser/src/document/utils/document-helpers.d.ts +10 -0
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/browser/src/document/utils/node.d.ts +3 -2
- package/dist/browser/src/document-model/gen/schema/zod.d.ts +169 -169
- package/dist/browser/src/document-model/index.d.ts +3 -3
- package/dist/node/cjs/document-model.js +2 -2
- package/dist/node/cjs/document.js +2 -2
- package/dist/node/cjs/index.js +2 -2
- package/dist/node/cjs/internal/{index-CJIU8iX-.js → index-5qN282Jw.js} +12 -4
- package/dist/node/cjs/internal/index-5qN282Jw.js.map +1 -0
- package/dist/node/cjs/internal/{index-DWeC8dwW.js → index-Bm-pIfaz.js} +5 -10
- package/dist/node/cjs/internal/{index-DWeC8dwW.js.map → index-Bm-pIfaz.js.map} +1 -1
- package/dist/node/cjs/internal/{object-op6YzhH1.js → object-BMOaYPkd.js} +381 -244
- package/dist/node/cjs/internal/object-BMOaYPkd.js.map +1 -0
- package/dist/node/es/document-model.js +2 -2
- package/dist/node/es/document.js +8 -8
- package/dist/node/es/index.js +2 -2
- package/dist/node/es/internal/{index-BNAE-_Hg.js → index-CAjAt1Xx.js} +5 -10
- package/dist/{browser/cjs/internal/index-vlbA6Asd.js.map → node/es/internal/index-CAjAt1Xx.js.map} +1 -1
- package/dist/node/es/internal/index-CVuLZAmf.js +58 -0
- package/dist/node/es/internal/index-CVuLZAmf.js.map +1 -0
- package/dist/node/es/internal/{object-BuK9PFjs.js → object-COSf2HUT.js} +405 -268
- package/dist/node/es/internal/object-COSf2HUT.js.map +1 -0
- package/dist/node/src/document/actions/creators.d.ts +1 -1
- package/dist/node/src/document/reducer.d.ts +4 -1
- package/dist/node/src/document/schema/zod.d.ts +18 -18
- package/dist/node/src/document/types.d.ts +13 -1
- package/dist/node/src/document/utils/base.d.ts +3 -3
- package/dist/node/src/document/utils/crypto.d.ts +10 -0
- package/dist/node/src/document/utils/document-helpers.d.ts +10 -0
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/dist/node/src/document/utils/node.d.ts +3 -2
- package/dist/node/src/document-model/gen/schema/zod.d.ts +169 -169
- package/dist/node/src/document-model/index.d.ts +3 -3
- package/package.json +6 -3
- package/dist/browser/cjs/internal/index-BImZF-Wk.js.map +0 -1
- package/dist/browser/cjs/internal/object-9Wvjprnm.js.map +0 -1
- package/dist/browser/es/internal/index-Drp90r05.js +0 -50
- package/dist/browser/es/internal/index-Drp90r05.js.map +0 -1
- package/dist/browser/es/internal/object-CyAog_F_.js.map +0 -1
- package/dist/node/cjs/internal/index-CJIU8iX-.js.map +0 -1
- package/dist/node/cjs/internal/object-op6YzhH1.js.map +0 -1
- package/dist/node/es/internal/index-B_7z_4EV.js +0 -50
- package/dist/node/es/internal/index-B_7z_4EV.js.map +0 -1
- package/dist/node/es/internal/object-BuK9PFjs.js.map +0 -1
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) =>
|
|
5
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
5
|
const mutative = require("mutative");
|
|
9
6
|
const zod$1 = require("zod");
|
|
10
7
|
const JSZip = require("jszip");
|
|
@@ -157,16 +154,16 @@ var safeStableStringify = { exports: {} };
|
|
|
157
154
|
exports2.stringify = stringify;
|
|
158
155
|
exports2.configure = configure;
|
|
159
156
|
module2.exports = stringify;
|
|
160
|
-
const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]
|
|
157
|
+
const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
|
|
161
158
|
function strEscape(str) {
|
|
162
159
|
if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) {
|
|
163
160
|
return `"${str}"`;
|
|
164
161
|
}
|
|
165
162
|
return JSON.stringify(str);
|
|
166
163
|
}
|
|
167
|
-
function
|
|
168
|
-
if (array.length > 200) {
|
|
169
|
-
return array.sort();
|
|
164
|
+
function sort(array, comparator) {
|
|
165
|
+
if (array.length > 200 || comparator) {
|
|
166
|
+
return array.sort(comparator);
|
|
170
167
|
}
|
|
171
168
|
for (let i = 1; i < array.length; i++) {
|
|
172
169
|
const currentValue = array[i];
|
|
@@ -221,6 +218,16 @@ var safeStableStringify = { exports: {} };
|
|
|
221
218
|
}
|
|
222
219
|
return '"[Circular]"';
|
|
223
220
|
}
|
|
221
|
+
function getDeterministicOption(options) {
|
|
222
|
+
let value;
|
|
223
|
+
if (hasOwnProperty.call(options, "deterministic")) {
|
|
224
|
+
value = options.deterministic;
|
|
225
|
+
if (typeof value !== "boolean" && typeof value !== "function") {
|
|
226
|
+
throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return value === void 0 ? true : value;
|
|
230
|
+
}
|
|
224
231
|
function getBooleanOption(options, key) {
|
|
225
232
|
let value;
|
|
226
233
|
if (hasOwnProperty.call(options, key)) {
|
|
@@ -271,8 +278,7 @@ var safeStableStringify = { exports: {} };
|
|
|
271
278
|
if (value) {
|
|
272
279
|
return (value2) => {
|
|
273
280
|
let message = `Object can not safely be stringified. Received type ${typeof value2}`;
|
|
274
|
-
if (typeof value2 !== "function")
|
|
275
|
-
message += ` (${value2.toString()})`;
|
|
281
|
+
if (typeof value2 !== "function") message += ` (${value2.toString()})`;
|
|
276
282
|
throw new Error(message);
|
|
277
283
|
};
|
|
278
284
|
}
|
|
@@ -291,7 +297,8 @@ var safeStableStringify = { exports: {} };
|
|
|
291
297
|
}
|
|
292
298
|
const circularValue = getCircularValueOption(options);
|
|
293
299
|
const bigint = getBooleanOption(options, "bigint");
|
|
294
|
-
const deterministic =
|
|
300
|
+
const deterministic = getDeterministicOption(options);
|
|
301
|
+
const comparator = typeof deterministic === "function" ? deterministic : void 0;
|
|
295
302
|
const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
|
|
296
303
|
const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
|
|
297
304
|
function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
|
|
@@ -366,7 +373,7 @@ ${indentation}`;
|
|
|
366
373
|
}
|
|
367
374
|
const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
368
375
|
if (deterministic && !isTypedArrayWithEntries(value)) {
|
|
369
|
-
keys =
|
|
376
|
+
keys = sort(keys, comparator);
|
|
370
377
|
}
|
|
371
378
|
stack.push(value);
|
|
372
379
|
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
@@ -567,7 +574,7 @@ ${indentation}`;
|
|
|
567
574
|
separator = join;
|
|
568
575
|
}
|
|
569
576
|
if (deterministic) {
|
|
570
|
-
keys =
|
|
577
|
+
keys = sort(keys, comparator);
|
|
571
578
|
}
|
|
572
579
|
stack.push(value);
|
|
573
580
|
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
@@ -626,7 +633,8 @@ ${originalIndentation}`;
|
|
|
626
633
|
return circularValue;
|
|
627
634
|
}
|
|
628
635
|
let res = "";
|
|
629
|
-
|
|
636
|
+
const hasLength = value.length !== void 0;
|
|
637
|
+
if (hasLength && Array.isArray(value)) {
|
|
630
638
|
if (value.length === 0) {
|
|
631
639
|
return "[]";
|
|
632
640
|
}
|
|
@@ -660,14 +668,14 @@ ${originalIndentation}`;
|
|
|
660
668
|
}
|
|
661
669
|
let separator = "";
|
|
662
670
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
663
|
-
if (isTypedArrayWithEntries(value)) {
|
|
671
|
+
if (hasLength && isTypedArrayWithEntries(value)) {
|
|
664
672
|
res += stringifyTypedArray(value, ",", maximumBreadth);
|
|
665
673
|
keys = keys.slice(value.length);
|
|
666
674
|
maximumPropertiesToStringify -= value.length;
|
|
667
675
|
separator = ",";
|
|
668
676
|
}
|
|
669
677
|
if (deterministic) {
|
|
670
|
-
keys =
|
|
678
|
+
keys = sort(keys, comparator);
|
|
671
679
|
}
|
|
672
680
|
stack.push(value);
|
|
673
681
|
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
@@ -759,175 +767,361 @@ function v4(options, buf, offset) {
|
|
|
759
767
|
rnds[8] = rnds[8] & 63 | 128;
|
|
760
768
|
return unsafeStringify(rnds);
|
|
761
769
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
770
|
+
const K = [
|
|
771
|
+
1518500249 | 0,
|
|
772
|
+
1859775393 | 0,
|
|
773
|
+
2400959708 | 0,
|
|
774
|
+
3395469782 | 0
|
|
775
|
+
];
|
|
776
|
+
function createHash(algorithm) {
|
|
777
|
+
return new Hash();
|
|
778
|
+
}
|
|
779
|
+
class Hash {
|
|
780
|
+
constructor() {
|
|
781
|
+
this.A = 1732584193 | 0;
|
|
782
|
+
this.B = 4023233417 | 0;
|
|
783
|
+
this.C = 2562383102 | 0;
|
|
784
|
+
this.D = 271733878 | 0;
|
|
785
|
+
this.E = 3285377520 | 0;
|
|
786
|
+
this._size = 0;
|
|
787
|
+
this._sp = 0;
|
|
788
|
+
if (!sharedBuffer || sharedOffset >= 8e3) {
|
|
789
|
+
sharedBuffer = new ArrayBuffer(
|
|
790
|
+
8e3
|
|
791
|
+
/* N.allocTotal */
|
|
776
792
|
);
|
|
793
|
+
sharedOffset = 0;
|
|
777
794
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
795
|
+
this._byte = new Uint8Array(
|
|
796
|
+
sharedBuffer,
|
|
797
|
+
sharedOffset,
|
|
798
|
+
80
|
|
799
|
+
/* N.allocBytes */
|
|
800
|
+
);
|
|
801
|
+
this._word = new Int32Array(
|
|
802
|
+
sharedBuffer,
|
|
803
|
+
sharedOffset,
|
|
804
|
+
20
|
|
805
|
+
/* N.allocWords */
|
|
806
|
+
);
|
|
807
|
+
sharedOffset += 80;
|
|
808
|
+
}
|
|
809
|
+
update(data) {
|
|
810
|
+
if ("string" === typeof data) {
|
|
811
|
+
return this._utf8(data);
|
|
812
|
+
}
|
|
813
|
+
if (data == null) {
|
|
814
|
+
throw new TypeError("Invalid type: " + typeof data);
|
|
815
|
+
}
|
|
816
|
+
const byteOffset = data.byteOffset;
|
|
817
|
+
const length = data.byteLength;
|
|
818
|
+
let blocks = length / 64 | 0;
|
|
819
|
+
let offset = 0;
|
|
820
|
+
if (blocks && !(byteOffset & 3) && !(this._size % 64)) {
|
|
821
|
+
const block = new Int32Array(
|
|
822
|
+
data.buffer,
|
|
823
|
+
byteOffset,
|
|
824
|
+
blocks * 16
|
|
825
|
+
/* N.inputWords */
|
|
781
826
|
);
|
|
827
|
+
while (blocks--) {
|
|
828
|
+
this._int32(block, offset >> 2);
|
|
829
|
+
offset += 64;
|
|
830
|
+
}
|
|
831
|
+
this._size += offset;
|
|
782
832
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
);
|
|
833
|
+
const BYTES_PER_ELEMENT = data.BYTES_PER_ELEMENT;
|
|
834
|
+
if (BYTES_PER_ELEMENT !== 1 && data.buffer) {
|
|
835
|
+
const rest = new Uint8Array(data.buffer, byteOffset + offset, length - offset);
|
|
836
|
+
return this._uint8(rest);
|
|
787
837
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
838
|
+
if (offset === length)
|
|
839
|
+
return this;
|
|
840
|
+
return this._uint8(data, offset);
|
|
841
|
+
}
|
|
842
|
+
_uint8(data, offset) {
|
|
843
|
+
const { _byte, _word } = this;
|
|
844
|
+
const length = data.length;
|
|
845
|
+
offset = offset | 0;
|
|
846
|
+
while (offset < length) {
|
|
847
|
+
const start = this._size % 64;
|
|
848
|
+
let index = start;
|
|
849
|
+
while (offset < length && index < 64) {
|
|
850
|
+
_byte[index++] = data[offset++];
|
|
796
851
|
}
|
|
852
|
+
if (index >= 64) {
|
|
853
|
+
this._int32(_word);
|
|
854
|
+
}
|
|
855
|
+
this._size += index - start;
|
|
797
856
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
let
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
857
|
+
return this;
|
|
858
|
+
}
|
|
859
|
+
_utf8(text) {
|
|
860
|
+
const { _byte, _word } = this;
|
|
861
|
+
const length = text.length;
|
|
862
|
+
let surrogate = this._sp;
|
|
863
|
+
for (let offset = 0; offset < length; ) {
|
|
864
|
+
const start = this._size % 64;
|
|
865
|
+
let index = start;
|
|
866
|
+
while (offset < length && index < 64) {
|
|
867
|
+
let code = text.charCodeAt(offset++) | 0;
|
|
868
|
+
if (code < 128) {
|
|
869
|
+
_byte[index++] = code;
|
|
870
|
+
} else if (code < 2048) {
|
|
871
|
+
_byte[index++] = 192 | code >>> 6;
|
|
872
|
+
_byte[index++] = 128 | code & 63;
|
|
873
|
+
} else if (code < 55296 || code > 57343) {
|
|
874
|
+
_byte[index++] = 224 | code >>> 12;
|
|
875
|
+
_byte[index++] = 128 | code >>> 6 & 63;
|
|
876
|
+
_byte[index++] = 128 | code & 63;
|
|
877
|
+
} else if (surrogate) {
|
|
878
|
+
code = ((surrogate & 1023) << 10) + (code & 1023) + 65536;
|
|
879
|
+
_byte[index++] = 240 | code >>> 18;
|
|
880
|
+
_byte[index++] = 128 | code >>> 12 & 63;
|
|
881
|
+
_byte[index++] = 128 | code >>> 6 & 63;
|
|
882
|
+
_byte[index++] = 128 | code & 63;
|
|
883
|
+
surrogate = 0;
|
|
884
|
+
} else {
|
|
885
|
+
surrogate = code;
|
|
886
|
+
}
|
|
812
887
|
}
|
|
813
|
-
if (
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
index--;
|
|
888
|
+
if (index >= 64) {
|
|
889
|
+
this._int32(_word);
|
|
890
|
+
_word[0] = _word[
|
|
891
|
+
16
|
|
892
|
+
/* N.inputWords */
|
|
893
|
+
];
|
|
820
894
|
}
|
|
895
|
+
this._size += index - start;
|
|
821
896
|
}
|
|
822
|
-
|
|
823
|
-
|
|
897
|
+
this._sp = surrogate;
|
|
898
|
+
return this;
|
|
899
|
+
}
|
|
900
|
+
_int32(data, offset) {
|
|
901
|
+
let { A, B, C, D, E } = this;
|
|
902
|
+
let i = 0;
|
|
903
|
+
offset = offset | 0;
|
|
904
|
+
while (i < 16) {
|
|
905
|
+
W[i++] = swap32(data[offset++]);
|
|
906
|
+
}
|
|
907
|
+
for (i = 16; i < 80; i++) {
|
|
908
|
+
W[i] = rotate1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]);
|
|
909
|
+
}
|
|
910
|
+
for (i = 0; i < 80; i++) {
|
|
911
|
+
const S = i / 20 | 0;
|
|
912
|
+
const T = rotate5(A) + ft(S, B, C, D) + E + W[i] + K[S] | 0;
|
|
913
|
+
E = D;
|
|
914
|
+
D = C;
|
|
915
|
+
C = rotate30(B);
|
|
916
|
+
B = A;
|
|
917
|
+
A = T;
|
|
918
|
+
}
|
|
919
|
+
this.A = A + this.A | 0;
|
|
920
|
+
this.B = B + this.B | 0;
|
|
921
|
+
this.C = C + this.C | 0;
|
|
922
|
+
this.D = D + this.D | 0;
|
|
923
|
+
this.E = E + this.E | 0;
|
|
924
|
+
}
|
|
925
|
+
digest(encoding) {
|
|
926
|
+
const { _byte, _word } = this;
|
|
927
|
+
let i = this._size % 64 | 0;
|
|
928
|
+
_byte[i++] = 128;
|
|
929
|
+
while (i & 3) {
|
|
930
|
+
_byte[i++] = 0;
|
|
931
|
+
}
|
|
932
|
+
i >>= 2;
|
|
933
|
+
if (i > 14) {
|
|
934
|
+
while (i < 16) {
|
|
935
|
+
_word[i++] = 0;
|
|
936
|
+
}
|
|
937
|
+
i = 0;
|
|
938
|
+
this._int32(_word);
|
|
939
|
+
}
|
|
940
|
+
while (i < 16) {
|
|
941
|
+
_word[i++] = 0;
|
|
942
|
+
}
|
|
943
|
+
const bits64 = this._size * 8;
|
|
944
|
+
const low32 = (bits64 & 4294967295) >>> 0;
|
|
945
|
+
const high32 = (bits64 - low32) / 4294967296;
|
|
946
|
+
if (high32)
|
|
947
|
+
_word[
|
|
948
|
+
14
|
|
949
|
+
/* N.highIndex */
|
|
950
|
+
] = swap32(high32);
|
|
951
|
+
if (low32)
|
|
952
|
+
_word[
|
|
953
|
+
15
|
|
954
|
+
/* N.lowIndex */
|
|
955
|
+
] = swap32(low32);
|
|
956
|
+
this._int32(_word);
|
|
957
|
+
return encoding === "hex" ? this._hex() : this._bin();
|
|
958
|
+
}
|
|
959
|
+
_hex() {
|
|
960
|
+
const { A, B, C, D, E } = this;
|
|
961
|
+
return hex32(A) + hex32(B) + hex32(C) + hex32(D) + hex32(E);
|
|
962
|
+
}
|
|
963
|
+
_bin() {
|
|
964
|
+
const { A, B, C, D, E, _byte, _word } = this;
|
|
965
|
+
_word[0] = swap32(A);
|
|
966
|
+
_word[1] = swap32(B);
|
|
967
|
+
_word[2] = swap32(C);
|
|
968
|
+
_word[3] = swap32(D);
|
|
969
|
+
_word[4] = swap32(E);
|
|
970
|
+
return _byte.slice(0, 20);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
const W = new Int32Array(
|
|
974
|
+
80
|
|
975
|
+
/* N.workWords */
|
|
976
|
+
);
|
|
977
|
+
let sharedBuffer;
|
|
978
|
+
let sharedOffset = 0;
|
|
979
|
+
const hex32 = (num) => (num + 4294967296).toString(16).substr(-8);
|
|
980
|
+
const swapLE = (c) => c << 24 & 4278190080 | c << 8 & 16711680 | c >> 8 & 65280 | c >> 24 & 255;
|
|
981
|
+
const swapBE = (c) => c;
|
|
982
|
+
const swap32 = isBE() ? swapBE : swapLE;
|
|
983
|
+
const rotate1 = (num) => num << 1 | num >>> 31;
|
|
984
|
+
const rotate5 = (num) => num << 5 | num >>> 27;
|
|
985
|
+
const rotate30 = (num) => num << 30 | num >>> 2;
|
|
986
|
+
function ft(s, b, c, d) {
|
|
987
|
+
if (s === 0)
|
|
988
|
+
return b & c | ~b & d;
|
|
989
|
+
if (s === 2)
|
|
990
|
+
return b & c | b & d | c & d;
|
|
991
|
+
return b ^ c ^ d;
|
|
824
992
|
}
|
|
825
|
-
function
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
document,
|
|
829
|
-
action,
|
|
830
|
-
skip
|
|
831
|
-
};
|
|
832
|
-
return mutative.create(defaultResult, (draft) => {
|
|
833
|
-
if (draft.skip > 0) {
|
|
834
|
-
throw new Error(
|
|
835
|
-
`Cannot redo: skip value from reducer cannot be used with REDO action`
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
if (input > 1) {
|
|
839
|
-
throw new Error(
|
|
840
|
-
`Cannot redo: you can only redo one operation at a time`
|
|
841
|
-
);
|
|
842
|
-
}
|
|
843
|
-
if (input < 1) {
|
|
844
|
-
throw new Error(`Invalid REDO action: invalid redo input value`);
|
|
845
|
-
}
|
|
846
|
-
if (draft.document.clipboard.length < 1) {
|
|
847
|
-
throw new Error(`Cannot redo: no operations in the clipboard`);
|
|
848
|
-
}
|
|
849
|
-
const operationIndex = draft.document.clipboard.findLastIndex(
|
|
850
|
-
(op) => op.scope === scope
|
|
851
|
-
);
|
|
852
|
-
if (operationIndex < 0) {
|
|
853
|
-
throw new Error(
|
|
854
|
-
`Cannot redo: no operations in clipboard for scope "${scope}"`
|
|
855
|
-
);
|
|
856
|
-
}
|
|
857
|
-
const operation = draft.document.clipboard.splice(operationIndex, 1)[0];
|
|
858
|
-
draft.action = mutative.castDraft({
|
|
859
|
-
type: operation.type,
|
|
860
|
-
scope: operation.scope,
|
|
861
|
-
input: operation.input
|
|
862
|
-
});
|
|
863
|
-
});
|
|
993
|
+
function isBE() {
|
|
994
|
+
const buf = new Uint8Array(new Uint16Array([65279]).buffer);
|
|
995
|
+
return buf[0] === 254;
|
|
864
996
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
997
|
+
const FileSystemError = new Error("File system not available.");
|
|
998
|
+
function writeFile(path, name, stream) {
|
|
999
|
+
throw FileSystemError;
|
|
1000
|
+
}
|
|
1001
|
+
function readFile(path) {
|
|
1002
|
+
throw FileSystemError;
|
|
1003
|
+
}
|
|
1004
|
+
function fetchFile(url) {
|
|
1005
|
+
throw FileSystemError;
|
|
1006
|
+
}
|
|
1007
|
+
const getFile = async (file) => {
|
|
1008
|
+
return readFile();
|
|
1009
|
+
};
|
|
1010
|
+
const hash = (data, algorithm = "sha1") => {
|
|
1011
|
+
if (!["sha1"].includes(algorithm)) {
|
|
1012
|
+
throw new Error("Hashing algorithm not supported: Available: sha1");
|
|
1013
|
+
}
|
|
1014
|
+
const hash2 = hashUIntArray(data);
|
|
1015
|
+
return uint8ArrayToBase64(hash2);
|
|
1016
|
+
};
|
|
1017
|
+
function uint8ArrayToBase64(uint8Array) {
|
|
1018
|
+
let binaryString = "";
|
|
1019
|
+
for (let i = 0; i < uint8Array.length; i++) {
|
|
1020
|
+
binaryString += String.fromCharCode(uint8Array[i]);
|
|
1021
|
+
}
|
|
1022
|
+
const base64String = btoa(binaryString);
|
|
1023
|
+
return base64String;
|
|
1024
|
+
}
|
|
1025
|
+
function hashUIntArray(data, algorithm = "sha1") {
|
|
1026
|
+
if (!["sha1"].includes(algorithm)) {
|
|
1027
|
+
throw new Error("Hashing algorithm not supported: Available: sha1");
|
|
1028
|
+
}
|
|
1029
|
+
return createHash().update(data).digest();
|
|
1030
|
+
}
|
|
1031
|
+
function getUnixTimestamp(date) {
|
|
1032
|
+
return (new Date(date).getTime() / 1e3).toFixed(0);
|
|
1033
|
+
}
|
|
1034
|
+
function buildOperationSignatureParams({
|
|
1035
|
+
documentId,
|
|
1036
|
+
signer,
|
|
1037
|
+
operation,
|
|
1038
|
+
previousStateHash
|
|
1039
|
+
}) {
|
|
1040
|
+
const { timestamp, scope, id, type } = operation;
|
|
1041
|
+
return [
|
|
1042
|
+
getUnixTimestamp(timestamp),
|
|
1043
|
+
// timestamp,
|
|
1044
|
+
signer.app.key,
|
|
1045
|
+
// signer public key
|
|
1046
|
+
hash(
|
|
1047
|
+
// hash (docID, scope, operationID, operationName, operationInput)
|
|
1048
|
+
[documentId, scope, id, type, cjsModule(operation.input)].join(
|
|
1049
|
+
""
|
|
1050
|
+
)
|
|
1051
|
+
),
|
|
1052
|
+
previousStateHash
|
|
1053
|
+
// state hash that the operation was applied to
|
|
1054
|
+
];
|
|
1055
|
+
}
|
|
1056
|
+
const textEncode = new TextEncoder();
|
|
1057
|
+
function buildOperationSignatureMessage(params) {
|
|
1058
|
+
const message = params.join("");
|
|
1059
|
+
const prefix = "Signed Operation:\n" + message.length.toString();
|
|
1060
|
+
return textEncode.encode(prefix + message);
|
|
1061
|
+
}
|
|
1062
|
+
function ab2hex(ab) {
|
|
1063
|
+
return Array.prototype.map.call(
|
|
1064
|
+
new Uint8Array(ab),
|
|
1065
|
+
(x) => ("00" + x.toString(16)).slice(-2)
|
|
1066
|
+
).join("");
|
|
1067
|
+
}
|
|
1068
|
+
function hex2ab(hex) {
|
|
1069
|
+
var _a;
|
|
1070
|
+
return new Uint8Array(
|
|
1071
|
+
((_a = hex.match(/[\da-f]{2}/gi)) == null ? void 0 : _a.map(function(h) {
|
|
1072
|
+
return parseInt(h, 16);
|
|
1073
|
+
})) ?? []
|
|
883
1074
|
);
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
|
|
1075
|
+
}
|
|
1076
|
+
async function buildOperationSignature(context, signMethod) {
|
|
1077
|
+
const params = buildOperationSignatureParams(context);
|
|
1078
|
+
const message = buildOperationSignatureMessage(params);
|
|
1079
|
+
const signature = await signMethod(message);
|
|
1080
|
+
return [...params, `0x${ab2hex(signature)}`];
|
|
1081
|
+
}
|
|
1082
|
+
async function buildSignedOperation(action, reducer, document, context, signHandler) {
|
|
1083
|
+
var _a, _b;
|
|
1084
|
+
const result = reducer(document, action, void 0, {
|
|
1085
|
+
reuseHash: true,
|
|
1086
|
+
reuseOperationResultingState: true
|
|
1087
|
+
});
|
|
1088
|
+
const operation = result.operations[action.scope].at(-1);
|
|
1089
|
+
if (!operation) {
|
|
1090
|
+
throw new Error("Action was not applied");
|
|
1091
|
+
}
|
|
1092
|
+
const previousStateHash = ((_a = result.operations[action.scope].at(-2)) == null ? void 0 : _a.hash) ?? "";
|
|
1093
|
+
const signature = await buildOperationSignature(
|
|
889
1094
|
{
|
|
890
|
-
...
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
{
|
|
894
|
-
...loadState(
|
|
895
|
-
{ name, state: newState },
|
|
896
|
-
actionsToPrune.length
|
|
897
|
-
),
|
|
898
|
-
timestamp: loadStateTimestamp,
|
|
899
|
-
index: loadStateIndex,
|
|
900
|
-
hash: hashDocument({ state: newState }, "global")
|
|
901
|
-
},
|
|
902
|
-
...actionsToKeepEnd.map((action2, index) => ({
|
|
903
|
-
...action2,
|
|
904
|
-
index: loadStateIndex + index + 1
|
|
905
|
-
}))
|
|
906
|
-
]
|
|
1095
|
+
...context,
|
|
1096
|
+
operation,
|
|
1097
|
+
previousStateHash
|
|
907
1098
|
},
|
|
908
|
-
|
|
1099
|
+
signHandler
|
|
909
1100
|
);
|
|
910
|
-
}
|
|
911
|
-
function loadStateOperation(oldDocument, newDocument) {
|
|
912
1101
|
return {
|
|
913
|
-
...
|
|
914
|
-
|
|
915
|
-
|
|
1102
|
+
...operation,
|
|
1103
|
+
context: {
|
|
1104
|
+
...operation.context,
|
|
1105
|
+
signer: {
|
|
1106
|
+
...(_b = operation.context) == null ? void 0 : _b.signer,
|
|
1107
|
+
...context.signer,
|
|
1108
|
+
signatures: [...context.signer.signatures ?? [], signature]
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
916
1111
|
};
|
|
917
1112
|
}
|
|
918
|
-
|
|
919
|
-
const
|
|
920
|
-
const
|
|
921
|
-
const
|
|
922
|
-
const
|
|
923
|
-
|
|
1113
|
+
async function verifyOperationSignature(signature, signer, verifyHandler) {
|
|
1114
|
+
const publicKey = signer.app.key;
|
|
1115
|
+
const params = signature.slice(0, 4);
|
|
1116
|
+
const signatureBytes = hex2ab(signature[4]);
|
|
1117
|
+
const expectedMessage = buildOperationSignatureMessage(params);
|
|
1118
|
+
return verifyHandler(publicKey, signatureBytes, expectedMessage);
|
|
1119
|
+
}
|
|
924
1120
|
const types = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
|
|
925
1121
|
Object.freeze(types);
|
|
926
1122
|
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
927
|
-
if (kind === "a" && !f)
|
|
928
|
-
|
|
929
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
930
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1123
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1124
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
931
1125
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
932
1126
|
};
|
|
933
1127
|
var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
|
|
@@ -958,2103 +1152,58 @@ class Mime {
|
|
|
958
1152
|
}
|
|
959
1153
|
first = false;
|
|
960
1154
|
if (starred)
|
|
961
|
-
continue;
|
|
962
|
-
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension);
|
|
963
|
-
if (currentType && currentType != type && !force) {
|
|
964
|
-
throw new Error(`"${type} -> ${extension}" conflicts with "${currentType} -> ${extension}". Pass \`force=true\` to override this definition.`);
|
|
965
|
-
}
|
|
966
|
-
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension, type);
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
return this;
|
|
970
|
-
}
|
|
971
|
-
getType(path) {
|
|
972
|
-
if (typeof path !== "string")
|
|
973
|
-
return null;
|
|
974
|
-
const last = path.replace(/^.*[/\\]/, "").toLowerCase();
|
|
975
|
-
const ext = last.replace(/^.*\./, "").toLowerCase();
|
|
976
|
-
const hasPath = last.length < path.length;
|
|
977
|
-
const hasDot = ext.length < last.length - 1;
|
|
978
|
-
if (!hasDot && hasPath)
|
|
979
|
-
return null;
|
|
980
|
-
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
981
|
-
}
|
|
982
|
-
getExtension(type) {
|
|
983
|
-
var _a;
|
|
984
|
-
if (typeof type !== "string")
|
|
985
|
-
return null;
|
|
986
|
-
type = (_a = type == null ? void 0 : type.split) == null ? void 0 : _a.call(type, ";")[0];
|
|
987
|
-
return (type && __classPrivateFieldGet(this, _Mime_typeToExtension, "f").get(type.trim().toLowerCase())) ?? null;
|
|
988
|
-
}
|
|
989
|
-
getAllExtensions(type) {
|
|
990
|
-
if (typeof type !== "string")
|
|
991
|
-
return null;
|
|
992
|
-
return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type.toLowerCase()) ?? null;
|
|
993
|
-
}
|
|
994
|
-
_freeze() {
|
|
995
|
-
this.define = () => {
|
|
996
|
-
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
997
|
-
};
|
|
998
|
-
Object.freeze(this);
|
|
999
|
-
for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) {
|
|
1000
|
-
Object.freeze(extensions);
|
|
1001
|
-
}
|
|
1002
|
-
return this;
|
|
1003
|
-
}
|
|
1004
|
-
_getTestState() {
|
|
1005
|
-
return {
|
|
1006
|
-
types: __classPrivateFieldGet(this, _Mime_extensionToType, "f"),
|
|
1007
|
-
extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, "f")
|
|
1008
|
-
};
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
_Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
|
|
1012
|
-
const mime = new Mime(types)._freeze();
|
|
1013
|
-
var inherits_browser = { exports: {} };
|
|
1014
|
-
if (typeof Object.create === "function") {
|
|
1015
|
-
inherits_browser.exports = function inherits2(ctor, superCtor) {
|
|
1016
|
-
if (superCtor) {
|
|
1017
|
-
ctor.super_ = superCtor;
|
|
1018
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
1019
|
-
constructor: {
|
|
1020
|
-
value: ctor,
|
|
1021
|
-
enumerable: false,
|
|
1022
|
-
writable: true,
|
|
1023
|
-
configurable: true
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
} else {
|
|
1029
|
-
inherits_browser.exports = function inherits2(ctor, superCtor) {
|
|
1030
|
-
if (superCtor) {
|
|
1031
|
-
ctor.super_ = superCtor;
|
|
1032
|
-
var TempCtor = function() {
|
|
1033
|
-
};
|
|
1034
|
-
TempCtor.prototype = superCtor.prototype;
|
|
1035
|
-
ctor.prototype = new TempCtor();
|
|
1036
|
-
ctor.prototype.constructor = ctor;
|
|
1037
|
-
}
|
|
1038
|
-
};
|
|
1039
|
-
}
|
|
1040
|
-
var inherits_browserExports = inherits_browser.exports;
|
|
1041
|
-
var safeBuffer = { exports: {} };
|
|
1042
|
-
var buffer = {};
|
|
1043
|
-
var base64Js = {};
|
|
1044
|
-
base64Js.byteLength = byteLength;
|
|
1045
|
-
base64Js.toByteArray = toByteArray;
|
|
1046
|
-
base64Js.fromByteArray = fromByteArray;
|
|
1047
|
-
var lookup = [];
|
|
1048
|
-
var revLookup = [];
|
|
1049
|
-
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
1050
|
-
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1051
|
-
for (var i = 0, len = code.length; i < len; ++i) {
|
|
1052
|
-
lookup[i] = code[i];
|
|
1053
|
-
revLookup[code.charCodeAt(i)] = i;
|
|
1054
|
-
}
|
|
1055
|
-
revLookup["-".charCodeAt(0)] = 62;
|
|
1056
|
-
revLookup["_".charCodeAt(0)] = 63;
|
|
1057
|
-
function getLens(b64) {
|
|
1058
|
-
var len = b64.length;
|
|
1059
|
-
if (len % 4 > 0) {
|
|
1060
|
-
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
1061
|
-
}
|
|
1062
|
-
var validLen = b64.indexOf("=");
|
|
1063
|
-
if (validLen === -1)
|
|
1064
|
-
validLen = len;
|
|
1065
|
-
var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
|
|
1066
|
-
return [validLen, placeHoldersLen];
|
|
1067
|
-
}
|
|
1068
|
-
function byteLength(b64) {
|
|
1069
|
-
var lens = getLens(b64);
|
|
1070
|
-
var validLen = lens[0];
|
|
1071
|
-
var placeHoldersLen = lens[1];
|
|
1072
|
-
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
1073
|
-
}
|
|
1074
|
-
function _byteLength(b64, validLen, placeHoldersLen) {
|
|
1075
|
-
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
1076
|
-
}
|
|
1077
|
-
function toByteArray(b64) {
|
|
1078
|
-
var tmp;
|
|
1079
|
-
var lens = getLens(b64);
|
|
1080
|
-
var validLen = lens[0];
|
|
1081
|
-
var placeHoldersLen = lens[1];
|
|
1082
|
-
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
|
|
1083
|
-
var curByte = 0;
|
|
1084
|
-
var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
|
1085
|
-
var i;
|
|
1086
|
-
for (i = 0; i < len; i += 4) {
|
|
1087
|
-
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
|
|
1088
|
-
arr[curByte++] = tmp >> 16 & 255;
|
|
1089
|
-
arr[curByte++] = tmp >> 8 & 255;
|
|
1090
|
-
arr[curByte++] = tmp & 255;
|
|
1091
|
-
}
|
|
1092
|
-
if (placeHoldersLen === 2) {
|
|
1093
|
-
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
|
|
1094
|
-
arr[curByte++] = tmp & 255;
|
|
1095
|
-
}
|
|
1096
|
-
if (placeHoldersLen === 1) {
|
|
1097
|
-
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
|
|
1098
|
-
arr[curByte++] = tmp >> 8 & 255;
|
|
1099
|
-
arr[curByte++] = tmp & 255;
|
|
1100
|
-
}
|
|
1101
|
-
return arr;
|
|
1102
|
-
}
|
|
1103
|
-
function tripletToBase64(num) {
|
|
1104
|
-
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
|
|
1105
|
-
}
|
|
1106
|
-
function encodeChunk(uint8, start, end) {
|
|
1107
|
-
var tmp;
|
|
1108
|
-
var output = [];
|
|
1109
|
-
for (var i = start; i < end; i += 3) {
|
|
1110
|
-
tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);
|
|
1111
|
-
output.push(tripletToBase64(tmp));
|
|
1112
|
-
}
|
|
1113
|
-
return output.join("");
|
|
1114
|
-
}
|
|
1115
|
-
function fromByteArray(uint8) {
|
|
1116
|
-
var tmp;
|
|
1117
|
-
var len = uint8.length;
|
|
1118
|
-
var extraBytes = len % 3;
|
|
1119
|
-
var parts = [];
|
|
1120
|
-
var maxChunkLength = 16383;
|
|
1121
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
1122
|
-
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
|
|
1123
|
-
}
|
|
1124
|
-
if (extraBytes === 1) {
|
|
1125
|
-
tmp = uint8[len - 1];
|
|
1126
|
-
parts.push(
|
|
1127
|
-
lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
|
|
1128
|
-
);
|
|
1129
|
-
} else if (extraBytes === 2) {
|
|
1130
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
1131
|
-
parts.push(
|
|
1132
|
-
lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
|
|
1133
|
-
);
|
|
1134
|
-
}
|
|
1135
|
-
return parts.join("");
|
|
1136
|
-
}
|
|
1137
|
-
var ieee754 = {};
|
|
1138
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1139
|
-
ieee754.read = function(buffer2, offset, isLE, mLen, nBytes) {
|
|
1140
|
-
var e, m;
|
|
1141
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
1142
|
-
var eMax = (1 << eLen) - 1;
|
|
1143
|
-
var eBias = eMax >> 1;
|
|
1144
|
-
var nBits = -7;
|
|
1145
|
-
var i = isLE ? nBytes - 1 : 0;
|
|
1146
|
-
var d = isLE ? -1 : 1;
|
|
1147
|
-
var s = buffer2[offset + i];
|
|
1148
|
-
i += d;
|
|
1149
|
-
e = s & (1 << -nBits) - 1;
|
|
1150
|
-
s >>= -nBits;
|
|
1151
|
-
nBits += eLen;
|
|
1152
|
-
for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) {
|
|
1153
|
-
}
|
|
1154
|
-
m = e & (1 << -nBits) - 1;
|
|
1155
|
-
e >>= -nBits;
|
|
1156
|
-
nBits += mLen;
|
|
1157
|
-
for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) {
|
|
1158
|
-
}
|
|
1159
|
-
if (e === 0) {
|
|
1160
|
-
e = 1 - eBias;
|
|
1161
|
-
} else if (e === eMax) {
|
|
1162
|
-
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
1163
|
-
} else {
|
|
1164
|
-
m = m + Math.pow(2, mLen);
|
|
1165
|
-
e = e - eBias;
|
|
1166
|
-
}
|
|
1167
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
1168
|
-
};
|
|
1169
|
-
ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
1170
|
-
var e, m, c;
|
|
1171
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
1172
|
-
var eMax = (1 << eLen) - 1;
|
|
1173
|
-
var eBias = eMax >> 1;
|
|
1174
|
-
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
1175
|
-
var i = isLE ? 0 : nBytes - 1;
|
|
1176
|
-
var d = isLE ? 1 : -1;
|
|
1177
|
-
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
1178
|
-
value = Math.abs(value);
|
|
1179
|
-
if (isNaN(value) || value === Infinity) {
|
|
1180
|
-
m = isNaN(value) ? 1 : 0;
|
|
1181
|
-
e = eMax;
|
|
1182
|
-
} else {
|
|
1183
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
1184
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
1185
|
-
e--;
|
|
1186
|
-
c *= 2;
|
|
1187
|
-
}
|
|
1188
|
-
if (e + eBias >= 1) {
|
|
1189
|
-
value += rt / c;
|
|
1190
|
-
} else {
|
|
1191
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
1192
|
-
}
|
|
1193
|
-
if (value * c >= 2) {
|
|
1194
|
-
e++;
|
|
1195
|
-
c /= 2;
|
|
1196
|
-
}
|
|
1197
|
-
if (e + eBias >= eMax) {
|
|
1198
|
-
m = 0;
|
|
1199
|
-
e = eMax;
|
|
1200
|
-
} else if (e + eBias >= 1) {
|
|
1201
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
1202
|
-
e = e + eBias;
|
|
1203
|
-
} else {
|
|
1204
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
1205
|
-
e = 0;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
|
1209
|
-
}
|
|
1210
|
-
e = e << mLen | m;
|
|
1211
|
-
eLen += mLen;
|
|
1212
|
-
for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
|
1213
|
-
}
|
|
1214
|
-
buffer2[offset + i - d] |= s * 128;
|
|
1215
|
-
};
|
|
1216
|
-
/*!
|
|
1217
|
-
* The buffer module from node.js, for the browser.
|
|
1218
|
-
*
|
|
1219
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
1220
|
-
* @license MIT
|
|
1221
|
-
*/
|
|
1222
|
-
(function(exports2) {
|
|
1223
|
-
var base64 = base64Js;
|
|
1224
|
-
var ieee754$1 = ieee754;
|
|
1225
|
-
var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
1226
|
-
exports2.Buffer = Buffer3;
|
|
1227
|
-
exports2.SlowBuffer = SlowBuffer;
|
|
1228
|
-
exports2.INSPECT_MAX_BYTES = 50;
|
|
1229
|
-
var K_MAX_LENGTH = 2147483647;
|
|
1230
|
-
exports2.kMaxLength = K_MAX_LENGTH;
|
|
1231
|
-
Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
1232
|
-
if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
|
|
1233
|
-
console.error(
|
|
1234
|
-
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
1235
|
-
);
|
|
1236
|
-
}
|
|
1237
|
-
function typedArraySupport() {
|
|
1238
|
-
try {
|
|
1239
|
-
var arr = new Uint8Array(1);
|
|
1240
|
-
var proto = { foo: function() {
|
|
1241
|
-
return 42;
|
|
1242
|
-
} };
|
|
1243
|
-
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
|
1244
|
-
Object.setPrototypeOf(arr, proto);
|
|
1245
|
-
return arr.foo() === 42;
|
|
1246
|
-
} catch (e) {
|
|
1247
|
-
return false;
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
Object.defineProperty(Buffer3.prototype, "parent", {
|
|
1251
|
-
enumerable: true,
|
|
1252
|
-
get: function() {
|
|
1253
|
-
if (!Buffer3.isBuffer(this))
|
|
1254
|
-
return void 0;
|
|
1255
|
-
return this.buffer;
|
|
1256
|
-
}
|
|
1257
|
-
});
|
|
1258
|
-
Object.defineProperty(Buffer3.prototype, "offset", {
|
|
1259
|
-
enumerable: true,
|
|
1260
|
-
get: function() {
|
|
1261
|
-
if (!Buffer3.isBuffer(this))
|
|
1262
|
-
return void 0;
|
|
1263
|
-
return this.byteOffset;
|
|
1264
|
-
}
|
|
1265
|
-
});
|
|
1266
|
-
function createBuffer(length) {
|
|
1267
|
-
if (length > K_MAX_LENGTH) {
|
|
1268
|
-
throw new RangeError('The value "' + length + '" is invalid for option "size"');
|
|
1269
|
-
}
|
|
1270
|
-
var buf = new Uint8Array(length);
|
|
1271
|
-
Object.setPrototypeOf(buf, Buffer3.prototype);
|
|
1272
|
-
return buf;
|
|
1273
|
-
}
|
|
1274
|
-
function Buffer3(arg, encodingOrOffset, length) {
|
|
1275
|
-
if (typeof arg === "number") {
|
|
1276
|
-
if (typeof encodingOrOffset === "string") {
|
|
1277
|
-
throw new TypeError(
|
|
1278
|
-
'The "string" argument must be of type string. Received type number'
|
|
1279
|
-
);
|
|
1280
|
-
}
|
|
1281
|
-
return allocUnsafe(arg);
|
|
1282
|
-
}
|
|
1283
|
-
return from(arg, encodingOrOffset, length);
|
|
1284
|
-
}
|
|
1285
|
-
Buffer3.poolSize = 8192;
|
|
1286
|
-
function from(value, encodingOrOffset, length) {
|
|
1287
|
-
if (typeof value === "string") {
|
|
1288
|
-
return fromString(value, encodingOrOffset);
|
|
1289
|
-
}
|
|
1290
|
-
if (ArrayBuffer.isView(value)) {
|
|
1291
|
-
return fromArrayView(value);
|
|
1292
|
-
}
|
|
1293
|
-
if (value == null) {
|
|
1294
|
-
throw new TypeError(
|
|
1295
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
1296
|
-
);
|
|
1297
|
-
}
|
|
1298
|
-
if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
|
|
1299
|
-
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
1300
|
-
}
|
|
1301
|
-
if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
|
|
1302
|
-
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
1303
|
-
}
|
|
1304
|
-
if (typeof value === "number") {
|
|
1305
|
-
throw new TypeError(
|
|
1306
|
-
'The "value" argument must not be of type number. Received type number'
|
|
1307
|
-
);
|
|
1308
|
-
}
|
|
1309
|
-
var valueOf = value.valueOf && value.valueOf();
|
|
1310
|
-
if (valueOf != null && valueOf !== value) {
|
|
1311
|
-
return Buffer3.from(valueOf, encodingOrOffset, length);
|
|
1312
|
-
}
|
|
1313
|
-
var b = fromObject(value);
|
|
1314
|
-
if (b)
|
|
1315
|
-
return b;
|
|
1316
|
-
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
|
1317
|
-
return Buffer3.from(
|
|
1318
|
-
value[Symbol.toPrimitive]("string"),
|
|
1319
|
-
encodingOrOffset,
|
|
1320
|
-
length
|
|
1321
|
-
);
|
|
1322
|
-
}
|
|
1323
|
-
throw new TypeError(
|
|
1324
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
1325
|
-
);
|
|
1326
|
-
}
|
|
1327
|
-
Buffer3.from = function(value, encodingOrOffset, length) {
|
|
1328
|
-
return from(value, encodingOrOffset, length);
|
|
1329
|
-
};
|
|
1330
|
-
Object.setPrototypeOf(Buffer3.prototype, Uint8Array.prototype);
|
|
1331
|
-
Object.setPrototypeOf(Buffer3, Uint8Array);
|
|
1332
|
-
function assertSize(size) {
|
|
1333
|
-
if (typeof size !== "number") {
|
|
1334
|
-
throw new TypeError('"size" argument must be of type number');
|
|
1335
|
-
} else if (size < 0) {
|
|
1336
|
-
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
function alloc(size, fill, encoding) {
|
|
1340
|
-
assertSize(size);
|
|
1341
|
-
if (size <= 0) {
|
|
1342
|
-
return createBuffer(size);
|
|
1343
|
-
}
|
|
1344
|
-
if (fill !== void 0) {
|
|
1345
|
-
return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
|
|
1346
|
-
}
|
|
1347
|
-
return createBuffer(size);
|
|
1348
|
-
}
|
|
1349
|
-
Buffer3.alloc = function(size, fill, encoding) {
|
|
1350
|
-
return alloc(size, fill, encoding);
|
|
1351
|
-
};
|
|
1352
|
-
function allocUnsafe(size) {
|
|
1353
|
-
assertSize(size);
|
|
1354
|
-
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
|
1355
|
-
}
|
|
1356
|
-
Buffer3.allocUnsafe = function(size) {
|
|
1357
|
-
return allocUnsafe(size);
|
|
1358
|
-
};
|
|
1359
|
-
Buffer3.allocUnsafeSlow = function(size) {
|
|
1360
|
-
return allocUnsafe(size);
|
|
1361
|
-
};
|
|
1362
|
-
function fromString(string, encoding) {
|
|
1363
|
-
if (typeof encoding !== "string" || encoding === "") {
|
|
1364
|
-
encoding = "utf8";
|
|
1365
|
-
}
|
|
1366
|
-
if (!Buffer3.isEncoding(encoding)) {
|
|
1367
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1368
|
-
}
|
|
1369
|
-
var length = byteLength2(string, encoding) | 0;
|
|
1370
|
-
var buf = createBuffer(length);
|
|
1371
|
-
var actual = buf.write(string, encoding);
|
|
1372
|
-
if (actual !== length) {
|
|
1373
|
-
buf = buf.slice(0, actual);
|
|
1374
|
-
}
|
|
1375
|
-
return buf;
|
|
1376
|
-
}
|
|
1377
|
-
function fromArrayLike(array) {
|
|
1378
|
-
var length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
1379
|
-
var buf = createBuffer(length);
|
|
1380
|
-
for (var i = 0; i < length; i += 1) {
|
|
1381
|
-
buf[i] = array[i] & 255;
|
|
1382
|
-
}
|
|
1383
|
-
return buf;
|
|
1384
|
-
}
|
|
1385
|
-
function fromArrayView(arrayView) {
|
|
1386
|
-
if (isInstance(arrayView, Uint8Array)) {
|
|
1387
|
-
var copy = new Uint8Array(arrayView);
|
|
1388
|
-
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
|
1389
|
-
}
|
|
1390
|
-
return fromArrayLike(arrayView);
|
|
1391
|
-
}
|
|
1392
|
-
function fromArrayBuffer(array, byteOffset, length) {
|
|
1393
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
1394
|
-
throw new RangeError('"offset" is outside of buffer bounds');
|
|
1395
|
-
}
|
|
1396
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
1397
|
-
throw new RangeError('"length" is outside of buffer bounds');
|
|
1398
|
-
}
|
|
1399
|
-
var buf;
|
|
1400
|
-
if (byteOffset === void 0 && length === void 0) {
|
|
1401
|
-
buf = new Uint8Array(array);
|
|
1402
|
-
} else if (length === void 0) {
|
|
1403
|
-
buf = new Uint8Array(array, byteOffset);
|
|
1404
|
-
} else {
|
|
1405
|
-
buf = new Uint8Array(array, byteOffset, length);
|
|
1406
|
-
}
|
|
1407
|
-
Object.setPrototypeOf(buf, Buffer3.prototype);
|
|
1408
|
-
return buf;
|
|
1409
|
-
}
|
|
1410
|
-
function fromObject(obj) {
|
|
1411
|
-
if (Buffer3.isBuffer(obj)) {
|
|
1412
|
-
var len = checked(obj.length) | 0;
|
|
1413
|
-
var buf = createBuffer(len);
|
|
1414
|
-
if (buf.length === 0) {
|
|
1415
|
-
return buf;
|
|
1416
|
-
}
|
|
1417
|
-
obj.copy(buf, 0, 0, len);
|
|
1418
|
-
return buf;
|
|
1419
|
-
}
|
|
1420
|
-
if (obj.length !== void 0) {
|
|
1421
|
-
if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
|
|
1422
|
-
return createBuffer(0);
|
|
1423
|
-
}
|
|
1424
|
-
return fromArrayLike(obj);
|
|
1425
|
-
}
|
|
1426
|
-
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
|
|
1427
|
-
return fromArrayLike(obj.data);
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
function checked(length) {
|
|
1431
|
-
if (length >= K_MAX_LENGTH) {
|
|
1432
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
|
|
1433
|
-
}
|
|
1434
|
-
return length | 0;
|
|
1435
|
-
}
|
|
1436
|
-
function SlowBuffer(length) {
|
|
1437
|
-
if (+length != length) {
|
|
1438
|
-
length = 0;
|
|
1439
|
-
}
|
|
1440
|
-
return Buffer3.alloc(+length);
|
|
1441
|
-
}
|
|
1442
|
-
Buffer3.isBuffer = function isBuffer(b) {
|
|
1443
|
-
return b != null && b._isBuffer === true && b !== Buffer3.prototype;
|
|
1444
|
-
};
|
|
1445
|
-
Buffer3.compare = function compare(a, b) {
|
|
1446
|
-
if (isInstance(a, Uint8Array))
|
|
1447
|
-
a = Buffer3.from(a, a.offset, a.byteLength);
|
|
1448
|
-
if (isInstance(b, Uint8Array))
|
|
1449
|
-
b = Buffer3.from(b, b.offset, b.byteLength);
|
|
1450
|
-
if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) {
|
|
1451
|
-
throw new TypeError(
|
|
1452
|
-
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
1453
|
-
);
|
|
1454
|
-
}
|
|
1455
|
-
if (a === b)
|
|
1456
|
-
return 0;
|
|
1457
|
-
var x = a.length;
|
|
1458
|
-
var y = b.length;
|
|
1459
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
1460
|
-
if (a[i] !== b[i]) {
|
|
1461
|
-
x = a[i];
|
|
1462
|
-
y = b[i];
|
|
1463
|
-
break;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
if (x < y)
|
|
1467
|
-
return -1;
|
|
1468
|
-
if (y < x)
|
|
1469
|
-
return 1;
|
|
1470
|
-
return 0;
|
|
1471
|
-
};
|
|
1472
|
-
Buffer3.isEncoding = function isEncoding(encoding) {
|
|
1473
|
-
switch (String(encoding).toLowerCase()) {
|
|
1474
|
-
case "hex":
|
|
1475
|
-
case "utf8":
|
|
1476
|
-
case "utf-8":
|
|
1477
|
-
case "ascii":
|
|
1478
|
-
case "latin1":
|
|
1479
|
-
case "binary":
|
|
1480
|
-
case "base64":
|
|
1481
|
-
case "ucs2":
|
|
1482
|
-
case "ucs-2":
|
|
1483
|
-
case "utf16le":
|
|
1484
|
-
case "utf-16le":
|
|
1485
|
-
return true;
|
|
1486
|
-
default:
|
|
1487
|
-
return false;
|
|
1488
|
-
}
|
|
1489
|
-
};
|
|
1490
|
-
Buffer3.concat = function concat(list, length) {
|
|
1491
|
-
if (!Array.isArray(list)) {
|
|
1492
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1493
|
-
}
|
|
1494
|
-
if (list.length === 0) {
|
|
1495
|
-
return Buffer3.alloc(0);
|
|
1496
|
-
}
|
|
1497
|
-
var i;
|
|
1498
|
-
if (length === void 0) {
|
|
1499
|
-
length = 0;
|
|
1500
|
-
for (i = 0; i < list.length; ++i) {
|
|
1501
|
-
length += list[i].length;
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
var buffer2 = Buffer3.allocUnsafe(length);
|
|
1505
|
-
var pos = 0;
|
|
1506
|
-
for (i = 0; i < list.length; ++i) {
|
|
1507
|
-
var buf = list[i];
|
|
1508
|
-
if (isInstance(buf, Uint8Array)) {
|
|
1509
|
-
if (pos + buf.length > buffer2.length) {
|
|
1510
|
-
Buffer3.from(buf).copy(buffer2, pos);
|
|
1511
|
-
} else {
|
|
1512
|
-
Uint8Array.prototype.set.call(
|
|
1513
|
-
buffer2,
|
|
1514
|
-
buf,
|
|
1515
|
-
pos
|
|
1516
|
-
);
|
|
1517
|
-
}
|
|
1518
|
-
} else if (!Buffer3.isBuffer(buf)) {
|
|
1519
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1520
|
-
} else {
|
|
1521
|
-
buf.copy(buffer2, pos);
|
|
1522
|
-
}
|
|
1523
|
-
pos += buf.length;
|
|
1524
|
-
}
|
|
1525
|
-
return buffer2;
|
|
1526
|
-
};
|
|
1527
|
-
function byteLength2(string, encoding) {
|
|
1528
|
-
if (Buffer3.isBuffer(string)) {
|
|
1529
|
-
return string.length;
|
|
1530
|
-
}
|
|
1531
|
-
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
|
1532
|
-
return string.byteLength;
|
|
1533
|
-
}
|
|
1534
|
-
if (typeof string !== "string") {
|
|
1535
|
-
throw new TypeError(
|
|
1536
|
-
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
|
|
1537
|
-
);
|
|
1538
|
-
}
|
|
1539
|
-
var len = string.length;
|
|
1540
|
-
var mustMatch = arguments.length > 2 && arguments[2] === true;
|
|
1541
|
-
if (!mustMatch && len === 0)
|
|
1542
|
-
return 0;
|
|
1543
|
-
var loweredCase = false;
|
|
1544
|
-
for (; ; ) {
|
|
1545
|
-
switch (encoding) {
|
|
1546
|
-
case "ascii":
|
|
1547
|
-
case "latin1":
|
|
1548
|
-
case "binary":
|
|
1549
|
-
return len;
|
|
1550
|
-
case "utf8":
|
|
1551
|
-
case "utf-8":
|
|
1552
|
-
return utf8ToBytes(string).length;
|
|
1553
|
-
case "ucs2":
|
|
1554
|
-
case "ucs-2":
|
|
1555
|
-
case "utf16le":
|
|
1556
|
-
case "utf-16le":
|
|
1557
|
-
return len * 2;
|
|
1558
|
-
case "hex":
|
|
1559
|
-
return len >>> 1;
|
|
1560
|
-
case "base64":
|
|
1561
|
-
return base64ToBytes(string).length;
|
|
1562
|
-
default:
|
|
1563
|
-
if (loweredCase) {
|
|
1564
|
-
return mustMatch ? -1 : utf8ToBytes(string).length;
|
|
1565
|
-
}
|
|
1566
|
-
encoding = ("" + encoding).toLowerCase();
|
|
1567
|
-
loweredCase = true;
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
Buffer3.byteLength = byteLength2;
|
|
1572
|
-
function slowToString(encoding, start, end) {
|
|
1573
|
-
var loweredCase = false;
|
|
1574
|
-
if (start === void 0 || start < 0) {
|
|
1575
|
-
start = 0;
|
|
1576
|
-
}
|
|
1577
|
-
if (start > this.length) {
|
|
1578
|
-
return "";
|
|
1579
|
-
}
|
|
1580
|
-
if (end === void 0 || end > this.length) {
|
|
1581
|
-
end = this.length;
|
|
1582
|
-
}
|
|
1583
|
-
if (end <= 0) {
|
|
1584
|
-
return "";
|
|
1585
|
-
}
|
|
1586
|
-
end >>>= 0;
|
|
1587
|
-
start >>>= 0;
|
|
1588
|
-
if (end <= start) {
|
|
1589
|
-
return "";
|
|
1590
|
-
}
|
|
1591
|
-
if (!encoding)
|
|
1592
|
-
encoding = "utf8";
|
|
1593
|
-
while (true) {
|
|
1594
|
-
switch (encoding) {
|
|
1595
|
-
case "hex":
|
|
1596
|
-
return hexSlice(this, start, end);
|
|
1597
|
-
case "utf8":
|
|
1598
|
-
case "utf-8":
|
|
1599
|
-
return utf8Slice(this, start, end);
|
|
1600
|
-
case "ascii":
|
|
1601
|
-
return asciiSlice(this, start, end);
|
|
1602
|
-
case "latin1":
|
|
1603
|
-
case "binary":
|
|
1604
|
-
return latin1Slice(this, start, end);
|
|
1605
|
-
case "base64":
|
|
1606
|
-
return base64Slice(this, start, end);
|
|
1607
|
-
case "ucs2":
|
|
1608
|
-
case "ucs-2":
|
|
1609
|
-
case "utf16le":
|
|
1610
|
-
case "utf-16le":
|
|
1611
|
-
return utf16leSlice(this, start, end);
|
|
1612
|
-
default:
|
|
1613
|
-
if (loweredCase)
|
|
1614
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1615
|
-
encoding = (encoding + "").toLowerCase();
|
|
1616
|
-
loweredCase = true;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
Buffer3.prototype._isBuffer = true;
|
|
1621
|
-
function swap(b, n, m) {
|
|
1622
|
-
var i = b[n];
|
|
1623
|
-
b[n] = b[m];
|
|
1624
|
-
b[m] = i;
|
|
1625
|
-
}
|
|
1626
|
-
Buffer3.prototype.swap16 = function swap16() {
|
|
1627
|
-
var len = this.length;
|
|
1628
|
-
if (len % 2 !== 0) {
|
|
1629
|
-
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1630
|
-
}
|
|
1631
|
-
for (var i = 0; i < len; i += 2) {
|
|
1632
|
-
swap(this, i, i + 1);
|
|
1633
|
-
}
|
|
1634
|
-
return this;
|
|
1635
|
-
};
|
|
1636
|
-
Buffer3.prototype.swap32 = function swap32() {
|
|
1637
|
-
var len = this.length;
|
|
1638
|
-
if (len % 4 !== 0) {
|
|
1639
|
-
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1640
|
-
}
|
|
1641
|
-
for (var i = 0; i < len; i += 4) {
|
|
1642
|
-
swap(this, i, i + 3);
|
|
1643
|
-
swap(this, i + 1, i + 2);
|
|
1644
|
-
}
|
|
1645
|
-
return this;
|
|
1646
|
-
};
|
|
1647
|
-
Buffer3.prototype.swap64 = function swap64() {
|
|
1648
|
-
var len = this.length;
|
|
1649
|
-
if (len % 8 !== 0) {
|
|
1650
|
-
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1651
|
-
}
|
|
1652
|
-
for (var i = 0; i < len; i += 8) {
|
|
1653
|
-
swap(this, i, i + 7);
|
|
1654
|
-
swap(this, i + 1, i + 6);
|
|
1655
|
-
swap(this, i + 2, i + 5);
|
|
1656
|
-
swap(this, i + 3, i + 4);
|
|
1657
|
-
}
|
|
1658
|
-
return this;
|
|
1659
|
-
};
|
|
1660
|
-
Buffer3.prototype.toString = function toString() {
|
|
1661
|
-
var length = this.length;
|
|
1662
|
-
if (length === 0)
|
|
1663
|
-
return "";
|
|
1664
|
-
if (arguments.length === 0)
|
|
1665
|
-
return utf8Slice(this, 0, length);
|
|
1666
|
-
return slowToString.apply(this, arguments);
|
|
1667
|
-
};
|
|
1668
|
-
Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
|
|
1669
|
-
Buffer3.prototype.equals = function equals(b) {
|
|
1670
|
-
if (!Buffer3.isBuffer(b))
|
|
1671
|
-
throw new TypeError("Argument must be a Buffer");
|
|
1672
|
-
if (this === b)
|
|
1673
|
-
return true;
|
|
1674
|
-
return Buffer3.compare(this, b) === 0;
|
|
1675
|
-
};
|
|
1676
|
-
Buffer3.prototype.inspect = function inspect() {
|
|
1677
|
-
var str = "";
|
|
1678
|
-
var max = exports2.INSPECT_MAX_BYTES;
|
|
1679
|
-
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
1680
|
-
if (this.length > max)
|
|
1681
|
-
str += " ... ";
|
|
1682
|
-
return "<Buffer " + str + ">";
|
|
1683
|
-
};
|
|
1684
|
-
if (customInspectSymbol) {
|
|
1685
|
-
Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect;
|
|
1686
|
-
}
|
|
1687
|
-
Buffer3.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
1688
|
-
if (isInstance(target, Uint8Array)) {
|
|
1689
|
-
target = Buffer3.from(target, target.offset, target.byteLength);
|
|
1690
|
-
}
|
|
1691
|
-
if (!Buffer3.isBuffer(target)) {
|
|
1692
|
-
throw new TypeError(
|
|
1693
|
-
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
|
|
1694
|
-
);
|
|
1695
|
-
}
|
|
1696
|
-
if (start === void 0) {
|
|
1697
|
-
start = 0;
|
|
1698
|
-
}
|
|
1699
|
-
if (end === void 0) {
|
|
1700
|
-
end = target ? target.length : 0;
|
|
1701
|
-
}
|
|
1702
|
-
if (thisStart === void 0) {
|
|
1703
|
-
thisStart = 0;
|
|
1704
|
-
}
|
|
1705
|
-
if (thisEnd === void 0) {
|
|
1706
|
-
thisEnd = this.length;
|
|
1707
|
-
}
|
|
1708
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
1709
|
-
throw new RangeError("out of range index");
|
|
1710
|
-
}
|
|
1711
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
1712
|
-
return 0;
|
|
1713
|
-
}
|
|
1714
|
-
if (thisStart >= thisEnd) {
|
|
1715
|
-
return -1;
|
|
1716
|
-
}
|
|
1717
|
-
if (start >= end) {
|
|
1718
|
-
return 1;
|
|
1719
|
-
}
|
|
1720
|
-
start >>>= 0;
|
|
1721
|
-
end >>>= 0;
|
|
1722
|
-
thisStart >>>= 0;
|
|
1723
|
-
thisEnd >>>= 0;
|
|
1724
|
-
if (this === target)
|
|
1725
|
-
return 0;
|
|
1726
|
-
var x = thisEnd - thisStart;
|
|
1727
|
-
var y = end - start;
|
|
1728
|
-
var len = Math.min(x, y);
|
|
1729
|
-
var thisCopy = this.slice(thisStart, thisEnd);
|
|
1730
|
-
var targetCopy = target.slice(start, end);
|
|
1731
|
-
for (var i = 0; i < len; ++i) {
|
|
1732
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
1733
|
-
x = thisCopy[i];
|
|
1734
|
-
y = targetCopy[i];
|
|
1735
|
-
break;
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
if (x < y)
|
|
1739
|
-
return -1;
|
|
1740
|
-
if (y < x)
|
|
1741
|
-
return 1;
|
|
1742
|
-
return 0;
|
|
1743
|
-
};
|
|
1744
|
-
function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
|
|
1745
|
-
if (buffer2.length === 0)
|
|
1746
|
-
return -1;
|
|
1747
|
-
if (typeof byteOffset === "string") {
|
|
1748
|
-
encoding = byteOffset;
|
|
1749
|
-
byteOffset = 0;
|
|
1750
|
-
} else if (byteOffset > 2147483647) {
|
|
1751
|
-
byteOffset = 2147483647;
|
|
1752
|
-
} else if (byteOffset < -2147483648) {
|
|
1753
|
-
byteOffset = -2147483648;
|
|
1754
|
-
}
|
|
1755
|
-
byteOffset = +byteOffset;
|
|
1756
|
-
if (numberIsNaN(byteOffset)) {
|
|
1757
|
-
byteOffset = dir ? 0 : buffer2.length - 1;
|
|
1758
|
-
}
|
|
1759
|
-
if (byteOffset < 0)
|
|
1760
|
-
byteOffset = buffer2.length + byteOffset;
|
|
1761
|
-
if (byteOffset >= buffer2.length) {
|
|
1762
|
-
if (dir)
|
|
1763
|
-
return -1;
|
|
1764
|
-
else
|
|
1765
|
-
byteOffset = buffer2.length - 1;
|
|
1766
|
-
} else if (byteOffset < 0) {
|
|
1767
|
-
if (dir)
|
|
1768
|
-
byteOffset = 0;
|
|
1769
|
-
else
|
|
1770
|
-
return -1;
|
|
1771
|
-
}
|
|
1772
|
-
if (typeof val === "string") {
|
|
1773
|
-
val = Buffer3.from(val, encoding);
|
|
1774
|
-
}
|
|
1775
|
-
if (Buffer3.isBuffer(val)) {
|
|
1776
|
-
if (val.length === 0) {
|
|
1777
|
-
return -1;
|
|
1778
|
-
}
|
|
1779
|
-
return arrayIndexOf(buffer2, val, byteOffset, encoding, dir);
|
|
1780
|
-
} else if (typeof val === "number") {
|
|
1781
|
-
val = val & 255;
|
|
1782
|
-
if (typeof Uint8Array.prototype.indexOf === "function") {
|
|
1783
|
-
if (dir) {
|
|
1784
|
-
return Uint8Array.prototype.indexOf.call(buffer2, val, byteOffset);
|
|
1785
|
-
} else {
|
|
1786
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset);
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir);
|
|
1790
|
-
}
|
|
1791
|
-
throw new TypeError("val must be string, number or Buffer");
|
|
1792
|
-
}
|
|
1793
|
-
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
1794
|
-
var indexSize = 1;
|
|
1795
|
-
var arrLength = arr.length;
|
|
1796
|
-
var valLength = val.length;
|
|
1797
|
-
if (encoding !== void 0) {
|
|
1798
|
-
encoding = String(encoding).toLowerCase();
|
|
1799
|
-
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
|
|
1800
|
-
if (arr.length < 2 || val.length < 2) {
|
|
1801
|
-
return -1;
|
|
1802
|
-
}
|
|
1803
|
-
indexSize = 2;
|
|
1804
|
-
arrLength /= 2;
|
|
1805
|
-
valLength /= 2;
|
|
1806
|
-
byteOffset /= 2;
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
function read(buf, i2) {
|
|
1810
|
-
if (indexSize === 1) {
|
|
1811
|
-
return buf[i2];
|
|
1812
|
-
} else {
|
|
1813
|
-
return buf.readUInt16BE(i2 * indexSize);
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
var i;
|
|
1817
|
-
if (dir) {
|
|
1818
|
-
var foundIndex = -1;
|
|
1819
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
1820
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
1821
|
-
if (foundIndex === -1)
|
|
1822
|
-
foundIndex = i;
|
|
1823
|
-
if (i - foundIndex + 1 === valLength)
|
|
1824
|
-
return foundIndex * indexSize;
|
|
1825
|
-
} else {
|
|
1826
|
-
if (foundIndex !== -1)
|
|
1827
|
-
i -= i - foundIndex;
|
|
1828
|
-
foundIndex = -1;
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
} else {
|
|
1832
|
-
if (byteOffset + valLength > arrLength)
|
|
1833
|
-
byteOffset = arrLength - valLength;
|
|
1834
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
1835
|
-
var found = true;
|
|
1836
|
-
for (var j = 0; j < valLength; j++) {
|
|
1837
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
1838
|
-
found = false;
|
|
1839
|
-
break;
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
if (found)
|
|
1843
|
-
return i;
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
return -1;
|
|
1847
|
-
}
|
|
1848
|
-
Buffer3.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
1849
|
-
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
1850
|
-
};
|
|
1851
|
-
Buffer3.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
1852
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
1853
|
-
};
|
|
1854
|
-
Buffer3.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
1855
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
1856
|
-
};
|
|
1857
|
-
function hexWrite(buf, string, offset, length) {
|
|
1858
|
-
offset = Number(offset) || 0;
|
|
1859
|
-
var remaining = buf.length - offset;
|
|
1860
|
-
if (!length) {
|
|
1861
|
-
length = remaining;
|
|
1862
|
-
} else {
|
|
1863
|
-
length = Number(length);
|
|
1864
|
-
if (length > remaining) {
|
|
1865
|
-
length = remaining;
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
var strLen = string.length;
|
|
1869
|
-
if (length > strLen / 2) {
|
|
1870
|
-
length = strLen / 2;
|
|
1871
|
-
}
|
|
1872
|
-
for (var i = 0; i < length; ++i) {
|
|
1873
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
1874
|
-
if (numberIsNaN(parsed))
|
|
1875
|
-
return i;
|
|
1876
|
-
buf[offset + i] = parsed;
|
|
1877
|
-
}
|
|
1878
|
-
return i;
|
|
1879
|
-
}
|
|
1880
|
-
function utf8Write(buf, string, offset, length) {
|
|
1881
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
|
1882
|
-
}
|
|
1883
|
-
function asciiWrite(buf, string, offset, length) {
|
|
1884
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
1885
|
-
}
|
|
1886
|
-
function base64Write(buf, string, offset, length) {
|
|
1887
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
1888
|
-
}
|
|
1889
|
-
function ucs2Write(buf, string, offset, length) {
|
|
1890
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
1891
|
-
}
|
|
1892
|
-
Buffer3.prototype.write = function write(string, offset, length, encoding) {
|
|
1893
|
-
if (offset === void 0) {
|
|
1894
|
-
encoding = "utf8";
|
|
1895
|
-
length = this.length;
|
|
1896
|
-
offset = 0;
|
|
1897
|
-
} else if (length === void 0 && typeof offset === "string") {
|
|
1898
|
-
encoding = offset;
|
|
1899
|
-
length = this.length;
|
|
1900
|
-
offset = 0;
|
|
1901
|
-
} else if (isFinite(offset)) {
|
|
1902
|
-
offset = offset >>> 0;
|
|
1903
|
-
if (isFinite(length)) {
|
|
1904
|
-
length = length >>> 0;
|
|
1905
|
-
if (encoding === void 0)
|
|
1906
|
-
encoding = "utf8";
|
|
1907
|
-
} else {
|
|
1908
|
-
encoding = length;
|
|
1909
|
-
length = void 0;
|
|
1910
|
-
}
|
|
1911
|
-
} else {
|
|
1912
|
-
throw new Error(
|
|
1913
|
-
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
1914
|
-
);
|
|
1915
|
-
}
|
|
1916
|
-
var remaining = this.length - offset;
|
|
1917
|
-
if (length === void 0 || length > remaining)
|
|
1918
|
-
length = remaining;
|
|
1919
|
-
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
1920
|
-
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1921
|
-
}
|
|
1922
|
-
if (!encoding)
|
|
1923
|
-
encoding = "utf8";
|
|
1924
|
-
var loweredCase = false;
|
|
1925
|
-
for (; ; ) {
|
|
1926
|
-
switch (encoding) {
|
|
1927
|
-
case "hex":
|
|
1928
|
-
return hexWrite(this, string, offset, length);
|
|
1929
|
-
case "utf8":
|
|
1930
|
-
case "utf-8":
|
|
1931
|
-
return utf8Write(this, string, offset, length);
|
|
1932
|
-
case "ascii":
|
|
1933
|
-
case "latin1":
|
|
1934
|
-
case "binary":
|
|
1935
|
-
return asciiWrite(this, string, offset, length);
|
|
1936
|
-
case "base64":
|
|
1937
|
-
return base64Write(this, string, offset, length);
|
|
1938
|
-
case "ucs2":
|
|
1939
|
-
case "ucs-2":
|
|
1940
|
-
case "utf16le":
|
|
1941
|
-
case "utf-16le":
|
|
1942
|
-
return ucs2Write(this, string, offset, length);
|
|
1943
|
-
default:
|
|
1944
|
-
if (loweredCase)
|
|
1945
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1946
|
-
encoding = ("" + encoding).toLowerCase();
|
|
1947
|
-
loweredCase = true;
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
};
|
|
1951
|
-
Buffer3.prototype.toJSON = function toJSON() {
|
|
1952
|
-
return {
|
|
1953
|
-
type: "Buffer",
|
|
1954
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1955
|
-
};
|
|
1956
|
-
};
|
|
1957
|
-
function base64Slice(buf, start, end) {
|
|
1958
|
-
if (start === 0 && end === buf.length) {
|
|
1959
|
-
return base64.fromByteArray(buf);
|
|
1960
|
-
} else {
|
|
1961
|
-
return base64.fromByteArray(buf.slice(start, end));
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
function utf8Slice(buf, start, end) {
|
|
1965
|
-
end = Math.min(buf.length, end);
|
|
1966
|
-
var res = [];
|
|
1967
|
-
var i = start;
|
|
1968
|
-
while (i < end) {
|
|
1969
|
-
var firstByte = buf[i];
|
|
1970
|
-
var codePoint = null;
|
|
1971
|
-
var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
1972
|
-
if (i + bytesPerSequence <= end) {
|
|
1973
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
1974
|
-
switch (bytesPerSequence) {
|
|
1975
|
-
case 1:
|
|
1976
|
-
if (firstByte < 128) {
|
|
1977
|
-
codePoint = firstByte;
|
|
1978
|
-
}
|
|
1979
|
-
break;
|
|
1980
|
-
case 2:
|
|
1981
|
-
secondByte = buf[i + 1];
|
|
1982
|
-
if ((secondByte & 192) === 128) {
|
|
1983
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
1984
|
-
if (tempCodePoint > 127) {
|
|
1985
|
-
codePoint = tempCodePoint;
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
break;
|
|
1989
|
-
case 3:
|
|
1990
|
-
secondByte = buf[i + 1];
|
|
1991
|
-
thirdByte = buf[i + 2];
|
|
1992
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
1993
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
1994
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
1995
|
-
codePoint = tempCodePoint;
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
break;
|
|
1999
|
-
case 4:
|
|
2000
|
-
secondByte = buf[i + 1];
|
|
2001
|
-
thirdByte = buf[i + 2];
|
|
2002
|
-
fourthByte = buf[i + 3];
|
|
2003
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
2004
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
2005
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
2006
|
-
codePoint = tempCodePoint;
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
if (codePoint === null) {
|
|
2012
|
-
codePoint = 65533;
|
|
2013
|
-
bytesPerSequence = 1;
|
|
2014
|
-
} else if (codePoint > 65535) {
|
|
2015
|
-
codePoint -= 65536;
|
|
2016
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
2017
|
-
codePoint = 56320 | codePoint & 1023;
|
|
2018
|
-
}
|
|
2019
|
-
res.push(codePoint);
|
|
2020
|
-
i += bytesPerSequence;
|
|
2021
|
-
}
|
|
2022
|
-
return decodeCodePointsArray(res);
|
|
2023
|
-
}
|
|
2024
|
-
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
2025
|
-
function decodeCodePointsArray(codePoints) {
|
|
2026
|
-
var len = codePoints.length;
|
|
2027
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
2028
|
-
return String.fromCharCode.apply(String, codePoints);
|
|
2029
|
-
}
|
|
2030
|
-
var res = "";
|
|
2031
|
-
var i = 0;
|
|
2032
|
-
while (i < len) {
|
|
2033
|
-
res += String.fromCharCode.apply(
|
|
2034
|
-
String,
|
|
2035
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
2036
|
-
);
|
|
2037
|
-
}
|
|
2038
|
-
return res;
|
|
2039
|
-
}
|
|
2040
|
-
function asciiSlice(buf, start, end) {
|
|
2041
|
-
var ret = "";
|
|
2042
|
-
end = Math.min(buf.length, end);
|
|
2043
|
-
for (var i = start; i < end; ++i) {
|
|
2044
|
-
ret += String.fromCharCode(buf[i] & 127);
|
|
2045
|
-
}
|
|
2046
|
-
return ret;
|
|
2047
|
-
}
|
|
2048
|
-
function latin1Slice(buf, start, end) {
|
|
2049
|
-
var ret = "";
|
|
2050
|
-
end = Math.min(buf.length, end);
|
|
2051
|
-
for (var i = start; i < end; ++i) {
|
|
2052
|
-
ret += String.fromCharCode(buf[i]);
|
|
2053
|
-
}
|
|
2054
|
-
return ret;
|
|
2055
|
-
}
|
|
2056
|
-
function hexSlice(buf, start, end) {
|
|
2057
|
-
var len = buf.length;
|
|
2058
|
-
if (!start || start < 0)
|
|
2059
|
-
start = 0;
|
|
2060
|
-
if (!end || end < 0 || end > len)
|
|
2061
|
-
end = len;
|
|
2062
|
-
var out = "";
|
|
2063
|
-
for (var i = start; i < end; ++i) {
|
|
2064
|
-
out += hexSliceLookupTable[buf[i]];
|
|
2065
|
-
}
|
|
2066
|
-
return out;
|
|
2067
|
-
}
|
|
2068
|
-
function utf16leSlice(buf, start, end) {
|
|
2069
|
-
var bytes = buf.slice(start, end);
|
|
2070
|
-
var res = "";
|
|
2071
|
-
for (var i = 0; i < bytes.length - 1; i += 2) {
|
|
2072
|
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
2073
|
-
}
|
|
2074
|
-
return res;
|
|
2075
|
-
}
|
|
2076
|
-
Buffer3.prototype.slice = function slice(start, end) {
|
|
2077
|
-
var len = this.length;
|
|
2078
|
-
start = ~~start;
|
|
2079
|
-
end = end === void 0 ? len : ~~end;
|
|
2080
|
-
if (start < 0) {
|
|
2081
|
-
start += len;
|
|
2082
|
-
if (start < 0)
|
|
2083
|
-
start = 0;
|
|
2084
|
-
} else if (start > len) {
|
|
2085
|
-
start = len;
|
|
2086
|
-
}
|
|
2087
|
-
if (end < 0) {
|
|
2088
|
-
end += len;
|
|
2089
|
-
if (end < 0)
|
|
2090
|
-
end = 0;
|
|
2091
|
-
} else if (end > len) {
|
|
2092
|
-
end = len;
|
|
2093
|
-
}
|
|
2094
|
-
if (end < start)
|
|
2095
|
-
end = start;
|
|
2096
|
-
var newBuf = this.subarray(start, end);
|
|
2097
|
-
Object.setPrototypeOf(newBuf, Buffer3.prototype);
|
|
2098
|
-
return newBuf;
|
|
2099
|
-
};
|
|
2100
|
-
function checkOffset(offset, ext, length) {
|
|
2101
|
-
if (offset % 1 !== 0 || offset < 0)
|
|
2102
|
-
throw new RangeError("offset is not uint");
|
|
2103
|
-
if (offset + ext > length)
|
|
2104
|
-
throw new RangeError("Trying to access beyond buffer length");
|
|
2105
|
-
}
|
|
2106
|
-
Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = function readUIntLE(offset, byteLength3, noAssert) {
|
|
2107
|
-
offset = offset >>> 0;
|
|
2108
|
-
byteLength3 = byteLength3 >>> 0;
|
|
2109
|
-
if (!noAssert)
|
|
2110
|
-
checkOffset(offset, byteLength3, this.length);
|
|
2111
|
-
var val = this[offset];
|
|
2112
|
-
var mul = 1;
|
|
2113
|
-
var i = 0;
|
|
2114
|
-
while (++i < byteLength3 && (mul *= 256)) {
|
|
2115
|
-
val += this[offset + i] * mul;
|
|
2116
|
-
}
|
|
2117
|
-
return val;
|
|
2118
|
-
};
|
|
2119
|
-
Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = function readUIntBE(offset, byteLength3, noAssert) {
|
|
2120
|
-
offset = offset >>> 0;
|
|
2121
|
-
byteLength3 = byteLength3 >>> 0;
|
|
2122
|
-
if (!noAssert) {
|
|
2123
|
-
checkOffset(offset, byteLength3, this.length);
|
|
2124
|
-
}
|
|
2125
|
-
var val = this[offset + --byteLength3];
|
|
2126
|
-
var mul = 1;
|
|
2127
|
-
while (byteLength3 > 0 && (mul *= 256)) {
|
|
2128
|
-
val += this[offset + --byteLength3] * mul;
|
|
2129
|
-
}
|
|
2130
|
-
return val;
|
|
2131
|
-
};
|
|
2132
|
-
Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
2133
|
-
offset = offset >>> 0;
|
|
2134
|
-
if (!noAssert)
|
|
2135
|
-
checkOffset(offset, 1, this.length);
|
|
2136
|
-
return this[offset];
|
|
2137
|
-
};
|
|
2138
|
-
Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
2139
|
-
offset = offset >>> 0;
|
|
2140
|
-
if (!noAssert)
|
|
2141
|
-
checkOffset(offset, 2, this.length);
|
|
2142
|
-
return this[offset] | this[offset + 1] << 8;
|
|
2143
|
-
};
|
|
2144
|
-
Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
2145
|
-
offset = offset >>> 0;
|
|
2146
|
-
if (!noAssert)
|
|
2147
|
-
checkOffset(offset, 2, this.length);
|
|
2148
|
-
return this[offset] << 8 | this[offset + 1];
|
|
2149
|
-
};
|
|
2150
|
-
Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
2151
|
-
offset = offset >>> 0;
|
|
2152
|
-
if (!noAssert)
|
|
2153
|
-
checkOffset(offset, 4, this.length);
|
|
2154
|
-
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
2155
|
-
};
|
|
2156
|
-
Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
2157
|
-
offset = offset >>> 0;
|
|
2158
|
-
if (!noAssert)
|
|
2159
|
-
checkOffset(offset, 4, this.length);
|
|
2160
|
-
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
2161
|
-
};
|
|
2162
|
-
Buffer3.prototype.readIntLE = function readIntLE(offset, byteLength3, noAssert) {
|
|
2163
|
-
offset = offset >>> 0;
|
|
2164
|
-
byteLength3 = byteLength3 >>> 0;
|
|
2165
|
-
if (!noAssert)
|
|
2166
|
-
checkOffset(offset, byteLength3, this.length);
|
|
2167
|
-
var val = this[offset];
|
|
2168
|
-
var mul = 1;
|
|
2169
|
-
var i = 0;
|
|
2170
|
-
while (++i < byteLength3 && (mul *= 256)) {
|
|
2171
|
-
val += this[offset + i] * mul;
|
|
2172
|
-
}
|
|
2173
|
-
mul *= 128;
|
|
2174
|
-
if (val >= mul)
|
|
2175
|
-
val -= Math.pow(2, 8 * byteLength3);
|
|
2176
|
-
return val;
|
|
2177
|
-
};
|
|
2178
|
-
Buffer3.prototype.readIntBE = function readIntBE(offset, byteLength3, noAssert) {
|
|
2179
|
-
offset = offset >>> 0;
|
|
2180
|
-
byteLength3 = byteLength3 >>> 0;
|
|
2181
|
-
if (!noAssert)
|
|
2182
|
-
checkOffset(offset, byteLength3, this.length);
|
|
2183
|
-
var i = byteLength3;
|
|
2184
|
-
var mul = 1;
|
|
2185
|
-
var val = this[offset + --i];
|
|
2186
|
-
while (i > 0 && (mul *= 256)) {
|
|
2187
|
-
val += this[offset + --i] * mul;
|
|
2188
|
-
}
|
|
2189
|
-
mul *= 128;
|
|
2190
|
-
if (val >= mul)
|
|
2191
|
-
val -= Math.pow(2, 8 * byteLength3);
|
|
2192
|
-
return val;
|
|
2193
|
-
};
|
|
2194
|
-
Buffer3.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
2195
|
-
offset = offset >>> 0;
|
|
2196
|
-
if (!noAssert)
|
|
2197
|
-
checkOffset(offset, 1, this.length);
|
|
2198
|
-
if (!(this[offset] & 128))
|
|
2199
|
-
return this[offset];
|
|
2200
|
-
return (255 - this[offset] + 1) * -1;
|
|
2201
|
-
};
|
|
2202
|
-
Buffer3.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
2203
|
-
offset = offset >>> 0;
|
|
2204
|
-
if (!noAssert)
|
|
2205
|
-
checkOffset(offset, 2, this.length);
|
|
2206
|
-
var val = this[offset] | this[offset + 1] << 8;
|
|
2207
|
-
return val & 32768 ? val | 4294901760 : val;
|
|
2208
|
-
};
|
|
2209
|
-
Buffer3.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
2210
|
-
offset = offset >>> 0;
|
|
2211
|
-
if (!noAssert)
|
|
2212
|
-
checkOffset(offset, 2, this.length);
|
|
2213
|
-
var val = this[offset + 1] | this[offset] << 8;
|
|
2214
|
-
return val & 32768 ? val | 4294901760 : val;
|
|
2215
|
-
};
|
|
2216
|
-
Buffer3.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
2217
|
-
offset = offset >>> 0;
|
|
2218
|
-
if (!noAssert)
|
|
2219
|
-
checkOffset(offset, 4, this.length);
|
|
2220
|
-
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
2221
|
-
};
|
|
2222
|
-
Buffer3.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
2223
|
-
offset = offset >>> 0;
|
|
2224
|
-
if (!noAssert)
|
|
2225
|
-
checkOffset(offset, 4, this.length);
|
|
2226
|
-
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
2227
|
-
};
|
|
2228
|
-
Buffer3.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
2229
|
-
offset = offset >>> 0;
|
|
2230
|
-
if (!noAssert)
|
|
2231
|
-
checkOffset(offset, 4, this.length);
|
|
2232
|
-
return ieee754$1.read(this, offset, true, 23, 4);
|
|
2233
|
-
};
|
|
2234
|
-
Buffer3.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
2235
|
-
offset = offset >>> 0;
|
|
2236
|
-
if (!noAssert)
|
|
2237
|
-
checkOffset(offset, 4, this.length);
|
|
2238
|
-
return ieee754$1.read(this, offset, false, 23, 4);
|
|
2239
|
-
};
|
|
2240
|
-
Buffer3.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
2241
|
-
offset = offset >>> 0;
|
|
2242
|
-
if (!noAssert)
|
|
2243
|
-
checkOffset(offset, 8, this.length);
|
|
2244
|
-
return ieee754$1.read(this, offset, true, 52, 8);
|
|
2245
|
-
};
|
|
2246
|
-
Buffer3.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
2247
|
-
offset = offset >>> 0;
|
|
2248
|
-
if (!noAssert)
|
|
2249
|
-
checkOffset(offset, 8, this.length);
|
|
2250
|
-
return ieee754$1.read(this, offset, false, 52, 8);
|
|
2251
|
-
};
|
|
2252
|
-
function checkInt(buf, value, offset, ext, max, min) {
|
|
2253
|
-
if (!Buffer3.isBuffer(buf))
|
|
2254
|
-
throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
2255
|
-
if (value > max || value < min)
|
|
2256
|
-
throw new RangeError('"value" argument is out of bounds');
|
|
2257
|
-
if (offset + ext > buf.length)
|
|
2258
|
-
throw new RangeError("Index out of range");
|
|
2259
|
-
}
|
|
2260
|
-
Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength3, noAssert) {
|
|
2261
|
-
value = +value;
|
|
2262
|
-
offset = offset >>> 0;
|
|
2263
|
-
byteLength3 = byteLength3 >>> 0;
|
|
2264
|
-
if (!noAssert) {
|
|
2265
|
-
var maxBytes = Math.pow(2, 8 * byteLength3) - 1;
|
|
2266
|
-
checkInt(this, value, offset, byteLength3, maxBytes, 0);
|
|
2267
|
-
}
|
|
2268
|
-
var mul = 1;
|
|
2269
|
-
var i = 0;
|
|
2270
|
-
this[offset] = value & 255;
|
|
2271
|
-
while (++i < byteLength3 && (mul *= 256)) {
|
|
2272
|
-
this[offset + i] = value / mul & 255;
|
|
2273
|
-
}
|
|
2274
|
-
return offset + byteLength3;
|
|
2275
|
-
};
|
|
2276
|
-
Buffer3.prototype.writeUintBE = Buffer3.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength3, noAssert) {
|
|
2277
|
-
value = +value;
|
|
2278
|
-
offset = offset >>> 0;
|
|
2279
|
-
byteLength3 = byteLength3 >>> 0;
|
|
2280
|
-
if (!noAssert) {
|
|
2281
|
-
var maxBytes = Math.pow(2, 8 * byteLength3) - 1;
|
|
2282
|
-
checkInt(this, value, offset, byteLength3, maxBytes, 0);
|
|
2283
|
-
}
|
|
2284
|
-
var i = byteLength3 - 1;
|
|
2285
|
-
var mul = 1;
|
|
2286
|
-
this[offset + i] = value & 255;
|
|
2287
|
-
while (--i >= 0 && (mul *= 256)) {
|
|
2288
|
-
this[offset + i] = value / mul & 255;
|
|
2289
|
-
}
|
|
2290
|
-
return offset + byteLength3;
|
|
2291
|
-
};
|
|
2292
|
-
Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
2293
|
-
value = +value;
|
|
2294
|
-
offset = offset >>> 0;
|
|
2295
|
-
if (!noAssert)
|
|
2296
|
-
checkInt(this, value, offset, 1, 255, 0);
|
|
2297
|
-
this[offset] = value & 255;
|
|
2298
|
-
return offset + 1;
|
|
2299
|
-
};
|
|
2300
|
-
Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
2301
|
-
value = +value;
|
|
2302
|
-
offset = offset >>> 0;
|
|
2303
|
-
if (!noAssert)
|
|
2304
|
-
checkInt(this, value, offset, 2, 65535, 0);
|
|
2305
|
-
this[offset] = value & 255;
|
|
2306
|
-
this[offset + 1] = value >>> 8;
|
|
2307
|
-
return offset + 2;
|
|
2308
|
-
};
|
|
2309
|
-
Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
2310
|
-
value = +value;
|
|
2311
|
-
offset = offset >>> 0;
|
|
2312
|
-
if (!noAssert)
|
|
2313
|
-
checkInt(this, value, offset, 2, 65535, 0);
|
|
2314
|
-
this[offset] = value >>> 8;
|
|
2315
|
-
this[offset + 1] = value & 255;
|
|
2316
|
-
return offset + 2;
|
|
2317
|
-
};
|
|
2318
|
-
Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
2319
|
-
value = +value;
|
|
2320
|
-
offset = offset >>> 0;
|
|
2321
|
-
if (!noAssert)
|
|
2322
|
-
checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2323
|
-
this[offset + 3] = value >>> 24;
|
|
2324
|
-
this[offset + 2] = value >>> 16;
|
|
2325
|
-
this[offset + 1] = value >>> 8;
|
|
2326
|
-
this[offset] = value & 255;
|
|
2327
|
-
return offset + 4;
|
|
2328
|
-
};
|
|
2329
|
-
Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
2330
|
-
value = +value;
|
|
2331
|
-
offset = offset >>> 0;
|
|
2332
|
-
if (!noAssert)
|
|
2333
|
-
checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2334
|
-
this[offset] = value >>> 24;
|
|
2335
|
-
this[offset + 1] = value >>> 16;
|
|
2336
|
-
this[offset + 2] = value >>> 8;
|
|
2337
|
-
this[offset + 3] = value & 255;
|
|
2338
|
-
return offset + 4;
|
|
2339
|
-
};
|
|
2340
|
-
Buffer3.prototype.writeIntLE = function writeIntLE(value, offset, byteLength3, noAssert) {
|
|
2341
|
-
value = +value;
|
|
2342
|
-
offset = offset >>> 0;
|
|
2343
|
-
if (!noAssert) {
|
|
2344
|
-
var limit = Math.pow(2, 8 * byteLength3 - 1);
|
|
2345
|
-
checkInt(this, value, offset, byteLength3, limit - 1, -limit);
|
|
2346
|
-
}
|
|
2347
|
-
var i = 0;
|
|
2348
|
-
var mul = 1;
|
|
2349
|
-
var sub = 0;
|
|
2350
|
-
this[offset] = value & 255;
|
|
2351
|
-
while (++i < byteLength3 && (mul *= 256)) {
|
|
2352
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
2353
|
-
sub = 1;
|
|
2354
|
-
}
|
|
2355
|
-
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
2356
|
-
}
|
|
2357
|
-
return offset + byteLength3;
|
|
2358
|
-
};
|
|
2359
|
-
Buffer3.prototype.writeIntBE = function writeIntBE(value, offset, byteLength3, noAssert) {
|
|
2360
|
-
value = +value;
|
|
2361
|
-
offset = offset >>> 0;
|
|
2362
|
-
if (!noAssert) {
|
|
2363
|
-
var limit = Math.pow(2, 8 * byteLength3 - 1);
|
|
2364
|
-
checkInt(this, value, offset, byteLength3, limit - 1, -limit);
|
|
2365
|
-
}
|
|
2366
|
-
var i = byteLength3 - 1;
|
|
2367
|
-
var mul = 1;
|
|
2368
|
-
var sub = 0;
|
|
2369
|
-
this[offset + i] = value & 255;
|
|
2370
|
-
while (--i >= 0 && (mul *= 256)) {
|
|
2371
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
2372
|
-
sub = 1;
|
|
2373
|
-
}
|
|
2374
|
-
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
2375
|
-
}
|
|
2376
|
-
return offset + byteLength3;
|
|
2377
|
-
};
|
|
2378
|
-
Buffer3.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
2379
|
-
value = +value;
|
|
2380
|
-
offset = offset >>> 0;
|
|
2381
|
-
if (!noAssert)
|
|
2382
|
-
checkInt(this, value, offset, 1, 127, -128);
|
|
2383
|
-
if (value < 0)
|
|
2384
|
-
value = 255 + value + 1;
|
|
2385
|
-
this[offset] = value & 255;
|
|
2386
|
-
return offset + 1;
|
|
2387
|
-
};
|
|
2388
|
-
Buffer3.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
2389
|
-
value = +value;
|
|
2390
|
-
offset = offset >>> 0;
|
|
2391
|
-
if (!noAssert)
|
|
2392
|
-
checkInt(this, value, offset, 2, 32767, -32768);
|
|
2393
|
-
this[offset] = value & 255;
|
|
2394
|
-
this[offset + 1] = value >>> 8;
|
|
2395
|
-
return offset + 2;
|
|
2396
|
-
};
|
|
2397
|
-
Buffer3.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
2398
|
-
value = +value;
|
|
2399
|
-
offset = offset >>> 0;
|
|
2400
|
-
if (!noAssert)
|
|
2401
|
-
checkInt(this, value, offset, 2, 32767, -32768);
|
|
2402
|
-
this[offset] = value >>> 8;
|
|
2403
|
-
this[offset + 1] = value & 255;
|
|
2404
|
-
return offset + 2;
|
|
2405
|
-
};
|
|
2406
|
-
Buffer3.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
2407
|
-
value = +value;
|
|
2408
|
-
offset = offset >>> 0;
|
|
2409
|
-
if (!noAssert)
|
|
2410
|
-
checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2411
|
-
this[offset] = value & 255;
|
|
2412
|
-
this[offset + 1] = value >>> 8;
|
|
2413
|
-
this[offset + 2] = value >>> 16;
|
|
2414
|
-
this[offset + 3] = value >>> 24;
|
|
2415
|
-
return offset + 4;
|
|
2416
|
-
};
|
|
2417
|
-
Buffer3.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
2418
|
-
value = +value;
|
|
2419
|
-
offset = offset >>> 0;
|
|
2420
|
-
if (!noAssert)
|
|
2421
|
-
checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2422
|
-
if (value < 0)
|
|
2423
|
-
value = 4294967295 + value + 1;
|
|
2424
|
-
this[offset] = value >>> 24;
|
|
2425
|
-
this[offset + 1] = value >>> 16;
|
|
2426
|
-
this[offset + 2] = value >>> 8;
|
|
2427
|
-
this[offset + 3] = value & 255;
|
|
2428
|
-
return offset + 4;
|
|
2429
|
-
};
|
|
2430
|
-
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
2431
|
-
if (offset + ext > buf.length)
|
|
2432
|
-
throw new RangeError("Index out of range");
|
|
2433
|
-
if (offset < 0)
|
|
2434
|
-
throw new RangeError("Index out of range");
|
|
2435
|
-
}
|
|
2436
|
-
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
2437
|
-
value = +value;
|
|
2438
|
-
offset = offset >>> 0;
|
|
2439
|
-
if (!noAssert) {
|
|
2440
|
-
checkIEEE754(buf, value, offset, 4);
|
|
2441
|
-
}
|
|
2442
|
-
ieee754$1.write(buf, value, offset, littleEndian, 23, 4);
|
|
2443
|
-
return offset + 4;
|
|
2444
|
-
}
|
|
2445
|
-
Buffer3.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
2446
|
-
return writeFloat(this, value, offset, true, noAssert);
|
|
2447
|
-
};
|
|
2448
|
-
Buffer3.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
2449
|
-
return writeFloat(this, value, offset, false, noAssert);
|
|
2450
|
-
};
|
|
2451
|
-
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
2452
|
-
value = +value;
|
|
2453
|
-
offset = offset >>> 0;
|
|
2454
|
-
if (!noAssert) {
|
|
2455
|
-
checkIEEE754(buf, value, offset, 8);
|
|
2456
|
-
}
|
|
2457
|
-
ieee754$1.write(buf, value, offset, littleEndian, 52, 8);
|
|
2458
|
-
return offset + 8;
|
|
2459
|
-
}
|
|
2460
|
-
Buffer3.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
2461
|
-
return writeDouble(this, value, offset, true, noAssert);
|
|
2462
|
-
};
|
|
2463
|
-
Buffer3.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
2464
|
-
return writeDouble(this, value, offset, false, noAssert);
|
|
2465
|
-
};
|
|
2466
|
-
Buffer3.prototype.copy = function copy(target, targetStart, start, end) {
|
|
2467
|
-
if (!Buffer3.isBuffer(target))
|
|
2468
|
-
throw new TypeError("argument should be a Buffer");
|
|
2469
|
-
if (!start)
|
|
2470
|
-
start = 0;
|
|
2471
|
-
if (!end && end !== 0)
|
|
2472
|
-
end = this.length;
|
|
2473
|
-
if (targetStart >= target.length)
|
|
2474
|
-
targetStart = target.length;
|
|
2475
|
-
if (!targetStart)
|
|
2476
|
-
targetStart = 0;
|
|
2477
|
-
if (end > 0 && end < start)
|
|
2478
|
-
end = start;
|
|
2479
|
-
if (end === start)
|
|
2480
|
-
return 0;
|
|
2481
|
-
if (target.length === 0 || this.length === 0)
|
|
2482
|
-
return 0;
|
|
2483
|
-
if (targetStart < 0) {
|
|
2484
|
-
throw new RangeError("targetStart out of bounds");
|
|
2485
|
-
}
|
|
2486
|
-
if (start < 0 || start >= this.length)
|
|
2487
|
-
throw new RangeError("Index out of range");
|
|
2488
|
-
if (end < 0)
|
|
2489
|
-
throw new RangeError("sourceEnd out of bounds");
|
|
2490
|
-
if (end > this.length)
|
|
2491
|
-
end = this.length;
|
|
2492
|
-
if (target.length - targetStart < end - start) {
|
|
2493
|
-
end = target.length - targetStart + start;
|
|
2494
|
-
}
|
|
2495
|
-
var len = end - start;
|
|
2496
|
-
if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
|
|
2497
|
-
this.copyWithin(targetStart, start, end);
|
|
2498
|
-
} else {
|
|
2499
|
-
Uint8Array.prototype.set.call(
|
|
2500
|
-
target,
|
|
2501
|
-
this.subarray(start, end),
|
|
2502
|
-
targetStart
|
|
2503
|
-
);
|
|
2504
|
-
}
|
|
2505
|
-
return len;
|
|
2506
|
-
};
|
|
2507
|
-
Buffer3.prototype.fill = function fill(val, start, end, encoding) {
|
|
2508
|
-
if (typeof val === "string") {
|
|
2509
|
-
if (typeof start === "string") {
|
|
2510
|
-
encoding = start;
|
|
2511
|
-
start = 0;
|
|
2512
|
-
end = this.length;
|
|
2513
|
-
} else if (typeof end === "string") {
|
|
2514
|
-
encoding = end;
|
|
2515
|
-
end = this.length;
|
|
2516
|
-
}
|
|
2517
|
-
if (encoding !== void 0 && typeof encoding !== "string") {
|
|
2518
|
-
throw new TypeError("encoding must be a string");
|
|
2519
|
-
}
|
|
2520
|
-
if (typeof encoding === "string" && !Buffer3.isEncoding(encoding)) {
|
|
2521
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
2522
|
-
}
|
|
2523
|
-
if (val.length === 1) {
|
|
2524
|
-
var code2 = val.charCodeAt(0);
|
|
2525
|
-
if (encoding === "utf8" && code2 < 128 || encoding === "latin1") {
|
|
2526
|
-
val = code2;
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
} else if (typeof val === "number") {
|
|
2530
|
-
val = val & 255;
|
|
2531
|
-
} else if (typeof val === "boolean") {
|
|
2532
|
-
val = Number(val);
|
|
2533
|
-
}
|
|
2534
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
2535
|
-
throw new RangeError("Out of range index");
|
|
2536
|
-
}
|
|
2537
|
-
if (end <= start) {
|
|
2538
|
-
return this;
|
|
2539
|
-
}
|
|
2540
|
-
start = start >>> 0;
|
|
2541
|
-
end = end === void 0 ? this.length : end >>> 0;
|
|
2542
|
-
if (!val)
|
|
2543
|
-
val = 0;
|
|
2544
|
-
var i;
|
|
2545
|
-
if (typeof val === "number") {
|
|
2546
|
-
for (i = start; i < end; ++i) {
|
|
2547
|
-
this[i] = val;
|
|
2548
|
-
}
|
|
2549
|
-
} else {
|
|
2550
|
-
var bytes = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding);
|
|
2551
|
-
var len = bytes.length;
|
|
2552
|
-
if (len === 0) {
|
|
2553
|
-
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
|
|
2554
|
-
}
|
|
2555
|
-
for (i = 0; i < end - start; ++i) {
|
|
2556
|
-
this[i + start] = bytes[i % len];
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
return this;
|
|
2560
|
-
};
|
|
2561
|
-
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
2562
|
-
function base64clean(str) {
|
|
2563
|
-
str = str.split("=")[0];
|
|
2564
|
-
str = str.trim().replace(INVALID_BASE64_RE, "");
|
|
2565
|
-
if (str.length < 2)
|
|
2566
|
-
return "";
|
|
2567
|
-
while (str.length % 4 !== 0) {
|
|
2568
|
-
str = str + "=";
|
|
2569
|
-
}
|
|
2570
|
-
return str;
|
|
2571
|
-
}
|
|
2572
|
-
function utf8ToBytes(string, units) {
|
|
2573
|
-
units = units || Infinity;
|
|
2574
|
-
var codePoint;
|
|
2575
|
-
var length = string.length;
|
|
2576
|
-
var leadSurrogate = null;
|
|
2577
|
-
var bytes = [];
|
|
2578
|
-
for (var i = 0; i < length; ++i) {
|
|
2579
|
-
codePoint = string.charCodeAt(i);
|
|
2580
|
-
if (codePoint > 55295 && codePoint < 57344) {
|
|
2581
|
-
if (!leadSurrogate) {
|
|
2582
|
-
if (codePoint > 56319) {
|
|
2583
|
-
if ((units -= 3) > -1)
|
|
2584
|
-
bytes.push(239, 191, 189);
|
|
2585
|
-
continue;
|
|
2586
|
-
} else if (i + 1 === length) {
|
|
2587
|
-
if ((units -= 3) > -1)
|
|
2588
|
-
bytes.push(239, 191, 189);
|
|
2589
|
-
continue;
|
|
2590
|
-
}
|
|
2591
|
-
leadSurrogate = codePoint;
|
|
2592
|
-
continue;
|
|
2593
|
-
}
|
|
2594
|
-
if (codePoint < 56320) {
|
|
2595
|
-
if ((units -= 3) > -1)
|
|
2596
|
-
bytes.push(239, 191, 189);
|
|
2597
|
-
leadSurrogate = codePoint;
|
|
2598
|
-
continue;
|
|
2599
|
-
}
|
|
2600
|
-
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
|
2601
|
-
} else if (leadSurrogate) {
|
|
2602
|
-
if ((units -= 3) > -1)
|
|
2603
|
-
bytes.push(239, 191, 189);
|
|
2604
|
-
}
|
|
2605
|
-
leadSurrogate = null;
|
|
2606
|
-
if (codePoint < 128) {
|
|
2607
|
-
if ((units -= 1) < 0)
|
|
2608
|
-
break;
|
|
2609
|
-
bytes.push(codePoint);
|
|
2610
|
-
} else if (codePoint < 2048) {
|
|
2611
|
-
if ((units -= 2) < 0)
|
|
2612
|
-
break;
|
|
2613
|
-
bytes.push(
|
|
2614
|
-
codePoint >> 6 | 192,
|
|
2615
|
-
codePoint & 63 | 128
|
|
2616
|
-
);
|
|
2617
|
-
} else if (codePoint < 65536) {
|
|
2618
|
-
if ((units -= 3) < 0)
|
|
2619
|
-
break;
|
|
2620
|
-
bytes.push(
|
|
2621
|
-
codePoint >> 12 | 224,
|
|
2622
|
-
codePoint >> 6 & 63 | 128,
|
|
2623
|
-
codePoint & 63 | 128
|
|
2624
|
-
);
|
|
2625
|
-
} else if (codePoint < 1114112) {
|
|
2626
|
-
if ((units -= 4) < 0)
|
|
2627
|
-
break;
|
|
2628
|
-
bytes.push(
|
|
2629
|
-
codePoint >> 18 | 240,
|
|
2630
|
-
codePoint >> 12 & 63 | 128,
|
|
2631
|
-
codePoint >> 6 & 63 | 128,
|
|
2632
|
-
codePoint & 63 | 128
|
|
2633
|
-
);
|
|
2634
|
-
} else {
|
|
2635
|
-
throw new Error("Invalid code point");
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
|
-
return bytes;
|
|
2639
|
-
}
|
|
2640
|
-
function asciiToBytes(str) {
|
|
2641
|
-
var byteArray = [];
|
|
2642
|
-
for (var i = 0; i < str.length; ++i) {
|
|
2643
|
-
byteArray.push(str.charCodeAt(i) & 255);
|
|
2644
|
-
}
|
|
2645
|
-
return byteArray;
|
|
2646
|
-
}
|
|
2647
|
-
function utf16leToBytes(str, units) {
|
|
2648
|
-
var c, hi, lo;
|
|
2649
|
-
var byteArray = [];
|
|
2650
|
-
for (var i = 0; i < str.length; ++i) {
|
|
2651
|
-
if ((units -= 2) < 0)
|
|
2652
|
-
break;
|
|
2653
|
-
c = str.charCodeAt(i);
|
|
2654
|
-
hi = c >> 8;
|
|
2655
|
-
lo = c % 256;
|
|
2656
|
-
byteArray.push(lo);
|
|
2657
|
-
byteArray.push(hi);
|
|
2658
|
-
}
|
|
2659
|
-
return byteArray;
|
|
2660
|
-
}
|
|
2661
|
-
function base64ToBytes(str) {
|
|
2662
|
-
return base64.toByteArray(base64clean(str));
|
|
2663
|
-
}
|
|
2664
|
-
function blitBuffer(src, dst, offset, length) {
|
|
2665
|
-
for (var i = 0; i < length; ++i) {
|
|
2666
|
-
if (i + offset >= dst.length || i >= src.length)
|
|
2667
|
-
break;
|
|
2668
|
-
dst[i + offset] = src[i];
|
|
2669
|
-
}
|
|
2670
|
-
return i;
|
|
2671
|
-
}
|
|
2672
|
-
function isInstance(obj, type) {
|
|
2673
|
-
return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
|
|
2674
|
-
}
|
|
2675
|
-
function numberIsNaN(obj) {
|
|
2676
|
-
return obj !== obj;
|
|
2677
|
-
}
|
|
2678
|
-
var hexSliceLookupTable = function() {
|
|
2679
|
-
var alphabet = "0123456789abcdef";
|
|
2680
|
-
var table = new Array(256);
|
|
2681
|
-
for (var i = 0; i < 16; ++i) {
|
|
2682
|
-
var i16 = i * 16;
|
|
2683
|
-
for (var j = 0; j < 16; ++j) {
|
|
2684
|
-
table[i16 + j] = alphabet[i] + alphabet[j];
|
|
2685
|
-
}
|
|
2686
|
-
}
|
|
2687
|
-
return table;
|
|
2688
|
-
}();
|
|
2689
|
-
})(buffer);
|
|
2690
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
2691
|
-
(function(module2, exports2) {
|
|
2692
|
-
var buffer$1 = buffer;
|
|
2693
|
-
var Buffer3 = buffer$1.Buffer;
|
|
2694
|
-
function copyProps(src, dst) {
|
|
2695
|
-
for (var key in src) {
|
|
2696
|
-
dst[key] = src[key];
|
|
2697
|
-
}
|
|
2698
|
-
}
|
|
2699
|
-
if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
|
|
2700
|
-
module2.exports = buffer$1;
|
|
2701
|
-
} else {
|
|
2702
|
-
copyProps(buffer$1, exports2);
|
|
2703
|
-
exports2.Buffer = SafeBuffer;
|
|
2704
|
-
}
|
|
2705
|
-
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
2706
|
-
return Buffer3(arg, encodingOrOffset, length);
|
|
2707
|
-
}
|
|
2708
|
-
SafeBuffer.prototype = Object.create(Buffer3.prototype);
|
|
2709
|
-
copyProps(Buffer3, SafeBuffer);
|
|
2710
|
-
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
2711
|
-
if (typeof arg === "number") {
|
|
2712
|
-
throw new TypeError("Argument must not be a number");
|
|
2713
|
-
}
|
|
2714
|
-
return Buffer3(arg, encodingOrOffset, length);
|
|
2715
|
-
};
|
|
2716
|
-
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
2717
|
-
if (typeof size !== "number") {
|
|
2718
|
-
throw new TypeError("Argument must be a number");
|
|
2719
|
-
}
|
|
2720
|
-
var buf = Buffer3(size);
|
|
2721
|
-
if (fill !== void 0) {
|
|
2722
|
-
if (typeof encoding === "string") {
|
|
2723
|
-
buf.fill(fill, encoding);
|
|
2724
|
-
} else {
|
|
2725
|
-
buf.fill(fill);
|
|
1155
|
+
continue;
|
|
1156
|
+
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension);
|
|
1157
|
+
if (currentType && currentType != type && !force) {
|
|
1158
|
+
throw new Error(`"${type} -> ${extension}" conflicts with "${currentType} -> ${extension}". Pass \`force=true\` to override this definition.`);
|
|
1159
|
+
}
|
|
1160
|
+
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension, type);
|
|
2726
1161
|
}
|
|
2727
|
-
} else {
|
|
2728
|
-
buf.fill(0);
|
|
2729
|
-
}
|
|
2730
|
-
return buf;
|
|
2731
|
-
};
|
|
2732
|
-
SafeBuffer.allocUnsafe = function(size) {
|
|
2733
|
-
if (typeof size !== "number") {
|
|
2734
|
-
throw new TypeError("Argument must be a number");
|
|
2735
|
-
}
|
|
2736
|
-
return Buffer3(size);
|
|
2737
|
-
};
|
|
2738
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
2739
|
-
if (typeof size !== "number") {
|
|
2740
|
-
throw new TypeError("Argument must be a number");
|
|
2741
1162
|
}
|
|
2742
|
-
return
|
|
2743
|
-
};
|
|
2744
|
-
})(safeBuffer, safeBuffer.exports);
|
|
2745
|
-
var safeBufferExports = safeBuffer.exports;
|
|
2746
|
-
var Buffer$2 = safeBufferExports.Buffer;
|
|
2747
|
-
function Hash$2(blockSize, finalSize) {
|
|
2748
|
-
this._block = Buffer$2.alloc(blockSize);
|
|
2749
|
-
this._finalSize = finalSize;
|
|
2750
|
-
this._blockSize = blockSize;
|
|
2751
|
-
this._len = 0;
|
|
2752
|
-
}
|
|
2753
|
-
Hash$2.prototype.update = function(data, enc) {
|
|
2754
|
-
if (typeof data === "string") {
|
|
2755
|
-
enc = enc || "utf8";
|
|
2756
|
-
data = Buffer$2.from(data, enc);
|
|
1163
|
+
return this;
|
|
2757
1164
|
}
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
accum += remainder;
|
|
2769
|
-
offset += remainder;
|
|
2770
|
-
if (accum % blockSize === 0) {
|
|
2771
|
-
this._update(block);
|
|
2772
|
-
}
|
|
1165
|
+
getType(path) {
|
|
1166
|
+
if (typeof path !== "string")
|
|
1167
|
+
return null;
|
|
1168
|
+
const last = path.replace(/^.*[/\\]/, "").toLowerCase();
|
|
1169
|
+
const ext = last.replace(/^.*\./, "").toLowerCase();
|
|
1170
|
+
const hasPath = last.length < path.length;
|
|
1171
|
+
const hasDot = ext.length < last.length - 1;
|
|
1172
|
+
if (!hasDot && hasPath)
|
|
1173
|
+
return null;
|
|
1174
|
+
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
2773
1175
|
}
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
this._block.fill(0, rem + 1);
|
|
2781
|
-
if (rem >= this._finalSize) {
|
|
2782
|
-
this._update(this._block);
|
|
2783
|
-
this._block.fill(0);
|
|
1176
|
+
getExtension(type) {
|
|
1177
|
+
var _a;
|
|
1178
|
+
if (typeof type !== "string")
|
|
1179
|
+
return null;
|
|
1180
|
+
type = (_a = type == null ? void 0 : type.split) == null ? void 0 : _a.call(type, ";")[0];
|
|
1181
|
+
return (type && __classPrivateFieldGet(this, _Mime_typeToExtension, "f").get(type.trim().toLowerCase())) ?? null;
|
|
2784
1182
|
}
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
var lowBits = (bits & 4294967295) >>> 0;
|
|
2790
|
-
var highBits = (bits - lowBits) / 4294967296;
|
|
2791
|
-
this._block.writeUInt32BE(highBits, this._blockSize - 8);
|
|
2792
|
-
this._block.writeUInt32BE(lowBits, this._blockSize - 4);
|
|
1183
|
+
getAllExtensions(type) {
|
|
1184
|
+
if (typeof type !== "string")
|
|
1185
|
+
return null;
|
|
1186
|
+
return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type.toLowerCase()) ?? null;
|
|
2793
1187
|
}
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
};
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
var Hash$1 = hash$1;
|
|
2804
|
-
var Buffer$1 = safeBufferExports.Buffer;
|
|
2805
|
-
var K$1 = [
|
|
2806
|
-
1518500249,
|
|
2807
|
-
1859775393,
|
|
2808
|
-
2400959708 | 0,
|
|
2809
|
-
3395469782 | 0
|
|
2810
|
-
];
|
|
2811
|
-
var W$1 = new Array(80);
|
|
2812
|
-
function Sha1() {
|
|
2813
|
-
this.init();
|
|
2814
|
-
this._w = W$1;
|
|
2815
|
-
Hash$1.call(this, 64, 56);
|
|
2816
|
-
}
|
|
2817
|
-
inherits$1(Sha1, Hash$1);
|
|
2818
|
-
Sha1.prototype.init = function() {
|
|
2819
|
-
this._a = 1732584193;
|
|
2820
|
-
this._b = 4023233417;
|
|
2821
|
-
this._c = 2562383102;
|
|
2822
|
-
this._d = 271733878;
|
|
2823
|
-
this._e = 3285377520;
|
|
2824
|
-
return this;
|
|
2825
|
-
};
|
|
2826
|
-
function rotl1(num) {
|
|
2827
|
-
return num << 1 | num >>> 31;
|
|
2828
|
-
}
|
|
2829
|
-
function rotl5(num) {
|
|
2830
|
-
return num << 5 | num >>> 27;
|
|
2831
|
-
}
|
|
2832
|
-
function rotl30(num) {
|
|
2833
|
-
return num << 30 | num >>> 2;
|
|
2834
|
-
}
|
|
2835
|
-
function ft(s, b, c, d) {
|
|
2836
|
-
if (s === 0)
|
|
2837
|
-
return b & c | ~b & d;
|
|
2838
|
-
if (s === 2)
|
|
2839
|
-
return b & c | b & d | c & d;
|
|
2840
|
-
return b ^ c ^ d;
|
|
2841
|
-
}
|
|
2842
|
-
Sha1.prototype._update = function(M) {
|
|
2843
|
-
var W2 = this._w;
|
|
2844
|
-
var a = this._a | 0;
|
|
2845
|
-
var b = this._b | 0;
|
|
2846
|
-
var c = this._c | 0;
|
|
2847
|
-
var d = this._d | 0;
|
|
2848
|
-
var e = this._e | 0;
|
|
2849
|
-
for (var i = 0; i < 16; ++i)
|
|
2850
|
-
W2[i] = M.readInt32BE(i * 4);
|
|
2851
|
-
for (; i < 80; ++i)
|
|
2852
|
-
W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
|
|
2853
|
-
for (var j = 0; j < 80; ++j) {
|
|
2854
|
-
var s = ~~(j / 20);
|
|
2855
|
-
var t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K$1[s] | 0;
|
|
2856
|
-
e = d;
|
|
2857
|
-
d = c;
|
|
2858
|
-
c = rotl30(b);
|
|
2859
|
-
b = a;
|
|
2860
|
-
a = t;
|
|
1188
|
+
_freeze() {
|
|
1189
|
+
this.define = () => {
|
|
1190
|
+
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
1191
|
+
};
|
|
1192
|
+
Object.freeze(this);
|
|
1193
|
+
for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) {
|
|
1194
|
+
Object.freeze(extensions);
|
|
1195
|
+
}
|
|
1196
|
+
return this;
|
|
2861
1197
|
}
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
};
|
|
2868
|
-
Sha1.prototype._hash = function() {
|
|
2869
|
-
var H = Buffer$1.allocUnsafe(20);
|
|
2870
|
-
H.writeInt32BE(this._a | 0, 0);
|
|
2871
|
-
H.writeInt32BE(this._b | 0, 4);
|
|
2872
|
-
H.writeInt32BE(this._c | 0, 8);
|
|
2873
|
-
H.writeInt32BE(this._d | 0, 12);
|
|
2874
|
-
H.writeInt32BE(this._e | 0, 16);
|
|
2875
|
-
return H;
|
|
2876
|
-
};
|
|
2877
|
-
var sha1 = Sha1;
|
|
2878
|
-
const Sha1$1 = /* @__PURE__ */ getDefaultExportFromCjs(sha1);
|
|
2879
|
-
var inherits = inherits_browserExports;
|
|
2880
|
-
var Hash = hash$1;
|
|
2881
|
-
var Buffer2 = safeBufferExports.Buffer;
|
|
2882
|
-
var K = [
|
|
2883
|
-
1116352408,
|
|
2884
|
-
1899447441,
|
|
2885
|
-
3049323471,
|
|
2886
|
-
3921009573,
|
|
2887
|
-
961987163,
|
|
2888
|
-
1508970993,
|
|
2889
|
-
2453635748,
|
|
2890
|
-
2870763221,
|
|
2891
|
-
3624381080,
|
|
2892
|
-
310598401,
|
|
2893
|
-
607225278,
|
|
2894
|
-
1426881987,
|
|
2895
|
-
1925078388,
|
|
2896
|
-
2162078206,
|
|
2897
|
-
2614888103,
|
|
2898
|
-
3248222580,
|
|
2899
|
-
3835390401,
|
|
2900
|
-
4022224774,
|
|
2901
|
-
264347078,
|
|
2902
|
-
604807628,
|
|
2903
|
-
770255983,
|
|
2904
|
-
1249150122,
|
|
2905
|
-
1555081692,
|
|
2906
|
-
1996064986,
|
|
2907
|
-
2554220882,
|
|
2908
|
-
2821834349,
|
|
2909
|
-
2952996808,
|
|
2910
|
-
3210313671,
|
|
2911
|
-
3336571891,
|
|
2912
|
-
3584528711,
|
|
2913
|
-
113926993,
|
|
2914
|
-
338241895,
|
|
2915
|
-
666307205,
|
|
2916
|
-
773529912,
|
|
2917
|
-
1294757372,
|
|
2918
|
-
1396182291,
|
|
2919
|
-
1695183700,
|
|
2920
|
-
1986661051,
|
|
2921
|
-
2177026350,
|
|
2922
|
-
2456956037,
|
|
2923
|
-
2730485921,
|
|
2924
|
-
2820302411,
|
|
2925
|
-
3259730800,
|
|
2926
|
-
3345764771,
|
|
2927
|
-
3516065817,
|
|
2928
|
-
3600352804,
|
|
2929
|
-
4094571909,
|
|
2930
|
-
275423344,
|
|
2931
|
-
430227734,
|
|
2932
|
-
506948616,
|
|
2933
|
-
659060556,
|
|
2934
|
-
883997877,
|
|
2935
|
-
958139571,
|
|
2936
|
-
1322822218,
|
|
2937
|
-
1537002063,
|
|
2938
|
-
1747873779,
|
|
2939
|
-
1955562222,
|
|
2940
|
-
2024104815,
|
|
2941
|
-
2227730452,
|
|
2942
|
-
2361852424,
|
|
2943
|
-
2428436474,
|
|
2944
|
-
2756734187,
|
|
2945
|
-
3204031479,
|
|
2946
|
-
3329325298
|
|
2947
|
-
];
|
|
2948
|
-
var W = new Array(64);
|
|
2949
|
-
function Sha256() {
|
|
2950
|
-
this.init();
|
|
2951
|
-
this._w = W;
|
|
2952
|
-
Hash.call(this, 64, 56);
|
|
2953
|
-
}
|
|
2954
|
-
inherits(Sha256, Hash);
|
|
2955
|
-
Sha256.prototype.init = function() {
|
|
2956
|
-
this._a = 1779033703;
|
|
2957
|
-
this._b = 3144134277;
|
|
2958
|
-
this._c = 1013904242;
|
|
2959
|
-
this._d = 2773480762;
|
|
2960
|
-
this._e = 1359893119;
|
|
2961
|
-
this._f = 2600822924;
|
|
2962
|
-
this._g = 528734635;
|
|
2963
|
-
this._h = 1541459225;
|
|
2964
|
-
return this;
|
|
2965
|
-
};
|
|
2966
|
-
function ch(x, y, z) {
|
|
2967
|
-
return z ^ x & (y ^ z);
|
|
2968
|
-
}
|
|
2969
|
-
function maj(x, y, z) {
|
|
2970
|
-
return x & y | z & (x | y);
|
|
2971
|
-
}
|
|
2972
|
-
function sigma0(x) {
|
|
2973
|
-
return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);
|
|
2974
|
-
}
|
|
2975
|
-
function sigma1(x) {
|
|
2976
|
-
return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);
|
|
2977
|
-
}
|
|
2978
|
-
function gamma0(x) {
|
|
2979
|
-
return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;
|
|
2980
|
-
}
|
|
2981
|
-
function gamma1(x) {
|
|
2982
|
-
return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10;
|
|
2983
|
-
}
|
|
2984
|
-
Sha256.prototype._update = function(M) {
|
|
2985
|
-
var W2 = this._w;
|
|
2986
|
-
var a = this._a | 0;
|
|
2987
|
-
var b = this._b | 0;
|
|
2988
|
-
var c = this._c | 0;
|
|
2989
|
-
var d = this._d | 0;
|
|
2990
|
-
var e = this._e | 0;
|
|
2991
|
-
var f = this._f | 0;
|
|
2992
|
-
var g = this._g | 0;
|
|
2993
|
-
var h = this._h | 0;
|
|
2994
|
-
for (var i = 0; i < 16; ++i)
|
|
2995
|
-
W2[i] = M.readInt32BE(i * 4);
|
|
2996
|
-
for (; i < 64; ++i)
|
|
2997
|
-
W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;
|
|
2998
|
-
for (var j = 0; j < 64; ++j) {
|
|
2999
|
-
var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W2[j] | 0;
|
|
3000
|
-
var T2 = sigma0(a) + maj(a, b, c) | 0;
|
|
3001
|
-
h = g;
|
|
3002
|
-
g = f;
|
|
3003
|
-
f = e;
|
|
3004
|
-
e = d + T1 | 0;
|
|
3005
|
-
d = c;
|
|
3006
|
-
c = b;
|
|
3007
|
-
b = a;
|
|
3008
|
-
a = T1 + T2 | 0;
|
|
1198
|
+
_getTestState() {
|
|
1199
|
+
return {
|
|
1200
|
+
types: __classPrivateFieldGet(this, _Mime_extensionToType, "f"),
|
|
1201
|
+
extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, "f")
|
|
1202
|
+
};
|
|
3009
1203
|
}
|
|
3010
|
-
this._a = a + this._a | 0;
|
|
3011
|
-
this._b = b + this._b | 0;
|
|
3012
|
-
this._c = c + this._c | 0;
|
|
3013
|
-
this._d = d + this._d | 0;
|
|
3014
|
-
this._e = e + this._e | 0;
|
|
3015
|
-
this._f = f + this._f | 0;
|
|
3016
|
-
this._g = g + this._g | 0;
|
|
3017
|
-
this._h = h + this._h | 0;
|
|
3018
|
-
};
|
|
3019
|
-
Sha256.prototype._hash = function() {
|
|
3020
|
-
var H = Buffer2.allocUnsafe(32);
|
|
3021
|
-
H.writeInt32BE(this._a, 0);
|
|
3022
|
-
H.writeInt32BE(this._b, 4);
|
|
3023
|
-
H.writeInt32BE(this._c, 8);
|
|
3024
|
-
H.writeInt32BE(this._d, 12);
|
|
3025
|
-
H.writeInt32BE(this._e, 16);
|
|
3026
|
-
H.writeInt32BE(this._f, 20);
|
|
3027
|
-
H.writeInt32BE(this._g, 24);
|
|
3028
|
-
H.writeInt32BE(this._h, 28);
|
|
3029
|
-
return H;
|
|
3030
|
-
};
|
|
3031
|
-
var sha256 = Sha256;
|
|
3032
|
-
const Sha256$1 = /* @__PURE__ */ getDefaultExportFromCjs(sha256);
|
|
3033
|
-
const FileSystemError = new Error("File system not available.");
|
|
3034
|
-
function writeFile(path, name, stream) {
|
|
3035
|
-
throw FileSystemError;
|
|
3036
|
-
}
|
|
3037
|
-
function readFile(path) {
|
|
3038
|
-
throw FileSystemError;
|
|
3039
1204
|
}
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
}
|
|
3043
|
-
const getFile = async (file) => {
|
|
3044
|
-
return readFile();
|
|
3045
|
-
};
|
|
3046
|
-
const hashAlgorithms = {
|
|
3047
|
-
sha1: Sha1$1,
|
|
3048
|
-
sha256: Sha256$1
|
|
3049
|
-
};
|
|
3050
|
-
const hash = (data, algorithm = "sha1") => {
|
|
3051
|
-
if (!["sha1", "sha256"].includes(algorithm)) {
|
|
3052
|
-
throw new Error("Hashing algorithm not supported: Available: sha1, sha256");
|
|
3053
|
-
}
|
|
3054
|
-
const Algorithm = hashAlgorithms[algorithm];
|
|
3055
|
-
const sha = new Algorithm();
|
|
3056
|
-
return sha.update(data).digest("base64");
|
|
3057
|
-
};
|
|
1205
|
+
_Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
|
|
1206
|
+
const mime = new Mime(types)._freeze();
|
|
3058
1207
|
function validateOperations(operations) {
|
|
3059
1208
|
const errors = [];
|
|
3060
1209
|
const scopes = Object.keys(operations);
|
|
@@ -3124,8 +1273,7 @@ function garbageCollect(sortedOperations) {
|
|
|
3124
1273
|
function addUndo(sortedOperations) {
|
|
3125
1274
|
const operationsCopy = [...sortedOperations];
|
|
3126
1275
|
const latestOperation = operationsCopy[operationsCopy.length - 1];
|
|
3127
|
-
if (!latestOperation)
|
|
3128
|
-
return operationsCopy;
|
|
1276
|
+
if (!latestOperation) return operationsCopy;
|
|
3129
1277
|
if (latestOperation.type === "NOOP") {
|
|
3130
1278
|
operationsCopy.push({
|
|
3131
1279
|
...latestOperation,
|
|
@@ -3404,6 +1552,13 @@ function filterDocumentOperationsResultingState(documentOperations) {
|
|
|
3404
1552
|
{}
|
|
3405
1553
|
);
|
|
3406
1554
|
}
|
|
1555
|
+
function diffOperations(clearedOperationsA, clearedOperationsB) {
|
|
1556
|
+
return clearedOperationsA.filter(
|
|
1557
|
+
(operationA) => !clearedOperationsB.some(
|
|
1558
|
+
(operationB) => operationA.index === operationB.index
|
|
1559
|
+
)
|
|
1560
|
+
);
|
|
1561
|
+
}
|
|
3407
1562
|
const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3408
1563
|
__proto__: null,
|
|
3409
1564
|
IntegrityIssueSubType,
|
|
@@ -3412,6 +1567,7 @@ const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
|
|
|
3412
1567
|
attachBranch,
|
|
3413
1568
|
checkCleanedOperationsIntegrity,
|
|
3414
1569
|
checkOperationsIntegrity,
|
|
1570
|
+
diffOperations,
|
|
3415
1571
|
filterDocumentOperationsResultingState,
|
|
3416
1572
|
filterDuplicatedOperations,
|
|
3417
1573
|
garbageCollect,
|
|
@@ -3542,9 +1698,9 @@ function getFileAttributes(file) {
|
|
|
3542
1698
|
return { extension, fileName };
|
|
3543
1699
|
}
|
|
3544
1700
|
async function getRemoteFile(url) {
|
|
3545
|
-
const { buffer
|
|
1701
|
+
const { buffer, mimeType = "application/octet-stream" } = await fetchFile();
|
|
3546
1702
|
const attributes = getFileAttributes(url);
|
|
3547
|
-
const data =
|
|
1703
|
+
const data = buffer.toString("base64");
|
|
3548
1704
|
return {
|
|
3549
1705
|
data,
|
|
3550
1706
|
hash: hash(data),
|
|
@@ -3553,12 +1709,147 @@ async function getRemoteFile(url) {
|
|
|
3553
1709
|
};
|
|
3554
1710
|
}
|
|
3555
1711
|
async function getLocalFile(path) {
|
|
3556
|
-
const
|
|
1712
|
+
const buffer = await getFile();
|
|
3557
1713
|
const mimeType = mime.getType(path) || "application/octet-stream";
|
|
3558
1714
|
const attributes = getFileAttributes(path);
|
|
3559
|
-
const data =
|
|
1715
|
+
const data = buffer.toString("base64");
|
|
3560
1716
|
return { data, hash: hash(data), mimeType, ...attributes };
|
|
3561
1717
|
}
|
|
1718
|
+
function setNameOperation(document, name) {
|
|
1719
|
+
return { ...document, name };
|
|
1720
|
+
}
|
|
1721
|
+
function undoOperation(document, action, skip) {
|
|
1722
|
+
const { scope, input } = action;
|
|
1723
|
+
const defaultResult = {
|
|
1724
|
+
document,
|
|
1725
|
+
action,
|
|
1726
|
+
skip,
|
|
1727
|
+
reuseLastOperationIndex: false
|
|
1728
|
+
};
|
|
1729
|
+
return mutative.create(defaultResult, (draft) => {
|
|
1730
|
+
const operations = [...document.operations[scope]];
|
|
1731
|
+
const sortedOperations = sortOperations$1(operations);
|
|
1732
|
+
draft.action = noop(scope);
|
|
1733
|
+
const lastOperation = sortedOperations.at(-1);
|
|
1734
|
+
let nextIndex = (lastOperation == null ? void 0 : lastOperation.index) ?? -1;
|
|
1735
|
+
const isNewNoop = (lastOperation == null ? void 0 : lastOperation.type) !== "NOOP";
|
|
1736
|
+
if (isNewNoop) {
|
|
1737
|
+
nextIndex = nextIndex + 1;
|
|
1738
|
+
} else {
|
|
1739
|
+
draft.reuseLastOperationIndex = true;
|
|
1740
|
+
}
|
|
1741
|
+
const nextOperationHistory = isNewNoop ? [...sortedOperations, { index: nextIndex, skip: 0 }] : sortedOperations;
|
|
1742
|
+
draft.skip = nextSkipNumber(nextOperationHistory);
|
|
1743
|
+
if (lastOperation && draft.skip > lastOperation.skip + 1) {
|
|
1744
|
+
draft.skip = draft.skip + 1;
|
|
1745
|
+
}
|
|
1746
|
+
if (draft.skip < 0) {
|
|
1747
|
+
throw new Error(
|
|
1748
|
+
`Cannot undo: you can't undo more operations than the ones in the scope history`
|
|
1749
|
+
);
|
|
1750
|
+
}
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
function redoOperation(document, action, skip) {
|
|
1754
|
+
const { scope, input } = action;
|
|
1755
|
+
const defaultResult = {
|
|
1756
|
+
document,
|
|
1757
|
+
action,
|
|
1758
|
+
skip,
|
|
1759
|
+
reuseLastOperationIndex: false
|
|
1760
|
+
};
|
|
1761
|
+
return mutative.create(defaultResult, (draft) => {
|
|
1762
|
+
if (draft.skip > 0) {
|
|
1763
|
+
throw new Error(
|
|
1764
|
+
`Cannot redo: skip value from reducer cannot be used with REDO action`
|
|
1765
|
+
);
|
|
1766
|
+
}
|
|
1767
|
+
if (input > 1) {
|
|
1768
|
+
throw new Error(
|
|
1769
|
+
`Cannot redo: you can only redo one operation at a time`
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
if (input < 1) {
|
|
1773
|
+
throw new Error(`Invalid REDO action: invalid redo input value`);
|
|
1774
|
+
}
|
|
1775
|
+
if (draft.document.clipboard.length < 1) {
|
|
1776
|
+
throw new Error(`Cannot redo: no operations in the clipboard`);
|
|
1777
|
+
}
|
|
1778
|
+
const operationIndex = draft.document.clipboard.findLastIndex(
|
|
1779
|
+
(op) => op.scope === scope
|
|
1780
|
+
);
|
|
1781
|
+
if (operationIndex < 0) {
|
|
1782
|
+
throw new Error(
|
|
1783
|
+
`Cannot redo: no operations in clipboard for scope "${scope}"`
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
const operation = draft.document.clipboard.splice(operationIndex, 1)[0];
|
|
1787
|
+
draft.action = mutative.castDraft({
|
|
1788
|
+
type: operation.type,
|
|
1789
|
+
scope: operation.scope,
|
|
1790
|
+
input: operation.input
|
|
1791
|
+
});
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
function pruneOperation(document, action, wrappedReducer) {
|
|
1795
|
+
const { scope } = action;
|
|
1796
|
+
const operations = document.operations[scope];
|
|
1797
|
+
let {
|
|
1798
|
+
input: { start, end }
|
|
1799
|
+
} = action;
|
|
1800
|
+
start = start || 0;
|
|
1801
|
+
end = end || operations.length;
|
|
1802
|
+
const actionsToPrune = operations.slice(start, end);
|
|
1803
|
+
const actionsToKeepStart = operations.slice(0, start);
|
|
1804
|
+
const actionsToKeepEnd = operations.slice(end);
|
|
1805
|
+
const newDocument = replayOperations(
|
|
1806
|
+
document.initialState,
|
|
1807
|
+
{
|
|
1808
|
+
...document.operations,
|
|
1809
|
+
[scope]: actionsToKeepStart.concat(actionsToPrune)
|
|
1810
|
+
},
|
|
1811
|
+
wrappedReducer
|
|
1812
|
+
);
|
|
1813
|
+
const { name, state: newState } = newDocument;
|
|
1814
|
+
const loadStateIndex = actionsToKeepStart.length;
|
|
1815
|
+
const loadStateTimestamp = actionsToKeepStart.length ? actionsToKeepStart[actionsToKeepStart.length - 1].timestamp : actionsToKeepEnd.length ? actionsToKeepEnd[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
1816
|
+
return replayOperations(
|
|
1817
|
+
document.initialState,
|
|
1818
|
+
{
|
|
1819
|
+
...document.operations,
|
|
1820
|
+
[scope]: [
|
|
1821
|
+
...actionsToKeepStart,
|
|
1822
|
+
{
|
|
1823
|
+
...loadState(
|
|
1824
|
+
{ name, state: newState },
|
|
1825
|
+
actionsToPrune.length
|
|
1826
|
+
),
|
|
1827
|
+
timestamp: loadStateTimestamp,
|
|
1828
|
+
index: loadStateIndex,
|
|
1829
|
+
hash: hashDocument({ state: newState }, "global")
|
|
1830
|
+
},
|
|
1831
|
+
...actionsToKeepEnd.map((action2, index) => ({
|
|
1832
|
+
...action2,
|
|
1833
|
+
index: loadStateIndex + index + 1
|
|
1834
|
+
}))
|
|
1835
|
+
]
|
|
1836
|
+
},
|
|
1837
|
+
wrappedReducer
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
function loadStateOperation(oldDocument, newDocument) {
|
|
1841
|
+
return {
|
|
1842
|
+
...oldDocument,
|
|
1843
|
+
name: newDocument.name,
|
|
1844
|
+
state: newDocument.state ?? { global: {}, local: {} }
|
|
1845
|
+
};
|
|
1846
|
+
}
|
|
1847
|
+
const SET_NAME = "SET_NAME";
|
|
1848
|
+
const UNDO = "UNDO";
|
|
1849
|
+
const REDO = "REDO";
|
|
1850
|
+
const PRUNE = "PRUNE";
|
|
1851
|
+
const LOAD_STATE = "LOAD_STATE";
|
|
1852
|
+
const NOOP = "NOOP";
|
|
3562
1853
|
function getNextRevision(document, action) {
|
|
3563
1854
|
let latestOperation;
|
|
3564
1855
|
if ("index" in action) {
|
|
@@ -3578,7 +1869,7 @@ function updateHeader(document, action) {
|
|
|
3578
1869
|
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
3579
1870
|
};
|
|
3580
1871
|
}
|
|
3581
|
-
function updateOperations(document, action, skip = 0) {
|
|
1872
|
+
function updateOperations(document, action, skip = 0, reuseLastOperationIndex = false) {
|
|
3582
1873
|
if ([UNDO, REDO, PRUNE].includes(action.type)) {
|
|
3583
1874
|
return document;
|
|
3584
1875
|
}
|
|
@@ -3586,7 +1877,8 @@ function updateOperations(document, action, skip = 0) {
|
|
|
3586
1877
|
const operations = document.operations[scope].slice();
|
|
3587
1878
|
let operationId;
|
|
3588
1879
|
const latestOperation = operations.at(-1);
|
|
3589
|
-
|
|
1880
|
+
const lastOperationIndex = (latestOperation == null ? void 0 : latestOperation.index) ?? -1;
|
|
1881
|
+
let nextIndex = reuseLastOperationIndex ? lastOperationIndex : lastOperationIndex + 1;
|
|
3590
1882
|
if ("index" in action) {
|
|
3591
1883
|
if (action.index - skip > nextIndex) {
|
|
3592
1884
|
throw new Error(
|
|
@@ -3596,7 +1888,7 @@ function updateOperations(document, action, skip = 0) {
|
|
|
3596
1888
|
nextIndex = action.index;
|
|
3597
1889
|
operationId = action.id;
|
|
3598
1890
|
} else {
|
|
3599
|
-
operationId = v4();
|
|
1891
|
+
operationId = "id" in action ? action.id : v4();
|
|
3600
1892
|
}
|
|
3601
1893
|
operations.push({
|
|
3602
1894
|
...action,
|
|
@@ -3613,8 +1905,13 @@ function updateOperations(document, action, skip = 0) {
|
|
|
3613
1905
|
operations: { ...document.operations, [scope]: operations }
|
|
3614
1906
|
};
|
|
3615
1907
|
}
|
|
3616
|
-
function updateDocument(document, action, skip = 0) {
|
|
3617
|
-
let newDocument = updateOperations(
|
|
1908
|
+
function updateDocument(document, action, skip = 0, reuseLastOperationIndex = false) {
|
|
1909
|
+
let newDocument = updateOperations(
|
|
1910
|
+
document,
|
|
1911
|
+
action,
|
|
1912
|
+
skip,
|
|
1913
|
+
reuseLastOperationIndex
|
|
1914
|
+
);
|
|
3618
1915
|
newDocument = updateHeader(newDocument, action);
|
|
3619
1916
|
return newDocument;
|
|
3620
1917
|
}
|
|
@@ -3638,14 +1935,13 @@ function processUndoRedo(document, action, skip) {
|
|
|
3638
1935
|
case REDO:
|
|
3639
1936
|
return redoOperation(document, action, skip);
|
|
3640
1937
|
default:
|
|
3641
|
-
return { document, action, skip };
|
|
1938
|
+
return { document, action, skip, reuseLastOperationIndex: false };
|
|
3642
1939
|
}
|
|
3643
1940
|
}
|
|
3644
1941
|
function processSkipOperation(document, action, customReducer, skipValue, reuseOperationResultingState = false, resultingStateParser = parseResultingState) {
|
|
3645
1942
|
const scope = action.scope;
|
|
3646
1943
|
const latestOperation = document.operations[scope].at(-1);
|
|
3647
|
-
if (!latestOperation)
|
|
3648
|
-
return document;
|
|
1944
|
+
if (!latestOperation) return document;
|
|
3649
1945
|
const documentOperations = garbageCollectDocumentOperations(
|
|
3650
1946
|
{
|
|
3651
1947
|
...document.operations,
|
|
@@ -3689,6 +1985,37 @@ function processSkipOperation(document, action, customReducer, skipValue, reuseO
|
|
|
3689
1985
|
})
|
|
3690
1986
|
};
|
|
3691
1987
|
}
|
|
1988
|
+
function processUndoOperation(document, scope, customReducer, reuseOperationResultingState = false, resultingStateParser = parseResultingState) {
|
|
1989
|
+
const operations = [...document.operations[scope]];
|
|
1990
|
+
const sortedOperations = sortOperations$1(operations);
|
|
1991
|
+
sortedOperations.pop();
|
|
1992
|
+
const documentOperations = garbageCollectDocumentOperations(
|
|
1993
|
+
{ ...document.operations }
|
|
1994
|
+
);
|
|
1995
|
+
const clearedOperations = [...documentOperations[scope]];
|
|
1996
|
+
const diff = diffOperations(
|
|
1997
|
+
garbageCollect(sortedOperations),
|
|
1998
|
+
clearedOperations
|
|
1999
|
+
);
|
|
2000
|
+
const doc = replayOperations(
|
|
2001
|
+
document.initialState,
|
|
2002
|
+
documentOperations,
|
|
2003
|
+
customReducer,
|
|
2004
|
+
void 0,
|
|
2005
|
+
void 0,
|
|
2006
|
+
void 0,
|
|
2007
|
+
void 0,
|
|
2008
|
+
{
|
|
2009
|
+
reuseHash: true,
|
|
2010
|
+
reuseOperationResultingState,
|
|
2011
|
+
operationResultingStateParser: resultingStateParser
|
|
2012
|
+
}
|
|
2013
|
+
);
|
|
2014
|
+
const clipboard = sortOperations$1(
|
|
2015
|
+
[...document.clipboard, ...diff].filter((op) => op.type !== "NOOP")
|
|
2016
|
+
).reverse();
|
|
2017
|
+
return { ...doc, clipboard };
|
|
2018
|
+
}
|
|
3692
2019
|
function baseReducer(document, action, customReducer, dispatch, options = {}) {
|
|
3693
2020
|
const {
|
|
3694
2021
|
skip,
|
|
@@ -3697,14 +2024,46 @@ function baseReducer(document, action, customReducer, dispatch, options = {}) {
|
|
|
3697
2024
|
reuseOperationResultingState = false,
|
|
3698
2025
|
operationResultingStateParser
|
|
3699
2026
|
} = options;
|
|
3700
|
-
|
|
3701
|
-
|
|
2027
|
+
let _action = { ...action };
|
|
2028
|
+
let skipValue = skip || 0;
|
|
3702
2029
|
let newDocument = { ...document };
|
|
2030
|
+
let reuseLastOperationIndex = false;
|
|
3703
2031
|
const shouldProcessSkipOperation = !ignoreSkipOperations && (skipValue > 0 || "index" in _action && _action.skip > 0);
|
|
2032
|
+
if (isUndoRedo(_action)) {
|
|
2033
|
+
const {
|
|
2034
|
+
skip: calculatedSkip,
|
|
2035
|
+
action: transformedAction,
|
|
2036
|
+
document: processedDocument,
|
|
2037
|
+
reuseLastOperationIndex: reuseIndex
|
|
2038
|
+
} = processUndoRedo(document, _action, skipValue);
|
|
2039
|
+
_action = transformedAction;
|
|
2040
|
+
skipValue = calculatedSkip;
|
|
2041
|
+
newDocument = processedDocument;
|
|
2042
|
+
reuseLastOperationIndex = reuseIndex;
|
|
2043
|
+
} else {
|
|
2044
|
+
newDocument = {
|
|
2045
|
+
...newDocument,
|
|
2046
|
+
clipboard: []
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
3704
2049
|
if (isBaseAction(_action)) {
|
|
3705
2050
|
newDocument = _baseReducer(newDocument, _action, customReducer);
|
|
3706
2051
|
}
|
|
3707
|
-
newDocument = updateDocument(
|
|
2052
|
+
newDocument = updateDocument(
|
|
2053
|
+
newDocument,
|
|
2054
|
+
_action,
|
|
2055
|
+
skipValue,
|
|
2056
|
+
reuseLastOperationIndex
|
|
2057
|
+
);
|
|
2058
|
+
const isUndoAction = isUndo(action);
|
|
2059
|
+
if (isUndoAction) {
|
|
2060
|
+
const result = processUndoOperation(
|
|
2061
|
+
newDocument,
|
|
2062
|
+
action.scope,
|
|
2063
|
+
customReducer
|
|
2064
|
+
);
|
|
2065
|
+
return result;
|
|
2066
|
+
}
|
|
3708
2067
|
if (shouldProcessSkipOperation) {
|
|
3709
2068
|
newDocument = processSkipOperation(
|
|
3710
2069
|
newDocument,
|
|
@@ -3844,6 +2203,9 @@ function isNoopOperation(op) {
|
|
|
3844
2203
|
function isUndoRedo(action) {
|
|
3845
2204
|
return [UNDO, REDO].includes(action.type);
|
|
3846
2205
|
}
|
|
2206
|
+
function isUndo(action) {
|
|
2207
|
+
return action.type === UNDO;
|
|
2208
|
+
}
|
|
3847
2209
|
function isBaseAction(action) {
|
|
3848
2210
|
return [SET_NAME, UNDO, REDO, PRUNE, LOAD_STATE].includes(action.type);
|
|
3849
2211
|
}
|
|
@@ -3939,23 +2301,6 @@ function mapSkippedOperations(operations, skippedHeadOperations) {
|
|
|
3939
2301
|
}
|
|
3940
2302
|
return scopeOpsWithIgnore.reverse();
|
|
3941
2303
|
}
|
|
3942
|
-
function calculateSkipsLeft(operations, currentIndex, skip) {
|
|
3943
|
-
const sortedOperations = operations.slice().sort((a, b) => a.skip - b.skip).sort((a, b) => a.index - b.index);
|
|
3944
|
-
let skipsLeft = skip;
|
|
3945
|
-
let skipsToPerform = 0;
|
|
3946
|
-
let lastIndex = currentIndex;
|
|
3947
|
-
for (const operation of sortedOperations.reverse()) {
|
|
3948
|
-
const distance = lastIndex - operation.index;
|
|
3949
|
-
skipsLeft = skipsLeft - distance;
|
|
3950
|
-
if (skipsLeft > -1) {
|
|
3951
|
-
skipsToPerform++;
|
|
3952
|
-
lastIndex = operation.index;
|
|
3953
|
-
} else {
|
|
3954
|
-
break;
|
|
3955
|
-
}
|
|
3956
|
-
}
|
|
3957
|
-
return skipsToPerform;
|
|
3958
|
-
}
|
|
3959
2304
|
function sortOperations(operations) {
|
|
3960
2305
|
return Object.values(operations).flatMap((array) => array).sort(
|
|
3961
2306
|
(a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
|
|
@@ -4322,9 +2667,13 @@ function applyMixins(derivedCtor, constructors) {
|
|
|
4322
2667
|
}
|
|
4323
2668
|
exports.BaseActions = BaseActions;
|
|
4324
2669
|
exports.BaseDocument = BaseDocument;
|
|
2670
|
+
exports.ab2hex = ab2hex;
|
|
4325
2671
|
exports.applyMixins = applyMixins;
|
|
4326
2672
|
exports.baseReducer = baseReducer;
|
|
4327
|
-
exports.
|
|
2673
|
+
exports.buildOperationSignature = buildOperationSignature;
|
|
2674
|
+
exports.buildOperationSignatureMessage = buildOperationSignatureMessage;
|
|
2675
|
+
exports.buildOperationSignatureParams = buildOperationSignatureParams;
|
|
2676
|
+
exports.buildSignedOperation = buildSignedOperation;
|
|
4328
2677
|
exports.createAction = createAction;
|
|
4329
2678
|
exports.createDocument = createDocument;
|
|
4330
2679
|
exports.createExtendedState = createExtendedState;
|
|
@@ -4334,11 +2683,14 @@ exports.createZip = createZip;
|
|
|
4334
2683
|
exports.documentHelpers = documentHelpers;
|
|
4335
2684
|
exports.getLocalFile = getLocalFile;
|
|
4336
2685
|
exports.getRemoteFile = getRemoteFile;
|
|
2686
|
+
exports.getUnixTimestamp = getUnixTimestamp;
|
|
4337
2687
|
exports.hashDocument = hashDocument;
|
|
4338
2688
|
exports.hashKey = hashKey;
|
|
2689
|
+
exports.hex2ab = hex2ab;
|
|
4339
2690
|
exports.isBaseAction = isBaseAction;
|
|
4340
2691
|
exports.isNoopOperation = isNoopOperation;
|
|
4341
2692
|
exports.isSameDocument = isSameDocument;
|
|
2693
|
+
exports.isUndo = isUndo;
|
|
4342
2694
|
exports.isUndoRedo = isUndoRedo;
|
|
4343
2695
|
exports.loadFromFile = loadFromFile;
|
|
4344
2696
|
exports.loadFromInput = loadFromInput;
|
|
@@ -4356,5 +2708,6 @@ exports.sortOperations = sortOperations;
|
|
|
4356
2708
|
exports.updateDocument = updateDocument;
|
|
4357
2709
|
exports.updateHeader = updateHeader;
|
|
4358
2710
|
exports.validateOperations = validateOperations;
|
|
2711
|
+
exports.verifyOperationSignature = verifyOperationSignature;
|
|
4359
2712
|
exports.zod = zod;
|
|
4360
|
-
//# sourceMappingURL=object-
|
|
2713
|
+
//# sourceMappingURL=object-CCclzskm.js.map
|