@loaders.gl/polyfills 4.0.0-alpha.9 → 4.0.0-beta.2

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.
Files changed (67) hide show
  1. package/dist/dist.min.js +10 -1818
  2. package/dist/es5/filesystems/node-filesystem.js +214 -0
  3. package/dist/es5/filesystems/node-filesystem.js.map +1 -0
  4. package/dist/es5/index.browser.js +15 -0
  5. package/dist/es5/index.browser.js.map +1 -0
  6. package/dist/es5/index.js +32 -49
  7. package/dist/es5/index.js.map +1 -1
  8. package/dist/es5/node/fetch/fetch.node.js +2 -3
  9. package/dist/es5/node/fetch/fetch.node.js.map +1 -1
  10. package/dist/es5/node/file/install-file-polyfills.js +1 -4
  11. package/dist/es5/node/file/install-file-polyfills.js.map +1 -1
  12. package/dist/esm/filesystems/node-filesystem.js +56 -0
  13. package/dist/esm/filesystems/node-filesystem.js.map +1 -0
  14. package/dist/esm/index.browser.js +7 -0
  15. package/dist/esm/index.browser.js.map +1 -0
  16. package/dist/esm/index.js +32 -31
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/node/fetch/fetch.node.js +2 -3
  19. package/dist/esm/node/fetch/fetch.node.js.map +1 -1
  20. package/dist/esm/node/file/install-file-polyfills.js +1 -4
  21. package/dist/esm/node/file/install-file-polyfills.js.map +1 -1
  22. package/dist/filesystems/node-filesystem.d.ts +39 -0
  23. package/dist/filesystems/node-filesystem.d.ts.map +1 -0
  24. package/dist/index.browser.d.ts +3 -0
  25. package/dist/index.browser.d.ts.map +1 -0
  26. package/dist/index.d.ts +1 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/node/fetch/fetch.node.d.ts +1 -1
  29. package/dist/node/fetch/fetch.node.d.ts.map +1 -1
  30. package/package.json +6 -66
  31. package/src/filesystems/node-filesystem.ts +87 -0
  32. package/src/index.browser.ts +14 -0
  33. package/src/index.ts +54 -38
  34. package/src/node/fetch/fetch.node.ts +6 -5
  35. package/src/node/file/install-file-polyfills.ts +2 -2
  36. package/dist/bundle.js +0 -5
  37. package/dist/es5/node/fetch/fetch-file.node.js +0 -83
  38. package/dist/es5/node/fetch/fetch-file.node.js.map +0 -1
  39. package/dist/esm/node/fetch/fetch-file.node.js +0 -50
  40. package/dist/esm/node/fetch/fetch-file.node.js.map +0 -1
  41. package/dist/index.js +0 -97
  42. package/dist/lib/encoding-indexes.js +0 -35
  43. package/dist/lib/encoding.js +0 -2779
  44. package/dist/libs/encoding-indexes-asian.js +0 -14
  45. package/dist/node/buffer/btoa.node.js +0 -14
  46. package/dist/node/buffer/to-array-buffer.node.js +0 -12
  47. package/dist/node/fetch/fetch-file.node.d.ts +0 -4
  48. package/dist/node/fetch/fetch-file.node.d.ts.map +0 -1
  49. package/dist/node/fetch/fetch-file.node.js +0 -51
  50. package/dist/node/fetch/fetch.node.js +0 -143
  51. package/dist/node/fetch/headers.node.js +0 -106
  52. package/dist/node/fetch/response.node.js +0 -76
  53. package/dist/node/fetch/utils/decode-data-uri.node.js +0 -65
  54. package/dist/node/fetch/utils/stream-utils.node.js +0 -73
  55. package/dist/node/file/blob-stream-controller.js +0 -63
  56. package/dist/node/file/blob-stream.js +0 -37
  57. package/dist/node/file/blob.js +0 -160
  58. package/dist/node/file/file-reader.js +0 -35
  59. package/dist/node/file/file.js +0 -37
  60. package/dist/node/file/install-file-polyfills.js +0 -27
  61. package/dist/node/file/readable-stream.js +0 -11
  62. package/dist/node/images/encode-image.node.js +0 -41
  63. package/dist/node/images/parse-image.node.js +0 -41
  64. package/dist/promise/all-settled.js +0 -24
  65. package/dist/utils/assert.js +0 -9
  66. package/dist/utils/globals.js +0 -36
  67. package/src/node/fetch/fetch-file.node.ts +0 -51
