@jaw.id/ui 0.4.2 → 0.4.4

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,1187 @@
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, I as s, J as c, K as l, L as u, M as d, O as f, P as p, R as m, S as h, T as g, X as _, Y as v, Z as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as E, h as D, i as O, k, l as ee, m as A, n as j, o as M, p as te, q as N, r as P, s as ne, t as F, u as I, v as L, w as re, x as R, y as ie, z as ae } from "./utils-so0pTN_S.js";
2
+ //#region ../../node_modules/@noble/hashes/esm/_md.js
3
+ function oe(e, t, n, r) {
4
+ if (typeof e.setBigUint64 == "function") return e.setBigUint64(t, n, r);
5
+ let i = BigInt(32), a = BigInt(4294967295), o = Number(n >> i & a), s = Number(n & a), c = r ? 4 : 0, l = r ? 0 : 4;
6
+ e.setUint32(t + c, o, r), e.setUint32(t + l, s, r);
7
+ }
8
+ function se(e, t, n) {
9
+ return e & t ^ ~e & n;
10
+ }
11
+ function ce(e, t, n) {
12
+ return e & t ^ e & n ^ t & n;
13
+ }
14
+ var le = class extends ie {
15
+ constructor(e, t, n, r) {
16
+ super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view = f(this.buffer);
17
+ }
18
+ update(e) {
19
+ R(this), e = d(e), S(e);
20
+ let { view: t, buffer: n, blockLen: r } = this, i = e.length;
21
+ for (let a = 0; a < i;) {
22
+ let o = Math.min(r - this.pos, i - a);
23
+ if (o === r) {
24
+ let t = f(e);
25
+ for (; r <= i - a; a += r) this.process(t, a);
26
+ continue;
27
+ }
28
+ n.set(e.subarray(a, a + o), this.pos), this.pos += o, a += o, this.pos === r && (this.process(t, 0), this.pos = 0);
29
+ }
30
+ return this.length += e.length, this.roundClean(), this;
31
+ }
32
+ digestInto(e) {
33
+ R(this), re(e, this), this.finished = !0;
34
+ let { buffer: t, view: n, blockLen: r, isLE: i } = this, { pos: a } = this;
35
+ t[a++] = 128, g(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(n, 0), a = 0);
36
+ for (let e = a; e < r; e++) t[e] = 0;
37
+ oe(n, r - 8, BigInt(this.length * 8), i), this.process(n, 0);
38
+ let o = f(e), s = this.outputLen;
39
+ if (s % 4) throw Error("_sha2: outputLen should be aligned to 32bit");
40
+ let c = s / 4, l = this.get();
41
+ if (c > l.length) throw Error("_sha2: outputLen bigger than state");
42
+ for (let e = 0; e < c; e++) o.setUint32(4 * e, l[e], i);
43
+ }
44
+ digest() {
45
+ let { buffer: e, outputLen: t } = this;
46
+ this.digestInto(e);
47
+ let n = e.slice(0, t);
48
+ return this.destroy(), n;
49
+ }
50
+ _cloneInto(e) {
51
+ e ||= new this.constructor(), e.set(...this.get());
52
+ let { blockLen: t, buffer: n, length: r, finished: i, destroyed: a, pos: o } = this;
53
+ return e.destroyed = a, e.finished = i, e.length = r, e.pos = o, r % t && e.buffer.set(n), e;
54
+ }
55
+ clone() {
56
+ return this._cloneInto();
57
+ }
58
+ }, z = /* @__PURE__ */ Uint32Array.from([
59
+ 1779033703,
60
+ 3144134277,
61
+ 1013904242,
62
+ 2773480762,
63
+ 1359893119,
64
+ 2600822924,
65
+ 528734635,
66
+ 1541459225
67
+ ]), B = /* @__PURE__ */ Uint32Array.from([
68
+ 3418070365,
69
+ 3238371032,
70
+ 1654270250,
71
+ 914150663,
72
+ 2438529370,
73
+ 812702999,
74
+ 355462360,
75
+ 4144912697,
76
+ 1731405415,
77
+ 4290775857,
78
+ 2394180231,
79
+ 1750603025,
80
+ 3675008525,
81
+ 1694076839,
82
+ 1203062813,
83
+ 3204075428
84
+ ]), V = /* @__PURE__ */ Uint32Array.from([
85
+ 1779033703,
86
+ 4089235720,
87
+ 3144134277,
88
+ 2227873595,
89
+ 1013904242,
90
+ 4271175723,
91
+ 2773480762,
92
+ 1595750129,
93
+ 1359893119,
94
+ 2917565137,
95
+ 2600822924,
96
+ 725511199,
97
+ 528734635,
98
+ 4215389547,
99
+ 1541459225,
100
+ 327033209
101
+ ]), ue = /* @__PURE__ */ Uint32Array.from([
102
+ 1116352408,
103
+ 1899447441,
104
+ 3049323471,
105
+ 3921009573,
106
+ 961987163,
107
+ 1508970993,
108
+ 2453635748,
109
+ 2870763221,
110
+ 3624381080,
111
+ 310598401,
112
+ 607225278,
113
+ 1426881987,
114
+ 1925078388,
115
+ 2162078206,
116
+ 2614888103,
117
+ 3248222580,
118
+ 3835390401,
119
+ 4022224774,
120
+ 264347078,
121
+ 604807628,
122
+ 770255983,
123
+ 1249150122,
124
+ 1555081692,
125
+ 1996064986,
126
+ 2554220882,
127
+ 2821834349,
128
+ 2952996808,
129
+ 3210313671,
130
+ 3336571891,
131
+ 3584528711,
132
+ 113926993,
133
+ 338241895,
134
+ 666307205,
135
+ 773529912,
136
+ 1294757372,
137
+ 1396182291,
138
+ 1695183700,
139
+ 1986661051,
140
+ 2177026350,
141
+ 2456956037,
142
+ 2730485921,
143
+ 2820302411,
144
+ 3259730800,
145
+ 3345764771,
146
+ 3516065817,
147
+ 3600352804,
148
+ 4094571909,
149
+ 275423344,
150
+ 430227734,
151
+ 506948616,
152
+ 659060556,
153
+ 883997877,
154
+ 958139571,
155
+ 1322822218,
156
+ 1537002063,
157
+ 1747873779,
158
+ 1955562222,
159
+ 2024104815,
160
+ 2227730452,
161
+ 2361852424,
162
+ 2428436474,
163
+ 2756734187,
164
+ 3204031479,
165
+ 3329325298
166
+ ]), H = /* @__PURE__ */ new Uint32Array(64), de = class extends le {
167
+ constructor(e = 32) {
168
+ super(64, e, 8, !1), this.A = z[0] | 0, this.B = z[1] | 0, this.C = z[2] | 0, this.D = z[3] | 0, this.E = z[4] | 0, this.F = z[5] | 0, this.G = z[6] | 0, this.H = z[7] | 0;
169
+ }
170
+ get() {
171
+ let { A: e, B: t, C: n, D: r, E: i, F: a, G: o, H: s } = this;
172
+ return [
173
+ e,
174
+ t,
175
+ n,
176
+ r,
177
+ i,
178
+ a,
179
+ o,
180
+ s
181
+ ];
182
+ }
183
+ set(e, t, n, r, i, a, o, s) {
184
+ this.A = e | 0, this.B = t | 0, this.C = n | 0, this.D = r | 0, this.E = i | 0, this.F = a | 0, this.G = o | 0, this.H = s | 0;
185
+ }
186
+ process(t, n) {
187
+ for (let e = 0; e < 16; e++, n += 4) H[e] = t.getUint32(n, !1);
188
+ for (let t = 16; t < 64; t++) {
189
+ let n = H[t - 15], r = H[t - 2], i = e(n, 7) ^ e(n, 18) ^ n >>> 3;
190
+ H[t] = (e(r, 17) ^ e(r, 19) ^ r >>> 10) + H[t - 7] + i + H[t - 16] | 0;
191
+ }
192
+ let { A: r, B: i, C: a, D: o, E: s, F: c, G: l, H: u } = this;
193
+ for (let t = 0; t < 64; t++) {
194
+ let n = e(s, 6) ^ e(s, 11) ^ e(s, 25), d = u + n + se(s, c, l) + ue[t] + H[t] | 0, f = (e(r, 2) ^ e(r, 13) ^ e(r, 22)) + ce(r, i, a) | 0;
195
+ u = l, l = c, c = s, s = o + d | 0, o = a, a = i, i = r, r = d + f | 0;
196
+ }
197
+ r = r + this.A | 0, i = i + this.B | 0, a = a + this.C | 0, o = o + this.D | 0, s = s + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(r, i, a, o, s, c, l, u);
198
+ }
199
+ roundClean() {
200
+ g(H);
201
+ }
202
+ destroy() {
203
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), g(this.buffer);
204
+ }
205
+ }, fe = /* @__PURE__ */ y((/* @__PURE__ */ "0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817".split(".")).map((e) => BigInt(e))), pe = fe[0], me = fe[1], U = /* @__PURE__ */ new Uint32Array(80), W = /* @__PURE__ */ new Uint32Array(80), he = class extends le {
206
+ constructor(e = 64) {
207
+ super(128, e, 16, !1), this.Ah = V[0] | 0, this.Al = V[1] | 0, this.Bh = V[2] | 0, this.Bl = V[3] | 0, this.Ch = V[4] | 0, this.Cl = V[5] | 0, this.Dh = V[6] | 0, this.Dl = V[7] | 0, this.Eh = V[8] | 0, this.El = V[9] | 0, this.Fh = V[10] | 0, this.Fl = V[11] | 0, this.Gh = V[12] | 0, this.Gl = V[13] | 0, this.Hh = V[14] | 0, this.Hl = V[15] | 0;
208
+ }
209
+ get() {
210
+ let { Ah: e, Al: t, Bh: n, Bl: r, Ch: i, Cl: a, Dh: o, Dl: s, Eh: c, El: l, Fh: u, Fl: d, Gh: f, Gl: p, Hh: m, Hl: h } = this;
211
+ return [
212
+ e,
213
+ t,
214
+ n,
215
+ r,
216
+ i,
217
+ a,
218
+ o,
219
+ s,
220
+ c,
221
+ l,
222
+ u,
223
+ d,
224
+ f,
225
+ p,
226
+ m,
227
+ h
228
+ ];
229
+ }
230
+ set(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
231
+ this.Ah = e | 0, this.Al = t | 0, this.Bh = n | 0, this.Bl = r | 0, this.Ch = i | 0, this.Cl = a | 0, this.Dh = o | 0, this.Dl = s | 0, this.Eh = c | 0, this.El = l | 0, this.Fh = u | 0, this.Fl = d | 0, this.Gh = f | 0, this.Gl = p | 0, this.Hh = m | 0, this.Hl = h | 0;
232
+ }
233
+ process(e, n) {
234
+ for (let t = 0; t < 16; t++, n += 4) U[t] = e.getUint32(n), W[t] = e.getUint32(n += 4);
235
+ for (let e = 16; e < 80; e++) {
236
+ let t = U[e - 15] | 0, n = W[e - 15] | 0, r = N(t, n, 1) ^ N(t, n, 8) ^ v(t, n, 7), i = c(t, n, 1) ^ c(t, n, 8) ^ _(t, n, 7), a = U[e - 2] | 0, s = W[e - 2] | 0, d = N(a, s, 19) ^ o(a, s, 61) ^ v(a, s, 6), f = m(i, c(a, s, 19) ^ l(a, s, 61) ^ _(a, s, 6), W[e - 7], W[e - 16]);
237
+ U[e] = u(f, r, d, U[e - 7], U[e - 16]) | 0, W[e] = f | 0;
238
+ }
239
+ let { Ah: r, Al: i, Bh: d, Bl: f, Ch: h, Cl: g, Dh: y, Dl: b, Eh: x, El: S, Fh: C, Fl: w, Gh: T, Gl: E, Hh: D, Hl: O } = this;
240
+ for (let e = 0; e < 80; e++) {
241
+ let n = N(x, S, 14) ^ N(x, S, 18) ^ o(x, S, 41), u = c(x, S, 14) ^ c(x, S, 18) ^ l(x, S, 41), m = x & C ^ ~x & T, _ = S & w ^ ~S & E, v = t(O, u, _, me[e], W[e]), k = ae(v, D, n, m, pe[e], U[e]), ee = v | 0, A = N(r, i, 28) ^ o(r, i, 34) ^ o(r, i, 39), j = c(r, i, 28) ^ l(r, i, 34) ^ l(r, i, 39), M = r & d ^ r & h ^ d & h, te = i & f ^ i & g ^ f & g;
242
+ D = T | 0, O = E | 0, T = C | 0, E = w | 0, C = x | 0, w = S | 0, {h: x, l: S} = p(y | 0, b | 0, k | 0, ee | 0), y = h | 0, b = g | 0, h = d | 0, g = f | 0, d = r | 0, f = i | 0;
243
+ let P = s(ee, j, te);
244
+ r = a(P, k, A, M), i = P | 0;
245
+ }
246
+ ({h: r, l: i} = p(this.Ah | 0, this.Al | 0, r | 0, i | 0)), {h: d, l: f} = p(this.Bh | 0, this.Bl | 0, d | 0, f | 0), {h: h, l: g} = p(this.Ch | 0, this.Cl | 0, h | 0, g | 0), {h: y, l: b} = p(this.Dh | 0, this.Dl | 0, y | 0, b | 0), {h: x, l: S} = p(this.Eh | 0, this.El | 0, x | 0, S | 0), {h: C, l: w} = p(this.Fh | 0, this.Fl | 0, C | 0, w | 0), {h: T, l: E} = p(this.Gh | 0, this.Gl | 0, T | 0, E | 0), {h: D, l: O} = p(this.Hh | 0, this.Hl | 0, D | 0, O | 0), this.set(r, i, d, f, h, g, y, b, x, S, C, w, T, E, D, O);
247
+ }
248
+ roundClean() {
249
+ g(U, W);
250
+ }
251
+ destroy() {
252
+ g(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
253
+ }
254
+ }, ge = class extends he {
255
+ constructor() {
256
+ super(48), this.Ah = B[0] | 0, this.Al = B[1] | 0, this.Bh = B[2] | 0, this.Bl = B[3] | 0, this.Ch = B[4] | 0, this.Cl = B[5] | 0, this.Dh = B[6] | 0, this.Dl = B[7] | 0, this.Eh = B[8] | 0, this.El = B[9] | 0, this.Fh = B[10] | 0, this.Fl = B[11] | 0, this.Gh = B[12] | 0, this.Gl = B[13] | 0, this.Hh = B[14] | 0, this.Hl = B[15] | 0;
257
+ }
258
+ }, _e = /* @__PURE__ */ r(() => new de()), ve = /* @__PURE__ */ r(() => new he()), ye = /* @__PURE__ */ r(() => new ge()), be = class extends ie {
259
+ constructor(e, t) {
260
+ super(), this.finished = !1, this.destroyed = !1, h(e);
261
+ let n = d(t);
262
+ if (this.iHash = e.create(), typeof this.iHash.update != "function") throw Error("Expected instance of class which extends utils.Hash");
263
+ this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
264
+ let r = this.blockLen, i = new Uint8Array(r);
265
+ i.set(n.length > r ? e.create().update(n).digest() : n);
266
+ for (let e = 0; e < i.length; e++) i[e] ^= 54;
267
+ this.iHash.update(i), this.oHash = e.create();
268
+ for (let e = 0; e < i.length; e++) i[e] ^= 106;
269
+ this.oHash.update(i), g(i);
270
+ }
271
+ update(e) {
272
+ return R(this), this.iHash.update(e), this;
273
+ }
274
+ digestInto(e) {
275
+ R(this), S(e, this.outputLen), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
276
+ }
277
+ digest() {
278
+ let e = new Uint8Array(this.oHash.outputLen);
279
+ return this.digestInto(e), e;
280
+ }
281
+ _cloneInto(e) {
282
+ e ||= Object.create(Object.getPrototypeOf(this), {});
283
+ let { oHash: t, iHash: n, finished: r, destroyed: i, blockLen: a, outputLen: o } = this;
284
+ return e = e, e.finished = r, e.destroyed = i, e.blockLen = a, e.outputLen = o, e.oHash = t._cloneInto(e.oHash), e.iHash = n._cloneInto(e.iHash), e;
285
+ }
286
+ clone() {
287
+ return this._cloneInto();
288
+ }
289
+ destroy() {
290
+ this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
291
+ }
292
+ }, xe = (e, t, n) => new be(e, t).update(n).digest();
293
+ xe.create = (e, t) => new be(e, t);
294
+ //#endregion
295
+ //#region ../../node_modules/@noble/curves/esm/abstract/modular.js
296
+ var G = BigInt(0), K = BigInt(1), q = /* @__PURE__ */ BigInt(2), Se = /* @__PURE__ */ BigInt(3), Ce = /* @__PURE__ */ BigInt(4), we = /* @__PURE__ */ BigInt(5), Te = /* @__PURE__ */ BigInt(8);
297
+ function J(e, t) {
298
+ let n = e % t;
299
+ return n >= G ? n : t + n;
300
+ }
301
+ function Y(e, t, n) {
302
+ let r = e;
303
+ for (; t-- > G;) r *= r, r %= n;
304
+ return r;
305
+ }
306
+ function Ee(e, t) {
307
+ if (e === G) throw Error("invert: expected non-zero number");
308
+ if (t <= G) throw Error("invert: expected positive modulus, got " + t);
309
+ let n = J(e, t), r = t, i = G, a = K, o = K, s = G;
310
+ for (; n !== G;) {
311
+ let e = r / n, t = r % n, c = i - o * e, l = a - s * e;
312
+ r = n, n = t, i = o, a = s, o = c, s = l;
313
+ }
314
+ if (r !== K) throw Error("invert: does not exist");
315
+ return J(i, t);
316
+ }
317
+ function De(e, t) {
318
+ let n = (e.ORDER + K) / Ce, r = e.pow(t, n);
319
+ if (!e.eql(e.sqr(r), t)) throw Error("Cannot find square root");
320
+ return r;
321
+ }
322
+ function Oe(e, t) {
323
+ let n = (e.ORDER - we) / Te, r = e.mul(t, q), i = e.pow(r, n), a = e.mul(t, i), o = e.mul(e.mul(a, q), i), s = e.mul(a, e.sub(o, e.ONE));
324
+ if (!e.eql(e.sqr(s), t)) throw Error("Cannot find square root");
325
+ return s;
326
+ }
327
+ function ke(e) {
328
+ if (e < BigInt(3)) throw Error("sqrt is not defined for small field");
329
+ let t = e - K, n = 0;
330
+ for (; t % q === G;) t /= q, n++;
331
+ let r = q, i = X(e);
332
+ for (; Fe(i, r) === 1;) if (r++ > 1e3) throw Error("Cannot find square root: probably non-prime P");
333
+ if (n === 1) return De;
334
+ let a = i.pow(r, t), o = (t + K) / q;
335
+ return function(e, r) {
336
+ if (e.is0(r)) return r;
337
+ if (Fe(e, r) !== 1) throw Error("Cannot find square root");
338
+ let i = n, s = e.mul(e.ONE, a), c = e.pow(r, t), l = e.pow(r, o);
339
+ for (; !e.eql(c, e.ONE);) {
340
+ if (e.is0(c)) return e.ZERO;
341
+ let t = 1, n = e.sqr(c);
342
+ for (; !e.eql(n, e.ONE);) if (t++, n = e.sqr(n), t === i) throw Error("Cannot find square root");
343
+ let r = K << BigInt(i - t - 1), a = e.pow(s, r);
344
+ i = t, s = e.sqr(a), c = e.mul(c, s), l = e.mul(l, a);
345
+ }
346
+ return l;
347
+ };
348
+ }
349
+ function Ae(e) {
350
+ return e % Ce === Se ? De : e % Te === we ? Oe : ke(e);
351
+ }
352
+ var je = [
353
+ "create",
354
+ "isValid",
355
+ "is0",
356
+ "neg",
357
+ "inv",
358
+ "sqrt",
359
+ "sqr",
360
+ "eql",
361
+ "add",
362
+ "sub",
363
+ "mul",
364
+ "pow",
365
+ "div",
366
+ "addN",
367
+ "subN",
368
+ "mulN",
369
+ "sqrN"
370
+ ];
371
+ function Me(e) {
372
+ return L(e, je.reduce((e, t) => (e[t] = "function", e), {
373
+ ORDER: "bigint",
374
+ MASK: "bigint",
375
+ BYTES: "isSafeInteger",
376
+ BITS: "isSafeInteger"
377
+ }));
378
+ }
379
+ function Ne(e, t, n) {
380
+ if (n < G) throw Error("invalid exponent, negatives unsupported");
381
+ if (n === G) return e.ONE;
382
+ if (n === K) return t;
383
+ let r = e.ONE, i = t;
384
+ for (; n > G;) n & K && (r = e.mul(r, i)), i = e.sqr(i), n >>= K;
385
+ return r;
386
+ }
387
+ function Pe(e, t, n = !1) {
388
+ let r = Array(t.length).fill(n ? e.ZERO : void 0), i = t.reduce((t, n, i) => e.is0(n) ? t : (r[i] = t, e.mul(t, n)), e.ONE), a = e.inv(i);
389
+ return t.reduceRight((t, n, i) => e.is0(n) ? t : (r[i] = e.mul(t, r[i]), e.mul(t, n)), a), r;
390
+ }
391
+ function Fe(e, t) {
392
+ let n = (e.ORDER - K) / q, r = e.pow(t, n), i = e.eql(r, e.ONE), a = e.eql(r, e.ZERO), o = e.eql(r, e.neg(e.ONE));
393
+ if (!i && !a && !o) throw Error("invalid Legendre symbol result");
394
+ return i ? 1 : a ? 0 : -1;
395
+ }
396
+ function Ie(e, t) {
397
+ t !== void 0 && n(t);
398
+ let r = t === void 0 ? e.toString(2).length : t;
399
+ return {
400
+ nBitLength: r,
401
+ nByteLength: Math.ceil(r / 8)
402
+ };
403
+ }
404
+ function X(e, t, n = !1, r = {}) {
405
+ if (e <= G) throw Error("invalid field: expected ORDER > 0, got " + e);
406
+ let { nBitLength: i, nByteLength: a } = Ie(e, t);
407
+ if (a > 2048) throw Error("invalid field: expected ORDER of <= 2048 bytes");
408
+ let o, s = Object.freeze({
409
+ ORDER: e,
410
+ isLE: n,
411
+ BITS: i,
412
+ BYTES: a,
413
+ MASK: O(i),
414
+ ZERO: G,
415
+ ONE: K,
416
+ create: (t) => J(t, e),
417
+ isValid: (t) => {
418
+ if (typeof t != "bigint") throw Error("invalid field element: expected bigint, got " + typeof t);
419
+ return G <= t && t < e;
420
+ },
421
+ is0: (e) => e === G,
422
+ isOdd: (e) => (e & K) === K,
423
+ neg: (t) => J(-t, e),
424
+ eql: (e, t) => e === t,
425
+ sqr: (t) => J(t * t, e),
426
+ add: (t, n) => J(t + n, e),
427
+ sub: (t, n) => J(t - n, e),
428
+ mul: (t, n) => J(t * n, e),
429
+ pow: (e, t) => Ne(s, e, t),
430
+ div: (t, n) => J(t * Ee(n, e), e),
431
+ sqrN: (e) => e * e,
432
+ addN: (e, t) => e + t,
433
+ subN: (e, t) => e - t,
434
+ mulN: (e, t) => e * t,
435
+ inv: (t) => Ee(t, e),
436
+ sqrt: r.sqrt || ((t) => (o ||= Ae(e), o(s, t))),
437
+ toBytes: (e) => n ? E(e, a) : D(e, a),
438
+ fromBytes: (e) => {
439
+ if (e.length !== a) throw Error("Field.fromBytes: expected " + a + " bytes, got " + e.length);
440
+ return n ? ne(e) : M(e);
441
+ },
442
+ invertBatch: (e) => Pe(s, e),
443
+ cmov: (e, t, n) => n ? t : e
444
+ });
445
+ return Object.freeze(s);
446
+ }
447
+ function Le(e) {
448
+ if (typeof e != "bigint") throw Error("field order must be bigint");
449
+ let t = e.toString(2).length;
450
+ return Math.ceil(t / 8);
451
+ }
452
+ function Re(e) {
453
+ let t = Le(e);
454
+ return t + Math.ceil(t / 2);
455
+ }
456
+ function ze(e, t, n = !1) {
457
+ let r = e.length, i = Le(t), a = Re(t);
458
+ if (r < 16 || r < a || r > 1024) throw Error("expected " + a + "-1024 bytes of input, got " + r);
459
+ let o = J(n ? ne(e) : M(e), t - K) + K;
460
+ return n ? E(o, i) : D(o, i);
461
+ }
462
+ //#endregion
463
+ //#region ../../node_modules/@noble/curves/esm/abstract/curve.js
464
+ var Be = BigInt(0), Ve = BigInt(1);
465
+ function He(e, t) {
466
+ let n = t.negate();
467
+ return e ? n : t;
468
+ }
469
+ function Ue(e, t) {
470
+ if (!Number.isSafeInteger(e) || e <= 0 || e > t) throw Error("invalid window size, expected [1.." + t + "], got W=" + e);
471
+ }
472
+ function We(e, t) {
473
+ Ue(e, t);
474
+ let n = Math.ceil(t / e) + 1, r = 2 ** (e - 1), i = 2 ** e;
475
+ return {
476
+ windows: n,
477
+ windowSize: r,
478
+ mask: O(e),
479
+ maxNumber: i,
480
+ shiftBy: BigInt(e)
481
+ };
482
+ }
483
+ function Ge(e, t, n) {
484
+ let { windowSize: r, mask: i, maxNumber: a, shiftBy: o } = n, s = Number(e & i), c = e >> o;
485
+ s > r && (s -= a, c += Ve);
486
+ let l = t * r, u = l + Math.abs(s) - 1, d = s === 0, f = s < 0, p = t % 2 != 0;
487
+ return {
488
+ nextN: c,
489
+ offset: u,
490
+ isZero: d,
491
+ isNeg: f,
492
+ isNegF: p,
493
+ offsetF: l
494
+ };
495
+ }
496
+ function Ke(e, t) {
497
+ if (!Array.isArray(e)) throw Error("array expected");
498
+ e.forEach((e, n) => {
499
+ if (!(e instanceof t)) throw Error("invalid point at index " + n);
500
+ });
501
+ }
502
+ function qe(e, t) {
503
+ if (!Array.isArray(e)) throw Error("array of scalars expected");
504
+ e.forEach((e, n) => {
505
+ if (!t.isValid(e)) throw Error("invalid scalar at index " + n);
506
+ });
507
+ }
508
+ var Je = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap();
509
+ function Xe(e) {
510
+ return Ye.get(e) || 1;
511
+ }
512
+ function Ze(e, t) {
513
+ return {
514
+ constTimeNegate: He,
515
+ hasPrecomputes(e) {
516
+ return Xe(e) !== 1;
517
+ },
518
+ unsafeLadder(t, n, r = e.ZERO) {
519
+ let i = t;
520
+ for (; n > Be;) n & Ve && (r = r.add(i)), i = i.double(), n >>= Ve;
521
+ return r;
522
+ },
523
+ precomputeWindow(e, n) {
524
+ let { windows: r, windowSize: i } = We(n, t), a = [], o = e, s = o;
525
+ for (let e = 0; e < r; e++) {
526
+ s = o, a.push(s);
527
+ for (let e = 1; e < i; e++) s = s.add(o), a.push(s);
528
+ o = s.double();
529
+ }
530
+ return a;
531
+ },
532
+ wNAF(n, r, i) {
533
+ let a = e.ZERO, o = e.BASE, s = We(n, t);
534
+ for (let e = 0; e < s.windows; e++) {
535
+ let { nextN: t, offset: n, isZero: c, isNeg: l, isNegF: u, offsetF: d } = Ge(i, e, s);
536
+ i = t, c ? o = o.add(He(u, r[d])) : a = a.add(He(l, r[n]));
537
+ }
538
+ return {
539
+ p: a,
540
+ f: o
541
+ };
542
+ },
543
+ wNAFUnsafe(n, r, i, a = e.ZERO) {
544
+ let o = We(n, t);
545
+ for (let e = 0; e < o.windows && i !== Be; e++) {
546
+ let { nextN: t, offset: n, isZero: s, isNeg: c } = Ge(i, e, o);
547
+ if (i = t, !s) {
548
+ let e = r[n];
549
+ a = a.add(c ? e.negate() : e);
550
+ }
551
+ }
552
+ return a;
553
+ },
554
+ getPrecomputes(e, t, n) {
555
+ let r = Je.get(t);
556
+ return r || (r = this.precomputeWindow(t, e), e !== 1 && Je.set(t, n(r))), r;
557
+ },
558
+ wNAFCached(e, t, n) {
559
+ let r = Xe(e);
560
+ return this.wNAF(r, this.getPrecomputes(r, e, n), t);
561
+ },
562
+ wNAFCachedUnsafe(e, t, n, r) {
563
+ let i = Xe(e);
564
+ return i === 1 ? this.unsafeLadder(e, t, r) : this.wNAFUnsafe(i, this.getPrecomputes(i, e, n), t, r);
565
+ },
566
+ setWindowSize(e, n) {
567
+ Ue(n, t), Ye.set(e, n), Je.delete(e);
568
+ }
569
+ };
570
+ }
571
+ function Qe(e, t, n, r) {
572
+ Ke(n, e), qe(r, t);
573
+ let i = n.length, a = r.length;
574
+ if (i !== a) throw Error("arrays of points and scalars must have equal length");
575
+ let o = e.ZERO, s = P(BigInt(i)), c = 1;
576
+ s > 12 ? c = s - 3 : s > 4 ? c = s - 2 : s > 0 && (c = 2);
577
+ let l = O(c), u = Array(Number(l) + 1).fill(o), d = Math.floor((t.BITS - 1) / c) * c, f = o;
578
+ for (let e = d; e >= 0; e -= c) {
579
+ u.fill(o);
580
+ for (let t = 0; t < a; t++) {
581
+ let i = r[t], a = Number(i >> BigInt(e) & l);
582
+ u[a] = u[a].add(n[t]);
583
+ }
584
+ let t = o;
585
+ for (let e = u.length - 1, n = o; e > 0; e--) n = n.add(u[e]), t = t.add(n);
586
+ if (f = f.add(t), e !== 0) for (let e = 0; e < c; e++) f = f.double();
587
+ }
588
+ return f;
589
+ }
590
+ function $e(e) {
591
+ return Me(e.Fp), L(e, {
592
+ n: "bigint",
593
+ h: "bigint",
594
+ Gx: "field",
595
+ Gy: "field"
596
+ }, {
597
+ nBitLength: "isSafeInteger",
598
+ nByteLength: "isSafeInteger"
599
+ }), Object.freeze({
600
+ ...Ie(e.n, e.nBitLength),
601
+ ...e,
602
+ p: e.Fp.ORDER
603
+ });
604
+ }
605
+ //#endregion
606
+ //#region ../../node_modules/@noble/curves/esm/abstract/weierstrass.js
607
+ function et(e) {
608
+ e.lowS !== void 0 && j("lowS", e.lowS), e.prehash !== void 0 && j("prehash", e.prehash);
609
+ }
610
+ function tt(e) {
611
+ let t = $e(e);
612
+ L(t, {
613
+ a: "field",
614
+ b: "field"
615
+ }, {
616
+ allowInfinityPoint: "boolean",
617
+ allowedPrivateKeyLengths: "array",
618
+ clearCofactor: "function",
619
+ fromBytes: "function",
620
+ isTorsionFree: "function",
621
+ toBytes: "function",
622
+ wrapPrivateKey: "boolean"
623
+ });
624
+ let { endo: n, Fp: r, a: i } = t;
625
+ if (n) {
626
+ if (!r.eql(i, r.ZERO)) throw Error("invalid endo: CURVE.a must be 0");
627
+ if (typeof n != "object" || typeof n.beta != "bigint" || typeof n.splitScalar != "function") throw Error("invalid endo: expected \"beta\": bigint and \"splitScalar\": function");
628
+ }
629
+ return Object.freeze({ ...t });
630
+ }
631
+ var Z = {
632
+ Err: class extends Error {
633
+ constructor(e = "") {
634
+ super(e);
635
+ }
636
+ },
637
+ _tlv: {
638
+ encode: (e, t) => {
639
+ let { Err: n } = Z;
640
+ if (e < 0 || e > 256) throw new n("tlv.encode: wrong tag");
641
+ if (t.length & 1) throw new n("tlv.encode: unpadded data");
642
+ let r = t.length / 2, i = b(r);
643
+ if (i.length / 2 & 128) throw new n("tlv.encode: long form length too big");
644
+ let a = r > 127 ? b(i.length / 2 | 128) : "";
645
+ return b(e) + a + i + t;
646
+ },
647
+ decode(e, t) {
648
+ let { Err: n } = Z, r = 0;
649
+ if (e < 0 || e > 256) throw new n("tlv.encode: wrong tag");
650
+ if (t.length < 2 || t[r++] !== e) throw new n("tlv.decode: wrong tlv");
651
+ let i = t[r++], a = !!(i & 128), o = 0;
652
+ if (!a) o = i;
653
+ else {
654
+ let e = i & 127;
655
+ if (!e) throw new n("tlv.decode(long): indefinite length not supported");
656
+ if (e > 4) throw new n("tlv.decode(long): byte length is too big");
657
+ let a = t.subarray(r, r + e);
658
+ if (a.length !== e) throw new n("tlv.decode: length bytes not complete");
659
+ if (a[0] === 0) throw new n("tlv.decode(long): zero leftmost byte");
660
+ for (let e of a) o = o << 8 | e;
661
+ if (r += e, o < 128) throw new n("tlv.decode(long): not minimal encoding");
662
+ }
663
+ let s = t.subarray(r, r + o);
664
+ if (s.length !== o) throw new n("tlv.decode: wrong value length");
665
+ return {
666
+ v: s,
667
+ l: t.subarray(r + o)
668
+ };
669
+ }
670
+ },
671
+ _int: {
672
+ encode(e) {
673
+ let { Err: t } = Z;
674
+ if (e < Q) throw new t("integer: negative integers are not allowed");
675
+ let n = b(e);
676
+ if (Number.parseInt(n[0], 16) & 8 && (n = "00" + n), n.length & 1) throw new t("unexpected DER parsing assertion: unpadded hex");
677
+ return n;
678
+ },
679
+ decode(e) {
680
+ let { Err: t } = Z;
681
+ if (e[0] & 128) throw new t("invalid signature integer: negative");
682
+ if (e[0] === 0 && !(e[1] & 128)) throw new t("invalid signature integer: unnecessary leading zero");
683
+ return M(e);
684
+ }
685
+ },
686
+ toSig(e) {
687
+ let { Err: t, _int: n, _tlv: r } = Z, i = I("signature", e), { v: a, l: o } = r.decode(48, i);
688
+ if (o.length) throw new t("invalid signature: left bytes after parsing");
689
+ let { v: s, l: c } = r.decode(2, a), { v: l, l: u } = r.decode(2, c);
690
+ if (u.length) throw new t("invalid signature: left bytes after parsing");
691
+ return {
692
+ r: n.decode(s),
693
+ s: n.decode(l)
694
+ };
695
+ },
696
+ hexFromSig(e) {
697
+ let { _tlv: t, _int: n } = Z, r = t.encode(2, n.encode(e.r)) + t.encode(2, n.encode(e.s));
698
+ return t.encode(48, r);
699
+ }
700
+ };
701
+ function nt(e, t) {
702
+ return x(D(e, t));
703
+ }
704
+ var Q = BigInt(0), $ = BigInt(1), rt = BigInt(3), it = BigInt(4);
705
+ function at(e) {
706
+ let t = tt(e), { Fp: n } = t, r = X(t.n, t.nBitLength), i = t.toBytes || ((e, t, r) => {
707
+ let i = t.toAffine();
708
+ return C(Uint8Array.from([4]), n.toBytes(i.x), n.toBytes(i.y));
709
+ }), a = t.fromBytes || ((e) => {
710
+ let t = e.subarray(1);
711
+ return {
712
+ x: n.fromBytes(t.subarray(0, n.BYTES)),
713
+ y: n.fromBytes(t.subarray(n.BYTES, 2 * n.BYTES))
714
+ };
715
+ });
716
+ function o(e) {
717
+ let { a: r, b: i } = t, a = n.sqr(e), o = n.mul(a, e);
718
+ return n.add(n.add(o, n.mul(e, r)), i);
719
+ }
720
+ function s(e, t) {
721
+ let r = n.sqr(t), i = o(e);
722
+ return n.eql(r, i);
723
+ }
724
+ if (!s(t.Gx, t.Gy)) throw Error("bad curve params: generator point");
725
+ let c = n.mul(n.pow(t.a, rt), it), l = n.mul(n.sqr(t.b), BigInt(27));
726
+ if (n.is0(n.add(c, l))) throw Error("bad curve params: a or b");
727
+ function u(e) {
728
+ return T(e, $, t.n);
729
+ }
730
+ function d(e) {
731
+ let { allowedPrivateKeyLengths: n, nByteLength: r, wrapPrivateKey: i, n: a } = t;
732
+ if (n && typeof e != "bigint") {
733
+ if (te(e) && (e = x(e)), typeof e != "string" || !n.includes(e.length)) throw Error("invalid private key");
734
+ e = e.padStart(r * 2, "0");
735
+ }
736
+ let o;
737
+ try {
738
+ o = typeof e == "bigint" ? e : M(I("private key", e, r));
739
+ } catch {
740
+ throw Error("invalid private key, expected hex or " + r + " bytes, got " + typeof e);
741
+ }
742
+ return i && (o = J(o, a)), F("private key", o, $, a), o;
743
+ }
744
+ function f(e) {
745
+ if (!(e instanceof h)) throw Error("ProjectivePoint expected");
746
+ }
747
+ let p = A((e, t) => {
748
+ let { px: r, py: i, pz: a } = e;
749
+ if (n.eql(a, n.ONE)) return {
750
+ x: r,
751
+ y: i
752
+ };
753
+ let o = e.is0();
754
+ t ??= o ? n.ONE : n.inv(a);
755
+ let s = n.mul(r, t), c = n.mul(i, t), l = n.mul(a, t);
756
+ if (o) return {
757
+ x: n.ZERO,
758
+ y: n.ZERO
759
+ };
760
+ if (!n.eql(l, n.ONE)) throw Error("invZ was invalid");
761
+ return {
762
+ x: s,
763
+ y: c
764
+ };
765
+ }), m = A((e) => {
766
+ if (e.is0()) {
767
+ if (t.allowInfinityPoint && !n.is0(e.py)) return;
768
+ throw Error("bad point: ZERO");
769
+ }
770
+ let { x: r, y: i } = e.toAffine();
771
+ if (!n.isValid(r) || !n.isValid(i)) throw Error("bad point: x or y not FE");
772
+ if (!s(r, i)) throw Error("bad point: equation left != right");
773
+ if (!e.isTorsionFree()) throw Error("bad point: not in prime-order subgroup");
774
+ return !0;
775
+ });
776
+ class h {
777
+ constructor(e, t, r) {
778
+ if (e == null || !n.isValid(e)) throw Error("x required");
779
+ if (t == null || !n.isValid(t) || n.is0(t)) throw Error("y required");
780
+ if (r == null || !n.isValid(r)) throw Error("z required");
781
+ this.px = e, this.py = t, this.pz = r, Object.freeze(this);
782
+ }
783
+ static fromAffine(e) {
784
+ let { x: t, y: r } = e || {};
785
+ if (!e || !n.isValid(t) || !n.isValid(r)) throw Error("invalid affine point");
786
+ if (e instanceof h) throw Error("projective point not allowed");
787
+ let i = (e) => n.eql(e, n.ZERO);
788
+ return i(t) && i(r) ? h.ZERO : new h(t, r, n.ONE);
789
+ }
790
+ get x() {
791
+ return this.toAffine().x;
792
+ }
793
+ get y() {
794
+ return this.toAffine().y;
795
+ }
796
+ static normalizeZ(e) {
797
+ let t = Pe(n, e.map((e) => e.pz));
798
+ return e.map((e, n) => e.toAffine(t[n])).map(h.fromAffine);
799
+ }
800
+ static fromHex(e) {
801
+ let t = h.fromAffine(a(I("pointHex", e)));
802
+ return t.assertValidity(), t;
803
+ }
804
+ static fromPrivateKey(e) {
805
+ return h.BASE.multiply(d(e));
806
+ }
807
+ static msm(e, t) {
808
+ return Qe(h, r, e, t);
809
+ }
810
+ _setWindowSize(e) {
811
+ v.setWindowSize(this, e);
812
+ }
813
+ assertValidity() {
814
+ m(this);
815
+ }
816
+ hasEvenY() {
817
+ let { y: e } = this.toAffine();
818
+ if (n.isOdd) return !n.isOdd(e);
819
+ throw Error("Field doesn't support isOdd");
820
+ }
821
+ equals(e) {
822
+ f(e);
823
+ let { px: t, py: r, pz: i } = this, { px: a, py: o, pz: s } = e, c = n.eql(n.mul(t, s), n.mul(a, i)), l = n.eql(n.mul(r, s), n.mul(o, i));
824
+ return c && l;
825
+ }
826
+ negate() {
827
+ return new h(this.px, n.neg(this.py), this.pz);
828
+ }
829
+ double() {
830
+ let { a: e, b: r } = t, i = n.mul(r, rt), { px: a, py: o, pz: s } = this, c = n.ZERO, l = n.ZERO, u = n.ZERO, d = n.mul(a, a), f = n.mul(o, o), p = n.mul(s, s), m = n.mul(a, o);
831
+ return m = n.add(m, m), u = n.mul(a, s), u = n.add(u, u), c = n.mul(e, u), l = n.mul(i, p), l = n.add(c, l), c = n.sub(f, l), l = n.add(f, l), l = n.mul(c, l), c = n.mul(m, c), u = n.mul(i, u), p = n.mul(e, p), m = n.sub(d, p), m = n.mul(e, m), m = n.add(m, u), u = n.add(d, d), d = n.add(u, d), d = n.add(d, p), d = n.mul(d, m), l = n.add(l, d), p = n.mul(o, s), p = n.add(p, p), d = n.mul(p, m), c = n.sub(c, d), u = n.mul(p, f), u = n.add(u, u), u = n.add(u, u), new h(c, l, u);
832
+ }
833
+ add(e) {
834
+ f(e);
835
+ let { px: r, py: i, pz: a } = this, { px: o, py: s, pz: c } = e, l = n.ZERO, u = n.ZERO, d = n.ZERO, p = t.a, m = n.mul(t.b, rt), g = n.mul(r, o), _ = n.mul(i, s), v = n.mul(a, c), y = n.add(r, i), b = n.add(o, s);
836
+ y = n.mul(y, b), b = n.add(g, _), y = n.sub(y, b), b = n.add(r, a);
837
+ let x = n.add(o, c);
838
+ return b = n.mul(b, x), x = n.add(g, v), b = n.sub(b, x), x = n.add(i, a), l = n.add(s, c), x = n.mul(x, l), l = n.add(_, v), x = n.sub(x, l), d = n.mul(p, b), l = n.mul(m, v), d = n.add(l, d), l = n.sub(_, d), d = n.add(_, d), u = n.mul(l, d), _ = n.add(g, g), _ = n.add(_, g), v = n.mul(p, v), b = n.mul(m, b), _ = n.add(_, v), v = n.sub(g, v), v = n.mul(p, v), b = n.add(b, v), g = n.mul(_, b), u = n.add(u, g), g = n.mul(x, b), l = n.mul(y, l), l = n.sub(l, g), g = n.mul(y, _), d = n.mul(x, d), d = n.add(d, g), new h(l, u, d);
839
+ }
840
+ subtract(e) {
841
+ return this.add(e.negate());
842
+ }
843
+ is0() {
844
+ return this.equals(h.ZERO);
845
+ }
846
+ wNAF(e) {
847
+ return v.wNAFCached(this, e, h.normalizeZ);
848
+ }
849
+ multiplyUnsafe(e) {
850
+ let { endo: r, n: i } = t;
851
+ F("scalar", e, Q, i);
852
+ let a = h.ZERO;
853
+ if (e === Q) return a;
854
+ if (this.is0() || e === $) return this;
855
+ if (!r || v.hasPrecomputes(this)) return v.wNAFCachedUnsafe(this, e, h.normalizeZ);
856
+ let { k1neg: o, k1: s, k2neg: c, k2: l } = r.splitScalar(e), u = a, d = a, f = this;
857
+ for (; s > Q || l > Q;) s & $ && (u = u.add(f)), l & $ && (d = d.add(f)), f = f.double(), s >>= $, l >>= $;
858
+ return o && (u = u.negate()), c && (d = d.negate()), d = new h(n.mul(d.px, r.beta), d.py, d.pz), u.add(d);
859
+ }
860
+ multiply(e) {
861
+ let { endo: r, n: i } = t;
862
+ F("scalar", e, $, i);
863
+ let a, o;
864
+ if (r) {
865
+ let { k1neg: t, k1: i, k2neg: s, k2: c } = r.splitScalar(e), { p: l, f: u } = this.wNAF(i), { p: d, f } = this.wNAF(c);
866
+ l = v.constTimeNegate(t, l), d = v.constTimeNegate(s, d), d = new h(n.mul(d.px, r.beta), d.py, d.pz), a = l.add(d), o = u.add(f);
867
+ } else {
868
+ let { p: t, f: n } = this.wNAF(e);
869
+ a = t, o = n;
870
+ }
871
+ return h.normalizeZ([a, o])[0];
872
+ }
873
+ multiplyAndAddUnsafe(e, t, n) {
874
+ let r = h.BASE, i = (e, t) => t === Q || t === $ || !e.equals(r) ? e.multiplyUnsafe(t) : e.multiply(t), a = i(this, t).add(i(e, n));
875
+ return a.is0() ? void 0 : a;
876
+ }
877
+ toAffine(e) {
878
+ return p(this, e);
879
+ }
880
+ isTorsionFree() {
881
+ let { h: e, isTorsionFree: n } = t;
882
+ if (e === $) return !0;
883
+ if (n) return n(h, this);
884
+ throw Error("isTorsionFree() has not been declared for the elliptic curve");
885
+ }
886
+ clearCofactor() {
887
+ let { h: e, clearCofactor: n } = t;
888
+ return e === $ ? this : n ? n(h, this) : this.multiplyUnsafe(t.h);
889
+ }
890
+ toRawBytes(e = !0) {
891
+ return j("isCompressed", e), this.assertValidity(), i(h, this, e);
892
+ }
893
+ toHex(e = !0) {
894
+ return j("isCompressed", e), x(this.toRawBytes(e));
895
+ }
896
+ }
897
+ h.BASE = new h(t.Gx, t.Gy, n.ONE), h.ZERO = new h(n.ZERO, n.ONE, n.ZERO);
898
+ let { endo: g, nBitLength: _ } = t, v = Ze(h, g ? Math.ceil(_ / 2) : _);
899
+ return {
900
+ CURVE: t,
901
+ ProjectivePoint: h,
902
+ normPrivateKeyToScalar: d,
903
+ weierstrassEquation: o,
904
+ isWithinCurveOrder: u
905
+ };
906
+ }
907
+ function ot(e) {
908
+ let t = $e(e);
909
+ return L(t, {
910
+ hash: "hash",
911
+ hmac: "function",
912
+ randomBytes: "function"
913
+ }, {
914
+ bits2int: "function",
915
+ bits2int_modN: "function",
916
+ lowS: "boolean"
917
+ }), Object.freeze({
918
+ lowS: !0,
919
+ ...t
920
+ });
921
+ }
922
+ function st(e) {
923
+ let t = ot(e), { Fp: n, n: r, nByteLength: i, nBitLength: a } = t, o = n.BYTES + 1, s = 2 * n.BYTES + 1;
924
+ function c(e) {
925
+ return J(e, r);
926
+ }
927
+ function l(e) {
928
+ return Ee(e, r);
929
+ }
930
+ let { ProjectivePoint: u, normPrivateKeyToScalar: d, weierstrassEquation: f, isWithinCurveOrder: p } = at({
931
+ ...t,
932
+ toBytes(e, t, r) {
933
+ let i = t.toAffine(), a = n.toBytes(i.x), o = C;
934
+ return j("isCompressed", r), r ? o(Uint8Array.from([t.hasEvenY() ? 2 : 3]), a) : o(Uint8Array.from([4]), a, n.toBytes(i.y));
935
+ },
936
+ fromBytes(e) {
937
+ let t = e.length, r = e[0], i = e.subarray(1);
938
+ if (t === o && (r === 2 || r === 3)) {
939
+ let e = M(i);
940
+ if (!T(e, $, n.ORDER)) throw Error("Point is not on curve");
941
+ let t = f(e), a;
942
+ try {
943
+ a = n.sqrt(t);
944
+ } catch (e) {
945
+ let t = e instanceof Error ? ": " + e.message : "";
946
+ throw Error("Point is not on curve" + t);
947
+ }
948
+ let o = (a & $) === $;
949
+ return (r & 1) == 1 !== o && (a = n.neg(a)), {
950
+ x: e,
951
+ y: a
952
+ };
953
+ } else if (t === s && r === 4) return {
954
+ x: n.fromBytes(i.subarray(0, n.BYTES)),
955
+ y: n.fromBytes(i.subarray(n.BYTES, 2 * n.BYTES))
956
+ };
957
+ else {
958
+ let e = o, n = s;
959
+ throw Error("invalid Point, expected length of " + e + ", or uncompressed " + n + ", got " + t);
960
+ }
961
+ }
962
+ });
963
+ function m(e) {
964
+ return e > r >> $;
965
+ }
966
+ function h(e) {
967
+ return m(e) ? c(-e) : e;
968
+ }
969
+ let g = (e, t, n) => M(e.slice(t, n));
970
+ class _ {
971
+ constructor(e, t, n) {
972
+ F("r", e, $, r), F("s", t, $, r), this.r = e, this.s = t, n != null && (this.recovery = n), Object.freeze(this);
973
+ }
974
+ static fromCompact(e) {
975
+ let t = i;
976
+ return e = I("compactSignature", e, t * 2), new _(g(e, 0, t), g(e, t, 2 * t));
977
+ }
978
+ static fromDER(e) {
979
+ let { r: t, s: n } = Z.toSig(I("DER", e));
980
+ return new _(t, n);
981
+ }
982
+ assertValidity() {}
983
+ addRecoveryBit(e) {
984
+ return new _(this.r, this.s, e);
985
+ }
986
+ recoverPublicKey(e) {
987
+ let { r, s: i, recovery: a } = this, o = E(I("msgHash", e));
988
+ if (a == null || ![
989
+ 0,
990
+ 1,
991
+ 2,
992
+ 3
993
+ ].includes(a)) throw Error("recovery id invalid");
994
+ let s = a === 2 || a === 3 ? r + t.n : r;
995
+ if (s >= n.ORDER) throw Error("recovery id 2 or 3 invalid");
996
+ let d = a & 1 ? "03" : "02", f = u.fromHex(d + nt(s, n.BYTES)), p = l(s), m = c(-o * p), h = c(i * p), g = u.BASE.multiplyAndAddUnsafe(f, m, h);
997
+ if (!g) throw Error("point at infinify");
998
+ return g.assertValidity(), g;
999
+ }
1000
+ hasHighS() {
1001
+ return m(this.s);
1002
+ }
1003
+ normalizeS() {
1004
+ return this.hasHighS() ? new _(this.r, c(-this.s), this.recovery) : this;
1005
+ }
1006
+ toDERRawBytes() {
1007
+ return w(this.toDERHex());
1008
+ }
1009
+ toDERHex() {
1010
+ return Z.hexFromSig(this);
1011
+ }
1012
+ toCompactRawBytes() {
1013
+ return w(this.toCompactHex());
1014
+ }
1015
+ toCompactHex() {
1016
+ let e = i;
1017
+ return nt(this.r, e) + nt(this.s, e);
1018
+ }
1019
+ }
1020
+ let v = {
1021
+ isValidPrivateKey(e) {
1022
+ try {
1023
+ return d(e), !0;
1024
+ } catch {
1025
+ return !1;
1026
+ }
1027
+ },
1028
+ normPrivateKeyToScalar: d,
1029
+ randomPrivateKey: () => {
1030
+ let e = Re(t.n);
1031
+ return ze(t.randomBytes(e), t.n);
1032
+ },
1033
+ precompute(e = 8, t = u.BASE) {
1034
+ return t._setWindowSize(e), t.multiply(BigInt(3)), t;
1035
+ }
1036
+ };
1037
+ function y(e, t = !0) {
1038
+ return u.fromPrivateKey(e).toRawBytes(t);
1039
+ }
1040
+ function b(e) {
1041
+ if (typeof e == "bigint") return !1;
1042
+ if (e instanceof u) return !0;
1043
+ let r = I("key", e).length, a = n.BYTES, o = a + 1, s = 2 * a + 1;
1044
+ if (!(t.allowedPrivateKeyLengths || i === o)) return r === o || r === s;
1045
+ }
1046
+ function x(e, t, n = !0) {
1047
+ if (b(e) === !0) throw Error("first arg must be private key");
1048
+ if (b(t) === !1) throw Error("second arg must be public key");
1049
+ return u.fromHex(t).multiply(d(e)).toRawBytes(n);
1050
+ }
1051
+ let S = t.bits2int || function(e) {
1052
+ if (e.length > 8192) throw Error("input is too large");
1053
+ let t = M(e), n = e.length * 8 - a;
1054
+ return n > 0 ? t >> BigInt(n) : t;
1055
+ }, E = t.bits2int_modN || function(e) {
1056
+ return c(S(e));
1057
+ }, k = O(a);
1058
+ function A(e) {
1059
+ return F("num < 2^" + a, e, Q, k), D(e, i);
1060
+ }
1061
+ function N(e, r, i = P) {
1062
+ if (["recovered", "canonical"].some((e) => e in i)) throw Error("sign() legacy options not supported");
1063
+ let { hash: a, randomBytes: o } = t, { lowS: s, prehash: f, extraEntropy: g } = i;
1064
+ s ??= !0, e = I("msgHash", e), et(i), f && (e = I("prehashed msgHash", a(e)));
1065
+ let v = E(e), y = d(r), b = [A(y), A(v)];
1066
+ if (g != null && g !== !1) {
1067
+ let e = g === !0 ? o(n.BYTES) : g;
1068
+ b.push(I("extraEntropy", e));
1069
+ }
1070
+ let x = C(...b), w = v;
1071
+ function T(e) {
1072
+ let t = S(e);
1073
+ if (!p(t)) return;
1074
+ let n = l(t), r = u.BASE.multiply(t).toAffine(), i = c(r.x);
1075
+ if (i === Q) return;
1076
+ let a = c(n * c(w + i * y));
1077
+ if (a === Q) return;
1078
+ let o = (r.x === i ? 0 : 2) | Number(r.y & $), d = a;
1079
+ return s && m(a) && (d = h(a), o ^= 1), new _(i, d, o);
1080
+ }
1081
+ return {
1082
+ seed: x,
1083
+ k2sig: T
1084
+ };
1085
+ }
1086
+ let P = {
1087
+ lowS: t.lowS,
1088
+ prehash: !1
1089
+ }, ne = {
1090
+ lowS: t.lowS,
1091
+ prehash: !1
1092
+ };
1093
+ function L(e, n, r = P) {
1094
+ let { seed: i, k2sig: a } = N(e, n, r), o = t;
1095
+ return ee(o.hash.outputLen, o.nByteLength, o.hmac)(i, a);
1096
+ }
1097
+ u.BASE._setWindowSize(8);
1098
+ function re(e, n, r, i = ne) {
1099
+ let a = e;
1100
+ n = I("msgHash", n), r = I("publicKey", r);
1101
+ let { lowS: o, prehash: s, format: d } = i;
1102
+ if (et(i), "strict" in i) throw Error("options.strict was renamed to lowS");
1103
+ if (d !== void 0 && d !== "compact" && d !== "der") throw Error("format must be compact or der");
1104
+ let f = typeof a == "string" || te(a), p = !f && !d && typeof a == "object" && !!a && typeof a.r == "bigint" && typeof a.s == "bigint";
1105
+ if (!f && !p) throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");
1106
+ let m, h;
1107
+ try {
1108
+ if (p && (m = new _(a.r, a.s)), f) {
1109
+ try {
1110
+ d !== "compact" && (m = _.fromDER(a));
1111
+ } catch (e) {
1112
+ if (!(e instanceof Z.Err)) throw e;
1113
+ }
1114
+ !m && d !== "der" && (m = _.fromCompact(a));
1115
+ }
1116
+ h = u.fromHex(r);
1117
+ } catch {
1118
+ return !1;
1119
+ }
1120
+ if (!m || o && m.hasHighS()) return !1;
1121
+ s && (n = t.hash(n));
1122
+ let { r: g, s: v } = m, y = E(n), b = l(v), x = c(y * b), S = c(g * b), C = u.BASE.multiplyAndAddUnsafe(h, x, S)?.toAffine();
1123
+ return C ? c(C.x) === g : !1;
1124
+ }
1125
+ return {
1126
+ CURVE: t,
1127
+ getPublicKey: y,
1128
+ getSharedSecret: x,
1129
+ sign: L,
1130
+ verify: re,
1131
+ ProjectivePoint: u,
1132
+ Signature: _,
1133
+ utils: v
1134
+ };
1135
+ }
1136
+ //#endregion
1137
+ //#region ../../node_modules/@noble/curves/esm/_shortw_utils.js
1138
+ function ct(e) {
1139
+ return {
1140
+ hash: e,
1141
+ hmac: (t, ...n) => xe(e, t, i(...n)),
1142
+ randomBytes: k
1143
+ };
1144
+ }
1145
+ function lt(e, t) {
1146
+ let n = (t) => st({
1147
+ ...e,
1148
+ ...ct(t)
1149
+ });
1150
+ return {
1151
+ ...n(t),
1152
+ create: n
1153
+ };
1154
+ }
1155
+ //#endregion
1156
+ //#region ../../node_modules/@noble/curves/esm/secp256k1.js
1157
+ var ut = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), dt = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), ft = BigInt(0), pt = BigInt(1), mt = BigInt(2), ht = (e, t) => (e + t / mt) / t;
1158
+ function gt(e) {
1159
+ let t = ut, n = BigInt(3), r = BigInt(6), i = BigInt(11), a = BigInt(22), o = BigInt(23), s = BigInt(44), c = BigInt(88), l = e * e * e % t, u = l * l * e % t, d = Y(Y(Y(u, n, t) * u % t, n, t) * u % t, mt, t) * l % t, f = Y(d, i, t) * d % t, p = Y(f, a, t) * f % t, m = Y(p, s, t) * p % t, h = Y(Y(Y(Y(Y(Y(m, c, t) * m % t, s, t) * p % t, n, t) * u % t, o, t) * f % t, r, t) * l % t, mt, t);
1160
+ if (!_t.eql(_t.sqr(h), e)) throw Error("Cannot find square root");
1161
+ return h;
1162
+ }
1163
+ var _t = X(ut, void 0, void 0, { sqrt: gt }), vt = lt({
1164
+ a: ft,
1165
+ b: BigInt(7),
1166
+ Fp: _t,
1167
+ n: dt,
1168
+ Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
1169
+ Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
1170
+ h: BigInt(1),
1171
+ lowS: !0,
1172
+ endo: {
1173
+ beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
1174
+ splitScalar: (e) => {
1175
+ let t = dt, n = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -pt * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), i = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), a = n, o = BigInt("0x100000000000000000000000000000000"), s = ht(a * e, t), c = ht(-r * e, t), l = J(e - s * n - c * i, t), u = J(-s * r - c * a, t), d = l > o, f = u > o;
1176
+ if (d && (l = t - l), f && (u = t - u), l > o || u > o) throw Error("splitScalar: Endomorphism failed, k=" + e);
1177
+ return {
1178
+ k1neg: d,
1179
+ k1: l,
1180
+ k2neg: f,
1181
+ k2: u
1182
+ };
1183
+ }
1184
+ }
1185
+ }, _e);
1186
+ //#endregion
1187
+ export { ye as a, _e as i, lt as n, ve as o, X as r, vt as t };