module-develop-kit 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/commonjs-virtual-dir/browser2.js +7 -0
  2. package/dist/commonjs-virtual-dir/index2.js +5 -3
  3. package/dist/commonjs-virtual-dir/index3.js +3 -5
  4. package/dist/commonjs-virtual-dir/index4.js +2 -4
  5. package/dist/commonjs-virtual-dir/index5.js +2 -2
  6. package/dist/commonjs-virtual-dir/index6.js +2 -2
  7. package/dist/commonjs-virtual-dir/index7.js +4 -0
  8. package/dist/commonjs-virtual-dir/index8.js +4 -0
  9. package/dist/main.d.ts +111 -0
  10. package/dist/main.js +34 -22
  11. package/dist/src/outside-call/utils.js +1 -1
  12. package/dist/src/shield/crypto/sm4.js +1 -1
  13. package/dist/src/shield/file-detection.js +143 -0
  14. package/dist/vendor/@borewit/text-codec/lib/index.js +181 -0
  15. package/dist/vendor/@tokenizer/inflate/lib/GzipHandler.js +21 -0
  16. package/dist/vendor/@tokenizer/inflate/lib/ZipHandler.js +156 -0
  17. package/dist/vendor/@tokenizer/inflate/lib/ZipToken.js +71 -0
  18. package/dist/vendor/base64-js/index.js +1 -1
  19. package/dist/vendor/file-type/source/detectors/asf.js +74 -0
  20. package/dist/vendor/file-type/source/detectors/ebml.js +61 -0
  21. package/dist/vendor/file-type/source/detectors/png.js +64 -0
  22. package/dist/vendor/file-type/source/detectors/zip.js +344 -0
  23. package/dist/vendor/file-type/source/index.js +1135 -0
  24. package/dist/vendor/file-type/source/parser.js +49 -0
  25. package/dist/vendor/file-type/source/supported.js +372 -0
  26. package/dist/vendor/file-type/source/tokens.js +40 -0
  27. package/dist/vendor/ieee754/index.js +30 -0
  28. package/dist/vendor/jsbn/index.js +1 -1
  29. package/dist/vendor/sdp-transform/lib/index.js +1 -1
  30. package/dist/vendor/strtok3/lib/AbstractTokenizer.js +92 -0
  31. package/dist/vendor/strtok3/lib/BlobTokenizer.js +48 -0
  32. package/dist/vendor/strtok3/lib/BufferTokenizer.js +47 -0
  33. package/dist/vendor/strtok3/lib/ReadStreamTokenizer.js +91 -0
  34. package/dist/vendor/strtok3/lib/core.js +22 -0
  35. package/dist/vendor/strtok3/lib/stream/AbstractStreamReader.js +51 -0
  36. package/dist/vendor/strtok3/lib/stream/Errors.js +16 -0
  37. package/dist/vendor/strtok3/lib/stream/WebStreamByobReader.js +18 -0
  38. package/dist/vendor/strtok3/lib/stream/WebStreamDefaultReader.js +45 -0
  39. package/dist/vendor/strtok3/lib/stream/WebStreamReader.js +15 -0
  40. package/dist/vendor/strtok3/lib/stream/WebStreamReaderFactory.js +15 -0
  41. package/dist/vendor/token-types/lib/index.js +81 -0
  42. package/dist/vendor/uint8array-extras/index.js +45 -0
  43. package/package.json +2 -1
@@ -0,0 +1,7 @@
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as e } from "../vendor/debug/src/browser.js";
3
+ var o = e();
4
+ const i = /* @__PURE__ */ r(o);
5
+ export {
6
+ i as default
7
+ };
@@ -1,5 +1,7 @@
1
- import { __require as r } from "../vendor/gm-crypt/index.js";
2
- var p = r();
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as o } from "../vendor/sdp-transform/lib/index.js";
3
+ var t = o();
4
+ const a = /* @__PURE__ */ r(t);
3
5
  export {
4
- p as g
6
+ a as default
5
7
  };
