@seayoo-web/app-info 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -41
- package/dist/index.js +1047 -944
- package/package.json +1 -1
- package/types/index.d.ts +1 -1
- package/types/src/file.apk.d.ts +17 -10
- package/types/src/file.app.d.ts +17 -11
- package/types/src/file.ipa.d.ts +18 -18
- package/types/src/utils/base.d.ts +19 -0
- package/types/src/utils/cgbi.d.ts +18 -0
package/dist/index.js
CHANGED
|
@@ -1,298 +1,318 @@
|
|
|
1
|
-
import
|
|
2
|
-
function Q(
|
|
3
|
-
return typeof
|
|
1
|
+
import rt from "jszip";
|
|
2
|
+
function Q(f) {
|
|
3
|
+
return typeof f == "string" ? f : `${f}`;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return typeof
|
|
5
|
+
function ct(f) {
|
|
6
|
+
return typeof f == "number" ? f : typeof f == "string" ? /^\d+(?:\.\d+)/.test(f) ? +f : Number(f) : NaN;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function P(f) {
|
|
9
|
+
return f instanceof Error ? f : new Error(String(f));
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return `data:image/png;base64,${
|
|
11
|
+
function it(f) {
|
|
12
|
+
return `data:image/png;base64,${f}`;
|
|
13
13
|
}
|
|
14
|
-
async function
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
return new Error(`
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
14
|
+
async function nt(f, i, n) {
|
|
15
|
+
const s = f.file(i) || f.filter((w) => w.includes(i))[0];
|
|
16
|
+
if (!s)
|
|
17
|
+
return new Error(`not found ${i}`);
|
|
18
|
+
const c = await s.async(n).catch(P);
|
|
19
|
+
return c instanceof Error ? new Error(`read ${i} error: ${c.message}`) : { name: s.name, content: c };
|
|
20
|
+
}
|
|
21
|
+
const st = rt.loadAsync;
|
|
22
|
+
class Gt {
|
|
23
|
+
zip;
|
|
24
|
+
constructor(i) {
|
|
25
|
+
this.zip = st(i).catch(P);
|
|
26
|
+
}
|
|
27
|
+
async parse(i) {
|
|
28
|
+
const n = await this.zip;
|
|
29
|
+
if (n instanceof Error)
|
|
30
|
+
return new Error(`load file error: ${n.message}`);
|
|
31
|
+
const s = await ft(n);
|
|
32
|
+
if (s instanceof Error)
|
|
33
|
+
return new Error(`read pack.info error: ${s.message}`);
|
|
34
|
+
const c = {
|
|
35
|
+
package: s.summary.app.bundleName,
|
|
36
|
+
versionCode: s.summary.app.version.code,
|
|
37
|
+
versionName: s.summary.app.version.name,
|
|
38
|
+
pack: s
|
|
39
|
+
};
|
|
40
|
+
if (i?.ignoreIcon)
|
|
41
|
+
return c;
|
|
42
|
+
const w = s.packages.find((v) => v.moduleType === "entry");
|
|
43
|
+
if (!w)
|
|
44
|
+
return c;
|
|
45
|
+
const d = n.file(`${w.name}.hap`);
|
|
46
|
+
if (!d)
|
|
47
|
+
return c;
|
|
48
|
+
const E = await d.async("arraybuffer").catch(P);
|
|
49
|
+
if (E instanceof Error)
|
|
50
|
+
return c;
|
|
51
|
+
const T = await st(E).catch(P);
|
|
52
|
+
if (T instanceof Error)
|
|
53
|
+
return c;
|
|
54
|
+
const U = await gt(T);
|
|
55
|
+
if (U instanceof Error)
|
|
56
|
+
return c;
|
|
57
|
+
const I = await pt(T, U.app.icon);
|
|
58
|
+
return I instanceof Error || (c.icon = it(I)), c;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 读取指定文件的内容
|
|
62
|
+
*/
|
|
63
|
+
async readFile(i, n) {
|
|
64
|
+
const s = await this.zip;
|
|
65
|
+
return s instanceof Error ? new Error(`load file error: ${s.message}`) : await nt(s, i, n);
|
|
66
|
+
}
|
|
47
67
|
}
|
|
48
|
-
async function
|
|
49
|
-
const i =
|
|
68
|
+
async function ft(f) {
|
|
69
|
+
const i = f.file("pack.info");
|
|
50
70
|
if (!i)
|
|
51
71
|
return new Error("not found pack.info file");
|
|
52
|
-
const n = await i.async("text").catch(
|
|
72
|
+
const n = await i.async("text").catch(P);
|
|
53
73
|
if (n instanceof Error)
|
|
54
74
|
return new Error(`read pack.info file error: ${n.message}`);
|
|
55
75
|
if (!n)
|
|
56
76
|
return new Error("pack.info file is empty");
|
|
57
77
|
try {
|
|
58
78
|
return JSON.parse(n);
|
|
59
|
-
} catch (
|
|
60
|
-
const c =
|
|
79
|
+
} catch (s) {
|
|
80
|
+
const c = P(s);
|
|
61
81
|
return new Error(`parse pack.info file error: ${c.message}`);
|
|
62
82
|
}
|
|
63
83
|
}
|
|
64
|
-
async function
|
|
65
|
-
const i =
|
|
84
|
+
async function gt(f) {
|
|
85
|
+
const i = f.file("module.json") || f.file("module.json5");
|
|
66
86
|
if (!i)
|
|
67
87
|
return new Error("not found module.json file");
|
|
68
|
-
const n = await i.async("text").catch(
|
|
88
|
+
const n = await i.async("text").catch(P);
|
|
69
89
|
if (n instanceof Error)
|
|
70
90
|
return new Error(`read module.json file error: ${n.message}`);
|
|
71
91
|
if (!n)
|
|
72
92
|
return new Error("module.json file is empty");
|
|
73
93
|
try {
|
|
74
94
|
return JSON.parse(n);
|
|
75
|
-
} catch (
|
|
76
|
-
const c =
|
|
95
|
+
} catch (s) {
|
|
96
|
+
const c = P(s);
|
|
77
97
|
return new Error(`parse module.json file error: ${c.message}`);
|
|
78
98
|
}
|
|
79
99
|
}
|
|
80
|
-
async function
|
|
81
|
-
const
|
|
100
|
+
async function pt(f, i) {
|
|
101
|
+
const s = `resources/base/media/${(i || "app_icon").replace(/(?:^\$media:|\.[a-z]+$)/gi, "")}.png`, c = f.file(s);
|
|
82
102
|
if (!c)
|
|
83
|
-
return new Error(`not found icon file at ${
|
|
84
|
-
const
|
|
85
|
-
return
|
|
103
|
+
return new Error(`not found icon file at ${s}`);
|
|
104
|
+
const w = await c.async("base64").catch(P);
|
|
105
|
+
return w instanceof Error ? new Error(`read icon file error: ${w.message}`) : w;
|
|
86
106
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
107
|
+
function dt(f) {
|
|
108
|
+
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
|
|
89
109
|
}
|
|
90
|
-
function
|
|
91
|
-
throw new Error('Could not dynamically require "' +
|
|
110
|
+
function ut(f) {
|
|
111
|
+
throw new Error('Could not dynamically require "' + f + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
92
112
|
}
|
|
93
|
-
var
|
|
94
|
-
function
|
|
95
|
-
return
|
|
113
|
+
var K = { exports: {} }, J = { exports: {} }, yt = J.exports, at;
|
|
114
|
+
function wt() {
|
|
115
|
+
return at || (at = 1, function(f) {
|
|
96
116
|
/**
|
|
97
117
|
* @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
98
118
|
* Released under the Apache License, Version 2.0
|
|
99
119
|
* see: https://github.com/dcodeIO/long.js for details
|
|
100
120
|
*/
|
|
101
121
|
(function(i, n) {
|
|
102
|
-
typeof
|
|
103
|
-
})(
|
|
104
|
-
function i(
|
|
105
|
-
this.low =
|
|
122
|
+
typeof ut == "function" && f && f.exports ? f.exports = n() : (i.dcodeIO = i.dcodeIO || {}).Long = n();
|
|
123
|
+
})(yt, function() {
|
|
124
|
+
function i(g, h, b) {
|
|
125
|
+
this.low = g | 0, this.high = h | 0, this.unsigned = !!b;
|
|
106
126
|
}
|
|
107
127
|
i.prototype.__isLong__, Object.defineProperty(i.prototype, "__isLong__", {
|
|
108
128
|
value: !0,
|
|
109
129
|
enumerable: !1,
|
|
110
130
|
configurable: !1
|
|
111
131
|
});
|
|
112
|
-
function n(
|
|
113
|
-
return (
|
|
132
|
+
function n(g) {
|
|
133
|
+
return (g && g.__isLong__) === !0;
|
|
114
134
|
}
|
|
115
135
|
i.isLong = n;
|
|
116
|
-
var
|
|
117
|
-
function
|
|
118
|
-
var b,
|
|
119
|
-
return h ? (
|
|
136
|
+
var s = {}, c = {};
|
|
137
|
+
function w(g, h) {
|
|
138
|
+
var b, m, x;
|
|
139
|
+
return h ? (g >>>= 0, (x = 0 <= g && g < 256) && (m = c[g], m) ? m : (b = E(g, (g | 0) < 0 ? -1 : 0, !0), x && (c[g] = b), b)) : (g |= 0, (x = -128 <= g && g < 128) && (m = s[g], m) ? m : (b = E(g, g < 0 ? -1 : 0, !1), x && (s[g] = b), b));
|
|
120
140
|
}
|
|
121
|
-
i.fromInt =
|
|
122
|
-
function
|
|
123
|
-
if (isNaN(
|
|
141
|
+
i.fromInt = w;
|
|
142
|
+
function d(g, h) {
|
|
143
|
+
if (isNaN(g) || !isFinite(g))
|
|
124
144
|
return h ? l : u;
|
|
125
145
|
if (h) {
|
|
126
|
-
if (
|
|
146
|
+
if (g < 0)
|
|
127
147
|
return l;
|
|
128
|
-
if (
|
|
129
|
-
return L;
|
|
130
|
-
} else {
|
|
131
|
-
if (f <= -s)
|
|
148
|
+
if (g >= r)
|
|
132
149
|
return _;
|
|
133
|
-
|
|
134
|
-
|
|
150
|
+
} else {
|
|
151
|
+
if (g <= -a)
|
|
152
|
+
return L;
|
|
153
|
+
if (g + 1 >= a)
|
|
154
|
+
return N;
|
|
135
155
|
}
|
|
136
|
-
return
|
|
156
|
+
return g < 0 ? d(-g, h).neg() : E(g % e | 0, g / e | 0, h);
|
|
137
157
|
}
|
|
138
|
-
i.fromNumber =
|
|
139
|
-
function
|
|
140
|
-
return new i(
|
|
158
|
+
i.fromNumber = d;
|
|
159
|
+
function E(g, h, b) {
|
|
160
|
+
return new i(g, h, b);
|
|
141
161
|
}
|
|
142
|
-
i.fromBits =
|
|
143
|
-
var
|
|
144
|
-
function
|
|
145
|
-
if (
|
|
162
|
+
i.fromBits = E;
|
|
163
|
+
var T = Math.pow;
|
|
164
|
+
function U(g, h, b) {
|
|
165
|
+
if (g.length === 0)
|
|
146
166
|
throw Error("empty string");
|
|
147
|
-
if (
|
|
167
|
+
if (g === "NaN" || g === "Infinity" || g === "+Infinity" || g === "-Infinity")
|
|
148
168
|
return u;
|
|
149
169
|
if (typeof h == "number" ? (b = h, h = !1) : h = !!h, b = b || 10, b < 2 || 36 < b)
|
|
150
170
|
throw RangeError("radix");
|
|
151
|
-
var
|
|
152
|
-
if ((
|
|
171
|
+
var m;
|
|
172
|
+
if ((m = g.indexOf("-")) > 0)
|
|
153
173
|
throw Error("interior hyphen");
|
|
154
|
-
if (
|
|
155
|
-
return
|
|
156
|
-
for (var x =
|
|
157
|
-
var O = Math.min(8,
|
|
174
|
+
if (m === 0)
|
|
175
|
+
return U(g.substring(1), h, b).neg();
|
|
176
|
+
for (var x = d(T(b, 8)), A = u, k = 0; k < g.length; k += 8) {
|
|
177
|
+
var O = Math.min(8, g.length - k), C = parseInt(g.substring(k, k + O), b);
|
|
158
178
|
if (O < 8) {
|
|
159
|
-
var D =
|
|
160
|
-
|
|
179
|
+
var D = d(T(b, O));
|
|
180
|
+
A = A.mul(D).add(d(C));
|
|
161
181
|
} else
|
|
162
|
-
|
|
182
|
+
A = A.mul(x), A = A.add(d(C));
|
|
163
183
|
}
|
|
164
|
-
return
|
|
184
|
+
return A.unsigned = h, A;
|
|
165
185
|
}
|
|
166
|
-
i.fromString =
|
|
167
|
-
function
|
|
168
|
-
return
|
|
186
|
+
i.fromString = U;
|
|
187
|
+
function I(g) {
|
|
188
|
+
return g instanceof i ? g : typeof g == "number" ? d(g) : typeof g == "string" ? U(g) : E(g.low, g.high, g.unsigned);
|
|
169
189
|
}
|
|
170
|
-
i.fromValue =
|
|
171
|
-
var
|
|
190
|
+
i.fromValue = I;
|
|
191
|
+
var v = 65536, t = 1 << 24, e = v * v, r = e * e, a = r / 2, o = w(t), u = w(0);
|
|
172
192
|
i.ZERO = u;
|
|
173
|
-
var l =
|
|
193
|
+
var l = w(0, !0);
|
|
174
194
|
i.UZERO = l;
|
|
175
|
-
var p =
|
|
195
|
+
var p = w(1);
|
|
176
196
|
i.ONE = p;
|
|
177
|
-
var F =
|
|
197
|
+
var F = w(1, !0);
|
|
178
198
|
i.UONE = F;
|
|
179
|
-
var S =
|
|
199
|
+
var S = w(-1);
|
|
180
200
|
i.NEG_ONE = S;
|
|
181
|
-
var
|
|
182
|
-
i.MAX_VALUE =
|
|
183
|
-
var
|
|
184
|
-
i.MAX_UNSIGNED_VALUE =
|
|
185
|
-
var
|
|
186
|
-
i.MIN_VALUE =
|
|
187
|
-
var
|
|
188
|
-
return
|
|
201
|
+
var N = E(-1, 2147483647, !1);
|
|
202
|
+
i.MAX_VALUE = N;
|
|
203
|
+
var _ = E(-1, -1, !0);
|
|
204
|
+
i.MAX_UNSIGNED_VALUE = _;
|
|
205
|
+
var L = E(0, -2147483648, !1);
|
|
206
|
+
i.MIN_VALUE = L;
|
|
207
|
+
var y = i.prototype;
|
|
208
|
+
return y.toInt = function() {
|
|
189
209
|
return this.unsigned ? this.low >>> 0 : this.low;
|
|
190
|
-
},
|
|
210
|
+
}, y.toNumber = function() {
|
|
191
211
|
return this.unsigned ? (this.high >>> 0) * e + (this.low >>> 0) : this.high * e + (this.low >>> 0);
|
|
192
|
-
},
|
|
212
|
+
}, y.toString = function(h) {
|
|
193
213
|
if (h = h || 10, h < 2 || 36 < h)
|
|
194
214
|
throw RangeError("radix");
|
|
195
215
|
if (this.isZero())
|
|
196
216
|
return "0";
|
|
197
217
|
if (this.isNegative())
|
|
198
|
-
if (this.eq(
|
|
199
|
-
var b =
|
|
200
|
-
return
|
|
218
|
+
if (this.eq(L)) {
|
|
219
|
+
var b = d(h), m = this.div(b), x = m.mul(b).sub(this);
|
|
220
|
+
return m.toString(h) + x.toInt().toString(h);
|
|
201
221
|
} else
|
|
202
222
|
return "-" + this.neg().toString(h);
|
|
203
|
-
for (var
|
|
204
|
-
var
|
|
205
|
-
if (k =
|
|
223
|
+
for (var A = d(T(h, 6), this.unsigned), k = this, O = ""; ; ) {
|
|
224
|
+
var C = k.div(A), D = k.sub(C.mul(A)).toInt() >>> 0, M = D.toString(h);
|
|
225
|
+
if (k = C, k.isZero())
|
|
206
226
|
return M + O;
|
|
207
227
|
for (; M.length < 6; )
|
|
208
228
|
M = "0" + M;
|
|
209
229
|
O = "" + M + O;
|
|
210
230
|
}
|
|
211
|
-
},
|
|
231
|
+
}, y.getHighBits = function() {
|
|
212
232
|
return this.high;
|
|
213
|
-
},
|
|
233
|
+
}, y.getHighBitsUnsigned = function() {
|
|
214
234
|
return this.high >>> 0;
|
|
215
|
-
},
|
|
235
|
+
}, y.getLowBits = function() {
|
|
216
236
|
return this.low;
|
|
217
|
-
},
|
|
237
|
+
}, y.getLowBitsUnsigned = function() {
|
|
218
238
|
return this.low >>> 0;
|
|
219
|
-
},
|
|
239
|
+
}, y.getNumBitsAbs = function() {
|
|
220
240
|
if (this.isNegative())
|
|
221
|
-
return this.eq(
|
|
241
|
+
return this.eq(L) ? 64 : this.neg().getNumBitsAbs();
|
|
222
242
|
for (var h = this.high != 0 ? this.high : this.low, b = 31; b > 0 && (h & 1 << b) == 0; b--)
|
|
223
243
|
;
|
|
224
244
|
return this.high != 0 ? b + 33 : b + 1;
|
|
225
|
-
},
|
|
245
|
+
}, y.isZero = function() {
|
|
226
246
|
return this.high === 0 && this.low === 0;
|
|
227
|
-
},
|
|
247
|
+
}, y.isNegative = function() {
|
|
228
248
|
return !this.unsigned && this.high < 0;
|
|
229
|
-
},
|
|
249
|
+
}, y.isPositive = function() {
|
|
230
250
|
return this.unsigned || this.high >= 0;
|
|
231
|
-
},
|
|
251
|
+
}, y.isOdd = function() {
|
|
232
252
|
return (this.low & 1) === 1;
|
|
233
|
-
},
|
|
253
|
+
}, y.isEven = function() {
|
|
234
254
|
return (this.low & 1) === 0;
|
|
235
|
-
},
|
|
236
|
-
return n(h) || (h =
|
|
237
|
-
},
|
|
255
|
+
}, y.equals = function(h) {
|
|
256
|
+
return n(h) || (h = I(h)), this.unsigned !== h.unsigned && this.high >>> 31 === 1 && h.high >>> 31 === 1 ? !1 : this.high === h.high && this.low === h.low;
|
|
257
|
+
}, y.eq = y.equals, y.notEquals = function(h) {
|
|
238
258
|
return !this.eq(
|
|
239
259
|
/* validates */
|
|
240
260
|
h
|
|
241
261
|
);
|
|
242
|
-
},
|
|
262
|
+
}, y.neq = y.notEquals, y.lessThan = function(h) {
|
|
243
263
|
return this.comp(
|
|
244
264
|
/* validates */
|
|
245
265
|
h
|
|
246
266
|
) < 0;
|
|
247
|
-
},
|
|
267
|
+
}, y.lt = y.lessThan, y.lessThanOrEqual = function(h) {
|
|
248
268
|
return this.comp(
|
|
249
269
|
/* validates */
|
|
250
270
|
h
|
|
251
271
|
) <= 0;
|
|
252
|
-
},
|
|
272
|
+
}, y.lte = y.lessThanOrEqual, y.greaterThan = function(h) {
|
|
253
273
|
return this.comp(
|
|
254
274
|
/* validates */
|
|
255
275
|
h
|
|
256
276
|
) > 0;
|
|
257
|
-
},
|
|
277
|
+
}, y.gt = y.greaterThan, y.greaterThanOrEqual = function(h) {
|
|
258
278
|
return this.comp(
|
|
259
279
|
/* validates */
|
|
260
280
|
h
|
|
261
281
|
) >= 0;
|
|
262
|
-
},
|
|
263
|
-
if (n(h) || (h =
|
|
282
|
+
}, y.gte = y.greaterThanOrEqual, y.compare = function(h) {
|
|
283
|
+
if (n(h) || (h = I(h)), this.eq(h))
|
|
264
284
|
return 0;
|
|
265
|
-
var b = this.isNegative(),
|
|
266
|
-
return b && !
|
|
267
|
-
},
|
|
268
|
-
return !this.unsigned && this.eq(
|
|
269
|
-
},
|
|
270
|
-
n(h) || (h =
|
|
271
|
-
var b = this.high >>> 16,
|
|
272
|
-
return
|
|
273
|
-
},
|
|
274
|
-
return n(h) || (h =
|
|
275
|
-
},
|
|
276
|
-
if (this.isZero() || (n(h) || (h =
|
|
285
|
+
var b = this.isNegative(), m = h.isNegative();
|
|
286
|
+
return b && !m ? -1 : !b && m ? 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;
|
|
287
|
+
}, y.comp = y.compare, y.negate = function() {
|
|
288
|
+
return !this.unsigned && this.eq(L) ? L : this.not().add(p);
|
|
289
|
+
}, y.neg = y.negate, y.add = function(h) {
|
|
290
|
+
n(h) || (h = I(h));
|
|
291
|
+
var b = this.high >>> 16, m = this.high & 65535, x = this.low >>> 16, A = this.low & 65535, k = h.high >>> 16, O = h.high & 65535, C = h.low >>> 16, D = h.low & 65535, M = 0, B = 0, z = 0, Y = 0;
|
|
292
|
+
return Y += A + D, z += Y >>> 16, Y &= 65535, z += x + C, B += z >>> 16, z &= 65535, B += m + O, M += B >>> 16, B &= 65535, M += b + k, M &= 65535, E(z << 16 | Y, M << 16 | B, this.unsigned);
|
|
293
|
+
}, y.subtract = function(h) {
|
|
294
|
+
return n(h) || (h = I(h)), this.add(h.neg());
|
|
295
|
+
}, y.sub = y.subtract, y.multiply = function(h) {
|
|
296
|
+
if (this.isZero() || (n(h) || (h = I(h)), h.isZero()))
|
|
277
297
|
return u;
|
|
278
|
-
if (this.eq(
|
|
279
|
-
return h.isOdd() ?
|
|
280
|
-
if (h.eq(
|
|
281
|
-
return this.isOdd() ?
|
|
298
|
+
if (this.eq(L))
|
|
299
|
+
return h.isOdd() ? L : u;
|
|
300
|
+
if (h.eq(L))
|
|
301
|
+
return this.isOdd() ? L : u;
|
|
282
302
|
if (this.isNegative())
|
|
283
303
|
return h.isNegative() ? this.neg().mul(h.neg()) : this.neg().mul(h).neg();
|
|
284
304
|
if (h.isNegative())
|
|
285
305
|
return this.mul(h.neg()).neg();
|
|
286
306
|
if (this.lt(o) && h.lt(o))
|
|
287
|
-
return
|
|
288
|
-
var b = this.high >>> 16,
|
|
289
|
-
return
|
|
290
|
-
},
|
|
291
|
-
if (n(h) || (h =
|
|
307
|
+
return d(this.toNumber() * h.toNumber(), this.unsigned);
|
|
308
|
+
var b = this.high >>> 16, m = this.high & 65535, x = this.low >>> 16, A = this.low & 65535, k = h.high >>> 16, O = h.high & 65535, C = h.low >>> 16, D = h.low & 65535, M = 0, B = 0, z = 0, Y = 0;
|
|
309
|
+
return Y += A * D, z += Y >>> 16, Y &= 65535, z += x * D, B += z >>> 16, z &= 65535, z += A * C, B += z >>> 16, z &= 65535, B += m * D, M += B >>> 16, B &= 65535, B += x * C, M += B >>> 16, B &= 65535, B += A * O, M += B >>> 16, B &= 65535, M += b * D + m * C + x * O + A * k, M &= 65535, E(z << 16 | Y, M << 16 | B, this.unsigned);
|
|
310
|
+
}, y.mul = y.multiply, y.divide = function(h) {
|
|
311
|
+
if (n(h) || (h = I(h)), h.isZero())
|
|
292
312
|
throw Error("division by zero");
|
|
293
313
|
if (this.isZero())
|
|
294
314
|
return this.unsigned ? l : u;
|
|
295
|
-
var b,
|
|
315
|
+
var b, m, x;
|
|
296
316
|
if (this.unsigned) {
|
|
297
317
|
if (h.unsigned || (h = h.toUnsigned()), h.gt(this))
|
|
298
318
|
return l;
|
|
@@ -300,14 +320,14 @@ function ft() {
|
|
|
300
320
|
return F;
|
|
301
321
|
x = l;
|
|
302
322
|
} else {
|
|
303
|
-
if (this.eq(
|
|
323
|
+
if (this.eq(L)) {
|
|
304
324
|
if (h.eq(p) || h.eq(S))
|
|
305
|
-
return
|
|
306
|
-
if (h.eq(
|
|
325
|
+
return L;
|
|
326
|
+
if (h.eq(L))
|
|
307
327
|
return p;
|
|
308
|
-
var
|
|
309
|
-
return b =
|
|
310
|
-
} else if (h.eq(
|
|
328
|
+
var A = this.shr(1);
|
|
329
|
+
return b = A.div(h).shl(1), b.eq(u) ? h.isNegative() ? p : S : (m = this.sub(h.mul(b)), x = b.add(m.div(h)), x);
|
|
330
|
+
} else if (h.eq(L))
|
|
311
331
|
return this.unsigned ? l : u;
|
|
312
332
|
if (this.isNegative())
|
|
313
333
|
return h.isNegative() ? this.neg().div(h.neg()) : this.neg().div(h).neg();
|
|
@@ -315,60 +335,60 @@ function ft() {
|
|
|
315
335
|
return this.div(h.neg()).neg();
|
|
316
336
|
x = u;
|
|
317
337
|
}
|
|
318
|
-
for (
|
|
319
|
-
b = Math.max(1, Math.floor(
|
|
320
|
-
for (var k = Math.ceil(Math.log(b) / Math.LN2), O = k <= 48 ? 1 :
|
|
321
|
-
b -= O,
|
|
322
|
-
|
|
338
|
+
for (m = this; m.gte(h); ) {
|
|
339
|
+
b = Math.max(1, Math.floor(m.toNumber() / h.toNumber()));
|
|
340
|
+
for (var k = Math.ceil(Math.log(b) / Math.LN2), O = k <= 48 ? 1 : T(2, k - 48), C = d(b), D = C.mul(h); D.isNegative() || D.gt(m); )
|
|
341
|
+
b -= O, C = d(b, this.unsigned), D = C.mul(h);
|
|
342
|
+
C.isZero() && (C = p), x = x.add(C), m = m.sub(D);
|
|
323
343
|
}
|
|
324
344
|
return x;
|
|
325
|
-
},
|
|
326
|
-
return n(h) || (h =
|
|
327
|
-
},
|
|
328
|
-
return
|
|
329
|
-
},
|
|
330
|
-
return n(h) || (h =
|
|
331
|
-
},
|
|
332
|
-
return n(h) || (h =
|
|
333
|
-
},
|
|
334
|
-
return n(h) || (h =
|
|
335
|
-
},
|
|
336
|
-
return n(h) && (h = h.toInt()), (h &= 63) === 0 ? this : h < 32 ?
|
|
337
|
-
},
|
|
338
|
-
return n(h) && (h = h.toInt()), (h &= 63) === 0 ? this : h < 32 ?
|
|
339
|
-
},
|
|
345
|
+
}, y.div = y.divide, y.modulo = function(h) {
|
|
346
|
+
return n(h) || (h = I(h)), this.sub(this.div(h).mul(h));
|
|
347
|
+
}, y.mod = y.modulo, y.not = function() {
|
|
348
|
+
return E(~this.low, ~this.high, this.unsigned);
|
|
349
|
+
}, y.and = function(h) {
|
|
350
|
+
return n(h) || (h = I(h)), E(this.low & h.low, this.high & h.high, this.unsigned);
|
|
351
|
+
}, y.or = function(h) {
|
|
352
|
+
return n(h) || (h = I(h)), E(this.low | h.low, this.high | h.high, this.unsigned);
|
|
353
|
+
}, y.xor = function(h) {
|
|
354
|
+
return n(h) || (h = I(h)), E(this.low ^ h.low, this.high ^ h.high, this.unsigned);
|
|
355
|
+
}, y.shiftLeft = function(h) {
|
|
356
|
+
return n(h) && (h = h.toInt()), (h &= 63) === 0 ? this : h < 32 ? E(this.low << h, this.high << h | this.low >>> 32 - h, this.unsigned) : E(0, this.low << h - 32, this.unsigned);
|
|
357
|
+
}, y.shl = y.shiftLeft, y.shiftRight = function(h) {
|
|
358
|
+
return n(h) && (h = h.toInt()), (h &= 63) === 0 ? this : h < 32 ? E(this.low >>> h | this.high << 32 - h, this.high >> h, this.unsigned) : E(this.high >> h - 32, this.high >= 0 ? 0 : -1, this.unsigned);
|
|
359
|
+
}, y.shr = y.shiftRight, y.shiftRightUnsigned = function(h) {
|
|
340
360
|
if (n(h) && (h = h.toInt()), h &= 63, h === 0)
|
|
341
361
|
return this;
|
|
342
362
|
var b = this.high;
|
|
343
363
|
if (h < 32) {
|
|
344
|
-
var
|
|
345
|
-
return
|
|
346
|
-
} else return h === 32 ?
|
|
347
|
-
},
|
|
348
|
-
return this.unsigned ?
|
|
349
|
-
},
|
|
350
|
-
return this.unsigned ? this :
|
|
351
|
-
},
|
|
352
|
-
return
|
|
353
|
-
},
|
|
354
|
-
var
|
|
364
|
+
var m = this.low;
|
|
365
|
+
return E(m >>> h | b << 32 - h, b >>> h, this.unsigned);
|
|
366
|
+
} else return h === 32 ? E(b, 0, this.unsigned) : E(b >>> h - 32, 0, this.unsigned);
|
|
367
|
+
}, y.shru = y.shiftRightUnsigned, y.toSigned = function() {
|
|
368
|
+
return this.unsigned ? E(this.low, this.high, !1) : this;
|
|
369
|
+
}, y.toUnsigned = function() {
|
|
370
|
+
return this.unsigned ? this : E(this.low, this.high, !0);
|
|
371
|
+
}, y.toBytes = function(g) {
|
|
372
|
+
return g ? this.toBytesLE() : this.toBytesBE();
|
|
373
|
+
}, y.toBytesLE = function() {
|
|
374
|
+
var g = this.high, h = this.low;
|
|
355
375
|
return [
|
|
356
376
|
h & 255,
|
|
357
377
|
h >>> 8 & 255,
|
|
358
378
|
h >>> 16 & 255,
|
|
359
379
|
h >>> 24 & 255,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
380
|
+
g & 255,
|
|
381
|
+
g >>> 8 & 255,
|
|
382
|
+
g >>> 16 & 255,
|
|
383
|
+
g >>> 24 & 255
|
|
364
384
|
];
|
|
365
|
-
},
|
|
366
|
-
var
|
|
385
|
+
}, y.toBytesBE = function() {
|
|
386
|
+
var g = this.high, h = this.low;
|
|
367
387
|
return [
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
388
|
+
g >>> 24 & 255,
|
|
389
|
+
g >>> 16 & 255,
|
|
390
|
+
g >>> 8 & 255,
|
|
391
|
+
g & 255,
|
|
372
392
|
h >>> 24 & 255,
|
|
373
393
|
h >>> 16 & 255,
|
|
374
394
|
h >>> 8 & 255,
|
|
@@ -376,11 +396,11 @@ function ft() {
|
|
|
376
396
|
];
|
|
377
397
|
}, i;
|
|
378
398
|
});
|
|
379
|
-
}(
|
|
399
|
+
}(J)), J.exports;
|
|
380
400
|
}
|
|
381
|
-
var
|
|
382
|
-
function
|
|
383
|
-
return
|
|
401
|
+
var bt = K.exports, ot;
|
|
402
|
+
function Et() {
|
|
403
|
+
return ot || (ot = 1, function(f) {
|
|
384
404
|
/**
|
|
385
405
|
* @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
|
|
386
406
|
* Backing buffer: ArrayBuffer, Accessor: Uint8Array
|
|
@@ -388,15 +408,15 @@ function pt() {
|
|
|
388
408
|
* see: https://github.com/dcodeIO/bytebuffer.js for details
|
|
389
409
|
*/
|
|
390
410
|
(function(i, n) {
|
|
391
|
-
typeof
|
|
392
|
-
var
|
|
411
|
+
typeof ut == "function" && f && f.exports ? f.exports = function() {
|
|
412
|
+
var s;
|
|
393
413
|
try {
|
|
394
|
-
|
|
414
|
+
s = wt();
|
|
395
415
|
} catch {
|
|
396
416
|
}
|
|
397
|
-
return n(
|
|
417
|
+
return n(s);
|
|
398
418
|
}() : (i.dcodeIO = i.dcodeIO || {}).ByteBuffer = n(i.dcodeIO.Long);
|
|
399
|
-
})(
|
|
419
|
+
})(bt, function(i) {
|
|
400
420
|
var n = function(t, e, r) {
|
|
401
421
|
if (typeof t > "u" && (t = n.DEFAULT_CAPACITY), typeof e > "u" && (e = n.DEFAULT_ENDIAN), typeof r > "u" && (r = n.DEFAULT_NOASSERT), !r) {
|
|
402
422
|
if (t = t | 0, t < 0)
|
|
@@ -406,38 +426,38 @@ function pt() {
|
|
|
406
426
|
this.buffer = t === 0 ? c : new ArrayBuffer(t), this.view = t === 0 ? null : new Uint8Array(this.buffer), this.offset = 0, this.markedOffset = -1, this.limit = t, this.littleEndian = e, this.noAssert = r;
|
|
407
427
|
};
|
|
408
428
|
n.VERSION = "5.0.1", n.LITTLE_ENDIAN = !0, n.BIG_ENDIAN = !1, n.DEFAULT_CAPACITY = 16, n.DEFAULT_ENDIAN = n.BIG_ENDIAN, n.DEFAULT_NOASSERT = !1, n.Long = i || null;
|
|
409
|
-
var
|
|
410
|
-
|
|
429
|
+
var s = n.prototype;
|
|
430
|
+
s.__isByteBuffer__, Object.defineProperty(s, "__isByteBuffer__", {
|
|
411
431
|
value: !0,
|
|
412
432
|
enumerable: !1,
|
|
413
433
|
configurable: !1
|
|
414
434
|
});
|
|
415
|
-
var c = new ArrayBuffer(0),
|
|
416
|
-
function
|
|
435
|
+
var c = new ArrayBuffer(0), w = String.fromCharCode;
|
|
436
|
+
function d(t) {
|
|
417
437
|
var e = 0;
|
|
418
438
|
return function() {
|
|
419
439
|
return e < t.length ? t.charCodeAt(e++) : null;
|
|
420
440
|
};
|
|
421
441
|
}
|
|
422
|
-
function
|
|
442
|
+
function E() {
|
|
423
443
|
var t = [], e = [];
|
|
424
444
|
return function() {
|
|
425
445
|
if (arguments.length === 0)
|
|
426
|
-
return e.join("") +
|
|
427
|
-
t.length + arguments.length > 1024 && (e.push(
|
|
446
|
+
return e.join("") + w.apply(String, t);
|
|
447
|
+
t.length + arguments.length > 1024 && (e.push(w.apply(String, t)), t.length = 0), Array.prototype.push.apply(t, arguments);
|
|
428
448
|
};
|
|
429
449
|
}
|
|
430
450
|
n.accessor = function() {
|
|
431
451
|
return Uint8Array;
|
|
432
452
|
}, n.allocate = function(t, e, r) {
|
|
433
453
|
return new n(t, e, r);
|
|
434
|
-
}, n.concat = function(t, e, r,
|
|
435
|
-
(typeof e == "boolean" || typeof e != "string") && (
|
|
454
|
+
}, n.concat = function(t, e, r, a) {
|
|
455
|
+
(typeof e == "boolean" || typeof e != "string") && (a = r, r = e, e = void 0);
|
|
436
456
|
for (var o = 0, u = 0, l = t.length, p; u < l; ++u)
|
|
437
457
|
n.isByteBuffer(t[u]) || (t[u] = n.wrap(t[u], e)), p = t[u].limit - t[u].offset, p > 0 && (o += p);
|
|
438
458
|
if (o === 0)
|
|
439
|
-
return new n(0, r,
|
|
440
|
-
var F = new n(o, r,
|
|
459
|
+
return new n(0, r, a);
|
|
460
|
+
var F = new n(o, r, a), S;
|
|
441
461
|
for (u = 0; u < l; )
|
|
442
462
|
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);
|
|
443
463
|
return F.limit = F.offset, F.offset = 0, F;
|
|
@@ -445,8 +465,8 @@ function pt() {
|
|
|
445
465
|
return (t && t.__isByteBuffer__) === !0;
|
|
446
466
|
}, n.type = function() {
|
|
447
467
|
return ArrayBuffer;
|
|
448
|
-
}, n.wrap = function(t, e, r,
|
|
449
|
-
if (typeof e != "string" && (
|
|
468
|
+
}, n.wrap = function(t, e, r, a) {
|
|
469
|
+
if (typeof e != "string" && (a = r, r = e, e = void 0), typeof t == "string")
|
|
450
470
|
switch (typeof e > "u" && (e = "utf8"), e) {
|
|
451
471
|
case "base64":
|
|
452
472
|
return n.fromBase64(t, r);
|
|
@@ -465,19 +485,19 @@ function pt() {
|
|
|
465
485
|
throw TypeError("Illegal buffer");
|
|
466
486
|
var o;
|
|
467
487
|
if (n.isByteBuffer(t))
|
|
468
|
-
return o =
|
|
488
|
+
return o = s.clone.call(t), o.markedOffset = -1, o;
|
|
469
489
|
if (t instanceof Uint8Array)
|
|
470
|
-
o = new n(0, r,
|
|
490
|
+
o = new n(0, r, a), t.length > 0 && (o.buffer = t.buffer, o.offset = t.byteOffset, o.limit = t.byteOffset + t.byteLength, o.view = new Uint8Array(t.buffer));
|
|
471
491
|
else if (t instanceof ArrayBuffer)
|
|
472
|
-
o = new n(0, r,
|
|
492
|
+
o = new n(0, r, a), t.byteLength > 0 && (o.buffer = t, o.offset = 0, o.limit = t.byteLength, o.view = t.byteLength > 0 ? new Uint8Array(t) : null);
|
|
473
493
|
else if (Object.prototype.toString.call(t) === "[object Array]") {
|
|
474
|
-
o = new n(t.length, r,
|
|
494
|
+
o = new n(t.length, r, a), o.limit = t.length;
|
|
475
495
|
for (var u = 0; u < t.length; ++u)
|
|
476
496
|
o.view[u] = t[u];
|
|
477
497
|
} else
|
|
478
498
|
throw TypeError("Illegal buffer");
|
|
479
499
|
return o;
|
|
480
|
-
},
|
|
500
|
+
}, s.writeBitSet = function(t, e) {
|
|
481
501
|
var r = typeof e > "u";
|
|
482
502
|
if (r && (e = this.offset), !this.noAssert) {
|
|
483
503
|
if (!(t instanceof Array))
|
|
@@ -487,7 +507,7 @@ function pt() {
|
|
|
487
507
|
if (e >>>= 0, e < 0 || e + 0 > this.buffer.byteLength)
|
|
488
508
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
489
509
|
}
|
|
490
|
-
var
|
|
510
|
+
var a = e, o = t.length, u = o >> 3, l = 0, p;
|
|
491
511
|
for (e += this.writeVarint32(o, e); u--; )
|
|
492
512
|
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++);
|
|
493
513
|
if (l < o) {
|
|
@@ -495,19 +515,19 @@ function pt() {
|
|
|
495
515
|
for (p = 0; l < o; ) p = p | (!!t[l++] & 1) << F++;
|
|
496
516
|
this.writeByte(p, e++);
|
|
497
517
|
}
|
|
498
|
-
return r ? (this.offset = e, this) : e -
|
|
499
|
-
},
|
|
518
|
+
return r ? (this.offset = e, this) : e - a;
|
|
519
|
+
}, s.readBitSet = function(t) {
|
|
500
520
|
var e = typeof t > "u";
|
|
501
521
|
e && (t = this.offset);
|
|
502
|
-
var r = this.readVarint32(t),
|
|
522
|
+
var r = this.readVarint32(t), a = r.value, o = a >> 3, u = 0, l = [], p;
|
|
503
523
|
for (t += r.length; o--; )
|
|
504
524
|
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);
|
|
505
|
-
if (u <
|
|
525
|
+
if (u < a) {
|
|
506
526
|
var F = 0;
|
|
507
|
-
for (p = this.readByte(t++); u <
|
|
527
|
+
for (p = this.readByte(t++); u < a; ) l[u++] = !!(p >> F++ & 1);
|
|
508
528
|
}
|
|
509
529
|
return e && (this.offset = t), l;
|
|
510
|
-
},
|
|
530
|
+
}, s.readBytes = function(t, e) {
|
|
511
531
|
var r = typeof e > "u";
|
|
512
532
|
if (r && (e = this.offset), !this.noAssert) {
|
|
513
533
|
if (typeof e != "number" || e % 1 !== 0)
|
|
@@ -515,9 +535,9 @@ function pt() {
|
|
|
515
535
|
if (e >>>= 0, e < 0 || e + t > this.buffer.byteLength)
|
|
516
536
|
throw RangeError("Illegal offset: 0 <= " + e + " (+" + t + ") <= " + this.buffer.byteLength);
|
|
517
537
|
}
|
|
518
|
-
var
|
|
519
|
-
return r && (this.offset += t),
|
|
520
|
-
},
|
|
538
|
+
var a = this.slice(e, e + t);
|
|
539
|
+
return r && (this.offset += t), a;
|
|
540
|
+
}, s.writeBytes = s.append, s.writeInt8 = function(t, e) {
|
|
521
541
|
var r = typeof e > "u";
|
|
522
542
|
if (r && (e = this.offset), !this.noAssert) {
|
|
523
543
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -528,9 +548,9 @@ function pt() {
|
|
|
528
548
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
529
549
|
}
|
|
530
550
|
e += 1;
|
|
531
|
-
var
|
|
532
|
-
return e >
|
|
533
|
-
},
|
|
551
|
+
var a = this.buffer.byteLength;
|
|
552
|
+
return e > a && this.resize((a *= 2) > e ? a : e), e -= 1, this.view[e] = t, r && (this.offset += 1), this;
|
|
553
|
+
}, s.writeByte = s.writeInt8, s.readInt8 = function(t) {
|
|
534
554
|
var e = typeof t > "u";
|
|
535
555
|
if (e && (t = this.offset), !this.noAssert) {
|
|
536
556
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -540,7 +560,7 @@ function pt() {
|
|
|
540
560
|
}
|
|
541
561
|
var r = this.view[t];
|
|
542
562
|
return (r & 128) === 128 && (r = -(255 - r + 1)), e && (this.offset += 1), r;
|
|
543
|
-
},
|
|
563
|
+
}, s.readByte = s.readInt8, s.writeUint8 = function(t, e) {
|
|
544
564
|
var r = typeof e > "u";
|
|
545
565
|
if (r && (e = this.offset), !this.noAssert) {
|
|
546
566
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -551,9 +571,9 @@ function pt() {
|
|
|
551
571
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
552
572
|
}
|
|
553
573
|
e += 1;
|
|
554
|
-
var
|
|
555
|
-
return e >
|
|
556
|
-
},
|
|
574
|
+
var a = this.buffer.byteLength;
|
|
575
|
+
return e > a && this.resize((a *= 2) > e ? a : e), e -= 1, this.view[e] = t, r && (this.offset += 1), this;
|
|
576
|
+
}, s.writeUInt8 = s.writeUint8, s.readUint8 = function(t) {
|
|
557
577
|
var e = typeof t > "u";
|
|
558
578
|
if (e && (t = this.offset), !this.noAssert) {
|
|
559
579
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -563,7 +583,7 @@ function pt() {
|
|
|
563
583
|
}
|
|
564
584
|
var r = this.view[t];
|
|
565
585
|
return e && (this.offset += 1), r;
|
|
566
|
-
},
|
|
586
|
+
}, s.readUInt8 = s.readUint8, s.writeInt16 = function(t, e) {
|
|
567
587
|
var r = typeof e > "u";
|
|
568
588
|
if (r && (e = this.offset), !this.noAssert) {
|
|
569
589
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -574,9 +594,9 @@ function pt() {
|
|
|
574
594
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
575
595
|
}
|
|
576
596
|
e += 2;
|
|
577
|
-
var
|
|
578
|
-
return e >
|
|
579
|
-
},
|
|
597
|
+
var a = this.buffer.byteLength;
|
|
598
|
+
return e > a && this.resize((a *= 2) > e ? a : e), e -= 2, this.littleEndian ? (this.view[e + 1] = (t & 65280) >>> 8, this.view[e] = t & 255) : (this.view[e] = (t & 65280) >>> 8, this.view[e + 1] = t & 255), r && (this.offset += 2), this;
|
|
599
|
+
}, s.writeShort = s.writeInt16, s.readInt16 = function(t) {
|
|
580
600
|
var e = typeof t > "u";
|
|
581
601
|
if (e && (t = this.offset), !this.noAssert) {
|
|
582
602
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -586,7 +606,7 @@ function pt() {
|
|
|
586
606
|
}
|
|
587
607
|
var r = 0;
|
|
588
608
|
return this.littleEndian ? (r = this.view[t], r |= this.view[t + 1] << 8) : (r = this.view[t] << 8, r |= this.view[t + 1]), (r & 32768) === 32768 && (r = -(65535 - r + 1)), e && (this.offset += 2), r;
|
|
589
|
-
},
|
|
609
|
+
}, s.readShort = s.readInt16, s.writeUint16 = function(t, e) {
|
|
590
610
|
var r = typeof e > "u";
|
|
591
611
|
if (r && (e = this.offset), !this.noAssert) {
|
|
592
612
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -597,9 +617,9 @@ function pt() {
|
|
|
597
617
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
598
618
|
}
|
|
599
619
|
e += 2;
|
|
600
|
-
var
|
|
601
|
-
return e >
|
|
602
|
-
},
|
|
620
|
+
var a = this.buffer.byteLength;
|
|
621
|
+
return e > a && this.resize((a *= 2) > e ? a : e), e -= 2, this.littleEndian ? (this.view[e + 1] = (t & 65280) >>> 8, this.view[e] = t & 255) : (this.view[e] = (t & 65280) >>> 8, this.view[e + 1] = t & 255), r && (this.offset += 2), this;
|
|
622
|
+
}, s.writeUInt16 = s.writeUint16, s.readUint16 = function(t) {
|
|
603
623
|
var e = typeof t > "u";
|
|
604
624
|
if (e && (t = this.offset), !this.noAssert) {
|
|
605
625
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -609,7 +629,7 @@ function pt() {
|
|
|
609
629
|
}
|
|
610
630
|
var r = 0;
|
|
611
631
|
return this.littleEndian ? (r = this.view[t], r |= this.view[t + 1] << 8) : (r = this.view[t] << 8, r |= this.view[t + 1]), e && (this.offset += 2), r;
|
|
612
|
-
},
|
|
632
|
+
}, s.readUInt16 = s.readUint16, s.writeInt32 = function(t, e) {
|
|
613
633
|
var r = typeof e > "u";
|
|
614
634
|
if (r && (e = this.offset), !this.noAssert) {
|
|
615
635
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -620,9 +640,9 @@ function pt() {
|
|
|
620
640
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
621
641
|
}
|
|
622
642
|
e += 4;
|
|
623
|
-
var
|
|
624
|
-
return e >
|
|
625
|
-
},
|
|
643
|
+
var a = this.buffer.byteLength;
|
|
644
|
+
return e > a && this.resize((a *= 2) > e ? a : e), e -= 4, this.littleEndian ? (this.view[e + 3] = t >>> 24 & 255, this.view[e + 2] = t >>> 16 & 255, this.view[e + 1] = t >>> 8 & 255, this.view[e] = t & 255) : (this.view[e] = t >>> 24 & 255, this.view[e + 1] = t >>> 16 & 255, this.view[e + 2] = t >>> 8 & 255, this.view[e + 3] = t & 255), r && (this.offset += 4), this;
|
|
645
|
+
}, s.writeInt = s.writeInt32, s.readInt32 = function(t) {
|
|
626
646
|
var e = typeof t > "u";
|
|
627
647
|
if (e && (t = this.offset), !this.noAssert) {
|
|
628
648
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -632,7 +652,7 @@ function pt() {
|
|
|
632
652
|
}
|
|
633
653
|
var r = 0;
|
|
634
654
|
return this.littleEndian ? (r = this.view[t + 2] << 16, r |= this.view[t + 1] << 8, r |= this.view[t], r += this.view[t + 3] << 24 >>> 0) : (r = this.view[t + 1] << 16, r |= this.view[t + 2] << 8, r |= this.view[t + 3], r += this.view[t] << 24 >>> 0), r |= 0, e && (this.offset += 4), r;
|
|
635
|
-
},
|
|
655
|
+
}, s.readInt = s.readInt32, s.writeUint32 = function(t, e) {
|
|
636
656
|
var r = typeof e > "u";
|
|
637
657
|
if (r && (e = this.offset), !this.noAssert) {
|
|
638
658
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -643,9 +663,9 @@ function pt() {
|
|
|
643
663
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
644
664
|
}
|
|
645
665
|
e += 4;
|
|
646
|
-
var
|
|
647
|
-
return e >
|
|
648
|
-
},
|
|
666
|
+
var a = this.buffer.byteLength;
|
|
667
|
+
return e > a && this.resize((a *= 2) > e ? a : e), e -= 4, this.littleEndian ? (this.view[e + 3] = t >>> 24 & 255, this.view[e + 2] = t >>> 16 & 255, this.view[e + 1] = t >>> 8 & 255, this.view[e] = t & 255) : (this.view[e] = t >>> 24 & 255, this.view[e + 1] = t >>> 16 & 255, this.view[e + 2] = t >>> 8 & 255, this.view[e + 3] = t & 255), r && (this.offset += 4), this;
|
|
668
|
+
}, s.writeUInt32 = s.writeUint32, s.readUint32 = function(t) {
|
|
649
669
|
var e = typeof t > "u";
|
|
650
670
|
if (e && (t = this.offset), !this.noAssert) {
|
|
651
671
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -655,7 +675,7 @@ function pt() {
|
|
|
655
675
|
}
|
|
656
676
|
var r = 0;
|
|
657
677
|
return this.littleEndian ? (r = this.view[t + 2] << 16, r |= this.view[t + 1] << 8, r |= this.view[t], r += this.view[t + 3] << 24 >>> 0) : (r = this.view[t + 1] << 16, r |= this.view[t + 2] << 8, r |= this.view[t + 3], r += this.view[t] << 24 >>> 0), e && (this.offset += 4), r;
|
|
658
|
-
},
|
|
678
|
+
}, s.readUInt32 = s.readUint32, i && (s.writeInt64 = function(t, e) {
|
|
659
679
|
var r = typeof e > "u";
|
|
660
680
|
if (r && (e = this.offset), !this.noAssert) {
|
|
661
681
|
if (typeof t == "number")
|
|
@@ -670,11 +690,11 @@ function pt() {
|
|
|
670
690
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
671
691
|
}
|
|
672
692
|
typeof t == "number" ? t = i.fromNumber(t) : typeof t == "string" && (t = i.fromString(t)), e += 8;
|
|
673
|
-
var
|
|
674
|
-
e >
|
|
693
|
+
var a = this.buffer.byteLength;
|
|
694
|
+
e > a && this.resize((a *= 2) > e ? a : e), e -= 8;
|
|
675
695
|
var o = t.low, u = t.high;
|
|
676
696
|
return 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, e += 4, this.view[e + 3] = u >>> 24 & 255, this.view[e + 2] = u >>> 16 & 255, this.view[e + 1] = u >>> 8 & 255, this.view[e] = u & 255) : (this.view[e] = u >>> 24 & 255, this.view[e + 1] = u >>> 16 & 255, this.view[e + 2] = u >>> 8 & 255, this.view[e + 3] = u & 255, e += 4, 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), r && (this.offset += 8), this;
|
|
677
|
-
},
|
|
697
|
+
}, s.writeLong = s.writeInt64, s.readInt64 = function(t) {
|
|
678
698
|
var e = typeof t > "u";
|
|
679
699
|
if (e && (t = this.offset), !this.noAssert) {
|
|
680
700
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -682,11 +702,11 @@ function pt() {
|
|
|
682
702
|
if (t >>>= 0, t < 0 || t + 8 > this.buffer.byteLength)
|
|
683
703
|
throw RangeError("Illegal offset: 0 <= " + t + " (+8) <= " + this.buffer.byteLength);
|
|
684
704
|
}
|
|
685
|
-
var r = 0,
|
|
686
|
-
this.littleEndian ? (r = this.view[t + 2] << 16, r |= this.view[t + 1] << 8, r |= this.view[t], r += this.view[t + 3] << 24 >>> 0, t += 4,
|
|
687
|
-
var o = new i(r,
|
|
705
|
+
var r = 0, a = 0;
|
|
706
|
+
this.littleEndian ? (r = this.view[t + 2] << 16, r |= this.view[t + 1] << 8, r |= this.view[t], r += this.view[t + 3] << 24 >>> 0, t += 4, a = this.view[t + 2] << 16, a |= this.view[t + 1] << 8, a |= this.view[t], a += this.view[t + 3] << 24 >>> 0) : (a = this.view[t + 1] << 16, a |= this.view[t + 2] << 8, a |= this.view[t + 3], a += this.view[t] << 24 >>> 0, t += 4, r = this.view[t + 1] << 16, r |= this.view[t + 2] << 8, r |= this.view[t + 3], r += this.view[t] << 24 >>> 0);
|
|
707
|
+
var o = new i(r, a, !1);
|
|
688
708
|
return e && (this.offset += 8), o;
|
|
689
|
-
},
|
|
709
|
+
}, s.readLong = s.readInt64, s.writeUint64 = function(t, e) {
|
|
690
710
|
var r = typeof e > "u";
|
|
691
711
|
if (r && (e = this.offset), !this.noAssert) {
|
|
692
712
|
if (typeof t == "number")
|
|
@@ -701,11 +721,11 @@ function pt() {
|
|
|
701
721
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
702
722
|
}
|
|
703
723
|
typeof t == "number" ? t = i.fromNumber(t) : typeof t == "string" && (t = i.fromString(t)), e += 8;
|
|
704
|
-
var
|
|
705
|
-
e >
|
|
724
|
+
var a = this.buffer.byteLength;
|
|
725
|
+
e > a && this.resize((a *= 2) > e ? a : e), e -= 8;
|
|
706
726
|
var o = t.low, u = t.high;
|
|
707
727
|
return 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, e += 4, this.view[e + 3] = u >>> 24 & 255, this.view[e + 2] = u >>> 16 & 255, this.view[e + 1] = u >>> 8 & 255, this.view[e] = u & 255) : (this.view[e] = u >>> 24 & 255, this.view[e + 1] = u >>> 16 & 255, this.view[e + 2] = u >>> 8 & 255, this.view[e + 3] = u & 255, e += 4, 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), r && (this.offset += 8), this;
|
|
708
|
-
},
|
|
728
|
+
}, s.writeUInt64 = s.writeUint64, s.readUint64 = function(t) {
|
|
709
729
|
var e = typeof t > "u";
|
|
710
730
|
if (e && (t = this.offset), !this.noAssert) {
|
|
711
731
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -713,35 +733,35 @@ function pt() {
|
|
|
713
733
|
if (t >>>= 0, t < 0 || t + 8 > this.buffer.byteLength)
|
|
714
734
|
throw RangeError("Illegal offset: 0 <= " + t + " (+8) <= " + this.buffer.byteLength);
|
|
715
735
|
}
|
|
716
|
-
var r = 0,
|
|
717
|
-
this.littleEndian ? (r = this.view[t + 2] << 16, r |= this.view[t + 1] << 8, r |= this.view[t], r += this.view[t + 3] << 24 >>> 0, t += 4,
|
|
718
|
-
var o = new i(r,
|
|
736
|
+
var r = 0, a = 0;
|
|
737
|
+
this.littleEndian ? (r = this.view[t + 2] << 16, r |= this.view[t + 1] << 8, r |= this.view[t], r += this.view[t + 3] << 24 >>> 0, t += 4, a = this.view[t + 2] << 16, a |= this.view[t + 1] << 8, a |= this.view[t], a += this.view[t + 3] << 24 >>> 0) : (a = this.view[t + 1] << 16, a |= this.view[t + 2] << 8, a |= this.view[t + 3], a += this.view[t] << 24 >>> 0, t += 4, r = this.view[t + 1] << 16, r |= this.view[t + 2] << 8, r |= this.view[t + 3], r += this.view[t] << 24 >>> 0);
|
|
738
|
+
var o = new i(r, a, !0);
|
|
719
739
|
return e && (this.offset += 8), o;
|
|
720
|
-
},
|
|
721
|
-
function
|
|
722
|
-
var u, l, p = o * 8 -
|
|
723
|
-
for (
|
|
740
|
+
}, s.readUInt64 = s.readUint64);
|
|
741
|
+
function T(t, e, r, a, o) {
|
|
742
|
+
var u, l, p = o * 8 - a - 1, F = (1 << p) - 1, S = F >> 1, N = -7, _ = r ? o - 1 : 0, L = r ? -1 : 1, y = t[e + _];
|
|
743
|
+
for (_ += L, u = y & (1 << -N) - 1, y >>= -N, N += p; N > 0; u = u * 256 + t[e + _], _ += L, N -= 8)
|
|
724
744
|
;
|
|
725
|
-
for (l = u & (1 << -
|
|
745
|
+
for (l = u & (1 << -N) - 1, u >>= -N, N += a; N > 0; l = l * 256 + t[e + _], _ += L, N -= 8)
|
|
726
746
|
;
|
|
727
747
|
if (u === 0)
|
|
728
748
|
u = 1 - S;
|
|
729
749
|
else {
|
|
730
750
|
if (u === F)
|
|
731
|
-
return l ? NaN : (
|
|
732
|
-
l = l + Math.pow(2,
|
|
751
|
+
return l ? NaN : (y ? -1 : 1) * (1 / 0);
|
|
752
|
+
l = l + Math.pow(2, a), u = u - S;
|
|
733
753
|
}
|
|
734
|
-
return (
|
|
754
|
+
return (y ? -1 : 1) * l * Math.pow(2, u - a);
|
|
735
755
|
}
|
|
736
|
-
function
|
|
737
|
-
var l, p, F, S = u * 8 - o - 1,
|
|
738
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (p = isNaN(e) ? 1 : 0, l =
|
|
756
|
+
function U(t, e, r, a, o, u) {
|
|
757
|
+
var l, p, F, S = u * 8 - o - 1, N = (1 << S) - 1, _ = N >> 1, L = o === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = a ? 0 : u - 1, g = a ? 1 : -1, h = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
758
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (p = isNaN(e) ? 1 : 0, l = N) : (l = Math.floor(Math.log(e) / Math.LN2), e * (F = Math.pow(2, -l)) < 1 && (l--, F *= 2), l + _ >= 1 ? e += L / F : e += L * Math.pow(2, 1 - _), e * F >= 2 && (l++, F /= 2), l + _ >= N ? (p = 0, l = N) : l + _ >= 1 ? (p = (e * F - 1) * Math.pow(2, o), l = l + _) : (p = e * Math.pow(2, _ - 1) * Math.pow(2, o), l = 0)); o >= 8; t[r + y] = p & 255, y += g, p /= 256, o -= 8)
|
|
739
759
|
;
|
|
740
|
-
for (l = l << o | p, S += o; S > 0; t[r +
|
|
760
|
+
for (l = l << o | p, S += o; S > 0; t[r + y] = l & 255, y += g, l /= 256, S -= 8)
|
|
741
761
|
;
|
|
742
|
-
t[r +
|
|
762
|
+
t[r + y - g] |= h * 128;
|
|
743
763
|
}
|
|
744
|
-
|
|
764
|
+
s.writeFloat32 = function(t, e) {
|
|
745
765
|
var r = typeof e > "u";
|
|
746
766
|
if (r && (e = this.offset), !this.noAssert) {
|
|
747
767
|
if (typeof t != "number")
|
|
@@ -752,9 +772,9 @@ function pt() {
|
|
|
752
772
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
753
773
|
}
|
|
754
774
|
e += 4;
|
|
755
|
-
var
|
|
756
|
-
return e >
|
|
757
|
-
},
|
|
775
|
+
var a = this.buffer.byteLength;
|
|
776
|
+
return e > a && this.resize((a *= 2) > e ? a : e), e -= 4, U(this.view, t, e, this.littleEndian, 23, 4), r && (this.offset += 4), this;
|
|
777
|
+
}, s.writeFloat = s.writeFloat32, s.readFloat32 = function(t) {
|
|
758
778
|
var e = typeof t > "u";
|
|
759
779
|
if (e && (t = this.offset), !this.noAssert) {
|
|
760
780
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -762,9 +782,9 @@ function pt() {
|
|
|
762
782
|
if (t >>>= 0, t < 0 || t + 4 > this.buffer.byteLength)
|
|
763
783
|
throw RangeError("Illegal offset: 0 <= " + t + " (+4) <= " + this.buffer.byteLength);
|
|
764
784
|
}
|
|
765
|
-
var r =
|
|
785
|
+
var r = T(this.view, t, this.littleEndian, 23, 4);
|
|
766
786
|
return e && (this.offset += 4), r;
|
|
767
|
-
},
|
|
787
|
+
}, s.readFloat = s.readFloat32, s.writeFloat64 = function(t, e) {
|
|
768
788
|
var r = typeof e > "u";
|
|
769
789
|
if (r && (e = this.offset), !this.noAssert) {
|
|
770
790
|
if (typeof t != "number")
|
|
@@ -775,9 +795,9 @@ function pt() {
|
|
|
775
795
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
776
796
|
}
|
|
777
797
|
e += 8;
|
|
778
|
-
var
|
|
779
|
-
return e >
|
|
780
|
-
},
|
|
798
|
+
var a = this.buffer.byteLength;
|
|
799
|
+
return e > a && this.resize((a *= 2) > e ? a : e), e -= 8, U(this.view, t, e, this.littleEndian, 52, 8), r && (this.offset += 8), this;
|
|
800
|
+
}, s.writeDouble = s.writeFloat64, s.readFloat64 = function(t) {
|
|
781
801
|
var e = typeof t > "u";
|
|
782
802
|
if (e && (t = this.offset), !this.noAssert) {
|
|
783
803
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -785,15 +805,15 @@ function pt() {
|
|
|
785
805
|
if (t >>>= 0, t < 0 || t + 8 > this.buffer.byteLength)
|
|
786
806
|
throw RangeError("Illegal offset: 0 <= " + t + " (+8) <= " + this.buffer.byteLength);
|
|
787
807
|
}
|
|
788
|
-
var r =
|
|
808
|
+
var r = T(this.view, t, this.littleEndian, 52, 8);
|
|
789
809
|
return e && (this.offset += 8), r;
|
|
790
|
-
},
|
|
810
|
+
}, s.readDouble = s.readFloat64, n.MAX_VARINT32_BYTES = 5, n.calculateVarint32 = function(t) {
|
|
791
811
|
return t = t >>> 0, t < 128 ? 1 : t < 16384 ? 2 : t < 1 << 21 ? 3 : t < 1 << 28 ? 4 : 5;
|
|
792
812
|
}, n.zigZagEncode32 = function(t) {
|
|
793
813
|
return ((t |= 0) << 1 ^ t >> 31) >>> 0;
|
|
794
814
|
}, n.zigZagDecode32 = function(t) {
|
|
795
815
|
return t >>> 1 ^ -(t & 1) | 0;
|
|
796
|
-
},
|
|
816
|
+
}, s.writeVarint32 = function(t, e) {
|
|
797
817
|
var r = typeof e > "u";
|
|
798
818
|
if (r && (e = this.offset), !this.noAssert) {
|
|
799
819
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -803,15 +823,15 @@ function pt() {
|
|
|
803
823
|
if (e >>>= 0, e < 0 || e + 0 > this.buffer.byteLength)
|
|
804
824
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
805
825
|
}
|
|
806
|
-
var
|
|
807
|
-
e +=
|
|
826
|
+
var a = n.calculateVarint32(t), o;
|
|
827
|
+
e += a;
|
|
808
828
|
var u = this.buffer.byteLength;
|
|
809
|
-
for (e > u && this.resize((u *= 2) > e ? u : e), e -=
|
|
829
|
+
for (e > u && this.resize((u *= 2) > e ? u : e), e -= a, t >>>= 0; t >= 128; )
|
|
810
830
|
o = t & 127 | 128, this.view[e++] = o, t >>>= 7;
|
|
811
|
-
return this.view[e++] = t, r ? (this.offset = e, this) :
|
|
812
|
-
},
|
|
831
|
+
return this.view[e++] = t, r ? (this.offset = e, this) : a;
|
|
832
|
+
}, s.writeVarint32ZigZag = function(t, e) {
|
|
813
833
|
return this.writeVarint32(n.zigZagEncode32(t), e);
|
|
814
|
-
},
|
|
834
|
+
}, s.readVarint32 = function(t) {
|
|
815
835
|
var e = typeof t > "u";
|
|
816
836
|
if (e && (t = this.offset), !this.noAssert) {
|
|
817
837
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -819,30 +839,30 @@ function pt() {
|
|
|
819
839
|
if (t >>>= 0, t < 0 || t + 1 > this.buffer.byteLength)
|
|
820
840
|
throw RangeError("Illegal offset: 0 <= " + t + " (+1) <= " + this.buffer.byteLength);
|
|
821
841
|
}
|
|
822
|
-
var r = 0,
|
|
842
|
+
var r = 0, a = 0, o;
|
|
823
843
|
do {
|
|
824
844
|
if (!this.noAssert && t > this.limit) {
|
|
825
845
|
var u = Error("Truncated");
|
|
826
846
|
throw u.truncated = !0, u;
|
|
827
847
|
}
|
|
828
|
-
o = this.view[t++], r < 5 && (
|
|
848
|
+
o = this.view[t++], r < 5 && (a |= (o & 127) << 7 * r), ++r;
|
|
829
849
|
} while ((o & 128) !== 0);
|
|
830
|
-
return
|
|
831
|
-
value:
|
|
850
|
+
return a |= 0, e ? (this.offset = t, a) : {
|
|
851
|
+
value: a,
|
|
832
852
|
length: r
|
|
833
853
|
};
|
|
834
|
-
},
|
|
854
|
+
}, s.readVarint32ZigZag = function(t) {
|
|
835
855
|
var e = this.readVarint32(t);
|
|
836
856
|
return typeof e == "object" ? e.value = n.zigZagDecode32(e.value) : e = n.zigZagDecode32(e), e;
|
|
837
857
|
}, i && (n.MAX_VARINT64_BYTES = 10, n.calculateVarint64 = function(t) {
|
|
838
858
|
typeof t == "number" ? t = i.fromNumber(t) : typeof t == "string" && (t = i.fromString(t));
|
|
839
|
-
var e = t.toInt() >>> 0, r = t.shiftRightUnsigned(28).toInt() >>> 0,
|
|
840
|
-
return
|
|
859
|
+
var e = t.toInt() >>> 0, r = t.shiftRightUnsigned(28).toInt() >>> 0, a = t.shiftRightUnsigned(56).toInt() >>> 0;
|
|
860
|
+
return a == 0 ? r == 0 ? e < 16384 ? e < 128 ? 1 : 2 : e < 1 << 21 ? 3 : 4 : r < 16384 ? r < 128 ? 5 : 6 : r < 1 << 21 ? 7 : 8 : a < 128 ? 9 : 10;
|
|
841
861
|
}, n.zigZagEncode64 = function(t) {
|
|
842
862
|
return typeof t == "number" ? t = i.fromNumber(t, !1) : typeof t == "string" ? t = i.fromString(t, !1) : t.unsigned !== !1 && (t = t.toSigned()), t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned();
|
|
843
863
|
}, n.zigZagDecode64 = function(t) {
|
|
844
864
|
return typeof t == "number" ? t = i.fromNumber(t, !1) : typeof t == "string" ? t = i.fromString(t, !1) : t.unsigned !== !1 && (t = t.toSigned()), t.shiftRightUnsigned(1).xor(t.and(i.ONE).toSigned().negate()).toSigned();
|
|
845
|
-
},
|
|
865
|
+
}, s.writeVarint64 = function(t, e) {
|
|
846
866
|
var r = typeof e > "u";
|
|
847
867
|
if (r && (e = this.offset), !this.noAssert) {
|
|
848
868
|
if (typeof t == "number")
|
|
@@ -857,35 +877,35 @@ function pt() {
|
|
|
857
877
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
858
878
|
}
|
|
859
879
|
typeof t == "number" ? t = i.fromNumber(t, !1) : typeof t == "string" ? t = i.fromString(t, !1) : t.unsigned !== !1 && (t = t.toSigned());
|
|
860
|
-
var
|
|
861
|
-
e +=
|
|
880
|
+
var a = n.calculateVarint64(t), o = t.toInt() >>> 0, u = t.shiftRightUnsigned(28).toInt() >>> 0, l = t.shiftRightUnsigned(56).toInt() >>> 0;
|
|
881
|
+
e += a;
|
|
862
882
|
var p = this.buffer.byteLength;
|
|
863
|
-
switch (e > p && this.resize((p *= 2) > e ? p : e), e -=
|
|
883
|
+
switch (e > p && this.resize((p *= 2) > e ? p : e), e -= a, a) {
|
|
864
884
|
case 10:
|
|
865
885
|
this.view[e + 9] = l >>> 7 & 1;
|
|
866
886
|
case 9:
|
|
867
|
-
this.view[e + 8] =
|
|
887
|
+
this.view[e + 8] = a !== 9 ? l | 128 : l & 127;
|
|
868
888
|
case 8:
|
|
869
|
-
this.view[e + 7] =
|
|
889
|
+
this.view[e + 7] = a !== 8 ? u >>> 21 | 128 : u >>> 21 & 127;
|
|
870
890
|
case 7:
|
|
871
|
-
this.view[e + 6] =
|
|
891
|
+
this.view[e + 6] = a !== 7 ? u >>> 14 | 128 : u >>> 14 & 127;
|
|
872
892
|
case 6:
|
|
873
|
-
this.view[e + 5] =
|
|
893
|
+
this.view[e + 5] = a !== 6 ? u >>> 7 | 128 : u >>> 7 & 127;
|
|
874
894
|
case 5:
|
|
875
|
-
this.view[e + 4] =
|
|
895
|
+
this.view[e + 4] = a !== 5 ? u | 128 : u & 127;
|
|
876
896
|
case 4:
|
|
877
|
-
this.view[e + 3] =
|
|
897
|
+
this.view[e + 3] = a !== 4 ? o >>> 21 | 128 : o >>> 21 & 127;
|
|
878
898
|
case 3:
|
|
879
|
-
this.view[e + 2] =
|
|
899
|
+
this.view[e + 2] = a !== 3 ? o >>> 14 | 128 : o >>> 14 & 127;
|
|
880
900
|
case 2:
|
|
881
|
-
this.view[e + 1] =
|
|
901
|
+
this.view[e + 1] = a !== 2 ? o >>> 7 | 128 : o >>> 7 & 127;
|
|
882
902
|
case 1:
|
|
883
|
-
this.view[e] =
|
|
903
|
+
this.view[e] = a !== 1 ? o | 128 : o & 127;
|
|
884
904
|
}
|
|
885
|
-
return r ? (this.offset +=
|
|
886
|
-
},
|
|
905
|
+
return r ? (this.offset += a, this) : a;
|
|
906
|
+
}, s.writeVarint64ZigZag = function(t, e) {
|
|
887
907
|
return this.writeVarint64(n.zigZagEncode64(t), e);
|
|
888
|
-
},
|
|
908
|
+
}, s.readVarint64 = function(t) {
|
|
889
909
|
var e = typeof t > "u";
|
|
890
910
|
if (e && (t = this.offset), !this.noAssert) {
|
|
891
911
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -893,38 +913,38 @@ function pt() {
|
|
|
893
913
|
if (t >>>= 0, t < 0 || t + 1 > this.buffer.byteLength)
|
|
894
914
|
throw RangeError("Illegal offset: 0 <= " + t + " (+1) <= " + this.buffer.byteLength);
|
|
895
915
|
}
|
|
896
|
-
var r = t,
|
|
897
|
-
if (l = this.view[t++],
|
|
916
|
+
var r = t, a = 0, o = 0, u = 0, l = 0;
|
|
917
|
+
if (l = this.view[t++], a = l & 127, l & 128 && (l = this.view[t++], a |= (l & 127) << 7, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], a |= (l & 127) << 14, (l & 128 || this.noAssert && typeof l > "u") && (l = this.view[t++], a |= (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
918
|
throw Error("Buffer overrun");
|
|
899
|
-
var p = i.fromBits(
|
|
919
|
+
var p = i.fromBits(a | o << 28, o >>> 4 | u << 24, !1);
|
|
900
920
|
return e ? (this.offset = t, p) : {
|
|
901
921
|
value: p,
|
|
902
922
|
length: t - r
|
|
903
923
|
};
|
|
904
|
-
},
|
|
924
|
+
}, s.readVarint64ZigZag = function(t) {
|
|
905
925
|
var e = this.readVarint64(t);
|
|
906
926
|
return e && e.value instanceof i ? e.value = n.zigZagDecode64(e.value) : e = n.zigZagDecode64(e), e;
|
|
907
|
-
}),
|
|
927
|
+
}), s.writeCString = function(t, e) {
|
|
908
928
|
var r = typeof e > "u";
|
|
909
929
|
r && (e = this.offset);
|
|
910
|
-
var
|
|
930
|
+
var a, o = t.length;
|
|
911
931
|
if (!this.noAssert) {
|
|
912
932
|
if (typeof t != "string")
|
|
913
933
|
throw TypeError("Illegal str: Not a string");
|
|
914
|
-
for (
|
|
915
|
-
if (t.charCodeAt(
|
|
934
|
+
for (a = 0; a < o; ++a)
|
|
935
|
+
if (t.charCodeAt(a) === 0)
|
|
916
936
|
throw RangeError("Illegal str: Contains NULL-characters");
|
|
917
937
|
if (typeof e != "number" || e % 1 !== 0)
|
|
918
938
|
throw TypeError("Illegal offset: " + e + " (not an integer)");
|
|
919
939
|
if (e >>>= 0, e < 0 || e + 0 > this.buffer.byteLength)
|
|
920
940
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
921
941
|
}
|
|
922
|
-
o =
|
|
942
|
+
o = v.calculateUTF16asUTF8(d(t))[1], e += o + 1;
|
|
923
943
|
var u = this.buffer.byteLength;
|
|
924
|
-
return e > u && this.resize((u *= 2) > e ? u : e), e -= o + 1,
|
|
944
|
+
return e > u && this.resize((u *= 2) > e ? u : e), e -= o + 1, v.encodeUTF16toUTF8(d(t), (function(l) {
|
|
925
945
|
this.view[e++] = l;
|
|
926
946
|
}).bind(this)), this.view[e++] = 0, r ? (this.offset = e, this) : o;
|
|
927
|
-
},
|
|
947
|
+
}, s.readCString = function(t) {
|
|
928
948
|
var e = typeof t > "u";
|
|
929
949
|
if (e && (t = this.offset), !this.noAssert) {
|
|
930
950
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -932,17 +952,17 @@ function pt() {
|
|
|
932
952
|
if (t >>>= 0, t < 0 || t + 1 > this.buffer.byteLength)
|
|
933
953
|
throw RangeError("Illegal offset: 0 <= " + t + " (+1) <= " + this.buffer.byteLength);
|
|
934
954
|
}
|
|
935
|
-
var r = t,
|
|
936
|
-
return
|
|
955
|
+
var r = t, a, o = -1;
|
|
956
|
+
return v.decodeUTF8toUTF16((function() {
|
|
937
957
|
if (o === 0) return null;
|
|
938
958
|
if (t >= this.limit)
|
|
939
959
|
throw RangeError("Illegal range: Truncated data, " + t + " < " + this.limit);
|
|
940
960
|
return o = this.view[t++], o === 0 ? null : o;
|
|
941
|
-
}).bind(this),
|
|
942
|
-
string:
|
|
961
|
+
}).bind(this), a = E(), !0), e ? (this.offset = t, a()) : {
|
|
962
|
+
string: a(),
|
|
943
963
|
length: t - r
|
|
944
964
|
};
|
|
945
|
-
},
|
|
965
|
+
}, s.writeIString = function(t, e) {
|
|
946
966
|
var r = typeof e > "u";
|
|
947
967
|
if (r && (e = this.offset), !this.noAssert) {
|
|
948
968
|
if (typeof t != "string")
|
|
@@ -952,15 +972,15 @@ function pt() {
|
|
|
952
972
|
if (e >>>= 0, e < 0 || e + 0 > this.buffer.byteLength)
|
|
953
973
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
954
974
|
}
|
|
955
|
-
var
|
|
956
|
-
o =
|
|
975
|
+
var a = e, o;
|
|
976
|
+
o = v.calculateUTF16asUTF8(d(t), this.noAssert)[1], e += 4 + o;
|
|
957
977
|
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,
|
|
978
|
+
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, v.encodeUTF16toUTF8(d(t), (function(l) {
|
|
959
979
|
this.view[e++] = l;
|
|
960
|
-
}).bind(this)), e !==
|
|
980
|
+
}).bind(this)), e !== a + 4 + o)
|
|
961
981
|
throw RangeError("Illegal range: Truncated data, " + e + " == " + (e + 4 + o));
|
|
962
|
-
return r ? (this.offset = e, this) : e -
|
|
963
|
-
},
|
|
982
|
+
return r ? (this.offset = e, this) : e - a;
|
|
983
|
+
}, s.readIString = function(t) {
|
|
964
984
|
var e = typeof t > "u";
|
|
965
985
|
if (e && (t = this.offset), !this.noAssert) {
|
|
966
986
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -968,12 +988,12 @@ function pt() {
|
|
|
968
988
|
if (t >>>= 0, t < 0 || t + 4 > this.buffer.byteLength)
|
|
969
989
|
throw RangeError("Illegal offset: 0 <= " + t + " (+4) <= " + this.buffer.byteLength);
|
|
970
990
|
}
|
|
971
|
-
var r = t,
|
|
991
|
+
var r = t, a = this.readUint32(t), o = this.readUTF8String(a, n.METRICS_BYTES, t += 4);
|
|
972
992
|
return t += o.length, e ? (this.offset = t, o.string) : {
|
|
973
993
|
string: o.string,
|
|
974
994
|
length: t - r
|
|
975
995
|
};
|
|
976
|
-
}, n.METRICS_CHARS = "c", n.METRICS_BYTES = "b",
|
|
996
|
+
}, n.METRICS_CHARS = "c", n.METRICS_BYTES = "b", s.writeUTF8String = function(t, e) {
|
|
977
997
|
var r = typeof e > "u";
|
|
978
998
|
if (r && (e = this.offset), !this.noAssert) {
|
|
979
999
|
if (typeof e != "number" || e % 1 !== 0)
|
|
@@ -981,20 +1001,20 @@ function pt() {
|
|
|
981
1001
|
if (e >>>= 0, e < 0 || e + 0 > this.buffer.byteLength)
|
|
982
1002
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
983
1003
|
}
|
|
984
|
-
var
|
|
985
|
-
|
|
1004
|
+
var a, o = e;
|
|
1005
|
+
a = v.calculateUTF16asUTF8(d(t))[1], e += a;
|
|
986
1006
|
var u = this.buffer.byteLength;
|
|
987
|
-
return e > u && this.resize((u *= 2) > e ? u : e), e -=
|
|
1007
|
+
return e > u && this.resize((u *= 2) > e ? u : e), e -= a, v.encodeUTF16toUTF8(d(t), (function(l) {
|
|
988
1008
|
this.view[e++] = l;
|
|
989
1009
|
}).bind(this)), r ? (this.offset = e, this) : e - o;
|
|
990
|
-
},
|
|
991
|
-
return
|
|
1010
|
+
}, s.writeString = s.writeUTF8String, n.calculateUTF8Chars = function(t) {
|
|
1011
|
+
return v.calculateUTF16asUTF8(d(t))[0];
|
|
992
1012
|
}, n.calculateUTF8Bytes = function(t) {
|
|
993
|
-
return
|
|
994
|
-
}, n.calculateString = n.calculateUTF8Bytes,
|
|
1013
|
+
return v.calculateUTF16asUTF8(d(t))[1];
|
|
1014
|
+
}, n.calculateString = n.calculateUTF8Bytes, s.readUTF8String = function(t, e, r) {
|
|
995
1015
|
typeof e == "number" && (r = e, e = void 0);
|
|
996
|
-
var
|
|
997
|
-
if (
|
|
1016
|
+
var a = typeof r > "u";
|
|
1017
|
+
if (a && (r = this.offset), typeof e > "u" && (e = n.METRICS_CHARS), !this.noAssert) {
|
|
998
1018
|
if (typeof t != "number" || t % 1 !== 0)
|
|
999
1019
|
throw TypeError("Illegal length: " + t + " (not an integer)");
|
|
1000
1020
|
if (t |= 0, typeof r != "number" || r % 1 !== 0)
|
|
@@ -1004,13 +1024,13 @@ function pt() {
|
|
|
1004
1024
|
}
|
|
1005
1025
|
var o = 0, u = r, l;
|
|
1006
1026
|
if (e === n.METRICS_CHARS) {
|
|
1007
|
-
if (l =
|
|
1027
|
+
if (l = E(), v.decodeUTF8((function() {
|
|
1008
1028
|
return o < t && r < this.limit ? this.view[r++] : null;
|
|
1009
1029
|
}).bind(this), function(F) {
|
|
1010
|
-
++o,
|
|
1030
|
+
++o, v.UTF8toUTF16(F, l);
|
|
1011
1031
|
}), o !== t)
|
|
1012
1032
|
throw RangeError("Illegal range: Truncated data, " + o + " == " + t);
|
|
1013
|
-
return
|
|
1033
|
+
return a ? (this.offset = r, l()) : {
|
|
1014
1034
|
string: l(),
|
|
1015
1035
|
length: r - u
|
|
1016
1036
|
};
|
|
@@ -1022,17 +1042,17 @@ function pt() {
|
|
|
1022
1042
|
throw RangeError("Illegal offset: 0 <= " + r + " (+" + t + ") <= " + this.buffer.byteLength);
|
|
1023
1043
|
}
|
|
1024
1044
|
var p = r + t;
|
|
1025
|
-
if (
|
|
1045
|
+
if (v.decodeUTF8toUTF16((function() {
|
|
1026
1046
|
return r < p ? this.view[r++] : null;
|
|
1027
|
-
}).bind(this), l =
|
|
1047
|
+
}).bind(this), l = E(), this.noAssert), r !== p)
|
|
1028
1048
|
throw RangeError("Illegal range: Truncated data, " + r + " == " + p);
|
|
1029
|
-
return
|
|
1049
|
+
return a ? (this.offset = r, l()) : {
|
|
1030
1050
|
string: l(),
|
|
1031
1051
|
length: r - u
|
|
1032
1052
|
};
|
|
1033
1053
|
} else
|
|
1034
1054
|
throw TypeError("Unsupported metrics: " + e);
|
|
1035
|
-
},
|
|
1055
|
+
}, s.readString = s.readUTF8String, s.writeVString = function(t, e) {
|
|
1036
1056
|
var r = typeof e > "u";
|
|
1037
1057
|
if (r && (e = this.offset), !this.noAssert) {
|
|
1038
1058
|
if (typeof t != "string")
|
|
@@ -1042,15 +1062,15 @@ function pt() {
|
|
|
1042
1062
|
if (e >>>= 0, e < 0 || e + 0 > this.buffer.byteLength)
|
|
1043
1063
|
throw RangeError("Illegal offset: 0 <= " + e + " (+0) <= " + this.buffer.byteLength);
|
|
1044
1064
|
}
|
|
1045
|
-
var
|
|
1046
|
-
o =
|
|
1065
|
+
var a = e, o, u;
|
|
1066
|
+
o = v.calculateUTF16asUTF8(d(t), this.noAssert)[1], u = n.calculateVarint32(o), e += u + o;
|
|
1047
1067
|
var l = this.buffer.byteLength;
|
|
1048
|
-
if (e > l && this.resize((l *= 2) > e ? l : e), e -= u + o, e += this.writeVarint32(o, e),
|
|
1068
|
+
if (e > l && this.resize((l *= 2) > e ? l : e), e -= u + o, e += this.writeVarint32(o, e), v.encodeUTF16toUTF8(d(t), (function(p) {
|
|
1049
1069
|
this.view[e++] = p;
|
|
1050
|
-
}).bind(this)), e !==
|
|
1070
|
+
}).bind(this)), e !== a + o + u)
|
|
1051
1071
|
throw RangeError("Illegal range: Truncated data, " + e + " == " + (e + o + u));
|
|
1052
|
-
return r ? (this.offset = e, this) : e -
|
|
1053
|
-
},
|
|
1072
|
+
return r ? (this.offset = e, this) : e - a;
|
|
1073
|
+
}, s.readVString = function(t) {
|
|
1054
1074
|
var e = typeof t > "u";
|
|
1055
1075
|
if (e && (t = this.offset), !this.noAssert) {
|
|
1056
1076
|
if (typeof t != "number" || t % 1 !== 0)
|
|
@@ -1058,15 +1078,15 @@ function pt() {
|
|
|
1058
1078
|
if (t >>>= 0, t < 0 || t + 1 > this.buffer.byteLength)
|
|
1059
1079
|
throw RangeError("Illegal offset: 0 <= " + t + " (+1) <= " + this.buffer.byteLength);
|
|
1060
1080
|
}
|
|
1061
|
-
var r = t,
|
|
1081
|
+
var r = t, a = this.readVarint32(t), o = this.readUTF8String(a.value, n.METRICS_BYTES, t += a.length);
|
|
1062
1082
|
return t += o.length, e ? (this.offset = t, o.string) : {
|
|
1063
1083
|
string: o.string,
|
|
1064
1084
|
length: t - r
|
|
1065
1085
|
};
|
|
1066
|
-
},
|
|
1086
|
+
}, s.append = function(t, e, r) {
|
|
1067
1087
|
(typeof e == "number" || typeof e != "string") && (r = e, e = void 0);
|
|
1068
|
-
var
|
|
1069
|
-
if (
|
|
1088
|
+
var a = typeof r > "u";
|
|
1089
|
+
if (a && (r = this.offset), !this.noAssert) {
|
|
1070
1090
|
if (typeof r != "number" || r % 1 !== 0)
|
|
1071
1091
|
throw TypeError("Illegal offset: " + r + " (not an integer)");
|
|
1072
1092
|
if (r >>>= 0, r < 0 || r + 0 > this.buffer.byteLength)
|
|
@@ -1077,19 +1097,19 @@ function pt() {
|
|
|
1077
1097
|
if (o <= 0) return this;
|
|
1078
1098
|
r += o;
|
|
1079
1099
|
var u = this.buffer.byteLength;
|
|
1080
|
-
return r > u && this.resize((u *= 2) > r ? u : r), r -= o, this.view.set(t.view.subarray(t.offset, t.limit), r), t.offset += o,
|
|
1081
|
-
},
|
|
1100
|
+
return r > u && this.resize((u *= 2) > r ? u : r), r -= o, this.view.set(t.view.subarray(t.offset, t.limit), r), t.offset += o, a && (this.offset += o), this;
|
|
1101
|
+
}, s.appendTo = function(t, e) {
|
|
1082
1102
|
return t.append(this, e), this;
|
|
1083
|
-
},
|
|
1103
|
+
}, s.assert = function(t) {
|
|
1084
1104
|
return this.noAssert = !t, this;
|
|
1085
|
-
},
|
|
1105
|
+
}, s.capacity = function() {
|
|
1086
1106
|
return this.buffer.byteLength;
|
|
1087
|
-
},
|
|
1107
|
+
}, s.clear = function() {
|
|
1088
1108
|
return this.offset = 0, this.limit = this.buffer.byteLength, this.markedOffset = -1, this;
|
|
1089
|
-
},
|
|
1109
|
+
}, s.clone = function(t) {
|
|
1090
1110
|
var e = new n(0, this.littleEndian, this.noAssert);
|
|
1091
1111
|
return t ? (e.buffer = new ArrayBuffer(this.buffer.byteLength), e.view = new Uint8Array(e.buffer)) : (e.buffer = this.buffer, e.view = this.view), e.offset = this.offset, e.markedOffset = this.markedOffset, e.limit = this.limit, e;
|
|
1092
|
-
},
|
|
1112
|
+
}, s.compact = function(t, e) {
|
|
1093
1113
|
if (typeof t > "u" && (t = this.offset), typeof e > "u" && (e = this.limit), !this.noAssert) {
|
|
1094
1114
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1095
1115
|
throw TypeError("Illegal begin: Not an integer");
|
|
@@ -1103,9 +1123,9 @@ function pt() {
|
|
|
1103
1123
|
var r = e - t;
|
|
1104
1124
|
if (r === 0)
|
|
1105
1125
|
return this.buffer = c, this.view = null, this.markedOffset >= 0 && (this.markedOffset -= t), this.offset = 0, this.limit = 0, this;
|
|
1106
|
-
var
|
|
1107
|
-
return o.set(this.view.subarray(t, e)), this.buffer =
|
|
1108
|
-
},
|
|
1126
|
+
var a = new ArrayBuffer(r), o = new Uint8Array(a);
|
|
1127
|
+
return o.set(this.view.subarray(t, e)), this.buffer = a, this.view = o, this.markedOffset >= 0 && (this.markedOffset -= t), this.offset = 0, this.limit = r, this;
|
|
1128
|
+
}, s.copy = function(t, e) {
|
|
1109
1129
|
if (typeof t > "u" && (t = this.offset), typeof e > "u" && (e = this.limit), !this.noAssert) {
|
|
1110
1130
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1111
1131
|
throw TypeError("Illegal begin: Not an integer");
|
|
@@ -1116,24 +1136,24 @@ function pt() {
|
|
|
1116
1136
|
}
|
|
1117
1137
|
if (t === e)
|
|
1118
1138
|
return new n(0, this.littleEndian, this.noAssert);
|
|
1119
|
-
var r = e - t,
|
|
1120
|
-
return
|
|
1121
|
-
},
|
|
1139
|
+
var r = e - t, a = new n(r, this.littleEndian, this.noAssert);
|
|
1140
|
+
return a.offset = 0, a.limit = r, a.markedOffset >= 0 && (a.markedOffset -= t), this.copyTo(a, 0, t, e), a;
|
|
1141
|
+
}, s.copyTo = function(t, e, r, a) {
|
|
1122
1142
|
var o, u;
|
|
1123
1143
|
if (!this.noAssert && !n.isByteBuffer(t))
|
|
1124
1144
|
throw TypeError("Illegal target: Not a ByteBuffer");
|
|
1125
|
-
if (e = (u = typeof e > "u") ? t.offset : e | 0, r = (o = typeof r > "u") ? this.offset : r | 0,
|
|
1145
|
+
if (e = (u = typeof e > "u") ? t.offset : e | 0, r = (o = typeof r > "u") ? this.offset : r | 0, a = typeof a > "u" ? this.limit : a | 0, e < 0 || e > t.buffer.byteLength)
|
|
1126
1146
|
throw RangeError("Illegal target range: 0 <= " + e + " <= " + t.buffer.byteLength);
|
|
1127
|
-
if (r < 0 ||
|
|
1147
|
+
if (r < 0 || a > this.buffer.byteLength)
|
|
1128
1148
|
throw RangeError("Illegal source range: 0 <= " + r + " <= " + this.buffer.byteLength);
|
|
1129
|
-
var l =
|
|
1130
|
-
return l === 0 ? t : (t.ensureCapacity(e + l), t.view.set(this.view.subarray(r,
|
|
1131
|
-
},
|
|
1149
|
+
var l = a - r;
|
|
1150
|
+
return l === 0 ? t : (t.ensureCapacity(e + l), t.view.set(this.view.subarray(r, a), e), o && (this.offset += l), u && (t.offset += l), this);
|
|
1151
|
+
}, s.ensureCapacity = function(t) {
|
|
1132
1152
|
var e = this.buffer.byteLength;
|
|
1133
1153
|
return e < t ? this.resize((e *= 2) > t ? e : t) : this;
|
|
1134
|
-
},
|
|
1135
|
-
var
|
|
1136
|
-
if (
|
|
1154
|
+
}, s.fill = function(t, e, r) {
|
|
1155
|
+
var a = typeof e > "u";
|
|
1156
|
+
if (a && (e = this.offset), typeof t == "string" && t.length > 0 && (t = t.charCodeAt(0)), typeof e > "u" && (e = this.offset), typeof r > "u" && (r = this.limit), !this.noAssert) {
|
|
1137
1157
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1138
1158
|
throw TypeError("Illegal value: " + t + " (not an integer)");
|
|
1139
1159
|
if (t |= 0, typeof e != "number" || e % 1 !== 0)
|
|
@@ -1146,10 +1166,10 @@ function pt() {
|
|
|
1146
1166
|
if (e >= r)
|
|
1147
1167
|
return this;
|
|
1148
1168
|
for (; e < r; ) this.view[e++] = t;
|
|
1149
|
-
return
|
|
1150
|
-
},
|
|
1169
|
+
return a && (this.offset = e), this;
|
|
1170
|
+
}, s.flip = function() {
|
|
1151
1171
|
return this.limit = this.offset, this.offset = 0, this;
|
|
1152
|
-
},
|
|
1172
|
+
}, s.mark = function(t) {
|
|
1153
1173
|
if (t = typeof t > "u" ? this.offset : t, !this.noAssert) {
|
|
1154
1174
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1155
1175
|
throw TypeError("Illegal offset: " + t + " (not an integer)");
|
|
@@ -1157,18 +1177,18 @@ function pt() {
|
|
|
1157
1177
|
throw RangeError("Illegal offset: 0 <= " + t + " (+0) <= " + this.buffer.byteLength);
|
|
1158
1178
|
}
|
|
1159
1179
|
return this.markedOffset = t, this;
|
|
1160
|
-
},
|
|
1180
|
+
}, s.order = function(t) {
|
|
1161
1181
|
if (!this.noAssert && typeof t != "boolean")
|
|
1162
1182
|
throw TypeError("Illegal littleEndian: Not a boolean");
|
|
1163
1183
|
return this.littleEndian = !!t, this;
|
|
1164
|
-
},
|
|
1184
|
+
}, s.LE = function(t) {
|
|
1165
1185
|
return this.littleEndian = typeof t < "u" ? !!t : !0, this;
|
|
1166
|
-
},
|
|
1186
|
+
}, s.BE = function(t) {
|
|
1167
1187
|
return this.littleEndian = typeof t < "u" ? !t : !1, this;
|
|
1168
|
-
},
|
|
1188
|
+
}, s.prepend = function(t, e, r) {
|
|
1169
1189
|
(typeof e == "number" || typeof e != "string") && (r = e, e = void 0);
|
|
1170
|
-
var
|
|
1171
|
-
if (
|
|
1190
|
+
var a = typeof r > "u";
|
|
1191
|
+
if (a && (r = this.offset), !this.noAssert) {
|
|
1172
1192
|
if (typeof r != "number" || r % 1 !== 0)
|
|
1173
1193
|
throw TypeError("Illegal offset: " + r + " (not an integer)");
|
|
1174
1194
|
if (r >>>= 0, r < 0 || r + 0 > this.buffer.byteLength)
|
|
@@ -1183,10 +1203,10 @@ function pt() {
|
|
|
1183
1203
|
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;
|
|
1184
1204
|
} else
|
|
1185
1205
|
new Uint8Array(this.buffer);
|
|
1186
|
-
return this.view.set(t.view.subarray(t.offset, t.limit), r - o), t.offset = t.limit,
|
|
1187
|
-
},
|
|
1206
|
+
return this.view.set(t.view.subarray(t.offset, t.limit), r - o), t.offset = t.limit, a && (this.offset -= o), this;
|
|
1207
|
+
}, s.prependTo = function(t, e) {
|
|
1188
1208
|
return t.prepend(this, e), this;
|
|
1189
|
-
},
|
|
1209
|
+
}, s.printDebug = function(t) {
|
|
1190
1210
|
typeof t != "function" && (t = console.log.bind(console)), t(
|
|
1191
1211
|
this.toString() + `
|
|
1192
1212
|
-------------------------------------------------------------------
|
|
@@ -1195,11 +1215,11 @@ function pt() {
|
|
|
1195
1215
|
!0
|
|
1196
1216
|
)
|
|
1197
1217
|
);
|
|
1198
|
-
},
|
|
1218
|
+
}, s.remaining = function() {
|
|
1199
1219
|
return this.limit - this.offset;
|
|
1200
|
-
},
|
|
1220
|
+
}, s.reset = function() {
|
|
1201
1221
|
return this.markedOffset >= 0 ? (this.offset = this.markedOffset, this.markedOffset = -1) : this.offset = 0, this;
|
|
1202
|
-
},
|
|
1222
|
+
}, s.resize = function(t) {
|
|
1203
1223
|
if (!this.noAssert) {
|
|
1204
1224
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1205
1225
|
throw TypeError("Illegal capacity: " + t + " (not an integer)");
|
|
@@ -1211,7 +1231,7 @@ function pt() {
|
|
|
1211
1231
|
r.set(this.view), this.buffer = e, this.view = r;
|
|
1212
1232
|
}
|
|
1213
1233
|
return this;
|
|
1214
|
-
},
|
|
1234
|
+
}, s.reverse = function(t, e) {
|
|
1215
1235
|
if (typeof t > "u" && (t = this.offset), typeof e > "u" && (e = this.limit), !this.noAssert) {
|
|
1216
1236
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1217
1237
|
throw TypeError("Illegal begin: Not an integer");
|
|
@@ -1221,7 +1241,7 @@ function pt() {
|
|
|
1221
1241
|
throw RangeError("Illegal range: 0 <= " + t + " <= " + e + " <= " + this.buffer.byteLength);
|
|
1222
1242
|
}
|
|
1223
1243
|
return t === e ? this : (Array.prototype.reverse.call(this.view.subarray(t, e)), this);
|
|
1224
|
-
},
|
|
1244
|
+
}, s.skip = function(t) {
|
|
1225
1245
|
if (!this.noAssert) {
|
|
1226
1246
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1227
1247
|
throw TypeError("Illegal length: " + t + " (not an integer)");
|
|
@@ -1231,7 +1251,7 @@ function pt() {
|
|
|
1231
1251
|
if (!this.noAssert && (e < 0 || e > this.buffer.byteLength))
|
|
1232
1252
|
throw RangeError("Illegal length: 0 <= " + this.offset + " + " + t + " <= " + this.buffer.byteLength);
|
|
1233
1253
|
return this.offset = e, this;
|
|
1234
|
-
},
|
|
1254
|
+
}, s.slice = function(t, e) {
|
|
1235
1255
|
if (typeof t > "u" && (t = this.offset), typeof e > "u" && (e = this.limit), !this.noAssert) {
|
|
1236
1256
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1237
1257
|
throw TypeError("Illegal begin: Not an integer");
|
|
@@ -1242,7 +1262,7 @@ function pt() {
|
|
|
1242
1262
|
}
|
|
1243
1263
|
var r = this.clone();
|
|
1244
1264
|
return r.offset = t, r.limit = e, r;
|
|
1245
|
-
},
|
|
1265
|
+
}, s.toBuffer = function(t) {
|
|
1246
1266
|
var e = this.offset, r = this.limit;
|
|
1247
1267
|
if (!this.noAssert) {
|
|
1248
1268
|
if (typeof e != "number" || e % 1 !== 0)
|
|
@@ -1256,9 +1276,9 @@ function pt() {
|
|
|
1256
1276
|
return this.buffer;
|
|
1257
1277
|
if (e === r)
|
|
1258
1278
|
return c;
|
|
1259
|
-
var
|
|
1260
|
-
return new Uint8Array(
|
|
1261
|
-
},
|
|
1279
|
+
var a = new ArrayBuffer(r - e);
|
|
1280
|
+
return new Uint8Array(a).set(new Uint8Array(this.buffer).subarray(e, r), 0), a;
|
|
1281
|
+
}, s.toArrayBuffer = s.toBuffer, s.toString = function(t, e, r) {
|
|
1262
1282
|
if (typeof t > "u")
|
|
1263
1283
|
return "ByteBufferAB(offset=" + this.offset + ",markedOffset=" + this.markedOffset + ",limit=" + this.limit + ",capacity=" + this.capacity() + ")";
|
|
1264
1284
|
switch (typeof t == "number" && (t = "utf8", e = t, r = e), t) {
|
|
@@ -1278,7 +1298,7 @@ function pt() {
|
|
|
1278
1298
|
throw Error("Unsupported encoding: " + t);
|
|
1279
1299
|
}
|
|
1280
1300
|
};
|
|
1281
|
-
var
|
|
1301
|
+
var I = function() {
|
|
1282
1302
|
for (var t = {}, e = [
|
|
1283
1303
|
65,
|
|
1284
1304
|
66,
|
|
@@ -1344,26 +1364,26 @@ function pt() {
|
|
|
1344
1364
|
57,
|
|
1345
1365
|
43,
|
|
1346
1366
|
47
|
|
1347
|
-
], r = [],
|
|
1348
|
-
r[e[
|
|
1367
|
+
], r = [], a = 0, o = e.length; a < o; ++a)
|
|
1368
|
+
r[e[a]] = a;
|
|
1349
1369
|
return t.encode = function(u, l) {
|
|
1350
1370
|
for (var p, F; (p = u()) !== null; )
|
|
1351
1371
|
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));
|
|
1352
1372
|
}, t.decode = function(u, l) {
|
|
1353
1373
|
var p, F, S;
|
|
1354
|
-
function
|
|
1355
|
-
throw Error("Illegal character code: " +
|
|
1374
|
+
function N(_) {
|
|
1375
|
+
throw Error("Illegal character code: " + _);
|
|
1356
1376
|
}
|
|
1357
1377
|
for (; (p = u()) !== null; )
|
|
1358
|
-
if (F = r[p], typeof F > "u" &&
|
|
1378
|
+
if (F = r[p], typeof F > "u" && N(p), (p = u()) !== null && (S = r[p], typeof S > "u" && N(p), l(F << 2 >>> 0 | (S & 48) >> 4), (p = u()) !== null)) {
|
|
1359
1379
|
if (F = r[p], typeof F > "u") {
|
|
1360
1380
|
if (p === 61) break;
|
|
1361
|
-
|
|
1381
|
+
N(p);
|
|
1362
1382
|
}
|
|
1363
1383
|
if (l((S & 15) << 4 >>> 0 | (F & 60) >> 2), (p = u()) !== null) {
|
|
1364
1384
|
if (S = r[p], typeof S > "u") {
|
|
1365
1385
|
if (p === 61) break;
|
|
1366
|
-
|
|
1386
|
+
N(p);
|
|
1367
1387
|
}
|
|
1368
1388
|
l((F & 3) << 6 >>> 0 | S);
|
|
1369
1389
|
}
|
|
@@ -1372,44 +1392,44 @@ function pt() {
|
|
|
1372
1392
|
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u);
|
|
1373
1393
|
}, t;
|
|
1374
1394
|
}();
|
|
1375
|
-
|
|
1395
|
+
s.toBase64 = function(t, e) {
|
|
1376
1396
|
if (typeof t > "u" && (t = this.offset), typeof e > "u" && (e = this.limit), t = t | 0, e = e | 0, t < 0 || e > this.capacity || t > e)
|
|
1377
1397
|
throw RangeError("begin, end");
|
|
1378
1398
|
var r;
|
|
1379
|
-
return
|
|
1399
|
+
return I.encode((function() {
|
|
1380
1400
|
return t < e ? this.view[t++] : null;
|
|
1381
|
-
}).bind(this), r =
|
|
1401
|
+
}).bind(this), r = E()), r();
|
|
1382
1402
|
}, n.fromBase64 = function(t, e) {
|
|
1383
1403
|
if (typeof t != "string")
|
|
1384
1404
|
throw TypeError("str");
|
|
1385
|
-
var r = new n(t.length / 4 * 3, e),
|
|
1386
|
-
return
|
|
1387
|
-
r.view[
|
|
1388
|
-
}), r.limit =
|
|
1405
|
+
var r = new n(t.length / 4 * 3, e), a = 0;
|
|
1406
|
+
return I.decode(d(t), function(o) {
|
|
1407
|
+
r.view[a++] = o;
|
|
1408
|
+
}), r.limit = a, r;
|
|
1389
1409
|
}, n.btoa = function(t) {
|
|
1390
1410
|
return n.fromBinary(t).toBase64();
|
|
1391
1411
|
}, n.atob = function(t) {
|
|
1392
1412
|
return n.fromBase64(t).toBinary();
|
|
1393
|
-
},
|
|
1413
|
+
}, s.toBinary = function(t, e) {
|
|
1394
1414
|
if (typeof t > "u" && (t = this.offset), typeof e > "u" && (e = this.limit), t |= 0, e |= 0, t < 0 || e > this.capacity() || t > e)
|
|
1395
1415
|
throw RangeError("begin, end");
|
|
1396
1416
|
if (t === e)
|
|
1397
1417
|
return "";
|
|
1398
|
-
for (var r = [],
|
|
1399
|
-
r.push(this.view[t++]), r.length >= 1024 && (
|
|
1400
|
-
return
|
|
1418
|
+
for (var r = [], a = []; t < e; )
|
|
1419
|
+
r.push(this.view[t++]), r.length >= 1024 && (a.push(String.fromCharCode.apply(String, r)), r = []);
|
|
1420
|
+
return a.join("") + String.fromCharCode.apply(String, r);
|
|
1401
1421
|
}, n.fromBinary = function(t, e) {
|
|
1402
1422
|
if (typeof t != "string")
|
|
1403
1423
|
throw TypeError("str");
|
|
1404
|
-
for (var r = 0,
|
|
1424
|
+
for (var r = 0, a = t.length, o, u = new n(a, e); r < a; ) {
|
|
1405
1425
|
if (o = t.charCodeAt(r), o > 255)
|
|
1406
1426
|
throw RangeError("illegal char code: " + o);
|
|
1407
1427
|
u.view[r++] = o;
|
|
1408
1428
|
}
|
|
1409
|
-
return u.limit =
|
|
1410
|
-
},
|
|
1411
|
-
for (var e = -1, r = this.buffer.byteLength,
|
|
1412
|
-
if (e !== -1 && (
|
|
1429
|
+
return u.limit = a, u;
|
|
1430
|
+
}, s.toDebug = function(t) {
|
|
1431
|
+
for (var e = -1, r = this.buffer.byteLength, a, o = "", u = "", l = ""; e < r; ) {
|
|
1432
|
+
if (e !== -1 && (a = this.view[e], a < 16 ? o += "0" + a.toString(16).toUpperCase() : o += a.toString(16).toUpperCase(), t && (u += a > 32 && a < 127 ? String.fromCharCode(a) : ".")), ++e, t && e > 0 && e % 16 === 0 && e !== r) {
|
|
1413
1433
|
for (; o.length < 3 * 16 + 3; ) o += " ";
|
|
1414
1434
|
l += o + u + `
|
|
1415
1435
|
`, o = u = "";
|
|
@@ -1424,75 +1444,75 @@ function pt() {
|
|
|
1424
1444
|
}
|
|
1425
1445
|
return t ? l : o;
|
|
1426
1446
|
}, n.fromDebug = function(t, e, r) {
|
|
1427
|
-
for (var
|
|
1447
|
+
for (var a = t.length, o = new n((a + 1) / 3 | 0, e, r), u = 0, l = 0, p, F, S = !1, N = !1, _ = !1, L = !1, y = !1; u < a; ) {
|
|
1428
1448
|
switch (p = t.charAt(u++)) {
|
|
1429
1449
|
case "!":
|
|
1430
1450
|
if (!r) {
|
|
1431
|
-
if (
|
|
1432
|
-
|
|
1451
|
+
if (N || _ || L) {
|
|
1452
|
+
y = !0;
|
|
1433
1453
|
break;
|
|
1434
1454
|
}
|
|
1435
|
-
|
|
1455
|
+
N = _ = L = !0;
|
|
1436
1456
|
}
|
|
1437
1457
|
o.offset = o.markedOffset = o.limit = l, S = !1;
|
|
1438
1458
|
break;
|
|
1439
1459
|
case "|":
|
|
1440
1460
|
if (!r) {
|
|
1441
|
-
if (
|
|
1442
|
-
|
|
1461
|
+
if (N || L) {
|
|
1462
|
+
y = !0;
|
|
1443
1463
|
break;
|
|
1444
1464
|
}
|
|
1445
|
-
|
|
1465
|
+
N = L = !0;
|
|
1446
1466
|
}
|
|
1447
1467
|
o.offset = o.limit = l, S = !1;
|
|
1448
1468
|
break;
|
|
1449
1469
|
case "[":
|
|
1450
1470
|
if (!r) {
|
|
1451
|
-
if (
|
|
1452
|
-
|
|
1471
|
+
if (N || _) {
|
|
1472
|
+
y = !0;
|
|
1453
1473
|
break;
|
|
1454
1474
|
}
|
|
1455
|
-
|
|
1475
|
+
N = _ = !0;
|
|
1456
1476
|
}
|
|
1457
1477
|
o.offset = o.markedOffset = l, S = !1;
|
|
1458
1478
|
break;
|
|
1459
1479
|
case "<":
|
|
1460
1480
|
if (!r) {
|
|
1461
|
-
if (
|
|
1462
|
-
|
|
1481
|
+
if (N) {
|
|
1482
|
+
y = !0;
|
|
1463
1483
|
break;
|
|
1464
1484
|
}
|
|
1465
|
-
|
|
1485
|
+
N = !0;
|
|
1466
1486
|
}
|
|
1467
1487
|
o.offset = l, S = !1;
|
|
1468
1488
|
break;
|
|
1469
1489
|
case "]":
|
|
1470
1490
|
if (!r) {
|
|
1471
|
-
if (
|
|
1472
|
-
|
|
1491
|
+
if (L || _) {
|
|
1492
|
+
y = !0;
|
|
1473
1493
|
break;
|
|
1474
1494
|
}
|
|
1475
|
-
|
|
1495
|
+
L = _ = !0;
|
|
1476
1496
|
}
|
|
1477
1497
|
o.limit = o.markedOffset = l, S = !1;
|
|
1478
1498
|
break;
|
|
1479
1499
|
case ">":
|
|
1480
1500
|
if (!r) {
|
|
1481
|
-
if (
|
|
1482
|
-
|
|
1501
|
+
if (L) {
|
|
1502
|
+
y = !0;
|
|
1483
1503
|
break;
|
|
1484
1504
|
}
|
|
1485
|
-
|
|
1505
|
+
L = !0;
|
|
1486
1506
|
}
|
|
1487
1507
|
o.limit = l, S = !1;
|
|
1488
1508
|
break;
|
|
1489
1509
|
case "'":
|
|
1490
1510
|
if (!r) {
|
|
1491
|
-
if (
|
|
1492
|
-
|
|
1511
|
+
if (_) {
|
|
1512
|
+
y = !0;
|
|
1493
1513
|
break;
|
|
1494
1514
|
}
|
|
1495
|
-
|
|
1515
|
+
_ = !0;
|
|
1496
1516
|
}
|
|
1497
1517
|
o.markedOffset = l, S = !1;
|
|
1498
1518
|
break;
|
|
@@ -1501,24 +1521,24 @@ function pt() {
|
|
|
1501
1521
|
break;
|
|
1502
1522
|
default:
|
|
1503
1523
|
if (!r && S) {
|
|
1504
|
-
|
|
1524
|
+
y = !0;
|
|
1505
1525
|
break;
|
|
1506
1526
|
}
|
|
1507
1527
|
if (F = parseInt(p + t.charAt(u++), 16), !r && (isNaN(F) || F < 0 || F > 255))
|
|
1508
1528
|
throw TypeError("Illegal str: Not a debug encoded string");
|
|
1509
1529
|
o.view[l++] = F, S = !0;
|
|
1510
1530
|
}
|
|
1511
|
-
if (
|
|
1531
|
+
if (y)
|
|
1512
1532
|
throw TypeError("Illegal str: Invalid symbol at " + u);
|
|
1513
1533
|
}
|
|
1514
1534
|
if (!r) {
|
|
1515
|
-
if (!
|
|
1535
|
+
if (!N || !L)
|
|
1516
1536
|
throw TypeError("Illegal str: Missing offset or limit");
|
|
1517
1537
|
if (l < o.buffer.byteLength)
|
|
1518
|
-
throw TypeError("Illegal str: Not a debug encoded string (is it hex?) " + l + " < " +
|
|
1538
|
+
throw TypeError("Illegal str: Not a debug encoded string (is it hex?) " + l + " < " + a);
|
|
1519
1539
|
}
|
|
1520
1540
|
return o;
|
|
1521
|
-
},
|
|
1541
|
+
}, s.toHex = function(t, e) {
|
|
1522
1542
|
if (t = typeof t > "u" ? this.offset : t, e = typeof e > "u" ? this.limit : e, !this.noAssert) {
|
|
1523
1543
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1524
1544
|
throw TypeError("Illegal begin: Not an integer");
|
|
@@ -1527,8 +1547,8 @@ function pt() {
|
|
|
1527
1547
|
if (e >>>= 0, t < 0 || t > e || e > this.buffer.byteLength)
|
|
1528
1548
|
throw RangeError("Illegal range: 0 <= " + t + " <= " + e + " <= " + this.buffer.byteLength);
|
|
1529
1549
|
}
|
|
1530
|
-
for (var r = new Array(e - t),
|
|
1531
|
-
|
|
1550
|
+
for (var r = new Array(e - t), a; t < e; )
|
|
1551
|
+
a = this.view[t++], a < 16 ? r.push("0", a.toString(16)) : r.push(a.toString(16));
|
|
1532
1552
|
return r.join("");
|
|
1533
1553
|
}, n.fromHex = function(t, e, r) {
|
|
1534
1554
|
if (!r) {
|
|
@@ -1537,73 +1557,73 @@ function pt() {
|
|
|
1537
1557
|
if (t.length % 2 !== 0)
|
|
1538
1558
|
throw TypeError("Illegal str: Length not a multiple of 2");
|
|
1539
1559
|
}
|
|
1540
|
-
for (var
|
|
1560
|
+
for (var a = t.length, o = new n(a / 2 | 0, e), u, l = 0, p = 0; l < a; l += 2) {
|
|
1541
1561
|
if (u = parseInt(t.substring(l, l + 2), 16), !r && (!isFinite(u) || u < 0 || u > 255))
|
|
1542
1562
|
throw TypeError("Illegal str: Contains non-hex characters");
|
|
1543
1563
|
o.view[p++] = u;
|
|
1544
1564
|
}
|
|
1545
1565
|
return o.limit = p, o;
|
|
1546
1566
|
};
|
|
1547
|
-
var
|
|
1567
|
+
var v = function() {
|
|
1548
1568
|
var t = {};
|
|
1549
1569
|
return t.MAX_CODEPOINT = 1114111, t.encodeUTF8 = function(e, r) {
|
|
1550
|
-
var
|
|
1551
|
-
for (typeof e == "number" && (
|
|
1570
|
+
var a = null;
|
|
1571
|
+
for (typeof e == "number" && (a = e, e = function() {
|
|
1552
1572
|
return null;
|
|
1553
|
-
});
|
|
1554
|
-
|
|
1573
|
+
}); a !== null || (a = e()) !== null; )
|
|
1574
|
+
a < 128 ? r(a & 127) : a < 2048 ? (r(a >> 6 & 31 | 192), r(a & 63 | 128)) : a < 65536 ? (r(a >> 12 & 15 | 224), r(a >> 6 & 63 | 128), r(a & 63 | 128)) : (r(a >> 18 & 7 | 240), r(a >> 12 & 63 | 128), r(a >> 6 & 63 | 128), r(a & 63 | 128)), a = null;
|
|
1555
1575
|
}, t.decodeUTF8 = function(e, r) {
|
|
1556
|
-
for (var
|
|
1576
|
+
for (var a, o, u, l, p = function(F) {
|
|
1557
1577
|
F = F.slice(0, F.indexOf(null));
|
|
1558
1578
|
var S = Error(F.toString());
|
|
1559
1579
|
throw S.name = "TruncatedError", S.bytes = F, S;
|
|
1560
|
-
}; (
|
|
1561
|
-
if ((
|
|
1562
|
-
r(
|
|
1563
|
-
else if ((
|
|
1564
|
-
(o = e()) === null && p([
|
|
1565
|
-
else if ((
|
|
1566
|
-
((o = e()) === null || (u = e()) === null) && p([
|
|
1567
|
-
else if ((
|
|
1568
|
-
((o = e()) === null || (u = e()) === null || (l = e()) === null) && p([
|
|
1569
|
-
else throw RangeError("Illegal starting byte: " +
|
|
1580
|
+
}; (a = e()) !== null; )
|
|
1581
|
+
if ((a & 128) === 0)
|
|
1582
|
+
r(a);
|
|
1583
|
+
else if ((a & 224) === 192)
|
|
1584
|
+
(o = e()) === null && p([a, o]), r((a & 31) << 6 | o & 63);
|
|
1585
|
+
else if ((a & 240) === 224)
|
|
1586
|
+
((o = e()) === null || (u = e()) === null) && p([a, o, u]), r((a & 15) << 12 | (o & 63) << 6 | u & 63);
|
|
1587
|
+
else if ((a & 248) === 240)
|
|
1588
|
+
((o = e()) === null || (u = e()) === null || (l = e()) === null) && p([a, o, u, l]), r((a & 7) << 18 | (o & 63) << 12 | (u & 63) << 6 | l & 63);
|
|
1589
|
+
else throw RangeError("Illegal starting byte: " + a);
|
|
1570
1590
|
}, t.UTF16toUTF8 = function(e, r) {
|
|
1571
|
-
for (var
|
|
1572
|
-
if (
|
|
1573
|
-
r((
|
|
1591
|
+
for (var a, o = null; (a = o !== null ? o : e()) !== null; ) {
|
|
1592
|
+
if (a >= 55296 && a <= 57343 && (o = e()) !== null && o >= 56320 && o <= 57343) {
|
|
1593
|
+
r((a - 55296) * 1024 + o - 56320 + 65536), o = null;
|
|
1574
1594
|
continue;
|
|
1575
1595
|
}
|
|
1576
|
-
r(
|
|
1596
|
+
r(a);
|
|
1577
1597
|
}
|
|
1578
1598
|
o !== null && r(o);
|
|
1579
1599
|
}, t.UTF8toUTF16 = function(e, r) {
|
|
1580
|
-
var
|
|
1581
|
-
for (typeof e == "number" && (
|
|
1600
|
+
var a = null;
|
|
1601
|
+
for (typeof e == "number" && (a = e, e = function() {
|
|
1582
1602
|
return null;
|
|
1583
|
-
});
|
|
1584
|
-
|
|
1603
|
+
}); a !== null || (a = e()) !== null; )
|
|
1604
|
+
a <= 65535 ? r(a) : (a -= 65536, r((a >> 10) + 55296), r(a % 1024 + 56320)), a = null;
|
|
1585
1605
|
}, t.encodeUTF16toUTF8 = function(e, r) {
|
|
1586
|
-
t.UTF16toUTF8(e, function(
|
|
1587
|
-
t.encodeUTF8(
|
|
1606
|
+
t.UTF16toUTF8(e, function(a) {
|
|
1607
|
+
t.encodeUTF8(a, r);
|
|
1588
1608
|
});
|
|
1589
1609
|
}, t.decodeUTF8toUTF16 = function(e, r) {
|
|
1590
|
-
t.decodeUTF8(e, function(
|
|
1591
|
-
t.UTF8toUTF16(
|
|
1610
|
+
t.decodeUTF8(e, function(a) {
|
|
1611
|
+
t.UTF8toUTF16(a, r);
|
|
1592
1612
|
});
|
|
1593
1613
|
}, t.calculateCodePoint = function(e) {
|
|
1594
1614
|
return e < 128 ? 1 : e < 2048 ? 2 : e < 65536 ? 3 : 4;
|
|
1595
1615
|
}, t.calculateUTF8 = function(e) {
|
|
1596
|
-
for (var r,
|
|
1597
|
-
|
|
1598
|
-
return
|
|
1616
|
+
for (var r, a = 0; (r = e()) !== null; )
|
|
1617
|
+
a += r < 128 ? 1 : r < 2048 ? 2 : r < 65536 ? 3 : 4;
|
|
1618
|
+
return a;
|
|
1599
1619
|
}, t.calculateUTF16asUTF8 = function(e) {
|
|
1600
|
-
var r = 0,
|
|
1620
|
+
var r = 0, a = 0;
|
|
1601
1621
|
return t.UTF16toUTF8(e, function(o) {
|
|
1602
|
-
++r,
|
|
1603
|
-
}), [r,
|
|
1622
|
+
++r, a += o < 128 ? 1 : o < 2048 ? 2 : o < 65536 ? 3 : 4;
|
|
1623
|
+
}), [r, a];
|
|
1604
1624
|
}, t;
|
|
1605
1625
|
}();
|
|
1606
|
-
return
|
|
1626
|
+
return s.toUTF8 = function(t, e) {
|
|
1607
1627
|
if (typeof t > "u" && (t = this.offset), typeof e > "u" && (e = this.limit), !this.noAssert) {
|
|
1608
1628
|
if (typeof t != "number" || t % 1 !== 0)
|
|
1609
1629
|
throw TypeError("Illegal begin: Not an integer");
|
|
@@ -1614,9 +1634,9 @@ function pt() {
|
|
|
1614
1634
|
}
|
|
1615
1635
|
var r;
|
|
1616
1636
|
try {
|
|
1617
|
-
|
|
1637
|
+
v.decodeUTF8toUTF16((function() {
|
|
1618
1638
|
return t < e ? this.view[t++] : null;
|
|
1619
|
-
}).bind(this), r =
|
|
1639
|
+
}).bind(this), r = E());
|
|
1620
1640
|
} catch {
|
|
1621
1641
|
if (t !== e)
|
|
1622
1642
|
throw RangeError("Illegal range: Truncated data, " + t + " != " + e);
|
|
@@ -1625,16 +1645,16 @@ function pt() {
|
|
|
1625
1645
|
}, n.fromUTF8 = function(t, e, r) {
|
|
1626
1646
|
if (!r && typeof t != "string")
|
|
1627
1647
|
throw TypeError("Illegal str: Not a string");
|
|
1628
|
-
var
|
|
1629
|
-
return
|
|
1630
|
-
|
|
1631
|
-
}),
|
|
1648
|
+
var a = new n(v.calculateUTF16asUTF8(d(t), !0)[1], e, r), o = 0;
|
|
1649
|
+
return v.encodeUTF16toUTF8(d(t), function(u) {
|
|
1650
|
+
a.view[o++] = u;
|
|
1651
|
+
}), a.limit = o, a;
|
|
1632
1652
|
}, n;
|
|
1633
1653
|
});
|
|
1634
|
-
}(
|
|
1654
|
+
}(K)), K.exports;
|
|
1635
1655
|
}
|
|
1636
|
-
var
|
|
1637
|
-
const q = /* @__PURE__ */
|
|
1656
|
+
var Ft = Et();
|
|
1657
|
+
const q = /* @__PURE__ */ dt(Ft), Tt = 1, It = 2, vt = 512, mt = 513, xt = 514, St = 1, Ut = 3;
|
|
1638
1658
|
class H {
|
|
1639
1659
|
// 实例属性的类型标注
|
|
1640
1660
|
valueStringPool;
|
|
@@ -1655,10 +1675,10 @@ class H {
|
|
|
1655
1675
|
* @returns {ByteBuffer}
|
|
1656
1676
|
*/
|
|
1657
1677
|
static readBytes(i, n) {
|
|
1658
|
-
const
|
|
1678
|
+
const s = new Uint8Array(n);
|
|
1659
1679
|
for (let c = 0; c < n; c++)
|
|
1660
|
-
|
|
1661
|
-
return q.wrap(
|
|
1680
|
+
s[c] = i.readUint8();
|
|
1681
|
+
return q.wrap(s, "binary", !0);
|
|
1662
1682
|
}
|
|
1663
1683
|
/**
|
|
1664
1684
|
*
|
|
@@ -1666,33 +1686,33 @@ class H {
|
|
|
1666
1686
|
* @return {Record<string, string[]>}
|
|
1667
1687
|
*/
|
|
1668
1688
|
processResourceTable(i) {
|
|
1669
|
-
const n = q.wrap(i, "binary", !0),
|
|
1670
|
-
let
|
|
1671
|
-
if (
|
|
1689
|
+
const n = q.wrap(i, "binary", !0), s = n.readShort(), c = n.readShort(), w = n.readInt(), d = n.readInt();
|
|
1690
|
+
let E, T;
|
|
1691
|
+
if (s !== It)
|
|
1672
1692
|
throw new Error("No RES_TABLE_TYPE found!");
|
|
1673
|
-
if (
|
|
1693
|
+
if (w !== n.limit)
|
|
1674
1694
|
throw new Error("The buffer size not matches to the resource table size.");
|
|
1675
1695
|
n.offset = c;
|
|
1676
|
-
let
|
|
1696
|
+
let U = 0, I = 0;
|
|
1677
1697
|
for (; ; ) {
|
|
1678
|
-
let
|
|
1698
|
+
let v, t, e;
|
|
1679
1699
|
try {
|
|
1680
|
-
|
|
1700
|
+
v = n.offset, t = n.readShort(), n.readShort(), e = n.readInt();
|
|
1681
1701
|
} catch {
|
|
1682
1702
|
break;
|
|
1683
1703
|
}
|
|
1684
|
-
if (t ===
|
|
1685
|
-
|
|
1686
|
-
else if (t ===
|
|
1687
|
-
|
|
1704
|
+
if (t === Tt)
|
|
1705
|
+
U === 0 && (E = new q(e), n.offset = v, n.prependTo(E), T = q.wrap(E, "binary", !0), T.LE(), this.valueStringPool = this.processStringPool(T)), U++;
|
|
1706
|
+
else if (t === vt)
|
|
1707
|
+
E = new q(e), n.offset = v, n.prependTo(E), T = q.wrap(E, "binary", !0), T.LE(), this.processPackage(T), I++;
|
|
1688
1708
|
else
|
|
1689
1709
|
throw new Error("Unsupported type");
|
|
1690
|
-
if (n.offset =
|
|
1710
|
+
if (n.offset = v + e, !n.remaining())
|
|
1691
1711
|
break;
|
|
1692
1712
|
}
|
|
1693
|
-
if (
|
|
1713
|
+
if (U !== 1)
|
|
1694
1714
|
throw new Error("More than 1 string pool found!");
|
|
1695
|
-
if (
|
|
1715
|
+
if (I !== d)
|
|
1696
1716
|
throw new Error("Real package count not equals the declared count.");
|
|
1697
1717
|
return this.responseMap;
|
|
1698
1718
|
}
|
|
@@ -1704,33 +1724,33 @@ class H {
|
|
|
1704
1724
|
i.readShort();
|
|
1705
1725
|
const n = i.readShort();
|
|
1706
1726
|
i.readInt();
|
|
1707
|
-
const
|
|
1708
|
-
this.package_id =
|
|
1709
|
-
for (let
|
|
1727
|
+
const s = i.readInt();
|
|
1728
|
+
this.package_id = s;
|
|
1729
|
+
for (let v = 0; v < 256; ++v)
|
|
1710
1730
|
i.readUint8();
|
|
1711
1731
|
const c = i.readInt();
|
|
1712
1732
|
i.readInt();
|
|
1713
|
-
const
|
|
1733
|
+
const w = i.readInt();
|
|
1714
1734
|
if (i.readInt(), c !== n)
|
|
1715
1735
|
throw new Error("TypeStrings must immediately following the package structure header.");
|
|
1716
|
-
let
|
|
1736
|
+
let d = i.offset;
|
|
1717
1737
|
i.offset = c;
|
|
1718
|
-
const
|
|
1719
|
-
i.offset =
|
|
1720
|
-
const
|
|
1721
|
-
|
|
1722
|
-
const
|
|
1723
|
-
i.offset =
|
|
1724
|
-
let
|
|
1738
|
+
const E = H.readBytes(i, i.limit - i.offset);
|
|
1739
|
+
i.offset = d, this.typeStringPool = this.processStringPool(E), i.offset = w, i.readShort(), i.readShort();
|
|
1740
|
+
const T = i.readInt();
|
|
1741
|
+
d = i.offset, i.offset = w;
|
|
1742
|
+
const U = H.readBytes(i, i.limit - i.offset);
|
|
1743
|
+
i.offset = d, this.keyStringPool = this.processStringPool(U), i.offset = w + T;
|
|
1744
|
+
let I;
|
|
1725
1745
|
for (; ; ) {
|
|
1726
|
-
const
|
|
1746
|
+
const v = i.offset;
|
|
1727
1747
|
let t, e;
|
|
1728
1748
|
try {
|
|
1729
1749
|
t = i.readShort(), i.readShort(), e = i.readInt();
|
|
1730
1750
|
} catch {
|
|
1731
1751
|
break;
|
|
1732
1752
|
}
|
|
1733
|
-
if (t ===
|
|
1753
|
+
if (t === xt ? (i.offset = v, I = H.readBytes(i, e), this.processTypeSpec(I)) : t === mt && (i.offset = v, I = H.readBytes(i, e), this.processType(I)), e === 0 || (i.offset = v + e, !i.remaining()))
|
|
1734
1754
|
break;
|
|
1735
1755
|
}
|
|
1736
1756
|
}
|
|
@@ -1742,30 +1762,30 @@ class H {
|
|
|
1742
1762
|
i.readShort();
|
|
1743
1763
|
const n = i.readShort();
|
|
1744
1764
|
i.readInt();
|
|
1745
|
-
const
|
|
1765
|
+
const s = i.readByte();
|
|
1746
1766
|
i.readByte(), i.readShort();
|
|
1747
|
-
const c = i.readInt(),
|
|
1748
|
-
if (i.readInt(), i.offset = n, n + c * 4 !==
|
|
1767
|
+
const c = i.readInt(), w = i.readInt(), d = {};
|
|
1768
|
+
if (i.readInt(), i.offset = n, n + c * 4 !== w)
|
|
1749
1769
|
throw new Error("HeaderSize, entryCount and entriesStart are not valid.");
|
|
1750
|
-
const
|
|
1751
|
-
for (let
|
|
1752
|
-
|
|
1753
|
-
for (let
|
|
1754
|
-
if (
|
|
1755
|
-
const
|
|
1756
|
-
let
|
|
1770
|
+
const E = new Array(c);
|
|
1771
|
+
for (let T = 0; T < c; ++T)
|
|
1772
|
+
E[T] = i.readInt();
|
|
1773
|
+
for (let T = 0; T < c; ++T) {
|
|
1774
|
+
if (E[T] === -1) continue;
|
|
1775
|
+
const U = this.package_id << 24 | s << 16 | T, I = i.offset;
|
|
1776
|
+
let v, t, e, r;
|
|
1757
1777
|
try {
|
|
1758
|
-
i.readShort(),
|
|
1778
|
+
i.readShort(), v = i.readShort(), t = i.readInt();
|
|
1759
1779
|
} catch {
|
|
1760
1780
|
break;
|
|
1761
1781
|
}
|
|
1762
|
-
if ((
|
|
1782
|
+
if ((v & 1) === 0) {
|
|
1763
1783
|
i.readShort(), i.readByte(), e = i.readByte(), r = i.readInt();
|
|
1764
|
-
const o = Number(
|
|
1784
|
+
const o = Number(U).toString(16), u = this.keyStringPool[t];
|
|
1765
1785
|
let l = null;
|
|
1766
1786
|
const p = parseInt(o, 16);
|
|
1767
1787
|
let F = this.entryMap[p];
|
|
1768
|
-
F == null && (F = []), F.push(u), this.entryMap[p] = F, e ===
|
|
1788
|
+
F == null && (F = []), F.push(u), this.entryMap[p] = F, e === Ut ? l = this.valueStringPool[r] : e === St ? d[o] = r : l = "" + r, this.putIntoMap("@" + o, l), i.offset = I + 8 + 8;
|
|
1769
1789
|
} else {
|
|
1770
1790
|
i.readInt();
|
|
1771
1791
|
const o = i.readInt();
|
|
@@ -1773,11 +1793,11 @@ class H {
|
|
|
1773
1793
|
i.readInt(), i.readShort(), i.readByte(), e = i.readByte(), r = i.readInt();
|
|
1774
1794
|
}
|
|
1775
1795
|
}
|
|
1776
|
-
for (const
|
|
1777
|
-
const
|
|
1778
|
-
if (
|
|
1779
|
-
for (const
|
|
1780
|
-
this.putIntoMap("@" +
|
|
1796
|
+
for (const T in d) {
|
|
1797
|
+
const U = this.responseMap["@" + Number(d[T]).toString(16).toUpperCase()];
|
|
1798
|
+
if (U != null && Object.keys(U).length < 1e3)
|
|
1799
|
+
for (const I of U)
|
|
1800
|
+
this.putIntoMap("@" + T, I);
|
|
1781
1801
|
}
|
|
1782
1802
|
}
|
|
1783
1803
|
/**
|
|
@@ -1789,36 +1809,36 @@ class H {
|
|
|
1789
1809
|
i.readShort(), i.readShort(), i.readInt();
|
|
1790
1810
|
const n = i.readInt();
|
|
1791
1811
|
i.readInt();
|
|
1792
|
-
const
|
|
1812
|
+
const s = i.readInt(), c = i.readInt();
|
|
1793
1813
|
i.readInt();
|
|
1794
|
-
let
|
|
1795
|
-
const
|
|
1796
|
-
for (let
|
|
1797
|
-
I
|
|
1798
|
-
const
|
|
1799
|
-
for (let
|
|
1800
|
-
const
|
|
1801
|
-
if (i.offset =
|
|
1802
|
-
|
|
1814
|
+
let w, d;
|
|
1815
|
+
const E = (s & 256) !== 0, T = new Array(n);
|
|
1816
|
+
for (let I = 0; I < n; ++I)
|
|
1817
|
+
T[I] = i.readInt();
|
|
1818
|
+
const U = new Array(n);
|
|
1819
|
+
for (let I = 0; I < n; ++I) {
|
|
1820
|
+
const v = c + T[I];
|
|
1821
|
+
if (i.offset = v, U[I] = "", E) {
|
|
1822
|
+
w = i.readUint8(), (w & 128) !== 0 && (w = ((w & 127) << 8) + i.readUint8());
|
|
1803
1823
|
let t = i.readUint8();
|
|
1804
1824
|
if ((t & 128) !== 0 && (t = ((t & 127) << 8) + i.readUint8()), t > 0) {
|
|
1805
|
-
|
|
1825
|
+
d = H.readBytes(i, t);
|
|
1806
1826
|
try {
|
|
1807
|
-
|
|
1827
|
+
U[I] = q.wrap(d, "utf8", !0).toString("utf8");
|
|
1808
1828
|
} catch {
|
|
1809
1829
|
}
|
|
1810
1830
|
} else
|
|
1811
|
-
|
|
1812
|
-
} else if (
|
|
1813
|
-
const t =
|
|
1814
|
-
|
|
1831
|
+
U[I] = "";
|
|
1832
|
+
} else if (w = i.readUint16(), (w & 32768) !== 0 && (w = ((w & 32767) << 16) + i.readUint16()), w > 0) {
|
|
1833
|
+
const t = w * 2;
|
|
1834
|
+
d = H.readBytes(i, t);
|
|
1815
1835
|
try {
|
|
1816
|
-
|
|
1836
|
+
U[I] = q.wrap(d, "utf8", !0).toString("utf8");
|
|
1817
1837
|
} catch {
|
|
1818
1838
|
}
|
|
1819
1839
|
}
|
|
1820
1840
|
}
|
|
1821
|
-
return
|
|
1841
|
+
return U;
|
|
1822
1842
|
}
|
|
1823
1843
|
/**
|
|
1824
1844
|
*
|
|
@@ -1826,9 +1846,9 @@ class H {
|
|
|
1826
1846
|
*/
|
|
1827
1847
|
processTypeSpec(i) {
|
|
1828
1848
|
i.readShort(), i.readShort(), i.readInt(), i.readByte(), i.readByte(), i.readShort();
|
|
1829
|
-
const n = i.readInt(),
|
|
1849
|
+
const n = i.readInt(), s = new Array(n);
|
|
1830
1850
|
for (let c = 0; c < n; ++c)
|
|
1831
|
-
|
|
1851
|
+
s[c] = i.readInt();
|
|
1832
1852
|
}
|
|
1833
1853
|
/**
|
|
1834
1854
|
*
|
|
@@ -1836,15 +1856,15 @@ class H {
|
|
|
1836
1856
|
* @param {string | null} value - 资源值,可能是 null
|
|
1837
1857
|
*/
|
|
1838
1858
|
putIntoMap(i, n) {
|
|
1839
|
-
const
|
|
1840
|
-
this.responseMap[
|
|
1859
|
+
const s = i.toUpperCase();
|
|
1860
|
+
this.responseMap[s] == null && (this.responseMap[s] = []), n && this.responseMap[s].push(n);
|
|
1841
1861
|
}
|
|
1842
1862
|
}
|
|
1843
|
-
const
|
|
1863
|
+
const V = {
|
|
1844
1864
|
ELEMENT_NODE: 1,
|
|
1845
1865
|
ATTRIBUTE_NODE: 2,
|
|
1846
1866
|
CDATA_SECTION_NODE: 4
|
|
1847
|
-
},
|
|
1867
|
+
}, $ = {
|
|
1848
1868
|
NULL: 0,
|
|
1849
1869
|
STRING_POOL: 1,
|
|
1850
1870
|
XML: 3,
|
|
@@ -1854,10 +1874,10 @@ const z = {
|
|
|
1854
1874
|
XML_END_ELEMENT: 259,
|
|
1855
1875
|
XML_CDATA: 260,
|
|
1856
1876
|
XML_RESOURCE_MAP: 384
|
|
1857
|
-
},
|
|
1877
|
+
}, G = {
|
|
1858
1878
|
SORTED: 1,
|
|
1859
1879
|
UTF8: 256
|
|
1860
|
-
},
|
|
1880
|
+
}, R = {
|
|
1861
1881
|
COMPLEX_UNIT_DIP: 1,
|
|
1862
1882
|
COMPLEX_UNIT_FRACTION: 0,
|
|
1863
1883
|
COMPLEX_UNIT_FRACTION_PARENT: 1,
|
|
@@ -1879,7 +1899,7 @@ const z = {
|
|
|
1879
1899
|
TYPE_REFERENCE: 1,
|
|
1880
1900
|
TYPE_STRING: 3
|
|
1881
1901
|
};
|
|
1882
|
-
class
|
|
1902
|
+
class At {
|
|
1883
1903
|
view;
|
|
1884
1904
|
// Use DataView for reading little-endian data
|
|
1885
1905
|
cursor;
|
|
@@ -1937,24 +1957,24 @@ class It {
|
|
|
1937
1957
|
unit: null,
|
|
1938
1958
|
rawUnit: 0
|
|
1939
1959
|
// Will be overwritten
|
|
1940
|
-
}, n = this.readU32(),
|
|
1941
|
-
switch (i.value = n >> 8, i.rawUnit =
|
|
1942
|
-
case
|
|
1960
|
+
}, n = this.readU32(), s = n & 255;
|
|
1961
|
+
switch (i.value = n >> 8, i.rawUnit = s, s) {
|
|
1962
|
+
case R.COMPLEX_UNIT_MM:
|
|
1943
1963
|
i.unit = "mm";
|
|
1944
1964
|
break;
|
|
1945
|
-
case
|
|
1965
|
+
case R.COMPLEX_UNIT_PX:
|
|
1946
1966
|
i.unit = "px";
|
|
1947
1967
|
break;
|
|
1948
|
-
case
|
|
1968
|
+
case R.COMPLEX_UNIT_DIP:
|
|
1949
1969
|
i.unit = "dp";
|
|
1950
1970
|
break;
|
|
1951
|
-
case
|
|
1971
|
+
case R.COMPLEX_UNIT_SP:
|
|
1952
1972
|
i.unit = "sp";
|
|
1953
1973
|
break;
|
|
1954
|
-
case
|
|
1974
|
+
case R.COMPLEX_UNIT_PT:
|
|
1955
1975
|
i.unit = "pt";
|
|
1956
1976
|
break;
|
|
1957
|
-
case
|
|
1977
|
+
case R.COMPLEX_UNIT_IN:
|
|
1958
1978
|
i.unit = "in";
|
|
1959
1979
|
break;
|
|
1960
1980
|
}
|
|
@@ -1968,12 +1988,12 @@ class It {
|
|
|
1968
1988
|
type: null,
|
|
1969
1989
|
rawType: 0
|
|
1970
1990
|
// Will be overwritten
|
|
1971
|
-
}, n = this.readU32(),
|
|
1972
|
-
switch (i.value = this.convertIntToFloat(n >> 4), i.rawType =
|
|
1973
|
-
case
|
|
1991
|
+
}, n = this.readU32(), s = n & 15;
|
|
1992
|
+
switch (i.value = this.convertIntToFloat(n >> 4), i.rawType = s, s) {
|
|
1993
|
+
case R.COMPLEX_UNIT_FRACTION:
|
|
1974
1994
|
i.type = "%";
|
|
1975
1995
|
break;
|
|
1976
|
-
case
|
|
1996
|
+
case R.COMPLEX_UNIT_FRACTION_PARENT:
|
|
1977
1997
|
i.type = "%p";
|
|
1978
1998
|
break;
|
|
1979
1999
|
}
|
|
@@ -1997,57 +2017,57 @@ class It {
|
|
|
1997
2017
|
rawType: 0
|
|
1998
2018
|
// Will be overwritten
|
|
1999
2019
|
}, n = this.cursor;
|
|
2000
|
-
let
|
|
2020
|
+
let s = this.readU16();
|
|
2001
2021
|
this.readU8();
|
|
2002
2022
|
const c = this.readU8();
|
|
2003
|
-
switch (
|
|
2004
|
-
case
|
|
2023
|
+
switch (s === 0 && (s = 8), i.rawType = c, c) {
|
|
2024
|
+
case R.TYPE_INT_DEC:
|
|
2005
2025
|
i.value = this.readS32(), i.type = "int_dec";
|
|
2006
2026
|
break;
|
|
2007
|
-
case
|
|
2027
|
+
case R.TYPE_INT_HEX:
|
|
2008
2028
|
i.value = this.readS32(), i.type = "int_hex";
|
|
2009
2029
|
break;
|
|
2010
|
-
case
|
|
2011
|
-
const
|
|
2012
|
-
i.value =
|
|
2030
|
+
case R.TYPE_STRING:
|
|
2031
|
+
const d = this.readS32();
|
|
2032
|
+
i.value = d >= 0 ? this.strings[d] : "", i.type = "string";
|
|
2013
2033
|
break;
|
|
2014
|
-
case
|
|
2015
|
-
const
|
|
2016
|
-
i.value = `resourceId:0x${
|
|
2034
|
+
case R.TYPE_REFERENCE:
|
|
2035
|
+
const E = this.readU32();
|
|
2036
|
+
i.value = `resourceId:0x${E.toString(16)}`, i.type = "reference";
|
|
2017
2037
|
break;
|
|
2018
|
-
case
|
|
2038
|
+
case R.TYPE_INT_BOOLEAN:
|
|
2019
2039
|
i.value = this.readS32() !== 0, i.type = "boolean";
|
|
2020
2040
|
break;
|
|
2021
|
-
case
|
|
2041
|
+
case R.TYPE_NULL:
|
|
2022
2042
|
this.readU32(), i.value = null, i.type = "null";
|
|
2023
2043
|
break;
|
|
2024
|
-
case
|
|
2044
|
+
case R.TYPE_INT_COLOR_RGB8:
|
|
2025
2045
|
i.value = this.readHex24(), i.type = "rgb8";
|
|
2026
2046
|
break;
|
|
2027
|
-
case
|
|
2047
|
+
case R.TYPE_INT_COLOR_RGB4:
|
|
2028
2048
|
i.value = this.readHex24(), i.type = "rgb4";
|
|
2029
2049
|
break;
|
|
2030
|
-
case
|
|
2050
|
+
case R.TYPE_INT_COLOR_ARGB8:
|
|
2031
2051
|
i.value = this.readHex32(), i.type = "argb8";
|
|
2032
2052
|
break;
|
|
2033
|
-
case
|
|
2053
|
+
case R.TYPE_INT_COLOR_ARGB4:
|
|
2034
2054
|
i.value = this.readHex32(), i.type = "argb4";
|
|
2035
2055
|
break;
|
|
2036
|
-
case
|
|
2056
|
+
case R.TYPE_DIMENSION:
|
|
2037
2057
|
i.value = this.readDimension(), i.type = "dimension";
|
|
2038
2058
|
break;
|
|
2039
|
-
case
|
|
2059
|
+
case R.TYPE_FRACTION:
|
|
2040
2060
|
i.value = this.readFraction(), i.type = "fraction";
|
|
2041
2061
|
break;
|
|
2042
2062
|
default: {
|
|
2043
|
-
const
|
|
2044
|
-
console.debug(`Not sure what to do with typed value of type 0x${
|
|
2063
|
+
const T = c.toString(16);
|
|
2064
|
+
console.debug(`Not sure what to do with typed value of type 0x${T}, falling back to reading an uint32.`), i.value = this.readU32(), i.type = "unknown";
|
|
2045
2065
|
}
|
|
2046
2066
|
}
|
|
2047
|
-
const
|
|
2048
|
-
if (this.cursor !==
|
|
2049
|
-
const
|
|
2050
|
-
console.debug(`Cursor is off by ${
|
|
2067
|
+
const w = n + s;
|
|
2068
|
+
if (this.cursor !== w) {
|
|
2069
|
+
const d = c.toString(16), E = w - this.cursor;
|
|
2070
|
+
console.debug(`Cursor is off by ${E} bytes at ${this.cursor} at supposed end of typed value of type 0x${d}. 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
2071
|
}
|
|
2052
2072
|
return this.debug && console.groupEnd(), i;
|
|
2053
2073
|
}
|
|
@@ -2059,21 +2079,21 @@ class It {
|
|
|
2059
2079
|
// Use TextDecoder for browser compatibility
|
|
2060
2080
|
readString(i) {
|
|
2061
2081
|
this.debug && console.group("readString", i);
|
|
2062
|
-
let n,
|
|
2082
|
+
let n, s;
|
|
2063
2083
|
switch (i) {
|
|
2064
2084
|
case "utf-8":
|
|
2065
|
-
|
|
2085
|
+
s = this.readLength8(), this.debug && console.debug("stringLength:", s), n = this.readLength8(), this.debug && console.debug("byteLength:", n);
|
|
2066
2086
|
break;
|
|
2067
2087
|
// Continue below to decode using TextDecoder
|
|
2068
2088
|
case "ucs2":
|
|
2069
|
-
|
|
2089
|
+
s = this.readLength16(), this.debug && console.debug("stringLength:", s), n = s * 2, this.debug && console.debug("byteLength:", n);
|
|
2070
2090
|
break;
|
|
2071
2091
|
// Continue below to decode using TextDecoder
|
|
2072
2092
|
default:
|
|
2073
2093
|
throw new Error(`Unsupported encoding '${i}'`);
|
|
2074
2094
|
}
|
|
2075
|
-
const c = new TextDecoder(i === "ucs2" ? "utf-16le" : i),
|
|
2076
|
-
return this.cursor += n, this.debug && (console.debug("value:",
|
|
2095
|
+
const c = new TextDecoder(i === "ucs2" ? "utf-16le" : i), w = new Uint8Array(this.view.buffer, this.cursor, n), d = c.decode(w);
|
|
2096
|
+
return this.cursor += n, this.debug && (console.debug("value:", d), console.groupEnd()), d;
|
|
2077
2097
|
}
|
|
2078
2098
|
readChunkHeader() {
|
|
2079
2099
|
this.debug && console.group("readChunkHeader");
|
|
@@ -2086,24 +2106,24 @@ class It {
|
|
|
2086
2106
|
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
2107
|
}
|
|
2088
2108
|
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 !==
|
|
2109
|
+
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
2110
|
throw new Error("Invalid string pool header");
|
|
2091
2111
|
const n = [];
|
|
2092
|
-
for (let
|
|
2093
|
-
this.debug && console.debug("offset:",
|
|
2094
|
-
const
|
|
2095
|
-
this.debug && console.debug("sorted:",
|
|
2096
|
-
const c = (i.flags &
|
|
2112
|
+
for (let d = 0, E = i.stringCount; d < E; ++d)
|
|
2113
|
+
this.debug && console.debug("offset:", d), n.push(this.readU32());
|
|
2114
|
+
const s = (i.flags & G.SORTED) === G.SORTED;
|
|
2115
|
+
this.debug && console.debug("sorted:", s);
|
|
2116
|
+
const c = (i.flags & G.UTF8) === G.UTF8 ? "utf-8" : "ucs2";
|
|
2097
2117
|
this.debug && console.debug("encoding:", c);
|
|
2098
|
-
const
|
|
2099
|
-
for (let
|
|
2100
|
-
this.debug && (console.debug("string:",
|
|
2118
|
+
const w = i.startOffset + (i.stringsStart || 0);
|
|
2119
|
+
for (let d = 0, E = i.stringCount; d < E; ++d)
|
|
2120
|
+
this.debug && (console.debug("string:", d), console.debug("offset:", n[d])), this.cursor = w + n[d], this.strings.push(this.readString(c));
|
|
2101
2121
|
return this.cursor = i.startOffset + i.chunkSize, this.debug && console.groupEnd(), null;
|
|
2102
2122
|
}
|
|
2103
2123
|
readResourceMap(i) {
|
|
2104
2124
|
this.debug && console.group("readResourceMap");
|
|
2105
2125
|
const n = Math.floor((i.chunkSize - i.headerSize) / 4);
|
|
2106
|
-
for (let
|
|
2126
|
+
for (let s = 0; s < n; ++s)
|
|
2107
2127
|
this.resources.push(this.readU32());
|
|
2108
2128
|
return this.debug && console.groupEnd(), null;
|
|
2109
2129
|
}
|
|
@@ -2117,32 +2137,32 @@ class It {
|
|
|
2117
2137
|
this.debug && console.group("readXmlElementStart", i);
|
|
2118
2138
|
const n = {
|
|
2119
2139
|
namespaceURI: null,
|
|
2120
|
-
nodeType:
|
|
2140
|
+
nodeType: V.ELEMENT_NODE,
|
|
2121
2141
|
nodeName: null,
|
|
2122
2142
|
attributes: [],
|
|
2123
2143
|
childNodes: []
|
|
2124
2144
|
};
|
|
2125
2145
|
this.readU32(), this.readU32();
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2128
|
-
const
|
|
2146
|
+
const s = this.readS32(), c = this.readS32();
|
|
2147
|
+
s >= 0 && (n.namespaceURI = this.strings[s]), c >= 0 && (n.nodeName = this.strings[c]), this.readU16(), this.readU16();
|
|
2148
|
+
const w = this.readU16();
|
|
2129
2149
|
this.readU16(), this.readU16(), this.readU16();
|
|
2130
|
-
for (let
|
|
2150
|
+
for (let d = 0; d < w; ++d)
|
|
2131
2151
|
n.attributes.push(this.readXmlAttribute());
|
|
2132
|
-
return this.document ? (this.parent && this.parent.nodeType ===
|
|
2152
|
+
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
2153
|
}
|
|
2134
2154
|
readXmlAttribute() {
|
|
2135
2155
|
this.debug && console.group("readXmlAttribute");
|
|
2136
2156
|
const i = {
|
|
2137
2157
|
namespaceURI: null,
|
|
2138
|
-
nodeType:
|
|
2158
|
+
nodeType: V.ATTRIBUTE_NODE,
|
|
2139
2159
|
nodeName: null,
|
|
2140
2160
|
name: null,
|
|
2141
2161
|
value: null,
|
|
2142
2162
|
typedValue: {}
|
|
2143
2163
|
// Will be overwritten
|
|
2144
|
-
}, n = this.readS32(),
|
|
2145
|
-
return n >= 0 && (i.namespaceURI = this.strings[n]),
|
|
2164
|
+
}, n = this.readS32(), s = this.readS32(), c = this.readS32();
|
|
2165
|
+
return n >= 0 && (i.namespaceURI = this.strings[n]), s >= 0 && (i.nodeName = i.name = this.strings[s]), c >= 0 && (i.name === "versionName" && this.strings[c] && (this.strings[c] = this.strings[c].replace(/[^\d\w-.]/g, "")), i.value = this.strings[c]), i.typedValue = this.readTypedValue(), this.debug && console.groupEnd(), i;
|
|
2146
2166
|
}
|
|
2147
2167
|
readXmlElementEnd(i) {
|
|
2148
2168
|
return this.debug && console.group("readXmlCData", i), this.readU32(), this.readU32(), this.readS32(), this.readS32(), this.stack.pop(), this.parent = this.stack[this.stack.length - 1] || null, this.debug && console.groupEnd(), null;
|
|
@@ -2151,15 +2171,15 @@ class It {
|
|
|
2151
2171
|
this.debug && console.group("readXmlCData", i);
|
|
2152
2172
|
const n = {
|
|
2153
2173
|
namespaceURI: null,
|
|
2154
|
-
nodeType:
|
|
2174
|
+
nodeType: V.CDATA_SECTION_NODE,
|
|
2155
2175
|
nodeName: "#cdata",
|
|
2156
2176
|
data: null,
|
|
2157
2177
|
typedValue: {}
|
|
2158
2178
|
// Will be overwritten
|
|
2159
2179
|
};
|
|
2160
2180
|
this.readU32(), this.readU32();
|
|
2161
|
-
const
|
|
2162
|
-
return
|
|
2181
|
+
const s = this.readS32();
|
|
2182
|
+
return s >= 0 && (n.data = this.strings[s]), n.typedValue = this.readTypedValue(), this.parent && this.parent.nodeType === V.ELEMENT_NODE && this.parent.childNodes.push(n), this.debug && console.groupEnd(), n;
|
|
2163
2183
|
}
|
|
2164
2184
|
readNull(i) {
|
|
2165
2185
|
return this.debug && console.group("readNull"), this.cursor += i.chunkSize - i.headerSize, this.debug && console.groupEnd(), null;
|
|
@@ -2169,51 +2189,51 @@ class It {
|
|
|
2169
2189
|
* @returns The root XML element of the parsed document.
|
|
2170
2190
|
*/
|
|
2171
2191
|
parse() {
|
|
2172
|
-
if (this.debug && console.group("BinaryXmlParser.parse"), this.readChunkHeader().chunkType !==
|
|
2192
|
+
if (this.debug && console.group("BinaryXmlParser.parse"), this.readChunkHeader().chunkType !== $.XML)
|
|
2173
2193
|
throw new Error("Invalid XML header");
|
|
2174
2194
|
for (; this.cursor < this.view.byteLength; ) {
|
|
2175
2195
|
this.debug && console.group("chunk");
|
|
2176
|
-
const n = this.cursor,
|
|
2177
|
-
switch (
|
|
2178
|
-
case
|
|
2179
|
-
this.readStringPool(
|
|
2196
|
+
const n = this.cursor, s = this.readChunkHeader();
|
|
2197
|
+
switch (s.chunkType) {
|
|
2198
|
+
case $.STRING_POOL:
|
|
2199
|
+
this.readStringPool(s);
|
|
2180
2200
|
break;
|
|
2181
|
-
case
|
|
2182
|
-
this.readResourceMap(
|
|
2201
|
+
case $.XML_RESOURCE_MAP:
|
|
2202
|
+
this.readResourceMap(s);
|
|
2183
2203
|
break;
|
|
2184
|
-
case
|
|
2185
|
-
this.readXmlNamespaceStart(
|
|
2204
|
+
case $.XML_START_NAMESPACE:
|
|
2205
|
+
this.readXmlNamespaceStart(s);
|
|
2186
2206
|
break;
|
|
2187
|
-
case
|
|
2188
|
-
this.readXmlNamespaceEnd(
|
|
2207
|
+
case $.XML_END_NAMESPACE:
|
|
2208
|
+
this.readXmlNamespaceEnd(s);
|
|
2189
2209
|
break;
|
|
2190
|
-
case
|
|
2191
|
-
this.readXmlElementStart(
|
|
2210
|
+
case $.XML_START_ELEMENT:
|
|
2211
|
+
this.readXmlElementStart(s);
|
|
2192
2212
|
break;
|
|
2193
|
-
case
|
|
2194
|
-
this.readXmlElementEnd(
|
|
2213
|
+
case $.XML_END_ELEMENT:
|
|
2214
|
+
this.readXmlElementEnd(s);
|
|
2195
2215
|
break;
|
|
2196
|
-
case
|
|
2197
|
-
this.readXmlCData(
|
|
2216
|
+
case $.XML_CDATA:
|
|
2217
|
+
this.readXmlCData(s);
|
|
2198
2218
|
break;
|
|
2199
|
-
case
|
|
2200
|
-
this.readNull(
|
|
2219
|
+
case $.NULL:
|
|
2220
|
+
this.readNull(s);
|
|
2201
2221
|
break;
|
|
2202
2222
|
default:
|
|
2203
|
-
throw new Error(`Unsupported chunk type '0x${
|
|
2223
|
+
throw new Error(`Unsupported chunk type '0x${s.chunkType.toString(16)}'`);
|
|
2204
2224
|
}
|
|
2205
|
-
const c = n +
|
|
2225
|
+
const c = n + s.chunkSize;
|
|
2206
2226
|
if (this.cursor !== c) {
|
|
2207
|
-
const
|
|
2208
|
-
console.debug(`Cursor is off by ${
|
|
2227
|
+
const w = c - this.cursor, d = s.chunkType.toString(16);
|
|
2228
|
+
console.debug(`Cursor is off by ${w} bytes at ${this.cursor} at supposed end of chunk of type 0x${d}. The chunk started at offset ${n} and is supposed to end at offset ${c}. Ignoring the rest of the chunk.`), this.cursor = c;
|
|
2209
2229
|
}
|
|
2210
2230
|
this.debug && console.groupEnd();
|
|
2211
2231
|
}
|
|
2212
2232
|
return this.debug && console.groupEnd(), this.document;
|
|
2213
2233
|
}
|
|
2214
2234
|
}
|
|
2215
|
-
const
|
|
2216
|
-
class
|
|
2235
|
+
const Nt = "android.intent.action.MAIN", Lt = "android.intent.category.LAUNCHER";
|
|
2236
|
+
class _t {
|
|
2217
2237
|
buffer;
|
|
2218
2238
|
xmlParser;
|
|
2219
2239
|
/**
|
|
@@ -2221,7 +2241,7 @@ class St {
|
|
|
2221
2241
|
* @param options Configuration options for the underlying BinaryXmlParser.
|
|
2222
2242
|
*/
|
|
2223
2243
|
constructor(i, n = {}) {
|
|
2224
|
-
this.buffer = i, this.xmlParser = new
|
|
2244
|
+
this.buffer = i, this.xmlParser = new At(this.buffer, n);
|
|
2225
2245
|
}
|
|
2226
2246
|
/**
|
|
2227
2247
|
* Flattens the attributes of an XML element into a simple key/value object.
|
|
@@ -2231,38 +2251,38 @@ class St {
|
|
|
2231
2251
|
*/
|
|
2232
2252
|
collapseAttributes(i) {
|
|
2233
2253
|
const n = /* @__PURE__ */ Object.create(null);
|
|
2234
|
-
if (i.nodeType ===
|
|
2235
|
-
for (const
|
|
2236
|
-
n[
|
|
2254
|
+
if (i.nodeType === V.ELEMENT_NODE)
|
|
2255
|
+
for (const s of Array.from(i.attributes))
|
|
2256
|
+
n[s.name] = s.typedValue.value;
|
|
2237
2257
|
return n;
|
|
2238
2258
|
}
|
|
2239
2259
|
/**
|
|
2240
2260
|
* Parses child nodes of a component into intent filters and meta data.
|
|
2241
2261
|
*/
|
|
2242
2262
|
parseIntents(i, n) {
|
|
2243
|
-
n.intentFilters = [], n.metaData = [], i.childNodes.forEach((
|
|
2244
|
-
if (
|
|
2245
|
-
switch (
|
|
2263
|
+
n.intentFilters = [], n.metaData = [], i.childNodes.forEach((s) => {
|
|
2264
|
+
if (s.nodeType === V.ELEMENT_NODE)
|
|
2265
|
+
switch (s.nodeName) {
|
|
2246
2266
|
case "intent-filter": {
|
|
2247
|
-
const c = this.collapseAttributes(
|
|
2248
|
-
c.actions = [], c.categories = [], c.data = [],
|
|
2249
|
-
if (
|
|
2250
|
-
switch (
|
|
2267
|
+
const c = this.collapseAttributes(s);
|
|
2268
|
+
c.actions = [], c.categories = [], c.data = [], s.childNodes.forEach((w) => {
|
|
2269
|
+
if (w.nodeType === V.ELEMENT_NODE)
|
|
2270
|
+
switch (w.nodeName) {
|
|
2251
2271
|
case "action":
|
|
2252
|
-
c.actions.push(this.collapseAttributes(
|
|
2272
|
+
c.actions.push(this.collapseAttributes(w));
|
|
2253
2273
|
break;
|
|
2254
2274
|
case "category":
|
|
2255
|
-
c.categories.push(this.collapseAttributes(
|
|
2275
|
+
c.categories.push(this.collapseAttributes(w));
|
|
2256
2276
|
break;
|
|
2257
2277
|
case "data":
|
|
2258
|
-
c.data.push(this.collapseAttributes(
|
|
2278
|
+
c.data.push(this.collapseAttributes(w));
|
|
2259
2279
|
break;
|
|
2260
2280
|
}
|
|
2261
2281
|
}), n.intentFilters.push(c);
|
|
2262
2282
|
break;
|
|
2263
2283
|
}
|
|
2264
2284
|
case "meta-data":
|
|
2265
|
-
n.metaData.push(this.collapseAttributes(
|
|
2285
|
+
n.metaData.push(this.collapseAttributes(s));
|
|
2266
2286
|
break;
|
|
2267
2287
|
}
|
|
2268
2288
|
});
|
|
@@ -2274,52 +2294,52 @@ class St {
|
|
|
2274
2294
|
*/
|
|
2275
2295
|
parseApplication(i) {
|
|
2276
2296
|
const n = this.collapseAttributes(i);
|
|
2277
|
-
return n.activities = [], n.activityAliases = [], n.launcherActivities = [], n.services = [], n.receivers = [], n.providers = [], n.usesLibraries = [], n.metaData = [], i.childNodes.forEach((
|
|
2278
|
-
if (
|
|
2279
|
-
switch (
|
|
2297
|
+
return n.activities = [], n.activityAliases = [], n.launcherActivities = [], n.services = [], n.receivers = [], n.providers = [], n.usesLibraries = [], n.metaData = [], i.childNodes.forEach((s) => {
|
|
2298
|
+
if (s.nodeType === V.ELEMENT_NODE)
|
|
2299
|
+
switch (s.nodeName) {
|
|
2280
2300
|
case "activity": {
|
|
2281
|
-
const c = this.collapseAttributes(
|
|
2282
|
-
this.parseIntents(
|
|
2301
|
+
const c = this.collapseAttributes(s);
|
|
2302
|
+
this.parseIntents(s, c), n.activities.push(c), this.isLauncherActivity(c) && n.launcherActivities.push(c);
|
|
2283
2303
|
break;
|
|
2284
2304
|
}
|
|
2285
2305
|
case "activity-alias": {
|
|
2286
|
-
const c = this.collapseAttributes(
|
|
2287
|
-
this.parseIntents(
|
|
2306
|
+
const c = this.collapseAttributes(s);
|
|
2307
|
+
this.parseIntents(s, c), n.activityAliases.push(c), this.isLauncherActivity(c) && n.launcherActivities.push(c);
|
|
2288
2308
|
break;
|
|
2289
2309
|
}
|
|
2290
2310
|
case "service": {
|
|
2291
|
-
const c = this.collapseAttributes(
|
|
2292
|
-
this.parseIntents(
|
|
2311
|
+
const c = this.collapseAttributes(s);
|
|
2312
|
+
this.parseIntents(s, c), n.services.push(c);
|
|
2293
2313
|
break;
|
|
2294
2314
|
}
|
|
2295
2315
|
case "receiver": {
|
|
2296
|
-
const c = this.collapseAttributes(
|
|
2297
|
-
this.parseIntents(
|
|
2316
|
+
const c = this.collapseAttributes(s);
|
|
2317
|
+
this.parseIntents(s, c), n.receivers.push(c);
|
|
2298
2318
|
break;
|
|
2299
2319
|
}
|
|
2300
2320
|
case "provider": {
|
|
2301
|
-
const c = this.collapseAttributes(
|
|
2302
|
-
c.grantUriPermissions = [], c.metaData = [], c.pathPermissions = [],
|
|
2303
|
-
if (
|
|
2304
|
-
switch (
|
|
2321
|
+
const c = this.collapseAttributes(s);
|
|
2322
|
+
c.grantUriPermissions = [], c.metaData = [], c.pathPermissions = [], s.childNodes.forEach((w) => {
|
|
2323
|
+
if (w.nodeType === V.ELEMENT_NODE)
|
|
2324
|
+
switch (w.nodeName) {
|
|
2305
2325
|
case "grant-uri-permission":
|
|
2306
|
-
c.grantUriPermissions.push(this.collapseAttributes(
|
|
2326
|
+
c.grantUriPermissions.push(this.collapseAttributes(w));
|
|
2307
2327
|
break;
|
|
2308
2328
|
case "meta-data":
|
|
2309
|
-
c.metaData.push(this.collapseAttributes(
|
|
2329
|
+
c.metaData.push(this.collapseAttributes(w));
|
|
2310
2330
|
break;
|
|
2311
2331
|
case "path-permission":
|
|
2312
|
-
c.pathPermissions.push(this.collapseAttributes(
|
|
2332
|
+
c.pathPermissions.push(this.collapseAttributes(w));
|
|
2313
2333
|
break;
|
|
2314
2334
|
}
|
|
2315
2335
|
}), n.providers.push(c);
|
|
2316
2336
|
break;
|
|
2317
2337
|
}
|
|
2318
2338
|
case "uses-library":
|
|
2319
|
-
n.usesLibraries.push(this.collapseAttributes(
|
|
2339
|
+
n.usesLibraries.push(this.collapseAttributes(s));
|
|
2320
2340
|
break;
|
|
2321
2341
|
case "meta-data":
|
|
2322
|
-
n.metaData.push(this.collapseAttributes(
|
|
2342
|
+
n.metaData.push(this.collapseAttributes(s));
|
|
2323
2343
|
break;
|
|
2324
2344
|
}
|
|
2325
2345
|
}), n;
|
|
@@ -2331,7 +2351,7 @@ class St {
|
|
|
2331
2351
|
*/
|
|
2332
2352
|
isLauncherActivity(i) {
|
|
2333
2353
|
return i.intentFilters.some(function(n) {
|
|
2334
|
-
return n.actions.some((c) => c.name ===
|
|
2354
|
+
return n.actions.some((c) => c.name === Nt) ? n.categories.some((c) => c.name === Lt) : !1;
|
|
2335
2355
|
});
|
|
2336
2356
|
}
|
|
2337
2357
|
/**
|
|
@@ -2340,89 +2360,101 @@ class St {
|
|
|
2340
2360
|
*/
|
|
2341
2361
|
parse() {
|
|
2342
2362
|
const i = this.xmlParser.parse(), n = this.collapseAttributes(i);
|
|
2343
|
-
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((
|
|
2344
|
-
if (
|
|
2345
|
-
switch (
|
|
2363
|
+
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((s) => {
|
|
2364
|
+
if (s.nodeType === V.ELEMENT_NODE)
|
|
2365
|
+
switch (s.nodeName) {
|
|
2346
2366
|
case "uses-permission":
|
|
2347
|
-
n.usesPermissions.push(this.collapseAttributes(
|
|
2367
|
+
n.usesPermissions.push(this.collapseAttributes(s));
|
|
2348
2368
|
break;
|
|
2349
2369
|
case "uses-permission-sdk-23":
|
|
2350
|
-
n.usesPermissionsSDK23.push(this.collapseAttributes(
|
|
2370
|
+
n.usesPermissionsSDK23.push(this.collapseAttributes(s));
|
|
2351
2371
|
break;
|
|
2352
2372
|
case "permission":
|
|
2353
|
-
n.permissions.push(this.collapseAttributes(
|
|
2373
|
+
n.permissions.push(this.collapseAttributes(s));
|
|
2354
2374
|
break;
|
|
2355
2375
|
case "permission-tree":
|
|
2356
|
-
n.permissionTrees.push(this.collapseAttributes(
|
|
2376
|
+
n.permissionTrees.push(this.collapseAttributes(s));
|
|
2357
2377
|
break;
|
|
2358
2378
|
case "permission-group":
|
|
2359
|
-
n.permissionGroups.push(this.collapseAttributes(
|
|
2379
|
+
n.permissionGroups.push(this.collapseAttributes(s));
|
|
2360
2380
|
break;
|
|
2361
2381
|
case "instrumentation":
|
|
2362
|
-
n.instrumentation = this.collapseAttributes(
|
|
2382
|
+
n.instrumentation = this.collapseAttributes(s);
|
|
2363
2383
|
break;
|
|
2364
2384
|
case "uses-sdk":
|
|
2365
|
-
n.usesSdk = this.collapseAttributes(
|
|
2385
|
+
n.usesSdk = this.collapseAttributes(s);
|
|
2366
2386
|
break;
|
|
2367
2387
|
case "uses-configuration":
|
|
2368
|
-
n.usesConfiguration = this.collapseAttributes(
|
|
2388
|
+
n.usesConfiguration = this.collapseAttributes(s);
|
|
2369
2389
|
break;
|
|
2370
2390
|
case "uses-feature":
|
|
2371
|
-
n.usesFeatures.push(this.collapseAttributes(
|
|
2391
|
+
n.usesFeatures.push(this.collapseAttributes(s));
|
|
2372
2392
|
break;
|
|
2373
2393
|
case "supports-screens":
|
|
2374
|
-
n.supportsScreens = this.collapseAttributes(
|
|
2394
|
+
n.supportsScreens = this.collapseAttributes(s);
|
|
2375
2395
|
break;
|
|
2376
2396
|
case "compatible-screens":
|
|
2377
|
-
|
|
2378
|
-
if (c.nodeType ===
|
|
2397
|
+
s.childNodes.forEach((c) => {
|
|
2398
|
+
if (c.nodeType === V.ELEMENT_NODE)
|
|
2379
2399
|
return n.compatibleScreens.push(this.collapseAttributes(c));
|
|
2380
2400
|
});
|
|
2381
2401
|
break;
|
|
2382
2402
|
case "supports-gl-texture":
|
|
2383
|
-
n.supportsGlTextures.push(this.collapseAttributes(
|
|
2403
|
+
n.supportsGlTextures.push(this.collapseAttributes(s));
|
|
2384
2404
|
break;
|
|
2385
2405
|
case "application":
|
|
2386
|
-
n.application = this.parseApplication(
|
|
2406
|
+
n.application = this.parseApplication(s);
|
|
2387
2407
|
break;
|
|
2388
2408
|
}
|
|
2389
2409
|
}), n;
|
|
2390
2410
|
}
|
|
2391
2411
|
}
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2412
|
+
const kt = rt.loadAsync;
|
|
2413
|
+
class Wt {
|
|
2414
|
+
zip;
|
|
2415
|
+
constructor(i) {
|
|
2416
|
+
this.zip = kt(i).catch(P);
|
|
2417
|
+
}
|
|
2418
|
+
async parse(i) {
|
|
2419
|
+
const n = await this.zip;
|
|
2420
|
+
if (n instanceof Error)
|
|
2421
|
+
return new Error(`load file error: ${n.message}`);
|
|
2422
|
+
const s = n.file("AndroidManifest.xml"), c = i?.ignoreIcon ? null : n.file("resources.arsc"), [w, d] = await Promise.all([
|
|
2423
|
+
s?.async("arraybuffer").catch(P),
|
|
2424
|
+
c?.async("arraybuffer").catch(P)
|
|
2425
|
+
]);
|
|
2426
|
+
if (!w || w instanceof Error)
|
|
2427
|
+
return new Error("not found AndroidManifest.xml");
|
|
2428
|
+
const E = Ct(w);
|
|
2429
|
+
if (E instanceof Error)
|
|
2430
|
+
return new Error(`parse AndroidManifest.xml error: ${E.message}`);
|
|
2431
|
+
const T = {
|
|
2432
|
+
package: E.package,
|
|
2433
|
+
versionCode: E.versionCode,
|
|
2434
|
+
versionName: E.versionName,
|
|
2435
|
+
manifest: E
|
|
2436
|
+
}, U = E.application?.icon;
|
|
2437
|
+
if (!d || d instanceof Error || !U || typeof U != "string")
|
|
2438
|
+
return T;
|
|
2439
|
+
const I = Rt(d, U);
|
|
2440
|
+
if (!I)
|
|
2441
|
+
return T;
|
|
2442
|
+
const v = n.file(I);
|
|
2443
|
+
if (!v)
|
|
2444
|
+
return T;
|
|
2445
|
+
const t = await v.async("base64").catch(P);
|
|
2446
|
+
return t instanceof Error || (T.icon = it(t)), T;
|
|
2447
|
+
}
|
|
2448
|
+
/**
|
|
2449
|
+
* 读取指定文件的内容
|
|
2450
|
+
*/
|
|
2451
|
+
async readFile(i, n) {
|
|
2452
|
+
const s = await this.zip;
|
|
2453
|
+
return s instanceof Error ? new Error(`load file error: ${s.message}`) : await nt(s, i, n);
|
|
2454
|
+
}
|
|
2423
2455
|
}
|
|
2424
|
-
function
|
|
2425
|
-
const i = new
|
|
2456
|
+
function Ct(f) {
|
|
2457
|
+
const i = new _t(f, {
|
|
2426
2458
|
ignore: [
|
|
2427
2459
|
"application.activity",
|
|
2428
2460
|
"application.service",
|
|
@@ -2434,80 +2466,120 @@ function Nt(g) {
|
|
|
2434
2466
|
try {
|
|
2435
2467
|
return i.parse();
|
|
2436
2468
|
} catch (n) {
|
|
2437
|
-
return
|
|
2469
|
+
return P(n);
|
|
2438
2470
|
}
|
|
2439
2471
|
}
|
|
2440
|
-
function
|
|
2472
|
+
function Rt(f, i) {
|
|
2441
2473
|
try {
|
|
2442
|
-
const n = new H().processResourceTable(
|
|
2443
|
-
return n[
|
|
2474
|
+
const n = new H().processResourceTable(f), s = i.replace(/^resourceId:0x/, "@").toUpperCase();
|
|
2475
|
+
return n[s]?.[0] || "";
|
|
2444
2476
|
} catch {
|
|
2445
2477
|
return "";
|
|
2446
2478
|
}
|
|
2447
2479
|
}
|
|
2448
|
-
typeof globalThis < "u"
|
|
2449
|
-
function
|
|
2450
|
-
|
|
2451
|
-
const n = Object.getPrototypeOf(g);
|
|
2452
|
-
return n !== Object.prototype && n !== null ? !1 : i.every((a) => a in g);
|
|
2480
|
+
const Z = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")();
|
|
2481
|
+
function Ot(f) {
|
|
2482
|
+
return typeof f == "function";
|
|
2453
2483
|
}
|
|
2454
|
-
|
|
2484
|
+
function lt(f) {
|
|
2485
|
+
return typeof f == "object" && f !== null;
|
|
2486
|
+
}
|
|
2487
|
+
function Pt() {
|
|
2488
|
+
return "wx" in Z && lt(Z.wx) && "getSystemInfo" in Z.wx && Ot(Z.wx.getSystemInfo);
|
|
2489
|
+
}
|
|
2490
|
+
function Bt() {
|
|
2491
|
+
return "window" in Z && lt(Z.window) && !Pt();
|
|
2492
|
+
}
|
|
2493
|
+
function W(f, ...i) {
|
|
2494
|
+
if (!f || typeof f != "object") return !1;
|
|
2495
|
+
const n = Object.getPrototypeOf(f);
|
|
2496
|
+
return n !== Object.prototype && n !== null ? !1 : i.every((s) => s in f);
|
|
2497
|
+
}
|
|
2498
|
+
function Mt(f) {
|
|
2499
|
+
const i = new DataView(f);
|
|
2500
|
+
if (f.byteLength < 8)
|
|
2501
|
+
return f;
|
|
2502
|
+
const n = new Uint8Array(f, 0, 8), s = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
2503
|
+
for (let r = 0; r < 8; r++)
|
|
2504
|
+
if (n[r] !== s[r])
|
|
2505
|
+
return f;
|
|
2506
|
+
if (f.byteLength < 20)
|
|
2507
|
+
return f;
|
|
2508
|
+
const c = 8, w = i.getUint32(c, !1), d = new Uint8Array(f, c + 4, 4);
|
|
2509
|
+
if (String.fromCharCode(d[0], d[1], d[2], d[3]) !== "CgBI")
|
|
2510
|
+
return f;
|
|
2511
|
+
const T = c + 12 + w;
|
|
2512
|
+
if (f.byteLength < T)
|
|
2513
|
+
return f;
|
|
2514
|
+
const U = f.byteLength - (12 + w), I = new ArrayBuffer(U), v = new Uint8Array(I), t = new Uint8Array(f, 0, c);
|
|
2515
|
+
v.set(t, 0);
|
|
2516
|
+
const e = new Uint8Array(f, T);
|
|
2517
|
+
return v.set(e, c), I;
|
|
2518
|
+
}
|
|
2519
|
+
function Dt(f) {
|
|
2520
|
+
const i = new Uint8Array(f);
|
|
2521
|
+
let n = "";
|
|
2522
|
+
for (let s = 0; s < i.byteLength; s++)
|
|
2523
|
+
n += String.fromCharCode(i[s]);
|
|
2524
|
+
return Bt() ? btoa(n) : Buffer.from(n, "binary").toString("base64");
|
|
2525
|
+
}
|
|
2526
|
+
class zt {
|
|
2455
2527
|
constructor(i) {
|
|
2456
2528
|
this.UID = i;
|
|
2457
2529
|
}
|
|
2458
2530
|
}
|
|
2459
|
-
const
|
|
2460
|
-
function et(
|
|
2461
|
-
return new DataView(
|
|
2531
|
+
const Xt = 9783072e5, X = 100 * 1e3 * 1e3, Vt = 32768;
|
|
2532
|
+
function et(f, i, n) {
|
|
2533
|
+
return new DataView(f, i, n);
|
|
2462
2534
|
}
|
|
2463
|
-
function
|
|
2535
|
+
function j(f, i = 0) {
|
|
2464
2536
|
let n = 0;
|
|
2465
|
-
for (let
|
|
2466
|
-
n <<= 8, n |=
|
|
2537
|
+
for (let s = i; s < f.length; s++)
|
|
2538
|
+
n <<= 8, n |= f[s] & 255;
|
|
2467
2539
|
return n;
|
|
2468
2540
|
}
|
|
2469
|
-
function tt(
|
|
2470
|
-
return et(
|
|
2541
|
+
function tt(f, i) {
|
|
2542
|
+
return et(f, i, 8).getUint32(4, !1);
|
|
2471
2543
|
}
|
|
2472
|
-
function
|
|
2473
|
-
const i =
|
|
2544
|
+
function $t(f) {
|
|
2545
|
+
const i = f.length;
|
|
2474
2546
|
for (let n = 0; n < i; n += 2) {
|
|
2475
|
-
const
|
|
2476
|
-
|
|
2547
|
+
const s = f[n];
|
|
2548
|
+
f[n] = f[n + 1], f[n + 1] = s;
|
|
2477
2549
|
}
|
|
2478
|
-
return
|
|
2550
|
+
return f;
|
|
2479
2551
|
}
|
|
2480
|
-
function
|
|
2552
|
+
function Yt(f) {
|
|
2481
2553
|
let i = "", n;
|
|
2482
|
-
for (n = 0; n <
|
|
2554
|
+
for (n = 0; n < f.length && f[n] === 0; n++)
|
|
2483
2555
|
;
|
|
2484
|
-
for (; n <
|
|
2485
|
-
const
|
|
2486
|
-
i +=
|
|
2556
|
+
for (; n < f.length; n++) {
|
|
2557
|
+
const s = "00" + f[n].toString(16);
|
|
2558
|
+
i += s.substring(s.length - 2);
|
|
2487
2559
|
}
|
|
2488
2560
|
return i;
|
|
2489
2561
|
}
|
|
2490
|
-
function
|
|
2562
|
+
function ht(f) {
|
|
2491
2563
|
try {
|
|
2492
|
-
return
|
|
2564
|
+
return jt(f);
|
|
2493
2565
|
} catch (i) {
|
|
2494
|
-
return
|
|
2566
|
+
return P(i);
|
|
2495
2567
|
}
|
|
2496
2568
|
}
|
|
2497
|
-
function
|
|
2498
|
-
const i = new Uint8Array(
|
|
2569
|
+
function jt(f) {
|
|
2570
|
+
const i = new Uint8Array(f), n = i.slice(0, 6);
|
|
2499
2571
|
if (new TextDecoder("utf8").decode(n) !== "bplist")
|
|
2500
2572
|
throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
|
|
2501
|
-
const c =
|
|
2502
|
-
if (
|
|
2573
|
+
const c = f.byteLength - 32, w = new DataView(f, c, 32), d = w.getUint8(6), E = w.getUint8(7), T = tt(f, c + 8), U = tt(f, c + 16), I = tt(f, c + 24);
|
|
2574
|
+
if (T > Vt)
|
|
2503
2575
|
throw new Error("maxObjectCount exceeded");
|
|
2504
|
-
const
|
|
2505
|
-
for (let e = 0; e <
|
|
2506
|
-
const r = i.slice(
|
|
2507
|
-
|
|
2576
|
+
const v = [];
|
|
2577
|
+
for (let e = 0; e < T; e++) {
|
|
2578
|
+
const r = i.slice(I + e * d, I + (e + 1) * d);
|
|
2579
|
+
v[e] = j(r, 0);
|
|
2508
2580
|
}
|
|
2509
2581
|
function t(e) {
|
|
2510
|
-
const r =
|
|
2582
|
+
const r = v[e], a = i[r], o = (a & 240) >> 4, u = a & 15;
|
|
2511
2583
|
switch (o) {
|
|
2512
2584
|
case 0:
|
|
2513
2585
|
return l();
|
|
@@ -2518,17 +2590,17 @@ function Ot(g) {
|
|
|
2518
2590
|
case 2:
|
|
2519
2591
|
return S();
|
|
2520
2592
|
case 3:
|
|
2521
|
-
return
|
|
2593
|
+
return N();
|
|
2522
2594
|
case 4:
|
|
2523
|
-
return
|
|
2595
|
+
return _();
|
|
2524
2596
|
case 5:
|
|
2525
|
-
return
|
|
2597
|
+
return L(!1);
|
|
2526
2598
|
case 6:
|
|
2527
|
-
return
|
|
2599
|
+
return L(!0);
|
|
2528
2600
|
case 10:
|
|
2529
|
-
return
|
|
2601
|
+
return y();
|
|
2530
2602
|
case 13:
|
|
2531
|
-
return
|
|
2603
|
+
return g();
|
|
2532
2604
|
default:
|
|
2533
2605
|
throw new Error("Unhandled type 0x" + o.toString(16));
|
|
2534
2606
|
}
|
|
@@ -2548,178 +2620,209 @@ function Ot(g) {
|
|
|
2548
2620
|
}
|
|
2549
2621
|
function p() {
|
|
2550
2622
|
const h = Math.pow(2, u);
|
|
2551
|
-
if (h <
|
|
2623
|
+
if (h < X) {
|
|
2552
2624
|
const b = i.slice(r + 1, r + 1 + h);
|
|
2553
2625
|
if (h === 16) {
|
|
2554
|
-
const
|
|
2555
|
-
return BigInt("0x" +
|
|
2626
|
+
const m = Yt(b);
|
|
2627
|
+
return BigInt("0x" + m);
|
|
2556
2628
|
}
|
|
2557
|
-
return b.reduce((
|
|
2629
|
+
return b.reduce((m, x) => (m <<= 8, m |= x & 255, m), 0);
|
|
2558
2630
|
}
|
|
2559
2631
|
throw new Error(
|
|
2560
|
-
"Too little heap space available! Wanted to read " + h + " bytes, but only " +
|
|
2632
|
+
"Too little heap space available! Wanted to read " + h + " bytes, but only " + X + " are available."
|
|
2561
2633
|
);
|
|
2562
2634
|
}
|
|
2563
2635
|
function F() {
|
|
2564
2636
|
const h = u + 1;
|
|
2565
|
-
if (h <
|
|
2566
|
-
return new
|
|
2637
|
+
if (h < X)
|
|
2638
|
+
return new zt(j(i.slice(r + 1, r + 1 + h)));
|
|
2567
2639
|
throw new Error(
|
|
2568
|
-
"Too little heap space available! Wanted to read " + h + " bytes, but only " +
|
|
2640
|
+
"Too little heap space available! Wanted to read " + h + " bytes, but only " + X + " are available."
|
|
2569
2641
|
);
|
|
2570
2642
|
}
|
|
2571
2643
|
function S() {
|
|
2572
2644
|
const h = Math.pow(2, u);
|
|
2573
|
-
if (h <
|
|
2574
|
-
const b = et(
|
|
2645
|
+
if (h < X) {
|
|
2646
|
+
const b = et(f, r + 1, h);
|
|
2575
2647
|
if (h === 4)
|
|
2576
2648
|
return b.getFloat32(0, !1);
|
|
2577
2649
|
if (h === 8)
|
|
2578
2650
|
return b.getFloat64(0, !1);
|
|
2579
2651
|
} else
|
|
2580
2652
|
throw new Error(
|
|
2581
|
-
"Too little heap space available! Wanted to read " + h + " bytes, but only " +
|
|
2653
|
+
"Too little heap space available! Wanted to read " + h + " bytes, but only " + X + " are available."
|
|
2582
2654
|
);
|
|
2583
2655
|
return 0;
|
|
2584
2656
|
}
|
|
2585
|
-
function
|
|
2586
|
-
const b = et(
|
|
2587
|
-
return new Date(
|
|
2657
|
+
function N() {
|
|
2658
|
+
const b = et(f, r + 1, 8).getFloat64(0, !1);
|
|
2659
|
+
return new Date(Xt + 1e3 * b);
|
|
2588
2660
|
}
|
|
2589
|
-
function
|
|
2661
|
+
function _() {
|
|
2590
2662
|
let h = 1, b = u;
|
|
2591
2663
|
if (u === 15) {
|
|
2592
|
-
const x = i[r + 1] & 15,
|
|
2593
|
-
h = 2 +
|
|
2664
|
+
const x = i[r + 1] & 15, A = Math.pow(2, x);
|
|
2665
|
+
h = 2 + A, b = j(i.slice(r + 2, r + 2 + A));
|
|
2594
2666
|
}
|
|
2595
|
-
if (b <
|
|
2667
|
+
if (b < X)
|
|
2596
2668
|
return i.slice(r + h, r + h + b);
|
|
2597
2669
|
throw new Error(
|
|
2598
|
-
"Too little heap space available! Wanted to read " + b + " bytes, but only " +
|
|
2670
|
+
"Too little heap space available! Wanted to read " + b + " bytes, but only " + X + " are available."
|
|
2599
2671
|
);
|
|
2600
2672
|
}
|
|
2601
|
-
function
|
|
2602
|
-
let b = "utf8",
|
|
2673
|
+
function L(h) {
|
|
2674
|
+
let b = "utf8", m = u, x = 1;
|
|
2603
2675
|
if (u === 15) {
|
|
2604
2676
|
const k = i[r + 1] & 15, O = Math.pow(2, k);
|
|
2605
|
-
x = 2 + O,
|
|
2677
|
+
x = 2 + O, m = j(i.slice(r + 2, r + 2 + O));
|
|
2606
2678
|
}
|
|
2607
|
-
if (
|
|
2608
|
-
let
|
|
2679
|
+
if (m *= h ? 2 : 1, m < X) {
|
|
2680
|
+
let A = i.slice(r + x, r + x + m);
|
|
2609
2681
|
if (h) {
|
|
2610
|
-
const k = new Uint8Array(
|
|
2611
|
-
|
|
2682
|
+
const k = new Uint8Array(A);
|
|
2683
|
+
A = $t(k), b = "utf-16le";
|
|
2612
2684
|
} else
|
|
2613
2685
|
b = "utf8";
|
|
2614
|
-
return new TextDecoder(b).decode(
|
|
2686
|
+
return new TextDecoder(b).decode(A);
|
|
2615
2687
|
}
|
|
2616
2688
|
throw new Error(
|
|
2617
|
-
"Too little heap space available! Wanted to read " +
|
|
2689
|
+
"Too little heap space available! Wanted to read " + m + " bytes, but only " + X + " are available."
|
|
2618
2690
|
);
|
|
2619
2691
|
}
|
|
2620
|
-
function
|
|
2692
|
+
function y() {
|
|
2621
2693
|
let h = u, b = 1;
|
|
2622
2694
|
if (u === 15) {
|
|
2623
|
-
const
|
|
2624
|
-
b = 2 + k, h =
|
|
2695
|
+
const A = i[r + 1] & 15, k = Math.pow(2, A);
|
|
2696
|
+
b = 2 + k, h = j(i.slice(r + 2, r + 2 + k));
|
|
2625
2697
|
}
|
|
2626
|
-
if (h *
|
|
2698
|
+
if (h * E > X)
|
|
2627
2699
|
throw new Error("Too little heap space available!");
|
|
2628
|
-
const
|
|
2700
|
+
const m = [];
|
|
2629
2701
|
for (let x = 0; x < h; x++) {
|
|
2630
|
-
const
|
|
2631
|
-
i.slice(r + b + x *
|
|
2702
|
+
const A = j(
|
|
2703
|
+
i.slice(r + b + x * E, r + b + (x + 1) * E)
|
|
2632
2704
|
);
|
|
2633
|
-
|
|
2705
|
+
m[x] = t(A);
|
|
2634
2706
|
}
|
|
2635
|
-
return
|
|
2707
|
+
return m;
|
|
2636
2708
|
}
|
|
2637
|
-
function
|
|
2709
|
+
function g() {
|
|
2638
2710
|
let h = u, b = 1;
|
|
2639
2711
|
if (u === 15) {
|
|
2640
|
-
const
|
|
2641
|
-
b = 2 + k, h =
|
|
2712
|
+
const A = i[r + 1] & 15, k = Math.pow(2, A);
|
|
2713
|
+
b = 2 + k, h = j(i.slice(r + 2, r + 2 + k));
|
|
2642
2714
|
}
|
|
2643
|
-
if (h * 2 *
|
|
2715
|
+
if (h * 2 * E > X)
|
|
2644
2716
|
throw new Error("Too little heap space available!");
|
|
2645
|
-
const
|
|
2717
|
+
const m = {};
|
|
2646
2718
|
for (let x = 0; x < h; x++) {
|
|
2647
|
-
const
|
|
2648
|
-
i.slice(r + b + x *
|
|
2649
|
-
), k =
|
|
2719
|
+
const A = j(
|
|
2720
|
+
i.slice(r + b + x * E, r + b + (x + 1) * E)
|
|
2721
|
+
), k = j(
|
|
2650
2722
|
i.slice(
|
|
2651
|
-
r + b + h *
|
|
2652
|
-
r + b + h *
|
|
2723
|
+
r + b + h * E + x * E,
|
|
2724
|
+
r + b + h * E + (x + 1) * E
|
|
2653
2725
|
)
|
|
2654
|
-
), O = t(
|
|
2655
|
-
|
|
2726
|
+
), O = t(A), C = t(k);
|
|
2727
|
+
m[String(O)] = C;
|
|
2656
2728
|
}
|
|
2657
|
-
return
|
|
2729
|
+
return m;
|
|
2658
2730
|
}
|
|
2659
2731
|
}
|
|
2660
|
-
return t(
|
|
2732
|
+
return t(U);
|
|
2661
2733
|
}
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
)
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
w
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
return
|
|
2734
|
+
const qt = rt.loadAsync;
|
|
2735
|
+
class Kt {
|
|
2736
|
+
zip;
|
|
2737
|
+
constructor(i) {
|
|
2738
|
+
this.zip = qt(i).catch(P);
|
|
2739
|
+
}
|
|
2740
|
+
/**
|
|
2741
|
+
* 解析应用 plist 信息
|
|
2742
|
+
*/
|
|
2743
|
+
async parse(i) {
|
|
2744
|
+
const n = await this.zip;
|
|
2745
|
+
if (n instanceof Error)
|
|
2746
|
+
return new Error(`load IPA error: ${n.message}`);
|
|
2747
|
+
const s = n.filter((t) => /payload\/[^/]+?.app\/info.plist$/i.test(t))[0];
|
|
2748
|
+
if (!s)
|
|
2749
|
+
return new Error("not found Info.plist file in IPA");
|
|
2750
|
+
const c = await s.async("arraybuffer").catch(P);
|
|
2751
|
+
if (c instanceof Error)
|
|
2752
|
+
return new Error(`read Info.plist file error: ${c.message}`);
|
|
2753
|
+
const w = ht(c);
|
|
2754
|
+
if (w instanceof Error)
|
|
2755
|
+
return new Error(`parse Info.plist error: ${w.message}`);
|
|
2756
|
+
const d = {
|
|
2757
|
+
package: "CFBundleIdentifier" in w ? Q(w.CFBundleIdentifier) : "",
|
|
2758
|
+
versionCode: "CFBundleVersion" in w ? ct(w.CFBundleVersion) : 0,
|
|
2759
|
+
versionName: "CFBundleShortVersionString" in w ? Q(w.CFBundleShortVersionString) : "",
|
|
2760
|
+
plist: w
|
|
2761
|
+
};
|
|
2762
|
+
if (i?.ignoreIcon)
|
|
2763
|
+
return d;
|
|
2764
|
+
const E = Ht(w);
|
|
2765
|
+
if (d.iconPath = E, !d.iconPath)
|
|
2766
|
+
return d;
|
|
2767
|
+
const T = n.filter((t) => t.includes(E))[0];
|
|
2768
|
+
if (!T)
|
|
2769
|
+
return d;
|
|
2770
|
+
d.iconPath = T.name;
|
|
2771
|
+
const U = await T.async("arraybuffer").catch(P);
|
|
2772
|
+
if (U instanceof Error)
|
|
2773
|
+
return d;
|
|
2774
|
+
const I = Mt(U), v = Dt(I);
|
|
2775
|
+
return d.icon = it(v), d;
|
|
2776
|
+
}
|
|
2777
|
+
// async parseProvision() {
|
|
2778
|
+
// const zip = await this.zip;
|
|
2779
|
+
// if (zip instanceof Error) {
|
|
2780
|
+
// return zip;
|
|
2781
|
+
// }
|
|
2782
|
+
// // spell-checker:ignore mobileprovision
|
|
2783
|
+
// const provisionFile =
|
|
2784
|
+
// zip.filter((relativePath) => /payload\/[^/]+?.app\/embedded.mobileprovision$/i.test(relativePath))[0] || null;
|
|
2785
|
+
// if (!provisionFile) {
|
|
2786
|
+
// return new Error(`not found provision file in IPA`);
|
|
2787
|
+
// }
|
|
2788
|
+
// const provision = await provisionFile?.async("text").catch(formatError);
|
|
2789
|
+
// if (provision instanceof Error) {
|
|
2790
|
+
// return provision;
|
|
2791
|
+
// }
|
|
2792
|
+
// const firstIndex = provision.indexOf("<?xml");
|
|
2793
|
+
// const endIndex = provision.indexOf("</plist>");
|
|
2794
|
+
// const xmlContent = provision.slice(firstIndex, endIndex + 8);
|
|
2795
|
+
// // todo 解析 xml
|
|
2796
|
+
// return xmlContent;
|
|
2797
|
+
// }
|
|
2798
|
+
/**
|
|
2799
|
+
* 读取指定模块的 plist 信息
|
|
2800
|
+
*/
|
|
2801
|
+
async parseFramework(i) {
|
|
2802
|
+
const n = await this.zip;
|
|
2803
|
+
if (n instanceof Error)
|
|
2804
|
+
return n;
|
|
2805
|
+
const s = i.replace(/\.framework/i, ""), c = new RegExp(`\\/frameworks\\/${s}\\.framework\\/[^/]+?\\.plist$`, "i"), w = n.file(c)[0];
|
|
2806
|
+
if (!w)
|
|
2807
|
+
return new Error(`not found ${i} plist file in IPA`);
|
|
2808
|
+
const d = await w.async("arraybuffer").catch(P);
|
|
2809
|
+
return d instanceof Error ? new Error(`read ${i} plist file error: ${d.message}`) : ht(d);
|
|
2810
|
+
}
|
|
2811
|
+
/**
|
|
2812
|
+
* 读取指定文件的内容
|
|
2813
|
+
*/
|
|
2814
|
+
async readFile(i, n) {
|
|
2815
|
+
const s = await this.zip;
|
|
2816
|
+
return s instanceof Error ? new Error(`load file error: ${s.message}`) : await nt(s, i, n);
|
|
2817
|
+
}
|
|
2715
2818
|
}
|
|
2716
|
-
function
|
|
2717
|
-
return
|
|
2718
|
-
|
|
2719
|
-
) :
|
|
2819
|
+
function Ht(f) {
|
|
2820
|
+
return W(f, "CFBundleIcons") && W(f.CFBundleIcons, "CFBundlePrimaryIcon") && W(f.CFBundleIcons.CFBundlePrimaryIcon, "CFBundleIconFiles") && Array.isArray(f.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles) && f.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length ? Q(
|
|
2821
|
+
f.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[f.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1]
|
|
2822
|
+
) : W(f, "CFBundleIconFiles") && Array.isArray(f.CFBundleIconFiles) && f.CFBundleIconFiles.length ? Q(f.CFBundleIconFiles[f.CFBundleIconFiles.length - 1]) : "";
|
|
2720
2823
|
}
|
|
2721
2824
|
export {
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2825
|
+
Wt as AndroidAppParser,
|
|
2826
|
+
Gt as HosAppParser,
|
|
2827
|
+
Kt as IosAppParser
|
|
2725
2828
|
};
|