module-develop-kit 1.4.3 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,4 @@
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);
1
+ var r = { exports: {} };
5
2
  export {
6
- i as default
3
+ r as __module
7
4
  };
@@ -1,4 +1,7 @@
1
- var r = { exports: {} };
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);
2
5
  export {
3
- r as __module
6
+ i as default
4
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,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
  };
package/dist/main.d.ts CHANGED
@@ -479,7 +479,7 @@ export declare function requestDataEncryption(publicKey: string, _data?: TData):
479
479
  /**
480
480
  * gcm 加密请求拦截器
481
481
  */
482
- export declare const requestDataGcmCryptoInterceptor: <T>(config: InternalAxiosRequestConfig<T>) => Promise<InternalAxiosRequestConfig<T>>;
482
+ export declare const requestDataGcmCryptoInterceptor: <T>(config: InternalAxiosRequestConfig<T>) => Promise<InternalAxiosRequestConfig<T, any>>;
483
483
 
484
484
  /**
485
485
  * 请求数据通过gcm模式加密
@@ -510,7 +510,7 @@ export declare function responseDataEncryption<T>(stepCb: (_headers: {
510
510
  */
511
511
  export declare const responseDataGcmCryptoInterceptor: <T extends {
512
512
  data: unknown;
513
- }>(response: AxiosResponse<T>) => AxiosResponse<T, any, {}>;
513
+ }>(response: AxiosResponse<T>) => AxiosResponse<T, any, {}, any>;
514
514
 
515
515
  /**
516
516
  * 响应数据通过gcm模式解密
@@ -652,3 +652,45 @@ export declare const useCall: (callBack?: (status: ECallStatus, callStatusText:
652
652
  };
653
653
 
654
654
  export { }
655
+
656
+
657
+
658
+ declare module "axios" {
659
+ export interface InternalAxiosRequestConfig {
660
+ /**
661
+ * 是否启用请求加密
662
+ * @default false
663
+ */
664
+ enableRequestCrypto?: boolean;
665
+
666
+ /**
667
+ * 是否启用响应加密
668
+ * @default false
669
+ */
670
+ enableResponseCrypto?: boolean;
671
+ }
672
+
673
+ // eslint-disable-next-line
674
+ export interface AxiosRequestConfig<D = any> {
675
+ /**
676
+ * 是否启用请求加密
677
+ * @default false
678
+ */
679
+ enableRequestCrypto?: boolean;
680
+
681
+ /**
682
+ * 是否启用响应加密
683
+ * @default false
684
+ */
685
+ enableResponseCrypto?: boolean;
686
+ }
687
+ }
688
+
689
+ declare module "gm-crypt" {
690
+ export class sm4 {
691
+ // eslint-disable-next-line
692
+ public constructor(options: { key: string; iv: string; mode?: "cbc" | "ecb"; cipherType?: "base64" | "text" }) {}
693
+ public encrypt(data: string): string;
694
+ public decrypt(encryptedData: string): string;
695
+ }
696
+ }
@@ -1,4 +1,4 @@
1
- import c from "../../commonjs-virtual-dir/index2.js";
1
+ import c from "../../commonjs-virtual-dir/index3.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/index3.js";
1
+ import { g as o } from "../../../commonjs-virtual-dir/index2.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,
@@ -7,8 +7,8 @@ import { isNullOrUndefined as f } from "../../utils/is.js";
7
7
  import "vue";
