jobsys-explore 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.cjs +38 -0
  3. package/.prettierrc.cjs +38 -0
  4. package/README.md +42 -0
  5. package/components/button/ExButton.jsx +119 -0
  6. package/components/button/index.js +4 -0
  7. package/components/button/index.less +8 -0
  8. package/components/form/ExAddress.jsx +125 -0
  9. package/components/form/ExCascader.jsx +98 -0
  10. package/components/form/ExCheckbox.jsx +59 -0
  11. package/components/form/ExDate.jsx +130 -0
  12. package/components/form/ExDatetime.jsx +152 -0
  13. package/components/form/ExField.jsx +123 -0
  14. package/components/form/ExFieldUploader.jsx +44 -0
  15. package/components/form/ExForm.jsx +395 -0
  16. package/components/form/ExNumber.jsx +49 -0
  17. package/components/form/ExRadio.jsx +58 -0
  18. package/components/form/ExRate.jsx +47 -0
  19. package/components/form/ExSelect.jsx +151 -0
  20. package/components/form/ExSlider.jsx +53 -0
  21. package/components/form/ExSwitch.jsx +49 -0
  22. package/components/form/ExTime.jsx +104 -0
  23. package/components/form/FormItem.jsx +229 -0
  24. package/components/form/PickerWrapper.jsx +111 -0
  25. package/components/form/addressData.json +1 -0
  26. package/components/form/index.js +37 -0
  27. package/components/form/index.less +108 -0
  28. package/components/form/utils.js +47 -0
  29. package/components/grid/ExGrid.jsx +53 -0
  30. package/components/grid/index.js +4 -0
  31. package/components/grid/index.less +3 -0
  32. package/components/index.js +9 -0
  33. package/components/pagination/ExPagination.jsx +148 -0
  34. package/components/pagination/index.js +5 -0
  35. package/components/pagination/index.less +15 -0
  36. package/components/provider/ExProvider.jsx +91 -0
  37. package/components/provider/index.js +4 -0
  38. package/components/qrcode/ExQrcode.jsx +86 -0
  39. package/components/qrcode/index.js +5 -0
  40. package/components/qrcode/index.less +8 -0
  41. package/components/result/ExResult.jsx +122 -0
  42. package/components/result/index.js +5 -0
  43. package/components/result/index.less +60 -0
  44. package/components/search/ExSearch.jsx +252 -0
  45. package/components/search/components/Expand.jsx +77 -0
  46. package/components/search/components/Field.jsx +27 -0
  47. package/components/search/components/Quick.jsx +53 -0
  48. package/components/search/components/index.js +5 -0
  49. package/components/search/index.js +5 -0
  50. package/components/search/index.less +119 -0
  51. package/components/search/utils.js +30 -0
  52. package/components/theme/ExTheme.jsx +10 -0
  53. package/components/theme/index.js +4 -0
  54. package/components/theme/index.less +97 -0
  55. package/components/uploader/ExUploader.jsx +248 -0
  56. package/components/uploader/index.js +5 -0
  57. package/components/utils.js +150 -0
  58. package/dist/__vite-browser-external-2447137e.mjs +5 -0
  59. package/dist/__vite-browser-external-2447137e.mjs.map +1 -0
  60. package/dist/__vite-browser-external-b3701507.js +2 -0
  61. package/dist/__vite-browser-external-b3701507.js.map +1 -0
  62. package/dist/hooks.cjs +2 -0
  63. package/dist/hooks.cjs.map +1 -0
  64. package/dist/hooks.js +35 -0
  65. package/dist/hooks.js.map +1 -0
  66. package/dist/index-82d74e5f.mjs +2120 -0
  67. package/dist/index-82d74e5f.mjs.map +1 -0
  68. package/dist/index-b8729555.js +2 -0
  69. package/dist/index-b8729555.js.map +1 -0
  70. package/dist/jobsys-explore.cjs +9 -0
  71. package/dist/jobsys-explore.cjs.map +1 -0
  72. package/dist/jobsys-explore.js +18673 -0
  73. package/dist/jobsys-explore.js.map +1 -0
  74. package/dist/style.css +1 -0
  75. package/docgen.config.cjs +9 -0
  76. package/docs/.vitepress/cache/deps/_metadata.json +19 -0
  77. package/docs/.vitepress/cache/deps/package.json +3 -0
  78. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +162 -0
  79. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
  80. package/docs/.vitepress/cache/deps/vue.js +10795 -0
  81. package/docs/.vitepress/cache/deps/vue.js.map +7 -0
  82. package/docs/.vitepress/config.mjs +43 -0
  83. package/docs/.vitepress/dist/404.html +19 -0
  84. package/docs/.vitepress/dist/assets/app.e0eb4814.js +1 -0
  85. package/docs/.vitepress/dist/assets/chunks/framework.7a64ad8e.js +2 -0
  86. package/docs/.vitepress/dist/assets/chunks/theme.ffc5f35c.js +7 -0
  87. package/docs/.vitepress/dist/assets/inter-italic-cyrillic-ext.33bd5a8e.woff2 +0 -0
  88. package/docs/.vitepress/dist/assets/inter-italic-cyrillic.ea42a392.woff2 +0 -0
  89. package/docs/.vitepress/dist/assets/inter-italic-greek-ext.4fbe9427.woff2 +0 -0
  90. package/docs/.vitepress/dist/assets/inter-italic-greek.8f4463c4.woff2 +0 -0
  91. package/docs/.vitepress/dist/assets/inter-italic-latin-ext.bd8920cc.woff2 +0 -0
  92. package/docs/.vitepress/dist/assets/inter-italic-latin.bd3b6f56.woff2 +0 -0
  93. package/docs/.vitepress/dist/assets/inter-italic-vietnamese.6ce511fb.woff2 +0 -0
  94. package/docs/.vitepress/dist/assets/inter-roman-cyrillic-ext.e75737ce.woff2 +0 -0
  95. package/docs/.vitepress/dist/assets/inter-roman-cyrillic.5f2c6c8c.woff2 +0 -0
  96. package/docs/.vitepress/dist/assets/inter-roman-greek-ext.ab0619bc.woff2 +0 -0
  97. package/docs/.vitepress/dist/assets/inter-roman-greek.d5a6d92a.woff2 +0 -0
  98. package/docs/.vitepress/dist/assets/inter-roman-latin-ext.0030eebd.woff2 +0 -0
  99. package/docs/.vitepress/dist/assets/inter-roman-latin.2ed14f66.woff2 +0 -0
  100. package/docs/.vitepress/dist/assets/inter-roman-vietnamese.14ce25a6.woff2 +0 -0
  101. package/docs/.vitepress/dist/assets/style.6747f984.css +1 -0
  102. package/docs/.vitepress/dist/hashmap.json +1 -0
  103. package/docs/.vitepress/theme/index.css +0 -0
  104. package/docs/.vitepress/theme/index.js +12 -0
  105. package/hooks/cipher.js +40 -0
  106. package/hooks/form.js +176 -0
  107. package/hooks/index.js +4 -0
  108. package/hooks/network.js +153 -0
  109. package/hooks/utils.js +61 -0
  110. package/index.html +17 -0
  111. package/index.js +10 -0
  112. package/package.json +75 -0
  113. package/playground/App.vue +45 -0
  114. package/playground/TestButton.vue +15 -0
  115. package/playground/TestForm.vue +271 -0
  116. package/playground/TestFormItem.vue +110 -0
  117. package/playground/TestGrid.vue +22 -0
  118. package/playground/TestPagination.vue +89 -0
  119. package/playground/TestQrcode.vue +7 -0
  120. package/playground/TestResult.vue +12 -0
  121. package/playground/TestSearch.vue +84 -0
  122. package/playground/http.js +23 -0
  123. package/playground/main.js +12 -0
  124. package/postcss.config.cjs +8 -0
  125. package/utils/style.js +13 -0
  126. package/utils/withInstall.js +7 -0
  127. package/vite.config.js +52 -0
