hd-wallet-ui 2.0.29 → 2.0.31

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,16 +1,16 @@
1
- const we = Object.freeze({
1
+ const Te = Object.freeze({
2
2
  cm: 0.01,
3
3
  km: 1e3,
4
4
  m: 1,
5
5
  mm: 1e-3
6
- }), ve = Object.freeze({
7
- metersPerSourceUnit: we,
6
+ }), Pe = Object.freeze({
7
+ metersPerSourceUnit: Te,
8
8
  quaternionNormTolerance: 1e-6,
9
9
  scaleComponentExclusiveMin: 0,
10
10
  scaleComponentInclusiveMax: 1e6,
11
11
  translationComponentAbsMax: 1e6,
12
12
  upAxes: Object.freeze(["X_UP", "Y_UP", "Z_UP"])
13
- }), Le = Object.freeze({ reviewedTransform: ve, schemaVersion: 1 }), B = new TextEncoder(), le = Object.getPrototypeOf(Uint8Array.prototype), _e = Object.getOwnPropertyDescriptor(le, "buffer").get, Ie = Object.getOwnPropertyDescriptor(le, "length").get, Te = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, G = typeof SharedArrayBuffer > "u" ? null : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get, v = "sdn-bip32-slip10-purpose-v1", U = "password-scrypt-v2", N = "ed25519-over-sha256-jcs-v1", ee = "ed25519-raw-32-v1", W = "sdn-login:sdn.spaceaware.io", xe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, P = /^[0-9a-f]{64}$/u, ue = /^[0-9a-f]{128}$/u, F = /^sha256:[0-9a-f]{64}$/u, Ce = /^[1-9A-HJ-NP-Za-km-z]+$/u, he = 131072, Ne = [
13
+ }), xe = Object.freeze({ reviewedTransform: Pe, schemaVersion: 1 }), C = new TextEncoder(), ye = Object.getPrototypeOf(Uint8Array.prototype), Ne = Object.getOwnPropertyDescriptor(ye, "buffer").get, Ce = Object.getOwnPropertyDescriptor(ye, "length").get, De = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, re = typeof SharedArrayBuffer > "u" ? null : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get, v = "sdn-bip32-slip10-purpose-v1", q = "password-scrypt-v2", D = "ed25519-over-sha256-jcs-v1", ie = "ed25519-raw-32-v1", ke = "ed25519-sdn-signed-request-v2", ne = ["protocolVersion", "providerOrigin", "method", "requestUri", "bodySha256", "bodyBytes", "schema", "entityId", "entityName", "documentCount"], se = ["schemaVersion", "keyId", "identityScheme", "algorithm", "encoding", "signatureProfile", "publicKeyHex", "signatureHex", "requestDigestSha256", "challengeId", "challengeBase64url"], z = "sdn-login:sdn.spaceaware.io", je = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, L = /^[0-9a-f]{64}$/u, K = /^[0-9a-f]{128}$/u, j = /^sha256:[0-9a-f]{64}$/u, Ve = /^[1-9A-HJ-NP-Za-km-z]+$/u, pe = 131072, $e = [
14
14
  "accountFingerprint",
15
15
  "accountIndex",
16
16
  "accountLabel",
@@ -20,7 +20,7 @@ const we = Object.freeze({
20
20
  "keys",
21
21
  "schemaVersion",
22
22
  "seedProfile"
23
- ], Pe = [
23
+ ], Me = [
24
24
  "bip32Fingerprint",
25
25
  "curve",
26
26
  "derivation",
@@ -32,12 +32,12 @@ const we = Object.freeze({
32
32
  "purpose",
33
33
  "seedProfile",
34
34
  "signatureProfile"
35
- ], De = [
35
+ ], Be = [
36
36
  "connectionExpiresAt",
37
37
  "event",
38
38
  "identity",
39
39
  "schemaVersion"
40
- ], je = [
40
+ ], Ye = [
41
41
  "algorithm",
42
42
  "encoding",
43
43
  "identityScheme",
@@ -45,7 +45,7 @@ const we = Object.freeze({
45
45
  "schemaVersion",
46
46
  "signatureHex",
47
47
  "signatureProfile"
48
- ], ke = [
48
+ ], Ue = [
49
49
  "algorithm",
50
50
  "canonicalEnvelope",
51
51
  "encoding",
@@ -56,34 +56,34 @@ const we = Object.freeze({
56
56
  "signatureProfile",
57
57
  "signedDigestSha256"
58
58
  ];
59
- function a(r) {
59
+ function c(r) {
60
60
  throw new TypeError(r);
61
61
  }
62
- function z(r) {
62
+ function X(r) {
63
63
  if (r === null || typeof r != "object" || Array.isArray(r)) return !1;
64
64
  const e = Object.getPrototypeOf(r);
65
65
  return e === Object.prototype || e === null;
66
66
  }
67
- function w(r, e) {
68
- typeof r != "string" && a(`${e} must be a string`);
67
+ function g(r, e) {
68
+ typeof r != "string" && c(`${e} must be a string`);
69
69
  for (let t = 0; t < r.length; t += 1) {
70
- const n = r.charCodeAt(t);
71
- let i = n;
72
- if (n >= 55296 && n <= 56319) {
70
+ const i = r.charCodeAt(t);
71
+ let n = i;
72
+ if (i >= 55296 && i <= 56319) {
73
73
  const o = r.charCodeAt(t + 1);
74
- o >= 56320 && o <= 57343 || a(`${e} contains an unpaired surrogate`), i = 65536 + (n - 55296 << 10) + (o - 56320), t += 1;
75
- } else n >= 56320 && n <= 57343 && a(`${e} contains an unpaired surrogate`);
76
- ((i & 65535) === 65534 || (i & 65535) === 65535 || i >= 64976 && i <= 65007) && a(`${e} contains a Unicode noncharacter`);
74
+ o >= 56320 && o <= 57343 || c(`${e} contains an unpaired surrogate`), n = 65536 + (i - 55296 << 10) + (o - 56320), t += 1;
75
+ } else i >= 56320 && i <= 57343 && c(`${e} contains an unpaired surrogate`);
76
+ ((n & 65535) === 65534 || (n & 65535) === 65535 || n >= 64976 && n <= 65007) && c(`${e} contains a Unicode noncharacter`);
77
77
  }
78
78
  return r;
79
79
  }
80
- function fe(r) {
81
- typeof r != "string" && a("wire JSON must be a string"), B.encode(r).byteLength > he && a("wire JSON is too large"), r.charCodeAt(0) === 65279 && a("wire JSON must not contain a BOM");
80
+ function me(r) {
81
+ typeof r != "string" && c("wire JSON must be a string"), C.encode(r).byteLength > pe && c("wire JSON is too large"), r.charCodeAt(0) === 65279 && c("wire JSON must not contain a BOM");
82
82
  let e = 0, t = 0;
83
- const n = () => {
83
+ const i = () => {
84
84
  for (; e < r.length && /[\u0009\u000a\u000d\u0020]/u.test(r[e]); ) e += 1;
85
- }, i = () => {
86
- r[e] !== '"' && a("invalid JSON string");
85
+ }, n = () => {
86
+ r[e] !== '"' && c("invalid JSON string");
87
87
  const u = e;
88
88
  for (e += 1; e < r.length; ) {
89
89
  const l = r.charCodeAt(e);
@@ -93,194 +93,194 @@ function fe(r) {
93
93
  try {
94
94
  f = JSON.parse(r.slice(u, e));
95
95
  } catch {
96
- a("invalid JSON string");
96
+ c("invalid JSON string");
97
97
  }
98
- return w(f, "JSON string");
98
+ return g(f, "JSON string");
99
99
  }
100
- l < 32 && a("invalid JSON control character"), l === 92 && (e += 1, e >= r.length && a("unterminated JSON escape")), e += 1;
100
+ l < 32 && c("invalid JSON control character"), l === 92 && (e += 1, e >= r.length && c("unterminated JSON escape")), e += 1;
101
101
  }
102
- a("unterminated JSON string");
102
+ c("unterminated JSON string");
103
103
  }, o = (u = 0) => {
104
- u > 32 && a("wire JSON nesting is too deep"), t += 1, t > 4096 && a("wire JSON contains too many values"), n();
104
+ u > 32 && c("wire JSON nesting is too deep"), t += 1, t > 4096 && c("wire JSON contains too many values"), i();
105
105
  const l = r[e];
106
- if (l === '"') return i();
106
+ if (l === '"') return n();
107
107
  if (l === "{") {
108
108
  e += 1;
109
- const d = /* @__PURE__ */ Object.create(null), p = /* @__PURE__ */ new Set();
110
- if (n(), r[e] === "}")
111
- return e += 1, d;
109
+ const y = /* @__PURE__ */ Object.create(null), p = /* @__PURE__ */ new Set();
110
+ if (i(), r[e] === "}")
111
+ return e += 1, y;
112
112
  for (; e < r.length; ) {
113
- n();
114
- const m = i();
115
- if (p.has(m) && a(`duplicate JSON field: ${m}`), p.add(m), n(), r[e] !== ":" && a("missing JSON object colon"), e += 1, d[m] = o(u + 1), n(), r[e] === "}")
116
- return e += 1, d;
117
- r[e] !== "," && a("invalid JSON object separator"), e += 1;
113
+ i();
114
+ const R = n();
115
+ if (p.has(R) && c(`duplicate JSON field: ${R}`), p.add(R), i(), r[e] !== ":" && c("missing JSON object colon"), e += 1, y[R] = o(u + 1), i(), r[e] === "}")
116
+ return e += 1, y;
117
+ r[e] !== "," && c("invalid JSON object separator"), e += 1;
118
118
  }
119
- a("unterminated JSON object");
119
+ c("unterminated JSON object");
120
120
  }
121
121
  if (l === "[") {
122
122
  e += 1;
123
- const d = [];
124
- if (n(), r[e] === "]")
125
- return e += 1, d;
123
+ const y = [];
124
+ if (i(), r[e] === "]")
125
+ return e += 1, y;
126
126
  for (; e < r.length; ) {
127
- if (d.push(o(u + 1)), n(), r[e] === "]")
128
- return e += 1, d;
129
- r[e] !== "," && a("invalid JSON array separator"), e += 1;
127
+ if (y.push(o(u + 1)), i(), r[e] === "]")
128
+ return e += 1, y;
129
+ r[e] !== "," && c("invalid JSON array separator"), e += 1;
130
130
  }
131
- a("unterminated JSON array");
131
+ c("unterminated JSON array");
132
132
  }
133
- for (const [d, p] of [["true", !0], ["false", !1], ["null", null]])
134
- if (r.startsWith(d, e))
135
- return e += d.length, p;
133
+ for (const [y, p] of [["true", !0], ["false", !1], ["null", null]])
134
+ if (r.startsWith(y, e))
135
+ return e += y.length, p;
136
136
  const f = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/u.exec(r.slice(e));
137
- f || a("invalid JSON value"), e += f[0].length;
137
+ f || c("invalid JSON value"), e += f[0].length;
138
138
  const h = Number(f[0]);
139
- return Number.isFinite(h) || a("wire JSON number must be finite"), h;
139
+ return Number.isFinite(h) || c("wire JSON number must be finite"), h;
140
140
  };
141
- n();
141
+ i();
142
142
  const s = o();
143
- return n(), e !== r.length && a("wire JSON contains trailing bytes"), s;
143
+ return i(), e !== r.length && c("wire JSON contains trailing bytes"), s;
144
144
  }
145
- function Ve(r) {
146
- return typeof r == "string" ? fe(r) : r;
145
+ function qe(r) {
146
+ return typeof r == "string" ? me(r) : r;
147
147
  }
148
- function $e(r, e) {
148
+ function Fe(r, e) {
149
149
  if (r.byteLength !== e.byteLength) return !1;
150
150
  let t = 0;
151
- for (let n = 0; n < r.byteLength; n += 1) t |= r[n] ^ e[n];
151
+ for (let i = 0; i < r.byteLength; i += 1) t |= r[i] ^ e[i];
152
152
  return t === 0;
153
153
  }
154
- function R(r, e, t) {
155
- const n = Ve(r);
156
- z(n) || a(`${t} must be a JSON object`), Object.getOwnPropertySymbols(n).length !== 0 && a(`${t} has an unknown symbol field`);
157
- const i = Object.getOwnPropertyNames(n).sort(), o = [...e].sort(), s = B.encode(i.join("\0")), u = B.encode(o.join("\0"));
158
- $e(s, u) || a(`${t} has missing or unknown fields`);
159
- for (const l of i) {
160
- const f = Object.getOwnPropertyDescriptor(n, l);
161
- (!f || !f.enumerable || !("value" in f)) && a(`${t}.${l} must be an enumerable data field`), f.value === void 0 && a(`${t}.${l} must not be undefined`);
154
+ function b(r, e, t) {
155
+ const i = qe(r);
156
+ X(i) || c(`${t} must be a JSON object`), Object.getOwnPropertySymbols(i).length !== 0 && c(`${t} has an unknown symbol field`);
157
+ const n = Object.getOwnPropertyNames(i).sort(), o = [...e].sort(), s = C.encode(n.join("\0")), u = C.encode(o.join("\0"));
158
+ Fe(s, u) || c(`${t} has missing or unknown fields`);
159
+ for (const l of n) {
160
+ const f = Object.getOwnPropertyDescriptor(i, l);
161
+ (!f || !f.enumerable || !("value" in f)) && c(`${t}.${l} must be an enumerable data field`), f.value === void 0 && c(`${t}.${l} must not be undefined`);
162
162
  }
163
- return n;
163
+ return i;
164
164
  }
165
165
  function J(r) {
166
166
  if (!r || typeof r != "object" || Object.isFrozen(r)) return r;
167
167
  for (const e of Object.values(r)) J(e);
168
168
  return Object.freeze(r);
169
169
  }
170
- function g(r) {
170
+ function A(r) {
171
171
  return J(Object.fromEntries([...r].sort(([e], [t]) => e < t ? -1 : e > t ? 1 : 0)));
172
172
  }
173
- function de(r, e, t) {
174
- (!Array.isArray(r) || Object.getPrototypeOf(r) !== Array.prototype || r.length !== e) && a(`${t} must be a plain array with exactly ${e} values`);
175
- const n = [...Array.from({ length: e }, (o, s) => String(s)), "length"], i = Reflect.ownKeys(r);
176
- (i.length !== n.length || i.some((o, s) => o !== n[s])) && a(`${t} must be a dense plain array`);
173
+ function Re(r, e, t) {
174
+ (!Array.isArray(r) || Object.getPrototypeOf(r) !== Array.prototype || r.length !== e) && c(`${t} must be a plain array with exactly ${e} values`);
175
+ const i = [...Array.from({ length: e }, (o, s) => String(s)), "length"], n = Reflect.ownKeys(r);
176
+ (n.length !== i.length || n.some((o, s) => o !== i[s])) && c(`${t} must be a dense plain array`);
177
177
  for (let o = 0; o < e; o += 1) {
178
178
  const s = Object.getOwnPropertyDescriptor(r, String(o));
179
- (!s || !s.enumerable || !("value" in s) || s.value === void 0) && a(`${t} must contain enumerable data values`);
179
+ (!s || !s.enumerable || !("value" in s) || s.value === void 0) && c(`${t} must contain enumerable data values`);
180
180
  }
181
181
  }
182
- function Me(r) {
183
- const e = R(
182
+ function Je(r) {
183
+ const e = b(
184
184
  r,
185
185
  ["reviewedTransform", "schemaVersion"],
186
186
  "asset review protocol policy"
187
187
  );
188
- y(e.schemaVersion, 1, "asset review protocol schemaVersion");
189
- const t = R(e.reviewedTransform, [
188
+ d(e.schemaVersion, 1, "asset review protocol schemaVersion");
189
+ const t = b(e.reviewedTransform, [
190
190
  "metersPerSourceUnit",
191
191
  "quaternionNormTolerance",
192
192
  "scaleComponentExclusiveMin",
193
193
  "scaleComponentInclusiveMax",
194
194
  "translationComponentAbsMax",
195
195
  "upAxes"
196
- ], "asset review transform policy"), n = R(
196
+ ], "asset review transform policy"), i = b(
197
197
  t.metersPerSourceUnit,
198
198
  ["cm", "km", "m", "mm"],
199
199
  "asset review unit policy"
200
200
  );
201
- for (const [i, o] of Object.entries(n))
202
- (typeof o != "number" || !Number.isFinite(o) || o <= 0) && a(`asset review unit policy ${i} must be positive and finite`);
203
- for (const [i, o] of [
201
+ for (const [n, o] of Object.entries(i))
202
+ (typeof o != "number" || !Number.isFinite(o) || o <= 0) && c(`asset review unit policy ${n} must be positive and finite`);
203
+ for (const [n, o] of [
204
204
  ["quaternionNormTolerance", t.quaternionNormTolerance],
205
205
  ["scaleComponentExclusiveMin", t.scaleComponentExclusiveMin],
206
206
  ["scaleComponentInclusiveMax", t.scaleComponentInclusiveMax],
207
207
  ["translationComponentAbsMax", t.translationComponentAbsMax]
208
208
  ])
209
- (typeof o != "number" || !Number.isFinite(o)) && a(`asset review transform policy ${i} must be finite`);
210
- return (t.quaternionNormTolerance <= 0 || t.scaleComponentInclusiveMax <= t.scaleComponentExclusiveMin || t.translationComponentAbsMax <= 0) && a("asset review transform policy bounds are inconsistent"), de(t.upAxes, 3, "asset review up-axis policy"), t.upAxes.join("\0") !== "X_UP\0Y_UP\0Z_UP" && a("asset review up-axis policy is invalid"), g([
211
- ["metersPerSourceUnit", g(Object.entries(n))],
209
+ (typeof o != "number" || !Number.isFinite(o)) && c(`asset review transform policy ${n} must be finite`);
210
+ return (t.quaternionNormTolerance <= 0 || t.scaleComponentInclusiveMax <= t.scaleComponentExclusiveMin || t.translationComponentAbsMax <= 0) && c("asset review transform policy bounds are inconsistent"), Re(t.upAxes, 3, "asset review up-axis policy"), t.upAxes.join("\0") !== "X_UP\0Y_UP\0Z_UP" && c("asset review up-axis policy is invalid"), A([
211
+ ["metersPerSourceUnit", A(Object.entries(i))],
212
212
  ["quaternionNormTolerance", t.quaternionNormTolerance],
213
213
  ["scaleComponentExclusiveMin", t.scaleComponentExclusiveMin],
214
214
  ["scaleComponentInclusiveMax", t.scaleComponentInclusiveMax],
215
215
  ["translationComponentAbsMax", t.translationComponentAbsMax],
216
- ["upAxes", Object.freeze(Array.from({ length: 3 }, (i, o) => t.upAxes[o]))]
216
+ ["upAxes", Object.freeze(Array.from({ length: 3 }, (n, o) => t.upAxes[o]))]
217
217
  ]);
218
218
  }
219
- Me(Le);
220
- function y(r, e, t) {
221
- return r !== e && a(`${t} must equal ${JSON.stringify(e)}`), r;
219
+ Je(xe);
220
+ function d(r, e, t) {
221
+ return r !== e && c(`${t} must equal ${JSON.stringify(e)}`), r;
222
222
  }
223
- function ye(r, e, t) {
224
- return e.includes(r) || a(`${t} is not an allowed value`), r;
223
+ function F(r, e, t) {
224
+ return e.includes(r) || c(`${t} is not an allowed value`), r;
225
225
  }
226
- function A(r, e, t) {
227
- return w(r, t), e.test(r) || a(`${t} has an invalid encoding`), r;
226
+ function m(r, e, t) {
227
+ return g(r, t), e.test(r) || c(`${t} has an invalid encoding`), r;
228
228
  }
229
- function D(r, e) {
230
- return w(r, e), (!xe.test(r) || new Date(r).toISOString() !== r) && a(`${e} must be exact RFC3339 milliseconds UTC`), r;
229
+ function k(r, e) {
230
+ return g(r, e), (!je.test(r) || new Date(r).toISOString() !== r) && c(`${e} must be exact RFC3339 milliseconds UTC`), r;
231
231
  }
232
- function pe(r, e) {
233
- const t = Date.parse(r), n = Date.parse(e);
234
- n > t && n - t <= 3e5 || a("request lifetime must be in (0, 300] seconds");
232
+ function be(r, e) {
233
+ const t = Date.parse(r), i = Date.parse(e);
234
+ i > t && i - t <= 3e5 || c("request lifetime must be in (0, 300] seconds");
235
235
  }
236
- function H(r, e) {
237
- (!ArrayBuffer.isView(r) || !(r instanceof Uint8Array) || Object.getPrototypeOf(r) !== Uint8Array.prototype) && a(`${e} must be a plain Uint8Array`), Ie.call(r) !== 32 && a(`${e} must be exactly 32 bytes`);
238
- const n = Array.from({ length: 32 }, (h, d) => String(d)), i = Reflect.ownKeys(r);
239
- (i.length !== n.length || i.some((h, d) => h !== n[d])) && a(`${e} Uint8Array must contain only 32 indexed bytes`);
240
- const o = _e.call(r);
236
+ function Q(r, e) {
237
+ (!ArrayBuffer.isView(r) || !(r instanceof Uint8Array) || Object.getPrototypeOf(r) !== Uint8Array.prototype) && c(`${e} must be a plain Uint8Array`), Ce.call(r) !== 32 && c(`${e} must be exactly 32 bytes`);
238
+ const i = Array.from({ length: 32 }, (h, y) => String(y)), n = Reflect.ownKeys(r);
239
+ (n.length !== i.length || n.some((h, y) => h !== i[y])) && c(`${e} Uint8Array must contain only 32 indexed bytes`);
240
+ const o = Ne.call(r);
241
241
  let s = !1;
242
- if (G)
242
+ if (re)
243
243
  try {
244
- G.call(o), s = !0;
244
+ re.call(o), s = !0;
245
245
  } catch {
246
246
  s = !1;
247
247
  }
248
- s && a(`${e} must not use SharedArrayBuffer storage`);
248
+ s && c(`${e} must not use SharedArrayBuffer storage`);
249
249
  try {
250
- Te.call(o);
250
+ De.call(o);
251
251
  } catch {
252
- a(`${e} must use ArrayBuffer storage`);
252
+ c(`${e} must use ArrayBuffer storage`);
253
253
  }
254
254
  const u = new Uint8Array(32);
255
255
  for (let h = 0; h < 32; h += 1) {
256
- const d = Object.getOwnPropertyDescriptor(r, String(h));
257
- (!d || !d.enumerable || !("value" in d) || !Number.isInteger(d.value) || d.value < 0 || d.value > 255) && a(`${e} Uint8Array contains an invalid indexed byte`), u[h] = r[h];
256
+ const y = Object.getOwnPropertyDescriptor(r, String(h));
257
+ (!y || !y.enumerable || !("value" in y) || !Number.isInteger(y.value) || y.value < 0 || y.value > 255) && c(`${e} Uint8Array contains an invalid indexed byte`), u[h] = r[h];
258
258
  }
259
259
  let l = "";
260
260
  for (let h = 0; h < 32; h += 1) l += String.fromCharCode(u[h]);
261
261
  const f = globalThis.btoa(l).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/gu, "");
262
- return f.length !== 43 && a(`${e} did not encode to 43 base64url characters`), f;
262
+ return f.length !== 43 && c(`${e} did not encode to 43 base64url characters`), f;
263
263
  }
264
- function me(r, e) {
265
- w(r, e), /^[A-Za-z0-9_-]{43}$/u.test(r) || a(`${e} must be canonical unpadded base64url`);
264
+ function Z(r, e) {
265
+ g(r, e), /^[A-Za-z0-9_-]{43}$/u.test(r) || c(`${e} must be canonical unpadded base64url`);
266
266
  let t;
267
267
  try {
268
268
  t = globalThis.atob(`${r.replace(/-/gu, "+").replace(/_/gu, "/")}=`);
269
269
  } catch {
270
- a(`${e} must be valid base64url`);
270
+ c(`${e} must be valid base64url`);
271
271
  }
272
- const n = Uint8Array.from(t, (i) => i.charCodeAt(0));
273
- return (n.byteLength !== 32 || H(n, e) !== r) && a(`${e} must canonically encode exactly 32 bytes`), r;
272
+ const i = Uint8Array.from(t, (n) => n.charCodeAt(0));
273
+ return (i.byteLength !== 32 || Q(i, e) !== r) && c(`${e} must canonically encode exactly 32 bytes`), r;
274
274
  }
275
- function K(r) {
276
- return r === null || typeof r == "boolean" ? JSON.stringify(r) : typeof r == "string" ? (w(r, "canonical JSON string"), JSON.stringify(r)) : typeof r == "number" ? (Number.isFinite(r) || a("canonical JSON numbers must be finite"), JSON.stringify(r)) : Array.isArray(r) ? `[${r.map(K).join(",")}]` : (z(r) || a("canonical JSON contains an unsupported value"), `{${Object.keys(r).sort().map((e) => `${JSON.stringify(e)}:${K(r[e])}`).join(",")}}`);
275
+ function W(r) {
276
+ return r === null || typeof r == "boolean" ? JSON.stringify(r) : typeof r == "string" ? (g(r, "canonical JSON string"), JSON.stringify(r)) : typeof r == "number" ? (Number.isFinite(r) || c("canonical JSON numbers must be finite"), JSON.stringify(r)) : Array.isArray(r) ? `[${r.map(W).join(",")}]` : (X(r) || c("canonical JSON contains an unsupported value"), `{${Object.keys(r).sort().map((e) => `${JSON.stringify(e)}:${W(r[e])}`).join(",")}}`);
277
277
  }
278
- function Ye(r, e) {
278
+ function He(r, e) {
279
279
  for (const t of ["identityScheme", "keyId", "signatureProfile"])
280
- r[t] !== e[t] && a(`canonicalEnvelope ${t} must match the signature result`);
280
+ r[t] !== e[t] && c(`canonicalEnvelope ${t} must match the signature result`);
281
281
  }
282
- function Be(r, e) {
283
- const n = R(r, [
282
+ function ze(r, e) {
283
+ const i = b(r, [
284
284
  "audience",
285
285
  "challengeSha256",
286
286
  "clientId",
@@ -294,16 +294,16 @@ function Be(r, e) {
294
294
  "requestOrigin",
295
295
  "signatureProfile"
296
296
  ], "SDN login canonicalEnvelope");
297
- Ye(n, e), y(n.audience, W, "SDN login envelope audience"), A(n.challengeSha256, P, "SDN login envelope challengeSha256"), y(n.clientId, "sdn-node-console-v1", "SDN login envelope clientId"), D(n.issuedAt, "SDN login envelope issuedAt"), D(n.expiresAt, "SDN login envelope expiresAt"), pe(n.issuedAt, n.expiresAt), y(n.identityScheme, v, "SDN login envelope identityScheme"), A(n.keyId, F, "SDN login envelope keyId"), y(n.kind, "sdn-login", "SDN login envelope kind"), A(n.nonce, P, "SDN login envelope nonce"), y(n.protocolVersion, 2, "SDN login envelope protocolVersion"), y(n.requestOrigin, "https://sdn.spaceaware.io", "SDN login envelope requestOrigin"), y(n.signatureProfile, N, "SDN login envelope signatureProfile");
297
+ He(i, e), d(i.audience, z, "SDN login envelope audience"), m(i.challengeSha256, L, "SDN login envelope challengeSha256"), d(i.clientId, "sdn-node-console-v1", "SDN login envelope clientId"), k(i.issuedAt, "SDN login envelope issuedAt"), k(i.expiresAt, "SDN login envelope expiresAt"), be(i.issuedAt, i.expiresAt), d(i.identityScheme, v, "SDN login envelope identityScheme"), m(i.keyId, j, "SDN login envelope keyId"), d(i.kind, "sdn-login", "SDN login envelope kind"), m(i.nonce, L, "SDN login envelope nonce"), d(i.protocolVersion, 2, "SDN login envelope protocolVersion"), d(i.requestOrigin, "https://sdn.spaceaware.io", "SDN login envelope requestOrigin"), d(i.signatureProfile, D, "SDN login envelope signatureProfile");
298
298
  }
299
- function Ue(r, e, t) {
300
- w(r, "canonicalEnvelope"), B.encode(r).byteLength > he && a("canonicalEnvelope is too large");
301
- const n = fe(r);
302
- return (!z(n) || n.kind !== e) && a("canonicalEnvelope kind does not match the operation"), K(n) !== r && a("canonicalEnvelope must be exact JCS"), Be(n, t), r;
299
+ function We(r, e, t) {
300
+ g(r, "canonicalEnvelope"), C.encode(r).byteLength > pe && c("canonicalEnvelope is too large");
301
+ const i = me(r);
302
+ return (!X(i) || i.kind !== e) && c("canonicalEnvelope kind does not match the operation"), W(i) !== r && c("canonicalEnvelope must be exact JCS"), ze(i, t), r;
303
303
  }
304
- function Fe(r, e) {
305
- const t = R(r, Pe, `identity key ${e.purpose}`);
306
- return y(t.purpose, e.purpose, "key purpose"), y(t.identityScheme, v, "key identityScheme"), y(t.seedProfile, U, "key seedProfile"), y(t.signatureProfile, e.signatureProfile, "key signatureProfile"), y(t.curve, e.curve, "key curve"), y(t.derivation, "slip10", "key derivation"), y(t.path, e.path, "key path"), y(t.encoding, "raw", "key encoding"), A(t.publicKeyHex, P, "key publicKeyHex"), y(t.bip32Fingerprint, null, "key bip32Fingerprint"), A(t.keyId, F, "key keyId"), g([
304
+ function Ke(r, e) {
305
+ const t = b(r, Me, `identity key ${e.purpose}`);
306
+ return d(t.purpose, e.purpose, "key purpose"), d(t.identityScheme, v, "key identityScheme"), d(t.seedProfile, q, "key seedProfile"), d(t.signatureProfile, e.signatureProfile, "key signatureProfile"), d(t.curve, e.curve, "key curve"), d(t.derivation, "slip10", "key derivation"), d(t.path, e.path, "key path"), d(t.encoding, "raw", "key encoding"), m(t.publicKeyHex, L, "key publicKeyHex"), d(t.bip32Fingerprint, null, "key bip32Fingerprint"), m(t.keyId, j, "key keyId"), A([
307
307
  ["bip32Fingerprint", null],
308
308
  ["curve", t.curve],
309
309
  ["derivation", "slip10"],
@@ -313,18 +313,18 @@ function Fe(r, e) {
313
313
  ["path", t.path],
314
314
  ["publicKeyHex", t.publicKeyHex],
315
315
  ["purpose", t.purpose],
316
- ["seedProfile", U],
316
+ ["seedProfile", q],
317
317
  ["signatureProfile", t.signatureProfile]
318
318
  ]);
319
319
  }
320
- function Je(r) {
321
- const e = R(r, Ne, "WalletPublicIdentity");
322
- y(e.schemaVersion, 1, "identity schemaVersion"), y(e.identityScheme, v, "identity identityScheme"), y(e.seedProfile, U, "identity seedProfile"), e.accountIndex !== 0 && a("public wallet identity must use account 0"), y(e.accountLabel, null, "identity accountLabel"), w(e.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(e.accountXpub) || a("identity accountXpub is invalid"), w(e.accountPeerId, "identity accountPeerId"), (!e.accountPeerId.startsWith("16Uiu2H") || e.accountPeerId.length < 40 || e.accountPeerId.length > 64 || !Ce.test(e.accountPeerId)) && a("identity accountPeerId is invalid"), A(e.accountFingerprint, /^[0-9a-f]{8}$/u, "identity accountFingerprint"), de(e.keys, 3, "public identity keys array");
320
+ function Xe(r) {
321
+ const e = b(r, $e, "WalletPublicIdentity");
322
+ d(e.schemaVersion, 1, "identity schemaVersion"), d(e.identityScheme, v, "identity identityScheme"), d(e.seedProfile, q, "identity seedProfile"), e.accountIndex !== 0 && c("public wallet identity must use account 0"), d(e.accountLabel, null, "identity accountLabel"), g(e.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(e.accountXpub) || c("identity accountXpub is invalid"), g(e.accountPeerId, "identity accountPeerId"), (!e.accountPeerId.startsWith("16Uiu2H") || e.accountPeerId.length < 40 || e.accountPeerId.length > 64 || !Ve.test(e.accountPeerId)) && c("identity accountPeerId is invalid"), m(e.accountFingerprint, /^[0-9a-f]{8}$/u, "identity accountFingerprint"), Re(e.keys, 3, "public identity keys array");
323
323
  const t = [
324
324
  {
325
325
  purpose: "asset-review-approval",
326
326
  curve: "ed25519",
327
- signatureProfile: N,
327
+ signatureProfile: D,
328
328
  path: "m/44'/0'/0'/2'/0'"
329
329
  },
330
330
  {
@@ -336,54 +336,54 @@ function Je(r) {
336
336
  {
337
337
  purpose: "sdn-authentication",
338
338
  curve: "ed25519",
339
- signatureProfile: N,
339
+ signatureProfile: D,
340
340
  path: "m/44'/0'/0'/0'/0'"
341
341
  }
342
- ], n = Array.from(
342
+ ], i = Array.from(
343
343
  { length: 3 },
344
- (i, o) => Fe(e.keys[o], t[o])
344
+ (n, o) => Ke(e.keys[o], t[o])
345
345
  );
346
- return g([
346
+ return A([
347
347
  ["accountFingerprint", e.accountFingerprint],
348
348
  ["accountIndex", 0],
349
349
  ["accountLabel", null],
350
350
  ["accountPeerId", e.accountPeerId],
351
351
  ["accountXpub", e.accountXpub],
352
352
  ["identityScheme", v],
353
- ["keys", J(n)],
353
+ ["keys", J(i)],
354
354
  ["schemaVersion", 1],
355
- ["seedProfile", U]
355
+ ["seedProfile", q]
356
356
  ]);
357
357
  }
358
- function Re(r, e) {
359
- const t = R(r, De, `${e} result`);
360
- y(t.schemaVersion, 1, "connection result schemaVersion"), ye(t.event, ["connected", "disconnected"], "connection event"), e === "connect" && t.event !== "connected" && a("connect result must be connected");
361
- let n = null, i = null;
362
- return t.event === "connected" ? (n = Je(t.identity), i = D(t.connectionExpiresAt, "connectionExpiresAt")) : (t.identity !== null || t.connectionExpiresAt !== null) && a("disconnected result must clear identity and expiry"), g([
363
- ["connectionExpiresAt", i],
358
+ function Ee(r, e) {
359
+ const t = b(r, Be, `${e} result`);
360
+ d(t.schemaVersion, 1, "connection result schemaVersion"), F(t.event, ["connected", "disconnected"], "connection event"), e === "connect" && t.event !== "connected" && c("connect result must be connected");
361
+ let i = null, n = null;
362
+ return t.event === "connected" ? (i = Xe(t.identity), n = k(t.connectionExpiresAt, "connectionExpiresAt")) : (t.identity !== null || t.connectionExpiresAt !== null) && c("disconnected result must clear identity and expiry"), A([
363
+ ["connectionExpiresAt", n],
364
364
  ["event", t.event],
365
- ["identity", n],
365
+ ["identity", i],
366
366
  ["schemaVersion", 1]
367
367
  ]);
368
368
  }
369
- function qe(r) {
370
- const e = R(r, je, "raw signature");
371
- return y(e.schemaVersion, 1, "signature schemaVersion"), A(e.keyId, F, "signature keyId"), ye(e.identityScheme, [
369
+ function Qe(r) {
370
+ const e = b(r, Ye, "raw signature");
371
+ return d(e.schemaVersion, 1, "signature schemaVersion"), m(e.keyId, j, "signature keyId"), F(e.identityScheme, [
372
372
  "sdn-fast-password-auth-v1-legacy",
373
373
  "sdn-bip39-auth-v1-legacy"
374
- ], "raw signature identityScheme"), y(e.algorithm, "ed25519", "signature algorithm"), y(e.encoding, "raw", "signature encoding"), y(e.signatureProfile, ee, "signature profile"), A(e.signatureHex, ue, "signatureHex"), g([
374
+ ], "raw signature identityScheme"), d(e.algorithm, "ed25519", "signature algorithm"), d(e.encoding, "raw", "signature encoding"), d(e.signatureProfile, ie, "signature profile"), m(e.signatureHex, K, "signatureHex"), A([
375
375
  ["algorithm", "ed25519"],
376
376
  ["encoding", "raw"],
377
377
  ["identityScheme", e.identityScheme],
378
378
  ["keyId", e.keyId],
379
379
  ["schemaVersion", 1],
380
380
  ["signatureHex", e.signatureHex],
381
- ["signatureProfile", ee]
381
+ ["signatureProfile", ie]
382
382
  ]);
383
383
  }
384
- function We(r, e) {
385
- const t = R(r, ke, "canonical signature");
386
- return y(t.schemaVersion, 1, "signature schemaVersion"), A(t.keyId, F, "signature keyId"), y(t.identityScheme, v, "signature identityScheme"), y(t.algorithm, "ed25519", "signature algorithm"), y(t.encoding, "raw", "signature encoding"), y(t.signatureProfile, N, "signature profile"), Ue(t.canonicalEnvelope, e, t), A(t.signedDigestSha256, P, "signedDigestSha256"), A(t.signatureHex, ue, "signatureHex"), g([
384
+ function Ze(r, e) {
385
+ const t = b(r, Ue, "canonical signature");
386
+ return d(t.schemaVersion, 1, "signature schemaVersion"), m(t.keyId, j, "signature keyId"), d(t.identityScheme, v, "signature identityScheme"), d(t.algorithm, "ed25519", "signature algorithm"), d(t.encoding, "raw", "signature encoding"), d(t.signatureProfile, D, "signature profile"), We(t.canonicalEnvelope, e, t), m(t.signedDigestSha256, L, "signedDigestSha256"), m(t.signatureHex, K, "signatureHex"), A([
387
387
  ["algorithm", "ed25519"],
388
388
  ["canonicalEnvelope", t.canonicalEnvelope],
389
389
  ["encoding", "raw"],
@@ -391,19 +391,44 @@ function We(r, e) {
391
391
  ["keyId", t.keyId],
392
392
  ["schemaVersion", 1],
393
393
  ["signatureHex", t.signatureHex],
394
- ["signatureProfile", N],
394
+ ["signatureProfile", D],
395
395
  ["signedDigestSha256", t.signedDigestSha256]
396
396
  ]);
397
397
  }
398
- function Ke(r) {
399
- const e = R(r, ["challengeBase64url", "protocolVersion"], "SDN login v1 request");
400
- return y(e.protocolVersion, 1, "SDN login v1 protocolVersion"), me(e.challengeBase64url, "challengeBase64url"), g([
398
+ function Ge(r) {
399
+ const e = b(r, ["challengeBase64url", "protocolVersion"], "SDN login v1 request");
400
+ return d(e.protocolVersion, 1, "SDN login v1 protocolVersion"), Z(e.challengeBase64url, "challengeBase64url"), A([
401
401
  ["challengeBase64url", e.challengeBase64url],
402
402
  ["protocolVersion", 1]
403
403
  ]);
404
404
  }
405
- function ze(r) {
406
- const e = R(r, [
405
+ function et(r) {
406
+ const e = b(r, ne, "SDN publication request");
407
+ d(e.protocolVersion, 1, "publication protocolVersion"), d(e.method, "POST", "publication method"), F(e.schema, ["CZM", "ETM"], "publication schema"), g(e.providerOrigin, "providerOrigin");
408
+ let t;
409
+ try {
410
+ t = new URL(e.providerOrigin);
411
+ } catch {
412
+ c("providerOrigin must be canonical HTTPS");
413
+ }
414
+ (t.protocol !== "https:" || e.providerOrigin !== t.origin || t.username || t.password || t.port === "0" || t.pathname !== "/" || t.search || t.hash || t.hostname.length > 253 || t.hostname.split(".").some((o) => !/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(o))) && c("providerOrigin must be a canonical HTTPS DNS or IPv4 origin");
415
+ const i = `/api/v1/data/publish/${e.schema}`, n = `/api/v1/data/publish/batch/${e.schema}`;
416
+ F(e.requestUri, [i, `${i}.fbs`, n, `${n}.fbs`], "publication requestUri"), m(e.bodySha256, L, "publication bodySha256");
417
+ for (const [o, s] of [["bodyBytes", 1048576], ["documentCount", 1e5]])
418
+ (!Number.isInteger(e[o]) || e[o] < 1 || e[o] > s) && c(`publication ${o} is outside its bounds`);
419
+ for (const o of ["entityId", "entityName"]) {
420
+ g(e[o], o);
421
+ const s = C.encode(e[o]).byteLength;
422
+ (s < 1 || s > 256 || /[\u0000-\u001f\u007f]/u.test(e[o])) && c(`${o} must contain 1..256 UTF-8 bytes without controls`);
423
+ }
424
+ return A(ne.map((o) => [o, e[o]]));
425
+ }
426
+ function tt(r) {
427
+ const e = b(r, se, "SDN publication signature");
428
+ return d(e.schemaVersion, 1, "publication signature schemaVersion"), d(e.identityScheme, v, "publication identityScheme"), d(e.algorithm, "ed25519", "publication algorithm"), d(e.encoding, "raw", "publication encoding"), d(e.signatureProfile, ke, "publication signatureProfile"), m(e.keyId, j, "publication keyId"), m(e.publicKeyHex, L, "publication publicKeyHex"), m(e.signatureHex, K, "publication signatureHex"), m(e.requestDigestSha256, L, "publication requestDigestSha256"), m(e.challengeId, /^[0-9a-f]{32}$/u, "publication challengeId"), Z(e.challengeBase64url, "publication challengeBase64url"), A(se.map((t) => [t, e[t]]));
429
+ }
430
+ function rt(r) {
431
+ const e = b(r, [
407
432
  "audience",
408
433
  "challengeBase64url",
409
434
  "expiresAt",
@@ -411,8 +436,8 @@ function ze(r) {
411
436
  "nonce",
412
437
  "protocolVersion"
413
438
  ], "SDN login v2 request");
414
- return y(e.protocolVersion, 2, "SDN login v2 protocolVersion"), y(e.audience, W, "SDN login v2 audience"), me(e.challengeBase64url, "challengeBase64url"), A(e.nonce, P, "SDN login nonce"), D(e.issuedAt, "SDN login issuedAt"), D(e.expiresAt, "SDN login expiresAt"), pe(e.issuedAt, e.expiresAt), g([
415
- ["audience", W],
439
+ return d(e.protocolVersion, 2, "SDN login v2 protocolVersion"), d(e.audience, z, "SDN login v2 audience"), Z(e.challengeBase64url, "challengeBase64url"), m(e.nonce, L, "SDN login nonce"), k(e.issuedAt, "SDN login issuedAt"), k(e.expiresAt, "SDN login expiresAt"), be(e.issuedAt, e.expiresAt), A([
440
+ ["audience", z],
416
441
  ["challengeBase64url", e.challengeBase64url],
417
442
  ["expiresAt", e.expiresAt],
418
443
  ["issuedAt", e.issuedAt],
@@ -421,32 +446,32 @@ function ze(r) {
421
446
  ]);
422
447
  }
423
448
  function Ae(r, e) {
424
- return R(r, [], e), J({});
449
+ return b(r, [], e), J({});
425
450
  }
426
- function He(r = {}) {
451
+ function it(r = {}) {
427
452
  return Ae(r, "wallet connect request");
428
453
  }
429
- function Xe(r) {
430
- return Re(r, "connect");
454
+ function nt(r) {
455
+ return Ee(r, "connect");
431
456
  }
432
- function Qe(r = {}) {
457
+ function st(r = {}) {
433
458
  return Ae(r, "wallet account request");
434
459
  }
435
- function Ze(r) {
436
- return Re(r, "account");
460
+ function ot(r) {
461
+ return Ee(r, "account");
437
462
  }
438
- function Ge(r) {
439
- const e = R(r, ["challenge", "protocolVersion"], "SDN login v1 public request");
440
- return y(e.protocolVersion, 1, "SDN login v1 protocolVersion"), Ke({
441
- challengeBase64url: H(e.challenge, "challenge"),
463
+ function ct(r) {
464
+ const e = b(r, ["challenge", "protocolVersion"], "SDN login v1 public request");
465
+ return d(e.protocolVersion, 1, "SDN login v1 protocolVersion"), Ge({
466
+ challengeBase64url: Q(e.challenge, "challenge"),
442
467
  protocolVersion: 1
443
468
  });
444
469
  }
445
- function et(r) {
446
- return qe(r);
470
+ function at(r) {
471
+ return Qe(r);
447
472
  }
448
- function tt(r) {
449
- const e = R(r, [
473
+ function lt(r) {
474
+ const e = b(r, [
450
475
  "audience",
451
476
  "challenge",
452
477
  "expiresAt",
@@ -454,19 +479,25 @@ function tt(r) {
454
479
  "nonce",
455
480
  "protocolVersion"
456
481
  ], "SDN login v2 public request");
457
- return ze({
482
+ return rt({
458
483
  audience: e.audience,
459
- challengeBase64url: H(e.challenge, "challenge"),
484
+ challengeBase64url: Q(e.challenge, "challenge"),
460
485
  expiresAt: e.expiresAt,
461
486
  issuedAt: e.issuedAt,
462
487
  nonce: e.nonce,
463
488
  protocolVersion: e.protocolVersion
464
489
  });
465
490
  }
466
- function rt(r) {
467
- return We(r, "sdn-login");
491
+ function ut(r) {
492
+ return Ze(r, "sdn-login");
493
+ }
494
+ function ht(r) {
495
+ return et(r);
468
496
  }
469
- const _ = "https://wallet.spacedatanetwork.org", j = "sdn.wallet.callback.v1:", T = /^[0-9a-f]{64}$/u, te = /^[A-Za-z0-9_-]{43}$/u, nt = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, it = 250, st = 3e4, ot = 3e5, ct = 9e5, at = 12e4, lt = 8, re = 4096, ne = 70 * 1024, ut = 64, Ee = Object.freeze({
497
+ function ft(r) {
498
+ return tt(r);
499
+ }
500
+ const _ = "https://wallet.spacedatanetwork.org", V = "sdn.wallet.callback.v1:", P = /^[0-9a-f]{64}$/u, oe = /^[A-Za-z0-9_-]{43}$/u, dt = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, yt = 250, pt = 3e4, mt = 3e5, Rt = 9e5, bt = 12e4, Et = 8, ce = 4096, ae = 70 * 1024, At = 64, ge = Object.freeze({
470
501
  CALLBACK_ERROR: "The wallet return could not be verified. Try again.",
471
502
  CRYPTO_UNAVAILABLE: "Secure browser cryptography is unavailable.",
472
503
  DESTROYED: "This wallet client has been destroyed.",
@@ -477,10 +508,10 @@ const _ = "https://wallet.spacedatanetwork.org", j = "sdn.wallet.callback.v1:",
477
508
  RELAY_ERROR: "The wallet service could not complete the request. Try again.",
478
509
  REPLACED: "A newer wallet request replaced this one.",
479
510
  WALLET_NOT_COMPLETED: "The wallet did not complete. Check popup settings and try again."
480
- }), be = new TextEncoder(), ht = new TextDecoder("utf-8", { fatal: !0 });
481
- class C extends Error {
511
+ }), Oe = new TextEncoder(), gt = new TextDecoder("utf-8", { fatal: !0 });
512
+ class N extends Error {
482
513
  constructor(e) {
483
- super(Ee[e]), this.name = "WalletClientError", Object.defineProperty(this, "code", {
514
+ super(ge[e]), this.name = "WalletClientError", Object.defineProperty(this, "code", {
484
515
  configurable: !1,
485
516
  enumerable: !0,
486
517
  value: e,
@@ -488,22 +519,22 @@ class C extends Error {
488
519
  });
489
520
  }
490
521
  }
491
- function c(r) {
492
- return Object.hasOwn(Ee, r) ? new C(r) : new C("RELAY_ERROR");
522
+ function a(r) {
523
+ return Object.hasOwn(ge, r) ? new N(r) : new N("RELAY_ERROR");
493
524
  }
494
- function ft(r) {
525
+ function Ot(r) {
495
526
  if (r === null || typeof r != "object" || Array.isArray(r)) return !1;
496
527
  const e = Object.getPrototypeOf(r);
497
528
  return e === Object.prototype || e === null;
498
529
  }
499
- function V(r, e) {
500
- if (typeof r != "string" || r.length > e || be.encode(r).byteLength > e || r.charCodeAt(0) === 65279)
501
- throw c("RELAY_ERROR");
502
- let t = 0, n = 0;
503
- const i = () => {
530
+ function M(r, e) {
531
+ if (typeof r != "string" || r.length > e || Oe.encode(r).byteLength > e || r.charCodeAt(0) === 65279)
532
+ throw a("RELAY_ERROR");
533
+ let t = 0, i = 0;
534
+ const n = () => {
504
535
  for (; t < r.length && /[\u0009\u000a\u000d\u0020]/u.test(r[t]); ) t += 1;
505
536
  }, o = () => {
506
- if (r[t] !== '"') throw c("RELAY_ERROR");
537
+ if (r[t] !== '"') throw a("RELAY_ERROR");
507
538
  const l = t;
508
539
  for (t += 1; t < r.length; ) {
509
540
  const f = r.charCodeAt(t);
@@ -513,131 +544,131 @@ function V(r, e) {
513
544
  try {
514
545
  h = JSON.parse(r.slice(l, t));
515
546
  } catch {
516
- throw c("RELAY_ERROR");
547
+ throw a("RELAY_ERROR");
517
548
  }
518
- for (let d = 0; d < h.length; d += 1) {
519
- const p = h.charCodeAt(d);
549
+ for (let y = 0; y < h.length; y += 1) {
550
+ const p = h.charCodeAt(y);
520
551
  if (p >= 55296 && p <= 56319) {
521
- const m = h.charCodeAt(d + 1);
522
- if (!(m >= 56320 && m <= 57343)) throw c("RELAY_ERROR");
523
- d += 1;
552
+ const R = h.charCodeAt(y + 1);
553
+ if (!(R >= 56320 && R <= 57343)) throw a("RELAY_ERROR");
554
+ y += 1;
524
555
  } else if (p >= 56320 && p <= 57343)
525
- throw c("RELAY_ERROR");
556
+ throw a("RELAY_ERROR");
526
557
  }
527
558
  return h;
528
559
  }
529
560
  if (f < 32 || f === 92 && (t += 1, t >= r.length))
530
- throw c("RELAY_ERROR");
561
+ throw a("RELAY_ERROR");
531
562
  t += 1;
532
563
  }
533
- throw c("RELAY_ERROR");
564
+ throw a("RELAY_ERROR");
534
565
  }, s = (l = 0) => {
535
- if (l > 32 || ++n > 4096) throw c("RELAY_ERROR");
536
- i();
566
+ if (l > 32 || ++i > 4096) throw a("RELAY_ERROR");
567
+ n();
537
568
  const f = r[t];
538
569
  if (f === '"') return o();
539
570
  if (f === "{") {
540
571
  t += 1;
541
- const p = /* @__PURE__ */ Object.create(null), m = /* @__PURE__ */ new Set();
542
- if (i(), r[t] === "}")
572
+ const p = /* @__PURE__ */ Object.create(null), R = /* @__PURE__ */ new Set();
573
+ if (n(), r[t] === "}")
543
574
  return t += 1, p;
544
575
  for (; t < r.length; ) {
545
- i();
546
- const O = o();
547
- if (m.has(O) || (m.add(O), i(), r[t] !== ":")) throw c("RELAY_ERROR");
548
- if (t += 1, p[O] = s(l + 1), i(), r[t] === "}")
576
+ n();
577
+ const S = o();
578
+ if (R.has(S) || (R.add(S), n(), r[t] !== ":")) throw a("RELAY_ERROR");
579
+ if (t += 1, p[S] = s(l + 1), n(), r[t] === "}")
549
580
  return t += 1, p;
550
- if (r[t] !== ",") throw c("RELAY_ERROR");
581
+ if (r[t] !== ",") throw a("RELAY_ERROR");
551
582
  t += 1;
552
583
  }
553
- throw c("RELAY_ERROR");
584
+ throw a("RELAY_ERROR");
554
585
  }
555
586
  if (f === "[") {
556
587
  t += 1;
557
588
  const p = [];
558
- if (i(), r[t] === "]")
589
+ if (n(), r[t] === "]")
559
590
  return t += 1, p;
560
591
  for (; t < r.length; ) {
561
- if (p.push(s(l + 1)), i(), r[t] === "]")
592
+ if (p.push(s(l + 1)), n(), r[t] === "]")
562
593
  return t += 1, p;
563
- if (r[t] !== ",") throw c("RELAY_ERROR");
594
+ if (r[t] !== ",") throw a("RELAY_ERROR");
564
595
  t += 1;
565
596
  }
566
- throw c("RELAY_ERROR");
597
+ throw a("RELAY_ERROR");
567
598
  }
568
- for (const [p, m] of [["true", !0], ["false", !1], ["null", null]])
599
+ for (const [p, R] of [["true", !0], ["false", !1], ["null", null]])
569
600
  if (r.startsWith(p, t))
570
- return t += p.length, m;
601
+ return t += p.length, R;
571
602
  const h = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/u.exec(r.slice(t));
572
- if (!h) throw c("RELAY_ERROR");
603
+ if (!h) throw a("RELAY_ERROR");
573
604
  t += h[0].length;
574
- const d = Number(h[0]);
575
- if (!Number.isFinite(d)) throw c("RELAY_ERROR");
576
- return d;
605
+ const y = Number(h[0]);
606
+ if (!Number.isFinite(y)) throw a("RELAY_ERROR");
607
+ return y;
577
608
  };
578
- i();
609
+ n();
579
610
  const u = s();
580
- if (i(), t !== r.length) throw c("RELAY_ERROR");
611
+ if (n(), t !== r.length) throw a("RELAY_ERROR");
581
612
  return u;
582
613
  }
583
- function $(r, e, t = "RELAY_ERROR") {
584
- if (!ft(r) || Object.getOwnPropertySymbols(r).length !== 0)
585
- throw c(t);
586
- const n = Object.getOwnPropertyNames(r).sort(), i = [...e].sort();
587
- if (n.length !== i.length || n.some((o, s) => o !== i[s]))
588
- throw c(t);
589
- for (const o of n) {
614
+ function B(r, e, t = "RELAY_ERROR") {
615
+ if (!Ot(r) || Object.getOwnPropertySymbols(r).length !== 0)
616
+ throw a(t);
617
+ const i = Object.getOwnPropertyNames(r).sort(), n = [...e].sort();
618
+ if (i.length !== n.length || i.some((o, s) => o !== n[s]))
619
+ throw a(t);
620
+ for (const o of i) {
590
621
  const s = Object.getOwnPropertyDescriptor(r, o);
591
622
  if (!s?.enumerable || !("value" in s) || s.value === void 0)
592
- throw c(t);
623
+ throw a(t);
593
624
  }
594
625
  return r;
595
626
  }
596
- function M(r, e = "RELAY_ERROR") {
597
- if (typeof r != "string" || !nt.test(r))
598
- throw c(e);
627
+ function Y(r, e = "RELAY_ERROR") {
628
+ if (typeof r != "string" || !dt.test(r))
629
+ throw a(e);
599
630
  const t = Date.parse(r);
600
631
  if (!Number.isFinite(t) || new Date(t).toISOString() !== r)
601
- throw c(e);
632
+ throw a(e);
602
633
  return t;
603
634
  }
604
- function S(r) {
605
- return Array.isArray(r) ? Object.freeze(r.map(S)) : r && typeof r == "object" ? Object.freeze(Object.fromEntries(
606
- Object.entries(r).map(([e, t]) => [e, S(t)])
635
+ function w(r) {
636
+ return Array.isArray(r) ? Object.freeze(r.map(w)) : r && typeof r == "object" ? Object.freeze(Object.fromEntries(
637
+ Object.entries(r).map(([e, t]) => [e, w(t)])
607
638
  )) : r;
608
639
  }
609
- function ie(r) {
640
+ function le(r) {
610
641
  const e = {
611
- identity: r.identity === null ? null : S(r.identity),
642
+ identity: r.identity === null ? null : w(r.identity),
612
643
  status: r.status
613
644
  };
614
- return r.connectionExpiresAt !== void 0 && (e.connectionExpiresAt = r.connectionExpiresAt), r.error !== void 0 && (e.error = S(r.error)), S(e);
645
+ return r.connectionExpiresAt !== void 0 && (e.connectionExpiresAt = r.connectionExpiresAt), r.error !== void 0 && (e.error = w(r.error)), w(e);
615
646
  }
616
- function I(r) {
647
+ function T(r) {
617
648
  return Object.freeze({ code: r.code, message: r.message });
618
649
  }
619
- function se(r) {
650
+ function ue(r) {
620
651
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
621
- let t = 0, n = 0, i = "";
652
+ let t = 0, i = 0, n = "";
622
653
  for (const o of r)
623
- for (t = t << 8 | o, n += 8; n >= 6; )
624
- n -= 6, i += e[t >>> n & 63], t &= (1 << n) - 1;
625
- return n !== 0 && (i += e[t << 6 - n & 63]), i;
654
+ for (t = t << 8 | o, i += 8; i >= 6; )
655
+ i -= 6, n += e[t >>> i & 63], t &= (1 << i) - 1;
656
+ return i !== 0 && (n += e[t << 6 - i & 63]), n;
626
657
  }
627
- function oe(r) {
658
+ function he(r) {
628
659
  let e = "";
629
660
  for (const t of r) e += t.toString(16).padStart(2, "0");
630
661
  return e;
631
662
  }
632
- function q(r, e) {
663
+ function H(r, e) {
633
664
  const t = new Uint8Array(32);
634
665
  return Reflect.apply(e, r, [t]), t;
635
666
  }
636
- function dt(r) {
667
+ function St(r) {
637
668
  const e = r?.headers?.get?.("content-type");
638
669
  return typeof e == "string" && /^application\/json(?:\s*;\s*charset=utf-8)?$/iu.test(e.trim());
639
670
  }
640
- function X(r) {
671
+ function G(r) {
641
672
  try {
642
673
  Promise.resolve(r).catch(() => {
643
674
  });
@@ -647,54 +678,54 @@ function X(r) {
647
678
  function x(r) {
648
679
  try {
649
680
  const e = r?.body, t = e?.cancel;
650
- typeof t == "function" && X(Reflect.apply(t, e, []));
681
+ typeof t == "function" && G(Reflect.apply(t, e, []));
651
682
  } catch {
652
683
  }
653
684
  }
654
- function ge(r) {
685
+ function Se(r) {
655
686
  try {
656
687
  const e = r?.cancel;
657
- typeof e == "function" && X(Reflect.apply(e, r, []));
688
+ typeof e == "function" && G(Reflect.apply(e, r, []));
658
689
  } catch {
659
690
  }
660
691
  }
661
- function yt(r) {
692
+ function wt(r) {
662
693
  try {
663
694
  const e = r?.releaseLock;
664
695
  typeof e == "function" && Reflect.apply(e, r, []);
665
696
  } catch {
666
697
  }
667
698
  }
668
- function L(r, e, t = null) {
699
+ function I(r, e, t = null) {
669
700
  try {
670
701
  r.abort();
671
702
  } catch {
672
703
  }
673
- t && ge(t), x(e);
704
+ t && Se(t), x(e);
674
705
  }
675
- function Y(r, e, t = null) {
676
- let n;
706
+ function U(r, e, t = null) {
707
+ let i;
677
708
  try {
678
- n = Promise.resolve(r);
679
- } catch (i) {
680
- return Promise.reject(i);
709
+ i = Promise.resolve(r);
710
+ } catch (n) {
711
+ return Promise.reject(n);
681
712
  }
682
- return new Promise((i, o) => {
713
+ return new Promise((n, o) => {
683
714
  let s = !1;
684
715
  const u = () => {
685
716
  try {
686
717
  e.removeEventListener("abort", f);
687
718
  } catch {
688
719
  }
689
- }, l = (h, d) => s ? !1 : (s = !0, u(), h(d), !0), f = () => {
690
- l(o, c("RELAY_ERROR"));
720
+ }, l = (h, y) => s ? !1 : (s = !0, u(), h(y), !0), f = () => {
721
+ l(o, a("RELAY_ERROR"));
691
722
  };
692
723
  try {
693
724
  e.addEventListener("abort", f, { once: !0 }), e.aborted && f();
694
725
  } catch {
695
726
  f();
696
727
  }
697
- n.then(
728
+ i.then(
698
729
  (h) => {
699
730
  if (s) {
700
731
  try {
@@ -703,7 +734,7 @@ function Y(r, e, t = null) {
703
734
  }
704
735
  return;
705
736
  }
706
- l(i, h);
737
+ l(n, h);
707
738
  },
708
739
  (h) => {
709
740
  s || l(o, h);
@@ -711,36 +742,36 @@ function Y(r, e, t = null) {
711
742
  );
712
743
  });
713
744
  }
714
- async function ce(r, e, t) {
715
- let n = null;
716
- const i = [];
745
+ async function fe(r, e, t) {
746
+ let i = null;
747
+ const n = [];
717
748
  let o = 0;
718
749
  try {
719
- if (!dt(r) || typeof r?.body?.getReader != "function")
720
- throw c("RELAY_ERROR");
721
- for (n = r.body.getReader(); ; ) {
722
- const l = n.read(), { done: f, value: h } = await Y(l, t.signal);
750
+ if (!St(r) || typeof r?.body?.getReader != "function")
751
+ throw a("RELAY_ERROR");
752
+ for (i = r.body.getReader(); ; ) {
753
+ const l = i.read(), { done: f, value: h } = await U(l, t.signal);
723
754
  if (f) break;
724
755
  if (!(h instanceof Uint8Array) || (o += h.byteLength, o > e))
725
- throw c("RELAY_ERROR");
726
- i.push(h);
756
+ throw a("RELAY_ERROR");
757
+ n.push(h);
727
758
  }
728
759
  const s = new Uint8Array(o);
729
760
  let u = 0;
730
- for (const l of i)
761
+ for (const l of n)
731
762
  s.set(l, u), u += l.byteLength;
732
- return ht.decode(s);
763
+ return gt.decode(s);
733
764
  } catch {
734
765
  try {
735
766
  t.abort();
736
767
  } catch {
737
768
  }
738
- throw n && ge(n), c("RELAY_ERROR");
769
+ throw i && Se(i), a("RELAY_ERROR");
739
770
  } finally {
740
- n && yt(n);
771
+ i && wt(i);
741
772
  }
742
773
  }
743
- function k(r, e) {
774
+ function $(r, e) {
744
775
  const t = {
745
776
  body: JSON.stringify(r),
746
777
  cache: "no-store",
@@ -753,33 +784,33 @@ function k(r, e) {
753
784
  };
754
785
  return e !== void 0 && (t.signal = e), t;
755
786
  }
756
- function pt(r, e, t) {
757
- let n;
787
+ function vt(r, e, t) {
788
+ let i;
758
789
  try {
759
- n = V(r, 2048), $(n, ["code", "expiresAt", "schemaVersion", "state"], "CALLBACK_ERROR");
790
+ i = M(r, 2048), B(i, ["code", "expiresAt", "schemaVersion", "state"], "CALLBACK_ERROR");
760
791
  } catch {
761
- throw c("CALLBACK_ERROR");
792
+ throw a("CALLBACK_ERROR");
762
793
  }
763
- if (n.schemaVersion !== 1 || n.state !== e || !T.test(n.code))
764
- throw c("CALLBACK_ERROR");
765
- const i = M(n.expiresAt, "CALLBACK_ERROR");
766
- if (i <= t || i - t > at)
767
- throw c("CALLBACK_ERROR");
768
- return { code: n.code, expiresAt: i, state: n.state };
769
- }
770
- function mt() {
794
+ if (i.schemaVersion !== 1 || i.state !== e || !P.test(i.code))
795
+ throw a("CALLBACK_ERROR");
796
+ const n = Y(i.expiresAt, "CALLBACK_ERROR");
797
+ if (n <= t || n - t > bt)
798
+ throw a("CALLBACK_ERROR");
799
+ return { code: i.code, expiresAt: n, state: i.state };
800
+ }
801
+ function Lt() {
771
802
  let r;
772
803
  return { promise: new Promise((t) => {
773
804
  r = t;
774
805
  }), resolve: r };
775
806
  }
776
- function ae() {
807
+ function de() {
777
808
  let r, e;
778
- return { promise: new Promise((n, i) => {
779
- r = i, e = n;
809
+ return { promise: new Promise((i, n) => {
810
+ r = n, e = i;
780
811
  }), reject: r, resolve: e };
781
812
  }
782
- function Rt() {
813
+ function It() {
783
814
  const r = globalThis.window;
784
815
  return Object.freeze({
785
816
  AbortController: globalThis.AbortController,
@@ -800,8 +831,8 @@ function Rt() {
800
831
  window: r
801
832
  });
802
833
  }
803
- class At {
804
- #k;
834
+ class _t {
835
+ #j;
805
836
  #V;
806
837
  #T = !1;
807
838
  #l = !1;
@@ -815,25 +846,25 @@ class At {
815
846
  #m = 0;
816
847
  #w = 0;
817
848
  #v = /* @__PURE__ */ new Set();
818
- #x = [];
849
+ #P = [];
819
850
  #o = null;
820
- #C = !1;
851
+ #x = !1;
821
852
  #y = /* @__PURE__ */ new Set();
822
853
  #M = Object.freeze({ identity: null, status: "dormant" });
823
854
  #u = null;
824
855
  #L = null;
825
- #b = null;
856
+ #A = null;
826
857
  #R = /* @__PURE__ */ new Set();
827
858
  #p;
828
- constructor({ adapters: e, clientId: t, dependencies: n }) {
829
- this.#k = e, this.#V = t, this.#e = n ?? Rt(), this.#p = this.#e.window;
859
+ constructor({ adapters: e, clientId: t, dependencies: i }) {
860
+ this.#j = e, this.#V = t, this.#e = i ?? It(), this.#p = this.#e.window;
830
861
  }
831
862
  getSnapshot() {
832
- return this.#U(), ie(this.#M);
863
+ return this.#U(), le(this.#M);
833
864
  }
834
865
  subscribe(e) {
835
- if (typeof e != "function") throw c("INVALID_REQUEST");
836
- if (this.#r) throw c("DESTROYED");
866
+ if (typeof e != "function") throw a("INVALID_REQUEST");
867
+ if (this.#r) throw a("DESTROYED");
837
868
  this.#v.add(e);
838
869
  try {
839
870
  e(this.getSnapshot());
@@ -845,62 +876,62 @@ class At {
845
876
  };
846
877
  }
847
878
  execute(e, t) {
848
- if (this.#r) return Promise.reject(c("DESTROYED"));
849
- const n = this.#m, i = this.#k[e];
850
- if (!i) return Promise.reject(c("INVALID_REQUEST"));
879
+ if (this.#r) return Promise.reject(a("DESTROYED"));
880
+ const i = this.#m, n = this.#j[e];
881
+ if (!n) return Promise.reject(a("INVALID_REQUEST"));
851
882
  let o;
852
883
  try {
853
- o = i.buildRequest(t);
884
+ o = n.buildRequest(t);
854
885
  } catch {
855
- const E = this.#t(n);
856
- return E ? Promise.reject(E) : Promise.reject(c("INVALID_REQUEST"));
886
+ const E = this.#t(i);
887
+ return E ? Promise.reject(E) : Promise.reject(a("INVALID_REQUEST"));
857
888
  }
858
- let s = this.#t(n);
889
+ let s = this.#t(i);
859
890
  if (s) return Promise.reject(s);
860
891
  if (this.#T)
861
- return this.#l = !0, Promise.reject(c("REPLACED"));
892
+ return this.#l = !0, Promise.reject(a("REPLACED"));
862
893
  const u = ++this.#m;
863
894
  if (this.#Q(), s = this.#t(u), s) return Promise.reject(s);
864
895
  if (this.#l)
865
- return Promise.reject(c("CALLBACK_ERROR"));
896
+ return Promise.reject(a("CALLBACK_ERROR"));
866
897
  if (this.#U(), s = this.#t(u), s) return Promise.reject(s);
867
- const l = this.#i();
898
+ const l = this.#n();
868
899
  if (s = this.#t(u), s) return Promise.reject(s);
869
900
  const f = this.#s && this.#s.expiresAtMs > l ? this.#s : null;
870
901
  if (s = this.#t(u), s) return Promise.reject(s);
871
902
  const h = this.#o;
872
- let d, p, m;
903
+ let y, p, R;
873
904
  try {
874
- const E = this.#e.crypto, b = E?.getRandomValues, Se = E?.subtle?.digest, Z = this.#p?.open;
905
+ const E = this.#e.crypto, O = E?.getRandomValues, _e = E?.subtle?.digest, te = this.#p?.open;
875
906
  if (s = this.#t(u), s) throw s;
876
- if (typeof b != "function" || typeof Se != "function" || typeof Z != "function")
877
- throw c("CRYPTO_UNAVAILABLE");
878
- if (d = oe(q(E, b)), s = this.#t(u), s || (p = oe(q(E, b)), s = this.#t(u), s) || (m = se(q(E, b)), s = this.#t(u), s)) throw s;
879
- if (!T.test(d) || !T.test(p) || !te.test(m))
880
- throw c("CRYPTO_UNAVAILABLE");
881
- if (Reflect.apply(Z, this.#p, [
882
- `${_}/transaction/${d}`,
907
+ if (typeof O != "function" || typeof _e != "function" || typeof te != "function")
908
+ throw a("CRYPTO_UNAVAILABLE");
909
+ if (y = he(H(E, O)), s = this.#t(u), s || (p = he(H(E, O)), s = this.#t(u), s) || (R = ue(H(E, O)), s = this.#t(u), s)) throw s;
910
+ if (!P.test(y) || !P.test(p) || !oe.test(R))
911
+ throw a("CRYPTO_UNAVAILABLE");
912
+ if (Reflect.apply(te, this.#p, [
913
+ `${_}/transaction/${y}`,
883
914
  "_blank",
884
915
  "noopener"
885
916
  ]), s = this.#t(u), s) throw s;
886
917
  } catch (E) {
887
918
  if (s = this.#t(u), s) return Promise.reject(s);
888
- let b;
919
+ let O;
889
920
  try {
890
- b = E instanceof C ? E : c("CRYPTO_UNAVAILABLE");
921
+ O = E instanceof N ? E : a("CRYPTO_UNAVAILABLE");
891
922
  } catch {
892
- b = c("CRYPTO_UNAVAILABLE");
923
+ O = a("CRYPTO_UNAVAILABLE");
893
924
  }
894
- return h && (this.#_(h, "REPLACED", !1), s = this.#t(u), s) ? Promise.reject(s) : (this.#Y(null, b, f, i.kind), Promise.reject(b));
925
+ return h && (this.#I(h, "REPLACED", !1), s = this.#t(u), s) ? Promise.reject(s) : (this.#B(null, O, f, n.kind), Promise.reject(O));
895
926
  }
896
- if (h && (this.#_(h, "REPLACED", !1), s = this.#t(u), s))
927
+ if (h && (this.#I(h, "REPLACED", !1), s = this.#t(u), s))
897
928
  return Promise.reject(s);
898
- const O = ae(), Oe = mt(), Q = {
929
+ const S = de(), Ie = Lt(), ee = {
899
930
  active: !0,
900
- adapter: i,
931
+ adapter: n,
901
932
  callbackBusy: !1,
902
933
  challenge: null,
903
- cleanup: Oe,
934
+ cleanup: Ie,
904
935
  cleanupFinished: !1,
905
936
  cleanupStarted: !1,
906
937
  controllers: /* @__PURE__ */ new Set(),
@@ -910,76 +941,76 @@ class At {
910
941
  phase: "hashing",
911
942
  pollTimer: null,
912
943
  priorConnection: f,
913
- promise: O.promise,
914
- registrationDeadlineMs: l + st,
944
+ promise: S.promise,
945
+ registrationDeadlineMs: l + pt,
915
946
  registrationOutcome: "none",
916
- reject: O.reject,
947
+ reject: S.reject,
917
948
  request: o,
918
- resolve: O.resolve,
949
+ resolve: S.resolve,
919
950
  retryResolve: null,
920
951
  retryTimer: null,
921
952
  state: p,
922
953
  transactionExpiresAtMs: null,
923
- transactionId: d,
924
- verifier: m
954
+ transactionId: y,
955
+ verifier: R
925
956
  };
926
- return this.#o = Q, this.#n({
957
+ return this.#o = ee, this.#i({
927
958
  ...f ? {
928
959
  connectionExpiresAt: f.expiresAt,
929
960
  identity: f.identity
930
961
  } : { identity: null },
931
962
  status: "opening"
932
- }), this.#q(Q), O.promise;
963
+ }), this.#J(ee), S.promise;
933
964
  }
934
965
  async disconnect() {
935
- if (this.#r) throw c("DESTROYED");
966
+ if (this.#r) throw a("DESTROYED");
936
967
  const e = ++this.#m;
937
968
  this.#f();
938
969
  const t = this.#o;
939
- let n = Promise.resolve();
940
- t && (n = this.#_(t, "DISCONNECTED", !1));
941
- let i = this.#t(e);
942
- if (i)
943
- throw await n, i;
944
- if (this.#n({ identity: null, status: "dormant" }), await n, i = this.#t(e), i) throw i;
970
+ let i = Promise.resolve();
971
+ t && (i = this.#I(t, "DISCONNECTED", !1));
972
+ let n = this.#t(e);
973
+ if (n)
974
+ throw await i, n;
975
+ if (this.#i({ identity: null, status: "dormant" }), await i, n = this.#t(e), n) throw n;
945
976
  }
946
977
  destroy() {
947
978
  if (this.#S) return this.#S;
948
- const e = ae();
979
+ const e = de();
949
980
  this.#S = e.promise, this.#m += 1;
950
981
  try {
951
- this.#J(), e.resolve();
982
+ this.#F(), e.resolve();
952
983
  } catch {
953
- e.reject(c("RELAY_ERROR"));
984
+ e.reject(a("RELAY_ERROR"));
954
985
  }
955
986
  return this.#S;
956
987
  }
957
- #J() {
988
+ #F() {
958
989
  this.#r = !0, this.#w += 1, this.#f();
959
990
  const e = [], t = this.#o;
960
- t && (t.active = !1, this.#o = null, this.#I(t), t.reject(c("DESTROYED")), t.challenge && t.verifier && e.push(t));
961
- for (const n of this.#y)
962
- n.challenge && n.verifier && e.push(n);
963
- for (const n of this.#E) n.abort();
991
+ t && (t.active = !1, this.#o = null, this.#_(t), t.reject(a("DESTROYED")), t.challenge && t.verifier && e.push(t));
992
+ for (const i of this.#y)
993
+ i.challenge && i.verifier && e.push(i);
994
+ for (const i of this.#E) i.abort();
964
995
  this.#E.clear();
965
- for (const n of this.#R)
966
- this.#e.clearTimeout(n), this.#e.clearInterval(n);
967
- if (this.#R.clear(), this.#b)
996
+ for (const i of this.#R)
997
+ this.#e.clearTimeout(i), this.#e.clearInterval(i);
998
+ if (this.#R.clear(), this.#A)
968
999
  try {
969
- this.#b();
1000
+ this.#A();
970
1001
  } catch {
971
1002
  }
972
- this.#L = null, this.#b = null, this.#u = null, this.#v.clear();
973
- for (const n of e) this.#X(n);
1003
+ this.#L = null, this.#A = null, this.#u = null, this.#v.clear();
1004
+ for (const i of e) this.#X(i);
974
1005
  t && this.#a(t);
975
- for (const n of [...this.#y]) this.#a(n);
976
- this.#n({
977
- error: I(c("DESTROYED")),
1006
+ for (const i of [...this.#y]) this.#a(i);
1007
+ this.#i({
1008
+ error: T(a("DESTROYED")),
978
1009
  identity: null,
979
1010
  status: "error"
980
1011
  });
981
1012
  }
982
- async #q(e) {
1013
+ async #J(e) {
983
1014
  if (!(!this.#c(e) || e.cleanupFinished))
984
1015
  try {
985
1016
  e.operationTimer = this.#g(() => {
@@ -991,24 +1022,24 @@ class At {
991
1022
  if (e.phase === "registering")
992
1023
  for (const u of e.controllers) u.abort();
993
1024
  }
994
- }, Math.max(0, e.registrationDeadlineMs - this.#i()));
1025
+ }, Math.max(0, e.registrationDeadlineMs - this.#n()));
995
1026
  const t = await this.#e.crypto.subtle.digest(
996
1027
  "SHA-256",
997
- be.encode(e.verifier)
998
- ), n = se(new Uint8Array(t));
999
- if (!te.test(n)) throw c("CRYPTO_UNAVAILABLE");
1028
+ Oe.encode(e.verifier)
1029
+ ), i = ue(new Uint8Array(t));
1030
+ if (!oe.test(i)) throw a("CRYPTO_UNAVAILABLE");
1000
1031
  if (!this.#c(e)) {
1001
1032
  e.registrationOutcome = "not-started", this.#a(e);
1002
1033
  return;
1003
1034
  }
1004
- e.challenge = n, e.phase = "registering";
1005
- const i = this.#P(e);
1035
+ e.challenge = i, e.phase = "registering";
1036
+ const n = this.#C(e);
1006
1037
  let o, s = null;
1007
1038
  try {
1008
1039
  try {
1009
1040
  const l = this.#e.fetch(
1010
1041
  `${_}/relay/v1/transactions`,
1011
- k({
1042
+ $({
1012
1043
  clientId: this.#V,
1013
1044
  codeChallenge: e.challenge,
1014
1045
  codeChallengeMethod: "S256",
@@ -1017,15 +1048,15 @@ class At {
1017
1048
  schemaVersion: 1,
1018
1049
  state: e.state,
1019
1050
  transactionId: e.transactionId
1020
- }, i.signal)
1051
+ }, n.signal)
1021
1052
  );
1022
- s = await Y(
1053
+ s = await U(
1023
1054
  l,
1024
- i.signal,
1055
+ n.signal,
1025
1056
  x
1026
1057
  );
1027
1058
  } catch {
1028
- e.registrationOutcome = "ambiguous", e.active ? this.#h(e, "RELAY_ERROR") : this.#A(e);
1059
+ e.registrationOutcome = "ambiguous", e.active ? this.#h(e, "RELAY_ERROR") : this.#b(e);
1029
1060
  return;
1030
1061
  }
1031
1062
  e.registrationOutcome = "ambiguous";
@@ -1033,75 +1064,75 @@ class At {
1033
1064
  try {
1034
1065
  u = s.status;
1035
1066
  } catch {
1036
- L(i, s), e.active ? this.#h(e, "RELAY_ERROR") : this.#A(e);
1067
+ I(n, s), e.active ? this.#h(e, "RELAY_ERROR") : this.#b(e);
1037
1068
  return;
1038
1069
  }
1039
1070
  if (u !== 201) {
1040
- e.registrationOutcome = "definitive-failure", L(i, s), e.active ? this.#h(e, "RELAY_ERROR", !1) : this.#a(e);
1071
+ e.registrationOutcome = "definitive-failure", I(n, s), e.active ? this.#h(e, "RELAY_ERROR", !1) : this.#a(e);
1041
1072
  return;
1042
1073
  }
1043
1074
  try {
1044
- const l = await ce(
1075
+ const l = await fe(
1045
1076
  s,
1046
- re,
1047
- i
1048
- ), f = $(
1049
- V(l, re),
1077
+ ce,
1078
+ n
1079
+ ), f = B(
1080
+ M(l, ce),
1050
1081
  ["expiresAt", "schemaVersion", "transactionId"]
1051
1082
  );
1052
1083
  if (f.schemaVersion !== 1 || f.transactionId !== e.transactionId)
1053
- throw c("RELAY_ERROR");
1054
- o = M(f.expiresAt);
1055
- const h = this.#i();
1056
- if (o <= h || o - h > ot)
1057
- throw c("RELAY_ERROR");
1084
+ throw a("RELAY_ERROR");
1085
+ o = Y(f.expiresAt);
1086
+ const h = this.#n();
1087
+ if (o <= h || o - h > mt)
1088
+ throw a("RELAY_ERROR");
1058
1089
  } catch {
1059
- e.registrationOutcome = "ambiguous", L(i, s), e.active ? this.#h(e, "RELAY_ERROR") : this.#A(e);
1090
+ e.registrationOutcome = "ambiguous", I(n, s), e.active ? this.#h(e, "RELAY_ERROR") : this.#b(e);
1060
1091
  return;
1061
1092
  }
1062
1093
  } finally {
1063
1094
  try {
1064
- i.abort();
1095
+ n.abort();
1065
1096
  } catch {
1066
1097
  }
1067
- this.#D(e, i), this.#d(e.operationTimer), e.operationTimer = null;
1098
+ this.#D(e, n), this.#d(e.operationTimer), e.operationTimer = null;
1068
1099
  }
1069
1100
  if (e.transactionExpiresAtMs = o, e.registrationOutcome = "registered", !this.#c(e)) {
1070
- this.#A(e);
1101
+ this.#b(e);
1071
1102
  return;
1072
1103
  }
1073
1104
  e.phase = "waiting-callback", e.expiryTimer = this.#g(() => {
1074
1105
  this.#c(e) && this.#h(e, "WALLET_NOT_COMPLETED");
1075
- }, Math.max(0, e.transactionExpiresAtMs - this.#i())), e.pollTimer = this.#H(() => {
1106
+ }, Math.max(0, e.transactionExpiresAtMs - this.#n())), e.pollTimer = this.#K(() => {
1076
1107
  this.#N(e, !1);
1077
- }, it), await this.#N(e, !1);
1108
+ }, yt), await this.#N(e, !1);
1078
1109
  } catch (t) {
1079
1110
  if (!e.active) {
1080
- e.registrationOutcome === "ambiguous" || e.registrationOutcome === "registered" ? this.#A(e) : this.#a(e);
1111
+ e.registrationOutcome === "ambiguous" || e.registrationOutcome === "registered" ? this.#b(e) : this.#a(e);
1081
1112
  return;
1082
1113
  }
1083
- const n = t instanceof C ? t.code : e.phase === "hashing" ? "CRYPTO_UNAVAILABLE" : "RELAY_ERROR";
1084
- this.#h(e, n, e.registrationOutcome !== "none");
1114
+ const i = t instanceof N ? t.code : e.phase === "hashing" ? "CRYPTO_UNAVAILABLE" : "RELAY_ERROR";
1115
+ this.#h(e, i, e.registrationOutcome !== "none");
1085
1116
  }
1086
1117
  }
1087
1118
  async #N(e, t) {
1088
1119
  if (!this.#c(e) || e.phase !== "waiting-callback" || e.callbackBusy || !this.#u) return;
1089
- const n = `${j}${e.state}`;
1090
- let i;
1120
+ const i = `${V}${e.state}`;
1121
+ let n;
1091
1122
  try {
1092
- i = this.#u.getItem(n);
1123
+ n = this.#u.getItem(i);
1093
1124
  } catch {
1094
1125
  t && this.#h(e, "CALLBACK_ERROR");
1095
1126
  return;
1096
1127
  }
1097
- if (i === null) return;
1128
+ if (n === null) return;
1098
1129
  e.callbackBusy = !0;
1099
1130
  let o;
1100
1131
  try {
1101
- o = pt(i, e.state, this.#i()), this.#u.removeItem(n);
1132
+ o = vt(n, e.state, this.#n()), this.#u.removeItem(i);
1102
1133
  } catch {
1103
1134
  try {
1104
- this.#u.removeItem(n);
1135
+ this.#u.removeItem(i);
1105
1136
  } catch {
1106
1137
  }
1107
1138
  this.#h(e, "CALLBACK_ERROR");
@@ -1109,12 +1140,12 @@ class At {
1109
1140
  }
1110
1141
  if (!this.#c(e)) return;
1111
1142
  e.phase = "redeeming", this.#d(e.pollTimer, !0), e.pollTimer = null;
1112
- const s = this.#P(e);
1143
+ const s = this.#C(e);
1113
1144
  let u = null;
1114
1145
  try {
1115
1146
  const l = this.#e.fetch(
1116
1147
  `${_}/relay/v1/codes/redeem`,
1117
- k({
1148
+ $({
1118
1149
  code: o.code,
1119
1150
  codeVerifier: e.verifier,
1120
1151
  schemaVersion: 1,
@@ -1122,32 +1153,32 @@ class At {
1122
1153
  transactionId: e.transactionId
1123
1154
  }, s.signal)
1124
1155
  );
1125
- if (u = await Y(
1156
+ if (u = await U(
1126
1157
  l,
1127
1158
  s.signal,
1128
1159
  x
1129
- ), u.status !== 200) throw c("RELAY_ERROR");
1130
- const f = await ce(
1160
+ ), u.status !== 200) throw a("RELAY_ERROR");
1161
+ const f = await fe(
1131
1162
  u,
1132
- ne,
1163
+ ae,
1133
1164
  s
1134
- ), h = $(
1135
- V(f, ne),
1165
+ ), h = B(
1166
+ M(f, ae),
1136
1167
  ["result", "schemaVersion", "transactionId"]
1137
1168
  );
1138
1169
  if (h.schemaVersion !== 1 || h.transactionId !== e.transactionId)
1139
- throw c("RELAY_ERROR");
1140
- let d;
1170
+ throw a("RELAY_ERROR");
1171
+ let y;
1141
1172
  try {
1142
- d = e.adapter.parseResult(h.result);
1173
+ y = e.adapter.parseResult(h.result);
1143
1174
  } catch {
1144
- throw c("RELAY_ERROR");
1175
+ throw a("RELAY_ERROR");
1145
1176
  }
1146
1177
  if (!this.#c(e)) return;
1147
- this.#W(e, d);
1178
+ this.#H(e, y);
1148
1179
  } catch (l) {
1149
- if (u && L(s, u), !this.#c(e)) return;
1150
- const f = l instanceof C ? l.code : "RELAY_ERROR";
1180
+ if (u && I(s, u), !this.#c(e)) return;
1181
+ const f = l instanceof N ? l.code : "RELAY_ERROR";
1151
1182
  this.#h(e, f);
1152
1183
  } finally {
1153
1184
  try {
@@ -1157,93 +1188,93 @@ class At {
1157
1188
  this.#D(e, s);
1158
1189
  }
1159
1190
  }
1160
- #W(e, t) {
1191
+ #H(e, t) {
1161
1192
  if (!this.#c(e)) return;
1162
- let n = null;
1163
- (e.adapter.kind === "connect" || e.adapter.kind === "account" && t.event === "connected") && (n = this.#K(t)), e.active = !1, this.#o = null, this.#I(e);
1164
- let i = t;
1165
- e.adapter.kind === "connect" ? (this.#B(n), i = S(t.identity)) : e.adapter.kind === "account" ? (t.event === "connected" ? this.#B(n) : (this.#f(), this.#n({ identity: null, status: "dormant" })), i = void 0) : this.#z(e, void 0), e.resolve(i), this.#a(e);
1193
+ let i = null;
1194
+ (e.adapter.kind === "connect" || e.adapter.kind === "account" && t.event === "connected") && (i = this.#z(t)), e.active = !1, this.#o = null, this.#_(e);
1195
+ let n = t;
1196
+ e.adapter.kind === "connect" ? (this.#Y(i), n = w(t.identity)) : e.adapter.kind === "account" ? (t.event === "connected" ? this.#Y(i) : (this.#f(), this.#i({ identity: null, status: "dormant" })), n = void 0) : this.#W(e, void 0), e.resolve(n), this.#a(e);
1166
1197
  }
1167
- #h(e, t, n = !0) {
1168
- this.#c(e) && this.#_(e, t, !0, n);
1198
+ #h(e, t, i = !0) {
1199
+ this.#c(e) && this.#I(e, t, !0, i);
1169
1200
  }
1170
- #_(e, t, n, i = !0) {
1201
+ #I(e, t, i, n = !0) {
1171
1202
  if (!e.active) return e.cleanup.promise;
1172
1203
  const o = this.#m;
1173
- e.active = !1, this.#o === e && (this.#o = null), this.#w += 1, this.#I(e);
1204
+ e.active = !1, this.#o === e && (this.#o = null), this.#w += 1, this.#_(e);
1174
1205
  for (const l of e.controllers)
1175
1206
  e.phase !== "registering" && l.abort();
1176
- const s = this.#t(o), u = s ?? c(t);
1177
- return e.reject(u), n && !s && this.#Y(e, u, e.priorConnection, e.adapter.kind), this.#r ? (e.challenge && e.verifier && this.#F(e), this.#a(e), e.cleanup.promise) : (!i || e.registrationOutcome === "definitive-failure" || e.registrationOutcome === "not-started" ? this.#a(e) : e.phase === "hashing" ? (e.registrationOutcome = "not-started", this.#a(e)) : e.phase === "registering" && e.registrationOutcome === "none" ? this.#j(e) : (this.#j(e), this.#A(e)), e.cleanup.promise);
1207
+ const s = this.#t(o), u = s ?? a(t);
1208
+ return e.reject(u), i && !s && this.#B(e, u, e.priorConnection, e.adapter.kind), this.#r ? (e.challenge && e.verifier && this.#q(e), this.#a(e), e.cleanup.promise) : (!n || e.registrationOutcome === "definitive-failure" || e.registrationOutcome === "not-started" ? this.#a(e) : e.phase === "hashing" ? (e.registrationOutcome = "not-started", this.#a(e)) : e.phase === "registering" && e.registrationOutcome === "none" ? this.#k(e) : (this.#k(e), this.#b(e)), e.cleanup.promise);
1178
1209
  }
1179
- #Y(e, t, n, i) {
1180
- if (n?.expiresAtMs > this.#i()) {
1181
- this.#s = n, this.#n({
1182
- connectionExpiresAt: n.expiresAt,
1183
- error: I(t),
1184
- identity: n.identity,
1210
+ #B(e, t, i, n) {
1211
+ if (i?.expiresAtMs > this.#n()) {
1212
+ this.#s = i, this.#i({
1213
+ connectionExpiresAt: i.expiresAt,
1214
+ error: T(t),
1215
+ identity: i.identity,
1185
1216
  status: "connected"
1186
1217
  });
1187
1218
  return;
1188
1219
  }
1189
- this.#f(), this.#n({
1190
- error: I(t),
1220
+ this.#f(), this.#i({
1221
+ error: T(t),
1191
1222
  identity: null,
1192
1223
  status: "error"
1193
1224
  });
1194
1225
  }
1195
- #K(e) {
1196
- const t = M(e.connectionExpiresAt), n = this.#i();
1197
- if (t <= n || t - n > ct)
1198
- throw c("RELAY_ERROR");
1226
+ #z(e) {
1227
+ const t = Y(e.connectionExpiresAt), i = this.#n();
1228
+ if (t <= i || t - i > Rt)
1229
+ throw a("RELAY_ERROR");
1199
1230
  return {
1200
1231
  expiresAt: e.connectionExpiresAt,
1201
1232
  expiresAtMs: t,
1202
- identity: S(e.identity)
1233
+ identity: w(e.identity)
1203
1234
  };
1204
1235
  }
1205
- #B(e) {
1206
- const t = this.#i();
1236
+ #Y(e) {
1237
+ const t = this.#n();
1207
1238
  this.#f(), this.#s = e;
1208
- const n = this.#s;
1239
+ const i = this.#s;
1209
1240
  this.#O = this.#g(() => {
1210
- this.#s === n && (this.#s = null, this.#O = null, this.#o ? this.#n({ identity: null, status: "opening" }) : this.#n({ identity: null, status: "dormant" }));
1211
- }, Math.max(0, e.expiresAtMs - t)), this.#n({
1241
+ this.#s === i && (this.#s = null, this.#O = null, this.#o ? this.#i({ identity: null, status: "opening" }) : this.#i({ identity: null, status: "dormant" }));
1242
+ }, Math.max(0, e.expiresAtMs - t)), this.#i({
1212
1243
  connectionExpiresAt: e.expiresAt,
1213
1244
  identity: this.#s.identity,
1214
1245
  status: "connected"
1215
1246
  });
1216
1247
  }
1217
- #z(e, t) {
1218
- const n = e.priorConnection;
1219
- n?.expiresAtMs > this.#i() ? (this.#s = n, this.#n({
1220
- connectionExpiresAt: n.expiresAt,
1221
- ...t ? { error: I(t) } : {},
1222
- identity: n.identity,
1248
+ #W(e, t) {
1249
+ const i = e.priorConnection;
1250
+ i?.expiresAtMs > this.#n() ? (this.#s = i, this.#i({
1251
+ connectionExpiresAt: i.expiresAt,
1252
+ ...t ? { error: T(t) } : {},
1253
+ identity: i.identity,
1223
1254
  status: "connected"
1224
- })) : t ? (this.#f(), this.#n({ error: I(t), identity: null, status: "error" })) : (this.#f(), this.#n({ identity: null, status: "dormant" }));
1255
+ })) : t ? (this.#f(), this.#i({ error: T(t), identity: null, status: "error" })) : (this.#f(), this.#i({ identity: null, status: "dormant" }));
1225
1256
  }
1226
1257
  #U() {
1227
- !this.#s || this.#s.expiresAtMs > this.#i() || (this.#f(), this.#o ? this.#n({ identity: null, status: "opening" }) : this.#n({ identity: null, status: "dormant" }));
1258
+ !this.#s || this.#s.expiresAtMs > this.#n() || (this.#f(), this.#o ? this.#i({ identity: null, status: "opening" }) : this.#i({ identity: null, status: "dormant" }));
1228
1259
  }
1229
1260
  #f() {
1230
1261
  this.#s = null, this.#d(this.#O), this.#O = null;
1231
1262
  }
1232
- #n(e) {
1233
- const t = S(e);
1234
- if (this.#M = t, this.#x.push(t), !this.#C) {
1235
- this.#C = !0;
1263
+ #i(e) {
1264
+ const t = w(e);
1265
+ if (this.#M = t, this.#P.push(t), !this.#x) {
1266
+ this.#x = !0;
1236
1267
  try {
1237
- for (; this.#x.length !== 0; ) {
1238
- const n = this.#x.shift();
1239
- for (const i of [...this.#v])
1268
+ for (; this.#P.length !== 0; ) {
1269
+ const i = this.#P.shift();
1270
+ for (const n of [...this.#v])
1240
1271
  try {
1241
- i(ie(n));
1272
+ n(le(i));
1242
1273
  } catch {
1243
1274
  }
1244
1275
  }
1245
1276
  } finally {
1246
- this.#C = !1;
1277
+ this.#x = !1;
1247
1278
  }
1248
1279
  }
1249
1280
  }
@@ -1251,12 +1282,12 @@ class At {
1251
1282
  return !this.#r && e.active && this.#o === e && e.generation === this.#w;
1252
1283
  }
1253
1284
  #t(e) {
1254
- return this.#r ? c("DESTROYED") : e !== this.#m ? c("REPLACED") : null;
1285
+ return this.#r ? a("DESTROYED") : e !== this.#m ? a("REPLACED") : null;
1255
1286
  }
1256
- #i() {
1287
+ #n() {
1257
1288
  return this.#e.now();
1258
1289
  }
1259
- #P(e) {
1290
+ #C(e) {
1260
1291
  const t = new this.#e.AbortController();
1261
1292
  return e.controllers.add(t), this.#E.add(t), t;
1262
1293
  }
@@ -1264,41 +1295,41 @@ class At {
1264
1295
  e.controllers.delete(t), this.#E.delete(t);
1265
1296
  }
1266
1297
  #g(e, t) {
1267
- let n;
1268
- return n = this.#e.setTimeout(() => {
1269
- this.#R.delete(n), e();
1270
- }, Math.max(0, t)), this.#R.add(n), n;
1298
+ let i;
1299
+ return i = this.#e.setTimeout(() => {
1300
+ this.#R.delete(i), e();
1301
+ }, Math.max(0, t)), this.#R.add(i), i;
1271
1302
  }
1272
- #H(e, t) {
1273
- const n = this.#e.setInterval(e, t);
1274
- return this.#R.add(n), n;
1303
+ #K(e, t) {
1304
+ const i = this.#e.setInterval(e, t);
1305
+ return this.#R.add(i), i;
1275
1306
  }
1276
1307
  #d(e, t = !1) {
1277
1308
  e != null && (t ? this.#e.clearInterval(e) : this.#e.clearTimeout(e), this.#R.delete(e));
1278
1309
  }
1279
- #I(e) {
1310
+ #_(e) {
1280
1311
  this.#d(e.expiryTimer), this.#d(e.pollTimer, !0), e.expiryTimer = null, e.pollTimer = null;
1281
1312
  }
1282
- #j(e) {
1313
+ #k(e) {
1283
1314
  if (!(e.cleanupFinished || this.#y.has(e)))
1284
- for (this.#y.add(e); this.#y.size > lt; ) {
1315
+ for (this.#y.add(e); this.#y.size > Et; ) {
1285
1316
  const t = this.#y.values().next().value;
1286
- for (const n of t.controllers) n.abort();
1317
+ for (const i of t.controllers) i.abort();
1287
1318
  this.#a(t);
1288
1319
  }
1289
1320
  }
1290
- async #A(e) {
1321
+ async #b(e) {
1291
1322
  if (e.cleanupFinished || e.cleanupStarted || this.#r)
1292
1323
  return e.cleanup.promise;
1293
- e.cleanupStarted = !0, this.#j(e);
1294
- let t = 100, n = !0;
1295
- for (; !this.#r && !e.cleanupFinished && (n || this.#i() <= e.registrationDeadlineMs); ) {
1296
- n = !1;
1297
- const i = await this.#F(e);
1324
+ e.cleanupStarted = !0, this.#k(e);
1325
+ let t = 100, i = !0;
1326
+ for (; !this.#r && !e.cleanupFinished && (i || this.#n() <= e.registrationDeadlineMs); ) {
1327
+ i = !1;
1328
+ const n = await this.#q(e);
1298
1329
  if (e.cleanupFinished) return e.cleanup.promise;
1299
- if (i === "done")
1330
+ if (n === "done")
1300
1331
  return this.#a(e), e.cleanup.promise;
1301
- const o = e.registrationDeadlineMs - this.#i();
1332
+ const o = e.registrationDeadlineMs - this.#n();
1302
1333
  if (o <= 0) break;
1303
1334
  await new Promise((s) => {
1304
1335
  e.retryResolve = s, e.retryTimer = this.#g(() => {
@@ -1308,29 +1339,29 @@ class At {
1308
1339
  }
1309
1340
  return this.#a(e), e.cleanup.promise;
1310
1341
  }
1311
- async #F(e) {
1342
+ async #q(e) {
1312
1343
  if (!e.verifier || !e.challenge) return "done";
1313
- const t = this.#P(e), n = e.registrationDeadlineMs - this.#i(), i = n > 0 ? Math.min(4e3, n) : 1e3, o = this.#g(() => t.abort(), Math.max(1, i));
1344
+ const t = this.#C(e), i = e.registrationDeadlineMs - this.#n(), n = i > 0 ? Math.min(4e3, i) : 1e3, o = this.#g(() => t.abort(), Math.max(1, n));
1314
1345
  let s = null;
1315
1346
  try {
1316
1347
  const u = this.#e.fetch(
1317
1348
  `${_}/relay/v1/transactions/${e.transactionId}/cancel`,
1318
- k({
1349
+ $({
1319
1350
  codeVerifier: e.verifier,
1320
1351
  schemaVersion: 1,
1321
1352
  state: e.state,
1322
1353
  transactionId: e.transactionId
1323
1354
  }, t.signal)
1324
1355
  );
1325
- s = await Y(
1356
+ s = await U(
1326
1357
  u,
1327
1358
  t.signal,
1328
1359
  x
1329
1360
  );
1330
1361
  const l = s.status;
1331
- return L(t, s), s = null, l === 204 || l === 400 || l === 403 || l === 409 || l === 410 ? "done" : "retry";
1362
+ return I(t, s), s = null, l === 204 || l === 400 || l === 403 || l === 409 || l === 410 ? "done" : "retry";
1332
1363
  } catch {
1333
- return s && L(t, s), "retry";
1364
+ return s && I(t, s), "retry";
1334
1365
  } finally {
1335
1366
  try {
1336
1367
  t.abort();
@@ -1345,7 +1376,7 @@ class At {
1345
1376
  t = this.#e.fetch(
1346
1377
  `${_}/relay/v1/transactions/${e.transactionId}/cancel`,
1347
1378
  {
1348
- ...k({
1379
+ ...$({
1349
1380
  codeVerifier: e.verifier,
1350
1381
  schemaVersion: 1,
1351
1382
  state: e.state,
@@ -1358,11 +1389,11 @@ class At {
1358
1389
  } catch {
1359
1390
  return;
1360
1391
  }
1361
- X(Promise.resolve(t).then(x));
1392
+ G(Promise.resolve(t).then(x));
1362
1393
  }
1363
1394
  #a(e) {
1364
1395
  if (!e.cleanupFinished) {
1365
- e.cleanupFinished = !0, this.#d(e.retryTimer), e.retryResolve?.(), e.retryResolve = null, e.retryTimer = null, this.#d(e.operationTimer), e.operationTimer = null, this.#I(e);
1396
+ e.cleanupFinished = !0, this.#d(e.retryTimer), e.retryResolve?.(), e.retryResolve = null, e.retryTimer = null, this.#d(e.operationTimer), e.operationTimer = null, this.#_(e);
1366
1397
  for (const t of e.controllers)
1367
1398
  t.abort(), this.#E.delete(t);
1368
1399
  e.controllers.clear(), this.#y.delete(e), e.adapter = null, e.challenge = null, e.priorConnection = null, e.request = null, e.state = null, e.transactionExpiresAtMs = null, e.transactionId = null, e.verifier = null, e.cleanup.resolve();
@@ -1395,29 +1426,29 @@ class At {
1395
1426
  const t = (o) => {
1396
1427
  const s = this.#o;
1397
1428
  if (!s || !this.#c(s)) return;
1398
- const u = `${j}${s.state}`;
1429
+ const u = `${V}${s.state}`;
1399
1430
  o?.key === u && this.#N(s, !0);
1400
1431
  };
1401
1432
  this.#L = t;
1402
- let n = !1, i = null;
1433
+ let i = !1, n = null;
1403
1434
  try {
1404
1435
  const o = this.#p?.addEventListener, s = this.#p?.removeEventListener;
1405
1436
  if (typeof o != "function" || typeof s != "function")
1406
1437
  throw new TypeError("storage events unavailable");
1407
- i = () => Reflect.apply(
1438
+ n = () => Reflect.apply(
1408
1439
  s,
1409
1440
  this.#p,
1410
1441
  ["storage", t]
1411
- ), this.#b = i, Reflect.apply(o, this.#p, ["storage", this.#L]), n = !0;
1442
+ ), this.#A = n, Reflect.apply(o, this.#p, ["storage", this.#L]), i = !0;
1412
1443
  } catch {
1413
1444
  this.#l = !0;
1414
1445
  }
1415
- if (!n || this.#r || this.#l) {
1446
+ if (!i || this.#r || this.#l) {
1416
1447
  try {
1417
- i?.();
1448
+ n?.();
1418
1449
  } catch {
1419
1450
  }
1420
- this.#L = null, this.#b = null, this.#u = null;
1451
+ this.#L = null, this.#A = null, this.#u = null;
1421
1452
  }
1422
1453
  } finally {
1423
1454
  this.#T = !1;
@@ -1434,109 +1465,123 @@ class At {
1434
1465
  return;
1435
1466
  }
1436
1467
  if (!Number.isSafeInteger(t) || t < 0) return;
1437
- const n = Math.min(t, ut), i = [];
1438
- for (let o = 0; o < n && !this.#r && !this.#l; o += 1) {
1468
+ const i = Math.min(t, At), n = [];
1469
+ for (let o = 0; o < i && !this.#r && !this.#l; o += 1) {
1439
1470
  let s;
1440
1471
  try {
1441
1472
  s = e.key(o);
1442
1473
  } catch {
1443
1474
  continue;
1444
1475
  }
1445
- i.push(s);
1476
+ n.push(s);
1446
1477
  }
1447
- for (const o of i) {
1478
+ for (const o of n) {
1448
1479
  if (this.#r || this.#l) return;
1449
- if (typeof o != "string" || !o.startsWith(j)) continue;
1450
- const s = o.slice(j.length);
1451
- if (T.test(s))
1480
+ if (typeof o != "string" || !o.startsWith(V)) continue;
1481
+ const s = o.slice(V.length);
1482
+ if (P.test(s))
1452
1483
  try {
1453
1484
  const u = e.getItem(o);
1454
1485
  if (u === null) continue;
1455
- const l = $(
1456
- V(u, 2048),
1486
+ const l = B(
1487
+ M(u, 2048),
1457
1488
  ["code", "expiresAt", "schemaVersion", "state"],
1458
1489
  "CALLBACK_ERROR"
1459
1490
  );
1460
- if (l.schemaVersion !== 1 || l.state !== s || !T.test(l.code))
1491
+ if (l.schemaVersion !== 1 || l.state !== s || !P.test(l.code))
1461
1492
  continue;
1462
- M(l.expiresAt, "CALLBACK_ERROR") <= this.#i() && e.removeItem(o);
1493
+ Y(l.expiresAt, "CALLBACK_ERROR") <= this.#n() && e.removeItem(o);
1463
1494
  } catch {
1464
1495
  }
1465
1496
  }
1466
1497
  }
1467
1498
  }
1468
- function Et(r) {
1469
- return new At(r);
1499
+ function we(r) {
1500
+ return new _t(r);
1470
1501
  }
1471
- function bt(r, e = {}) {
1472
- const t = (i, o) => i !== 0 ? Promise.reject(c("INVALID_REQUEST")) : o(), n = {
1473
- connect(...i) {
1474
- return t(i.length, () => r.execute("connect", void 0));
1502
+ function ve(r, e = {}) {
1503
+ const t = (n, o) => n !== 0 ? Promise.reject(a("INVALID_REQUEST")) : o(), i = {
1504
+ connect(...n) {
1505
+ return t(n.length, () => r.execute("connect", void 0));
1475
1506
  },
1476
- destroy(...i) {
1477
- return t(i.length, () => r.destroy());
1507
+ destroy(...n) {
1508
+ return t(n.length, () => r.destroy());
1478
1509
  },
1479
- disconnect(...i) {
1480
- return t(i.length, () => r.disconnect());
1510
+ disconnect(...n) {
1511
+ return t(n.length, () => r.disconnect());
1481
1512
  },
1482
- getSnapshot(...i) {
1483
- if (i.length !== 0) throw c("INVALID_REQUEST");
1513
+ getSnapshot(...n) {
1514
+ if (n.length !== 0) throw a("INVALID_REQUEST");
1484
1515
  return r.getSnapshot();
1485
1516
  },
1486
- openAccount(...i) {
1487
- return t(i.length, () => r.execute("account", void 0));
1517
+ openAccount(...n) {
1518
+ return t(n.length, () => r.execute("account", void 0));
1488
1519
  },
1489
- subscribe(i, ...o) {
1490
- if (o.length !== 0) throw c("INVALID_REQUEST");
1491
- return r.subscribe(i);
1520
+ subscribe(n, ...o) {
1521
+ if (o.length !== 0) throw a("INVALID_REQUEST");
1522
+ return r.subscribe(n);
1492
1523
  }
1493
1524
  };
1494
- for (const [i, o] of Object.entries(e))
1495
- n[i] = function(u, ...l) {
1496
- return l.length !== 0 ? Promise.reject(c("INVALID_REQUEST")) : r.execute(o, u);
1525
+ for (const [n, o] of Object.entries(e))
1526
+ i[n] = function(u, ...l) {
1527
+ return l.length !== 0 ? Promise.reject(a("INVALID_REQUEST")) : r.execute(o, u);
1497
1528
  };
1498
- return Object.freeze(n);
1529
+ return Object.freeze(i);
1499
1530
  }
1500
- const gt = Object.freeze({
1531
+ const Le = Object.freeze({
1501
1532
  account: Object.freeze({
1502
- buildRequest: () => Qe({}),
1533
+ buildRequest: () => st({}),
1503
1534
  kind: "account",
1504
1535
  operation: "sdn.wallet.account.v1",
1505
- parseResult: Ze
1536
+ parseResult: ot
1506
1537
  }),
1507
1538
  connect: Object.freeze({
1508
- buildRequest: () => He({}),
1539
+ buildRequest: () => it({}),
1509
1540
  kind: "connect",
1510
1541
  operation: "sdn.wallet.connect.v1",
1511
- parseResult: Xe
1542
+ parseResult: nt
1512
1543
  })
1513
- }), Ot = Object.freeze({
1514
- ...gt,
1544
+ }), Tt = Object.freeze({
1545
+ ...Le,
1515
1546
  sdnLoginV1: Object.freeze({
1516
- buildRequest: Ge,
1547
+ buildRequest: ct,
1517
1548
  kind: "typed",
1518
1549
  operation: "sdn.auth.raw-challenge.v1",
1519
- parseResult: et
1550
+ parseResult: at
1520
1551
  }),
1521
1552
  sdnLoginV2: Object.freeze({
1522
- buildRequest: tt,
1553
+ buildRequest: lt,
1523
1554
  kind: "typed",
1524
1555
  operation: "sdn.auth.jcs-envelope.v2",
1525
- parseResult: rt
1556
+ parseResult: ut
1526
1557
  })
1527
1558
  });
1528
- function St() {
1529
- if (arguments.length !== 0) throw c("INVALID_REQUEST");
1530
- const r = Et({
1531
- adapters: Ot,
1559
+ function Pt() {
1560
+ if (arguments.length !== 0) throw a("INVALID_REQUEST");
1561
+ const r = we({
1562
+ adapters: Tt,
1532
1563
  clientId: "sdn-node-console-v1"
1533
1564
  });
1534
- return bt(r, {
1565
+ return ve(r, {
1535
1566
  requestSdnLoginV1: "sdnLoginV1",
1536
1567
  requestSdnLoginV2: "sdnLoginV2"
1537
1568
  });
1538
1569
  }
1570
+ function xt() {
1571
+ if (arguments.length !== 0) throw a("INVALID_REQUEST");
1572
+ const r = we({
1573
+ adapters: Object.freeze({ ...Le, publish: Object.freeze({
1574
+ buildRequest: ht,
1575
+ kind: "typed",
1576
+ operation: "sdn.auth.publish-request.v1",
1577
+ parseResult: ft
1578
+ }) }),
1579
+ clientId: "spaceaware-web-v1"
1580
+ });
1581
+ return ve(r, { requestSdnPublish: "publish" });
1582
+ }
1539
1583
  export {
1540
- Ee as WALLET_CLIENT_ERRORS,
1541
- St as createSdnWalletClient
1584
+ ge as WALLET_CLIENT_ERRORS,
1585
+ Pt as createSdnWalletClient,
1586
+ xt as createSpaceAwarePublishWalletClient
1542
1587
  };