@@ -1,7 +1,5 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as o } from "../vendor/sdp-transform/lib/index.js";
3
- var t = o();
4
- const a = /* @__PURE__ */ r(t);
1
+ import { __require as r } from "../vendor/gm-crypt/index.js";
2
+ var p = r();
5
3
  export {
6
- a as default
4
+ p as g
7
5
  };
@@ -1,4 +1,2 @@
1
- var r = {};
2
- export {
3
- r as __exports
4
- };
1
+ import { __require as e } from "../vendor/ieee754/index.js";
2
+ e();
@@ -1,4 +1,4 @@
1
- var e = { exports: {} };
1
+ var r = {};
2
2
  export {
3
- e as __module
3
+ r as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var s = {};
1
+ var e = { exports: {} };
2
2
  export {
3
- s as __exports
3
+ e as __module
4
4
  };
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var s = {};
2
+ export {
3
+ s as __exports
4
+ };
package/dist/main.d.ts CHANGED
@@ -1,4 +1,20 @@
1
1
  import { Ref } from 'vue';
2
+ import { supportedExtensions } from 'file-type';
3
+ import { supportedMimeTypes } from 'file-type';
4
+
5
+ /**
6
+ * 支持的文件类型配置
7
+ * 基于 file-type 库的 supportedMimeTypes 动态生成
8
+ */
9
+ export declare const ALLOWED_FILE_TYPES: {
10
+ readonly image: Set<string>;
11
+ readonly document: Set<string>;
12
+ readonly video: Set<string>;
13
+ readonly audio: Set<string>;
14
+ readonly archive: Set<string>;
15
+ readonly font: Set<string>;
16
+ readonly model: Set<string>;
17
+ };
2
18
 
3
19
  /**
4
20
  * 防重放攻击策略
@@ -23,6 +39,46 @@ export declare const CallLogger: {
23
39
  error(message: unknown, ...args: unknown[]): void;
24
40
  };
25
41
 
42
+ /**
43
+ * 检测文件真实类型并验证扩展名
44
+ *
45
+ * @param file 要检测的文件
46
+ * @param _allowedExtensions 允许的扩展名列表(不含点),如 ['jpg', 'png'],或者 'jpg,png' 或者 'jpg'
47
+ * @param options 检测选项
48
+ * @returns 检测结果
49
+ */
50
+ export declare function detectFileByExtension(file: File, _allowedExtensions: TMaybeArray<string>, options?: FileDetectionOptions): Promise<FileDetectionResult>;
51
+
52
+ /**
53
+ * 检测文件真实类型并验证 MIME 类型
54
+ *
55
+ * @param file 要检测的文件
56
+ * @param _allowedMimes 允许的MIME类型列表 支持单个或者数组。单个支持使用,分割
57
+ * @param options 检测选项
58
+ * @returns 检测结果
59
+ */
60
+ export declare function detectFileByMime(file: File, _allowedMimes: TMaybeArray<string>, options?: FileDetectionOptions): Promise<FileDetectionResult>;
61
+
62
+ /**
63
+ * 批量检测文件扩展名
64
+ *
65
+ * @param files 要检测的文件列表
66
+ * @param allowedExtensions 允许的扩展名列表
67
+ * @param options 检测选项
68
+ * @returns 检测结果列表
69
+ */
70
+ export declare function detectionFilesByExtension(files: File[], allowedExtensions: TMaybeArray<string>, options?: FileDetectionOptions): Promise<FileDetectionResult[]>;
71
+
72
+ /**
73
+ * 批量检测文件 MIME 类型
74
+ *
75
+ * @param files 要检测的文件列表
76
+ * @param allowedMimes 允许的MIME类型列表
77
+ * @param options 检测选项
78
+ * @returns 检测结果列表
79
+ */
80
+ export declare function detectionFilesByMime(files: File[], allowedMimes: TMaybeArray<string>, options?: FileDetectionOptions): Promise<FileDetectionResult[]>;
81
+
26
82
  export declare enum ECallStatus {
27
83
  /**
28
84
  * 正在接听中
@@ -106,6 +162,40 @@ export declare interface EventBusProps {
106
162
 
107
163
  declare type EventFnc = (...args: any) => void;
108
164
 
165
+ export declare interface FileDetectionOptions {
166
+ /**
167
+ * 最大文件大小(字节)
168
+ */
169
+ maxSize?: number;
170
+ }
171
+
172
+ export declare interface FileDetectionResult {
173
+ /**
174
+ * 是否通过检测
175
+ */
176
+ valid: boolean;
177
+ /**
178
+ * 检测到的真实MIME类型
179
+ */
180
+ detectedMime?: string;
181
+ /**
182
+ * 检测到的文件扩展名
183
+ */
184
+ detectedExt?: string;
185
+ /**
186
+ * 错误信息
187
+ */
188
+ error?: string;
189
+ /**
190
+ * 文件声称的MIME类型(来自File对象)
191
+ */
192
+ claimedMime?: string;
193
+ /**
194
+ * MIME类型是否匹配(真实vs声称)
195
+ */
196
+ mimeMatches?: boolean;
197
+ }
198
+
109
199
  /**
110
200
  * 安全的解析html内容 防止xss攻击
111
201
  * @param input 输入的html内容
@@ -239,6 +329,21 @@ export declare interface ISm4Params {
239
329
  */
240
330
  export declare function isUrlSafe(url: unknown, options?: UrlSanitizeOptions): boolean;
241
331
 
332
+ /**
333
+ * 便捷方法: 检测是否为文档文件(基于 MIME 类型)
334
+ */
335
+ export declare function isValidDocument(file: File, maxSize?: number): Promise<FileDetectionResult>;
336
+
337
+ /**
338
+ * 便捷方法: 检测是否为图片文件(基于 MIME 类型)
339
+ */
340
+ export declare function isValidImage(file: File, maxSize?: number): Promise<FileDetectionResult>;
341
+
342
+ /**
343
+ * 便捷方法: 检测是否为视频文件(基于 MIME 类型)
344
+ */
345
+ export declare function isValidVideo(file: File, maxSize?: number): Promise<FileDetectionResult>;
346
+
242
347
  /**
243
348
  * 请求数据加密
244
349
  * @param publicKey 公钥
@@ -338,10 +443,16 @@ declare interface SipAccount {
338
443
  */
339
444
  export declare const startNoDebugger: () => void;
340
445
 
446
+ export { supportedExtensions }
447
+
448
+ export { supportedMimeTypes }
449
+
341
450
  export declare type TData = _TData | _TData[];
342
451
 
343
452
  declare type _TData = null | undefined | number | string | Record<string, any>;
344
453
 
454
+ export declare type TMaybeArray<T> = T[] | T;
455
+
345
456
  export declare type TNullable<T> = T | null;
346
457
 
347
458
  export declare type TObj<K extends keyof any = string, T = any> = Record<K, T>;
package/dist/main.js CHANGED
@@ -1,25 +1,37 @@
1
- import { useCall as e } from "./src/outside-call/index.js";
2
- import { antiReplyAttackStrategy as a, requestDataEncryption as E, responseDataEncryption as p } from "./src/shield/crypto/index.js";
3
- import { htmlSanitize as s } from "./src/shield/html-sanitize.js";
4
- import { startNoDebugger as n } from "./src/shield/no-debugger.js";
5
- import { isUrlSafe as f, sanitizeUrl as m, sanitizeUrls as x } from "./src/shield/url-sanitize.js";
6
- import { EventBus as g } from "./src/utils/eventBus.js";
7
- import { CallLogger as C } from "./src/outside-call/utils.js";
8
- import { ECallStatus as A, EMIT_EVENT_NAME as D, SIP_CODE_MESSAGE as R, SIP_ERROR_CAUSES as U } from "./src/outside-call/constants.js";
1
+ import { useCall as o } from "./src/outside-call/index.js";
2
+ import { antiReplyAttackStrategy as i, requestDataEncryption as s, responseDataEncryption as a } from "./src/shield/crypto/index.js";
3
+ import { ALLOWED_FILE_TYPES as p, detectFileByExtension as E, detectFileByMime as l, detectionFilesByExtension as m, detectionFilesByMime as x, isValidDocument as f, isValidImage as S, isValidVideo as d } from "./src/shield/file-detection.js";
4
+ import { htmlSanitize as c } from "./src/shield/html-sanitize.js";
5
+ import { startNoDebugger as _ } from "./src/shield/no-debugger.js";
6
+ import { isUrlSafe as D, sanitizeUrl as M, sanitizeUrls as A } from "./src/shield/url-sanitize.js";
7
+ import { EventBus as C } from "./src/utils/eventBus.js";
8
+ import { CallLogger as I } from "./src/outside-call/utils.js";
9
+ import { ECallStatus as L, EMIT_EVENT_NAME as R, SIP_CODE_MESSAGE as T, SIP_ERROR_CAUSES as U } from "./src/outside-call/constants.js";
10
+ import { supportedExtensions as N, supportedMimeTypes as O } from "./vendor/file-type/source/index.js";
9
11
  export {
10
- C as CallLogger,
11
- A as ECallStatus,
12
- D as EMIT_EVENT_NAME,
13
- g as EventBus,
14
- R as SIP_CODE_MESSAGE,
12
+ p as ALLOWED_FILE_TYPES,
13
+ I as CallLogger,
14
+ L as ECallStatus,
15
+ R as EMIT_EVENT_NAME,
16
+ C as EventBus,
17
+ T as SIP_CODE_MESSAGE,
15
18
  U as SIP_ERROR_CAUSES,
16
- a as antiReplyAttackStrategy,
17
- s as htmlSanitize,
18
- f as isUrlSafe,
19
- E as requestDataEncryption,
20
- p as responseDataEncryption,
21
- m as sanitizeUrl,
22
- x as sanitizeUrls,
23
- n as startNoDebugger,
24
- e as useCall
19
+ i as antiReplyAttackStrategy,
20
+ E as detectFileByExtension,
21
+ l as detectFileByMime,
22
+ m as detectionFilesByExtension,
23
+ x as detectionFilesByMime,
24
+ c as htmlSanitize,
25
+ D as isUrlSafe,
26
+ f as isValidDocument,
27
+ S as isValidImage,
28
+ d as isValidVideo,
29
+ s as requestDataEncryption,
30
+ a as responseDataEncryption,
31
+ M as sanitizeUrl,
32
+ A as sanitizeUrls,
33
+ _ as startNoDebugger,
34
+ N as supportedExtensions,
35
+ O as supportedMimeTypes,
36
+ o as useCall
25
37
  };
@@ -1,4 +1,4 @@
1
- import c from "../../commonjs-virtual-dir/index3.js";
1
+ import c from "../../commonjs-virtual-dir/index2.js";
2
2
  const g = {
3
3
  log(e, ...r) {
4
4
  console.log(`%c【${(/* @__PURE__ */ new Date()).toLocaleString()}】`, "color: green; font-weight: bold;", e, ...r);
@@ -1,4 +1,4 @@
1
- import { g as o } from "../../../commonjs-virtual-dir/index2.js";
1
+ import { g as o } from "../../../commonjs-virtual-dir/index3.js";
2
2
  import { dataToStr as r } from "./util.js";
3
3
  const c = "cbc", n = (t, e) => new o.sm4({
4
4
  key: t.key,
@@ -0,0 +1,143 @@
1
+ import { supportedMimeTypes as l, fileTypeFromStream as y } from "../../vendor/file-type/source/index.js";
2
+ import { supportedExtensions as z } from "../../vendor/file-type/source/index.js";
3
+ function d(e) {
4
+ const t = /* @__PURE__ */ new Set();
5
+ for (const r of l)
6
+ r.startsWith(`${e}/`) && t.add(r);
7
+ return t;
8
+ }
9
+ const f = {
10
+ // 图片类型 - 从 supportedMimeTypes 中过滤 image/*
11
+ image: d("image"),
12
+ // 文档类型 - 包含常见办公文档
13
+ document: /* @__PURE__ */ new Set([
14
+ ...Array.from(l).filter(
15
+ (e) => e.includes("pdf") || e.includes("msword") || e.includes("officedocument") || e.includes("ms-excel") || e.includes("ms-powerpoint") || e.includes("opendocument") || e === "text/plain"
16
+ )
17
+ ]),
18
+ // 视频类型 - 从 supportedMimeTypes 中过滤 video/*
19
+ video: d("video"),
20
+ // 音频类型 - 从 supportedMimeTypes 中过滤 audio/*
21
+ audio: d("audio"),
22
+ // 压缩文件
23
+ archive: /* @__PURE__ */ new Set([
24
+ ...Array.from(l).filter(
25
+ (e) => e.includes("zip") || e.includes("rar") || e.includes("7z") || e.includes("tar") || e.includes("gzip") || e.includes("compress")
26
+ )
27
+ ]),
28
+ // 字体文件
29
+ font: d("font"),
30
+ // 模型文件
31
+ model: d("model")
32
+ };
33
+ function M(e, t) {
34
+ return t.some((r) => {
35
+ const i = r.trim();
36
+ if (!i)
37
+ return !1;
38
+ if (i === e)
39
+ return !0;
40
+ if (i.endsWith("/*")) {
41
+ const n = i.slice(0, i.indexOf("/"));
42
+ return e.startsWith(`${n}/`);
43
+ }
44
+ return !1;
45
+ });
46
+ }
47
+ async function p(e, t) {
48
+ const { maxSize: r } = t;
49
+ if (r && e.size > r)
50
+ return {
51
+ valid: !1,
52
+ error: `上传文件大小不能超过 ${(r / 1024 / 1024).toFixed(2)}MB`,
53
+ claimedMime: e.type
54
+ };
55
+ const i = await y(e.stream());
56
+ if (!i)
57
+ return {
58
+ valid: !1,
59
+ error: "无法检测文件类型,可能是不支持的格式或文件已损坏",
60
+ claimedMime: e.type
61
+ };
62
+ const n = i.mime, o = i.ext, c = e.type, s = n === c;
63
+ return !s && c && console.warn("文件MIME类型不匹配", {
64
+ claimed: c,
65
+ detected: n,
66
+ fileName: e.name
67
+ }), {
68
+ detectedMime: n,
69
+ detectedExt: o,
70
+ claimedMime: c,
71
+ mimeMatches: s
72
+ };
73
+ }
74
+ async function u(e, t, r = {}) {
75
+ const i = await p(e, r);
76
+ if ("valid" in i && !i.valid)
77
+ return i;
78
+ const { detectedMime: n, detectedExt: o, claimedMime: c, mimeMatches: s } = i, m = Array.isArray(t) ? t : t.split(",");
79
+ return !n || !M(n, m) ? {
80
+ valid: !1,
81
+ error: `不支持的文件类型: ${n || "未知"}`,
82
+ detectedMime: n,
83
+ detectedExt: o,
84
+ claimedMime: c,
85
+ mimeMatches: s
86
+ } : {
87
+ valid: !0,
88
+ detectedMime: n,
89
+ detectedExt: o,
90
+ claimedMime: c,
91
+ mimeMatches: s
92
+ };
93
+ }
94
+ async function v(e, t, r = {}) {
95
+ const i = await p(e, r);
96
+ if ("valid" in i && !i.valid)
97
+ return i;
98
+ const { detectedMime: n, detectedExt: o, claimedMime: c, mimeMatches: s } = i, m = Array.isArray(t) ? t : t.split(",").map((a) => a.trim());
99
+ return !o || !m.some((a) => o === a || `.${o}` === a) ? {
100
+ valid: !1,
101
+ error: `不支持的文件扩展名: .${o || "未知"}`,
102
+ detectedMime: n,
103
+ detectedExt: o,
104
+ claimedMime: c,
105
+ mimeMatches: s
106
+ } : {
107
+ valid: !0,
108
+ detectedMime: n,
109
+ detectedExt: o,
110
+ claimedMime: c,
111
+ mimeMatches: s
112
+ };
113
+ }
114
+ function A(e, t, r = {}) {
115
+ return Promise.all(e.map((i) => u(i, t, r)));
116
+ }
117
+ function g(e, t, r = {}) {
118
+ return Promise.all(e.map((i) => v(i, t, r)));
119
+ }
120
+ function E(e, t) {
121
+ const r = Array.from(f.image);
122
+ return u(e, r, { maxSize: t });
123
+ }
124
+ function w(e, t) {
125
+ const r = Array.from(f.document);
126
+ return u(e, r, { maxSize: t });
127
+ }
128
+ function F(e, t) {
129
+ const r = Array.from(f.video);
130
+ return u(e, r, { maxSize: t });
131
+ }
132
+ export {
133
+ f as ALLOWED_FILE_TYPES,
134
+ v as detectFileByExtension,
135
+ u as detectFileByMime,
136
+ g as detectionFilesByExtension,
137
+ A as detectionFilesByMime,
138
+ w as isValidDocument,
139
+ E as isValidImage,
140
+ F as isValidVideo,
141
+ z as supportedExtensions,
142
+ l as supportedMimeTypes
143
+ };
@@ -0,0 +1,181 @@
1
+ const g = {
2
+ 128: "€",
3
+ 130: "‚",
4
+ 131: "ƒ",
5
+ 132: "„",
6
+ 133: "…",
7
+ 134: "†",
8
+ 135: "‡",
9
+ 136: "ˆ",
10
+ 137: "‰",
11
+ 138: "Š",
12
+ 139: "‹",
13
+ 140: "Œ",
14
+ 142: "Ž",
15
+ 145: "‘",
16
+ 146: "’",
17
+ 147: "“",
18
+ 148: "”",
19
+ 149: "•",
20
+ 150: "–",
21
+ 151: "—",
22
+ 152: "˜",
23
+ 153: "™",
24
+ 154: "š",
25
+ 155: "›",
26
+ 156: "œ",
27
+ 158: "ž",
28
+ 159: "Ÿ"
29
+ };
30
+ for (const [e, o] of Object.entries(g))
31
+ ;
32
+ let a;
33
+ function w() {
34
+ if (!(typeof globalThis.TextDecoder > "u"))
35
+ return a ?? (a = new globalThis.TextDecoder("utf-8"));
36
+ }
37
+ const d = 32 * 1024, r = 65533;
38
+ function L(e, o = "utf-8") {
39
+ switch (o.toLowerCase()) {
40
+ case "utf-8":
41
+ case "utf8": {
42
+ const n = w();
43
+ return n ? n.decode(e) : T(e);
44
+ }
45
+ case "utf-16le":
46
+ return E(e);
47
+ case "us-ascii":
48
+ case "ascii":
49
+ return m(e);
50
+ case "latin1":
51
+ case "iso-8859-1":
52
+ return v(e);
53
+ case "windows-1252":
54
+ return D(e);
55
+ default:
56
+ throw new RangeError(`Encoding '${o}' not supported`);
57
+ }
58
+ }
59
+ function s(e, o) {
60
+ o.length !== 0 && (e.push(String.fromCharCode.apply(null, o)), o.length = 0);
61
+ }
62
+ function i(e, o, n) {
63
+ o.push(n), o.length >= d && s(e, o);
64
+ }
65
+ function j(e, o, n) {
66
+ if (n <= 65535) {
67
+ i(e, o, n);
68
+ return;
69
+ }
70
+ n -= 65536, i(e, o, 55296 + (n >> 10)), i(e, o, 56320 + (n & 1023));
71
+ }
72
+ function T(e) {
73
+ const o = [], n = [];
74
+ let t = 0;
75
+ for (e.length >= 3 && e[0] === 239 && e[1] === 187 && e[2] === 191 && (t = 3); t < e.length; ) {
76
+ const f = e[t];
77
+ if (f <= 127) {
78
+ i(o, n, f), t++;
79
+ continue;
80
+ }
81
+ if (f < 194 || f > 244) {
82
+ i(o, n, r), t++;
83
+ continue;
84
+ }
85
+ if (f <= 223) {
86
+ if (t + 1 >= e.length) {
87
+ i(o, n, r), t++;
88
+ continue;
89
+ }
90
+ const u = e[t + 1];
91
+ if ((u & 192) !== 128) {
92
+ i(o, n, r), t++;
93
+ continue;
94
+ }
95
+ const l = (f & 31) << 6 | u & 63;
96
+ i(o, n, l), t += 2;
97
+ continue;
98
+ }
99
+ if (f <= 239) {
100
+ if (t + 2 >= e.length) {
101
+ i(o, n, r), t++;
102
+ continue;
103
+ }
104
+ const u = e[t + 1], l = e[t + 2];
105
+ if (!((u & 192) === 128 && (l & 192) === 128 && !(f === 224 && u < 160) && // overlong
106
+ !(f === 237 && u >= 160))) {
107
+ i(o, n, r), t++;
108
+ continue;
109
+ }
110
+ const C = (f & 15) << 12 | (u & 63) << 6 | l & 63;
111
+ i(o, n, C), t += 3;
112
+ continue;
113
+ }
114
+ if (t + 3 >= e.length) {
115
+ i(o, n, r), t++;
116
+ continue;
117
+ }
118
+ const c = e[t + 1], x = e[t + 2], h = e[t + 3];
119
+ if (!((c & 192) === 128 && (x & 192) === 128 && (h & 192) === 128 && !(f === 240 && c < 144) && // overlong
120
+ !(f === 244 && c > 143))) {
121
+ i(o, n, r), t++;
122
+ continue;
123
+ }
124
+ const p = (f & 7) << 18 | (c & 63) << 12 | (x & 63) << 6 | h & 63;
125
+ j(o, n, p), t += 4;
126
+ }
127
+ return s(o, n), o.join("");
128
+ }
129
+ function E(e) {
130
+ const o = [], n = [], t = e.length;
131
+ let f = 0;
132
+ for (; f + 1 < t; ) {
133
+ const c = e[f] | e[f + 1] << 8;
134
+ if (f += 2, c >= 55296 && c <= 56319) {
135
+ if (f + 1 < t) {
136
+ const x = e[f] | e[f + 1] << 8;
137
+ x >= 56320 && x <= 57343 ? (i(o, n, c), i(o, n, x), f += 2) : i(o, n, r);
138
+ } else
139
+ i(o, n, r);
140
+ continue;
141
+ }
142
+ if (c >= 56320 && c <= 57343) {
143
+ i(o, n, r);
144
+ continue;
145
+ }
146
+ i(o, n, c);
147
+ }
148
+ return f < t && i(o, n, r), s(o, n), o.join("");
149
+ }
150
+ function m(e) {
151
+ const o = [];
152
+ for (let n = 0; n < e.length; n += d) {
153
+ const t = Math.min(e.length, n + d), f = new Array(t - n);
154
+ for (let c = n, x = 0; c < t; c++, x++)
155
+ f[x] = e[c] & 127;
156
+ o.push(String.fromCharCode.apply(null, f));
157
+ }
158
+ return o.join("");
159
+ }
160
+ function v(e) {
161
+ const o = [];
162
+ for (let n = 0; n < e.length; n += d) {
163
+ const t = Math.min(e.length, n + d), f = new Array(t - n);
164
+ for (let c = n, x = 0; c < t; c++, x++)
165
+ f[x] = e[c];
166
+ o.push(String.fromCharCode.apply(null, f));
167
+ }
168
+ return o.join("");
169
+ }
170
+ function D(e) {
171
+ const o = [];
172
+ let n = "";
173
+ for (let t = 0; t < e.length; t++) {
174
+ const f = e[t], c = f >= 128 && f <= 159 ? g[f] : void 0;
175
+ n += c ?? String.fromCharCode(f), n.length >= d && (o.push(n), n = "");
176
+ }
177
+ return n && o.push(n), o.join("");
178
+ }
179
+ export {
180
+ L as textDecode
181
+ };
@@ -0,0 +1,21 @@
1
+ class a {
2
+ constructor(e) {
3
+ this.tokenizer = e;
4
+ }
5
+ inflate() {
6
+ const e = this.tokenizer;
7
+ return new ReadableStream({
8
+ async pull(r) {
9
+ const t = new Uint8Array(1024), n = await e.readBuffer(t, { mayBeLess: !0 });
10
+ if (n === 0) {
11
+ r.close();
12
+ return;
13
+ }
14
+ r.enqueue(t.subarray(0, n));
15
+ }
16
+ }).pipeThrough(new DecompressionStream("gzip"));
17
+ }
18
+ }
19
+ export {
20
+ a as GzipHandler
21
+ };