@@ -0,0 +1,2120 @@
1
+ var Re = Object.defineProperty;
2
+ var Ve = (t, n, e) => n in t ? Re(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var L = (t, n, e) => (Ve(t, typeof n != "symbol" ? n + "" : n, e), e);
4
+ import { reduce as $e, find as ke, isString as me, isFunction as Ee, cloneDeep as Ze, isDate as De, isBoolean as Ke, isObject as se, isUndefined as ze, isArray as Fe } from "lodash-es";
5
+ import ie from "axios";
6
+ import { showToast as je, closeToast as Ye, showSuccessToast as Me, showFailToast as Ct } from "vant";
7
+ const be = {
8
+ STATE_CODE_SUCCESS: "SUCCESS",
9
+ // 成功
10
+ STATE_CODE_FAIL: "FAIL",
11
+ // 失败
12
+ STATE_CODE_NOT_FOUND: "NOT_FOUND",
13
+ // 找不到资源
14
+ STATE_CODE_INFO_NOT_COMPLETE: "INCOMPLETE",
15
+ // 信息不完整
16
+ STATE_CODE_NOT_ALLOWED: "NOT_ALLOWED"
17
+ //没有权限
18
+ };
19
+ function Ge(t) {
20
+ return t || (t = {}), t.loading = !0, {
21
+ /**
22
+ * get请求
23
+ * @param url
24
+ * @param {Object} [config] - axios config
25
+ * @returns {Promise<unknown>}
26
+ */
27
+ get(n, e) {
28
+ return new Promise((o, r) => {
29
+ ie.get(n, e).then((s) => {
30
+ o(s);
31
+ }).catch((s) => {
32
+ r(s);
33
+ }).finally(() => {
34
+ t.loading = !1;
35
+ });
36
+ });
37
+ },
38
+ /**
39
+ * post请求
40
+ * @param {string} url
41
+ * @param {Object} data
42
+ * @param {Object} [config] - axios config
43
+ * @returns {Promise<unknown>}
44
+ */
45
+ post(n, e, o) {
46
+ return new Promise((r, s) => {
47
+ ie.post(n, e, o).then((c) => {
48
+ r(c);
49
+ }).catch((c) => {
50
+ s(c);
51
+ }).finally(() => {
52
+ t.loading = !1;
53
+ });
54
+ });
55
+ }
56
+ };
57
+ }
58
+ const Er = async (t, n, e) => {
59
+ if (t.finishedText = t.finishedText || "加载完毕", t.loading = !0, !t.uri) {
60
+ console.error("URI is required in pagination");
61
+ return;
62
+ }
63
+ let o = {};
64
+ try {
65
+ je({ type: "loading", message: "加载中...", forbidClick: !0, overlay: !0, duration: 0 }), o = await Ge().get(t.uri, {
66
+ params: { ...t.params || {}, page: n || !t.page ? 1 : t.page + 1 }
67
+ });
68
+ } catch {
69
+ t.loading = !1, t.finished = !1, t.error = !0;
70
+ return;
71
+ } finally {
72
+ Ye(!0);
73
+ }
74
+ if (o.status !== be.STATE_CODE_SUCCESS) {
75
+ t.loading = !1, t.error = !0, t.errorText = o.result;
76
+ return;
77
+ }
78
+ let r;
79
+ e ? r = e(o) : r = o.result;
80
+ let s = r.data;
81
+ !n && t.items && (s = t.items.concat(s));
82
+ const c = r.current_page || r.current || r.page || 1, i = r.last_page || r.lastPage || r.pages || 0, l = r.total_size || r.totalSize || r.total || 0;
83
+ t.loading = !1, t.error = !1, t.page = c, t.items = s, t.finished = i === 0 || i === c, t.empty = l === 0;
84
+ };
85
+ function br(t, n) {
86
+ if (!n)
87
+ return "";
88
+ const e = n.find((o) => o.value === t);
89
+ return e ? e.text : "";
90
+ }
91
+ function We(t, n, e) {
92
+ e = e || {
93
+ value: "value",
94
+ label: "label",
95
+ children: "children"
96
+ };
97
+ let o = [];
98
+ return $e(
99
+ n,
100
+ (r, s) => {
101
+ const c = ke(r, { [e.value]: s });
102
+ if (c)
103
+ return o.push(c[e.label]), c[e.children];
104
+ },
105
+ t
106
+ ), o;
107
+ }
108
+ function vr(t, n, e) {
109
+ return e = e || {
110
+ value: "value",
111
+ label: "text",
112
+ children: "children"
113
+ }, We(t, n, e);
114
+ }
115
+ const { STATE_CODE_FAIL: Qe, STATE_CODE_INFO_NOT_COMPLETE: Xe, STATE_CODE_NOT_FOUND: Je, STATE_CODE_NOT_ALLOWED: tn, STATE_CODE_SUCCESS: ce } = be;
116
+ function xr(t) {
117
+ const { url: n, data: e, csrfToken: o } = t;
118
+ let { method: r } = t;
119
+ r = r || "post";
120
+ const s = document.createElement("form");
121
+ if (s.action = n, s.method = r, s.target = "_blank", s.style.display = "none", Object.keys(e).forEach((c) => {
122
+ const i = document.createElement("input");
123
+ i.type = "hidden", i.name = c, i.value = e[c], s.appendChild(i);
124
+ }), !o) {
125
+ const c = document.createElement("input");
126
+ c.type = "hidden", c.name = "_token", c.value = document.querySelector('meta[name="csrf-token"]').getAttribute("content"), s.appendChild(c);
127
+ }
128
+ return document.body.appendChild(s), s;
129
+ }
130
+ function en(t, n) {
131
+ const { status: e } = t, o = t.result, r = {};
132
+ r.default = "请求失败, 请检查数据并重试", r[Qe] = "系统错误,请稍候再试", r[Je] = "请求的内容不存在", r[Xe] = "信息不完整", r[tn] = "没有权限";
133
+ const s = {
134
+ [ce]: "success"
135
+ }, c = n[e] || n[s[e]] || r[e] || r.def;
136
+ me(c) ? e === ce ? Me(c) : Ct(o || c) : Ee(c) && c();
137
+ }
138
+ function Sr(t, n) {
139
+ en(t, { success: n });
140
+ }
141
+ function Br(t) {
142
+ t && t.errorFields ? t.errorFields.forEach((n) => {
143
+ Ct(n.errors.join(" "));
144
+ }) : t && t.response ? Ct("网络异常") : Ct("请检查填写项");
145
+ }
146
+ function Ar(t, n) {
147
+ const e = Ze(t);
148
+ n = n || {};
149
+ const o = (r) => {
150
+ for (let s in r) {
151
+ if (n.date && De(r[s])) {
152
+ r[s] = Math.ceil(r[s].getTime() / 1e3);
153
+ continue;
154
+ }
155
+ if (n.boolean && Ke(r[s])) {
156
+ r[s] = r[s] ? 1 : 0;
157
+ continue;
158
+ }
159
+ if (n.attachment) {
160
+ const c = n.attachment;
161
+ if (se(r[s]) && me(c) && !ze(r[s][c])) {
162
+ r[s] = r[s][c];
163
+ continue;
164
+ } else if (se(r[s]) && Ee(c)) {
165
+ r[s] = c(r[s]);
166
+ continue;
167
+ }
168
+ }
169
+ if (Fe(r[s]))
170
+ for (let c in r[s])
171
+ r[s][c] = o(r[s][c]);
172
+ }
173
+ return r;
174
+ };
175
+ return o(e);
176
+ }
177
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
178
+ const ve = BigInt(0), Ht = BigInt(1), nn = BigInt(2), _t = (t) => t instanceof Uint8Array, rn = Array.from({ length: 256 }, (t, n) => n.toString(16).padStart(2, "0"));
179
+ function nt(t) {
180
+ if (!_t(t))
181
+ throw new Error("Uint8Array expected");
182
+ let n = "";
183
+ for (let e = 0; e < t.length; e++)
184
+ n += rn[t[e]];
185
+ return n;
186
+ }
187
+ function $(t) {
188
+ const n = t.toString(16);
189
+ return n.length & 1 ? `0${n}` : n;
190
+ }
191
+ function _(t) {
192
+ if (typeof t != "string")
193
+ throw new Error("hex string expected, got " + typeof t);
194
+ return BigInt(t === "" ? "0" : `0x${t}`);
195
+ }
196
+ function xt(t) {
197
+ if (typeof t != "string")
198
+ throw new Error("hex string expected, got " + typeof t);
199
+ const n = t.length;
200
+ if (n % 2)
201
+ throw new Error("padded hex string expected, got unpadded hex of length " + n);
202
+ const e = new Uint8Array(n / 2);
203
+ for (let o = 0; o < e.length; o++) {
204
+ const r = o * 2, s = t.slice(r, r + 2), c = Number.parseInt(s, 16);
205
+ if (Number.isNaN(c) || c < 0)
206
+ throw new Error("Invalid byte sequence");
207
+ e[o] = c;
208
+ }
209
+ return e;
210
+ }
211
+ function wt(t) {
212
+ return _(nt(t));
213
+ }
214
+ function Ft(t) {
215
+ if (!_t(t))
216
+ throw new Error("Uint8Array expected");
217
+ return _(nt(Uint8Array.from(t).reverse()));
218
+ }
219
+ function yt(t, n) {
220
+ return xt(t.toString(16).padStart(n * 2, "0"));
221
+ }
222
+ function xe(t, n) {
223
+ return yt(t, n).reverse();
224
+ }
225
+ function on(t) {
226
+ return xt($(t));
227
+ }
228
+ function M(t, n, e) {
229
+ let o;
230
+ if (typeof n == "string")
231
+ try {
232
+ o = xt(n);
233
+ } catch (s) {
234
+ throw new Error(`${t} must be valid hex string, got "${n}". Cause: ${s}`);
235
+ }
236
+ else if (_t(n))
237
+ o = Uint8Array.from(n);
238
+ else
239
+ throw new Error(`${t} must be hex string or Uint8Array`);
240
+ const r = o.length;
241
+ if (typeof e == "number" && r !== e)
242
+ throw new Error(`${t} expected ${e} bytes, got ${r}`);
243
+ return o;
244
+ }
245
+ function j(...t) {
246
+ const n = new Uint8Array(t.reduce((o, r) => o + r.length, 0));
247
+ let e = 0;
248
+ return t.forEach((o) => {
249
+ if (!_t(o))
250
+ throw new Error("Uint8Array expected");
251
+ n.set(o, e), e += o.length;
252
+ }), n;
253
+ }
254
+ function sn(t, n) {
255
+ if (t.length !== n.length)
256
+ return !1;
257
+ for (let e = 0; e < t.length; e++)
258
+ if (t[e] !== n[e])
259
+ return !1;
260
+ return !0;
261
+ }
262
+ function cn(t) {
263
+ if (typeof t != "string")
264
+ throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
265
+ return new Uint8Array(new TextEncoder().encode(t));
266
+ }
267
+ function ln(t) {
268
+ let n;
269
+ for (n = 0; t > ve; t >>= Ht, n += 1)
270
+ ;
271
+ return n;
272
+ }
273
+ function fn(t, n) {
274
+ return t >> BigInt(n) & Ht;
275
+ }
276
+ const un = (t, n, e) => t | (e ? Ht : ve) << BigInt(n), jt = (t) => (nn << BigInt(t - 1)) - Ht, Vt = (t) => new Uint8Array(t), le = (t) => Uint8Array.from(t);
277
+ function Se(t, n, e) {
278
+ if (typeof t != "number" || t < 2)
279
+ throw new Error("hashLen must be a number");
280
+ if (typeof n != "number" || n < 2)
281
+ throw new Error("qByteLen must be a number");
282
+ if (typeof e != "function")
283
+ throw new Error("hmacFn must be a function");
284
+ let o = Vt(t), r = Vt(t), s = 0;
285
+ const c = () => {
286
+ o.fill(1), r.fill(0), s = 0;
287
+ }, i = (...u) => e(r, o, ...u), l = (u = Vt()) => {
288
+ r = i(le([0]), u), o = i(), u.length !== 0 && (r = i(le([1]), u), o = i());
289
+ }, f = () => {
290
+ if (s++ >= 1e3)
291
+ throw new Error("drbg: tried 1000 values");
292
+ let u = 0;
293
+ const m = [];
294
+ for (; u < n; ) {
295
+ o = i();
296
+ const b = o.slice();
297
+ m.push(b), u += o.length;
298
+ }
299
+ return j(...m);
300
+ };
301
+ return (u, m) => {
302
+ c(), l(u);
303
+ let b;
304
+ for (; !(b = m(f())); )
305
+ l();
306
+ return c(), b;
307
+ };
308
+ }
309
+ const an = {
310
+ bigint: (t) => typeof t == "bigint",
311
+ function: (t) => typeof t == "function",
312
+ boolean: (t) => typeof t == "boolean",
313
+ string: (t) => typeof t == "string",
314
+ isSafeInteger: (t) => Number.isSafeInteger(t),
315
+ array: (t) => Array.isArray(t),
316
+ field: (t, n) => n.Fp.isValid(t),
317
+ hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
318
+ };
319
+ function It(t, n, e = {}) {
320
+ const o = (r, s, c) => {
321
+ const i = an[s];
322
+ if (typeof i != "function")
323
+ throw new Error(`Invalid validator "${s}", expected function`);
324
+ const l = t[r];
325
+ if (!(c && l === void 0) && !i(l, t))
326
+ throw new Error(`Invalid param ${String(r)}=${l} (${typeof l}), expected ${s}`);
327
+ };
328
+ for (const [r, s] of Object.entries(n))
329
+ o(r, s, !1);
330
+ for (const [r, s] of Object.entries(e))
331
+ o(r, s, !0);
332
+ return t;
333
+ }
334
+ const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
335
+ __proto__: null,
336
+ bitGet: fn,
337
+ bitLen: ln,
338
+ bitMask: jt,
339
+ bitSet: un,
340
+ bytesToHex: nt,
341
+ bytesToNumberBE: wt,
342
+ bytesToNumberLE: Ft,
343
+ concatBytes: j,
344
+ createHmacDrbg: Se,
345
+ ensureBytes: M,
346
+ equalBytes: sn,
347
+ hexToBytes: xt,
348
+ hexToNumber: _,
349
+ numberToBytesBE: yt,
350
+ numberToBytesLE: xe,
351
+ numberToHexUnpadded: $,
352
+ numberToVarBytesBE: on,
353
+ utf8ToBytes: cn,
354
+ validateObject: It
355
+ }, Symbol.toStringTag, { value: "Module" }));
356
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
357
+ const V = BigInt(0), H = BigInt(1), ht = BigInt(2), dn = BigInt(3), Kt = BigInt(4), fe = BigInt(5), ue = BigInt(8);
358
+ BigInt(9);
359
+ BigInt(16);
360
+ function Z(t, n) {
361
+ const e = t % n;
362
+ return e >= V ? e : n + e;
363
+ }
364
+ function gn(t, n, e) {
365
+ if (e <= V || n < V)
366
+ throw new Error("Expected power/modulo > 0");
367
+ if (e === H)
368
+ return V;
369
+ let o = H;
370
+ for (; n > V; )
371
+ n & H && (o = o * t % e), t = t * t % e, n >>= H;
372
+ return o;
373
+ }
374
+ function zt(t, n) {
375
+ if (t === V || n <= V)
376
+ throw new Error(`invert: expected positive integers, got n=${t} mod=${n}`);
377
+ let e = Z(t, n), o = n, r = V, s = H;
378
+ for (; e !== V; ) {
379
+ const i = o / e, l = o % e, f = r - s * i;
380
+ o = e, e = l, r = s, s = f;
381
+ }
382
+ if (o !== H)
383
+ throw new Error("invert: does not exist");
384
+ return Z(r, n);
385
+ }
386
+ function wn(t) {
387
+ const n = (t - H) / ht;
388
+ let e, o, r;
389
+ for (e = t - H, o = 0; e % ht === V; e /= ht, o++)
390
+ ;
391
+ for (r = ht; r < t && gn(r, n, t) !== t - H; r++)
392
+ ;
393
+ if (o === 1) {
394
+ const c = (t + H) / Kt;
395
+ return function(l, f) {
396
+ const h = l.pow(f, c);
397
+ if (!l.eql(l.sqr(h), f))
398
+ throw new Error("Cannot find square root");
399
+ return h;
400
+ };
401
+ }
402
+ const s = (e + H) / ht;
403
+ return function(i, l) {
404
+ if (i.pow(l, n) === i.neg(i.ONE))
405
+ throw new Error("Cannot find square root");
406
+ let f = o, h = i.pow(i.mul(i.ONE, r), e), u = i.pow(l, s), m = i.pow(l, e);
407
+ for (; !i.eql(m, i.ONE); ) {
408
+ if (i.eql(m, i.ZERO))
409
+ return i.ZERO;
410
+ let b = 1;
411
+ for (let a = i.sqr(m); b < f && !i.eql(a, i.ONE); b++)
412
+ a = i.sqr(a);
413
+ const g = i.pow(h, H << BigInt(f - b - 1));
414
+ h = i.sqr(g), u = i.mul(u, g), m = i.mul(m, h), f = b;
415
+ }
416
+ return u;
417
+ };
418
+ }
419
+ function yn(t) {
420
+ if (t % Kt === dn) {
421
+ const n = (t + H) / Kt;
422
+ return function(o, r) {
423
+ const s = o.pow(r, n);
424
+ if (!o.eql(o.sqr(s), r))
425
+ throw new Error("Cannot find square root");
426
+ return s;
427
+ };
428
+ }
429
+ if (t % ue === fe) {
430
+ const n = (t - fe) / ue;
431
+ return function(o, r) {
432
+ const s = o.mul(r, ht), c = o.pow(s, n), i = o.mul(r, c), l = o.mul(o.mul(i, ht), c), f = o.mul(i, o.sub(l, o.ONE));
433
+ if (!o.eql(o.sqr(f), r))
434
+ throw new Error("Cannot find square root");
435
+ return f;
436
+ };
437
+ }
438
+ return wn(t);
439
+ }
440
+ const pn = [
441
+ "create",
442
+ "isValid",
443
+ "is0",
444
+ "neg",
445
+ "inv",
446
+ "sqrt",
447
+ "sqr",
448
+ "eql",
449
+ "add",
450
+ "sub",
451
+ "mul",
452
+ "pow",
453
+ "div",
454
+ "addN",
455
+ "subN",
456
+ "mulN",
457
+ "sqrN"
458
+ ];
459
+ function mn(t) {
460
+ const n = {
461
+ ORDER: "bigint",
462
+ MASK: "bigint",
463
+ BYTES: "isSafeInteger",
464
+ BITS: "isSafeInteger"
465
+ }, e = pn.reduce((o, r) => (o[r] = "function", o), n);
466
+ return It(t, e);
467
+ }
468
+ function En(t, n, e) {
469
+ if (e < V)
470
+ throw new Error("Expected power > 0");
471
+ if (e === V)
472
+ return t.ONE;
473
+ if (e === H)
474
+ return n;
475
+ let o = t.ONE, r = n;
476
+ for (; e > V; )
477
+ e & H && (o = t.mul(o, r)), r = t.sqr(r), e >>= H;
478
+ return o;
479
+ }
480
+ function bn(t, n) {
481
+ const e = new Array(n.length), o = n.reduce((s, c, i) => t.is0(c) ? s : (e[i] = s, t.mul(s, c)), t.ONE), r = t.inv(o);
482
+ return n.reduceRight((s, c, i) => t.is0(c) ? s : (e[i] = t.mul(s, e[i]), t.mul(s, c)), r), e;
483
+ }
484
+ function Yt(t, n) {
485
+ const e = n !== void 0 ? n : t.toString(2).length, o = Math.ceil(e / 8);
486
+ return { nBitLength: e, nByteLength: o };
487
+ }
488
+ function Be(t, n, e = !1, o = {}) {
489
+ if (t <= V)
490
+ throw new Error(`Expected Fp ORDER > 0, got ${t}`);
491
+ const { nBitLength: r, nByteLength: s } = Yt(t, n);
492
+ if (s > 2048)
493
+ throw new Error("Field lengths over 2048 bytes are not supported");
494
+ const c = yn(t), i = Object.freeze({
495
+ ORDER: t,
496
+ BITS: r,
497
+ BYTES: s,
498
+ MASK: jt(r),
499
+ ZERO: V,
500
+ ONE: H,
501
+ create: (l) => Z(l, t),
502
+ isValid: (l) => {
503
+ if (typeof l != "bigint")
504
+ throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);
505
+ return V <= l && l < t;
506
+ },
507
+ is0: (l) => l === V,
508
+ isOdd: (l) => (l & H) === H,
509
+ neg: (l) => Z(-l, t),
510
+ eql: (l, f) => l === f,
511
+ sqr: (l) => Z(l * l, t),
512
+ add: (l, f) => Z(l + f, t),
513
+ sub: (l, f) => Z(l - f, t),
514
+ mul: (l, f) => Z(l * f, t),
515
+ pow: (l, f) => En(i, l, f),
516
+ div: (l, f) => Z(l * zt(f, t), t),
517
+ // Same as above, but doesn't normalize
518
+ sqrN: (l) => l * l,
519
+ addN: (l, f) => l + f,
520
+ subN: (l, f) => l - f,
521
+ mulN: (l, f) => l * f,
522
+ inv: (l) => zt(l, t),
523
+ sqrt: o.sqrt || ((l) => c(i, l)),
524
+ invertBatch: (l) => bn(i, l),
525
+ // TODO: do we really need constant cmov?
526
+ // We don't have const-time bigints anyway, so probably will be not very useful
527
+ cmov: (l, f, h) => h ? f : l,
528
+ toBytes: (l) => e ? xe(l, s) : yt(l, s),
529
+ fromBytes: (l) => {
530
+ if (l.length !== s)
531
+ throw new Error(`Fp.fromBytes: expected ${s}, got ${l.length}`);
532
+ return e ? Ft(l) : wt(l);
533
+ }
534
+ });
535
+ return Object.freeze(i);
536
+ }
537
+ function vn(t, n, e = !1) {
538
+ t = M("privateHash", t);
539
+ const o = t.length, r = Yt(n).nByteLength + 8;
540
+ if (r < 24 || o < r || o > 1024)
541
+ throw new Error(`hashToPrivateScalar: expected ${r}-1024 bytes of input, got ${o}`);
542
+ const s = e ? Ft(t) : wt(t);
543
+ return Z(s, n - H) + H;
544
+ }
545
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
546
+ const xn = BigInt(0), $t = BigInt(1);
547
+ function Sn(t, n) {
548
+ const e = (r, s) => {
549
+ const c = s.negate();
550
+ return r ? c : s;
551
+ }, o = (r) => {
552
+ const s = Math.ceil(n / r) + 1, c = 2 ** (r - 1);
553
+ return { windows: s, windowSize: c };
554
+ };
555
+ return {
556
+ constTimeNegate: e,
557
+ // non-const time multiplication ladder
558
+ unsafeLadder(r, s) {
559
+ let c = t.ZERO, i = r;
560
+ for (; s > xn; )
561
+ s & $t && (c = c.add(i)), i = i.double(), s >>= $t;
562
+ return c;
563
+ },
564
+ /**
565
+ * Creates a wNAF precomputation window. Used for caching.
566
+ * Default window size is set by `utils.precompute()` and is equal to 8.
567
+ * Number of precomputed points depends on the curve size:
568
+ * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
569
+ * - 𝑊 is the window size
570
+ * - 𝑛 is the bitlength of the curve order.
571
+ * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
572
+ * @returns precomputed point tables flattened to a single array
573
+ */
574
+ precomputeWindow(r, s) {
575
+ const { windows: c, windowSize: i } = o(s), l = [];
576
+ let f = r, h = f;
577
+ for (let u = 0; u < c; u++) {
578
+ h = f, l.push(h);
579
+ for (let m = 1; m < i; m++)
580
+ h = h.add(f), l.push(h);
581
+ f = h.double();
582
+ }
583
+ return l;
584
+ },
585
+ /**
586
+ * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
587
+ * @param W window size
588
+ * @param precomputes precomputed tables
589
+ * @param n scalar (we don't check here, but should be less than curve order)
590
+ * @returns real and fake (for const-time) points
591
+ */
592
+ wNAF(r, s, c) {
593
+ const { windows: i, windowSize: l } = o(r);
594
+ let f = t.ZERO, h = t.BASE;
595
+ const u = BigInt(2 ** r - 1), m = 2 ** r, b = BigInt(r);
596
+ for (let g = 0; g < i; g++) {
597
+ const a = g * l;
598
+ let w = Number(c & u);
599
+ c >>= b, w > l && (w -= m, c += $t);
600
+ const y = a, v = a + Math.abs(w) - 1, S = g % 2 !== 0, I = w < 0;
601
+ w === 0 ? h = h.add(e(S, s[y])) : f = f.add(e(I, s[v]));
602
+ }
603
+ return { p: f, f: h };
604
+ },
605
+ wNAFCached(r, s, c, i) {
606
+ const l = r._WINDOW_SIZE || 1;
607
+ let f = s.get(r);
608
+ return f || (f = this.precomputeWindow(r, l), l !== 1 && s.set(r, i(f))), this.wNAF(l, f, c);
609
+ }
610
+ };
611
+ }
612
+ function Ae(t) {
613
+ return mn(t.Fp), It(t, {
614
+ n: "bigint",
615
+ h: "bigint",
616
+ Gx: "field",
617
+ Gy: "field"
618
+ }, {
619
+ nBitLength: "isSafeInteger",
620
+ nByteLength: "isSafeInteger"
621
+ }), Object.freeze({
622
+ ...Yt(t.n, t.nBitLength),
623
+ ...t,
624
+ p: t.Fp.ORDER
625
+ });
626
+ }
627
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
628
+ function Bn(t) {
629
+ const n = Ae(t);
630
+ It(n, {
631
+ a: "field",
632
+ b: "field"
633
+ }, {
634
+ allowedPrivateKeyLengths: "array",
635
+ wrapPrivateKey: "boolean",
636
+ isTorsionFree: "function",
637
+ clearCofactor: "function",
638
+ allowInfinityPoint: "boolean",
639
+ fromBytes: "function",
640
+ toBytes: "function"
641
+ });
642
+ const { endo: e, Fp: o, a: r } = n;
643
+ if (e) {
644
+ if (!o.eql(r, o.ZERO))
645
+ throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");
646
+ if (typeof e != "object" || typeof e.beta != "bigint" || typeof e.splitScalar != "function")
647
+ throw new Error("Expected endomorphism with beta: bigint and splitScalar: function");
648
+ }
649
+ return Object.freeze({ ...n });
650
+ }
651
+ const { bytesToNumberBE: An, hexToBytes: Tn } = hn, dt = {
652
+ // asn.1 DER encoding utils
653
+ Err: class extends Error {
654
+ constructor(n = "") {
655
+ super(n);
656
+ }
657
+ },
658
+ _parseInt(t) {
659
+ const { Err: n } = dt;
660
+ if (t.length < 2 || t[0] !== 2)
661
+ throw new n("Invalid signature integer tag");
662
+ const e = t[1], o = t.subarray(2, e + 2);
663
+ if (!e || o.length !== e)
664
+ throw new n("Invalid signature integer: wrong length");
665
+ if (o[0] & 128)
666
+ throw new n("Invalid signature integer: negative");
667
+ if (o[0] === 0 && !(o[1] & 128))
668
+ throw new n("Invalid signature integer: unnecessary leading zero");
669
+ return { d: An(o), l: t.subarray(e + 2) };
670
+ },
671
+ toSig(t) {
672
+ const { Err: n } = dt, e = typeof t == "string" ? Tn(t) : t;
673
+ if (!(e instanceof Uint8Array))
674
+ throw new Error("ui8a expected");
675
+ let o = e.length;
676
+ if (o < 2 || e[0] != 48)
677
+ throw new n("Invalid signature tag");
678
+ if (e[1] !== o - 2)
679
+ throw new n("Invalid signature: incorrect length");
680
+ const { d: r, l: s } = dt._parseInt(e.subarray(2)), { d: c, l: i } = dt._parseInt(s);
681
+ if (i.length)
682
+ throw new n("Invalid signature: left bytes after parsing");
683
+ return { r, s: c };
684
+ },
685
+ hexFromSig(t) {
686
+ const n = (f) => Number.parseInt(f[0], 16) & 8 ? "00" + f : f, e = (f) => {
687
+ const h = f.toString(16);
688
+ return h.length & 1 ? `0${h}` : h;
689
+ }, o = n(e(t.s)), r = n(e(t.r)), s = o.length / 2, c = r.length / 2, i = e(s), l = e(c);
690
+ return `30${e(c + s + 4)}02${l}${r}02${i}${o}`;
691
+ }
692
+ }, et = BigInt(0), G = BigInt(1);
693
+ BigInt(2);
694
+ const ae = BigInt(3);
695
+ BigInt(4);
696
+ function In(t) {
697
+ const n = Bn(t), { Fp: e } = n, o = n.toBytes || ((g, a, w) => {
698
+ const y = a.toAffine();
699
+ return j(Uint8Array.from([4]), e.toBytes(y.x), e.toBytes(y.y));
700
+ }), r = n.fromBytes || ((g) => {
701
+ const a = g.subarray(1), w = e.fromBytes(a.subarray(0, e.BYTES)), y = e.fromBytes(a.subarray(e.BYTES, 2 * e.BYTES));
702
+ return { x: w, y };
703
+ });
704
+ function s(g) {
705
+ const { a, b: w } = n, y = e.sqr(g), v = e.mul(y, g);
706
+ return e.add(e.add(v, e.mul(g, a)), w);
707
+ }
708
+ if (!e.eql(e.sqr(n.Gy), s(n.Gx)))
709
+ throw new Error("bad generator point: equation left != right");
710
+ function c(g) {
711
+ return typeof g == "bigint" && et < g && g < n.n;
712
+ }
713
+ function i(g) {
714
+ if (!c(g))
715
+ throw new Error("Expected valid bigint: 0 < bigint < curve.n");
716
+ }
717
+ function l(g) {
718
+ const { allowedPrivateKeyLengths: a, nByteLength: w, wrapPrivateKey: y, n: v } = n;
719
+ if (a && typeof g != "bigint") {
720
+ if (g instanceof Uint8Array && (g = nt(g)), typeof g != "string" || !a.includes(g.length))
721
+ throw new Error("Invalid key");
722
+ g = g.padStart(w * 2, "0");
723
+ }
724
+ let S;
725
+ try {
726
+ S = typeof g == "bigint" ? g : wt(M("private key", g, w));
727
+ } catch {
728
+ throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof g}`);
729
+ }
730
+ return y && (S = Z(S, v)), i(S), S;
731
+ }
732
+ const f = /* @__PURE__ */ new Map();
733
+ function h(g) {
734
+ if (!(g instanceof u))
735
+ throw new Error("ProjectivePoint expected");
736
+ }
737
+ class u {
738
+ constructor(a, w, y) {
739
+ if (this.px = a, this.py = w, this.pz = y, a == null || !e.isValid(a))
740
+ throw new Error("x required");
741
+ if (w == null || !e.isValid(w))
742
+ throw new Error("y required");
743
+ if (y == null || !e.isValid(y))
744
+ throw new Error("z required");
745
+ }
746
+ // Does not validate if the point is on-curve.
747
+ // Use fromHex instead, or call assertValidity() later.
748
+ static fromAffine(a) {
749
+ const { x: w, y } = a || {};
750
+ if (!a || !e.isValid(w) || !e.isValid(y))
751
+ throw new Error("invalid affine point");
752
+ if (a instanceof u)
753
+ throw new Error("projective point not allowed");
754
+ const v = (S) => e.eql(S, e.ZERO);
755
+ return v(w) && v(y) ? u.ZERO : new u(w, y, e.ONE);
756
+ }
757
+ get x() {
758
+ return this.toAffine().x;
759
+ }
760
+ get y() {
761
+ return this.toAffine().y;
762
+ }
763
+ /**
764
+ * Takes a bunch of Projective Points but executes only one
765
+ * inversion on all of them. Inversion is very slow operation,
766
+ * so this improves performance massively.
767
+ * Optimization: converts a list of projective points to a list of identical points with Z=1.
768
+ */
769
+ static normalizeZ(a) {
770
+ const w = e.invertBatch(a.map((y) => y.pz));
771
+ return a.map((y, v) => y.toAffine(w[v])).map(u.fromAffine);
772
+ }
773
+ /**
774
+ * Converts hash string or Uint8Array to Point.
775
+ * @param hex short/long ECDSA hex
776
+ */
777
+ static fromHex(a) {
778
+ const w = u.fromAffine(r(M("pointHex", a)));
779
+ return w.assertValidity(), w;
780
+ }
781
+ // Multiplies generator point by privateKey.
782
+ static fromPrivateKey(a) {
783
+ return u.BASE.multiply(l(a));
784
+ }
785
+ // "Private method", don't use it directly
786
+ _setWindowSize(a) {
787
+ this._WINDOW_SIZE = a, f.delete(this);
788
+ }
789
+ // A point on curve is valid if it conforms to equation.
790
+ assertValidity() {
791
+ if (this.is0()) {
792
+ if (n.allowInfinityPoint)
793
+ return;
794
+ throw new Error("bad point: ZERO");
795
+ }
796
+ const { x: a, y: w } = this.toAffine();
797
+ if (!e.isValid(a) || !e.isValid(w))
798
+ throw new Error("bad point: x or y not FE");
799
+ const y = e.sqr(w), v = s(a);
800
+ if (!e.eql(y, v))
801
+ throw new Error("bad point: equation left != right");
802
+ if (!this.isTorsionFree())
803
+ throw new Error("bad point: not in prime-order subgroup");
804
+ }
805
+ hasEvenY() {
806
+ const { y: a } = this.toAffine();
807
+ if (e.isOdd)
808
+ return !e.isOdd(a);
809
+ throw new Error("Field doesn't support isOdd");
810
+ }
811
+ /**
812
+ * Compare one point to another.
813
+ */
814
+ equals(a) {
815
+ h(a);
816
+ const { px: w, py: y, pz: v } = this, { px: S, py: I, pz: T } = a, E = e.eql(e.mul(w, T), e.mul(S, v)), x = e.eql(e.mul(y, T), e.mul(I, v));
817
+ return E && x;
818
+ }
819
+ /**
820
+ * Flips point to one corresponding to (x, -y) in Affine coordinates.
821
+ */
822
+ negate() {
823
+ return new u(this.px, e.neg(this.py), this.pz);
824
+ }
825
+ // Renes-Costello-Batina exception-free doubling formula.
826
+ // There is 30% faster Jacobian formula, but it is not complete.
827
+ // https://eprint.iacr.org/2015/1060, algorithm 3
828
+ // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
829
+ double() {
830
+ const { a, b: w } = n, y = e.mul(w, ae), { px: v, py: S, pz: I } = this;
831
+ let T = e.ZERO, E = e.ZERO, x = e.ZERO, A = e.mul(v, v), Y = e.mul(S, S), C = e.mul(I, I), O = e.mul(v, S);
832
+ return O = e.add(O, O), x = e.mul(v, I), x = e.add(x, x), T = e.mul(a, x), E = e.mul(y, C), E = e.add(T, E), T = e.sub(Y, E), E = e.add(Y, E), E = e.mul(T, E), T = e.mul(O, T), x = e.mul(y, x), C = e.mul(a, C), O = e.sub(A, C), O = e.mul(a, O), O = e.add(O, x), x = e.add(A, A), A = e.add(x, A), A = e.add(A, C), A = e.mul(A, O), E = e.add(E, A), C = e.mul(S, I), C = e.add(C, C), A = e.mul(C, O), T = e.sub(T, A), x = e.mul(C, Y), x = e.add(x, x), x = e.add(x, x), new u(T, E, x);
833
+ }
834
+ // Renes-Costello-Batina exception-free addition formula.
835
+ // There is 30% faster Jacobian formula, but it is not complete.
836
+ // https://eprint.iacr.org/2015/1060, algorithm 1
837
+ // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
838
+ add(a) {
839
+ h(a);
840
+ const { px: w, py: y, pz: v } = this, { px: S, py: I, pz: T } = a;
841
+ let E = e.ZERO, x = e.ZERO, A = e.ZERO;
842
+ const Y = n.a, C = e.mul(n.b, ae);
843
+ let O = e.mul(w, S), D = e.mul(y, I), K = e.mul(v, T), rt = e.add(w, y), d = e.add(S, I);
844
+ rt = e.mul(rt, d), d = e.add(O, D), rt = e.sub(rt, d), d = e.add(w, v);
845
+ let p = e.add(S, T);
846
+ return d = e.mul(d, p), p = e.add(O, K), d = e.sub(d, p), p = e.add(y, v), E = e.add(I, T), p = e.mul(p, E), E = e.add(D, K), p = e.sub(p, E), A = e.mul(Y, d), E = e.mul(C, K), A = e.add(E, A), E = e.sub(D, A), A = e.add(D, A), x = e.mul(E, A), D = e.add(O, O), D = e.add(D, O), K = e.mul(Y, K), d = e.mul(C, d), D = e.add(D, K), K = e.sub(O, K), K = e.mul(Y, K), d = e.add(d, K), O = e.mul(D, d), x = e.add(x, O), O = e.mul(p, d), E = e.mul(rt, E), E = e.sub(E, O), O = e.mul(rt, D), A = e.mul(p, A), A = e.add(A, O), new u(E, x, A);
847
+ }
848
+ subtract(a) {
849
+ return this.add(a.negate());
850
+ }
851
+ is0() {
852
+ return this.equals(u.ZERO);
853
+ }
854
+ wNAF(a) {
855
+ return b.wNAFCached(this, f, a, (w) => {
856
+ const y = e.invertBatch(w.map((v) => v.pz));
857
+ return w.map((v, S) => v.toAffine(y[S])).map(u.fromAffine);
858
+ });
859
+ }
860
+ /**
861
+ * Non-constant-time multiplication. Uses double-and-add algorithm.
862
+ * It's faster, but should only be used when you don't care about
863
+ * an exposed private key e.g. sig verification, which works over *public* keys.
864
+ */
865
+ multiplyUnsafe(a) {
866
+ const w = u.ZERO;
867
+ if (a === et)
868
+ return w;
869
+ if (i(a), a === G)
870
+ return this;
871
+ const { endo: y } = n;
872
+ if (!y)
873
+ return b.unsafeLadder(this, a);
874
+ let { k1neg: v, k1: S, k2neg: I, k2: T } = y.splitScalar(a), E = w, x = w, A = this;
875
+ for (; S > et || T > et; )
876
+ S & G && (E = E.add(A)), T & G && (x = x.add(A)), A = A.double(), S >>= G, T >>= G;
877
+ return v && (E = E.negate()), I && (x = x.negate()), x = new u(e.mul(x.px, y.beta), x.py, x.pz), E.add(x);
878
+ }
879
+ /**
880
+ * Constant time multiplication.
881
+ * Uses wNAF method. Windowed method may be 10% faster,
882
+ * but takes 2x longer to generate and consumes 2x memory.
883
+ * Uses precomputes when available.
884
+ * Uses endomorphism for Koblitz curves.
885
+ * @param scalar by which the point would be multiplied
886
+ * @returns New point
887
+ */
888
+ multiply(a) {
889
+ i(a);
890
+ let w = a, y, v;
891
+ const { endo: S } = n;
892
+ if (S) {
893
+ const { k1neg: I, k1: T, k2neg: E, k2: x } = S.splitScalar(w);
894
+ let { p: A, f: Y } = this.wNAF(T), { p: C, f: O } = this.wNAF(x);
895
+ A = b.constTimeNegate(I, A), C = b.constTimeNegate(E, C), C = new u(e.mul(C.px, S.beta), C.py, C.pz), y = A.add(C), v = Y.add(O);
896
+ } else {
897
+ const { p: I, f: T } = this.wNAF(w);
898
+ y = I, v = T;
899
+ }
900
+ return u.normalizeZ([y, v])[0];
901
+ }
902
+ /**
903
+ * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
904
+ * Not using Strauss-Shamir trick: precomputation tables are faster.
905
+ * The trick could be useful if both P and Q are not G (not in our case).
906
+ * @returns non-zero affine point
907
+ */
908
+ multiplyAndAddUnsafe(a, w, y) {
909
+ const v = u.BASE, S = (T, E) => E === et || E === G || !T.equals(v) ? T.multiplyUnsafe(E) : T.multiply(E), I = S(this, w).add(S(a, y));
910
+ return I.is0() ? void 0 : I;
911
+ }
912
+ // Converts Projective point to affine (x, y) coordinates.
913
+ // Can accept precomputed Z^-1 - for example, from invertBatch.
914
+ // (x, y, z) ∋ (x=x/z, y=y/z)
915
+ toAffine(a) {
916
+ const { px: w, py: y, pz: v } = this, S = this.is0();
917
+ a == null && (a = S ? e.ONE : e.inv(v));
918
+ const I = e.mul(w, a), T = e.mul(y, a), E = e.mul(v, a);
919
+ if (S)
920
+ return { x: e.ZERO, y: e.ZERO };
921
+ if (!e.eql(E, e.ONE))
922
+ throw new Error("invZ was invalid");
923
+ return { x: I, y: T };
924
+ }
925
+ isTorsionFree() {
926
+ const { h: a, isTorsionFree: w } = n;
927
+ if (a === G)
928
+ return !0;
929
+ if (w)
930
+ return w(u, this);
931
+ throw new Error("isTorsionFree() has not been declared for the elliptic curve");
932
+ }
933
+ clearCofactor() {
934
+ const { h: a, clearCofactor: w } = n;
935
+ return a === G ? this : w ? w(u, this) : this.multiplyUnsafe(n.h);
936
+ }
937
+ toRawBytes(a = !0) {
938
+ return this.assertValidity(), o(u, this, a);
939
+ }
940
+ toHex(a = !0) {
941
+ return nt(this.toRawBytes(a));
942
+ }
943
+ }
944
+ u.BASE = new u(n.Gx, n.Gy, e.ONE), u.ZERO = new u(e.ZERO, e.ONE, e.ZERO);
945
+ const m = n.nBitLength, b = Sn(u, n.endo ? Math.ceil(m / 2) : m);
946
+ return {
947
+ CURVE: n,
948
+ ProjectivePoint: u,
949
+ normPrivateKeyToScalar: l,
950
+ weierstrassEquation: s,
951
+ isWithinCurveOrder: c
952
+ };
953
+ }
954
+ function On(t) {
955
+ const n = Ae(t);
956
+ return It(n, {
957
+ hash: "hash",
958
+ hmac: "function",
959
+ randomBytes: "function"
960
+ }, {
961
+ bits2int: "function",
962
+ bits2int_modN: "function",
963
+ lowS: "boolean"
964
+ }), Object.freeze({ lowS: !0, ...n });
965
+ }
966
+ function Pn(t) {
967
+ const n = On(t), { Fp: e, n: o } = n, r = e.BYTES + 1, s = 2 * e.BYTES + 1;
968
+ function c(d) {
969
+ return et < d && d < e.ORDER;
970
+ }
971
+ function i(d) {
972
+ return Z(d, o);
973
+ }
974
+ function l(d) {
975
+ return zt(d, o);
976
+ }
977
+ const { ProjectivePoint: f, normPrivateKeyToScalar: h, weierstrassEquation: u, isWithinCurveOrder: m } = In({
978
+ ...n,
979
+ toBytes(d, p, B) {
980
+ const U = p.toAffine(), P = e.toBytes(U.x), R = j;
981
+ return B ? R(Uint8Array.from([p.hasEvenY() ? 2 : 3]), P) : R(Uint8Array.from([4]), P, e.toBytes(U.y));
982
+ },
983
+ fromBytes(d) {
984
+ const p = d.length, B = d[0], U = d.subarray(1);
985
+ if (p === r && (B === 2 || B === 3)) {
986
+ const P = wt(U);
987
+ if (!c(P))
988
+ throw new Error("Point is not on curve");
989
+ const R = u(P);
990
+ let z = e.sqrt(R);
991
+ const F = (z & G) === G;
992
+ return (B & 1) === 1 !== F && (z = e.neg(z)), { x: P, y: z };
993
+ } else if (p === s && B === 4) {
994
+ const P = e.fromBytes(U.subarray(0, e.BYTES)), R = e.fromBytes(U.subarray(e.BYTES, 2 * e.BYTES));
995
+ return { x: P, y: R };
996
+ } else
997
+ throw new Error(`Point of length ${p} was invalid. Expected ${r} compressed bytes or ${s} uncompressed bytes`);
998
+ }
999
+ }), b = (d) => nt(yt(d, n.nByteLength));
1000
+ function g(d) {
1001
+ const p = o >> G;
1002
+ return d > p;
1003
+ }
1004
+ function a(d) {
1005
+ return g(d) ? i(-d) : d;
1006
+ }
1007
+ const w = (d, p, B) => wt(d.slice(p, B));
1008
+ class y {
1009
+ constructor(p, B, U) {
1010
+ this.r = p, this.s = B, this.recovery = U, this.assertValidity();
1011
+ }
1012
+ // pair (bytes of r, bytes of s)
1013
+ static fromCompact(p) {
1014
+ const B = n.nByteLength;
1015
+ return p = M("compactSignature", p, B * 2), new y(w(p, 0, B), w(p, B, 2 * B));
1016
+ }
1017
+ // DER encoded ECDSA signature
1018
+ // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
1019
+ static fromDER(p) {
1020
+ const { r: B, s: U } = dt.toSig(M("DER", p));
1021
+ return new y(B, U);
1022
+ }
1023
+ assertValidity() {
1024
+ if (!m(this.r))
1025
+ throw new Error("r must be 0 < r < CURVE.n");
1026
+ if (!m(this.s))
1027
+ throw new Error("s must be 0 < s < CURVE.n");
1028
+ }
1029
+ addRecoveryBit(p) {
1030
+ return new y(this.r, this.s, p);
1031
+ }
1032
+ recoverPublicKey(p) {
1033
+ const { r: B, s: U, recovery: P } = this, R = x(M("msgHash", p));
1034
+ if (P == null || ![0, 1, 2, 3].includes(P))
1035
+ throw new Error("recovery id invalid");
1036
+ const z = P === 2 || P === 3 ? B + n.n : B;
1037
+ if (z >= e.ORDER)
1038
+ throw new Error("recovery id 2 or 3 invalid");
1039
+ const F = P & 1 ? "03" : "02", ot = f.fromHex(F + b(z)), st = l(z), pt = i(-R * st), At = i(U * st), it = f.BASE.multiplyAndAddUnsafe(ot, pt, At);
1040
+ if (!it)
1041
+ throw new Error("point at infinify");
1042
+ return it.assertValidity(), it;
1043
+ }
1044
+ // Signatures should be low-s, to prevent malleability.
1045
+ hasHighS() {
1046
+ return g(this.s);
1047
+ }
1048
+ normalizeS() {
1049
+ return this.hasHighS() ? new y(this.r, i(-this.s), this.recovery) : this;
1050
+ }
1051
+ // DER-encoded
1052
+ toDERRawBytes() {
1053
+ return xt(this.toDERHex());
1054
+ }
1055
+ toDERHex() {
1056
+ return dt.hexFromSig({ r: this.r, s: this.s });
1057
+ }
1058
+ // padded bytes of r, then padded bytes of s
1059
+ toCompactRawBytes() {
1060
+ return xt(this.toCompactHex());
1061
+ }
1062
+ toCompactHex() {
1063
+ return b(this.r) + b(this.s);
1064
+ }
1065
+ }
1066
+ const v = {
1067
+ isValidPrivateKey(d) {
1068
+ try {
1069
+ return h(d), !0;
1070
+ } catch {
1071
+ return !1;
1072
+ }
1073
+ },
1074
+ normPrivateKeyToScalar: h,
1075
+ /**
1076
+ * Produces cryptographically secure private key from random of size (nBitLength+64)
1077
+ * as per FIPS 186 B.4.1 with modulo bias being neglible.
1078
+ */
1079
+ randomPrivateKey: () => {
1080
+ const d = n.randomBytes(e.BYTES + 8), p = vn(d, o);
1081
+ return yt(p, n.nByteLength);
1082
+ },
1083
+ /**
1084
+ * Creates precompute table for an arbitrary EC point. Makes point "cached".
1085
+ * Allows to massively speed-up `point.multiply(scalar)`.
1086
+ * @returns cached point
1087
+ * @example
1088
+ * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
1089
+ * fast.multiply(privKey); // much faster ECDH now
1090
+ */
1091
+ precompute(d = 8, p = f.BASE) {
1092
+ return p._setWindowSize(d), p.multiply(BigInt(3)), p;
1093
+ }
1094
+ };
1095
+ function S(d, p = !0) {
1096
+ return f.fromPrivateKey(d).toRawBytes(p);
1097
+ }
1098
+ function I(d) {
1099
+ const p = d instanceof Uint8Array, B = typeof d == "string", U = (p || B) && d.length;
1100
+ return p ? U === r || U === s : B ? U === 2 * r || U === 2 * s : d instanceof f;
1101
+ }
1102
+ function T(d, p, B = !0) {
1103
+ if (I(d))
1104
+ throw new Error("first arg must be private key");
1105
+ if (!I(p))
1106
+ throw new Error("second arg must be public key");
1107
+ return f.fromHex(p).multiply(h(d)).toRawBytes(B);
1108
+ }
1109
+ const E = n.bits2int || function(d) {
1110
+ const p = wt(d), B = d.length * 8 - n.nBitLength;
1111
+ return B > 0 ? p >> BigInt(B) : p;
1112
+ }, x = n.bits2int_modN || function(d) {
1113
+ return i(E(d));
1114
+ }, A = jt(n.nBitLength);
1115
+ function Y(d) {
1116
+ if (typeof d != "bigint")
1117
+ throw new Error("bigint expected");
1118
+ if (!(et <= d && d < A))
1119
+ throw new Error(`bigint expected < 2^${n.nBitLength}`);
1120
+ return yt(d, n.nByteLength);
1121
+ }
1122
+ function C(d, p, B = O) {
1123
+ if (["recovered", "canonical"].some((ut) => ut in B))
1124
+ throw new Error("sign() legacy options not supported");
1125
+ const { hash: U, randomBytes: P } = n;
1126
+ let { lowS: R, prehash: z, extraEntropy: F } = B;
1127
+ R == null && (R = !0), d = M("msgHash", d), z && (d = M("prehashed msgHash", U(d)));
1128
+ const ot = x(d), st = h(p), pt = [Y(st), Y(ot)];
1129
+ if (F != null) {
1130
+ const ut = F === !0 ? P(e.BYTES) : F;
1131
+ pt.push(M("extraEntropy", ut, e.BYTES));
1132
+ }
1133
+ const At = j(...pt), it = ot;
1134
+ function Rt(ut) {
1135
+ const mt = E(ut);
1136
+ if (!m(mt))
1137
+ return;
1138
+ const ne = l(mt), Et = f.BASE.multiply(mt).toAffine(), Q = i(Et.x);
1139
+ if (Q === et)
1140
+ return;
1141
+ const bt = i(ne * i(it + Q * st));
1142
+ if (bt === et)
1143
+ return;
1144
+ let re = (Et.x === Q ? 0 : 2) | Number(Et.y & G), oe = bt;
1145
+ return R && g(bt) && (oe = a(bt), re ^= 1), new y(Q, oe, re);
1146
+ }
1147
+ return { seed: At, k2sig: Rt };
1148
+ }
1149
+ const O = { lowS: n.lowS, prehash: !1 }, D = { lowS: n.lowS, prehash: !1 };
1150
+ function K(d, p, B = O) {
1151
+ const { seed: U, k2sig: P } = C(d, p, B), R = n;
1152
+ return Se(R.hash.outputLen, R.nByteLength, R.hmac)(U, P);
1153
+ }
1154
+ f.BASE._setWindowSize(8);
1155
+ function rt(d, p, B, U = D) {
1156
+ var Et;
1157
+ const P = d;
1158
+ if (p = M("msgHash", p), B = M("publicKey", B), "strict" in U)
1159
+ throw new Error("options.strict was renamed to lowS");
1160
+ const { lowS: R, prehash: z } = U;
1161
+ let F, ot;
1162
+ try {
1163
+ if (typeof P == "string" || P instanceof Uint8Array)
1164
+ try {
1165
+ F = y.fromDER(P);
1166
+ } catch (Q) {
1167
+ if (!(Q instanceof dt.Err))
1168
+ throw Q;
1169
+ F = y.fromCompact(P);
1170
+ }
1171
+ else if (typeof P == "object" && typeof P.r == "bigint" && typeof P.s == "bigint") {
1172
+ const { r: Q, s: bt } = P;
1173
+ F = new y(Q, bt);
1174
+ } else
1175
+ throw new Error("PARSE");
1176
+ ot = f.fromHex(B);
1177
+ } catch (Q) {
1178
+ if (Q.message === "PARSE")
1179
+ throw new Error("signature must be Signature instance, Uint8Array or hex string");
1180
+ return !1;
1181
+ }
1182
+ if (R && F.hasHighS())
1183
+ return !1;
1184
+ z && (p = n.hash(p));
1185
+ const { r: st, s: pt } = F, At = x(p), it = l(pt), Rt = i(At * it), ut = i(st * it), mt = (Et = f.BASE.multiplyAndAddUnsafe(ot, Rt, ut)) == null ? void 0 : Et.toAffine();
1186
+ return mt ? i(mt.x) === st : !1;
1187
+ }
1188
+ return {
1189
+ CURVE: n,
1190
+ getPublicKey: S,
1191
+ getSharedSecret: T,
1192
+ sign: K,
1193
+ verify: rt,
1194
+ ProjectivePoint: f,
1195
+ Signature: y,
1196
+ utils: v
1197
+ };
1198
+ }
1199
+ var Un = Object.defineProperty, Te = (t, n) => {
1200
+ for (var e in n)
1201
+ Un(t, e, { get: n[e], enumerable: !0 });
1202
+ }, Cn = {};
1203
+ Te(Cn, {
1204
+ EmptyArray: () => Jt,
1205
+ arrayToHex: () => qt,
1206
+ arrayToUtf8: () => Xt,
1207
+ calculateSharedKey: () => rr,
1208
+ comparePublicKeyHex: () => er,
1209
+ compressPublicKeyHex: () => Jn,
1210
+ doDecrypt: () => sr,
1211
+ doEncrypt: () => or,
1212
+ doSignature: () => ir,
1213
+ doVerifySignature: () => cr,
1214
+ generateKeyPairHex: () => Qt,
1215
+ getHash: () => te,
1216
+ getPoint: () => _e,
1217
+ getPublicKeyFromPrivateKey: () => He,
1218
+ getZ: () => Lt,
1219
+ hexToArray: () => k,
1220
+ initRNGPool: () => Mt,
1221
+ leftPad: () => q,
1222
+ precomputePublicKey: () => lr,
1223
+ utf8ToHex: () => Bt,
1224
+ verifyPublicKey: () => tr
1225
+ });
1226
+ var Nt = BigInt(0), Tt = BigInt(1), Nn = BigInt(2);
1227
+ BigInt(3);
1228
+ function Ln(t) {
1229
+ let n = t.toString(16);
1230
+ if (n[0] !== "-")
1231
+ n.length % 2 === 1 ? n = "0" + n : n.match(/^[0-7]/) || (n = "00" + n);
1232
+ else {
1233
+ n = n.substring(1);
1234
+ let e = n.length;
1235
+ e % 2 === 1 ? e += 1 : n.match(/^[0-7]/) || (e += 2);
1236
+ let o = "";
1237
+ for (let c = 0; c < e; c++)
1238
+ o += "f";
1239
+ n = ((_(o) ^ t) + Tt).toString(16).replace(/^-/, "");
1240
+ }
1241
+ return n;
1242
+ }
1243
+ var Ie = class {
1244
+ constructor(t = null, n = "00", e = "00", o = "") {
1245
+ this.tlv = t, this.t = n, this.l = e, this.v = o;
1246
+ }
1247
+ getEncodedHex() {
1248
+ return this.tlv || (this.v = this.getValue(), this.l = this.getLength(), this.tlv = this.t + this.l + this.v), this.tlv;
1249
+ }
1250
+ getLength() {
1251
+ const t = this.v.length / 2;
1252
+ let n = t.toString(16);
1253
+ return n.length % 2 === 1 && (n = "0" + n), t < 128 ? n : (128 + n.length / 2).toString(16) + n;
1254
+ }
1255
+ getValue() {
1256
+ return "";
1257
+ }
1258
+ }, he = class extends Ie {
1259
+ constructor(t) {
1260
+ super(), this.t = "02", t && (this.v = Ln(t));
1261
+ }
1262
+ getValue() {
1263
+ return this.v;
1264
+ }
1265
+ }, Hn = class extends Ie {
1266
+ constructor(n) {
1267
+ super();
1268
+ L(this, "t", "30");
1269
+ this.asn1Array = n;
1270
+ }
1271
+ getValue() {
1272
+ return this.v = this.asn1Array.map((n) => n.getEncodedHex()).join(""), this.v;
1273
+ }
1274
+ };
1275
+ function Oe(t, n) {
1276
+ return +t[n + 2] < 8 ? 1 : +t.substring(n + 2, n + 4) & 127 + 1;
1277
+ }
1278
+ function de(t, n) {
1279
+ const e = Oe(t, n), o = t.substring(n + 2, n + 2 + e * 2);
1280
+ return o ? +(+o[0] < 8 ? _(o) : _(o.substring(2))).toString() : -1;
1281
+ }
1282
+ function kt(t, n) {
1283
+ const e = Oe(t, n);
1284
+ return n + (e + 1) * 2;
1285
+ }
1286
+ function _n(t, n) {
1287
+ const e = new he(t), o = new he(n);
1288
+ return new Hn([e, o]).getEncodedHex();
1289
+ }
1290
+ function qn(t) {
1291
+ const n = kt(t, 0), e = kt(t, n), o = de(t, n), r = t.substr(e, o * 2), s = e + r.length, c = kt(t, s), i = de(t, s), l = t.substring(c, c + i * 2), f = _(r), h = _(l);
1292
+ return { r: f, s: h };
1293
+ }
1294
+ var Zt = 16384, gt = new Uint8Array(0), vt;
1295
+ async function Mt() {
1296
+ if ("crypto" in globalThis) {
1297
+ vt = globalThis.crypto;
1298
+ return;
1299
+ }
1300
+ if (!(gt.length > Zt / 2))
1301
+ if ("wx" in globalThis && "getRandomValues" in globalThis.wx)
1302
+ gt = await new Promise((t) => {
1303
+ wx.getRandomValues({
1304
+ length: Zt,
1305
+ success(n) {
1306
+ t(new Uint8Array(n.randomValues));
1307
+ }
1308
+ });
1309
+ });
1310
+ else
1311
+ try {
1312
+ globalThis.crypto ? vt = globalThis.crypto : vt = (await import(
1313
+ /* webpackIgnore: true */
1314
+ "./__vite-browser-external-2447137e.mjs"
1315
+ )).webcrypto;
1316
+ const t = new Uint8Array(Zt);
1317
+ vt.getRandomValues(t), gt = t;
1318
+ } catch {
1319
+ throw new Error("no available csprng, abort.");
1320
+ }
1321
+ }
1322
+ Mt();
1323
+ function Rn(t) {
1324
+ if (gt.length > t) {
1325
+ const n = gt.slice(0, t);
1326
+ return gt = gt.slice(t), Mt(), n;
1327
+ } else
1328
+ throw new Error("random number pool is not ready or insufficient, prevent getting too long random values or too often.");
1329
+ }
1330
+ function Vn(t = 0) {
1331
+ const n = new Uint8Array(t);
1332
+ return vt ? vt.getRandomValues(n) : Rn(t);
1333
+ }
1334
+ var Pe = (t) => t instanceof Uint8Array, Dt = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), $n = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
1335
+ if (!$n)
1336
+ throw new Error("Non little-endian hardware is not supported");
1337
+ var kn = Array.from({ length: 256 }, (t, n) => n.toString(16).padStart(2, "0"));
1338
+ function St(t) {
1339
+ if (!Pe(t))
1340
+ throw new Error("Uint8Array expected");
1341
+ let n = "";
1342
+ for (let e = 0; e < t.length; e++)
1343
+ n += kn[t[e]];
1344
+ return n;
1345
+ }
1346
+ function Zn(t) {
1347
+ if (typeof t != "string")
1348
+ throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
1349
+ return new Uint8Array(new TextEncoder().encode(t));
1350
+ }
1351
+ function Gt(t) {
1352
+ if (typeof t == "string" && (t = Zn(t)), !Pe(t))
1353
+ throw new Error(`expected Uint8Array, got ${typeof t}`);
1354
+ return t;
1355
+ }
1356
+ var Ue = class {
1357
+ clone() {
1358
+ return this._cloneInto();
1359
+ }
1360
+ };
1361
+ function Dn(t) {
1362
+ const n = (o) => t().update(Gt(o)).digest(), e = t();
1363
+ return n.outputLen = e.outputLen, n.blockLen = e.blockLen, n.create = () => t(), n;
1364
+ }
1365
+ var Kn = (t, n, e) => t & n | t & e | n & e, ge = (t, n, e) => t ^ n ^ e, zn = (t, n, e) => t & n | ~t & e;
1366
+ function Fn(t, n, e, o) {
1367
+ if (typeof t.setBigUint64 == "function")
1368
+ return t.setBigUint64(n, e, o);
1369
+ const r = BigInt(32), s = BigInt(4294967295), c = Number(e >> r & s), i = Number(e & s), l = o ? 4 : 0, f = o ? 0 : 4;
1370
+ t.setUint32(n + l, c, o), t.setUint32(n + f, i, o);
1371
+ }
1372
+ function W(t, n) {
1373
+ const e = n & 31;
1374
+ return t << e | t >>> 32 - e;
1375
+ }
1376
+ function jn(t) {
1377
+ return t ^ W(t, 9) ^ W(t, 17);
1378
+ }
1379
+ function Yn(t) {
1380
+ return t ^ W(t, 15) ^ W(t, 23);
1381
+ }
1382
+ var Mn = class extends Ue {
1383
+ constructor(n, e, o, r) {
1384
+ super();
1385
+ L(this, "buffer");
1386
+ L(this, "view");
1387
+ L(this, "finished", !1);
1388
+ L(this, "length", 0);
1389
+ L(this, "pos", 0);
1390
+ L(this, "destroyed", !1);
1391
+ this.blockLen = n, this.outputLen = e, this.padOffset = o, this.isLE = r, this.buffer = new Uint8Array(n), this.view = Dt(this.buffer);
1392
+ }
1393
+ update(n) {
1394
+ const { view: e, buffer: o, blockLen: r } = this;
1395
+ n = Gt(n);
1396
+ const s = n.length;
1397
+ for (let c = 0; c < s; ) {
1398
+ const i = Math.min(r - this.pos, s - c);
1399
+ if (i === r) {
1400
+ const l = Dt(n);
1401
+ for (; r <= s - c; c += r)
1402
+ this.process(l, c);
1403
+ continue;
1404
+ }
1405
+ o.set(n.subarray(c, c + i), this.pos), this.pos += i, c += i, this.pos === r && (this.process(e, 0), this.pos = 0);
1406
+ }
1407
+ return this.length += n.length, this.roundClean(), this;
1408
+ }
1409
+ digestInto(n) {
1410
+ this.finished = !0;
1411
+ const { buffer: e, view: o, blockLen: r, isLE: s } = this;
1412
+ let { pos: c } = this;
1413
+ e[c++] = 128, this.buffer.subarray(c).fill(0), this.padOffset > r - c && (this.process(o, 0), c = 0);
1414
+ for (let u = c; u < r; u++)
1415
+ e[u] = 0;
1416
+ Fn(o, r - 8, BigInt(this.length * 8), s), this.process(o, 0);
1417
+ const i = Dt(n), l = this.outputLen;
1418
+ if (l % 4)
1419
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
1420
+ const f = l / 4, h = this.get();
1421
+ if (f > h.length)
1422
+ throw new Error("_sha2: outputLen bigger than state");
1423
+ for (let u = 0; u < f; u++)
1424
+ i.setUint32(4 * u, h[u], s);
1425
+ }
1426
+ digest() {
1427
+ const { buffer: n, outputLen: e } = this;
1428
+ this.digestInto(n);
1429
+ const o = n.slice(0, e);
1430
+ return this.destroy(), o;
1431
+ }
1432
+ _cloneInto(n) {
1433
+ n || (n = new this.constructor()), n.set(...this.get());
1434
+ const { blockLen: e, buffer: o, length: r, finished: s, destroyed: c, pos: i } = this;
1435
+ return n.length = r, n.pos = i, n.finished = s, n.destroyed = c, r % e && n.buffer.set(o), n;
1436
+ }
1437
+ }, ct = new Uint32Array([1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214]), X = new Uint32Array(68), we = new Uint32Array(64), Gn = 2043430169, Wn = 2055708042, Qn = class extends Mn {
1438
+ constructor() {
1439
+ super(64, 32, 8, !1);
1440
+ L(this, "A", ct[0] | 0);
1441
+ L(this, "B", ct[1] | 0);
1442
+ L(this, "C", ct[2] | 0);
1443
+ L(this, "D", ct[3] | 0);
1444
+ L(this, "E", ct[4] | 0);
1445
+ L(this, "F", ct[5] | 0);
1446
+ L(this, "G", ct[6] | 0);
1447
+ L(this, "H", ct[7] | 0);
1448
+ }
1449
+ get() {
1450
+ const { A: n, B: e, C: o, D: r, E: s, F: c, G: i, H: l } = this;
1451
+ return [n, e, o, r, s, c, i, l];
1452
+ }
1453
+ set(n, e, o, r, s, c, i, l) {
1454
+ this.A = n | 0, this.B = e | 0, this.C = o | 0, this.D = r | 0, this.E = s | 0, this.F = c | 0, this.G = i | 0, this.H = l | 0;
1455
+ }
1456
+ process(n, e) {
1457
+ for (let u = 0; u < 16; u++, e += 4)
1458
+ X[u] = n.getUint32(e, !1);
1459
+ for (let u = 16; u < 68; u++)
1460
+ X[u] = Yn(X[u - 16] ^ X[u - 9] ^ W(X[u - 3], 15)) ^ W(X[u - 13], 7) ^ X[u - 6];
1461
+ for (let u = 0; u < 64; u++)
1462
+ we[u] = X[u] ^ X[u + 4];
1463
+ let { A: o, B: r, C: s, D: c, E: i, F: l, G: f, H: h } = this;
1464
+ for (let u = 0; u < 64; u++) {
1465
+ let m = u >= 0 && u <= 15, b = m ? Gn : Wn, g = W(W(o, 12) + i + W(b, u), 7), a = g ^ W(o, 12), w = (m ? ge(o, r, s) : Kn(o, r, s)) + c + a + we[u] | 0, y = (m ? ge(i, l, f) : zn(i, l, f)) + h + g + X[u] | 0;
1466
+ c = s, s = W(r, 9), r = o, o = w, h = f, f = W(l, 19), l = i, i = jn(y);
1467
+ }
1468
+ o = o ^ this.A | 0, r = r ^ this.B | 0, s = s ^ this.C | 0, c = c ^ this.D | 0, i = i ^ this.E | 0, l = l ^ this.F | 0, f = f ^ this.G | 0, h = h ^ this.H | 0, this.set(o, r, s, c, i, l, f, h);
1469
+ }
1470
+ roundClean() {
1471
+ X.fill(0);
1472
+ }
1473
+ destroy() {
1474
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
1475
+ }
1476
+ }, tt = Dn(() => new Qn()), Ce = class extends Ue {
1477
+ constructor(n, e) {
1478
+ super();
1479
+ L(this, "oHash");
1480
+ L(this, "iHash");
1481
+ L(this, "blockLen");
1482
+ L(this, "outputLen");
1483
+ L(this, "finished", !1);
1484
+ L(this, "destroyed", !1);
1485
+ const o = Gt(e);
1486
+ if (this.iHash = n.create(), typeof this.iHash.update != "function")
1487
+ throw new Error("Expected instance of class which extends utils.Hash");
1488
+ this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
1489
+ const r = this.blockLen, s = new Uint8Array(r);
1490
+ s.set(o.length > r ? n.create().update(o).digest() : o);
1491
+ for (let c = 0; c < s.length; c++)
1492
+ s[c] ^= 54;
1493
+ this.iHash.update(s), this.oHash = n.create();
1494
+ for (let c = 0; c < s.length; c++)
1495
+ s[c] ^= 106;
1496
+ this.oHash.update(s), s.fill(0);
1497
+ }
1498
+ update(n) {
1499
+ return this.iHash.update(n), this;
1500
+ }
1501
+ digestInto(n) {
1502
+ this.finished = !0, this.iHash.digestInto(n), this.oHash.update(n), this.oHash.digestInto(n), this.destroy();
1503
+ }
1504
+ digest() {
1505
+ const n = new Uint8Array(this.oHash.outputLen);
1506
+ return this.digestInto(n), n;
1507
+ }
1508
+ _cloneInto(n) {
1509
+ n || (n = Object.create(Object.getPrototypeOf(this), {}));
1510
+ const { oHash: e, iHash: o, finished: r, destroyed: s, blockLen: c, outputLen: i } = this;
1511
+ return n = n, n.finished = r, n.destroyed = s, n.blockLen = c, n.outputLen = i, n.oHash = e._cloneInto(n.oHash), n.iHash = o._cloneInto(n.iHash), n;
1512
+ }
1513
+ destroy() {
1514
+ this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
1515
+ }
1516
+ }, Wt = (t, n, e) => new Ce(t, n).update(e).digest();
1517
+ Wt.create = (t, n) => new Ce(t, n);
1518
+ var Xn = Be(BigInt("115792089210356248756420345214020892766250353991924191454421193933289684991999")), N = Pn({
1519
+ a: BigInt("115792089210356248756420345214020892766250353991924191454421193933289684991996"),
1520
+ b: BigInt("18505919022281880113072981827955639221458448578012075254857346196103069175443"),
1521
+ Fp: Xn,
1522
+ h: Tt,
1523
+ n: BigInt("115792089210356248756420345214020892766061623724957744567843809356293439045923"),
1524
+ Gx: BigInt("22963146547237050559479531362550074578802567295341616970375194840604139615431"),
1525
+ Gy: BigInt("85132369209828568825618990617112496413088388631904505083283536607588877201568"),
1526
+ hash: tt,
1527
+ hmac: (t, ...n) => Wt(tt, t, j(...n)),
1528
+ randomBytes: Vn
1529
+ }), J = Be(BigInt(N.CURVE.n));
1530
+ function Qt(t) {
1531
+ const n = t ? yt(Z(BigInt(t), Tt) + Tt, 32) : N.utils.randomPrivateKey(), e = N.getPublicKey(n, !1), o = q(nt(n), 64), r = q(nt(e), 64);
1532
+ return { privateKey: o, publicKey: r };
1533
+ }
1534
+ function Jn(t) {
1535
+ if (t.length !== 130)
1536
+ throw new Error("Invalid public key to compress");
1537
+ const n = (t.length - 2) / 2, e = t.substring(2, 2 + n), o = _(t.substring(n + 2, n + n + 2));
1538
+ let r = "03";
1539
+ return Z(o, Nn) === Nt && (r = "02"), r + e;
1540
+ }
1541
+ function Bt(t) {
1542
+ t = decodeURIComponent(encodeURIComponent(t));
1543
+ const n = t.length, e = new Uint32Array((n >>> 2) + 1);
1544
+ for (let r = 0; r < n; r++)
1545
+ e[r >>> 2] |= (t.charCodeAt(r) & 255) << 24 - r % 4 * 8;
1546
+ const o = [];
1547
+ for (let r = 0; r < n; r++) {
1548
+ const s = e[r >>> 2] >>> 24 - r % 4 * 8 & 255;
1549
+ o.push((s >>> 4).toString(16)), o.push((s & 15).toString(16));
1550
+ }
1551
+ return o.join("");
1552
+ }
1553
+ function q(t, n) {
1554
+ return t.length >= n ? t : new Array(n - t.length + 1).join("0") + t;
1555
+ }
1556
+ function qt(t) {
1557
+ return t.map((n) => {
1558
+ const e = n.toString(16);
1559
+ return e.length === 1 ? "0" + e : e;
1560
+ }).join("");
1561
+ }
1562
+ function Xt(t) {
1563
+ const n = [];
1564
+ for (let e = 0, o = t.length; e < o; e++)
1565
+ t[e] >= 240 && t[e] <= 247 ? (n.push(String.fromCodePoint(((t[e] & 7) << 18) + ((t[e + 1] & 63) << 12) + ((t[e + 2] & 63) << 6) + (t[e + 3] & 63))), e += 3) : t[e] >= 224 && t[e] <= 239 ? (n.push(String.fromCodePoint(((t[e] & 15) << 12) + ((t[e + 1] & 63) << 6) + (t[e + 2] & 63))), e += 2) : t[e] >= 192 && t[e] <= 223 ? (n.push(String.fromCodePoint(((t[e] & 31) << 6) + (t[e + 1] & 63))), e++) : n.push(String.fromCodePoint(t[e]));
1566
+ return n.join("");
1567
+ }
1568
+ function k(t) {
1569
+ let n = t.length;
1570
+ n % 2 !== 0 && (t = q(t, n + 1)), n = t.length;
1571
+ const e = n / 2, o = new Uint8Array(e);
1572
+ for (let r = 0; r < e; r++)
1573
+ o[r] = parseInt(t.substring(r * 2, r * 2 + 2), 16);
1574
+ return o;
1575
+ }
1576
+ function tr(t) {
1577
+ const n = N.ProjectivePoint.fromHex(t);
1578
+ if (!n)
1579
+ return !1;
1580
+ try {
1581
+ return n.assertValidity(), !0;
1582
+ } catch {
1583
+ return !1;
1584
+ }
1585
+ }
1586
+ function er(t, n) {
1587
+ const e = N.ProjectivePoint.fromHex(t);
1588
+ if (!e)
1589
+ return !1;
1590
+ const o = N.ProjectivePoint.fromHex(n);
1591
+ return o ? e.equals(o) : !1;
1592
+ }
1593
+ var ye = _("80000000000000000000000000000000"), pe = _("7fffffffffffffffffffffffffffffff");
1594
+ function nr(t, n) {
1595
+ let e = new Uint8Array(n), o = 1, r = 0, s = Jt;
1596
+ const c = new Uint8Array(4), i = () => {
1597
+ c[0] = o >> 24 & 255, c[1] = o >> 16 & 255, c[2] = o >> 8 & 255, c[3] = o & 255, s = tt(j(t, c)), o++, r = 0;
1598
+ };
1599
+ i();
1600
+ for (let l = 0, f = e.length; l < f; l++)
1601
+ r === s.length && i(), e[l] = s[r++] & 255;
1602
+ return e;
1603
+ }
1604
+ function rr(t, n, e, o, r, s = !1, c = "1234567812345678", i = "1234567812345678") {
1605
+ const l = N.ProjectivePoint.fromHex(n.publicKey), f = N.ProjectivePoint.fromHex(o), h = N.ProjectivePoint.fromHex(e);
1606
+ let u = Lt(t.publicKey, c), m = Lt(e, i);
1607
+ s && ([u, m] = [m, u]);
1608
+ const b = _(n.privateKey), g = _(t.privateKey), a = l.x, w = ye + (a & pe), y = J.add(g, J.mulN(w, b)), v = f.x, S = J.add(ye, v & pe), I = f.multiply(S).add(h).multiply(y), T = k(q($(I.x), 64)), E = k(q($(I.y), 64));
1609
+ return nr(j(T, E, u, m), r);
1610
+ }
1611
+ var Ne = 0, Jt = new Uint8Array();
1612
+ function or(t, n, e = 1) {
1613
+ const o = typeof t == "string" ? k(Bt(t)) : Uint8Array.from(t), r = typeof n == "string" ? N.ProjectivePoint.fromHex(n) : n, s = Qt(), c = _(s.privateKey);
1614
+ let i = s.publicKey;
1615
+ i.length > 128 && (i = i.substring(i.length - 128));
1616
+ const l = r.multiply(c), f = k(q($(l.x), 64)), h = k(q($(l.y), 64)), u = St(tt(j(f, o, h)));
1617
+ Le(f, h, o);
1618
+ const m = St(o);
1619
+ return e === Ne ? i + m + u : i + u + m;
1620
+ }
1621
+ function Le(t, n, e) {
1622
+ let o = 1, r = 0, s = Jt;
1623
+ const c = new Uint8Array(4), i = () => {
1624
+ c[0] = o >> 24 & 255, c[1] = o >> 16 & 255, c[2] = o >> 8 & 255, c[3] = o & 255, s = tt(j(t, n, c)), o++, r = 0;
1625
+ };
1626
+ i();
1627
+ for (let l = 0, f = e.length; l < f; l++)
1628
+ r === s.length && i(), e[l] ^= s[r++] & 255;
1629
+ }
1630
+ function sr(t, n, e = 1, {
1631
+ output: o = "string"
1632
+ } = {}) {
1633
+ const r = _(n);
1634
+ let s = t.substring(128, 128 + 64), c = t.substring(128 + 64);
1635
+ e === Ne && (s = t.substring(t.length - 64), c = t.substring(128, t.length - 64));
1636
+ const i = k(c), f = N.ProjectivePoint.fromHex("04" + t.substring(0, 128)).multiply(r), h = k(q($(f.x), 64)), u = k(q($(f.y), 64));
1637
+ return Le(h, u, i), qt(Array.from(tt(j(h, i, u)))) === s.toLowerCase() ? o === "array" ? i : Xt(i) : o === "array" ? [] : "";
1638
+ }
1639
+ function ir(t, n, e = {}) {
1640
+ let {
1641
+ pointPool: o,
1642
+ der: r,
1643
+ hash: s,
1644
+ publicKey: c,
1645
+ userId: i
1646
+ } = e, l = typeof t == "string" ? Bt(t) : qt(Array.from(t));
1647
+ s && (c = c || He(n), l = te(l, c, i));
1648
+ const f = _(n), h = _(l);
1649
+ let u = null, m = null, b = null;
1650
+ do {
1651
+ do {
1652
+ let g;
1653
+ o && o.length ? g = o.pop() : g = _e(), u = g.k, m = J.add(h, g.x1);
1654
+ } while (m === Nt || m + u === N.CURVE.n);
1655
+ b = J.mul(J.inv(J.addN(f, Tt)), J.subN(u, J.mulN(m, f)));
1656
+ } while (b === Nt);
1657
+ return r ? _n(m, b) : q($(m), 64) + q($(b), 64);
1658
+ }
1659
+ function cr(t, n, e, o = {}) {
1660
+ let r;
1661
+ const {
1662
+ hash: s,
1663
+ der: c,
1664
+ userId: i
1665
+ } = o, l = typeof e == "string" ? e : e.toHex(!1);
1666
+ s ? r = te(typeof t == "string" ? Bt(t) : t, l, i) : r = typeof t == "string" ? Bt(t) : qt(Array.from(t));
1667
+ let f, h;
1668
+ if (c) {
1669
+ const w = qn(n);
1670
+ f = w.r, h = w.s;
1671
+ } else
1672
+ f = _(n.substring(0, 64)), h = _(n.substring(64));
1673
+ const u = typeof e == "string" ? N.ProjectivePoint.fromHex(e) : e, m = _(r), b = J.add(f, h);
1674
+ if (b === Nt)
1675
+ return !1;
1676
+ const g = N.ProjectivePoint.BASE.multiply(h).add(u.multiply(b)), a = J.add(m, g.x);
1677
+ return f === a;
1678
+ }
1679
+ function Lt(t, n = "1234567812345678") {
1680
+ n = Bt(n);
1681
+ const e = q($(N.CURVE.a), 64), o = q($(N.CURVE.b), 64), r = q($(N.ProjectivePoint.BASE.x), 64), s = q($(N.ProjectivePoint.BASE.y), 64);
1682
+ let c, i;
1683
+ if (t.length === 128)
1684
+ c = t.substring(0, 64), i = t.substring(64, 128);
1685
+ else {
1686
+ const u = N.ProjectivePoint.fromHex(t);
1687
+ c = q($(u.x), 64), i = q($(u.y), 64);
1688
+ }
1689
+ const l = k(n + e + o + r + s + c + i), f = n.length * 4;
1690
+ return tt(j(new Uint8Array([f >> 8 & 255, f & 255]), l));
1691
+ }
1692
+ function te(t, n, e = "1234567812345678") {
1693
+ const o = Lt(n, e);
1694
+ return St(tt(j(o, typeof t == "string" ? k(t) : t)));
1695
+ }
1696
+ function lr(t, n) {
1697
+ const e = N.ProjectivePoint.fromHex(t);
1698
+ return N.utils.precompute(n, e);
1699
+ }
1700
+ function He(t) {
1701
+ const n = N.getPublicKey(t, !1);
1702
+ return q(nt(n), 64);
1703
+ }
1704
+ function _e() {
1705
+ const t = Qt(), n = N.ProjectivePoint.fromHex(t.publicKey), e = _(t.privateKey);
1706
+ return {
1707
+ ...t,
1708
+ k: e,
1709
+ x1: n.x
1710
+ };
1711
+ }
1712
+ function qe(t) {
1713
+ const n = [];
1714
+ for (let e = 0, o = t.length; e < o; e++) {
1715
+ const r = t.codePointAt(e);
1716
+ if (r <= 127)
1717
+ n.push(r);
1718
+ else if (r <= 2047)
1719
+ n.push(192 | r >>> 6), n.push(128 | r & 63);
1720
+ else if (r <= 55295 || r >= 57344 && r <= 65535)
1721
+ n.push(224 | r >>> 12), n.push(128 | r >>> 6 & 63), n.push(128 | r & 63);
1722
+ else if (r >= 65536 && r <= 1114111)
1723
+ e++, n.push(240 | r >>> 18 & 28), n.push(128 | r >>> 12 & 63), n.push(128 | r >>> 6 & 63), n.push(128 | r & 63);
1724
+ else
1725
+ throw n.push(r), new Error("input is not supported");
1726
+ }
1727
+ return new Uint8Array(n);
1728
+ }
1729
+ function Ir(t, n) {
1730
+ if (t = typeof t == "string" ? qe(t) : t, n) {
1731
+ if ((n.mode || "hmac") !== "hmac")
1732
+ throw new Error("invalid mode");
1733
+ let o = n.key;
1734
+ if (!o)
1735
+ throw new Error("invalid key");
1736
+ return o = typeof o == "string" ? k(o) : o, St(Wt(tt, o, t));
1737
+ }
1738
+ return St(tt(t));
1739
+ }
1740
+ var fr = {};
1741
+ Te(fr, {
1742
+ decrypt: () => gr,
1743
+ encrypt: () => dr,
1744
+ sm4: () => ee
1745
+ });
1746
+ var lt = 0, ur = 32, at = 16, Ot = Uint8Array.from([
1747
+ 214,
1748
+ 144,
1749
+ 233,
1750
+ 254,
1751
+ 204,
1752
+ 225,
1753
+ 61,
1754
+ 183,
1755
+ 22,
1756
+ 182,
1757
+ 20,
1758
+ 194,
1759
+ 40,
1760
+ 251,
1761
+ 44,
1762
+ 5,
1763
+ 43,
1764
+ 103,
1765
+ 154,
1766
+ 118,
1767
+ 42,
1768
+ 190,
1769
+ 4,
1770
+ 195,
1771
+ 170,
1772
+ 68,
1773
+ 19,
1774
+ 38,
1775
+ 73,
1776
+ 134,
1777
+ 6,
1778
+ 153,
1779
+ 156,
1780
+ 66,
1781
+ 80,
1782
+ 244,
1783
+ 145,
1784
+ 239,
1785
+ 152,
1786
+ 122,
1787
+ 51,
1788
+ 84,
1789
+ 11,
1790
+ 67,
1791
+ 237,
1792
+ 207,
1793
+ 172,
1794
+ 98,
1795
+ 228,
1796
+ 179,
1797
+ 28,
1798
+ 169,
1799
+ 201,
1800
+ 8,
1801
+ 232,
1802
+ 149,
1803
+ 128,
1804
+ 223,
1805
+ 148,
1806
+ 250,
1807
+ 117,
1808
+ 143,
1809
+ 63,
1810
+ 166,
1811
+ 71,
1812
+ 7,
1813
+ 167,
1814
+ 252,
1815
+ 243,
1816
+ 115,
1817
+ 23,
1818
+ 186,
1819
+ 131,
1820
+ 89,
1821
+ 60,
1822
+ 25,
1823
+ 230,
1824
+ 133,
1825
+ 79,
1826
+ 168,
1827
+ 104,
1828
+ 107,
1829
+ 129,
1830
+ 178,
1831
+ 113,
1832
+ 100,
1833
+ 218,
1834
+ 139,
1835
+ 248,
1836
+ 235,
1837
+ 15,
1838
+ 75,
1839
+ 112,
1840
+ 86,
1841
+ 157,
1842
+ 53,
1843
+ 30,
1844
+ 36,
1845
+ 14,
1846
+ 94,
1847
+ 99,
1848
+ 88,
1849
+ 209,
1850
+ 162,
1851
+ 37,
1852
+ 34,
1853
+ 124,
1854
+ 59,
1855
+ 1,
1856
+ 33,
1857
+ 120,
1858
+ 135,
1859
+ 212,
1860
+ 0,
1861
+ 70,
1862
+ 87,
1863
+ 159,
1864
+ 211,
1865
+ 39,
1866
+ 82,
1867
+ 76,
1868
+ 54,
1869
+ 2,
1870
+ 231,
1871
+ 160,
1872
+ 196,
1873
+ 200,
1874
+ 158,
1875
+ 234,
1876
+ 191,
1877
+ 138,
1878
+ 210,
1879
+ 64,
1880
+ 199,
1881
+ 56,
1882
+ 181,
1883
+ 163,
1884
+ 247,
1885
+ 242,
1886
+ 206,
1887
+ 249,
1888
+ 97,
1889
+ 21,
1890
+ 161,
1891
+ 224,
1892
+ 174,
1893
+ 93,
1894
+ 164,
1895
+ 155,
1896
+ 52,
1897
+ 26,
1898
+ 85,
1899
+ 173,
1900
+ 147,
1901
+ 50,
1902
+ 48,
1903
+ 245,
1904
+ 140,
1905
+ 177,
1906
+ 227,
1907
+ 29,
1908
+ 246,
1909
+ 226,
1910
+ 46,
1911
+ 130,
1912
+ 102,
1913
+ 202,
1914
+ 96,
1915
+ 192,
1916
+ 41,
1917
+ 35,
1918
+ 171,
1919
+ 13,
1920
+ 83,
1921
+ 78,
1922
+ 111,
1923
+ 213,
1924
+ 219,
1925
+ 55,
1926
+ 69,
1927
+ 222,
1928
+ 253,
1929
+ 142,
1930
+ 47,
1931
+ 3,
1932
+ 255,
1933
+ 106,
1934
+ 114,
1935
+ 109,
1936
+ 108,
1937
+ 91,
1938
+ 81,
1939
+ 141,
1940
+ 27,
1941
+ 175,
1942
+ 146,
1943
+ 187,
1944
+ 221,
1945
+ 188,
1946
+ 127,
1947
+ 17,
1948
+ 217,
1949
+ 92,
1950
+ 65,
1951
+ 31,
1952
+ 16,
1953
+ 90,
1954
+ 216,
1955
+ 10,
1956
+ 193,
1957
+ 49,
1958
+ 136,
1959
+ 165,
1960
+ 205,
1961
+ 123,
1962
+ 189,
1963
+ 45,
1964
+ 116,
1965
+ 208,
1966
+ 18,
1967
+ 184,
1968
+ 229,
1969
+ 180,
1970
+ 176,
1971
+ 137,
1972
+ 105,
1973
+ 151,
1974
+ 74,
1975
+ 12,
1976
+ 150,
1977
+ 119,
1978
+ 126,
1979
+ 101,
1980
+ 185,
1981
+ 241,
1982
+ 9,
1983
+ 197,
1984
+ 110,
1985
+ 198,
1986
+ 132,
1987
+ 24,
1988
+ 240,
1989
+ 125,
1990
+ 236,
1991
+ 58,
1992
+ 220,
1993
+ 77,
1994
+ 32,
1995
+ 121,
1996
+ 238,
1997
+ 95,
1998
+ 62,
1999
+ 215,
2000
+ 203,
2001
+ 57,
2002
+ 72
2003
+ ]), Pt = new Uint32Array([
2004
+ 462357,
2005
+ 472066609,
2006
+ 943670861,
2007
+ 1415275113,
2008
+ 1886879365,
2009
+ 2358483617,
2010
+ 2830087869,
2011
+ 3301692121,
2012
+ 3773296373,
2013
+ 4228057617,
2014
+ 404694573,
2015
+ 876298825,
2016
+ 1347903077,
2017
+ 1819507329,
2018
+ 2291111581,
2019
+ 2762715833,
2020
+ 3234320085,
2021
+ 3705924337,
2022
+ 4177462797,
2023
+ 337322537,
2024
+ 808926789,
2025
+ 1280531041,
2026
+ 1752135293,
2027
+ 2223739545,
2028
+ 2695343797,
2029
+ 3166948049,
2030
+ 3638552301,
2031
+ 4110090761,
2032
+ 269950501,
2033
+ 741554753,
2034
+ 1213159005,
2035
+ 1684763257
2036
+ ]);
2037
+ function ft(t) {
2038
+ return (Ot[t >>> 24 & 255] & 255) << 24 | (Ot[t >>> 16 & 255] & 255) << 16 | (Ot[t >>> 8 & 255] & 255) << 8 | Ot[t & 255] & 255;
2039
+ }
2040
+ function ar(t, n, e) {
2041
+ let o = 0, r = 0, s = 0, c = 0, i = 0, l = 0, f = 0, h = 0;
2042
+ i = t[0] & 255, l = t[1] & 255, f = t[2] & 255, h = t[3] & 255, o = i << 24 | l << 16 | f << 8 | h, i = t[4] & 255, l = t[5] & 255, f = t[6] & 255, h = t[7] & 255, r = i << 24 | l << 16 | f << 8 | h, i = t[8] & 255, l = t[9] & 255, f = t[10] & 255, h = t[11] & 255, s = i << 24 | l << 16 | f << 8 | h, i = t[12] & 255, l = t[13] & 255, f = t[14] & 255, h = t[15] & 255, c = i << 24 | l << 16 | f << 8 | h;
2043
+ for (let u = 0; u < 32; u += 4)
2044
+ i = r ^ s ^ c ^ e[u], i = ft(i), o ^= i ^ (i << 2 | i >>> 30) ^ (i << 10 | i >>> 22) ^ (i << 18 | i >>> 14) ^ (i << 24 | i >>> 8), l = s ^ c ^ o ^ e[u + 1], l = ft(l), r ^= l ^ (l << 2 | l >>> 30) ^ (l << 10 | l >>> 22) ^ (l << 18 | l >>> 14) ^ (l << 24 | l >>> 8), f = c ^ o ^ r ^ e[u + 2], f = ft(f), s ^= f ^ (f << 2 | f >>> 30) ^ (f << 10 | f >>> 22) ^ (f << 18 | f >>> 14) ^ (f << 24 | f >>> 8), h = o ^ r ^ s ^ e[u + 3], h = ft(h), c ^= h ^ (h << 2 | h >>> 30) ^ (h << 10 | h >>> 22) ^ (h << 18 | h >>> 14) ^ (h << 24 | h >>> 8);
2045
+ n[0] = c >>> 24 & 255, n[1] = c >>> 16 & 255, n[2] = c >>> 8 & 255, n[3] = c & 255, n[4] = s >>> 24 & 255, n[5] = s >>> 16 & 255, n[6] = s >>> 8 & 255, n[7] = s & 255, n[8] = r >>> 24 & 255, n[9] = r >>> 16 & 255, n[10] = r >>> 8 & 255, n[11] = r & 255, n[12] = o >>> 24 & 255, n[13] = o >>> 16 & 255, n[14] = o >>> 8 & 255, n[15] = o & 255;
2046
+ }
2047
+ function hr(t, n, e) {
2048
+ let o = 0, r = 0, s = 0, c = 0, i = 0;
2049
+ o = (t[0] & 255) << 24 | (t[1] & 255) << 16 | (t[2] & 255) << 8 | t[3] & 255, r = (t[4] & 255) << 24 | (t[5] & 255) << 16 | (t[6] & 255) << 8 | t[7] & 255, s = (t[8] & 255) << 24 | (t[9] & 255) << 16 | (t[10] & 255) << 8 | t[11] & 255, c = (t[12] & 255) << 24 | (t[13] & 255) << 16 | (t[14] & 255) << 8 | t[15] & 255, o ^= 2746333894, r ^= 1453994832, s ^= 1736282519, c ^= 2993693404;
2050
+ for (let l = 0; l < 32; l += 4)
2051
+ i = r ^ s ^ c ^ Pt[l + 0], i = ft(i), o ^= i ^ (i << 13 | i >>> 19) ^ (i << 23 | i >>> 9), n[l + 0] = o, i = s ^ c ^ o ^ Pt[l + 1], i = ft(i), r ^= i ^ (i << 13 | i >>> 19) ^ (i << 23 | i >>> 9), n[l + 1] = r, i = c ^ o ^ r ^ Pt[l + 2], i = ft(i), s ^= i ^ (i << 13 | i >>> 19) ^ (i << 23 | i >>> 9), n[l + 2] = s, i = o ^ r ^ s ^ Pt[l + 3], i = ft(i), c ^= i ^ (i << 13 | i >>> 19) ^ (i << 23 | i >>> 9), n[l + 3] = c;
2052
+ if (e === lt)
2053
+ for (let l = 0; l < 16; l++)
2054
+ [n[l], n[31 - l]] = [n[31 - l], n[l]];
2055
+ }
2056
+ var Ut = new Uint8Array(16);
2057
+ function ee(t, n, e, o = {}) {
2058
+ let {
2059
+ padding: r = "pkcs#7",
2060
+ mode: s,
2061
+ iv: c = new Uint8Array(16),
2062
+ output: i
2063
+ } = o;
2064
+ if (s === "cbc" && (typeof c == "string" && (c = k(c)), c.length !== 128 / 8))
2065
+ throw new Error("iv is invalid");
2066
+ if (typeof n == "string" && (n = k(n)), n.length !== 128 / 8)
2067
+ throw new Error("key is invalid");
2068
+ if (typeof t == "string" ? e !== lt ? t = qe(t) : t = k(t) : t = Uint8Array.from(t), (r === "pkcs#5" || r === "pkcs#7") && e !== lt) {
2069
+ const b = at - t.length % at, g = new Uint8Array(t.length + b);
2070
+ g.set(t, 0);
2071
+ for (let a = 0; a < b; a++)
2072
+ g[t.length + a] = b;
2073
+ t = g;
2074
+ }
2075
+ const l = new Uint32Array(ur);
2076
+ hr(n, l, e);
2077
+ let f = new Uint8Array(t.length), h = c, u = t.length, m = 0;
2078
+ for (; u >= at; ) {
2079
+ const b = t.subarray(m, m + 16);
2080
+ if (s === "cbc")
2081
+ for (let g = 0; g < at; g++)
2082
+ e !== lt && (b[g] ^= h[g]);
2083
+ ar(b, Ut, l);
2084
+ for (let g = 0; g < at; g++)
2085
+ s === "cbc" && e === lt && (Ut[g] ^= h[g]), f[m + g] = Ut[g];
2086
+ s === "cbc" && (e !== lt ? h = Ut : h = b), u -= at, m += at;
2087
+ }
2088
+ if ((r === "pkcs#5" || r === "pkcs#7") && e === lt) {
2089
+ const b = f.length, g = f[b - 1];
2090
+ for (let a = 1; a <= g; a++)
2091
+ if (f[b - a] !== g)
2092
+ throw new Error("padding is invalid");
2093
+ f = f.slice(0, b - g);
2094
+ }
2095
+ return i !== "array" ? e !== lt ? St(f) : Xt(f) : f;
2096
+ }
2097
+ function dr(t, n, e = {}) {
2098
+ return ee(t, n, 1, e);
2099
+ }
2100
+ function gr(t, n, e = {}) {
2101
+ return ee(t, n, 0, e);
2102
+ }
2103
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2104
+ export {
2105
+ be as S,
2106
+ vr as a,
2107
+ Sr as b,
2108
+ Ar as c,
2109
+ Br as d,
2110
+ Er as e,
2111
+ Ir as f,
2112
+ fr as g,
2113
+ br as h,
2114
+ We as i,
2115
+ xr as j,
2116
+ en as k,
2117
+ Cn as s,
2118
+ Ge as u
2119
+ };
2120
+ //# sourceMappingURL=index-82d74e5f.mjs.map