package/dist/dist.min.js CHANGED
@@ -1,10 +1,5 @@
1
1
  (() => {
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
3
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
4
  var __esm = (fn, res) => function __init() {
10
5
  return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
@@ -17,1599 +12,6 @@
17
12
  for (var name in all)
18
13
  __defProp(target, name, { get: all[name], enumerable: true });
19
14
  };
20
- var __reExport = (target, module, desc) => {
21
- if (module && typeof module === "object" || typeof module === "function") {
22
- for (let key of __getOwnPropNames(module))
23
- if (!__hasOwnProp.call(target, key) && key !== "default")
24
- __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
25
- }
26
- return target;
27
- };
28
- var __toModule = (module) => {
29
- return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
30
- };
31
-
32
- // src/utils/globals.ts
33
- var isBrowser, globals, global_;
34
- var init_globals = __esm({
35
- "src/utils/globals.ts"() {
36
- isBrowser = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
37
- globals = {
38
- self: typeof self !== "undefined" && self,
39
- window: typeof window !== "undefined" && window,
40
- global: typeof global !== "undefined" && global
41
- };
42
- global_ = globals.global || globals.self || globals.window;
43
- }
44
- });
45
-
46
- // src/lib/encoding-indexes.ts
47
- var encoding_indexes_default;
48
- var init_encoding_indexes = __esm({
49
- "src/lib/encoding-indexes.ts"() {
50
- encoding_indexes_default = {
51
- "ibm866": [1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 9617, 9618, 9619, 9474, 9508, 9569, 9570, 9558, 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488, 9492, 9524, 9516, 9500, 9472, 9532, 9566, 9567, 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575, 9576, 9572, 9573, 9561, 9560, 9554, 9555, 9579, 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1025, 1105, 1028, 1108, 1031, 1111, 1038, 1118, 176, 8729, 183, 8730, 8470, 164, 9632, 160],
52
- "iso-8859-2": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 260, 728, 321, 164, 317, 346, 167, 168, 352, 350, 356, 377, 173, 381, 379, 176, 261, 731, 322, 180, 318, 347, 711, 184, 353, 351, 357, 378, 733, 382, 380, 340, 193, 194, 258, 196, 313, 262, 199, 268, 201, 280, 203, 282, 205, 206, 270, 272, 323, 327, 211, 212, 336, 214, 215, 344, 366, 218, 368, 220, 221, 354, 223, 341, 225, 226, 259, 228, 314, 263, 231, 269, 233, 281, 235, 283, 237, 238, 271, 273, 324, 328, 243, 244, 337, 246, 247, 345, 367, 250, 369, 252, 253, 355, 729],
53
- "iso-8859-3": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 294, 728, 163, 164, null, 292, 167, 168, 304, 350, 286, 308, 173, null, 379, 176, 295, 178, 179, 180, 181, 293, 183, 184, 305, 351, 287, 309, 189, null, 380, 192, 193, 194, null, 196, 266, 264, 199, 200, 201, 202, 203, 204, 205, 206, 207, null, 209, 210, 211, 212, 288, 214, 215, 284, 217, 218, 219, 220, 364, 348, 223, 224, 225, 226, null, 228, 267, 265, 231, 232, 233, 234, 235, 236, 237, 238, 239, null, 241, 242, 243, 244, 289, 246, 247, 285, 249, 250, 251, 252, 365, 349, 729],
54
- "iso-8859-4": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 260, 312, 342, 164, 296, 315, 167, 168, 352, 274, 290, 358, 173, 381, 175, 176, 261, 731, 343, 180, 297, 316, 711, 184, 353, 275, 291, 359, 330, 382, 331, 256, 193, 194, 195, 196, 197, 198, 302, 268, 201, 280, 203, 278, 205, 206, 298, 272, 325, 332, 310, 212, 213, 214, 215, 216, 370, 218, 219, 220, 360, 362, 223, 257, 225, 226, 227, 228, 229, 230, 303, 269, 233, 281, 235, 279, 237, 238, 299, 273, 326, 333, 311, 244, 245, 246, 247, 248, 371, 250, 251, 252, 361, 363, 729],
55
- "iso-8859-5": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 173, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 8470, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 167, 1118, 1119],
56
- "iso-8859-6": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, null, null, null, 164, null, null, null, null, null, null, null, 1548, 173, null, null, null, null, null, null, null, null, null, null, null, null, null, 1563, null, null, null, 1567, null, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, null, null, null, null, null, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, null, null, null, null, null, null, null, null, null, null, null, null, null],
57
- "iso-8859-7": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 8216, 8217, 163, 8364, 8367, 166, 167, 168, 169, 890, 171, 172, 173, null, 8213, 176, 177, 178, 179, 900, 901, 902, 183, 904, 905, 906, 187, 908, 189, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, null, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, null],
58
- "iso-8859-8": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, null, 162, 163, 164, 165, 166, 167, 168, 169, 215, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 247, 187, 188, 189, 190, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8215, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, null, null, 8206, 8207, null],
59
- "iso-8859-10": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 260, 274, 290, 298, 296, 310, 167, 315, 272, 352, 358, 381, 173, 362, 330, 176, 261, 275, 291, 299, 297, 311, 183, 316, 273, 353, 359, 382, 8213, 363, 331, 256, 193, 194, 195, 196, 197, 198, 302, 268, 201, 280, 203, 278, 205, 206, 207, 208, 325, 332, 211, 212, 213, 214, 360, 216, 370, 218, 219, 220, 221, 222, 223, 257, 225, 226, 227, 228, 229, 230, 303, 269, 233, 281, 235, 279, 237, 238, 239, 240, 326, 333, 243, 244, 245, 246, 361, 248, 371, 250, 251, 252, 253, 254, 312],
60
- "iso-8859-13": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 8221, 162, 163, 164, 8222, 166, 167, 216, 169, 342, 171, 172, 173, 174, 198, 176, 177, 178, 179, 8220, 181, 182, 183, 248, 185, 343, 187, 188, 189, 190, 230, 260, 302, 256, 262, 196, 197, 280, 274, 268, 201, 377, 278, 290, 310, 298, 315, 352, 323, 325, 211, 332, 213, 214, 215, 370, 321, 346, 362, 220, 379, 381, 223, 261, 303, 257, 263, 228, 229, 281, 275, 269, 233, 378, 279, 291, 311, 299, 316, 353, 324, 326, 243, 333, 245, 246, 247, 371, 322, 347, 363, 252, 380, 382, 8217],
61
- "iso-8859-14": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 7682, 7683, 163, 266, 267, 7690, 167, 7808, 169, 7810, 7691, 7922, 173, 174, 376, 7710, 7711, 288, 289, 7744, 7745, 182, 7766, 7809, 7767, 7811, 7776, 7923, 7812, 7813, 7777, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 372, 209, 210, 211, 212, 213, 214, 7786, 216, 217, 218, 219, 220, 221, 374, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 373, 241, 242, 243, 244, 245, 246, 7787, 248, 249, 250, 251, 252, 253, 375, 255],
62
- "iso-8859-15": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 8364, 165, 352, 167, 353, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 381, 181, 182, 183, 382, 185, 186, 187, 338, 339, 376, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255],
63
- "iso-8859-16": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 260, 261, 321, 8364, 8222, 352, 167, 353, 169, 536, 171, 377, 173, 378, 379, 176, 177, 268, 322, 381, 8221, 182, 183, 382, 269, 537, 187, 338, 339, 376, 380, 192, 193, 194, 258, 196, 262, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 272, 323, 210, 211, 212, 336, 214, 346, 368, 217, 218, 219, 220, 280, 538, 223, 224, 225, 226, 259, 228, 263, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 273, 324, 242, 243, 244, 337, 246, 347, 369, 249, 250, 251, 252, 281, 539, 255],
64
- "koi8-r": [9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 8992, 9632, 8729, 8730, 8776, 8804, 8805, 160, 8993, 176, 178, 183, 247, 9552, 9553, 9554, 1105, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 1025, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 169, 1102, 1072, 1073, 1094, 1076, 1077, 1092, 1075, 1093, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1103, 1088, 1089, 1090, 1091, 1078, 1074, 1100, 1099, 1079, 1096, 1101, 1097, 1095, 1098, 1070, 1040, 1041, 1062, 1044, 1045, 1060, 1043, 1061, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1071, 1056, 1057, 1058, 1059, 1046, 1042, 1068, 1067, 1047, 1064, 1069, 1065, 1063, 1066],
65
- "koi8-u": [9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 8992, 9632, 8729, 8730, 8776, 8804, 8805, 160, 8993, 176, 178, 183, 247, 9552, 9553, 9554, 1105, 1108, 9556, 1110, 1111, 9559, 9560, 9561, 9562, 9563, 1169, 1118, 9566, 9567, 9568, 9569, 1025, 1028, 9571, 1030, 1031, 9574, 9575, 9576, 9577, 9578, 1168, 1038, 169, 1102, 1072, 1073, 1094, 1076, 1077, 1092, 1075, 1093, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1103, 1088, 1089, 1090, 1091, 1078, 1074, 1100, 1099, 1079, 1096, 1101, 1097, 1095, 1098, 1070, 1040, 1041, 1062, 1044, 1045, 1060, 1043, 1061, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1071, 1056, 1057, 1058, 1059, 1046, 1042, 1068, 1067, 1047, 1064, 1069, 1065, 1063, 1066],
66
- "macintosh": [196, 197, 199, 201, 209, 214, 220, 225, 224, 226, 228, 227, 229, 231, 233, 232, 234, 235, 237, 236, 238, 239, 241, 243, 242, 244, 246, 245, 250, 249, 251, 252, 8224, 176, 162, 163, 167, 8226, 182, 223, 174, 169, 8482, 180, 168, 8800, 198, 216, 8734, 177, 8804, 8805, 165, 181, 8706, 8721, 8719, 960, 8747, 170, 186, 937, 230, 248, 191, 161, 172, 8730, 402, 8776, 8710, 171, 187, 8230, 160, 192, 195, 213, 338, 339, 8211, 8212, 8220, 8221, 8216, 8217, 247, 9674, 255, 376, 8260, 8364, 8249, 8250, 64257, 64258, 8225, 183, 8218, 8222, 8240, 194, 202, 193, 203, 200, 205, 206, 207, 204, 211, 212, 63743, 210, 218, 219, 217, 305, 710, 732, 175, 728, 729, 730, 184, 733, 731, 711],
67
- "windows-874": [8364, 129, 130, 131, 132, 8230, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 152, 153, 154, 155, 156, 157, 158, 159, 160, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, null, null, null, null, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, null, null, null, null],
68
- "windows-1250": [8364, 129, 8218, 131, 8222, 8230, 8224, 8225, 136, 8240, 352, 8249, 346, 356, 381, 377, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 152, 8482, 353, 8250, 347, 357, 382, 378, 160, 711, 728, 321, 164, 260, 166, 167, 168, 169, 350, 171, 172, 173, 174, 379, 176, 177, 731, 322, 180, 181, 182, 183, 184, 261, 351, 187, 317, 733, 318, 380, 340, 193, 194, 258, 196, 313, 262, 199, 268, 201, 280, 203, 282, 205, 206, 270, 272, 323, 327, 211, 212, 336, 214, 215, 344, 366, 218, 368, 220, 221, 354, 223, 341, 225, 226, 259, 228, 314, 263, 231, 269, 233, 281, 235, 283, 237, 238, 271, 273, 324, 328, 243, 244, 337, 246, 247, 345, 367, 250, 369, 252, 253, 355, 729],
69
- "windows-1251": [1026, 1027, 8218, 1107, 8222, 8230, 8224, 8225, 8364, 8240, 1033, 8249, 1034, 1036, 1035, 1039, 1106, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 152, 8482, 1113, 8250, 1114, 1116, 1115, 1119, 160, 1038, 1118, 1032, 164, 1168, 166, 167, 1025, 169, 1028, 171, 172, 173, 174, 1031, 176, 177, 1030, 1110, 1169, 181, 182, 183, 1105, 8470, 1108, 187, 1112, 1029, 1109, 1111, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103],
70
- "windows-1252": [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, 8249, 338, 141, 381, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 353, 8250, 339, 157, 382, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255],
71
- "windows-1253": [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 136, 8240, 138, 8249, 140, 141, 142, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 152, 8482, 154, 8250, 156, 157, 158, 159, 160, 901, 902, 163, 164, 165, 166, 167, 168, 169, null, 171, 172, 173, 174, 8213, 176, 177, 178, 179, 900, 181, 182, 183, 904, 905, 906, 187, 908, 189, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, null, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, null],
72
- "windows-1254": [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, 8249, 338, 141, 142, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 353, 8250, 339, 157, 158, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 286, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 304, 350, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 287, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 305, 351, 255],
73
- "windows-1255": [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 138, 8249, 140, 141, 142, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 154, 8250, 156, 157, 158, 159, 160, 161, 162, 163, 8362, 165, 166, 167, 168, 169, 215, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 247, 187, 188, 189, 190, 191, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1520, 1521, 1522, 1523, 1524, null, null, null, null, null, null, null, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, null, null, 8206, 8207, null],
74
- "windows-1256": [8364, 1662, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 1657, 8249, 338, 1670, 1688, 1672, 1711, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 1705, 8482, 1681, 8250, 339, 8204, 8205, 1722, 160, 1548, 162, 163, 164, 165, 166, 167, 168, 169, 1726, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 1563, 187, 188, 189, 190, 1567, 1729, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 215, 1591, 1592, 1593, 1594, 1600, 1601, 1602, 1603, 224, 1604, 226, 1605, 1606, 1607, 1608, 231, 232, 233, 234, 235, 1609, 1610, 238, 239, 1611, 1612, 1613, 1614, 244, 1615, 1616, 247, 1617, 249, 1618, 251, 252, 8206, 8207, 1746],
75
- "windows-1257": [8364, 129, 8218, 131, 8222, 8230, 8224, 8225, 136, 8240, 138, 8249, 140, 168, 711, 184, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 152, 8482, 154, 8250, 156, 175, 731, 159, 160, null, 162, 163, 164, null, 166, 167, 216, 169, 342, 171, 172, 173, 174, 198, 176, 177, 178, 179, 180, 181, 182, 183, 248, 185, 343, 187, 188, 189, 190, 230, 260, 302, 256, 262, 196, 197, 280, 274, 268, 201, 377, 278, 290, 310, 298, 315, 352, 323, 325, 211, 332, 213, 214, 215, 370, 321, 346, 362, 220, 379, 381, 223, 261, 303, 257, 263, 228, 229, 281, 275, 269, 233, 378, 279, 291, 311, 299, 316, 353, 324, 326, 243, 333, 245, 246, 247, 371, 322, 347, 363, 252, 380, 382, 729],
76
- "windows-1258": [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 138, 8249, 338, 141, 142, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 154, 8250, 339, 157, 158, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 258, 196, 197, 198, 199, 200, 201, 202, 203, 768, 205, 206, 207, 272, 209, 777, 211, 212, 416, 214, 215, 216, 217, 218, 219, 220, 431, 771, 223, 224, 225, 226, 259, 228, 229, 230, 231, 232, 233, 234, 235, 769, 237, 238, 239, 273, 241, 803, 243, 244, 417, 246, 247, 248, 249, 250, 251, 252, 432, 8363, 255],
77
- "x-mac-cyrillic": [1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 8224, 176, 1168, 163, 167, 8226, 182, 1030, 174, 169, 8482, 1026, 1106, 8800, 1027, 1107, 8734, 177, 8804, 8805, 1110, 181, 1169, 1032, 1028, 1108, 1031, 1111, 1033, 1113, 1034, 1114, 1112, 1029, 172, 8730, 402, 8776, 8710, 171, 187, 8230, 160, 1035, 1115, 1036, 1116, 1109, 8211, 8212, 8220, 8221, 8216, 8217, 247, 8222, 1038, 1118, 1039, 1119, 8470, 1025, 1105, 1103, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 8364]
78
- };
79
- }
80
- });
81
-
82
- // src/lib/encoding.ts
83
- function inRange(a, min, max) {
84
- return min <= a && a <= max;
85
- }
86
- function includes(array, item) {
87
- return array.indexOf(item) !== -1;
88
- }
89
- function ToDictionary(o) {
90
- if (o === void 0)
91
- return {};
92
- if (o === Object(o))
93
- return o;
94
- throw TypeError("Could not convert argument to dictionary");
95
- }
96
- function stringToCodePoints(string) {
97
- var s = String(string);
98
- var n = s.length;
99
- var i = 0;
100
- var u = [];
101
- while (i < n) {
102
- var c = s.charCodeAt(i);
103
- if (c < 55296 || c > 57343) {
104
- u.push(c);
105
- } else if (56320 <= c && c <= 57343) {
106
- u.push(65533);
107
- } else if (55296 <= c && c <= 56319) {
108
- if (i === n - 1) {
109
- u.push(65533);
110
- } else {
111
- var d = s.charCodeAt(i + 1);
112
- if (56320 <= d && d <= 57343) {
113
- var a = c & 1023;
114
- var b = d & 1023;
115
- u.push(65536 + (a << 10) + b);
116
- i += 1;
117
- } else {
118
- u.push(65533);
119
- }
120
- }
121
- }
122
- i += 1;
123
- }
124
- return u;
125
- }
126
- function codePointsToString(code_points) {
127
- var s = "";
128
- for (var i = 0; i < code_points.length; ++i) {
129
- var cp = code_points[i];
130
- if (cp <= 65535) {
131
- s += String.fromCharCode(cp);
132
- } else {
133
- cp -= 65536;
134
- s += String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320);
135
- }
136
- }
137
- return s;
138
- }
139
- function isASCIIByte(a) {
140
- return 0 <= a && a <= 127;
141
- }
142
- function Stream(tokens) {
143
- this.tokens = [].slice.call(tokens);
144
- this.tokens.reverse();
145
- }
146
- function decoderError(fatal, opt_code_point) {
147
- if (fatal)
148
- throw TypeError("Decoder error");
149
- return opt_code_point || 65533;
150
- }
151
- function encoderError(code_point) {
152
- throw TypeError("The code point " + code_point + " could not be encoded.");
153
- }
154
- function Decoder() {
155
- }
156
- function Encoder() {
157
- }
158
- function getEncoding(label) {
159
- label = String(label).trim().toLowerCase();
160
- if (Object.prototype.hasOwnProperty.call(label_to_encoding, label)) {
161
- return label_to_encoding[label];
162
- }
163
- return null;
164
- }
165
- function indexCodePointFor(pointer, index2) {
166
- if (!index2)
167
- return null;
168
- return index2[pointer] || null;
169
- }
170
- function indexPointerFor(code_point, index2) {
171
- var pointer = index2.indexOf(code_point);
172
- return pointer === -1 ? null : pointer;
173
- }
174
- function index(name) {
175
- if (!("encoding-indexes" in global)) {
176
- throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");
177
- }
178
- return global["encoding-indexes"][name];
179
- }
180
- function indexGB18030RangesCodePointFor(pointer) {
181
- if (pointer > 39419 && pointer < 189e3 || pointer > 1237575)
182
- return null;
183
- if (pointer === 7457)
184
- return 59335;
185
- var offset = 0;
186
- var code_point_offset = 0;
187
- var idx = index("gb18030-ranges");
188
- var i;
189
- for (i = 0; i < idx.length; ++i) {
190
- var entry = idx[i];
191
- if (entry[0] <= pointer) {
192
- offset = entry[0];
193
- code_point_offset = entry[1];
194
- } else {
195
- break;
196
- }
197
- }
198
- return code_point_offset + pointer - offset;
199
- }
200
- function indexGB18030RangesPointerFor(code_point) {
201
- if (code_point === 59335)
202
- return 7457;
203
- var offset = 0;
204
- var pointer_offset = 0;
205
- var idx = index("gb18030-ranges");
206
- var i;
207
- for (i = 0; i < idx.length; ++i) {
208
- var entry = idx[i];
209
- if (entry[1] <= code_point) {
210
- offset = entry[1];
211
- pointer_offset = entry[0];
212
- } else {
213
- break;
214
- }
215
- }
216
- return pointer_offset + code_point - offset;
217
- }
218
- function indexShiftJISPointerFor(code_point) {
219
- shift_jis_index = shift_jis_index || index("jis0208").map(function(code_point2, pointer) {
220
- return inRange(pointer, 8272, 8835) ? null : code_point2;
221
- });
222
- var index_ = shift_jis_index;
223
- return index_.indexOf(code_point);
224
- }
225
- function indexBig5PointerFor(code_point) {
226
- big5_index_no_hkscs = big5_index_no_hkscs || index("big5").map(function(code_point2, pointer) {
227
- return pointer < (161 - 129) * 157 ? null : code_point2;
228
- });
229
- var index_ = big5_index_no_hkscs;
230
- if (code_point === 9552 || code_point === 9566 || code_point === 9569 || code_point === 9578 || code_point === 21313 || code_point === 21317) {
231
- return index_.lastIndexOf(code_point);
232
- }
233
- return indexPointerFor(code_point, index_);
234
- }
235
- function TextDecoder(label, options) {
236
- if (!(this instanceof TextDecoder))
237
- throw TypeError("Called as a function. Did you forget 'new'?");
238
- label = label !== void 0 ? String(label) : DEFAULT_ENCODING;
239
- options = ToDictionary(options);
240
- this._encoding = null;
241
- this._decoder = null;
242
- this._ignoreBOM = false;
243
- this._BOMseen = false;
244
- this._error_mode = "replacement";
245
- this._do_not_flush = false;
246
- var encoding = getEncoding(label);
247
- if (encoding === null || encoding.name === "replacement")
248
- throw RangeError("Unknown encoding: " + label);
249
- if (!decoders[encoding.name]) {
250
- throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");
251
- }
252
- var dec = this;
253
- dec._encoding = encoding;
254
- if (Boolean(options["fatal"]))
255
- dec._error_mode = "fatal";
256
- if (Boolean(options["ignoreBOM"]))
257
- dec._ignoreBOM = true;
258
- if (!Object.defineProperty) {
259
- this.encoding = dec._encoding.name.toLowerCase();
260
- this.fatal = dec._error_mode === "fatal";
261
- this.ignoreBOM = dec._ignoreBOM;
262
- }
263
- return dec;
264
- }
265
- function TextEncoder(label, options) {
266
- if (!(this instanceof TextEncoder))
267
- throw TypeError("Called as a function. Did you forget 'new'?");
268
- options = ToDictionary(options);
269
- this._encoding = null;
270
- this._encoder = null;
271
- this._do_not_flush = false;
272
- this._fatal = Boolean(options["fatal"]) ? "fatal" : "replacement";
273
- var enc = this;
274
- if (Boolean(options["NONSTANDARD_allowLegacyEncoding"])) {
275
- label = label !== void 0 ? String(label) : DEFAULT_ENCODING;
276
- var encoding = getEncoding(label);
277
- if (encoding === null || encoding.name === "replacement")
278
- throw RangeError("Unknown encoding: " + label);
279
- if (!encoders[encoding.name]) {
280
- throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");
281
- }
282
- enc._encoding = encoding;
283
- } else {
284
- enc._encoding = getEncoding("utf-8");
285
- if (label !== void 0 && "console" in global) {
286
- console.warn("TextEncoder constructor called with encoding label, which is ignored.");
287
- }
288
- }
289
- if (!Object.defineProperty)
290
- this.encoding = enc._encoding.name.toLowerCase();
291
- return enc;
292
- }
293
- function UTF8Decoder(options) {
294
- var fatal = options.fatal;
295
- var utf8_code_point = 0, utf8_bytes_seen = 0, utf8_bytes_needed = 0, utf8_lower_boundary = 128, utf8_upper_boundary = 191;
296
- this.handler = function(stream, bite) {
297
- if (bite === end_of_stream && utf8_bytes_needed !== 0) {
298
- utf8_bytes_needed = 0;
299
- return decoderError(fatal);
300
- }
301
- if (bite === end_of_stream)
302
- return finished;
303
- if (utf8_bytes_needed === 0) {
304
- if (inRange(bite, 0, 127)) {
305
- return bite;
306
- } else if (inRange(bite, 194, 223)) {
307
- utf8_bytes_needed = 1;
308
- utf8_code_point = bite & 31;
309
- } else if (inRange(bite, 224, 239)) {
310
- if (bite === 224)
311
- utf8_lower_boundary = 160;
312
- if (bite === 237)
313
- utf8_upper_boundary = 159;
314
- utf8_bytes_needed = 2;
315
- utf8_code_point = bite & 15;
316
- } else if (inRange(bite, 240, 244)) {
317
- if (bite === 240)
318
- utf8_lower_boundary = 144;
319
- if (bite === 244)
320
- utf8_upper_boundary = 143;
321
- utf8_bytes_needed = 3;
322
- utf8_code_point = bite & 7;
323
- } else {
324
- return decoderError(fatal);
325
- }
326
- return null;
327
- }
328
- if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {
329
- utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
330
- utf8_lower_boundary = 128;
331
- utf8_upper_boundary = 191;
332
- stream.prepend(bite);
333
- return decoderError(fatal);
334
- }
335
- utf8_lower_boundary = 128;
336
- utf8_upper_boundary = 191;
337
- utf8_code_point = utf8_code_point << 6 | bite & 63;
338
- utf8_bytes_seen += 1;
339
- if (utf8_bytes_seen !== utf8_bytes_needed)
340
- return null;
341
- var code_point = utf8_code_point;
342
- utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
343
- return code_point;
344
- };
345
- }
346
- function UTF8Encoder(options) {
347
- var fatal = options.fatal;
348
- this.handler = function(stream, code_point) {
349
- if (code_point === end_of_stream)
350
- return finished;
351
- if (isASCIICodePoint(code_point))
352
- return code_point;
353
- var count, offset;
354
- if (inRange(code_point, 128, 2047)) {
355
- count = 1;
356
- offset = 192;
357
- } else if (inRange(code_point, 2048, 65535)) {
358
- count = 2;
359
- offset = 224;
360
- } else if (inRange(code_point, 65536, 1114111)) {
361
- count = 3;
362
- offset = 240;
363
- }
364
- var bytes = [(code_point >> 6 * count) + offset];
365
- while (count > 0) {
366
- var temp = code_point >> 6 * (count - 1);
367
- bytes.push(128 | temp & 63);
368
- count -= 1;
369
- }
370
- return bytes;
371
- };
372
- }
373
- function SingleByteDecoder(index2, options) {
374
- var fatal = options.fatal;
375
- this.handler = function(stream, bite) {
376
- if (bite === end_of_stream)
377
- return finished;
378
- if (isASCIIByte(bite))
379
- return bite;
380
- var code_point = index2[bite - 128];
381
- if (code_point === null)
382
- return decoderError(fatal);
383
- return code_point;
384
- };
385
- }
386
- function SingleByteEncoder(index2, options) {
387
- var fatal = options.fatal;
388
- this.handler = function(stream, code_point) {
389
- if (code_point === end_of_stream)
390
- return finished;
391
- if (isASCIICodePoint(code_point))
392
- return code_point;
393
- var pointer = indexPointerFor(code_point, index2);
394
- if (pointer === null)
395
- encoderError(code_point);
396
- return pointer + 128;
397
- };
398
- }
399
- function GB18030Decoder(options) {
400
- var fatal = options.fatal;
401
- var gb18030_first = 0, gb18030_second = 0, gb18030_third = 0;
402
- this.handler = function(stream, bite) {
403
- if (bite === end_of_stream && gb18030_first === 0 && gb18030_second === 0 && gb18030_third === 0) {
404
- return finished;
405
- }
406
- if (bite === end_of_stream && (gb18030_first !== 0 || gb18030_second !== 0 || gb18030_third !== 0)) {
407
- gb18030_first = 0;
408
- gb18030_second = 0;
409
- gb18030_third = 0;
410
- decoderError(fatal);
411
- }
412
- var code_point;
413
- if (gb18030_third !== 0) {
414
- code_point = null;
415
- if (inRange(bite, 48, 57)) {
416
- code_point = indexGB18030RangesCodePointFor((((gb18030_first - 129) * 10 + gb18030_second - 48) * 126 + gb18030_third - 129) * 10 + bite - 48);
417
- }
418
- var buffer = [gb18030_second, gb18030_third, bite];
419
- gb18030_first = 0;
420
- gb18030_second = 0;
421
- gb18030_third = 0;
422
- if (code_point === null) {
423
- stream.prepend(buffer);
424
- return decoderError(fatal);
425
- }
426
- return code_point;
427
- }
428
- if (gb18030_second !== 0) {
429
- if (inRange(bite, 129, 254)) {
430
- gb18030_third = bite;
431
- return null;
432
- }
433
- stream.prepend([gb18030_second, bite]);
434
- gb18030_first = 0;
435
- gb18030_second = 0;
436
- return decoderError(fatal);
437
- }
438
- if (gb18030_first !== 0) {
439
- if (inRange(bite, 48, 57)) {
440
- gb18030_second = bite;
441
- return null;
442
- }
443
- var lead = gb18030_first;
444
- var pointer = null;
445
- gb18030_first = 0;
446
- var offset = bite < 127 ? 64 : 65;
447
- if (inRange(bite, 64, 126) || inRange(bite, 128, 254))
448
- pointer = (lead - 129) * 190 + (bite - offset);
449
- code_point = pointer === null ? null : indexCodePointFor(pointer, index("gb18030"));
450
- if (code_point === null && isASCIIByte(bite))
451
- stream.prepend(bite);
452
- if (code_point === null)
453
- return decoderError(fatal);
454
- return code_point;
455
- }
456
- if (isASCIIByte(bite))
457
- return bite;
458
- if (bite === 128)
459
- return 8364;
460
- if (inRange(bite, 129, 254)) {
461
- gb18030_first = bite;
462
- return null;
463
- }
464
- return decoderError(fatal);
465
- };
466
- }
467
- function GB18030Encoder(options, gbk_flag) {
468
- var fatal = options.fatal;
469
- this.handler = function(stream, code_point) {
470
- if (code_point === end_of_stream)
471
- return finished;
472
- if (isASCIICodePoint(code_point))
473
- return code_point;
474
- if (code_point === 58853)
475
- return encoderError(code_point);
476
- if (gbk_flag && code_point === 8364)
477
- return 128;
478
- var pointer = indexPointerFor(code_point, index("gb18030"));
479
- if (pointer !== null) {
480
- var lead = floor(pointer / 190) + 129;
481
- var trail = pointer % 190;
482
- var offset = trail < 63 ? 64 : 65;
483
- return [lead, trail + offset];
484
- }
485
- if (gbk_flag)
486
- return encoderError(code_point);
487
- pointer = indexGB18030RangesPointerFor(code_point);
488
- var byte1 = floor(pointer / 10 / 126 / 10);
489
- pointer = pointer - byte1 * 10 * 126 * 10;
490
- var byte2 = floor(pointer / 10 / 126);
491
- pointer = pointer - byte2 * 10 * 126;
492
- var byte3 = floor(pointer / 10);
493
- var byte4 = pointer - byte3 * 10;
494
- return [byte1 + 129, byte2 + 48, byte3 + 129, byte4 + 48];
495
- };
496
- }
497
- function Big5Decoder(options) {
498
- var fatal = options.fatal;
499
- var Big5_lead = 0;
500
- this.handler = function(stream, bite) {
501
- if (bite === end_of_stream && Big5_lead !== 0) {
502
- Big5_lead = 0;
503
- return decoderError(fatal);
504
- }
505
- if (bite === end_of_stream && Big5_lead === 0)
506
- return finished;
507
- if (Big5_lead !== 0) {
508
- var lead = Big5_lead;
509
- var pointer = null;
510
- Big5_lead = 0;
511
- var offset = bite < 127 ? 64 : 98;
512
- if (inRange(bite, 64, 126) || inRange(bite, 161, 254))
513
- pointer = (lead - 129) * 157 + (bite - offset);
514
- switch (pointer) {
515
- case 1133:
516
- return [202, 772];
517
- case 1135:
518
- return [202, 780];
519
- case 1164:
520
- return [234, 772];
521
- case 1166:
522
- return [234, 780];
523
- }
524
- var code_point = pointer === null ? null : indexCodePointFor(pointer, index("big5"));
525
- if (code_point === null && isASCIIByte(bite))
526
- stream.prepend(bite);
527
- if (code_point === null)
528
- return decoderError(fatal);
529
- return code_point;
530
- }
531
- if (isASCIIByte(bite))
532
- return bite;
533
- if (inRange(bite, 129, 254)) {
534
- Big5_lead = bite;
535
- return null;
536
- }
537
- return decoderError(fatal);
538
- };
539
- }
540
- function Big5Encoder(options) {
541
- var fatal = options.fatal;
542
- this.handler = function(stream, code_point) {
543
- if (code_point === end_of_stream)
544
- return finished;
545
- if (isASCIICodePoint(code_point))
546
- return code_point;
547
- var pointer = indexBig5PointerFor(code_point);
548
- if (pointer === null)
549
- return encoderError(code_point);
550
- var lead = floor(pointer / 157) + 129;
551
- if (lead < 161)
552
- return encoderError(code_point);
553
- var trail = pointer % 157;
554
- var offset = trail < 63 ? 64 : 98;
555
- return [lead, trail + offset];
556
- };
557
- }
558
- function EUCJPDecoder(options) {
559
- var fatal = options.fatal;
560
- var eucjp_jis0212_flag = false, eucjp_lead = 0;
561
- this.handler = function(stream, bite) {
562
- if (bite === end_of_stream && eucjp_lead !== 0) {
563
- eucjp_lead = 0;
564
- return decoderError(fatal);
565
- }
566
- if (bite === end_of_stream && eucjp_lead === 0)
567
- return finished;
568
- if (eucjp_lead === 142 && inRange(bite, 161, 223)) {
569
- eucjp_lead = 0;
570
- return 65377 - 161 + bite;
571
- }
572
- if (eucjp_lead === 143 && inRange(bite, 161, 254)) {
573
- eucjp_jis0212_flag = true;
574
- eucjp_lead = bite;
575
- return null;
576
- }
577
- if (eucjp_lead !== 0) {
578
- var lead = eucjp_lead;
579
- eucjp_lead = 0;
580
- var code_point = null;
581
- if (inRange(lead, 161, 254) && inRange(bite, 161, 254)) {
582
- code_point = indexCodePointFor((lead - 161) * 94 + (bite - 161), index(!eucjp_jis0212_flag ? "jis0208" : "jis0212"));
583
- }
584
- eucjp_jis0212_flag = false;
585
- if (!inRange(bite, 161, 254))
586
- stream.prepend(bite);
587
- if (code_point === null)
588
- return decoderError(fatal);
589
- return code_point;
590
- }
591
- if (isASCIIByte(bite))
592
- return bite;
593
- if (bite === 142 || bite === 143 || inRange(bite, 161, 254)) {
594
- eucjp_lead = bite;
595
- return null;
596
- }
597
- return decoderError(fatal);
598
- };
599
- }
600
- function EUCJPEncoder(options) {
601
- var fatal = options.fatal;
602
- this.handler = function(stream, code_point) {
603
- if (code_point === end_of_stream)
604
- return finished;
605
- if (isASCIICodePoint(code_point))
606
- return code_point;
607
- if (code_point === 165)
608
- return 92;
609
- if (code_point === 8254)
610
- return 126;
611
- if (inRange(code_point, 65377, 65439))
612
- return [142, code_point - 65377 + 161];
613
- if (code_point === 8722)
614
- code_point = 65293;
615
- var pointer = indexPointerFor(code_point, index("jis0208"));
616
- if (pointer === null)
617
- return encoderError(code_point);
618
- var lead = floor(pointer / 94) + 161;
619
- var trail = pointer % 94 + 161;
620
- return [lead, trail];
621
- };
622
- }
623
- function ISO2022JPDecoder(options) {
624
- var fatal = options.fatal;
625
- var states = {
626
- ASCII: 0,
627
- Roman: 1,
628
- Katakana: 2,
629
- LeadByte: 3,
630
- TrailByte: 4,
631
- EscapeStart: 5,
632
- Escape: 6
633
- };
634
- var iso2022jp_decoder_state = states.ASCII, iso2022jp_decoder_output_state = states.ASCII, iso2022jp_lead = 0, iso2022jp_output_flag = false;
635
- this.handler = function(stream, bite) {
636
- switch (iso2022jp_decoder_state) {
637
- default:
638
- case states.ASCII:
639
- if (bite === 27) {
640
- iso2022jp_decoder_state = states.EscapeStart;
641
- return null;
642
- }
643
- if (inRange(bite, 0, 127) && bite !== 14 && bite !== 15 && bite !== 27) {
644
- iso2022jp_output_flag = false;
645
- return bite;
646
- }
647
- if (bite === end_of_stream) {
648
- return finished;
649
- }
650
- iso2022jp_output_flag = false;
651
- return decoderError(fatal);
652
- case states.Roman:
653
- if (bite === 27) {
654
- iso2022jp_decoder_state = states.EscapeStart;
655
- return null;
656
- }
657
- if (bite === 92) {
658
- iso2022jp_output_flag = false;
659
- return 165;
660
- }
661
- if (bite === 126) {
662
- iso2022jp_output_flag = false;
663
- return 8254;
664
- }
665
- if (inRange(bite, 0, 127) && bite !== 14 && bite !== 15 && bite !== 27 && bite !== 92 && bite !== 126) {
666
- iso2022jp_output_flag = false;
667
- return bite;
668
- }
669
- if (bite === end_of_stream) {
670
- return finished;
671
- }
672
- iso2022jp_output_flag = false;
673
- return decoderError(fatal);
674
- case states.Katakana:
675
- if (bite === 27) {
676
- iso2022jp_decoder_state = states.EscapeStart;
677
- return null;
678
- }
679
- if (inRange(bite, 33, 95)) {
680
- iso2022jp_output_flag = false;
681
- return 65377 - 33 + bite;
682
- }
683
- if (bite === end_of_stream) {
684
- return finished;
685
- }
686
- iso2022jp_output_flag = false;
687
- return decoderError(fatal);
688
- case states.LeadByte:
689
- if (bite === 27) {
690
- iso2022jp_decoder_state = states.EscapeStart;
691
- return null;
692
- }
693
- if (inRange(bite, 33, 126)) {
694
- iso2022jp_output_flag = false;
695
- iso2022jp_lead = bite;
696
- iso2022jp_decoder_state = states.TrailByte;
697
- return null;
698
- }
699
- if (bite === end_of_stream) {
700
- return finished;
701
- }
702
- iso2022jp_output_flag = false;
703
- return decoderError(fatal);
704
- case states.TrailByte:
705
- if (bite === 27) {
706
- iso2022jp_decoder_state = states.EscapeStart;
707
- return decoderError(fatal);
708
- }
709
- if (inRange(bite, 33, 126)) {
710
- iso2022jp_decoder_state = states.LeadByte;
711
- var pointer = (iso2022jp_lead - 33) * 94 + bite - 33;
712
- var code_point = indexCodePointFor(pointer, index("jis0208"));
713
- if (code_point === null)
714
- return decoderError(fatal);
715
- return code_point;
716
- }
717
- if (bite === end_of_stream) {
718
- iso2022jp_decoder_state = states.LeadByte;
719
- stream.prepend(bite);
720
- return decoderError(fatal);
721
- }
722
- iso2022jp_decoder_state = states.LeadByte;
723
- return decoderError(fatal);
724
- case states.EscapeStart:
725
- if (bite === 36 || bite === 40) {
726
- iso2022jp_lead = bite;
727
- iso2022jp_decoder_state = states.Escape;
728
- return null;
729
- }
730
- stream.prepend(bite);
731
- iso2022jp_output_flag = false;
732
- iso2022jp_decoder_state = iso2022jp_decoder_output_state;
733
- return decoderError(fatal);
734
- case states.Escape:
735
- var lead = iso2022jp_lead;
736
- iso2022jp_lead = 0;
737
- var state = null;
738
- if (lead === 40 && bite === 66)
739
- state = states.ASCII;
740
- if (lead === 40 && bite === 74)
741
- state = states.Roman;
742
- if (lead === 40 && bite === 73)
743
- state = states.Katakana;
744
- if (lead === 36 && (bite === 64 || bite === 66))
745
- state = states.LeadByte;
746
- if (state !== null) {
747
- iso2022jp_decoder_state = iso2022jp_decoder_state = state;
748
- var output_flag = iso2022jp_output_flag;
749
- iso2022jp_output_flag = true;
750
- return !output_flag ? null : decoderError(fatal);
751
- }
752
- stream.prepend([lead, bite]);
753
- iso2022jp_output_flag = false;
754
- iso2022jp_decoder_state = iso2022jp_decoder_output_state;
755
- return decoderError(fatal);
756
- }
757
- };
758
- }
759
- function ISO2022JPEncoder(options) {
760
- var fatal = options.fatal;
761
- var states = {
762
- ASCII: 0,
763
- Roman: 1,
764
- jis0208: 2
765
- };
766
- var iso2022jp_state = states.ASCII;
767
- this.handler = function(stream, code_point) {
768
- if (code_point === end_of_stream && iso2022jp_state !== states.ASCII) {
769
- stream.prepend(code_point);
770
- iso2022jp_state = states.ASCII;
771
- return [27, 40, 66];
772
- }
773
- if (code_point === end_of_stream && iso2022jp_state === states.ASCII)
774
- return finished;
775
- if ((iso2022jp_state === states.ASCII || iso2022jp_state === states.Roman) && (code_point === 14 || code_point === 15 || code_point === 27)) {
776
- return encoderError(65533);
777
- }
778
- if (iso2022jp_state === states.ASCII && isASCIICodePoint(code_point))
779
- return code_point;
780
- if (iso2022jp_state === states.Roman && (isASCIICodePoint(code_point) && code_point !== 92 && code_point !== 126 || code_point == 165 || code_point == 8254)) {
781
- if (isASCIICodePoint(code_point))
782
- return code_point;
783
- if (code_point === 165)
784
- return 92;
785
- if (code_point === 8254)
786
- return 126;
787
- }
788
- if (isASCIICodePoint(code_point) && iso2022jp_state !== states.ASCII) {
789
- stream.prepend(code_point);
790
- iso2022jp_state = states.ASCII;
791
- return [27, 40, 66];
792
- }
793
- if ((code_point === 165 || code_point === 8254) && iso2022jp_state !== states.Roman) {
794
- stream.prepend(code_point);
795
- iso2022jp_state = states.Roman;
796
- return [27, 40, 74];
797
- }
798
- if (code_point === 8722)
799
- code_point = 65293;
800
- var pointer = indexPointerFor(code_point, index("jis0208"));
801
- if (pointer === null)
802
- return encoderError(code_point);
803
- if (iso2022jp_state !== states.jis0208) {
804
- stream.prepend(code_point);
805
- iso2022jp_state = states.jis0208;
806
- return [27, 36, 66];
807
- }
808
- var lead = floor(pointer / 94) + 33;
809
- var trail = pointer % 94 + 33;
810
- return [lead, trail];
811
- };
812
- }
813
- function ShiftJISDecoder(options) {
814
- var fatal = options.fatal;
815
- var Shift_JIS_lead = 0;
816
- this.handler = function(stream, bite) {
817
- if (bite === end_of_stream && Shift_JIS_lead !== 0) {
818
- Shift_JIS_lead = 0;
819
- return decoderError(fatal);
820
- }
821
- if (bite === end_of_stream && Shift_JIS_lead === 0)
822
- return finished;
823
- if (Shift_JIS_lead !== 0) {
824
- var lead = Shift_JIS_lead;
825
- var pointer = null;
826
- Shift_JIS_lead = 0;
827
- var offset = bite < 127 ? 64 : 65;
828
- var lead_offset = lead < 160 ? 129 : 193;
829
- if (inRange(bite, 64, 126) || inRange(bite, 128, 252))
830
- pointer = (lead - lead_offset) * 188 + bite - offset;
831
- if (inRange(pointer, 8836, 10715))
832
- return 57344 - 8836 + pointer;
833
- var code_point = pointer === null ? null : indexCodePointFor(pointer, index("jis0208"));
834
- if (code_point === null && isASCIIByte(bite))
835
- stream.prepend(bite);
836
- if (code_point === null)
837
- return decoderError(fatal);
838
- return code_point;
839
- }
840
- if (isASCIIByte(bite) || bite === 128)
841
- return bite;
842
- if (inRange(bite, 161, 223))
843
- return 65377 - 161 + bite;
844
- if (inRange(bite, 129, 159) || inRange(bite, 224, 252)) {
845
- Shift_JIS_lead = bite;
846
- return null;
847
- }
848
- return decoderError(fatal);
849
- };
850
- }
851
- function ShiftJISEncoder(options) {
852
- var fatal = options.fatal;
853
- this.handler = function(stream, code_point) {
854
- if (code_point === end_of_stream)
855
- return finished;
856
- if (isASCIICodePoint(code_point) || code_point === 128)
857
- return code_point;
858
- if (code_point === 165)
859
- return 92;
860
- if (code_point === 8254)
861
- return 126;
862
- if (inRange(code_point, 65377, 65439))
863
- return code_point - 65377 + 161;
864
- if (code_point === 8722)
865
- code_point = 65293;
866
- var pointer = indexShiftJISPointerFor(code_point);
867
- if (pointer === null)
868
- return encoderError(code_point);
869
- var lead = floor(pointer / 188);
870
- var lead_offset = lead < 31 ? 129 : 193;
871
- var trail = pointer % 188;
872
- var offset = trail < 63 ? 64 : 65;
873
- return [lead + lead_offset, trail + offset];
874
- };
875
- }
876
- function EUCKRDecoder(options) {
877
- var fatal = options.fatal;
878
- var euckr_lead = 0;
879
- this.handler = function(stream, bite) {
880
- if (bite === end_of_stream && euckr_lead !== 0) {
881
- euckr_lead = 0;
882
- return decoderError(fatal);
883
- }
884
- if (bite === end_of_stream && euckr_lead === 0)
885
- return finished;
886
- if (euckr_lead !== 0) {
887
- var lead = euckr_lead;
888
- var pointer = null;
889
- euckr_lead = 0;
890
- if (inRange(bite, 65, 254))
891
- pointer = (lead - 129) * 190 + (bite - 65);
892
- var code_point = pointer === null ? null : indexCodePointFor(pointer, index("euc-kr"));
893
- if (pointer === null && isASCIIByte(bite))
894
- stream.prepend(bite);
895
- if (code_point === null)
896
- return decoderError(fatal);
897
- return code_point;
898
- }
899
- if (isASCIIByte(bite))
900
- return bite;
901
- if (inRange(bite, 129, 254)) {
902
- euckr_lead = bite;
903
- return null;
904
- }
905
- return decoderError(fatal);
906
- };
907
- }
908
- function EUCKREncoder(options) {
909
- var fatal = options.fatal;
910
- this.handler = function(stream, code_point) {
911
- if (code_point === end_of_stream)
912
- return finished;
913
- if (isASCIICodePoint(code_point))
914
- return code_point;
915
- var pointer = indexPointerFor(code_point, index("euc-kr"));
916
- if (pointer === null)
917
- return encoderError(code_point);
918
- var lead = floor(pointer / 190) + 129;
919
- var trail = pointer % 190 + 65;
920
- return [lead, trail];
921
- };
922
- }
923
- function convertCodeUnitToBytes(code_unit, utf16be) {
924
- var byte1 = code_unit >> 8;
925
- var byte2 = code_unit & 255;
926
- if (utf16be)
927
- return [byte1, byte2];
928
- return [byte2, byte1];
929
- }
930
- function UTF16Decoder(utf16_be, options) {
931
- var fatal = options.fatal;
932
- var utf16_lead_byte = null, utf16_lead_surrogate = null;
933
- this.handler = function(stream, bite) {
934
- if (bite === end_of_stream && (utf16_lead_byte !== null || utf16_lead_surrogate !== null)) {
935
- return decoderError(fatal);
936
- }
937
- if (bite === end_of_stream && utf16_lead_byte === null && utf16_lead_surrogate === null) {
938
- return finished;
939
- }
940
- if (utf16_lead_byte === null) {
941
- utf16_lead_byte = bite;
942
- return null;
943
- }
944
- var code_unit;
945
- if (utf16_be) {
946
- code_unit = (utf16_lead_byte << 8) + bite;
947
- } else {
948
- code_unit = (bite << 8) + utf16_lead_byte;
949
- }
950
- utf16_lead_byte = null;
951
- if (utf16_lead_surrogate !== null) {
952
- var lead_surrogate = utf16_lead_surrogate;
953
- utf16_lead_surrogate = null;
954
- if (inRange(code_unit, 56320, 57343)) {
955
- return 65536 + (lead_surrogate - 55296) * 1024 + (code_unit - 56320);
956
- }
957
- stream.prepend(convertCodeUnitToBytes(code_unit, utf16_be));
958
- return decoderError(fatal);
959
- }
960
- if (inRange(code_unit, 55296, 56319)) {
961
- utf16_lead_surrogate = code_unit;
962
- return null;
963
- }
964
- if (inRange(code_unit, 56320, 57343))
965
- return decoderError(fatal);
966
- return code_unit;
967
- };
968
- }
969
- function UTF16Encoder(utf16_be, options) {
970
- var fatal = options.fatal;
971
- this.handler = function(stream, code_point) {
972
- if (code_point === end_of_stream)
973
- return finished;
974
- if (inRange(code_point, 0, 65535))
975
- return convertCodeUnitToBytes(code_point, utf16_be);
976
- var lead = convertCodeUnitToBytes((code_point - 65536 >> 10) + 55296, utf16_be);
977
- var trail = convertCodeUnitToBytes((code_point - 65536 & 1023) + 56320, utf16_be);
978
- return lead.concat(trail);
979
- };
980
- }
981
- function XUserDefinedDecoder(options) {
982
- var fatal = options.fatal;
983
- this.handler = function(stream, bite) {
984
- if (bite === end_of_stream)
985
- return finished;
986
- if (isASCIIByte(bite))
987
- return bite;
988
- return 63360 + bite - 128;
989
- };
990
- }
991
- function XUserDefinedEncoder(options) {
992
- var fatal = options.fatal;
993
- this.handler = function(stream, code_point) {
994
- if (code_point === end_of_stream)
995
- return finished;
996
- if (isASCIICodePoint(code_point))
997
- return code_point;
998
- if (inRange(code_point, 63360, 63487))
999
- return code_point - 63360 + 128;
1000
- return encoderError(code_point);
1001
- };
1002
- }
1003
- var floor, isASCIICodePoint, end_of_stream, finished, encodings, label_to_encoding, encoders, decoders, shift_jis_index, big5_index_no_hkscs, DEFAULT_ENCODING;
1004
- var init_encoding = __esm({
1005
- "src/lib/encoding.ts"() {
1006
- init_encoding_indexes();
1007
- global["encoding-indexes"] = encoding_indexes_default || {};
1008
- floor = Math.floor;
1009
- isASCIICodePoint = isASCIIByte;
1010
- end_of_stream = -1;
1011
- Stream.prototype = {
1012
- endOfStream: function() {
1013
- return !this.tokens.length;
1014
- },
1015
- read: function() {
1016
- if (!this.tokens.length)
1017
- return end_of_stream;
1018
- return this.tokens.pop();
1019
- },
1020
- prepend: function(token) {
1021
- if (Array.isArray(token)) {
1022
- var tokens = token;
1023
- while (tokens.length)
1024
- this.tokens.push(tokens.pop());
1025
- } else {
1026
- this.tokens.push(token);
1027
- }
1028
- },
1029
- push: function(token) {
1030
- if (Array.isArray(token)) {
1031
- var tokens = token;
1032
- while (tokens.length)
1033
- this.tokens.unshift(tokens.shift());
1034
- } else {
1035
- this.tokens.unshift(token);
1036
- }
1037
- }
1038
- };
1039
- finished = -1;
1040
- Decoder.prototype = {
1041
- handler: function(stream, bite) {
1042
- }
1043
- };
1044
- Encoder.prototype = {
1045
- handler: function(stream, code_point) {
1046
- }
1047
- };
1048
- encodings = [
1049
- {
1050
- encodings: [
1051
- {
1052
- labels: ["unicode-1-1-utf-8", "utf-8", "utf8"],
1053
- name: "UTF-8"
1054
- }
1055
- ],
1056
- heading: "The Encoding"
1057
- },
1058
- {
1059
- encodings: [
1060
- {
1061
- labels: ["866", "cp866", "csibm866", "ibm866"],
1062
- name: "IBM866"
1063
- },
1064
- {
1065
- labels: [
1066
- "csisolatin2",
1067
- "iso-8859-2",
1068
- "iso-ir-101",
1069
- "iso8859-2",
1070
- "iso88592",
1071
- "iso_8859-2",
1072
- "iso_8859-2:1987",
1073
- "l2",
1074
- "latin2"
1075
- ],
1076
- name: "ISO-8859-2"
1077
- },
1078
- {
1079
- labels: [
1080
- "csisolatin3",
1081
- "iso-8859-3",
1082
- "iso-ir-109",
1083
- "iso8859-3",
1084
- "iso88593",
1085
- "iso_8859-3",
1086
- "iso_8859-3:1988",
1087
- "l3",
1088
- "latin3"
1089
- ],
1090
- name: "ISO-8859-3"
1091
- },
1092
- {
1093
- labels: [
1094
- "csisolatin4",
1095
- "iso-8859-4",
1096
- "iso-ir-110",
1097
- "iso8859-4",
1098
- "iso88594",
1099
- "iso_8859-4",
1100
- "iso_8859-4:1988",
1101
- "l4",
1102
- "latin4"
1103
- ],
1104
- name: "ISO-8859-4"
1105
- },
1106
- {
1107
- labels: [
1108
- "csisolatincyrillic",
1109
- "cyrillic",
1110
- "iso-8859-5",
1111
- "iso-ir-144",
1112
- "iso8859-5",
1113
- "iso88595",
1114
- "iso_8859-5",
1115
- "iso_8859-5:1988"
1116
- ],
1117
- name: "ISO-8859-5"
1118
- },
1119
- {
1120
- labels: [
1121
- "arabic",
1122
- "asmo-708",
1123
- "csiso88596e",
1124
- "csiso88596i",
1125
- "csisolatinarabic",
1126
- "ecma-114",
1127
- "iso-8859-6",
1128
- "iso-8859-6-e",
1129
- "iso-8859-6-i",
1130
- "iso-ir-127",
1131
- "iso8859-6",
1132
- "iso88596",
1133
- "iso_8859-6",
1134
- "iso_8859-6:1987"
1135
- ],
1136
- name: "ISO-8859-6"
1137
- },
1138
- {
1139
- labels: [
1140
- "csisolatingreek",
1141
- "ecma-118",
1142
- "elot_928",
1143
- "greek",
1144
- "greek8",
1145
- "iso-8859-7",
1146
- "iso-ir-126",
1147
- "iso8859-7",
1148
- "iso88597",
1149
- "iso_8859-7",
1150
- "iso_8859-7:1987",
1151
- "sun_eu_greek"
1152
- ],
1153
- name: "ISO-8859-7"
1154
- },
1155
- {
1156
- labels: [
1157
- "csiso88598e",
1158
- "csisolatinhebrew",
1159
- "hebrew",
1160
- "iso-8859-8",
1161
- "iso-8859-8-e",
1162
- "iso-ir-138",
1163
- "iso8859-8",
1164
- "iso88598",
1165
- "iso_8859-8",
1166
- "iso_8859-8:1988",
1167
- "visual"
1168
- ],
1169
- name: "ISO-8859-8"
1170
- },
1171
- {
1172
- labels: ["csiso88598i", "iso-8859-8-i", "logical"],
1173
- name: "ISO-8859-8-I"
1174
- },
1175
- {
1176
- labels: [
1177
- "csisolatin6",
1178
- "iso-8859-10",
1179
- "iso-ir-157",
1180
- "iso8859-10",
1181
- "iso885910",
1182
- "l6",
1183
- "latin6"
1184
- ],
1185
- name: "ISO-8859-10"
1186
- },
1187
- {
1188
- labels: ["iso-8859-13", "iso8859-13", "iso885913"],
1189
- name: "ISO-8859-13"
1190
- },
1191
- {
1192
- labels: ["iso-8859-14", "iso8859-14", "iso885914"],
1193
- name: "ISO-8859-14"
1194
- },
1195
- {
1196
- labels: ["csisolatin9", "iso-8859-15", "iso8859-15", "iso885915", "iso_8859-15", "l9"],
1197
- name: "ISO-8859-15"
1198
- },
1199
- {
1200
- labels: ["iso-8859-16"],
1201
- name: "ISO-8859-16"
1202
- },
1203
- {
1204
- labels: ["cskoi8r", "koi", "koi8", "koi8-r", "koi8_r"],
1205
- name: "KOI8-R"
1206
- },
1207
- {
1208
- labels: ["koi8-ru", "koi8-u"],
1209
- name: "KOI8-U"
1210
- },
1211
- {
1212
- labels: ["csmacintosh", "mac", "macintosh", "x-mac-roman"],
1213
- name: "macintosh"
1214
- },
1215
- {
1216
- labels: ["dos-874", "iso-8859-11", "iso8859-11", "iso885911", "tis-620", "windows-874"],
1217
- name: "windows-874"
1218
- },
1219
- {
1220
- labels: ["cp1250", "windows-1250", "x-cp1250"],
1221
- name: "windows-1250"
1222
- },
1223
- {
1224
- labels: ["cp1251", "windows-1251", "x-cp1251"],
1225
- name: "windows-1251"
1226
- },
1227
- {
1228
- labels: [
1229
- "ansi_x3.4-1968",
1230
- "ascii",
1231
- "cp1252",
1232
- "cp819",
1233
- "csisolatin1",
1234
- "ibm819",
1235
- "iso-8859-1",
1236
- "iso-ir-100",
1237
- "iso8859-1",
1238
- "iso88591",
1239
- "iso_8859-1",
1240
- "iso_8859-1:1987",
1241
- "l1",
1242
- "latin1",
1243
- "us-ascii",
1244
- "windows-1252",
1245
- "x-cp1252"
1246
- ],
1247
- name: "windows-1252"
1248
- },
1249
- {
1250
- labels: ["cp1253", "windows-1253", "x-cp1253"],
1251
- name: "windows-1253"
1252
- },
1253
- {
1254
- labels: [
1255
- "cp1254",
1256
- "csisolatin5",
1257
- "iso-8859-9",
1258
- "iso-ir-148",
1259
- "iso8859-9",
1260
- "iso88599",
1261
- "iso_8859-9",
1262
- "iso_8859-9:1989",
1263
- "l5",
1264
- "latin5",
1265
- "windows-1254",
1266
- "x-cp1254"
1267
- ],
1268
- name: "windows-1254"
1269
- },
1270
- {
1271
- labels: ["cp1255", "windows-1255", "x-cp1255"],
1272
- name: "windows-1255"
1273
- },
1274
- {
1275
- labels: ["cp1256", "windows-1256", "x-cp1256"],
1276
- name: "windows-1256"
1277
- },
1278
- {
1279
- labels: ["cp1257", "windows-1257", "x-cp1257"],
1280
- name: "windows-1257"
1281
- },
1282
- {
1283
- labels: ["cp1258", "windows-1258", "x-cp1258"],
1284
- name: "windows-1258"
1285
- },
1286
- {
1287
- labels: ["x-mac-cyrillic", "x-mac-ukrainian"],
1288
- name: "x-mac-cyrillic"
1289
- }
1290
- ],
1291
- heading: "Legacy single-byte encodings"
1292
- },
1293
- {
1294
- encodings: [
1295
- {
1296
- labels: [
1297
- "chinese",
1298
- "csgb2312",
1299
- "csiso58gb231280",
1300
- "gb2312",
1301
- "gb_2312",
1302
- "gb_2312-80",
1303
- "gbk",
1304
- "iso-ir-58",
1305
- "x-gbk"
1306
- ],
1307
- name: "GBK"
1308
- },
1309
- {
1310
- labels: ["gb18030"],
1311
- name: "gb18030"
1312
- }
1313
- ],
1314
- heading: "Legacy multi-byte Chinese (simplified) encodings"
1315
- },
1316
- {
1317
- encodings: [
1318
- {
1319
- labels: ["big5", "big5-hkscs", "cn-big5", "csbig5", "x-x-big5"],
1320
- name: "Big5"
1321
- }
1322
- ],
1323
- heading: "Legacy multi-byte Chinese (traditional) encodings"
1324
- },
1325
- {
1326
- encodings: [
1327
- {
1328
- labels: ["cseucpkdfmtjapanese", "euc-jp", "x-euc-jp"],
1329
- name: "EUC-JP"
1330
- },
1331
- {
1332
- labels: ["csiso2022jp", "iso-2022-jp"],
1333
- name: "ISO-2022-JP"
1334
- },
1335
- {
1336
- labels: [
1337
- "csshiftjis",
1338
- "ms932",
1339
- "ms_kanji",
1340
- "shift-jis",
1341
- "shift_jis",
1342
- "sjis",
1343
- "windows-31j",
1344
- "x-sjis"
1345
- ],
1346
- name: "Shift_JIS"
1347
- }
1348
- ],
1349
- heading: "Legacy multi-byte Japanese encodings"
1350
- },
1351
- {
1352
- encodings: [
1353
- {
1354
- labels: [
1355
- "cseuckr",
1356
- "csksc56011987",
1357
- "euc-kr",
1358
- "iso-ir-149",
1359
- "korean",
1360
- "ks_c_5601-1987",
1361
- "ks_c_5601-1989",
1362
- "ksc5601",
1363
- "ksc_5601",
1364
- "windows-949"
1365
- ],
1366
- name: "EUC-KR"
1367
- }
1368
- ],
1369
- heading: "Legacy multi-byte Korean encodings"
1370
- },
1371
- {
1372
- encodings: [
1373
- {
1374
- labels: ["csiso2022kr", "hz-gb-2312", "iso-2022-cn", "iso-2022-cn-ext", "iso-2022-kr"],
1375
- name: "replacement"
1376
- },
1377
- {
1378
- labels: ["utf-16be"],
1379
- name: "UTF-16BE"
1380
- },
1381
- {
1382
- labels: ["utf-16", "utf-16le"],
1383
- name: "UTF-16LE"
1384
- },
1385
- {
1386
- labels: ["x-user-defined"],
1387
- name: "x-user-defined"
1388
- }
1389
- ],
1390
- heading: "Legacy miscellaneous encodings"
1391
- }
1392
- ];
1393
- label_to_encoding = {};
1394
- encodings.forEach(function(category) {
1395
- category.encodings.forEach(function(encoding) {
1396
- encoding.labels.forEach(function(label) {
1397
- label_to_encoding[label] = encoding;
1398
- });
1399
- });
1400
- });
1401
- encoders = {};
1402
- decoders = {};
1403
- DEFAULT_ENCODING = "utf-8";
1404
- if (Object.defineProperty) {
1405
- Object.defineProperty(TextDecoder.prototype, "encoding", {
1406
- get: function() {
1407
- return this._encoding.name.toLowerCase();
1408
- }
1409
- });
1410
- Object.defineProperty(TextDecoder.prototype, "fatal", {
1411
- get: function() {
1412
- return this._error_mode === "fatal";
1413
- }
1414
- });
1415
- Object.defineProperty(TextDecoder.prototype, "ignoreBOM", {
1416
- get: function() {
1417
- return this._ignoreBOM;
1418
- }
1419
- });
1420
- }
1421
- TextDecoder.prototype.decode = function decode(input, options) {
1422
- var bytes;
1423
- if (typeof input === "object" && input instanceof ArrayBuffer) {
1424
- bytes = new Uint8Array(input);
1425
- } else if (typeof input === "object" && "buffer" in input && input.buffer instanceof ArrayBuffer) {
1426
- bytes = new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
1427
- } else {
1428
- bytes = new Uint8Array(0);
1429
- }
1430
- options = ToDictionary(options);
1431
- if (!this._do_not_flush) {
1432
- this._decoder = decoders[this._encoding.name]({
1433
- fatal: this._error_mode === "fatal"
1434
- });
1435
- this._BOMseen = false;
1436
- }
1437
- this._do_not_flush = Boolean(options["stream"]);
1438
- var input_stream = new Stream(bytes);
1439
- var output = [];
1440
- var result;
1441
- while (true) {
1442
- var token = input_stream.read();
1443
- if (token === end_of_stream)
1444
- break;
1445
- result = this._decoder.handler(input_stream, token);
1446
- if (result === finished)
1447
- break;
1448
- if (result !== null) {
1449
- if (Array.isArray(result))
1450
- output.push.apply(output, result);
1451
- else
1452
- output.push(result);
1453
- }
1454
- }
1455
- if (!this._do_not_flush) {
1456
- do {
1457
- result = this._decoder.handler(input_stream, input_stream.read());
1458
- if (result === finished)
1459
- break;
1460
- if (result === null)
1461
- continue;
1462
- if (Array.isArray(result))
1463
- output.push.apply(output, result);
1464
- else
1465
- output.push(result);
1466
- } while (!input_stream.endOfStream());
1467
- this._decoder = null;
1468
- }
1469
- function serializeStream(stream) {
1470
- if (includes(["UTF-8", "UTF-16LE", "UTF-16BE"], this._encoding.name) && !this._ignoreBOM && !this._BOMseen) {
1471
- if (stream.length > 0 && stream[0] === 65279) {
1472
- this._BOMseen = true;
1473
- stream.shift();
1474
- } else if (stream.length > 0) {
1475
- this._BOMseen = true;
1476
- } else {
1477
- }
1478
- }
1479
- return codePointsToString(stream);
1480
- }
1481
- return serializeStream.call(this, output);
1482
- };
1483
- if (Object.defineProperty) {
1484
- Object.defineProperty(TextEncoder.prototype, "encoding", {
1485
- get: function() {
1486
- return this._encoding.name.toLowerCase();
1487
- }
1488
- });
1489
- }
1490
- TextEncoder.prototype.encode = function encode(opt_string, options) {
1491
- opt_string = opt_string === void 0 ? "" : String(opt_string);
1492
- options = ToDictionary(options);
1493
- if (!this._do_not_flush)
1494
- this._encoder = encoders[this._encoding.name]({
1495
- fatal: this._fatal === "fatal"
1496
- });
1497
- this._do_not_flush = Boolean(options["stream"]);
1498
- var input = new Stream(stringToCodePoints(opt_string));
1499
- var output = [];
1500
- var result;
1501
- while (true) {
1502
- var token = input.read();
1503
- if (token === end_of_stream)
1504
- break;
1505
- result = this._encoder.handler(input, token);
1506
- if (result === finished)
1507
- break;
1508
- if (Array.isArray(result))
1509
- output.push.apply(output, result);
1510
- else
1511
- output.push(result);
1512
- }
1513
- if (!this._do_not_flush) {
1514
- while (true) {
1515
- result = this._encoder.handler(input, input.read());
1516
- if (result === finished)
1517
- break;
1518
- if (Array.isArray(result))
1519
- output.push.apply(output, result);
1520
- else
1521
- output.push(result);
1522
- }
1523
- this._encoder = null;
1524
- }
1525
- return new Uint8Array(output);
1526
- };
1527
- encoders["UTF-8"] = function(options) {
1528
- return new UTF8Encoder(options);
1529
- };
1530
- decoders["UTF-8"] = function(options) {
1531
- return new UTF8Decoder(options);
1532
- };
1533
- (function() {
1534
- if (!("encoding-indexes" in global))
1535
- return;
1536
- encodings.forEach(function(category) {
1537
- if (category.heading !== "Legacy single-byte encodings")
1538
- return;
1539
- category.encodings.forEach(function(encoding) {
1540
- var name = encoding.name;
1541
- var idx = index(name.toLowerCase());
1542
- decoders[name] = function(options) {
1543
- return new SingleByteDecoder(idx, options);
1544
- };
1545
- encoders[name] = function(options) {
1546
- return new SingleByteEncoder(idx, options);
1547
- };
1548
- });
1549
- });
1550
- })();
1551
- decoders["GBK"] = function(options) {
1552
- return new GB18030Decoder(options);
1553
- };
1554
- encoders["GBK"] = function(options) {
1555
- return new GB18030Encoder(options, true);
1556
- };
1557
- encoders["gb18030"] = function(options) {
1558
- return new GB18030Encoder(options);
1559
- };
1560
- decoders["gb18030"] = function(options) {
1561
- return new GB18030Decoder(options);
1562
- };
1563
- encoders["Big5"] = function(options) {
1564
- return new Big5Encoder(options);
1565
- };
1566
- decoders["Big5"] = function(options) {
1567
- return new Big5Decoder(options);
1568
- };
1569
- encoders["EUC-JP"] = function(options) {
1570
- return new EUCJPEncoder(options);
1571
- };
1572
- decoders["EUC-JP"] = function(options) {
1573
- return new EUCJPDecoder(options);
1574
- };
1575
- encoders["ISO-2022-JP"] = function(options) {
1576
- return new ISO2022JPEncoder(options);
1577
- };
1578
- decoders["ISO-2022-JP"] = function(options) {
1579
- return new ISO2022JPDecoder(options);
1580
- };
1581
- encoders["Shift_JIS"] = function(options) {
1582
- return new ShiftJISEncoder(options);
1583
- };
1584
- decoders["Shift_JIS"] = function(options) {
1585
- return new ShiftJISDecoder(options);
1586
- };
1587
- encoders["EUC-KR"] = function(options) {
1588
- return new EUCKREncoder(options);
1589
- };
1590
- decoders["EUC-KR"] = function(options) {
1591
- return new EUCKRDecoder(options);
1592
- };
1593
- encoders["UTF-16BE"] = function(options) {
1594
- return new UTF16Encoder(true, options);
1595
- };
1596
- decoders["UTF-16BE"] = function(options) {
1597
- return new UTF16Decoder(true, options);
1598
- };
1599
- encoders["UTF-16LE"] = function(options) {
1600
- return new UTF16Encoder(false, options);
1601
- };
1602
- decoders["UTF-16LE"] = function(options) {
1603
- return new UTF16Decoder(false, options);
1604
- };
1605
- encoders["x-user-defined"] = function(options) {
1606
- return new XUserDefinedEncoder(options);
1607
- };
1608
- decoders["x-user-defined"] = function(options) {
1609
- return new XUserDefinedDecoder(options);
1610
- };
1611
- }
1612
- });
1613
15
 
