@coherentglobal/spark-execute-sdk 0.4.15 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -4
- package/dist/browser.js +1638 -484
- package/package.json +5 -3
- package/src/browser.js +105 -35
- package/src/node.js +27 -5
- package/types/browser.d.ts +5 -5
- package/types/browser.d.ts.map +1 -1
package/dist/browser.js
CHANGED
|
@@ -640,258 +640,232 @@ exports.WasmRunner = void 0;
|
|
|
640
640
|
/* eslint-disable no-underscore-dangle */
|
|
641
641
|
/* eslint-disable import/prefer-default-export */
|
|
642
642
|
var cuid_1 = __importDefault(require("cuid"));
|
|
643
|
-
var jszip_1 = __importDefault(require("jszip"));
|
|
644
643
|
var path_1 = __importDefault(require("path"));
|
|
645
644
|
var utils = __importStar(require("./utils"));
|
|
646
645
|
var logger_1 = __importStar(require("./browser/logger"));
|
|
647
646
|
var template_1 = __importDefault(require("./browser/template"));
|
|
648
647
|
var is_buffer_1 = __importDefault(require("is-buffer"));
|
|
649
648
|
var error_1 = __importDefault(require("./error"));
|
|
649
|
+
var unzipit = __importStar(require("unzipit"));
|
|
650
650
|
var unzipFile = function unzipFile(zipURL) {
|
|
651
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
652
|
-
|
|
651
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
652
|
+
var js, jsPath, wasm, wasmPath, dataPath, data, metadata, metadataPath, _yield$unzipit$unzip, entries, response;
|
|
653
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
653
654
|
while (1) {
|
|
654
|
-
switch (
|
|
655
|
+
switch (_context.prev = _context.next) {
|
|
655
656
|
case 0:
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
metadata = _context.sent;
|
|
749
|
-
response.metadata = {
|
|
750
|
-
url: URL.createObjectURL(new Blob([metadata], {
|
|
751
|
-
type: "application/json"
|
|
752
|
-
})),
|
|
753
|
-
path: metadataPath
|
|
754
|
-
};
|
|
755
|
-
case 22:
|
|
756
|
-
resolve(response);
|
|
757
|
-
case 23:
|
|
758
|
-
case "end":
|
|
759
|
-
return _context.stop();
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}, _callee);
|
|
763
|
-
}));
|
|
764
|
-
});
|
|
765
|
-
case 5:
|
|
766
|
-
case "end":
|
|
767
|
-
return _context2.stop();
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}, _callee2);
|
|
771
|
-
}));
|
|
772
|
-
});
|
|
773
|
-
}));
|
|
774
|
-
case 1:
|
|
657
|
+
_context.prev = 0;
|
|
658
|
+
_context.next = 3;
|
|
659
|
+
return unzipit.unzip(zipURL);
|
|
660
|
+
case 3:
|
|
661
|
+
_yield$unzipit$unzip = _context.sent;
|
|
662
|
+
entries = _yield$unzipit$unzip.entries;
|
|
663
|
+
Object.keys(entries).forEach(function (entry) {
|
|
664
|
+
if (entry.indexOf("__MACOSX") === -1) {
|
|
665
|
+
if (path_1["default"].extname(entry) === ".js") {
|
|
666
|
+
jsPath = entry;
|
|
667
|
+
}
|
|
668
|
+
if (path_1["default"].extname(entry) === ".wasm") {
|
|
669
|
+
wasmPath = entry;
|
|
670
|
+
}
|
|
671
|
+
if (path_1["default"].extname(entry) === ".data") {
|
|
672
|
+
dataPath = entry;
|
|
673
|
+
}
|
|
674
|
+
if (entry.toLowerCase().indexOf("_static.json") > -1) {
|
|
675
|
+
metadataPath = entry;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
if (jsPath) {
|
|
680
|
+
_context.next = 8;
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
throw new Error("Missing runtime file");
|
|
684
|
+
case 8:
|
|
685
|
+
if (wasmPath) {
|
|
686
|
+
_context.next = 10;
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
throw new Error("Missing engine file");
|
|
690
|
+
case 10:
|
|
691
|
+
_context.next = 12;
|
|
692
|
+
return entries[jsPath].text();
|
|
693
|
+
case 12:
|
|
694
|
+
js = _context.sent;
|
|
695
|
+
_context.next = 15;
|
|
696
|
+
return entries[wasmPath].arrayBuffer();
|
|
697
|
+
case 15:
|
|
698
|
+
wasm = _context.sent;
|
|
699
|
+
response = {
|
|
700
|
+
js: {
|
|
701
|
+
url: URL.createObjectURL(new Blob([js], {
|
|
702
|
+
type: "text/javascript"
|
|
703
|
+
})),
|
|
704
|
+
path: jsPath
|
|
705
|
+
},
|
|
706
|
+
wasm: {
|
|
707
|
+
url: URL.createObjectURL(new Blob([wasm], {
|
|
708
|
+
type: "application/wasm"
|
|
709
|
+
})),
|
|
710
|
+
path: wasmPath
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
if (!dataPath) {
|
|
714
|
+
_context.next = 22;
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
_context.next = 20;
|
|
718
|
+
return entries[dataPath].arrayBuffer();
|
|
719
|
+
case 20:
|
|
720
|
+
data = _context.sent;
|
|
721
|
+
response.data = {
|
|
722
|
+
url: URL.createObjectURL(new Blob([data], {
|
|
723
|
+
type: "application/octet-stream"
|
|
724
|
+
})),
|
|
725
|
+
path: dataPath
|
|
726
|
+
};
|
|
727
|
+
case 22:
|
|
728
|
+
if (!metadataPath) {
|
|
729
|
+
_context.next = 27;
|
|
730
|
+
break;
|
|
731
|
+
}
|
|
732
|
+
_context.next = 25;
|
|
733
|
+
return entries[metadataPath].text();
|
|
734
|
+
case 25:
|
|
735
|
+
metadata = _context.sent;
|
|
736
|
+
response.metadata = {
|
|
737
|
+
url: URL.createObjectURL(new Blob([metadata], {
|
|
738
|
+
type: "application/json"
|
|
739
|
+
})),
|
|
740
|
+
path: metadataPath
|
|
741
|
+
};
|
|
742
|
+
case 27:
|
|
743
|
+
return _context.abrupt("return", response);
|
|
744
|
+
case 30:
|
|
745
|
+
_context.prev = 30;
|
|
746
|
+
_context.t0 = _context["catch"](0);
|
|
747
|
+
throw new Error(_context.t0);
|
|
748
|
+
case 33:
|
|
775
749
|
case "end":
|
|
776
|
-
return
|
|
750
|
+
return _context.stop();
|
|
777
751
|
}
|
|
778
752
|
}
|
|
779
|
-
},
|
|
753
|
+
}, _callee, null, [[0, 30]]);
|
|
780
754
|
}));
|
|
781
755
|
};
|
|
782
756
|
var unzipBuffer = function unzipBuffer(model) {
|
|
783
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
784
|
-
var js, jsPath, wasm, wasmPath, dataPath, data, metadata, metadataPath, modelToBlob,
|
|
785
|
-
return _regenerator["default"].wrap(function
|
|
757
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
758
|
+
var js, jsPath, wasm, wasmPath, dataPath, data, metadata, metadataPath, modelToBlob, _yield$unzipit$unzip2, entries, response;
|
|
759
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
786
760
|
while (1) {
|
|
787
|
-
switch (
|
|
761
|
+
switch (_context2.prev = _context2.next) {
|
|
788
762
|
case 0:
|
|
789
|
-
modelToBlob = new Blob([new Uint8Array(model)]);
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
return
|
|
793
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
794
|
-
var response;
|
|
795
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
796
|
-
while (1) {
|
|
797
|
-
switch (_context4.prev = _context4.next) {
|
|
798
|
-
case 0:
|
|
799
|
-
Object.keys(zipped.files).forEach(function (entry) {
|
|
800
|
-
if (entry.indexOf("__MACOSX") === -1) {
|
|
801
|
-
if (path_1["default"].extname(entry) === ".js") {
|
|
802
|
-
jsPath = entry;
|
|
803
|
-
}
|
|
804
|
-
if (path_1["default"].extname(entry) === ".wasm") {
|
|
805
|
-
wasmPath = entry;
|
|
806
|
-
}
|
|
807
|
-
if (path_1["default"].extname(entry) === ".data") {
|
|
808
|
-
dataPath = entry;
|
|
809
|
-
}
|
|
810
|
-
if (entry.toLowerCase().indexOf("_static.json") > -1) {
|
|
811
|
-
metadataPath = entry;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
});
|
|
815
|
-
// if (!jsPath) return reject(new Error("Missing runtime file"));
|
|
816
|
-
// if (!wasmPath) return reject(new Error("Missing engine file"));
|
|
817
|
-
_context4.next = 3;
|
|
818
|
-
return zipped.file(jsPath).async("text");
|
|
819
|
-
case 3:
|
|
820
|
-
js = _context4.sent;
|
|
821
|
-
_context4.next = 6;
|
|
822
|
-
return zipped.file(wasmPath).async("arraybuffer");
|
|
823
|
-
case 6:
|
|
824
|
-
wasm = _context4.sent;
|
|
825
|
-
response = {
|
|
826
|
-
wasm: {
|
|
827
|
-
url: URL.createObjectURL(new Blob([wasm], {
|
|
828
|
-
type: "application/wasm"
|
|
829
|
-
})),
|
|
830
|
-
path: wasmPath
|
|
831
|
-
},
|
|
832
|
-
js: {
|
|
833
|
-
url: URL.createObjectURL(new Blob([js], {
|
|
834
|
-
type: "text/javascript"
|
|
835
|
-
})),
|
|
836
|
-
path: jsPath
|
|
837
|
-
}
|
|
838
|
-
};
|
|
839
|
-
if (!dataPath) {
|
|
840
|
-
_context4.next = 13;
|
|
841
|
-
break;
|
|
842
|
-
}
|
|
843
|
-
_context4.next = 11;
|
|
844
|
-
return zipped.file(dataPath).async("arraybuffer");
|
|
845
|
-
case 11:
|
|
846
|
-
data = _context4.sent;
|
|
847
|
-
response.data = {
|
|
848
|
-
url: URL.createObjectURL(new Blob([data], {
|
|
849
|
-
type: "application/octet-stream"
|
|
850
|
-
})),
|
|
851
|
-
path: dataPath
|
|
852
|
-
};
|
|
853
|
-
case 13:
|
|
854
|
-
if (!metadataPath) {
|
|
855
|
-
_context4.next = 18;
|
|
856
|
-
break;
|
|
857
|
-
}
|
|
858
|
-
_context4.next = 16;
|
|
859
|
-
return zipped.file(metadataPath).async("text");
|
|
860
|
-
case 16:
|
|
861
|
-
metadata = _context4.sent;
|
|
862
|
-
response.metadata = {
|
|
863
|
-
url: URL.createObjectURL(new Blob([metadata], {
|
|
864
|
-
type: "application/json"
|
|
865
|
-
})),
|
|
866
|
-
path: metadataPath
|
|
867
|
-
};
|
|
868
|
-
case 18:
|
|
869
|
-
return _context4.abrupt("return", response);
|
|
870
|
-
case 19:
|
|
871
|
-
case "end":
|
|
872
|
-
return _context4.stop();
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}, _callee4);
|
|
876
|
-
}));
|
|
877
|
-
});
|
|
763
|
+
modelToBlob = new Blob([new Uint8Array(model)]); // USING UNZIPIT
|
|
764
|
+
_context2.prev = 1;
|
|
765
|
+
_context2.next = 4;
|
|
766
|
+
return unzipit.unzip(modelToBlob);
|
|
878
767
|
case 4:
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
768
|
+
_yield$unzipit$unzip2 = _context2.sent;
|
|
769
|
+
entries = _yield$unzipit$unzip2.entries;
|
|
770
|
+
Object.keys(entries).forEach(function (entry) {
|
|
771
|
+
if (entry.indexOf("__MACOSX") === -1) {
|
|
772
|
+
if (path_1["default"].extname(entry) === ".js") {
|
|
773
|
+
jsPath = entry;
|
|
774
|
+
}
|
|
775
|
+
if (path_1["default"].extname(entry) === ".wasm") {
|
|
776
|
+
wasmPath = entry;
|
|
777
|
+
}
|
|
778
|
+
if (path_1["default"].extname(entry) === ".data") {
|
|
779
|
+
dataPath = entry;
|
|
780
|
+
}
|
|
781
|
+
if (entry.toLowerCase().indexOf("_static.json") > -1) {
|
|
782
|
+
metadataPath = entry;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
if (jsPath) {
|
|
787
|
+
_context2.next = 9;
|
|
788
|
+
break;
|
|
789
|
+
}
|
|
790
|
+
throw new Error("Missing runtime file");
|
|
791
|
+
case 9:
|
|
792
|
+
if (wasmPath) {
|
|
793
|
+
_context2.next = 11;
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
throw new Error("Missing engine file");
|
|
797
|
+
case 11:
|
|
798
|
+
_context2.next = 13;
|
|
799
|
+
return entries[jsPath].text();
|
|
800
|
+
case 13:
|
|
801
|
+
js = _context2.sent;
|
|
802
|
+
_context2.next = 16;
|
|
803
|
+
return entries[wasmPath].arrayBuffer();
|
|
804
|
+
case 16:
|
|
805
|
+
wasm = _context2.sent;
|
|
806
|
+
response = {
|
|
807
|
+
wasm: {
|
|
808
|
+
url: URL.createObjectURL(new Blob([wasm], {
|
|
809
|
+
type: "application/wasm"
|
|
810
|
+
})),
|
|
811
|
+
path: wasmPath
|
|
812
|
+
},
|
|
813
|
+
js: {
|
|
814
|
+
url: URL.createObjectURL(new Blob([js], {
|
|
815
|
+
type: "text/javascript"
|
|
816
|
+
})),
|
|
817
|
+
path: jsPath
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
if (!dataPath) {
|
|
821
|
+
_context2.next = 23;
|
|
822
|
+
break;
|
|
823
|
+
}
|
|
824
|
+
_context2.next = 21;
|
|
825
|
+
return entries[dataPath].arrayBuffer();
|
|
826
|
+
case 21:
|
|
827
|
+
data = _context2.sent;
|
|
828
|
+
response.data = {
|
|
829
|
+
url: URL.createObjectURL(new Blob([data], {
|
|
830
|
+
type: "application/octet-stream"
|
|
831
|
+
})),
|
|
832
|
+
path: dataPath
|
|
833
|
+
};
|
|
834
|
+
case 23:
|
|
835
|
+
if (!metadataPath) {
|
|
836
|
+
_context2.next = 28;
|
|
837
|
+
break;
|
|
838
|
+
}
|
|
839
|
+
_context2.next = 26;
|
|
840
|
+
return entries[metadataPath].text();
|
|
841
|
+
case 26:
|
|
842
|
+
metadata = _context2.sent;
|
|
843
|
+
response.metadata = {
|
|
844
|
+
url: URL.createObjectURL(new Blob([metadata], {
|
|
845
|
+
type: "application/json"
|
|
846
|
+
})),
|
|
847
|
+
path: metadataPath
|
|
848
|
+
};
|
|
849
|
+
case 28:
|
|
850
|
+
return _context2.abrupt("return", response);
|
|
851
|
+
case 31:
|
|
852
|
+
_context2.prev = 31;
|
|
853
|
+
_context2.t0 = _context2["catch"](1);
|
|
854
|
+
throw new Error(_context2.t0);
|
|
855
|
+
case 34:
|
|
882
856
|
case "end":
|
|
883
|
-
return
|
|
857
|
+
return _context2.stop();
|
|
884
858
|
}
|
|
885
859
|
}
|
|
886
|
-
},
|
|
860
|
+
}, _callee2, null, [[1, 31]]);
|
|
887
861
|
}));
|
|
888
862
|
};
|
|
889
863
|
var unzipppedModel = function unzipppedModel(model) {
|
|
890
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
864
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
891
865
|
var servicename, wasm, js, data, metadata, response;
|
|
892
|
-
return _regenerator["default"].wrap(function
|
|
866
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
893
867
|
while (1) {
|
|
894
|
-
switch (
|
|
868
|
+
switch (_context3.prev = _context3.next) {
|
|
895
869
|
case 0:
|
|
896
870
|
servicename = model.servicename, wasm = model.wasm, js = model.js, data = model.data, metadata = model.metadata;
|
|
897
871
|
response = {
|
|
@@ -936,91 +910,91 @@ var unzipppedModel = function unzipppedModel(model) {
|
|
|
936
910
|
path: "".concat(servicename, "_static.json")
|
|
937
911
|
};
|
|
938
912
|
}
|
|
939
|
-
return
|
|
913
|
+
return _context3.abrupt("return", response);
|
|
940
914
|
case 5:
|
|
941
915
|
case "end":
|
|
942
|
-
return
|
|
916
|
+
return _context3.stop();
|
|
943
917
|
}
|
|
944
918
|
}
|
|
945
|
-
},
|
|
919
|
+
}, _callee3);
|
|
946
920
|
}));
|
|
947
921
|
};
|
|
948
922
|
var getRuntimeContent = function getRuntimeContent(js, wasm) {
|
|
949
923
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
950
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
924
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
951
925
|
var _runtime, runtime;
|
|
952
|
-
return _regenerator["default"].wrap(function
|
|
926
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
953
927
|
while (1) {
|
|
954
|
-
switch (
|
|
928
|
+
switch (_context6.prev = _context6.next) {
|
|
955
929
|
case 0:
|
|
956
930
|
if (!data) {
|
|
957
|
-
|
|
931
|
+
_context6.next = 5;
|
|
958
932
|
break;
|
|
959
933
|
}
|
|
960
|
-
|
|
934
|
+
_context6.next = 3;
|
|
961
935
|
return fetch(js.url).then(function (res) {
|
|
962
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
963
|
-
return _regenerator["default"].wrap(function
|
|
936
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
937
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
964
938
|
while (1) {
|
|
965
|
-
switch (
|
|
939
|
+
switch (_context4.prev = _context4.next) {
|
|
966
940
|
case 0:
|
|
967
|
-
return
|
|
941
|
+
return _context4.abrupt("return", res.text());
|
|
968
942
|
case 1:
|
|
969
943
|
case "end":
|
|
970
|
-
return
|
|
944
|
+
return _context4.stop();
|
|
971
945
|
}
|
|
972
946
|
}
|
|
973
|
-
},
|
|
947
|
+
}, _callee4);
|
|
974
948
|
}));
|
|
975
949
|
}).then(function (text) {
|
|
976
950
|
return text.replace(wasm.path, wasm.url).replace("\"".concat(data.path, "\""), "\"".concat(data.url, "\"")).replace("\"".concat(data.path, "\""), "\"".concat(data.url, "\"")).replace("'".concat(data.path, "'"), "'".concat(data.url, "'")).replace("'".concat(data.path, "'"), "'".concat(data.url, "'"));
|
|
977
951
|
});
|
|
978
952
|
case 3:
|
|
979
|
-
_runtime =
|
|
980
|
-
return
|
|
953
|
+
_runtime = _context6.sent;
|
|
954
|
+
return _context6.abrupt("return", _runtime);
|
|
981
955
|
case 5:
|
|
982
|
-
|
|
956
|
+
_context6.next = 7;
|
|
983
957
|
return fetch(js.url).then(function (res) {
|
|
984
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
985
|
-
return _regenerator["default"].wrap(function
|
|
958
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
959
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
986
960
|
while (1) {
|
|
987
|
-
switch (
|
|
961
|
+
switch (_context5.prev = _context5.next) {
|
|
988
962
|
case 0:
|
|
989
|
-
return
|
|
963
|
+
return _context5.abrupt("return", res.text());
|
|
990
964
|
case 1:
|
|
991
965
|
case "end":
|
|
992
|
-
return
|
|
966
|
+
return _context5.stop();
|
|
993
967
|
}
|
|
994
968
|
}
|
|
995
|
-
},
|
|
969
|
+
}, _callee5);
|
|
996
970
|
}));
|
|
997
971
|
}).then(function (text) {
|
|
998
972
|
return text.replace(wasm.path, wasm.url);
|
|
999
973
|
});
|
|
1000
974
|
case 7:
|
|
1001
|
-
runtime =
|
|
1002
|
-
return
|
|
975
|
+
runtime = _context6.sent;
|
|
976
|
+
return _context6.abrupt("return", runtime);
|
|
1003
977
|
case 9:
|
|
1004
978
|
case "end":
|
|
1005
|
-
return
|
|
979
|
+
return _context6.stop();
|
|
1006
980
|
}
|
|
1007
981
|
}
|
|
1008
|
-
},
|
|
982
|
+
}, _callee6);
|
|
1009
983
|
}));
|
|
1010
984
|
};
|
|
1011
985
|
var defaultCallback = function defaultCallback() {
|
|
1012
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
1013
|
-
return _regenerator["default"].wrap(function
|
|
986
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
987
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
1014
988
|
while (1) {
|
|
1015
|
-
switch (
|
|
989
|
+
switch (_context7.prev = _context7.next) {
|
|
1016
990
|
case 0:
|
|
1017
991
|
logger_1.logger.info("CALLBACK NOT IMPLEMENTED");
|
|
1018
992
|
case 1:
|
|
1019
993
|
case "end":
|
|
1020
|
-
return
|
|
994
|
+
return _context7.stop();
|
|
1021
995
|
}
|
|
1022
996
|
}
|
|
1023
|
-
},
|
|
997
|
+
}, _callee7);
|
|
1024
998
|
}));
|
|
1025
999
|
};
|
|
1026
1000
|
var safeJsonParser = function safeJsonParser(data) {
|
|
@@ -1056,15 +1030,30 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1056
1030
|
*
|
|
1057
1031
|
* @param {RunnerConfig} wasmRunnerConfig
|
|
1058
1032
|
*/
|
|
1059
|
-
function WasmRunner() {
|
|
1060
|
-
var license = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
1033
|
+
function WasmRunner(wasmRunnerConfig) {
|
|
1061
1034
|
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultCallback;
|
|
1035
|
+
var license = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
1062
1036
|
(0, _classCallCheck2["default"])(this, WasmRunner);
|
|
1063
1037
|
utils.isCompatible();
|
|
1064
1038
|
this.license = license;
|
|
1065
1039
|
this.callback = callback;
|
|
1066
1040
|
this.models = [];
|
|
1067
1041
|
this._logger = new logger_1["default"]();
|
|
1042
|
+
if (!utils.isEmpty(wasmRunnerConfig)) {
|
|
1043
|
+
if (Array.isArray(wasmRunnerConfig)) {
|
|
1044
|
+
this.models = wasmRunnerConfig.map(function (wsconfig) {
|
|
1045
|
+
return {
|
|
1046
|
+
id: wsconfig.id,
|
|
1047
|
+
url: wsconfig.url
|
|
1048
|
+
};
|
|
1049
|
+
});
|
|
1050
|
+
} else if ((0, _typeof2["default"])(wasmRunnerConfig) === "object") {
|
|
1051
|
+
this.models = [{
|
|
1052
|
+
id: wasmRunnerConfig.id,
|
|
1053
|
+
url: wasmRunnerConfig.url
|
|
1054
|
+
}];
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1068
1057
|
}
|
|
1069
1058
|
(0, _createClass2["default"])(WasmRunner, [{
|
|
1070
1059
|
key: "setLogLevel",
|
|
@@ -1081,47 +1070,47 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1081
1070
|
key: "initialize",
|
|
1082
1071
|
value: function initialize() {
|
|
1083
1072
|
var license = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
1084
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
1073
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
1085
1074
|
var _this = this;
|
|
1086
|
-
return _regenerator["default"].wrap(function
|
|
1075
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
1087
1076
|
while (1) {
|
|
1088
|
-
switch (
|
|
1077
|
+
switch (_context9.prev = _context9.next) {
|
|
1089
1078
|
case 0:
|
|
1090
1079
|
if (!utils.isEmpty(license)) {
|
|
1091
1080
|
this.license = license;
|
|
1092
1081
|
}
|
|
1093
|
-
|
|
1082
|
+
_context9.next = 3;
|
|
1094
1083
|
return Promise.all(this.models.map(function (m) {
|
|
1095
|
-
return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
1096
|
-
return _regenerator["default"].wrap(function
|
|
1084
|
+
return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
1085
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
1097
1086
|
while (1) {
|
|
1098
|
-
switch (
|
|
1087
|
+
switch (_context8.prev = _context8.next) {
|
|
1099
1088
|
case 0:
|
|
1100
|
-
return
|
|
1089
|
+
return _context8.abrupt("return", this._initializeModelInstance(m, this.license));
|
|
1101
1090
|
case 1:
|
|
1102
1091
|
case "end":
|
|
1103
|
-
return
|
|
1092
|
+
return _context8.stop();
|
|
1104
1093
|
}
|
|
1105
1094
|
}
|
|
1106
|
-
},
|
|
1095
|
+
}, _callee8, this);
|
|
1107
1096
|
}));
|
|
1108
1097
|
}));
|
|
1109
1098
|
case 3:
|
|
1110
1099
|
case "end":
|
|
1111
|
-
return
|
|
1100
|
+
return _context9.stop();
|
|
1112
1101
|
}
|
|
1113
1102
|
}
|
|
1114
|
-
},
|
|
1103
|
+
}, _callee9, this);
|
|
1115
1104
|
}));
|
|
1116
1105
|
}
|
|
1117
1106
|
}, {
|
|
1118
1107
|
key: "_initializeModelInstance",
|
|
1119
1108
|
value: function _initializeModelInstance(m, license) {
|
|
1120
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
1109
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
1121
1110
|
var start, modelUrl, isDataBuffer, isObject, js, wasm, data, metadata, bufferModel, unzipModelFile, unzipped, metadataJSON, runtime, loggerInt;
|
|
1122
|
-
return _regenerator["default"].wrap(function
|
|
1111
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
1123
1112
|
while (1) {
|
|
1124
|
-
switch (
|
|
1113
|
+
switch (_context11.prev = _context11.next) {
|
|
1125
1114
|
case 0:
|
|
1126
1115
|
start = Date.now();
|
|
1127
1116
|
logger_1.logger.debug({
|
|
@@ -1132,64 +1121,64 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1132
1121
|
isDataBuffer = (0, is_buffer_1["default"])(modelUrl);
|
|
1133
1122
|
isObject = (0, _typeof2["default"])(modelUrl) === "object";
|
|
1134
1123
|
if (!isDataBuffer) {
|
|
1135
|
-
|
|
1124
|
+
_context11.next = 15;
|
|
1136
1125
|
break;
|
|
1137
1126
|
}
|
|
1138
|
-
|
|
1127
|
+
_context11.next = 8;
|
|
1139
1128
|
return unzipBuffer(modelUrl);
|
|
1140
1129
|
case 8:
|
|
1141
|
-
bufferModel =
|
|
1130
|
+
bufferModel = _context11.sent;
|
|
1142
1131
|
js = bufferModel.js;
|
|
1143
1132
|
wasm = bufferModel.wasm;
|
|
1144
1133
|
data = bufferModel.data;
|
|
1145
1134
|
metadata = bufferModel.metadata;
|
|
1146
|
-
|
|
1135
|
+
_context11.next = 32;
|
|
1147
1136
|
break;
|
|
1148
1137
|
case 15:
|
|
1149
1138
|
if (!isObject) {
|
|
1150
|
-
|
|
1139
|
+
_context11.next = 25;
|
|
1151
1140
|
break;
|
|
1152
1141
|
}
|
|
1153
|
-
|
|
1142
|
+
_context11.next = 18;
|
|
1154
1143
|
return unzipppedModel(modelUrl);
|
|
1155
1144
|
case 18:
|
|
1156
|
-
unzipModelFile =
|
|
1145
|
+
unzipModelFile = _context11.sent;
|
|
1157
1146
|
js = unzipModelFile.js;
|
|
1158
1147
|
wasm = unzipModelFile.wasm;
|
|
1159
1148
|
data = unzipModelFile.data;
|
|
1160
1149
|
metadata = unzipModelFile.metadata;
|
|
1161
|
-
|
|
1150
|
+
_context11.next = 32;
|
|
1162
1151
|
break;
|
|
1163
1152
|
case 25:
|
|
1164
|
-
|
|
1153
|
+
_context11.next = 27;
|
|
1165
1154
|
return unzipFile(modelUrl);
|
|
1166
1155
|
case 27:
|
|
1167
|
-
unzipped =
|
|
1156
|
+
unzipped = _context11.sent;
|
|
1168
1157
|
js = unzipped.js;
|
|
1169
1158
|
wasm = unzipped.wasm;
|
|
1170
1159
|
data = unzipped.data;
|
|
1171
1160
|
metadata = unzipped.metadata;
|
|
1172
1161
|
case 32:
|
|
1173
1162
|
if (!metadata) {
|
|
1174
|
-
|
|
1163
|
+
_context11.next = 38;
|
|
1175
1164
|
break;
|
|
1176
1165
|
}
|
|
1177
|
-
|
|
1166
|
+
_context11.next = 35;
|
|
1178
1167
|
return fetch(metadata.url).then(function (response) {
|
|
1179
1168
|
return response.json();
|
|
1180
1169
|
});
|
|
1181
1170
|
case 35:
|
|
1182
|
-
|
|
1183
|
-
|
|
1171
|
+
_context11.t0 = _context11.sent;
|
|
1172
|
+
_context11.next = 39;
|
|
1184
1173
|
break;
|
|
1185
1174
|
case 38:
|
|
1186
|
-
|
|
1175
|
+
_context11.t0 = undefined;
|
|
1187
1176
|
case 39:
|
|
1188
|
-
metadataJSON =
|
|
1189
|
-
|
|
1177
|
+
metadataJSON = _context11.t0;
|
|
1178
|
+
_context11.next = 42;
|
|
1190
1179
|
return getRuntimeContent(js, wasm, data);
|
|
1191
1180
|
case 42:
|
|
1192
|
-
runtime =
|
|
1181
|
+
runtime = _context11.sent;
|
|
1193
1182
|
logger_1.logger.debug({
|
|
1194
1183
|
modelid: m.id,
|
|
1195
1184
|
timespent: Date.now() - start
|
|
@@ -1206,49 +1195,48 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1206
1195
|
var requestData = JSON.parse(oEvent.data.requestData.request_body);
|
|
1207
1196
|
var folderName = oEvent.data.requestData.folder_name;
|
|
1208
1197
|
var serviceName = oEvent.data.requestData.service_name;
|
|
1209
|
-
var
|
|
1210
|
-
return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
1198
|
+
var fn = function fn() {
|
|
1199
|
+
return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
1211
1200
|
var option, modelVersionId, results;
|
|
1212
|
-
return _regenerator["default"].wrap(function
|
|
1201
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
1213
1202
|
while (1) {
|
|
1214
|
-
switch (
|
|
1203
|
+
switch (_context10.prev = _context10.next) {
|
|
1215
1204
|
case 0:
|
|
1216
|
-
|
|
1205
|
+
_context10.prev = 0;
|
|
1217
1206
|
option = {
|
|
1218
1207
|
folder_name: folderName,
|
|
1219
1208
|
service_name: serviceName
|
|
1220
1209
|
// version_id: versionId
|
|
1221
1210
|
};
|
|
1222
|
-
|
|
1211
|
+
_context10.next = 4;
|
|
1223
1212
|
return m.parents.callback(option);
|
|
1224
1213
|
case 4:
|
|
1225
|
-
modelVersionId =
|
|
1214
|
+
modelVersionId = _context10.sent;
|
|
1226
1215
|
if (!requestData.request_meta) requestData.request_meta = {};
|
|
1227
1216
|
requestData.request_meta.version_id = modelVersionId;
|
|
1228
|
-
|
|
1217
|
+
_context10.next = 9;
|
|
1229
1218
|
return m.parents.execute(requestData, modelVersionId);
|
|
1230
1219
|
case 9:
|
|
1231
|
-
results =
|
|
1220
|
+
results = _context10.sent;
|
|
1232
1221
|
m.worker.postMessage([{
|
|
1233
1222
|
request: oEvent.data.requestData,
|
|
1234
1223
|
response: results
|
|
1235
1224
|
}, "", "dispatch"]);
|
|
1236
|
-
|
|
1237
|
-
_context13.next = 18;
|
|
1225
|
+
_context10.next = 16;
|
|
1238
1226
|
break;
|
|
1239
|
-
case
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
loggerInt.error(
|
|
1243
|
-
|
|
1244
|
-
case 18:
|
|
1227
|
+
case 13:
|
|
1228
|
+
_context10.prev = 13;
|
|
1229
|
+
_context10.t0 = _context10["catch"](0);
|
|
1230
|
+
loggerInt.error(_context10.t0, "CHILD MODEL ERROR");
|
|
1231
|
+
case 16:
|
|
1245
1232
|
case "end":
|
|
1246
|
-
return
|
|
1233
|
+
return _context10.stop();
|
|
1247
1234
|
}
|
|
1248
1235
|
}
|
|
1249
|
-
},
|
|
1236
|
+
}, _callee10, null, [[0, 13]]);
|
|
1250
1237
|
}));
|
|
1251
|
-
}
|
|
1238
|
+
};
|
|
1239
|
+
fn();
|
|
1252
1240
|
} else if (Array.isArray(oEvent.data)) {
|
|
1253
1241
|
if (utils.isEmpty(m.results)) {
|
|
1254
1242
|
m.results = {};
|
|
@@ -1256,7 +1244,7 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1256
1244
|
m.results[oEvent.data[1]] = oEvent.data[0];
|
|
1257
1245
|
}
|
|
1258
1246
|
};
|
|
1259
|
-
return
|
|
1247
|
+
return _context11.abrupt("return", new Promise(function (resolve, reject) {
|
|
1260
1248
|
var checkModelStatus = function checkModelStatus() {
|
|
1261
1249
|
setTimeout(function () {
|
|
1262
1250
|
if (!m.ready) {
|
|
@@ -1274,10 +1262,10 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1274
1262
|
}));
|
|
1275
1263
|
case 49:
|
|
1276
1264
|
case "end":
|
|
1277
|
-
return
|
|
1265
|
+
return _context11.stop();
|
|
1278
1266
|
}
|
|
1279
1267
|
}
|
|
1280
|
-
},
|
|
1268
|
+
}, _callee11, this);
|
|
1281
1269
|
}));
|
|
1282
1270
|
}
|
|
1283
1271
|
}, {
|
|
@@ -1360,22 +1348,26 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1360
1348
|
}, {
|
|
1361
1349
|
key: "remove",
|
|
1362
1350
|
value: function remove(id) {
|
|
1363
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
1364
|
-
return _regenerator["default"].wrap(function
|
|
1351
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
1352
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
1365
1353
|
while (1) {
|
|
1366
|
-
switch (
|
|
1354
|
+
switch (_context12.prev = _context12.next) {
|
|
1367
1355
|
case 0:
|
|
1368
1356
|
if (this.isExist(id)) {
|
|
1369
1357
|
this.models = this.models.filter(function (m) {
|
|
1358
|
+
if (m.id === id) {
|
|
1359
|
+
m.worker.terminate();
|
|
1360
|
+
return false;
|
|
1361
|
+
}
|
|
1370
1362
|
return m.id !== id;
|
|
1371
1363
|
});
|
|
1372
1364
|
}
|
|
1373
1365
|
case 1:
|
|
1374
1366
|
case "end":
|
|
1375
|
-
return
|
|
1367
|
+
return _context12.stop();
|
|
1376
1368
|
}
|
|
1377
1369
|
}
|
|
1378
|
-
},
|
|
1370
|
+
}, _callee12, this);
|
|
1379
1371
|
}));
|
|
1380
1372
|
}
|
|
1381
1373
|
/**
|
|
@@ -1386,33 +1378,33 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1386
1378
|
}, {
|
|
1387
1379
|
key: "append",
|
|
1388
1380
|
value: function append(modelConfig) {
|
|
1389
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
1381
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
|
1390
1382
|
var model;
|
|
1391
|
-
return _regenerator["default"].wrap(function
|
|
1383
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
1392
1384
|
while (1) {
|
|
1393
|
-
switch (
|
|
1385
|
+
switch (_context13.prev = _context13.next) {
|
|
1394
1386
|
case 0:
|
|
1395
1387
|
if (!this.isExist(modelConfig.id)) {
|
|
1396
|
-
|
|
1388
|
+
_context13.next = 2;
|
|
1397
1389
|
break;
|
|
1398
1390
|
}
|
|
1399
|
-
return
|
|
1391
|
+
return _context13.abrupt("return");
|
|
1400
1392
|
case 2:
|
|
1401
1393
|
model = {
|
|
1402
1394
|
id: modelConfig.id,
|
|
1403
1395
|
url: modelConfig.url,
|
|
1404
1396
|
meta: {}
|
|
1405
1397
|
};
|
|
1406
|
-
|
|
1398
|
+
_context13.next = 5;
|
|
1407
1399
|
return this._initializeModelInstance(model, this.license);
|
|
1408
1400
|
case 5:
|
|
1409
1401
|
this.models.push(model);
|
|
1410
1402
|
case 6:
|
|
1411
1403
|
case "end":
|
|
1412
|
-
return
|
|
1404
|
+
return _context13.stop();
|
|
1413
1405
|
}
|
|
1414
1406
|
}
|
|
1415
|
-
},
|
|
1407
|
+
}, _callee13, this);
|
|
1416
1408
|
}));
|
|
1417
1409
|
}
|
|
1418
1410
|
/**
|
|
@@ -1426,11 +1418,11 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1426
1418
|
value: function execute(input) {
|
|
1427
1419
|
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
1428
1420
|
var _a, _b;
|
|
1429
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function
|
|
1421
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
1430
1422
|
var version_uuid, model, callid;
|
|
1431
|
-
return _regenerator["default"].wrap(function
|
|
1423
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
1432
1424
|
while (1) {
|
|
1433
|
-
switch (
|
|
1425
|
+
switch (_context14.prev = _context14.next) {
|
|
1434
1426
|
case 0:
|
|
1435
1427
|
version_uuid = id || ((_a = input === null || input === void 0 ? void 0 : input.request_meta) === null || _a === void 0 ? void 0 : _a.version_id) || ((_b = input.request_meta) === null || _b === void 0 ? void 0 : _b.version_uuid);
|
|
1436
1428
|
if (!(input === null || input === void 0 ? void 0 : input.request_meta)) {
|
|
@@ -1441,25 +1433,24 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1441
1433
|
}
|
|
1442
1434
|
this._logger.trace(input, "EXECUTING: ".concat(id));
|
|
1443
1435
|
if (!version_uuid) {
|
|
1444
|
-
|
|
1436
|
+
_context14.next = 9;
|
|
1445
1437
|
break;
|
|
1446
1438
|
}
|
|
1447
1439
|
model = this._getModel(version_uuid);
|
|
1448
1440
|
callid = (0, cuid_1["default"])();
|
|
1449
1441
|
model.worker.postMessage([JSON.stringify(input), callid]);
|
|
1450
|
-
return
|
|
1442
|
+
return _context14.abrupt("return", new Promise(function (resolve, reject) {
|
|
1451
1443
|
var counter = 0;
|
|
1452
1444
|
var getResult = function getResult() {
|
|
1453
1445
|
setTimeout(function () {
|
|
1454
1446
|
var _a, _b;
|
|
1455
1447
|
if ((_a = model.results) === null || _a === void 0 ? void 0 : _a[callid]) {
|
|
1456
1448
|
var tryParsingResult = safeJsonParser((_b = model.results) === null || _b === void 0 ? void 0 : _b[callid]);
|
|
1457
|
-
// const result = JSON.parse(model.results?.[callid]);
|
|
1458
1449
|
if (tryParsingResult) {
|
|
1459
1450
|
model.results[callid] = undefined;
|
|
1460
1451
|
resolve(tryParsingResult);
|
|
1461
1452
|
} else {
|
|
1462
|
-
if (counter <
|
|
1453
|
+
if (counter < 5000) {
|
|
1463
1454
|
// Increase timeout into 20s
|
|
1464
1455
|
counter++;
|
|
1465
1456
|
getResult();
|
|
@@ -1468,7 +1459,7 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1468
1459
|
}
|
|
1469
1460
|
}
|
|
1470
1461
|
} else {
|
|
1471
|
-
if (counter <
|
|
1462
|
+
if (counter < 5000) {
|
|
1472
1463
|
// Increase timeout into 20s
|
|
1473
1464
|
counter++;
|
|
1474
1465
|
getResult();
|
|
@@ -1484,10 +1475,10 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1484
1475
|
throw new error_1["default"].ParameterRequiredError("request_meta.version_id", input);
|
|
1485
1476
|
case 10:
|
|
1486
1477
|
case "end":
|
|
1487
|
-
return
|
|
1478
|
+
return _context14.stop();
|
|
1488
1479
|
}
|
|
1489
1480
|
}
|
|
1490
|
-
},
|
|
1481
|
+
}, _callee14, this);
|
|
1491
1482
|
}));
|
|
1492
1483
|
}
|
|
1493
1484
|
}]);
|
|
@@ -1495,7 +1486,7 @@ var WasmRunner = /*#__PURE__*/function () {
|
|
|
1495
1486
|
}();
|
|
1496
1487
|
exports.WasmRunner = WasmRunner;
|
|
1497
1488
|
|
|
1498
|
-
},{"./browser/logger":21,"./browser/template":22,"./error":23,"./utils":24,"@babel/runtime/helpers/classCallCheck":3,"@babel/runtime/helpers/createClass":5,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/typeof":17,"@babel/runtime/regenerator":19,"cuid":28,"is-buffer":33,"
|
|
1489
|
+
},{"./browser/logger":21,"./browser/template":22,"./error":23,"./utils":24,"@babel/runtime/helpers/classCallCheck":3,"@babel/runtime/helpers/createClass":5,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/typeof":17,"@babel/runtime/regenerator":19,"cuid":28,"is-buffer":33,"path":35,"unzipit":41}],21:[function(require,module,exports){
|
|
1499
1490
|
"use strict";
|
|
1500
1491
|
|
|
1501
1492
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -1698,7 +1689,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1698
1689
|
function buildWorkerFN(runtime) {
|
|
1699
1690
|
var license = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
1700
1691
|
var metadata = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1701
|
-
return "\n ".concat(runtime, "\n\n const metadata = ").concat(JSON.stringify(metadata), ";\n\n const license = '").concat(license, "';\n class MyEventEmitter{constructor(){this._events={}}on(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}removeListener(e,t){if(!this._events[e]){throw new Error(\"Can't emit an event. Event doesn't exits.\"+e)}this._events[e]=this._events[e].filter((e=>e!==t))}emit(e,t){
|
|
1692
|
+
return "\n ".concat(runtime, "\n\n const metadata = ").concat(JSON.stringify(metadata), ";\n\n const license = '").concat(license, "';\n class MyEventEmitter{constructor(){this._events={},this._eventsOnce={}}on(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}once(e,t){this._eventsOnce[e]||(this._eventsOnce[e]=[]),this._eventsOnce[e].push(t)}removeListener(e,t){if(!this._events[e]){throw new Error(\"Can't emit an event. Event doesn't exits.\"+e)}this._events[e]=this._events[e].filter((e=>e!==t))}emit(e,t){const a=e=>{e(t)};this._events[e]&&this._events[e].forEach(a),this._eventsOnce[e]&&(this._eventsOnce[e].forEach(a),this._eventsOnce[e]=[])}}var workerEventEmitter=new MyEventEmitter;let wasm,wb;var CALL_TYPE={0:\"SparkService\",1:\"ExternalApi\"},XcallResBuilder={Json:function(e,t,a,s,r,n){return JSON.stringify({metadata:{calltype:e,name:t,status:a,error_code:s,response_time:r},data:n||{}})},XML:()=>{}};function moduleInitialize(){Module().then((e=>{wasm=e,wb=e._construct();var t=new TextDecoder(\"utf-8\"),a=(new TextEncoder,0);e.dispatch=async(s,r,n)=>{var c=new Uint8Array(e.HEAPU8.subarray(r,r+n)),i=t.decode(c).slice(),o=JSON.parse(i),m=(o.folder_name,o.service_name);if(s===a){return await new Promise(((e,t)=>{try{postMessage({requestData:o,type:\"stall\"});var a=\"xcall-loopback-result-\"+m;workerEventEmitter.once(a,(t=>{var a=XcallResBuilder.Json(CALL_TYPE[0],m,202,\"\",0,t);e(a)}))}catch(e){t(e)}}))}},postMessage(\"Initialized\")}))}async function runComputation(e){if(!e)return new Error(\"No Event was placed\");var t=e.data[0],a=\"string\"==typeof t?JSON.parse(t):t,s=e.data[1];if(void 0===wasm||void 0===wb)return new Error(\"WASM is not ready\");a?.request_meta?._ctx?.authorization&&(ctx.headers.authorization=a?.request_meta?._ctx?.authorization,delete a?.request_meta?._ctx?.authorization),a?.request_meta?._ctx?.secretkey&&(ctx.headers.secretkey=a?.request_meta?._ctx.secretkey,delete a?.request_meta?._ctx?.secretkey),a?.request_meta?._ctx?.[\"x-synthetic-key\"]&&(ctx.headers[\"x-synthetic-key\"]=a?.request_meta?._ctx?.[\"x-synthetic-key\"],delete a?.request_meta?._ctx?.[\"x-synthetic-key\"]),a?.request_meta?._ctx?.tenant&&(ctx.headers.tenant=a?.request_meta?._ctx?.tenant,delete a?.request_meta?._ctx?.tenant),a?.request_meta?._ctx?.servicemap&&(ctx.servicemap=a?.request_meta?._ctx?.servicemap,delete a?.request_meta?._ctx.servicemap);var r=a?.request_meta?.service_category&&a?.request_meta?.service_category.split(\",\").some((e=>\"metadata\"===e.toLowerCase()))&&void 0!==metadata,n=(new TextEncoder).encode(t),c=wasm._malloc(n.length),i=n.BYTES_PER_ELEMENT;wasm.HEAP8.set(n,c/i);var o=wasm._malloc(8),m=await wasm.ccall(\"node_calc_v3\",\"number\",[\"number\",\"number\",\"number\",\"number\"],[wb,c,n.length,o],{async:!0}),_=wasm.getValue(o,\"i64\"),u=new Uint8Array(wasm.HEAPU8.subarray(m,m+_));let d=new TextDecoder(\"utf-8\").decode(u).slice();if(wasm._free(c),wasm._free(o),wasm._free(m),r){d=JSON.parse(d),d.response_data||(d.response_data={});var l=metadata?.ImageOutputs??[],v=l?l.reduce(((e,t)=>t?.ImageName?(e[t.ImageName]=t?.Base64Content||\"\",e):e),{}):{};return d.response_data.outputs={...d.response_data?.outputs,...metadata?.Outputs,...v},[JSON.stringify(d),s]}return[d,s]}moduleInitialize(),onmessage=function(e){var t=e,a=t.data[0],s=t.data[1];if(\"dispatch\"===t.data[2]){var r=a.request.service_name,n=a.response,c=\"xcall-loopback-result-\"+r;workerEventEmitter.emit(c,n)}else runComputation(t).then((e=>{postMessage(e)})).catch((e=>{postMessage([JSON.stringify({executeError:e.message}),s])}))};\n\n");
|
|
1702
1693
|
}
|
|
1703
1694
|
exports["default"] = buildWorkerFN;
|
|
1704
1695
|
|
|
@@ -2064,7 +2055,7 @@ function last(arr) {
|
|
|
2064
2055
|
exports.last = last;
|
|
2065
2056
|
|
|
2066
2057
|
}).call(this)}).call(this,require('_process'))
|
|
2067
|
-
},{"./error":23,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/typeof":17,"@babel/runtime/regenerator":19,"_process":
|
|
2058
|
+
},{"./error":23,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/typeof":17,"@babel/runtime/regenerator":19,"_process":36,"fs":26,"url":42}],25:[function(require,module,exports){
|
|
2068
2059
|
'use strict'
|
|
2069
2060
|
|
|
2070
2061
|
exports.byteLength = byteLength
|
|
@@ -4228,22 +4219,6 @@ module.exports = function isBuffer (obj) {
|
|
|
4228
4219
|
},{}],34:[function(require,module,exports){
|
|
4229
4220
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.joi=t():e.joi=t()}(self,(()=>{return e={7629:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(9474),i=r(1687),o=r(8652),l=r(8160),c=r(3292),u=r(6354),f=r(8901),h=r(9708),d=r(6914),m=r(2294),p=r(6133),g=r(1152),y=r(8863),b=r(2036),v={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new m.Ids,this._preferences=null,this._refs=new p.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return s("function"==typeof h.describe,"Manifest functionality disabled"),h.describe(this)}allow(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"allow"),this._values(t,"_valids")}alter(e){s(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),s(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const n=e[r];s("function"==typeof n,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:n})}return t.$_temp.ruleset=!1,t}artifact(e){return s(void 0!==e,"Artifact cannot be undefined"),s(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return s(!1===e||"string"==typeof e,"Invalid to value"),s(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return s(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return s(e,"Missing error"),s(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(void 0!==e,"Missing example"),l.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(s(!t,"Cannot combine options with description"),t=e.description,e=e.method),s("function"==typeof e,"Method must be a function"),s(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(s("string"==typeof e,"id must be a non-empty string"),s(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this._values(t,"_invalids")}label(e){return s(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return s(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];s(t.length,"Missing notes");for(const e of t)s(e&&"string"==typeof e,"Notes must be non-empty strings");return this._inner("notes",t)}only(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){s(e,"Missing preferences"),s(void 0===e.context,"Cannot override context"),s(void 0===e.externals,"Cannot override externals"),s(void 0===e.warnings,"Cannot override warnings"),s(void 0===e.debug,"Cannot override debug"),l.checkPreferences(e);const t=this.clone();return t._preferences=l.preferences(t._preferences,e),t}presence(e){return s(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("result",e?"raw":void 0)}result(e){return s(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=l.preferences(t._preferences,{convert:r}),t}strip(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("result",e?"strip":void 0)}tag(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];s(t.length,"Missing tags");for(const e of t)s(e&&"string"==typeof e,"Tags must be non-empty strings");return this._inner("tags",t)}unit(e){return s(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];l.verifyFlat(t,"valid");const s=this.allow(...t);return s.$_setFlag("only",!!s._valids,{clone:!1}),s}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const n=c.when(r,e,t);if(!["any","link"].includes(r.type)){const e=n.is?[n]:n.switch;for(const t of e)s(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),s(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(n),r.$_mutateRebuild()}cache(e){s(!this._inRuleset(),"Cannot set caching inside a ruleset"),s(!this._cache,"Cannot override schema cache"),s(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||o.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){s(l.isSchema(e),"Invalid schema object"),s("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),s(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),s(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,p.toSibling),t._preferences=t._preferences?l.preferences(t._preferences,e._preferences):e._preferences,t._valids=b.merge(t._valids,e._valids,e._invalids),t._invalids=b.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.keep||e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else i(t._flags,e._flags);for(const r in e.$_terms){const s=e.$_terms[r];s?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(s):t.$_terms[r]=s.slice():t.$_terms[r]||(t.$_terms[r]=s)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return s(!e.base,"Cannot extend type with another base"),f.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){s(!this._inRuleset(),"Cannot fork inside a ruleset");let r=this;for(let s of[].concat(e))s=Array.isArray(s)?s:s.split("."),r=r._ids.fork(s,t,r);return r.$_temp.ruleset=!1,r}rule(e){const t=this._definition;l.assertOptions(e,Object.keys(t.modifiers)),s(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const r=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;s(r>=0&&r<this._rules.length,"Cannot apply rules to empty ruleset");const a=this.clone();for(let i=r;i<a._rules.length;++i){const r=a._rules[i],o=n(r);for(const n in e)t.modifiers[n](o,e[n]),s(o.name===r.name,"Cannot change rule name");a._rules[i]=o,a._singleRules.get(o.name)===r&&a._singleRules.set(o.name,o)}return a.$_temp.ruleset=!1,a.$_mutateRebuild()}get ruleset(){s(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),s(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:r,adjuster:n}of this.$_terms.alterations)e.includes(r)&&(t=n(t),s(l.isSchema(t),"Alteration adjuster for",r,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),s(e&&"object"==typeof e,"Invalid options"),s(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)s("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],n=t.args;s(r,"Unknown rule",t.method);const a=this.clone();if(n){s(1===Object.keys(n).length||Object.keys(n).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in n){let i=n[e];if(r.argsByName){const o=r.argsByName.get(e);if(o.ref&&l.isResolvable(i))t._resolve.push(e),a.$_mutateRegister(i);else if(o.normalize&&(i=o.normalize(i),n[e]=i),o.assert){const t=l.validateArg(i,e,o);s(!t,t,"or reference")}}void 0!==i?n[e]=i:delete n[e]}}return r.multi||(a._ruleRemove(t.name,{clone:!1}),a._singleRules.set(t.name,t)),!1===a.$_temp.ruleset&&(a.$_temp.ruleset=null),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,r,s,n){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const i=!1!==a.flags?this._flags:{},o=a.messages?d.merge(this._definition.messages,a.messages):this._definition.messages;return new u.Report(e,t,r,i,o,s,n)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,s){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const n=!y.validate(e,this,t,r,s).errors;return t.restore(),n}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),m.schema(this,e)||this}$_mutateRebuild(){return s(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,t)=>{let{source:r,name:s,path:n,key:a}=t;const i=this._definition[r][s]&&this._definition[r][s].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:a})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e){let{family:t,key:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const n=this._definition.flags[e]||{};if(a(t,n.default)&&(t=void 0),a(t,this._flags[e]))return this;const i=!1!==r.clone?this.clone():this;return void 0!==t?(i._flags[e]=t,i.$_mutateRegister(t)):delete i._flags[e],"_"!==e[0]&&(i.$_temp.ruleset=!1),i}$_parent(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return this[e][l.symbols.parent].call(this,...r)}$_validate(e,t,r){return y.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=n(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const s=t[r];e.$_terms[r]=s.init}return e.$_mutateRebuild()}_default(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l.assertOptions(r,"literal"),s(void 0!==t,"Missing",e,"value"),s("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[l.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const s=[],n=[];for(let a=0;a<this.$_terms.whens.length;++a){const i=this.$_terms.whens[a];if(i.concat){s.push(i.concat),n.push(`${a}.concat`);continue}const o=i.ref?i.ref.resolve(e,t,r):e,l=i.is?[i]:i.switch,c=n.length;for(let c=0;c<l.length;++c){const{is:u,then:f,otherwise:h}=l[c],d=`${a}${i.switch?"."+c:""}`;if(u.$_match(o,t.nest(u,`${d}.is`),r)){if(f){const a=t.localize([...t.path,`${d}.then`],t.ancestors,t.schemas),{schema:i,id:o}=f._generate(e,a,r);s.push(i),n.push(`${d}.then${o?`(${o})`:""}`);break}}else if(h){const a=t.localize([...t.path,`${d}.otherwise`],t.ancestors,t.schemas),{schema:i,id:o}=h._generate(e,a,r);s.push(i),n.push(`${d}.otherwise${o?`(${o})`:""}`);break}}if(i.break&&n.length>c)break}const a=n.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",a),!a)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let i=this;this._definition.generate&&(i=this._definition.generate(this,e,t,r));for(const e of s)i=i.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(i,[this,...s]),this.$_temp.whens[a]=i,{schema:i,id:a}}_inner(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const n=this.clone();return n.$_terms[e]&&!r.override||(n.$_terms[e]=[]),r.single?n.$_terms[e].push(t):n.$_terms[e].push(...t),n.$_temp.ruleset=!1,n}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const s=[];for(let t=0;t<r._rules.length;++t){const n=r._rules[t];n.name!==e||n.keep?s.push(n):r._inRuleset()&&t<r.$_temp.ruleset&&--r.$_temp.ruleset}return r._rules=s,r}_values(e,t){l.verifyFlat(e,t.slice(1,-1));const r=this.clone(),n=e[0]===l.symbols.override;if(n&&(e=e.slice(1)),!r[t]&&e.length?r[t]=new b:n&&(r[t]=e.length?new b:null,r.$_mutateRebuild()),!r[t])return r;n&&r[t].override();for(const n of e){s(void 0!==n,"Cannot call allow/valid/invalid with undefined"),s(n!==l.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";r[e]&&(r[e].remove(n),r[e].length||(s("_valids"===t||!r._flags.only,"Setting invalid value",n,"leaves schema rejecting all values due to previous valid rule"),r[e]=null)),r[t].add(n,r._refs)}return r}}};v.Base.prototype[l.symbols.any]={version:l.version,compile:c.compile,root:"$_root"},v.Base.prototype.isImmutable=!0,v.Base.prototype.deny=v.Base.prototype.invalid,v.Base.prototype.disallow=v.Base.prototype.invalid,v.Base.prototype.equal=v.Base.prototype.valid,v.Base.prototype.exist=v.Base.prototype.required,v.Base.prototype.not=v.Base.prototype.invalid,v.Base.prototype.options=v.Base.prototype.prefs,v.Base.prototype.preferences=v.Base.prototype.prefs,e.exports=new v.Base},8652:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(8160),i={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new i.Cache(e)},i.Cache=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a.assertOptions(e,["max"]),s(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||i.max,this._map=new Map,this._list=new i.List}get length(){return this._map.size}set(e,t){if(null!==e&&!i.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),n(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},i.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,r)=>{"use strict";const s=r(375),n=r(7916),a=r(5934);let i,o;const l={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Options";s(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const n=Object.keys(e).filter((e=>!t.includes(e)));s(0===n.length,`${r} contain unknown keys: ${n}`)},t.checkPreferences=function(e){o=o||r(3378);const t=o.preferences.validate(e);if(t.error)throw new n([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return l.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e&&e[t.symbols.any];return!!n&&(s(r.legacy||n.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,s){i=i||r(6914),e=e||{},s=s||{};const n=Object.assign({},e,s);return s.errors&&e.errors&&(n.errors=Object.assign({},e.errors,s.errors),n.errors.wrap=Object.assign({},e.errors.wrap,s.errors.wrap)),s.messages&&(n.messages=i.compile(s.messages,e.messages)),delete n[t.symbols.prefs],n},t.tryWithPath=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,s){let{assert:n,message:a}=s;if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?`${r} ${a}`:a},t.verifyFlat=function(e,t){for(const r of e)s(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},3292:(e,t,r)=>{"use strict";const s=r(375),n=r(8160),a=r(6133),i={};t.schema=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.assertOptions(r,["appendPath","override"]);try{return i.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},i.schema=function(e,t,r){s(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(s(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=function(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];return!1!==r.override?t.valid(e.override,...n):t.valid(...n)};if(i.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(s("object"==typeof t,"Invalid schema content:",typeof t),n.isResolvable(t))return a(e,t);if(n.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!i.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(s(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.assertOptions(a,["legacy"]);const o=r&&r[n.symbols.any];if(o)return s(a.legacy||o.version===n.version,"Cannot mix different versions of joi schemas:",o.version,n.version),r;if("object"!=typeof r||!a.legacy)return t.schema(e,r,{appendPath:!0});const l=i.walk(r);return l?l.compile(l.root,r):t.schema(e,r,{appendPath:!0})},i.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=i.walk(t);if(e)return e}return null}const t=e[n.symbols.any];if(t)return{root:e[t.root],compile:t.compile};s(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=i.walk(e[t]);if(r)return r}return null},i.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,o){if(void 0===o&&(s(r&&"object"==typeof r,"Missing options"),o=r,r=a.create(".")),Array.isArray(o)&&(o={switch:o}),n.assertOptions(o,["is","not","then","otherwise","switch","break"]),n.isSchema(r))return s(void 0===o.is,'"is" can not be used with a schema condition'),s(void 0===o.not,'"not" can not be used with a schema condition'),s(void 0===o.switch,'"switch" can not be used with a schema condition'),i.condition(e,{is:r,then:o.then,otherwise:o.otherwise,break:o.break});if(s(a.isRef(r)||"string"==typeof r,"Invalid condition:",r),s(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let l=o;void 0!==o.not&&(l={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let c=void 0!==l.is?e.$_compile(l.is):e.$_root.invalid(null,!1,0,"").required();return s(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),s(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||a.isRef(o.is)||n.isSchema(o.is)||(c=c.required()),i.condition(e,{ref:t.ref(r),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}s(Array.isArray(o.switch),'"switch" must be an array'),s(void 0===o.is,'Cannot combine "switch" with "is"'),s(void 0===o.not,'Cannot combine "switch" with "not"'),s(void 0===o.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(r),switch:[],break:o.break};for(let t=0;t<o.switch.length;++t){const r=o.switch[t],i=t===o.switch.length-1;n.assertOptions(r,i?["is","then","otherwise"]:["is","then"]),s(void 0!==r.is,'Switch statement missing "is"'),s(void 0!==r.then,'Switch statement missing "then"');const c={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(a.isRef(r.is)||n.isSchema(r.is)||(c.is=c.is.required()),i){s(void 0===o.otherwise||void 0===r.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==o.otherwise?o.otherwise:r.otherwise;void 0!==t&&(s(void 0===l.break,"Cannot specify both otherwise and break"),c.otherwise=e.$_compile(t))}l.switch.push(c)}return l},i.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}},6354:(e,t,r)=>{"use strict";const s=r(5688),n=r(8160),a=r(3328);t.Report=class{constructor(e,r,s,n,a,i,o){if(this.code=e,this.flags=n,this.messages=a,this.path=i.path,this.prefs=o,this.state=i,this.value=r,this.message=null,this.template=null,this.local=s||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,s,i){if(!t)return;if(a.isTemplate(t))return"root"!==r?t:null;let o=i.errors.language;if(n.isResolvable(o)&&(o=o.resolve(e,s,i)),o&&t[o]){if(void 0!==t[o][r])return t[o][r];if(void 0!==t[o]["*"])return t[o]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,s,n){if(e.label)return e.label;if(!s.errors.label)return"";let a=r.path;"key"===s.errors.label&&r.path.length>1&&(a=r.path.slice(-1));return t.path(a)||t.template(null,s.messages,"root",r,s)||n&&t.template(null,n,"root",r,s)||"value"},t.process=function(e,r,s){if(!e)return null;const{override:n,message:a,details:i}=t.details(e);if(n)return n;if(s.errors.stack)return new t.ValidationError(a,i,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(a,i,r);return Error.stackTraceLimit=o,l},t.details=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[];const s=[];for(const n of e){if(n instanceof Error){if(!1!==t.override)return{override:n};const e=n.toString();r.push(e),s.push({message:e,type:"override",context:{error:n}});continue}const e=n.toString();r.push(e),s.push({message:e,path:n.path.filter((e=>"object"!=typeof e)),type:n.code,context:n.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:s}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=s.error},8901:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(8160),i=r(6914),o={};t.type=function(e,t){const r=Object.getPrototypeOf(e),l=n(r),c=e._assign(Object.create(l)),u=Object.assign({},t);delete u.base,l._definition=u;const f=r._definition||{};u.messages=i.merge(f.messages,u.messages),u.properties=Object.assign({},f.properties,u.properties),c.type=u.type,u.flags=Object.assign({},f.flags,u.flags);const h=Object.assign({},f.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];s(void 0===c.$_terms[e],"Invalid term override for",u.type,e),c.$_terms[e]=t.init,h[e]=t}u.terms=h,u.args||(u.args=f.args),u.prepare=o.prepare(u.prepare,f.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=o.coerce(u.coerce,f.coerce),u.validate=o.validate(u.validate,f.validate);const d=Object.assign({},f.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];s("object"==typeof t,"Invalid rule definition for",u.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(s(!l[e],"Rule conflict in",u.type,e),l[e]=r),s(!d[e],"Rule conflict in",u.type,e),d[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)l[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),s(!t.argsByName.has(e.name),"Duplicated argument name",e.name),a.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}u.rules=d;const m=Object.assign({},f.modifiers);if(u.modifiers)for(const e in u.modifiers){s(!l[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];s("function"==typeof t,"Invalid modifier definition for",u.type,e);const r=function(t){return this.rule({[e]:t})};l[e]=r,m[e]=t}if(u.modifiers=m,u.overrides){l._super=r,c.$_super={};for(const e in u.overrides)s(r[e],"Cannot override missing",e),u.overrides[e][a.symbols.parent]=r[e],c.$_super[e]=r[e].bind(c);Object.assign(l,u.overrides)}u.cast=Object.assign({},f.cast,u.cast);const p=Object.assign({},f.manifest,u.manifest);return p.build=o.build(u.manifest&&u.manifest.build,f.manifest&&f.manifest.build),u.manifest=p,u.rebuild=o.rebuild(u.rebuild,f.rebuild),c},o.build=function(e,t){return e&&t?function(r,s){return t(e(r,s),s)}:e||t},o.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,s){let n;if((!t.from||t.from.includes(typeof r))&&(n=t.method(r,s),n)){if(n.errors||void 0===n.value)return n;r=n.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,s);if(t)return t}return n}}:e||t},o.prepare=function(e,t){return e&&t?function(r,s){const n=e(r,s);if(n){if(n.errors||void 0===n.value)return n;r=n.value}return t(r,s)||n}:e||t},o.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},o.validate=function(e,t){return e&&t?function(r,s){const n=t(r,s);if(n){if(n.errors&&(!Array.isArray(n.errors)||n.errors.length))return n;r=n.value}return e(r,s)||n}:e||t}},5107:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(8652),i=r(8160),o=r(3292),l=r(6354),c=r(8901),u=r(9708),f=r(6133),h=r(3328),d=r(1152);let m;const p={types:{alternatives:r(4946),any:r(8068),array:r(546),boolean:r(4937),date:r(7500),function:r(390),link:r(8785),number:r(3832),object:r(8966),string:r(7417),symbol:r(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(p.types))};for(const t of e._types)e[t]=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return s(!r.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),p.generate(this,p.types[t],r)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(){return this.any()[t](...arguments)};Object.assign(e,p.methods);for(const t in p.aliases){const r=p.aliases[t];e[t]=e[r]}return e.x=e.expression,d.setup&&d.setup(e),e}};p.methods={ValidationError:l.ValidationError,version:i.version,cache:a.provider,assert(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];p.assert(e,t,!0,s)},attempt(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];return p.assert(e,t,!1,s)},build(e){return s("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){i.checkPreferences(e)},compile(e,t){return o.compile(this,e,t)},defaults(e){s("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const r of t._types){const n=e(t[r]());s(i.isSchema(n),"modifier must return a valid schema object"),t[r]=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.generate(this,n,t)}}return t},expression(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return new h(...t)},extend(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.verifyFlat(t,"extend"),m=m||r(3378),s(t.length,"You need to provide at least one extension"),this.assert(t,m.extensions);const a=Object.assign({},this);a._types=new Set(a._types);for(let e of t){"function"==typeof e&&(e=e(a)),this.assert(e,m.extension);const t=p.expandExtension(e,a);for(const e of t){s(void 0===a[e.type]||a._types.has(e.type),"Cannot override name",e.type);const t=e.base||this.any(),r=c.type(t,e);a._types.add(e.type),a[e.type]=function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return p.generate(this,r,t)}}}return a},isError:l.ValidationError.isError,isExpression:h.isTemplate,isRef:f.isRef,isSchema:i.isSchema,in(){return f.in(...arguments)},override:i.symbols.override,ref(){return f.create(...arguments)},types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in p.aliases)e[t]=this[t]();return e}},p.assert=function(e,t,r,s){const a=s[0]instanceof Error||"string"==typeof s[0]?s[0]:null,o=null!==a?s[1]:s[0],c=t.validate(e,i.preferences({errors:{stack:!0}},o||{}));let u=c.error;if(!u)return c.value;if(a instanceof Error)throw a;const f=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof l.ValidationError==0&&(u=n(u)),u.message=a?`${a} ${f}`:f,u},p.generate=function(e,t,r){return s(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},p.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const s of t._types)if(e.type.test(s)){const n=Object.assign({},e);n.type=s,n.base=t[s](),r.push(n)}return r},e.exports=p.root()},6914:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(3328);t.compile=function(e,t){if("string"==typeof e)return s(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return s(!t,"Cannot set single message template"),e;s("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?n(t):{};for(let r in e){const n=e[r];if("root"===r||a.isTemplate(n)){t[r]=n;continue}if("string"==typeof n){t[r]=new a(n);continue}s("object"==typeof n&&!Array.isArray(n),"Invalid message for",r);const i=r;for(r in t[i]=t[i]||{},n){const e=n[r];"root"===r||a.isTemplate(e)?t[i][r]=e:(s("string"==typeof e,"Invalid message for",r,"in",i),t[i][r]=new a(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const s=e[r];if("root"===r){t.root=s;continue}if(a.isTemplate(s)){t[r]=s.describe({compact:!0});continue}const n=r;for(r in t[n]={},s){const e=s[r];"root"!==r?t[n][r]=e.describe({compact:!0}):t[n].root=e}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new a(r);if(a.isTemplate(r))return r;const i=n(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){i[e]=t;continue}if("string"==typeof t){i[e]=new a(t);continue}s("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const n=e;for(e in i[n]=i[n]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?i[n][e]=r:(s("string"==typeof r,"Invalid message for",e,"in",n),i[n][e]=new a(r))}}return i}},2294:(e,t,r)=>{"use strict";const s=r(375),n=r(8160),a=r(6133),i={};t.Ids=i.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new i.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())s(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const a=this._collect(e);a.push({schema:r});const o=a.shift();let l={id:o.id,schema:t(o.schema)};s(n.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of a)l={id:e.id,schema:i.fork(e.schema,l.id,l.schema)};return l.schema}labels(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=e[0],s=this._get(r);if(!s)return[...t,...e].join(".");const n=e.slice(1);return t=[...t,s.schema._flags.label||r],n.length?s.schema._ids.labels(n,t):t.join(".")}reach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=e[0],n=this._get(r);s(n,"Schema does not contain path",[...t,...e].join("."));const a=e.slice(1);return a.length?n.schema._ids.reach(a,[...t,r]):n.schema}register(e){let{key:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!n.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);s(!t||t.schema===e,"Cannot add different schemas with the same id:",r),s(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(s(!this._byKey.has(t),"Schema already contains key:",t),s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const n=e[0],a=this._get(n);s(a,"Schema does not contain path",[...t,...e].join(".")),r=[a,...r];const i=e.slice(1);return i.length?a.schema._ids._collect(i,[...t,n],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},i.fork=function(e,r,s){const n=t.schema(e,{each:(e,t)=>{let{key:n}=t;if(r===(e._flags.id||n))return s},ref:!1});return n?n.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const s in e._flags){if("_"===s[0])continue;const n=i.scan(e._flags[s],{source:"flags",name:s},t);void 0!==n&&(r=r||e.clone(),r._flags[s]=n)}for(let s=0;s<e._rules.length;++s){const n=e._rules[s],a=i.scan(n.args,{source:"rules",name:n.name},t);if(void 0!==a){r=r||e.clone();const t=Object.assign({},n);t.args=a,r._rules[s]=t,r._singleRules.get(n.name)===n&&r._singleRules.set(n.name,t)}}for(const s in e.$_terms){if("_"===s[0])continue;const n=i.scan(e.$_terms[s],{source:"terms",name:s},t);void 0!==n&&(r=r||e.clone(),r.$_terms[s]=n)}return r},i.scan=function(e,t,r,s,o){const l=s||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let s=0;s<e.length;++s){const n="terms"===t.source&&"keys"===t.name&&e[s].key,a=i.scan(e[s],t,r,[s,...l],n);void 0!==a&&(c=c||e.slice(),c[s]=a)}return c}if(!1!==r.schema&&n.isSchema(e)||!1!==r.ref&&a.isRef(e)){const s=r.each(e,{...t,path:l,key:o});if(s===e)return;return s}for(const s in e){if("_"===s[0])continue;const n=i.scan(e[s],t,r,[s,...l],o);void 0!==n&&(c=c||Object.assign({},e),c[s]=n)}return c}},6133:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(9621),i=r(8160);let o;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s("string"==typeof e,"Invalid reference key:",e),i.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),s(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},l.defaults,t);delete r.prefix;const n=r.separator,a=l.context(e,n,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.root&&(s(!n||e[0]!==n,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),n&&n===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)s(!n||!e||e[0]!==n,"Cannot combine prefix with ancestor option");else{const[t,s]=l.ancestor(e,n);s&&""===(e=e.slice(s))&&(e=null),r.ancestor=t}return r.path=n?null===e?[]:e.split(n):[e],new l.Ref(r)},t.in=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.create(e,{...r,in:!0})},t.isRef=function(e){return!!e&&!!e[i.symbols.ref]},l.Ref=class{constructor(e){s("object"==typeof e,"Invalid reference construction"),i.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),s([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),s(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),s(!e.map||Array.isArray(e.map),"options.map must be an array"),s(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),s("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,n){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return s(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(n,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(s(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let s;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(s=t.mainstay.shadow.get(this.absolute(t))),void 0===s&&(s=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(s=this.adjust(s)),this.map){const e=this.map.get(s);void 0!==e&&(s=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,s),s}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new l.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},l.Ref.prototype[i.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},l.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new l.Ref(e)},l.context=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e=e.trim(),r){const s=void 0===r.global?"$":r.global;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"global"};const n=void 0===r.local?"#":r.local;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"local"};const a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},l.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,s){if(e)if(s=void 0===s?t.toParent:s,Array.isArray(e))for(const t of e)this.register(t,s);else if(i.isSchema(e))for(const t of e._refs.refs)t.ancestor-s>=0&&this.refs.push({ancestor:t.ancestor-s,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-s>=0&&this.refs.push({ancestor:e.ancestor-s,root:e.root}),o=o||r(3328),o.isTemplate(e)&&this.register(e.refs(),s)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=n(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},3378:(e,t,r)=>{"use strict";const s=r(5107),n={};n.wrap=s.string().min(1).max(2).allow(!1),t.preferences=s.object({allowUnknown:s.boolean(),abortEarly:s.boolean(),artifacts:s.boolean(),cache:s.boolean(),context:s.object(),convert:s.boolean(),dateFormat:s.valid("date","iso","string","time","utc"),debug:s.boolean(),errors:{escapeHtml:s.boolean(),label:s.valid("path","key",!1),language:[s.string(),s.object().ref()],render:s.boolean(),stack:s.boolean(),wrap:{label:n.wrap,array:n.wrap,string:n.wrap}},externals:s.boolean(),messages:s.object(),noDefaults:s.boolean(),nonEnumerables:s.boolean(),presence:s.valid("required","optional","forbidden"),skipFunctions:s.boolean(),stripUnknown:s.object({arrays:s.boolean(),objects:s.boolean()}).or("arrays","objects").allow(!0,!1),warnings:s.boolean()}).strict(),n.nameRx=/^[a-zA-Z0-9]\w*$/,n.rule=s.object({alias:s.array().items(s.string().pattern(n.nameRx)).single(),args:s.array().items(s.string(),s.object({name:s.string().pattern(n.nameRx).required(),ref:s.boolean(),assert:s.alternatives([s.function(),s.object().schema()]).conditional("ref",{is:!0,then:s.required()}),normalize:s.function(),message:s.string().when("assert",{is:s.function(),then:s.required()})})),convert:s.boolean(),manifest:s.boolean(),method:s.function().allow(!1),multi:s.boolean(),validate:s.function()}),t.extension=s.object({type:s.alternatives([s.string(),s.object().regex()]).required(),args:s.function(),cast:s.object().pattern(n.nameRx,s.object({from:s.function().maxArity(1).required(),to:s.function().minArity(1).maxArity(2).required()})),base:s.object().schema().when("type",{is:s.object().regex(),then:s.forbidden()}),coerce:[s.function().maxArity(3),s.object({method:s.function().maxArity(3).required(),from:s.array().items(s.string()).single()})],flags:s.object().pattern(n.nameRx,s.object({setter:s.string(),default:s.any()})),manifest:{build:s.function().arity(2)},messages:[s.object(),s.string()],modifiers:s.object().pattern(n.nameRx,s.function().minArity(1).maxArity(2)),overrides:s.object().pattern(n.nameRx,s.function()),prepare:s.function().maxArity(3),rebuild:s.function().arity(1),rules:s.object().pattern(n.nameRx,n.rule),terms:s.object().pattern(n.nameRx,s.object({init:s.array().allow(null).required(),manifest:s.object().pattern(/.+/,[s.valid("schema","single"),s.object({mapped:s.object({from:s.string().required(),to:s.string().required()}).required()})])})),validate:s.function().maxArity(3)}).strict(),t.extensions=s.array().items(s.object(),s.function().arity(1)).strict(),n.desc={buffer:s.object({buffer:s.string()}),func:s.object({function:s.function().required(),options:{literal:!0}}),override:s.object({override:!0}),ref:s.object({ref:s.object({type:s.valid("value","global","local"),path:s.array().required(),separator:s.string().length(1).allow(!1),ancestor:s.number().min(0).integer().allow("root"),map:s.array().items(s.array().length(2)).min(1),adjust:s.function(),iterables:s.boolean(),in:s.boolean(),render:s.boolean()}).required()}),regex:s.object({regex:s.string().min(3)}),special:s.object({special:s.valid("deep").required()}),template:s.object({template:s.string().required(),options:s.object()}),value:s.object({value:s.alternatives([s.object(),s.array()]).required()})},n.desc.entity=s.alternatives([s.array().items(s.link("...")),s.boolean(),s.function(),s.number(),s.string(),n.desc.buffer,n.desc.func,n.desc.ref,n.desc.regex,n.desc.special,n.desc.template,n.desc.value,s.link("/")]),n.desc.values=s.array().items(null,s.boolean(),s.function(),s.number().allow(1/0,-1/0),s.string().allow(""),s.symbol(),n.desc.buffer,n.desc.func,n.desc.override,n.desc.ref,n.desc.regex,n.desc.template,n.desc.value),n.desc.messages=s.object().pattern(/.+/,[s.string(),n.desc.template,s.object().pattern(/.+/,[s.string(),n.desc.template])]),t.description=s.object({type:s.string().required(),flags:s.object({cast:s.string(),default:s.any(),description:s.string(),empty:s.link("/"),failover:n.desc.entity,id:s.string(),label:s.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:s.boolean(),unit:s.string()}).unknown(),preferences:{allowUnknown:s.boolean(),abortEarly:s.boolean(),artifacts:s.boolean(),cache:s.boolean(),convert:s.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:s.boolean(),label:["path","key"],language:[s.string(),n.desc.ref],wrap:{label:n.wrap,array:n.wrap}},externals:s.boolean(),messages:n.desc.messages,noDefaults:s.boolean(),nonEnumerables:s.boolean(),presence:["required","optional","forbidden"],skipFunctions:s.boolean(),stripUnknown:s.object({arrays:s.boolean(),objects:s.boolean()}).or("arrays","objects").allow(!0,!1),warnings:s.boolean()},allow:n.desc.values,invalid:n.desc.values,rules:s.array().min(1).items({name:s.string().required(),args:s.object().min(1),keep:s.boolean(),message:[s.string(),n.desc.messages],warn:s.boolean()}),keys:s.object().pattern(/.*/,s.link("/")),link:n.desc.ref}).pattern(/^[a-z]\w*$/,s.any())},493:(e,t,r)=>{"use strict";const s=r(8571),n=r(9621),a=r(8160),i={value:Symbol("value")};e.exports=i.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const s=new i.State(e,t,this);return r&&s.schemas&&(s.schemas=[i.schemas(r),...s.schemas]),s}nest(e,t){const r=new i.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[i.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new i.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=s(this.mainstay.shadow.node(this.path)))}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0)}},i.schemas=function(e){return a.isSchema(e)?{schema:e}:e},i.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let s=this._values;for(let t=0;t<e.length;++t){const r=e[t];let n=s.get(r);n||(n=new Map,s.set(r,n)),s=n}s[i.value]=t}get(e){const t=this.node(e);if(t)return t[i.value]}node(e){if(this._values)return n(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const r=e.slice(0,-1),s=e[e.length-1],a=n(this._values,r,{iterables:!0});t?a.set(s,t):a&&a.delete(s)}}},3328:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(5277),i=r(1447),o=r(8160),l=r(6354),c=r(6133),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){s("string"==typeof e,"Template source must be a string"),s(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,this._settings=n(t),this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let r=!1;const s=[],n=t.shift();n&&s.push(n);for(const e of t){const t="{"!==e[0],n=t?"}":"}}",a=e.indexOf(n);if(-1===a||"{"===e[1]){s.push(`{${u.decode(e)}`);continue}let i=e.slice(t?0:1,a);const o=":"===i[0];o&&(i=i.slice(1));const l=this._ref(u.decode(i),{raw:t,wrapped:o});s.push(l),"string"!=typeof l&&(r=!0);const c=e.slice(a+n.length);c&&s.push(u.decode(c))}r?this._template=s:this.rendered=s.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),t}static build(e){return new u.Template(e.template,e.options)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[o.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,s){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,s,{}):this.render(e,t,r,s)}_part(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return e.ref?e.ref.resolve(...r):e.formula.evaluate(r)}render(e,t,r,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!this.isDynamic())return this.rendered;const i=[];for(const o of this._template)if("string"==typeof o)i.push(o);else{const l=this._part(o,e,t,r,s,n),c=u.stringify(l,e,t,r,s,n);if(void 0!==c){const e=o.raw||!1===(n.errors&&n.errors.escapeHtml)?c:a(c);i.push(u.wrap(e,o.wrapped&&r.errors.wrap.label))}}return i.join("")}_ref(e,t){let{raw:r,wrapped:s}=t;const n=[],a=e=>{const t=c.create(e,this._settings);return n.push(t),e=>t.resolve(...e)};try{var o=new i.Parser(e,{reference:a,functions:u.functions,constants:u.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(o.single){if("reference"===o.single.type){const e=n[0];return{ref:e,raw:r,refs:n,wrapped:s||"local"===e.type&&"label"===e.key}}return u.stringify(o.single.value)}return{formula:o,raw:r,refs:n}}toString(){return this.source}},u.Template.prototype[o.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>u.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>u.closes.slice(0,t.length)))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let r="";for(let s=0;s<e.length;++s){const n=e[s];if("{"===n){let n="";for(;s+1<e.length&&"{"===e[s+1];)n+="{",++s;t.push(r),r=n}else r+=n}return t.push(r),t},u.wrap=function(e,t){return t?1===t.length?`${t}${e}${t}`:`${t[0]}${e}${t[1]}`:e},u.stringify=function(e,t,r,s,n){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const i=typeof e,o=s&&s.errors&&s.errors.wrap||{};let l=!1;if(c.isRef(e)&&e.render&&(l=e.in,e=e.resolve(t,r,s,n,{in:e.in,...a})),null===e)return"null";if("string"===i)return u.wrap(e,a.arrayItems&&o.string);if("number"===i||"function"===i||"symbol"===i)return e.toString();if("object"!==i)return JSON.stringify(e);if(e instanceof Date)return u.Template.date(e,s);if(e instanceof Map){const t=[];for(const[r,s]of e.entries())t.push(`${r.toString()} -> ${s.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const f=[];for(const i of e)f.push(u.stringify(i,t,r,s,n,{arrayItems:!0,...a}));return u.wrap(f.join(", "),!l&&o.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,s,n,a]=this,i=a.messages;if(!i)return"";const o=l.template(t,i[0],e,r,s)||l.template(t,i[1],e,r,s);return o?o.render(t,r,s,n,a):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},4946:(e,t,r)=>{"use strict";const s=r(375),n=r(1687),a=r(8068),i=r(8160),o=r(3292),l=r(6354),c=r(6133),u={};e.exports=a.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:c.toSibling}},args(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return 1===r.length&&Array.isArray(r[0])?e.try(...r[0]):e.try(...r)},validate(e,t){const{schema:r,error:s,state:a,prefs:i}=t;if(r._flags.match){const t=[],o=[];for(let s=0;s<r.$_terms.matches.length;++s){const n=r.$_terms.matches[s],l=a.nest(n.schema,`match.${s}`);l.snapshot();const c=n.schema.$_validate(e,l,i);c.errors?(o.push(c.errors),l.restore()):t.push(c.value)}if(0===t.length)return{errors:s("alternatives.any",{details:o.map((e=>l.details(e,{override:!1})))})};if("one"===r._flags.match)return 1===t.length?{value:t[0]}:{errors:s("alternatives.one")};if(t.length!==r.$_terms.matches.length)return{errors:s("alternatives.all",{details:o.map((e=>l.details(e,{override:!1})))})};const c=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&c(e.schema)));return c(r)?{value:t.reduce(((e,t)=>n(e,t,{mergeArrays:!1})))}:{value:t[t.length-1]}}const o=[];for(let t=0;t<r.$_terms.matches.length;++t){const s=r.$_terms.matches[t];if(s.schema){const r=a.nest(s.schema,`match.${t}`);r.snapshot();const n=s.schema.$_validate(e,r,i);if(!n.errors)return n;r.restore(),o.push({schema:s.schema,reports:n.errors});continue}const n=s.ref?s.ref.resolve(e,a,i):e,l=s.is?[s]:s.switch;for(let r=0;r<l.length;++r){const o=l[r],{is:c,then:u,otherwise:f}=o,h=`match.${t}${s.switch?"."+r:""}`;if(c.$_match(n,a.nest(c,`${h}.is`),i)){if(u)return u.$_validate(e,a.nest(u,`${h}.then`),i)}else if(f)return f.$_validate(e,a.nest(f,`${h}.otherwise`),i)}}return u.errors(o,t)},rules:{conditional:{method(e,t){s(!this._flags._endedSwitch,"Unreachable condition"),s(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),s(void 0===t.break,"Cannot use break option with alternatives conditional");const r=this.clone(),n=o.when(r,e,t),a=n.is?[n]:n.switch;for(const e of a)if(e.then&&e.otherwise){r.$_setFlag("_endedSwitch",!0,{clone:!1});break}return r.$_terms.matches.push(n),r.$_mutateRebuild()}},match:{method(e){if(s(["any","one","all"].includes(e),"Invalid alternatives match mode",e),"any"!==e)for(const t of this.$_terms.matches)s(t.schema,"Cannot combine match mode",e,"with conditional rules");return this.$_setFlag("match",e)}},try:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];s(t.length,"Missing alternative schemas"),i.verifyFlat(t,"try"),s(!this._flags._endedSwitch,"Unreachable condition");const n=this.clone();for(const e of t)n.$_terms.matches.push({schema:n.$_compile(e)});return n.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,r)=>"is"!==r.path[0]?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{i.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:s,is:n,not:a,then:i,otherwise:o}=r;e=t?e.try(t):s?e.conditional(s,{is:n,then:i,not:a,otherwise:o,switch:r.switch}):e.conditional(n,{then:i,otherwise:o})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,t){let{error:r,state:s}=t;if(!e.length)return{errors:r("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,a=[];for(const{reports:t,schema:i}of e){if(t.length>1)return u.unmatched(e,r);const o=t[0];if(o instanceof l.Report==0)return u.unmatched(e,r);if(o.state.path.length!==s.path.length){a.push({type:i.type,report:o});continue}if("any.only"===o.code){for(const e of o.local.valids)n.add(e);continue}const[c,f]=o.code.split(".");"base"===f?n.add(c):a.push({type:i.type,report:o})}return a.length?1===a.length?{errors:a[0].report}:u.unmatched(e,r):{errors:r("alternatives.types",{types:[...n]})}},u.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",l.details(r,{override:!1}))}}},8068:(e,t,r)=>{"use strict";const s=r(375),n=r(7629),a=r(8160),i=r(6914);e.exports=n.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return s("function"==typeof e,"Method must be a function"),s(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,r){let{method:s}=r;try{return s(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){s(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return s(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate(e,t,r){let{code:s,local:n}=r;return t.error(s,n)},args:["code","local"],multi:!0}},modifiers:{keep(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.keep=t},message(e,t){e.message=i.compile(t)},warn(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.warn=t}},manifest:{build(e,t){for(const r in t){const s=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of s)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of s)e=e.shared(t)}else for(const t of s){const{ref:r,is:s,not:n,then:a,otherwise:i,concat:o}=t;e=o?e.concat(o):r?e.when(r,{is:s,not:n,then:a,otherwise:i,switch:t.switch,break:t.break}):e.when(s,{then:a,otherwise:i,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of s)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,r)=>{"use strict";const s=r(375),n=r(9474),a=r(9621),i=r(8068),o=r(8160),l=r(3292),c={};e.exports=i.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,t){let{schema:r,state:s,prefs:n}=t;if(!Array.isArray(e))return;const a=r.$_getRule("sort");return a?c.sort(r,e,a.args.options,s,n):void 0}},validate(e,t){let{schema:r,error:s}=t;if(!Array.isArray(e)){if(r._flags.single){const t=[e];return t[o.symbols.arraySingle]=!0,{value:t}}return{errors:s("array.base")}}if(r.$_getRule("items")||r.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,t,r){let{state:s,prefs:n,error:a}=t,{schema:i}=r;const o=[e,...s.ancestors];for(let t=0;t<e.length;++t){const r=s.localize([...s.path,t],o,i);if(i.$_match(e[t],r,n))return e}const l=i._flags.label;return l?a("array.hasKnown",{patternLabel:l}):a("array.hasUnknown",null)},multi:!0},items:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];o.verifyFlat(t,"items");const s=this.$_addRule("items");for(let e=0;e<t.length;++e){const r=o.tryWithPath((()=>this.$_compile(t[e])),e,{append:!0});s.$_terms.items.push(r)}return s.$_mutateRebuild()},validate(e,t){let{schema:r,error:s,state:n,prefs:a,errorsArray:i}=t;const l=r.$_terms._requireds.slice(),u=r.$_terms.ordered.slice(),f=[...r.$_terms._inclusions,...l],h=!e[o.symbols.arraySingle];delete e[o.symbols.arraySingle];const d=i();let m=e.length;for(let t=0;t<m;++t){const i=e[t];let o=!1,p=!1;const g=h?t:new Number(t),y=[...n.path,g];if(!r._flags.sparse&&void 0===i){if(d.push(s("array.sparse",{key:g,path:y,pos:t,value:void 0},n.localize(y))),a.abortEarly)return d;u.shift();continue}const b=[e,...n.ancestors];for(const e of r.$_terms._exclusions)if(e.$_match(i,n.localize(y,b,e),a,{presence:"ignore"})){if(d.push(s("array.excludes",{pos:t,value:i},n.localize(y))),a.abortEarly)return d;o=!0,u.shift();break}if(o)continue;if(r.$_terms.ordered.length){if(u.length){const o=u.shift(),l=o.$_validate(i,n.localize(y,b,o),a);if(l.errors){if(d.push(...l.errors),a.abortEarly)return d}else if("strip"===o._flags.result)c.fastSplice(e,t),--t,--m;else{if(!r._flags.sparse&&void 0===l.value){if(d.push(s("array.sparse",{key:g,path:y,pos:t,value:void 0},n.localize(y))),a.abortEarly)return d;continue}e[t]=l.value}continue}if(!r.$_terms.items.length){if(d.push(s("array.orderedLength",{pos:t,limit:r.$_terms.ordered.length})),a.abortEarly)return d;break}}const v=[];let _=l.length;for(let o=0;o<_;++o){const u=n.localize(y,b,l[o]);u.snapshot();const f=l[o].$_validate(i,u,a);if(v[o]=f,!f.errors){if(e[t]=f.value,p=!0,c.fastSplice(l,o),--o,--_,!r._flags.sparse&&void 0===f.value&&(d.push(s("array.sparse",{key:g,path:y,pos:t,value:void 0},n.localize(y))),a.abortEarly))return d;break}u.restore()}if(p)continue;const w=a.stripUnknown&&!!a.stripUnknown.arrays||!1;_=f.length;for(const u of f){let f;const h=l.indexOf(u);if(-1!==h)f=v[h];else{const l=n.localize(y,b,u);if(l.snapshot(),f=u.$_validate(i,l,a),!f.errors){"strip"===u._flags.result?(c.fastSplice(e,t),--t,--m):r._flags.sparse||void 0!==f.value?e[t]=f.value:(d.push(s("array.sparse",{key:g,path:y,pos:t,value:void 0},n.localize(y))),o=!0),p=!0;break}l.restore()}if(1===_){if(w){c.fastSplice(e,t),--t,--m,p=!0;break}if(d.push(...f.errors),a.abortEarly)return d;o=!0;break}}if(!o&&(r.$_terms._inclusions.length||r.$_terms._requireds.length)&&!p){if(w){c.fastSplice(e,t),--t,--m;continue}if(d.push(s("array.includes",{pos:t,value:i},n.localize(y))),a.abortEarly)return d}}return l.length&&c.fillMissedErrors(r,d,l,e,n,a),u.length&&(c.fillOrderedErrors(r,d,u,e,n,a),d.length||c.fillDefault(u,e,n,a)),d.length?d:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate(e,t,r,s){let{limit:n}=r,{name:a,operator:i,args:l}=s;return o.compare(e.length,n,i)?e:t.error("array."+a,{limit:l.limit,value:e})},args:[{name:"limit",ref:!0,assert:o.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];o.verifyFlat(t,"ordered");const s=this.$_addRule("items");for(let e=0;e<t.length;++e){const r=o.tryWithPath((()=>this.$_compile(t[e])),e,{append:!0});c.validateSingle(r,s),s.$_mutateRegister(r),s.$_terms.ordered.push(r)}return s.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return s(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=l.ref(e.by,{ancestor:0}),s(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,t,r){let{error:s,state:n,prefs:a,schema:i}=t,{options:o}=r;const{value:l,errors:u}=c.sort(i,e,o,n,a);if(u)return u;for(let t=0;t<e.length;++t)if(e[t]!==l[t])return s("array.sort",{order:o.order,by:o.by?o.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),o.assertOptions(t,["ignoreUndefined","separator"]);const r={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const s=o.default(t.separator,".");r.path=s?e.split(s):[e]}else r.comparator=e;return this.$_addRule(r)},validate(e,t,r,i){let{state:o,error:l,schema:c}=t,{comparator:u,options:f}=r,{comparator:h,path:d}=i;const m={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},p=h||n,g=f.ignoreUndefined;for(let t=0;t<e.length;++t){const r=d?a(e[t],d):e[t],n=h?m.custom:m[typeof r];if(s(n,"Failed to find unique map container for type",typeof r),n instanceof Map){const s=n.entries();let a;for(;!(a=s.next()).done;)if(p(a.value[0],r)){const r=o.localize([...o.path,t],[e,...o.ancestors]),s={pos:t,value:e[t],dupePos:a.value[1],dupeValue:e[a.value[1]]};return d&&(s.path=u),l("array.unique",s,r)}n.set(r,t)}else{if((!g||void 0!==r)&&void 0!==n[r]){const s={pos:t,value:e[t],dupePos:n[r],dupeValue:e[n[r]]};return d&&(s.path=u),l("array.unique",s,o.localize([...o.path,t],[e,...o.ancestors]))}n[r]=t}}return e},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)c.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)c.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),c.fillMissedErrors=function(e,t,r,s,n,a){const i=[];let o=0;for(const e of r){const t=e._flags.label;t?i.push(t):++o}i.length?o?t.push(e.$_createError("array.includesRequiredBoth",s,{knownMisses:i,unknownMisses:o},n,a)):t.push(e.$_createError("array.includesRequiredKnowns",s,{knownMisses:i},n,a)):t.push(e.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:o},n,a))},c.fillOrderedErrors=function(e,t,r,s,n,a){const i=[];for(const e of r)"required"===e._flags.presence&&i.push(e);i.length&&c.fillMissedErrors(e,t,i,s,n,a)},c.fillDefault=function(e,t,r,s){const n=[];let a=!0;for(let i=e.length-1;i>=0;--i){const o=e[i],l=[t,...r.ancestors],c=o.$_validate(void 0,r.localize(r.path,l,o),s).value;if(a){if(void 0===c)continue;a=!1}n.unshift(c)}n.length&&t.push(...n)},c.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},c.validateSingle=function(e,t){("array"===e.type||e._flags._arrayItems)&&(s(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},c.sort=function(e,t,r,s,n){const a="ascending"===r.order?1:-1,i=-1*a,o=a,l=(l,u)=>{let f=c.compare(l,u,i,o);if(null!==f)return f;if(r.by&&(l=r.by.resolve(l,s,n),u=r.by.resolve(u,s,n)),f=c.compare(l,u,i,o),null!==f)return f;const h=typeof l;if(h!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,s,n);if("number"!==h&&"string"!==h)throw e.$_createError("array.sort.unsupported",t,{type:h},s,n);return"number"===h?(l-u)*a:l<u?i:o};try{return{value:t.slice().sort(l)}}catch(e){return{errors:e}}},c.compare=function(e,t,r,s){return e===t?0:void 0===e?1:void 0===t?-1:null===e?s:null===t?r:null}},4937:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a=r(8160),i=r(2036),o={isBool:function(e){return"boolean"==typeof e}};e.exports=n.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,t){let{schema:r}=t;if("boolean"!=typeof e){if("string"==typeof e){const t=r._flags.sensitive?e:e.toLowerCase();e="true"===t||"false"!==t&&e}return"boolean"!=typeof e&&(e=r.$_terms.truthy&&r.$_terms.truthy.has(e,null,null,!r._flags.sensitive)||(!r.$_terms.falsy||!r.$_terms.falsy.has(e,null,null,!r._flags.sensitive))&&e),{value:e}}},validate(e,t){let{error:r}=t;if("boolean"!=typeof e)return{value:e,errors:r("boolean.base")}},rules:{truthy:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.verifyFlat(t,"truthy");const n=this.clone();n.$_terms.truthy=n.$_terms.truthy||new i;for(let e=0;e<t.length;++e){const r=t[e];s(void 0!==r,"Cannot call truthy with undefined"),n.$_terms.truthy.add(r)}return n}},falsy:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.verifyFlat(t,"falsy");const n=this.clone();n.$_terms.falsy=n.$_terms.falsy||new i;for(let e=0;e<t.length;++e){const r=t[e];s(void 0!==r,"Cannot call falsy with undefined"),n.$_terms.falsy.add(r)}return n}},sensitive:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("sensitive",e)}}},cast:{number:{from:o.isBool,to:(e,t)=>e?1:0},string:{from:o.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a=r(8160),i=r(3328),o={isDate:function(e){return e instanceof Date}};e.exports=n.extend({type:"date",coerce:{from:["number","string"],method(e,t){let{schema:r}=t;return{value:o.parse(e,r._flags.format)||e}}},validate(e,t){let{schema:r,error:s,prefs:n}=t;if(e instanceof Date&&!isNaN(e.getTime()))return;const a=r._flags.format;return n.convert&&a&&"string"==typeof e?{value:e,errors:s("date.format",{format:a})}:{value:e,errors:s("date.base")}},rules:{compare:{method:!1,validate(e,t,r,s){let{date:n}=r,{name:i,operator:o,args:l}=s;const c="now"===n?Date.now():n.getTime();return a.compare(e.getTime(),c,o)?e:t.error("date."+i,{limit:l.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:o.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return s(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"javascript";return s(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:o.isDate,to:(e,t)=>e.getTime()},string:{from:o.isDate,to(e,t){let{prefs:r}=t;return i.date(e,r)}}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),o.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return a.isIsoDate(e)?o.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return o.date(1*e);if("unix"===t)return o.date(1e3*e);if("string"==typeof r)return null}return o.date(e)},o.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,r)=>{"use strict";const s=r(375),n=r(7824);e.exports=n.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return s(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate(e,t,r){let{n:s}=r;return e.length===s?e:t.error("function.arity",{n:s})}},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return s(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate(e,t,r){let{n:s}=r;return e.length>=s?e:t.error("function.minArity",{n:s})}},maxArity:{method(e){return s(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate(e,t,r){let{n:s}=r;return e.length<=s?e:t.error("function.maxArity",{n:s})}}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(e,t,r)=>{"use strict";const s=r(978),n=r(375),a=r(8571),i=r(3652),o=r(8068),l=r(8160),c=r(3292),u=r(6354),f=r(6133),h=r(3328),d={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=o.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,t){let{schema:r,error:s,state:n,prefs:a}=t;if(!e||typeof e!==r.$_property("typeof")||Array.isArray(e))return{value:e,errors:s("object.base",{type:r.$_property("typeof")})};if(!(r.$_terms.renames||r.$_terms.dependencies||r.$_terms.keys||r.$_terms.patterns||r.$_terms.externals))return;e=d.clone(e,a);const i=[];if(r.$_terms.renames&&!d.rename(r,e,n,a,i))return{value:e,errors:i};if(!r.$_terms.keys&&!r.$_terms.patterns&&!r.$_terms.dependencies)return{value:e,errors:i};const o=new Set(Object.keys(e));if(r.$_terms.keys){const t=[e,...n.ancestors];for(const s of r.$_terms.keys){const r=s.key,l=e[r];o.delete(r);const c=n.localize([...n.path,r],t,s),u=s.schema.$_validate(l,c,a);if(u.errors){if(a.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[r]=u.value),i.push(...u.errors)}else"strip"===s.schema._flags.result||void 0===u.value&&void 0!==l?delete e[r]:void 0!==u.value&&(e[r]=u.value)}}if(o.size||r._flags._hasPatternMatch){const t=d.unknown(r,e,o,i,n,a);if(t)return t}if(r.$_terms.dependencies)for(const t of r.$_terms.dependencies){if(null!==t.key&&!1===d.isPresent(t.options)(t.key.resolve(e,n,a,null,{shadow:!1})))continue;const s=d.dependencies[t.rel](r,t,e,n,a);if(s){const t=r.$_createError(s.code,e,s.context,n,a);if(a.abortEarly)return{value:e,errors:t};i.push(t)}}return{value:e,errors:i}},rules:{and:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"and"),d.dependency(this,"and",null,t)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){h.isTemplate(e)||(e=c.ref(e)),n(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const s=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return s.$_mutateRegister(e),s.$_mutateRegister(t),s},validate(e,t,r){let{error:s,prefs:n,state:a}=t,{subject:i,schema:o,message:l}=r;const c=i.resolve(e,a,n),u=f.isRef(i)?i.absolute(a):[];return o.$_match(c,a.localize(u,[e,...a.ancestors],o),n)?e:s("object.assert",{subject:i,message:l})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return n("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate(e,t,r){let{constructor:s,name:n}=r;return e instanceof s?e:t.error("object.instance",{type:n,value:e})},args:["constructor","name"]},keys:{method(e){n(void 0===e||"object"==typeof e,"Object schema must be a valid object"),n(!l.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new d.Keys;for(const r in e)l.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new d.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate(e,t,r,s){let{limit:n}=r,{name:a,operator:i,args:o}=s;return l.compare(Object.keys(e).length,n,i)?e:t.error("object."+a,{limit:o.limit,value:e})},args:[{name:"limit",ref:!0,assert:l.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"nand"),d.dependency(this,"nand",null,t)}},or:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"or"),d.dependency(this,"or",null,t)}},oxor:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return d.dependency(this,"oxor",null,t)}},pattern:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=e instanceof RegExp;s||(e=this.$_compile(e,{appendPath:!0})),n(void 0!==t,"Invalid rule"),l.assertOptions(r,["fallthrough","matches"]),s&&n(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const i={[s?"regex":"schema"]:e,rule:t};return r.matches&&(i.matches=this.$_compile(r.matches),"array"!==i.matches.type&&(i.matches=i.matches.$_root.array().items(i.matches)),a.$_mutateRegister(i.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(i.fallthrough=!0),a.$_terms.patterns.push(i),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>f.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),n("string"==typeof t||t instanceof h,"Invalid rename to argument"),n(t!==e,"Cannot rename key to same name:",e),l.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)n(t.from!==e,"Cannot rename the same key multiple times");return t instanceof h&&a.$_mutateRegister(t),a.$_terms.renames.push({from:e,to:t,options:s(d.renameDefaults,r)}),a}},schema:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return this.$_addRule({name:"schema",args:{type:e}})},validate(e,t,r){let{type:s}=r;return!l.isSchema(e)||"any"!==s&&e.type!==s?t.error("object.schema",{type:s}):e}},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return d.dependency(this,"with",e,t,r)}},without:{method(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return d.dependency(this,"without",e,t,r)}},xor:{method(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.verifyFlat(t,"xor"),d.dependency(this,"xor",null,t)}}},overrides:{default(e,t){return void 0===e&&(e=l.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new i.Sorter;for(const r of e.$_terms.keys)l.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new d.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:s=null,peers:n,options:a}of t.dependencies)e=d.dependency(e,r,s,n,a);if(t.patterns)for(const{regex:r,schema:s,rule:n,fallthrough:a,matches:i}of t.patterns)e=e.pattern(r||s,n,{fallthrough:a,matches:i});if(t.renames)for(const{from:r,to:s,options:n}of t.renames)e=e.rename(r,s,n);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),d.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return a(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return e.apply(this,r)};return r.prototype=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},d.dependency=function(e,t,r,s,a){n(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=s.length>1&&"object"==typeof s[s.length-1]?s.pop():{}),l.assertOptions(a,["separator","isPresent"]),s=[].concat(s);const i=l.default(a.separator,"."),o=[];for(const e of s)n("string"==typeof e,t,"peers must be strings"),o.push(c.ref(e,{separator:i,ancestor:0,prefix:!1}));null!==r&&(r=c.ref(r,{separator:i,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new d.Dependency(t,r,o,s,a)),u},d.dependencies={and(e,t,r,s,n){const a=[],i=[],o=t.peers.length,l=d.isPresent(t.options);for(const e of t.peers)!1===l(e.resolve(r,s,n,null,{shadow:!1}))?a.push(e.key):i.push(e.key);if(a.length!==o&&i.length!==o)return{code:"object.and",context:{present:i,presentWithLabels:d.keysToLabels(e,i),missing:a,missingWithLabels:d.keysToLabels(e,a)}}},nand(e,t,r,s,n){const a=[],i=d.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(a.length!==t.peers.length)return;const o=t.paths[0],l=t.paths.slice(1);return{code:"object.nand",context:{main:o,mainWithLabel:d.keysToLabels(e,o),peers:l,peersWithLabels:d.keysToLabels(e,l)}}},or(e,t,r,s,n){const a=d.isPresent(t.options);for(const e of t.peers)if(a(e.resolve(r,s,n,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:d.keysToLabels(e,t.paths)}}},oxor(e,t,r,s,n){const a=[],i=d.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(!a.length||1===a.length)return;const o={peers:t.paths,peersWithLabels:d.keysToLabels(e,t.paths)};return o.present=a,o.presentWithLabels=d.keysToLabels(e,a),{code:"object.oxor",context:o}},with(e,t,r,s,n){const a=d.isPresent(t.options);for(const i of t.peers)if(!1===a(i.resolve(r,s,n,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:d.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:d.keysToLabels(e,i.key)}}},without(e,t,r,s,n){const a=d.isPresent(t.options);for(const i of t.peers)if(a(i.resolve(r,s,n,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:d.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:d.keysToLabels(e,i.key)}}},xor(e,t,r,s,n){const a=[],i=d.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(1===a.length)return;const o={peers:t.paths,peersWithLabels:d.keysToLabels(e,t.paths)};return 0===a.length?{code:"object.missing",context:o}:(o.present=a,o.presentWithLabels=d.keysToLabels(e,a),{code:"object.xor",context:o})}},d.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},d.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},d.rename=function(e,t,r,s,n){const a={};for(const i of e.$_terms.renames){const o=[],l="string"!=typeof i.from;if(l)for(const e in t){if(void 0===t[e]&&i.options.ignoreUndefined)continue;if(e===i.to)continue;const r=i.from.exec(e);r&&o.push({from:e,to:i.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,i.from)||void 0===t[i.from]&&i.options.ignoreUndefined||o.push(i);for(const c of o){const o=c.from;let u=c.to;if(u instanceof h&&(u=u.render(t,r,s,c.match)),o!==u){if(!i.options.multiple&&a[u]&&(n.push(e.$_createError("object.rename.multiple",t,{from:o,to:u,pattern:l},r,s)),s.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!i.options.override&&!a[u]&&(n.push(e.$_createError("object.rename.override",t,{from:o,to:u,pattern:l},r,s)),s.abortEarly))return!1;void 0===t[o]?delete t[u]:t[u]=t[o],a[u]=!0,i.options.alias||delete t[o]}}}return!0},d.unknown=function(e,t,r,s,n,a){if(e.$_terms.patterns){let i=!1;const o=e.$_terms.patterns.map((e=>{if(e.matches)return i=!0,[]})),l=[t,...n.ancestors];for(const i of r){const c=t[i],u=[...n.path,i];for(let f=0;f<e.$_terms.patterns.length;++f){const h=e.$_terms.patterns[f];if(h.regex){const e=h.regex.test(i);if(n.mainstay.tracer.debug(n,"rule",`pattern.${f}`,e?"pass":"error"),!e)continue}else if(!h.schema.$_match(i,n.nest(h.schema,`pattern.${f}`),a))continue;r.delete(i);const d=n.localize(u,l,{schema:h.rule,key:i}),m=h.rule.$_validate(c,d,a);if(m.errors){if(a.abortEarly)return{value:t,errors:m.errors};s.push(...m.errors)}if(h.matches&&o[f].push(i),t[i]=m.value,!h.fallthrough)break}}if(i)for(let r=0;r<o.length;++r){const i=o[r];if(!i)continue;const c=e.$_terms.patterns[r].matches,f=n.localize(n.path,l,c),h=c.$_validate(i,f,a);if(h.errors){const r=u.details(h.errors,{override:!1});r.matches=i;const o=e.$_createError("object.pattern.match",t,r,n,a);if(a.abortEarly)return{value:t,errors:o};s.push(o)}}}if(r.size&&(e.$_terms.keys||e.$_terms.patterns)){if(a.stripUnknown&&!e._flags.unknown||a.skipFunctions){const e=!(!a.stripUnknown||!0!==a.stripUnknown&&!a.stripUnknown.objects);for(const s of r)e?(delete t[s],r.delete(s)):"function"==typeof t[s]&&r.delete(s)}if(!l.default(e._flags.unknown,a.allowUnknown))for(const i of r){const r=n.localize([...n.path,i],[]),o=e.$_createError("object.unknown",t[i],{child:i},r,a,{flags:!1});if(a.abortEarly)return{value:t,errors:o};s.push(o)}}},d.Dependency=class{constructor(e,t,r,s,n){this.rel=e,this.key=t,this.peers=r,this.paths=s,this.options=n}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options={...e.options,separator:this.peers[0].separator}),this.options.isPresent&&(e.options={...e.options,isPresent:this.options.isPresent}),e}},d.Keys=class extends Array{concat(e){const t=this.slice(),r=new Map;for(let e=0;e<t.length;++e)r.set(t[e].key,e);for(const s of e){const e=s.key,n=r.get(e);void 0!==n?t[n]={key:e,schema:t[n].schema.concat(s.schema)}:t.push(s)}return t}}},8785:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a=r(8160),i=r(3292),o=r(6354),l={};e.exports=n.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,t){let{schema:r,state:n,prefs:a}=t;s(r.$_terms.link,"Uninitialized link schema");const i=l.generate(r,e,n,a),o=r.$_terms.link[0].ref;return i.$_validate(e,n.nest(i,`link:${o.display}:${i.type}`),a)},generate:(e,t,r,s)=>l.generate(e,t,r,s),rules:{ref:{method(e){s(!this.$_terms.link,"Cannot reinitialize schema"),e=i.ref(e),s("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),s("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.$_setFlag("relative",e)}}},overrides:{concat(e){s(this.$_terms.link,"Uninitialized link schema"),s(a.isSchema(e),"Invalid schema object"),s("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(s(t.link,"Invalid link description missing link"),e.ref(t.link))}}),l.generate=function(e,t,r,s){let n=r.mainstay.links.get(e);if(n)return n._generate(t,r,s).schema;const a=e.$_terms.link[0].ref,{perspective:i,path:o}=l.perspective(a,r);l.assert(i,"which is outside of schema boundaries",a,e,r,s);try{n=o.length?i.$_reach(o):i}catch(t){l.assert(!1,"to non-existing schema",a,e,r,s)}return l.assert("link"!==n.type,"which is another link",a,e,r,s),e._flags.relative||r.mainstay.links.set(e,n),n._generate(t,r,s).schema},l.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:s}of t.schemas){if((r._flags.id||s)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},l.assert=function(e,t,r,n,a,i){e||s(!1,`"${o.label(n._flags,a,i)}" contains link reference "${r.display}" ${t}`)}},3832:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a=r(8160),i={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};e.exports=n.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,t){let{schema:r,error:s}=t;if(!e.match(i.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!r._flags.unsafe)if(e.match(/e/i)){if(i.extractSignificantDigits(e)!==i.extractSignificantDigits(String(n.value)))return n.errors=s("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==i.normalizeDecimal(e))return n.errors=s("number.unsafe"),n}return n}},validate(e,t){let{schema:r,error:s,prefs:n}=t;if(e===1/0||e===-1/0)return{value:e,errors:s("number.infinity")};if(!a.isNumber(e))return{value:e,errors:s("number.base")};const i={value:e};if(n.convert){const e=r.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);i.value=Math.round(i.value*t)/t}}return 0===i.value&&(i.value=0),!r._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(i.errors=s("number.unsafe")),i},rules:{compare:{method:!1,validate(e,t,r,s){let{limit:n}=r,{name:i,operator:o,args:l}=s;return a.compare(e,n,o)?e:t.error("number."+i,{limit:l.limit,value:e})},args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate(e,t,r,s){let{base:n}=r;return e*(1/n)%1==0?e:t.error("number.multiple",{multiple:s.args.base,value:e})},args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return s(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,r){let{limit:s}=r;const n=e.toString().match(i.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=s?e:t.error("number.precision",{limit:s,value:e})},convert:!0},sign:{method(e){return s(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate(e,t,r){let{sign:s}=r;return"negative"===s&&e<0||"positive"===s&&e>0?e:t.error(`number.${s}`)}},unsafe:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),i.extractSignificantDigits=function(e){return e.replace(i.exponentialPartRegex,"").replace(i.dotRegex,"").replace(i.trailingZerosRegex,"").replace(i.leadingSignAndZerosRegex,"")},i.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,r)=>{"use strict";const s=r(7824);e.exports=s.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},7417:(e,t,r)=>{"use strict";const s=r(375),n=r(5380),a=r(1745),i=r(9959),o=r(6064),l=r(9926),c=r(5752),u=r(8068),f=r(8160),h={tlds:l instanceof Set&&{tlds:{allow:l,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,ipRegex:i.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=u.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,t){let{schema:r,state:s,prefs:n}=t;const a=r.$_getRule("normalize");a&&(e=e.normalize(a.args.form));const i=r.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=r.$_getRule("trim");if(o&&o.args.enabled&&(e=e.trim()),r.$_terms.replacements)for(const t of r.$_terms.replacements)e=e.replace(t.pattern,t.replacement);const l=r.$_getRule("hex");if(l&&l.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),r.$_getRule("isoDate")){const t=h.isoDate(e);t&&(e=t)}if(r._flags.truncate){const t=r.$_getRule("max");if(t){let a=t.args.limit;if(f.isResolvable(a)&&(a=a.resolve(e,s,n),!f.limit(a)))return{value:e,errors:r.$_createError("any.ref",a,{ref:t.args.limit,arg:"limit",reason:"must be a positive integer"},s,n)};e=e.slice(0,a)}}return{value:e}}},validate(e,t){let{schema:r,error:s}=t;if("string"!=typeof e)return{value:e,errors:s("string.base")};if(""===e){const t=r.$_getRule("min");if(t&&0===t.args.limit)return;return{value:e,errors:s("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},s("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),s("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate(e,t,r){let{options:s}=r;return h.base64Regex[s.paddingRequired][s.urlSafe].test(e)?e:t.error("string.base64")}},case:{method(e){return s(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate(e,t,r){let{direction:s}=r;return"lower"===s&&e===e.toLocaleLowerCase()||"upper"===s&&e===e.toLocaleUpperCase()?e:t.error(`string.${s}case`)},convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,s=0,n=1;for(;r--;){const t=e.charAt(r)*n;s+=t-9*(t>9),n^=3}return s>0&&s%10==0?e:t.error("string.creditCard")}},dataUri:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},s("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,r){let{options:s}=r;const n=e.match(h.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(h.base64Regex[s.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&f.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=h.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate(e,t,r,s){let{address:a}=s;return n.isValid(e,a)?e:t.error("string.domain")}},email:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),s(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=h.addressOptions(e),r=new RegExp(`\\s*[${e.separator?o(e.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:e},regex:r,address:t})},validate(e,t,r,s){let{options:n}=r,{regex:i,address:o}=s;const l=n.multiple?e.split(i):[e],c=[];for(const e of l)a.isValid(e,o)||c.push(e);return c.length?t.error("string.email",{value:e,invalids:c}):e}},guid:{alias:"uuid",method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);s(r.length>=1,"version must have at least 1 valid version specified");const n=new Set;for(let e=0;e<r.length;++e){const a=r[e];s("string"==typeof a,"version at position "+e+" must be a string");const i=h.guidVersions[a.toLowerCase()];s(i,"version at position "+e+" must be one of "+Object.keys(h.guidVersions).join(", ")),s(!n.has(i),"version at position "+e+" must not be a duplicate"),t+=i,n.add(i)}}s(h.guidSeparators.has(e.separator),'separator must be one of true, false, "-", or ":"');const r=void 0===e.separator?"[:-]?":!0===e.separator?"[:-]":!1===e.separator?"[]?":`\\${e.separator}`,n=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${r})[0-9A-F]{4}\\2?[${t||"0-9A-F"}][0-9A-F]{3}\\2?[${t?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:e},regex:n})},validate(e,t,r,s){let{regex:n}=s;const a=n.exec(e);return a?h.guidBrackets[a[1]]!==a[a.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f.assertOptions(e,["byteAligned"]),e={byteAligned:!1,...e},s("boolean"==typeof e.byteAligned,"byteAligned must be boolean"),this.$_addRule({name:"hex",args:{options:e}})},validate(e,t,r){let{options:s}=r;return h.hexRegex.test(e)?s.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")}},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>n.isValid(e,{minDomainSegments:1})||h.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:s}=i.regex(e),n=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:n}},regex:s})},validate(e,t,r,s){let{options:n}=r,{regex:a}=s;return a.test(e)?e:n.version?t.error("string.ipVersion",{value:e,cidr:n.cidr,version:n.version}):t.error("string.ip",{value:e,cidr:n.cidr})}},isoDate:{method(){return this.$_addRule("isoDate")},validate(e,t){let{error:r}=t;return h.isoDate(e)?e:r("string.isoDate")}},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>h.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return h.length(this,"length",e,"=",t)},validate(e,t,r,s){let{limit:n,encoding:a}=r,{name:i,operator:o,args:l}=s;const c=!a&&e.length;return f.compare(c,n,o)?e:t.error("string."+i,{limit:l.limit,value:e,encoding:a})},args:[{name:"limit",ref:!0,assert:f.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return h.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return h.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"NFC";return s(h.normalizationForms.includes(e),"normalization form must be one of "+h.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate(e,t,r){let{error:s}=t,{form:n}=r;return e===e.normalize(n)?e:s("string.normalize",{value:e,form:n})},convert:!0},pattern:{alias:"regex",method(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(e instanceof RegExp,"regex must be a RegExp"),s(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),f.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate(e,t,r,s){let{regex:n,options:a}=r,{errorCode:i}=s;return n.test(e)^a.invert?e:t.error(i,{name:a.name,regex:n,value:e})},args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(o(e),"g")),s(e instanceof RegExp,"pattern must be a RegExp"),s("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate(e,t,r){let{enabled:s}=r;return s&&e!==e.trim()?t.error("string.trim"):e},convert:!0},truncate:{method(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&f.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=c.regex(e),s=e.domain?h.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:s,scheme:r})},validate(e,t,r,s){let{options:a}=r,{regex:i,domain:o,scheme:l}=s;if(["http:/","https:/"].includes(e))return t.error("string.uri");const c=i.exec(e);if(c){const r=c[1]||c[2];return!o||a.allowRelative&&!r||n.isValid(r,o)?e:t.error("string.domain",{value:r})}return a.relativeOnly?t.error("string.uriRelativeOnly"):a.scheme?t.error("string.uriCustomScheme",{scheme:l,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:s}of t.replacements)e=e.replace(r,s);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),h.addressOptions=function(e){if(!e)return e;if(s(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),s(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return s(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds);s("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),s(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),s(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),h.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(s(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds)):(Array.isArray(r)&&(e=Object.assign({},e,{tlds:{allow:new Set(r)}})),s(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),h.validateTlds(e.tlds.allow,"tlds.allow"),e):e},h.validateTlds=function(e,t){for(const r of e)s(n.isValid(r,{minDomainSegments:1,maxDomainSegments:1}),`${t} must contain valid top level domain names`)},h.isoDate=function(e){if(!f.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},h.length=function(e,t,r,n,a){return s(!a||!1,"Invalid encoding:",a),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:a},operator:n})}},8826:(e,t,r)=>{"use strict";const s=r(375),n=r(8068),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=n.extend({type:"symbol",terms:{map:{init:new a.Map}},coerce:{method(e,t){let{schema:r,error:s}=t;const n=r.$_terms.map.get(e);return n&&(e=n),r._flags.only&&"symbol"!=typeof e?{value:e,errors:s("symbol.map",{map:r.$_terms.map})}:{value:e}}},validate(e,t){let{error:r}=t;if("symbol"!=typeof e)return{value:e,errors:r("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),s(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const n of e){s(n&&n[Symbol.iterator],"Entry must be an iterable");const[e,a]=n;s("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),s("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(738),i=r(9621),o=r(8160),l=r(6354),c=r(493),u={result:Symbol("result")};t.entry=function(e,t,r){let n=o.defaults;r&&(s(void 0===r.warnings,"Cannot override warnings preference in synchronous validation"),s(void 0===r.artifacts,"Cannot override artifacts preference in synchronous validation"),n=o.preferences(o.defaults,r));const a=u.entry(e,t,n);s(!a.mainstay.externals.length,"Schema with external rules must use validateAsync()");const i={value:a.value};return a.error&&(i.error=a.error),a.mainstay.warnings.length&&(i.warning=l.details(a.mainstay.warnings)),a.mainstay.debug&&(i.debug=a.mainstay.debug),a.mainstay.artifacts&&(i.artifacts=a.mainstay.artifacts),i},t.entryAsync=async function(e,t,r){let s=o.defaults;r&&(s=o.preferences(o.defaults,r));const n=u.entry(e,t,s),a=n.mainstay;if(n.error)throw a.debug&&(n.error.debug=a.debug),n.error;if(a.externals.length){let e=n.value;for(const{method:t,path:n,label:o}of a.externals){let a,l,c=e;n.length&&(a=n[n.length-1],l=i(e,n.slice(0,-1)),c=l[a]);try{const s=await t(c,{prefs:r});if(void 0===s||s===c)continue;l?l[a]=s:e=s}catch(e){throw s.errors.label&&(e.message+=` (${o})`),e}}n.value=e}if(!s.warnings&&!s.debug&&!s.artifacts)return n.value;const c={value:n.value};return a.warnings.length&&(c.warning=l.details(a.warnings)),a.debug&&(c.debug=a.debug),a.artifacts&&(c.artifacts=a.artifacts),c},u.entry=function(e,r,s){const{tracer:n,cleanup:a}=u.tracer(r,s),i={externals:[],warnings:[],tracer:n,debug:s.debug?[]:null,links:r._ids._schemaChain?new Map:null},o=r._ids._schemaChain?[{schema:r}]:null,f=new c([],[],{mainstay:i,schemas:o}),h=t.validate(e,r,f,s);a&&r.$_root.untrace();const d=l.process(h.errors,e,s);return{value:h.value,error:d,mainstay:i}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(s(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,r,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(t.$_terms.whens&&(t=t._generate(e,r,s).schema),t._preferences&&(s=u.prefs(t,s)),t._cache&&s.cache){const s=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!s),s)return s}const a=(n,a,i)=>t.$_createError(n,e,a,i||r,s),i={original:e,prefs:s,schema:t,state:r,error:a,errorsArray:u.errorsArray,warn:(e,t,s)=>r.mainstay.warnings.push(a(e,t,s)),message:(n,a)=>t.$_createError("custom",e,a,r,s,{messages:n})};r.mainstay.tracer.entry(t,r);const l=t._definition;if(l.prepare&&void 0!==e&&s.convert){const t=l.prepare(e,i);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),i);e=t.value}}if(l.coerce&&void 0!==e&&s.convert&&(!l.coerce.from||l.coerce.from.includes(typeof e))){const t=l.coerce.method(e,i);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),i);e=t.value}}const c=t._flags.empty;c&&c.$_match(u.trim(e,t),r.nest(c),o.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const f=n.presence||t._flags.presence||(t._flags._endedSwitch?null:s.presence);if(void 0===e){if("forbidden"===f)return u.finalize(e,null,i);if("required"===f)return u.finalize(e,[t.$_createError("any.required",e,null,r,s)],i);if("optional"===f){if(t._flags.default!==o.symbols.deepDefault)return u.finalize(e,null,i);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===f)return u.finalize(e,[t.$_createError("any.unknown",e,null,r,s)],i);const h=[];if(t._valids){const n=t._valids.get(e,r,s,t._flags.insensitive);if(n)return s.convert&&(r.mainstay.tracer.value(r,"valids",e,n.value),e=n.value),r.mainstay.tracer.filter(t,r,"valid",n),u.finalize(e,null,i);if(t._flags.only){const n=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,s);if(s.abortEarly)return u.finalize(e,[n],i);h.push(n)}}if(t._invalids){const n=t._invalids.get(e,r,s,t._flags.insensitive);if(n){r.mainstay.tracer.filter(t,r,"invalid",n);const a=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,s);if(s.abortEarly)return u.finalize(e,[a],i);h.push(a)}}if(l.validate){const t=l.validate(e,i);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return h.push(t.errors),u.finalize(e,h,i);if(t.errors.length)return h.push(...t.errors),u.finalize(e,h,i)}}return t._rules.length?u.rules(e,h,i):u.finalize(e,h,i)},u.rules=function(e,t,r){const{schema:s,state:n,prefs:a}=r;for(const i of s._rules){const l=s._definition.rules[i.method];if(l.convert&&a.convert){n.mainstay.tracer.log(s,n,"rule",i.name,"full");continue}let c,f=i.args;if(i._resolve.length){f=Object.assign({},f);for(const t of i._resolve){const r=l.argsByName.get(t),i=f[t].resolve(e,n,a),u=r.normalize?r.normalize(i):i,h=o.validateArg(u,null,r);if(h){c=s.$_createError("any.ref",i,{arg:t,ref:f[t],reason:h},n,a);break}f[t]=u}}c=c||l.validate(e,r,f,i);const h=u.rule(c,i);if(h.errors){if(n.mainstay.tracer.log(s,n,"rule",i.name,"error"),i.warn){n.mainstay.warnings.push(...h.errors);continue}if(a.abortEarly)return u.finalize(e,h.errors,r);t.push(...h.errors)}else n.mainstay.tracer.log(s,n,"rule",i.name,"pass"),n.mainstay.tracer.value(n,"rule",e,h.value,i.name),e=h.value}return u.finalize(e,t,r)},u.rule=function(e,t){return e instanceof l.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[o.symbols.errors]?(e.forEach((e=>u.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,r){t=t||[];const{schema:n,state:a,prefs:i}=r;if(t.length){const s=u.default("failover",void 0,t,r);void 0!==s&&(a.mainstay.tracer.value(a,"failover",e,s),e=s,t=[])}if(t.length&&n._flags.error)if("function"==typeof n._flags.error){t=n._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)s(e instanceof Error||e instanceof l.Report,"error() must return an Error object")}else t=[n._flags.error];if(void 0===e){const s=u.default("default",e,t,r);a.mainstay.tracer.value(a,"default",e,s),e=s}if(n._flags.cast&&void 0!==e){const t=n._definition.cast[n._flags.cast];if(t.from(e)){const s=t.to(e,r);a.mainstay.tracer.value(a,"cast",e,s,n._flags.cast),e=s}}if(n.$_terms.externals&&i.externals&&!1!==i._externals)for(const{method:e}of n.$_terms.externals)a.mainstay.externals.push({method:e,path:a.path,label:l.label(n._flags,a,i)});const o={value:e,errors:t.length?t:null};return n._flags.result&&(o.value="strip"===n._flags.result?void 0:r.original,a.mainstay.tracer.value(a,n._flags.result,e,o.value),a.shadow(e,n._flags.result)),n._cache&&!1!==i.cache&&!n._refs.length&&n._cache.set(r.original,o),void 0===e||o.errors||void 0===n._flags.artifact||(a.mainstay.artifacts=a.mainstay.artifacts||new Map,a.mainstay.artifacts.has(n._flags.artifact)||a.mainstay.artifacts.set(n._flags.artifact,[]),a.mainstay.artifacts.get(n._flags.artifact).push(a.path)),o},u.prefs=function(e,t){const r=t===o.defaults;return r&&e._preferences[o.symbols.prefs]?e._preferences[o.symbols.prefs]:(t=o.preferences(t,e._preferences),r&&(e._preferences[o.symbols.prefs]=t),t)},u.default=function(e,t,r,s){const{schema:a,state:i,prefs:l}=s,c=a._flags[e];if(l.noDefaults||void 0===c)return t;if(i.mainstay.tracer.log(a,i,"rule",e,"full"),!c)return c;if("function"==typeof c){const t=c.length?[n(i.ancestors[0]),s]:[];try{return c(...t)}catch(t){return void r.push(a.$_createError(`any.${e}`,null,{error:t},i,l))}}return"object"!=typeof c?c:c[o.symbols.literal]?c.literal:o.isResolvable(c)?c.resolve(t,i,l):n(c)},u.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},u.ignore={active:!1,debug:a,entry:a,filter:a,log:a,resolve:a,value:a},u.errorsArray=function(){const e=[];return e[o.symbols.errors]=!0,e}},2036:(e,t,r)=>{"use strict";const s=r(375),n=r(9474),a=r(8160),i={};e.exports=i.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=i.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new i.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,s){return!!this.get(e,t,r,s)}get(e,t,r,s){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&s){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(n(t,e))return{value:t};if(t)for(const a of this._refs){const i=a.resolve(e,t,r,null,{in:!0});if(void 0===i)continue;const o=a.in&&"object"==typeof i?Array.isArray(i)?i:Object.keys(i):[i];for(const t of o)if(typeof t==typeof e)if(s&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:a}}else if(n(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new i.Values(this._values,this._refs);return e._override=this._override,e}concat(e){s(!e._override,"Cannot concat override set of values");const t=new i.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},i.Values.prototype[a.symbols.values]=!0,i.Values.prototype.slice=i.Values.prototype.clone,i.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},978:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(1687),i=r(9621),o={};e.exports=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(s(e&&"object"==typeof e,"Invalid defaults value: must be an object"),s(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),s("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return o.applyToDefaultsWithShallow(e,t,r);const i=n(e);if(!0===t)return i;const l=void 0!==r.nullOverride&&r.nullOverride;return a(i,t,{nullOverride:l,mergeArrays:!1})},o.applyToDefaultsWithShallow=function(e,t,r){const l=r.shallow;s(Array.isArray(l),"Invalid keys");const c=new Map,u=!0===t?null:new Set;for(let r of l){r=Array.isArray(r)?r:r.split(".");const s=i(e,r);s&&"object"==typeof s?c.set(s,u&&i(t,r)||s):u&&u.add(r)}const f=n(e,{},c);if(!u)return f;for(const e of u)o.reachCopy(f,t,e);const h=void 0!==r.nullOverride&&r.nullOverride;return a(f,t,{nullOverride:h,mergeArrays:!1})},o.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const s=t;let n=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof n[t]&&(n[t]={}),n=n[t]}n[r[r.length-1]]=s}},375:(e,t,r)=>{"use strict";const s=r(7916);e.exports=function(e){if(!e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(1===r.length&&r[0]instanceof Error)throw r[0];throw new s(r)}}},8571:(e,t,r)=>{"use strict";const s=r(9621),n=r(4277),a=r(7043),i={needsProtoHack:new Set([n.set,n.map,n.weakSet,n.weakMap])};e.exports=i.clone=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("object"!=typeof e||null===e)return e;let s=i.clone,o=r;if(t.shallow){if(!0!==t.shallow)return i.cloneWithShallow(e,t);s=e=>e}else if(o){const t=o.get(e);if(t)return t}else o=new Map;const l=n.getInternalProto(e);if(l===n.buffer)return!1;if(l===n.date)return new Date(e.getTime());if(l===n.regex)return new RegExp(e);const c=i.base(e,l,t);if(c===e)return e;if(o&&o.set(e,c),l===n.set)for(const r of e)c.add(s(r,t,o));else if(l===n.map)for(const[r,n]of e)c.set(r,s(n,t,o));const u=a.keys(e,t);for(const r of u){if("__proto__"===r)continue;if(l===n.array&&"length"===r){c.length=e.length;continue}const a=Object.getOwnPropertyDescriptor(e,r);a?a.get||a.set?Object.defineProperty(c,r,a):a.enumerable?c[r]=s(e[r],t,o):Object.defineProperty(c,r,{enumerable:!1,writable:!0,configurable:!0,value:s(e[r],t,o)}):Object.defineProperty(c,r,{enumerable:!0,writable:!0,configurable:!0,value:s(e[r],t,o)})}return c},i.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const n=new Map;for(const t of r){const r=s(e,t);"object"!=typeof r&&"function"!=typeof r||n.set(r,r)}return i.clone(e,t,n)},i.base=function(e,t,r){if(!1===r.prototype)return i.needsProtoHack.has(t)?new t.constructor:t===n.array?[]:{};const s=Object.getPrototypeOf(e);if(s&&s.isImmutable)return e;if(t===n.array){const e=[];return s!==t&&Object.setPrototypeOf(e,s),e}if(i.needsProtoHack.has(t)){const e=new s.constructor;return s!==t&&Object.setPrototypeOf(e,s),e}return Object.create(s)}},9474:(e,t,r)=>{"use strict";const s=r(4277),n={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!n.isDeepEqual(e,t,r,[])},n.isDeepEqual=function(e,t,r,a){if(e===t)return 0!==e||1/e==1/t;const i=typeof e;if(i!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===i){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==i)return e!=e&&t!=t;const o=n.getSharedType(e,t,!!r.prototype);switch(o){case s.buffer:return!1;case s.promise:return e===t;case s.regex:return e.toString()===t.toString();case n.mismatched:return!1}for(let r=a.length-1;r>=0;--r)if(a[r].isSame(e,t))return!0;a.push(new n.SeenEntry(e,t));try{return!!n.isDeepEqualObj(o,e,t,r,a)}finally{a.pop()}},n.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?n.mismatched:s.getInternalProto(e);const a=s.getInternalProto(e);return a!==s.getInternalProto(t)?n.mismatched:a},n.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},n.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},n.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},n.isDeepEqualObj=function(e,t,r,a,i){const{isDeepEqual:o,valueOf:l,hasOwnEnumerableProperty:c}=n,{keys:u,getOwnPropertySymbols:f}=Object;if(e===s.array){if(!a.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!o(t[e],r[e],a,i))return!1;return!0}for(const e of t)for(const t of r)if(o(e,t,a,i))return!0}else if(e===s.set){if(t.size!==r.size)return!1;if(!n.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r))continue;let t=!1;for(const s of e)if(o(r,s,a,i)){e.delete(s),t=!0;break}if(!t)return!1}}}else if(e===s.map){if(t.size!==r.size)return!1;for(const[e,s]of Map.prototype.entries.call(t)){if(void 0===s&&!Map.prototype.has.call(r,e))return!1;if(!o(s,Map.prototype.get.call(r,e),a,i))return!1}}else if(e===s.error&&(t.name!==r.name||t.message!==r.message))return!1;const h=l(t),d=l(r);if((t!==h||r!==d)&&!o(h,d,a,i))return!1;const m=u(t);if(!a.part&&m.length!==u(r).length&&!a.skip)return!1;let p=0;for(const e of m)if(a.skip&&a.skip.includes(e))void 0===r[e]&&++p;else{if(!c(r,e))return!1;if(!o(t[e],r[e],a,i))return!1}if(!a.part&&m.length-p!==u(r).length)return!1;if(!1!==a.symbols){const e=f(t),s=new Set(f(r));for(const n of e){if(!a.skip||!a.skip.includes(n))if(c(t,n)){if(!c(r,n))return!1;if(!o(t[n],r[n],a,i))return!1}else if(c(r,n))return!1;s.delete(n)}for(const e of s)if(c(r,e))return!1}return!0},n.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},7916:(e,t,r)=>{"use strict";const s=r(8761);e.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:s(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},5277:e=>{"use strict";const t={};e.exports=function(e){if(!e)return"";let r="";for(let s=0;s<e.length;++s){const n=e.charCodeAt(s);t.isSafe(n)?r+=e[s]:r+=t.escapeHtmlChar(n)}return r},t.escapeHtmlChar=function(e){return t.namedHtml.get(e)||(e>=256?"&#"+e+";":`&#x${e.toString(16).padStart(2,"0")};`)},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},6064:e=>{"use strict";e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:e=>{"use strict";e.exports=function(){}},1687:(e,t,r)=>{"use strict";const s=r(375),n=r(8571),a=r(7043),i={};e.exports=i.merge=function(e,t,r){if(s(e&&"object"==typeof e,"Invalid target value: must be an object"),s(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){s(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let s=0;s<t.length;++s)e.push(n(t[s],{symbols:r.symbols}));return e}const o=a.keys(t,r);for(let s=0;s<o.length;++s){const a=o[s];if("__proto__"===a||!Object.prototype.propertyIsEnumerable.call(t,a))continue;const l=t[a];if(l&&"object"==typeof l){if(e[a]===l)continue;!e[a]||"object"!=typeof e[a]||Array.isArray(e[a])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?e[a]=n(l,{symbols:r.symbols}):i.merge(e[a],l,r)}else(null!=l||r.nullOverride)&&(e[a]=l)}return e}},9621:(e,t,r)=>{"use strict";const s=r(375),n={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const a=Array.isArray(t);s(!a||!r.separator,"Separator option is not valid for array-based chain");const i=a?t:t.split(r.separator||".");let o=e;for(let e=0;e<i.length;++e){let a=i[e];const l=r.iterables&&n.iterables(o);if(Array.isArray(o)||"set"===l){const e=Number(a);Number.isInteger(e)&&(a=e<0?o.length+e:e)}if(!o||"function"==typeof o&&!1===r.functions||!l&&void 0===o[a]){s(!r.strict||e+1===i.length,"Missing segment",a,"in reach path ",t),s("object"==typeof o||!0===r.functions||"function"!=typeof o,"Invalid segment",a,"in reach path ",t),o=r.default;break}o=l?"set"===l?[...o][a]:o.get(a):o[a]}return o},n.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},8761:e=>{"use strict";e.exports=function(){try{return JSON.stringify(...arguments)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{"use strict";const r={};t=e.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const s=Object.prototype.toString.call(e);return r.typeMap.get(s)||t.generic}},7043:(e,t)=>{"use strict";t.keys=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},3652:(e,t,r)=>{"use strict";const s=r(375),n={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t||{}).before||[]),n=[].concat(t.after||[]),a=t.group||"?",i=t.sort||0;s(!r.includes(a),`Item cannot come before itself: ${a}`),s(!r.includes("?"),"Item cannot come before unassociated items"),s(!n.includes(a),`Item cannot come after itself: ${a}`),s(!n.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:i,before:r,after:n,group:a,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();s(e,"item","?"!==a?`added into group ${a}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(n.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return s(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return s(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),r=Object.create(null);for(const s of this._items){const n=s.seq,a=s.group;r[a]=r[a]||[],r[a].push(n),e[n]=s.before;for(const e of s.after)t[e]=t[e]||[],t[e].push(n)}for(const t in e){const s=[];for(const n in e[t]){const a=e[t][n];r[a]=r[a]||[],s.push(...r[a])}e[t]=s}for(const s in t)if(r[s])for(const n of r[s])e[n].push(...t[s]);const s={};for(const t in e){const r=e[t];for(const e of r)s[e]=s[e]||[],s[e].push(t)}const n={},a=[];for(let e=0;e<this._items.length;++e){let t=e;if(s[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===n[e])continue;s[e]||(s[e]=[]);const r=s[e].length;let a=0;for(let t=0;t<r;++t)n[s[e][t]]&&++a;if(a===r){t=e;break}}}null!==t&&(n[t]=!0,a.push(t))}if(a.length!==this._items.length)return!1;const i={};for(const e of this._items)i[e.seq]=e;this._items=[],this.nodes=[];for(const e of a){const t=i[e];this.nodes.push(t.node),this._items.push(t)}return!0}},n.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},5380:(e,t,r)=>{"use strict";const s=r(443),n=r(2178),a={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:s.URL||URL};t.analyze=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return n.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return n.code("DOMAIN_TOO_LONG");const r=!a.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return n.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(a.domainControlRx.test(e))return n.code("DOMAIN_INVALID_CHARS");e=a.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const s=t.minDomainSegments||a.minDomainSegments,i=e.split(".");if(i.length<s)return n.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&i.length>t.maxDomainSegments)return n.code("DOMAIN_SEGMENTS_COUNT_MAX");const o=t.tlds;if(o){const e=i[i.length-1].toLowerCase();if(o.deny&&o.deny.has(e)||o.allow&&!o.allow.has(e))return n.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<i.length;++e){const t=i[e];if(!t.length)return n.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return n.code("DOMAIN_LONG_SEGMENT");if(e<i.length-1){if(!a.domainSegmentRx.test(t))return n.code("DOMAIN_INVALID_CHARS")}else if(!a.tldSegmentRx.test(t))return n.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,r){return!t.analyze(e,r)},a.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new a.URL(`http://${e}`).host}catch(t){return e}}},1745:(e,t,r)=>{"use strict";const s=r(9848),n=r(5380),a=r(2178),i={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(s.TextEncoder||TextEncoder)};t.analyze=function(e,t){return i.email(e,t)},t.isValid=function(e,t){return!i.email(e,t)},i.email=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return a.code("EMPTY_STRING");const r=!i.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return a.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const s=e.split("@");if(2!==s.length)return s.length>2?a.code("MULTIPLE_AT_CHAR"):a.code("MISSING_AT_CHAR");const[o,l]=s;if(!o)return a.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return a.code("ADDRESS_TOO_LONG");if(i.encoder.encode(o).length>64)return a.code("LOCAL_TOO_LONG")}return i.local(o,r)||n.analyze(l,t)},i.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return a.code("EMPTY_LOCAL_SEGMENT");if(t){if(!i.atextRx.test(e))return a.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(i.atextRx.test(t))continue;const e=i.binary(t);if(!i.atomRx.test(e))return a.code("INVALID_LOCAL_CHARS")}}},i.binary=function(e){return Array.from(i.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},i.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,i.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(e,t)=>{"use strict";t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},9959:(e,t,r)=>{"use strict";const s=r(375),n=r(5752);t.regex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";s(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),s(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),s(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<r.length;++e)s("string"==typeof r[e],"options.version must only contain strings"),r[e]=r[e].toLowerCase(),s(["ipv4","ipv6","ipvfuture"].includes(r[e]),"options.version contains unknown version "+r[e]+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const a=r.map((e=>{if("forbidden"===t)return n.ip[e];const r=`\\/${"ipv4"===e?n.ip.v4Cidr:n.ip.v6Cidr}`;return"required"===t?`${n.ip[e]}${r}`:`${n.ip[e]}(?:${r})?`})),i=`(?:${a.join("|")})`,o=new RegExp(`^${i}$`);return{cidr:t,versions:r,regex:o,raw:i}}},5752:(e,t,r)=>{"use strict";const s=r(375),n=r(6064),a={generate:function(){const e={},t="!\\$&'\\(\\)\\*\\+,;=",r="\\w-\\.~%\\dA-Fa-f"+t+":@",s="["+r+"]",n="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+n+"\\.){3}"+n;const a="[\\dA-Fa-f]{1,4}",i="(?:"+a+":"+a+"|"+e.ipv4address+")",o="(?:"+a+":){6}"+i,l="::(?:"+a+":){5}"+i,c="(?:"+a+")?::(?:"+a+":){4}"+i,u="(?:(?:"+a+":){0,1}"+a+")?::(?:"+a+":){3}"+i,f="(?:(?:"+a+":){0,2}"+a+")?::(?:"+a+":){2}"+i,h="(?:(?:"+a+":){0,3}"+a+")?::"+a+":"+i,d="(?:(?:"+a+":){0,4}"+a+")?::"+i;e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+o+"|"+l+"|"+c+"|"+u+"|"+f+"|"+h+"|"+d+"|(?:(?:[\\dA-Fa-f]{1,4}:){0,5}[\\dA-Fa-f]{1,4})?::[\\dA-Fa-f]{1,4}|(?:(?:[\\dA-Fa-f]{1,4}:){0,6}[\\dA-Fa-f]{1,4})?::)",e.ipvFuture="v[\\dA-Fa-f]+\\.[\\w-\\.~"+t+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const m="[\\w-\\.~%\\dA-Fa-f"+t+":]*",p="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=]{1,255})",g="(?:"+m+"@)?"+p+"(?::\\d*)?",y="(?:"+m+"@)?("+p+")(?::\\d*)?",b=s+"+",v="(?:\\/[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*)*",_="\\/(?:"+b+v+")?",w=b+v,$="[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=@]+"+v;return e.hierPart="(?:(?:\\/\\/"+g+v+")|"+_+"|"+w+"|(?:\\/\\/\\/[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*(?:\\/[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*)*))",e.hierPartCapture="(?:(?:\\/\\/"+y+v+")|"+_+"|"+w+")",e.relativeRef="(?:(?:\\/\\/"+g+v+")|"+_+"|"+$+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+y+v+")|"+_+"|"+$+"|)",e.query="["+r+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+r+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+r+"\\/\\?]*",e}};a.rfc3986=a.generate(),t.ip={v4Cidr:a.rfc3986.ipv4Cidr,v6Cidr:a.rfc3986.ipv6Cidr,ipv4:a.rfc3986.ipv4address,ipv6:a.rfc3986.ipv6address,ipvfuture:a.rfc3986.ipvFuture},a.createRegex=function(e){const t=a.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",i=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return a.wrap(i+r);let o="";if(e.scheme){s(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);s(r.length>=1,"scheme must have at least 1 scheme specified");const a=[];for(let e=0;e<r.length;++e){const i=r[e];s(i instanceof RegExp||"string"==typeof i,"scheme at position "+e+" must be a RegExp or String"),i instanceof RegExp?a.push(i.source.toString()):(s(t.schemeRegex.test(i),"scheme at position "+e+" must be a valid scheme"),a.push(n(i)))}o=a.join("|")}const l="(?:"+(o?"(?:"+o+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",c=e.allowRelative?"(?:"+l+"|"+i+")":l;return a.wrap(c+r,o)},a.wrap=function(e,t){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}},a.uriRegex=a.createRegex({}),t.regex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?a.createRegex(e):a.uriRegex}},1447:(e,t)=>{"use strict";const r={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*\.?[0-9]*){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t[r.settings]&&t.constants)for(const e in t.constants){const r=t.constants[e];if(null!==r&&!["boolean","number","string"].includes(typeof r))throw new Error(`Formula constant ${e} contains invalid ${typeof r} value type`)}this.settings=t[r.settings]?t:Object.assign({[r.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let s=[],n="",a=0,i=!1;const o=e=>{if(a)throw new Error("Formula missing closing parenthesis");const o=s.length?s[s.length-1]:null;if(i||n||e){if(o&&"reference"===o.type&&")"===e)return o.type="function",o.value=this._subFormula(n,o.value),void(n="");if(")"===e){const e=new t.Parser(n,this.settings);s.push({type:"segment",value:e})}else if(i){if("]"===i)return s.push({type:"reference",value:n}),void(n="");s.push({type:"literal",value:n})}else if(r.operatorCharacters.includes(n))o&&"operator"===o.type&&r.operators.includes(o.value+n)?o.value+=n:s.push({type:"operator",value:n});else if(n.match(r.numberRx))s.push({type:"constant",value:parseFloat(n)});else if(void 0!==this.settings.constants[n])s.push({type:"constant",value:this.settings.constants[n]});else{if(!n.match(r.tokenRx))throw new Error(`Formula contains invalid token: ${n}`);s.push({type:"reference",value:n})}n=""}};for(const t of e)i?t===i?(o(),i=!1):n+=t:a?"("===t?(n+=t,++a):")"===t?(--a,a?n+=t:o(t)):n+=t:t in r.literals?i=r.literals[t]:"("===t?(o(),++a):r.operatorCharacters.includes(t)?(o(),n=t,o()):" "!==t?n+=t:o();o(),s=s.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==s[t-1].type?e:{type:"operator",value:"n"}));let l=!1;for(const e of s){if("operator"===e.type){if(r.operatorsPrefix.includes(e.value))continue;if(!l)throw new Error("Formula contains an operator in invalid position");if(!r.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(l)throw new Error("Formula missing expected operator");l=!l}if(!l)throw new Error("Formula contains invalid trailing operator");1===s.length&&["reference","literal","constant"].includes(s[0].type)&&(this.single={type:"reference"===s[0].type?"reference":"value",value:s[0].value}),this._parts=s.map((e=>{if("operator"===e.type)return r.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):r.reference(e.value)}))}_subFormula(e,s){const n=this.settings.functions[s];if("function"!=typeof n)throw new Error(`Formula contains unknown function ${s}`);let a=[];if(e){let t="",n=0,i=!1;const o=()=>{if(!t)throw new Error(`Formula contains function ${s} with invalid arguments ${e}`);a.push(t),t=""};for(let s=0;s<e.length;++s){const a=e[s];i?(t+=a,a===i&&(i=!1)):a in r.literals&&!n?(t+=a,i=r.literals[a]):","!==a||n?(t+=a,"("===a?++n:")"===a&&--n):o()}o()}return a=a.map((e=>new t.Parser(e,this.settings))),function(e){const t=[];for(const r of a)t.push(r.evaluate(e));return n.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let s=t.length-2;s>=0;--s){const n=t[s];if(n&&"operator"===n.type){const a=t[s+1];t.splice(s+1,1);const i=r.evaluate(a,e);t[s]=r.single(n.value,i)}}return r.operatorsOrder.forEach((s=>{for(let n=1;n<t.length-1;)if(s.includes(t[n])){const s=t[n],a=r.evaluate(t[n-1],e),i=r.evaluate(t[n+1],e);t.splice(n,2);const o=r.calculate(s,a,i);t[n-1]=0===o?0:o}else n+=2})),r.evaluate(t[0],e)}},t.Parser.prototype[r.symbol]=!0,r.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},r.evaluate=function(e,t){return null===e?null:"function"==typeof e?e(t):e[r.symbol]?e.evaluate(t):e},r.single=function(e,t){if("!"===e)return!t;const r=-t;return 0===r?0:r},r.calculate=function(e,t,s){if("??"===e)return r.exists(t)?t:s;if("string"==typeof t||"string"==typeof s){if("+"===e)return(t=r.exists(t)?t:"")+(r.exists(s)?s:"")}else switch(e){case"^":return Math.pow(t,s);case"*":return t*s;case"/":return t/s;case"%":return t%s;case"+":return t+s;case"-":return t-s}switch(e){case"<":return t<s;case"<=":return t<=s;case">":return t>s;case">=":return t>=s;case"==":return t===s;case"!=":return t!==s;case"&&":return t&&s;case"||":return t||s}return null},r.exists=function(e){return null!=e}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:e=>{"use strict";e.exports={version:"17.7.0"}}},t={},function r(s){var n=t[s];if(void 0!==n)return n.exports;var a=t[s]={exports:{}};return e[s](a,a.exports,r),a.exports}(5107);var e,t}));
|
|
4230
4221
|
},{}],35:[function(require,module,exports){
|
|
4231
|
-
(function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,setImmediate){(function (){
|
|
4232
|
-
/*!
|
|
4233
|
-
|
|
4234
|
-
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
4235
|
-
<http://stuartk.com/jszip>
|
|
4236
|
-
|
|
4237
|
-
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
4238
|
-
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
4239
|
-
|
|
4240
|
-
JSZip uses the library pako released under the MIT license :
|
|
4241
|
-
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
4242
|
-
*/
|
|
4243
|
-
|
|
4244
|
-
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=e()}}(function(){return function s(a,o,h){function u(r,e){if(!o[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=o[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return u(t||e)},i,i.exports,s,a,o,h)}return o[r].exports}for(var l="function"==typeof require&&require,e=0;e<h.length;e++)u(h[e]);return u}({1:[function(e,t,r){"use strict";var d=e("./utils"),c=e("./support"),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,n,i,s,a,o,h=[],u=0,l=e.length,f=l,c="string"!==d.getTypeOf(e);u<e.length;)f=l-u,n=c?(t=e[u++],r=u<l?e[u++]:0,u<l?e[u++]:0):(t=e.charCodeAt(u++),r=u<l?e.charCodeAt(u++):0,u<l?e.charCodeAt(u++):0),i=t>>2,s=(3&t)<<4|r>>4,a=1<f?(15&r)<<2|n>>6:64,o=2<f?63&n:64,h.push(p.charAt(i)+p.charAt(s)+p.charAt(a)+p.charAt(o));return h.join("")},r.decode=function(e){var t,r,n,i,s,a,o=0,h=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var l,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===p.charAt(64)&&f--,e.charAt(e.length-2)===p.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(l=c.uint8array?new Uint8Array(0|f):new Array(0|f);o<e.length;)t=p.indexOf(e.charAt(o++))<<2|(i=p.indexOf(e.charAt(o++)))>>4,r=(15&i)<<4|(s=p.indexOf(e.charAt(o++)))>>2,n=(3&s)<<6|(a=p.indexOf(e.charAt(o++))),l[h++]=t,64!==s&&(l[h++]=r),64!==a&&(l[h++]=n);return l}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function o(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new a("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=o},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),a=e("./stream/GenericWorker"),o=n?"uint8array":"array";function h(e,t){a.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(h,a),h.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,e.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},r.compressWorker=function(e){return new h("Deflate",e)},r.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function A(e,t){var r,n="";for(r=0;r<t;r++)n+=String.fromCharCode(255&e),e>>>=8;return n}function n(e,t,r,n,i,s){var a,o,h=e.file,u=e.compression,l=s!==O.utf8encode,f=I.transformTo("string",s(h.name)),c=I.transformTo("string",O.utf8encode(h.name)),d=h.comment,p=I.transformTo("string",s(d)),m=I.transformTo("string",O.utf8encode(d)),_=c.length!==h.name.length,g=m.length!==d.length,b="",v="",y="",w=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var S=0;t&&(S|=8),l||!_&&!g||(S|=2048);var z=0,C=0;w&&(z|=16),"UNIX"===i?(C=798,z|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,w)):(C=20,z|=function(e){return 63&(e||0)}(h.dosPermissions)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v=A(1,1)+A(B(f),4)+c,b+="up"+A(v.length,2)+v),g&&(y=A(1,1)+A(B(p),4)+m,b+="uc"+A(y.length,2)+y);var E="";return E+="\n\0",E+=A(S,2),E+=u.magic,E+=A(a,2),E+=A(o,2),E+=A(x.crc32,4),E+=A(x.compressedSize,4),E+=A(x.uncompressedSize,4),E+=A(f.length,2),E+=A(b.length,2),{fileRecord:R.LOCAL_FILE_HEADER+E+f+b,dirRecord:R.CENTRAL_FILE_HEADER+A(C,2)+E+A(p.length,2)+"\0\0\0\0"+A(z,4)+A(n,4)+f+b+p}}var I=e("../utils"),i=e("../stream/GenericWorker"),O=e("../utf8"),B=e("../crc32"),R=e("../signature");function s(e,t,r,n){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}I.inherits(s,i),s.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},s.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return R.DATA_DESCRIPTOR+A(e.crc32,4)+A(e.compressedSize,4)+A(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,n=function(e,t,r,n,i){var s=I.transformTo("string",i(n));return R.CENTRAL_DIRECTORY_END+"\0\0\0\0"+A(e,2)+A(e,2)+A(t,4)+A(r,4)+A(s.length,2)+s}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},s.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},s.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},s.prototype.error=function(e){var t=this._sources;if(!i.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},s.prototype.lock=function(){i.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=s},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var u=e("../compressions"),n=e("./ZipFileWorker");r.generateWorker=function(e,a,t){var o=new n(a.streamFiles,t,a.platform,a.encodeFileName),h=0;try{e.forEach(function(e,t){h++;var r=function(e,t){var r=e||t,n=u[r];if(!n)throw new Error(r+" is not a valid compression method !");return n}(t.options.compression,a.compression),n=t.options.compressionOptions||a.compressionOptions||{},i=t.dir,s=t.date;t._compressWorker(r,n).withStreamInfo("file",{name:e,dir:i,date:s,comment:t.comment||"",unixPermissions:t.unixPermissions,dosPermissions:t.dosPermissions}).pipe(o)}),o.entriesCount=h}catch(e){o.error(e)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new n;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(e,t){return(new n).loadAsync(e,t)},n.external=e("./external"),t.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var u=e("./utils"),i=e("./external"),n=e("./utf8"),s=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function f(n){return new i.Promise(function(e,t){var r=n.decompressed.getContentWorker().pipe(new a);r.on("error",function(e){t(e)}).on("end",function(){r.streamInfo.crc32!==n.decompressed.crc32?t(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}t.exports=function(e,o){var h=this;return o=u.extend(o||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:n.utf8decode}),l.isNode&&l.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):u.prepareContent("the loaded zip file",e,!0,o.optimizedBinaryString,o.base64).then(function(e){var t=new s(o);return t.load(e),t}).then(function(e){var t=[i.Promise.resolve(e)],r=e.files;if(o.checkCRC32)for(var n=0;n<r.length;n++)t.push(f(r[n]));return i.Promise.all(t)}).then(function(e){for(var t=e.shift(),r=t.files,n=0;n<r.length;n++){var i=r[n],s=i.fileNameStr,a=u.resolve(i.fileNameStr);h.file(a,i.decompressed,{binary:!0,optimizedBinaryString:!0,date:i.date,dir:i.dir,comment:i.fileCommentStr.length?i.fileCommentStr:null,unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions,createFolders:o.createFolders}),i.dir||(h.file(a).unsafeOriginalName=s)}return t.zipComment.length&&(h.comment=t.zipComment),h})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../stream/GenericWorker");function s(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}n.inherits(s,i),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},s.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var i=e("readable-stream").Readable;function n(e,t,r){i.call(this,t),this._helper=e;var n=this;e.on("data",function(e,t){n.push(e)||n._helper.pause(),r&&r(t)}).on("error",function(e){n.emit("error",e)}).on("end",function(){n.push(null)})}e("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){"use strict";t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,r){"use strict";function s(e,t,r){var n,i=u.getTypeOf(t),s=u.extend(r||{},f);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(e=g(e)),s.createFolders&&(n=_(e))&&b.call(this,n,!0);var a="string"===i&&!1===s.binary&&!1===s.base64;r&&void 0!==r.binary||(s.binary=!a),(t instanceof c&&0===t.uncompressedSize||s.dir||!t||0===t.length)&&(s.base64=!1,s.binary=!0,t="",s.compression="STORE",i="string");var o=null;o=t instanceof c||t instanceof l?t:p.isNode&&p.isStream(t)?new m(e,t):u.prepareContent(e,t,s.binary,s.optimizedBinaryString,s.base64);var h=new d(e,o,s);this.files[e]=h}var i=e("./utf8"),u=e("./utils"),l=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),f=e("./defaults"),c=e("./compressedObject"),d=e("./zipObject"),o=e("./generate"),p=e("./nodejsUtils"),m=e("./nodejs/NodejsStreamInputAdapter"),_=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},g=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},b=function(e,t){return t=void 0!==t?t:f.createFolders,e=g(e),this.files[e]||s.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function h(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var n={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)n=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,n)},filter:function(r){var n=[];return this.forEach(function(e,t){r(e,t)&&n.push(t)}),n},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,s.call(this,e,t,r),this;if(h(e)){var n=e;return this.filter(function(e,t){return!t.dir&&n.test(e)})}var i=this.files[this.root+e];return i&&!i.dir?i:null},folder:function(r){if(!r)return this;if(h(r))return this.filter(function(e,t){return t.dir&&r.test(e)});var e=this.root+r,t=b.call(this,e),n=this.clone();return n.root=t.name,n},remove:function(r){r=this.root+r;var e=this.files[r];if(e||("/"!==r.slice(-1)&&(r+="/"),e=this.files[r]),e&&!e.dir)delete this.files[r];else for(var t=this.filter(function(e,t){return t.name.slice(0,r.length)===r}),n=0;n<t.length;n++)delete this.files[t[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=u.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");u.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var n=r.comment||this.comment||"";t=o.generateWorker(this,r,n)}catch(e){(t=new l("error")).error(e)}return new a(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=n},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===n&&this.data[s+3]===i)return s-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&n===s[2]&&i===s[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var n=e("../utils");function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),s=e("./ArrayReader"),a=e("./StringReader"),o=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new o(e):i.uint8array?new h(n.transformTo("uint8array",e)):new s(n.transformTo("array",e)):new a(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function s(e){n.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function s(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=n},{}],29:[function(e,t,r){"use strict";var h=e("../utils"),i=e("./ConvertWorker"),s=e("./GenericWorker"),u=e("../base64"),n=e("../support"),a=e("../external"),o=null;if(n.nodestream)try{o=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function l(e,o){return new a.Promise(function(t,r){var n=[],i=e._internalType,s=e._outputType,a=e._mimeType;e.on("data",function(e,t){n.push(e),o&&o(t)}).on("error",function(e){n=[],r(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return h.newBlob(h.transformTo("arraybuffer",t),r);case"base64":return u.encode(t);default:return h.transformTo(e,t)}}(s,function(e,t){var r,n=0,i=null,s=0;for(r=0;r<t.length;r++)s+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(s),r=0;r<t.length;r++)i.set(t[r],n),n+=t[r].length;return i;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(i,n),a);t(e)}catch(e){r(e)}n=[]}).resume()})}function f(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,h.checkSupport(n),this._worker=e.pipe(new i(n)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}f.prototype={accumulate:function(e){return l(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,function(e){t.call(r,e.data,e.meta)}):this._worker.on(e,function(){h.delay(t,arguments,r)}),this},resume:function(){return h.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(h.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new o(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer="undefined"!=typeof Buffer,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=0===new Blob([n],{type:"application/zip"}).size}catch(e){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=0===i.getBlob("application/zip").size}catch(e){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(e){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,s){"use strict";for(var o=e("./utils"),h=e("./support"),r=e("./nodejsUtils"),n=e("./stream/GenericWorker"),u=new Array(256),i=0;i<256;i++)u[i]=252<=i?6:248<=i?5:240<=i?4:224<=i?3:192<=i?2:1;u[254]=u[254]=1;function a(){n.call(this,"utf-8 decode"),this.leftOver=null}function l(){n.call(this,"utf-8 encode")}s.utf8encode=function(e){return h.nodebuffer?r.newBufferFrom(e,"utf-8"):function(e){var t,r,n,i,s,a=e.length,o=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),o+=r<128?1:r<2048?2:r<65536?3:4;for(t=h.uint8array?new Uint8Array(o):new Array(o),i=s=0;s<o;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[s++]=r:(r<2048?t[s++]=192|r>>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return h.nodebuffer?o.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,i,s=e.length,a=new Array(2*s);for(t=r=0;t<s;)if((n=e[t++])<128)a[r++]=n;else if(4<(i=u[n]))a[r++]=65533,t+=i-1;else{for(n&=2===i?31:3===i?15:7;1<i&&t<s;)n=n<<6|63&e[t++],i--;1<i?a[r++]=65533:n<65536?a[r++]=n:(n-=65536,a[r++]=55296|n>>10&1023,a[r++]=56320|1023&n)}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(e=o.transformTo(h.uint8array?"uint8array":"array",e))},o.inherits(a,n),a.prototype.processChunk=function(e){var t=o.transformTo(h.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}(t),i=t;n!==t.length&&(h.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:s.utf8decode(i),meta:e.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=a,o.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta})},s.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,a){"use strict";var o=e("./support"),h=e("./base64"),r=e("./nodejsUtils"),u=e("./external");function n(e){return e}function l(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),a.newBlob=function(t,r){a.checkSupport("blob");try{return new Blob([t],{type:r})}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(t),n.getBlob(r)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var i={stringifyByChunk:function(e,t,r){var n=[],i=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);for(;i<s;)"array"===t||"nodebuffer"===t?n.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,s)))):n.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,s)))),i+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return o.nodebuffer&&1===String.fromCharCode.apply(null,r.allocBuffer(1)).length}catch(e){return!1}}()}};function s(e){var t=65536,r=a.getTypeOf(e),n=!0;if("uint8array"===r?n=i.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=i.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return i.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return i.stringifyByChar(e)}function f(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}a.applyFromCharCode=s;var c={};c.string={string:n,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return c.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,r.allocBuffer(e.length))}},c.array={string:s,array:n,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(e)}},c.arraybuffer={string:function(e){return s(new Uint8Array(e))},array:function(e){return f(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:n,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(new Uint8Array(e))}},c.uint8array={string:s,array:function(e){return f(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:n,nodebuffer:function(e){return r.newBufferFrom(e)}},c.nodebuffer={string:s,array:function(e){return f(e,new Array(e.length))},arraybuffer:function(e){return c.nodebuffer.uint8array(e).buffer},uint8array:function(e){return f(e,new Uint8Array(e.length))},nodebuffer:n},a.transformTo=function(e,t){if(t=t||"",!e)return t;a.checkSupport(e);var r=a.getTypeOf(t);return c[r][e](t)},a.resolve=function(e){for(var t=e.split("/"),r=[],n=0;n<t.length;n++){var i=t[n];"."===i||""===i&&0!==n&&n!==t.length-1||(".."===i?r.pop():r.push(i))}return r.join("/")},a.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":o.nodebuffer&&r.isBuffer(e)?"nodebuffer":o.uint8array&&e instanceof Uint8Array?"uint8array":o.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(e){if(!o[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(e){var t,r,n="";for(r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},a.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})},a.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r},a.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},a.prepareContent=function(r,e,n,i,s){return u.Promise.resolve(e).then(function(n){return o.blob&&(n instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(n)))&&"undefined"!=typeof FileReader?new u.Promise(function(t,r){var e=new FileReader;e.onload=function(e){t(e.target.result)},e.onerror=function(e){r(e.target.error)},e.readAsArrayBuffer(n)}):n}).then(function(e){var t=a.getTypeOf(e);return t?("arraybuffer"===t?e=a.transformTo("uint8array",e):"string"===t&&(s?e=h.decode(e):n&&!0!==i&&(e=function(e){return l(e,o.uint8array?new Uint8Array(e.length):new Array(e.length))}(e))),e):u.Promise.reject(new Error("Can't read the data of '"+r+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),i=e("./utils"),s=e("./signature"),a=e("./zipEntry"),o=e("./support");function h(e){this.files=[],this.loadOptions=e}h.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4)===t;return this.reader.setIndex(r),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=o.uint8array?"uint8array":"array",r=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,n=this.zip64EndOfCentralSize-44;0<n;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw!this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var n=t-r;if(0<n)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(e){this.reader=n(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),s=e("./utils"),i=e("./compressedObject"),a=e("./crc32"),o=e("./utf8"),h=e("./compressions"),u=e("./support");function l(e,t){this.options=e,this.loadOptions=t}l.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in h)if(Object.prototype.hasOwnProperty.call(h,t)&&h[t].magic===e)return h[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),r=e.readInt(2),n=e.readData(r),this.extraFields[t]={id:t,length:r,value:n};e.setIndex(i)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=o.utf8decode(this.fileName),this.fileCommentStr=o.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=s.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var i=s.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=n(e.value);return 1!==t.readInt(1)?null:a(this.fileName)!==t.readInt(4)?null:o.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=n(e.value);return 1!==t.readInt(1)?null:a(this.fileComment)!==t.readInt(4)?null:o.utf8decode(t.readData(e.length-5))}return null}},t.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){"use strict";function n(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var s=e("./stream/StreamHelper"),i=e("./stream/DataWorker"),a=e("./utf8"),o=e("./compressedObject"),h=e("./stream/GenericWorker");n.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var n="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var i=!this._dataBinary;i&&!n&&(t=t.pipe(new a.Utf8EncodeWorker)),!i&&n&&(t=t.pipe(new a.Utf8DecodeWorker))}catch(e){(t=new h("error")).error(e)}return new s(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof o&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new a.Utf8EncodeWorker)),o.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof o?this._data.getContentWorker():this._data instanceof h?this._data:new i(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<u.length;f++)n.prototype[u[f]]=l;t.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,l,t){(function(t){"use strict";var r,n,e=t.MutationObserver||t.WebKitMutationObserver;if(e){var i=0,s=new e(u),a=t.document.createTextNode("");s.observe(a,{characterData:!0}),r=function(){a.data=i=++i%2}}else if(t.setImmediate||void 0===t.MessageChannel)r="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){u(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(u,0)};else{var o=new t.MessageChannel;o.port1.onmessage=u,r=function(){o.port2.postMessage(0)}}var h=[];function u(){var e,t;n=!0;for(var r=h.length;r;){for(t=h,h=[],e=-1;++e<r;)t[e]();r=h.length}n=!1}l.exports=function(e){1!==h.push(e)||n||r()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,r){"use strict";var i=e("immediate");function u(){}var l={},s=["REJECTED"],a=["FULFILLED"],n=["PENDING"];function o(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=n,this.queue=[],this.outcome=void 0,e!==u&&d(this,e)}function h(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function f(t,r,n){i(function(){var e;try{e=r(n)}catch(e){return l.reject(t,e)}e===t?l.reject(t,new TypeError("Cannot resolve promise with itself")):l.resolve(t,e)})}function c(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(t,e){var r=!1;function n(e){r||(r=!0,l.reject(t,e))}function i(e){r||(r=!0,l.resolve(t,e))}var s=p(function(){e(i,n)});"error"===s.status&&n(s.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}(t.exports=o).prototype.finally=function(t){if("function"!=typeof t)return this;var r=this.constructor;return this.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})})},o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var r=new this.constructor(u);this.state!==n?f(r,this.state===a?e:t,this.outcome):this.queue.push(new h(r,e,t));return r},h.prototype.callFulfilled=function(e){l.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){f(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){l.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){f(this.promise,this.onRejected,e)},l.resolve=function(e,t){var r=p(c,t);if("error"===r.status)return l.reject(e,r.value);var n=r.value;if(n)d(e,n);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},l.reject=function(e,t){e.state=s,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},o.resolve=function(e){if(e instanceof this)return e;return l.resolve(new this(u),e)},o.reject=function(e){var t=new this(u);return l.reject(t,e)},o.all=function(e){var r=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);var s=new Array(n),a=0,t=-1,o=new this(u);for(;++t<n;)h(e[t],t);return o;function h(e,t){r.resolve(e).then(function(e){s[t]=e,++a!==n||i||(i=!0,l.resolve(o,s))},function(e){i||(i=!0,l.reject(o,e))})}},o.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);var i=-1,s=new this(u);for(;++i<r;)a=e[i],t.resolve(a).then(function(e){n||(n=!0,l.resolve(s,e))},function(e){n||(n=!0,l.reject(s,e))});var a;return s}},{immediate:36}],38:[function(e,t,r){"use strict";var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){"use strict";var a=e("./zlib/deflate"),o=e("./utils/common"),h=e("./utils/strings"),i=e("./zlib/messages"),s=e("./zlib/zstream"),u=Object.prototype.toString,l=0,f=-1,c=0,d=8;function p(e){if(!(this instanceof p))return new p(e);this.options=o.assign({level:f,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:c,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var r=a.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==l)throw new Error(i[r]);if(t.header&&a.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?h.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=a.deflateSetDictionary(this.strm,n))!==l)throw new Error(i[r]);this._dict_set=!0}}function n(e,t){var r=new p(t);if(r.push(e,!0),r.err)throw r.msg||i[r.err];return r.result}p.prototype.push=function(e,t){var r,n,i=this.strm,s=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=h.string2buf(e):"[object ArrayBuffer]"===u.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new o.Buf8(s),i.next_out=0,i.avail_out=s),1!==(r=a.deflate(i,n))&&r!==l)return this.onEnd(r),!(this.ended=!0);0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(h.buf2binstring(o.shrinkBuf(i.output,i.next_out))):this.onData(o.shrinkBuf(i.output,i.next_out)))}while((0<i.avail_in||0===i.avail_out)&&1!==r);return 4===n?(r=a.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===l):2!==n||(this.onEnd(l),!(i.avail_out=0))},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=p,r.deflate=n,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,n(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,n(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){"use strict";var c=e("./zlib/inflate"),d=e("./utils/common"),p=e("./utils/strings"),m=e("./zlib/constants"),n=e("./zlib/messages"),i=e("./zlib/zstream"),s=e("./zlib/gzheader"),_=Object.prototype.toString;function a(e){if(!(this instanceof a))return new a(e);this.options=d.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i,this.strm.avail_out=0;var r=c.inflateInit2(this.strm,t.windowBits);if(r!==m.Z_OK)throw new Error(n[r]);this.header=new s,c.inflateGetHeader(this.strm,this.header)}function o(e,t){var r=new a(t);if(r.push(e,!0),r.err)throw r.msg||n[r.err];return r.result}a.prototype.push=function(e,t){var r,n,i,s,a,o,h=this.strm,u=this.options.chunkSize,l=this.options.dictionary,f=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?m.Z_FINISH:m.Z_NO_FLUSH,"string"==typeof e?h.input=p.binstring2buf(e):"[object ArrayBuffer]"===_.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new d.Buf8(u),h.next_out=0,h.avail_out=u),(r=c.inflate(h,m.Z_NO_FLUSH))===m.Z_NEED_DICT&&l&&(o="string"==typeof l?p.string2buf(l):"[object ArrayBuffer]"===_.call(l)?new Uint8Array(l):l,r=c.inflateSetDictionary(this.strm,o)),r===m.Z_BUF_ERROR&&!0===f&&(r=m.Z_OK,f=!1),r!==m.Z_STREAM_END&&r!==m.Z_OK)return this.onEnd(r),!(this.ended=!0);h.next_out&&(0!==h.avail_out&&r!==m.Z_STREAM_END&&(0!==h.avail_in||n!==m.Z_FINISH&&n!==m.Z_SYNC_FLUSH)||("string"===this.options.to?(i=p.utf8border(h.output,h.next_out),s=h.next_out-i,a=p.buf2string(h.output,i),h.next_out=s,h.avail_out=u-s,s&&d.arraySet(h.output,h.output,i,s,0),this.onData(a)):this.onData(d.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(f=!0)}while((0<h.avail_in||0===h.avail_out)&&r!==m.Z_STREAM_END);return r===m.Z_STREAM_END&&(n=m.Z_FINISH),n===m.Z_FINISH?(r=c.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===m.Z_OK):n!==m.Z_SYNC_FLUSH||(this.onEnd(m.Z_OK),!(h.avail_out=0))},a.prototype.onData=function(e){this.chunks.push(e)},a.prototype.onEnd=function(e){e===m.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=d.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=a,r.inflate=o,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,o(e,t)},r.ungzip=o},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var s=0;s<n;s++)e[i+s]=t[r+s]},flattenChunks:function(e){var t,r,n,i,s,a;for(t=n=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),t=i=0,r=e.length;t<r;t++)s=e[t],a.set(s,i),i+=s.length;return a}},s={arraySet:function(e,t,r,n,i){for(var s=0;s<n;s++)e[i+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(n)},{}],42:[function(e,t,r){"use strict";var h=e("./common"),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var u=new h.Buf8(256),n=0;n<256;n++)u[n]=252<=n?6:248<=n?5:240<=n?4:224<=n?3:192<=n?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,h.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}u[254]=u[254]=1,r.string2buf=function(e){var t,r,n,i,s,a=e.length,o=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),o+=r<128?1:r<2048?2:r<65536?3:4;for(t=new h.Buf8(o),i=s=0;s<o;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[s++]=r:(r<2048?t[s++]=192|r>>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new h.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,n,i,s,a=t||e.length,o=new Array(2*a);for(r=n=0;r<a;)if((i=e[r++])<128)o[n++]=i;else if(4<(s=u[i]))o[n++]=65533,r+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&r<a;)i=i<<6|63&e[r++],s--;1<s?o[n++]=65533:i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|1023&i)}return l(o,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){for(var i=65535&e|0,s=e>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3<r?2e3:r;s=s+(i=i+t[n++]|0)|0,--a;);i%=65521,s%=65521}return i|s<<16|0}},{}],44:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){"use strict";var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){"use strict";var h,c=e("../utils/common"),u=e("./trees"),d=e("./adler32"),p=e("./crc32"),n=e("./messages"),l=0,f=4,m=0,_=-2,g=-1,b=4,i=2,v=8,y=9,s=286,a=30,o=19,w=2*s+1,k=15,x=3,S=258,z=S+x+1,C=42,E=113,A=1,I=2,O=3,B=4;function R(e,t){return e.msg=n[t],t}function T(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function F(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(c.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function N(e,t){u._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function U(e,t){e.pending_buf[e.pending++]=t}function P(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function L(e,t){var r,n,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match,h=e.strstart>e.w_size-z?e.strstart-(e.w_size-z):0,u=e.window,l=e.w_mask,f=e.prev,c=e.strstart+S,d=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===d&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<c);if(n=S-(c-s),s=c-S,a<n){if(e.match_start=t,o<=(a=n))break;d=u[s+a-1],p=u[s+a]}}}while((t=f[t&l])>h&&0!=--i);return a<=e.lookahead?a:e.lookahead}function j(e){var t,r,n,i,s,a,o,h,u,l,f=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-z)){for(c.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=r=e.hash_size;n=e.head[--t],e.head[t]=f<=n?n-f:0,--r;);for(t=r=f;n=e.prev[--t],e.prev[t]=f<=n?n-f:0,--r;);i+=f}if(0===e.strm.avail_in)break;if(a=e.strm,o=e.window,h=e.strstart+e.lookahead,u=i,l=void 0,l=a.avail_in,u<l&&(l=u),r=0===l?0:(a.avail_in-=l,c.arraySet(o,a.input,a.next_in,l,h),1===a.state.wrap?a.adler=d(a.adler,o,l,h):2===a.state.wrap&&(a.adler=p(a.adler,o,l,h)),a.next_in+=l,a.total_in+=l,l),e.lookahead+=r,e.lookahead+e.insert>=x)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+x-1])&e.hash_mask,e.prev[s&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=s,s++,e.insert--,!(e.lookahead+e.insert<x)););}while(e.lookahead<z&&0!==e.strm.avail_in)}function Z(e,t){for(var r,n;;){if(e.lookahead<z){if(j(e),e.lookahead<z&&t===l)return A;if(0===e.lookahead)break}if(r=0,e.lookahead>=x&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-z&&(e.match_length=L(e,r)),e.match_length>=x)if(n=u._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=e.strstart<x-1?e.strstart:x-1,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}function W(e,t){for(var r,n,i;;){if(e.lookahead<z){if(j(e),e.lookahead<z&&t===l)return A;if(0===e.lookahead)break}if(r=0,e.lookahead>=x&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=x-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-z&&(e.match_length=L(e,r),e.match_length<=5&&(1===e.strategy||e.match_length===x&&4096<e.strstart-e.match_start)&&(e.match_length=x-1)),e.prev_length>=x&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-x,n=u._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=x-1,e.strstart++,n&&(N(e,!1),0===e.strm.avail_out))return A}else if(e.match_available){if((n=u._tr_tally(e,0,e.window[e.strstart-1]))&&N(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return A}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=u._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<x-1?e.strstart:x-1,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}function M(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function H(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new c.Buf16(2*w),this.dyn_dtree=new c.Buf16(2*(2*a+1)),this.bl_tree=new c.Buf16(2*(2*o+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new c.Buf16(k+1),this.heap=new c.Buf16(2*s+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new c.Buf16(2*s+1),D(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=i,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?C:E,e.adler=2===t.wrap?0:1,t.last_flush=l,u._tr_init(t),m):R(e,_)}function K(e){var t=G(e);return t===m&&function(e){e.window_size=2*e.w_size,D(e.head),e.max_lazy_match=h[e.level].max_lazy,e.good_match=h[e.level].good_length,e.nice_match=h[e.level].nice_length,e.max_chain_length=h[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=x-1,e.match_available=0,e.ins_h=0}(e.state),t}function Y(e,t,r,n,i,s){if(!e)return _;var a=1;if(t===g&&(t=6),n<0?(a=0,n=-n):15<n&&(a=2,n-=16),i<1||y<i||r!==v||n<8||15<n||t<0||9<t||s<0||b<s)return R(e,_);8===n&&(n=9);var o=new H;return(e.state=o).strm=e,o.wrap=a,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=i+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+x-1)/x),o.window=new c.Buf8(2*o.w_size),o.head=new c.Buf16(o.hash_size),o.prev=new c.Buf16(o.w_size),o.lit_bufsize=1<<i+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new c.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=t,o.strategy=s,o.method=r,K(e)}h=[new M(0,0,0,0,function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(j(e),0===e.lookahead&&t===l)return A;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,N(e,!1),0===e.strm.avail_out))return A;if(e.strstart-e.block_start>=e.w_size-z&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):(e.strstart>e.block_start&&(N(e,!1),e.strm.avail_out),A)}),new M(4,4,8,4,Z),new M(4,5,16,8,Z),new M(4,6,32,32,Z),new M(4,4,16,16,W),new M(8,16,32,32,W),new M(8,16,128,128,W),new M(8,32,128,256,W),new M(32,128,258,1024,W),new M(32,258,258,4096,W)],r.deflateInit=function(e,t){return Y(e,t,v,15,8,0)},r.deflateInit2=Y,r.deflateReset=K,r.deflateResetKeep=G,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?_:(e.state.gzhead=t,m):_},r.deflate=function(e,t){var r,n,i,s;if(!e||!e.state||5<t||t<0)return e?R(e,_):_;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==f)return R(e,0===e.avail_out?-5:_);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===C)if(2===n.wrap)e.adler=0,U(n,31),U(n,139),U(n,8),n.gzhead?(U(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),U(n,255&n.gzhead.time),U(n,n.gzhead.time>>8&255),U(n,n.gzhead.time>>16&255),U(n,n.gzhead.time>>24&255),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(U(n,255&n.gzhead.extra.length),U(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(U(n,0),U(n,0),U(n,0),U(n,0),U(n,0),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,3),n.status=E);else{var a=v+(n.w_bits-8<<4)<<8;a|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=E,P(n,a),0!==n.strstart&&(P(n,e.adler>>>16),P(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending!==n.pending_buf_size));)U(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,U(n,s)}while(0!==s);n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,U(n,s)}while(0!==s);n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&F(e),n.pending+2<=n.pending_buf_size&&(U(n,255&e.adler),U(n,e.adler>>8&255),e.adler=0,n.status=E)):n.status=E),0!==n.pending){if(F(e),0===e.avail_out)return n.last_flush=-1,m}else if(0===e.avail_in&&T(t)<=T(r)&&t!==f)return R(e,-5);if(666===n.status&&0!==e.avail_in)return R(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var o=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(j(e),0===e.lookahead)){if(t===l)return A;break}if(e.match_length=0,r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):3===n.strategy?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=S){if(j(e),e.lookahead<=S&&t===l)return A;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&0<e.strstart&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){s=e.strstart+S;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<s);e.match_length=S-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(r=u._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):h[n.level].func(n,t);if(o!==O&&o!==B||(n.status=666),o===A||o===O)return 0===e.avail_out&&(n.last_flush=-1),m;if(o===I&&(1===t?u._tr_align(n):5!==t&&(u._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),F(e),0===e.avail_out))return n.last_flush=-1,m}return t!==f?m:n.wrap<=0?1:(2===n.wrap?(U(n,255&e.adler),U(n,e.adler>>8&255),U(n,e.adler>>16&255),U(n,e.adler>>24&255),U(n,255&e.total_in),U(n,e.total_in>>8&255),U(n,e.total_in>>16&255),U(n,e.total_in>>24&255)):(P(n,e.adler>>>16),P(n,65535&e.adler)),F(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?m:1)},r.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==C&&69!==t&&73!==t&&91!==t&&103!==t&&t!==E&&666!==t?R(e,_):(e.state=null,t===E?R(e,-3):m):_},r.deflateSetDictionary=function(e,t){var r,n,i,s,a,o,h,u,l=t.length;if(!e||!e.state)return _;if(2===(s=(r=e.state).wrap)||1===s&&r.status!==C||r.lookahead)return _;for(1===s&&(e.adler=d(e.adler,t,l,0)),r.wrap=0,l>=r.w_size&&(0===s&&(D(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new c.Buf8(r.w_size),c.arraySet(u,t,l-r.w_size,r.w_size,0),t=u,l=r.w_size),a=e.avail_in,o=e.next_in,h=e.input,e.avail_in=l,e.next_in=0,e.input=t,j(r);r.lookahead>=x;){for(n=r.strstart,i=r.lookahead-(x-1);r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+x-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,--i;);r.strstart=n,r.lookahead=x-1,j(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=x-1,r.match_available=0,e.next_in=o,e.input=h,e.avail_in=a,r.wrap=s,m},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){"use strict";t.exports=function(e,t){var r,n,i,s,a,o,h,u,l,f,c,d,p,m,_,g,b,v,y,w,k,x,S,z,C;r=e.state,n=e.next_in,z=e.input,i=n+(e.avail_in-5),s=e.next_out,C=e.output,a=s-(t-e.avail_out),o=s+(e.avail_out-257),h=r.dmax,u=r.wsize,l=r.whave,f=r.wnext,c=r.window,d=r.hold,p=r.bits,m=r.lencode,_=r.distcode,g=(1<<r.lenbits)-1,b=(1<<r.distbits)-1;e:do{p<15&&(d+=z[n++]<<p,p+=8,d+=z[n++]<<p,p+=8),v=m[d&g];t:for(;;){if(d>>>=y=v>>>24,p-=y,0===(y=v>>>16&255))C[s++]=65535&v;else{if(!(16&y)){if(0==(64&y)){v=m[(65535&v)+(d&(1<<y)-1)];continue t}if(32&y){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}w=65535&v,(y&=15)&&(p<y&&(d+=z[n++]<<p,p+=8),w+=d&(1<<y)-1,d>>>=y,p-=y),p<15&&(d+=z[n++]<<p,p+=8,d+=z[n++]<<p,p+=8),v=_[d&b];r:for(;;){if(d>>>=y=v>>>24,p-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=_[(65535&v)+(d&(1<<y)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(k=65535&v,p<(y&=15)&&(d+=z[n++]<<p,(p+=8)<y&&(d+=z[n++]<<p,p+=8)),h<(k+=d&(1<<y)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(d>>>=y,p-=y,(y=s-a)<k){if(l<(y=k-y)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=c,(x=0)===f){if(x+=u-y,y<w){for(w-=y;C[s++]=c[x++],--y;);x=s-k,S=C}}else if(f<y){if(x+=u+f-y,(y-=f)<w){for(w-=y;C[s++]=c[x++],--y;);if(x=0,f<w){for(w-=y=f;C[s++]=c[x++],--y;);x=s-k,S=C}}}else if(x+=f-y,y<w){for(w-=y;C[s++]=c[x++],--y;);x=s-k,S=C}for(;2<w;)C[s++]=S[x++],C[s++]=S[x++],C[s++]=S[x++],w-=3;w&&(C[s++]=S[x++],1<w&&(C[s++]=S[x++]))}else{for(x=s-k;C[s++]=C[x++],C[s++]=C[x++],C[s++]=C[x++],2<(w-=3););w&&(C[s++]=C[x++],1<w&&(C[s++]=C[x++]))}break}}break}}while(n<i&&s<o);n-=w=p>>3,d&=(1<<(p-=w<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=s<o?o-s+257:257-(s-o),r.hold=d,r.bits=p}},{}],49:[function(e,t,r){"use strict";var I=e("../utils/common"),O=e("./adler32"),B=e("./crc32"),R=e("./inffast"),T=e("./inftrees"),D=1,F=2,N=0,U=-2,P=1,n=852,i=592;function L(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=P,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(i),t.sane=1,t.back=-1,N):U}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):U}function h(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?U:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,o(e))):U}function u(e,t){var r,n;return e?(n=new s,(e.state=n).window=null,(r=h(e,t))!==N&&(e.state=null),r):U}var l,f,c=!0;function j(e){if(c){var t;for(l=new I.Buf32(512),f=new I.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(T(D,e.lens,0,288,l,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;T(F,e.lens,0,32,f,0,e.work,{bits:5}),c=!1}e.lencode=l,e.lenbits=9,e.distcode=f,e.distbits=5}function Z(e,t,r,n){var i,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new I.Buf8(s.wsize)),n>=s.wsize?(I.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(i=s.wsize-s.wnext)&&(i=n),I.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(I.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0}r.inflateReset=o,r.inflateReset2=h,r.inflateResetKeep=a,r.inflateInit=function(e){return u(e,15)},r.inflateInit2=u,r.inflate=function(e,t){var r,n,i,s,a,o,h,u,l,f,c,d,p,m,_,g,b,v,y,w,k,x,S,z,C=0,E=new I.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return U;12===(r=e.state).mode&&(r.mode=13),a=e.next_out,i=e.output,h=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,u=r.hold,l=r.bits,f=o,c=h,x=N;e:for(;;)switch(r.mode){case P:if(0===r.wrap){r.mode=13;break}for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(2&r.wrap&&35615===u){E[r.check=0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0),l=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(l-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=512&u?10:12,l=u=0;break;case 2:for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=3;case 3:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=B(r.check,E,4,0)),l=u=0,r.mode=4;case 4:for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(d=r.length)&&(d=o),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,n,s,d,k)),512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(d=0;k=n[s+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&d<o;);if(512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,k)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===o)break e;for(d=0;k=n[s+d++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k)),k&&d<o;);if(512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,k)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}l=u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}e.adler=r.check=L(u),l=u=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}switch(r.last=1&u,l-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==t)break;u>>>=2,l-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,l=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(d=r.length){if(o<d&&(d=o),h<d&&(d=h),0===d)break e;I.arraySet(i,n,s,d,a),o-=d,s+=d,h-=d,a+=d,r.length-=d;break}r.mode=12;break;case 17:for(;l<14;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;l<3;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.lens[A[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;g=(C=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(b<16)u>>>=_,l-=_,r.lens[r.have++]=b;else{if(16===b){for(z=_+2;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(u>>>=_,l-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===b){for(z=_+3;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}l-=_,k=0,d=3+(7&(u>>>=_)),u>>>=3,l-=3}else{for(z=_+7;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}l-=_,k=0,d=11+(127&(u>>>=_)),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=h){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,R(e,c),a=e.next_out,i=e.output,h=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,u=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(g&&0==(240&g)){for(v=_,y=g,w=b;g=(C=r.lencode[w+((u&(1<<v+y)-1)>>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,r.length=b,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[u&(1<<r.distbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(0==(240&g)){for(v=_,y=g,w=b;g=(C=r.distcode[w+((u&(1<<v+y)-1)>>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,64&g){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===h)break e;if(d=c-h,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}p=d>r.wnext?(d-=r.wnext,r.wsize-d):r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=a-r.offset,d=r.length;for(h<d&&(d=h),h-=d,r.length-=d;i[a++]=m[p++],--d;);0===r.length&&(r.mode=21);break;case 26:if(0===h)break e;i[a++]=r.length,h--,r.mode=21;break;case 27:if(r.wrap){for(;l<32;){if(0===o)break e;o--,u|=n[s++]<<l,l+=8}if(c-=h,e.total_out+=c,r.total+=c,c&&(e.adler=r.check=r.flags?B(r.check,i,c,a-c):O(r.check,i,c,a-c)),c=h,(r.flags?u:L(u))!==r.check){e.msg="incorrect data check",r.mode=30;break}l=u=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;l<32;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}l=u=0}r.mode=29;case 29:x=1;break e;case 30:x=-3;break e;case 31:return-4;case 32:default:return U}return e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,(r.wsize||c!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&Z(e,e.output,e.next_out,c-e.avail_out)?(r.mode=31,-4):(f-=e.avail_in,c-=e.avail_out,e.total_in+=f,e.total_out+=c,r.total+=c,r.wrap&&c&&(e.adler=r.check=r.flags?B(r.check,i,c,e.next_out-c):O(r.check,i,c,e.next_out-c)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==f&&0===c||4===t)&&x===N&&(x=-5),x)},r.inflateEnd=function(e){if(!e||!e.state)return U;var t=e.state;return t.window&&(t.window=null),e.state=null,N},r.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?U:((r.head=t).done=!1,N):U},r.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?U:11===r.mode&&O(1,t,n,0)!==r.check?-3:Z(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,N):U},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){"use strict";var D=e("../utils/common"),F=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],U=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],P=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,n,i,s,a,o){var h,u,l,f,c,d,p,m,_,g=o.bits,b=0,v=0,y=0,w=0,k=0,x=0,S=0,z=0,C=0,E=0,A=null,I=0,O=new D.Buf16(16),B=new D.Buf16(16),R=null,T=0;for(b=0;b<=15;b++)O[b]=0;for(v=0;v<n;v++)O[t[r+v]]++;for(k=g,w=15;1<=w&&0===O[w];w--);if(w<k&&(k=w),0===w)return i[s++]=20971520,i[s++]=20971520,o.bits=1,0;for(y=1;y<w&&0===O[y];y++);for(k<y&&(k=y),b=z=1;b<=15;b++)if(z<<=1,(z-=O[b])<0)return-1;if(0<z&&(0===e||1!==w))return-1;for(B[1]=0,b=1;b<15;b++)B[b+1]=B[b]+O[b];for(v=0;v<n;v++)0!==t[r+v]&&(a[B[t[r+v]]++]=v);if(d=0===e?(A=R=a,19):1===e?(A=F,I-=257,R=N,T-=257,256):(A=U,R=P,-1),b=y,c=s,S=v=E=0,l=-1,f=(C=1<<(x=k))-1,1===e&&852<C||2===e&&592<C)return 1;for(;;){for(p=b-S,_=a[v]<d?(m=0,a[v]):a[v]>d?(m=R[T+a[v]],A[I+a[v]]):(m=96,0),h=1<<b-S,y=u=1<<x;i[c+(E>>S)+(u-=h)]=p<<24|m<<16|_|0,0!==u;);for(h=1<<b-1;E&h;)h>>=1;if(0!==h?(E&=h-1,E+=h):E=0,v++,0==--O[b]){if(b===w)break;b=t[r+a[v]]}if(k<b&&(E&f)!==l){for(0===S&&(S=k),c+=y,z=1<<(x=b-S);x+S<w&&!((z-=O[x+S])<=0);)x++,z<<=1;if(C+=1<<x,1===e&&852<C||2===e&&592<C)return 1;i[l=E&f]=k<<24|x<<16|c-s|0}}return 0!==E&&(i[c+E]=b-S<<24|64<<16|0),o.bits=k,0}},{"../utils/common":41}],51:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){"use strict";var i=e("../utils/common"),o=0,h=1;function n(e){for(var t=e.length;0<=--t;)e[t]=0}var s=0,a=29,u=256,l=u+1+a,f=30,c=19,_=2*l+1,g=15,d=16,p=7,m=256,b=16,v=17,y=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],k=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=new Array(2*(l+2));n(z);var C=new Array(2*f);n(C);var E=new Array(512);n(E);var A=new Array(256);n(A);var I=new Array(a);n(I);var O,B,R,T=new Array(f);function D(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function F(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function N(e){return e<256?E[e]:E[256+(e>>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>d-r?(e.bi_buf|=t<<e.bi_valid&65535,U(e,e.bi_buf),e.bi_buf=t>>d-e.bi_valid,e.bi_valid+=r-d):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function L(e,t,r){P(e,r[2*t],r[2*t+1])}function j(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){var n,i,s=new Array(g+1),a=0;for(n=1;n<=g;n++)s[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var o=e[2*i+1];0!==o&&(e[2*i]=j(s[o]++,o))}}function W(e){var t;for(t=0;t<l;t++)e.dyn_ltree[2*t]=0;for(t=0;t<f;t++)e.dyn_dtree[2*t]=0;for(t=0;t<c;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*m]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function M(e){8<e.bi_valid?U(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function H(e,t,r,n){var i=2*t,s=2*r;return e[i]<e[s]||e[i]===e[s]&&n[t]<=n[r]}function G(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&H(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!H(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function K(e,t,r){var n,i,s,a,o=0;if(0!==e.last_lit)for(;n=e.pending_buf[e.d_buf+2*o]<<8|e.pending_buf[e.d_buf+2*o+1],i=e.pending_buf[e.l_buf+o],o++,0===n?L(e,i,t):(L(e,(s=A[i])+u+1,t),0!==(a=w[s])&&P(e,i-=I[s],a),L(e,s=N(--n),r),0!==(a=k[s])&&P(e,n-=T[s],a)),o<e.last_lit;);L(e,m,t)}function Y(e,t){var r,n,i,s=t.dyn_tree,a=t.stat_desc.static_tree,o=t.stat_desc.has_stree,h=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=_,r=0;r<h;r++)0!==s[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,o&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;1<=r;r--)G(e,s,r);for(i=h;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,a,o,h=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(s=0;s<=g;s++)e.bl_count[s]=0;for(h[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<_;r++)p<(s=h[2*h[2*(n=e.heap[r])+1]+1]+1)&&(s=p,m++),h[2*n+1]=s,u<n||(e.bl_count[s]++,a=0,d<=n&&(a=c[n-d]),o=h[2*n],e.opt_len+=o*(s+a),f&&(e.static_len+=o*(l[2*n+1]+a)));if(0!==m){do{for(s=p-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[p]--,m-=2}while(0<m);for(s=p;0!==s;s--)for(n=e.bl_count[s];0!==n;)u<(i=e.heap[--r])||(h[2*i+1]!==s&&(e.opt_len+=(s-h[2*i+1])*h[2*i],h[2*i+1]=s),n--)}}(e,t),Z(s,u,e.bl_count)}function X(e,t,r){var n,i,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++o<h&&i===a||(o<u?e.bl_tree[2*i]+=o:0!==i?(i!==s&&e.bl_tree[2*i]++,e.bl_tree[2*b]++):o<=10?e.bl_tree[2*v]++:e.bl_tree[2*y]++,s=i,u=(o=0)===a?(h=138,3):i===a?(h=6,3):(h=7,4))}function V(e,t,r){var n,i,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++o<h&&i===a)){if(o<u)for(;L(e,i,e.bl_tree),0!=--o;);else 0!==i?(i!==s&&(L(e,i,e.bl_tree),o--),L(e,b,e.bl_tree),P(e,o-3,2)):o<=10?(L(e,v,e.bl_tree),P(e,o-3,3)):(L(e,y,e.bl_tree),P(e,o-11,7));s=i,u=(o=0)===a?(h=138,3):i===a?(h=6,3):(h=7,4)}}n(T);var q=!1;function J(e,t,r,n){P(e,(s<<1)+(n?1:0),3),function(e,t,r,n){M(e),n&&(U(e,r),U(e,~r)),i.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}r._tr_init=function(e){q||(function(){var e,t,r,n,i,s=new Array(g+1);for(n=r=0;n<a-1;n++)for(I[n]=r,e=0;e<1<<w[n];e++)A[r++]=n;for(A[r-1]=n,n=i=0;n<16;n++)for(T[n]=i,e=0;e<1<<k[n];e++)E[i++]=n;for(i>>=7;n<f;n++)for(T[n]=i<<7,e=0;e<1<<k[n]-7;e++)E[256+i++]=n;for(t=0;t<=g;t++)s[t]=0;for(e=0;e<=143;)z[2*e+1]=8,e++,s[8]++;for(;e<=255;)z[2*e+1]=9,e++,s[9]++;for(;e<=279;)z[2*e+1]=7,e++,s[7]++;for(;e<=287;)z[2*e+1]=8,e++,s[8]++;for(Z(z,l+1,s),e=0;e<f;e++)C[2*e+1]=5,C[2*e]=j(e,5);O=new D(z,w,u+1,l,g),B=new D(C,k,0,f,g),R=new D(new Array(0),x,0,c,p)}(),q=!0),e.l_desc=new F(e.dyn_ltree,O),e.d_desc=new F(e.dyn_dtree,B),e.bl_desc=new F(e.bl_tree,R),e.bi_buf=0,e.bi_valid=0,W(e)},r._tr_stored_block=J,r._tr_flush_block=function(e,t,r,n){var i,s,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(t=32;t<u;t++)if(0!==e.dyn_ltree[2*t])return h;return o}(e)),Y(e,e.l_desc),Y(e,e.d_desc),a=function(e){var t;for(X(e,e.dyn_ltree,e.l_desc.max_code),X(e,e.dyn_dtree,e.d_desc.max_code),Y(e,e.bl_desc),t=c-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=r+5,r+4<=i&&-1!==t?J(e,t,r,n):4===e.strategy||s===i?(P(e,2+(n?1:0),3),K(e,z,C)):(P(e,4+(n?1:0),3),function(e,t,r,n){var i;for(P(e,t-257,5),P(e,r-1,5),P(e,n-4,4),i=0;i<n;i++)P(e,e.bl_tree[2*S[i]+1],3);V(e,e.dyn_ltree,t-1),V(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),K(e,e.dyn_ltree,e.dyn_dtree)),W(e),n&&M(e)},r._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(A[r]+u+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){P(e,2,3),L(e,m,z),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(r,n){"use strict";if(!r.setImmediate){var i,s,t,a,o=1,h={},u=!1,l=r.document,e=Object.getPrototypeOf&&Object.getPrototypeOf(r);e=e&&e.setTimeout?e:r,i="[object process]"==={}.toString.call(r.process)?function(e){process.nextTick(function(){c(e)})}:function(){if(r.postMessage&&!r.importScripts){var e=!0,t=r.onmessage;return r.onmessage=function(){e=!1},r.postMessage("","*"),r.onmessage=t,e}}()?(a="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",d,!1):r.attachEvent("onmessage",d),function(e){r.postMessage(a+e,"*")}):r.MessageChannel?((t=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){t.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(c,0,e)},e.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var n={callback:e,args:t};return h[o]=n,i(o),o++},e.clearImmediate=f}function f(e){delete h[e]}function c(e){if(u)setTimeout(c,0,e);else{var t=h[e];if(t){u=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{f(e),u=!1}}}}function d(e){e.source===r&&"string"==typeof e.data&&0===e.data.indexOf(a)&&c(+e.data.slice(a.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)});
|
|
4245
|
-
}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],require("timers").setImmediate)
|
|
4246
|
-
},{"_process":37,"buffer":27,"timers":42}],36:[function(require,module,exports){
|
|
4247
4222
|
(function (process){(function (){
|
|
4248
4223
|
// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
4249
4224
|
// transplited with Babel
|
|
@@ -4776,7 +4751,7 @@ posix.posix = posix;
|
|
|
4776
4751
|
module.exports = posix;
|
|
4777
4752
|
|
|
4778
4753
|
}).call(this)}).call(this,require('_process'))
|
|
4779
|
-
},{"_process":
|
|
4754
|
+
},{"_process":36}],36:[function(require,module,exports){
|
|
4780
4755
|
// shim for using process in browser
|
|
4781
4756
|
var process = module.exports = {};
|
|
4782
4757
|
|
|
@@ -4962,7 +4937,7 @@ process.chdir = function (dir) {
|
|
|
4962
4937
|
};
|
|
4963
4938
|
process.umask = function() { return 0; };
|
|
4964
4939
|
|
|
4965
|
-
},{}],
|
|
4940
|
+
},{}],37:[function(require,module,exports){
|
|
4966
4941
|
(function (global){(function (){
|
|
4967
4942
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
4968
4943
|
;(function(root) {
|
|
@@ -5499,7 +5474,7 @@ process.umask = function() { return 0; };
|
|
|
5499
5474
|
}(this));
|
|
5500
5475
|
|
|
5501
5476
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
5502
|
-
},{}],
|
|
5477
|
+
},{}],38:[function(require,module,exports){
|
|
5503
5478
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
5504
5479
|
//
|
|
5505
5480
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -5585,7 +5560,7 @@ var isArray = Array.isArray || function (xs) {
|
|
|
5585
5560
|
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
5586
5561
|
};
|
|
5587
5562
|
|
|
5588
|
-
},{}],
|
|
5563
|
+
},{}],39:[function(require,module,exports){
|
|
5589
5564
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
5590
5565
|
//
|
|
5591
5566
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -5672,92 +5647,1219 @@ var objectKeys = Object.keys || function (obj) {
|
|
|
5672
5647
|
return res;
|
|
5673
5648
|
};
|
|
5674
5649
|
|
|
5675
|
-
},{}],
|
|
5650
|
+
},{}],40:[function(require,module,exports){
|
|
5676
5651
|
'use strict';
|
|
5677
5652
|
|
|
5678
5653
|
exports.decode = exports.parse = require('./decode');
|
|
5679
5654
|
exports.encode = exports.stringify = require('./encode');
|
|
5680
5655
|
|
|
5681
|
-
},{"./decode":
|
|
5682
|
-
(function (
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5656
|
+
},{"./decode":38,"./encode":39}],41:[function(require,module,exports){
|
|
5657
|
+
(function (process){(function (){
|
|
5658
|
+
/* unzipit@1.4.2, license MIT */
|
|
5659
|
+
(function (global, factory) {
|
|
5660
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
5661
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
5662
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.unzipit = {}));
|
|
5663
|
+
}(this, (function (exports) { 'use strict';
|
|
5664
|
+
|
|
5665
|
+
/* global SharedArrayBuffer, process */
|
|
5666
|
+
|
|
5667
|
+
function readBlobAsArrayBuffer(blob) {
|
|
5668
|
+
if (blob.arrayBuffer) {
|
|
5669
|
+
return blob.arrayBuffer();
|
|
5670
|
+
}
|
|
5671
|
+
return new Promise((resolve, reject) => {
|
|
5672
|
+
const reader = new FileReader();
|
|
5673
|
+
reader.addEventListener('loadend', () => {
|
|
5674
|
+
resolve(reader.result);
|
|
5675
|
+
});
|
|
5676
|
+
reader.addEventListener('error', reject);
|
|
5677
|
+
reader.readAsArrayBuffer(blob);
|
|
5678
|
+
});
|
|
5679
|
+
}
|
|
5688
5680
|
|
|
5689
|
-
|
|
5681
|
+
async function readBlobAsUint8Array(blob) {
|
|
5682
|
+
const arrayBuffer = await readBlobAsArrayBuffer(blob);
|
|
5683
|
+
return new Uint8Array(arrayBuffer);
|
|
5684
|
+
}
|
|
5690
5685
|
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
}
|
|
5694
|
-
exports.setInterval = function() {
|
|
5695
|
-
return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
|
|
5696
|
-
};
|
|
5697
|
-
exports.clearTimeout =
|
|
5698
|
-
exports.clearInterval = function(timeout) { timeout.close(); };
|
|
5686
|
+
function isBlob(v) {
|
|
5687
|
+
return typeof Blob !== 'undefined' && v instanceof Blob;
|
|
5688
|
+
}
|
|
5699
5689
|
|
|
5700
|
-
function
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
}
|
|
5704
|
-
Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
|
5705
|
-
Timeout.prototype.close = function() {
|
|
5706
|
-
this._clearFn.call(window, this._id);
|
|
5707
|
-
};
|
|
5690
|
+
function isSharedArrayBuffer(b) {
|
|
5691
|
+
return typeof SharedArrayBuffer !== 'undefined' && b instanceof SharedArrayBuffer;
|
|
5692
|
+
}
|
|
5708
5693
|
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5694
|
+
const isNode =
|
|
5695
|
+
(typeof process !== 'undefined') &&
|
|
5696
|
+
process.versions &&
|
|
5697
|
+
(typeof process.versions.node !== 'undefined') &&
|
|
5698
|
+
(typeof process.versions.electron === 'undefined');
|
|
5714
5699
|
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
};
|
|
5700
|
+
function isTypedArraySameAsArrayBuffer(typedArray) {
|
|
5701
|
+
return typedArray.byteOffset === 0 && typedArray.byteLength === typedArray.buffer.byteLength;
|
|
5702
|
+
}
|
|
5719
5703
|
|
|
5720
|
-
|
|
5721
|
-
|
|
5704
|
+
class ArrayBufferReader {
|
|
5705
|
+
constructor(arrayBufferOrView) {
|
|
5706
|
+
this.typedArray = (arrayBufferOrView instanceof ArrayBuffer || isSharedArrayBuffer(arrayBufferOrView))
|
|
5707
|
+
? new Uint8Array(arrayBufferOrView)
|
|
5708
|
+
: new Uint8Array(arrayBufferOrView.buffer, arrayBufferOrView.byteOffset, arrayBufferOrView.byteLength);
|
|
5709
|
+
}
|
|
5710
|
+
async getLength() {
|
|
5711
|
+
return this.typedArray.byteLength;
|
|
5712
|
+
}
|
|
5713
|
+
async read(offset, length) {
|
|
5714
|
+
return new Uint8Array(this.typedArray.buffer, this.typedArray.byteOffset + offset, length);
|
|
5715
|
+
}
|
|
5716
|
+
}
|
|
5722
5717
|
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5718
|
+
class BlobReader {
|
|
5719
|
+
constructor(blob) {
|
|
5720
|
+
this.blob = blob;
|
|
5721
|
+
}
|
|
5722
|
+
async getLength() {
|
|
5723
|
+
return this.blob.size;
|
|
5724
|
+
}
|
|
5725
|
+
async read(offset, length) {
|
|
5726
|
+
const blob = this.blob.slice(offset, offset + length);
|
|
5727
|
+
const arrayBuffer = await readBlobAsArrayBuffer(blob);
|
|
5728
|
+
return new Uint8Array(arrayBuffer);
|
|
5729
|
+
}
|
|
5730
|
+
async sliceAsBlob(offset, length, type = '') {
|
|
5731
|
+
return this.blob.slice(offset, offset + length, type);
|
|
5732
|
+
}
|
|
5729
5733
|
}
|
|
5730
|
-
};
|
|
5731
5734
|
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5735
|
+
class HTTPRangeReader {
|
|
5736
|
+
constructor(url) {
|
|
5737
|
+
this.url = url;
|
|
5738
|
+
}
|
|
5739
|
+
async getLength() {
|
|
5740
|
+
if (this.length === undefined) {
|
|
5741
|
+
const req = await fetch(this.url, { method: 'HEAD' });
|
|
5742
|
+
if (!req.ok) {
|
|
5743
|
+
throw new Error(`failed http request ${this.url}, status: ${req.status}: ${req.statusText}`);
|
|
5744
|
+
}
|
|
5745
|
+
this.length = parseInt(req.headers.get('content-length'));
|
|
5746
|
+
if (Number.isNaN(this.length)) {
|
|
5747
|
+
throw Error('could not get length');
|
|
5748
|
+
}
|
|
5749
|
+
}
|
|
5750
|
+
return this.length;
|
|
5751
|
+
}
|
|
5752
|
+
async read(offset, size) {
|
|
5753
|
+
if (size === 0) {
|
|
5754
|
+
return new Uint8Array(0);
|
|
5755
|
+
}
|
|
5756
|
+
const req = await fetch(this.url, {
|
|
5757
|
+
headers: {
|
|
5758
|
+
Range: `bytes=${offset}-${offset + size - 1}`,
|
|
5759
|
+
},
|
|
5760
|
+
});
|
|
5761
|
+
if (!req.ok) {
|
|
5762
|
+
throw new Error(`failed http request ${this.url}, status: ${req.status} offset: ${offset} size: ${size}: ${req.statusText}`);
|
|
5763
|
+
}
|
|
5764
|
+
const buffer = await req.arrayBuffer();
|
|
5765
|
+
return new Uint8Array(buffer);
|
|
5766
|
+
}
|
|
5767
|
+
}
|
|
5768
|
+
|
|
5769
|
+
function inflate(data, buf) {
|
|
5770
|
+
var u8=Uint8Array;
|
|
5771
|
+
if(data[0]==3 && data[1]==0) return (buf ? buf : new u8(0));
|
|
5772
|
+
var bitsF = _bitsF, bitsE = _bitsE, decodeTiny = _decodeTiny, get17 = _get17;
|
|
5773
|
+
|
|
5774
|
+
var noBuf = (buf==null);
|
|
5775
|
+
if(noBuf) buf = new u8((data.length>>>2)<<3);
|
|
5776
|
+
|
|
5777
|
+
var BFINAL=0, BTYPE=0, HLIT=0, HDIST=0, HCLEN=0, ML=0, MD=0;
|
|
5778
|
+
var off = 0, pos = 0;
|
|
5779
|
+
var lmap, dmap;
|
|
5780
|
+
|
|
5781
|
+
while(BFINAL==0) {
|
|
5782
|
+
BFINAL = bitsF(data, pos , 1);
|
|
5783
|
+
BTYPE = bitsF(data, pos+1, 2); pos+=3;
|
|
5784
|
+
//console.log(BFINAL, BTYPE);
|
|
5785
|
+
|
|
5786
|
+
if(BTYPE==0) {
|
|
5787
|
+
if((pos&7)!=0) pos+=8-(pos&7);
|
|
5788
|
+
var p8 = (pos>>>3)+4, len = data[p8-4]|(data[p8-3]<<8); //console.log(len);//bitsF(data, pos, 16),
|
|
5789
|
+
if(noBuf) buf=_check(buf, off+len);
|
|
5790
|
+
buf.set(new u8(data.buffer, data.byteOffset+p8, len), off);
|
|
5791
|
+
//for(var i=0; i<len; i++) buf[off+i] = data[p8+i];
|
|
5792
|
+
//for(var i=0; i<len; i++) if(buf[off+i] != data[p8+i]) throw "e";
|
|
5793
|
+
pos = ((p8+len)<<3); off+=len; continue;
|
|
5794
|
+
}
|
|
5795
|
+
if(noBuf) buf=_check(buf, off+(1<<17)); // really not enough in many cases (but PNG and ZIP provide buffer in advance)
|
|
5796
|
+
if(BTYPE==1) { lmap = U.flmap; dmap = U.fdmap; ML = (1<<9)-1; MD = (1<<5)-1; }
|
|
5797
|
+
if(BTYPE==2) {
|
|
5798
|
+
HLIT = bitsE(data, pos , 5)+257;
|
|
5799
|
+
HDIST = bitsE(data, pos+ 5, 5)+ 1;
|
|
5800
|
+
HCLEN = bitsE(data, pos+10, 4)+ 4; pos+=14;
|
|
5801
|
+
for(var i=0; i<38; i+=2) { U.itree[i]=0; U.itree[i+1]=0; }
|
|
5802
|
+
var tl = 1;
|
|
5803
|
+
for(var i=0; i<HCLEN; i++) { var l=bitsE(data, pos+i*3, 3); U.itree[(U.ordr[i]<<1)+1] = l; if(l>tl)tl=l; } pos+=3*HCLEN; //console.log(itree);
|
|
5804
|
+
makeCodes(U.itree, tl);
|
|
5805
|
+
codes2map(U.itree, tl, U.imap);
|
|
5806
|
+
|
|
5807
|
+
lmap = U.lmap; dmap = U.dmap;
|
|
5808
|
+
|
|
5809
|
+
pos = decodeTiny(U.imap, (1<<tl)-1, HLIT+HDIST, data, pos, U.ttree);
|
|
5810
|
+
var mx0 = _copyOut(U.ttree, 0, HLIT , U.ltree); ML = (1<<mx0)-1;
|
|
5811
|
+
var mx1 = _copyOut(U.ttree, HLIT, HDIST, U.dtree); MD = (1<<mx1)-1;
|
|
5812
|
+
|
|
5813
|
+
//var ml = decodeTiny(U.imap, (1<<tl)-1, HLIT , data, pos, U.ltree); ML = (1<<(ml>>>24))-1; pos+=(ml&0xffffff);
|
|
5814
|
+
makeCodes(U.ltree, mx0);
|
|
5815
|
+
codes2map(U.ltree, mx0, lmap);
|
|
5816
|
+
|
|
5817
|
+
//var md = decodeTiny(U.imap, (1<<tl)-1, HDIST, data, pos, U.dtree); MD = (1<<(md>>>24))-1; pos+=(md&0xffffff);
|
|
5818
|
+
makeCodes(U.dtree, mx1);
|
|
5819
|
+
codes2map(U.dtree, mx1, dmap);
|
|
5820
|
+
}
|
|
5821
|
+
//var ooff=off, opos=pos;
|
|
5822
|
+
while(true) {
|
|
5823
|
+
var code = lmap[get17(data, pos) & ML]; pos += code&15;
|
|
5824
|
+
var lit = code>>>4; //U.lhst[lit]++;
|
|
5825
|
+
if((lit>>>8)==0) { buf[off++] = lit; }
|
|
5826
|
+
else if(lit==256) { break; }
|
|
5827
|
+
else {
|
|
5828
|
+
var end = off+lit-254;
|
|
5829
|
+
if(lit>264) { var ebs = U.ldef[lit-257]; end = off + (ebs>>>3) + bitsE(data, pos, ebs&7); pos += ebs&7; }
|
|
5830
|
+
//dst[end-off]++;
|
|
5831
|
+
|
|
5832
|
+
var dcode = dmap[get17(data, pos) & MD]; pos += dcode&15;
|
|
5833
|
+
var dlit = dcode>>>4;
|
|
5834
|
+
var dbs = U.ddef[dlit], dst = (dbs>>>4) + bitsF(data, pos, dbs&15); pos += dbs&15;
|
|
5835
|
+
|
|
5836
|
+
//var o0 = off-dst, stp = Math.min(end-off, dst);
|
|
5837
|
+
//if(stp>20) while(off<end) { buf.copyWithin(off, o0, o0+stp); off+=stp; } else
|
|
5838
|
+
//if(end-dst<=off) buf.copyWithin(off, off-dst, end-dst); else
|
|
5839
|
+
//if(dst==1) buf.fill(buf[off-1], off, end); else
|
|
5840
|
+
if(noBuf) buf=_check(buf, off+(1<<17));
|
|
5841
|
+
while(off<end) { buf[off]=buf[off++-dst]; buf[off]=buf[off++-dst]; buf[off]=buf[off++-dst]; buf[off]=buf[off++-dst]; }
|
|
5842
|
+
off=end;
|
|
5843
|
+
//while(off!=end) { buf[off]=buf[off++-dst]; }
|
|
5844
|
+
}
|
|
5845
|
+
}
|
|
5846
|
+
//console.log(off-ooff, (pos-opos)>>>3);
|
|
5847
|
+
}
|
|
5848
|
+
//console.log(dst);
|
|
5849
|
+
//console.log(tlen, dlen, off-tlen+tcnt);
|
|
5850
|
+
return buf.length==off ? buf : buf.slice(0,off);
|
|
5851
|
+
}
|
|
5852
|
+
function _check(buf, len) {
|
|
5853
|
+
var bl=buf.length; if(len<=bl) return buf;
|
|
5854
|
+
var nbuf = new Uint8Array(Math.max(bl<<1,len)); nbuf.set(buf,0);
|
|
5855
|
+
//for(var i=0; i<bl; i+=4) { nbuf[i]=buf[i]; nbuf[i+1]=buf[i+1]; nbuf[i+2]=buf[i+2]; nbuf[i+3]=buf[i+3]; }
|
|
5856
|
+
return nbuf;
|
|
5857
|
+
}
|
|
5858
|
+
|
|
5859
|
+
function _decodeTiny(lmap, LL, len, data, pos, tree) {
|
|
5860
|
+
var bitsE = _bitsE, get17 = _get17;
|
|
5861
|
+
var i = 0;
|
|
5862
|
+
while(i<len) {
|
|
5863
|
+
var code = lmap[get17(data, pos)&LL]; pos+=code&15;
|
|
5864
|
+
var lit = code>>>4;
|
|
5865
|
+
if(lit<=15) { tree[i]=lit; i++; }
|
|
5866
|
+
else {
|
|
5867
|
+
var ll = 0, n = 0;
|
|
5868
|
+
if(lit==16) {
|
|
5869
|
+
n = (3 + bitsE(data, pos, 2)); pos += 2; ll = tree[i-1];
|
|
5870
|
+
}
|
|
5871
|
+
else if(lit==17) {
|
|
5872
|
+
n = (3 + bitsE(data, pos, 3)); pos += 3;
|
|
5873
|
+
}
|
|
5874
|
+
else if(lit==18) {
|
|
5875
|
+
n = (11 + bitsE(data, pos, 7)); pos += 7;
|
|
5876
|
+
}
|
|
5877
|
+
var ni = i+n;
|
|
5878
|
+
while(i<ni) { tree[i]=ll; i++; }
|
|
5879
|
+
}
|
|
5880
|
+
}
|
|
5881
|
+
return pos;
|
|
5882
|
+
}
|
|
5883
|
+
function _copyOut(src, off, len, tree) {
|
|
5884
|
+
var mx=0, i=0, tl=tree.length>>>1;
|
|
5885
|
+
while(i<len) { var v=src[i+off]; tree[(i<<1)]=0; tree[(i<<1)+1]=v; if(v>mx)mx=v; i++; }
|
|
5886
|
+
while(i<tl ) { tree[(i<<1)]=0; tree[(i<<1)+1]=0; i++; }
|
|
5887
|
+
return mx;
|
|
5888
|
+
}
|
|
5889
|
+
|
|
5890
|
+
function makeCodes(tree, MAX_BITS) { // code, length
|
|
5891
|
+
var max_code = tree.length;
|
|
5892
|
+
var code, bits, n, i, len;
|
|
5893
|
+
|
|
5894
|
+
var bl_count = U.bl_count; for(var i=0; i<=MAX_BITS; i++) bl_count[i]=0;
|
|
5895
|
+
for(i=1; i<max_code; i+=2) bl_count[tree[i]]++;
|
|
5896
|
+
|
|
5897
|
+
var next_code = U.next_code; // smallest code for each length
|
|
5898
|
+
|
|
5899
|
+
code = 0;
|
|
5900
|
+
bl_count[0] = 0;
|
|
5901
|
+
for (bits = 1; bits <= MAX_BITS; bits++) {
|
|
5902
|
+
code = (code + bl_count[bits-1]) << 1;
|
|
5903
|
+
next_code[bits] = code;
|
|
5904
|
+
}
|
|
5905
|
+
|
|
5906
|
+
for (n = 0; n < max_code; n+=2) {
|
|
5907
|
+
len = tree[n+1];
|
|
5908
|
+
if (len != 0) {
|
|
5909
|
+
tree[n] = next_code[len];
|
|
5910
|
+
next_code[len]++;
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
}
|
|
5914
|
+
function codes2map(tree, MAX_BITS, map) {
|
|
5915
|
+
var max_code = tree.length;
|
|
5916
|
+
var r15 = U.rev15;
|
|
5917
|
+
for(var i=0; i<max_code; i+=2) if(tree[i+1]!=0) {
|
|
5918
|
+
var lit = i>>1;
|
|
5919
|
+
var cl = tree[i+1], val = (lit<<4)|cl; // : (0x8000 | (U.of0[lit-257]<<7) | (U.exb[lit-257]<<4) | cl);
|
|
5920
|
+
var rest = (MAX_BITS-cl), i0 = tree[i]<<rest, i1 = i0 + (1<<rest);
|
|
5921
|
+
//tree[i]=r15[i0]>>>(15-MAX_BITS);
|
|
5922
|
+
while(i0!=i1) {
|
|
5923
|
+
var p0 = r15[i0]>>>(15-MAX_BITS);
|
|
5924
|
+
map[p0]=val; i0++;
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
}
|
|
5928
|
+
function revCodes(tree, MAX_BITS) {
|
|
5929
|
+
var r15 = U.rev15, imb = 15-MAX_BITS;
|
|
5930
|
+
for(var i=0; i<tree.length; i+=2) { var i0 = (tree[i]<<(MAX_BITS-tree[i+1])); tree[i] = r15[i0]>>>imb; }
|
|
5931
|
+
}
|
|
5932
|
+
|
|
5933
|
+
function _bitsE(dt, pos, length) { return ((dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) )>>>(pos&7))&((1<<length)-1); }
|
|
5934
|
+
function _bitsF(dt, pos, length) { return ((dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16))>>>(pos&7))&((1<<length)-1); }
|
|
5935
|
+
/*
|
|
5936
|
+
function _get9(dt, pos) {
|
|
5937
|
+
return ((dt[pos>>>3] | (dt[(pos>>>3)+1]<<8))>>>(pos&7))&511;
|
|
5938
|
+
} */
|
|
5939
|
+
function _get17(dt, pos) { // return at least 17 meaningful bytes
|
|
5940
|
+
return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) )>>>(pos&7);
|
|
5941
|
+
}
|
|
5942
|
+
const U = function(){
|
|
5943
|
+
var u16=Uint16Array, u32=Uint32Array;
|
|
5944
|
+
return {
|
|
5945
|
+
next_code : new u16(16),
|
|
5946
|
+
bl_count : new u16(16),
|
|
5947
|
+
ordr : [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ],
|
|
5948
|
+
of0 : [3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],
|
|
5949
|
+
exb : [0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0],
|
|
5950
|
+
ldef : new u16(32),
|
|
5951
|
+
df0 : [1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 65535, 65535],
|
|
5952
|
+
dxb : [0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0],
|
|
5953
|
+
ddef : new u32(32),
|
|
5954
|
+
flmap: new u16( 512), fltree: [],
|
|
5955
|
+
fdmap: new u16( 32), fdtree: [],
|
|
5956
|
+
lmap : new u16(32768), ltree : [], ttree:[],
|
|
5957
|
+
dmap : new u16(32768), dtree : [],
|
|
5958
|
+
imap : new u16( 512), itree : [],
|
|
5959
|
+
//rev9 : new u16( 512)
|
|
5960
|
+
rev15: new u16(1<<15),
|
|
5961
|
+
lhst : new u32(286), dhst : new u32( 30), ihst : new u32(19),
|
|
5962
|
+
lits : new u32(15000),
|
|
5963
|
+
strt : new u16(1<<16),
|
|
5964
|
+
prev : new u16(1<<15)
|
|
5965
|
+
};
|
|
5966
|
+
} ();
|
|
5967
|
+
|
|
5968
|
+
(function(){
|
|
5969
|
+
var len = 1<<15;
|
|
5970
|
+
for(var i=0; i<len; i++) {
|
|
5971
|
+
var x = i;
|
|
5972
|
+
x = (((x & 0xaaaaaaaa) >>> 1) | ((x & 0x55555555) << 1));
|
|
5973
|
+
x = (((x & 0xcccccccc) >>> 2) | ((x & 0x33333333) << 2));
|
|
5974
|
+
x = (((x & 0xf0f0f0f0) >>> 4) | ((x & 0x0f0f0f0f) << 4));
|
|
5975
|
+
x = (((x & 0xff00ff00) >>> 8) | ((x & 0x00ff00ff) << 8));
|
|
5976
|
+
U.rev15[i] = (((x >>> 16) | (x << 16)))>>>17;
|
|
5977
|
+
}
|
|
5978
|
+
|
|
5979
|
+
function pushV(tgt, n, sv) { while(n--!=0) tgt.push(0,sv); }
|
|
5980
|
+
|
|
5981
|
+
for(var i=0; i<32; i++) { U.ldef[i]=(U.of0[i]<<3)|U.exb[i]; U.ddef[i]=(U.df0[i]<<4)|U.dxb[i]; }
|
|
5982
|
+
|
|
5983
|
+
pushV(U.fltree, 144, 8); pushV(U.fltree, 255-143, 9); pushV(U.fltree, 279-255, 7); pushV(U.fltree,287-279,8);
|
|
5984
|
+
/*
|
|
5985
|
+
var i = 0;
|
|
5986
|
+
for(; i<=143; i++) U.fltree.push(0,8);
|
|
5987
|
+
for(; i<=255; i++) U.fltree.push(0,9);
|
|
5988
|
+
for(; i<=279; i++) U.fltree.push(0,7);
|
|
5989
|
+
for(; i<=287; i++) U.fltree.push(0,8);
|
|
5990
|
+
*/
|
|
5991
|
+
makeCodes(U.fltree, 9);
|
|
5992
|
+
codes2map(U.fltree, 9, U.flmap);
|
|
5993
|
+
revCodes (U.fltree, 9);
|
|
5994
|
+
|
|
5995
|
+
pushV(U.fdtree,32,5);
|
|
5996
|
+
//for(i=0;i<32; i++) U.fdtree.push(0,5);
|
|
5997
|
+
makeCodes(U.fdtree, 5);
|
|
5998
|
+
codes2map(U.fdtree, 5, U.fdmap);
|
|
5999
|
+
revCodes (U.fdtree, 5);
|
|
6000
|
+
|
|
6001
|
+
pushV(U.itree,19,0); pushV(U.ltree,286,0); pushV(U.dtree,30,0); pushV(U.ttree,320,0);
|
|
6002
|
+
/*
|
|
6003
|
+
for(var i=0; i< 19; i++) U.itree.push(0,0);
|
|
6004
|
+
for(var i=0; i<286; i++) U.ltree.push(0,0);
|
|
6005
|
+
for(var i=0; i< 30; i++) U.dtree.push(0,0);
|
|
6006
|
+
for(var i=0; i<320; i++) U.ttree.push(0,0);
|
|
6007
|
+
*/
|
|
6008
|
+
})();
|
|
6009
|
+
|
|
6010
|
+
const crc = {
|
|
6011
|
+
table : ( function() {
|
|
6012
|
+
var tab = new Uint32Array(256);
|
|
6013
|
+
for (var n=0; n<256; n++) {
|
|
6014
|
+
var c = n;
|
|
6015
|
+
for (var k=0; k<8; k++) {
|
|
6016
|
+
if (c & 1) c = 0xedb88320 ^ (c >>> 1);
|
|
6017
|
+
else c = c >>> 1;
|
|
6018
|
+
}
|
|
6019
|
+
tab[n] = c; }
|
|
6020
|
+
return tab; })(),
|
|
6021
|
+
update : function(c, buf, off, len) {
|
|
6022
|
+
for (var i=0; i<len; i++) c = crc.table[(c ^ buf[off+i]) & 0xff] ^ (c >>> 8);
|
|
6023
|
+
return c;
|
|
6024
|
+
},
|
|
6025
|
+
crc : function(b,o,l) { return crc.update(0xffffffff,b,o,l) ^ 0xffffffff; }
|
|
6026
|
+
};
|
|
6027
|
+
|
|
6028
|
+
function inflateRaw(file, buf) { return inflate(file, buf); }
|
|
6029
|
+
|
|
6030
|
+
/* global module */
|
|
6031
|
+
|
|
6032
|
+
const config = {
|
|
6033
|
+
numWorkers: 1,
|
|
6034
|
+
workerURL: '',
|
|
6035
|
+
useWorkers: false,
|
|
6036
|
+
};
|
|
5736
6037
|
|
|
5737
|
-
|
|
6038
|
+
let nextId = 0;
|
|
6039
|
+
|
|
6040
|
+
// Requests are put on a queue.
|
|
6041
|
+
// We don't send the request to the worker until the worker
|
|
6042
|
+
// is finished. This probably adds a small amount of latency
|
|
6043
|
+
// but the issue is imagine you have 2 workers. You give worker
|
|
6044
|
+
// A x seconds of work to do and worker B y seconds of work to
|
|
6045
|
+
// do. You don't know which will finish first. If you give
|
|
6046
|
+
// the worker with more work to do the request then you'll
|
|
6047
|
+
// waste time.
|
|
6048
|
+
|
|
6049
|
+
// note: we can't check `workers.length` for deciding if
|
|
6050
|
+
// we've reached `config.numWorkers` because creation the worker
|
|
6051
|
+
// is async which means other requests to make workers might
|
|
6052
|
+
// come in before a worker gets added to `workers`
|
|
6053
|
+
let numWorkers = 0;
|
|
6054
|
+
let canUseWorkers = true; // gets set to false if we can't start a worker
|
|
6055
|
+
const workers = [];
|
|
6056
|
+
const availableWorkers = [];
|
|
6057
|
+
const waitingForWorkerQueue = [];
|
|
6058
|
+
const currentlyProcessingIdToRequestMap = new Map();
|
|
6059
|
+
|
|
6060
|
+
function handleResult(e) {
|
|
6061
|
+
makeWorkerAvailable(e.target);
|
|
6062
|
+
const {id, error, data} = e.data;
|
|
6063
|
+
const request = currentlyProcessingIdToRequestMap.get(id);
|
|
6064
|
+
currentlyProcessingIdToRequestMap.delete(id);
|
|
6065
|
+
if (error) {
|
|
6066
|
+
request.reject(error);
|
|
6067
|
+
} else {
|
|
6068
|
+
request.resolve(data);
|
|
6069
|
+
}
|
|
6070
|
+
}
|
|
5738
6071
|
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
6072
|
+
// Because Firefox uses non-standard onerror to signal an error.
|
|
6073
|
+
function startWorker(url) {
|
|
6074
|
+
return new Promise((resolve, reject) => {
|
|
6075
|
+
const worker = new Worker(url);
|
|
6076
|
+
worker.onmessage = (e) => {
|
|
6077
|
+
if (e.data === 'start') {
|
|
6078
|
+
worker.onerror = undefined;
|
|
6079
|
+
worker.onmessage = undefined;
|
|
6080
|
+
resolve(worker);
|
|
6081
|
+
} else {
|
|
6082
|
+
reject(new Error(`unexpected message: ${e.data}`));
|
|
6083
|
+
}
|
|
6084
|
+
};
|
|
6085
|
+
worker.onerror = reject;
|
|
6086
|
+
});
|
|
6087
|
+
}
|
|
6088
|
+
|
|
6089
|
+
function dynamicRequire(mod, request) {
|
|
6090
|
+
return mod.require ? mod.require(request) : {};
|
|
6091
|
+
}
|
|
6092
|
+
|
|
6093
|
+
const workerHelper = (function() {
|
|
6094
|
+
if (isNode) {
|
|
6095
|
+
// We need to use `dynamicRequire` because `require` on it's own will be optimized by webpack.
|
|
6096
|
+
const {Worker} = dynamicRequire(module, 'worker_threads');
|
|
6097
|
+
return {
|
|
6098
|
+
async createWorker(url) {
|
|
6099
|
+
return new Worker(url);
|
|
6100
|
+
},
|
|
6101
|
+
addEventListener(worker, fn) {
|
|
6102
|
+
worker.on('message', (data) => {
|
|
6103
|
+
fn({target: worker, data});
|
|
6104
|
+
});
|
|
6105
|
+
},
|
|
6106
|
+
async terminate(worker) {
|
|
6107
|
+
await worker.terminate();
|
|
6108
|
+
},
|
|
6109
|
+
};
|
|
6110
|
+
} else {
|
|
6111
|
+
return {
|
|
6112
|
+
async createWorker(url) {
|
|
6113
|
+
// I don't understand this security issue
|
|
6114
|
+
// Apparently there is some iframe setting or http header
|
|
6115
|
+
// that prevents cross domain workers. But, I can manually
|
|
6116
|
+
// download the text and do it. I reported this to Chrome
|
|
6117
|
+
// and they said it was fine so ¯\_(ツ)_/¯
|
|
6118
|
+
try {
|
|
6119
|
+
const worker = await startWorker(url);
|
|
6120
|
+
return worker;
|
|
6121
|
+
} catch (e) {
|
|
6122
|
+
console.warn('could not load worker:', url);
|
|
6123
|
+
}
|
|
6124
|
+
|
|
6125
|
+
let text;
|
|
6126
|
+
try {
|
|
6127
|
+
const req = await fetch(url, {mode: 'cors'});
|
|
6128
|
+
if (!req.ok) {
|
|
6129
|
+
throw new Error(`could not load: ${url}`);
|
|
6130
|
+
}
|
|
6131
|
+
text = await req.text();
|
|
6132
|
+
url = URL.createObjectURL(new Blob([text], {type: 'application/javascript'}));
|
|
6133
|
+
const worker = await startWorker(url);
|
|
6134
|
+
config.workerURL = url; // this is a hack. What's a better way to structure this code?
|
|
6135
|
+
return worker;
|
|
6136
|
+
} catch (e) {
|
|
6137
|
+
console.warn('could not load worker via fetch:', url);
|
|
6138
|
+
}
|
|
6139
|
+
|
|
6140
|
+
if (text !== undefined) {
|
|
6141
|
+
try {
|
|
6142
|
+
url = `data:application/javascript;base64,${btoa(text)}`;
|
|
6143
|
+
const worker = await startWorker(url);
|
|
6144
|
+
config.workerURL = url;
|
|
6145
|
+
return worker;
|
|
6146
|
+
} catch (e) {
|
|
6147
|
+
console.warn('could not load worker via dataURI');
|
|
6148
|
+
}
|
|
6149
|
+
}
|
|
6150
|
+
|
|
6151
|
+
console.warn('workers will not be used');
|
|
6152
|
+
throw new Error('can not start workers');
|
|
6153
|
+
},
|
|
6154
|
+
addEventListener(worker, fn) {
|
|
6155
|
+
worker.addEventListener('message', fn);
|
|
6156
|
+
},
|
|
6157
|
+
async terminate(worker) {
|
|
6158
|
+
worker.terminate();
|
|
6159
|
+
},
|
|
6160
|
+
};
|
|
6161
|
+
}
|
|
6162
|
+
}());
|
|
6163
|
+
|
|
6164
|
+
function makeWorkerAvailable(worker) {
|
|
6165
|
+
availableWorkers.push(worker);
|
|
6166
|
+
processWaitingForWorkerQueue();
|
|
6167
|
+
}
|
|
6168
|
+
|
|
6169
|
+
async function getAvailableWorker() {
|
|
6170
|
+
if (availableWorkers.length === 0 && numWorkers < config.numWorkers) {
|
|
6171
|
+
++numWorkers; // see comment at numWorkers declaration
|
|
6172
|
+
try {
|
|
6173
|
+
const worker = await workerHelper.createWorker(config.workerURL);
|
|
6174
|
+
workers.push(worker);
|
|
6175
|
+
availableWorkers.push(worker);
|
|
6176
|
+
workerHelper.addEventListener(worker, handleResult);
|
|
6177
|
+
} catch (e) {
|
|
6178
|
+
// set this global out-of-band (needs refactor)
|
|
6179
|
+
canUseWorkers = false;
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
return availableWorkers.pop();
|
|
6183
|
+
}
|
|
6184
|
+
|
|
6185
|
+
// @param {Uint8Array} src
|
|
6186
|
+
// @param {number} uncompressedSize
|
|
6187
|
+
// @param {string} [type] mime-type
|
|
6188
|
+
// @returns {ArrayBuffer|Blob} ArrayBuffer if type is falsy or Blob otherwise.
|
|
6189
|
+
function inflateRawLocal(src, uncompressedSize, type, resolve) {
|
|
6190
|
+
const dst = new Uint8Array(uncompressedSize);
|
|
6191
|
+
inflateRaw(src, dst);
|
|
6192
|
+
resolve(type
|
|
6193
|
+
? new Blob([dst], {type})
|
|
6194
|
+
: dst.buffer);
|
|
6195
|
+
}
|
|
6196
|
+
|
|
6197
|
+
async function processWaitingForWorkerQueue() {
|
|
6198
|
+
if (waitingForWorkerQueue.length === 0) {
|
|
6199
|
+
return;
|
|
6200
|
+
}
|
|
6201
|
+
|
|
6202
|
+
if (config.useWorkers && canUseWorkers) {
|
|
6203
|
+
const worker = await getAvailableWorker();
|
|
6204
|
+
// canUseWorkers might have been set out-of-band (need refactor)
|
|
6205
|
+
if (canUseWorkers) {
|
|
6206
|
+
if (worker) {
|
|
6207
|
+
if (waitingForWorkerQueue.length === 0) {
|
|
6208
|
+
// the queue might be empty while we awaited for a worker.
|
|
6209
|
+
makeWorkerAvailable(worker);
|
|
6210
|
+
return;
|
|
6211
|
+
}
|
|
6212
|
+
const {id, src, uncompressedSize, type, resolve, reject} = waitingForWorkerQueue.shift();
|
|
6213
|
+
currentlyProcessingIdToRequestMap.set(id, {id, resolve, reject});
|
|
6214
|
+
const transferables = [];
|
|
6215
|
+
// NOTE: Originally I thought you could transfer an ArrayBuffer.
|
|
6216
|
+
// The code on this side is often using views into the entire file
|
|
6217
|
+
// which means if we transferred we'd lose the entire file. That sucks
|
|
6218
|
+
// because it means there's an expensive copy to send the uncompressed
|
|
6219
|
+
// data to the worker.
|
|
6220
|
+
//
|
|
6221
|
+
// Also originally I thought we could send a Blob but we'd need to refactor
|
|
6222
|
+
// the code in unzipit/readEntryData as currently it reads the uncompressed
|
|
6223
|
+
// bytes.
|
|
6224
|
+
//
|
|
6225
|
+
//if (!isBlob(src) && !isSharedArrayBuffer(src)) {
|
|
6226
|
+
// transferables.push(src);
|
|
6227
|
+
//}
|
|
6228
|
+
worker.postMessage({
|
|
6229
|
+
type: 'inflate',
|
|
6230
|
+
data: {
|
|
6231
|
+
id,
|
|
6232
|
+
type,
|
|
6233
|
+
src,
|
|
6234
|
+
uncompressedSize,
|
|
6235
|
+
},
|
|
6236
|
+
}, transferables);
|
|
6237
|
+
}
|
|
6238
|
+
return;
|
|
6239
|
+
}
|
|
6240
|
+
}
|
|
6241
|
+
|
|
6242
|
+
// inflate locally
|
|
6243
|
+
// We loop here because what happens if many requests happen at once
|
|
6244
|
+
// the first N requests will try to async make a worker. Other requests
|
|
6245
|
+
// will then be on the queue. But if we fail to make workers then there
|
|
6246
|
+
// are pending requests.
|
|
6247
|
+
while (waitingForWorkerQueue.length) {
|
|
6248
|
+
const {src, uncompressedSize, type, resolve} = waitingForWorkerQueue.shift();
|
|
6249
|
+
let data = src;
|
|
6250
|
+
if (isBlob(src)) {
|
|
6251
|
+
data = await readBlobAsUint8Array(src);
|
|
6252
|
+
}
|
|
6253
|
+
inflateRawLocal(data, uncompressedSize, type, resolve);
|
|
6254
|
+
}
|
|
6255
|
+
}
|
|
6256
|
+
|
|
6257
|
+
function setOptions(options) {
|
|
6258
|
+
config.workerURL = options.workerURL || config.workerURL;
|
|
6259
|
+
// there's no reason to set the workerURL if you're not going to use workers
|
|
6260
|
+
if (options.workerURL) {
|
|
6261
|
+
config.useWorkers = true;
|
|
6262
|
+
}
|
|
6263
|
+
config.useWorkers = options.useWorkers !== undefined ? options.useWorkers : config.useWorkers;
|
|
6264
|
+
config.numWorkers = options.numWorkers || config.numWorkers;
|
|
6265
|
+
}
|
|
6266
|
+
|
|
6267
|
+
// It has to take non-zero time to put a large typed array in a Blob since the very
|
|
6268
|
+
// next instruction you could change the contents of the array. So, if you're reading
|
|
6269
|
+
// the zip file for images/video/audio then all you want is a Blob on which to get a URL.
|
|
6270
|
+
// so that operation of putting the data in a Blob should happen in the worker.
|
|
6271
|
+
//
|
|
6272
|
+
// Conversely if you want the data itself then you want an ArrayBuffer immediately
|
|
6273
|
+
// since the worker can transfer its ArrayBuffer zero copy.
|
|
6274
|
+
//
|
|
6275
|
+
// @param {Uint8Array|Blob} src
|
|
6276
|
+
// @param {number} uncompressedSize
|
|
6277
|
+
// @param {string} [type] falsy or mimeType string (eg: 'image/png')
|
|
6278
|
+
// @returns {ArrayBuffer|Blob} ArrayBuffer if type is falsy or Blob otherwise.
|
|
6279
|
+
function inflateRawAsync(src, uncompressedSize, type) {
|
|
6280
|
+
return new Promise((resolve, reject) => {
|
|
6281
|
+
// note: there is potential an expensive copy here. In order for the data
|
|
6282
|
+
// to make it into the worker we need to copy the data to the worker unless
|
|
6283
|
+
// it's a Blob or a SharedArrayBuffer.
|
|
6284
|
+
//
|
|
6285
|
+
// Solutions:
|
|
6286
|
+
//
|
|
6287
|
+
// 1. A minor enhancement, if `uncompressedSize` is small don't call the worker.
|
|
6288
|
+
//
|
|
6289
|
+
// might be a win period as their is overhead calling the worker
|
|
6290
|
+
//
|
|
6291
|
+
// 2. Move the entire library to the worker
|
|
6292
|
+
//
|
|
6293
|
+
// Good, Maybe faster if you pass a URL, Blob, or SharedArrayBuffer? Not sure about that
|
|
6294
|
+
// as those are also easy to transfer. Still slow if you pass an ArrayBuffer
|
|
6295
|
+
// as the ArrayBuffer has to be copied to the worker.
|
|
6296
|
+
//
|
|
6297
|
+
// I guess benchmarking is really the only thing to try.
|
|
6298
|
+
waitingForWorkerQueue.push({src, uncompressedSize, type, resolve, reject, id: nextId++});
|
|
6299
|
+
processWaitingForWorkerQueue();
|
|
6300
|
+
});
|
|
6301
|
+
}
|
|
6302
|
+
|
|
6303
|
+
function clearArray(arr) {
|
|
6304
|
+
arr.splice(0, arr.length);
|
|
6305
|
+
}
|
|
6306
|
+
|
|
6307
|
+
async function cleanup() {
|
|
6308
|
+
for (const worker of workers) {
|
|
6309
|
+
await workerHelper.terminate(worker);
|
|
6310
|
+
}
|
|
6311
|
+
clearArray(workers);
|
|
6312
|
+
clearArray(availableWorkers);
|
|
6313
|
+
clearArray(waitingForWorkerQueue);
|
|
6314
|
+
currentlyProcessingIdToRequestMap.clear();
|
|
6315
|
+
numWorkers = 0;
|
|
6316
|
+
canUseWorkers = true;
|
|
6317
|
+
}
|
|
6318
|
+
|
|
6319
|
+
/*
|
|
6320
|
+
class Zip {
|
|
6321
|
+
constructor(reader) {
|
|
6322
|
+
comment, // the comment for this entry
|
|
6323
|
+
commentBytes, // the raw comment for this entry
|
|
6324
|
+
}
|
|
6325
|
+
}
|
|
6326
|
+
*/
|
|
6327
|
+
|
|
6328
|
+
function dosDateTimeToDate(date, time) {
|
|
6329
|
+
const day = date & 0x1f; // 1-31
|
|
6330
|
+
const month = (date >> 5 & 0xf) - 1; // 1-12, 0-11
|
|
6331
|
+
const year = (date >> 9 & 0x7f) + 1980; // 0-128, 1980-2108
|
|
6332
|
+
|
|
6333
|
+
const millisecond = 0;
|
|
6334
|
+
const second = (time & 0x1f) * 2; // 0-29, 0-58 (even numbers)
|
|
6335
|
+
const minute = time >> 5 & 0x3f; // 0-59
|
|
6336
|
+
const hour = time >> 11 & 0x1f; // 0-23
|
|
6337
|
+
|
|
6338
|
+
return new Date(year, month, day, hour, minute, second, millisecond);
|
|
6339
|
+
}
|
|
6340
|
+
|
|
6341
|
+
class ZipEntry {
|
|
6342
|
+
constructor(reader, rawEntry) {
|
|
6343
|
+
this._reader = reader;
|
|
6344
|
+
this._rawEntry = rawEntry;
|
|
6345
|
+
this.name = rawEntry.name;
|
|
6346
|
+
this.nameBytes = rawEntry.nameBytes;
|
|
6347
|
+
this.size = rawEntry.uncompressedSize;
|
|
6348
|
+
this.compressedSize = rawEntry.compressedSize;
|
|
6349
|
+
this.comment = rawEntry.comment;
|
|
6350
|
+
this.commentBytes = rawEntry.commentBytes;
|
|
6351
|
+
this.compressionMethod = rawEntry.compressionMethod;
|
|
6352
|
+
this.lastModDate = dosDateTimeToDate(rawEntry.lastModFileDate, rawEntry.lastModFileTime);
|
|
6353
|
+
this.isDirectory = rawEntry.uncompressedSize === 0 && rawEntry.name.endsWith('/');
|
|
6354
|
+
this.encrypted = !!(rawEntry.generalPurposeBitFlag & 0x1);
|
|
6355
|
+
this.externalFileAttributes = rawEntry.externalFileAttributes;
|
|
6356
|
+
this.versionMadeBy = rawEntry.versionMadeBy;
|
|
6357
|
+
}
|
|
6358
|
+
// returns a promise that returns a Blob for this entry
|
|
6359
|
+
async blob(type = 'application/octet-stream') {
|
|
6360
|
+
return await readEntryDataAsBlob(this._reader, this._rawEntry, type);
|
|
6361
|
+
}
|
|
6362
|
+
// returns a promise that returns an ArrayBuffer for this entry
|
|
6363
|
+
async arrayBuffer() {
|
|
6364
|
+
return await readEntryDataAsArrayBuffer(this._reader, this._rawEntry);
|
|
6365
|
+
}
|
|
6366
|
+
// returns text, assumes the text is valid utf8. If you want more options decode arrayBuffer yourself
|
|
6367
|
+
async text() {
|
|
6368
|
+
const buffer = await this.arrayBuffer();
|
|
6369
|
+
return decodeBuffer(new Uint8Array(buffer));
|
|
6370
|
+
}
|
|
6371
|
+
// returns text with JSON.parse called on it. If you want more options decode arrayBuffer yourself
|
|
6372
|
+
async json() {
|
|
6373
|
+
const text = await this.text();
|
|
6374
|
+
return JSON.parse(text);
|
|
6375
|
+
}
|
|
6376
|
+
}
|
|
6377
|
+
|
|
6378
|
+
const EOCDR_WITHOUT_COMMENT_SIZE = 22;
|
|
6379
|
+
const MAX_COMMENT_SIZE = 0xffff; // 2-byte size
|
|
6380
|
+
const EOCDR_SIGNATURE = 0x06054b50;
|
|
6381
|
+
const ZIP64_EOCDR_SIGNATURE = 0x06064b50;
|
|
6382
|
+
|
|
6383
|
+
async function readAs(reader, offset, length) {
|
|
6384
|
+
return await reader.read(offset, length);
|
|
6385
|
+
}
|
|
6386
|
+
|
|
6387
|
+
// The point of this function is we want to be able to pass the data
|
|
6388
|
+
// to a worker as fast as possible so when decompressing if the data
|
|
6389
|
+
// is already a blob and we can get a blob then get a blob.
|
|
6390
|
+
//
|
|
6391
|
+
// I'm not sure what a better way to refactor this is. We've got examples
|
|
6392
|
+
// of multiple readers. Ideally, for every type of reader we could ask
|
|
6393
|
+
// it, "give me a type that is zero copy both locally and when sent to a worker".
|
|
6394
|
+
//
|
|
6395
|
+
// The problem is the worker would also have to know the how to handle this
|
|
6396
|
+
// opaque type. I suppose the correct solution is to register different
|
|
6397
|
+
// reader handlers in the worker so BlobReader would register some
|
|
6398
|
+
// `handleZeroCopyType<BlobReader>`. At the moment I don't feel like
|
|
6399
|
+
// refactoring. As it is you just pass in an instance of the reader
|
|
6400
|
+
// but instead you'd have to register the reader and some how get the
|
|
6401
|
+
// source for the `handleZeroCopyType` handler function into the worker.
|
|
6402
|
+
// That sounds like a huge PITA, requiring you to put the implementation
|
|
6403
|
+
// in a separate file so the worker can load it or some other workaround
|
|
6404
|
+
// hack.
|
|
6405
|
+
//
|
|
6406
|
+
// For now this hack works even if it's not generic.
|
|
6407
|
+
async function readAsBlobOrTypedArray(reader, offset, length, type) {
|
|
6408
|
+
if (reader.sliceAsBlob) {
|
|
6409
|
+
return await reader.sliceAsBlob(offset, length, type);
|
|
6410
|
+
}
|
|
6411
|
+
return await reader.read(offset, length);
|
|
6412
|
+
}
|
|
6413
|
+
|
|
6414
|
+
const crc$1 = {
|
|
6415
|
+
unsigned() {
|
|
6416
|
+
return 0;
|
|
6417
|
+
},
|
|
6418
|
+
};
|
|
6419
|
+
|
|
6420
|
+
function getUint16LE(uint8View, offset) {
|
|
6421
|
+
return uint8View[offset ] +
|
|
6422
|
+
uint8View[offset + 1] * 0x100;
|
|
6423
|
+
}
|
|
6424
|
+
|
|
6425
|
+
function getUint32LE(uint8View, offset) {
|
|
6426
|
+
return uint8View[offset ] +
|
|
6427
|
+
uint8View[offset + 1] * 0x100 +
|
|
6428
|
+
uint8View[offset + 2] * 0x10000 +
|
|
6429
|
+
uint8View[offset + 3] * 0x1000000;
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6432
|
+
function getUint64LE(uint8View, offset) {
|
|
6433
|
+
return getUint32LE(uint8View, offset) +
|
|
6434
|
+
getUint32LE(uint8View, offset + 4) * 0x100000000;
|
|
6435
|
+
}
|
|
6436
|
+
|
|
6437
|
+
/* eslint-disable no-irregular-whitespace */
|
|
6438
|
+
// const decodeCP437 = (function() {
|
|
6439
|
+
// const cp437 = '\u0000☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ';
|
|
6440
|
+
//
|
|
6441
|
+
// return function(uint8view) {
|
|
6442
|
+
// return Array.from(uint8view).map(v => cp437[v]).join('');
|
|
6443
|
+
// };
|
|
6444
|
+
// }());
|
|
6445
|
+
/* eslint-enable no-irregular-whitespace */
|
|
6446
|
+
|
|
6447
|
+
const utf8Decoder = new TextDecoder();
|
|
6448
|
+
function decodeBuffer(uint8View, isUTF8) { /* eslint-disable-line no-unused-vars */ /* lgtm [js/superfluous-trailing-arguments] */
|
|
6449
|
+
if (isSharedArrayBuffer(uint8View.buffer)) {
|
|
6450
|
+
uint8View = new Uint8Array(uint8View);
|
|
6451
|
+
}
|
|
6452
|
+
return utf8Decoder.decode(uint8View);
|
|
6453
|
+
/*
|
|
6454
|
+
AFAICT the UTF8 flat is not set so it's 100% up to the user
|
|
6455
|
+
to self decode if their file is not utf8 filenames
|
|
6456
|
+
return isUTF8
|
|
6457
|
+
? utf8Decoder.decode(uint8View)
|
|
6458
|
+
: decodeCP437(uint8View);
|
|
6459
|
+
*/
|
|
6460
|
+
}
|
|
6461
|
+
|
|
6462
|
+
async function findEndOfCentralDirector(reader, totalLength) {
|
|
6463
|
+
const size = Math.min(EOCDR_WITHOUT_COMMENT_SIZE + MAX_COMMENT_SIZE, totalLength);
|
|
6464
|
+
const readStart = totalLength - size;
|
|
6465
|
+
const data = await readAs(reader, readStart, size);
|
|
6466
|
+
for (let i = size - EOCDR_WITHOUT_COMMENT_SIZE; i >= 0; --i) {
|
|
6467
|
+
if (getUint32LE(data, i) !== EOCDR_SIGNATURE) {
|
|
6468
|
+
continue;
|
|
6469
|
+
}
|
|
6470
|
+
|
|
6471
|
+
// 0 - End of central directory signature
|
|
6472
|
+
const eocdr = new Uint8Array(data.buffer, data.byteOffset + i, data.byteLength - i);
|
|
6473
|
+
// 4 - Number of this disk
|
|
6474
|
+
const diskNumber = getUint16LE(eocdr, 4);
|
|
6475
|
+
if (diskNumber !== 0) {
|
|
6476
|
+
throw new Error(`multi-volume zip files are not supported. This is volume: ${diskNumber}`);
|
|
6477
|
+
}
|
|
6478
|
+
|
|
6479
|
+
// 6 - Disk where central directory starts
|
|
6480
|
+
// 8 - Number of central directory records on this disk
|
|
6481
|
+
// 10 - Total number of central directory records
|
|
6482
|
+
const entryCount = getUint16LE(eocdr, 10);
|
|
6483
|
+
// 12 - Size of central directory (bytes)
|
|
6484
|
+
const centralDirectorySize = getUint32LE(eocdr, 12);
|
|
6485
|
+
// 16 - Offset of start of central directory, relative to start of archive
|
|
6486
|
+
const centralDirectoryOffset = getUint32LE(eocdr, 16);
|
|
6487
|
+
// 20 - Comment length
|
|
6488
|
+
const commentLength = getUint16LE(eocdr, 20);
|
|
6489
|
+
const expectedCommentLength = eocdr.length - EOCDR_WITHOUT_COMMENT_SIZE;
|
|
6490
|
+
if (commentLength !== expectedCommentLength) {
|
|
6491
|
+
throw new Error(`invalid comment length. expected: ${expectedCommentLength}, actual: ${commentLength}`);
|
|
6492
|
+
}
|
|
6493
|
+
|
|
6494
|
+
// 22 - Comment
|
|
6495
|
+
// the encoding is always cp437.
|
|
6496
|
+
const commentBytes = new Uint8Array(eocdr.buffer, eocdr.byteOffset + 22, commentLength);
|
|
6497
|
+
const comment = decodeBuffer(commentBytes);
|
|
6498
|
+
|
|
6499
|
+
if (entryCount === 0xffff || centralDirectoryOffset === 0xffffffff) {
|
|
6500
|
+
return await readZip64CentralDirectory(reader, readStart + i, comment, commentBytes);
|
|
5745
6501
|
} else {
|
|
5746
|
-
|
|
6502
|
+
return await readEntries(reader, centralDirectoryOffset, centralDirectorySize, entryCount, comment, commentBytes);
|
|
5747
6503
|
}
|
|
5748
|
-
// Prevent ids from leaking
|
|
5749
|
-
exports.clearImmediate(id);
|
|
5750
6504
|
}
|
|
5751
|
-
});
|
|
5752
6505
|
|
|
5753
|
-
|
|
5754
|
-
}
|
|
6506
|
+
throw new Error('could not find end of central directory. maybe not zip file');
|
|
6507
|
+
}
|
|
5755
6508
|
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
6509
|
+
const END_OF_CENTRAL_DIRECTORY_LOCATOR_SIGNATURE = 0x07064b50;
|
|
6510
|
+
|
|
6511
|
+
async function readZip64CentralDirectory(reader, offset, comment, commentBytes) {
|
|
6512
|
+
// ZIP64 Zip64 end of central directory locator
|
|
6513
|
+
const zip64EocdlOffset = offset - 20;
|
|
6514
|
+
const eocdl = await readAs(reader, zip64EocdlOffset, 20);
|
|
6515
|
+
|
|
6516
|
+
// 0 - zip64 end of central dir locator signature
|
|
6517
|
+
if (getUint32LE(eocdl, 0) !== END_OF_CENTRAL_DIRECTORY_LOCATOR_SIGNATURE) {
|
|
6518
|
+
throw new Error('invalid zip64 end of central directory locator signature');
|
|
6519
|
+
}
|
|
6520
|
+
|
|
6521
|
+
// 4 - number of the disk with the start of the zip64 end of central directory
|
|
6522
|
+
// 8 - relative offset of the zip64 end of central directory record
|
|
6523
|
+
const zip64EocdrOffset = getUint64LE(eocdl, 8);
|
|
6524
|
+
// 16 - total number of disks
|
|
6525
|
+
|
|
6526
|
+
// ZIP64 end of central directory record
|
|
6527
|
+
const zip64Eocdr = await readAs(reader, zip64EocdrOffset, 56);
|
|
6528
|
+
|
|
6529
|
+
// 0 - zip64 end of central dir signature 4 bytes (0x06064b50)
|
|
6530
|
+
if (getUint32LE(zip64Eocdr, 0) !== ZIP64_EOCDR_SIGNATURE) {
|
|
6531
|
+
throw new Error('invalid zip64 end of central directory record signature');
|
|
6532
|
+
}
|
|
6533
|
+
// 4 - size of zip64 end of central directory record 8 bytes
|
|
6534
|
+
// 12 - version made by 2 bytes
|
|
6535
|
+
// 14 - version needed to extract 2 bytes
|
|
6536
|
+
// 16 - number of this disk 4 bytes
|
|
6537
|
+
// 20 - number of the disk with the start of the central directory 4 bytes
|
|
6538
|
+
// 24 - total number of entries in the central directory on this disk 8 bytes
|
|
6539
|
+
// 32 - total number of entries in the central directory 8 bytes
|
|
6540
|
+
const entryCount = getUint64LE(zip64Eocdr, 32);
|
|
6541
|
+
// 40 - size of the central directory 8 bytes
|
|
6542
|
+
const centralDirectorySize = getUint64LE(zip64Eocdr, 40);
|
|
6543
|
+
// 48 - offset of start of central directory with respect to the starting disk number 8 bytes
|
|
6544
|
+
const centralDirectoryOffset = getUint64LE(zip64Eocdr, 48);
|
|
6545
|
+
// 56 - zip64 extensible data sector (variable size)
|
|
6546
|
+
return readEntries(reader, centralDirectoryOffset, centralDirectorySize, entryCount, comment, commentBytes);
|
|
6547
|
+
}
|
|
6548
|
+
|
|
6549
|
+
const CENTRAL_DIRECTORY_FILE_HEADER_SIGNATURE = 0x02014b50;
|
|
6550
|
+
|
|
6551
|
+
async function readEntries(reader, centralDirectoryOffset, centralDirectorySize, rawEntryCount, comment, commentBytes) {
|
|
6552
|
+
let readEntryCursor = 0;
|
|
6553
|
+
const allEntriesBuffer = await readAs(reader, centralDirectoryOffset, centralDirectorySize);
|
|
6554
|
+
const rawEntries = [];
|
|
6555
|
+
|
|
6556
|
+
for (let e = 0; e < rawEntryCount; ++e) {
|
|
6557
|
+
const buffer = allEntriesBuffer.subarray(readEntryCursor, readEntryCursor + 46);
|
|
6558
|
+
// 0 - Central directory file header signature
|
|
6559
|
+
const signature = getUint32LE(buffer, 0);
|
|
6560
|
+
if (signature !== CENTRAL_DIRECTORY_FILE_HEADER_SIGNATURE) {
|
|
6561
|
+
throw new Error(`invalid central directory file header signature: 0x${signature.toString(16)}`);
|
|
6562
|
+
}
|
|
6563
|
+
const rawEntry = {
|
|
6564
|
+
// 4 - Version made by
|
|
6565
|
+
versionMadeBy: getUint16LE(buffer, 4),
|
|
6566
|
+
// 6 - Version needed to extract (minimum)
|
|
6567
|
+
versionNeededToExtract: getUint16LE(buffer, 6),
|
|
6568
|
+
// 8 - General purpose bit flag
|
|
6569
|
+
generalPurposeBitFlag: getUint16LE(buffer, 8),
|
|
6570
|
+
// 10 - Compression method
|
|
6571
|
+
compressionMethod: getUint16LE(buffer, 10),
|
|
6572
|
+
// 12 - File last modification time
|
|
6573
|
+
lastModFileTime: getUint16LE(buffer, 12),
|
|
6574
|
+
// 14 - File last modification date
|
|
6575
|
+
lastModFileDate: getUint16LE(buffer, 14),
|
|
6576
|
+
// 16 - CRC-32
|
|
6577
|
+
crc32: getUint32LE(buffer, 16),
|
|
6578
|
+
// 20 - Compressed size
|
|
6579
|
+
compressedSize: getUint32LE(buffer, 20),
|
|
6580
|
+
// 24 - Uncompressed size
|
|
6581
|
+
uncompressedSize: getUint32LE(buffer, 24),
|
|
6582
|
+
// 28 - File name length (n)
|
|
6583
|
+
fileNameLength: getUint16LE(buffer, 28),
|
|
6584
|
+
// 30 - Extra field length (m)
|
|
6585
|
+
extraFieldLength: getUint16LE(buffer, 30),
|
|
6586
|
+
// 32 - File comment length (k)
|
|
6587
|
+
fileCommentLength: getUint16LE(buffer, 32),
|
|
6588
|
+
// 34 - Disk number where file starts
|
|
6589
|
+
// 36 - Internal file attributes
|
|
6590
|
+
internalFileAttributes: getUint16LE(buffer, 36),
|
|
6591
|
+
// 38 - External file attributes
|
|
6592
|
+
externalFileAttributes: getUint32LE(buffer, 38),
|
|
6593
|
+
// 42 - Relative offset of local file header
|
|
6594
|
+
relativeOffsetOfLocalHeader: getUint32LE(buffer, 42),
|
|
6595
|
+
};
|
|
6596
|
+
|
|
6597
|
+
if (rawEntry.generalPurposeBitFlag & 0x40) {
|
|
6598
|
+
throw new Error('strong encryption is not supported');
|
|
6599
|
+
}
|
|
6600
|
+
|
|
6601
|
+
readEntryCursor += 46;
|
|
6602
|
+
|
|
6603
|
+
const data = allEntriesBuffer.subarray(readEntryCursor, readEntryCursor + rawEntry.fileNameLength + rawEntry.extraFieldLength + rawEntry.fileCommentLength);
|
|
6604
|
+
rawEntry.nameBytes = data.slice(0, rawEntry.fileNameLength);
|
|
6605
|
+
rawEntry.name = decodeBuffer(rawEntry.nameBytes);
|
|
6606
|
+
|
|
6607
|
+
// 46+n - Extra field
|
|
6608
|
+
const fileCommentStart = rawEntry.fileNameLength + rawEntry.extraFieldLength;
|
|
6609
|
+
const extraFieldBuffer = data.slice(rawEntry.fileNameLength, fileCommentStart);
|
|
6610
|
+
rawEntry.extraFields = [];
|
|
6611
|
+
let i = 0;
|
|
6612
|
+
while (i < extraFieldBuffer.length - 3) {
|
|
6613
|
+
const headerId = getUint16LE(extraFieldBuffer, i + 0);
|
|
6614
|
+
const dataSize = getUint16LE(extraFieldBuffer, i + 2);
|
|
6615
|
+
const dataStart = i + 4;
|
|
6616
|
+
const dataEnd = dataStart + dataSize;
|
|
6617
|
+
if (dataEnd > extraFieldBuffer.length) {
|
|
6618
|
+
throw new Error('extra field length exceeds extra field buffer size');
|
|
6619
|
+
}
|
|
6620
|
+
rawEntry.extraFields.push({
|
|
6621
|
+
id: headerId,
|
|
6622
|
+
data: extraFieldBuffer.slice(dataStart, dataEnd),
|
|
6623
|
+
});
|
|
6624
|
+
i = dataEnd;
|
|
6625
|
+
}
|
|
6626
|
+
|
|
6627
|
+
// 46+n+m - File comment
|
|
6628
|
+
rawEntry.commentBytes = data.slice(fileCommentStart, fileCommentStart + rawEntry.fileCommentLength);
|
|
6629
|
+
rawEntry.comment = decodeBuffer(rawEntry.commentBytes);
|
|
6630
|
+
|
|
6631
|
+
readEntryCursor += data.length;
|
|
6632
|
+
|
|
6633
|
+
if (rawEntry.uncompressedSize === 0xffffffff ||
|
|
6634
|
+
rawEntry.compressedSize === 0xffffffff ||
|
|
6635
|
+
rawEntry.relativeOffsetOfLocalHeader === 0xffffffff) {
|
|
6636
|
+
// ZIP64 format
|
|
6637
|
+
// find the Zip64 Extended Information Extra Field
|
|
6638
|
+
const zip64ExtraField = rawEntry.extraFields.find(e => e.id === 0x0001);
|
|
6639
|
+
if (!zip64ExtraField) {
|
|
6640
|
+
throw new Error('expected zip64 extended information extra field');
|
|
6641
|
+
}
|
|
6642
|
+
const zip64EiefBuffer = zip64ExtraField.data;
|
|
6643
|
+
let index = 0;
|
|
6644
|
+
// 0 - Original Size 8 bytes
|
|
6645
|
+
if (rawEntry.uncompressedSize === 0xffffffff) {
|
|
6646
|
+
if (index + 8 > zip64EiefBuffer.length) {
|
|
6647
|
+
throw new Error('zip64 extended information extra field does not include uncompressed size');
|
|
6648
|
+
}
|
|
6649
|
+
rawEntry.uncompressedSize = getUint64LE(zip64EiefBuffer, index);
|
|
6650
|
+
index += 8;
|
|
6651
|
+
}
|
|
6652
|
+
// 8 - Compressed Size 8 bytes
|
|
6653
|
+
if (rawEntry.compressedSize === 0xffffffff) {
|
|
6654
|
+
if (index + 8 > zip64EiefBuffer.length) {
|
|
6655
|
+
throw new Error('zip64 extended information extra field does not include compressed size');
|
|
6656
|
+
}
|
|
6657
|
+
rawEntry.compressedSize = getUint64LE(zip64EiefBuffer, index);
|
|
6658
|
+
index += 8;
|
|
6659
|
+
}
|
|
6660
|
+
// 16 - Relative Header Offset 8 bytes
|
|
6661
|
+
if (rawEntry.relativeOffsetOfLocalHeader === 0xffffffff) {
|
|
6662
|
+
if (index + 8 > zip64EiefBuffer.length) {
|
|
6663
|
+
throw new Error('zip64 extended information extra field does not include relative header offset');
|
|
6664
|
+
}
|
|
6665
|
+
rawEntry.relativeOffsetOfLocalHeader = getUint64LE(zip64EiefBuffer, index);
|
|
6666
|
+
index += 8;
|
|
6667
|
+
}
|
|
6668
|
+
// 24 - Disk Start Number 4 bytes
|
|
6669
|
+
}
|
|
6670
|
+
|
|
6671
|
+
// check for Info-ZIP Unicode Path Extra Field (0x7075)
|
|
6672
|
+
// see https://github.com/thejoshwolfe/yauzl/issues/33
|
|
6673
|
+
const nameField = rawEntry.extraFields.find(e =>
|
|
6674
|
+
e.id === 0x7075 &&
|
|
6675
|
+
e.data.length >= 6 && // too short to be meaningful
|
|
6676
|
+
e.data[0] === 1 && // Version 1 byte version of this extra field, currently 1
|
|
6677
|
+
getUint32LE(e.data, 1), crc$1.unsigned(rawEntry.nameBytes)); // NameCRC32 4 bytes File Name Field CRC32 Checksum
|
|
6678
|
+
// > If the CRC check fails, this UTF-8 Path Extra Field should be
|
|
6679
|
+
// > ignored and the File Name field in the header should be used instead.
|
|
6680
|
+
if (nameField) {
|
|
6681
|
+
// UnicodeName Variable UTF-8 version of the entry File Name
|
|
6682
|
+
rawEntry.fileName = decodeBuffer(nameField.data.slice(5));
|
|
6683
|
+
}
|
|
6684
|
+
|
|
6685
|
+
// validate file size
|
|
6686
|
+
if (rawEntry.compressionMethod === 0) {
|
|
6687
|
+
let expectedCompressedSize = rawEntry.uncompressedSize;
|
|
6688
|
+
if ((rawEntry.generalPurposeBitFlag & 0x1) !== 0) {
|
|
6689
|
+
// traditional encryption prefixes the file data with a header
|
|
6690
|
+
expectedCompressedSize += 12;
|
|
6691
|
+
}
|
|
6692
|
+
if (rawEntry.compressedSize !== expectedCompressedSize) {
|
|
6693
|
+
throw new Error(`compressed size mismatch for stored file: ${rawEntry.compressedSize} != ${expectedCompressedSize}`);
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
rawEntries.push(rawEntry);
|
|
6697
|
+
}
|
|
6698
|
+
const zip = {
|
|
6699
|
+
comment,
|
|
6700
|
+
commentBytes,
|
|
6701
|
+
};
|
|
6702
|
+
return {
|
|
6703
|
+
zip,
|
|
6704
|
+
entries: rawEntries.map(e => new ZipEntry(reader, e)),
|
|
6705
|
+
};
|
|
6706
|
+
}
|
|
6707
|
+
|
|
6708
|
+
async function readEntryDataHeader(reader, rawEntry) {
|
|
6709
|
+
if (rawEntry.generalPurposeBitFlag & 0x1) {
|
|
6710
|
+
throw new Error('encrypted entries not supported');
|
|
6711
|
+
}
|
|
6712
|
+
const buffer = await readAs(reader, rawEntry.relativeOffsetOfLocalHeader, 30);
|
|
6713
|
+
// note: maybe this should be passed in or cached on entry
|
|
6714
|
+
// as it's async so there will be at least one tick (not sure about that)
|
|
6715
|
+
const totalLength = await reader.getLength();
|
|
6716
|
+
|
|
6717
|
+
// 0 - Local file header signature = 0x04034b50
|
|
6718
|
+
const signature = getUint32LE(buffer, 0);
|
|
6719
|
+
if (signature !== 0x04034b50) {
|
|
6720
|
+
throw new Error(`invalid local file header signature: 0x${signature.toString(16)}`);
|
|
6721
|
+
}
|
|
6722
|
+
|
|
6723
|
+
// all this should be redundant
|
|
6724
|
+
// 4 - Version needed to extract (minimum)
|
|
6725
|
+
// 6 - General purpose bit flag
|
|
6726
|
+
// 8 - Compression method
|
|
6727
|
+
// 10 - File last modification time
|
|
6728
|
+
// 12 - File last modification date
|
|
6729
|
+
// 14 - CRC-32
|
|
6730
|
+
// 18 - Compressed size
|
|
6731
|
+
// 22 - Uncompressed size
|
|
6732
|
+
// 26 - File name length (n)
|
|
6733
|
+
const fileNameLength = getUint16LE(buffer, 26);
|
|
6734
|
+
// 28 - Extra field length (m)
|
|
6735
|
+
const extraFieldLength = getUint16LE(buffer, 28);
|
|
6736
|
+
// 30 - File name
|
|
6737
|
+
// 30+n - Extra field
|
|
6738
|
+
const localFileHeaderEnd = rawEntry.relativeOffsetOfLocalHeader + buffer.length + fileNameLength + extraFieldLength;
|
|
6739
|
+
let decompress;
|
|
6740
|
+
if (rawEntry.compressionMethod === 0) {
|
|
6741
|
+
// 0 - The file is stored (no compression)
|
|
6742
|
+
decompress = false;
|
|
6743
|
+
} else if (rawEntry.compressionMethod === 8) {
|
|
6744
|
+
// 8 - The file is Deflated
|
|
6745
|
+
decompress = true;
|
|
6746
|
+
} else {
|
|
6747
|
+
throw new Error(`unsupported compression method: ${rawEntry.compressionMethod}`);
|
|
6748
|
+
}
|
|
6749
|
+
const fileDataStart = localFileHeaderEnd;
|
|
6750
|
+
const fileDataEnd = fileDataStart + rawEntry.compressedSize;
|
|
6751
|
+
if (rawEntry.compressedSize !== 0) {
|
|
6752
|
+
// bounds check now, because the read streams will probably not complain loud enough.
|
|
6753
|
+
// since we're dealing with an unsigned offset plus an unsigned size,
|
|
6754
|
+
// we only have 1 thing to check for.
|
|
6755
|
+
if (fileDataEnd > totalLength) {
|
|
6756
|
+
throw new Error(`file data overflows file bounds: ${fileDataStart} + ${rawEntry.compressedSize} > ${totalLength}`);
|
|
6757
|
+
}
|
|
6758
|
+
}
|
|
6759
|
+
return {
|
|
6760
|
+
decompress,
|
|
6761
|
+
fileDataStart,
|
|
6762
|
+
};
|
|
6763
|
+
}
|
|
6764
|
+
|
|
6765
|
+
async function readEntryDataAsArrayBuffer(reader, rawEntry) {
|
|
6766
|
+
const {decompress, fileDataStart} = await readEntryDataHeader(reader, rawEntry);
|
|
6767
|
+
if (!decompress) {
|
|
6768
|
+
const dataView = await readAs(reader, fileDataStart, rawEntry.compressedSize);
|
|
6769
|
+
// make copy?
|
|
6770
|
+
//
|
|
6771
|
+
// 1. The source is a Blob/file. In this case we'll get back TypedArray we can just hand to the user
|
|
6772
|
+
// 2. The source is a TypedArray. In this case we'll get back TypedArray that is a view into a larger buffer
|
|
6773
|
+
// but because ultimately this is used to return an ArrayBuffer to `someEntry.arrayBuffer()`
|
|
6774
|
+
// we need to return copy since we need the `ArrayBuffer`, not the TypedArray to exactly match the data.
|
|
6775
|
+
// Note: We could add another API function `bytes()` or something that returned a `Uint8Array`
|
|
6776
|
+
// instead of an `ArrayBuffer`. This would let us skip a copy here. But this case only happens for uncompressed
|
|
6777
|
+
// data. That seems like a rare enough case that adding a new API is not worth it? Or is it? A zip of jpegs or mp3s
|
|
6778
|
+
// might not be compressed. For now that's a TBD.
|
|
6779
|
+
return isTypedArraySameAsArrayBuffer(dataView) ? dataView.buffer : dataView.slice().buffer;
|
|
6780
|
+
}
|
|
6781
|
+
// see comment in readEntryDateAsBlob
|
|
6782
|
+
const typedArrayOrBlob = await readAsBlobOrTypedArray(reader, fileDataStart, rawEntry.compressedSize);
|
|
6783
|
+
const result = await inflateRawAsync(typedArrayOrBlob, rawEntry.uncompressedSize);
|
|
6784
|
+
return result;
|
|
6785
|
+
}
|
|
6786
|
+
|
|
6787
|
+
async function readEntryDataAsBlob(reader, rawEntry, type) {
|
|
6788
|
+
const {decompress, fileDataStart} = await readEntryDataHeader(reader, rawEntry);
|
|
6789
|
+
if (!decompress) {
|
|
6790
|
+
const typedArrayOrBlob = await readAsBlobOrTypedArray(reader, fileDataStart, rawEntry.compressedSize, type);
|
|
6791
|
+
if (isBlob(typedArrayOrBlob)) {
|
|
6792
|
+
return typedArrayOrBlob;
|
|
6793
|
+
}
|
|
6794
|
+
return new Blob([isSharedArrayBuffer(typedArrayOrBlob.buffer) ? new Uint8Array(typedArrayOrBlob) : typedArrayOrBlob], {type});
|
|
6795
|
+
}
|
|
6796
|
+
// Here's the issue with this mess (should refactor?)
|
|
6797
|
+
// if the source is a blob then we really want to pass a blob to inflateRawAsync to avoid a large
|
|
6798
|
+
// copy if we're going to a worker.
|
|
6799
|
+
const typedArrayOrBlob = await readAsBlobOrTypedArray(reader, fileDataStart, rawEntry.compressedSize);
|
|
6800
|
+
const result = await inflateRawAsync(typedArrayOrBlob, rawEntry.uncompressedSize, type);
|
|
6801
|
+
return result;
|
|
6802
|
+
}
|
|
6803
|
+
|
|
6804
|
+
function setOptions$1(options) {
|
|
6805
|
+
setOptions(options);
|
|
6806
|
+
}
|
|
6807
|
+
|
|
6808
|
+
async function unzipRaw(source) {
|
|
6809
|
+
let reader;
|
|
6810
|
+
if (typeof Blob !== 'undefined' && source instanceof Blob) {
|
|
6811
|
+
reader = new BlobReader(source);
|
|
6812
|
+
} else if (source instanceof ArrayBuffer || (source && source.buffer && source.buffer instanceof ArrayBuffer)) {
|
|
6813
|
+
reader = new ArrayBufferReader(source);
|
|
6814
|
+
} else if (isSharedArrayBuffer(source) || isSharedArrayBuffer(source.buffer)) {
|
|
6815
|
+
reader = new ArrayBufferReader(source);
|
|
6816
|
+
} else if (typeof source === 'string') {
|
|
6817
|
+
const req = await fetch(source);
|
|
6818
|
+
if (!req.ok) {
|
|
6819
|
+
throw new Error(`failed http request ${source}, status: ${req.status}: ${req.statusText}`);
|
|
6820
|
+
}
|
|
6821
|
+
const blob = await req.blob();
|
|
6822
|
+
reader = new BlobReader(blob);
|
|
6823
|
+
} else if (typeof source.getLength === 'function' && typeof source.read === 'function') {
|
|
6824
|
+
reader = source;
|
|
6825
|
+
} else {
|
|
6826
|
+
throw new Error('unsupported source type');
|
|
6827
|
+
}
|
|
6828
|
+
|
|
6829
|
+
const totalLength = await reader.getLength();
|
|
6830
|
+
|
|
6831
|
+
if (totalLength > Number.MAX_SAFE_INTEGER) {
|
|
6832
|
+
throw new Error(`file too large. size: ${totalLength}. Only file sizes up 4503599627370496 bytes are supported`);
|
|
6833
|
+
}
|
|
6834
|
+
|
|
6835
|
+
return await findEndOfCentralDirector(reader, totalLength);
|
|
6836
|
+
}
|
|
6837
|
+
|
|
6838
|
+
// If the names are not utf8 you should use unzipitRaw
|
|
6839
|
+
async function unzip(source) {
|
|
6840
|
+
const {zip, entries} = await unzipRaw(source);
|
|
6841
|
+
return {
|
|
6842
|
+
zip,
|
|
6843
|
+
entries: Object.fromEntries(entries.map(v => [v.name, v])),
|
|
6844
|
+
};
|
|
6845
|
+
}
|
|
6846
|
+
|
|
6847
|
+
function cleanup$1() {
|
|
6848
|
+
cleanup();
|
|
6849
|
+
}
|
|
6850
|
+
|
|
6851
|
+
exports.HTTPRangeReader = HTTPRangeReader;
|
|
6852
|
+
exports.cleanup = cleanup$1;
|
|
6853
|
+
exports.setOptions = setOptions$1;
|
|
6854
|
+
exports.unzip = unzip;
|
|
6855
|
+
exports.unzipRaw = unzipRaw;
|
|
6856
|
+
|
|
6857
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6858
|
+
|
|
6859
|
+
})));
|
|
6860
|
+
|
|
6861
|
+
}).call(this)}).call(this,require('_process'))
|
|
6862
|
+
},{"_process":36}],42:[function(require,module,exports){
|
|
5761
6863
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
5762
6864
|
//
|
|
5763
6865
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -6491,7 +7593,7 @@ Url.prototype.parseHost = function() {
|
|
|
6491
7593
|
if (host) this.hostname = host;
|
|
6492
7594
|
};
|
|
6493
7595
|
|
|
6494
|
-
},{"./util":
|
|
7596
|
+
},{"./util":43,"punycode":37,"querystring":40}],43:[function(require,module,exports){
|
|
6495
7597
|
'use strict';
|
|
6496
7598
|
|
|
6497
7599
|
module.exports = {
|
|
@@ -6509,7 +7611,7 @@ module.exports = {
|
|
|
6509
7611
|
}
|
|
6510
7612
|
};
|
|
6511
7613
|
|
|
6512
|
-
},{}],
|
|
7614
|
+
},{}],44:[function(require,module,exports){
|
|
6513
7615
|
"use strict";
|
|
6514
7616
|
|
|
6515
7617
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6589,7 +7691,7 @@ var _stringify = _interopRequireDefault(require("./stringify.js"));
|
|
|
6589
7691
|
var _parse = _interopRequireDefault(require("./parse.js"));
|
|
6590
7692
|
|
|
6591
7693
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6592
|
-
},{"./nil.js":
|
|
7694
|
+
},{"./nil.js":47,"./parse.js":48,"./stringify.js":52,"./v1.js":53,"./v3.js":54,"./v4.js":56,"./v5.js":57,"./validate.js":58,"./version.js":59}],45:[function(require,module,exports){
|
|
6593
7695
|
"use strict";
|
|
6594
7696
|
|
|
6595
7697
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6813,7 +7915,7 @@ function md5ii(a, b, c, d, x, s, t) {
|
|
|
6813
7915
|
|
|
6814
7916
|
var _default = md5;
|
|
6815
7917
|
exports.default = _default;
|
|
6816
|
-
},{}],
|
|
7918
|
+
},{}],46:[function(require,module,exports){
|
|
6817
7919
|
"use strict";
|
|
6818
7920
|
|
|
6819
7921
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6825,7 +7927,7 @@ var _default = {
|
|
|
6825
7927
|
randomUUID
|
|
6826
7928
|
};
|
|
6827
7929
|
exports.default = _default;
|
|
6828
|
-
},{}],
|
|
7930
|
+
},{}],47:[function(require,module,exports){
|
|
6829
7931
|
"use strict";
|
|
6830
7932
|
|
|
6831
7933
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6834,7 +7936,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6834
7936
|
exports.default = void 0;
|
|
6835
7937
|
var _default = '00000000-0000-0000-0000-000000000000';
|
|
6836
7938
|
exports.default = _default;
|
|
6837
|
-
},{}],
|
|
7939
|
+
},{}],48:[function(require,module,exports){
|
|
6838
7940
|
"use strict";
|
|
6839
7941
|
|
|
6840
7942
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6880,7 +7982,7 @@ function parse(uuid) {
|
|
|
6880
7982
|
|
|
6881
7983
|
var _default = parse;
|
|
6882
7984
|
exports.default = _default;
|
|
6883
|
-
},{"./validate.js":
|
|
7985
|
+
},{"./validate.js":58}],49:[function(require,module,exports){
|
|
6884
7986
|
"use strict";
|
|
6885
7987
|
|
|
6886
7988
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6889,7 +7991,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6889
7991
|
exports.default = void 0;
|
|
6890
7992
|
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
6891
7993
|
exports.default = _default;
|
|
6892
|
-
},{}],
|
|
7994
|
+
},{}],50:[function(require,module,exports){
|
|
6893
7995
|
"use strict";
|
|
6894
7996
|
|
|
6895
7997
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6915,7 +8017,7 @@ function rng() {
|
|
|
6915
8017
|
|
|
6916
8018
|
return getRandomValues(rnds8);
|
|
6917
8019
|
}
|
|
6918
|
-
},{}],
|
|
8020
|
+
},{}],51:[function(require,module,exports){
|
|
6919
8021
|
"use strict";
|
|
6920
8022
|
|
|
6921
8023
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7020,7 +8122,7 @@ function sha1(bytes) {
|
|
|
7020
8122
|
|
|
7021
8123
|
var _default = sha1;
|
|
7022
8124
|
exports.default = _default;
|
|
7023
|
-
},{}],
|
|
8125
|
+
},{}],52:[function(require,module,exports){
|
|
7024
8126
|
"use strict";
|
|
7025
8127
|
|
|
7026
8128
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7065,7 +8167,7 @@ function stringify(arr, offset = 0) {
|
|
|
7065
8167
|
|
|
7066
8168
|
var _default = stringify;
|
|
7067
8169
|
exports.default = _default;
|
|
7068
|
-
},{"./validate.js":
|
|
8170
|
+
},{"./validate.js":58}],53:[function(require,module,exports){
|
|
7069
8171
|
"use strict";
|
|
7070
8172
|
|
|
7071
8173
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7173,7 +8275,7 @@ function v1(options, buf, offset) {
|
|
|
7173
8275
|
|
|
7174
8276
|
var _default = v1;
|
|
7175
8277
|
exports.default = _default;
|
|
7176
|
-
},{"./rng.js":
|
|
8278
|
+
},{"./rng.js":50,"./stringify.js":52}],54:[function(require,module,exports){
|
|
7177
8279
|
"use strict";
|
|
7178
8280
|
|
|
7179
8281
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7190,7 +8292,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
7190
8292
|
const v3 = (0, _v.default)('v3', 0x30, _md.default);
|
|
7191
8293
|
var _default = v3;
|
|
7192
8294
|
exports.default = _default;
|
|
7193
|
-
},{"./md5.js":
|
|
8295
|
+
},{"./md5.js":45,"./v35.js":55}],55:[function(require,module,exports){
|
|
7194
8296
|
"use strict";
|
|
7195
8297
|
|
|
7196
8298
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7271,7 +8373,7 @@ function v35(name, version, hashfunc) {
|
|
|
7271
8373
|
generateUUID.URL = URL;
|
|
7272
8374
|
return generateUUID;
|
|
7273
8375
|
}
|
|
7274
|
-
},{"./parse.js":
|
|
8376
|
+
},{"./parse.js":48,"./stringify.js":52}],56:[function(require,module,exports){
|
|
7275
8377
|
"use strict";
|
|
7276
8378
|
|
|
7277
8379
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7315,7 +8417,7 @@ function v4(options, buf, offset) {
|
|
|
7315
8417
|
|
|
7316
8418
|
var _default = v4;
|
|
7317
8419
|
exports.default = _default;
|
|
7318
|
-
},{"./native.js":
|
|
8420
|
+
},{"./native.js":46,"./rng.js":50,"./stringify.js":52}],57:[function(require,module,exports){
|
|
7319
8421
|
"use strict";
|
|
7320
8422
|
|
|
7321
8423
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7332,7 +8434,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
7332
8434
|
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
|
7333
8435
|
var _default = v5;
|
|
7334
8436
|
exports.default = _default;
|
|
7335
|
-
},{"./sha1.js":
|
|
8437
|
+
},{"./sha1.js":51,"./v35.js":55}],58:[function(require,module,exports){
|
|
7336
8438
|
"use strict";
|
|
7337
8439
|
|
|
7338
8440
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7350,7 +8452,7 @@ function validate(uuid) {
|
|
|
7350
8452
|
|
|
7351
8453
|
var _default = validate;
|
|
7352
8454
|
exports.default = _default;
|
|
7353
|
-
},{"./regex.js":
|
|
8455
|
+
},{"./regex.js":49}],59:[function(require,module,exports){
|
|
7354
8456
|
"use strict";
|
|
7355
8457
|
|
|
7356
8458
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7372,7 +8474,7 @@ function version(uuid) {
|
|
|
7372
8474
|
|
|
7373
8475
|
var _default = version;
|
|
7374
8476
|
exports.default = _default;
|
|
7375
|
-
},{"./validate.js":
|
|
8477
|
+
},{"./validate.js":58}],60:[function(require,module,exports){
|
|
7376
8478
|
"use strict";
|
|
7377
8479
|
|
|
7378
8480
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -7399,13 +8501,13 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7399
8501
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7400
8502
|
(0, _classCallCheck2["default"])(this, Spark);
|
|
7401
8503
|
/**
|
|
7402
|
-
|
|
7403
|
-
|
|
8504
|
+
* @private
|
|
8505
|
+
*/
|
|
7404
8506
|
this._registry = undefined;
|
|
7405
8507
|
|
|
7406
8508
|
/**
|
|
7407
|
-
|
|
7408
|
-
|
|
8509
|
+
* @private
|
|
8510
|
+
*/
|
|
7409
8511
|
if (options !== null && options !== void 0 && options.log) {
|
|
7410
8512
|
this.logger = options.log;
|
|
7411
8513
|
}
|
|
@@ -7442,8 +8544,8 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7442
8544
|
this.priority = ["model", "onlineEndpoint"];
|
|
7443
8545
|
|
|
7444
8546
|
/**
|
|
7445
|
-
|
|
7446
|
-
|
|
8547
|
+
* @private
|
|
8548
|
+
*/
|
|
7447
8549
|
this.model = this._models((_this$config6 = this.config) === null || _this$config6 === void 0 ? void 0 : _this$config6.nodeGenModels);
|
|
7448
8550
|
}
|
|
7449
8551
|
(0, _createClass2["default"])(Spark, [{
|
|
@@ -7462,7 +8564,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7462
8564
|
value: function _models(nodegen) {
|
|
7463
8565
|
this.log({
|
|
7464
8566
|
eventType: "spark._models",
|
|
7465
|
-
msg:
|
|
8567
|
+
msg: "Parse models"
|
|
7466
8568
|
});
|
|
7467
8569
|
var models = [];
|
|
7468
8570
|
for (var i = 0; i < nodegen.length; i++) {
|
|
@@ -7492,7 +8594,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7492
8594
|
value: function validateConfig(config) {
|
|
7493
8595
|
var start = Date.now();
|
|
7494
8596
|
this.log({
|
|
7495
|
-
eventType:
|
|
8597
|
+
eventType: "spark.validateconfig.start"
|
|
7496
8598
|
});
|
|
7497
8599
|
var _validate = validate(config),
|
|
7498
8600
|
value = _validate.value,
|
|
@@ -7500,7 +8602,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7500
8602
|
if (!error) {
|
|
7501
8603
|
var end = Date.now();
|
|
7502
8604
|
this.log({
|
|
7503
|
-
eventType:
|
|
8605
|
+
eventType: "spark.validateconfig.startend",
|
|
7504
8606
|
duration: end - start
|
|
7505
8607
|
});
|
|
7506
8608
|
return value;
|
|
@@ -7508,7 +8610,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7508
8610
|
var message = JSON.stringify(error.details);
|
|
7509
8611
|
var _end = Date.now();
|
|
7510
8612
|
this.log({
|
|
7511
|
-
eventType:
|
|
8613
|
+
eventType: "spark.validateconfig.startend.error",
|
|
7512
8614
|
duration: _end - start
|
|
7513
8615
|
});
|
|
7514
8616
|
throw new Error("ValidationError: ".concat(message));
|
|
@@ -7560,7 +8662,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7560
8662
|
_context.next = 2;
|
|
7561
8663
|
break;
|
|
7562
8664
|
}
|
|
7563
|
-
throw new WasmRunnerErrors.BadRequestError(
|
|
8665
|
+
throw new WasmRunnerErrors.BadRequestError("Spark initialize is required. Please call initialize method");
|
|
7564
8666
|
case 2:
|
|
7565
8667
|
versionID = version_id || (input === null || input === void 0 ? void 0 : (_input$request_meta = input.request_meta) === null || _input$request_meta === void 0 ? void 0 : _input$request_meta.version_id) || (input === null || input === void 0 ? void 0 : (_input$request_meta2 = input.request_meta) === null || _input$request_meta2 === void 0 ? void 0 : _input$request_meta2.version_uuid);
|
|
7566
8668
|
lookup = {
|
|
@@ -7598,11 +8700,12 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7598
8700
|
value: function () {
|
|
7599
8701
|
var _offlineModel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(input, versionID) {
|
|
7600
8702
|
var _this = this;
|
|
7601
|
-
var model, modelVersionId, callback, _model2$metaData$Engi, _model2$metaData, _model2$metaData$Engi2, _model2$metaData$Engi3, _model2$metaData2, _model2$metaData2$Eng, _model2, result;
|
|
8703
|
+
var model, modelVersionId, callback, _model2$metaData$Engi, _model2$metaData, _model2$metaData$Engi2, _model2$metaData$Engi3, _model2$metaData2, _model2$metaData2$Eng, _model2, retry, MAX_RETRY, error, duration, result, _model$metaData$Engin6, _model$metaData5, _model$metaData5$Engi, _model$metaData$Engin7, _model$metaData6, _model$metaData6$Engi, start;
|
|
7602
8704
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
7603
8705
|
while (1) {
|
|
7604
8706
|
switch (_context3.prev = _context3.next) {
|
|
7605
8707
|
case 0:
|
|
8708
|
+
_context3.prev = 0;
|
|
7606
8709
|
model = findModel(input.request_meta, this.model);
|
|
7607
8710
|
modelVersionId = versionID || model && (model === null || model === void 0 ? void 0 : model.versionId);
|
|
7608
8711
|
if (!(input !== null && input !== void 0 && input.request_meta)) {
|
|
@@ -7611,7 +8714,6 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7611
8714
|
if (versionID) {
|
|
7612
8715
|
input.request_meta.version_id = modelVersionId;
|
|
7613
8716
|
}
|
|
7614
|
-
_context3.prev = 4;
|
|
7615
8717
|
if (this._registry === undefined) {
|
|
7616
8718
|
/**
|
|
7617
8719
|
* Options is the request data the the runner dispatch
|
|
@@ -7670,7 +8772,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7670
8772
|
return _ref2.apply(this, arguments);
|
|
7671
8773
|
};
|
|
7672
8774
|
}();
|
|
7673
|
-
this._registry = new WasmRunner(
|
|
8775
|
+
this._registry = new WasmRunner(undefined, callback, "");
|
|
7674
8776
|
}
|
|
7675
8777
|
if (this._registry.isExist(modelVersionId)) {
|
|
7676
8778
|
_context3.next = 10;
|
|
@@ -7687,21 +8789,63 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7687
8789
|
}
|
|
7688
8790
|
});
|
|
7689
8791
|
case 10:
|
|
7690
|
-
|
|
8792
|
+
retry = 0;
|
|
8793
|
+
MAX_RETRY = 3;
|
|
8794
|
+
error = true;
|
|
8795
|
+
duration = 0;
|
|
8796
|
+
case 14:
|
|
8797
|
+
if (!(error && retry <= MAX_RETRY)) {
|
|
8798
|
+
_context3.next = 33;
|
|
8799
|
+
break;
|
|
8800
|
+
}
|
|
8801
|
+
_context3.next = 17;
|
|
7691
8802
|
return this._registry.execute(input, modelVersionId, function () {});
|
|
7692
|
-
case
|
|
8803
|
+
case 17:
|
|
7693
8804
|
result = _context3.sent;
|
|
8805
|
+
if (!result.executeError) {
|
|
8806
|
+
_context3.next = 28;
|
|
8807
|
+
break;
|
|
8808
|
+
}
|
|
8809
|
+
retry++;
|
|
8810
|
+
start = Date.now();
|
|
8811
|
+
console.log("Retry Execute");
|
|
8812
|
+
// this.log({ eventType: "spark.execute", msg: 'Retry Execute' });
|
|
8813
|
+
this._registry.remove(modelVersionId);
|
|
8814
|
+
_context3.next = 25;
|
|
8815
|
+
return this._registry.append({
|
|
8816
|
+
id: modelVersionId,
|
|
8817
|
+
url: model.binary,
|
|
8818
|
+
meta: {
|
|
8819
|
+
folder_name: (_model$metaData$Engin6 = model === null || model === void 0 ? void 0 : (_model$metaData5 = model.metaData) === null || _model$metaData5 === void 0 ? void 0 : (_model$metaData5$Engi = _model$metaData5.EngineInformation) === null || _model$metaData5$Engi === void 0 ? void 0 : _model$metaData5$Engi.ProductName) !== null && _model$metaData$Engin6 !== void 0 ? _model$metaData$Engin6 : "",
|
|
8820
|
+
service_name: (_model$metaData$Engin7 = model === null || model === void 0 ? void 0 : (_model$metaData6 = model.metaData) === null || _model$metaData6 === void 0 ? void 0 : (_model$metaData6$Engi = _model$metaData6.EngineInformation) === null || _model$metaData6$Engi === void 0 ? void 0 : _model$metaData6$Engi.ServiceName) !== null && _model$metaData$Engin7 !== void 0 ? _model$metaData$Engin7 : ""
|
|
8821
|
+
}
|
|
8822
|
+
});
|
|
8823
|
+
case 25:
|
|
8824
|
+
duration = duration + (Date.now() - start);
|
|
8825
|
+
_context3.next = 31;
|
|
8826
|
+
break;
|
|
8827
|
+
case 28:
|
|
8828
|
+
error = false;
|
|
8829
|
+
if (retry > 0 && result.response_meta && result.response_meta.process_time !== undefined) {
|
|
8830
|
+
result.response_meta.process_time = result.response_meta.process_time + duration;
|
|
8831
|
+
}
|
|
7694
8832
|
return _context3.abrupt("return", result);
|
|
7695
|
-
case
|
|
7696
|
-
_context3.
|
|
7697
|
-
|
|
8833
|
+
case 31:
|
|
8834
|
+
_context3.next = 14;
|
|
8835
|
+
break;
|
|
8836
|
+
case 33:
|
|
8837
|
+
_context3.next = 38;
|
|
8838
|
+
break;
|
|
8839
|
+
case 35:
|
|
8840
|
+
_context3.prev = 35;
|
|
8841
|
+
_context3.t0 = _context3["catch"](0);
|
|
7698
8842
|
return _context3.abrupt("return", _context3.t0);
|
|
7699
|
-
case
|
|
8843
|
+
case 38:
|
|
7700
8844
|
case "end":
|
|
7701
8845
|
return _context3.stop();
|
|
7702
8846
|
}
|
|
7703
8847
|
}
|
|
7704
|
-
}, _callee3, this, [[
|
|
8848
|
+
}, _callee3, this, [[0, 35]]);
|
|
7705
8849
|
}));
|
|
7706
8850
|
function offlineModel(_x3, _x4) {
|
|
7707
8851
|
return _offlineModel.apply(this, arguments);
|
|
@@ -7712,7 +8856,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7712
8856
|
key: "onlineModelEndpoint",
|
|
7713
8857
|
value: function () {
|
|
7714
8858
|
var _onlineModelEndpoint = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(input, versionID) {
|
|
7715
|
-
var isPublic, token, header, options, modelUrl, response, result;
|
|
8859
|
+
var isPublic, token, service_uri, header, options, folder, service, regex, parts, modelPath, modelUrl, response, result;
|
|
7716
8860
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
7717
8861
|
while (1) {
|
|
7718
8862
|
switch (_context4.prev = _context4.next) {
|
|
@@ -7746,7 +8890,8 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7746
8890
|
}
|
|
7747
8891
|
throw new WasmRunnerErrors.UnauthorizedError();
|
|
7748
8892
|
case 12:
|
|
7749
|
-
|
|
8893
|
+
service_uri = input.request_meta.service_uri;
|
|
8894
|
+
_context4.prev = 13;
|
|
7750
8895
|
header = !isPublic ? utils.getAuthHeaders(token, this.authType, this.tenant) : {};
|
|
7751
8896
|
options = {
|
|
7752
8897
|
method: "POST",
|
|
@@ -7758,26 +8903,35 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7758
8903
|
"content-type": "application/json"
|
|
7759
8904
|
}), header)
|
|
7760
8905
|
};
|
|
7761
|
-
|
|
7762
|
-
|
|
8906
|
+
if (service_uri) {
|
|
8907
|
+
regex = /folders\/(.+)\/services\/(.+)/gi;
|
|
8908
|
+
parts = regex.exec(service_uri);
|
|
8909
|
+
if (parts) {
|
|
8910
|
+
folder = decodeURI(parts[1]);
|
|
8911
|
+
service = decodeURI(parts[2]);
|
|
8912
|
+
}
|
|
8913
|
+
}
|
|
8914
|
+
modelPath = service_uri ? "/".concat(this.tenant, "/api/v3/").concat(!isPublic ? "folders/".concat(folder, "/services/").concat(service, "/execute") : "public/folders/".concat(folder, "/services/").concat(service, "/execute")) : "/".concat(this.tenant, "/api/v3/").concat(!isPublic ? "execute" : "public/execute");
|
|
8915
|
+
modelUrl = new URL(modelPath, this.url);
|
|
8916
|
+
_context4.next = 21;
|
|
7763
8917
|
return fetch(modelUrl, options);
|
|
7764
|
-
case
|
|
8918
|
+
case 21:
|
|
7765
8919
|
response = _context4.sent;
|
|
7766
|
-
_context4.next =
|
|
8920
|
+
_context4.next = 24;
|
|
7767
8921
|
return response.json();
|
|
7768
|
-
case
|
|
8922
|
+
case 24:
|
|
7769
8923
|
result = _context4.sent;
|
|
7770
8924
|
return _context4.abrupt("return", result);
|
|
7771
|
-
case 25:
|
|
7772
|
-
_context4.prev = 25;
|
|
7773
|
-
_context4.t0 = _context4["catch"](12);
|
|
7774
|
-
return _context4.abrupt("return", _context4.t0);
|
|
7775
8925
|
case 28:
|
|
8926
|
+
_context4.prev = 28;
|
|
8927
|
+
_context4.t0 = _context4["catch"](13);
|
|
8928
|
+
throw _context4.t0;
|
|
8929
|
+
case 31:
|
|
7776
8930
|
case "end":
|
|
7777
8931
|
return _context4.stop();
|
|
7778
8932
|
}
|
|
7779
8933
|
}
|
|
7780
|
-
}, _callee4, this, [[
|
|
8934
|
+
}, _callee4, this, [[13, 28]]);
|
|
7781
8935
|
}));
|
|
7782
8936
|
function onlineModelEndpoint(_x6, _x7) {
|
|
7783
8937
|
return _onlineModelEndpoint.apply(this, arguments);
|
|
@@ -7789,7 +8943,7 @@ var Spark = /*#__PURE__*/function () {
|
|
|
7789
8943
|
}();
|
|
7790
8944
|
module.exports = Spark;
|
|
7791
8945
|
|
|
7792
|
-
},{"./error.js":
|
|
8946
|
+
},{"./error.js":61,"./findModels.js":62,"./helpers/utils.js":63,"./models.js":64,"./validate.js":65,"@babel/runtime/helpers/asyncToGenerator":2,"@babel/runtime/helpers/classCallCheck":3,"@babel/runtime/helpers/createClass":5,"@babel/runtime/helpers/defineProperty":6,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/regenerator":19,"@coherentglobal/wasm-runner":20}],61:[function(require,module,exports){
|
|
7793
8947
|
"use strict";
|
|
7794
8948
|
|
|
7795
8949
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -7930,7 +9084,7 @@ module.exports = {
|
|
|
7930
9084
|
BadRequestError: BadRequestError
|
|
7931
9085
|
};
|
|
7932
9086
|
|
|
7933
|
-
},{"@babel/runtime/helpers/classCallCheck":3,"@babel/runtime/helpers/createClass":5,"@babel/runtime/helpers/getPrototypeOf":7,"@babel/runtime/helpers/inherits":8,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/possibleConstructorReturn":12,"@babel/runtime/helpers/wrapNativeSuper":18}],
|
|
9087
|
+
},{"@babel/runtime/helpers/classCallCheck":3,"@babel/runtime/helpers/createClass":5,"@babel/runtime/helpers/getPrototypeOf":7,"@babel/runtime/helpers/inherits":8,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/possibleConstructorReturn":12,"@babel/runtime/helpers/wrapNativeSuper":18}],62:[function(require,module,exports){
|
|
7934
9088
|
"use strict";
|
|
7935
9089
|
|
|
7936
9090
|
var WasmRunnerErrors = require("./error");
|
|
@@ -8074,7 +9228,7 @@ var findModel = function findModel(requestMeta, nodegenModels) {
|
|
|
8074
9228
|
};
|
|
8075
9229
|
module.exports = findModel;
|
|
8076
9230
|
|
|
8077
|
-
},{"./error":
|
|
9231
|
+
},{"./error":61}],63:[function(require,module,exports){
|
|
8078
9232
|
"use strict";
|
|
8079
9233
|
|
|
8080
9234
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -8142,7 +9296,7 @@ module.exports = {
|
|
|
8142
9296
|
getAuthHeaders: getAuthHeaders
|
|
8143
9297
|
};
|
|
8144
9298
|
|
|
8145
|
-
},{"../error.js":
|
|
9299
|
+
},{"../error.js":61,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/typeof":17}],64:[function(require,module,exports){
|
|
8146
9300
|
(function (Buffer,__dirname){(function (){
|
|
8147
9301
|
"use strict";
|
|
8148
9302
|
|
|
@@ -8287,7 +9441,7 @@ var processModels = function processModels(nodegen, index) {
|
|
|
8287
9441
|
module.exports = processModels;
|
|
8288
9442
|
|
|
8289
9443
|
}).call(this)}).call(this,require("buffer").Buffer,"/src")
|
|
8290
|
-
},{"@babel/runtime/helpers/asyncToGenerator":2,"@babel/runtime/helpers/defineProperty":6,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/typeof":17,"@babel/runtime/regenerator":19,"buffer":27,"fs":26,"path":
|
|
9444
|
+
},{"@babel/runtime/helpers/asyncToGenerator":2,"@babel/runtime/helpers/defineProperty":6,"@babel/runtime/helpers/interopRequireDefault":9,"@babel/runtime/helpers/typeof":17,"@babel/runtime/regenerator":19,"buffer":27,"fs":26,"path":35,"uuid":44}],65:[function(require,module,exports){
|
|
8291
9445
|
"use strict";
|
|
8292
9446
|
|
|
8293
9447
|
var Joi = require("joi");
|
|
@@ -8324,5 +9478,5 @@ var validate = function validate(config) {
|
|
|
8324
9478
|
};
|
|
8325
9479
|
module.exports = validate;
|
|
8326
9480
|
|
|
8327
|
-
},{"joi":34}]},{},[
|
|
9481
|
+
},{"joi":34}]},{},[60])(60)
|
|
8328
9482
|
});
|