8
8
  const g = {
9
9
  install: (e, t) => {
10
- r.init(t), t.router.beforeEach(async (o, c, n) => {
11
- await r.initPublicKey(), n();
10
+ r.init(t), t.router.beforeEach(async (o, c, s) => {
11
+ await r.initPublicKey(), s();
12
12
  });
13
13
  }
14
14
  }, x = (e) => {
@@ -34,8 +34,8 @@ const i = (e, t) => e && (e[t] || e.get(t)) || "", R = async (e) => {
34
34
  d(e.url)
35
35
  );
36
36
  if (e.data = f(e.data) ? e.data : o, r.isEnableResponseCrypto(e)) {
37
- const { publicKey: c, privateKey: n } = K.generateKeyPairHex();
38
- y.set(c, { privateKey: n, timestamp: Date.now() }), e.headers.set(a.gcmPublicKey, c);
37
+ const { publicKey: c, privateKey: s } = K.generateKeyPairHex();
38
+ y.set(c, { privateKey: s, timestamp: Date.now() }), e.headers.set(a.gcmPublicKey, c);
39
39
  }
40
40
  return e.headers.set(t), e;
41
41
  }, H = (e) => {
@@ -49,8 +49,8 @@ const i = (e, t) => e && (e[t] || e.get(t)) || "", R = async (e) => {
49
49
  const o = y.get(t);
50
50
  if (y.delete(t), !o)
51
51
  throw new Error("[gcm-crypto] Private key not found, possible security issue or expired request");
52
- const { privateKey: c } = o, { data: n, ...C } = e.data;
53
- if (f(n))
52
+ const { privateKey: c } = o, { data: s, ...C } = e.data;
53
+ if (f(s))
54
54
  return e;
55
55
  const p = i(e.headers, a.encryptIv), u = i(e.headers, a.encryptKey), m = i(e.headers, a.encryptTag);
56
56
  if (!p || !u || !m)
@@ -59,17 +59,19 @@ const i = (e, t) => e && (e[t] || e.get(t)) || "", R = async (e) => {
59
59
  r.responseBeforeCryptoCallBacks.forEach((b) => {
60
60
  b(e);
61
61
  });
62
- const s = w(c, D(u));
62
+ const n = w(c, D(u));
63
63
  e.data = {
64
64
  ...C,
65
- data: E(s, n, d(e.config.url), {
65
+ data: E(n, s, d(e.config.url), {
66
66
  [a.encryptIv]: p,
67
- [a.encryptKey]: s,
67
+ [a.encryptKey]: n,
68
68
  [a.encryptTag]: m
69
69
  })
70
70
  };
71
- } catch (s) {
72
- throw new Error(`[gcm-crypto] Decryption failed: ${s instanceof Error ? s.message : String(s)}`);
71
+ } catch (n) {
72
+ throw new Error(`[gcm-crypto] Decryption failed: ${n instanceof Error ? n.message : String(n)}`, {
73
+ cause: n
74
+ });
73
75
  }
74
76
  return e;
75
77
  };
@@ -1,11 +1,11 @@
1
- import { sm4 as d } from "../../../vendor/sm-crypto-v2/dist/index.js";
1
+ import { sm4 as u } from "../../../vendor/sm-crypto-v2/dist/index.js";
2
2
  import { EGcmHeaderKey as r } from "./constants.js";
3
- import { generateHex as y, dataToStr as T, stringToUtf8Bytes as u, bytesToBase64 as m, hexToBase64 as f, sm2Encrypt as E, base64ToHex as i, utf8BytesToString as S } from "./utils.js";
4
- const v = (s, c, n) => {
5
- const t = y(12), e = y(16), { output: o, tag: a } = d.encrypt(T(c), e, {
3
+ import { generateHex as y, dataToStr as T, stringToUtf8Bytes as d, bytesToBase64 as m, hexToBase64 as f, sm2Encrypt as E, base64ToHex as i, utf8BytesToString as S } from "./utils.js";
4
+ const v = (c, n, p) => {
5
+ const t = y(12), e = y(16), { output: o, tag: a } = u.encrypt(T(n), e, {
6
6
  mode: "gcm",
7
7
  iv: t,
8
- associatedData: u(`uri=${n}`),
8
+ associatedData: d(`uri=${p}`),
9
9
  output: "array",
10
10
  outputTag: !0
11
11
  });
@@ -15,25 +15,26 @@ const v = (s, c, n) => {
15
15
  headers: {
16
16
  [r.encryptIv]: t,
17
17
  [r.encryptTag]: m(a),
18
- [r.encryptKey]: f(E(s, e))
18
+ [r.encryptKey]: f(E(c, e))
19
19
  },
20
20
  data: {
21
21
  body: m(o)
22
22
  }
23
23
  };
24
- }, w = (s, c, n, t) => {
25
- const e = t[r.encryptIv], o = i(t[r.encryptTag]), a = d.decrypt(i(c), s, {
24
+ }, w = (c, n, p, t) => {
25
+ const e = t[r.encryptIv], o = i(t[r.encryptTag]), a = u.decrypt(i(n), c, {
26
26
  mode: "gcm",
27
27
  iv: e,
28
- associatedData: u(`uri=${n}`),
28
+ associatedData: d(`uri=${p}`),
29
29
  output: "array",
30
30
  tag: o
31
31
  }), g = S(a);
32
32
  try {
33
33
  return JSON.parse(g);
34
- } catch (p) {
34
+ } catch (s) {
35
35
  throw new Error(
36
- `[gcm-crypto] Failed to parse decrypted data as JSON: ${p instanceof Error ? p.message : String(p)}`
36
+ `[gcm-crypto] Failed to parse decrypted data as JSON: ${s instanceof Error ? s.message : String(s)}`,
37
+ { cause: s }
37
38
  );
38
39
  }
39
40
  };
@@ -1,5 +1,5 @@
1
1
  import { UINT32_LE as h, StringType as k } from "../../../token-types/lib/index.js";
2
- import D from "../../../../commonjs-virtual-dir/browser.js";
2
+ import D from "../../../../commonjs-virtual-dir/browser2.js";
3
3
  import { Signature as c, EndOfCentralDirectoryRecordToken as L, FileHeader as E, DataDescriptor as y, LocalFileHeaderToken as S } from "./ZipToken.js";
4
4
  function m(s) {
5
5
  const t = new Uint8Array(h.len);
@@ -1,4 +1,4 @@
1
- import { __module as C } from "../../../commonjs-virtual-dir/browser2.js";
1
+ import { __module as C } from "../../../commonjs-virtual-dir/browser.js";
2
2
  import { __require as g } from "./common.js";
3
3
  var F;
4
4
  function p() {
@@ -1,7 +1,7 @@
1
- import { UINT32_LE as h } from "../../../token-types/lib/index.js";
2
- import { EndOfStreamError as T } from "../../../strtok3/lib/stream/Errors.js";
1
+ import { UINT32_LE as x } from "../../../token-types/lib/index.js";
2
+ import { EndOfStreamError as k } from "../../../strtok3/lib/stream/Errors.js";
3
3
  import { ZipHandler as y } from "../../../@tokenizer/inflate/lib/ZipHandler.js";
4
- import { hasUnknownFileSize as f, ParserHardLimitError as x, hasExceededUnknownSizeScanBudget as w, maximumUntrustedSkipSizeInBytes as u, safeIgnore as C } from "../parser.js";
4
+ import { ParserHardLimitError as l, hasUnknownFileSize as h, hasExceededUnknownSizeScanBudget as w, maximumUntrustedSkipSizeInBytes as u, safeIgnore as C } from "../parser.js";
5
5
  const d = 1024 * 1024, E = 1024, F = 2 ** 31 - 1, D = d, P = /* @__PURE__ */ new Set([
6
6
  "Unexpected signature",
7
7
  "Encrypted ZIP",
@@ -19,42 +19,46 @@ const d = 1024 * 1024, E = 1024, F = 2 ** 31 - 1, D = d, P = /* @__PURE__ */ new
19
19
  ]);
20
20
  async function z(e, { maximumLength: t = d } = {}) {
21
21
  const i = new ReadableStream({
22
- start(c) {
23
- c.enqueue(e), c.close();
22
+ start(a) {
23
+ a.enqueue(e), a.close();
24
24
  }
25
25
  }).pipeThrough(new DecompressionStream("deflate-raw")).getReader(), s = [];
26
- let o = 0;
26
+ let c = 0;
27
27
  try {
28
28
  for (; ; ) {
29
- const { done: c, value: m } = await i.read();
30
- if (c)
29
+ const { done: a, value: m } = await i.read();
30
+ if (a)
31
31
  break;
32
- if (o += m.length, o > t)
33
- throw await i.cancel(), new Error(`ZIP entry decompressed data exceeds ${t} bytes`);
32
+ if (c += m.length, c > t)
33
+ throw await i.cancel().catch(() => {
34
+ }), new Error(`ZIP entry decompressed data exceeds ${t} bytes`);
34
35
  s.push(m);
35
36
  }
37
+ } catch (a) {
38
+ if (a.code !== "ERR_TRAILING_JUNK_AFTER_STREAM_END")
39
+ throw a;
36
40
  } finally {
37
41
  i.releaseLock();
38
42
  }
39
- const a = new Uint8Array(o);
43
+ const o = new Uint8Array(c);
40
44
  let p = 0;
41
- for (const c of s)
42
- a.set(c, p), p += c.length;
43
- return a;
45
+ for (const a of s)
46
+ o.set(a, p), p += a.length;
47
+ return o;
44
48
  }
45
- function L(e, t) {
49
+ function R(e, t) {
46
50
  const r = new Uint8Array(t);
47
51
  let n = 0;
48
52
  for (const i of e)
49
53
  r.set(i, n), n += i.length;
50
54
  return r;
51
55
  }
52
- function R(e) {
56
+ function L(e) {
53
57
  const t = e.fileInfo.size, r = Number.isFinite(t) ? Math.max(0, t - e.position) : Number.MAX_SAFE_INTEGER;
54
58
  return Math.min(r, F);
55
59
  }
56
- function U(e) {
57
- if (e instanceof T || e instanceof x)
60
+ function _(e) {
61
+ if (e instanceof k || e instanceof l)
58
62
  return !0;
59
63
  if (!(e instanceof Error))
60
64
  return !1;
@@ -72,7 +76,7 @@ function v(e, t = d) {
72
76
  return !1;
73
77
  return !0;
74
78
  }
75
- function O() {
79
+ function U() {
76
80
  return {
77
81
  hasDocumentEntry: !1,
78
82
  hasMasterSlideEntry: !1,
@@ -87,7 +91,7 @@ function b(e) {
87
91
  if (e.hasDocumentEntry)
88
92
  return e.hasMasterSlideEntry ? { ext: "key", mime: "application/vnd.apple.keynote" } : e.hasTablesEntry ? { ext: "numbers", mime: "application/vnd.apple.numbers" } : { ext: "pages", mime: "application/vnd.apple.pages" };
89
93
  }
90
- function k(e) {
94
+ function T(e) {
91
95
  switch (e = e.toLowerCase(), e) {
92
96
  case "application/epub+zip":
93
97
  return { ext: "epub", mime: e };
@@ -141,7 +145,7 @@ function k(e) {
141
145
  return { ext: "3mf", mime: "model/3mf" };
142
146
  }
143
147
  }
144
- function _() {
148
+ function O() {
145
149
  return {
146
150
  hasContentTypesEntry: !1,
147
151
  hasParsedContentTypesEntry: !1,
@@ -153,7 +157,7 @@ function _() {
153
157
  hasThreeDimensionalModelEntry: !1
154
158
  };
155
159
  }
156
- function W(e, t) {
160
+ function N(e, t) {
157
161
  t.startsWith("word/") && (e.hasWordDirectory = !0), t.startsWith("ppt/") && (e.hasPresentationDirectory = !0), t.startsWith("xl/") && (e.hasSpreadsheetDirectory = !0), t.startsWith("3D/") && t.endsWith(".model") && (e.hasThreeDimensionalModelEntry = !0);
158
162
  }
159
163
  function Z(e) {
@@ -182,7 +186,7 @@ function I(e) {
182
186
  if (!(!e.hasContentTypesEntry || e.hasUnparseableContentTypes || e.isParsingContentTypes || e.hasParsedContentTypesEntry))
183
187
  return Z(e);
184
188
  }
185
- function N(e) {
189
+ function W(e) {
186
190
  const t = e.indexOf('.main+xml"');
187
191
  if (t === -1) {
188
192
  const i = "application/vnd.ms-package.3dmanufacturing-3dmodel+xml";
@@ -191,25 +195,25 @@ function N(e) {
191
195
  const r = e.slice(0, t), n = r.lastIndexOf('"');
192
196
  return r.slice(n + 1);
193
197
  }
194
- const S = 134695760, l = 16, $ = l - 1;
198
+ const S = 134695760, f = 16, $ = f - 1;
195
199
  function j(e, t) {
196
- if (e.length < l)
200
+ if (e.length < f)
197
201
  return -1;
198
- const r = e.length - l;
202
+ const r = e.length - f;
199
203
  for (let n = 0; n <= r; n++)
200
- if (h.get(e, n) === S && h.get(e, n + 8) === t + n)
204
+ if (x.get(e, n) === S && x.get(e, n + 8) === t + n)
201
205
  return n;
202
206
  return -1;
203
207
  }
204
- async function q(e, { shouldBuffer: t, maximumLength: r = d } = {}) {
208
+ async function G(e, { shouldBuffer: t, maximumLength: r = d } = {}) {
205
209
  const { syncBuffer: n } = e, { length: i } = n, s = [];
206
- let o = 0;
210
+ let c = 0;
207
211
  for (; ; ) {
208
- const a = await e.tokenizer.peekBuffer(n, { mayBeLess: !0 }), p = j(n.subarray(0, a), o), c = p >= 0 ? 0 : a === i ? Math.min($, a - 1) : 0, m = p >= 0 ? p : a - c;
212
+ const o = await e.tokenizer.peekBuffer(n, { mayBeLess: !0 }), p = j(n.subarray(0, o), c), a = p >= 0 ? 0 : o === i ? Math.min($, o - 1) : 0, m = p >= 0 ? p : o - a;
209
213
  if (m === 0)
210
214
  break;
211
- if (o += m, o > r)
212
- throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);
215
+ if (c += m, c > r)
216
+ throw new l(`ZIP entry data descriptor not found within ${r} bytes`);
213
217
  if (t) {
214
218
  const g = new Uint8Array(m);
215
219
  await e.tokenizer.readBuffer(g), s.push(g);
@@ -218,26 +222,26 @@ async function q(e, { shouldBuffer: t, maximumLength: r = d } = {}) {
218
222
  if (p >= 0)
219
223
  break;
220
224
  }
221
- if (f(e.tokenizer) || (e.knownSizeDescriptorScannedBytes += o), !!t)
222
- return L(s, o);
225
+ if (h(e.tokenizer) || (e.knownSizeDescriptorScannedBytes += c), !!t)
226
+ return R(s, c);
223
227
  }
224
- function G(e, t) {
225
- return f(e.tokenizer) ? Math.max(0, u - (e.tokenizer.position - t)) : Math.max(0, d - e.knownSizeDescriptorScannedBytes);
228
+ function q(e, t) {
229
+ return h(e.tokenizer) ? Math.max(0, u - (e.tokenizer.position - t)) : Math.max(0, d - e.knownSizeDescriptorScannedBytes);
226
230
  }
227
- async function Q(e, t, { shouldBuffer: r, maximumDescriptorLength: n = d } = {}) {
231
+ async function J(e, t, { shouldBuffer: r, maximumDescriptorLength: n = d } = {}) {
228
232
  if (t.dataDescriptor && t.compressedSize === 0)
229
- return q(e, {
233
+ return G(e, {
230
234
  shouldBuffer: r,
231
235
  maximumLength: n
232
236
  });
233
237
  if (!r) {
234
238
  await C(e.tokenizer, t.compressedSize, {
235
- maximumLength: f(e.tokenizer) ? d : e.tokenizer.fileInfo.size,
239
+ maximumLength: h(e.tokenizer) ? d : e.tokenizer.fileInfo.size,
236
240
  reason: "ZIP entry compressed data"
237
241
  });
238
242
  return;
239
243
  }
240
- const i = R(e.tokenizer);
244
+ const i = L(e.tokenizer);
241
245
  if (!Number.isFinite(t.compressedSize) || t.compressedSize < 0 || t.compressedSize > i)
242
246
  throw new Error(`ZIP entry compressed data exceeds ${i} bytes`);
243
247
  const s = new Uint8Array(t.compressedSize);
@@ -257,7 +261,7 @@ y.prototype.unzip = async function(e) {
257
261
  this.knownSizeDescriptorScannedBytes = 0;
258
262
  do {
259
263
  if (w(this.tokenizer, n, u))
260
- throw new x(`ZIP stream probing exceeds ${u} bytes`);
264
+ throw new l(`ZIP stream probing exceeds ${u} bytes`);
261
265
  const i = await this.readLocalFileHeader();
262
266
  if (!i)
263
267
  break;
@@ -265,29 +269,29 @@ y.prototype.unzip = async function(e) {
265
269
  throw new Error(`ZIP entry count exceeds ${E}`);
266
270
  const s = e(i);
267
271
  t = !!s.stop, await this.tokenizer.ignore(i.extraFieldLength);
268
- const o = await Q(this, i, {
272
+ const c = await J(this, i, {
269
273
  shouldBuffer: !!s.handler,
270
- maximumDescriptorLength: Math.min(d, G(this, n))
274
+ maximumDescriptorLength: Math.min(d, q(this, n))
271
275
  });
272
- if (s.handler && await this.inflate(i, o, s.handler), i.dataDescriptor) {
273
- const a = new Uint8Array(l);
274
- if (await this.tokenizer.readBuffer(a), h.get(a, 0) !== S)
275
- throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position - a.length}`);
276
+ if (s.handler && await this.inflate(i, c, s.handler), i.dataDescriptor) {
277
+ const o = new Uint8Array(f);
278
+ if (await this.tokenizer.readBuffer(o), x.get(o, 0) !== S)
279
+ throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position - o.length}`);
276
280
  }
277
281
  if (w(this.tokenizer, n, u))
278
- throw new x(`ZIP stream probing exceeds ${u} bytes`);
282
+ throw new l(`ZIP stream probing exceeds ${u} bytes`);
279
283
  } while (!t);
280
284
  };
281
285
  async function Y(e) {
282
286
  let t;
283
- const r = _(), n = O();
287
+ const r = O(), n = U();
284
288
  try {
285
289
  await new y(e).unzip((s) => {
286
- if (W(r, s.filename), A(n, s.filename), n.hasDocumentEntry && (n.hasMasterSlideEntry || n.hasTablesEntry))
290
+ if (N(r, s.filename), A(n, s.filename), n.hasDocumentEntry && (n.hasMasterSlideEntry || n.hasTablesEntry))
287
291
  return t = b(n), { stop: !0 };
288
- const o = s.filename === "[Content_Types].xml", a = I(r);
289
- if (!o && a)
290
- return t = a, {
292
+ const c = s.filename === "[Content_Types].xml", o = I(r);
293
+ if (!c && o)
294
+ return t = o, {
291
295
  stop: !0
292
296
  };
293
297
  switch (s.filename) {
@@ -308,16 +312,16 @@ async function Y(e) {
308
312
  case "mimetype":
309
313
  return v(s, D) ? {
310
314
  async handler(p) {
311
- const c = new TextDecoder("utf-8").decode(p).trim();
312
- t = k(c);
315
+ const a = new TextDecoder("utf-8").decode(p).trim();
316
+ t = T(a);
313
317
  },
314
318
  stop: !0
315
319
  } : {};
316
320
  case "[Content_Types].xml":
317
321
  return r.hasContentTypesEntry = !0, v(s, D) ? (r.isParsingContentTypes = !0, {
318
322
  async handler(p) {
319
- const c = new TextDecoder("utf-8").decode(p), m = N(c);
320
- m && (t = k(m)), r.hasParsedContentTypesEntry = !0, r.isParsingContentTypes = !1;
323
+ const a = new TextDecoder("utf-8").decode(p), m = W(a);
324
+ m && (t = T(m)), r.hasParsedContentTypesEntry = !0, r.isParsingContentTypes = !1;
321
325
  },
322
326
  stop: !0
323
327
  }) : (r.hasUnparseableContentTypes = !0, {});
@@ -329,11 +333,11 @@ async function Y(e) {
329
333
  }
330
334
  });
331
335
  } catch (s) {
332
- if (!U(s))
336
+ if (!_(s))
333
337
  throw s;
334
- r.isParsingContentTypes && (r.isParsingContentTypes = !1, r.hasUnparseableContentTypes = !0), !t && s instanceof T && !r.hasContentTypesEntry && (t = Z(r));
338
+ r.isParsingContentTypes && (r.isParsingContentTypes = !1, r.hasUnparseableContentTypes = !0), !t && (s instanceof k || s instanceof l) && !r.hasContentTypesEntry && (t = Z(r));
335
339
  }
336
- const i = f(e) && n.hasDocumentEntry && !n.hasMasterSlideEntry && !n.hasTablesEntry && !n.hasCalculationEngineEntry ? void 0 : b(n);
340
+ const i = h(e) && n.hasDocumentEntry && !n.hasMasterSlideEntry && !n.hasTablesEntry && !n.hasCalculationEngineEntry ? void 0 : b(n);
337
341
  return t ?? I(r) ?? i ?? {
338
342
  ext: "zip",
339
343
  mime: "application/zip"
@@ -1,9 +1,9 @@
1
- import { UINT32_BE as T, UINT16_BE as p, StringType as S, UINT16_LE as g, UINT32_LE as C } from "../../token-types/lib/index.js";
2
- import { fromWebStream as z, fromBuffer as I, fromBlob as M } from "../../strtok3/lib/core.js";
1
+ import { UINT32_BE as T, UINT16_BE as p, StringType as S, UINT16_LE as g, UINT32_LE as z } from "../../token-types/lib/index.js";
2
+ import { fromWebStream as I, fromBuffer as M, fromBlob as O } from "../../strtok3/lib/core.js";
3
3
  import "../../@tokenizer/inflate/lib/ZipHandler.js";
4
- import { GzipHandler as O } from "../../@tokenizer/inflate/lib/GzipHandler.js";
5
- import { concatUint8Arrays as P } from "../../uint8array-extras/index.js";
6
- import { stringToBytes as j, uint32SyncSafeToken as R, tarHeaderChecksumMatches as L } from "./tokens.js";
4
+ import { GzipHandler as P } from "../../@tokenizer/inflate/lib/GzipHandler.js";
5
+ import { concatUint8Arrays as j } from "../../uint8array-extras/index.js";
6
+ import { stringToBytes as A, uint32SyncSafeToken as L, tarHeaderChecksumMatches as R } from "./tokens.js";
7
7
  import { mimeTypes as N, extensions as U } from "./supported.js";
8
8
  import { ParserHardLimitError as q, hasUnknownFileSize as l, checkBytes as h, safeIgnore as F, maximumUntrustedSkipSizeInBytes as b } from "./parser.js";
9
9
  import { detectZip as G } from "./detectors/zip.js";
@@ -11,71 +11,75 @@ import { detectEbml as _ } from "./detectors/ebml.js";
11
11
  import { detectPng as H } from "./detectors/png.js";
12
12
  import { detectAsf as V } from "./detectors/asf.js";
13
13
  import { EndOfStreamError as d } from "../../strtok3/lib/stream/Errors.js";
14
- const k = 4100, W = k - 2, $ = b, K = 1, A = 100, w = b, X = 512, v = 256, Z = 1024 * 1024, B = b;
15
- function J(n) {
16
- return Number.isFinite(n) ? Math.max(1, Math.trunc(n)) : k;
14
+ const k = 4100, W = k - 4, $ = b, K = 1, B = 100, w = b, X = 512, v = 256, Z = 1024 * 1024, D = b;
15
+ function J(s) {
16
+ return Number.isFinite(s) ? Math.max(1, Math.trunc(s)) : k;
17
17
  }
18
- function Q(n) {
19
- return Number.isFinite(n) ? Math.max(0, Math.min(W, Math.trunc(n))) : 0;
18
+ function Q(s) {
19
+ return Number.isFinite(s) ? Math.max(0, Math.min(W, Math.trunc(s))) : 0;
20
20
  }
21
- function Y(n) {
22
- return Number.isFinite(n) ? Math.max(0, n) : Number.MAX_SAFE_INTEGER;
21
+ function Y(s) {
22
+ return Number.isFinite(s) ? Math.max(0, s) : Number.MAX_SAFE_INTEGER;
23
23
  }
24
- function D(n) {
25
- return import(n);
24
+ function E(s) {
25
+ return import(
26
+ /* @vite-ignore */
27
+ /* webpackIgnore: true */
28
+ s
29
+ );
26
30
  }
27
- function ee(n) {
28
- return n.pipeThrough(new TransformStream());
31
+ function ee(s) {
32
+ return s.pipeThrough(new TransformStream());
29
33
  }
30
- function E(n, e) {
31
- return e === void 0 ? n.read() : (e.throwIfAborted(), Promise.race([
32
- n.read(),
33
- new Promise((t, i) => {
34
+ function C(s, e) {
35
+ return e === void 0 ? s.read() : (e.throwIfAborted(), Promise.race([
36
+ s.read(),
37
+ new Promise((i, r) => {
34
38
  e.addEventListener("abort", () => {
35
- i(e.reason), n.cancel(e.reason).catch(() => {
39
+ r(e.reason), s.cancel(e.reason).catch(() => {
36
40
  });
37
41
  }, { once: !0 });
38
42
  })
39
43
  ]));
40
44
  }
41
- function te(n, e) {
42
- const t = n.getReader();
43
- let i = 0, r = !1, s = !1;
45
+ function te(s, e) {
46
+ const i = s.getReader();
47
+ let r = 0, t = !1, n = !1;
44
48
  const c = async (x) => {
45
- r || s || (s = !0, await t.cancel(x));
49
+ t || n || (n = !0, await i.cancel(x));
46
50
  };
47
51
  return new ReadableStream({
48
52
  async pull(x) {
49
- if (i >= e) {
53
+ if (r >= e) {
50
54
  x.close(), await c();
51
55
  return;
52
56
  }
53
- const { done: f, value: a } = await t.read();
57
+ const { done: f, value: a } = await i.read();
54
58
  if (f || !a) {
55
- r = !0, x.close();
59
+ t = !0, x.close();
56
60
  return;
57
61
  }
58
- const u = e - i;
62
+ const u = e - r;
59
63
  if (a.length > u) {
60
- x.enqueue(a.subarray(0, u)), i += u, x.close(), await c();
64
+ x.enqueue(a.subarray(0, u)), r += u, x.close(), await c();
61
65
  return;
62
66
  }
63
- x.enqueue(a), i += a.length;
67
+ x.enqueue(a), r += a.length;
64
68
  },
65
69
  async cancel(x) {
66
70
  await c(x);
67
71
  }
68
72
  });
69
73
  }
70
- async function le(n, e) {
71
- return new y(e).fromStream(n);
74
+ async function le(s, e) {
75
+ return new y(e).fromStream(s);
72
76
  }
73
77
  class y {
74
78
  constructor(e) {
75
- const t = Q(e?.mpegOffsetTolerance);
79
+ const i = Q(e?.mpegOffsetTolerance);
76
80
  this.options = {
77
81
  ...e,
78
- mpegOffsetTolerance: t
82
+ mpegOffsetTolerance: i
79
83
  }, this.detectors = [
80
84
  ...this.options.customDetectors ?? [],
81
85
  { id: "core", detect: this.detectConfident },
@@ -90,23 +94,23 @@ class y {
90
94
  };
91
95
  }
92
96
  createTokenizerFromWebStream(e) {
93
- return z(ee(e), this.getTokenizerOptions());
97
+ return I(ee(e), this.getTokenizerOptions());
94
98
  }
95
- async parseTokenizer(e, t = 0) {
96
- this.detectionReentryCount = t;
97
- const i = e.position;
98
- for (const r of this.detectors) {
99
- let s;
99
+ async parseTokenizer(e, i = 0) {
100
+ this.detectionReentryCount = i;
101
+ const r = e.position;
102
+ for (const t of this.detectors) {
103
+ let n;
100
104
  try {
101
- s = await r.detect(e);
105
+ n = await t.detect(e);
102
106
  } catch (c) {
103
107
  if (c instanceof d || c instanceof q)
104
108
  return;
105
109
  throw c;
106
110
  }
107
- if (s)
108
- return s;
109
- if (i !== e.position)
111
+ if (n)
112
+ return n;
113
+ if (r !== e.position)
110
114
  return;
111
115
  }
112
116
  }
@@ -120,68 +124,68 @@ class y {
120
124
  async fromBuffer(e) {
121
125
  if (!(e instanceof Uint8Array || e instanceof ArrayBuffer))
122
126
  throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);
123
- const t = e instanceof Uint8Array ? e : new Uint8Array(e);
124
- if (t?.length > 1)
125
- return this.fromTokenizer(I(t, this.getTokenizerOptions()));
127
+ const i = e instanceof Uint8Array ? e : new Uint8Array(e);
128
+ if (i?.length > 1)
129
+ return this.fromTokenizer(M(i, this.getTokenizerOptions()));
126
130
  }
127
131
  async fromBlob(e) {
128
132
  this.options.signal?.throwIfAborted();
129
- const t = M(e, this.getTokenizerOptions());
130
- return this.fromTokenizer(t);
133
+ const i = O(e, this.getTokenizerOptions());
134
+ return this.fromTokenizer(i);
131
135
  }
132
136
  async fromStream(e) {
133
137
  this.options.signal?.throwIfAborted();
134
- const t = this.createTokenizerFromWebStream(e);
135
- return this.fromTokenizer(t);
138
+ const i = this.createTokenizerFromWebStream(e);
139
+ return this.fromTokenizer(i);
136
140
  }
137
141
  async fromFile(e) {
138
142
  this.options.signal?.throwIfAborted();
139
- const [{ default: t }, { FileTokenizer: i }] = await Promise.all([
140
- D("node:fs/promises"),
141
- D("strtok3")
142
- ]), r = await t.open(e, t.constants.O_RDONLY | t.constants.O_NONBLOCK), s = await r.stat();
143
- if (!s.isFile()) {
144
- await r.close();
143
+ const [{ default: i }, { FileTokenizer: r }] = await Promise.all([
144
+ E("node:fs/promises"),
145
+ E("strtok3")
146
+ ]), t = await i.open(e, i.constants.O_RDONLY | i.constants.O_NONBLOCK), n = await t.stat();
147
+ if (!n.isFile()) {
148
+ await t.close();
145
149
  return;
146
150
  }
147
- const c = new i(r, {
151
+ const c = new r(t, {
148
152
  ...this.getTokenizerOptions(),
149
- fileInfo: { path: e, size: s.size }
153
+ fileInfo: { path: e, size: n.size }
150
154
  });
151
155
  return this.fromTokenizer(c);
152
156
  }
153
- async toDetectionStream(e, t) {
157
+ async toDetectionStream(e, i) {
154
158
  this.options.signal?.throwIfAborted();
155
- const i = J(t?.sampleSize ?? k);
156
- let r, s = !1;
159
+ const r = J(i?.sampleSize ?? k);
160
+ let t, n = !1;
157
161
  const c = e.getReader(), x = [];
158
162
  let f = 0;
159
163
  try {
160
- for (; f < i; ) {
161
- const { value: m, done: o } = await E(c, this.options.signal);
164
+ for (; f < r; ) {
165
+ const { value: m, done: o } = await C(c, this.options.signal);
162
166
  if (o || !m) {
163
- s = !0;
167
+ n = !0;
164
168
  break;
165
169
  }
166
170
  x.push(m), f += m.length;
167
171
  }
168
- if (!s && f === i) {
169
- const { value: m, done: o } = await E(c, this.options.signal);
170
- o || !m ? s = !0 : (x.push(m), f += m.length);
172
+ if (!n && f === r) {
173
+ const { value: m, done: o } = await C(c, this.options.signal);
174
+ o || !m ? n = !0 : (x.push(m), f += m.length);
171
175
  }
172
176
  } finally {
173
177
  c.releaseLock();
174
178
  }
175
179
  if (f > 0) {
176
- const m = x.length === 1 ? x[0] : P(x);
180
+ const m = x.length === 1 ? x[0] : j(x);
177
181
  try {
178
- r = await this.fromBuffer(m.subarray(0, i));
182
+ t = await this.fromBuffer(m.subarray(0, r));
179
183
  } catch (o) {
180
184
  if (!(o instanceof d))
181
185
  throw o;
182
- r = void 0;
186
+ t = void 0;
183
187
  }
184
- !s && r?.ext === "pages" && (r = {
188
+ !n && t?.ext === "pages" && (t = {
185
189
  ext: "zip",
186
190
  mime: "application/zip"
187
191
  });
@@ -195,7 +199,7 @@ class y {
195
199
  o.enqueue(m);
196
200
  }
197
201
  }), u = e.pipeThrough(a);
198
- return u.fileType = r, u;
202
+ return u.fileType = t, u;
199
203
  }
200
204
  async detectGzip(e) {
201
205
  if (this.gzipProbeDepth >= K)
@@ -203,25 +207,25 @@ class y {
203
207
  ext: "gz",
204
208
  mime: "application/gzip"
205
209
  };
206
- const t = new O(e), i = te(t.inflate(), $), r = l(e);
207
- let s, c, x, f;
208
- if (r) {
210
+ const i = new P(e), r = te(i.inflate(), $), t = l(e);
211
+ let n, c, x, f;
212
+ if (t) {
209
213
  const a = new AbortController();
210
- s = setTimeout(() => {
211
- a.abort(new DOMException(`Operation timed out after ${A} ms`, "TimeoutError"));
212
- }, A), c = this.options.signal === void 0 ? a.signal : AbortSignal.any([this.options.signal, a.signal]), x = new y({
214
+ n = setTimeout(() => {
215
+ a.abort(new DOMException(`Operation timed out after ${B} ms`, "TimeoutError"));
216
+ }, B), c = this.options.signal === void 0 ? a.signal : AbortSignal.any([this.options.signal, a.signal]), x = new y({
213
217
  ...this.options,
214
218
  signal: c
215
219
  }), x.gzipProbeDepth = this.gzipProbeDepth + 1;
216
220
  } else
217
221
  this.gzipProbeDepth++;
218
222
  try {
219
- f = await (x ?? this).fromStream(i);
223
+ f = await (x ?? this).fromStream(r);
220
224
  } catch (a) {
221
225
  if (a?.name === "AbortError" && c?.reason?.name !== "TimeoutError")
222
226
  throw a;
223
227
  } finally {
224
- clearTimeout(s), r || this.gzipProbeDepth--;
228
+ clearTimeout(n), t || this.gzipProbeDepth--;
225
229
  }
226
230
  return f?.ext === "tar" ? {
227
231
  ext: "tar.gz",
@@ -231,11 +235,11 @@ class y {
231
235
  mime: "application/gzip"
232
236
  };
233
237
  }
234
- check(e, t) {
235
- return h(this.buffer, e, t);
238
+ check(e, i) {
239
+ return h(this.buffer, e, i);
236
240
  }
237
- checkString(e, t) {
238
- return this.check(j(e, t?.encoding), t);
241
+ checkString(e, i) {
242
+ return this.check(A(e, i?.encoding), i);
239
243
  }
240
244
  // Detections with a high degree of certainty in identifying the correct file type
241
245
  detectConfident = async (e) => {
@@ -308,23 +312,23 @@ class y {
308
312
  maximumLength: 6,
309
313
  reason: "ID3 header prefix"
310
314
  });
311
- const t = await e.readToken(R), i = l(e);
312
- if (!Number.isFinite(t) || t < 0 || i && (t > w || e.position + t > w))
315
+ const t = await e.readToken(L), n = l(e);
316
+ if (!Number.isFinite(t) || t < 0 || n && (t > w || e.position + t > w))
313
317
  return;
314
318
  if (e.position + t > e.fileInfo.size)
315
- return i ? void 0 : {
319
+ return n ? void 0 : {
316
320
  ext: "mp3",
317
321
  mime: "audio/mpeg"
318
322
  };
319
323
  try {
320
324
  await F(e, t, {
321
- maximumLength: i ? w : e.fileInfo.size,
325
+ maximumLength: n ? w : e.fileInfo.size,
322
326
  reason: "ID3 payload"
323
327
  });
324
- } catch (r) {
325
- if (r instanceof d)
328
+ } catch (c) {
329
+ if (c instanceof d)
326
330
  return;
327
- throw r;
331
+ throw c;
328
332
  }
329
333
  return this.detectionReentryCount >= v ? void 0 : (this.detectionReentryCount++, this.parseTokenizer(e, this.detectionReentryCount));
330
334
  }
@@ -608,13 +612,13 @@ class y {
608
612
  mime: "application/vnd.ms-htmlhelp"
609
613
  };
610
614
  if (this.check([202, 254, 186, 190])) {
611
- const t = T.get(this.buffer, 4), i = p.get(this.buffer, 6);
615
+ const t = T.get(this.buffer, 4), n = p.get(this.buffer, 6);
612
616
  if (t > 0 && t <= 30)
613
617
  return {
614
618
  ext: "macho",
615
619
  mime: "application/x-mach-binary"
616
620
  };
617
- if (i > 30)
621
+ if (n > 30)
618
622
  return {
619
623
  ext: "class",
620
624
  mime: "application/java-vm"
@@ -893,8 +897,8 @@ class y {
893
897
  const t = new DataView(this.buffer.buffer).getUint32(12, !0);
894
898
  if (t > 12 && this.buffer.length >= t + 16)
895
899
  try {
896
- const i = new TextDecoder().decode(this.buffer.subarray(16, t + 16));
897
- if (JSON.parse(i).files)
900
+ const n = new TextDecoder().decode(this.buffer.subarray(16, t + 16));
901
+ if (JSON.parse(n).files)
898
902
  return {
899
903
  ext: "asar",
900
904
  mime: "application/x-asar"
@@ -963,7 +967,7 @@ class y {
963
967
  ext: "jmp",
964
968
  mime: "application/x-jmp-data"
965
969
  };
966
- if (await e.peekBuffer(this.buffer, { length: Math.min(512, e.fileInfo.size), mayBeLess: !0 }), this.checkString("ustar", { offset: 257 }) && (this.checkString("\0", { offset: 262 }) || this.checkString(" ", { offset: 262 })) || this.check([0, 0, 0, 0, 0, 0], { offset: 257 }) && L(this.buffer))
970
+ if (await e.peekBuffer(this.buffer, { length: Math.min(512, e.fileInfo.size), mayBeLess: !0 }), this.checkString("ustar", { offset: 257 }) && (this.checkString("\0", { offset: 262 }) || this.checkString(" ", { offset: 262 })) || this.check([0, 0, 0, 0, 0, 0], { offset: 257 }) && R(this.buffer))
967
971
  return {
968
972
  ext: "tar",
969
973
  mime: "application/x-tar"
@@ -987,12 +991,25 @@ class y {
987
991
  ext: "pgp",
988
992
  mime: "application/pgp-encrypted"
989
993
  };
994
+ const i = 32769, r = 5;
995
+ if (e.supportsRandomAccess() && e.fileInfo.size >= i + r) {
996
+ const t = new Uint8Array(r);
997
+ if (await e.peekBuffer(t, {
998
+ position: i,
999
+ length: r,
1000
+ mayBeLess: !0
1001
+ }), h(t, A("CD001")))
1002
+ return {
1003
+ ext: "iso",
1004
+ mime: "application/x-iso9660-image"
1005
+ };
1006
+ }
990
1007
  };
991
1008
  // Detections with limited supporting data, resulting in a higher likelihood of false positives
992
1009
  detectImprecise = async (e) => {
993
1010
  this.buffer = new Uint8Array(k);
994
- const t = Y(e.fileInfo.size);
995
- if (await e.peekBuffer(this.buffer, { length: Math.min(8, t), mayBeLess: !0 }), this.check([0, 0, 1, 186]) || this.check([0, 0, 1, 179]))
1011
+ const i = Y(e.fileInfo.size);
1012
+ if (await e.peekBuffer(this.buffer, { length: Math.min(8, i), mayBeLess: !0 }), this.check([0, 0, 1, 186]) || this.check([0, 0, 1, 179]))
996
1013
  return {
997
1014
  ext: "mpg",
998
1015
  mime: "video/mpeg"
@@ -1012,16 +1029,16 @@ class y {
1012
1029
  ext: "cur",
1013
1030
  mime: "image/x-icon"
1014
1031
  };
1015
- if (await e.peekBuffer(this.buffer, { length: Math.min(2 + this.options.mpegOffsetTolerance, t), mayBeLess: !0 }), this.buffer.length >= 2 + this.options.mpegOffsetTolerance)
1016
- for (let i = 0; i <= this.options.mpegOffsetTolerance; ++i) {
1017
- const r = this.scanMpeg(i);
1018
- if (r)
1019
- return r;
1032
+ if (await e.peekBuffer(this.buffer, { length: Math.min(4 + this.options.mpegOffsetTolerance, i), mayBeLess: !0 }), this.buffer.length >= 4 + this.options.mpegOffsetTolerance)
1033
+ for (let r = 0; r <= this.options.mpegOffsetTolerance; ++r) {
1034
+ const t = this.scanMpeg(r);
1035
+ if (t)
1036
+ return t;
1020
1037
  }
1021
1038
  };
1022
1039
  async readTiffTag(e) {
1023
- const t = await this.tokenizer.readToken(e ? p : g);
1024
- switch (await this.tokenizer.ignore(10), t) {
1040
+ const i = await this.tokenizer.readToken(e ? p : g);
1041
+ switch (await this.tokenizer.ignore(10), i) {
1025
1042
  case 50341:
1026
1043
  return {
1027
1044
  ext: "arw",
@@ -1035,27 +1052,27 @@ class y {
1035
1052
  }
1036
1053
  }
1037
1054
  async readTiffIFD(e) {
1038
- const t = await this.tokenizer.readToken(e ? p : g);
1039
- if (!(t > X) && !(l(this.tokenizer) && 2 + t * 12 > B))
1040
- for (let i = 0; i < t; ++i) {
1041
- const r = await this.readTiffTag(e);
1042
- if (r)
1043
- return r;
1055
+ const i = await this.tokenizer.readToken(e ? p : g);
1056
+ if (!(i > X) && !(l(this.tokenizer) && 2 + i * 12 > D))
1057
+ for (let r = 0; r < i; ++r) {
1058
+ const t = await this.readTiffTag(e);
1059
+ if (t)
1060
+ return t;
1044
1061
  }
1045
1062
  }
1046
1063
  async readTiffHeader(e) {
1047
- const t = {
1064
+ const i = {
1048
1065
  ext: "tif",
1049
1066
  mime: "image/tiff"
1050
- }, i = (e ? p : g).get(this.buffer, 2), r = (e ? T : C).get(this.buffer, 4);
1051
- if (i === 42) {
1052
- if (r >= 6) {
1067
+ }, r = (e ? p : g).get(this.buffer, 2), t = (e ? T : z).get(this.buffer, 4);
1068
+ if (r === 42) {
1069
+ if (t >= 6) {
1053
1070
  if (this.checkString("CR", { offset: 8 }))
1054
1071
  return {
1055
1072
  ext: "cr2",
1056
1073
  mime: "image/x-canon-cr2"
1057
1074
  };
1058
- if (r >= 8) {
1075
+ if (t >= 8) {
1059
1076
  const x = (e ? p : g).get(this.buffer, 8), f = (e ? p : g).get(this.buffer, 10);
1060
1077
  if (x === 28 && f === 254 || x === 31 && f === 11)
1061
1078
  return {
@@ -1064,12 +1081,12 @@ class y {
1064
1081
  };
1065
1082
  }
1066
1083
  }
1067
- if (l(this.tokenizer) && r > Z)
1068
- return t;
1069
- const s = l(this.tokenizer) ? B : this.tokenizer.fileInfo.size;
1084
+ if (l(this.tokenizer) && t > Z)
1085
+ return i;
1086
+ const n = l(this.tokenizer) ? D : this.tokenizer.fileInfo.size;
1070
1087
  try {
1071
- await F(this.tokenizer, r, {
1072
- maximumLength: s,
1088
+ await F(this.tokenizer, t, {
1089
+ maximumLength: n,
1073
1090
  reason: "TIFF IFD offset"
1074
1091
  });
1075
1092
  } catch (x) {
@@ -1085,10 +1102,10 @@ class y {
1085
1102
  return;
1086
1103
  throw x;
1087
1104
  }
1088
- return c ?? t;
1105
+ return c ?? i;
1089
1106
  }
1090
- if (i === 43)
1091
- return t;
1107
+ if (r === 43)
1108
+ return i;
1092
1109
  }
1093
1110
  /**
1094
1111
  Scan check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE).
@@ -1099,13 +1116,12 @@ class y {
1099
1116
  scanMpeg(e) {
1100
1117
  if (this.check([255, 224], { offset: e, mask: [255, 224] })) {
1101
1118
  if (this.check([16], { offset: e + 1, mask: [22] }))
1102
- return this.check([8], { offset: e + 1, mask: [8] }) ? {
1103
- ext: "aac",
1104
- mime: "audio/aac"
1105
- } : {
1119
+ return {
1106
1120
  ext: "aac",
1107
1121
  mime: "audio/aac"
1108
1122
  };
1123
+ if (this.check([255, 254], { offset: e }) || this.check([8], { offset: e + 1, mask: [24] }) || this.check([240], { offset: e + 2, mask: [240] }) || this.check([12], { offset: e + 2, mask: [12] }))
1124
+ return;
1109
1125
  if (this.check([2], { offset: e + 1, mask: [6] }))
1110
1126
  return {
1111
1127
  ext: "mp3",
@@ -181,7 +181,8 @@ const a = [
181
181
  "dat",
182
182
  "key",
183
183
  "numbers",
184
- "pages"
184
+ "pages",
185
+ "iso"
185
186
  ], i = [
186
187
  "image/jpeg",
187
188
  "image/png",
@@ -364,7 +365,8 @@ const a = [
364
365
  "application/x-jmp-data",
365
366
  "application/vnd.apple.keynote",
366
367
  "application/vnd.apple.numbers",
367
- "application/vnd.apple.pages"
368
+ "application/vnd.apple.pages",
369
+ "application/x-iso9660-image"
368
370
  ];
369
371
  export {
370
372
  a as extensions,
@@ -204,3 +204,45 @@ export declare const vitePluginRouterRandomParams: () => Plugin_2;
204
204
  export declare function vitePluginSri(options?: SriPluginOptions): PluginOption;
205
205
 
206
206
  export { }
207
+
208
+
209
+
210
+ declare module "axios" {
211
+ export interface InternalAxiosRequestConfig {
212
+ /**
213
+ * 是否启用请求加密
214
+ * @default false
215
+ */
216
+ enableRequestCrypto?: boolean;
217
+
218
+ /**
219
+ * 是否启用响应加密
220
+ * @default false
221
+ */
222
+ enableResponseCrypto?: boolean;
223
+ }
224
+
225
+ // eslint-disable-next-line
226
+ export interface AxiosRequestConfig<D = any> {
227
+ /**
228
+ * 是否启用请求加密
229
+ * @default false
230
+ */
231
+ enableRequestCrypto?: boolean;
232
+
233
+ /**
234
+ * 是否启用响应加密
235
+ * @default false
236
+ */
237
+ enableResponseCrypto?: boolean;
238
+ }
239
+ }
240
+
241
+ declare module "gm-crypt" {
242
+ export class sm4 {
243
+ // eslint-disable-next-line
244
+ public constructor(options: { key: string; iv: string; mode?: "cbc" | "ecb"; cipherType?: "base64" | "text" }) {}
245
+ public encrypt(data: string): string;
246
+ public decrypt(encryptedData: string): string;
247
+ }
248
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "module-develop-kit",
3
3
  "author": "Front-End team",
4
- "version": "1.4.3",
4
+ "version": "1.5.0",
5
5
  "type": "module",
6
6
  "description": "前端项目通用工具包",
7
7
  "module": "dist/main.js",
@@ -36,31 +36,31 @@
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.28.4",
38
38
  "@babel/preset-env": "^7.28.3",
39
- "@lonely9/eslint-config-team": "^1.3.4",
40
- "@microsoft/api-extractor": "^7.52.13",
39
+ "@lonely9/eslint-config-team": "^1.4.0",
40
+ "@microsoft/api-extractor": "^7.59.1",
41
41
  "@types/babel__core": "^7.20.5",
42
42
  "@types/crypto-js": "^4.2.2",
43
43
  "@types/node": "^24.4.0",
44
44
  "@types/sdp-transform": "^2.15.0",
45
45
  "@types/sm-crypto": "^0.3.4",
46
46
  "@vitejs/plugin-legacy": "^7.2.1",
47
- "axios": "^1.12.2",
48
- "cross-env": "^10.0.0",
49
- "eslint": "^9.35.0",
50
- "jsdom": "^27.0.0",
47
+ "axios": "^1.20.0",
48
+ "cross-env": "^10.1.0",
49
+ "eslint": "^10.10.0",
50
+ "jsdom": "^30.1.0",
51
51
  "parse5": "^8.0.1",
52
- "prettier": "^3.6.2",
52
+ "prettier": "^3.9.8",
53
53
  "sdp-transform": "^2.15.0",
54
- "terser": "^5.44.0",
54
+ "terser": "^5.51.2",
55
55
  "typescript": "^5.9.2",
56
- "unplugin-dts": "^1.0.0-beta.6",
56
+ "unplugin-dts": "^1.1.0",
57
57
  "vite": "^7.1.5",
58
58
  "vitest": "^3.2.4",
59
- "vue": "^3.5.21",
60
- "vue-tsc": "^3.0.7"
59
+ "vue": "^3.5.43",
60
+ "vue-tsc": "^3.3.11"
61
61
  },
62
62
  "dependencies": {
63
- "file-type": "^22.0.1",
63
+ "file-type": "^22.1.1",
64
64
  "gm-crypt": "^0.0.2",
65
65
  "jssip": "^3.10.1",
66
66
  "nanoid": "^5.1.11",