@seayoo-web/app-info 0.1.0 → 0.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.
package/dist/index.js CHANGED
@@ -1,55 +1,70 @@
1
1
  import { loadAsync as J } from "jszip";
2
- function Q(g) {
3
- return typeof g == "string" ? g : `${g}`;
2
+ function Q(p) {
3
+ return typeof p == "string" ? p : `${p}`;
4
4
  }
5
- function at(g) {
6
- return typeof g == "number" ? g : typeof g == "string" ? /^\d+(?:\.\d+)/.test(g) ? +g : Number(g) : NaN;
5
+ function ot(p) {
6
+ return typeof p == "number" ? p : typeof p == "string" ? /^\d+(?:\.\d+)/.test(p) ? +p : Number(p) : NaN;
7
7
  }
8
- function B(g) {
9
- return g instanceof Error ? g : new Error(String(g));
8
+ function R(p) {
9
+ return p instanceof Error ? p : new Error(String(p));
10
10
  }
11
- function rt(g) {
12
- return `data:image/png;base64,${g}`;
11
+ function rt(p) {
12
+ return `data:image/png;base64,${p}`;
13
13
  }
14
- async function Mt(g, i) {
15
- const n = await J(g).catch(B);
16
- if (n instanceof Error)
17
- return new Error(`load file error: ${n.message}`);
18
- const a = await ot(n);
19
- if (a instanceof Error)
20
- return new Error(`read pack.info error: ${a.message}`);
21
- const c = {
22
- package: a.summary.app.bundleName,
23
- versionCode: a.summary.app.version.code,
24
- versionName: a.summary.app.version.name,
25
- summary: a.summary,
26
- packages: a.packages
27
- };
28
- if (i?.ignoreIcon)
29
- return c;
30
- const E = a.packages.find((m) => m.moduleType === "entry");
31
- if (!E)
32
- return c;
33
- const w = n.file(`${E.name}.hap`);
34
- if (!w)
35
- return c;
36
- const y = await w.async("arraybuffer").catch(B);
37
- if (y instanceof Error)
38
- return c;
39
- const I = await J(y).catch(B);
40
- if (I instanceof Error)
41
- return c;
42
- const N = await ht(I);
43
- if (N instanceof Error)
44
- return c;
45
- const T = await ut(I, N.app.icon);
46
- return T instanceof Error || (c.icon = rt(T)), c;
14
+ class Mt {
15
+ zip;
16
+ constructor(i) {
17
+ this.zip = J(i).catch(R);
18
+ }
19
+ async parse(i) {
20
+ const n = await this.zip;
21
+ if (n instanceof Error)
22
+ return new Error(`load file error: ${n.message}`);
23
+ const a = await ht(n);
24
+ if (a instanceof Error)
25
+ return new Error(`read pack.info error: ${a.message}`);
26
+ const c = {
27
+ package: a.summary.app.bundleName,
28
+ versionCode: a.summary.app.version.code,
29
+ versionName: a.summary.app.version.name,
30
+ pack: a
31
+ };
32
+ if (i?.ignoreIcon)
33
+ return c;
34
+ const w = a.packages.find((m) => m.moduleType === "entry");
35
+ if (!w)
36
+ return c;
37
+ const y = n.file(`${w.name}.hap`);
38
+ if (!y)
39
+ return c;
40
+ const b = await y.async("arraybuffer").catch(R);
41
+ if (b instanceof Error)
42
+ return c;
43
+ const v = await J(b).catch(R);
44
+ if (v instanceof Error)
45
+ return c;
46
+ const N = await ut(v);
47
+ if (N instanceof Error)
48
+ return c;
49
+ const T = await lt(v, N.app.icon);
50
+ return T instanceof Error || (c.icon = rt(T)), c;
51
+ }
52
+ /**
53
+ * 读取指定文件的内容
54
+ */
55
+ async readFile(i) {
56
+ const n = await this.zip;
57
+ if (n instanceof Error)
58
+ return n;
59
+ const a = typeof i == "string" ? n.file(i) : n.file(i)[0];
60
+ return a ? await a.async("arraybuffer").catch(R) : new Error(`not found ${i}`);
61
+ }
47
62
  }
48
- async function ot(g) {
49
- const i = g.file("pack.info");
63
+ async function ht(p) {
64
+ const i = p.file("pack.info");
50
65
  if (!i)
51
66
  return new Error("not found pack.info file");
52
- const n = await i.async("text").catch(B);
67
+ const n = await i.async("text").catch(R);
53
68
  if (n instanceof Error)
54
69
  return new Error(`read pack.info file error: ${n.message}`);
55
70
  if (!n)
@@ -57,15 +72,15 @@ async function ot(g) {
57
72
  try {
58
73
  return JSON.parse(n);
59
74
  } catch (a) {
60
- const c = B(a);
75
+ const c = R(a);
61
76
  return new Error(`parse pack.info file error: ${c.message}`);
62
77
  }
63
78
  }
64
- async function ht(g) {
65
- const i = g.file("module.json") || g.file("module.json5");
79
+ async function ut(p) {
80
+ const i = p.file("module.json") || p.file("module.json5");
66
81
  if (!i)
67
82
  return new Error("not found module.json file");
68
- const n = await i.async("text").catch(B);
83
+ const n = await i.async("text").catch(R);
69
84
  if (n instanceof Error)
70
85
  return new Error(`read module.json file error: ${n.message}`);
71
86
  if (!n)
@@ -73,36 +88,36 @@ async function ht(g) {
73
88
  try {
74
89
  return JSON.parse(n);
75
90
  } catch (a) {
76
- const c = B(a);
91
+ const c = R(a);
77
92
  return new Error(`parse module.json file error: ${c.message}`);
78
93
  }
79
94
  }
80
- async function ut(g, i) {
81
- const a = `resources/base/media/${(i || "app_icon").replace(/(?:^\$media:|\.[a-z]+$)/gi, "")}.png`, c = g.file(a);
95
+ async function lt(p, i) {
96
+ const a = `resources/base/media/${(i || "app_icon").replace(/(?:^\$media:|\.[a-z]+$)/gi, "")}.png`, c = p.file(a);
82
97
  if (!c)
83
98
  return new Error(`not found icon file at ${a}`);
84
- const E = await c.async("base64").catch(B);
85
- return E instanceof Error ? new Error(`read icon file error: ${E.message}`) : E;
99
+ const w = await c.async("base64").catch(R);
100
+ return w instanceof Error ? new Error(`read icon file error: ${w.message}`) : w;
86
101
  }
87
- function lt(g) {
88
- return g && g.__esModule && Object.prototype.hasOwnProperty.call(g, "default") ? g.default : g;
102
+ function ct(p) {
103
+ return p && p.__esModule && Object.prototype.hasOwnProperty.call(p, "default") ? p.default : p;
89
104
  }
90
- function st(g) {
91
- throw new Error('Could not dynamically require "' + g + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
105
+ function at(p) {
106
+ throw new Error('Could not dynamically require "' + p + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
92
107
  }
93
- var W = { exports: {} }, K = { exports: {} }, ct = K.exports, it;
94
- function ft() {
95
- return it || (it = 1, function(g) {
108
+ var W = { exports: {} }, K = { exports: {} }, ft = K.exports, it;
109
+ function gt() {
110
+ return it || (it = 1, function(p) {
96
111
  /**
97
112
  * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
98
113
  * Released under the Apache License, Version 2.0
99
114
  * see: https://github.com/dcodeIO/long.js for details
100
115
  */
101
116
  (function(i, n) {
102
- typeof st == "function" && g && g.exports ? g.exports = n() : (i.dcodeIO = i.dcodeIO || {}).Long = n();
103
- })(ct, function() {
104
- function i(f, h, b) {
105
- this.low = f | 0, this.high = h | 0, this.unsigned = !!b;
117
+ typeof at == "function" && p && p.exports ? p.exports = n() : (i.dcodeIO = i.dcodeIO || {}).Long = n();
118
+ })(ft, function() {
119
+ function i(f, h, E) {
120
+ this.low = f | 0, this.high = h | 0, this.unsigned = !!E;
106
121
  }
107
122
  i.prototype.__isLong__, Object.defineProperty(i.prototype, "__isLong__", {
108
123
  value: !0,
@@ -114,12 +129,12 @@ function ft() {
114
129
  }
115
130
  i.isLong = n;
116
131
  var a = {}, c = {};
117
- function E(f, h) {
118
- var b, v, x;
119
- return h ? (f >>>= 0, (x = 0 <= f && f < 256) && (v = c[f], v) ? v : (b = y(f, (f | 0) < 0 ? -1 : 0, !0), x && (c[f] = b), b)) : (f |= 0, (x = -128 <= f && f < 128) && (v = a[f], v) ? v : (b = y(f, f < 0 ? -1 : 0, !1), x && (a[f] = b), b));
120
- }
121
- i.fromInt = E;
122
132
  function w(f, h) {
133
+ var E, I, x;
134
+ return h ? (f >>>= 0, (x = 0 <= f && f < 256) && (I = c[f], I) ? I : (E = b(f, (f | 0) < 0 ? -1 : 0, !0), x && (c[f] = E), E)) : (f |= 0, (x = -128 <= f && f < 128) && (I = a[f], I) ? I : (E = b(f, f < 0 ? -1 : 0, !1), x && (a[f] = E), E));
135
+ }
136
+ i.fromInt = w;
137
+ function y(f, h) {
123
138
  if (isNaN(f) || !isFinite(f))
124
139
  return h ? l : u;
125
140
  if (h) {
@@ -133,56 +148,56 @@ function ft() {
133
148
  if (f + 1 >= s)
134
149
  return A;
135
150
  }
136
- return f < 0 ? w(-f, h).neg() : y(f % e | 0, f / e | 0, h);
151
+ return f < 0 ? y(-f, h).neg() : b(f % e | 0, f / e | 0, h);
137
152
  }
138
- i.fromNumber = w;
139
- function y(f, h, b) {
140
- return new i(f, h, b);
153
+ i.fromNumber = y;
154
+ function b(f, h, E) {
155
+ return new i(f, h, E);
141
156
  }
142
- i.fromBits = y;
143
- var I = Math.pow;
144
- function N(f, h, b) {
157
+ i.fromBits = b;
158
+ var v = Math.pow;
159
+ function N(f, h, E) {
145
160
  if (f.length === 0)
146
161
  throw Error("empty string");
147
162
  if (f === "NaN" || f === "Infinity" || f === "+Infinity" || f === "-Infinity")
148
163
  return u;
149
- if (typeof h == "number" ? (b = h, h = !1) : h = !!h, b = b || 10, b < 2 || 36 < b)
164
+ if (typeof h == "number" ? (E = h, h = !1) : h = !!h, E = E || 10, E < 2 || 36 < E)
150
165
  throw RangeError("radix");
151
- var v;
152
- if ((v = f.indexOf("-")) > 0)
166
+ var I;
167
+ if ((I = f.indexOf("-")) > 0)
153
168
  throw Error("interior hyphen");
154
- if (v === 0)
155
- return N(f.substring(1), h, b).neg();
156
- for (var x = w(I(b, 8)), U = u, k = 0; k < f.length; k += 8) {
157
- var O = Math.min(8, f.length - k), R = parseInt(f.substring(k, k + O), b);
158
- if (O < 8) {
159
- var D = w(I(b, O));
160
- U = U.mul(D).add(w(R));
169
+ if (I === 0)
170
+ return N(f.substring(1), h, E).neg();
171
+ for (var x = y(v(E, 8)), U = u, k = 0; k < f.length; k += 8) {
172
+ var B = Math.min(8, f.length - k), C = parseInt(f.substring(k, k + B), E);
173
+ if (B < 8) {
174
+ var D = y(v(E, B));
175
+ U = U.mul(D).add(y(C));
161
176
  } else
162
- U = U.mul(x), U = U.add(w(R));
177
+ U = U.mul(x), U = U.add(y(C));
163
178
  }
164
179
  return U.unsigned = h, U;
165
180
  }
166
181
  i.fromString = N;
167
182
  function T(f) {
168
- return f instanceof i ? f : typeof f == "number" ? w(f) : typeof f == "string" ? N(f) : y(f.low, f.high, f.unsigned);
183
+ return f instanceof i ? f : typeof f == "number" ? y(f) : typeof f == "string" ? N(f) : b(f.low, f.high, f.unsigned);
169
184
  }
170
185
  i.fromValue = T;
171
- var m = 65536, t = 1 << 24, e = m * m, r = e * e, s = r / 2, o = E(t), u = E(0);
186
+ var m = 65536, t = 1 << 24, e = m * m, r = e * e, s = r / 2, o = w(t), u = w(0);
172
187
  i.ZERO = u;
173
- var l = E(0, !0);
188
+ var l = w(0, !0);
174
189
  i.UZERO = l;
175
- var p = E(1);
176
- i.ONE = p;
177
- var F = E(1, !0);
190
+ var g = w(1);
191
+ i.ONE = g;
192
+ var F = w(1, !0);
178
193
  i.UONE = F;
179
- var S = E(-1);
194
+ var S = w(-1);
180
195
  i.NEG_ONE = S;
181
- var A = y(-1, 2147483647, !1);
196
+ var A = b(-1, 2147483647, !1);
182
197
  i.MAX_VALUE = A;
183
- var L = y(-1, -1, !0);
198
+ var L = b(-1, -1, !0);
184
199
  i.MAX_UNSIGNED_VALUE = L;
185
- var _ = y(0, -2147483648, !1);
200
+ var _ = b(0, -2147483648, !1);
186
201
  i.MIN_VALUE = _;
187
202
  var d = i.prototype;
188
203
  return d.toInt = function() {
@@ -196,17 +211,17 @@ function ft() {
196
211
  return "0";
197
212
  if (this.isNegative())
198
213
  if (this.eq(_)) {
199
- var b = w(h), v = this.div(b), x = v.mul(b).sub(this);
200
- return v.toString(h) + x.toInt().toString(h);
214
+ var E = y(h), I = this.div(E), x = I.mul(E).sub(this);
215
+ return I.toString(h) + x.toInt().toString(h);
201
216
  } else
202
217
  return "-" + this.neg().toString(h);
203
- for (var U = w(I(h, 6), this.unsigned), k = this, O = ""; ; ) {
204
- var R = k.div(U), D = k.sub(R.mul(U)).toInt() >>> 0, M = D.toString(h);
205
- if (k = R, k.isZero())
206
- return M + O;
218
+ for (var U = y(v(h, 6), this.unsigned), k = this, B = ""; ; ) {
219
+ var C = k.div(U), D = k.sub(C.mul(U)).toInt() >>> 0, M = D.toString(h);
220
+ if (k = C, k.isZero())
221
+ return M + B;
207
222
  for (; M.length < 6; )
208
223
  M = "0" + M;
209
- O = "" + M + O;
224
+ B = "" + M + B;
210
225
  }
211
226
  }, d.getHighBits = function() {
212
227
  return this.high;
@@ -219,9 +234,9 @@ function ft() {
219
234
  }, d.getNumBitsAbs = function() {
220
235
  if (this.isNegative())
221
236
  return this.eq(_) ? 64 : this.neg().getNumBitsAbs();
222
- for (var h = this.high != 0 ? this.high : this.low, b = 31; b > 0 && (h & 1 << b) == 0; b--)
237
+ for (var h = this.high != 0 ? this.high : this.low, E = 31; E > 0 && (h & 1 << E) == 0; E--)
223
238
  ;
224
- return this.high != 0 ? b + 33 : b + 1;
239
+ return this.high != 0 ? E + 33 : E + 1;
225
240
  }, d.isZero = function() {
226
241
  return this.high === 0 && this.low === 0;
227
242
  }, d.isNegative = function() {
@@ -262,14 +277,14 @@ function ft() {
262
277
  }, d.gte = d.greaterThanOrEqual, d.compare = function(h) {
263
278
  if (n(h) || (h = T(h)), this.eq(h))
264
279
  return 0;
265
- var b = this.isNegative(), v = h.isNegative();
266
- return b && !v ? -1 : !b && v ? 1 : this.unsigned ? h.high >>> 0 > this.high >>> 0 || h.high === this.high && h.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(h).isNegative() ? -1 : 1;
280
+ var E = this.isNegative(), I = h.isNegative();
281
+ return E && !I ? -1 : !E && I ? 1 : this.unsigned ? h.high >>> 0 > this.high >>> 0 || h.high === this.high && h.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(h).isNegative() ? -1 : 1;
267
282
  }, d.comp = d.compare, d.negate = function() {
268
- return !this.unsigned && this.eq(_) ? _ : this.not().add(p);
283
+ return !this.unsigned && this.eq(_) ? _ : this.not().add(g);
269
284
  }, d.neg = d.negate, d.add = function(h) {
270
285
  n(h) || (h = T(h));
271
- var b = this.high >>> 16, v = this.high & 65535, x = this.low >>> 16, U = this.low & 65535, k = h.high >>> 16, O = h.high & 65535, R = h.low >>> 16, D = h.low & 65535, M = 0, P = 0, X = 0, j = 0;
272
- return j += U + D, X += j >>> 16, j &= 65535, X += x + R, P += X >>> 16, X &= 65535, P += v + O, M += P >>> 16, P &= 65535, M += b + k, M &= 65535, y(X << 16 | j, M << 16 | P, this.unsigned);
286
+ var E = this.high >>> 16, I = this.high & 65535, x = this.low >>> 16, U = this.low & 65535, k = h.high >>> 16, B = h.high & 65535, C = h.low >>> 16, D = h.low & 65535, M = 0, P = 0, z = 0, Y = 0;
287
+ return Y += U + D, z += Y >>> 16, Y &= 65535, z += x + C, P += z >>> 16, z &= 65535, P += I + B, M += P >>> 16, P &= 65535, M += E + k, M &= 65535, b(z << 16 | Y, M << 16 | P, this.unsigned);
273
288
  }, d.subtract = function(h) {
274
289
  return n(h) || (h = T(h)), this.add(h.neg());
275
290
  }, d.sub = d.subtract, d.multiply = function(h) {
@@ -284,15 +299,15 @@ function ft() {
284
299
  if (h.isNegative())
285
300
  return this.mul(h.neg()).neg();
286
301
  if (this.lt(o) && h.lt(o))
287
- return w(this.toNumber() * h.toNumber(), this.unsigned);
288
- var b = this.high >>> 16, v = this.high & 65535, x = this.low >>> 16, U = this.low & 65535, k = h.high >>> 16, O = h.high & 65535, R = h.low >>> 16, D = h.low & 65535, M = 0, P = 0, X = 0, j = 0;
289
- return j += U * D, X += j >>> 16, j &= 65535, X += x * D, P += X >>> 16, X &= 65535, X += U * R, P += X >>> 16, X &= 65535, P += v * D, M += P >>> 16, P &= 65535, P += x * R, M += P >>> 16, P &= 65535, P += U * O, M += P >>> 16, P &= 65535, M += b * D + v * R + x * O + U * k, M &= 65535, y(X << 16 | j, M << 16 | P, this.unsigned);
302
+ return y(this.toNumber() * h.toNumber(), this.unsigned);
303
+ var E = this.high >>> 16, I = this.high & 65535, x = this.low >>> 16, U = this.low & 65535, k = h.high >>> 16, B = h.high & 65535, C = h.low >>> 16, D = h.low & 65535, M = 0, P = 0, z = 0, Y = 0;
304
+ return Y += U * D, z += Y >>> 16, Y &= 65535, z += x * D, P += z >>> 16, z &= 65535, z += U * C, P += z >>> 16, z &= 65535, P += I * D, M += P >>> 16, P &= 65535, P += x * C, M += P >>> 16, P &= 65535, P += U * B, M += P >>> 16, P &= 65535, M += E * D + I * C + x * B + U * k, M &= 65535, b(z << 16 | Y, M << 16 | P, this.unsigned);
290
305
  }, d.mul = d.multiply, d.divide = function(h) {
291
306
  if (n(h) || (h = T(h)), h.isZero())
292
307
  throw Error("division by zero");
293
308
  if (this.isZero())
294
309
  return this.unsigned ? l : u;
295
- var b, v, x;
310
+ var E, I, x;
296
311
  if (this.unsigned) {
297
312
  if (h.unsigned || (h = h.toUnsigned()), h.gt(this))
298
313
  return l;
@@ -301,12 +316,12 @@ function ft() {
301
316
  x = l;
302
317
  } else {
303
318
  if (this.eq(_)) {
304
- if (h.eq(p) || h.eq(S))
319
+ if (h.eq(g) || h.eq(S))
305
320
  return _;
306
321
  if (h.eq(_))
307
- return p;
322
+ return g;
308
323
  var U = this.shr(1);
309
- return b = U.div(h).shl(1), b.eq(u) ? h.isNegative() ? p : S : (v = this.sub(h.mul(b)), x = b.add(v.div(h)), x);
324
+ return E = U.div(h).shl(1), E.eq(u) ? h.isNegative() ? g : S : (I = this.sub(h.mul(E)), x = E.add(I.div(h)), x);
310
325
  } else if (h.eq(_))
311
326
  return this.unsigned ? l : u;
312
327
  if (this.isNegative())
@@ -315,39 +330,39 @@ function ft() {
315
330
  return this.div(h.neg()).neg();
316
331
  x = u;
317
332
  }
318
- for (v = this; v.gte(h); ) {
319
- b = Math.max(1, Math.floor(v.toNumber() / h.toNumber()));
320
- for (var k = Math.ceil(Math.log(b) / Math.LN2), O = k <= 48 ? 1 : I(2, k - 48), R = w(b), D = R.mul(h); D.isNegative() || D.gt(v); )
321
- b -= O, R = w(b, this.unsigned), D = R.mul(h);
322
- R.isZero() && (R = p), x = x.add(R), v = v.sub(D);
333
+ for (I = this; I.gte(h); ) {
334
+ E = Math.max(1, Math.floor(I.toNumber() / h.toNumber()));
335
+ for (var k = Math.ceil(Math.log(E) / Math.LN2), B = k <= 48 ? 1 : v(2, k - 48), C = y(E), D = C.mul(h); D.isNegative() || D.gt(I); )
336
+ E -= B, C = y(E, this.unsigned), D = C.mul(h);
337
+ C.isZero() && (C = g), x = x.add(C), I = I.sub(D);
323
338
  }
324
339
  return x;
325
340
  }, d.div = d.divide, d.modulo = function(h) {
326
341
  return n(h) || (h = T(h)), this.sub(this.div(h).mul(h));
327
342
  }, d.mod = d.modulo, d.not = function() {
328
- return y(~this.low, ~this.high, this.unsigned);
343
+ return b(~this.low, ~this.high, this.unsigned);
329
344
  }, d.and = function(h) {
330
- return n(h) || (h = T(h)), y(this.low & h.low, this.high & h.high, this.unsigned);
345
+ return n(h) || (h = T(h)), b(this.low & h.low, this.high & h.high, this.unsigned);
331
346
  }, d.or = function(h) {
332
- return n(h) || (h = T(h)), y(this.low | h.low, this.high | h.high, this.unsigned);
347
+ return n(h) || (h = T(h)), b(this.low | h.low, this.high | h.high, this.unsigned);
333
348
  }, d.xor = function(h) {
334
- return n(h) || (h = T(h)), y(this.low ^ h.low, this.high ^ h.high, this.unsigned);
349
+ return n(h) || (h = T(h)), b(this.low ^ h.low, this.high ^ h.high, this.unsigned);
335
350
  }, d.shiftLeft = function(h) {
336
- return n(h) && (h = h.toInt()), (h &= 63) === 0 ? this : h < 32 ? y(this.low << h, this.high << h | this.low >>> 32 - h, this.unsigned) : y(0, this.low << h - 32, this.unsigned);
351
+ return n(h) && (h = h.toInt()), (h &= 63) === 0 ? this : h < 32 ? b(this.low << h, this.high << h | this.low >>> 32 - h, this.unsigned) : b(0, this.low << h - 32, this.unsigned);
337
352
  }, d.shl = d.shiftLeft, d.shiftRight = function(h) {
338
- return n(h) && (h = h.toInt()), (h &= 63) === 0 ? this : h < 32 ? y(this.low >>> h | this.high << 32 - h, this.high >> h, this.unsigned) : y(this.high >> h - 32, this.high >= 0 ? 0 : -1, this.unsigned);
353
+ return n(h) && (h = h.toInt()), (h &= 63) === 0 ? this : h < 32 ? b(this.low >>> h | this.high << 32 - h, this.high >> h, this.unsigned) : b(this.high >> h - 32, this.high >= 0 ? 0 : -1, this.unsigned);
339
354
  }, d.shr = d.shiftRight, d.shiftRightUnsigned = function(h) {
340
355
  if (n(h) && (h = h.toInt()), h &= 63, h === 0)
341
356
  return this;
342
- var b = this.high;
357
+ var E = this.high;
343
358
  if (h < 32) {
344
- var v = this.low;
345
- return y(v >>> h | b << 32 - h, b >>> h, this.unsigned);
346
- } else return h === 32 ? y(b, 0, this.unsigned) : y(b >>> h - 32, 0, this.unsigned);
359
+ var I = this.low;
360
+ return b(I >>> h | E << 32 - h, E >>> h, this.unsigned);
361
+ } else return h === 32 ? b(E, 0, this.unsigned) : b(E >>> h - 32, 0, this.unsigned);
347
362
  }, d.shru = d.shiftRightUnsigned, d.toSigned = function() {
348
- return this.unsigned ? y(this.low, this.high, !1) : this;
363
+ return this.unsigned ? b(this.low, this.high, !1) : this;
349
364
  }, d.toUnsigned = function() {
350
- return this.unsigned ? this : y(this.low, this.high, !0);
365
+ return this.unsigned ? this : b(this.low, this.high, !0);
351
366
  }, d.toBytes = function(f) {
352
367
  return f ? this.toBytesLE() : this.toBytesBE();
353
368
  }, d.toBytesLE = function() {
@@ -378,9 +393,9 @@ function ft() {
378
393
  });
379
394
  }(K)), K.exports;
380
395
  }
381
- var gt = W.exports, nt;
382
- function pt() {
383
- return nt || (nt = 1, function(g) {
396
+ var pt = W.exports, nt;
397
+ function dt() {
398
+ return nt || (nt = 1, function(p) {
384
399
  /**
385
400
  * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
386
401
  * Backing buffer: ArrayBuffer, Accessor: Uint8Array
@@ -388,15 +403,15 @@ function pt() {
388
403
  * see: https://github.com/dcodeIO/bytebuffer.js for details
389
404
  */
390
405
  (function(i, n) {
391
- typeof st == "function" && g && g.exports ? g.exports = function() {
406
+ typeof at == "function" && p && p.exports ? p.exports = function() {
392
407
  var a;
393
408
  try {
394
- a = ft();
409
+ a = gt();
395
410
  } catch {
396
411
  }
397
412
  return n(a);
398
413
  }() : (i.dcodeIO = i.dcodeIO || {}).ByteBuffer = n(i.dcodeIO.Long);
399
- })(gt, function(i) {
414
+ })(pt, function(i) {
400
415
  var n = function(t, e, r) {
401
416
  if (typeof t > "u" && (t = n.DEFAULT_CAPACITY), typeof e > "u" && (e = n.DEFAULT_ENDIAN), typeof r > "u" && (r = n.DEFAULT_NOASSERT), !r) {
402
417
  if (t = t | 0, t < 0)
@@ -412,19 +427,19 @@ function pt() {
412
427
  enumerable: !1,
413
428
  configurable: !1
414
429
  });
415
- var c = new ArrayBuffer(0), E = String.fromCharCode;
416
- function w(t) {
430
+ var c = new ArrayBuffer(0), w = String.fromCharCode;
431
+ function y(t) {
417
432
  var e = 0;
418
433
  return function() {
419
434
  return e < t.length ? t.charCodeAt(e++) : null;
420
435
  };
421
436
  }
422
- function y() {
437
+ function b() {
423
438
  var t = [], e = [];
424
439
  return function() {
425
440
  if (arguments.length === 0)
426
- return e.join("") + E.apply(String, t);
427
- t.length + arguments.length > 1024 && (e.push(E.apply(String, t)), t.length = 0), Array.prototype.push.apply(t, arguments);
441
+ return e.join("") + w.apply(String, t);
442
+ t.length + arguments.length > 1024 && (e.push(w.apply(String, t)), t.length = 0), Array.prototype.push.apply(t, arguments);
428
443
  };
429
444
  }
430
445
  n.accessor = function() {
@@ -433,13 +448,13 @@ function pt() {
433
448
  return new n(t, e, r);
434
449
  }, n.concat = function(t, e, r, s) {
435
450
  (typeof e == "boolean" || typeof e != "string") && (s = r, r = e, e = void 0);
436
- for (var o = 0, u = 0, l = t.length, p; u < l; ++u)
437
- n.isByteBuffer(t[u]) || (t[u] = n.wrap(t[u], e)), p = t[u].limit - t[u].offset, p > 0 && (o += p);
451
+ for (var o = 0, u = 0, l = t.length, g; u < l; ++u)
452
+ n.isByteBuffer(t[u]) || (t[u] = n.wrap(t[u], e)), g = t[u].limit - t[u].offset, g > 0 && (o += g);
438
453
  if (o === 0)
439
454
  return new n(0, r, s);
440
455
  var F = new n(o, r, s), S;
441
456
  for (u = 0; u < l; )
442
- S = t[u++], p = S.limit - S.offset, !(p <= 0) && (F.view.set(S.view.subarray(S.offset, S.limit), F.offset), F.offset += p);
457
+ S = t[u++], g = S.limit - S.offset, !(g <= 0) && (F.view.set(S.view.subarray(S.offset, S.limit), F.offset), F.offset += g);
443
458
  return F.limit = F.offset, F.offset = 0, F;
444
459
  }, n.isByteBuffer = function(t) {
445
460
  return (t && t.__isByteBuffer__) === !0;
@@ -487,24 +502,24 @@ function pt() {
487
502
  if (e >>>= 0, e < 0 || e + 0 > this.buffer.byteLength)
488
503
  throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
489
504
  }
490
- var s = e, o = t.length, u = o >> 3, l = 0, p;
505
+ var s = e, o = t.length, u = o >> 3, l = 0, g;
491
506
  for (e += this.writeVarint32(o, e); u--; )
492
- p = !!t[l++] & 1 | (!!t[l++] & 1) << 1 | (!!t[l++] & 1) << 2 | (!!t[l++] & 1) << 3 | (!!t[l++] & 1) << 4 | (!!t[l++] & 1) << 5 | (!!t[l++] & 1) << 6 | (!!t[l++] & 1) << 7, this.writeByte(p, e++);
507
+ g = !!t[l++] & 1 | (!!t[l++] & 1) << 1 | (!!t[l++] & 1) << 2 | (!!t[l++] & 1) << 3 | (!!t[l++] & 1) << 4 | (!!t[l++] & 1) << 5 | (!!t[l++] & 1) << 6 | (!!t[l++] & 1) << 7, this.writeByte(g, e++);
493
508
  if (l < o) {
494
509
  var F = 0;
495
- for (p = 0; l < o; ) p = p | (!!t[l++] & 1) << F++;
496
- this.writeByte(p, e++);
510
+ for (g = 0; l < o; ) g = g | (!!t[l++] & 1) << F++;
511
+ this.writeByte(g, e++);
497
512
  }
498
513
  return r ? (this.offset = e, this) : e - s;
499
514
  }, a.readBitSet = function(t) {
500
515
  var e = typeof t > "u";
501
516
  e && (t = this.offset);
502
- var r = this.readVarint32(t), s = r.value, o = s >> 3, u = 0, l = [], p;
517
+ var r = this.readVarint32(t), s = r.value, o = s >> 3, u = 0, l = [], g;
503
518
  for (t += r.length; o--; )
504
- p = this.readByte(t++), l[u++] = !!(p & 1), l[u++] = !!(p & 2), l[u++] = !!(p & 4), l[u++] = !!(p & 8), l[u++] = !!(p & 16), l[u++] = !!(p & 32), l[u++] = !!(p & 64), l[u++] = !!(p & 128);
519
+ g = this.readByte(t++), l[u++] = !!(g & 1), l[u++] = !!(g & 2), l[u++] = !!(g & 4), l[u++] = !!(g & 8), l[u++] = !!(g & 16), l[u++] = !!(g & 32), l[u++] = !!(g & 64), l[u++] = !!(g & 128);
505
520
  if (u < s) {
506
521
  var F = 0;
507
- for (p = this.readByte(t++); u < s; ) l[u++] = !!(p >> F++ & 1);
522
+ for (g = this.readByte(t++); u < s; ) l[u++] = !!(g >> F++ & 1);
508
523
  }
509
524
  return e && (this.offset = t), l;
510
525
  }, a.readBytes = function(t, e) {
@@ -718,9 +733,9 @@ function pt() {
718
733
  var o = new i(r, s, !0);
719
734
  return e && (this.offset += 8), o;
720
735
  }, a.readUInt64 = a.readUint64);
721
- function I(t, e, r, s, o) {
722
- var u, l, p = o * 8 - s - 1, F = (1 << p) - 1, S = F >> 1, A = -7, L = r ? o - 1 : 0, _ = r ? -1 : 1, d = t[e + L];
723
- for (L += _, u = d & (1 << -A) - 1, d >>= -A, A += p; A > 0; u = u * 256 + t[e + L], L += _, A -= 8)
736
+ function v(t, e, r, s, o) {
737
+ var u, l, g = o * 8 - s - 1, F = (1 << g) - 1, S = F >> 1, A = -7, L = r ? o - 1 : 0, _ = r ? -1 : 1, d = t[e + L];
738
+ for (L += _, u = d & (1 << -A) - 1, d >>= -A, A += g; A > 0; u = u * 256 + t[e + L], L += _, A -= 8)
724
739
  ;
725
740
  for (l = u & (1 << -A) - 1, u >>= -A, A += s; A > 0; l = l * 256 + t[e + L], L += _, A -= 8)
726
741
  ;
@@ -734,10 +749,10 @@ function pt() {
734
749
  return (d ? -1 : 1) * l * Math.pow(2, u - s);
735
750
  }
736
751
  function N(t, e, r, s, o, u) {
737
- var l, p, F, S = u * 8 - o - 1, A = (1 << S) - 1, L = A >> 1, _ = o === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = s ? 0 : u - 1, f = s ? 1 : -1, h = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
738
- for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (p = isNaN(e) ? 1 : 0, l = A) : (l = Math.floor(Math.log(e) / Math.LN2), e * (F = Math.pow(2, -l)) < 1 && (l--, F *= 2), l + L >= 1 ? e += _ / F : e += _ * Math.pow(2, 1 - L), e * F >= 2 && (l++, F /= 2), l + L >= A ? (p = 0, l = A) : l + L >= 1 ? (p = (e * F - 1) * Math.pow(2, o), l = l + L) : (p = e * Math.pow(2, L - 1) * Math.pow(2, o), l = 0)); o >= 8; t[r + d] = p & 255, d += f, p /= 256, o -= 8)
752
+ var l, g, F, S = u * 8 - o - 1, A = (1 << S) - 1, L = A >> 1, _ = o === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = s ? 0 : u - 1, f = s ? 1 : -1, h = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
753
+ for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (g = isNaN(e) ? 1 : 0, l = A) : (l = Math.floor(Math.log(e) / Math.LN2), e * (F = Math.pow(2, -l)) < 1 && (l--, F *= 2), l + L >= 1 ? e += _ / F : e += _ * Math.pow(2, 1 - L), e * F >= 2 && (l++, F /= 2), l + L >= A ? (g = 0, l = A) : l + L >= 1 ? (g = (e * F - 1) * Math.pow(2, o), l = l + L) : (g = e * Math.pow(2, L - 1) * Math.pow(2, o), l = 0)); o >= 8; t[r + d] = g & 255, d += f, g /= 256, o -= 8)
739
754
  ;
740
- for (l = l << o | p, S += o; S > 0; t[r + d] = l & 255, d += f, l /= 256, S -= 8)
755
+ for (l = l << o | g, S += o; S > 0; t[r + d] = l & 255, d += f, l /= 256, S -= 8)
741
756
  ;
742
757
  t[r + d - f] |= h * 128;
743
758
  }
@@ -762,7 +777,7 @@ function pt() {
762
777
  if (t >>>= 0, t < 0 || t + 4 > this.buffer.byteLength)
763
778
  throw RangeError("Illegal offset: 0 <= " + t + " (+4) <= " + this.buffer.byteLength);
764
779
  }
765
- var r = I(this.view, t, this.littleEndian, 23, 4);
780
+ var r = v(this.view, t, this.littleEndian, 23, 4);
766
781
  return e && (this.offset += 4), r;
767
782
  }, a.readFloat = a.readFloat32, a.writeFloat64 = function(t, e) {
768
783
  var r = typeof e > "u";
@@ -785,7 +800,7 @@ function pt() {
785
800
  if (t >>>= 0, t < 0 || t + 8 > this.buffer.byteLength)
786
801
  throw RangeError("Illegal offset: 0 <= " + t + " (+8) <= " + this.buffer.byteLength);
787
802
  }
788
- var r = I(this.view, t, this.littleEndian, 52, 8);
803
+ var r = v(this.view, t, this.littleEndian, 52, 8);
789
804
  return e && (this.offset += 8), r;
790
805
  }, a.readDouble = a.readFloat64, n.MAX_VARINT32_BYTES = 5, n.calculateVarint32 = function(t) {
791
806
  return t = t >>> 0, t < 128 ? 1 : t < 16384 ? 2 : t < 1 << 21 ? 3 : t < 1 << 28 ? 4 : 5;
@@ -859,8 +874,8 @@ function pt() {
859
874
  typeof t == "number" ? t = i.fromNumber(t, !1) : typeof t == "string" ? t = i.fromString(t, !1) : t.unsigned !== !1 && (t = t.toSigned());
860
875
  var s = n.calculateVarint64(t), o = t.toInt() >>> 0, u = t.shiftRightUnsigned(28).toInt() >>> 0, l = t.shiftRightUnsigned(56).toInt() >>> 0;
861
876
  e += s;
862
- var p = this.buffer.byteLength;
863
- switch (e > p && this.resize((p *= 2) > e ? p : e), e -= s, s) {
877
+ var g = this.buffer.byteLength;
878
+ switch (e > g && this.resize((g *= 2) > e ? g : e), e -= s, s) {
864
879
  case 10:
865
880
  this.view[e + 9] = l >>> 7 & 1;
866
881
  case 9:
@@ -896,9 +911,9 @@ function pt() {
896
911
  var r = t, s = 0, o = 0, u = 0, l = 0;
897
912
  if (l = this.view[t++], s = l & 127, l & 128 && (l = this.view[t++], s |= (l & 127) << 7, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], s |= (l & 127) << 14, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], s |= (l & 127) << 21, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], o = l & 127, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], o |= (l & 127) << 7, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], o |= (l & 127) << 14, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], o |= (l & 127) << 21, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], u = l & 127, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], u |= (l & 127) << 7, l & 128 || this.noAssert && typeof l > "u"))))))))))
898
913
  throw Error("Buffer overrun");
899
- var p = i.fromBits(s | o << 28, o >>> 4 | u << 24, !1);
900
- return e ? (this.offset = t, p) : {
901
- value: p,
914
+ var g = i.fromBits(s | o << 28, o >>> 4 | u << 24, !1);
915
+ return e ? (this.offset = t, g) : {
916
+ value: g,
902
917
  length: t - r
903
918
  };
904
919
  }, a.readVarint64ZigZag = function(t) {
@@ -919,9 +934,9 @@ function pt() {
919
934
  if (e >>>= 0, e < 0 || e + 0 > this.buffer.byteLength)
920
935
  throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
921
936
  }
922
- o = m.calculateUTF16asUTF8(w(t))[1], e += o + 1;
937
+ o = m.calculateUTF16asUTF8(y(t))[1], e += o + 1;
923
938
  var u = this.buffer.byteLength;
924
- return e > u && this.resize((u *= 2) > e ? u : e), e -= o + 1, m.encodeUTF16toUTF8(w(t), (function(l) {
939
+ return e > u && this.resize((u *= 2) > e ? u : e), e -= o + 1, m.encodeUTF16toUTF8(y(t), (function(l) {
925
940
  this.view[e++] = l;
926
941
  }).bind(this)), this.view[e++] = 0, r ? (this.offset = e, this) : o;
927
942
  }, a.readCString = function(t) {
@@ -938,7 +953,7 @@ function pt() {
938
953
  if (t >= this.limit)
939
954
  throw RangeError("Illegal range: Truncated data, " + t + " < " + this.limit);
940
955
  return o = this.view[t++], o === 0 ? null : o;
941
- }).bind(this), s = y(), !0), e ? (this.offset = t, s()) : {
956
+ }).bind(this), s = b(), !0), e ? (this.offset = t, s()) : {
942
957
  string: s(),
943
958
  length: t - r
944
959
  };
@@ -953,9 +968,9 @@ function pt() {
953
968
  throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
954
969
  }
955
970
  var s = e, o;
956
- o = m.calculateUTF16asUTF8(w(t), this.noAssert)[1], e += 4 + o;
971
+ o = m.calculateUTF16asUTF8(y(t), this.noAssert)[1], e += 4 + o;
957
972
  var u = this.buffer.byteLength;
958
- if (e > u && this.resize((u *= 2) > e ? u : e), e -= 4 + o, this.littleEndian ? (this.view[e + 3] = o >>> 24 & 255, this.view[e + 2] = o >>> 16 & 255, this.view[e + 1] = o >>> 8 & 255, this.view[e] = o & 255) : (this.view[e] = o >>> 24 & 255, this.view[e + 1] = o >>> 16 & 255, this.view[e + 2] = o >>> 8 & 255, this.view[e + 3] = o & 255), e += 4, m.encodeUTF16toUTF8(w(t), (function(l) {
973
+ if (e > u && this.resize((u *= 2) > e ? u : e), e -= 4 + o, this.littleEndian ? (this.view[e + 3] = o >>> 24 & 255, this.view[e + 2] = o >>> 16 & 255, this.view[e + 1] = o >>> 8 & 255, this.view[e] = o & 255) : (this.view[e] = o >>> 24 & 255, this.view[e + 1] = o >>> 16 & 255, this.view[e + 2] = o >>> 8 & 255, this.view[e + 3] = o & 255), e += 4, m.encodeUTF16toUTF8(y(t), (function(l) {
959
974
  this.view[e++] = l;
960
975
  }).bind(this)), e !== s + 4 + o)
961
976
  throw RangeError("Illegal range: Truncated data, " + e + " == " + (e + 4 + o));
@@ -982,15 +997,15 @@ function pt() {
982
997
  throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
983
998
  }
984
999
  var s, o = e;
985
- s = m.calculateUTF16asUTF8(w(t))[1], e += s;
1000
+ s = m.calculateUTF16asUTF8(y(t))[1], e += s;
986
1001
  var u = this.buffer.byteLength;
987
- return e > u && this.resize((u *= 2) > e ? u : e), e -= s, m.encodeUTF16toUTF8(w(t), (function(l) {
1002
+ return e > u && this.resize((u *= 2) > e ? u : e), e -= s, m.encodeUTF16toUTF8(y(t), (function(l) {
988
1003
  this.view[e++] = l;
989
1004
  }).bind(this)), r ? (this.offset = e, this) : e - o;
990
1005
  }, a.writeString = a.writeUTF8String, n.calculateUTF8Chars = function(t) {
991
- return m.calculateUTF16asUTF8(w(t))[0];
1006
+ return m.calculateUTF16asUTF8(y(t))[0];
992
1007
  }, n.calculateUTF8Bytes = function(t) {
993
- return m.calculateUTF16asUTF8(w(t))[1];
1008
+ return m.calculateUTF16asUTF8(y(t))[1];
994
1009
  }, n.calculateString = n.calculateUTF8Bytes, a.readUTF8String = function(t, e, r) {
995
1010
  typeof e == "number" && (r = e, e = void 0);
996
1011
  var s = typeof r > "u";
@@ -1004,7 +1019,7 @@ function pt() {
1004
1019
  }
1005
1020
  var o = 0, u = r, l;
1006
1021
  if (e === n.METRICS_CHARS) {
1007
- if (l = y(), m.decodeUTF8((function() {
1022
+ if (l = b(), m.decodeUTF8((function() {
1008
1023
  return o < t && r < this.limit ? this.view[r++] : null;
1009
1024
  }).bind(this), function(F) {
1010
1025
  ++o, m.UTF8toUTF16(F, l);
@@ -1021,11 +1036,11 @@ function pt() {
1021
1036
  if (r >>>= 0, r < 0 || r + t > this.buffer.byteLength)
1022
1037
  throw RangeError("Illegal offset: 0 <= " + r + " (+" + t + ") <= " + this.buffer.byteLength);
1023
1038
  }
1024
- var p = r + t;
1039
+ var g = r + t;
1025
1040
  if (m.decodeUTF8toUTF16((function() {
1026
- return r < p ? this.view[r++] : null;
1027
- }).bind(this), l = y(), this.noAssert), r !== p)
1028
- throw RangeError("Illegal range: Truncated data, " + r + " == " + p);
1041
+ return r < g ? this.view[r++] : null;
1042
+ }).bind(this), l = b(), this.noAssert), r !== g)
1043
+ throw RangeError("Illegal range: Truncated data, " + r + " == " + g);
1029
1044
  return s ? (this.offset = r, l()) : {
1030
1045
  string: l(),
1031
1046
  length: r - u
@@ -1043,10 +1058,10 @@ function pt() {
1043
1058
  throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
1044
1059
  }
1045
1060
  var s = e, o, u;
1046
- o = m.calculateUTF16asUTF8(w(t), this.noAssert)[1], u = n.calculateVarint32(o), e += u + o;
1061
+ o = m.calculateUTF16asUTF8(y(t), this.noAssert)[1], u = n.calculateVarint32(o), e += u + o;
1047
1062
  var l = this.buffer.byteLength;
1048
- if (e > l && this.resize((l *= 2) > e ? l : e), e -= u + o, e += this.writeVarint32(o, e), m.encodeUTF16toUTF8(w(t), (function(p) {
1049
- this.view[e++] = p;
1063
+ if (e > l && this.resize((l *= 2) > e ? l : e), e -= u + o, e += this.writeVarint32(o, e), m.encodeUTF16toUTF8(y(t), (function(g) {
1064
+ this.view[e++] = g;
1050
1065
  }).bind(this)), e !== s + o + u)
1051
1066
  throw RangeError("Illegal range: Truncated data, " + e + " == " + (e + o + u));
1052
1067
  return r ? (this.offset = e, this) : e - s;
@@ -1179,8 +1194,8 @@ function pt() {
1179
1194
  if (o <= 0) return this;
1180
1195
  var u = o - r;
1181
1196
  if (u > 0) {
1182
- var l = new ArrayBuffer(this.buffer.byteLength + u), p = new Uint8Array(l);
1183
- p.set(this.view.subarray(r, this.buffer.byteLength), o), this.buffer = l, this.view = p, this.offset += u, this.markedOffset >= 0 && (this.markedOffset += u), this.limit += u, r += u;
1197
+ var l = new ArrayBuffer(this.buffer.byteLength + u), g = new Uint8Array(l);
1198
+ g.set(this.view.subarray(r, this.buffer.byteLength), o), this.buffer = l, this.view = g, this.offset += u, this.markedOffset >= 0 && (this.markedOffset += u), this.limit += u, r += u;
1184
1199
  } else
1185
1200
  new Uint8Array(this.buffer);
1186
1201
  return this.view.set(t.view.subarray(t.offset, t.limit), r - o), t.offset = t.limit, s && (this.offset -= o), this;
@@ -1347,23 +1362,23 @@ function pt() {
1347
1362
  ], r = [], s = 0, o = e.length; s < o; ++s)
1348
1363
  r[e[s]] = s;
1349
1364
  return t.encode = function(u, l) {
1350
- for (var p, F; (p = u()) !== null; )
1351
- l(e[p >> 2 & 63]), F = (p & 3) << 4, (p = u()) !== null ? (F |= p >> 4 & 15, l(e[(F | p >> 4 & 15) & 63]), F = (p & 15) << 2, (p = u()) !== null ? (l(e[(F | p >> 6 & 3) & 63]), l(e[p & 63])) : (l(e[F & 63]), l(61))) : (l(e[F & 63]), l(61), l(61));
1365
+ for (var g, F; (g = u()) !== null; )
1366
+ l(e[g >> 2 & 63]), F = (g & 3) << 4, (g = u()) !== null ? (F |= g >> 4 & 15, l(e[(F | g >> 4 & 15) & 63]), F = (g & 15) << 2, (g = u()) !== null ? (l(e[(F | g >> 6 & 3) & 63]), l(e[g & 63])) : (l(e[F & 63]), l(61))) : (l(e[F & 63]), l(61), l(61));
1352
1367
  }, t.decode = function(u, l) {
1353
- var p, F, S;
1368
+ var g, F, S;
1354
1369
  function A(L) {
1355
1370
  throw Error("Illegal character code: " + L);
1356
1371
  }
1357
- for (; (p = u()) !== null; )
1358
- if (F = r[p], typeof F > "u" && A(p), (p = u()) !== null && (S = r[p], typeof S > "u" && A(p), l(F << 2 >>> 0 | (S & 48) >> 4), (p = u()) !== null)) {
1359
- if (F = r[p], typeof F > "u") {
1360
- if (p === 61) break;
1361
- A(p);
1372
+ for (; (g = u()) !== null; )
1373
+ if (F = r[g], typeof F > "u" && A(g), (g = u()) !== null && (S = r[g], typeof S > "u" && A(g), l(F << 2 >>> 0 | (S & 48) >> 4), (g = u()) !== null)) {
1374
+ if (F = r[g], typeof F > "u") {
1375
+ if (g === 61) break;
1376
+ A(g);
1362
1377
  }
1363
- if (l((S & 15) << 4 >>> 0 | (F & 60) >> 2), (p = u()) !== null) {
1364
- if (S = r[p], typeof S > "u") {
1365
- if (p === 61) break;
1366
- A(p);
1378
+ if (l((S & 15) << 4 >>> 0 | (F & 60) >> 2), (g = u()) !== null) {
1379
+ if (S = r[g], typeof S > "u") {
1380
+ if (g === 61) break;
1381
+ A(g);
1367
1382
  }
1368
1383
  l((F & 3) << 6 >>> 0 | S);
1369
1384
  }
@@ -1378,12 +1393,12 @@ function pt() {
1378
1393
  var r;
1379
1394
  return T.encode((function() {
1380
1395
  return t < e ? this.view[t++] : null;
1381
- }).bind(this), r = y()), r();
1396
+ }).bind(this), r = b()), r();
1382
1397
  }, n.fromBase64 = function(t, e) {
1383
1398
  if (typeof t != "string")
1384
1399
  throw TypeError("str");
1385
1400
  var r = new n(t.length / 4 * 3, e), s = 0;
1386
- return T.decode(w(t), function(o) {
1401
+ return T.decode(y(t), function(o) {
1387
1402
  r.view[s++] = o;
1388
1403
  }), r.limit = s, r;
1389
1404
  }, n.btoa = function(t) {
@@ -1424,8 +1439,8 @@ function pt() {
1424
1439
  }
1425
1440
  return t ? l : o;
1426
1441
  }, n.fromDebug = function(t, e, r) {
1427
- for (var s = t.length, o = new n((s + 1) / 3 | 0, e, r), u = 0, l = 0, p, F, S = !1, A = !1, L = !1, _ = !1, d = !1; u < s; ) {
1428
- switch (p = t.charAt(u++)) {
1442
+ for (var s = t.length, o = new n((s + 1) / 3 | 0, e, r), u = 0, l = 0, g, F, S = !1, A = !1, L = !1, _ = !1, d = !1; u < s; ) {
1443
+ switch (g = t.charAt(u++)) {
1429
1444
  case "!":
1430
1445
  if (!r) {
1431
1446
  if (A || L || _) {
@@ -1504,7 +1519,7 @@ function pt() {
1504
1519
  d = !0;
1505
1520
  break;
1506
1521
  }
1507
- if (F = parseInt(p + t.charAt(u++), 16), !r && (isNaN(F) || F < 0 || F > 255))
1522
+ if (F = parseInt(g + t.charAt(u++), 16), !r && (isNaN(F) || F < 0 || F > 255))
1508
1523
  throw TypeError("Illegal str: Not a debug encoded string");
1509
1524
  o.view[l++] = F, S = !0;
1510
1525
  }
@@ -1537,12 +1552,12 @@ function pt() {
1537
1552
  if (t.length % 2 !== 0)
1538
1553
  throw TypeError("Illegal str: Length not a multiple of 2");
1539
1554
  }
1540
- for (var s = t.length, o = new n(s / 2 | 0, e), u, l = 0, p = 0; l < s; l += 2) {
1555
+ for (var s = t.length, o = new n(s / 2 | 0, e), u, l = 0, g = 0; l < s; l += 2) {
1541
1556
  if (u = parseInt(t.substring(l, l + 2), 16), !r && (!isFinite(u) || u < 0 || u > 255))
1542
1557
  throw TypeError("Illegal str: Contains non-hex characters");
1543
- o.view[p++] = u;
1558
+ o.view[g++] = u;
1544
1559
  }
1545
- return o.limit = p, o;
1560
+ return o.limit = g, o;
1546
1561
  };
1547
1562
  var m = function() {
1548
1563
  var t = {};
@@ -1553,7 +1568,7 @@ function pt() {
1553
1568
  }); s !== null || (s = e()) !== null; )
1554
1569
  s < 128 ? r(s & 127) : s < 2048 ? (r(s >> 6 & 31 | 192), r(s & 63 | 128)) : s < 65536 ? (r(s >> 12 & 15 | 224), r(s >> 6 & 63 | 128), r(s & 63 | 128)) : (r(s >> 18 & 7 | 240), r(s >> 12 & 63 | 128), r(s >> 6 & 63 | 128), r(s & 63 | 128)), s = null;
1555
1570
  }, t.decodeUTF8 = function(e, r) {
1556
- for (var s, o, u, l, p = function(F) {
1571
+ for (var s, o, u, l, g = function(F) {
1557
1572
  F = F.slice(0, F.indexOf(null));
1558
1573
  var S = Error(F.toString());
1559
1574
  throw S.name = "TruncatedError", S.bytes = F, S;
@@ -1561,11 +1576,11 @@ function pt() {
1561
1576
  if ((s & 128) === 0)
1562
1577
  r(s);
1563
1578
  else if ((s & 224) === 192)
1564
- (o = e()) === null && p([s, o]), r((s & 31) << 6 | o & 63);
1579
+ (o = e()) === null && g([s, o]), r((s & 31) << 6 | o & 63);
1565
1580
  else if ((s & 240) === 224)
1566
- ((o = e()) === null || (u = e()) === null) && p([s, o, u]), r((s & 15) << 12 | (o & 63) << 6 | u & 63);
1581
+ ((o = e()) === null || (u = e()) === null) && g([s, o, u]), r((s & 15) << 12 | (o & 63) << 6 | u & 63);
1567
1582
  else if ((s & 248) === 240)
1568
- ((o = e()) === null || (u = e()) === null || (l = e()) === null) && p([s, o, u, l]), r((s & 7) << 18 | (o & 63) << 12 | (u & 63) << 6 | l & 63);
1583
+ ((o = e()) === null || (u = e()) === null || (l = e()) === null) && g([s, o, u, l]), r((s & 7) << 18 | (o & 63) << 12 | (u & 63) << 6 | l & 63);
1569
1584
  else throw RangeError("Illegal starting byte: " + s);
1570
1585
  }, t.UTF16toUTF8 = function(e, r) {
1571
1586
  for (var s, o = null; (s = o !== null ? o : e()) !== null; ) {
@@ -1616,7 +1631,7 @@ function pt() {
1616
1631
  try {
1617
1632
  m.decodeUTF8toUTF16((function() {
1618
1633
  return t < e ? this.view[t++] : null;
1619
- }).bind(this), r = y());
1634
+ }).bind(this), r = b());
1620
1635
  } catch {
1621
1636
  if (t !== e)
1622
1637
  throw RangeError("Illegal range: Truncated data, " + t + " != " + e);
@@ -1625,16 +1640,16 @@ function pt() {
1625
1640
  }, n.fromUTF8 = function(t, e, r) {
1626
1641
  if (!r && typeof t != "string")
1627
1642
  throw TypeError("Illegal str: Not a string");
1628
- var s = new n(m.calculateUTF16asUTF8(w(t), !0)[1], e, r), o = 0;
1629
- return m.encodeUTF16toUTF8(w(t), function(u) {
1643
+ var s = new n(m.calculateUTF16asUTF8(y(t), !0)[1], e, r), o = 0;
1644
+ return m.encodeUTF16toUTF8(y(t), function(u) {
1630
1645
  s.view[o++] = u;
1631
1646
  }), s.limit = o, s;
1632
1647
  }, n;
1633
1648
  });
1634
1649
  }(W)), W.exports;
1635
1650
  }
1636
- var dt = pt();
1637
- const q = /* @__PURE__ */ lt(dt), yt = 1, wt = 2, bt = 512, Et = 513, Ft = 514, Tt = 1, vt = 3;
1651
+ var yt = dt();
1652
+ const q = /* @__PURE__ */ ct(yt), wt = 1, Et = 2, bt = 512, Ft = 513, Tt = 514, vt = 1, It = 3;
1638
1653
  class H {
1639
1654
  // 实例属性的类型标注
1640
1655
  valueStringPool;
@@ -1666,11 +1681,11 @@ class H {
1666
1681
  * @return {Record<string, string[]>}
1667
1682
  */
1668
1683
  processResourceTable(i) {
1669
- const n = q.wrap(i, "binary", !0), a = n.readShort(), c = n.readShort(), E = n.readInt(), w = n.readInt();
1670
- let y, I;
1671
- if (a !== wt)
1684
+ const n = q.wrap(i, "binary", !0), a = n.readShort(), c = n.readShort(), w = n.readInt(), y = n.readInt();
1685
+ let b, v;
1686
+ if (a !== Et)
1672
1687
  throw new Error("No RES_TABLE_TYPE found!");
1673
- if (E !== n.limit)
1688
+ if (w !== n.limit)
1674
1689
  throw new Error("The buffer size not matches to the resource table size.");
1675
1690
  n.offset = c;
1676
1691
  let N = 0, T = 0;
@@ -1681,10 +1696,10 @@ class H {
1681
1696
  } catch {
1682
1697
  break;
1683
1698
  }
1684
- if (t === yt)
1685
- N === 0 && (y = new q(e), n.offset = m, n.prependTo(y), I = q.wrap(y, "binary", !0), I.LE(), this.valueStringPool = this.processStringPool(I)), N++;
1699
+ if (t === wt)
1700
+ N === 0 && (b = new q(e), n.offset = m, n.prependTo(b), v = q.wrap(b, "binary", !0), v.LE(), this.valueStringPool = this.processStringPool(v)), N++;
1686
1701
  else if (t === bt)
1687
- y = new q(e), n.offset = m, n.prependTo(y), I = q.wrap(y, "binary", !0), I.LE(), this.processPackage(I), T++;
1702
+ b = new q(e), n.offset = m, n.prependTo(b), v = q.wrap(b, "binary", !0), v.LE(), this.processPackage(v), T++;
1688
1703
  else
1689
1704
  throw new Error("Unsupported type");
1690
1705
  if (n.offset = m + e, !n.remaining())
@@ -1692,7 +1707,7 @@ class H {
1692
1707
  }
1693
1708
  if (N !== 1)
1694
1709
  throw new Error("More than 1 string pool found!");
1695
- if (T !== w)
1710
+ if (T !== y)
1696
1711
  throw new Error("Real package count not equals the declared count.");
1697
1712
  return this.responseMap;
1698
1713
  }
@@ -1710,17 +1725,17 @@ class H {
1710
1725
  i.readUint8();
1711
1726
  const c = i.readInt();
1712
1727
  i.readInt();
1713
- const E = i.readInt();
1728
+ const w = i.readInt();
1714
1729
  if (i.readInt(), c !== n)
1715
1730
  throw new Error("TypeStrings must immediately following the package structure header.");
1716
- let w = i.offset;
1731
+ let y = i.offset;
1717
1732
  i.offset = c;
1718
- const y = H.readBytes(i, i.limit - i.offset);
1719
- i.offset = w, this.typeStringPool = this.processStringPool(y), i.offset = E, i.readShort(), i.readShort();
1720
- const I = i.readInt();
1721
- w = i.offset, i.offset = E;
1733
+ const b = H.readBytes(i, i.limit - i.offset);
1734
+ i.offset = y, this.typeStringPool = this.processStringPool(b), i.offset = w, i.readShort(), i.readShort();
1735
+ const v = i.readInt();
1736
+ y = i.offset, i.offset = w;
1722
1737
  const N = H.readBytes(i, i.limit - i.offset);
1723
- i.offset = w, this.keyStringPool = this.processStringPool(N), i.offset = E + I;
1738
+ i.offset = y, this.keyStringPool = this.processStringPool(N), i.offset = w + v;
1724
1739
  let T;
1725
1740
  for (; ; ) {
1726
1741
  const m = i.offset;
@@ -1730,7 +1745,7 @@ class H {
1730
1745
  } catch {
1731
1746
  break;
1732
1747
  }
1733
- if (t === Ft ? (i.offset = m, T = H.readBytes(i, e), this.processTypeSpec(T)) : t === Et && (i.offset = m, T = H.readBytes(i, e), this.processType(T)), e === 0 || (i.offset = m + e, !i.remaining()))
1748
+ if (t === Tt ? (i.offset = m, T = H.readBytes(i, e), this.processTypeSpec(T)) : t === Ft && (i.offset = m, T = H.readBytes(i, e), this.processType(T)), e === 0 || (i.offset = m + e, !i.remaining()))
1734
1749
  break;
1735
1750
  }
1736
1751
  }
@@ -1744,15 +1759,15 @@ class H {
1744
1759
  i.readInt();
1745
1760
  const a = i.readByte();
1746
1761
  i.readByte(), i.readShort();
1747
- const c = i.readInt(), E = i.readInt(), w = {};
1748
- if (i.readInt(), i.offset = n, n + c * 4 !== E)
1762
+ const c = i.readInt(), w = i.readInt(), y = {};
1763
+ if (i.readInt(), i.offset = n, n + c * 4 !== w)
1749
1764
  throw new Error("HeaderSize, entryCount and entriesStart are not valid.");
1750
- const y = new Array(c);
1751
- for (let I = 0; I < c; ++I)
1752
- y[I] = i.readInt();
1753
- for (let I = 0; I < c; ++I) {
1754
- if (y[I] === -1) continue;
1755
- const N = this.package_id << 24 | a << 16 | I, T = i.offset;
1765
+ const b = new Array(c);
1766
+ for (let v = 0; v < c; ++v)
1767
+ b[v] = i.readInt();
1768
+ for (let v = 0; v < c; ++v) {
1769
+ if (b[v] === -1) continue;
1770
+ const N = this.package_id << 24 | a << 16 | v, T = i.offset;
1756
1771
  let m, t, e, r;
1757
1772
  try {
1758
1773
  i.readShort(), m = i.readShort(), t = i.readInt();
@@ -1763,9 +1778,9 @@ class H {
1763
1778
  i.readShort(), i.readByte(), e = i.readByte(), r = i.readInt();
1764
1779
  const o = Number(N).toString(16), u = this.keyStringPool[t];
1765
1780
  let l = null;
1766
- const p = parseInt(o, 16);
1767
- let F = this.entryMap[p];
1768
- F == null && (F = []), F.push(u), this.entryMap[p] = F, e === vt ? l = this.valueStringPool[r] : e === Tt ? w[o] = r : l = "" + r, this.putIntoMap("@" + o, l), i.offset = T + 8 + 8;
1781
+ const g = parseInt(o, 16);
1782
+ let F = this.entryMap[g];
1783
+ F == null && (F = []), F.push(u), this.entryMap[g] = F, e === It ? l = this.valueStringPool[r] : e === vt ? y[o] = r : l = "" + r, this.putIntoMap("@" + o, l), i.offset = T + 8 + 8;
1769
1784
  } else {
1770
1785
  i.readInt();
1771
1786
  const o = i.readInt();
@@ -1773,11 +1788,11 @@ class H {
1773
1788
  i.readInt(), i.readShort(), i.readByte(), e = i.readByte(), r = i.readInt();
1774
1789
  }
1775
1790
  }
1776
- for (const I in w) {
1777
- const N = this.responseMap["@" + Number(w[I]).toString(16).toUpperCase()];
1791
+ for (const v in y) {
1792
+ const N = this.responseMap["@" + Number(y[v]).toString(16).toUpperCase()];
1778
1793
  if (N != null && Object.keys(N).length < 1e3)
1779
1794
  for (const T of N)
1780
- this.putIntoMap("@" + I, T);
1795
+ this.putIntoMap("@" + v, T);
1781
1796
  }
1782
1797
  }
1783
1798
  /**
@@ -1791,29 +1806,29 @@ class H {
1791
1806
  i.readInt();
1792
1807
  const a = i.readInt(), c = i.readInt();
1793
1808
  i.readInt();
1794
- let E, w;
1795
- const y = (a & 256) !== 0, I = new Array(n);
1809
+ let w, y;
1810
+ const b = (a & 256) !== 0, v = new Array(n);
1796
1811
  for (let T = 0; T < n; ++T)
1797
- I[T] = i.readInt();
1812
+ v[T] = i.readInt();
1798
1813
  const N = new Array(n);
1799
1814
  for (let T = 0; T < n; ++T) {
1800
- const m = c + I[T];
1801
- if (i.offset = m, N[T] = "", y) {
1802
- E = i.readUint8(), (E & 128) !== 0 && (E = ((E & 127) << 8) + i.readUint8());
1815
+ const m = c + v[T];
1816
+ if (i.offset = m, N[T] = "", b) {
1817
+ w = i.readUint8(), (w & 128) !== 0 && (w = ((w & 127) << 8) + i.readUint8());
1803
1818
  let t = i.readUint8();
1804
1819
  if ((t & 128) !== 0 && (t = ((t & 127) << 8) + i.readUint8()), t > 0) {
1805
- w = H.readBytes(i, t);
1820
+ y = H.readBytes(i, t);
1806
1821
  try {
1807
- N[T] = q.wrap(w, "utf8", !0).toString("utf8");
1822
+ N[T] = q.wrap(y, "utf8", !0).toString("utf8");
1808
1823
  } catch {
1809
1824
  }
1810
1825
  } else
1811
1826
  N[T] = "";
1812
- } else if (E = i.readUint16(), (E & 32768) !== 0 && (E = ((E & 32767) << 16) + i.readUint16()), E > 0) {
1813
- const t = E * 2;
1814
- w = H.readBytes(i, t);
1827
+ } else if (w = i.readUint16(), (w & 32768) !== 0 && (w = ((w & 32767) << 16) + i.readUint16()), w > 0) {
1828
+ const t = w * 2;
1829
+ y = H.readBytes(i, t);
1815
1830
  try {
1816
- N[T] = q.wrap(w, "utf8", !0).toString("utf8");
1831
+ N[T] = q.wrap(y, "utf8", !0).toString("utf8");
1817
1832
  } catch {
1818
1833
  }
1819
1834
  }
@@ -1840,11 +1855,11 @@ class H {
1840
1855
  this.responseMap[a] == null && (this.responseMap[a] = []), n && this.responseMap[a].push(n);
1841
1856
  }
1842
1857
  }
1843
- const z = {
1858
+ const V = {
1844
1859
  ELEMENT_NODE: 1,
1845
1860
  ATTRIBUTE_NODE: 2,
1846
1861
  CDATA_SECTION_NODE: 4
1847
- }, Y = {
1862
+ }, $ = {
1848
1863
  NULL: 0,
1849
1864
  STRING_POOL: 1,
1850
1865
  XML: 3,
@@ -1857,7 +1872,7 @@ const z = {
1857
1872
  }, Z = {
1858
1873
  SORTED: 1,
1859
1874
  UTF8: 256
1860
- }, C = {
1875
+ }, O = {
1861
1876
  COMPLEX_UNIT_DIP: 1,
1862
1877
  COMPLEX_UNIT_FRACTION: 0,
1863
1878
  COMPLEX_UNIT_FRACTION_PARENT: 1,
@@ -1879,7 +1894,7 @@ const z = {
1879
1894
  TYPE_REFERENCE: 1,
1880
1895
  TYPE_STRING: 3
1881
1896
  };
1882
- class It {
1897
+ class mt {
1883
1898
  view;
1884
1899
  // Use DataView for reading little-endian data
1885
1900
  cursor;
@@ -1939,22 +1954,22 @@ class It {
1939
1954
  // Will be overwritten
1940
1955
  }, n = this.readU32(), a = n & 255;
1941
1956
  switch (i.value = n >> 8, i.rawUnit = a, a) {
1942
- case C.COMPLEX_UNIT_MM:
1957
+ case O.COMPLEX_UNIT_MM:
1943
1958
  i.unit = "mm";
1944
1959
  break;
1945
- case C.COMPLEX_UNIT_PX:
1960
+ case O.COMPLEX_UNIT_PX:
1946
1961
  i.unit = "px";
1947
1962
  break;
1948
- case C.COMPLEX_UNIT_DIP:
1963
+ case O.COMPLEX_UNIT_DIP:
1949
1964
  i.unit = "dp";
1950
1965
  break;
1951
- case C.COMPLEX_UNIT_SP:
1966
+ case O.COMPLEX_UNIT_SP:
1952
1967
  i.unit = "sp";
1953
1968
  break;
1954
- case C.COMPLEX_UNIT_PT:
1969
+ case O.COMPLEX_UNIT_PT:
1955
1970
  i.unit = "pt";
1956
1971
  break;
1957
- case C.COMPLEX_UNIT_IN:
1972
+ case O.COMPLEX_UNIT_IN:
1958
1973
  i.unit = "in";
1959
1974
  break;
1960
1975
  }
@@ -1970,10 +1985,10 @@ class It {
1970
1985
  // Will be overwritten
1971
1986
  }, n = this.readU32(), a = n & 15;
1972
1987
  switch (i.value = this.convertIntToFloat(n >> 4), i.rawType = a, a) {
1973
- case C.COMPLEX_UNIT_FRACTION:
1988
+ case O.COMPLEX_UNIT_FRACTION:
1974
1989
  i.type = "%";
1975
1990
  break;
1976
- case C.COMPLEX_UNIT_FRACTION_PARENT:
1991
+ case O.COMPLEX_UNIT_FRACTION_PARENT:
1977
1992
  i.type = "%p";
1978
1993
  break;
1979
1994
  }
@@ -2001,53 +2016,53 @@ class It {
2001
2016
  this.readU8();
2002
2017
  const c = this.readU8();
2003
2018
  switch (a === 0 && (a = 8), i.rawType = c, c) {
2004
- case C.TYPE_INT_DEC:
2019
+ case O.TYPE_INT_DEC:
2005
2020
  i.value = this.readS32(), i.type = "int_dec";
2006
2021
  break;
2007
- case C.TYPE_INT_HEX:
2022
+ case O.TYPE_INT_HEX:
2008
2023
  i.value = this.readS32(), i.type = "int_hex";
2009
2024
  break;
2010
- case C.TYPE_STRING:
2011
- const w = this.readS32();
2012
- i.value = w >= 0 ? this.strings[w] : "", i.type = "string";
2025
+ case O.TYPE_STRING:
2026
+ const y = this.readS32();
2027
+ i.value = y >= 0 ? this.strings[y] : "", i.type = "string";
2013
2028
  break;
2014
- case C.TYPE_REFERENCE:
2015
- const y = this.readU32();
2016
- i.value = `resourceId:0x${y.toString(16)}`, i.type = "reference";
2029
+ case O.TYPE_REFERENCE:
2030
+ const b = this.readU32();
2031
+ i.value = `resourceId:0x${b.toString(16)}`, i.type = "reference";
2017
2032
  break;
2018
- case C.TYPE_INT_BOOLEAN:
2033
+ case O.TYPE_INT_BOOLEAN:
2019
2034
  i.value = this.readS32() !== 0, i.type = "boolean";
2020
2035
  break;
2021
- case C.TYPE_NULL:
2036
+ case O.TYPE_NULL:
2022
2037
  this.readU32(), i.value = null, i.type = "null";
2023
2038
  break;
2024
- case C.TYPE_INT_COLOR_RGB8:
2039
+ case O.TYPE_INT_COLOR_RGB8:
2025
2040
  i.value = this.readHex24(), i.type = "rgb8";
2026
2041
  break;
2027
- case C.TYPE_INT_COLOR_RGB4:
2042
+ case O.TYPE_INT_COLOR_RGB4:
2028
2043
  i.value = this.readHex24(), i.type = "rgb4";
2029
2044
  break;
2030
- case C.TYPE_INT_COLOR_ARGB8:
2045
+ case O.TYPE_INT_COLOR_ARGB8:
2031
2046
  i.value = this.readHex32(), i.type = "argb8";
2032
2047
  break;
2033
- case C.TYPE_INT_COLOR_ARGB4:
2048
+ case O.TYPE_INT_COLOR_ARGB4:
2034
2049
  i.value = this.readHex32(), i.type = "argb4";
2035
2050
  break;
2036
- case C.TYPE_DIMENSION:
2051
+ case O.TYPE_DIMENSION:
2037
2052
  i.value = this.readDimension(), i.type = "dimension";
2038
2053
  break;
2039
- case C.TYPE_FRACTION:
2054
+ case O.TYPE_FRACTION:
2040
2055
  i.value = this.readFraction(), i.type = "fraction";
2041
2056
  break;
2042
2057
  default: {
2043
- const I = c.toString(16);
2044
- console.debug(`Not sure what to do with typed value of type 0x${I}, falling back to reading an uint32.`), i.value = this.readU32(), i.type = "unknown";
2058
+ const v = c.toString(16);
2059
+ console.debug(`Not sure what to do with typed value of type 0x${v}, falling back to reading an uint32.`), i.value = this.readU32(), i.type = "unknown";
2045
2060
  }
2046
2061
  }
2047
- const E = n + a;
2048
- if (this.cursor !== E) {
2049
- const w = c.toString(16), y = E - this.cursor;
2050
- console.debug(`Cursor is off by ${y} bytes at ${this.cursor} at supposed end of typed value of type 0x${w}. The typed value started at offset ${n} and is supposed to end at offset ${E}. Ignoring the rest of the value.`), this.cursor = E;
2062
+ const w = n + a;
2063
+ if (this.cursor !== w) {
2064
+ const y = c.toString(16), b = w - this.cursor;
2065
+ console.debug(`Cursor is off by ${b} bytes at ${this.cursor} at supposed end of typed value of type 0x${y}. The typed value started at offset ${n} and is supposed to end at offset ${w}. Ignoring the rest of the value.`), this.cursor = w;
2051
2066
  }
2052
2067
  return this.debug && console.groupEnd(), i;
2053
2068
  }
@@ -2072,8 +2087,8 @@ class It {
2072
2087
  default:
2073
2088
  throw new Error(`Unsupported encoding '${i}'`);
2074
2089
  }
2075
- const c = new TextDecoder(i === "ucs2" ? "utf-16le" : i), E = new Uint8Array(this.view.buffer, this.cursor, n), w = c.decode(E);
2076
- return this.cursor += n, this.debug && (console.debug("value:", w), console.groupEnd()), w;
2090
+ const c = new TextDecoder(i === "ucs2" ? "utf-16le" : i), w = new Uint8Array(this.view.buffer, this.cursor, n), y = c.decode(w);
2091
+ return this.cursor += n, this.debug && (console.debug("value:", y), console.groupEnd()), y;
2077
2092
  }
2078
2093
  readChunkHeader() {
2079
2094
  this.debug && console.group("readChunkHeader");
@@ -2086,18 +2101,18 @@ class It {
2086
2101
  return this.debug && (console.debug("startOffset:", i.startOffset), console.debug("chunkType:", i.chunkType), console.debug("headerSize:", i.headerSize), console.debug("chunkSize:", i.chunkSize), console.groupEnd()), i;
2087
2102
  }
2088
2103
  readStringPool(i) {
2089
- if (this.debug && console.group("readStringPool"), i.stringCount = this.readU32(), this.debug && console.debug("stringCount:", i.stringCount), i.styleCount = this.readU32(), this.debug && console.debug("styleCount:", i.styleCount), i.flags = this.readU32(), this.debug && console.debug("flags:", i.flags), i.stringsStart = this.readU32(), this.debug && console.debug("stringsStart:", i.stringsStart), i.stylesStart = this.readU32(), this.debug && console.debug("stylesStart:", i.stylesStart), i.chunkType !== Y.STRING_POOL)
2104
+ if (this.debug && console.group("readStringPool"), i.stringCount = this.readU32(), this.debug && console.debug("stringCount:", i.stringCount), i.styleCount = this.readU32(), this.debug && console.debug("styleCount:", i.styleCount), i.flags = this.readU32(), this.debug && console.debug("flags:", i.flags), i.stringsStart = this.readU32(), this.debug && console.debug("stringsStart:", i.stringsStart), i.stylesStart = this.readU32(), this.debug && console.debug("stylesStart:", i.stylesStart), i.chunkType !== $.STRING_POOL)
2090
2105
  throw new Error("Invalid string pool header");
2091
2106
  const n = [];
2092
- for (let w = 0, y = i.stringCount; w < y; ++w)
2093
- this.debug && console.debug("offset:", w), n.push(this.readU32());
2107
+ for (let y = 0, b = i.stringCount; y < b; ++y)
2108
+ this.debug && console.debug("offset:", y), n.push(this.readU32());
2094
2109
  const a = (i.flags & Z.SORTED) === Z.SORTED;
2095
2110
  this.debug && console.debug("sorted:", a);
2096
2111
  const c = (i.flags & Z.UTF8) === Z.UTF8 ? "utf-8" : "ucs2";
2097
2112
  this.debug && console.debug("encoding:", c);
2098
- const E = i.startOffset + (i.stringsStart || 0);
2099
- for (let w = 0, y = i.stringCount; w < y; ++w)
2100
- this.debug && (console.debug("string:", w), console.debug("offset:", n[w])), this.cursor = E + n[w], this.strings.push(this.readString(c));
2113
+ const w = i.startOffset + (i.stringsStart || 0);
2114
+ for (let y = 0, b = i.stringCount; y < b; ++y)
2115
+ this.debug && (console.debug("string:", y), console.debug("offset:", n[y])), this.cursor = w + n[y], this.strings.push(this.readString(c));
2101
2116
  return this.cursor = i.startOffset + i.chunkSize, this.debug && console.groupEnd(), null;
2102
2117
  }
2103
2118
  readResourceMap(i) {
@@ -2117,7 +2132,7 @@ class It {
2117
2132
  this.debug && console.group("readXmlElementStart", i);
2118
2133
  const n = {
2119
2134
  namespaceURI: null,
2120
- nodeType: z.ELEMENT_NODE,
2135
+ nodeType: V.ELEMENT_NODE,
2121
2136
  nodeName: null,
2122
2137
  attributes: [],
2123
2138
  childNodes: []
@@ -2125,17 +2140,17 @@ class It {
2125
2140
  this.readU32(), this.readU32();
2126
2141
  const a = this.readS32(), c = this.readS32();
2127
2142
  a >= 0 && (n.namespaceURI = this.strings[a]), c >= 0 && (n.nodeName = this.strings[c]), this.readU16(), this.readU16();
2128
- const E = this.readU16();
2143
+ const w = this.readU16();
2129
2144
  this.readU16(), this.readU16(), this.readU16();
2130
- for (let w = 0; w < E; ++w)
2145
+ for (let y = 0; y < w; ++y)
2131
2146
  n.attributes.push(this.readXmlAttribute());
2132
- return this.document ? (this.parent && this.parent.nodeType === z.ELEMENT_NODE && this.parent.childNodes.push(n), this.parent = n) : this.document = this.parent = n, this.stack.push(n), this.debug && console.groupEnd(), n;
2147
+ return this.document ? (this.parent && this.parent.nodeType === V.ELEMENT_NODE && this.parent.childNodes.push(n), this.parent = n) : this.document = this.parent = n, this.stack.push(n), this.debug && console.groupEnd(), n;
2133
2148
  }
2134
2149
  readXmlAttribute() {
2135
2150
  this.debug && console.group("readXmlAttribute");
2136
2151
  const i = {
2137
2152
  namespaceURI: null,
2138
- nodeType: z.ATTRIBUTE_NODE,
2153
+ nodeType: V.ATTRIBUTE_NODE,
2139
2154
  nodeName: null,
2140
2155
  name: null,
2141
2156
  value: null,
@@ -2151,7 +2166,7 @@ class It {
2151
2166
  this.debug && console.group("readXmlCData", i);
2152
2167
  const n = {
2153
2168
  namespaceURI: null,
2154
- nodeType: z.CDATA_SECTION_NODE,
2169
+ nodeType: V.CDATA_SECTION_NODE,
2155
2170
  nodeName: "#cdata",
2156
2171
  data: null,
2157
2172
  typedValue: {}
@@ -2159,7 +2174,7 @@ class It {
2159
2174
  };
2160
2175
  this.readU32(), this.readU32();
2161
2176
  const a = this.readS32();
2162
- return a >= 0 && (n.data = this.strings[a]), n.typedValue = this.readTypedValue(), this.parent && this.parent.nodeType === z.ELEMENT_NODE && this.parent.childNodes.push(n), this.debug && console.groupEnd(), n;
2177
+ return a >= 0 && (n.data = this.strings[a]), n.typedValue = this.readTypedValue(), this.parent && this.parent.nodeType === V.ELEMENT_NODE && this.parent.childNodes.push(n), this.debug && console.groupEnd(), n;
2163
2178
  }
2164
2179
  readNull(i) {
2165
2180
  return this.debug && console.group("readNull"), this.cursor += i.chunkSize - i.headerSize, this.debug && console.groupEnd(), null;
@@ -2169,34 +2184,34 @@ class It {
2169
2184
  * @returns The root XML element of the parsed document.
2170
2185
  */
2171
2186
  parse() {
2172
- if (this.debug && console.group("BinaryXmlParser.parse"), this.readChunkHeader().chunkType !== Y.XML)
2187
+ if (this.debug && console.group("BinaryXmlParser.parse"), this.readChunkHeader().chunkType !== $.XML)
2173
2188
  throw new Error("Invalid XML header");
2174
2189
  for (; this.cursor < this.view.byteLength; ) {
2175
2190
  this.debug && console.group("chunk");
2176
2191
  const n = this.cursor, a = this.readChunkHeader();
2177
2192
  switch (a.chunkType) {
2178
- case Y.STRING_POOL:
2193
+ case $.STRING_POOL:
2179
2194
  this.readStringPool(a);
2180
2195
  break;
2181
- case Y.XML_RESOURCE_MAP:
2196
+ case $.XML_RESOURCE_MAP:
2182
2197
  this.readResourceMap(a);
2183
2198
  break;
2184
- case Y.XML_START_NAMESPACE:
2199
+ case $.XML_START_NAMESPACE:
2185
2200
  this.readXmlNamespaceStart(a);
2186
2201
  break;
2187
- case Y.XML_END_NAMESPACE:
2202
+ case $.XML_END_NAMESPACE:
2188
2203
  this.readXmlNamespaceEnd(a);
2189
2204
  break;
2190
- case Y.XML_START_ELEMENT:
2205
+ case $.XML_START_ELEMENT:
2191
2206
  this.readXmlElementStart(a);
2192
2207
  break;
2193
- case Y.XML_END_ELEMENT:
2208
+ case $.XML_END_ELEMENT:
2194
2209
  this.readXmlElementEnd(a);
2195
2210
  break;
2196
- case Y.XML_CDATA:
2211
+ case $.XML_CDATA:
2197
2212
  this.readXmlCData(a);
2198
2213
  break;
2199
- case Y.NULL:
2214
+ case $.NULL:
2200
2215
  this.readNull(a);
2201
2216
  break;
2202
2217
  default:
@@ -2204,16 +2219,16 @@ class It {
2204
2219
  }
2205
2220
  const c = n + a.chunkSize;
2206
2221
  if (this.cursor !== c) {
2207
- const E = c - this.cursor, w = a.chunkType.toString(16);
2208
- console.debug(`Cursor is off by ${E} bytes at ${this.cursor} at supposed end of chunk of type 0x${w}. The chunk started at offset ${n} and is supposed to end at offset ${c}. Ignoring the rest of the chunk.`), this.cursor = c;
2222
+ const w = c - this.cursor, y = a.chunkType.toString(16);
2223
+ console.debug(`Cursor is off by ${w} bytes at ${this.cursor} at supposed end of chunk of type 0x${y}. The chunk started at offset ${n} and is supposed to end at offset ${c}. Ignoring the rest of the chunk.`), this.cursor = c;
2209
2224
  }
2210
2225
  this.debug && console.groupEnd();
2211
2226
  }
2212
2227
  return this.debug && console.groupEnd(), this.document;
2213
2228
  }
2214
2229
  }
2215
- const mt = "android.intent.action.MAIN", xt = "android.intent.category.LAUNCHER";
2216
- class St {
2230
+ const xt = "android.intent.action.MAIN", St = "android.intent.category.LAUNCHER";
2231
+ class Nt {
2217
2232
  buffer;
2218
2233
  xmlParser;
2219
2234
  /**
@@ -2221,7 +2236,7 @@ class St {
2221
2236
  * @param options Configuration options for the underlying BinaryXmlParser.
2222
2237
  */
2223
2238
  constructor(i, n = {}) {
2224
- this.buffer = i, this.xmlParser = new It(this.buffer, n);
2239
+ this.buffer = i, this.xmlParser = new mt(this.buffer, n);
2225
2240
  }
2226
2241
  /**
2227
2242
  * Flattens the attributes of an XML element into a simple key/value object.
@@ -2231,7 +2246,7 @@ class St {
2231
2246
  */
2232
2247
  collapseAttributes(i) {
2233
2248
  const n = /* @__PURE__ */ Object.create(null);
2234
- if (i.nodeType === z.ELEMENT_NODE)
2249
+ if (i.nodeType === V.ELEMENT_NODE)
2235
2250
  for (const a of Array.from(i.attributes))
2236
2251
  n[a.name] = a.typedValue.value;
2237
2252
  return n;
@@ -2241,21 +2256,21 @@ class St {
2241
2256
  */
2242
2257
  parseIntents(i, n) {
2243
2258
  n.intentFilters = [], n.metaData = [], i.childNodes.forEach((a) => {
2244
- if (a.nodeType === z.ELEMENT_NODE)
2259
+ if (a.nodeType === V.ELEMENT_NODE)
2245
2260
  switch (a.nodeName) {
2246
2261
  case "intent-filter": {
2247
2262
  const c = this.collapseAttributes(a);
2248
- c.actions = [], c.categories = [], c.data = [], a.childNodes.forEach((E) => {
2249
- if (E.nodeType === z.ELEMENT_NODE)
2250
- switch (E.nodeName) {
2263
+ c.actions = [], c.categories = [], c.data = [], a.childNodes.forEach((w) => {
2264
+ if (w.nodeType === V.ELEMENT_NODE)
2265
+ switch (w.nodeName) {
2251
2266
  case "action":
2252
- c.actions.push(this.collapseAttributes(E));
2267
+ c.actions.push(this.collapseAttributes(w));
2253
2268
  break;
2254
2269
  case "category":
2255
- c.categories.push(this.collapseAttributes(E));
2270
+ c.categories.push(this.collapseAttributes(w));
2256
2271
  break;
2257
2272
  case "data":
2258
- c.data.push(this.collapseAttributes(E));
2273
+ c.data.push(this.collapseAttributes(w));
2259
2274
  break;
2260
2275
  }
2261
2276
  }), n.intentFilters.push(c);
@@ -2275,7 +2290,7 @@ class St {
2275
2290
  parseApplication(i) {
2276
2291
  const n = this.collapseAttributes(i);
2277
2292
  return n.activities = [], n.activityAliases = [], n.launcherActivities = [], n.services = [], n.receivers = [], n.providers = [], n.usesLibraries = [], n.metaData = [], i.childNodes.forEach((a) => {
2278
- if (a.nodeType === z.ELEMENT_NODE)
2293
+ if (a.nodeType === V.ELEMENT_NODE)
2279
2294
  switch (a.nodeName) {
2280
2295
  case "activity": {
2281
2296
  const c = this.collapseAttributes(a);
@@ -2299,17 +2314,17 @@ class St {
2299
2314
  }
2300
2315
  case "provider": {
2301
2316
  const c = this.collapseAttributes(a);
2302
- c.grantUriPermissions = [], c.metaData = [], c.pathPermissions = [], a.childNodes.forEach((E) => {
2303
- if (E.nodeType === z.ELEMENT_NODE)
2304
- switch (E.nodeName) {
2317
+ c.grantUriPermissions = [], c.metaData = [], c.pathPermissions = [], a.childNodes.forEach((w) => {
2318
+ if (w.nodeType === V.ELEMENT_NODE)
2319
+ switch (w.nodeName) {
2305
2320
  case "grant-uri-permission":
2306
- c.grantUriPermissions.push(this.collapseAttributes(E));
2321
+ c.grantUriPermissions.push(this.collapseAttributes(w));
2307
2322
  break;
2308
2323
  case "meta-data":
2309
- c.metaData.push(this.collapseAttributes(E));
2324
+ c.metaData.push(this.collapseAttributes(w));
2310
2325
  break;
2311
2326
  case "path-permission":
2312
- c.pathPermissions.push(this.collapseAttributes(E));
2327
+ c.pathPermissions.push(this.collapseAttributes(w));
2313
2328
  break;
2314
2329
  }
2315
2330
  }), n.providers.push(c);
@@ -2331,7 +2346,7 @@ class St {
2331
2346
  */
2332
2347
  isLauncherActivity(i) {
2333
2348
  return i.intentFilters.some(function(n) {
2334
- return n.actions.some((c) => c.name === mt) ? n.categories.some((c) => c.name === xt) : !1;
2349
+ return n.actions.some((c) => c.name === xt) ? n.categories.some((c) => c.name === St) : !1;
2335
2350
  });
2336
2351
  }
2337
2352
  /**
@@ -2341,7 +2356,7 @@ class St {
2341
2356
  parse() {
2342
2357
  const i = this.xmlParser.parse(), n = this.collapseAttributes(i);
2343
2358
  return n.usesPermissions = [], n.usesPermissionsSDK23 = [], n.permissions = [], n.permissionTrees = [], n.permissionGroups = [], n.instrumentation = null, n.usesSdk = null, n.usesConfiguration = null, n.usesFeatures = [], n.supportsScreens = null, n.compatibleScreens = [], n.supportsGlTextures = [], i.childNodes.forEach((a) => {
2344
- if (a.nodeType === z.ELEMENT_NODE)
2359
+ if (a.nodeType === V.ELEMENT_NODE)
2345
2360
  switch (a.nodeName) {
2346
2361
  case "uses-permission":
2347
2362
  n.usesPermissions.push(this.collapseAttributes(a));
@@ -2375,7 +2390,7 @@ class St {
2375
2390
  break;
2376
2391
  case "compatible-screens":
2377
2392
  a.childNodes.forEach((c) => {
2378
- if (c.nodeType === z.ELEMENT_NODE)
2393
+ if (c.nodeType === V.ELEMENT_NODE)
2379
2394
  return n.compatibleScreens.push(this.collapseAttributes(c));
2380
2395
  });
2381
2396
  break;
@@ -2389,40 +2404,54 @@ class St {
2389
2404
  }), n;
2390
2405
  }
2391
2406
  }
2392
- async function Dt(g, i) {
2393
- const n = await J(g).catch(B);
2394
- if (n instanceof Error)
2395
- return new Error(`load APK error: ${n.message}`);
2396
- const a = n.file("AndroidManifest.xml"), c = i?.ignoreIcon ? null : n.file("resources.arsc"), [E, w] = await Promise.all([
2397
- a?.async("arraybuffer").catch(B),
2398
- c?.async("arraybuffer").catch(B)
2399
- ]);
2400
- if (!E || E instanceof Error)
2401
- return new Error("not found AndroidManifest.xml");
2402
- const y = Nt(E);
2403
- if (y instanceof Error)
2404
- return new Error(`parse AndroidManifest.xml error: ${y.message}`);
2405
- const I = {
2406
- package: y.package,
2407
- versionCode: y.versionCode,
2408
- versionName: y.versionName,
2409
- manifest: y,
2410
- application: y.application,
2411
- metaData: y.application?.metaData
2412
- }, N = y.application?.icon;
2413
- if (!w || w instanceof Error || !N || typeof N != "string")
2414
- return I;
2415
- const T = Ut(w, N);
2416
- if (!T)
2417
- return I;
2418
- const m = n.file(T);
2419
- if (!m)
2420
- return I;
2421
- const t = await m.async("base64").catch(B);
2422
- return t instanceof Error || (I.icon = rt(t)), I;
2407
+ class Dt {
2408
+ zip;
2409
+ constructor(i) {
2410
+ this.zip = J(i).catch(R);
2411
+ }
2412
+ async parse(i) {
2413
+ const n = await this.zip;
2414
+ if (n instanceof Error)
2415
+ return new Error(`load file error: ${n.message}`);
2416
+ const a = n.file("AndroidManifest.xml"), c = i?.ignoreIcon ? null : n.file("resources.arsc"), [w, y] = await Promise.all([
2417
+ a?.async("arraybuffer").catch(R),
2418
+ c?.async("arraybuffer").catch(R)
2419
+ ]);
2420
+ if (!w || w instanceof Error)
2421
+ return new Error("not found AndroidManifest.xml");
2422
+ const b = Ut(w);
2423
+ if (b instanceof Error)
2424
+ return new Error(`parse AndroidManifest.xml error: ${b.message}`);
2425
+ const v = {
2426
+ package: b.package,
2427
+ versionCode: b.versionCode,
2428
+ versionName: b.versionName,
2429
+ manifest: b
2430
+ }, N = b.application?.icon;
2431
+ if (!y || y instanceof Error || !N || typeof N != "string")
2432
+ return v;
2433
+ const T = At(y, N);
2434
+ if (!T)
2435
+ return v;
2436
+ const m = n.file(T);
2437
+ if (!m)
2438
+ return v;
2439
+ const t = await m.async("base64").catch(R);
2440
+ return t instanceof Error || (v.icon = rt(t)), v;
2441
+ }
2442
+ /**
2443
+ * 读取指定文件的内容
2444
+ */
2445
+ async readFile(i) {
2446
+ const n = await this.zip;
2447
+ if (n instanceof Error)
2448
+ return n;
2449
+ const a = typeof i == "string" ? n.file(i) : n.file(i)[0];
2450
+ return a ? await a.async("arraybuffer").catch(R) : new Error(`not found ${i}`);
2451
+ }
2423
2452
  }
2424
- function Nt(g) {
2425
- const i = new St(g, {
2453
+ function Ut(p) {
2454
+ const i = new Nt(p, {
2426
2455
  ignore: [
2427
2456
  "application.activity",
2428
2457
  "application.service",
@@ -2434,77 +2463,77 @@ function Nt(g) {
2434
2463
  try {
2435
2464
  return i.parse();
2436
2465
  } catch (n) {
2437
- return B(n);
2466
+ return R(n);
2438
2467
  }
2439
2468
  }
2440
- function Ut(g, i) {
2469
+ function At(p, i) {
2441
2470
  try {
2442
- const n = new H().processResourceTable(g), a = i.replace(/^resourceId:0x/, "@").toUpperCase();
2471
+ const n = new H().processResourceTable(p), a = i.replace(/^resourceId:0x/, "@").toUpperCase();
2443
2472
  return n[a]?.[0] || "";
2444
2473
  } catch {
2445
2474
  return "";
2446
2475
  }
2447
2476
  }
2448
2477
  typeof globalThis < "u" || typeof self < "u" || typeof window < "u" || Function("return this")();
2449
- function G(g, ...i) {
2450
- if (!g || typeof g != "object") return !1;
2451
- const n = Object.getPrototypeOf(g);
2452
- return n !== Object.prototype && n !== null ? !1 : i.every((a) => a in g);
2478
+ function G(p, ...i) {
2479
+ if (!p || typeof p != "object") return !1;
2480
+ const n = Object.getPrototypeOf(p);
2481
+ return n !== Object.prototype && n !== null ? !1 : i.every((a) => a in p);
2453
2482
  }
2454
- class At {
2483
+ class _t {
2455
2484
  constructor(i) {
2456
2485
  this.UID = i;
2457
2486
  }
2458
2487
  }
2459
- const _t = 9783072e5, V = 100 * 1e3 * 1e3, Lt = 32768;
2460
- function et(g, i, n) {
2461
- return new DataView(g, i, n);
2488
+ const Lt = 9783072e5, X = 100 * 1e3 * 1e3, kt = 32768;
2489
+ function et(p, i, n) {
2490
+ return new DataView(p, i, n);
2462
2491
  }
2463
- function $(g, i = 0) {
2492
+ function j(p, i = 0) {
2464
2493
  let n = 0;
2465
- for (let a = i; a < g.length; a++)
2466
- n <<= 8, n |= g[a] & 255;
2494
+ for (let a = i; a < p.length; a++)
2495
+ n <<= 8, n |= p[a] & 255;
2467
2496
  return n;
2468
2497
  }
2469
- function tt(g, i) {
2470
- return et(g, i, 8).getUint32(4, !1);
2498
+ function tt(p, i) {
2499
+ return et(p, i, 8).getUint32(4, !1);
2471
2500
  }
2472
- function kt(g) {
2473
- const i = g.length;
2501
+ function Rt(p) {
2502
+ const i = p.length;
2474
2503
  for (let n = 0; n < i; n += 2) {
2475
- const a = g[n];
2476
- g[n] = g[n + 1], g[n + 1] = a;
2504
+ const a = p[n];
2505
+ p[n] = p[n + 1], p[n + 1] = a;
2477
2506
  }
2478
- return g;
2507
+ return p;
2479
2508
  }
2480
- function Rt(g) {
2509
+ function Ct(p) {
2481
2510
  let i = "", n;
2482
- for (n = 0; n < g.length && g[n] === 0; n++)
2511
+ for (n = 0; n < p.length && p[n] === 0; n++)
2483
2512
  ;
2484
- for (; n < g.length; n++) {
2485
- const a = "00" + g[n].toString(16);
2513
+ for (; n < p.length; n++) {
2514
+ const a = "00" + p[n].toString(16);
2486
2515
  i += a.substring(a.length - 2);
2487
2516
  }
2488
2517
  return i;
2489
2518
  }
2490
- function Ct(g) {
2519
+ function st(p) {
2491
2520
  try {
2492
- return Ot(g);
2521
+ return Ot(p);
2493
2522
  } catch (i) {
2494
- return B(i);
2523
+ return R(i);
2495
2524
  }
2496
2525
  }
2497
- function Ot(g) {
2498
- const i = new Uint8Array(g), n = i.slice(0, 6);
2526
+ function Ot(p) {
2527
+ const i = new Uint8Array(p), n = i.slice(0, 6);
2499
2528
  if (new TextDecoder("utf8").decode(n) !== "bplist")
2500
2529
  throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
2501
- const c = g.byteLength - 32, E = new DataView(g, c, 32), w = E.getUint8(6), y = E.getUint8(7), I = tt(g, c + 8), N = tt(g, c + 16), T = tt(g, c + 24);
2502
- if (I > Lt)
2530
+ const c = p.byteLength - 32, w = new DataView(p, c, 32), y = w.getUint8(6), b = w.getUint8(7), v = tt(p, c + 8), N = tt(p, c + 16), T = tt(p, c + 24);
2531
+ if (v > kt)
2503
2532
  throw new Error("maxObjectCount exceeded");
2504
2533
  const m = [];
2505
- for (let e = 0; e < I; e++) {
2506
- const r = i.slice(T + e * w, T + (e + 1) * w);
2507
- m[e] = $(r, 0);
2534
+ for (let e = 0; e < v; e++) {
2535
+ const r = i.slice(T + e * y, T + (e + 1) * y);
2536
+ m[e] = j(r, 0);
2508
2537
  }
2509
2538
  function t(e) {
2510
2539
  const r = m[e], s = i[r], o = (s & 240) >> 4, u = s & 15;
@@ -2512,7 +2541,7 @@ function Ot(g) {
2512
2541
  case 0:
2513
2542
  return l();
2514
2543
  case 1:
2515
- return p();
2544
+ return g();
2516
2545
  case 8:
2517
2546
  return F();
2518
2547
  case 2:
@@ -2546,180 +2575,208 @@ function Ot(g) {
2546
2575
  throw new Error("Unhandled simple type 0x" + o.toString(16) + u.toString(16));
2547
2576
  }
2548
2577
  }
2549
- function p() {
2578
+ function g() {
2550
2579
  const h = Math.pow(2, u);
2551
- if (h < V) {
2552
- const b = i.slice(r + 1, r + 1 + h);
2580
+ if (h < X) {
2581
+ const E = i.slice(r + 1, r + 1 + h);
2553
2582
  if (h === 16) {
2554
- const v = Rt(b);
2555
- return BigInt("0x" + v);
2583
+ const I = Ct(E);
2584
+ return BigInt("0x" + I);
2556
2585
  }
2557
- return b.reduce((v, x) => (v <<= 8, v |= x & 255, v), 0);
2586
+ return E.reduce((I, x) => (I <<= 8, I |= x & 255, I), 0);
2558
2587
  }
2559
2588
  throw new Error(
2560
- "Too little heap space available! Wanted to read " + h + " bytes, but only " + V + " are available."
2589
+ "Too little heap space available! Wanted to read " + h + " bytes, but only " + X + " are available."
2561
2590
  );
2562
2591
  }
2563
2592
  function F() {
2564
2593
  const h = u + 1;
2565
- if (h < V)
2566
- return new At($(i.slice(r + 1, r + 1 + h)));
2594
+ if (h < X)
2595
+ return new _t(j(i.slice(r + 1, r + 1 + h)));
2567
2596
  throw new Error(
2568
- "Too little heap space available! Wanted to read " + h + " bytes, but only " + V + " are available."
2597
+ "Too little heap space available! Wanted to read " + h + " bytes, but only " + X + " are available."
2569
2598
  );
2570
2599
  }
2571
2600
  function S() {
2572
2601
  const h = Math.pow(2, u);
2573
- if (h < V) {
2574
- const b = et(g, r + 1, h);
2602
+ if (h < X) {
2603
+ const E = et(p, r + 1, h);
2575
2604
  if (h === 4)
2576
- return b.getFloat32(0, !1);
2605
+ return E.getFloat32(0, !1);
2577
2606
  if (h === 8)
2578
- return b.getFloat64(0, !1);
2607
+ return E.getFloat64(0, !1);
2579
2608
  } else
2580
2609
  throw new Error(
2581
- "Too little heap space available! Wanted to read " + h + " bytes, but only " + V + " are available."
2610
+ "Too little heap space available! Wanted to read " + h + " bytes, but only " + X + " are available."
2582
2611
  );
2583
2612
  return 0;
2584
2613
  }
2585
2614
  function A() {
2586
- const b = et(g, r + 1, 8).getFloat64(0, !1);
2587
- return new Date(_t + 1e3 * b);
2615
+ const E = et(p, r + 1, 8).getFloat64(0, !1);
2616
+ return new Date(Lt + 1e3 * E);
2588
2617
  }
2589
2618
  function L() {
2590
- let h = 1, b = u;
2619
+ let h = 1, E = u;
2591
2620
  if (u === 15) {
2592
2621
  const x = i[r + 1] & 15, U = Math.pow(2, x);
2593
- h = 2 + U, b = $(i.slice(r + 2, r + 2 + U));
2622
+ h = 2 + U, E = j(i.slice(r + 2, r + 2 + U));
2594
2623
  }
2595
- if (b < V)
2596
- return i.slice(r + h, r + h + b);
2624
+ if (E < X)
2625
+ return i.slice(r + h, r + h + E);
2597
2626
  throw new Error(
2598
- "Too little heap space available! Wanted to read " + b + " bytes, but only " + V + " are available."
2627
+ "Too little heap space available! Wanted to read " + E + " bytes, but only " + X + " are available."
2599
2628
  );
2600
2629
  }
2601
2630
  function _(h) {
2602
- let b = "utf8", v = u, x = 1;
2631
+ let E = "utf8", I = u, x = 1;
2603
2632
  if (u === 15) {
2604
- const k = i[r + 1] & 15, O = Math.pow(2, k);
2605
- x = 2 + O, v = $(i.slice(r + 2, r + 2 + O));
2633
+ const k = i[r + 1] & 15, B = Math.pow(2, k);
2634
+ x = 2 + B, I = j(i.slice(r + 2, r + 2 + B));
2606
2635
  }
2607
- if (v *= h ? 2 : 1, v < V) {
2608
- let U = i.slice(r + x, r + x + v);
2636
+ if (I *= h ? 2 : 1, I < X) {
2637
+ let U = i.slice(r + x, r + x + I);
2609
2638
  if (h) {
2610
2639
  const k = new Uint8Array(U);
2611
- U = kt(k), b = "utf-16le";
2640
+ U = Rt(k), E = "utf-16le";
2612
2641
  } else
2613
- b = "utf8";
2614
- return new TextDecoder(b).decode(U);
2642
+ E = "utf8";
2643
+ return new TextDecoder(E).decode(U);
2615
2644
  }
2616
2645
  throw new Error(
2617
- "Too little heap space available! Wanted to read " + v + " bytes, but only " + V + " are available."
2646
+ "Too little heap space available! Wanted to read " + I + " bytes, but only " + X + " are available."
2618
2647
  );
2619
2648
  }
2620
2649
  function d() {
2621
- let h = u, b = 1;
2650
+ let h = u, E = 1;
2622
2651
  if (u === 15) {
2623
2652
  const U = i[r + 1] & 15, k = Math.pow(2, U);
2624
- b = 2 + k, h = $(i.slice(r + 2, r + 2 + k));
2653
+ E = 2 + k, h = j(i.slice(r + 2, r + 2 + k));
2625
2654
  }
2626
- if (h * y > V)
2655
+ if (h * b > X)
2627
2656
  throw new Error("Too little heap space available!");
2628
- const v = [];
2657
+ const I = [];
2629
2658
  for (let x = 0; x < h; x++) {
2630
- const U = $(
2631
- i.slice(r + b + x * y, r + b + (x + 1) * y)
2659
+ const U = j(
2660
+ i.slice(r + E + x * b, r + E + (x + 1) * b)
2632
2661
  );
2633
- v[x] = t(U);
2662
+ I[x] = t(U);
2634
2663
  }
2635
- return v;
2664
+ return I;
2636
2665
  }
2637
2666
  function f() {
2638
- let h = u, b = 1;
2667
+ let h = u, E = 1;
2639
2668
  if (u === 15) {
2640
2669
  const U = i[r + 1] & 15, k = Math.pow(2, U);
2641
- b = 2 + k, h = $(i.slice(r + 2, r + 2 + k));
2670
+ E = 2 + k, h = j(i.slice(r + 2, r + 2 + k));
2642
2671
  }
2643
- if (h * 2 * y > V)
2672
+ if (h * 2 * b > X)
2644
2673
  throw new Error("Too little heap space available!");
2645
- const v = {};
2674
+ const I = {};
2646
2675
  for (let x = 0; x < h; x++) {
2647
- const U = $(
2648
- i.slice(r + b + x * y, r + b + (x + 1) * y)
2649
- ), k = $(
2676
+ const U = j(
2677
+ i.slice(r + E + x * b, r + E + (x + 1) * b)
2678
+ ), k = j(
2650
2679
  i.slice(
2651
- r + b + h * y + x * y,
2652
- r + b + h * y + (x + 1) * y
2680
+ r + E + h * b + x * b,
2681
+ r + E + h * b + (x + 1) * b
2653
2682
  )
2654
- ), O = t(U), R = t(k);
2655
- v[String(O)] = R;
2683
+ ), B = t(U), C = t(k);
2684
+ I[String(B)] = C;
2656
2685
  }
2657
- return v;
2686
+ return I;
2658
2687
  }
2659
2688
  }
2660
2689
  return t(N);
2661
2690
  }
2662
- async function Xt(g, i) {
2663
- const n = await J(g).catch(B);
2664
- if (n instanceof Error)
2665
- return new Error(`load IPA error: ${n.message}`);
2666
- const a = {
2667
- ...(i?.frameworks || []).reduce(
2668
- function(e, r) {
2669
- const s = r.replace(/\.framework/i, "");
2670
- return e[s] = new RegExp(`/frameworks\\/${s}\\.framework\\/[^/]+?\\.plist$`, "i"), e;
2671
- },
2672
- {}
2673
- ),
2674
- main: /payload\/[^/]+?.app\/info.plist$/i
2675
- }, c = {};
2676
- if (n.forEach((e, r) => {
2677
- for (const s in a)
2678
- if (!c[s] && a[s].test(e)) {
2679
- c[s] = r;
2680
- break;
2681
- }
2682
- }), !c.main)
2683
- return new Error("not found Info.plist file in IPA");
2684
- const E = {}, w = {};
2685
- if (await Promise.all([
2686
- ...Object.keys(c).map((e) => c[e]?.async("arraybuffer").then((r) => {
2687
- w[e] = Ct(r);
2688
- }).catch((r) => {
2689
- w[e] = B(r);
2690
- })),
2691
- ...(i?.files || []).map((e) => n.file(e)?.async("arraybuffer").then((r) => {
2692
- E[e] = r;
2693
- }).catch((r) => {
2694
- E[e] = B(r);
2695
- }))
2696
- ]), !w.main || w.main instanceof Error)
2697
- return new Error(`parse Info.plist error: ${w.main?.message || "unknown error"}`);
2698
- const { main: y, ...I } = w, N = {
2699
- package: "CFBundleIdentifier" in y ? Q(y.CFBundleIdentifier) : "",
2700
- versionCode: "CFBundleVersion" in y ? at(y.CFBundleVersion) : 0,
2701
- versionName: "CFBundleShortVersionString" in y ? Q(y.CFBundleShortVersionString) : "",
2702
- plist: y,
2703
- frameworks: I,
2704
- files: E
2705
- };
2706
- if (i?.ignoreIcon)
2707
- return N;
2708
- const T = Pt(y), m = n.filter(
2709
- T ? (e) => e.includes(T) : (e) => /\/icon[^.]*?\.png/i.test(e)
2710
- )[0];
2711
- if (!m)
2712
- return N;
2713
- const t = await m.async("base64").catch(B);
2714
- return t instanceof Error || (N.icon = rt(t)), N;
2691
+ class zt {
2692
+ zip;
2693
+ constructor(i) {
2694
+ this.zip = J(i).catch(R);
2695
+ }
2696
+ /**
2697
+ * 解析应用 plist 信息
2698
+ */
2699
+ async parse(i) {
2700
+ const n = await this.zip;
2701
+ if (n instanceof Error)
2702
+ return new Error(`load IPA error: ${n.message}`);
2703
+ const a = n.filter((T) => /payload\/[^/]+?.app\/info.plist$/i.test(T))[0];
2704
+ if (!a)
2705
+ return new Error("not found Info.plist file in IPA");
2706
+ const c = await a.async("arraybuffer").catch(R);
2707
+ if (c instanceof Error)
2708
+ return new Error(`read Info.plist file error: ${c.message}`);
2709
+ const w = st(c);
2710
+ if (w instanceof Error)
2711
+ return new Error(`parse Info.plist error: ${w.message}`);
2712
+ const y = {
2713
+ package: "CFBundleIdentifier" in w ? Q(w.CFBundleIdentifier) : "",
2714
+ versionCode: "CFBundleVersion" in w ? ot(w.CFBundleVersion) : 0,
2715
+ versionName: "CFBundleShortVersionString" in w ? Q(w.CFBundleShortVersionString) : "",
2716
+ plist: w
2717
+ };
2718
+ if (i?.ignoreIcon)
2719
+ return y;
2720
+ const b = Bt(w), v = n.filter(
2721
+ b ? (T) => T.includes(b) : (T) => /\/icon[^.]*?\.png/i.test(T)
2722
+ )[0];
2723
+ if (!v)
2724
+ return y;
2725
+ const N = await v.async("base64").catch(R);
2726
+ return N instanceof Error || (y.icon = rt(N)), y;
2727
+ }
2728
+ // async parseProvision() {
2729
+ // const zip = await this.zip;
2730
+ // if (zip instanceof Error) {
2731
+ // return zip;
2732
+ // }
2733
+ // // spell-checker:ignore mobileprovision
2734
+ // const provisionFile =
2735
+ // zip.filter((relativePath) => /payload\/[^/]+?.app\/embedded.mobileprovision$/i.test(relativePath))[0] || null;
2736
+ // if (!provisionFile) {
2737
+ // return new Error(`not found provision file in IPA`);
2738
+ // }
2739
+ // const provision = await provisionFile?.async("text").catch(formatError);
2740
+ // if (provision instanceof Error) {
2741
+ // return provision;
2742
+ // }
2743
+ // const firstIndex = provision.indexOf("<?xml");
2744
+ // const endIndex = provision.indexOf("</plist>");
2745
+ // const xmlContent = provision.slice(firstIndex, endIndex + 8);
2746
+ // // todo 解析 xml
2747
+ // return xmlContent;
2748
+ // }
2749
+ /**
2750
+ * 读取指定模块的 plist 信息
2751
+ */
2752
+ async parseFramework(i) {
2753
+ const n = await this.zip;
2754
+ if (n instanceof Error)
2755
+ return n;
2756
+ const a = i.replace(/\.framework/i, ""), c = new RegExp(`\\/frameworks\\/${a}\\.framework\\/[^/]+?\\.plist$`, "i"), w = n.file(c)[0];
2757
+ if (!w)
2758
+ return new Error(`not found ${i} plist file in IPA`);
2759
+ const y = await w.async("arraybuffer").catch(R);
2760
+ return y instanceof Error ? new Error(`read ${i} plist file error: ${y.message}`) : st(y);
2761
+ }
2762
+ /**
2763
+ * 读取指定文件的内容
2764
+ */
2765
+ async readFile(i) {
2766
+ const n = await this.zip;
2767
+ if (n instanceof Error)
2768
+ return n;
2769
+ const a = typeof i == "string" ? n.file(i) : n.file(i)[0];
2770
+ return a ? await a.async("arraybuffer").catch(R) : new Error(`not found ${i}`);
2771
+ }
2715
2772
  }
2716
- function Pt(g) {
2717
- return G(g, "CFBundleIcons") && G(g.CFBundleIcons, "CFBundlePrimaryIcon") && G(g.CFBundleIcons.CFBundlePrimaryIcon, "CFBundleIconFiles") && Array.isArray(g.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles) && g.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length ? Q(
2718
- g.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[g.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1]
2719
- ) : G(g, "CFBundleIconFiles") && Array.isArray(g.CFBundleIconFiles) && g.CFBundleIconFiles.length ? Q(g.CFBundleIconFiles[g.CFBundleIconFiles.length - 1]) : "";
2773
+ function Bt(p) {
2774
+ return G(p, "CFBundleIcons") && G(p.CFBundleIcons, "CFBundlePrimaryIcon") && G(p.CFBundleIcons.CFBundlePrimaryIcon, "CFBundleIconFiles") && Array.isArray(p.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles) && p.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length ? Q(
2775
+ p.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[p.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1]
2776
+ ) : G(p, "CFBundleIconFiles") && Array.isArray(p.CFBundleIconFiles) && p.CFBundleIconFiles.length ? Q(p.CFBundleIconFiles[p.CFBundleIconFiles.length - 1]) : "";
2720
2777
  }
2721
2778
  export {
2722
- Dt as parseApk,
2723
- Mt as parseHosApp,
2724
- Xt as parseIpa
2779
+ Dt as AndroidAppParser,
2780
+ Mt as HosAppParser,
2781
+ zt as IosAppParser
2725
2782
  };