module-develop-kit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1755 @@
1
+ var at = { exports: {} }, li = at.exports, Pt;
2
+ function lt() {
3
+ return Pt || (Pt = 1, function(v, z) {
4
+ (function() {
5
+ var S, T = 244837814094590, I = (T & 16777215) == 15715070;
6
+ function r(t, e, i) {
7
+ t != null && (typeof t == "number" ? this.fromNumber(t, e, i) : e == null && typeof t != "string" ? this.fromString(t, 256) : this.fromString(t, e));
8
+ }
9
+ function g() {
10
+ return new r(null);
11
+ }
12
+ function c(t, e, i, n, u, a) {
13
+ for (; --a >= 0; ) {
14
+ var b = e * this[t++] + i[n] + u;
15
+ u = Math.floor(b / 67108864), i[n++] = b & 67108863;
16
+ }
17
+ return u;
18
+ }
19
+ function y(t, e, i, n, u, a) {
20
+ for (var b = e & 32767, F = e >> 15; --a >= 0; ) {
21
+ var V = this[t] & 32767, j = this[t++] >> 15, $ = F * V + j * b;
22
+ V = b * V + (($ & 32767) << 15) + i[n] + (u & 1073741823), u = (V >>> 30) + ($ >>> 15) + F * j + (u >>> 30), i[n++] = V & 1073741823;
23
+ }
24
+ return u;
25
+ }
26
+ function p(t, e, i, n, u, a) {
27
+ for (var b = e & 16383, F = e >> 14; --a >= 0; ) {
28
+ var V = this[t] & 16383, j = this[t++] >> 14, $ = F * V + j * b;
29
+ V = b * V + (($ & 16383) << 14) + i[n] + u, u = (V >> 28) + ($ >> 14) + F * j, i[n++] = V & 268435455;
30
+ }
31
+ return u;
32
+ }
33
+ var d = typeof navigator < "u";
34
+ d && I && navigator.appName == "Microsoft Internet Explorer" ? (r.prototype.am = y, S = 30) : d && I && navigator.appName != "Netscape" ? (r.prototype.am = c, S = 26) : (r.prototype.am = p, S = 28), r.prototype.DB = S, r.prototype.DM = (1 << S) - 1, r.prototype.DV = 1 << S;
35
+ var w = 52;
36
+ r.prototype.FV = Math.pow(2, w), r.prototype.F1 = w - S, r.prototype.F2 = 2 * S - w;
37
+ var B = "0123456789abcdefghijklmnopqrstuvwxyz", E = new Array(), D, M;
38
+ for (D = 48, M = 0; M <= 9; ++M) E[D++] = M;
39
+ for (D = 97, M = 10; M < 36; ++M) E[D++] = M;
40
+ for (D = 65, M = 10; M < 36; ++M) E[D++] = M;
41
+ function f(t) {
42
+ return B.charAt(t);
43
+ }
44
+ function l(t, e) {
45
+ var i = E[t.charCodeAt(e)];
46
+ return i ?? -1;
47
+ }
48
+ function h(t) {
49
+ for (var e = this.t - 1; e >= 0; --e) t[e] = this[e];
50
+ t.t = this.t, t.s = this.s;
51
+ }
52
+ function o(t) {
53
+ this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0;
54
+ }
55
+ function x(t) {
56
+ var e = g();
57
+ return e.fromInt(t), e;
58
+ }
59
+ function s(t, e) {
60
+ var i;
61
+ if (e == 16) i = 4;
62
+ else if (e == 8) i = 3;
63
+ else if (e == 256) i = 8;
64
+ else if (e == 2) i = 1;
65
+ else if (e == 32) i = 5;
66
+ else if (e == 4) i = 2;
67
+ else {
68
+ this.fromRadix(t, e);
69
+ return;
70
+ }
71
+ this.t = 0, this.s = 0;
72
+ for (var n = t.length, u = !1, a = 0; --n >= 0; ) {
73
+ var b = i == 8 ? t[n] & 255 : l(t, n);
74
+ if (b < 0) {
75
+ t.charAt(n) == "-" && (u = !0);
76
+ continue;
77
+ }
78
+ u = !1, a == 0 ? this[this.t++] = b : a + i > this.DB ? (this[this.t - 1] |= (b & (1 << this.DB - a) - 1) << a, this[this.t++] = b >> this.DB - a) : this[this.t - 1] |= b << a, a += i, a >= this.DB && (a -= this.DB);
79
+ }
80
+ i == 8 && (t[0] & 128) != 0 && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)), this.clamp(), u && r.ZERO.subTo(this, this);
81
+ }
82
+ function m() {
83
+ for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; ) --this.t;
84
+ }
85
+ function R(t) {
86
+ if (this.s < 0) return "-" + this.negate().toString(t);
87
+ var e;
88
+ if (t == 16) e = 4;
89
+ else if (t == 8) e = 3;
90
+ else if (t == 2) e = 1;
91
+ else if (t == 32) e = 5;
92
+ else if (t == 4) e = 2;
93
+ else return this.toRadix(t);
94
+ var i = (1 << e) - 1, n, u = !1, a = "", b = this.t, F = this.DB - b * this.DB % e;
95
+ if (b-- > 0)
96
+ for (F < this.DB && (n = this[b] >> F) > 0 && (u = !0, a = f(n)); b >= 0; )
97
+ F < e ? (n = (this[b] & (1 << F) - 1) << e - F, n |= this[--b] >> (F += this.DB - e)) : (n = this[b] >> (F -= e) & i, F <= 0 && (F += this.DB, --b)), n > 0 && (u = !0), u && (a += f(n));
98
+ return u ? a : "0";
99
+ }
100
+ function P() {
101
+ var t = g();
102
+ return r.ZERO.subTo(this, t), t;
103
+ }
104
+ function C() {
105
+ return this.s < 0 ? this.negate() : this;
106
+ }
107
+ function N(t) {
108
+ var e = this.s - t.s;
109
+ if (e != 0) return e;
110
+ var i = this.t;
111
+ if (e = i - t.t, e != 0) return this.s < 0 ? -e : e;
112
+ for (; --i >= 0; ) if ((e = this[i] - t[i]) != 0) return e;
113
+ return 0;
114
+ }
115
+ function q(t) {
116
+ var e = 1, i;
117
+ return (i = t >>> 16) != 0 && (t = i, e += 16), (i = t >> 8) != 0 && (t = i, e += 8), (i = t >> 4) != 0 && (t = i, e += 4), (i = t >> 2) != 0 && (t = i, e += 2), (i = t >> 1) != 0 && (t = i, e += 1), e;
118
+ }
119
+ function O() {
120
+ return this.t <= 0 ? 0 : this.DB * (this.t - 1) + q(this[this.t - 1] ^ this.s & this.DM);
121
+ }
122
+ function H(t, e) {
123
+ var i;
124
+ for (i = this.t - 1; i >= 0; --i) e[i + t] = this[i];
125
+ for (i = t - 1; i >= 0; --i) e[i] = 0;
126
+ e.t = this.t + t, e.s = this.s;
127
+ }
128
+ function L(t, e) {
129
+ for (var i = t; i < this.t; ++i) e[i - t] = this[i];
130
+ e.t = Math.max(this.t - t, 0), e.s = this.s;
131
+ }
132
+ function Z(t, e) {
133
+ var i = t % this.DB, n = this.DB - i, u = (1 << n) - 1, a = Math.floor(t / this.DB), b = this.s << i & this.DM, F;
134
+ for (F = this.t - 1; F >= 0; --F)
135
+ e[F + a + 1] = this[F] >> n | b, b = (this[F] & u) << i;
136
+ for (F = a - 1; F >= 0; --F) e[F] = 0;
137
+ e[a] = b, e.t = this.t + a + 1, e.s = this.s, e.clamp();
138
+ }
139
+ function W(t, e) {
140
+ e.s = this.s;
141
+ var i = Math.floor(t / this.DB);
142
+ if (i >= this.t) {
143
+ e.t = 0;
144
+ return;
145
+ }
146
+ var n = t % this.DB, u = this.DB - n, a = (1 << n) - 1;
147
+ e[0] = this[i] >> n;
148
+ for (var b = i + 1; b < this.t; ++b)
149
+ e[b - i - 1] |= (this[b] & a) << u, e[b - i] = this[b] >> n;
150
+ n > 0 && (e[this.t - i - 1] |= (this.s & a) << u), e.t = this.t - i, e.clamp();
151
+ }
152
+ function G(t, e) {
153
+ for (var i = 0, n = 0, u = Math.min(t.t, this.t); i < u; )
154
+ n += this[i] - t[i], e[i++] = n & this.DM, n >>= this.DB;
155
+ if (t.t < this.t) {
156
+ for (n -= t.s; i < this.t; )
157
+ n += this[i], e[i++] = n & this.DM, n >>= this.DB;
158
+ n += this.s;
159
+ } else {
160
+ for (n += this.s; i < t.t; )
161
+ n -= t[i], e[i++] = n & this.DM, n >>= this.DB;
162
+ n -= t.s;
163
+ }
164
+ e.s = n < 0 ? -1 : 0, n < -1 ? e[i++] = this.DV + n : n > 0 && (e[i++] = n), e.t = i, e.clamp();
165
+ }
166
+ function nt(t, e) {
167
+ var i = this.abs(), n = t.abs(), u = i.t;
168
+ for (e.t = u + n.t; --u >= 0; ) e[u] = 0;
169
+ for (u = 0; u < n.t; ++u) e[u + i.t] = i.am(0, n[u], e, u, 0, i.t);
170
+ e.s = 0, e.clamp(), this.s != t.s && r.ZERO.subTo(e, e);
171
+ }
172
+ function st(t) {
173
+ for (var e = this.abs(), i = t.t = 2 * e.t; --i >= 0; ) t[i] = 0;
174
+ for (i = 0; i < e.t - 1; ++i) {
175
+ var n = e.am(i, e[i], t, 2 * i, 0, 1);
176
+ (t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, n, e.t - i - 1)) >= e.DV && (t[i + e.t] -= e.DV, t[i + e.t + 1] = 1);
177
+ }
178
+ t.t > 0 && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)), t.s = 0, t.clamp();
179
+ }
180
+ function ot(t, e, i) {
181
+ var n = t.abs();
182
+ if (!(n.t <= 0)) {
183
+ var u = this.abs();
184
+ if (u.t < n.t) {
185
+ e != null && e.fromInt(0), i != null && this.copyTo(i);
186
+ return;
187
+ }
188
+ i == null && (i = g());
189
+ var a = g(), b = this.s, F = t.s, V = this.DB - q(n[n.t - 1]);
190
+ V > 0 ? (n.lShiftTo(V, a), u.lShiftTo(V, i)) : (n.copyTo(a), u.copyTo(i));
191
+ var j = a.t, $ = a[j - 1];
192
+ if ($ != 0) {
193
+ var X = $ * (1 << this.F1) + (j > 1 ? a[j - 2] >> this.F2 : 0), Q = this.FV / X, ut = (1 << this.F1) / X, K = 1 << this.F2, J = i.t, ct = J - j, tt = e ?? g();
194
+ for (a.dlShiftTo(ct, tt), i.compareTo(tt) >= 0 && (i[i.t++] = 1, i.subTo(tt, i)), r.ONE.dlShiftTo(j, tt), tt.subTo(a, a); a.t < j; ) a[a.t++] = 0;
195
+ for (; --ct >= 0; ) {
196
+ var gt = i[--J] == $ ? this.DM : Math.floor(i[J] * Q + (i[J - 1] + K) * ut);
197
+ if ((i[J] += a.am(0, gt, i, ct, 0, j)) < gt)
198
+ for (a.dlShiftTo(ct, tt), i.subTo(tt, i); i[J] < --gt; ) i.subTo(tt, i);
199
+ }
200
+ e != null && (i.drShiftTo(j, e), b != F && r.ZERO.subTo(e, e)), i.t = j, i.clamp(), V > 0 && i.rShiftTo(V, i), b < 0 && r.ZERO.subTo(i, i);
201
+ }
202
+ }
203
+ }
204
+ function ft(t) {
205
+ var e = g();
206
+ return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(r.ZERO) > 0 && t.subTo(e, e), e;
207
+ }
208
+ function A(t) {
209
+ this.m = t;
210
+ }
211
+ function jt(t) {
212
+ return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t;
213
+ }
214
+ function Ut(t) {
215
+ return t;
216
+ }
217
+ function Zt(t) {
218
+ t.divRemTo(this.m, null, t);
219
+ }
220
+ function _t(t, e, i) {
221
+ t.multiplyTo(e, i), this.reduce(i);
222
+ }
223
+ function Xt(t, e) {
224
+ t.squareTo(e), this.reduce(e);
225
+ }
226
+ A.prototype.convert = jt, A.prototype.revert = Ut, A.prototype.reduce = Zt, A.prototype.mulTo = _t, A.prototype.sqrTo = Xt;
227
+ function $t() {
228
+ if (this.t < 1) return 0;
229
+ var t = this[0];
230
+ if ((t & 1) == 0) return 0;
231
+ var e = t & 3;
232
+ return e = e * (2 - (t & 15) * e) & 15, e = e * (2 - (t & 255) * e) & 255, e = e * (2 - ((t & 65535) * e & 65535)) & 65535, e = e * (2 - t * e % this.DV) % this.DV, e > 0 ? this.DV - e : -e;
233
+ }
234
+ function et(t) {
235
+ this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t;
236
+ }
237
+ function Gt(t) {
238
+ var e = g();
239
+ return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(r.ZERO) > 0 && this.m.subTo(e, e), e;
240
+ }
241
+ function Yt(t) {
242
+ var e = g();
243
+ return t.copyTo(e), this.reduce(e), e;
244
+ }
245
+ function Kt(t) {
246
+ for (; t.t <= this.mt2; )
247
+ t[t.t++] = 0;
248
+ for (var e = 0; e < this.m.t; ++e) {
249
+ var i = t[e] & 32767, n = i * this.mpl + ((i * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
250
+ for (i = e + this.m.t, t[i] += this.m.am(0, n, t, e, 0, this.m.t); t[i] >= t.DV; )
251
+ t[i] -= t.DV, t[++i]++;
252
+ }
253
+ t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t);
254
+ }
255
+ function Jt(t, e) {
256
+ t.squareTo(e), this.reduce(e);
257
+ }
258
+ function Wt(t, e, i) {
259
+ t.multiplyTo(e, i), this.reduce(i);
260
+ }
261
+ et.prototype.convert = Gt, et.prototype.revert = Yt, et.prototype.reduce = Kt, et.prototype.mulTo = Wt, et.prototype.sqrTo = Jt;
262
+ function Qt() {
263
+ return (this.t > 0 ? this[0] & 1 : this.s) == 0;
264
+ }
265
+ function te(t, e) {
266
+ if (t > 4294967295 || t < 1) return r.ONE;
267
+ var i = g(), n = g(), u = e.convert(this), a = q(t) - 1;
268
+ for (u.copyTo(i); --a >= 0; )
269
+ if (e.sqrTo(i, n), (t & 1 << a) > 0) e.mulTo(n, u, i);
270
+ else {
271
+ var b = i;
272
+ i = n, n = b;
273
+ }
274
+ return e.revert(i);
275
+ }
276
+ function ee(t, e) {
277
+ var i;
278
+ return t < 256 || e.isEven() ? i = new A(e) : i = new et(e), this.exp(t, i);
279
+ }
280
+ r.prototype.copyTo = h, r.prototype.fromInt = o, r.prototype.fromString = s, r.prototype.clamp = m, r.prototype.dlShiftTo = H, r.prototype.drShiftTo = L, r.prototype.lShiftTo = Z, r.prototype.rShiftTo = W, r.prototype.subTo = G, r.prototype.multiplyTo = nt, r.prototype.squareTo = st, r.prototype.divRemTo = ot, r.prototype.invDigit = $t, r.prototype.isEven = Qt, r.prototype.exp = te, r.prototype.toString = R, r.prototype.negate = P, r.prototype.abs = C, r.prototype.compareTo = N, r.prototype.bitLength = O, r.prototype.mod = ft, r.prototype.modPowInt = ee, r.ZERO = x(0), r.ONE = x(1);
281
+ function ie() {
282
+ var t = g();
283
+ return this.copyTo(t), t;
284
+ }
285
+ function ne() {
286
+ if (this.s < 0) {
287
+ if (this.t == 1) return this[0] - this.DV;
288
+ if (this.t == 0) return -1;
289
+ } else {
290
+ if (this.t == 1) return this[0];
291
+ if (this.t == 0) return 0;
292
+ }
293
+ return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
294
+ }
295
+ function re() {
296
+ return this.t == 0 ? this.s : this[0] << 24 >> 24;
297
+ }
298
+ function se() {
299
+ return this.t == 0 ? this.s : this[0] << 16 >> 16;
300
+ }
301
+ function oe(t) {
302
+ return Math.floor(Math.LN2 * this.DB / Math.log(t));
303
+ }
304
+ function fe() {
305
+ return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
306
+ }
307
+ function he(t) {
308
+ if (t == null && (t = 10), this.signum() == 0 || t < 2 || t > 36) return "0";
309
+ var e = this.chunkSize(t), i = Math.pow(t, e), n = x(i), u = g(), a = g(), b = "";
310
+ for (this.divRemTo(n, u, a); u.signum() > 0; )
311
+ b = (i + a.intValue()).toString(t).substr(1) + b, u.divRemTo(n, u, a);
312
+ return a.intValue().toString(t) + b;
313
+ }
314
+ function ue(t, e) {
315
+ this.fromInt(0), e == null && (e = 10);
316
+ for (var i = this.chunkSize(e), n = Math.pow(e, i), u = !1, a = 0, b = 0, F = 0; F < t.length; ++F) {
317
+ var V = l(t, F);
318
+ if (V < 0) {
319
+ t.charAt(F) == "-" && this.signum() == 0 && (u = !0);
320
+ continue;
321
+ }
322
+ b = e * b + V, ++a >= i && (this.dMultiply(n), this.dAddOffset(b, 0), a = 0, b = 0);
323
+ }
324
+ a > 0 && (this.dMultiply(Math.pow(e, a)), this.dAddOffset(b, 0)), u && r.ZERO.subTo(this, this);
325
+ }
326
+ function ce(t, e, i) {
327
+ if (typeof e == "number")
328
+ if (t < 2) this.fromInt(1);
329
+ else
330
+ for (this.fromNumber(t, i), this.testBit(t - 1) || this.bitwiseTo(r.ONE.shiftLeft(t - 1), xt, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); )
331
+ this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(r.ONE.shiftLeft(t - 1), this);
332
+ else {
333
+ var n = new Array(), u = t & 7;
334
+ n.length = (t >> 3) + 1, e.nextBytes(n), u > 0 ? n[0] &= (1 << u) - 1 : n[0] = 0, this.fromString(n, 256);
335
+ }
336
+ }
337
+ function ae() {
338
+ var t = this.t, e = new Array();
339
+ e[0] = this.s;
340
+ var i = this.DB - t * this.DB % 8, n, u = 0;
341
+ if (t-- > 0)
342
+ for (i < this.DB && (n = this[t] >> i) != (this.s & this.DM) >> i && (e[u++] = n | this.s << this.DB - i); t >= 0; )
343
+ i < 8 ? (n = (this[t] & (1 << i) - 1) << 8 - i, n |= this[--t] >> (i += this.DB - 8)) : (n = this[t] >> (i -= 8) & 255, i <= 0 && (i += this.DB, --t)), (n & 128) != 0 && (n |= -256), u == 0 && (this.s & 128) != (n & 128) && ++u, (u > 0 || n != this.s) && (e[u++] = n);
344
+ return e;
345
+ }
346
+ function le(t) {
347
+ return this.compareTo(t) == 0;
348
+ }
349
+ function xe(t) {
350
+ return this.compareTo(t) < 0 ? this : t;
351
+ }
352
+ function pe(t) {
353
+ return this.compareTo(t) > 0 ? this : t;
354
+ }
355
+ function de(t, e, i) {
356
+ var n, u, a = Math.min(t.t, this.t);
357
+ for (n = 0; n < a; ++n) i[n] = e(this[n], t[n]);
358
+ if (t.t < this.t) {
359
+ for (u = t.s & this.DM, n = a; n < this.t; ++n) i[n] = e(this[n], u);
360
+ i.t = this.t;
361
+ } else {
362
+ for (u = this.s & this.DM, n = a; n < t.t; ++n) i[n] = e(u, t[n]);
363
+ i.t = t.t;
364
+ }
365
+ i.s = e(this.s, t.s), i.clamp();
366
+ }
367
+ function ge(t, e) {
368
+ return t & e;
369
+ }
370
+ function me(t) {
371
+ var e = g();
372
+ return this.bitwiseTo(t, ge, e), e;
373
+ }
374
+ function xt(t, e) {
375
+ return t | e;
376
+ }
377
+ function ve(t) {
378
+ var e = g();
379
+ return this.bitwiseTo(t, xt, e), e;
380
+ }
381
+ function St(t, e) {
382
+ return t ^ e;
383
+ }
384
+ function ye(t) {
385
+ var e = g();
386
+ return this.bitwiseTo(t, St, e), e;
387
+ }
388
+ function Dt(t, e) {
389
+ return t & ~e;
390
+ }
391
+ function be(t) {
392
+ var e = g();
393
+ return this.bitwiseTo(t, Dt, e), e;
394
+ }
395
+ function Te() {
396
+ for (var t = g(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e];
397
+ return t.t = this.t, t.s = ~this.s, t;
398
+ }
399
+ function we(t) {
400
+ var e = g();
401
+ return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e;
402
+ }
403
+ function Fe(t) {
404
+ var e = g();
405
+ return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e;
406
+ }
407
+ function Be(t) {
408
+ if (t == 0) return -1;
409
+ var e = 0;
410
+ return (t & 65535) == 0 && (t >>= 16, e += 16), (t & 255) == 0 && (t >>= 8, e += 8), (t & 15) == 0 && (t >>= 4, e += 4), (t & 3) == 0 && (t >>= 2, e += 2), (t & 1) == 0 && ++e, e;
411
+ }
412
+ function Se() {
413
+ for (var t = 0; t < this.t; ++t)
414
+ if (this[t] != 0) return t * this.DB + Be(this[t]);
415
+ return this.s < 0 ? this.t * this.DB : -1;
416
+ }
417
+ function De(t) {
418
+ for (var e = 0; t != 0; )
419
+ t &= t - 1, ++e;
420
+ return e;
421
+ }
422
+ function qe() {
423
+ for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i) t += De(this[i] ^ e);
424
+ return t;
425
+ }
426
+ function Ie(t) {
427
+ var e = Math.floor(t / this.DB);
428
+ return e >= this.t ? this.s != 0 : (this[e] & 1 << t % this.DB) != 0;
429
+ }
430
+ function Ee(t, e) {
431
+ var i = r.ONE.shiftLeft(t);
432
+ return this.bitwiseTo(i, e, i), i;
433
+ }
434
+ function Re(t) {
435
+ return this.changeBit(t, xt);
436
+ }
437
+ function Ae(t) {
438
+ return this.changeBit(t, Dt);
439
+ }
440
+ function Pe(t) {
441
+ return this.changeBit(t, St);
442
+ }
443
+ function Me(t, e) {
444
+ for (var i = 0, n = 0, u = Math.min(t.t, this.t); i < u; )
445
+ n += this[i] + t[i], e[i++] = n & this.DM, n >>= this.DB;
446
+ if (t.t < this.t) {
447
+ for (n += t.s; i < this.t; )
448
+ n += this[i], e[i++] = n & this.DM, n >>= this.DB;
449
+ n += this.s;
450
+ } else {
451
+ for (n += this.s; i < t.t; )
452
+ n += t[i], e[i++] = n & this.DM, n >>= this.DB;
453
+ n += t.s;
454
+ }
455
+ e.s = n < 0 ? -1 : 0, n > 0 ? e[i++] = n : n < -1 && (e[i++] = this.DV + n), e.t = i, e.clamp();
456
+ }
457
+ function Ce(t) {
458
+ var e = g();
459
+ return this.addTo(t, e), e;
460
+ }
461
+ function Oe(t) {
462
+ var e = g();
463
+ return this.subTo(t, e), e;
464
+ }
465
+ function He(t) {
466
+ var e = g();
467
+ return this.multiplyTo(t, e), e;
468
+ }
469
+ function Ne() {
470
+ var t = g();
471
+ return this.squareTo(t), t;
472
+ }
473
+ function Le(t) {
474
+ var e = g();
475
+ return this.divRemTo(t, e, null), e;
476
+ }
477
+ function Ve(t) {
478
+ var e = g();
479
+ return this.divRemTo(t, null, e), e;
480
+ }
481
+ function ze(t) {
482
+ var e = g(), i = g();
483
+ return this.divRemTo(t, e, i), new Array(e, i);
484
+ }
485
+ function ke(t) {
486
+ this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp();
487
+ }
488
+ function je(t, e) {
489
+ if (t != 0) {
490
+ for (; this.t <= e; ) this[this.t++] = 0;
491
+ for (this[e] += t; this[e] >= this.DV; )
492
+ this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e];
493
+ }
494
+ }
495
+ function rt() {
496
+ }
497
+ function qt(t) {
498
+ return t;
499
+ }
500
+ function Ue(t, e, i) {
501
+ t.multiplyTo(e, i);
502
+ }
503
+ function Ze(t, e) {
504
+ t.squareTo(e);
505
+ }
506
+ rt.prototype.convert = qt, rt.prototype.revert = qt, rt.prototype.mulTo = Ue, rt.prototype.sqrTo = Ze;
507
+ function _e(t) {
508
+ return this.exp(t, new rt());
509
+ }
510
+ function Xe(t, e, i) {
511
+ var n = Math.min(this.t + t.t, e);
512
+ for (i.s = 0, i.t = n; n > 0; ) i[--n] = 0;
513
+ var u;
514
+ for (u = i.t - this.t; n < u; ++n) i[n + this.t] = this.am(0, t[n], i, n, 0, this.t);
515
+ for (u = Math.min(t.t, e); n < u; ++n) this.am(0, t[n], i, n, 0, e - n);
516
+ i.clamp();
517
+ }
518
+ function $e(t, e, i) {
519
+ --e;
520
+ var n = i.t = this.t + t.t - e;
521
+ for (i.s = 0; --n >= 0; ) i[n] = 0;
522
+ for (n = Math.max(e - this.t, 0); n < t.t; ++n)
523
+ i[this.t + n - e] = this.am(e - n, t[n], i, 0, 0, this.t + n - e);
524
+ i.clamp(), i.drShiftTo(1, i);
525
+ }
526
+ function it(t) {
527
+ this.r2 = g(), this.q3 = g(), r.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t), this.m = t;
528
+ }
529
+ function Ge(t) {
530
+ if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m);
531
+ if (t.compareTo(this.m) < 0) return t;
532
+ var e = g();
533
+ return t.copyTo(e), this.reduce(e), e;
534
+ }
535
+ function Ye(t) {
536
+ return t;
537
+ }
538
+ function Ke(t) {
539
+ for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; ) t.dAddOffset(1, this.m.t + 1);
540
+ for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; ) t.subTo(this.m, t);
541
+ }
542
+ function Je(t, e) {
543
+ t.squareTo(e), this.reduce(e);
544
+ }
545
+ function We(t, e, i) {
546
+ t.multiplyTo(e, i), this.reduce(i);
547
+ }
548
+ it.prototype.convert = Ge, it.prototype.revert = Ye, it.prototype.reduce = Ke, it.prototype.mulTo = We, it.prototype.sqrTo = Je;
549
+ function Qe(t, e) {
550
+ var i = t.bitLength(), n, u = x(1), a;
551
+ if (i <= 0) return u;
552
+ i < 18 ? n = 1 : i < 48 ? n = 3 : i < 144 ? n = 4 : i < 768 ? n = 5 : n = 6, i < 8 ? a = new A(e) : e.isEven() ? a = new it(e) : a = new et(e);
553
+ var b = new Array(), F = 3, V = n - 1, j = (1 << n) - 1;
554
+ if (b[1] = a.convert(this), n > 1) {
555
+ var $ = g();
556
+ for (a.sqrTo(b[1], $); F <= j; )
557
+ b[F] = g(), a.mulTo($, b[F - 2], b[F]), F += 2;
558
+ }
559
+ var X = t.t - 1, Q, ut = !0, K = g(), J;
560
+ for (i = q(t[X]) - 1; X >= 0; ) {
561
+ for (i >= V ? Q = t[X] >> i - V & j : (Q = (t[X] & (1 << i + 1) - 1) << V - i, X > 0 && (Q |= t[X - 1] >> this.DB + i - V)), F = n; (Q & 1) == 0; )
562
+ Q >>= 1, --F;
563
+ if ((i -= F) < 0 && (i += this.DB, --X), ut)
564
+ b[Q].copyTo(u), ut = !1;
565
+ else {
566
+ for (; F > 1; )
567
+ a.sqrTo(u, K), a.sqrTo(K, u), F -= 2;
568
+ F > 0 ? a.sqrTo(u, K) : (J = u, u = K, K = J), a.mulTo(K, b[Q], u);
569
+ }
570
+ for (; X >= 0 && (t[X] & 1 << i) == 0; )
571
+ a.sqrTo(u, K), J = u, u = K, K = J, --i < 0 && (i = this.DB - 1, --X);
572
+ }
573
+ return a.revert(u);
574
+ }
575
+ function ti(t) {
576
+ var e = this.s < 0 ? this.negate() : this.clone(), i = t.s < 0 ? t.negate() : t.clone();
577
+ if (e.compareTo(i) < 0) {
578
+ var n = e;
579
+ e = i, i = n;
580
+ }
581
+ var u = e.getLowestSetBit(), a = i.getLowestSetBit();
582
+ if (a < 0) return e;
583
+ for (u < a && (a = u), a > 0 && (e.rShiftTo(a, e), i.rShiftTo(a, i)); e.signum() > 0; )
584
+ (u = e.getLowestSetBit()) > 0 && e.rShiftTo(u, e), (u = i.getLowestSetBit()) > 0 && i.rShiftTo(u, i), e.compareTo(i) >= 0 ? (e.subTo(i, e), e.rShiftTo(1, e)) : (i.subTo(e, i), i.rShiftTo(1, i));
585
+ return a > 0 && i.lShiftTo(a, i), i;
586
+ }
587
+ function ei(t) {
588
+ if (t <= 0) return 0;
589
+ var e = this.DV % t, i = this.s < 0 ? t - 1 : 0;
590
+ if (this.t > 0)
591
+ if (e == 0) i = this[0] % t;
592
+ else for (var n = this.t - 1; n >= 0; --n) i = (e * i + this[n]) % t;
593
+ return i;
594
+ }
595
+ function ii(t) {
596
+ var e = t.isEven();
597
+ if (this.isEven() && e || t.signum() == 0) return r.ZERO;
598
+ for (var i = t.clone(), n = this.clone(), u = x(1), a = x(0), b = x(0), F = x(1); i.signum() != 0; ) {
599
+ for (; i.isEven(); )
600
+ i.rShiftTo(1, i), e ? ((!u.isEven() || !a.isEven()) && (u.addTo(this, u), a.subTo(t, a)), u.rShiftTo(1, u)) : a.isEven() || a.subTo(t, a), a.rShiftTo(1, a);
601
+ for (; n.isEven(); )
602
+ n.rShiftTo(1, n), e ? ((!b.isEven() || !F.isEven()) && (b.addTo(this, b), F.subTo(t, F)), b.rShiftTo(1, b)) : F.isEven() || F.subTo(t, F), F.rShiftTo(1, F);
603
+ i.compareTo(n) >= 0 ? (i.subTo(n, i), e && u.subTo(b, u), a.subTo(F, a)) : (n.subTo(i, n), e && b.subTo(u, b), F.subTo(a, F));
604
+ }
605
+ if (n.compareTo(r.ONE) != 0) return r.ZERO;
606
+ if (F.compareTo(t) >= 0) return F.subtract(t);
607
+ if (F.signum() < 0) F.addTo(t, F);
608
+ else return F;
609
+ return F.signum() < 0 ? F.add(t) : F;
610
+ }
611
+ var U = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], ni = (1 << 26) / U[U.length - 1];
612
+ function ri(t) {
613
+ var e, i = this.abs();
614
+ if (i.t == 1 && i[0] <= U[U.length - 1]) {
615
+ for (e = 0; e < U.length; ++e)
616
+ if (i[0] == U[e]) return !0;
617
+ return !1;
618
+ }
619
+ if (i.isEven()) return !1;
620
+ for (e = 1; e < U.length; ) {
621
+ for (var n = U[e], u = e + 1; u < U.length && n < ni; ) n *= U[u++];
622
+ for (n = i.modInt(n); e < u; ) if (n % U[e++] == 0) return !1;
623
+ }
624
+ return i.millerRabin(t);
625
+ }
626
+ function si(t) {
627
+ var e = this.subtract(r.ONE), i = e.getLowestSetBit();
628
+ if (i <= 0) return !1;
629
+ var n = e.shiftRight(i);
630
+ t = t + 1 >> 1, t > U.length && (t = U.length);
631
+ for (var u = g(), a = 0; a < t; ++a) {
632
+ u.fromInt(U[Math.floor(Math.random() * U.length)]);
633
+ var b = u.modPow(n, this);
634
+ if (b.compareTo(r.ONE) != 0 && b.compareTo(e) != 0) {
635
+ for (var F = 1; F++ < i && b.compareTo(e) != 0; )
636
+ if (b = b.modPowInt(2, this), b.compareTo(r.ONE) == 0) return !1;
637
+ if (b.compareTo(e) != 0) return !1;
638
+ }
639
+ }
640
+ return !0;
641
+ }
642
+ r.prototype.chunkSize = oe, r.prototype.toRadix = he, r.prototype.fromRadix = ue, r.prototype.fromNumber = ce, r.prototype.bitwiseTo = de, r.prototype.changeBit = Ee, r.prototype.addTo = Me, r.prototype.dMultiply = ke, r.prototype.dAddOffset = je, r.prototype.multiplyLowerTo = Xe, r.prototype.multiplyUpperTo = $e, r.prototype.modInt = ei, r.prototype.millerRabin = si, r.prototype.clone = ie, r.prototype.intValue = ne, r.prototype.byteValue = re, r.prototype.shortValue = se, r.prototype.signum = fe, r.prototype.toByteArray = ae, r.prototype.equals = le, r.prototype.min = xe, r.prototype.max = pe, r.prototype.and = me, r.prototype.or = ve, r.prototype.xor = ye, r.prototype.andNot = be, r.prototype.not = Te, r.prototype.shiftLeft = we, r.prototype.shiftRight = Fe, r.prototype.getLowestSetBit = Se, r.prototype.bitCount = qe, r.prototype.testBit = Ie, r.prototype.setBit = Re, r.prototype.clearBit = Ae, r.prototype.flipBit = Pe, r.prototype.add = Ce, r.prototype.subtract = Oe, r.prototype.multiply = He, r.prototype.divide = Le, r.prototype.remainder = Ve, r.prototype.divideAndRemainder = ze, r.prototype.modPow = Qe, r.prototype.modInverse = ii, r.prototype.pow = _e, r.prototype.gcd = ti, r.prototype.isProbablePrime = ri, r.prototype.square = Ne, r.prototype.Barrett = it;
643
+ var ht, _, k;
644
+ function oi(t) {
645
+ _[k++] ^= t & 255, _[k++] ^= t >> 8 & 255, _[k++] ^= t >> 16 & 255, _[k++] ^= t >> 24 & 255, k >= dt && (k -= dt);
646
+ }
647
+ function It() {
648
+ oi((/* @__PURE__ */ new Date()).getTime());
649
+ }
650
+ if (_ == null) {
651
+ _ = new Array(), k = 0;
652
+ var Y;
653
+ if (typeof window < "u" && window.crypto) {
654
+ if (window.crypto.getRandomValues) {
655
+ var Et = new Uint8Array(32);
656
+ for (window.crypto.getRandomValues(Et), Y = 0; Y < 32; ++Y)
657
+ _[k++] = Et[Y];
658
+ } else if (navigator.appName == "Netscape" && navigator.appVersion < "5") {
659
+ var Rt = window.crypto.random(32);
660
+ for (Y = 0; Y < Rt.length; ++Y)
661
+ _[k++] = Rt.charCodeAt(Y) & 255;
662
+ }
663
+ }
664
+ for (; k < dt; )
665
+ Y = Math.floor(65536 * Math.random()), _[k++] = Y >>> 8, _[k++] = Y & 255;
666
+ k = 0, It();
667
+ }
668
+ function fi() {
669
+ if (ht == null) {
670
+ for (It(), ht = ai(), ht.init(_), k = 0; k < _.length; ++k)
671
+ _[k] = 0;
672
+ k = 0;
673
+ }
674
+ return ht.next();
675
+ }
676
+ function hi(t) {
677
+ var e;
678
+ for (e = 0; e < t.length; ++e) t[e] = fi();
679
+ }
680
+ function At() {
681
+ }
682
+ At.prototype.nextBytes = hi;
683
+ function pt() {
684
+ this.i = 0, this.j = 0, this.S = new Array();
685
+ }
686
+ function ui(t) {
687
+ var e, i, n;
688
+ for (e = 0; e < 256; ++e)
689
+ this.S[e] = e;
690
+ for (i = 0, e = 0; e < 256; ++e)
691
+ i = i + this.S[e] + t[e % t.length] & 255, n = this.S[e], this.S[e] = this.S[i], this.S[i] = n;
692
+ this.i = 0, this.j = 0;
693
+ }
694
+ function ci() {
695
+ var t;
696
+ return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255];
697
+ }
698
+ pt.prototype.init = ui, pt.prototype.next = ci;
699
+ function ai() {
700
+ return new pt();
701
+ }
702
+ var dt = 256;
703
+ v.exports = {
704
+ default: r,
705
+ BigInteger: r,
706
+ SecureRandom: At
707
+ };
708
+ }).call(li);
709
+ }(at)), at.exports;
710
+ }
711
+ var mt, Mt;
712
+ function xi() {
713
+ if (Mt) return mt;
714
+ Mt = 1;
715
+ const { BigInteger: v } = lt();
716
+ function z(y) {
717
+ let p = y.toString(16);
718
+ if (p[0] !== "-")
719
+ p.length % 2 === 1 ? p = "0" + p : p.match(/^[0-7]/) || (p = "00" + p);
720
+ else {
721
+ p = p.substr(1);
722
+ let d = p.length;
723
+ d % 2 === 1 ? d += 1 : p.match(/^[0-7]/) || (d += 2);
724
+ let w = "";
725
+ for (let B = 0; B < d; B++) w += "f";
726
+ w = new v(w, 16), p = w.xor(y).add(v.ONE), p = p.toString(16).replace(/^-/, "");
727
+ }
728
+ return p;
729
+ }
730
+ class S {
731
+ constructor() {
732
+ this.tlv = null, this.t = "00", this.l = "00", this.v = "";
733
+ }
734
+ /**
735
+ * 获取 der 编码比特流16进制串
736
+ */
737
+ getEncodedHex() {
738
+ return this.tlv || (this.v = this.getValue(), this.l = this.getLength(), this.tlv = this.t + this.l + this.v), this.tlv;
739
+ }
740
+ getLength() {
741
+ const p = this.v.length / 2;
742
+ let d = p.toString(16);
743
+ return d.length % 2 === 1 && (d = "0" + d), p < 128 ? d : (128 + d.length / 2).toString(16) + d;
744
+ }
745
+ getValue() {
746
+ return "";
747
+ }
748
+ }
749
+ class T extends S {
750
+ constructor(p) {
751
+ super(), this.t = "02", p && (this.v = z(p));
752
+ }
753
+ getValue() {
754
+ return this.v;
755
+ }
756
+ }
757
+ class I extends S {
758
+ constructor(p) {
759
+ super(), this.t = "30", this.asn1Array = p;
760
+ }
761
+ getValue() {
762
+ return this.v = this.asn1Array.map((p) => p.getEncodedHex()).join(""), this.v;
763
+ }
764
+ }
765
+ function r(y, p) {
766
+ return +y[p + 2] < 8 ? 1 : +y.substr(p + 2, 2) & 128;
767
+ }
768
+ function g(y, p) {
769
+ const d = r(y, p), w = y.substr(p + 2, d * 2);
770
+ return w ? (+w[0] < 8 ? new v(w, 16) : new v(w.substr(2), 16)).intValue() : -1;
771
+ }
772
+ function c(y, p) {
773
+ const d = r(y, p);
774
+ return p + (d + 1) * 2;
775
+ }
776
+ return mt = {
777
+ /**
778
+ * ASN.1 der 编码,针对 sm2 签名
779
+ */
780
+ encodeDer(y, p) {
781
+ const d = new T(y), w = new T(p);
782
+ return new I([d, w]).getEncodedHex();
783
+ },
784
+ /**
785
+ * 解析 ASN.1 der,针对 sm2 验签
786
+ */
787
+ decodeDer(y) {
788
+ const p = c(y, 0), d = c(y, p), w = g(y, p), B = y.substr(d, w * 2), E = d + B.length, D = c(y, E), M = g(y, E), f = y.substr(D, M * 2), l = new v(B, 16), h = new v(f, 16);
789
+ return { r: l, s: h };
790
+ }
791
+ }, mt;
792
+ }
793
+ var vt, Ct;
794
+ function pi() {
795
+ if (Ct) return vt;
796
+ Ct = 1;
797
+ const { BigInteger: v } = lt(), z = new v("2"), S = new v("3");
798
+ class T {
799
+ constructor(c, y) {
800
+ this.x = y, this.q = c;
801
+ }
802
+ /**
803
+ * 判断相等
804
+ */
805
+ equals(c) {
806
+ return c === this ? !0 : this.q.equals(c.q) && this.x.equals(c.x);
807
+ }
808
+ /**
809
+ * 返回具体数值
810
+ */
811
+ toBigInteger() {
812
+ return this.x;
813
+ }
814
+ /**
815
+ * 取反
816
+ */
817
+ negate() {
818
+ return new T(this.q, this.x.negate().mod(this.q));
819
+ }
820
+ /**
821
+ * 相加
822
+ */
823
+ add(c) {
824
+ return new T(this.q, this.x.add(c.toBigInteger()).mod(this.q));
825
+ }
826
+ /**
827
+ * 相减
828
+ */
829
+ subtract(c) {
830
+ return new T(this.q, this.x.subtract(c.toBigInteger()).mod(this.q));
831
+ }
832
+ /**
833
+ * 相乘
834
+ */
835
+ multiply(c) {
836
+ return new T(this.q, this.x.multiply(c.toBigInteger()).mod(this.q));
837
+ }
838
+ /**
839
+ * 相除
840
+ */
841
+ divide(c) {
842
+ return new T(this.q, this.x.multiply(c.toBigInteger().modInverse(this.q)).mod(this.q));
843
+ }
844
+ /**
845
+ * 平方
846
+ */
847
+ square() {
848
+ return new T(this.q, this.x.square().mod(this.q));
849
+ }
850
+ }
851
+ class I {
852
+ constructor(c, y, p, d) {
853
+ this.curve = c, this.x = y, this.y = p, this.z = d ?? v.ONE, this.zinv = null;
854
+ }
855
+ getX() {
856
+ return this.zinv === null && (this.zinv = this.z.modInverse(this.curve.q)), this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q));
857
+ }
858
+ getY() {
859
+ return this.zinv === null && (this.zinv = this.z.modInverse(this.curve.q)), this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q));
860
+ }
861
+ /**
862
+ * 判断相等
863
+ */
864
+ equals(c) {
865
+ return c === this ? !0 : this.isInfinity() ? c.isInfinity() : c.isInfinity() ? this.isInfinity() : c.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(c.z)).mod(this.curve.q).equals(v.ZERO) ? c.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(c.z)).mod(this.curve.q).equals(v.ZERO) : !1;
866
+ }
867
+ /**
868
+ * 是否是无穷远点
869
+ */
870
+ isInfinity() {
871
+ return this.x === null && this.y === null ? !0 : this.z.equals(v.ZERO) && !this.y.toBigInteger().equals(v.ZERO);
872
+ }
873
+ /**
874
+ * 取反,x 轴对称点
875
+ */
876
+ negate() {
877
+ return new I(this.curve, this.x, this.y.negate(), this.z);
878
+ }
879
+ /**
880
+ * 相加
881
+ *
882
+ * 标准射影坐标系:
883
+ *
884
+ * λ1 = x1 * z2
885
+ * λ2 = x2 * z1
886
+ * λ3 = λ1 − λ2
887
+ * λ4 = y1 * z2
888
+ * λ5 = y2 * z1
889
+ * λ6 = λ4 − λ5
890
+ * λ7 = λ1 + λ2
891
+ * λ8 = z1 * z2
892
+ * λ9 = λ3^2
893
+ * λ10 = λ3 * λ9
894
+ * λ11 = λ8 * λ6^2 − λ7 * λ9
895
+ * x3 = λ3 * λ11
896
+ * y3 = λ6 * (λ9 * λ1 − λ11) − λ4 * λ10
897
+ * z3 = λ10 * λ8
898
+ */
899
+ add(c) {
900
+ if (this.isInfinity()) return c;
901
+ if (c.isInfinity()) return this;
902
+ const y = this.x.toBigInteger(), p = this.y.toBigInteger(), d = this.z, w = c.x.toBigInteger(), B = c.y.toBigInteger(), E = c.z, D = this.curve.q, M = y.multiply(E).mod(D), f = w.multiply(d).mod(D), l = M.subtract(f), h = p.multiply(E).mod(D), o = B.multiply(d).mod(D), x = h.subtract(o);
903
+ if (v.ZERO.equals(l))
904
+ return v.ZERO.equals(x) ? this.twice() : this.curve.infinity;
905
+ const s = M.add(f), m = d.multiply(E).mod(D), R = l.square().mod(D), P = l.multiply(R).mod(D), C = m.multiply(x.square()).subtract(s.multiply(R)).mod(D), N = l.multiply(C).mod(D), q = x.multiply(R.multiply(M).subtract(C)).subtract(h.multiply(P)).mod(D), O = P.multiply(m).mod(D);
906
+ return new I(this.curve, this.curve.fromBigInteger(N), this.curve.fromBigInteger(q), O);
907
+ }
908
+ /**
909
+ * 自加
910
+ *
911
+ * 标准射影坐标系:
912
+ *
913
+ * λ1 = 3 * x1^2 + a * z1^2
914
+ * λ2 = 2 * y1 * z1
915
+ * λ3 = y1^2
916
+ * λ4 = λ3 * x1 * z1
917
+ * λ5 = λ2^2
918
+ * λ6 = λ1^2 − 8 * λ4
919
+ * x3 = λ2 * λ6
920
+ * y3 = λ1 * (4 * λ4 − λ6) − 2 * λ5 * λ3
921
+ * z3 = λ2 * λ5
922
+ */
923
+ twice() {
924
+ if (this.isInfinity()) return this;
925
+ if (!this.y.toBigInteger().signum()) return this.curve.infinity;
926
+ const c = this.x.toBigInteger(), y = this.y.toBigInteger(), p = this.z, d = this.curve.q, w = this.curve.a.toBigInteger(), B = c.square().multiply(S).add(w.multiply(p.square())).mod(d), E = y.shiftLeft(1).multiply(p).mod(d), D = y.square().mod(d), M = D.multiply(c).multiply(p).mod(d), f = E.square().mod(d), l = B.square().subtract(M.shiftLeft(3)).mod(d), h = E.multiply(l).mod(d), o = B.multiply(M.shiftLeft(2).subtract(l)).subtract(f.shiftLeft(1).multiply(D)).mod(d), x = E.multiply(f).mod(d);
927
+ return new I(this.curve, this.curve.fromBigInteger(h), this.curve.fromBigInteger(o), x);
928
+ }
929
+ /**
930
+ * 倍点计算
931
+ */
932
+ multiply(c) {
933
+ if (this.isInfinity()) return this;
934
+ if (!c.signum()) return this.curve.infinity;
935
+ const y = c.multiply(S), p = this.negate();
936
+ let d = this;
937
+ for (let w = y.bitLength() - 2; w > 0; w--) {
938
+ d = d.twice();
939
+ const B = y.testBit(w), E = c.testBit(w);
940
+ B !== E && (d = d.add(B ? this : p));
941
+ }
942
+ return d;
943
+ }
944
+ }
945
+ class r {
946
+ constructor(c, y, p) {
947
+ this.q = c, this.a = this.fromBigInteger(y), this.b = this.fromBigInteger(p), this.infinity = new I(this, null, null);
948
+ }
949
+ /**
950
+ * 判断两个椭圆曲线是否相等
951
+ */
952
+ equals(c) {
953
+ return c === this ? !0 : this.q.equals(c.q) && this.a.equals(c.a) && this.b.equals(c.b);
954
+ }
955
+ /**
956
+ * 生成椭圆曲线域元素
957
+ */
958
+ fromBigInteger(c) {
959
+ return new T(this.q, c);
960
+ }
961
+ /**
962
+ * 解析 16 进制串为椭圆曲线点
963
+ */
964
+ decodePointHex(c) {
965
+ switch (parseInt(c.substr(0, 2), 16)) {
966
+ // 第一个字节
967
+ case 0:
968
+ return this.infinity;
969
+ case 2:
970
+ case 3:
971
+ const y = this.fromBigInteger(new v(c.substr(2), 16));
972
+ let p = this.fromBigInteger(y.multiply(y.square()).add(
973
+ y.multiply(this.a)
974
+ ).add(this.b).toBigInteger().modPow(
975
+ this.q.divide(new v("4")).add(v.ONE),
976
+ this.q
977
+ ));
978
+ return p.toBigInteger().mod(z).equals(new v(c.substr(0, 2), 16).subtract(z)) || (p = p.negate()), new I(this, y, p);
979
+ case 4:
980
+ case 6:
981
+ case 7:
982
+ const d = (c.length - 2) / 2, w = c.substr(2, d), B = c.substr(d + 2, d);
983
+ return new I(this, this.fromBigInteger(new v(w, 16)), this.fromBigInteger(new v(B, 16)));
984
+ default:
985
+ return null;
986
+ }
987
+ }
988
+ }
989
+ return vt = {
990
+ ECPointFp: I,
991
+ ECCurveFp: r
992
+ }, vt;
993
+ }
994
+ var yt, Ot;
995
+ function di() {
996
+ if (Ot) return yt;
997
+ Ot = 1;
998
+ const { BigInteger: v, SecureRandom: z } = lt(), { ECCurveFp: S } = pi(), T = new z(), { curve: I, G: r, n: g } = y();
999
+ function c() {
1000
+ return I;
1001
+ }
1002
+ function y() {
1003
+ const h = new v("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", 16), o = new v("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16), x = new v("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", 16), s = new S(h, o, x), P = s.decodePointHex("04" + "32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7" + "BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0"), C = new v("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16);
1004
+ return { curve: s, G: P, n: C };
1005
+ }
1006
+ function p(h, o, x) {
1007
+ const m = (h ? new v(h, o, x) : new v(g.bitLength(), T)).mod(g.subtract(v.ONE)).add(v.ONE), R = B(m.toString(16), 64), P = r.multiply(m), C = B(P.getX().toBigInteger().toString(16), 64), N = B(P.getY().toBigInteger().toString(16), 64), q = "04" + C + N;
1008
+ return { privateKey: R, publicKey: q };
1009
+ }
1010
+ function d(h) {
1011
+ if (h.length !== 130) throw new Error("Invalid public key to compress");
1012
+ const o = (h.length - 2) / 2, x = h.substr(2, o), s = new v(h.substr(o + 2, o), 16);
1013
+ let m = "03";
1014
+ return s.mod(new v("2")).equals(v.ZERO) && (m = "02"), m + x;
1015
+ }
1016
+ function w(h) {
1017
+ h = unescape(encodeURIComponent(h));
1018
+ const o = h.length, x = [];
1019
+ for (let m = 0; m < o; m++)
1020
+ x[m >>> 2] |= (h.charCodeAt(m) & 255) << 24 - m % 4 * 8;
1021
+ const s = [];
1022
+ for (let m = 0; m < o; m++) {
1023
+ const R = x[m >>> 2] >>> 24 - m % 4 * 8 & 255;
1024
+ s.push((R >>> 4).toString(16)), s.push((R & 15).toString(16));
1025
+ }
1026
+ return s.join("");
1027
+ }
1028
+ function B(h, o) {
1029
+ return h.length >= o ? h : new Array(o - h.length + 1).join("0") + h;
1030
+ }
1031
+ function E(h) {
1032
+ return h.map((o) => (o = o.toString(16), o.length === 1 ? "0" + o : o)).join("");
1033
+ }
1034
+ function D(h) {
1035
+ const o = [];
1036
+ let x = 0;
1037
+ for (let s = 0; s < h.length * 2; s += 2)
1038
+ o[s >>> 3] |= parseInt(h[x], 10) << 24 - s % 8 * 4, x++;
1039
+ try {
1040
+ const s = [];
1041
+ for (let m = 0; m < h.length; m++) {
1042
+ const R = o[m >>> 2] >>> 24 - m % 4 * 8 & 255;
1043
+ s.push(String.fromCharCode(R));
1044
+ }
1045
+ return decodeURIComponent(escape(s.join("")));
1046
+ } catch {
1047
+ throw new Error("Malformed UTF-8 data");
1048
+ }
1049
+ }
1050
+ function M(h) {
1051
+ const o = [];
1052
+ let x = h.length;
1053
+ x % 2 !== 0 && (h = B(h, x + 1)), x = h.length;
1054
+ for (let s = 0; s < x; s += 2)
1055
+ o.push(parseInt(h.substr(s, 2), 16));
1056
+ return o;
1057
+ }
1058
+ function f(h) {
1059
+ const o = I.decodePointHex(h);
1060
+ if (!o) return !1;
1061
+ const x = o.getX();
1062
+ return o.getY().square().equals(x.multiply(x.square()).add(x.multiply(I.a)).add(I.b));
1063
+ }
1064
+ function l(h, o) {
1065
+ const x = I.decodePointHex(h);
1066
+ if (!x) return !1;
1067
+ const s = I.decodePointHex(o);
1068
+ return s ? x.equals(s) : !1;
1069
+ }
1070
+ return yt = {
1071
+ getGlobalCurve: c,
1072
+ generateEcparam: y,
1073
+ generateKeyPairHex: p,
1074
+ compressPublicKeyHex: d,
1075
+ utf8ToHex: w,
1076
+ leftPad: B,
1077
+ arrayToHex: E,
1078
+ arrayToUtf8: D,
1079
+ hexToArray: M,
1080
+ verifyPublicKey: f,
1081
+ comparePublicKeyHex: l
1082
+ }, yt;
1083
+ }
1084
+ var bt, Ht;
1085
+ function kt() {
1086
+ if (Ht) return bt;
1087
+ Ht = 1;
1088
+ const v = new Uint32Array(68), z = new Uint32Array(64);
1089
+ function S(w, B) {
1090
+ const E = B & 31;
1091
+ return w << E | w >>> 32 - E;
1092
+ }
1093
+ function T(w, B) {
1094
+ const E = [];
1095
+ for (let D = w.length - 1; D >= 0; D--) E[D] = (w[D] ^ B[D]) & 255;
1096
+ return E;
1097
+ }
1098
+ function I(w) {
1099
+ return w ^ S(w, 9) ^ S(w, 17);
1100
+ }
1101
+ function r(w) {
1102
+ return w ^ S(w, 15) ^ S(w, 23);
1103
+ }
1104
+ function g(w) {
1105
+ let B = w.length * 8, E = B % 512;
1106
+ E = E >= 448 ? 512 - E % 448 - 1 : 448 - E - 1;
1107
+ const D = new Array((E - 7) / 8), M = new Array(8);
1108
+ for (let s = 0, m = D.length; s < m; s++) D[s] = 0;
1109
+ for (let s = 0, m = M.length; s < m; s++) M[s] = 0;
1110
+ B = B.toString(2);
1111
+ for (let s = 7; s >= 0; s--)
1112
+ if (B.length > 8) {
1113
+ const m = B.length - 8;
1114
+ M[s] = parseInt(B.substr(m), 2), B = B.substr(0, m);
1115
+ } else B.length > 0 && (M[s] = parseInt(B, 2), B = "");
1116
+ const f = new Uint8Array([...w, 128, ...D, ...M]), l = new DataView(f.buffer, 0), h = f.length / 64, o = new Uint32Array([1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214]);
1117
+ for (let s = 0; s < h; s++) {
1118
+ v.fill(0), z.fill(0);
1119
+ const m = 16 * s;
1120
+ for (let A = 0; A < 16; A++)
1121
+ v[A] = l.getUint32((m + A) * 4, !1);
1122
+ for (let A = 16; A < 68; A++)
1123
+ v[A] = r(v[A - 16] ^ v[A - 9] ^ S(v[A - 3], 15)) ^ S(v[A - 13], 7) ^ v[A - 6];
1124
+ for (let A = 0; A < 64; A++)
1125
+ z[A] = v[A] ^ v[A + 4];
1126
+ const R = 2043430169, P = 2055708042;
1127
+ let C = o[0], N = o[1], q = o[2], O = o[3], H = o[4], L = o[5], Z = o[6], W = o[7], G, nt, st, ot, ft;
1128
+ for (let A = 0; A < 64; A++)
1129
+ ft = A >= 0 && A <= 15 ? R : P, G = S(S(C, 12) + H + S(ft, A), 7), nt = G ^ S(C, 12), st = (A >= 0 && A <= 15 ? C ^ N ^ q : C & N | C & q | N & q) + O + nt + z[A], ot = (A >= 0 && A <= 15 ? H ^ L ^ Z : H & L | ~H & Z) + W + G + v[A], O = q, q = S(N, 9), N = C, C = st, W = Z, Z = S(L, 19), L = H, H = I(ot);
1130
+ o[0] ^= C, o[1] ^= N, o[2] ^= q, o[3] ^= O, o[4] ^= H, o[5] ^= L, o[6] ^= Z, o[7] ^= W;
1131
+ }
1132
+ const x = [];
1133
+ for (let s = 0, m = o.length; s < m; s++) {
1134
+ const R = o[s];
1135
+ x.push((R & 4278190080) >>> 24, (R & 16711680) >>> 16, (R & 65280) >>> 8, R & 255);
1136
+ }
1137
+ return x;
1138
+ }
1139
+ const c = 64, y = new Uint8Array(c), p = new Uint8Array(c);
1140
+ for (let w = 0; w < c; w++)
1141
+ y[w] = 54, p[w] = 92;
1142
+ function d(w, B) {
1143
+ for (B.length > c && (B = g(B)); B.length < c; ) B.push(0);
1144
+ const E = T(B, y), D = T(B, p), M = g([...E, ...w]);
1145
+ return g([...D, ...M]);
1146
+ }
1147
+ return bt = {
1148
+ sm3: g,
1149
+ hmac: d
1150
+ }, bt;
1151
+ }
1152
+ var Tt, Nt;
1153
+ function gi() {
1154
+ if (Nt) return Tt;
1155
+ Nt = 1;
1156
+ const { BigInteger: v } = lt(), { encodeDer: z, decodeDer: S } = xi(), T = di(), I = kt().sm3, { G: r, curve: g, n: c } = T.generateEcparam(), y = 0;
1157
+ function p(f, l, h = 1) {
1158
+ f = typeof f == "string" ? T.hexToArray(T.utf8ToHex(f)) : Array.prototype.slice.call(f), l = T.getGlobalCurve().decodePointHex(l);
1159
+ const o = T.generateKeyPairHex(), x = new v(o.privateKey, 16);
1160
+ let s = o.publicKey;
1161
+ s.length > 128 && (s = s.substr(s.length - 128));
1162
+ const m = l.multiply(x), R = T.hexToArray(T.leftPad(m.getX().toBigInteger().toRadix(16), 64)), P = T.hexToArray(T.leftPad(m.getY().toBigInteger().toRadix(16), 64)), C = T.arrayToHex(I([].concat(R, f, P)));
1163
+ let N = 1, q = 0, O = [];
1164
+ const H = [].concat(R, P), L = () => {
1165
+ O = I([...H, N >> 24 & 255, N >> 16 & 255, N >> 8 & 255, N & 255]), N++, q = 0;
1166
+ };
1167
+ L();
1168
+ for (let W = 0, G = f.length; W < G; W++)
1169
+ q === O.length && L(), f[W] ^= O[q++] & 255;
1170
+ const Z = T.arrayToHex(f);
1171
+ return h === y ? s + Z + C : s + C + Z;
1172
+ }
1173
+ function d(f, l, h = 1, {
1174
+ output: o = "string"
1175
+ } = {}) {
1176
+ l = new v(l, 16);
1177
+ let x = f.substr(128, 64), s = f.substr(192);
1178
+ h === y && (x = f.substr(f.length - 64), s = f.substr(128, f.length - 128 - 64));
1179
+ const m = T.hexToArray(s), P = T.getGlobalCurve().decodePointHex("04" + f.substr(0, 128)).multiply(l), C = T.hexToArray(T.leftPad(P.getX().toBigInteger().toRadix(16), 64)), N = T.hexToArray(T.leftPad(P.getY().toBigInteger().toRadix(16), 64));
1180
+ let q = 1, O = 0, H = [];
1181
+ const L = [].concat(C, N), Z = () => {
1182
+ H = I([...L, q >> 24 & 255, q >> 16 & 255, q >> 8 & 255, q & 255]), q++, O = 0;
1183
+ };
1184
+ Z();
1185
+ for (let G = 0, nt = m.length; G < nt; G++)
1186
+ O === H.length && Z(), m[G] ^= H[O++] & 255;
1187
+ return T.arrayToHex(I([].concat(C, m, N))) === x.toLowerCase() ? o === "array" ? m : T.arrayToUtf8(m) : o === "array" ? [] : "";
1188
+ }
1189
+ function w(f, l, {
1190
+ pointPool: h,
1191
+ der: o,
1192
+ hash: x,
1193
+ publicKey: s,
1194
+ userId: m
1195
+ } = {}) {
1196
+ let R = typeof f == "string" ? T.utf8ToHex(f) : T.arrayToHex(f);
1197
+ x && (s = s || D(l), R = E(R, s, m));
1198
+ const P = new v(l, 16), C = new v(R, 16);
1199
+ let N = null, q = null, O = null;
1200
+ do {
1201
+ do {
1202
+ let H;
1203
+ h && h.length ? H = h.pop() : H = M(), N = H.k, q = C.add(H.x1).mod(c);
1204
+ } while (q.equals(v.ZERO) || q.add(N).equals(c));
1205
+ O = P.add(v.ONE).modInverse(c).multiply(N.subtract(q.multiply(P))).mod(c);
1206
+ } while (O.equals(v.ZERO));
1207
+ return o ? z(q, O) : T.leftPad(q.toString(16), 64) + T.leftPad(O.toString(16), 64);
1208
+ }
1209
+ function B(f, l, h, { der: o, hash: x, userId: s } = {}) {
1210
+ let m = typeof f == "string" ? T.utf8ToHex(f) : T.arrayToHex(f);
1211
+ x && (m = E(m, h, s));
1212
+ let R, P;
1213
+ if (o) {
1214
+ const L = S(l);
1215
+ R = L.r, P = L.s;
1216
+ } else
1217
+ R = new v(l.substring(0, 64), 16), P = new v(l.substring(64), 16);
1218
+ const C = g.decodePointHex(h), N = new v(m, 16), q = R.add(P).mod(c);
1219
+ if (q.equals(v.ZERO)) return !1;
1220
+ const O = r.multiply(P).add(C.multiply(q)), H = N.add(O.getX().toBigInteger()).mod(c);
1221
+ return R.equals(H);
1222
+ }
1223
+ function E(f, l, h = "1234567812345678") {
1224
+ h = T.utf8ToHex(h);
1225
+ const o = T.leftPad(r.curve.a.toBigInteger().toRadix(16), 64), x = T.leftPad(r.curve.b.toBigInteger().toRadix(16), 64), s = T.leftPad(r.getX().toBigInteger().toRadix(16), 64), m = T.leftPad(r.getY().toBigInteger().toRadix(16), 64);
1226
+ let R, P;
1227
+ if (l.length === 128)
1228
+ R = l.substr(0, 64), P = l.substr(64, 64);
1229
+ else {
1230
+ const O = r.curve.decodePointHex(l);
1231
+ R = T.leftPad(O.getX().toBigInteger().toRadix(16), 64), P = T.leftPad(O.getY().toBigInteger().toRadix(16), 64);
1232
+ }
1233
+ const C = T.hexToArray(h + o + x + s + m + R + P), N = h.length * 4;
1234
+ C.unshift(N & 255), C.unshift(N >> 8 & 255);
1235
+ const q = I(C);
1236
+ return T.arrayToHex(I(q.concat(T.hexToArray(f))));
1237
+ }
1238
+ function D(f) {
1239
+ const l = r.multiply(new v(f, 16)), h = T.leftPad(l.getX().toBigInteger().toString(16), 64), o = T.leftPad(l.getY().toBigInteger().toString(16), 64);
1240
+ return "04" + h + o;
1241
+ }
1242
+ function M() {
1243
+ const f = T.generateKeyPairHex(), l = g.decodePointHex(f.publicKey);
1244
+ return f.k = new v(f.privateKey, 16), f.x1 = l.getX().toBigInteger(), f;
1245
+ }
1246
+ return Tt = {
1247
+ generateKeyPairHex: T.generateKeyPairHex,
1248
+ compressPublicKeyHex: T.compressPublicKeyHex,
1249
+ comparePublicKeyHex: T.comparePublicKeyHex,
1250
+ doEncrypt: p,
1251
+ doDecrypt: d,
1252
+ doSignature: w,
1253
+ doVerifySignature: B,
1254
+ getPublicKeyFromPrivateKey: D,
1255
+ getPoint: M,
1256
+ verifyPublicKey: T.verifyPublicKey
1257
+ }, Tt;
1258
+ }
1259
+ var wt, Lt;
1260
+ function mi() {
1261
+ if (Lt) return wt;
1262
+ Lt = 1;
1263
+ const { sm3: v, hmac: z } = kt();
1264
+ function S(g, c) {
1265
+ return g.length >= c ? g : new Array(c - g.length + 1).join("0") + g;
1266
+ }
1267
+ function T(g) {
1268
+ return g.map((c) => (c = c.toString(16), c.length === 1 ? "0" + c : c)).join("");
1269
+ }
1270
+ function I(g) {
1271
+ const c = [];
1272
+ let y = g.length;
1273
+ y % 2 !== 0 && (g = S(g, y + 1)), y = g.length;
1274
+ for (let p = 0; p < y; p += 2)
1275
+ c.push(parseInt(g.substr(p, 2), 16));
1276
+ return c;
1277
+ }
1278
+ function r(g) {
1279
+ const c = [];
1280
+ for (let y = 0, p = g.length; y < p; y++) {
1281
+ const d = g.codePointAt(y);
1282
+ if (d <= 127)
1283
+ c.push(d);
1284
+ else if (d <= 2047)
1285
+ c.push(192 | d >>> 6), c.push(128 | d & 63);
1286
+ else if (d <= 55295 || d >= 57344 && d <= 65535)
1287
+ c.push(224 | d >>> 12), c.push(128 | d >>> 6 & 63), c.push(128 | d & 63);
1288
+ else if (d >= 65536 && d <= 1114111)
1289
+ y++, c.push(240 | d >>> 18 & 28), c.push(128 | d >>> 12 & 63), c.push(128 | d >>> 6 & 63), c.push(128 | d & 63);
1290
+ else
1291
+ throw c.push(d), new Error("input is not supported");
1292
+ }
1293
+ return c;
1294
+ }
1295
+ return wt = function(g, c) {
1296
+ if (g = typeof g == "string" ? r(g) : Array.prototype.slice.call(g), c) {
1297
+ if ((c.mode || "hmac") !== "hmac") throw new Error("invalid mode");
1298
+ let p = c.key;
1299
+ if (!p) throw new Error("invalid key");
1300
+ return p = typeof p == "string" ? I(p) : Array.prototype.slice.call(p), T(z(g, p));
1301
+ }
1302
+ return T(v(g));
1303
+ }, wt;
1304
+ }
1305
+ var Ft, Vt;
1306
+ function vi() {
1307
+ if (Vt) return Ft;
1308
+ Vt = 1;
1309
+ const v = 0, z = 32, S = 16, T = [
1310
+ 214,
1311
+ 144,
1312
+ 233,
1313
+ 254,
1314
+ 204,
1315
+ 225,
1316
+ 61,
1317
+ 183,
1318
+ 22,
1319
+ 182,
1320
+ 20,
1321
+ 194,
1322
+ 40,
1323
+ 251,
1324
+ 44,
1325
+ 5,
1326
+ 43,
1327
+ 103,
1328
+ 154,
1329
+ 118,
1330
+ 42,
1331
+ 190,
1332
+ 4,
1333
+ 195,
1334
+ 170,
1335
+ 68,
1336
+ 19,
1337
+ 38,
1338
+ 73,
1339
+ 134,
1340
+ 6,
1341
+ 153,
1342
+ 156,
1343
+ 66,
1344
+ 80,
1345
+ 244,
1346
+ 145,
1347
+ 239,
1348
+ 152,
1349
+ 122,
1350
+ 51,
1351
+ 84,
1352
+ 11,
1353
+ 67,
1354
+ 237,
1355
+ 207,
1356
+ 172,
1357
+ 98,
1358
+ 228,
1359
+ 179,
1360
+ 28,
1361
+ 169,
1362
+ 201,
1363
+ 8,
1364
+ 232,
1365
+ 149,
1366
+ 128,
1367
+ 223,
1368
+ 148,
1369
+ 250,
1370
+ 117,
1371
+ 143,
1372
+ 63,
1373
+ 166,
1374
+ 71,
1375
+ 7,
1376
+ 167,
1377
+ 252,
1378
+ 243,
1379
+ 115,
1380
+ 23,
1381
+ 186,
1382
+ 131,
1383
+ 89,
1384
+ 60,
1385
+ 25,
1386
+ 230,
1387
+ 133,
1388
+ 79,
1389
+ 168,
1390
+ 104,
1391
+ 107,
1392
+ 129,
1393
+ 178,
1394
+ 113,
1395
+ 100,
1396
+ 218,
1397
+ 139,
1398
+ 248,
1399
+ 235,
1400
+ 15,
1401
+ 75,
1402
+ 112,
1403
+ 86,
1404
+ 157,
1405
+ 53,
1406
+ 30,
1407
+ 36,
1408
+ 14,
1409
+ 94,
1410
+ 99,
1411
+ 88,
1412
+ 209,
1413
+ 162,
1414
+ 37,
1415
+ 34,
1416
+ 124,
1417
+ 59,
1418
+ 1,
1419
+ 33,
1420
+ 120,
1421
+ 135,
1422
+ 212,
1423
+ 0,
1424
+ 70,
1425
+ 87,
1426
+ 159,
1427
+ 211,
1428
+ 39,
1429
+ 82,
1430
+ 76,
1431
+ 54,
1432
+ 2,
1433
+ 231,
1434
+ 160,
1435
+ 196,
1436
+ 200,
1437
+ 158,
1438
+ 234,
1439
+ 191,
1440
+ 138,
1441
+ 210,
1442
+ 64,
1443
+ 199,
1444
+ 56,
1445
+ 181,
1446
+ 163,
1447
+ 247,
1448
+ 242,
1449
+ 206,
1450
+ 249,
1451
+ 97,
1452
+ 21,
1453
+ 161,
1454
+ 224,
1455
+ 174,
1456
+ 93,
1457
+ 164,
1458
+ 155,
1459
+ 52,
1460
+ 26,
1461
+ 85,
1462
+ 173,
1463
+ 147,
1464
+ 50,
1465
+ 48,
1466
+ 245,
1467
+ 140,
1468
+ 177,
1469
+ 227,
1470
+ 29,
1471
+ 246,
1472
+ 226,
1473
+ 46,
1474
+ 130,
1475
+ 102,
1476
+ 202,
1477
+ 96,
1478
+ 192,
1479
+ 41,
1480
+ 35,
1481
+ 171,
1482
+ 13,
1483
+ 83,
1484
+ 78,
1485
+ 111,
1486
+ 213,
1487
+ 219,
1488
+ 55,
1489
+ 69,
1490
+ 222,
1491
+ 253,
1492
+ 142,
1493
+ 47,
1494
+ 3,
1495
+ 255,
1496
+ 106,
1497
+ 114,
1498
+ 109,
1499
+ 108,
1500
+ 91,
1501
+ 81,
1502
+ 141,
1503
+ 27,
1504
+ 175,
1505
+ 146,
1506
+ 187,
1507
+ 221,
1508
+ 188,
1509
+ 127,
1510
+ 17,
1511
+ 217,
1512
+ 92,
1513
+ 65,
1514
+ 31,
1515
+ 16,
1516
+ 90,
1517
+ 216,
1518
+ 10,
1519
+ 193,
1520
+ 49,
1521
+ 136,
1522
+ 165,
1523
+ 205,
1524
+ 123,
1525
+ 189,
1526
+ 45,
1527
+ 116,
1528
+ 208,
1529
+ 18,
1530
+ 184,
1531
+ 229,
1532
+ 180,
1533
+ 176,
1534
+ 137,
1535
+ 105,
1536
+ 151,
1537
+ 74,
1538
+ 12,
1539
+ 150,
1540
+ 119,
1541
+ 126,
1542
+ 101,
1543
+ 185,
1544
+ 241,
1545
+ 9,
1546
+ 197,
1547
+ 110,
1548
+ 198,
1549
+ 132,
1550
+ 24,
1551
+ 240,
1552
+ 125,
1553
+ 236,
1554
+ 58,
1555
+ 220,
1556
+ 77,
1557
+ 32,
1558
+ 121,
1559
+ 238,
1560
+ 95,
1561
+ 62,
1562
+ 215,
1563
+ 203,
1564
+ 57,
1565
+ 72
1566
+ ], I = [
1567
+ 462357,
1568
+ 472066609,
1569
+ 943670861,
1570
+ 1415275113,
1571
+ 1886879365,
1572
+ 2358483617,
1573
+ 2830087869,
1574
+ 3301692121,
1575
+ 3773296373,
1576
+ 4228057617,
1577
+ 404694573,
1578
+ 876298825,
1579
+ 1347903077,
1580
+ 1819507329,
1581
+ 2291111581,
1582
+ 2762715833,
1583
+ 3234320085,
1584
+ 3705924337,
1585
+ 4177462797,
1586
+ 337322537,
1587
+ 808926789,
1588
+ 1280531041,
1589
+ 1752135293,
1590
+ 2223739545,
1591
+ 2695343797,
1592
+ 3166948049,
1593
+ 3638552301,
1594
+ 4110090761,
1595
+ 269950501,
1596
+ 741554753,
1597
+ 1213159005,
1598
+ 1684763257
1599
+ ];
1600
+ function r(f) {
1601
+ const l = [];
1602
+ for (let h = 0, o = f.length; h < o; h += 2)
1603
+ l.push(parseInt(f.substr(h, 2), 16));
1604
+ return l;
1605
+ }
1606
+ function g(f) {
1607
+ return f.map((l) => (l = l.toString(16), l.length === 1 ? "0" + l : l)).join("");
1608
+ }
1609
+ function c(f) {
1610
+ const l = [];
1611
+ for (let h = 0, o = f.length; h < o; h++) {
1612
+ const x = f.codePointAt(h);
1613
+ if (x <= 127)
1614
+ l.push(x);
1615
+ else if (x <= 2047)
1616
+ l.push(192 | x >>> 6), l.push(128 | x & 63);
1617
+ else if (x <= 55295 || x >= 57344 && x <= 65535)
1618
+ l.push(224 | x >>> 12), l.push(128 | x >>> 6 & 63), l.push(128 | x & 63);
1619
+ else if (x >= 65536 && x <= 1114111)
1620
+ h++, l.push(240 | x >>> 18 & 28), l.push(128 | x >>> 12 & 63), l.push(128 | x >>> 6 & 63), l.push(128 | x & 63);
1621
+ else
1622
+ throw l.push(x), new Error("input is not supported");
1623
+ }
1624
+ return l;
1625
+ }
1626
+ function y(f) {
1627
+ const l = [];
1628
+ for (let h = 0, o = f.length; h < o; h++)
1629
+ f[h] >= 240 && f[h] <= 247 ? (l.push(String.fromCodePoint(((f[h] & 7) << 18) + ((f[h + 1] & 63) << 12) + ((f[h + 2] & 63) << 6) + (f[h + 3] & 63))), h += 3) : f[h] >= 224 && f[h] <= 239 ? (l.push(String.fromCodePoint(((f[h] & 15) << 12) + ((f[h + 1] & 63) << 6) + (f[h + 2] & 63))), h += 2) : f[h] >= 192 && f[h] <= 223 ? (l.push(String.fromCodePoint(((f[h] & 31) << 6) + (f[h + 1] & 63))), h++) : l.push(String.fromCodePoint(f[h]));
1630
+ return l.join("");
1631
+ }
1632
+ function p(f, l) {
1633
+ const h = l & 31;
1634
+ return f << h | f >>> 32 - h;
1635
+ }
1636
+ function d(f) {
1637
+ return (T[f >>> 24 & 255] & 255) << 24 | (T[f >>> 16 & 255] & 255) << 16 | (T[f >>> 8 & 255] & 255) << 8 | T[f & 255] & 255;
1638
+ }
1639
+ function w(f) {
1640
+ return f ^ p(f, 2) ^ p(f, 10) ^ p(f, 18) ^ p(f, 24);
1641
+ }
1642
+ function B(f) {
1643
+ return f ^ p(f, 13) ^ p(f, 23);
1644
+ }
1645
+ function E(f, l, h) {
1646
+ const o = new Array(4), x = new Array(4);
1647
+ for (let s = 0; s < 4; s++)
1648
+ x[0] = f[4 * s] & 255, x[1] = f[4 * s + 1] & 255, x[2] = f[4 * s + 2] & 255, x[3] = f[4 * s + 3] & 255, o[s] = x[0] << 24 | x[1] << 16 | x[2] << 8 | x[3];
1649
+ for (let s = 0, m; s < 32; s += 4)
1650
+ m = o[1] ^ o[2] ^ o[3] ^ h[s + 0], o[0] ^= w(d(m)), m = o[2] ^ o[3] ^ o[0] ^ h[s + 1], o[1] ^= w(d(m)), m = o[3] ^ o[0] ^ o[1] ^ h[s + 2], o[2] ^= w(d(m)), m = o[0] ^ o[1] ^ o[2] ^ h[s + 3], o[3] ^= w(d(m));
1651
+ for (let s = 0; s < 16; s += 4)
1652
+ l[s] = o[3 - s / 4] >>> 24 & 255, l[s + 1] = o[3 - s / 4] >>> 16 & 255, l[s + 2] = o[3 - s / 4] >>> 8 & 255, l[s + 3] = o[3 - s / 4] & 255;
1653
+ }
1654
+ function D(f, l, h) {
1655
+ const o = new Array(4), x = new Array(4);
1656
+ for (let s = 0; s < 4; s++)
1657
+ x[0] = f[0 + 4 * s] & 255, x[1] = f[1 + 4 * s] & 255, x[2] = f[2 + 4 * s] & 255, x[3] = f[3 + 4 * s] & 255, o[s] = x[0] << 24 | x[1] << 16 | x[2] << 8 | x[3];
1658
+ o[0] ^= 2746333894, o[1] ^= 1453994832, o[2] ^= 1736282519, o[3] ^= 2993693404;
1659
+ for (let s = 0, m; s < 32; s += 4)
1660
+ m = o[1] ^ o[2] ^ o[3] ^ I[s + 0], l[s + 0] = o[0] ^= B(d(m)), m = o[2] ^ o[3] ^ o[0] ^ I[s + 1], l[s + 1] = o[1] ^= B(d(m)), m = o[3] ^ o[0] ^ o[1] ^ I[s + 2], l[s + 2] = o[2] ^= B(d(m)), m = o[0] ^ o[1] ^ o[2] ^ I[s + 3], l[s + 3] = o[3] ^= B(d(m));
1661
+ if (h === v)
1662
+ for (let s = 0, m; s < 16; s++)
1663
+ m = l[s], l[s] = l[31 - s], l[31 - s] = m;
1664
+ }
1665
+ function M(f, l, h, {
1666
+ padding: o = "pkcs#7",
1667
+ mode: x,
1668
+ iv: s = [],
1669
+ output: m = "string"
1670
+ } = {}) {
1671
+ if (x === "cbc" && (typeof s == "string" && (s = r(s)), s.length !== 128 / 8))
1672
+ throw new Error("iv is invalid");
1673
+ if (typeof l == "string" && (l = r(l)), l.length !== 128 / 8)
1674
+ throw new Error("key is invalid");
1675
+ if (typeof f == "string" ? h !== v ? f = c(f) : f = r(f) : f = [...f], (o === "pkcs#5" || o === "pkcs#7") && h !== v) {
1676
+ const O = S - f.length % S;
1677
+ for (let H = 0; H < O; H++) f.push(O);
1678
+ }
1679
+ const R = new Array(z);
1680
+ D(l, R, h);
1681
+ const P = [];
1682
+ let C = s, N = f.length, q = 0;
1683
+ for (; N >= S; ) {
1684
+ const O = f.slice(q, q + 16), H = new Array(16);
1685
+ if (x === "cbc")
1686
+ for (let L = 0; L < S; L++)
1687
+ h !== v && (O[L] ^= C[L]);
1688
+ E(O, H, R);
1689
+ for (let L = 0; L < S; L++)
1690
+ x === "cbc" && h === v && (H[L] ^= C[L]), P[q + L] = H[L];
1691
+ x === "cbc" && (h !== v ? C = H : C = O), N -= S, q += S;
1692
+ }
1693
+ if ((o === "pkcs#5" || o === "pkcs#7") && h === v) {
1694
+ const O = P.length, H = P[O - 1];
1695
+ for (let L = 1; L <= H; L++)
1696
+ if (P[O - L] !== H) throw new Error("padding is invalid");
1697
+ P.splice(O - H, H);
1698
+ }
1699
+ return m !== "array" ? h !== v ? g(P) : y(P) : P;
1700
+ }
1701
+ return Ft = {
1702
+ encrypt(f, l, h) {
1703
+ return M(f, l, 1, h);
1704
+ },
1705
+ decrypt(f, l, h) {
1706
+ return M(f, l, 0, h);
1707
+ }
1708
+ }, Ft;
1709
+ }
1710
+ var Bt, zt;
1711
+ function yi() {
1712
+ return zt || (zt = 1, Bt = {
1713
+ sm2: gi(),
1714
+ sm3: mi(),
1715
+ sm4: vi()
1716
+ }), Bt;
1717
+ }
1718
+ var bi = yi();
1719
+ function Ti({
1720
+ uid: v = "",
1721
+ salt: z = "",
1722
+ ts: S = 0,
1723
+ data: T
1724
+ }) {
1725
+ const I = Date.now() + S, r = Math.random().toString(36).substring(2, 15), g = JSON.stringify(T ?? ""), c = `${I}${v}${r}${g}${z}`, y = bi.sm3(c);
1726
+ return {
1727
+ headers: {
1728
+ "X-Sign-Timestamp": String(I),
1729
+ "X-Sign-Nonce": r,
1730
+ "X-Sign-Client": y
1731
+ }
1732
+ };
1733
+ }
1734
+ function wi(v) {
1735
+ const z = ["script", "iframe", "object", "embed", "link", "meta", "style"], S = ["onerror", "onload", "onclick", "onmouseover", "onfocus", "onmouseenter", "onmouseleave"], T = (y) => /^javascript:/i.test(y) || /^data:text\/html/i.test(y), r = new DOMParser().parseFromString(`<div>${v}</div>`, "text/html"), g = r.body.firstChild;
1736
+ function c(y) {
1737
+ if (y.nodeType === Node.ELEMENT_NODE) {
1738
+ const p = y, d = p.tagName.toLowerCase();
1739
+ if (z.includes(d)) {
1740
+ const w = p.outerHTML, B = r.createTextNode(w);
1741
+ p.replaceWith(B);
1742
+ return;
1743
+ }
1744
+ [...p.attributes].forEach((w) => {
1745
+ const B = w.name.toLowerCase(), E = w.value;
1746
+ (S.includes(B) || T(E)) && p.removeAttribute(w.name);
1747
+ }), [...p.childNodes].forEach(c);
1748
+ }
1749
+ }
1750
+ return [...g.childNodes].forEach(c), g.innerHTML;
1751
+ }
1752
+ export {
1753
+ wi as htmlSanitize,
1754
+ Ti as transmissionDataEncryption
1755
+ };