1614
16
  // src/promise/all-settled.ts
1615
17
  function allSettled(promises) {
@@ -1630,239 +32,29 @@
1630
32
  }
1631
33
  });
1632
34
 
1633
- // (disabled):src/node/buffer/btoa.node
1634
- var init_btoa = __esm({
1635
- "(disabled):src/node/buffer/btoa.node"() {
1636
- }
1637
- });
1638
-
1639
- // (disabled):src/node/fetch/headers.node
1640
- var init_headers = __esm({
1641
- "(disabled):src/node/fetch/headers.node"() {
1642
- }
1643
- });
1644
-
1645
- // (disabled):src/node/fetch/response.node
1646
- var init_response = __esm({
1647
- "(disabled):src/node/fetch/response.node"() {
1648
- }
1649
- });
1650
-
1651
- // (disabled):src/node/fetch/fetch.node
1652
- var init_fetch = __esm({
1653
- "(disabled):src/node/fetch/fetch.node"() {
1654
- }
1655
- });
1656
-
1657
- // (disabled):src/node/images/encode-image.node
1658
- var init_encode_image = __esm({
1659
- "(disabled):src/node/images/encode-image.node"() {
1660
- }
1661
- });
1662
-
1663
- // (disabled):src/node/images/parse-image.node
1664
- var init_parse_image = __esm({
1665
- "(disabled):src/node/images/parse-image.node"() {
1666
- }
1667
- });
1668
-
1669
- // (disabled):src/node/file/readable-stream
1670
- var init_readable_stream = __esm({
1671
- "(disabled):src/node/file/readable-stream"() {
1672
- }
1673
- });
1674
-
1675
- // (disabled):src/node/file/blob
1676
- var init_blob = __esm({
1677
- "(disabled):src/node/file/blob"() {
1678
- }
1679
- });
1680
-
1681
- // src/node/file/file-reader.ts
1682
- var FileReaderPolyfill;
1683
- var init_file_reader = __esm({
1684
- "src/node/file/file-reader.ts"() {
1685
- init_btoa();
1686
- FileReaderPolyfill = class {
1687
- constructor() {
1688
- this.onload = null;
1689
- }
1690
- abort() {
1691
- return;
1692
- }
1693
- async readAsArrayBuffer(blob) {
1694
- const arrayBuffer = await blob.arrayBuffer();
1695
- if (this.onload) {
1696
- this.onload({ target: { result: arrayBuffer } });
1697
- }
1698
- }
1699
- async readAsBinaryString(blob) {
1700
- throw Error("Not implemented");
1701
- }
1702
- async readAsDataURL(blob) {
1703
- const text = await blob.text();
1704
- const dataUrl = `data://;base64,${(0, import_btoa.atob)(text)}`;
1705
- if (this.onload) {
1706
- this.onload({ target: { result: dataUrl } });
1707
- }
1708
- }
1709
- async readAsText(blob) {
1710
- const text = await blob.text();
1711
- if (this.onload) {
1712
- this.onload({ target: { result: text } });
1713
- }
1714
- }
1715
- };
1716
- }
1717
- });
1718
-
1719
- // (disabled):src/node/file/file
1720
- var init_file = __esm({
1721
- "(disabled):src/node/file/file"() {
1722
- }
35
+ // src/index.browser.ts
36
+ var index_browser_exports = {};
37
+ __export(index_browser_exports, {
38
+ NodeFileSystem: () => NodeFileSystem,
39
+ installFilePolyfills: () => installFilePolyfills
1723
40
  });
1724
-
1725
- // src/node/file/install-file-polyfills.ts
1726
41
  function installFilePolyfills() {
1727
- if (typeof ReadableStream === "undefined" && global) {
1728
- global.ReadableStream = import_readable_stream.ReadableStreamPolyfill;
1729
- }
1730
- if (typeof Blob === "undefined" && global) {
1731
- global.Blob = import_blob.BlobPolyfill;
1732
- }
1733
- if (typeof FileReader === "undefined" && global) {
1734
- global.FileReader = FileReaderPolyfill;
1735
- }
1736
- if (typeof File === "undefined" && global) {
1737
- global.File = import_file.FilePolyfill;
1738
- }
1739
42
  }
1740
- var init_install_file_polyfills = __esm({
1741
- "src/node/file/install-file-polyfills.ts"() {
1742
- init_readable_stream();
1743
- init_blob();
1744
- init_file_reader();
1745
- init_file();
1746
- }
1747
- });
1748
-
1749
- // (disabled):fs
1750
- var require_fs = __commonJS({
1751
- "(disabled):fs"() {
1752
- }
1753
- });
1754
-
1755
- // src/node/fetch/fetch-file.node.ts
1756
- async function fetchFileNode(url, options) {
1757
- const noqueryUrl = url.split("?")[0];
1758
- try {
1759
- const body = await new Promise((resolve, reject) => {
1760
- const stream = import_fs.default.createReadStream(noqueryUrl, { encoding: null });
1761
- stream.once("readable", () => resolve(stream));
1762
- stream.on("error", (error) => reject(error));
1763
- });
1764
- const status = 200;
1765
- const statusText = "OK";
1766
- const headers = getHeadersForFile(noqueryUrl);
1767
- return new import_response.Response(body, { headers, status, statusText, url });
1768
- } catch (error) {
1769
- const status = 400;
1770
- const statusText = error.message;
1771
- const headers = {};
1772
- return new import_response.Response(error.message, { headers, status, statusText, url });
1773
- }
1774
- }
1775
- function getHeadersForFile(noqueryUrl) {
1776
- const headers = {};
1777
- if (!headers["content-length"]) {
1778
- const stats = import_fs.default.statSync(noqueryUrl);
1779
- headers["content-length"] = stats.size;
1780
- }
1781
- if (noqueryUrl.endsWith(".gz")) {
1782
- noqueryUrl = noqueryUrl.slice(0, -3);
1783
- headers["content-encoding"] = "gzip";
1784
- }
1785
- return new import_headers.Headers(headers);
1786
- }
1787
- var import_fs;
1788
- var init_fetch_file_node = __esm({
1789
- "src/node/fetch/fetch-file.node.ts"() {
1790
- import_fs = __toModule(require_fs());
1791
- init_response();
1792
- init_headers();
1793
- }
1794
- });
1795
-
1796
- // src/index.ts
1797
- var src_exports = {};
1798
- __export(src_exports, {
1799
- BlobPolyfill: () => import_blob2.BlobPolyfill,
1800
- FilePolyfill: () => import_file2.FilePolyfill,
1801
- FileReaderPolyfill: () => FileReaderPolyfill,
1802
- ReadableStreamPolyfill: () => import_readable_stream2.ReadableStreamPolyfill,
1803
- _fetchFileNode: () => fetchFileNode,
1804
- _fetchNode: () => import_fetch2.fetchNode,
1805
- installFilePolyfills: () => installFilePolyfills
1806
- });
1807
- var installTextEncoder, installTextDecoder;
1808
- var init_src = __esm({
1809
- "src/index.ts"() {
1810
- init_globals();
1811
- init_encoding();
43
+ var NodeFileSystem;
44
+ var init_index_browser = __esm({
45
+ "src/index.browser.ts"() {
1812
46
  init_all_settled();
1813
- init_btoa();
1814
- init_headers();
1815
- init_response();
1816
- init_fetch();
1817
- init_encode_image();
1818
- init_parse_image();
1819
- init_readable_stream();
1820
- init_blob();
1821
- init_file_reader();
1822
- init_file();
1823
- init_install_file_polyfills();
1824
- init_fetch();
1825
- init_fetch_file_node();
1826
- installTextEncoder = !isBrowser || !("TextEncoder" in global_);
1827
- if (installTextEncoder) {
1828
- global_["TextEncoder"] = TextEncoder;
1829
- }
1830
- installTextDecoder = !isBrowser || !("TextDecoder" in global_);
1831
- if (installTextDecoder) {
1832
- global_["TextDecoder"] = TextDecoder;
1833
- }
1834
- if (!isBrowser && !("atob" in global_) && base64.atob) {
1835
- global_["atob"] = base64.atob;
1836
- }
1837
- if (!isBrowser && !("btoa" in global_) && base64.btoa) {
1838
- global_["btoa"] = base64.btoa;
1839
- }
1840
- if (!isBrowser && !("Headers" in global_) && import_headers2.Headers) {
1841
- global_["Headers"] = import_headers2.Headers;
1842
- }
1843
- if (!isBrowser && !("Response" in global_) && import_response2.Response) {
1844
- global_["Response"] = import_response2.Response;
1845
- }
1846
- if (!isBrowser && !("fetch" in global_) && import_fetch.fetchNode) {
1847
- global_["fetch"] = import_fetch.fetchNode;
1848
- }
1849
- if (!isBrowser && !("_encodeImageNode" in global_) && import_encode_image.encodeImageNode) {
1850
- global_["_encodeImageNode"] = import_encode_image.encodeImageNode;
1851
- }
1852
- if (!isBrowser && !("_parseImageNode" in global_) && import_parse_image.parseImageNode) {
1853
- global_["_parseImageNode"] = import_parse_image.parseImageNode;
1854
- global_["_imageFormatsNode"] = import_parse_image.NODE_FORMAT_SUPPORT;
1855
- }
1856
47
  if (!("allSettled" in Promise)) {
1857
48
  Promise.allSettled = allSettled;
1858
49
  }
50
+ NodeFileSystem = null;
1859
51
  }
1860
52
  });
1861
53
 
1862
54
  // src/bundle.ts
1863
55
  var require_bundle = __commonJS({
1864
56
  "src/bundle.ts"(exports, module) {
1865
- var moduleExports = (init_src(), src_exports);
57
+ var moduleExports = (init_index_browser(), index_browser_exports);
1866
58
  globalThis.loaders = globalThis.loaders || {};
1867
59
  module.exports = Object.assign(globalThis.loaders, moduleExports);
1868
60
  }