hd-wallet-ui 2.0.32 → 2.0.33

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.
@@ -1,17 +1,17 @@
1
- import { getWalletOriginCapabilities as zn } from "hd-wallet-wasm";
2
- const Ui = Object.freeze({
1
+ import { getWalletOriginCapabilities as qn } from "hd-wallet-wasm";
2
+ const ji = Object.freeze({
3
3
  cm: 0.01,
4
4
  km: 1e3,
5
5
  m: 1,
6
6
  mm: 1e-3
7
- }), ji = Object.freeze({
8
- metersPerSourceUnit: Ui,
7
+ }), Bi = Object.freeze({
8
+ metersPerSourceUnit: ji,
9
9
  quaternionNormTolerance: 1e-6,
10
10
  scaleComponentExclusiveMin: 0,
11
11
  scaleComponentInclusiveMax: 1e6,
12
12
  translationComponentAbsMax: 1e6,
13
13
  upAxes: Object.freeze(["X_UP", "Y_UP", "Z_UP"])
14
- }), Bi = Object.freeze({ reviewedTransform: ji, schemaVersion: 1 }), be = new TextEncoder(), Hn = Object.getPrototypeOf(Uint8Array.prototype), Vi = Object.getOwnPropertyDescriptor(Hn, "buffer").get, Mi = Object.getOwnPropertyDescriptor(Hn, "length").get, $i = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, gn = typeof SharedArrayBuffer > "u" ? null : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get, Ae = "sdn-bip32-slip10-purpose-v1", At = "password-scrypt-v2", De = "ed25519-over-sha256-jcs-v1", An = "ed25519-raw-32-v1", Fi = "ed25519-sdn-signed-request-v2", bn = ["protocolVersion", "providerOrigin", "method", "requestUri", "bodySha256", "bodyBytes", "schema", "entityId", "entityName", "documentCount"], En = ["schemaVersion", "keyId", "identityScheme", "algorithm", "encoding", "signatureProfile", "publicKeyHex", "signatureHex", "requestDigestSha256", "challengeId", "challengeBase64url"], Kn = "https://review.spacedatanetwork.org", Gn = "sdn-asset-review-v1", Wi = "asset-review:assets.ipfs.01", qi = "asset-review-authority:assets.ipfs.01", Vt = "sdn-login:sdn.spaceaware.io", zi = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, ie = /^[0-9a-f]{64}$/u, Yt = /^[0-9a-f]{128}$/u, ke = /^sha256:[0-9a-f]{64}$/u, Hi = /^[1-9A-HJ-NP-Za-km-z]+$/u, Ki = /^b[a-z2-7]{58}$/u, Mt = "abcdefghijklmnopqrstuvwxyz234567", Jn = 131072, Gi = [
14
+ }), Vi = Object.freeze({ reviewedTransform: Bi, schemaVersion: 1 }), be = new TextEncoder(), zn = Object.getPrototypeOf(Uint8Array.prototype), Mi = Object.getOwnPropertyDescriptor(zn, "buffer").get, $i = Object.getOwnPropertyDescriptor(zn, "length").get, Fi = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, gn = typeof SharedArrayBuffer > "u" ? null : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get, Ae = "sdn-bip32-slip10-purpose-v1", At = "password-scrypt-v2", De = "ed25519-over-sha256-jcs-v1", An = "ed25519-raw-32-v1", Wi = "ed25519-sdn-signed-request-v2", bn = ["protocolVersion", "providerOrigin", "method", "requestUri", "bodySha256", "bodyBytes", "schema", "entityId", "entityName", "documentCount"], En = ["schemaVersion", "keyId", "identityScheme", "algorithm", "encoding", "signatureProfile", "publicKeyHex", "signatureHex", "requestDigestSha256", "challengeId", "challengeBase64url"], Hn = "https://review.spacedatanetwork.org", Kn = "sdn-asset-review-v1", qi = "asset-review:assets.ipfs.01", zi = "asset-review-authority:assets.ipfs.01", Vt = "sdn-login:sdn.spaceaware.io", Hi = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, ie = /^[0-9a-f]{64}$/u, Yt = /^[0-9a-f]{128}$/u, ke = /^sha256:[0-9a-f]{64}$/u, Ki = /^[1-9A-HJ-NP-Za-km-z]+$/u, Gi = /^b[a-z2-7]{58}$/u, Mt = "abcdefghijklmnopqrstuvwxyz234567", Gn = 131072, Ji = [
15
15
  "accountFingerprint",
16
16
  "accountIndex",
17
17
  "accountLabel",
@@ -21,7 +21,7 @@ const Ui = Object.freeze({
21
21
  "keys",
22
22
  "schemaVersion",
23
23
  "seedProfile"
24
- ], Ji = [
24
+ ], Qi = [
25
25
  "bip32Fingerprint",
26
26
  "curve",
27
27
  "derivation",
@@ -33,12 +33,12 @@ const Ui = Object.freeze({
33
33
  "purpose",
34
34
  "seedProfile",
35
35
  "signatureProfile"
36
- ], Qi = [
36
+ ], Yi = [
37
37
  "connectionExpiresAt",
38
38
  "event",
39
39
  "identity",
40
40
  "schemaVersion"
41
- ], Yi = [
41
+ ], Xi = [
42
42
  "algorithm",
43
43
  "encoding",
44
44
  "identityScheme",
@@ -46,7 +46,7 @@ const Ui = Object.freeze({
46
46
  "schemaVersion",
47
47
  "signatureHex",
48
48
  "signatureProfile"
49
- ], Xi = [
49
+ ], Zi = [
50
50
  "algorithm",
51
51
  "canonicalEnvelope",
52
52
  "encoding",
@@ -86,7 +86,7 @@ const Ui = Object.freeze({
86
86
  "previousDecisionHead",
87
87
  "protocolVersion",
88
88
  "requestOrigin"
89
- ], Zi = [
89
+ ], er = [
90
90
  "metersPerSourceUnit",
91
91
  "rotation",
92
92
  "scale",
@@ -115,8 +115,8 @@ function oe(e, t) {
115
115
  }
116
116
  return e;
117
117
  }
118
- function Qn(e) {
119
- typeof e != "string" && g("wire JSON must be a string"), be.encode(e).byteLength > Jn && g("wire JSON is too large"), e.charCodeAt(0) === 65279 && g("wire JSON must not contain a BOM");
118
+ function Jn(e) {
119
+ typeof e != "string" && g("wire JSON must be a string"), be.encode(e).byteLength > Gn && g("wire JSON is too large"), e.charCodeAt(0) === 65279 && g("wire JSON must not contain a BOM");
120
120
  let t = 0, n = 0;
121
121
  const i = () => {
122
122
  for (; t < e.length && /[\u0009\u000a\u000d\u0020]/u.test(e[t]); ) t += 1;
@@ -180,33 +180,33 @@ function Qn(e) {
180
180
  const a = s();
181
181
  return i(), t !== e.length && g("wire JSON contains trailing bytes"), a;
182
182
  }
183
- function Yn(e) {
184
- return typeof e == "string" ? Qn(e) : e;
183
+ function Qn(e) {
184
+ return typeof e == "string" ? Jn(e) : e;
185
185
  }
186
- function er(e, t) {
186
+ function tr(e, t) {
187
187
  if (e.byteLength !== t.byteLength) return !1;
188
188
  let n = 0;
189
189
  for (let i = 0; i < e.byteLength; i += 1) n |= e[i] ^ t[i];
190
190
  return n === 0;
191
191
  }
192
192
  function Q(e, t, n) {
193
- const i = Yn(e);
193
+ const i = Qn(e);
194
194
  Nt(i) || g(`${n} must be a JSON object`), Object.getOwnPropertySymbols(i).length !== 0 && g(`${n} has an unknown symbol field`);
195
195
  const r = Object.getOwnPropertyNames(i).sort(), s = [...t].sort(), a = be.encode(r.join("\0")), o = be.encode(s.join("\0"));
196
- er(a, o) || g(`${n} has missing or unknown fields`);
196
+ tr(a, o) || g(`${n} has missing or unknown fields`);
197
197
  for (const c of r) {
198
198
  const l = Object.getOwnPropertyDescriptor(i, c);
199
199
  (!l || !l.enumerable || !("value" in l)) && g(`${n}.${c} must be an enumerable data field`), l.value === void 0 && g(`${n}.${c} must not be undefined`);
200
200
  }
201
201
  return i;
202
202
  }
203
- function ot(e) {
203
+ function st(e) {
204
204
  if (!e || typeof e != "object" || Object.isFrozen(e)) return e;
205
- for (const t of Object.values(e)) ot(t);
205
+ for (const t of Object.values(e)) st(t);
206
206
  return Object.freeze(e);
207
207
  }
208
208
  function ae(e) {
209
- return ot(Object.fromEntries([...e].sort(([t], [n]) => t < n ? -1 : t > n ? 1 : 0)));
209
+ return st(Object.fromEntries([...e].sort(([t], [n]) => t < n ? -1 : t > n ? 1 : 0)));
210
210
  }
211
211
  function Xt(e, t, n) {
212
212
  (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length !== t) && g(`${n} must be a plain array with exactly ${t} values`);
@@ -217,7 +217,7 @@ function Xt(e, t, n) {
217
217
  (!a || !a.enumerable || !("value" in a) || a.value === void 0) && g(`${n} must contain enumerable data values`);
218
218
  }
219
219
  }
220
- function tr(e) {
220
+ function nr(e) {
221
221
  const t = Q(
222
222
  e,
223
223
  ["reviewedTransform", "schemaVersion"],
@@ -254,28 +254,28 @@ function tr(e) {
254
254
  ["upAxes", Object.freeze(Array.from({ length: 3 }, (r, s) => n.upAxes[s]))]
255
255
  ]);
256
256
  }
257
- const _e = tr(Bi);
257
+ const _e = nr(Vi);
258
258
  function I(e, t, n) {
259
259
  return e !== t && g(`${n} must equal ${JSON.stringify(t)}`), e;
260
260
  }
261
- function st(e, t, n) {
261
+ function rt(e, t, n) {
262
262
  return t.includes(e) || g(`${n} is not an allowed value`), e;
263
263
  }
264
264
  function W(e, t, n) {
265
265
  return oe(e, n), t.test(e) || g(`${n} has an invalid encoding`), e;
266
266
  }
267
267
  function Ee(e, t) {
268
- return oe(e, t), (!zi.test(e) || new Date(e).toISOString() !== e) && g(`${t} must be exact RFC3339 milliseconds UTC`), e;
268
+ return oe(e, t), (!Hi.test(e) || new Date(e).toISOString() !== e) && g(`${t} must be exact RFC3339 milliseconds UTC`), e;
269
269
  }
270
270
  function Tt(e, t) {
271
271
  const n = Date.parse(e), i = Date.parse(t);
272
272
  i > n && i - n <= 3e5 || g("request lifetime must be in (0, 300] seconds");
273
273
  }
274
- function nr(e, t) {
275
- (!ArrayBuffer.isView(e) || !(e instanceof Uint8Array) || Object.getPrototypeOf(e) !== Uint8Array.prototype) && g(`${t} must be a plain Uint8Array`), Mi.call(e) !== 32 && g(`${t} must be exactly 32 bytes`);
274
+ function ir(e, t) {
275
+ (!ArrayBuffer.isView(e) || !(e instanceof Uint8Array) || Object.getPrototypeOf(e) !== Uint8Array.prototype) && g(`${t} must be a plain Uint8Array`), $i.call(e) !== 32 && g(`${t} must be exactly 32 bytes`);
276
276
  const i = Array.from({ length: 32 }, (d, u) => String(u)), r = Reflect.ownKeys(e);
277
277
  (r.length !== i.length || r.some((d, u) => d !== i[u])) && g(`${t} Uint8Array must contain only 32 indexed bytes`);
278
- const s = Vi.call(e);
278
+ const s = Mi.call(e);
279
279
  let a = !1;
280
280
  if (gn)
281
281
  try {
@@ -285,7 +285,7 @@ function nr(e, t) {
285
285
  }
286
286
  a && g(`${t} must not use SharedArrayBuffer storage`);
287
287
  try {
288
- $i.call(s);
288
+ Fi.call(s);
289
289
  } catch {
290
290
  g(`${t} must use ArrayBuffer storage`);
291
291
  }
@@ -308,17 +308,17 @@ function Zt(e, t) {
308
308
  g(`${t} must be valid base64url`);
309
309
  }
310
310
  const i = Uint8Array.from(n, (r) => r.charCodeAt(0));
311
- return (i.byteLength !== 32 || nr(i, t) !== e) && g(`${t} must canonically encode exactly 32 bytes`), e;
311
+ return (i.byteLength !== 32 || ir(i, t) !== e) && g(`${t} must canonically encode exactly 32 bytes`), e;
312
312
  }
313
- function ir(e) {
313
+ function rr(e) {
314
314
  let t = 0, n = 0, i = "";
315
315
  for (const r of e)
316
316
  for (t = t << 8 | r, n += 8; n >= 5; )
317
317
  n -= 5, i += Mt[t >>> n & 31], t &= (1 << n) - 1;
318
318
  return n !== 0 && (i += Mt[t << 5 - n & 31]), i;
319
319
  }
320
- function rr(e, t) {
321
- oe(e, "modelCid"), Ki.test(e) || g("modelCid must be canonical CIDv1 raw sha2-256 base32");
320
+ function sr(e, t) {
321
+ oe(e, "modelCid"), Gi.test(e) || g("modelCid must be canonical CIDv1 raw sha2-256 base32");
322
322
  let n = 0, i = 0;
323
323
  const r = [];
324
324
  for (const o of e.slice(1)) {
@@ -327,7 +327,7 @@ function rr(e, t) {
327
327
  }
328
328
  (i !== 0 && n !== 0 || r.length !== 36) && g("modelCid has noncanonical base32 tail bits or length");
329
329
  const s = Uint8Array.from(r);
330
- (s[0] !== 1 || s[1] !== 85 || s[2] !== 18 || s[3] !== 32) && g("modelCid must encode CIDv1 raw sha2-256 with a 32-byte digest"), `b${ir(s)}` !== e && g("modelCid base32 is not canonical");
330
+ (s[0] !== 1 || s[1] !== 85 || s[2] !== 18 || s[3] !== 32) && g("modelCid must encode CIDv1 raw sha2-256 with a 32-byte digest"), `b${rr(s)}` !== e && g("modelCid base32 is not canonical");
331
331
  let a = 0;
332
332
  for (let o = 0; o < 32; o += 1) {
333
333
  const c = Number.parseInt(t.slice(o * 2, o * 2 + 2), 16);
@@ -342,7 +342,7 @@ function en(e, t) {
342
342
  for (const n of ["identityScheme", "keyId", "signatureProfile"])
343
343
  e[n] !== t[n] && g(`canonicalEnvelope ${n} must match the signature result`);
344
344
  }
345
- function sr(e, t) {
345
+ function or(e, t) {
346
346
  const i = Q(e, [
347
347
  "audience",
348
348
  "challengeSha256",
@@ -359,15 +359,15 @@ function sr(e, t) {
359
359
  ], "SDN login canonicalEnvelope");
360
360
  en(i, t), I(i.audience, Vt, "SDN login envelope audience"), W(i.challengeSha256, ie, "SDN login envelope challengeSha256"), I(i.clientId, "sdn-node-console-v1", "SDN login envelope clientId"), Ee(i.issuedAt, "SDN login envelope issuedAt"), Ee(i.expiresAt, "SDN login envelope expiresAt"), Tt(i.issuedAt, i.expiresAt), I(i.identityScheme, Ae, "SDN login envelope identityScheme"), W(i.keyId, ke, "SDN login envelope keyId"), I(i.kind, "sdn-login", "SDN login envelope kind"), W(i.nonce, ie, "SDN login envelope nonce"), I(i.protocolVersion, 2, "SDN login envelope protocolVersion"), I(i.requestOrigin, "https://sdn.spaceaware.io", "SDN login envelope requestOrigin"), I(i.signatureProfile, De, "SDN login envelope signatureProfile");
361
361
  }
362
- function or(e, t) {
362
+ function ar(e, t) {
363
363
  const n = Q(
364
364
  e,
365
365
  [...bt, "kind"],
366
366
  "authority activation canonicalEnvelope"
367
367
  );
368
- en(n, t), I(n.kind, "asset-review-authority-activation", "activation envelope kind"), Zn(Object.fromEntries(bt.map((i) => [i, n[i]])));
368
+ en(n, t), I(n.kind, "asset-review-authority-activation", "activation envelope kind"), Xn(Object.fromEntries(bt.map((i) => [i, n[i]])));
369
369
  }
370
- function ar(e, t) {
370
+ function cr(e, t) {
371
371
  const n = e?.decision === "approve" ? ["note", "reviewedTransform"] : e?.decision === "disapprove" ? ["reason"] : [], i = [...$t, ...n], r = Q(e, [
372
372
  ...i,
373
373
  "identityScheme",
@@ -376,15 +376,15 @@ function ar(e, t) {
376
376
  "purpose",
377
377
  "signatureProfile"
378
378
  ], "asset review decision canonicalEnvelope");
379
- en(r, t), I(r.identityScheme, Ae, "decision envelope identityScheme"), W(r.keyId, ke, "decision envelope keyId"), I(r.kind, "asset-review-attestation", "decision envelope kind"), I(r.purpose, "asset-review-approval", "decision envelope purpose"), I(r.signatureProfile, De, "decision envelope signatureProfile"), ei(Object.fromEntries(i.map((s) => [s, r[s]])));
379
+ en(r, t), I(r.identityScheme, Ae, "decision envelope identityScheme"), W(r.keyId, ke, "decision envelope keyId"), I(r.kind, "asset-review-attestation", "decision envelope kind"), I(r.purpose, "asset-review-approval", "decision envelope purpose"), I(r.signatureProfile, De, "decision envelope signatureProfile"), Zn(Object.fromEntries(i.map((s) => [s, r[s]])));
380
380
  }
381
- function cr(e, t, n) {
382
- oe(e, "canonicalEnvelope"), be.encode(e).byteLength > Jn && g("canonicalEnvelope is too large");
383
- const i = Qn(e);
384
- return (!Nt(i) || i.kind !== t) && g("canonicalEnvelope kind does not match the operation"), Ft(i) !== e && g("canonicalEnvelope must be exact JCS"), t === "sdn-login" ? sr(i, n) : t === "asset-review-authority-activation" ? or(i, n) : t === "asset-review-attestation" ? ar(i, n) : g("canonicalEnvelope operation is not registered"), e;
381
+ function lr(e, t, n) {
382
+ oe(e, "canonicalEnvelope"), be.encode(e).byteLength > Gn && g("canonicalEnvelope is too large");
383
+ const i = Jn(e);
384
+ return (!Nt(i) || i.kind !== t) && g("canonicalEnvelope kind does not match the operation"), Ft(i) !== e && g("canonicalEnvelope must be exact JCS"), t === "sdn-login" ? or(i, n) : t === "asset-review-authority-activation" ? ar(i, n) : t === "asset-review-attestation" ? cr(i, n) : g("canonicalEnvelope operation is not registered"), e;
385
385
  }
386
- function lr(e, t) {
387
- const n = Q(e, Ji, `identity key ${t.purpose}`);
386
+ function ur(e, t) {
387
+ const n = Q(e, Qi, `identity key ${t.purpose}`);
388
388
  return I(n.purpose, t.purpose, "key purpose"), I(n.identityScheme, Ae, "key identityScheme"), I(n.seedProfile, At, "key seedProfile"), I(n.signatureProfile, t.signatureProfile, "key signatureProfile"), I(n.curve, t.curve, "key curve"), I(n.derivation, "slip10", "key derivation"), I(n.path, t.path, "key path"), I(n.encoding, "raw", "key encoding"), W(n.publicKeyHex, ie, "key publicKeyHex"), I(n.bip32Fingerprint, null, "key bip32Fingerprint"), W(n.keyId, ke, "key keyId"), ae([
389
389
  ["bip32Fingerprint", null],
390
390
  ["curve", n.curve],
@@ -399,9 +399,9 @@ function lr(e, t) {
399
399
  ["signatureProfile", n.signatureProfile]
400
400
  ]);
401
401
  }
402
- function ur(e) {
403
- const t = Q(e, Gi, "WalletPublicIdentity");
404
- I(t.schemaVersion, 1, "identity schemaVersion"), I(t.identityScheme, Ae, "identity identityScheme"), I(t.seedProfile, At, "identity seedProfile"), t.accountIndex !== 0 && g("public wallet identity must use account 0"), I(t.accountLabel, null, "identity accountLabel"), oe(t.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(t.accountXpub) || g("identity accountXpub is invalid"), oe(t.accountPeerId, "identity accountPeerId"), (!t.accountPeerId.startsWith("16Uiu2H") || t.accountPeerId.length < 40 || t.accountPeerId.length > 64 || !Hi.test(t.accountPeerId)) && g("identity accountPeerId is invalid"), W(t.accountFingerprint, /^[0-9a-f]{8}$/u, "identity accountFingerprint"), Xt(t.keys, 3, "public identity keys array");
402
+ function dr(e) {
403
+ const t = Q(e, Ji, "WalletPublicIdentity");
404
+ I(t.schemaVersion, 1, "identity schemaVersion"), I(t.identityScheme, Ae, "identity identityScheme"), I(t.seedProfile, At, "identity seedProfile"), t.accountIndex !== 0 && g("public wallet identity must use account 0"), I(t.accountLabel, null, "identity accountLabel"), oe(t.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(t.accountXpub) || g("identity accountXpub is invalid"), oe(t.accountPeerId, "identity accountPeerId"), (!t.accountPeerId.startsWith("16Uiu2H") || t.accountPeerId.length < 40 || t.accountPeerId.length > 64 || !Ki.test(t.accountPeerId)) && g("identity accountPeerId is invalid"), W(t.accountFingerprint, /^[0-9a-f]{8}$/u, "identity accountFingerprint"), Xt(t.keys, 3, "public identity keys array");
405
405
  const n = [
406
406
  {
407
407
  purpose: "asset-review-approval",
@@ -423,7 +423,7 @@ function ur(e) {
423
423
  }
424
424
  ], i = Array.from(
425
425
  { length: 3 },
426
- (r, s) => lr(t.keys[s], n[s])
426
+ (r, s) => ur(t.keys[s], n[s])
427
427
  );
428
428
  return ae([
429
429
  ["accountFingerprint", t.accountFingerprint],
@@ -432,25 +432,25 @@ function ur(e) {
432
432
  ["accountPeerId", t.accountPeerId],
433
433
  ["accountXpub", t.accountXpub],
434
434
  ["identityScheme", Ae],
435
- ["keys", ot(i)],
435
+ ["keys", st(i)],
436
436
  ["schemaVersion", 1],
437
437
  ["seedProfile", At]
438
438
  ]);
439
439
  }
440
- function Xn(e, t) {
441
- const n = Q(e, Qi, `${t} result`);
442
- I(n.schemaVersion, 1, "connection result schemaVersion"), st(n.event, ["connected", "disconnected"], "connection event"), t === "connect" && n.event !== "connected" && g("connect result must be connected");
440
+ function Yn(e, t) {
441
+ const n = Q(e, Yi, `${t} result`);
442
+ I(n.schemaVersion, 1, "connection result schemaVersion"), rt(n.event, ["connected", "disconnected"], "connection event"), t === "connect" && n.event !== "connected" && g("connect result must be connected");
443
443
  let i = null, r = null;
444
- return n.event === "connected" ? (i = ur(n.identity), r = Ee(n.connectionExpiresAt, "connectionExpiresAt")) : (n.identity !== null || n.connectionExpiresAt !== null) && g("disconnected result must clear identity and expiry"), ae([
444
+ return n.event === "connected" ? (i = dr(n.identity), r = Ee(n.connectionExpiresAt, "connectionExpiresAt")) : (n.identity !== null || n.connectionExpiresAt !== null) && g("disconnected result must clear identity and expiry"), ae([
445
445
  ["connectionExpiresAt", r],
446
446
  ["event", n.event],
447
447
  ["identity", i],
448
448
  ["schemaVersion", 1]
449
449
  ]);
450
450
  }
451
- function dr(e) {
452
- const t = Q(e, Yi, "raw signature");
453
- return I(t.schemaVersion, 1, "signature schemaVersion"), W(t.keyId, ke, "signature keyId"), st(t.identityScheme, [
451
+ function fr(e) {
452
+ const t = Q(e, Xi, "raw signature");
453
+ return I(t.schemaVersion, 1, "signature schemaVersion"), W(t.keyId, ke, "signature keyId"), rt(t.identityScheme, [
454
454
  "sdn-fast-password-auth-v1-legacy",
455
455
  "sdn-bip39-auth-v1-legacy"
456
456
  ], "raw signature identityScheme"), I(t.algorithm, "ed25519", "signature algorithm"), I(t.encoding, "raw", "signature encoding"), I(t.signatureProfile, An, "signature profile"), W(t.signatureHex, Yt, "signatureHex"), ae([
@@ -464,8 +464,8 @@ function dr(e) {
464
464
  ]);
465
465
  }
466
466
  function tn(e, t) {
467
- const n = Q(e, Xi, "canonical signature");
468
- return I(n.schemaVersion, 1, "signature schemaVersion"), W(n.keyId, ke, "signature keyId"), I(n.identityScheme, Ae, "signature identityScheme"), I(n.algorithm, "ed25519", "signature algorithm"), I(n.encoding, "raw", "signature encoding"), I(n.signatureProfile, De, "signature profile"), cr(n.canonicalEnvelope, t, n), W(n.signedDigestSha256, ie, "signedDigestSha256"), W(n.signatureHex, Yt, "signatureHex"), ae([
467
+ const n = Q(e, Zi, "canonical signature");
468
+ return I(n.schemaVersion, 1, "signature schemaVersion"), W(n.keyId, ke, "signature keyId"), I(n.identityScheme, Ae, "signature identityScheme"), I(n.algorithm, "ed25519", "signature algorithm"), I(n.encoding, "raw", "signature encoding"), I(n.signatureProfile, De, "signature profile"), lr(n.canonicalEnvelope, t, n), W(n.signedDigestSha256, ie, "signedDigestSha256"), W(n.signatureHex, Yt, "signatureHex"), ae([
469
469
  ["algorithm", "ed25519"],
470
470
  ["canonicalEnvelope", n.canonicalEnvelope],
471
471
  ["encoding", "raw"],
@@ -477,16 +477,16 @@ function tn(e, t) {
477
477
  ["signedDigestSha256", n.signedDigestSha256]
478
478
  ]);
479
479
  }
480
- function fr(e) {
480
+ function pr(e) {
481
481
  const t = Q(e, ["challengeBase64url", "protocolVersion"], "SDN login v1 request");
482
482
  return I(t.protocolVersion, 1, "SDN login v1 protocolVersion"), Zt(t.challengeBase64url, "challengeBase64url"), ae([
483
483
  ["challengeBase64url", t.challengeBase64url],
484
484
  ["protocolVersion", 1]
485
485
  ]);
486
486
  }
487
- function pr(e) {
487
+ function hr(e) {
488
488
  const t = Q(e, bn, "SDN publication request");
489
- I(t.protocolVersion, 1, "publication protocolVersion"), I(t.method, "POST", "publication method"), st(t.schema, ["CZM", "ETM"], "publication schema"), oe(t.providerOrigin, "providerOrigin");
489
+ I(t.protocolVersion, 1, "publication protocolVersion"), I(t.method, "POST", "publication method"), rt(t.schema, ["CZM", "ETM"], "publication schema"), oe(t.providerOrigin, "providerOrigin");
490
490
  let n;
491
491
  try {
492
492
  n = new URL(t.providerOrigin);
@@ -495,7 +495,7 @@ function pr(e) {
495
495
  }
496
496
  (n.protocol !== "https:" || t.providerOrigin !== n.origin || n.username || n.password || n.port === "0" || n.pathname !== "/" || n.search || n.hash || n.hostname.length > 253 || n.hostname.split(".").some((s) => !/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(s))) && g("providerOrigin must be a canonical HTTPS DNS or IPv4 origin");
497
497
  const i = `/api/v1/data/publish/${t.schema}`, r = `/api/v1/data/publish/batch/${t.schema}`;
498
- st(t.requestUri, [i, `${i}.fbs`, r, `${r}.fbs`], "publication requestUri"), W(t.bodySha256, ie, "publication bodySha256");
498
+ rt(t.requestUri, [i, `${i}.fbs`, r, `${r}.fbs`], "publication requestUri"), W(t.bodySha256, ie, "publication bodySha256");
499
499
  for (const [s, a] of [["bodyBytes", 1048576], ["documentCount", 1e5]])
500
500
  (!Number.isInteger(t[s]) || t[s] < 1 || t[s] > a) && g(`publication ${s} is outside its bounds`);
501
501
  for (const s of ["entityId", "entityName"]) {
@@ -505,11 +505,11 @@ function pr(e) {
505
505
  }
506
506
  return ae(bn.map((s) => [s, t[s]]));
507
507
  }
508
- function hr(e) {
508
+ function yr(e) {
509
509
  const t = Q(e, En, "SDN publication signature");
510
- return I(t.schemaVersion, 1, "publication signature schemaVersion"), I(t.identityScheme, Ae, "publication identityScheme"), I(t.algorithm, "ed25519", "publication algorithm"), I(t.encoding, "raw", "publication encoding"), I(t.signatureProfile, Fi, "publication signatureProfile"), W(t.keyId, ke, "publication keyId"), W(t.publicKeyHex, ie, "publication publicKeyHex"), W(t.signatureHex, Yt, "publication signatureHex"), W(t.requestDigestSha256, ie, "publication requestDigestSha256"), W(t.challengeId, /^[0-9a-f]{32}$/u, "publication challengeId"), Zt(t.challengeBase64url, "publication challengeBase64url"), ae(En.map((n) => [n, t[n]]));
510
+ return I(t.schemaVersion, 1, "publication signature schemaVersion"), I(t.identityScheme, Ae, "publication identityScheme"), I(t.algorithm, "ed25519", "publication algorithm"), I(t.encoding, "raw", "publication encoding"), I(t.signatureProfile, Wi, "publication signatureProfile"), W(t.keyId, ke, "publication keyId"), W(t.publicKeyHex, ie, "publication publicKeyHex"), W(t.signatureHex, Yt, "publication signatureHex"), W(t.requestDigestSha256, ie, "publication requestDigestSha256"), W(t.challengeId, /^[0-9a-f]{32}$/u, "publication challengeId"), Zt(t.challengeBase64url, "publication challengeBase64url"), ae(En.map((n) => [n, t[n]]));
511
511
  }
512
- function yr(e) {
512
+ function mr(e) {
513
513
  const t = Q(e, [
514
514
  "audience",
515
515
  "challengeBase64url",
@@ -527,9 +527,9 @@ function yr(e) {
527
527
  ["protocolVersion", 2]
528
528
  ]);
529
529
  }
530
- function Zn(e) {
530
+ function Xn(e) {
531
531
  const t = Q(e, bt, "authority activation request");
532
- return I(t.protocolVersion, 1, "activation protocolVersion"), I(t.audience, qi, "activation audience"), I(t.requestOrigin, Kn, "activation requestOrigin"), I(t.clientId, Gn, "activation clientId"), I(t.serviceInstance, "assets.ipfs.01/asset-review-attestation", "activation serviceInstance"), I(t.purpose, "asset-review-authority-activation", "activation purpose"), W(t.nonce, ie, "activation nonce"), Ee(t.issuedAt, "activation issuedAt"), Ee(t.expiresAt, "activation expiresAt"), Tt(t.issuedAt, t.expiresAt), W(t.publicKeyHex, ie, "activation publicKeyHex"), W(t.keyId, ke, "activation keyId"), I(t.identityScheme, Ae, "activation identityScheme"), I(t.signatureProfile, De, "activation signatureProfile"), ae(bt.map((n) => [n, t[n]]));
532
+ return I(t.protocolVersion, 1, "activation protocolVersion"), I(t.audience, zi, "activation audience"), I(t.requestOrigin, Hn, "activation requestOrigin"), I(t.clientId, Kn, "activation clientId"), I(t.serviceInstance, "assets.ipfs.01/asset-review-attestation", "activation serviceInstance"), I(t.purpose, "asset-review-authority-activation", "activation purpose"), W(t.nonce, ie, "activation nonce"), Ee(t.issuedAt, "activation issuedAt"), Ee(t.expiresAt, "activation expiresAt"), Tt(t.issuedAt, t.expiresAt), W(t.publicKeyHex, ie, "activation publicKeyHex"), W(t.keyId, ke, "activation keyId"), I(t.identityScheme, Ae, "activation identityScheme"), I(t.signatureProfile, De, "activation signatureProfile"), ae(bt.map((n) => [n, t[n]]));
533
533
  }
534
534
  function Pt(e, t, n) {
535
535
  Xt(e, t, `${n} array`);
@@ -537,13 +537,13 @@ function Pt(e, t, n) {
537
537
  const a = e[s];
538
538
  return (typeof a != "number" || !Number.isFinite(a)) && g(`${n} values must be finite numbers`), a;
539
539
  });
540
- return ot(i);
540
+ return st(i);
541
541
  }
542
- function mr(e) {
543
- const t = Q(e, Zi, "reviewedTransform"), n = Pt(t.translation, 3, "translation"), i = Pt(t.rotation, 4, "rotation"), r = Pt(t.scale, 3, "scale");
542
+ function gr(e) {
543
+ const t = Q(e, er, "reviewedTransform"), n = Pt(t.translation, 3, "translation"), i = Pt(t.rotation, 4, "rotation"), r = Pt(t.scale, 3, "scale");
544
544
  n.some((a) => Math.abs(a) > _e.translationComponentAbsMax) && g("translation values exceed the reviewed transform policy"), r.some((a) => a <= _e.scaleComponentExclusiveMin || a > _e.scaleComponentInclusiveMax) && g("scale values exceed the reviewed transform policy");
545
545
  const s = Math.hypot(...i);
546
- return Math.abs(s - 1) > _e.quaternionNormTolerance && g("rotation must be a unit quaternion within the reviewed tolerance"), st(t.upAxis, _e.upAxes, "upAxis"), oe(t.sourceUnits, "sourceUnits"), Object.hasOwn(_e.metersPerSourceUnit, t.sourceUnits) || g("sourceUnits is not allowed by the reviewed transform policy"), (typeof t.metersPerSourceUnit != "number" || !Number.isFinite(t.metersPerSourceUnit) || t.metersPerSourceUnit !== _e.metersPerSourceUnit[t.sourceUnits]) && g("metersPerSourceUnit must exactly match sourceUnits"), ae([
546
+ return Math.abs(s - 1) > _e.quaternionNormTolerance && g("rotation must be a unit quaternion within the reviewed tolerance"), rt(t.upAxis, _e.upAxes, "upAxis"), oe(t.sourceUnits, "sourceUnits"), Object.hasOwn(_e.metersPerSourceUnit, t.sourceUnits) || g("sourceUnits is not allowed by the reviewed transform policy"), (typeof t.metersPerSourceUnit != "number" || !Number.isFinite(t.metersPerSourceUnit) || t.metersPerSourceUnit !== _e.metersPerSourceUnit[t.sourceUnits]) && g("metersPerSourceUnit must exactly match sourceUnits"), ae([
547
547
  ["metersPerSourceUnit", t.metersPerSourceUnit],
548
548
  ["rotation", i],
549
549
  ["scale", r],
@@ -561,66 +561,66 @@ function In(e, t, n) {
561
561
  const i = Array.from(e, (r) => r.codePointAt(0));
562
562
  return (wn(i[0]) || wn(i[i.length - 1])) && g(`${t} must already be trimmed`), e;
563
563
  }
564
- function ei(e) {
565
- const t = Yn(e);
564
+ function Zn(e) {
565
+ const t = Qn(e);
566
566
  Nt(t) || g("asset review decision request must be a JSON object");
567
567
  const n = Object.getOwnPropertyDescriptor(t, "decision");
568
568
  (!n || !n.enumerable || !("value" in n) || n.value === void 0) && g("asset review decision request has an invalid decision field");
569
569
  const i = n.value, r = i === "approve" ? ["note", "reviewedTransform"] : i === "disapprove" ? ["reason"] : [], s = Q(t, [...$t, ...r], "asset review decision request");
570
- I(s.protocolVersion, 1, "decision protocolVersion"), I(s.audience, Wi, "decision audience"), I(s.requestOrigin, Kn, "decision requestOrigin"), I(s.clientId, Gn, "decision clientId"), W(s.challengeId, ie, "challengeId"), W(s.nonce, ie, "decision nonce"), Ee(s.issuedAt, "decision issuedAt"), Ee(s.expiresAt, "decision expiresAt"), Tt(s.issuedAt, s.expiresAt), W(s.modelSha256, ie, "modelSha256"), W(s.metadataSha256, ie, "metadataSha256"), s.previousDecisionHead !== null && W(s.previousDecisionHead, ie, "previousDecisionHead"), rr(s.modelCid, s.modelSha256), (!Number.isSafeInteger(s.modelBytes) || s.modelBytes <= 0) && g("modelBytes must be a positive safe integer"), oe(s.candidateKey, "candidateKey");
570
+ I(s.protocolVersion, 1, "decision protocolVersion"), I(s.audience, qi, "decision audience"), I(s.requestOrigin, Hn, "decision requestOrigin"), I(s.clientId, Kn, "decision clientId"), W(s.challengeId, ie, "challengeId"), W(s.nonce, ie, "decision nonce"), Ee(s.issuedAt, "decision issuedAt"), Ee(s.expiresAt, "decision expiresAt"), Tt(s.issuedAt, s.expiresAt), W(s.modelSha256, ie, "modelSha256"), W(s.metadataSha256, ie, "metadataSha256"), s.previousDecisionHead !== null && W(s.previousDecisionHead, ie, "previousDecisionHead"), sr(s.modelCid, s.modelSha256), (!Number.isSafeInteger(s.modelBytes) || s.modelBytes <= 0) && g("modelBytes must be a positive safe integer"), oe(s.candidateKey, "candidateKey");
571
571
  const a = "asset-review:", o = `:${s.modelSha256}`;
572
572
  (!s.candidateKey.startsWith(a) || !s.candidateKey.endsWith(o) || be.encode(s.candidateKey).byteLength > 206) && g("candidateKey does not bind the model digest");
573
573
  const c = s.candidateKey.slice(a.length, -o.length);
574
574
  (!/^[a-z0-9-]+\/[a-z0-9][a-z0-9-]*$/u.test(c) || be.encode(c).byteLength > 128) && g("candidateKey entityId is invalid");
575
575
  const l = $t.map((u) => [u, s[u]]);
576
- return i === "approve" ? (l.push(["note", In(s.note, "note", !0)]), l.push(["reviewedTransform", mr(s.reviewedTransform)])) : l.push(["reason", In(s.reason, "reason", !1)]), Object.values(s).filter((u) => typeof u == "string").reduce((u, p) => u + be.encode(p).byteLength, 0) > 16384 && g("decision request strings exceed 16 KiB"), ae(l);
576
+ return i === "approve" ? (l.push(["note", In(s.note, "note", !0)]), l.push(["reviewedTransform", gr(s.reviewedTransform)])) : l.push(["reason", In(s.reason, "reason", !1)]), Object.values(s).filter((u) => typeof u == "string").reduce((u, p) => u + be.encode(p).byteLength, 0) > 16384 && g("decision request strings exceed 16 KiB"), ae(l);
577
577
  }
578
- function ti(e, t) {
579
- return Q(e, [], t), ot({});
580
- }
581
- function gr(e) {
582
- return ti(e, "wallet connect request");
578
+ function ei(e, t) {
579
+ return Q(e, [], t), st({});
583
580
  }
584
581
  function Ar(e) {
585
- return Xn(e, "connect");
582
+ return ei(e, "wallet connect request");
586
583
  }
587
584
  function br(e) {
588
- return ti(e, "wallet account request");
589
- }
590
- function ni(e) {
591
- return Xn(e, "account");
585
+ return Yn(e, "connect");
592
586
  }
593
587
  function Er(e) {
594
- return fr(e);
588
+ return ei(e, "wallet account request");
589
+ }
590
+ function ti(e) {
591
+ return Yn(e, "account");
595
592
  }
596
593
  function wr(e) {
597
- return dr(e);
594
+ return pr(e);
598
595
  }
599
596
  function Ir(e) {
600
- return yr(e);
597
+ return fr(e);
601
598
  }
602
599
  function vr(e) {
603
- return tn(e, "sdn-login");
600
+ return mr(e);
604
601
  }
605
- function ii(e) {
606
- return pr(e);
602
+ function Sr(e) {
603
+ return tn(e, "sdn-login");
607
604
  }
608
- function ri(e) {
605
+ function ni(e) {
609
606
  return hr(e);
610
607
  }
611
- function Sr(e) {
612
- return Zn(e);
608
+ function ii(e) {
609
+ return yr(e);
613
610
  }
614
611
  function Lr(e) {
615
- return tn(e, "asset-review-authority-activation");
612
+ return Xn(e);
616
613
  }
617
614
  function Rr(e) {
618
- return ei(e);
615
+ return tn(e, "asset-review-authority-activation");
619
616
  }
620
617
  function Or(e) {
618
+ return Zn(e);
619
+ }
620
+ function Nr(e) {
621
621
  return tn(e, "asset-review-attestation");
622
622
  }
623
- const Nr = Object.freeze([
623
+ const Tr = Object.freeze([
624
624
  "callbackUri",
625
625
  "clientDisplayName",
626
626
  "clientId",
@@ -634,48 +634,48 @@ const Nr = Object.freeze([
634
634
  "schemaVersion",
635
635
  "state",
636
636
  "transactionId"
637
- ]), pt = /^[0-9a-f]{64}$/u, si = /^[A-Za-z0-9_-]{43}$/u, Tr = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, Cr = new TextEncoder(), oi = Object.freeze({
637
+ ]), ft = /^[0-9a-f]{64}$/u, ri = /^[A-Za-z0-9_-]{43}$/u, Cr = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, _r = new TextEncoder(), si = Object.freeze({
638
638
  "sdn.auth.publish-request.v1": Object.freeze({
639
- parseRequest: ii,
640
- buildResult: ri,
639
+ parseRequest: ni,
640
+ buildResult: ii,
641
641
  publish: !0
642
642
  }),
643
643
  "sdn.auth.jcs-envelope.v2": Object.freeze({
644
- parseRequest: Ir,
645
- buildResult: vr,
644
+ parseRequest: vr,
645
+ buildResult: Sr,
646
646
  sign(e, t, n, i) {
647
647
  return e.signSdnLoginV2(t, n, i.registryRow);
648
648
  }
649
649
  }),
650
650
  "sdn.auth.raw-challenge.v1": Object.freeze({
651
- parseRequest: Er,
652
- buildResult: wr,
651
+ parseRequest: wr,
652
+ buildResult: Ir,
653
653
  sign(e, t, n) {
654
- return e.signSdnLoginV1(t, Pr(n.challengeBase64url));
654
+ return e.signSdnLoginV1(t, kr(n.challengeBase64url));
655
655
  }
656
656
  }),
657
657
  "sdn.asset-review.authority-activation.v1": Object.freeze({
658
- parseRequest: Sr,
659
- buildResult: Lr,
658
+ parseRequest: Lr,
659
+ buildResult: Rr,
660
660
  sign(e, t, n, i) {
661
661
  return e.signAssetReviewAuthorityActivation(t, n, i.registryRow);
662
662
  }
663
663
  }),
664
664
  "sdn.asset-review.decision.v1": Object.freeze({
665
- parseRequest: Rr,
666
- buildResult: Or,
665
+ parseRequest: Or,
666
+ buildResult: Nr,
667
667
  sign(e, t, n, i) {
668
668
  return e.signAssetReviewDecision(t, n, i.registryRow);
669
669
  }
670
670
  }),
671
671
  "sdn.wallet.account.v1": Object.freeze({
672
- parseRequest: br,
673
- buildResult: ni,
672
+ parseRequest: Er,
673
+ buildResult: ti,
674
674
  connect: !0
675
675
  }),
676
676
  "sdn.wallet.connect.v1": Object.freeze({
677
- parseRequest: gr,
678
- buildResult: Ar,
677
+ parseRequest: Ar,
678
+ buildResult: br,
679
679
  connect: !0
680
680
  })
681
681
  });
@@ -715,8 +715,8 @@ function Wt(e, t, n = "INVALID_TRANSACTION") {
715
715
  }
716
716
  return a;
717
717
  }
718
- function ht(e, t = "INVALID_TRANSACTION") {
719
- (typeof e != "string" || !Tr.test(e)) && _(t);
718
+ function pt(e, t = "INVALID_TRANSACTION") {
719
+ (typeof e != "string" || !Cr.test(e)) && _(t);
720
720
  const n = Date.parse(e);
721
721
  return (!Number.isFinite(n) || new Date(n).toISOString() !== e) && _(t), n;
722
722
  }
@@ -730,17 +730,17 @@ function et(e) {
730
730
  function qt(e) {
731
731
  return e === null || typeof e == "boolean" || typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? (Number.isFinite(e) || _("INVALID_TRANSACTION"), JSON.stringify(e)) : Array.isArray(e) ? `[${e.map(qt).join(",")}]` : (nn(e) || _("INVALID_TRANSACTION"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${qt(e[t])}`).join(",")}}`);
732
732
  }
733
- async function _r(e, t) {
733
+ async function xr(e, t) {
734
734
  typeof t != "function" && _("CRYPTO_UNAVAILABLE");
735
735
  let n;
736
736
  try {
737
- n = await t(Cr.encode(qt(e)));
737
+ n = await t(_r.encode(qt(e)));
738
738
  } catch {
739
739
  _("CRYPTO_UNAVAILABLE");
740
740
  }
741
741
  return (!(n instanceof Uint8Array) || n.byteLength !== 32) && _("CRYPTO_UNAVAILABLE"), Array.from(n, (i) => i.toString(16).padStart(2, "0")).join("");
742
742
  }
743
- function xr(e, t) {
743
+ function Dr(e, t) {
744
744
  if (typeof e != "string" || typeof t != "string") return !1;
745
745
  const n = Math.max(e.length, t.length);
746
746
  let i = e.length ^ t.length;
@@ -748,7 +748,7 @@ function xr(e, t) {
748
748
  i |= (e.charCodeAt(r) || 0) ^ (t.charCodeAt(r) || 0);
749
749
  return i === 0;
750
750
  }
751
- function Dr(e, t) {
751
+ function Pr(e, t) {
752
752
  try {
753
753
  if (typeof e?.resolveRegistryBinding == "function")
754
754
  return e.resolveRegistryBinding(t);
@@ -777,17 +777,17 @@ async function kt(e, {
777
777
  now: s = () => Date.now(),
778
778
  expectedTransactionId: a = null
779
779
  }) {
780
- const o = Wt(e, Nr);
781
- (o.schemaVersion !== 1 || typeof o.clientDisplayName != "string" || o.clientDisplayName.length < 1 || o.clientDisplayName.length > 80 || !pt.test(o.transactionId) || !pt.test(o.state) || !pt.test(o.requestSha256) || !si.test(o.resultToken)) && _("INVALID_TRANSACTION"), a !== null && o.transactionId !== a && _("INVALID_TRANSACTION");
782
- const c = oi[o.operation];
780
+ const o = Wt(e, Tr);
781
+ (o.schemaVersion !== 1 || typeof o.clientDisplayName != "string" || o.clientDisplayName.length < 1 || o.clientDisplayName.length > 80 || !ft.test(o.transactionId) || !ft.test(o.state) || !ft.test(o.requestSha256) || !ri.test(o.resultToken)) && _("INVALID_TRANSACTION"), a !== null && o.transactionId !== a && _("INVALID_TRANSACTION");
782
+ const c = si[o.operation];
783
783
  c || _("UNREGISTERED_TRANSACTION");
784
- const l = Dr(t, {
784
+ const l = Pr(t, {
785
785
  clientId: o.clientId,
786
786
  operation: o.operation,
787
787
  requestOrigin: o.requestOrigin
788
788
  });
789
789
  (l.registryReleaseSha256 !== o.registryVersion || l.callbackUri !== o.callbackUri || l.clientDisplayName !== o.clientDisplayName || l.clientId !== o.clientId || l.operation !== o.operation || l.requestOrigin !== o.requestOrigin) && _("REGISTRY_BINDING_MISMATCH");
790
- const d = s(), u = ht(o.expiresAt);
790
+ const d = s(), u = pt(o.expiresAt);
791
791
  (!Number.isFinite(d) || u <= d || u - d > l.maxLifetimeSeconds * 1e3) && _("TRANSACTION_EXPIRED");
792
792
  let p;
793
793
  try {
@@ -797,12 +797,12 @@ async function kt(e, {
797
797
  }
798
798
  let f;
799
799
  try {
800
- f = await _r(p, i);
800
+ f = await xr(p, i);
801
801
  } catch (b) {
802
802
  if (b instanceof we) throw b;
803
803
  _("CRYPTO_UNAVAILABLE");
804
804
  }
805
- xr(f, o.requestSha256) || _("REQUEST_HASH_MISMATCH");
805
+ Dr(f, o.requestSha256) || _("REQUEST_HASH_MISMATCH");
806
806
  const A = { ...o, request: p };
807
807
  return Object.freeze({
808
808
  binding: et(l),
@@ -811,8 +811,8 @@ async function kt(e, {
811
811
  transaction: et(A)
812
812
  });
813
813
  }
814
- function Pr(e) {
815
- si.test(e) || _("INVALID_TRANSACTION");
814
+ function kr(e) {
815
+ ri.test(e) || _("INVALID_TRANSACTION");
816
816
  let t;
817
817
  try {
818
818
  t = globalThis.atob(`${e.replace(/-/gu, "+").replace(/_/gu, "/")}=`);
@@ -822,7 +822,7 @@ function Pr(e) {
822
822
  const n = Uint8Array.from(t, (i) => i.charCodeAt(0));
823
823
  return n.byteLength !== 32 && _("INVALID_TRANSACTION"), n;
824
824
  }
825
- function kr(e, t, n, i) {
825
+ function Ur(e, t, n, i) {
826
826
  const r = e.createElement("div");
827
827
  r.className = "wallet-confirmation-row";
828
828
  const s = e.createElement("strong");
@@ -838,7 +838,7 @@ function vn(e) {
838
838
  }
839
839
  }
840
840
  const Sn = "The site sees your public key and address. It cannot spend or sign anything without asking you.";
841
- function ai(e, t = {}) {
841
+ function oi(e, t = {}) {
842
842
  const n = vn(e.requestOrigin), i = String(e.clientDisplayName ?? "").trim(), r = i || n, s = i && n && i !== n ? [["Site", n]] : [], a = (o, c, l, d = []) => ({
843
843
  title: o,
844
844
  detail: c,
@@ -873,26 +873,26 @@ function ai(e, t = {}) {
873
873
  return a(`Confirm a request from ${r}`, "", "Confirm");
874
874
  }
875
875
  }
876
- function Ur(e, { binding: t, document: n, request: i }) {
877
- const r = ai(t, i ?? {});
876
+ function jr(e, { binding: t, document: n, request: i }) {
877
+ const r = oi(t, i ?? {});
878
878
  e.replaceChildren();
879
879
  const s = n.createElement("h1");
880
880
  if (s.id = "wallet-confirmation-heading", s.textContent = r.title, e.append(s), r.detail) {
881
881
  const a = n.createElement("p");
882
882
  a.className = "wallet-confirmation-detail", a.textContent = r.detail, e.append(a);
883
883
  }
884
- for (const [a, o] of r.facts) kr(n, e, a, String(o));
884
+ for (const [a, o] of r.facts) Ur(n, e, a, String(o));
885
885
  return e;
886
886
  }
887
- async function jr({ assertCurrent: e, binding: t, capabilities: n, handle: i, identity: r, transaction: s }) {
888
- const a = ii(s.request);
887
+ async function Br({ assertCurrent: e, binding: t, capabilities: n, handle: i, identity: r, transaction: s }) {
888
+ const a = ni(s.request);
889
889
  (t.clientId !== "spaceaware-web-v1" || t.requestOrigin !== "https://spaceaware.io" || t.registryRow !== "spaceaware-publish-request-v1" || typeof n.signSdnPublishRequest != "function" || r?.identityScheme !== "sdn-bip32-slip10-purpose-v1" || r?.seedProfile !== "password-scrypt-v2") && _("OPERATION_NOT_ALLOWED");
890
890
  const o = r.keys?.filter((y) => y?.purpose === "sdn-authentication") ?? [];
891
- (o.length !== 1 || o[0].identityScheme !== r.identityScheme || o[0].seedProfile !== r.seedProfile || o[0].curve !== "ed25519" || !pt.test(o[0].publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(o[0].keyId)) && _("OPERATION_NOT_ALLOWED");
891
+ (o.length !== 1 || o[0].identityScheme !== r.identityScheme || o[0].seedProfile !== r.seedProfile || o[0].curve !== "ed25519" || !ft.test(o[0].publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(o[0].keyId)) && _("OPERATION_NOT_ALLOWED");
892
892
  const { publicKeyHex: c, keyId: l } = o[0], d = `${a.providerOrigin}/api/auth/challenge`, u = new AbortController(), p = setTimeout(() => u.abort(), 1e4);
893
893
  let f;
894
894
  try {
895
- e(), Date.now() >= ht(s.expiresAt) && _("TRANSACTION_EXPIRED");
895
+ e(), Date.now() >= pt(s.expiresAt) && _("TRANSACTION_EXPIRED");
896
896
  const y = await globalThis.fetch(d, {
897
897
  method: "POST",
898
898
  credentials: "omit",
@@ -932,23 +932,23 @@ async function jr({ assertCurrent: e, binding: t, capabilities: n, handle: i, id
932
932
  clearTimeout(p);
933
933
  }
934
934
  const A = f.challenge.replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
935
- e(), (Date.now() >= ht(s.expiresAt) || f.expires_at * 1e3 <= Date.now()) && _("TRANSACTION_EXPIRED");
935
+ e(), (Date.now() >= pt(s.expiresAt) || f.expires_at * 1e3 <= Date.now()) && _("TRANSACTION_EXPIRED");
936
936
  const b = await n.signSdnPublishRequest(i, {
937
937
  ...a,
938
938
  challengeId: f.challenge_id,
939
939
  challengeBase64url: A
940
940
  }, t.registryRow);
941
- e(), (Date.now() >= ht(s.expiresAt) || f.expires_at * 1e3 <= Date.now()) && _("TRANSACTION_EXPIRED");
941
+ e(), (Date.now() >= pt(s.expiresAt) || f.expires_at * 1e3 <= Date.now()) && _("TRANSACTION_EXPIRED");
942
942
  const h = Wt(b, ["schemaVersion", "keyId", "identityScheme", "algorithm", "encoding", "signatureProfile", "publicKeyHex", "signatureHex", "requestDigestSha256"], "INVALID_WALLET_RESULT");
943
- return (h.keyId !== l || h.publicKeyHex !== c) && _("INVALID_WALLET_RESULT"), ri({ ...h, challengeId: f.challenge_id, challengeBase64url: A });
943
+ return (h.keyId !== l || h.publicKeyHex !== c) && _("INVALID_WALLET_RESULT"), ii({ ...h, challengeId: f.challenge_id, challengeBase64url: A });
944
944
  }
945
- function Br({ binding: e, document: t, request: n }) {
945
+ function Vr({ binding: e, document: t, request: n }) {
946
946
  const i = t.activeElement ?? null, r = t.createElement("section");
947
- r.className = "wallet-confirmation", r.setAttribute?.("role", "dialog"), r.setAttribute?.("aria-modal", "true"), r.setAttribute?.("aria-labelledby", "wallet-confirmation-heading"), r.tabIndex = -1, Ur(r, { binding: e, document: t, request: n });
947
+ r.className = "wallet-confirmation", r.setAttribute?.("role", "dialog"), r.setAttribute?.("aria-modal", "true"), r.setAttribute?.("aria-labelledby", "wallet-confirmation-heading"), r.tabIndex = -1, jr(r, { binding: e, document: t, request: n });
948
948
  const s = t.createElement("div");
949
949
  s.className = "wallet-confirmation-actions";
950
950
  const a = t.createElement("button");
951
- a.type = "button", a.dataset.walletAction = "confirm", a.textContent = ai(e, n ?? {}).action;
951
+ a.type = "button", a.dataset.walletAction = "confirm", a.textContent = oi(e, n ?? {}).action;
952
952
  const o = t.createElement("button");
953
953
  o.type = "button", o.dataset.walletAction = "cancel", o.textContent = "Cancel", s.append(a, o), r.append(s), t.body.append(r);
954
954
  let c = !1, l, d;
@@ -994,7 +994,7 @@ function Br({ binding: e, document: t, request: n }) {
994
994
  }
995
995
  });
996
996
  }
997
- async function Vr({
997
+ async function Mr({
998
998
  assertCurrent: e = () => {
999
999
  },
1000
1000
  binding: t,
@@ -1003,8 +1003,8 @@ async function Vr({
1003
1003
  transaction: r,
1004
1004
  wasm: s
1005
1005
  }) {
1006
- const a = s?.sdn ?? s, o = oi[r.operation];
1007
- if ((!o || !a) && _("OPERATION_NOT_ALLOWED"), o.publish) return jr({ assertCurrent: e, binding: t, capabilities: a, handle: n, identity: i, transaction: r });
1006
+ const a = s?.sdn ?? s, o = si[r.operation];
1007
+ if ((!o || !a) && _("OPERATION_NOT_ALLOWED"), o.publish) return Br({ assertCurrent: e, binding: t, capabilities: a, handle: n, identity: i, transaction: r });
1008
1008
  if (o.connect)
1009
1009
  return o.buildResult({
1010
1010
  connectionExpiresAt: r.expiresAt,
@@ -1025,15 +1025,15 @@ async function Vr({
1025
1025
  _("INVALID_WALLET_RESULT");
1026
1026
  }
1027
1027
  }
1028
- function Mr() {
1029
- return ni({
1028
+ function $r() {
1029
+ return ti({
1030
1030
  connectionExpiresAt: null,
1031
1031
  event: "disconnected",
1032
1032
  identity: null,
1033
1033
  schemaVersion: 1
1034
1034
  });
1035
1035
  }
1036
- const Ln = "webauthn-prf-hkdf-sha256-aes256gcm-v2", $r = "sdn-bip32-slip10-purpose-v1", Fr = "password-scrypt-v2", Wr = Object.freeze([
1036
+ const Ln = "webauthn-prf-hkdf-sha256-aes256gcm-v2", Fr = "sdn-bip32-slip10-purpose-v1", Wr = "password-scrypt-v2", qr = Object.freeze([
1037
1037
  "aad",
1038
1038
  "canonicalUsername",
1039
1039
  "ciphertextBase64url",
@@ -1044,40 +1044,40 @@ const Ln = "webauthn-prf-hkdf-sha256-aes256gcm-v2", $r = "sdn-bip32-slip10-purpo
1044
1044
  "prfInputBase64url",
1045
1045
  "schemaVersion",
1046
1046
  "storageProfile"
1047
- ]), qr = Object.freeze([
1047
+ ]), zr = Object.freeze([
1048
1048
  "credentialIdBase64url",
1049
1049
  "identityScheme",
1050
1050
  "schemaVersion",
1051
1051
  "seedProfile",
1052
1052
  "storageProfile",
1053
1053
  "usernameSha256"
1054
- ]), zr = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, Hr = /^[0-9a-f]{64}$/u, Kr = /^[A-Za-z0-9_-]+$/u, Gr = new TextEncoder(), ue = "sdn.wallet.remembered.v2", Le = `${ue}.pending`, yt = 16 * 1024, ci = Object.freeze([
1054
+ ]), Hr = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, Kr = /^[0-9a-f]{64}$/u, Gr = /^[A-Za-z0-9_-]+$/u, Jr = new TextEncoder(), ue = "sdn.wallet.remembered.v2", Le = `${ue}.pending`, ht = 16 * 1024, ai = Object.freeze([
1055
1055
  "wallet_storage_metadata",
1056
1056
  "wallet_storage_encrypted",
1057
1057
  "wallet_storage_passkey_credential",
1058
1058
  "encrypted_wallet",
1059
1059
  "passkey_credential",
1060
1060
  "passkey_wallet"
1061
- ]), li = /* @__PURE__ */ new Set([
1061
+ ]), ci = /* @__PURE__ */ new Set([
1062
1062
  ue,
1063
1063
  Le,
1064
- ...ci
1064
+ ...ai
1065
1065
  ]), zt = /* @__PURE__ */ new WeakSet();
1066
- class at extends Error {
1066
+ class ot extends Error {
1067
1067
  constructor(t) {
1068
1068
  super(t), this.name = "WalletStorageError", this.code = t;
1069
1069
  }
1070
1070
  }
1071
1071
  function T(e) {
1072
- throw new at(e);
1072
+ throw new ot(e);
1073
1073
  }
1074
- function ui(e) {
1074
+ function li(e) {
1075
1075
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
1076
1076
  const t = Object.getPrototypeOf(e);
1077
1077
  return t === Object.prototype || t === null;
1078
1078
  }
1079
1079
  function Rn(e, t) {
1080
- ui(e) || T("INVALID_REMEMBERED_WALLET");
1080
+ li(e) || T("INVALID_REMEMBERED_WALLET");
1081
1081
  let n;
1082
1082
  try {
1083
1083
  n = Reflect.ownKeys(e);
@@ -1099,7 +1099,7 @@ function Rn(e, t) {
1099
1099
  }
1100
1100
  return s;
1101
1101
  }
1102
- function On(e) {
1102
+ function ui(e) {
1103
1103
  if (typeof e != "string") return !1;
1104
1104
  for (let t = 0; t < e.length; t += 1) {
1105
1105
  const n = e.charCodeAt(t);
@@ -1111,14 +1111,19 @@ function On(e) {
1111
1111
  }
1112
1112
  return !0;
1113
1113
  }
1114
- function Jr(e) {
1114
+ function di(e) {
1115
+ if (!ui(e)) return !1;
1116
+ const t = Jr.encode(e).length;
1117
+ return t >= 3 && t <= 64 && !/[\u0000-\u001f\u007f-\u009f]/u.test(e) && !/^ | $/u.test(e) && !/[A-Z]/u.test(e);
1118
+ }
1119
+ function Qr(e) {
1115
1120
  let t = "";
1116
1121
  for (let n = 0; n < e.length; n += 32768)
1117
1122
  t += String.fromCharCode(...e.subarray(n, n + 32768));
1118
1123
  return btoa(t).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
1119
1124
  }
1120
1125
  function ge(e, { minimum: t = 0, maximum: n = 65536, exact: i = null } = {}) {
1121
- (typeof e != "string" || e.length === 0 || !Kr.test(e)) && T("INVALID_REMEMBERED_WALLET");
1126
+ (typeof e != "string" || e.length === 0 || !Gr.test(e)) && T("INVALID_REMEMBERED_WALLET");
1122
1127
  const r = e.length % 4;
1123
1128
  r === 1 && T("INVALID_REMEMBERED_WALLET");
1124
1129
  const s = e.replace(/-/gu, "+").replace(/_/gu, "/") + "=".repeat((4 - r) % 4);
@@ -1130,12 +1135,12 @@ function ge(e, { minimum: t = 0, maximum: n = 65536, exact: i = null } = {}) {
1130
1135
  }
1131
1136
  const o = new Uint8Array(a.length);
1132
1137
  for (let c = 0; c < a.length; c += 1) o[c] = a.charCodeAt(c);
1133
- return (Jr(o) !== e || o.length < t || o.length > n || i !== null && o.length !== i) && T("INVALID_REMEMBERED_WALLET"), o;
1138
+ return (Qr(o) !== e || o.length < t || o.length > n || i !== null && o.length !== i) && T("INVALID_REMEMBERED_WALLET"), o;
1134
1139
  }
1135
1140
  function rn(e) {
1136
- return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : (ui(e) || T("INVALID_REMEMBERED_WALLET"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${rn(e[t])}`).join(",")}}`);
1141
+ return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : (li(e) || T("INVALID_REMEMBERED_WALLET"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${rn(e[t])}`).join(",")}}`);
1137
1142
  }
1138
- function Qr(e) {
1143
+ function Yr(e) {
1139
1144
  return Object.freeze({
1140
1145
  aad: Object.freeze({ ...e.aad }),
1141
1146
  canonicalUsername: e.canonicalUsername,
@@ -1149,12 +1154,12 @@ function Qr(e) {
1149
1154
  storageProfile: e.storageProfile
1150
1155
  });
1151
1156
  }
1152
- function di(e) {
1153
- const t = Rn(e, Wr), n = Rn(t.aad, qr), i = On(t.canonicalUsername) ? Gr.encode(t.canonicalUsername) : null;
1154
- return (t.schemaVersion !== 2 || t.storageProfile !== Ln || n.schemaVersion !== 2 || n.storageProfile !== Ln || n.identityScheme !== $r || n.seedProfile !== Fr || !i || i.length < 3 || i.length > 64 || !/^[a-z0-9][a-z0-9._-]*$/u.test(t.canonicalUsername) || !Hr.test(n.usernameSha256) || t.credentialIdBase64url !== n.credentialIdBase64url || !On(t.createdAt) || !zr.test(t.createdAt) || new Date(t.createdAt).toISOString() !== t.createdAt) && T("INVALID_REMEMBERED_WALLET"), ge(t.credentialIdBase64url, { minimum: 1, maximum: 1024 }), ge(t.ciphertextBase64url, { minimum: 17, maximum: 1024 }), ge(t.hkdfSaltBase64url, { exact: 32 }), ge(t.nonceBase64url, { exact: 12 }), ge(t.prfInputBase64url, { exact: 32 }), Qr({ ...t, aad: n });
1157
+ function fi(e) {
1158
+ const t = Rn(e, qr), n = Rn(t.aad, zr);
1159
+ return (t.schemaVersion !== 2 || t.storageProfile !== Ln || n.schemaVersion !== 2 || n.storageProfile !== Ln || n.identityScheme !== Fr || n.seedProfile !== Wr || !di(t.canonicalUsername) || !Kr.test(n.usernameSha256) || t.credentialIdBase64url !== n.credentialIdBase64url || !ui(t.createdAt) || !Hr.test(t.createdAt) || new Date(t.createdAt).toISOString() !== t.createdAt) && T("INVALID_REMEMBERED_WALLET"), ge(t.credentialIdBase64url, { minimum: 1, maximum: 1024 }), ge(t.ciphertextBase64url, { minimum: 17, maximum: 1024 }), ge(t.hkdfSaltBase64url, { exact: 32 }), ge(t.nonceBase64url, { exact: 12 }), ge(t.prfInputBase64url, { exact: 32 }), Yr({ ...t, aad: n });
1155
1160
  }
1156
- function Yr(e) {
1157
- return rn(di(e));
1161
+ function Xr(e) {
1162
+ return rn(fi(e));
1158
1163
  }
1159
1164
  function sn(e) {
1160
1165
  (typeof e != "string" || e.length === 0 || e.length > 131072) && T("INVALID_REMEMBERED_WALLET");
@@ -1164,7 +1169,7 @@ function sn(e) {
1164
1169
  } catch {
1165
1170
  T("INVALID_REMEMBERED_WALLET");
1166
1171
  }
1167
- const n = di(t);
1172
+ const n = fi(t);
1168
1173
  return rn(n) !== e && T("INVALID_REMEMBERED_WALLET"), n;
1169
1174
  }
1170
1175
  function Ht(e, t, { pending: n = !1 } = {}) {
@@ -1177,7 +1182,7 @@ function Ht(e, t, { pending: n = !1 } = {}) {
1177
1182
  }
1178
1183
  if (i === null) return Object.freeze({ raw: null, record: null, status: "empty" });
1179
1184
  typeof i != "string" && T("STORAGE_UNAVAILABLE");
1180
- const r = i.length > yt;
1185
+ const r = i.length > ht;
1181
1186
  if (n || r)
1182
1187
  return Object.freeze({
1183
1188
  exportable: !r,
@@ -1205,7 +1210,7 @@ function Ht(e, t, { pending: n = !1 } = {}) {
1205
1210
  });
1206
1211
  }
1207
1212
  }
1208
- function fi(e) {
1213
+ function pi(e) {
1209
1214
  const t = Ht(e, Le, { pending: !0 }), n = Ht(e, ue), i = t.status === "empty", r = n.status === "empty" || n.status === "valid";
1210
1215
  return Object.freeze({
1211
1216
  active: n,
@@ -1214,10 +1219,10 @@ function fi(e) {
1214
1219
  pending: t
1215
1220
  });
1216
1221
  }
1217
- function Xr(e, t) {
1218
- const n = fi(e);
1222
+ function Zr(e, t) {
1223
+ const n = pi(e);
1219
1224
  n.canSetup || T("STORAGE_QUARANTINED");
1220
- const i = Yr(t);
1225
+ const i = Xr(t);
1221
1226
  try {
1222
1227
  e.setItem(Le, i);
1223
1228
  } catch (a) {
@@ -1237,7 +1242,7 @@ function Xr(e, t) {
1237
1242
  });
1238
1243
  return zt.add(s), s;
1239
1244
  }
1240
- function Zr(e, t) {
1245
+ function es(e, t) {
1241
1246
  (!zt.has(t) || t.storage !== e) && T("INVALID_STORAGE_TRANSACTION"), zt.delete(t);
1242
1247
  let n, i;
1243
1248
  try {
@@ -1248,7 +1253,7 @@ function Zr(e, t) {
1248
1253
  (n !== t.serialized || i !== t.previousActiveRaw) && T("STORAGE_COLLISION"), e.removeItem(Le), e.getItem(Le) !== null && T("STORAGE_WRITE_FAILED"), e.setItem(ue, t.serialized);
1249
1254
  }
1250
1255
  function on(e, t) {
1251
- li.has(t) || T("INVALID_STORAGE_KEY"), (!e || typeof e.getItem != "function") && T("STORAGE_UNAVAILABLE");
1256
+ ci.has(t) || T("INVALID_STORAGE_KEY"), (!e || typeof e.getItem != "function") && T("STORAGE_UNAVAILABLE");
1252
1257
  let n;
1253
1258
  try {
1254
1259
  n = e.getItem(t);
@@ -1256,21 +1261,21 @@ function on(e, t) {
1256
1261
  T("STORAGE_UNAVAILABLE");
1257
1262
  }
1258
1263
  if (n === null) return null;
1259
- if (typeof n != "string" && T("STORAGE_UNAVAILABLE"), t === ue && n.length <= yt)
1264
+ if (typeof n != "string" && T("STORAGE_UNAVAILABLE"), t === ue && n.length <= ht)
1260
1265
  try {
1261
1266
  sn(n), T("NOT_QUARANTINED");
1262
1267
  } catch (i) {
1263
- if (i instanceof at && i.code === "NOT_QUARANTINED") throw i;
1268
+ if (i instanceof ot && i.code === "NOT_QUARANTINED") throw i;
1264
1269
  }
1265
1270
  return Object.freeze({
1266
- exportable: n.length <= yt,
1271
+ exportable: n.length <= ht,
1267
1272
  key: t,
1268
- oversized: n.length > yt,
1273
+ oversized: n.length > ht,
1269
1274
  raw: n,
1270
1275
  rawLength: n.length
1271
1276
  });
1272
1277
  }
1273
- function es(e) {
1278
+ function ts(e) {
1274
1279
  return Object.freeze({
1275
1280
  exportable: e.exportable,
1276
1281
  key: e.key,
@@ -1278,52 +1283,52 @@ function es(e) {
1278
1283
  rawLength: e.rawLength
1279
1284
  });
1280
1285
  }
1281
- function ts(e) {
1286
+ function ns(e) {
1282
1287
  const t = [];
1283
1288
  for (const n of [
1284
1289
  ue,
1285
1290
  Le,
1286
- ...ci
1291
+ ...ai
1287
1292
  ]) {
1288
1293
  let i;
1289
1294
  try {
1290
1295
  i = on(e, n);
1291
1296
  } catch (r) {
1292
- if (r instanceof at && r.code === "NOT_QUARANTINED") continue;
1297
+ if (r instanceof ot && r.code === "NOT_QUARANTINED") continue;
1293
1298
  throw r;
1294
1299
  }
1295
- i && t.push(es(i));
1300
+ i && t.push(ts(i));
1296
1301
  }
1297
1302
  return Object.freeze(t);
1298
1303
  }
1299
- function ns(e, t) {
1304
+ function is(e, t) {
1300
1305
  const n = on(e, t);
1301
1306
  return n || T("QUARANTINE_NOT_FOUND"), n.exportable || T("QUARANTINE_EXPORT_TOO_LARGE"), n.raw;
1302
1307
  }
1303
- function is(e, t, n) {
1304
- li.has(t) || T("INVALID_STORAGE_KEY"), n !== t && T("CONFIRMATION_REQUIRED"), on(e, t) || T("QUARANTINE_NOT_FOUND");
1308
+ function rs(e, t, n) {
1309
+ ci.has(t) || T("INVALID_STORAGE_KEY"), n !== t && T("CONFIRMATION_REQUIRED"), on(e, t) || T("QUARANTINE_NOT_FOUND");
1305
1310
  try {
1306
1311
  e.removeItem(t), e.getItem(t) !== null && T("STORAGE_WRITE_FAILED");
1307
1312
  } catch (r) {
1308
- if (r instanceof at) throw r;
1313
+ if (r instanceof ot) throw r;
1309
1314
  T("STORAGE_UNAVAILABLE");
1310
1315
  }
1311
1316
  }
1312
- function rs(e, t) {
1317
+ function ss(e, t) {
1313
1318
  t !== ue && T("CONFIRMATION_REQUIRED");
1314
1319
  const n = Ht(e, ue);
1315
1320
  n.status === "empty" && T("REMEMBER_UNAVAILABLE"), n.status !== "valid" && T("STORAGE_QUARANTINED");
1316
1321
  try {
1317
1322
  e.removeItem(ue), e.getItem(ue) !== null && T("STORAGE_WRITE_FAILED");
1318
1323
  } catch (i) {
1319
- if (i instanceof at) throw i;
1324
+ if (i instanceof ot) throw i;
1320
1325
  T("STORAGE_UNAVAILABLE");
1321
1326
  }
1322
1327
  }
1323
- const Et = "sdn-bip32-slip10-purpose-v1", wt = "password-scrypt-v2", Kt = "m/44'/0'/0'/2'/0'", an = "Approval unavailable — migrate to the new wallet profile", Nn = Object.freeze({
1328
+ const Et = "sdn-bip32-slip10-purpose-v1", wt = "password-scrypt-v2", Kt = "m/44'/0'/0'/2'/0'", an = "Approval unavailable — migrate to the new wallet profile", On = Object.freeze({
1324
1329
  "bip39-mnemonic-v1-legacy": "sdn-bip39-auth-v1-legacy",
1325
1330
  "password-fast-v1-legacy": "sdn-fast-password-auth-v1-legacy"
1326
- }), Tn = new TextEncoder(), ss = Uint8Array.prototype.fill, cn = Object.freeze([
1331
+ }), Nn = new TextEncoder(), os = Uint8Array.prototype.fill, cn = Object.freeze([
1327
1332
  "accountFingerprint",
1328
1333
  "accountIndex",
1329
1334
  "accountLabel",
@@ -1365,18 +1370,18 @@ const Et = "sdn-bip32-slip10-purpose-v1", wt = "password-scrypt-v2", Kt = "m/44'
1365
1370
  signatureProfile: "ed25519-over-sha256-jcs-v1"
1366
1371
  })
1367
1372
  ]);
1368
- class pi extends Error {
1373
+ class hi extends Error {
1369
1374
  constructor(t) {
1370
1375
  super(t === "APPROVAL_UNAVAILABLE" ? an : t), this.name = "WalletAccountError", this.code = t;
1371
1376
  }
1372
1377
  }
1373
1378
  function M(e) {
1374
- throw new pi(e);
1379
+ throw new hi(e);
1375
1380
  }
1376
- function Cn(e) {
1381
+ function Tn(e) {
1377
1382
  if (e instanceof Uint8Array)
1378
1383
  try {
1379
- ss.call(e, 0);
1384
+ os.call(e, 0);
1380
1385
  } catch {
1381
1386
  }
1382
1387
  }
@@ -1387,13 +1392,13 @@ function Pe(e) {
1387
1392
  for (const n of Object.keys(e).sort()) t[n] = Pe(e[n]);
1388
1393
  return Object.freeze(t);
1389
1394
  }
1390
- function os(e) {
1395
+ function as(e) {
1391
1396
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
1392
1397
  const t = Object.getPrototypeOf(e);
1393
1398
  return t === Object.prototype || t === null;
1394
1399
  }
1395
1400
  function vt(e, t) {
1396
- os(e) || M("INVALID_PUBLIC_IDENTITY");
1401
+ as(e) || M("INVALID_PUBLIC_IDENTITY");
1397
1402
  let n;
1398
1403
  try {
1399
1404
  n = Reflect.ownKeys(e);
@@ -1426,7 +1431,7 @@ function Me(e) {
1426
1431
  }
1427
1432
  return !0;
1428
1433
  }
1429
- function as(e) {
1434
+ function cs(e) {
1430
1435
  if (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length !== It.length) return !1;
1431
1436
  let t;
1432
1437
  try {
@@ -1442,7 +1447,7 @@ function as(e) {
1442
1447
  }
1443
1448
  return !0;
1444
1449
  }
1445
- function cs(e) {
1450
+ function ls(e) {
1446
1451
  if (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length !== 1) return !1;
1447
1452
  let t;
1448
1453
  try {
@@ -1456,22 +1461,22 @@ function cs(e) {
1456
1461
  }
1457
1462
  function ye(e) {
1458
1463
  const t = vt(e, cn);
1459
- (t.schemaVersion !== 1 || t.identityScheme !== Et || t.seedProfile !== wt || t.accountIndex !== 0 || t.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(t.accountFingerprint) || !Me(t.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(t.accountXpub) || !Me(t.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(t.accountPeerId) || !as(t.keys)) && M("INVALID_PUBLIC_IDENTITY");
1464
+ (t.schemaVersion !== 1 || t.identityScheme !== Et || t.seedProfile !== wt || t.accountIndex !== 0 || t.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(t.accountFingerprint) || !Me(t.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(t.accountXpub) || !Me(t.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(t.accountPeerId) || !cs(t.keys)) && M("INVALID_PUBLIC_IDENTITY");
1460
1465
  const n = It.map((i, r) => {
1461
1466
  const s = vt(t.keys[r], ln);
1462
1467
  return (s.bip32Fingerprint !== null || s.curve !== i.curve || s.derivation !== "slip10" || s.encoding !== "raw" || s.identityScheme !== Et || s.path !== i.path || s.purpose !== i.purpose || s.seedProfile !== wt || s.signatureProfile !== i.signatureProfile || !/^[0-9a-f]{64}$/u.test(s.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(s.keyId)) && M("INVALID_PUBLIC_IDENTITY"), Pe(s);
1463
1468
  });
1464
1469
  return Pe({ ...t, keys: n });
1465
1470
  }
1466
- function ls(e, { accountIndex: t = 0, profile: n } = {}) {
1467
- const i = Object.hasOwn(Nn, n) ? Nn[n] : null;
1471
+ function us(e, { accountIndex: t = 0, profile: n } = {}) {
1472
+ const i = Object.hasOwn(On, n) ? On[n] : null;
1468
1473
  (!i || t !== 0) && M("INVALID_LEGACY_PROFILE");
1469
1474
  const r = vt(e, cn);
1470
- (r.schemaVersion !== 1 || r.identityScheme !== i || r.seedProfile !== n || r.accountIndex !== t || r.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(r.accountFingerprint) || !Me(r.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(r.accountXpub) || !Me(r.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(r.accountPeerId) || !cs(r.keys)) && M("INVALID_PUBLIC_IDENTITY");
1475
+ (r.schemaVersion !== 1 || r.identityScheme !== i || r.seedProfile !== n || r.accountIndex !== t || r.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(r.accountFingerprint) || !Me(r.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(r.accountXpub) || !Me(r.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(r.accountPeerId) || !ls(r.keys)) && M("INVALID_PUBLIC_IDENTITY");
1471
1476
  const s = vt(r.keys[0], ln);
1472
1477
  return (s.bip32Fingerprint !== null || s.curve !== "ed25519" || s.derivation !== "bip32-scalar-as-ed25519-seed" || s.encoding !== "raw" || s.identityScheme !== i || s.path !== `m/44'/0'/${t}'/0/0` || s.purpose !== "sdn-authentication" || s.seedProfile !== n || s.signatureProfile !== "ed25519-raw-32-v1" || !/^[0-9a-f]{64}$/u.test(s.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(s.keyId)) && M("INVALID_PUBLIC_IDENTITY"), Pe({ ...r, keys: [s] });
1473
1478
  }
1474
- function _n(e) {
1479
+ function Cn(e) {
1475
1480
  if (!(!e || typeof e != "object")) {
1476
1481
  try {
1477
1482
  e.value = "";
@@ -1507,7 +1512,7 @@ function _n(e) {
1507
1512
  }
1508
1513
  }
1509
1514
  }
1510
- function xn(e, t) {
1515
+ function _n(e, t) {
1511
1516
  if (typeof e != "string" || typeof t != "string") return !1;
1512
1517
  const n = Math.max(e.length, t.length);
1513
1518
  let i = e.length ^ t.length;
@@ -1517,7 +1522,7 @@ function xn(e, t) {
1517
1522
  }
1518
1523
  return i === 0;
1519
1524
  }
1520
- function us(e) {
1525
+ function ds(e) {
1521
1526
  return !e || typeof e != "object" || !Array.isArray(e.keys) ? null : e.keys.find((t) => t?.purpose === "asset-review-approval") ?? null;
1522
1527
  }
1523
1528
  function Ut(e, t) {
@@ -1533,7 +1538,7 @@ function Ut(e, t) {
1533
1538
  const r = e.keys[i], s = t.keys[i];
1534
1539
  for (const a of ln.filter((o) => o !== "publicKeyHex" && o !== "keyId"))
1535
1540
  n = r[a] === s[a] && n;
1536
- n = xn(r.publicKeyHex, s.publicKeyHex) && n, n = xn(r.keyId.slice(7), s.keyId.slice(7)) && n;
1541
+ n = _n(r.publicKeyHex, s.publicKeyHex) && n, n = _n(r.keyId.slice(7), s.keyId.slice(7)) && n;
1537
1542
  }
1538
1543
  return n;
1539
1544
  }
@@ -1545,9 +1550,9 @@ function Be(e, t, n, i) {
1545
1550
  const a = e.createElement("span");
1546
1551
  a.textContent = i == null ? "" : String(i), r.append(s, a), t.append(r);
1547
1552
  }
1548
- function hi(e) {
1553
+ function yi(e) {
1549
1554
  (e?.identityScheme !== Et || e?.seedProfile !== wt || e?.accountIndex !== 0) && M("APPROVAL_UNAVAILABLE");
1550
- const t = us(e);
1555
+ const t = ds(e);
1551
1556
  return (!t || t.identityScheme !== e.identityScheme || t.seedProfile !== e.seedProfile || t.signatureProfile !== "ed25519-over-sha256-jcs-v1" || t.curve !== "ed25519" || t.derivation !== "slip10" || t.path !== Kt || t.encoding !== "raw" || !/^[0-9a-f]{64}$/u.test(t.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(t.keyId)) && M("APPROVAL_UNAVAILABLE"), Pe({
1552
1557
  algorithm: "Ed25519",
1553
1558
  derivationPath: Kt,
@@ -1561,20 +1566,20 @@ function hi(e) {
1561
1566
  signatureProfile: "ed25519-over-sha256-jcs-v1"
1562
1567
  });
1563
1568
  }
1564
- function ds(e) {
1569
+ function fs(e) {
1565
1570
  return JSON.stringify(e, null, 2);
1566
1571
  }
1567
- function fs(e, t, { document: n = e.ownerDocument } = {}) {
1572
+ function ps(e, t, { document: n = e.ownerDocument } = {}) {
1568
1573
  e.replaceChildren();
1569
1574
  const i = n.createElement("h1");
1570
1575
  if (i.textContent = "Account", e.append(i), Be(n, e, "Username / account", t?.accountLabel ?? "account 0"), Be(n, e, "Account xpub", t?.accountXpub), Be(n, e, "Peer ID", t?.accountPeerId), Be(n, e, "Fingerprint", t?.accountFingerprint), t?.identityScheme !== Et || t?.seedProfile !== wt) {
1571
1576
  const s = n.createElement("p");
1572
1577
  return s.textContent = an, e.append(s), Object.freeze({ approvalAvailable: !1 });
1573
1578
  }
1574
- const r = hi(t);
1579
+ const r = yi(t);
1575
1580
  return Be(n, e, "Asset approval public key", r.publicKeyHex), Be(n, e, "Asset approval key ID", r.keyId), Object.freeze({ approvalAvailable: !0, configuration: r });
1576
1581
  }
1577
- function ps(e, { document: t = e.ownerDocument } = {}) {
1582
+ function hs(e, { document: t = e.ownerDocument } = {}) {
1578
1583
  e.replaceChildren();
1579
1584
  const n = t.createElement("h2");
1580
1585
  n.textContent = "Stored wallet";
@@ -1603,7 +1608,7 @@ function ps(e, { document: t = e.ownerDocument } = {}) {
1603
1608
  status: d
1604
1609
  });
1605
1610
  }
1606
- function hs(e, t, { document: n = e.ownerDocument } = {}) {
1611
+ function ys(e, t, { document: n = e.ownerDocument } = {}) {
1607
1612
  e.replaceChildren();
1608
1613
  const i = n.createElement("h2");
1609
1614
  i.textContent = "Quarantined wallet storage";
@@ -1644,14 +1649,14 @@ function hs(e, t, { document: n = e.ownerDocument } = {}) {
1644
1649
  }
1645
1650
  return e.append(i, r, s, a), Object.freeze({ rows: Object.freeze(o), status: a });
1646
1651
  }
1647
- async function ys(e, {
1652
+ async function ms(e, {
1648
1653
  assertCurrent: t = () => {
1649
1654
  },
1650
1655
  clipboard: n = globalThis.navigator?.clipboard,
1651
1656
  container: i,
1652
1657
  document: r = i?.ownerDocument
1653
1658
  }) {
1654
- const s = ds(e);
1659
+ const s = fs(e);
1655
1660
  let a = !1;
1656
1661
  try {
1657
1662
  if (!n?.writeText) throw new Error("clipboard unavailable");
@@ -1668,7 +1673,7 @@ async function ys(e, {
1668
1673
  }
1669
1674
  return a;
1670
1675
  }
1671
- async function Dn(e, t, n, {
1676
+ async function xn(e, t, n, {
1672
1677
  assertCurrent: i,
1673
1678
  ownBuffer: r,
1674
1679
  ownHandle: s,
@@ -1679,9 +1684,9 @@ async function Dn(e, t, n, {
1679
1684
  try {
1680
1685
  i();
1681
1686
  const f = c?.value, A = l?.value;
1682
- (typeof f != "string" || typeof A != "string") && M("CREDENTIAL_CONFIRMATION_MISMATCH"), (!Me(f) || !Me(A)) && M("CREDENTIAL_CONFIRMATION_MISMATCH"), d = Tn.encode(f), r(d), u = Tn.encode(A), r(u);
1687
+ (typeof f != "string" || typeof A != "string") && M("CREDENTIAL_CONFIRMATION_MISMATCH"), (!Me(f) || !Me(A)) && M("CREDENTIAL_CONFIRMATION_MISMATCH"), d = Nn.encode(f), r(d), u = Nn.encode(A), r(u);
1683
1688
  } finally {
1684
- _n(c), _n(l);
1689
+ Cn(c), Cn(l);
1685
1690
  const f = c?.form, A = l?.form;
1686
1691
  try {
1687
1692
  (f?.parentNode ?? f)?.remove?.();
@@ -1711,7 +1716,7 @@ async function Dn(e, t, n, {
1711
1716
  a(d), a(u);
1712
1717
  }
1713
1718
  }
1714
- class ms {
1719
+ class gs {
1715
1720
  #d = null;
1716
1721
  #p;
1717
1722
  #y = !1;
@@ -1752,12 +1757,12 @@ class ms {
1752
1757
  ownBuffer: (a) => this.#r.add(a),
1753
1758
  ownHandle: (a) => this.#n.add(a),
1754
1759
  releaseBuffer: (a) => {
1755
- Cn(a), this.#r.delete(a);
1760
+ Tn(a), this.#r.delete(a);
1756
1761
  }
1757
1762
  };
1758
- return n = await Dn(this.#t, this.#p, 1, s), this.#S(n.handle) || M("CREDENTIAL_CONFIRMATION_MISMATCH"), n.handle = null, this.#h(t), i = await Dn(this.#t, this.#p, 2, s), this.#S(i.handle) || M("CREDENTIAL_CONFIRMATION_MISMATCH"), i.handle = null, this.#h(t), (!Ut(n.identity, i.identity) || this.#f !== null && (!Ut(n.identity, this.#f) || !Ut(i.identity, this.#f))) && M("CREDENTIAL_CONFIRMATION_MISMATCH"), this.#n.size !== 0 && M("CREDENTIAL_CONFIRMATION_MISMATCH"), this.#d = hi(i.identity), this.#d;
1763
+ return n = await xn(this.#t, this.#p, 1, s), this.#S(n.handle) || M("CREDENTIAL_CONFIRMATION_MISMATCH"), n.handle = null, this.#h(t), i = await xn(this.#t, this.#p, 2, s), this.#S(i.handle) || M("CREDENTIAL_CONFIRMATION_MISMATCH"), i.handle = null, this.#h(t), (!Ut(n.identity, i.identity) || this.#f !== null && (!Ut(n.identity, this.#f) || !Ut(i.identity, this.#f))) && M("CREDENTIAL_CONFIRMATION_MISMATCH"), this.#n.size !== 0 && M("CREDENTIAL_CONFIRMATION_MISMATCH"), this.#d = yi(i.identity), this.#d;
1759
1764
  } catch (r) {
1760
- if (this.#d = null, r instanceof pi && r.code === "CREDENTIAL_CONFIRMATION_MISMATCH") throw r;
1765
+ if (this.#d = null, r instanceof hi && r.code === "CREDENTIAL_CONFIRMATION_MISMATCH") throw r;
1761
1766
  M("CREDENTIAL_CONFIRMATION_MISMATCH");
1762
1767
  } finally {
1763
1768
  this.#o(), this.#L(), this.#e -= 1;
@@ -1784,10 +1789,10 @@ class ms {
1784
1789
  #o() {
1785
1790
  const t = [...this.#r];
1786
1791
  this.#r.clear();
1787
- for (const n of t) Cn(n);
1792
+ for (const n of t) Tn(n);
1788
1793
  }
1789
1794
  }
1790
- async function gs({
1795
+ async function As({
1791
1796
  wasm: e,
1792
1797
  profile: t,
1793
1798
  operation: n,
@@ -1807,7 +1812,7 @@ async function gs({
1807
1812
  legacy: !0
1808
1813
  });
1809
1814
  }
1810
- function As(e, { document: t = e.ownerDocument } = {}) {
1815
+ function bs(e, { document: t = e.ownerDocument } = {}) {
1811
1816
  e.replaceChildren();
1812
1817
  const n = t.createElement("h2");
1813
1818
  n.textContent = "Migrate legacy wallet";
@@ -1827,37 +1832,37 @@ function As(e, { document: t = e.ownerDocument } = {}) {
1827
1832
  const a = t.createElement("div");
1828
1833
  return a.className = "wallet-legacy-comparison", e.append(n, i, r, s, a), Object.freeze({ launch: s, result: a, select: r });
1829
1834
  }
1830
- const St = Uint8Array, yi = ArrayBuffer, un = Object.getPrototypeOf(St.prototype), bs = Object.getOwnPropertyDescriptor(un, "buffer").get, Es = Object.getOwnPropertyDescriptor(un, "byteLength").get, ws = Object.getOwnPropertyDescriptor(un, "byteOffset").get, Is = Object.getOwnPropertyDescriptor(yi.prototype, "byteLength").get;
1831
- class vs extends Error {
1835
+ const St = Uint8Array, mi = ArrayBuffer, un = Object.getPrototypeOf(St.prototype), Es = Object.getOwnPropertyDescriptor(un, "buffer").get, ws = Object.getOwnPropertyDescriptor(un, "byteLength").get, Is = Object.getOwnPropertyDescriptor(un, "byteOffset").get, vs = Object.getOwnPropertyDescriptor(mi.prototype, "byteLength").get;
1836
+ class Ss extends Error {
1832
1837
  constructor(t = "RNG_FAILURE") {
1833
1838
  super(t), this.name = "WalletRandomError", this.code = t;
1834
1839
  }
1835
1840
  }
1836
1841
  function Se() {
1837
- throw new vs();
1842
+ throw new Ss();
1838
1843
  }
1839
- function Ss(e) {
1844
+ function Ls(e) {
1840
1845
  if (!(e instanceof St) || Object.getPrototypeOf(e) !== St.prototype) return null;
1841
1846
  let t, n, i;
1842
1847
  try {
1843
- t = Reflect.apply(bs, e, []), n = Reflect.apply(Es, e, []), i = Reflect.apply(ws, e, []);
1848
+ t = Reflect.apply(Es, e, []), n = Reflect.apply(ws, e, []), i = Reflect.apply(Is, e, []);
1844
1849
  } catch {
1845
1850
  return null;
1846
1851
  }
1847
1852
  let r;
1848
1853
  try {
1849
- r = Reflect.apply(Is, t, []);
1854
+ r = Reflect.apply(vs, t, []);
1850
1855
  } catch {
1851
1856
  return null;
1852
1857
  }
1853
- return Object.getPrototypeOf(t) !== yi.prototype || i !== 0 || n !== r || n !== 12 && n !== 32 ? null : t;
1858
+ return Object.getPrototypeOf(t) !== mi.prototype || i !== 0 || n !== r || n !== 12 && n !== 32 ? null : t;
1854
1859
  }
1855
- function Ls({ getRandomValues: e, observedWrite: t } = {}) {
1860
+ function Rs({ getRandomValues: e, observedWrite: t } = {}) {
1856
1861
  if (typeof e != "function")
1857
1862
  return () => Se();
1858
1863
  const n = /* @__PURE__ */ new WeakSet(), i = /* @__PURE__ */ new WeakSet();
1859
1864
  return function(s) {
1860
- const a = Ss(s);
1865
+ const a = Ls(s);
1861
1866
  (!a || n.has(s) || i.has(a)) && Se(), n.add(s), i.add(a);
1862
1867
  let o;
1863
1868
  try {
@@ -1883,32 +1888,32 @@ function Ve(e, t) {
1883
1888
  const n = new St(t);
1884
1889
  return e(n);
1885
1890
  }
1886
- const tt = new TextEncoder(), Rs = new TextDecoder("utf-8", { fatal: !0 }), Os = Uint8Array.prototype.fill, Ns = Uint8Array.prototype.slice, Ts = Uint8Array.prototype.subarray, dn = Object.getPrototypeOf(Uint8Array.prototype), Cs = Object.getOwnPropertyDescriptor(dn, "buffer").get, mi = Object.getOwnPropertyDescriptor(dn, "byteLength").get, _s = Object.getOwnPropertyDescriptor(dn, "byteOffset").get, gi = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, xs = ArrayBuffer.prototype.slice, Pn = "webauthn-prf-hkdf-sha256-aes256gcm-v2", Ds = "sdn-bip32-slip10-purpose-v1", Ps = "password-scrypt-v2", ks = "Space Data Network Wallet", Ai = 12e4;
1887
- class Us extends Error {
1891
+ const yt = new TextEncoder(), Os = new TextDecoder("utf-8", { fatal: !0 }), Ns = Uint8Array.prototype.fill, Ts = Uint8Array.prototype.slice, Cs = Uint8Array.prototype.subarray, dn = Object.getPrototypeOf(Uint8Array.prototype), _s = Object.getOwnPropertyDescriptor(dn, "buffer").get, gi = Object.getOwnPropertyDescriptor(dn, "byteLength").get, xs = Object.getOwnPropertyDescriptor(dn, "byteOffset").get, Ai = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, Ds = ArrayBuffer.prototype.slice, Dn = "webauthn-prf-hkdf-sha256-aes256gcm-v2", Ps = "sdn-bip32-slip10-purpose-v1", ks = "password-scrypt-v2", Us = "Space Data Network Wallet", bi = 12e4;
1892
+ class js extends Error {
1888
1893
  constructor(t) {
1889
1894
  super(t), this.name = "RememberedWalletError", this.code = t;
1890
1895
  }
1891
1896
  }
1892
1897
  function C(e) {
1893
- throw new Us(e);
1898
+ throw new js(e);
1894
1899
  }
1895
- function kn(e) {
1900
+ function Pn(e) {
1896
1901
  if (typeof e != "string") return "";
1897
1902
  const t = e.trim().toLowerCase();
1898
1903
  return t.endsWith(".") ? t.slice(0, -1) : t;
1899
1904
  }
1900
- function js(e, t) {
1905
+ function Bs(e, t) {
1901
1906
  if (e == null || e === "") return;
1902
- const n = kn(e);
1907
+ const n = Pn(e);
1903
1908
  n === "" && C("INVALID_RP_ID");
1904
- const i = kn(t);
1909
+ const i = Pn(t);
1905
1910
  if (i === "" || n === i || i.endsWith(`.${n}`)) return n;
1906
1911
  C("INVALID_RP_ID");
1907
1912
  }
1908
1913
  function P(e) {
1909
1914
  if (e instanceof Uint8Array)
1910
1915
  try {
1911
- Os.call(e, 0);
1916
+ Ns.call(e, 0);
1912
1917
  } catch {
1913
1918
  }
1914
1919
  }
@@ -1917,7 +1922,7 @@ function Lt(e) {
1917
1922
  const t = Object.getPrototypeOf(e);
1918
1923
  return t === Object.prototype || t === null;
1919
1924
  }
1920
- function bi(e, t) {
1925
+ function Ei(e, t) {
1921
1926
  if (!Lt(e)) return !1;
1922
1927
  let n;
1923
1928
  try {
@@ -1929,8 +1934,8 @@ function bi(e, t) {
1929
1934
  const i = [...n].sort(), r = [...t].sort();
1930
1935
  return i.length === r.length && i.every((s, a) => s === r[a]);
1931
1936
  }
1932
- function nt(e, t) {
1933
- if (!bi(e, t)) return null;
1937
+ function tt(e, t) {
1938
+ if (!Ei(e, t)) return null;
1934
1939
  const n = {};
1935
1940
  for (const i of t) {
1936
1941
  let r;
@@ -1950,18 +1955,18 @@ function mt(e, t = null) {
1950
1955
  return !1;
1951
1956
  let n, i, r, s;
1952
1957
  try {
1953
- n = Reflect.apply(Cs, e, []), i = Reflect.apply(mi, e, []), r = Reflect.apply(_s, e, []), s = Reflect.apply(gi, n, []);
1958
+ n = Reflect.apply(_s, e, []), i = Reflect.apply(gi, e, []), r = Reflect.apply(xs, e, []), s = Reflect.apply(Ai, n, []);
1954
1959
  } catch {
1955
1960
  return !1;
1956
1961
  }
1957
1962
  return Object.getPrototypeOf(n) === ArrayBuffer.prototype && r === 0 && i === s && (t === null || i === t);
1958
1963
  }
1959
- function Ei(e, t, n) {
1964
+ function wi(e, t, n) {
1960
1965
  if (!(e instanceof ArrayBuffer) || Object.getPrototypeOf(e) !== ArrayBuffer.prototype)
1961
1966
  return !1;
1962
1967
  let i;
1963
1968
  try {
1964
- i = Reflect.apply(gi, e, []);
1969
+ i = Reflect.apply(Ai, e, []);
1965
1970
  } catch {
1966
1971
  return !1;
1967
1972
  }
@@ -1969,7 +1974,7 @@ function Ei(e, t, n) {
1969
1974
  }
1970
1975
  function xe(e) {
1971
1976
  try {
1972
- return Reflect.apply(mi, e, []);
1977
+ return Reflect.apply(gi, e, []);
1973
1978
  } catch {
1974
1979
  return -1;
1975
1980
  }
@@ -1980,13 +1985,13 @@ function Je(e) {
1980
1985
  n < 0 && C("INVALID_REMEMBERED_WALLET");
1981
1986
  for (let i = 0; i < n; i += 32768)
1982
1987
  t += String.fromCharCode(...Reflect.apply(
1983
- Ts,
1988
+ Cs,
1984
1989
  e,
1985
1990
  [i, i + 32768]
1986
1991
  ));
1987
1992
  return btoa(t).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
1988
1993
  }
1989
- function Bs(e) {
1994
+ function Vs(e) {
1990
1995
  let t = "";
1991
1996
  for (const n of e) t += n.toString(16).padStart(2, "0");
1992
1997
  return t;
@@ -1994,7 +1999,7 @@ function Bs(e) {
1994
1999
  function $e(e) {
1995
2000
  return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : Array.isArray(e) ? `[${e.map($e).join(",")}]` : (Lt(e) || C("INVALID_REMEMBERED_WALLET"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${$e(e[t])}`).join(",")}}`);
1996
2001
  }
1997
- function Vs(e, t) {
2002
+ function Ms(e, t) {
1998
2003
  if (!(e instanceof Uint8Array) || !(t instanceof Uint8Array)) return !1;
1999
2004
  const n = xe(e), i = xe(t);
2000
2005
  if (n < 0 || i < 0) return !1;
@@ -2004,10 +2009,10 @@ function Vs(e, t) {
2004
2009
  s |= (e[a] ?? 0) ^ (t[a] ?? 0);
2005
2010
  return s === 0;
2006
2011
  }
2007
- function Ms(e, t) {
2012
+ function $s(e, t) {
2008
2013
  return $e(e) === $e(t);
2009
2014
  }
2010
- function wi(e) {
2015
+ function Ii(e) {
2011
2016
  (!e || typeof e != "object" && typeof e != "function") && C("WEBAUTHN_INVALID_RESPONSE");
2012
2017
  let t, n, i;
2013
2018
  try {
@@ -2015,8 +2020,8 @@ function wi(e) {
2015
2020
  } catch {
2016
2021
  C("WEBAUTHN_INVALID_RESPONSE");
2017
2022
  }
2018
- return (t !== "public-key" || !Ei(n, 1, 1024) || typeof i != "function") && C("WEBAUTHN_INVALID_RESPONSE"), Object.freeze({
2019
- rawId: new Uint8Array(Reflect.apply(xs, n, [0])),
2023
+ return (t !== "public-key" || !wi(n, 1, 1024) || typeof i != "function") && C("WEBAUTHN_INVALID_RESPONSE"), Object.freeze({
2024
+ rawId: new Uint8Array(Reflect.apply(Ds, n, [0])),
2020
2025
  readExtensionResults() {
2021
2026
  try {
2022
2027
  return Reflect.apply(i, e, []);
@@ -2026,19 +2031,19 @@ function wi(e) {
2026
2031
  }
2027
2032
  });
2028
2033
  }
2029
- function $s(e) {
2030
- const t = nt(e.readExtensionResults(), ["prf"]), n = t ? nt(t.prf, ["enabled"]) : null;
2034
+ function Fs(e) {
2035
+ const t = tt(e.readExtensionResults(), ["prf"]), n = t ? tt(t.prf, ["enabled"]) : null;
2031
2036
  (!n || n.enabled !== !0) && C("WEBAUTHN_PRF_REQUIRED");
2032
2037
  }
2033
- function Fs(e, t) {
2034
- const n = wi(e), i = n.rawId;
2035
- Vs(i, t) || (P(i), C("WEBAUTHN_CREDENTIAL_MISMATCH")), P(i);
2036
- const r = nt(n.readExtensionResults(), ["prf"]), s = r ? nt(r.prf, ["results"]) : null, o = (s ? nt(s.results, ["first"]) : null)?.first;
2037
- Ei(o, 32, 32) || C("WEBAUTHN_PRF_REQUIRED");
2038
- const c = new Uint8Array(o), l = Reflect.apply(Ns, c, []);
2038
+ function Ws(e, t) {
2039
+ const n = Ii(e), i = n.rawId;
2040
+ Ms(i, t) || (P(i), C("WEBAUTHN_CREDENTIAL_MISMATCH")), P(i);
2041
+ const r = tt(n.readExtensionResults(), ["prf"]), s = r ? tt(r.prf, ["results"]) : null, o = (s ? tt(s.results, ["first"]) : null)?.first;
2042
+ wi(o, 32, 32) || C("WEBAUTHN_PRF_REQUIRED");
2043
+ const c = new Uint8Array(o), l = Reflect.apply(Ts, c, []);
2039
2044
  return P(c), l;
2040
2045
  }
2041
- function Ws({ challenge: e, credentialId: t, prfInput: n, rpId: i, signal: r }) {
2046
+ function qs({ challenge: e, credentialId: t, prfInput: n, rpId: i, signal: r }) {
2042
2047
  return {
2043
2048
  publicKey: {
2044
2049
  allowCredentials: [{
@@ -2048,17 +2053,17 @@ function Ws({ challenge: e, credentialId: t, prfInput: n, rpId: i, signal: r })
2048
2053
  challenge: e,
2049
2054
  extensions: { prf: { eval: { first: n } } },
2050
2055
  ...i === void 0 ? {} : { rpId: i },
2051
- timeout: Ai,
2056
+ timeout: bi,
2052
2057
  userVerification: "required"
2053
2058
  },
2054
2059
  signal: r
2055
2060
  };
2056
2061
  }
2057
- async function Un({ assertCurrent: e, credentials: t, credentialId: n, fillRandom: i, prfInput: r, rpId: s, signal: a }) {
2062
+ async function kn({ assertCurrent: e, credentials: t, credentialId: n, fillRandom: i, prfInput: r, rpId: s, signal: a }) {
2058
2063
  const o = Ve(i, 32);
2059
2064
  let c;
2060
2065
  try {
2061
- c = await t.get(Ws({
2066
+ c = await t.get(qs({
2062
2067
  challenge: o,
2063
2068
  credentialId: n,
2064
2069
  prfInput: r,
@@ -2070,9 +2075,9 @@ async function Un({ assertCurrent: e, credentials: t, credentialId: n, fillRando
2070
2075
  } finally {
2071
2076
  P(o);
2072
2077
  }
2073
- return e(), Fs(c, n);
2078
+ return e(), Ws(c, n);
2074
2079
  }
2075
- function qs(e) {
2080
+ function zs(e) {
2076
2081
  if (typeof e != "string") return !1;
2077
2082
  for (let t = 0; t < e.length; t += 1) {
2078
2083
  const n = e.charCodeAt(t);
@@ -2084,38 +2089,38 @@ function qs(e) {
2084
2089
  }
2085
2090
  return !0;
2086
2091
  }
2087
- function zs(e) {
2092
+ function Hs(e) {
2088
2093
  if (typeof e == "string")
2089
- return qs(e) || C("INVALID_USERNAME"), tt.encode(e).length > 256 && C("INVALID_USERNAME"), e;
2094
+ return zs(e) || C("INVALID_USERNAME"), yt.encode(e).length > 256 && C("INVALID_USERNAME"), e;
2090
2095
  (!mt(e) || xe(e) > 256) && C("INVALID_USERNAME");
2091
2096
  try {
2092
- return Rs.decode(e);
2097
+ return Os.decode(e);
2093
2098
  } catch {
2094
2099
  C("INVALID_USERNAME");
2095
2100
  }
2096
2101
  }
2097
2102
  function Gt(e) {
2098
- const n = zs(e).replace(/^ +/u, "").replace(/ +$/u, "").replace(/[A-Z]/gu, (r) => r.toLowerCase()), i = tt.encode(n);
2099
- return (i.length < 3 || i.length > 64 || !/^[a-z0-9][a-z0-9._-]*$/u.test(n)) && C("INVALID_USERNAME"), n;
2103
+ const t = Hs(e).replace(/^ +/u, "").replace(/ +$/u, "").replace(/[A-Z]/gu, (n) => n.toLowerCase());
2104
+ return di(t) || C("INVALID_USERNAME"), t;
2100
2105
  }
2101
- function Hs(e) {
2106
+ function Ks(e) {
2102
2107
  let t;
2103
2108
  try {
2104
- t = zn(e?.module);
2109
+ t = qn(e?.module);
2105
2110
  } catch {
2106
2111
  C("WASM_UNAVAILABLE");
2107
2112
  }
2108
- return (!bi(t, ["sdn", "sha256"]) || typeof t.sha256 != "function" || !t.sdn || typeof t.sdn != "object") && C("WASM_UNAVAILABLE"), t;
2113
+ return (!Ei(t, ["sdn", "sha256"]) || typeof t.sha256 != "function" || !t.sdn || typeof t.sdn != "object") && C("WASM_UNAVAILABLE"), t;
2109
2114
  }
2110
- function Ks(e) {
2111
- const t = Hs(e), n = t.sdn, i = e?.storage, r = e?.credentials, s = Ls(e?.rng), a = e?.createRequestController, o = e?.releaseRequestController, c = e?.ownHandle, l = e?.destroyHandle, d = e?.ownedHandlesClean, u = e?.now ?? (() => /* @__PURE__ */ new Date()), p = e?.rpHostname ?? e?.window?.location?.hostname ?? globalThis?.location?.hostname, f = js(e?.rpId, p), A = typeof e?.rpName == "string" && e.rpName !== "" ? e.rpName : ks, b = () => typeof r?.create == "function" && typeof r?.get == "function", h = () => fi(i), y = () => ts(i), m = (O) => ns(i, O), $ = (O, F) => (is(i, O, F), y().some((w) => w.key === O) && C("STORAGE_WRITE_FAILED"), !0), v = () => h().active.status === "valid", k = ({ confirmation: O } = {}) => (v() || C("REMEMBER_UNAVAILABLE"), rs(i, O), h().active.status !== "empty" && C("STORAGE_WRITE_FAILED"), !0), D = async (O) => {
2115
+ function Gs(e) {
2116
+ const t = Ks(e), n = t.sdn, i = e?.storage, r = e?.credentials, s = Rs(e?.rng), a = e?.createRequestController, o = e?.releaseRequestController, c = e?.ownHandle, l = e?.destroyHandle, d = e?.ownedHandlesClean, u = e?.now ?? (() => /* @__PURE__ */ new Date()), p = e?.rpHostname ?? e?.window?.location?.hostname ?? globalThis?.location?.hostname, f = Bs(e?.rpId, p), A = typeof e?.rpName == "string" && e.rpName !== "" ? e.rpName : Us, b = () => typeof r?.create == "function" && typeof r?.get == "function", h = () => pi(i), y = () => ns(i), m = (O) => is(i, O), $ = (O, F) => (rs(i, O, F), y().some((w) => w.key === O) && C("STORAGE_WRITE_FAILED"), !0), v = () => h().active.status === "valid", k = ({ confirmation: O } = {}) => (v() || C("REMEMBER_UNAVAILABLE"), ss(i, O), h().active.status !== "empty" && C("STORAGE_WRITE_FAILED"), !0), D = async (O) => {
2112
2117
  let F;
2113
2118
  try {
2114
- F = await t.sha256(tt.encode(O));
2119
+ F = await t.sha256(yt.encode(O));
2115
2120
  } catch {
2116
2121
  C("WASM_FAILURE");
2117
2122
  }
2118
- return mt(F, 32) || C("WASM_FAILURE"), Bs(F);
2123
+ return mt(F, 32) || C("WASM_FAILURE"), Vs(F);
2119
2124
  };
2120
2125
  return Object.freeze({
2121
2126
  canForget: v,
@@ -2136,11 +2141,11 @@ function Ks(e) {
2136
2141
  }), re = ge(w.prfInputBase64url, { exact: 32 }), Y = ge(w.ciphertextBase64url, {
2137
2142
  minimum: 17,
2138
2143
  maximum: 1024
2139
- }), U = ge(w.hkdfSaltBase64url, { exact: 32 }), R = ge(w.nonceBase64url, { exact: 12 }), H = tt.encode(w.canonicalUsername), X = $e(w.aad), K = typeof a == "function" ? a() : null;
2144
+ }), U = ge(w.hkdfSaltBase64url, { exact: 32 }), R = ge(w.nonceBase64url, { exact: 12 }), H = yt.encode(w.canonicalUsername), X = $e(w.aad), K = typeof a == "function" ? a() : null;
2140
2145
  (!K?.signal || typeof K.abort != "function") && (P(N), P(re), P(Y), P(U), P(R), P(H), C("WEBAUTHN_UNAVAILABLE"));
2141
2146
  let G, te = null, se = !1;
2142
2147
  try {
2143
- G = await Un({
2148
+ G = await kn({
2144
2149
  assertCurrent: O,
2145
2150
  credentialId: N,
2146
2151
  credentials: r,
@@ -2196,7 +2201,7 @@ function Ks(e) {
2196
2201
  { alg: -257, type: "public-key" }
2197
2202
  ],
2198
2203
  rp: f === void 0 ? { name: A } : { id: f, name: A },
2199
- timeout: Ai,
2204
+ timeout: bi,
2200
2205
  user: {
2201
2206
  displayName: F,
2202
2207
  id: H,
@@ -2209,8 +2214,8 @@ function Ks(e) {
2209
2214
  throw O(), Te;
2210
2215
  }
2211
2216
  O();
2212
- const We = wi(Ue);
2213
- te = We.rawId, $s(We), se = await Un({
2217
+ const We = Ii(Ue);
2218
+ te = We.rawId, Fs(We), se = await kn({
2214
2219
  assertCurrent: O,
2215
2220
  credentialId: te,
2216
2221
  credentials: r,
@@ -2223,10 +2228,10 @@ function Ks(e) {
2223
2228
  O();
2224
2229
  const je = Je(te), qe = Object.freeze({
2225
2230
  credentialIdBase64url: je,
2226
- identityScheme: Ds,
2231
+ identityScheme: Ps,
2227
2232
  schemaVersion: 2,
2228
- seedProfile: Ps,
2229
- storageProfile: Pn,
2233
+ seedProfile: ks,
2234
+ storageProfile: Dn,
2230
2235
  usernameSha256: Ie
2231
2236
  }), ze = $e(qe);
2232
2237
  let ve;
@@ -2251,7 +2256,7 @@ function Ks(e) {
2251
2256
  } catch {
2252
2257
  C("CLOCK_FAILURE");
2253
2258
  }
2254
- const ct = Object.freeze({
2259
+ const at = Object.freeze({
2255
2260
  aad: qe,
2256
2261
  canonicalUsername: F,
2257
2262
  ciphertextBase64url: Je(ve),
@@ -2261,15 +2266,15 @@ function Ks(e) {
2261
2266
  nonceBase64url: Je(G),
2262
2267
  prfInputBase64url: Je(X),
2263
2268
  schemaVersion: 2,
2264
- storageProfile: Pn
2269
+ storageProfile: Dn
2265
2270
  });
2266
- O(), Re = Xr(i, ct);
2271
+ O(), Re = Zr(i, at);
2267
2272
  let Ne;
2268
2273
  const Ke = ce;
2269
2274
  try {
2270
2275
  Ne = n.importRememberedIdentity({
2271
2276
  canonicalAad: ze,
2272
- canonicalUsernameUtf8: tt.encode(F),
2277
+ canonicalUsernameUtf8: yt.encode(F),
2273
2278
  ciphertextAndTag: ve.slice(),
2274
2279
  hkdfSalt: K.slice(),
2275
2280
  nonce: G.slice(),
@@ -2279,8 +2284,8 @@ function Ks(e) {
2279
2284
  P(Ke), ce = null;
2280
2285
  }
2281
2286
  Lt(Ne) || C("WASM_FAILURE"), J = Ne.handle, (J == null || typeof c != "function") && C("WASM_FAILURE"), c(J);
2282
- const lt = ye(Ne.identity);
2283
- return Ms(re, lt) || C("IDENTITY_MISMATCH"), O(), (typeof l != "function" || !l(J)) && C("DESTRUCTION_FAILED"), J = null, (typeof d != "function" || !d(w)) && C("DESTRUCTION_FAILED"), O(), Zr(i, Re), Re = null, Object.freeze({ remembered: !0 });
2287
+ const ct = ye(Ne.identity);
2288
+ return $s(re, ct) || C("IDENTITY_MISMATCH"), O(), (typeof l != "function" || !l(J)) && C("DESTRUCTION_FAILED"), J = null, (typeof d != "function" || !d(w)) && C("DESTRUCTION_FAILED"), O(), es(i, Re), Re = null, Object.freeze({ remembered: !0 });
2284
2289
  } finally {
2285
2290
  J !== null && typeof l == "function" && l(J), P(N), P(R), P(H), P(se), P(ne), P(ce), P(K), P(G), P(te), typeof o == "function" && o(U);
2286
2291
  }
@@ -2291,7 +2296,7 @@ function Ks(e) {
2291
2296
  supported: b
2292
2297
  });
2293
2298
  }
2294
- const it = /^[0-9a-f]{64}$/u, Gs = /^[A-Za-z0-9_-]{43}$/u, Js = Object.freeze([
2299
+ const nt = /^[0-9a-f]{64}$/u, Js = /^[A-Za-z0-9_-]{43}$/u, Qs = Object.freeze([
2295
2300
  "callbackUri",
2296
2301
  "clientDisplayName",
2297
2302
  "clientId",
@@ -2305,7 +2310,7 @@ const it = /^[0-9a-f]{64}$/u, Gs = /^[A-Za-z0-9_-]{43}$/u, Js = Object.freeze([
2305
2310
  "schemaVersion",
2306
2311
  "state",
2307
2312
  "transactionId"
2308
- ]), Qs = Object.freeze(["redirectUri", "schemaVersion", "transactionId"]), Ys = 64 * 1024, Xs = 4 * 1024, Zs = new TextEncoder(), eo = new TextDecoder("utf-8", { fatal: !0 });
2313
+ ]), Ys = Object.freeze(["redirectUri", "schemaVersion", "transactionId"]), Xs = 64 * 1024, Zs = 4 * 1024, eo = new TextEncoder(), to = new TextDecoder("utf-8", { fatal: !0 });
2309
2314
  class Rt extends Error {
2310
2315
  constructor() {
2311
2316
  super("RELAY_FAILURE"), this.name = "WalletRelayError", this.code = "RELAY_FAILURE";
@@ -2314,13 +2319,13 @@ class Rt extends Error {
2314
2319
  function x() {
2315
2320
  throw new Rt();
2316
2321
  }
2317
- function Ii(e) {
2322
+ function vi(e) {
2318
2323
  if (e === null || typeof e != "object" || Array.isArray(e)) return !1;
2319
2324
  const t = Object.getPrototypeOf(e);
2320
2325
  return t === Object.prototype || t === null;
2321
2326
  }
2322
- function vi(e, t) {
2323
- Ii(e) || x();
2327
+ function Si(e, t) {
2328
+ vi(e) || x();
2324
2329
  let n;
2325
2330
  try {
2326
2331
  n = Reflect.ownKeys(e);
@@ -2343,13 +2348,13 @@ function vi(e, t) {
2343
2348
  }
2344
2349
  function Jt(e) {
2345
2350
  if (Array.isArray(e)) return Object.freeze(e.map(Jt));
2346
- if (!Ii(e)) return e;
2351
+ if (!vi(e)) return e;
2347
2352
  const t = {};
2348
2353
  for (const n of Object.keys(e).sort()) t[n] = Jt(e[n]);
2349
2354
  return Object.freeze(t);
2350
2355
  }
2351
- function to(e, t) {
2352
- (typeof e != "string" || Zs.encode(e).byteLength > t || e.charCodeAt(0) === 65279) && x();
2356
+ function no(e, t) {
2357
+ (typeof e != "string" || eo.encode(e).byteLength > t || e.charCodeAt(0) === 65279) && x();
2353
2358
  let n = 0, i = 0;
2354
2359
  const r = () => {
2355
2360
  for (; n < e.length && /[\u0009\u000a\u000d\u0020]/u.test(e[n]); ) n += 1;
@@ -2420,27 +2425,27 @@ function to(e, t) {
2420
2425
  const o = a();
2421
2426
  return r(), n !== e.length && x(), o;
2422
2427
  }
2423
- function jn(e) {
2428
+ function Un(e) {
2424
2429
  try {
2425
2430
  Promise.resolve(e).catch(() => {
2426
2431
  });
2427
2432
  } catch {
2428
2433
  }
2429
2434
  }
2430
- function Si(e, t = null) {
2435
+ function Li(e, t = null) {
2431
2436
  try {
2432
2437
  const n = t?.cancel;
2433
- typeof n == "function" && jn(Reflect.apply(n, t, []));
2438
+ typeof n == "function" && Un(Reflect.apply(n, t, []));
2434
2439
  } catch {
2435
2440
  }
2436
2441
  if (!t)
2437
2442
  try {
2438
2443
  const n = e?.body, i = n?.cancel;
2439
- typeof i == "function" && jn(Reflect.apply(i, n, []));
2444
+ typeof i == "function" && Un(Reflect.apply(i, n, []));
2440
2445
  } catch {
2441
2446
  }
2442
2447
  }
2443
- function Li(e, t, n = null) {
2448
+ function Ri(e, t, n = null) {
2444
2449
  let i;
2445
2450
  try {
2446
2451
  i = Promise.resolve(e);
@@ -2474,7 +2479,7 @@ function Li(e, t, n = null) {
2474
2479
  );
2475
2480
  }) : i;
2476
2481
  }
2477
- async function no(e, t, n, i) {
2482
+ async function io(e, t, n, i) {
2478
2483
  let r = null;
2479
2484
  try {
2480
2485
  (!e || e.status !== t || e.redirected === !0 || e.headers?.get?.("cache-control")?.trim().toLowerCase() !== "no-store" || e.headers?.get?.("content-type")?.trim().toLowerCase() !== "application/json; charset=utf-8" || typeof e.body?.getReader != "function") && x(), r = e.body.getReader(), (!r || typeof r.read != "function" || i?.aborted === !0) && x();
@@ -2482,7 +2487,7 @@ async function no(e, t, n, i) {
2482
2487
  let a = 0;
2483
2488
  for (; ; ) {
2484
2489
  i?.aborted === !0 && x();
2485
- const { done: l, value: d } = await Li(r.read(), i);
2490
+ const { done: l, value: d } = await Ri(r.read(), i);
2486
2491
  if (i?.aborted === !0 && x(), l) break;
2487
2492
  d instanceof Uint8Array || x(), a += d.byteLength, a > n && x(), s.push(d);
2488
2493
  }
@@ -2490,9 +2495,9 @@ async function no(e, t, n, i) {
2490
2495
  let c = 0;
2491
2496
  for (const l of s)
2492
2497
  o.set(l, c), c += l.byteLength;
2493
- return to(eo.decode(o), n);
2498
+ return no(to.decode(o), n);
2494
2499
  } catch (s) {
2495
- if (Si(e, r), s instanceof Rt) throw s;
2500
+ if (Li(e, r), s instanceof Rt) throw s;
2496
2501
  x();
2497
2502
  } finally {
2498
2503
  try {
@@ -2501,21 +2506,21 @@ async function no(e, t, n, i) {
2501
2506
  }
2502
2507
  }
2503
2508
  }
2504
- function Bn(e, t) {
2505
- return vi(e, Js), (e.schemaVersion !== 1 || e.transactionId !== t || !it.test(e.transactionId) || !it.test(e.state) || !it.test(e.requestSha256) || !Gs.test(e.resultToken) || typeof e.callbackUri != "string" || typeof e.clientDisplayName != "string" || typeof e.clientId != "string" || typeof e.expiresAt != "string" || typeof e.operation != "string" || typeof e.registryVersion != "string" || typeof e.requestOrigin != "string") && x(), Jt(e);
2509
+ function jn(e, t) {
2510
+ return Si(e, Qs), (e.schemaVersion !== 1 || e.transactionId !== t || !nt.test(e.transactionId) || !nt.test(e.state) || !nt.test(e.requestSha256) || !Js.test(e.resultToken) || typeof e.callbackUri != "string" || typeof e.clientDisplayName != "string" || typeof e.clientId != "string" || typeof e.expiresAt != "string" || typeof e.operation != "string" || typeof e.registryVersion != "string" || typeof e.requestOrigin != "string") && x(), Jt(e);
2506
2511
  }
2507
2512
  function Qt(e, t) {
2508
- vi(t, Qs), (t.schemaVersion !== 1 || t.transactionId !== e.transactionId || typeof t.redirectUri != "string") && x();
2513
+ Si(t, Ys), (t.schemaVersion !== 1 || t.transactionId !== e.transactionId || typeof t.redirectUri != "string") && x();
2509
2514
  const n = `${e.callbackUri}#code=`, i = `&state=${e.state}`;
2510
2515
  (!t.redirectUri.startsWith(n) || !t.redirectUri.endsWith(i)) && x();
2511
2516
  const r = t.redirectUri.slice(n.length, t.redirectUri.length - i.length);
2512
- return (!it.test(r) || t.redirectUri !== `${n}${r}${i}`) && x(), Object.freeze({
2517
+ return (!nt.test(r) || t.redirectUri !== `${n}${r}${i}`) && x(), Object.freeze({
2513
2518
  redirectUri: t.redirectUri,
2514
2519
  schemaVersion: 1,
2515
2520
  transactionId: t.transactionId
2516
2521
  });
2517
2522
  }
2518
- function Vn(e, t, n = void 0) {
2523
+ function Bn(e, t, n = void 0) {
2519
2524
  const i = {
2520
2525
  cache: "no-store",
2521
2526
  credentials: "omit",
@@ -2528,39 +2533,39 @@ function Vn(e, t, n = void 0) {
2528
2533
  };
2529
2534
  return n !== void 0 && (i.body = JSON.stringify(n)), i;
2530
2535
  }
2531
- function io({ fetch: e, location: t }) {
2536
+ function ro({ fetch: e, location: t }) {
2532
2537
  (typeof e != "function" || typeof t?.replace != "function") && x();
2533
2538
  const n = /* @__PURE__ */ new Set(), i = async (r, s, a, o) => {
2534
2539
  let c;
2535
2540
  try {
2536
- c = await Li(e(r, s), s.signal, (l) => Si(l));
2541
+ c = await Ri(e(r, s), s.signal, (l) => Li(l));
2537
2542
  } catch {
2538
2543
  x();
2539
2544
  }
2540
- return no(c, a, o, s.signal);
2545
+ return io(c, a, o, s.signal);
2541
2546
  };
2542
2547
  return Object.freeze({
2543
2548
  async fetchTransaction(r, { signal: s } = {}) {
2544
- (typeof r != "string" || !it.test(r)) && x();
2549
+ (typeof r != "string" || !nt.test(r)) && x();
2545
2550
  const a = await i(
2546
2551
  `/relay/v1/transactions/${r}`,
2547
- Vn("GET", s),
2552
+ Bn("GET", s),
2548
2553
  200,
2549
- Ys
2554
+ Xs
2550
2555
  );
2551
- return Bn(a, r);
2556
+ return jn(a, r);
2552
2557
  },
2553
2558
  async publishResult(r, s, { signal: a } = {}) {
2554
- const o = Bn(r, r?.transactionId), c = await i(
2559
+ const o = jn(r, r?.transactionId), c = await i(
2555
2560
  `/relay/v1/transactions/${o.transactionId}/result`,
2556
- Vn("POST", a, {
2561
+ Bn("POST", a, {
2557
2562
  result: s,
2558
2563
  resultToken: o.resultToken,
2559
2564
  schemaVersion: 1,
2560
2565
  transactionId: o.transactionId
2561
2566
  }),
2562
2567
  201,
2563
- Xs
2568
+ Zs
2564
2569
  ), l = Qt(o, c);
2565
2570
  return n.clear(), n.add(l.redirectUri), l;
2566
2571
  },
@@ -2580,7 +2585,7 @@ function io({ fetch: e, location: t }) {
2580
2585
  }
2581
2586
  });
2582
2587
  }
2583
- const Ri = Uint8Array, ro = Ri.prototype.fill, Qe = new TextEncoder();
2588
+ const Oi = Uint8Array, so = Oi.prototype.fill, Qe = new TextEncoder();
2584
2589
  class V extends Error {
2585
2590
  constructor(t) {
2586
2591
  super(t), this.name = "WalletOriginError", this.code = t;
@@ -2593,9 +2598,9 @@ function Ye(e) {
2593
2598
  throw e instanceof we ? new V(e.code) : e;
2594
2599
  }
2595
2600
  function pe(e) {
2596
- if (e instanceof Ri)
2601
+ if (e instanceof Oi)
2597
2602
  try {
2598
- ro.call(e, 0);
2603
+ so.call(e, 0);
2599
2604
  } catch {
2600
2605
  }
2601
2606
  }
@@ -2610,7 +2615,7 @@ function Xe(e) {
2610
2615
  }
2611
2616
  return !0;
2612
2617
  }
2613
- function Mn(e) {
2618
+ function Vn(e) {
2614
2619
  if (!(!e || typeof e != "object")) {
2615
2620
  try {
2616
2621
  e.type === "checkbox" && (e.checked = !1);
@@ -2662,7 +2667,7 @@ function Ze(e, t) {
2662
2667
  } catch {
2663
2668
  r = null;
2664
2669
  }
2665
- r && n.add(r), Mn(i);
2670
+ r && n.add(r), Vn(i);
2666
2671
  }
2667
2672
  for (const i of n) {
2668
2673
  let r = [];
@@ -2671,7 +2676,7 @@ function Ze(e, t) {
2671
2676
  } catch {
2672
2677
  r = [];
2673
2678
  }
2674
- for (const s of r) Mn(s);
2679
+ for (const s of r) Vn(s);
2675
2680
  try {
2676
2681
  i.inert = !0, i.setAttribute?.("aria-hidden", "true");
2677
2682
  const s = e.createElement("div");
@@ -2684,21 +2689,21 @@ function Ze(e, t) {
2684
2689
  }
2685
2690
  }
2686
2691
  }
2687
- function so(e) {
2692
+ function oo(e) {
2688
2693
  let t;
2689
2694
  try {
2690
- t = zn(e);
2695
+ t = qn(e);
2691
2696
  } catch {
2692
2697
  E("WASM_UNAVAILABLE");
2693
2698
  }
2694
2699
  const n = t?.sdn, i = t?.sha256;
2695
2700
  return (!n || typeof n.derivePasswordIdentity != "function" || typeof n.destroySdnIdentity != "function" || typeof i != "function") && E("WASM_UNAVAILABLE"), Object.freeze({ capabilities: n, sha256: i });
2696
2701
  }
2697
- function dt(e) {
2702
+ function ut(e) {
2698
2703
  const t = e?.AbortController ?? globalThis.AbortController;
2699
2704
  return typeof t == "function" ? new t() : null;
2700
2705
  }
2701
- class oo {
2706
+ class ao {
2702
2707
  #d = !1;
2703
2708
  #p;
2704
2709
  #y = null;
@@ -2742,10 +2747,10 @@ class oo {
2742
2747
  wasm: d,
2743
2748
  window: u
2744
2749
  }) {
2745
- const p = so(d);
2746
- this.#p = p.capabilities, this.#x = p.sha256, this.#_ = r, this.#c = s, this.#n = n, this.#s = u, this.#m = Ks({
2750
+ const p = oo(d);
2751
+ this.#p = p.capabilities, this.#x = p.sha256, this.#_ = r, this.#c = s, this.#n = n, this.#s = u, this.#m = Gs({
2747
2752
  createRequestController: () => {
2748
- const f = dt(this.#s);
2753
+ const f = ut(this.#s);
2749
2754
  return f && (this.#a.add(f), this.#O.add(f)), f;
2750
2755
  },
2751
2756
  credentials: t ?? u?.navigator?.credentials ?? globalThis.navigator?.credentials,
@@ -2902,11 +2907,11 @@ class oo {
2902
2907
  i = a, r = o;
2903
2908
  });
2904
2909
  return this.#C = s, (async () => {
2905
- const a = dt(this.#s);
2910
+ const a = ut(this.#s);
2906
2911
  a && this.#a.add(a);
2907
2912
  try {
2908
2913
  this.#I(n.epoch, n.permit), le({ document: this.#n, window: this.#s }), typeof this.#c?.publishResult != "function" && E("RELAY_UNAVAILABLE");
2909
- const o = t === "connected" ? n.connectedResult : Mr();
2914
+ const o = t === "connected" ? n.connectedResult : $r();
2910
2915
  let c;
2911
2916
  try {
2912
2917
  c = await this.#c.publishResult(n.transaction, o, {
@@ -3195,7 +3200,7 @@ class oo {
3195
3200
  b == null && E("WASM_FAILURE"), this.#o.add(b);
3196
3201
  let h;
3197
3202
  try {
3198
- h = ls(A.identity, { accountIndex: t, profile: s });
3203
+ h = us(A.identity, { accountIndex: t, profile: s });
3199
3204
  } catch {
3200
3205
  const y = this.#b(b);
3201
3206
  A = null, y || (this.revokeNow("native-destruction-failed"), E("DESTRUCTION_FAILED")), E("WASM_FAILURE");
@@ -3209,7 +3214,7 @@ class oo {
3209
3214
  }
3210
3215
  async prepare(t) {
3211
3216
  (this.#e || this.#i) && E("STALE_CONTROLLER"), this.#d && E("TRANSACTION_IN_PROGRESS"), this.#d = !0;
3212
- const n = this.#r, i = typeof t == "string" ? t : t?.transactionId ?? null, r = dt(this.#s);
3217
+ const n = this.#r, i = typeof t == "string" ? t : t?.transactionId ?? null, r = ut(this.#s);
3213
3218
  r && this.#a.add(r);
3214
3219
  try {
3215
3220
  const s = typeof this.#c?.fetchTransaction == "function" ? await this.#c.fetchTransaction(t, { signal: r?.signal }) : t;
@@ -3242,7 +3247,7 @@ class oo {
3242
3247
  sha256: this.#x,
3243
3248
  window: this.#s
3244
3249
  });
3245
- this.#w(i, s), le({ document: this.#n, window: this.#s }), this.#y = Br({
3250
+ this.#w(i, s), le({ document: this.#n, window: this.#s }), this.#y = Vr({
3246
3251
  binding: o.binding,
3247
3252
  document: this.#n,
3248
3253
  identity: r,
@@ -3255,7 +3260,7 @@ class oo {
3255
3260
  sha256: this.#x,
3256
3261
  window: this.#s
3257
3262
  }), this.#w(i, s), le({ document: this.#n, window: this.#s });
3258
- const c = await Vr({
3263
+ const c = await Mr({
3259
3264
  assertCurrent: () => this.#w(i, s),
3260
3265
  binding: o.binding,
3261
3266
  handle: i,
@@ -3281,7 +3286,7 @@ class oo {
3281
3286
  }), Object.freeze({ accountReady: !0 });
3282
3287
  try {
3283
3288
  this.#I(u, p), typeof this.#c?.publishResult != "function" && E("RELAY_UNAVAILABLE");
3284
- const f = dt(this.#s);
3289
+ const f = ut(this.#s);
3285
3290
  f && this.#a.add(f);
3286
3291
  let A;
3287
3292
  try {
@@ -3372,7 +3377,7 @@ class oo {
3372
3377
  })(), i;
3373
3378
  }
3374
3379
  }
3375
- const ao = [
3380
+ const co = [
3376
3381
  {
3377
3382
  allowedOperations: [
3378
3383
  "sdn.wallet.account.v1",
@@ -3713,11 +3718,11 @@ const ao = [
3713
3718
  ],
3714
3719
  requestOrigin: "https://review.spacedatanetwork.org"
3715
3720
  }
3716
- ], co = "7674bfb019753eee8387f064467c0f6f2ff6babd1ecabbd70dc585afc31fbc1a", lo = 1, Oi = {
3717
- clients: ao,
3718
- registryReleaseSha256: co,
3719
- schemaVersion: lo
3720
- }, uo = new TextEncoder(), fo = /^[0-9a-f]{64}$/u, po = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u, ho = Object.freeze({
3721
+ ], lo = "7674bfb019753eee8387f064467c0f6f2ff6babd1ecabbd70dc585afc31fbc1a", uo = 1, Ni = {
3722
+ clients: co,
3723
+ registryReleaseSha256: lo,
3724
+ schemaVersion: uo
3725
+ }, fo = new TextEncoder(), po = /^[0-9a-f]{64}$/u, ho = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u, yo = Object.freeze({
3721
3726
  "sdn.auth.publish-request.v1": Object.freeze({
3722
3727
  audience: null,
3723
3728
  registryRow: "spaceaware-publish-request-v1",
@@ -3763,26 +3768,26 @@ const ao = [
3763
3768
  }), me = Object.freeze([
3764
3769
  "sdn.wallet.account.v1",
3765
3770
  "sdn.wallet.connect.v1"
3766
- ]), yo = Object.freeze([
3771
+ ]), mo = Object.freeze([
3767
3772
  "sdn.auth.jcs-envelope.v2",
3768
3773
  "sdn.auth.raw-challenge.v1",
3769
3774
  ...me
3770
- ]), mo = Object.freeze(["sdn.auth.publish-request.v1", ...me]), go = Object.freeze([
3775
+ ]), go = Object.freeze(["sdn.auth.publish-request.v1", ...me]), Ao = Object.freeze([
3771
3776
  "sdn.asset-review.authority-activation.v1",
3772
3777
  "sdn.asset-review.decision.v1",
3773
3778
  ...me
3774
- ]), $n = Object.freeze([
3779
+ ]), Mn = Object.freeze([
3775
3780
  Object.freeze(["sdn-landing-web-v1", "Space Data Network", "https://spacedatanetwork.org", "https://spacedatanetwork.org/wallet-callback.html", me]),
3776
3781
  Object.freeze(["sdn-standards-web-v1", "Space Data Standards", "https://spacedatastandards.org", "https://spacedatastandards.org/wallet-callback.html", me]),
3777
3782
  Object.freeze(["sdn-flatbuffers-pages-v1", "FlatBuffers Documentation", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/flatbuffers/wallet-callback.html", me]),
3778
3783
  Object.freeze(["sdn-flatsql-pages-v1", "FlatSQL Documentation", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/flatsql/wallet-callback.html", me]),
3779
3784
  Object.freeze(["sdn-module-sdk-pages-v1", "Space Data Module SDK", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/space-data-module-sdk/wallet-callback.html", me]),
3780
- Object.freeze(["spaceaware-web-v1", "SpaceAware", "https://spaceaware.io", "https://spaceaware.io/wallet/callback", mo]),
3781
- Object.freeze(["sdn-node-console-v1", "SDN Node Console", "https://sdn.spaceaware.io", "https://sdn.spaceaware.io/wallet/callback", yo]),
3785
+ Object.freeze(["spaceaware-web-v1", "SpaceAware", "https://spaceaware.io", "https://spaceaware.io/wallet/callback", go]),
3786
+ Object.freeze(["sdn-node-console-v1", "SDN Node Console", "https://sdn.spaceaware.io", "https://sdn.spaceaware.io/wallet/callback", mo]),
3782
3787
  Object.freeze(["orbpro-pages-v1", "OrbPro", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/OrbPro/wallet-callback.html", me]),
3783
3788
  Object.freeze(["sdn-asset-models-pages-v1", "SDN Asset Models", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/asset-models/wallet-callback.html", me]),
3784
- Object.freeze(["sdn-asset-review-v1", "SDN Asset Review", "https://review.spacedatanetwork.org", "https://review.spacedatanetwork.org/wallet/callback", go])
3785
- ]), Ao = Object.freeze([
3789
+ Object.freeze(["sdn-asset-review-v1", "SDN Asset Review", "https://review.spacedatanetwork.org", "https://review.spacedatanetwork.org/wallet/callback", Ao])
3790
+ ]), bo = Object.freeze([
3786
3791
  Object.freeze({
3787
3792
  audience: null,
3788
3793
  clientId: "spaceaware-web-v1",
@@ -3847,10 +3852,10 @@ function gt(e, t, n) {
3847
3852
  function he(e) {
3848
3853
  return e === null || typeof e == "boolean" || typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? (Number.isFinite(e) || B("registry contains a non-finite number"), JSON.stringify(e)) : Array.isArray(e) ? `[${e.map(he).join(",")}]` : (fn(e) || B("registry contains an unsupported value"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${he(e[t])}`).join(",")}}`);
3849
3854
  }
3850
- async function bo(e) {
3855
+ async function Eo(e) {
3851
3856
  const t = globalThis.crypto?.subtle;
3852
3857
  t || B("Web Crypto SHA-256 is unavailable");
3853
- const n = new Uint8Array(await t.digest("SHA-256", uo.encode(e)));
3858
+ const n = new Uint8Array(await t.digest("SHA-256", fo.encode(e)));
3854
3859
  return Array.from(n, (i) => i.toString(16).padStart(2, "0")).join("");
3855
3860
  }
3856
3861
  function Ot(e) {
@@ -3860,7 +3865,7 @@ function Ot(e) {
3860
3865
  for (const n of Object.keys(e).sort()) t[n] = Ot(e[n]);
3861
3866
  return Object.freeze(t);
3862
3867
  }
3863
- function Eo(e, t) {
3868
+ function wo(e, t) {
3864
3869
  (typeof e != "string" || !e.startsWith("https://") || e.includes("*")) && B(`${t} must be exact HTTPS`);
3865
3870
  let n;
3866
3871
  try {
@@ -3870,7 +3875,7 @@ function Eo(e, t) {
3870
3875
  }
3871
3876
  (n.protocol !== "https:" || n.username || n.password || n.port || n.origin !== e || n.pathname !== "/" || n.search || n.hash) && B(`${t} must be an exact HTTPS origin`);
3872
3877
  }
3873
- function wo(e, t) {
3878
+ function Io(e, t) {
3874
3879
  (typeof e != "string" || !e.startsWith("https://") || e.includes("*")) && B("callbackUri must be exact HTTPS");
3875
3880
  let n;
3876
3881
  try {
@@ -3880,8 +3885,8 @@ function wo(e, t) {
3880
3885
  }
3881
3886
  (n.protocol !== "https:" || n.username || n.password || n.port || n.origin !== t || n.search || n.hash || n.href !== e) && B("callbackUri must be exact and same-origin");
3882
3887
  }
3883
- function Io(e) {
3884
- gt(e, ["clients", "registryReleaseSha256", "schemaVersion"], "registry"), e.schemaVersion !== 1 && B("registry schemaVersion must be 1"), (typeof e.registryReleaseSha256 != "string" || !fo.test(e.registryReleaseSha256)) && B("registryReleaseSha256 must be lowercase SHA-256"), (!Array.isArray(e.clients) || e.clients.length !== $n.length) && B("registry must contain exactly the reviewed clients");
3888
+ function vo(e) {
3889
+ gt(e, ["clients", "registryReleaseSha256", "schemaVersion"], "registry"), e.schemaVersion !== 1 && B("registry schemaVersion must be 1"), (typeof e.registryReleaseSha256 != "string" || !po.test(e.registryReleaseSha256)) && B("registryReleaseSha256 must be lowercase SHA-256"), (!Array.isArray(e.clients) || e.clients.length !== Mn.length) && B("registry must contain exactly the reviewed clients");
3885
3890
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
3886
3891
  e.clients.forEach((i, r) => {
3887
3892
  gt(i, [
@@ -3893,8 +3898,8 @@ function Io(e) {
3893
3898
  "operationBindings",
3894
3899
  "requestOrigin"
3895
3900
  ], `client ${r}`);
3896
- const [s, a, o, c, l] = $n[r];
3897
- (i.clientId !== s || i.clientDisplayName !== a || i.requestOrigin !== o || i.callbackUri !== c) && B(`client ${r} differs from the reviewed row`), (!po.test(i.clientId) || t.has(i.clientId)) && B("clientId must be unique and canonical"), t.add(i.clientId), (typeof i.clientDisplayName != "string" || i.clientDisplayName.length < 1 || i.clientDisplayName.length > 80) && B("clientDisplayName is invalid"), Eo(i.requestOrigin, "requestOrigin"), wo(i.callbackUri, i.requestOrigin), (!Array.isArray(i.allowedOperations) || he(i.allowedOperations) !== he(l)) && B(`${i.clientId} allowedOperations differ from the reviewed allowlist`), (!Array.isArray(i.operationBindings) || i.operationBindings.length !== l.length) && B(`${i.clientId} operationBindings differ from the reviewed allowlist`), i.operationBindings.forEach((u, p) => {
3901
+ const [s, a, o, c, l] = Mn[r];
3902
+ (i.clientId !== s || i.clientDisplayName !== a || i.requestOrigin !== o || i.callbackUri !== c) && B(`client ${r} differs from the reviewed row`), (!ho.test(i.clientId) || t.has(i.clientId)) && B("clientId must be unique and canonical"), t.add(i.clientId), (typeof i.clientDisplayName != "string" || i.clientDisplayName.length < 1 || i.clientDisplayName.length > 80) && B("clientDisplayName is invalid"), wo(i.requestOrigin, "requestOrigin"), Io(i.callbackUri, i.requestOrigin), (!Array.isArray(i.allowedOperations) || he(i.allowedOperations) !== he(l)) && B(`${i.clientId} allowedOperations differ from the reviewed allowlist`), (!Array.isArray(i.operationBindings) || i.operationBindings.length !== l.length) && B(`${i.clientId} operationBindings differ from the reviewed allowlist`), i.operationBindings.forEach((u, p) => {
3898
3903
  gt(u, [
3899
3904
  "audience",
3900
3905
  "maxLifetimeSeconds",
@@ -3905,7 +3910,7 @@ function Io(e) {
3905
3910
  ], `${i.clientId} operation ${p}`);
3906
3911
  const f = l[p];
3907
3912
  u.operation !== f && B(`${i.clientId} operation allowlist order or value changed`);
3908
- const A = ho[u.operation];
3913
+ const A = yo[u.operation];
3909
3914
  A || B("unknown registry operation"), (u.maxLifetimeSeconds !== 300 || u.audience !== A.audience || u.registryRow !== A.registryRow || u.serviceActivationState !== A.serviceActivationState || u.serviceInstance !== A.serviceInstance) && B(`${i.clientId} operation policy differs from the reviewed binding`);
3910
3915
  const b = `${i.clientId}\0${i.requestOrigin}\0${u.operation}`;
3911
3916
  n.has(b) && B("duplicate registry binding"), n.add(b);
@@ -3913,7 +3918,7 @@ function Io(e) {
3913
3918
  const d = [...new Set(i.operationBindings.map(({ audience: u }) => u).filter((u) => u !== null))].sort();
3914
3919
  (!Array.isArray(i.audiences) || he(i.audiences) !== he(d)) && B(`${i.clientId} audiences differ from operationBindings`), he(i.allowedOperations) !== he(i.operationBindings.map(({ operation: u }) => u)) && B(`${i.clientId} allowedOperations differ from operationBindings`);
3915
3920
  });
3916
- for (const i of Ao) {
3921
+ for (const i of bo) {
3917
3922
  const r = e.clients.find((o) => o.clientId === i.clientId && o.requestOrigin === i.requestOrigin), s = r?.operationBindings.find((o) => o.operation === i.operation), a = s && {
3918
3923
  audience: s.audience,
3919
3924
  clientId: r.clientId,
@@ -3928,13 +3933,13 @@ function Io(e) {
3928
3933
  }
3929
3934
  return Ot(e);
3930
3935
  }
3931
- const { registryReleaseSha256: vo, ...So } = Oi, Lo = await bo(he(So));
3932
- Lo !== vo && B("registry release SHA-256 mismatch");
3933
- const Fn = Io(Oi);
3934
- function Ro(e) {
3936
+ const { registryReleaseSha256: So, ...Lo } = Ni, Ro = await Eo(he(Lo));
3937
+ Ro !== So && B("registry release SHA-256 mismatch");
3938
+ const $n = vo(Ni);
3939
+ function Oo(e) {
3935
3940
  const t = gt(e, ["clientId", "operation", "requestOrigin"], "registry lookup");
3936
3941
  (typeof t.clientId != "string" || typeof t.requestOrigin != "string" || typeof t.operation != "string") && B("registry lookup fields must be strings");
3937
- const n = Fn.clients.find((r) => r.clientId === t.clientId && r.requestOrigin === t.requestOrigin), i = n?.operationBindings.find((r) => r.operation === t.operation);
3942
+ const n = $n.clients.find((r) => r.clientId === t.clientId && r.requestOrigin === t.requestOrigin), i = n?.operationBindings.find((r) => r.operation === t.operation);
3938
3943
  return (!n || !i) && B("no exact registry binding exists"), Ot({
3939
3944
  audience: i.audience,
3940
3945
  callbackUri: n.callbackUri,
@@ -3943,17 +3948,17 @@ function Ro(e) {
3943
3948
  maxLifetimeSeconds: i.maxLifetimeSeconds,
3944
3949
  operation: i.operation,
3945
3950
  requestOrigin: n.requestOrigin,
3946
- registryReleaseSha256: Fn.registryReleaseSha256,
3951
+ registryReleaseSha256: $n.registryReleaseSha256,
3947
3952
  registryRow: i.registryRow,
3948
3953
  serviceActivationState: i.serviceActivationState,
3949
3954
  serviceInstance: i.serviceInstance
3950
3955
  });
3951
3956
  }
3952
- const Oo = /^\/transaction\/([0-9a-f]{64})$/u, jt = new TextEncoder(), No = Uint8Array.prototype.fill, To = Object.freeze({ resolveRegistryBinding: Ro });
3953
- function Wn(e) {
3957
+ const No = /^\/transaction\/([0-9a-f]{64})$/u, jt = new TextEncoder(), To = Uint8Array.prototype.fill, Co = Object.freeze({ resolveRegistryBinding: Oo });
3958
+ function Fn(e) {
3954
3959
  if (e instanceof Uint8Array)
3955
3960
  try {
3956
- No.call(e, 0);
3961
+ To.call(e, 0);
3957
3962
  } catch {
3958
3963
  }
3959
3964
  }
@@ -3968,10 +3973,10 @@ function Bt(e) {
3968
3973
  }
3969
3974
  return !0;
3970
3975
  }
3971
- function qn() {
3976
+ function Wn() {
3972
3977
  return new V("INVALID_TRANSACTION");
3973
3978
  }
3974
- function rt(e, t, n, i) {
3979
+ function it(e, t, n, i) {
3975
3980
  const r = e.createElement("label"), s = e.createElement("span");
3976
3981
  s.textContent = n, r.append(s, i), t.append(r);
3977
3982
  }
@@ -4015,7 +4020,7 @@ function Fe(e, t) {
4015
4020
  } catch {
4016
4021
  }
4017
4022
  }
4018
- function Ni({
4023
+ function Ti({
4019
4024
  clipboard: e,
4020
4025
  controller: t,
4021
4026
  document: n,
@@ -4065,7 +4070,7 @@ function Ni({
4065
4070
  }
4066
4071
  if (!Array.isArray(h) || h.length === 0)
4067
4072
  return r.replaceChildren(), r.hidden = !0, !1;
4068
- r.hidden = !1, l = hs(r, h, { document: n });
4073
+ r.hidden = !1, l = ys(r, h, { document: n });
4069
4074
  const y = o;
4070
4075
  for (const m of l.rows) {
4071
4076
  const { entry: $ } = m, v = async (q) => {
@@ -4147,7 +4152,7 @@ function Ni({
4147
4152
  refresh: A
4148
4153
  });
4149
4154
  }
4150
- function Co({
4155
+ function _o({
4151
4156
  clipboard: e = globalThis.navigator?.clipboard,
4152
4157
  controller: t = null,
4153
4158
  document: n,
@@ -4168,7 +4173,7 @@ function Co({
4168
4173
  const u = n.createElement("input");
4169
4174
  u.type = "text", u.name = "username", u.autocomplete = "username", u.required = !0;
4170
4175
  const p = n.createElement("input");
4171
- p.type = "password", p.name = "password", p.autocomplete = "current-password", p.required = !0, rt(n, d, "Username", u), rt(n, d, "Password", p);
4176
+ p.type = "password", p.name = "password", p.autocomplete = "current-password", p.required = !0, it(n, d, "Username", u), it(n, d, "Password", p);
4172
4177
  let f = null;
4173
4178
  if (t && typeof t == "object") {
4174
4179
  f = n.createElement("input"), f.type = "checkbox", f.dataset.walletRemember = "prf-only", f.checked = !1, f.defaultChecked = !1;
@@ -4178,13 +4183,13 @@ function Co({
4178
4183
  } catch {
4179
4184
  R = !1;
4180
4185
  }
4181
- f.disabled = !R, rt(n, d, "Remember on this device", f);
4186
+ f.disabled = !R, it(n, d, "Remember on this device", f);
4182
4187
  }
4183
4188
  const A = n.createElement("p");
4184
4189
  A.dataset.walletRememberStatus = "true";
4185
4190
  let b = () => {
4186
4191
  };
4187
- const h = Ni({
4192
+ const h = Ti({
4188
4193
  clipboard: e,
4189
4194
  controller: t,
4190
4195
  document: n,
@@ -4265,7 +4270,7 @@ function Co({
4265
4270
  remove: z
4266
4271
  });
4267
4272
  }
4268
- function Ti({
4273
+ function Ci({
4269
4274
  document: e,
4270
4275
  mount: t = null,
4271
4276
  submitLabel: n = "Compare legacy account",
@@ -4280,7 +4285,7 @@ function Ti({
4280
4285
  const o = e.createElement("form");
4281
4286
  o.noValidate = !0;
4282
4287
  const c = e.createElement("textarea");
4283
- c.name = "mnemonic", c.autocomplete = "off", c.required = !0, rt(e, o, "Mnemonic", c);
4288
+ c.name = "mnemonic", c.autocomplete = "off", c.required = !0, it(e, o, "Mnemonic", c);
4284
4289
  const l = e.createElement("button");
4285
4290
  l.type = "submit", l.dataset.walletAction = "confirm-legacy-mnemonic", l.textContent = n;
4286
4291
  const d = e.createElement("button");
@@ -4312,7 +4317,7 @@ function Ti({
4312
4317
  remove: h
4313
4318
  });
4314
4319
  }
4315
- function _o({ document: e, mount: t = null, title: n = "Choose legacy wallet profile" }) {
4320
+ function xo({ document: e, mount: t = null, title: n = "Choose legacy wallet profile" }) {
4316
4321
  const i = t ?? e?.body;
4317
4322
  if (!e?.createElement || !i?.append) throw new V("DOM_UNAVAILABLE");
4318
4323
  const r = e.createElement("section");
@@ -4333,7 +4338,7 @@ function _o({ document: e, mount: t = null, title: n = "Choose legacy wallet pro
4333
4338
  const D = e.createElement("option");
4334
4339
  D.value = v, D.textContent = k, v === "" && (D.disabled = !0, D.selected = !0), c.append(D);
4335
4340
  }
4336
- rt(e, o, "Legacy profile", c);
4341
+ it(e, o, "Legacy profile", c);
4337
4342
  const l = e.createElement("button");
4338
4343
  l.type = "submit", l.dataset.walletAction = "continue-legacy-login", l.textContent = "Continue";
4339
4344
  const d = e.createElement("button");
@@ -4365,13 +4370,13 @@ function _o({ document: e, mount: t = null, title: n = "Choose legacy wallet pro
4365
4370
  }
4366
4371
  return Object.freeze({ cancel: y, promise: A });
4367
4372
  }
4368
- function ft(e, t, n, i) {
4373
+ function dt(e, t, n, i) {
4369
4374
  const r = e.createElement("div"), s = e.createElement("strong");
4370
4375
  s.textContent = `${n}: `;
4371
4376
  const a = e.createElement("span");
4372
4377
  a.textContent = String(i ?? ""), r.append(s, a), t.append(r);
4373
4378
  }
4374
- function Ci(e, t, n, i = null) {
4379
+ function _i(e, t, n, i = null) {
4375
4380
  const r = i ?? e?.body, s = e.createElement("section");
4376
4381
  s.className = "wallet-complete";
4377
4382
  const a = e.createElement("h1");
@@ -4387,7 +4392,7 @@ function Ci(e, t, n, i = null) {
4387
4392
  }
4388
4393
  }), s.append(a, o, c), r?.replaceChildren?.(s);
4389
4394
  }
4390
- function _i(e, t = "The wallet request could not be completed. Close this window.", n = null) {
4395
+ function xi(e, t = "The wallet request could not be completed. Close this window.", n = null) {
4391
4396
  const i = n ?? e?.body;
4392
4397
  if (!e?.createElement || !i?.replaceChildren) return;
4393
4398
  const r = e.createElement("section");
@@ -4397,7 +4402,7 @@ function _i(e, t = "The wallet request could not be completed. Close this window
4397
4402
  const a = e.createElement("p");
4398
4403
  a.textContent = t, r.append(s, a), i.replaceChildren(r);
4399
4404
  }
4400
- function xo({
4405
+ function Do({
4401
4406
  clipboard: e,
4402
4407
  controller: t,
4403
4408
  document: n,
@@ -4410,7 +4415,7 @@ function xo({
4410
4415
  }) {
4411
4416
  const l = n.createElement("section");
4412
4417
  l.className = "wallet-account";
4413
- const d = n.createElement("div"), u = fs(d, i, { document: n }), p = n.createElement("section");
4418
+ const d = n.createElement("div"), u = ps(d, i, { document: n }), p = n.createElement("section");
4414
4419
  p.className = "wallet-approval-card";
4415
4420
  const f = n.createElement("h2");
4416
4421
  f.textContent = "Asset review approval";
@@ -4422,22 +4427,22 @@ function xo({
4422
4427
  m.type = "button", m.dataset.walletAction = "return-to-site", m.textContent = "Return to site";
4423
4428
  const $ = n.createElement("section");
4424
4429
  $.className = "wallet-legacy-migration";
4425
- const v = As($, { document: n });
4430
+ const v = bs($, { document: n });
4426
4431
  let k = !1;
4427
4432
  try {
4428
4433
  k = t.canForgetRememberedWallet?.() === !0;
4429
4434
  } catch {
4430
4435
  k = !1;
4431
4436
  }
4432
- const D = k ? n.createElement("section") : null, L = D ? ps(D, { document: n }) : null;
4437
+ const D = k ? n.createElement("section") : null, L = D ? hs(D, { document: n }) : null;
4433
4438
  L && (L.launch.dataset.walletAction = "forget-stored-wallet");
4434
- const q = Ni({
4439
+ const q = Ti({
4435
4440
  clipboard: e,
4436
4441
  controller: t,
4437
4442
  document: n
4438
4443
  }), O = n.createElement("p");
4439
4444
  O.className = "wallet-account-exit-status", l.append(d, p), D && l.append(D), q?.hasEntries && l.append(q.container), l.append(m, y, $), a.replaceChildren(l);
4440
- const F = new ms({
4445
+ const F = new gs({
4441
4446
  credentialRound: async (S) => {
4442
4447
  const j = s({
4443
4448
  controller: null,
@@ -4459,11 +4464,11 @@ function xo({
4459
4464
  const ce = (S) => !U && ne === S, J = (S) => {
4460
4465
  if (!ce(S)) throw new Error("account surface closed");
4461
4466
  }, Re = (S) => (S instanceof Uint8Array && re.add(S), S), Ue = (S) => {
4462
- Wn(S), re.delete(S);
4467
+ Fn(S), re.delete(S);
4463
4468
  }, We = () => {
4464
4469
  const S = [...re];
4465
4470
  re.clear();
4466
- for (const j of S) Wn(j);
4471
+ for (const j of S) Fn(j);
4467
4472
  }, Ie = () => {
4468
4473
  const S = Y || G || X;
4469
4474
  m.disabled = R, y.disabled = R, U || (h.disabled = S || !u.approvalAvailable, v.launch.disabled = S, L && (L.launch.disabled = S || K, L.confirm.disabled = S, L.cancel.disabled = S));
@@ -4488,7 +4493,7 @@ function xo({
4488
4493
  try {
4489
4494
  const fe = await F.confirm();
4490
4495
  J(j);
4491
- const Z = await ys(fe, {
4496
+ const Z = await ms(fe, {
4492
4497
  assertCurrent: () => J(j),
4493
4498
  clipboard: e,
4494
4499
  container: b,
@@ -4524,17 +4529,17 @@ function xo({
4524
4529
  const Ge = ee?.usernameControl?.value, yn = ee?.passwordControl?.value;
4525
4530
  if (!Bt(Ge) || !Bt(yn)) throw new Error("invalid legacy credentials");
4526
4531
  Ce = Re(jt.encode(Ge)), _t = Re(jt.encode(yn));
4527
- const mn = ee?.usernameControl?.form ?? ee?.passwordControl?.form ?? Z?.form, ki = mn?.parentNode;
4528
- Fe(mn, [ee?.usernameControl, ee?.passwordControl]), ki?.remove?.(), Dt = { passwordUtf8: _t, usernameUtf8: Ce };
4532
+ const mn = ee?.usernameControl?.form ?? ee?.passwordControl?.form ?? Z?.form, Ui = mn?.parentNode;
4533
+ Fe(mn, [ee?.usernameControl, ee?.passwordControl]), Ui?.remove?.(), Dt = { passwordUtf8: _t, usernameUtf8: Ce };
4529
4534
  } else {
4530
- Z = Ti({ document: n, mount: a }), w.add(Z);
4535
+ Z = Ci({ document: n, mount: a }), w.add(Z);
4531
4536
  const ee = await Z.promise;
4532
4537
  J(fe);
4533
4538
  const Ge = ee?.mnemonicControl?.value;
4534
4539
  if (!Bt(Ge)) throw new Error("invalid legacy credentials");
4535
4540
  xt = Re(jt.encode(Ge)), Fe(ee.form, [ee.mnemonicControl]), ee.section?.remove?.(), Dt = { mnemonicUtf8: xt };
4536
4541
  }
4537
- if (Z?.promise && w.delete(Z), de = await gs({
4542
+ if (Z?.promise && w.delete(Z), de = await As({
4538
4543
  accountIndex: 0,
4539
4544
  credentials: Dt,
4540
4545
  operation: "sdn.auth.raw-challenge.v1",
@@ -4543,14 +4548,14 @@ function xo({
4543
4548
  assertCurrent: () => J(fe),
4544
4549
  ownHandle: (ee) => z.add(ee)
4545
4550
  }), J(fe), !de?.handle) throw new Error("legacy derivation failed");
4546
- const xi = j === "password-fast-v1-legacy" ? "sdn-fast-password-auth-v1-legacy" : "sdn-bip39-auth-v1-legacy", ut = Array.isArray(de.identity?.keys) ? de.identity.keys.find((ee) => ee?.purpose === "sdn-authentication") : null;
4547
- if (de.identity?.identityScheme !== xi || de.identity?.seedProfile !== j || typeof de.identity?.accountXpub != "string" || !ut || typeof ut.publicKeyHex != "string" || !/^[0-9a-f]{64}$/u.test(ut.publicKeyHex))
4551
+ const Di = j === "password-fast-v1-legacy" ? "sdn-fast-password-auth-v1-legacy" : "sdn-bip39-auth-v1-legacy", lt = Array.isArray(de.identity?.keys) ? de.identity.keys.find((ee) => ee?.purpose === "sdn-authentication") : null;
4552
+ if (de.identity?.identityScheme !== Di || de.identity?.seedProfile !== j || typeof de.identity?.accountXpub != "string" || !lt || typeof lt.publicKeyHex != "string" || !/^[0-9a-f]{64}$/u.test(lt.publicKeyHex))
4548
4553
  throw new Error("legacy identity invalid");
4549
- const Di = de.identity;
4554
+ const Pi = de.identity;
4550
4555
  if (!je(de.handle)) throw new Error("legacy destruction failed");
4551
4556
  de = null, J(fe);
4552
- const Pi = i.keys.find((ee) => ee.purpose === "sdn-authentication");
4553
- v.result.replaceChildren(), ft(n, v.result, "Current account xpub", i.accountXpub), ft(n, v.result, "Legacy account xpub", Di.accountXpub), ft(n, v.result, "Current authentication key", Pi?.publicKeyHex), ft(n, v.result, "Legacy authentication key", ut.publicKeyHex);
4557
+ const ki = i.keys.find((ee) => ee.purpose === "sdn-authentication");
4558
+ v.result.replaceChildren(), dt(n, v.result, "Current account xpub", i.accountXpub), dt(n, v.result, "Legacy account xpub", Pi.accountXpub), dt(n, v.result, "Current authentication key", ki?.publicKeyHex), dt(n, v.result, "Legacy authentication key", lt.publicKeyHex);
4554
4559
  } catch {
4555
4560
  ce(fe) && (v.result.textContent = "Legacy account comparison could not be completed.");
4556
4561
  } finally {
@@ -4575,7 +4580,7 @@ function xo({
4575
4580
  } catch {
4576
4581
  }
4577
4582
  }
4578
- }, ct = (S) => {
4583
+ }, at = (S) => {
4579
4584
  !L || S?.isTrusted !== !0 || X || U || (Oe(), L.confirmationGroup.hidden = !0, L.status.textContent = "Forget cancelled.");
4580
4585
  }, Ne = (S) => {
4581
4586
  if (!L || S?.isTrusted !== !0 || Y || G || X || K || U) return;
@@ -4596,22 +4601,22 @@ function xo({
4596
4601
  if (U)
4597
4602
  We();
4598
4603
  else {
4599
- U = !0, ne += 1, h.disabled = !0, v.launch.disabled = !0, L && (L.launch.disabled = !0, L.confirm.disabled = !0, L.cancel.disabled = !0, Oe(), L.launch.removeEventListener?.("click", He), L.confirm.removeEventListener?.("click", Ne), L.cancel.removeEventListener?.("click", ct)), q?.destroy?.(), We(), h.removeEventListener?.("click", ze), v.launch.removeEventListener?.("click", ve);
4604
+ U = !0, ne += 1, h.disabled = !0, v.launch.disabled = !0, L && (L.launch.disabled = !0, L.confirm.disabled = !0, L.cancel.disabled = !0, Oe(), L.launch.removeEventListener?.("click", He), L.confirm.removeEventListener?.("click", Ne), L.cancel.removeEventListener?.("click", at)), q?.destroy?.(), We(), h.removeEventListener?.("click", ze), v.launch.removeEventListener?.("click", ve);
4600
4605
  for (const j of w) j.cancel?.();
4601
4606
  w.clear();
4602
4607
  }
4603
4608
  S && !se && (O.textContent = "Secure cleanup is still pending. Retry Return or Logout.", l.replaceChildren(O, m, y), m.disabled = !1, y.disabled = !1);
4604
- }, lt = () => {
4609
+ }, ct = () => {
4605
4610
  const S = F.destroy(), j = qe();
4606
4611
  return S && j && te === 0 && !G && !Y;
4607
- }, Te = () => (Ke(!1), se || (se = !0, m.disabled = !0, y.disabled = !0, m.removeEventListener?.("click", pn), y.removeEventListener?.("click", hn), l.remove?.()), lt()), Ct = (S, j, fe, { requireTrustedEvent: Z = !0 } = {}) => Z && S?.isTrusted !== !0 ? Promise.resolve() : H || (R || se ? Promise.reject(new V("STALE_CONTROLLER")) : (Ke(!0), lt() ? (R = !0, m.disabled = !0, y.disabled = !0, H = (async () => {
4608
- o(), Ci(n, null, fe, a);
4612
+ }, Te = () => (Ke(!1), se || (se = !0, m.disabled = !0, y.disabled = !0, m.removeEventListener?.("click", pn), y.removeEventListener?.("click", hn), l.remove?.()), ct()), Ct = (S, j, fe, { requireTrustedEvent: Z = !0 } = {}) => Z && S?.isTrusted !== !0 ? Promise.resolve() : H || (R || se ? Promise.reject(new V("STALE_CONTROLLER")) : (Ke(!0), ct() ? (R = !0, m.disabled = !0, y.disabled = !0, H = (async () => {
4613
+ o(), _i(n, null, fe, a);
4609
4614
  try {
4610
4615
  const Ce = await j();
4611
4616
  if (!r()) throw new V("STALE_CONTROLLER");
4612
4617
  return Ce;
4613
4618
  } catch (Ce) {
4614
- throw r() && _i(n, void 0, a), Ce;
4619
+ throw r() && xi(n, void 0, a), Ce;
4615
4620
  }
4616
4621
  })(), H) : (O.textContent = "Secure cleanup is still pending. Retry Return or Logout.", m.disabled = !1, y.disabled = !1, Promise.reject(new V("DESTRUCTION_FAILED"))))), pn = (S) => {
4617
4622
  Ct(
@@ -4628,7 +4633,7 @@ function xo({
4628
4633
  ).catch(() => {
4629
4634
  });
4630
4635
  };
4631
- return h.addEventListener("click", ze), v.launch.addEventListener("click", ve), L?.launch.addEventListener?.("click", He), L?.confirm.addEventListener?.("click", Ne), L?.cancel.addEventListener?.("click", ct), m.addEventListener("click", pn), y.addEventListener("click", hn), Object.freeze({
4636
+ return h.addEventListener("click", ze), v.launch.addEventListener("click", ve), L?.launch.addEventListener?.("click", He), L?.confirm.addEventListener?.("click", Ne), L?.cancel.addEventListener?.("click", at), m.addEventListener("click", pn), y.addEventListener("click", hn), Object.freeze({
4632
4637
  destroy: Te,
4633
4638
  logout: () => Ct(
4634
4639
  null,
@@ -4638,24 +4643,24 @@ function xo({
4638
4643
  )
4639
4644
  });
4640
4645
  }
4641
- function Do(e) {
4646
+ function Po(e) {
4642
4647
  const t = e?.pathname, n = e?.search ?? "", i = e?.hash ?? "";
4643
- if (typeof t != "string" || n !== "" || i !== "") throw qn();
4644
- const r = Oo.exec(t);
4645
- if (!r) throw qn();
4648
+ if (typeof t != "string" || n !== "" || i !== "") throw Wn();
4649
+ const r = No.exec(t);
4650
+ if (!r) throw Wn();
4646
4651
  return r[1];
4647
4652
  }
4648
- function Po(e) {
4649
- const t = e?.window ?? globalThis.window, n = e?.document ?? t?.document ?? globalThis.document, i = e?.mount ?? n?.body, r = typeof t?.fetch == "function" ? t.fetch.bind(t) : typeof globalThis.fetch == "function" ? globalThis.fetch.bind(globalThis) : null, s = e?.relay ?? (e?.controller ? null : io({
4653
+ function ko(e) {
4654
+ const t = e?.window ?? globalThis.window, n = e?.document ?? t?.document ?? globalThis.document, i = e?.mount ?? n?.body, r = typeof t?.fetch == "function" ? t.fetch.bind(t) : typeof globalThis.fetch == "function" ? globalThis.fetch.bind(globalThis) : null, s = e?.relay ?? (e?.controller ? null : ro({
4650
4655
  fetch: e?.fetch ?? r,
4651
4656
  location: e?.location ?? t?.location
4652
- })), a = e?.registry ?? To, o = e?.controller ?? new oo({
4657
+ })), a = e?.registry ?? Co, o = e?.controller ?? new ao({
4653
4658
  ...e,
4654
4659
  document: n,
4655
4660
  registry: a,
4656
4661
  relay: s,
4657
4662
  window: t
4658
- }), c = e?.credentialPrompt ?? ((w) => Co(w));
4663
+ }), c = e?.credentialPrompt ?? ((w) => _o(w));
4659
4664
  let l = null, d = null, u = null, p = null, f = null, A = [], b = 0, h = !1;
4660
4665
  const y = () => {
4661
4666
  (l?.destroy?.() ?? !0) && (l = null), d = null;
@@ -4698,14 +4703,14 @@ function Po(e) {
4698
4703
  const w = b;
4699
4704
  return h ? (p = Promise.reject(new V("STALE_CONTROLLER")), p) : (p = (async () => {
4700
4705
  try {
4701
- const z = Do(t?.location);
4706
+ const z = Po(t?.location);
4702
4707
  if (typeof o.prepare != "function" || typeof o.executePrepared != "function" || typeof o.unlockPassword != "function") {
4703
4708
  const U = await o.execute(z);
4704
4709
  return D(w), U;
4705
4710
  }
4706
4711
  const N = await o.prepare(z);
4707
4712
  if (D(w), N.transaction.operation === "sdn.auth.raw-challenge.v1") {
4708
- const U = _o({
4713
+ const U = xo({
4709
4714
  document: n,
4710
4715
  mount: i,
4711
4716
  title: `Choose the legacy profile for ${N.binding.clientDisplayName}`
@@ -4719,7 +4724,7 @@ function Po(e) {
4719
4724
  mount: i,
4720
4725
  title: `Sign in to ${N.binding.clientDisplayName}`,
4721
4726
  transaction: N
4722
- }) : Ti({
4727
+ }) : Ci({
4723
4728
  document: n,
4724
4729
  mount: i,
4725
4730
  submitLabel: "Continue",
@@ -4764,7 +4769,7 @@ function Po(e) {
4764
4769
  }
4765
4770
  }
4766
4771
  const Y = await o.executePrepared(N);
4767
- return D(w), L(u), N.transaction.operation === "sdn.wallet.account.v1" ? (d = o.copyPublicIdentity(), l = xo({
4772
+ return D(w), L(u), N.transaction.operation === "sdn.wallet.account.v1" ? (d = o.copyPublicIdentity(), l = Do({
4768
4773
  clipboard: e?.clipboard ?? globalThis.navigator?.clipboard,
4769
4774
  controller: o,
4770
4775
  document: n,
@@ -4774,7 +4779,7 @@ function Po(e) {
4774
4779
  mount: i,
4775
4780
  onClear: y,
4776
4781
  wasm: e?.wasm
4777
- })) : (d = null, n?.createElement && i?.replaceChildren && Ci(
4782
+ })) : (d = null, n?.createElement && i?.replaceChildren && _i(
4778
4783
  n,
4779
4784
  t,
4780
4785
  "The wallet request completed successfully.",
@@ -4782,7 +4787,7 @@ function Po(e) {
4782
4787
  )), Y;
4783
4788
  } catch (z) {
4784
4789
  const N = !k(w);
4785
- throw u?.cancel?.(), u = null, y(), F(), N || _i(n, z?.code === "USER_CANCELLED" ? "Cancelled. You may close this window." : void 0, i), await (f ?? o.destroy(N ? "stale-startup" : "startup-failure")), N && z?.code !== "DESTRUCTION_FAILED" ? new V("STALE_CONTROLLER") : z;
4790
+ throw u?.cancel?.(), u = null, y(), F(), N || xi(n, z?.code === "USER_CANCELLED" ? "Cancelled. You may close this window." : void 0, i), await (f ?? o.destroy(N ? "stale-startup" : "startup-failure")), N && z?.code !== "DESTRUCTION_FAILED" ? new V("STALE_CONTROLLER") : z;
4786
4791
  }
4787
4792
  })(), p);
4788
4793
  },
@@ -4793,13 +4798,13 @@ function Po(e) {
4793
4798
  }
4794
4799
  });
4795
4800
  }
4796
- async function Uo(e) {
4797
- const t = Po(e);
4801
+ async function jo(e) {
4802
+ const t = ko(e);
4798
4803
  return await t.start(), t;
4799
4804
  }
4800
4805
  export {
4801
- Co as createPasswordCredentialPrompt,
4802
- Po as createWalletOriginApp,
4803
- Uo as mountWalletOriginApp,
4804
- Do as transactionIdFromLocation
4806
+ _o as createPasswordCredentialPrompt,
4807
+ ko as createWalletOriginApp,
4808
+ jo as mountWalletOriginApp,
4809
+ Po as transactionIdFromLocation
4805
4810
  };