@ffaerber/swarm-connect 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import tr, { useState as U, useCallback as nr, useEffect as ae } from "react";
2
- import { useAccount as or, useChainId as ir, useDisconnect as zr, useConnect as Ur, useSwitchChain as Mr, createConfig as Br, http as Nr, WagmiProvider as Yr } from "wagmi";
3
- import { QueryClient as qr, QueryClientProvider as Vr } from "@tanstack/react-query";
4
- import { getAddress as oe, SwitchChainError as Je, numberToHex as Xe, UserRejectedRequestError as F, withRetry as Gr, withTimeout as Hr, ResourceUnavailableRpcError as xe } from "viem";
5
- var we = { exports: {} }, X = {};
1
+ import pt, { useState as F, useCallback as ce, useEffect as Q, useRef as Jt } from "react";
2
+ import { useAccount as we, useBalance as vt, useConnect as Xt, useDisconnect as gt, useSwitchChain as Qt, useSendTransaction as en, useWriteContract as tn, useWaitForTransactionReceipt as at, useReadContract as nn, createConfig as rn, http as an, WagmiProvider as on } from "wagmi";
3
+ import { erc20Abi as ot, parseEther as sn, parseUnits as cn, getAddress as me, SwitchChainError as it, numberToHex as st, UserRejectedRequestError as U, withRetry as ln, withTimeout as dn, ResourceUnavailableRpcError as Fe } from "viem";
4
+ import { QueryClient as un, QueryClientProvider as fn } from "@tanstack/react-query";
5
+ var Pe = { exports: {} }, ie = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.min.js
@@ -12,21 +12,21 @@ var we = { exports: {} }, X = {};
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
- var Qe;
16
- function Kr() {
17
- if (Qe) return X;
18
- Qe = 1;
19
- var t = tr, n = Symbol.for("react.element"), i = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, u = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
20
- function g(x, f, s) {
21
- var d, v = {}, b = null, R = null;
22
- s !== void 0 && (b = "" + s), f.key !== void 0 && (b = "" + f.key), f.ref !== void 0 && (R = f.ref);
23
- for (d in f) c.call(f, d) && !p.hasOwnProperty(d) && (v[d] = f[d]);
24
- if (x && x.defaultProps) for (d in f = x.defaultProps, f) v[d] === void 0 && (v[d] = f[d]);
25
- return { $$typeof: n, type: x, key: b, ref: R, props: v, _owner: u.current };
15
+ var ct;
16
+ function hn() {
17
+ if (ct) return ie;
18
+ ct = 1;
19
+ var n = pt, r = Symbol.for("react.element"), a = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function h(p, u, o) {
21
+ var l, v = {}, g = null, b = null;
22
+ o !== void 0 && (g = "" + o), u.key !== void 0 && (g = "" + u.key), u.ref !== void 0 && (b = u.ref);
23
+ for (l in u) i.call(u, l) && !d.hasOwnProperty(l) && (v[l] = u[l]);
24
+ if (p && p.defaultProps) for (l in u = p.defaultProps, u) v[l] === void 0 && (v[l] = u[l]);
25
+ return { $$typeof: r, type: p, key: g, ref: b, props: v, _owner: s.current };
26
26
  }
27
- return X.Fragment = i, X.jsx = g, X.jsxs = g, X;
27
+ return ie.Fragment = a, ie.jsx = h, ie.jsxs = h, ie;
28
28
  }
29
- var Q = {};
29
+ var se = {};
30
30
  /**
31
31
  * @license React
32
32
  * react-jsx-runtime.development.js
@@ -36,91 +36,91 @@ var Q = {};
36
36
  * This source code is licensed under the MIT license found in the
37
37
  * LICENSE file in the root directory of this source tree.
38
38
  */
39
- var Ze;
40
- function Jr() {
41
- return Ze || (Ze = 1, process.env.NODE_ENV !== "production" && function() {
42
- var t = tr, n = Symbol.for("react.element"), i = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), x = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), s = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), R = Symbol.for("react.offscreen"), A = Symbol.iterator, W = "@@iterator";
43
- function L(e) {
39
+ var lt;
40
+ function pn() {
41
+ return lt || (lt = 1, process.env.NODE_ENV !== "production" && function() {
42
+ var n = pt, r = Symbol.for("react.element"), a = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), p = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), o = Symbol.for("react.suspense"), l = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), _ = Symbol.iterator, E = "@@iterator";
43
+ function O(e) {
44
44
  if (e === null || typeof e != "object")
45
45
  return null;
46
- var o = A && e[A] || e[W];
47
- return typeof o == "function" ? o : null;
46
+ var c = _ && e[_] || e[E];
47
+ return typeof c == "function" ? c : null;
48
48
  }
49
- var I = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
- function S(e) {
49
+ var S = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
+ function w(e) {
51
51
  {
52
- for (var o = arguments.length, l = new Array(o > 1 ? o - 1 : 0), h = 1; h < o; h++)
53
- l[h - 1] = arguments[h];
54
- T("error", e, l);
52
+ for (var c = arguments.length, f = new Array(c > 1 ? c - 1 : 0), m = 1; m < c; m++)
53
+ f[m - 1] = arguments[m];
54
+ I("error", e, f);
55
55
  }
56
56
  }
57
- function T(e, o, l) {
57
+ function I(e, c, f) {
58
58
  {
59
- var h = I.ReactDebugCurrentFrame, w = h.getStackAddendum();
60
- w !== "" && (o += "%s", l = l.concat([w]));
61
- var j = l.map(function(m) {
62
- return String(m);
59
+ var m = S.ReactDebugCurrentFrame, j = m.getStackAddendum();
60
+ j !== "" && (c += "%s", f = f.concat([j]));
61
+ var C = f.map(function(y) {
62
+ return String(y);
63
63
  });
64
- j.unshift("Warning: " + o), Function.prototype.apply.call(console[e], console, j);
64
+ C.unshift("Warning: " + c), Function.prototype.apply.call(console[e], console, C);
65
65
  }
66
66
  }
67
- var _ = !1, C = !1, $ = !1, G = !1, de = !1, H;
68
- H = Symbol.for("react.module.reference");
69
- function ur(e) {
70
- return !!(typeof e == "string" || typeof e == "function" || e === c || e === p || de || e === u || e === s || e === d || G || e === R || _ || C || $ || typeof e == "object" && e !== null && (e.$$typeof === b || e.$$typeof === v || e.$$typeof === g || e.$$typeof === x || e.$$typeof === f || // This needs to include all possible module reference object
67
+ var R = !1, k = !1, z = !1, Y = !1, Z = !1, W;
68
+ W = Symbol.for("react.module.reference");
69
+ function te(e) {
70
+ return !!(typeof e == "string" || typeof e == "function" || e === i || e === d || Z || e === s || e === o || e === l || Y || e === b || R || k || z || typeof e == "object" && e !== null && (e.$$typeof === g || e.$$typeof === v || e.$$typeof === h || e.$$typeof === p || e.$$typeof === u || // This needs to include all possible module reference object
71
71
  // types supported by any Flight configuration anywhere since
72
72
  // we don't know which Flight build this will end up being used
73
73
  // with.
74
- e.$$typeof === H || e.getModuleId !== void 0));
74
+ e.$$typeof === W || e.getModuleId !== void 0));
75
75
  }
76
- function dr(e, o, l) {
77
- var h = e.displayName;
78
- if (h)
79
- return h;
80
- var w = o.displayName || o.name || "";
81
- return w !== "" ? l + "(" + w + ")" : l;
76
+ function ne(e, c, f) {
77
+ var m = e.displayName;
78
+ if (m)
79
+ return m;
80
+ var j = c.displayName || c.name || "";
81
+ return j !== "" ? f + "(" + j + ")" : f;
82
82
  }
83
- function ke(e) {
83
+ function re(e) {
84
84
  return e.displayName || "Context";
85
85
  }
86
- function z(e) {
86
+ function B(e) {
87
87
  if (e == null)
88
88
  return null;
89
- if (typeof e.tag == "number" && S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
89
+ if (typeof e.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
90
90
  return e.displayName || e.name || null;
91
91
  if (typeof e == "string")
92
92
  return e;
93
93
  switch (e) {
94
- case c:
95
- return "Fragment";
96
94
  case i:
95
+ return "Fragment";
96
+ case a:
97
97
  return "Portal";
98
- case p:
98
+ case d:
99
99
  return "Profiler";
100
- case u:
101
- return "StrictMode";
102
100
  case s:
101
+ return "StrictMode";
102
+ case o:
103
103
  return "Suspense";
104
- case d:
104
+ case l:
105
105
  return "SuspenseList";
106
106
  }
107
107
  if (typeof e == "object")
108
108
  switch (e.$$typeof) {
109
- case x:
110
- var o = e;
111
- return ke(o) + ".Consumer";
112
- case g:
113
- var l = e;
114
- return ke(l._context) + ".Provider";
115
- case f:
116
- return dr(e, e.render, "ForwardRef");
109
+ case p:
110
+ var c = e;
111
+ return re(c) + ".Consumer";
112
+ case h:
113
+ var f = e;
114
+ return re(f._context) + ".Provider";
115
+ case u:
116
+ return ne(e, e.render, "ForwardRef");
117
117
  case v:
118
- var h = e.displayName || null;
119
- return h !== null ? h : z(e.type) || "Memo";
120
- case b: {
121
- var w = e, j = w._payload, m = w._init;
118
+ var m = e.displayName || null;
119
+ return m !== null ? m : B(e.type) || "Memo";
120
+ case g: {
121
+ var j = e, C = j._payload, y = j._init;
122
122
  try {
123
- return z(m(j));
123
+ return B(y(C));
124
124
  } catch {
125
125
  return null;
126
126
  }
@@ -128,18 +128,18 @@ function Jr() {
128
128
  }
129
129
  return null;
130
130
  }
131
- var M = Object.assign, K = 0, _e, Ee, Ie, Te, Pe, Oe, Ae;
132
- function De() {
131
+ var M = Object.assign, N = 0, fe, D, ae, Le, We, Be, Me;
132
+ function Ne() {
133
133
  }
134
- De.__reactDisabledLog = !0;
135
- function fr() {
134
+ Ne.__reactDisabledLog = !0;
135
+ function St() {
136
136
  {
137
- if (K === 0) {
138
- _e = console.log, Ee = console.info, Ie = console.warn, Te = console.error, Pe = console.group, Oe = console.groupCollapsed, Ae = console.groupEnd;
137
+ if (N === 0) {
138
+ fe = console.log, D = console.info, ae = console.warn, Le = console.error, We = console.group, Be = console.groupCollapsed, Me = console.groupEnd;
139
139
  var e = {
140
140
  configurable: !0,
141
141
  enumerable: !0,
142
- value: De,
142
+ value: Ne,
143
143
  writable: !0
144
144
  };
145
145
  Object.defineProperties(console, {
@@ -152,12 +152,12 @@ function Jr() {
152
152
  groupEnd: e
153
153
  });
154
154
  }
155
- K++;
155
+ N++;
156
156
  }
157
157
  }
158
- function hr() {
158
+ function Ct() {
159
159
  {
160
- if (K--, K === 0) {
160
+ if (N--, N === 0) {
161
161
  var e = {
162
162
  configurable: !0,
163
163
  enumerable: !0,
@@ -165,319 +165,319 @@ function Jr() {
165
165
  };
166
166
  Object.defineProperties(console, {
167
167
  log: M({}, e, {
168
- value: _e
168
+ value: fe
169
169
  }),
170
170
  info: M({}, e, {
171
- value: Ee
171
+ value: D
172
172
  }),
173
173
  warn: M({}, e, {
174
- value: Ie
174
+ value: ae
175
175
  }),
176
176
  error: M({}, e, {
177
- value: Te
177
+ value: Le
178
178
  }),
179
179
  group: M({}, e, {
180
- value: Pe
180
+ value: We
181
181
  }),
182
182
  groupCollapsed: M({}, e, {
183
- value: Oe
183
+ value: Be
184
184
  }),
185
185
  groupEnd: M({}, e, {
186
- value: Ae
186
+ value: Me
187
187
  })
188
188
  });
189
189
  }
190
- K < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
190
+ N < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
191
191
  }
192
192
  }
193
- var fe = I.ReactCurrentDispatcher, he;
194
- function ee(e, o, l) {
193
+ var je = S.ReactCurrentDispatcher, Se;
194
+ function he(e, c, f) {
195
195
  {
196
- if (he === void 0)
196
+ if (Se === void 0)
197
197
  try {
198
198
  throw Error();
199
- } catch (w) {
200
- var h = w.stack.trim().match(/\n( *(at )?)/);
201
- he = h && h[1] || "";
199
+ } catch (j) {
200
+ var m = j.stack.trim().match(/\n( *(at )?)/);
201
+ Se = m && m[1] || "";
202
202
  }
203
203
  return `
204
- ` + he + e;
204
+ ` + Se + e;
205
205
  }
206
206
  }
207
- var pe = !1, re;
207
+ var Ce = !1, pe;
208
208
  {
209
- var pr = typeof WeakMap == "function" ? WeakMap : Map;
210
- re = new pr();
209
+ var Rt = typeof WeakMap == "function" ? WeakMap : Map;
210
+ pe = new Rt();
211
211
  }
212
- function $e(e, o) {
213
- if (!e || pe)
212
+ function Ue(e, c) {
213
+ if (!e || Ce)
214
214
  return "";
215
215
  {
216
- var l = re.get(e);
217
- if (l !== void 0)
218
- return l;
216
+ var f = pe.get(e);
217
+ if (f !== void 0)
218
+ return f;
219
219
  }
220
- var h;
221
- pe = !0;
222
- var w = Error.prepareStackTrace;
220
+ var m;
221
+ Ce = !0;
222
+ var j = Error.prepareStackTrace;
223
223
  Error.prepareStackTrace = void 0;
224
- var j;
225
- j = fe.current, fe.current = null, fr();
224
+ var C;
225
+ C = je.current, je.current = null, St();
226
226
  try {
227
- if (o) {
228
- var m = function() {
227
+ if (c) {
228
+ var y = function() {
229
229
  throw Error();
230
230
  };
231
- if (Object.defineProperty(m.prototype, "props", {
231
+ if (Object.defineProperty(y.prototype, "props", {
232
232
  set: function() {
233
233
  throw Error();
234
234
  }
235
235
  }), typeof Reflect == "object" && Reflect.construct) {
236
236
  try {
237
- Reflect.construct(m, []);
238
- } catch (O) {
239
- h = O;
237
+ Reflect.construct(y, []);
238
+ } catch ($) {
239
+ m = $;
240
240
  }
241
- Reflect.construct(e, [], m);
241
+ Reflect.construct(e, [], y);
242
242
  } else {
243
243
  try {
244
- m.call();
245
- } catch (O) {
246
- h = O;
244
+ y.call();
245
+ } catch ($) {
246
+ m = $;
247
247
  }
248
- e.call(m.prototype);
248
+ e.call(y.prototype);
249
249
  }
250
250
  } else {
251
251
  try {
252
252
  throw Error();
253
- } catch (O) {
254
- h = O;
253
+ } catch ($) {
254
+ m = $;
255
255
  }
256
256
  e();
257
257
  }
258
- } catch (O) {
259
- if (O && h && typeof O.stack == "string") {
260
- for (var y = O.stack.split(`
261
- `), P = h.stack.split(`
262
- `), k = y.length - 1, E = P.length - 1; k >= 1 && E >= 0 && y[k] !== P[E]; )
263
- E--;
264
- for (; k >= 1 && E >= 0; k--, E--)
265
- if (y[k] !== P[E]) {
266
- if (k !== 1 || E !== 1)
258
+ } catch ($) {
259
+ if ($ && m && typeof $.stack == "string") {
260
+ for (var x = $.stack.split(`
261
+ `), A = m.stack.split(`
262
+ `), T = x.length - 1, P = A.length - 1; T >= 1 && P >= 0 && x[T] !== A[P]; )
263
+ P--;
264
+ for (; T >= 1 && P >= 0; T--, P--)
265
+ if (x[T] !== A[P]) {
266
+ if (T !== 1 || P !== 1)
267
267
  do
268
- if (k--, E--, E < 0 || y[k] !== P[E]) {
269
- var D = `
270
- ` + y[k].replace(" at new ", " at ");
271
- return e.displayName && D.includes("<anonymous>") && (D = D.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, D), D;
268
+ if (T--, P--, P < 0 || x[T] !== A[P]) {
269
+ var L = `
270
+ ` + x[T].replace(" at new ", " at ");
271
+ return e.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", e.displayName)), typeof e == "function" && pe.set(e, L), L;
272
272
  }
273
- while (k >= 1 && E >= 0);
273
+ while (T >= 1 && P >= 0);
274
274
  break;
275
275
  }
276
276
  }
277
277
  } finally {
278
- pe = !1, fe.current = j, hr(), Error.prepareStackTrace = w;
278
+ Ce = !1, je.current = C, Ct(), Error.prepareStackTrace = j;
279
279
  }
280
- var q = e ? e.displayName || e.name : "", B = q ? ee(q) : "";
281
- return typeof e == "function" && re.set(e, B), B;
280
+ var J = e ? e.displayName || e.name : "", V = J ? he(J) : "";
281
+ return typeof e == "function" && pe.set(e, V), V;
282
282
  }
283
- function gr(e, o, l) {
284
- return $e(e, !1);
283
+ function _t(e, c, f) {
284
+ return Ue(e, !1);
285
285
  }
286
- function vr(e) {
287
- var o = e.prototype;
288
- return !!(o && o.isReactComponent);
286
+ function Et(e) {
287
+ var c = e.prototype;
288
+ return !!(c && c.isReactComponent);
289
289
  }
290
- function te(e, o, l) {
290
+ function ve(e, c, f) {
291
291
  if (e == null)
292
292
  return "";
293
293
  if (typeof e == "function")
294
- return $e(e, vr(e));
294
+ return Ue(e, Et(e));
295
295
  if (typeof e == "string")
296
- return ee(e);
296
+ return he(e);
297
297
  switch (e) {
298
- case s:
299
- return ee("Suspense");
300
- case d:
301
- return ee("SuspenseList");
298
+ case o:
299
+ return he("Suspense");
300
+ case l:
301
+ return he("SuspenseList");
302
302
  }
303
303
  if (typeof e == "object")
304
304
  switch (e.$$typeof) {
305
- case f:
306
- return gr(e.render);
305
+ case u:
306
+ return _t(e.render);
307
307
  case v:
308
- return te(e.type, o, l);
309
- case b: {
310
- var h = e, w = h._payload, j = h._init;
308
+ return ve(e.type, c, f);
309
+ case g: {
310
+ var m = e, j = m._payload, C = m._init;
311
311
  try {
312
- return te(j(w), o, l);
312
+ return ve(C(j), c, f);
313
313
  } catch {
314
314
  }
315
315
  }
316
316
  }
317
317
  return "";
318
318
  }
319
- var J = Object.prototype.hasOwnProperty, We = {}, Fe = I.ReactDebugCurrentFrame;
320
- function ne(e) {
319
+ var oe = Object.prototype.hasOwnProperty, qe = {}, Ye = S.ReactDebugCurrentFrame;
320
+ function ge(e) {
321
321
  if (e) {
322
- var o = e._owner, l = te(e.type, e._source, o ? o.type : null);
323
- Fe.setExtraStackFrame(l);
322
+ var c = e._owner, f = ve(e.type, e._source, c ? c.type : null);
323
+ Ye.setExtraStackFrame(f);
324
324
  } else
325
- Fe.setExtraStackFrame(null);
325
+ Ye.setExtraStackFrame(null);
326
326
  }
327
- function yr(e, o, l, h, w) {
327
+ function It(e, c, f, m, j) {
328
328
  {
329
- var j = Function.call.bind(J);
330
- for (var m in e)
331
- if (j(e, m)) {
332
- var y = void 0;
329
+ var C = Function.call.bind(oe);
330
+ for (var y in e)
331
+ if (C(e, y)) {
332
+ var x = void 0;
333
333
  try {
334
- if (typeof e[m] != "function") {
335
- var P = Error((h || "React class") + ": " + l + " type `" + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[m] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
336
- throw P.name = "Invariant Violation", P;
334
+ if (typeof e[y] != "function") {
335
+ var A = Error((m || "React class") + ": " + f + " type `" + y + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[y] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
336
+ throw A.name = "Invariant Violation", A;
337
337
  }
338
- y = e[m](o, m, h, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
- } catch (k) {
340
- y = k;
338
+ x = e[y](c, y, m, f, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
+ } catch (T) {
340
+ x = T;
341
341
  }
342
- y && !(y instanceof Error) && (ne(w), S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", h || "React class", l, m, typeof y), ne(null)), y instanceof Error && !(y.message in We) && (We[y.message] = !0, ne(w), S("Failed %s type: %s", l, y.message), ne(null));
342
+ x && !(x instanceof Error) && (ge(j), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", m || "React class", f, y, typeof x), ge(null)), x instanceof Error && !(x.message in qe) && (qe[x.message] = !0, ge(j), w("Failed %s type: %s", f, x.message), ge(null));
343
343
  }
344
344
  }
345
345
  }
346
- var mr = Array.isArray;
347
- function ge(e) {
348
- return mr(e);
346
+ var Tt = Array.isArray;
347
+ function Re(e) {
348
+ return Tt(e);
349
349
  }
350
- function br(e) {
350
+ function Ft(e) {
351
351
  {
352
- var o = typeof Symbol == "function" && Symbol.toStringTag, l = o && e[Symbol.toStringTag] || e.constructor.name || "Object";
353
- return l;
352
+ var c = typeof Symbol == "function" && Symbol.toStringTag, f = c && e[Symbol.toStringTag] || e.constructor.name || "Object";
353
+ return f;
354
354
  }
355
355
  }
356
- function xr(e) {
356
+ function Pt(e) {
357
357
  try {
358
- return Le(e), !1;
358
+ return Ge(e), !1;
359
359
  } catch {
360
360
  return !0;
361
361
  }
362
362
  }
363
- function Le(e) {
363
+ function Ge(e) {
364
364
  return "" + e;
365
365
  }
366
- function ze(e) {
367
- if (xr(e))
368
- return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", br(e)), Le(e);
366
+ function He(e) {
367
+ if (Pt(e))
368
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ft(e)), Ge(e);
369
369
  }
370
- var Ue = I.ReactCurrentOwner, wr = {
370
+ var Ve = S.ReactCurrentOwner, Dt = {
371
371
  key: !0,
372
372
  ref: !0,
373
373
  __self: !0,
374
374
  __source: !0
375
- }, Me, Be;
376
- function jr(e) {
377
- if (J.call(e, "ref")) {
378
- var o = Object.getOwnPropertyDescriptor(e, "ref").get;
379
- if (o && o.isReactWarning)
375
+ }, Ze, Ke;
376
+ function Ot(e) {
377
+ if (oe.call(e, "ref")) {
378
+ var c = Object.getOwnPropertyDescriptor(e, "ref").get;
379
+ if (c && c.isReactWarning)
380
380
  return !1;
381
381
  }
382
382
  return e.ref !== void 0;
383
383
  }
384
- function Sr(e) {
385
- if (J.call(e, "key")) {
386
- var o = Object.getOwnPropertyDescriptor(e, "key").get;
387
- if (o && o.isReactWarning)
384
+ function zt(e) {
385
+ if (oe.call(e, "key")) {
386
+ var c = Object.getOwnPropertyDescriptor(e, "key").get;
387
+ if (c && c.isReactWarning)
388
388
  return !1;
389
389
  }
390
390
  return e.key !== void 0;
391
391
  }
392
- function Cr(e, o) {
393
- typeof e.ref == "string" && Ue.current;
392
+ function At(e, c) {
393
+ typeof e.ref == "string" && Ve.current;
394
394
  }
395
- function Rr(e, o) {
395
+ function $t(e, c) {
396
396
  {
397
- var l = function() {
398
- Me || (Me = !0, S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", o));
397
+ var f = function() {
398
+ Ze || (Ze = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
399
399
  };
400
- l.isReactWarning = !0, Object.defineProperty(e, "key", {
401
- get: l,
400
+ f.isReactWarning = !0, Object.defineProperty(e, "key", {
401
+ get: f,
402
402
  configurable: !0
403
403
  });
404
404
  }
405
405
  }
406
- function kr(e, o) {
406
+ function Lt(e, c) {
407
407
  {
408
- var l = function() {
409
- Be || (Be = !0, S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", o));
408
+ var f = function() {
409
+ Ke || (Ke = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
410
410
  };
411
- l.isReactWarning = !0, Object.defineProperty(e, "ref", {
412
- get: l,
411
+ f.isReactWarning = !0, Object.defineProperty(e, "ref", {
412
+ get: f,
413
413
  configurable: !0
414
414
  });
415
415
  }
416
416
  }
417
- var _r = function(e, o, l, h, w, j, m) {
418
- var y = {
417
+ var Wt = function(e, c, f, m, j, C, y) {
418
+ var x = {
419
419
  // This tag allows us to uniquely identify this as a React Element
420
- $$typeof: n,
420
+ $$typeof: r,
421
421
  // Built-in properties that belong on the element
422
422
  type: e,
423
- key: o,
424
- ref: l,
425
- props: m,
423
+ key: c,
424
+ ref: f,
425
+ props: y,
426
426
  // Record the component responsible for creating this element.
427
- _owner: j
427
+ _owner: C
428
428
  };
429
- return y._store = {}, Object.defineProperty(y._store, "validated", {
429
+ return x._store = {}, Object.defineProperty(x._store, "validated", {
430
430
  configurable: !1,
431
431
  enumerable: !1,
432
432
  writable: !0,
433
433
  value: !1
434
- }), Object.defineProperty(y, "_self", {
434
+ }), Object.defineProperty(x, "_self", {
435
435
  configurable: !1,
436
436
  enumerable: !1,
437
437
  writable: !1,
438
- value: h
439
- }), Object.defineProperty(y, "_source", {
438
+ value: m
439
+ }), Object.defineProperty(x, "_source", {
440
440
  configurable: !1,
441
441
  enumerable: !1,
442
442
  writable: !1,
443
- value: w
444
- }), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
443
+ value: j
444
+ }), Object.freeze && (Object.freeze(x.props), Object.freeze(x)), x;
445
445
  };
446
- function Er(e, o, l, h, w) {
446
+ function Bt(e, c, f, m, j) {
447
447
  {
448
- var j, m = {}, y = null, P = null;
449
- l !== void 0 && (ze(l), y = "" + l), Sr(o) && (ze(o.key), y = "" + o.key), jr(o) && (P = o.ref, Cr(o, w));
450
- for (j in o)
451
- J.call(o, j) && !wr.hasOwnProperty(j) && (m[j] = o[j]);
448
+ var C, y = {}, x = null, A = null;
449
+ f !== void 0 && (He(f), x = "" + f), zt(c) && (He(c.key), x = "" + c.key), Ot(c) && (A = c.ref, At(c, j));
450
+ for (C in c)
451
+ oe.call(c, C) && !Dt.hasOwnProperty(C) && (y[C] = c[C]);
452
452
  if (e && e.defaultProps) {
453
- var k = e.defaultProps;
454
- for (j in k)
455
- m[j] === void 0 && (m[j] = k[j]);
453
+ var T = e.defaultProps;
454
+ for (C in T)
455
+ y[C] === void 0 && (y[C] = T[C]);
456
456
  }
457
- if (y || P) {
458
- var E = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
- y && Rr(m, E), P && kr(m, E);
457
+ if (x || A) {
458
+ var P = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ x && $t(y, P), A && Lt(y, P);
460
460
  }
461
- return _r(e, y, P, w, h, Ue.current, m);
461
+ return Wt(e, x, A, j, m, Ve.current, y);
462
462
  }
463
463
  }
464
- var ve = I.ReactCurrentOwner, Ne = I.ReactDebugCurrentFrame;
465
- function Y(e) {
464
+ var _e = S.ReactCurrentOwner, Je = S.ReactDebugCurrentFrame;
465
+ function K(e) {
466
466
  if (e) {
467
- var o = e._owner, l = te(e.type, e._source, o ? o.type : null);
468
- Ne.setExtraStackFrame(l);
467
+ var c = e._owner, f = ve(e.type, e._source, c ? c.type : null);
468
+ Je.setExtraStackFrame(f);
469
469
  } else
470
- Ne.setExtraStackFrame(null);
470
+ Je.setExtraStackFrame(null);
471
471
  }
472
- var ye;
473
- ye = !1;
474
- function me(e) {
475
- return typeof e == "object" && e !== null && e.$$typeof === n;
472
+ var Ee;
473
+ Ee = !1;
474
+ function Ie(e) {
475
+ return typeof e == "object" && e !== null && e.$$typeof === r;
476
476
  }
477
- function Ye() {
477
+ function Xe() {
478
478
  {
479
- if (ve.current) {
480
- var e = z(ve.current.type);
479
+ if (_e.current) {
480
+ var e = B(_e.current.type);
481
481
  if (e)
482
482
  return `
483
483
 
@@ -486,502 +486,597 @@ Check the render method of \`` + e + "`.";
486
486
  return "";
487
487
  }
488
488
  }
489
- function Ir(e) {
489
+ function Mt(e) {
490
490
  return "";
491
491
  }
492
- var qe = {};
493
- function Tr(e) {
492
+ var Qe = {};
493
+ function Nt(e) {
494
494
  {
495
- var o = Ye();
496
- if (!o) {
497
- var l = typeof e == "string" ? e : e.displayName || e.name;
498
- l && (o = `
495
+ var c = Xe();
496
+ if (!c) {
497
+ var f = typeof e == "string" ? e : e.displayName || e.name;
498
+ f && (c = `
499
499
 
500
- Check the top-level render call using <` + l + ">.");
500
+ Check the top-level render call using <` + f + ">.");
501
501
  }
502
- return o;
502
+ return c;
503
503
  }
504
504
  }
505
- function Ve(e, o) {
505
+ function et(e, c) {
506
506
  {
507
507
  if (!e._store || e._store.validated || e.key != null)
508
508
  return;
509
509
  e._store.validated = !0;
510
- var l = Tr(o);
511
- if (qe[l])
510
+ var f = Nt(c);
511
+ if (Qe[f])
512
512
  return;
513
- qe[l] = !0;
514
- var h = "";
515
- e && e._owner && e._owner !== ve.current && (h = " It was passed a child from " + z(e._owner.type) + "."), Y(e), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, h), Y(null);
513
+ Qe[f] = !0;
514
+ var m = "";
515
+ e && e._owner && e._owner !== _e.current && (m = " It was passed a child from " + B(e._owner.type) + "."), K(e), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', f, m), K(null);
516
516
  }
517
517
  }
518
- function Ge(e, o) {
518
+ function tt(e, c) {
519
519
  {
520
520
  if (typeof e != "object")
521
521
  return;
522
- if (ge(e))
523
- for (var l = 0; l < e.length; l++) {
524
- var h = e[l];
525
- me(h) && Ve(h, o);
522
+ if (Re(e))
523
+ for (var f = 0; f < e.length; f++) {
524
+ var m = e[f];
525
+ Ie(m) && et(m, c);
526
526
  }
527
- else if (me(e))
527
+ else if (Ie(e))
528
528
  e._store && (e._store.validated = !0);
529
529
  else if (e) {
530
- var w = L(e);
531
- if (typeof w == "function" && w !== e.entries)
532
- for (var j = w.call(e), m; !(m = j.next()).done; )
533
- me(m.value) && Ve(m.value, o);
530
+ var j = O(e);
531
+ if (typeof j == "function" && j !== e.entries)
532
+ for (var C = j.call(e), y; !(y = C.next()).done; )
533
+ Ie(y.value) && et(y.value, c);
534
534
  }
535
535
  }
536
536
  }
537
- function Pr(e) {
537
+ function Ut(e) {
538
538
  {
539
- var o = e.type;
540
- if (o == null || typeof o == "string")
539
+ var c = e.type;
540
+ if (c == null || typeof c == "string")
541
541
  return;
542
- var l;
543
- if (typeof o == "function")
544
- l = o.propTypes;
545
- else if (typeof o == "object" && (o.$$typeof === f || // Note: Memo only checks outer props here.
542
+ var f;
543
+ if (typeof c == "function")
544
+ f = c.propTypes;
545
+ else if (typeof c == "object" && (c.$$typeof === u || // Note: Memo only checks outer props here.
546
546
  // Inner props are checked in the reconciler.
547
- o.$$typeof === v))
548
- l = o.propTypes;
547
+ c.$$typeof === v))
548
+ f = c.propTypes;
549
549
  else
550
550
  return;
551
- if (l) {
552
- var h = z(o);
553
- yr(l, e.props, "prop", h, e);
554
- } else if (o.PropTypes !== void 0 && !ye) {
555
- ye = !0;
556
- var w = z(o);
557
- S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", w || "Unknown");
551
+ if (f) {
552
+ var m = B(c);
553
+ It(f, e.props, "prop", m, e);
554
+ } else if (c.PropTypes !== void 0 && !Ee) {
555
+ Ee = !0;
556
+ var j = B(c);
557
+ w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", j || "Unknown");
558
558
  }
559
- typeof o.getDefaultProps == "function" && !o.getDefaultProps.isReactClassApproved && S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
559
+ typeof c.getDefaultProps == "function" && !c.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
560
560
  }
561
561
  }
562
- function Or(e) {
562
+ function qt(e) {
563
563
  {
564
- for (var o = Object.keys(e.props), l = 0; l < o.length; l++) {
565
- var h = o[l];
566
- if (h !== "children" && h !== "key") {
567
- Y(e), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", h), Y(null);
564
+ for (var c = Object.keys(e.props), f = 0; f < c.length; f++) {
565
+ var m = c[f];
566
+ if (m !== "children" && m !== "key") {
567
+ K(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", m), K(null);
568
568
  break;
569
569
  }
570
570
  }
571
- e.ref !== null && (Y(e), S("Invalid attribute `ref` supplied to `React.Fragment`."), Y(null));
571
+ e.ref !== null && (K(e), w("Invalid attribute `ref` supplied to `React.Fragment`."), K(null));
572
572
  }
573
573
  }
574
- var He = {};
575
- function Ke(e, o, l, h, w, j) {
574
+ var nt = {};
575
+ function rt(e, c, f, m, j, C) {
576
576
  {
577
- var m = ur(e);
578
- if (!m) {
579
- var y = "";
580
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
581
- var P = Ir();
582
- P ? y += P : y += Ye();
583
- var k;
584
- e === null ? k = "null" : ge(e) ? k = "array" : e !== void 0 && e.$$typeof === n ? (k = "<" + (z(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : k = typeof e, S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", k, y);
577
+ var y = te(e);
578
+ if (!y) {
579
+ var x = "";
580
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (x += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
581
+ var A = Mt();
582
+ A ? x += A : x += Xe();
583
+ var T;
584
+ e === null ? T = "null" : Re(e) ? T = "array" : e !== void 0 && e.$$typeof === r ? (T = "<" + (B(e.type) || "Unknown") + " />", x = " Did you accidentally export a JSX literal instead of a component?") : T = typeof e, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, x);
585
585
  }
586
- var E = Er(e, o, l, w, j);
587
- if (E == null)
588
- return E;
589
- if (m) {
590
- var D = o.children;
591
- if (D !== void 0)
592
- if (h)
593
- if (ge(D)) {
594
- for (var q = 0; q < D.length; q++)
595
- Ge(D[q], e);
596
- Object.freeze && Object.freeze(D);
586
+ var P = Bt(e, c, f, j, C);
587
+ if (P == null)
588
+ return P;
589
+ if (y) {
590
+ var L = c.children;
591
+ if (L !== void 0)
592
+ if (m)
593
+ if (Re(L)) {
594
+ for (var J = 0; J < L.length; J++)
595
+ tt(L[J], e);
596
+ Object.freeze && Object.freeze(L);
597
597
  } else
598
- S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
598
+ w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
599
599
  else
600
- Ge(D, e);
600
+ tt(L, e);
601
601
  }
602
- if (J.call(o, "key")) {
603
- var B = z(e), O = Object.keys(o).filter(function(Lr) {
604
- return Lr !== "key";
605
- }), be = O.length > 0 ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}";
606
- if (!He[B + be]) {
607
- var Fr = O.length > 0 ? "{" + O.join(": ..., ") + ": ...}" : "{}";
608
- S(`A props object containing a "key" prop is being spread into JSX:
602
+ if (oe.call(c, "key")) {
603
+ var V = B(e), $ = Object.keys(c).filter(function(Kt) {
604
+ return Kt !== "key";
605
+ }), Te = $.length > 0 ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}";
606
+ if (!nt[V + Te]) {
607
+ var Zt = $.length > 0 ? "{" + $.join(": ..., ") + ": ...}" : "{}";
608
+ w(`A props object containing a "key" prop is being spread into JSX:
609
609
  let props = %s;
610
610
  <%s {...props} />
611
611
  React keys must be passed directly to JSX without using spread:
612
612
  let props = %s;
613
- <%s key={someKey} {...props} />`, be, B, Fr, B), He[B + be] = !0;
613
+ <%s key={someKey} {...props} />`, Te, V, Zt, V), nt[V + Te] = !0;
614
614
  }
615
615
  }
616
- return e === c ? Or(E) : Pr(E), E;
616
+ return e === i ? qt(P) : Ut(P), P;
617
617
  }
618
618
  }
619
- function Ar(e, o, l) {
620
- return Ke(e, o, l, !0);
619
+ function Yt(e, c, f) {
620
+ return rt(e, c, f, !0);
621
621
  }
622
- function Dr(e, o, l) {
623
- return Ke(e, o, l, !1);
622
+ function Gt(e, c, f) {
623
+ return rt(e, c, f, !1);
624
624
  }
625
- var $r = Dr, Wr = Ar;
626
- Q.Fragment = c, Q.jsx = $r, Q.jsxs = Wr;
627
- }()), Q;
625
+ var Ht = Gt, Vt = Yt;
626
+ se.Fragment = i, se.jsx = Ht, se.jsxs = Vt;
627
+ }()), se;
628
628
  }
629
- process.env.NODE_ENV === "production" ? we.exports = Kr() : we.exports = Jr();
630
- var r = we.exports;
631
- const ce = 100, ue = "http://localhost:1633", sr = "swarm-connect:bee-api-url", a = {
632
- colors: {
633
- primary: "#1a56db",
634
- primaryHover: "#1e429f",
635
- success: "#0e9f6e",
636
- successLight: "#f0fdf4",
637
- error: "#f05252",
638
- errorLight: "#fff5f5",
639
- warning: "#ff8a4c",
640
- warningLight: "#fffbf5",
641
- border: "#e5e7eb",
642
- text: "#111827",
643
- muted: "#6b7280",
644
- overlay: "rgba(0,0,0,0.5)",
645
- stepActive: "#1a56db"
646
- }
629
+ process.env.NODE_ENV === "production" ? Pe.exports = hn() : Pe.exports = pn();
630
+ var t = Pe.exports;
631
+ const G = 100, de = "http://localhost:1633", mt = "swarm-connect:bee-api-url", dt = "0xdBF3Ea6F5beE45c02255B2c26a16F300502F68da", De = 16, vn = "0.1", gn = "0.5", xt = {
632
+ xdai: !0,
633
+ xbzz: !1,
634
+ postageStamp: !0
647
635
  };
648
- function Xr(t = ue) {
649
- const [n, i] = U({
636
+ function mn(n = de) {
637
+ const [r, a] = F({
650
638
  isRunning: !1,
651
639
  isChecking: !1
652
- }), c = nr(async () => {
653
- i({ isRunning: !1, isChecking: !0 });
640
+ }), i = ce(async () => {
641
+ a({ isRunning: !1, isChecking: !0 });
654
642
  try {
655
- const u = await fetch(`${t}/health`, {
643
+ const d = await fetch(`${n}/health`, {
656
644
  signal: AbortSignal.timeout(5e3)
657
645
  });
658
- if (u.ok) {
659
- const p = await u.json();
660
- i({ isRunning: !0, isChecking: !1, version: p.version });
646
+ if (d.ok) {
647
+ const h = await d.json();
648
+ a({ isRunning: !0, isChecking: !1, version: h.version });
661
649
  } else
662
- i({ isRunning: !1, isChecking: !1, error: `Node returned HTTP ${u.status}` });
650
+ a({ isRunning: !1, isChecking: !1, error: `Node returned HTTP ${d.status}` });
663
651
  } catch {
664
- i({
652
+ a({
665
653
  isRunning: !1,
666
654
  isChecking: !1,
667
- error: `Cannot reach Bee node at ${t}`
655
+ error: `Cannot reach Bee node at ${n}`
668
656
  });
669
657
  }
670
- }, [t]);
671
- return { ...n, check: c };
658
+ }, [n]), s = ce(() => {
659
+ a({ isRunning: !1, isChecking: !1 });
660
+ }, []);
661
+ return { ...r, check: i, disconnect: s };
672
662
  }
673
- function Qr(t = ue) {
674
- const [n, i] = U([]), [c, u] = U(!1), [p, g] = U(), [x, f] = U(), s = nr(async () => {
675
- u(!0), g(void 0);
663
+ function xn(n = de) {
664
+ const [r, a] = F([]), [i, s] = F(!1), [d, h] = F(), [p, u] = F(), [o, l] = F(!1), [v, g] = F(), b = ce(async () => {
665
+ s(!0), h(void 0);
676
666
  try {
677
- const d = await fetch(`${t}/stamps`, {
667
+ const E = await fetch(`${n}/stamps`, {
678
668
  signal: AbortSignal.timeout(5e3)
679
669
  });
680
- if (d.ok) {
681
- const v = await d.json();
682
- i(v.stamps ?? []);
670
+ if (E.ok) {
671
+ const O = await E.json();
672
+ a(O.stamps ?? []);
683
673
  } else
684
- g(`HTTP ${d.status}`);
674
+ h(`HTTP ${E.status}`);
685
675
  } catch {
686
- g("Could not fetch postage stamps");
676
+ h("Could not fetch postage stamps");
687
677
  } finally {
688
- u(!1);
678
+ s(!1);
689
679
  }
690
- }, [t]);
691
- return { stamps: n, isLoading: c, error: p, fetchStamps: s, selectedStampId: x, selectStamp: f };
680
+ }, [n]), _ = ce(async ({ amount: E, depth: O, label: S }) => {
681
+ l(!0), g(void 0);
682
+ try {
683
+ const w = S ? `?label=${encodeURIComponent(S)}` : "", I = await fetch(`${n}/stamps/${E}/${O}${w}`, {
684
+ method: "POST",
685
+ signal: AbortSignal.timeout(24e4)
686
+ });
687
+ if (!I.ok) {
688
+ let k = `HTTP ${I.status}`;
689
+ try {
690
+ const z = await I.json();
691
+ z.message && (k = z.message);
692
+ } catch {
693
+ }
694
+ g(k);
695
+ return;
696
+ }
697
+ const R = await I.json();
698
+ return u(R.batchID), b(), R.batchID;
699
+ } catch {
700
+ g("Stamp purchase failed — is the node wallet funded with xDAI and xBZZ?");
701
+ return;
702
+ } finally {
703
+ l(!1);
704
+ }
705
+ }, [n, b]);
706
+ return {
707
+ stamps: r,
708
+ isLoading: i,
709
+ error: d,
710
+ fetchStamps: b,
711
+ selectedStampId: p,
712
+ selectStamp: u,
713
+ createStamp: _,
714
+ isCreating: o,
715
+ createError: v
716
+ };
692
717
  }
693
- function Zr() {
718
+ function bt(n = de) {
719
+ const [r, a] = F({
720
+ isLoading: !1
721
+ }), i = ce(async () => {
722
+ a((s) => ({ ...s, isLoading: !0, error: void 0 }));
723
+ try {
724
+ const [s, d] = await Promise.all([
725
+ fetch(`${n}/addresses`, { signal: AbortSignal.timeout(5e3) }),
726
+ fetch(`${n}/wallet`, { signal: AbortSignal.timeout(5e3) })
727
+ ]);
728
+ if (!s.ok || !d.ok) {
729
+ a((l) => ({
730
+ ...l,
731
+ isLoading: !1,
732
+ error: `Node returned HTTP ${s.ok ? d.status : s.status}`
733
+ }));
734
+ return;
735
+ }
736
+ const h = await s.json(), p = await d.json(), u = p.bzzBalance ?? p.bzz, o = p.nativeTokenBalance ?? p.xDai;
737
+ a({
738
+ address: h.ethereum,
739
+ xdai: o !== void 0 ? Number(o) / 1e18 : void 0,
740
+ xbzz: u !== void 0 ? Number(u) / 10 ** De : void 0,
741
+ isLoading: !1
742
+ });
743
+ } catch {
744
+ a((s) => ({
745
+ ...s,
746
+ isLoading: !1,
747
+ error: `Cannot read node wallet at ${n}`
748
+ }));
749
+ }
750
+ }, [n]);
751
+ return {
752
+ ...r,
753
+ isFunded: (r.xdai ?? 0) > 0 && (r.xbzz ?? 0) > 0,
754
+ refresh: i
755
+ };
756
+ }
757
+ function bn() {
694
758
  if (!(typeof window > "u"))
695
759
  try {
696
- return window.localStorage.getItem(sr) ?? void 0;
760
+ return window.localStorage.getItem(mt) ?? void 0;
697
761
  } catch {
698
762
  return;
699
763
  }
700
764
  }
701
- function et(t = {}) {
702
- const [n, i] = U(
703
- () => t.beeApiUrl ?? Zr() ?? ue
765
+ function yn(n = {}) {
766
+ const [r, a] = F(
767
+ () => n.beeApiUrl ?? bn() ?? de
704
768
  );
705
- ae(() => {
769
+ Q(() => {
706
770
  if (!(typeof window > "u"))
707
771
  try {
708
- window.localStorage.setItem(sr, n);
772
+ window.localStorage.setItem(mt, r);
709
773
  } catch {
710
774
  }
711
- }, [n]);
712
- const c = Xr(n), u = Qr(n), { address: p, isConnected: g } = or(), x = ir(), f = x === ce;
775
+ }, [r]);
776
+ const i = { ...xt, ...n.requirements }, s = mn(r), d = xn(r), h = bt(r), { address: p, isConnected: u, chainId: o } = we(), l = u && o === G, { data: v, isLoading: g } = vt({
777
+ address: p,
778
+ chainId: G,
779
+ query: { enabled: u }
780
+ }), b = v ? Number(v.formatted) : void 0, _ = l && !!v && v.value > 0n;
713
781
  return {
714
- beeNode: c,
715
- stamps: u,
716
- beeApiUrl: n,
717
- setBeeApiUrl: i,
718
- isWalletConnected: g,
782
+ beeNode: s,
783
+ stamps: d,
784
+ beeApiUrl: r,
785
+ setBeeApiUrl: a,
786
+ requirements: i,
787
+ nodeWallet: h,
788
+ isWalletConnected: u,
719
789
  address: p,
720
- isOnGnosis: f,
721
- chainId: x,
722
- isFullyConnected: c.isRunning && !!u.selectedStampId && g && f
790
+ isOnGnosis: l,
791
+ chainId: o,
792
+ balance: { xdai: b, isLoading: u && g, hasGas: _ },
793
+ isFullyConnected: u && l && s.isRunning && (!i.xdai || _) && (!i.xbzz || h.isFunded) && (!i.postageStamp || !!d.selectedStampId)
723
794
  };
724
795
  }
725
- function je({ step: t, done: n = !1, children: i }) {
726
- return /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 8 }, children: [
727
- /* @__PURE__ */ r.jsx("span", { style: {
728
- display: "inline-flex",
729
- alignItems: "center",
730
- justifyContent: "center",
731
- width: 18,
732
- height: 18,
733
- borderRadius: "50%",
734
- flexShrink: 0,
735
- fontSize: 11,
736
- fontWeight: 700,
737
- lineHeight: 1,
738
- color: "#fff",
739
- background: n ? a.colors.success : a.colors.stepActive
740
- }, children: n ? "✓" : t }),
741
- /* @__PURE__ */ r.jsx("span", { style: {
742
- fontSize: 11,
743
- fontWeight: 700,
744
- textTransform: "uppercase",
745
- letterSpacing: "0.06em",
746
- color: a.colors.muted
747
- }, children: i })
748
- ] });
796
+ const wn = `
797
+ .swarm-connect {
798
+ --void:#060809; --bunker:#0b0f12; --surface:#121821; --raised:#18202b; --raised-2:#1e2833;
799
+ --line:rgba(255,255,255,0.07); --line-2:rgba(255,255,255,0.12); --line-orange:rgba(255,107,0,0.45);
800
+ --fg:#f3f5f7; --fg-soft:#c3cad3; --fg-muted:#7d8794; --fg-faint:#565f6b;
801
+ --accent:#ff6b00; --accent-bright:#ff8a33; --accent-deep:#d65500; --accent-ink:#1a0e02;
802
+ --accent-glow:rgba(255,107,0,0.40); --accent-wash:rgba(255,107,0,0.10);
803
+ --ok:#36c46a; --ok-wash:rgba(54,196,106,0.12); --ok-line:rgba(54,196,106,0.40);
804
+ --bad:#ff5640; --bad-wash:rgba(255,86,64,0.12); --bad-line:rgba(255,86,64,0.38);
805
+ --warn:#f0a83a; --warn-wash:rgba(240,168,58,0.12); --warn-line:rgba(240,168,58,0.40);
806
+ --font-display:'Space Grotesk',system-ui,sans-serif;
807
+ --font-body:'Inter',system-ui,sans-serif;
808
+ --font-mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
809
+ --ease:cubic-bezier(0.22,0.61,0.36,1);
749
810
  }
750
- function rt({ beeApiUrl: t, setBeeApiUrl: n, beeNode: i, stamps: c }) {
751
- return ae(() => {
752
- i.check();
753
- }, [t]), ae(() => {
754
- i.isRunning && c.fetchStamps();
755
- }, [i.isRunning]), /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
756
- /* @__PURE__ */ r.jsxs("section", { children: [
757
- /* @__PURE__ */ r.jsx(je, { step: 1, done: i.isRunning, children: "Bee Node" }),
758
- /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
759
- /* @__PURE__ */ r.jsx(
760
- tt,
761
- {
762
- value: t,
763
- disabled: i.isChecking,
764
- onSubmit: n
765
- }
766
- ),
767
- /* @__PURE__ */ r.jsx(ot, { beeApiUrl: t, status: i, onRetry: i.check })
768
- ] })
769
- ] }),
770
- /* @__PURE__ */ r.jsxs("section", { style: { opacity: i.isRunning ? 1 : 0.5 }, children: [
771
- /* @__PURE__ */ r.jsx(je, { step: 2, done: !!c.selectedStampId, children: "Postage Stamp" }),
772
- i.isRunning ? /* @__PURE__ */ r.jsx(it, { stamps: c }) : /* @__PURE__ */ r.jsx(nt, { children: "Connect a running Bee node to load postage stamps." })
773
- ] })
774
- ] });
811
+ @keyframes sc-spin { to { transform: rotate(360deg); } }
812
+ @keyframes sc-pulse-dot { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.4; transform:scale(.82); } }
813
+ @keyframes sc-modal-in { from { opacity:0; transform:translate(-50%, calc(-50% + 10px)) scale(.985); } to { opacity:1; transform:translate(-50%,-50%) scale(1); } }
814
+ @keyframes sc-backdrop-in { from { opacity:0; } to { opacity:1; } }
815
+ @keyframes sc-step-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
816
+ .sc-scroll::-webkit-scrollbar { width:8px; }
817
+ .sc-scroll::-webkit-scrollbar-thumb { background:var(--line-2); border-radius:8px; border:2px solid transparent; background-clip:padding-box; }
818
+ .sc-scroll::-webkit-scrollbar-track { background:transparent; }
819
+ `;
820
+ let ut = !1;
821
+ function yt() {
822
+ if (ut || typeof document > "u") return;
823
+ ut = !0;
824
+ const n = document.createElement("style");
825
+ n.dataset.swarmConnect = "", n.textContent = wn, document.head.appendChild(n);
775
826
  }
776
- function tt({ value: t, disabled: n, onSubmit: i }) {
777
- const [c, u] = U(t);
778
- ae(() => {
779
- u(t);
780
- }, [t]);
781
- const p = c.trim().replace(/\/+$/, ""), g = p !== t && p.length > 0, x = () => {
782
- g && i(p);
783
- };
784
- return /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", gap: 6 }, children: [
785
- /* @__PURE__ */ r.jsx(
786
- "input",
787
- {
788
- type: "url",
789
- value: c,
790
- disabled: n,
791
- onChange: (f) => u(f.target.value),
792
- onKeyDown: (f) => {
793
- f.key === "Enter" && x();
794
- },
795
- placeholder: "http://localhost:1633",
796
- spellCheck: !1,
797
- autoComplete: "off",
798
- style: {
799
- flex: 1,
800
- minWidth: 0,
801
- padding: "8px 10px",
802
- fontSize: 13,
803
- fontFamily: "monospace",
804
- border: `1px solid ${a.colors.border}`,
805
- borderRadius: 6,
806
- color: a.colors.text,
807
- outline: "none",
808
- background: n ? "#f9fafb" : "#fff"
809
- }
810
- }
811
- ),
812
- /* @__PURE__ */ r.jsx(
813
- "button",
814
- {
815
- onClick: x,
816
- disabled: n || !g,
817
- style: {
818
- ...Ce,
819
- alignSelf: "auto",
820
- cursor: n || !g ? "default" : "pointer",
821
- opacity: n || !g ? 0.5 : 1
822
- },
823
- children: "Connect"
824
- }
825
- )
826
- ] });
827
+ function kn({ size: n = 18, stroke: r = "var(--accent)", glow: a = !0, children: i }) {
828
+ return /* @__PURE__ */ t.jsx("span", { style: {
829
+ display: "inline-flex",
830
+ alignItems: "center",
831
+ justifyContent: "center",
832
+ filter: a ? "drop-shadow(0 0 6px var(--accent-glow))" : "none"
833
+ }, children: /* @__PURE__ */ t.jsx(
834
+ "svg",
835
+ {
836
+ width: n,
837
+ height: n,
838
+ viewBox: "0 0 24 24",
839
+ fill: "none",
840
+ stroke: r,
841
+ strokeWidth: "1.4",
842
+ strokeLinecap: "round",
843
+ strokeLinejoin: "round",
844
+ children: i
845
+ }
846
+ ) });
827
847
  }
828
- function nt({ children: t }) {
829
- return /* @__PURE__ */ r.jsxs("div", { style: {
830
- ...N,
831
- color: a.colors.muted,
832
- fontSize: 13,
833
- borderStyle: "dashed",
834
- background: "#fafafa"
835
- }, children: [
836
- /* @__PURE__ */ r.jsx("span", { style: { fontSize: 13 }, children: "🔒" }),
837
- /* @__PURE__ */ r.jsx("span", { children: t })
838
- ] });
848
+ function ke({ size: n = 15 }) {
849
+ return /* @__PURE__ */ t.jsx("span", { style: {
850
+ width: n,
851
+ height: n,
852
+ flexShrink: 0,
853
+ display: "inline-block",
854
+ border: "2px solid rgba(255,255,255,.12)",
855
+ borderTopColor: "var(--accent)",
856
+ borderRadius: "50%",
857
+ animation: "sc-spin .7s linear infinite"
858
+ } });
839
859
  }
840
- function ot({ beeApiUrl: t, status: n, onRetry: i }) {
841
- return n.isChecking ? /* @__PURE__ */ r.jsxs("div", { style: N, children: [
842
- /* @__PURE__ */ r.jsx(ar, {}),
843
- /* @__PURE__ */ r.jsxs("span", { style: { color: a.colors.muted, fontSize: 14 }, children: [
844
- "Checking ",
845
- t,
846
- ""
847
- ] })
848
- ] }) : n.isRunning ? /* @__PURE__ */ r.jsxs("div", { style: { ...N, borderColor: a.colors.success, background: a.colors.successLight }, children: [
849
- /* @__PURE__ */ r.jsx(rr, { color: a.colors.success }),
850
- /* @__PURE__ */ r.jsxs("div", { children: [
851
- /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.success, fontSize: 14 }, children: "Node running" }),
852
- n.version && /* @__PURE__ */ r.jsxs("div", { style: { color: a.colors.muted, fontSize: 12 }, children: [
853
- "v",
854
- n.version
855
- ] })
856
- ] })
857
- ] }) : /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
858
- /* @__PURE__ */ r.jsxs("div", { style: { ...N, borderColor: a.colors.error, background: a.colors.errorLight }, children: [
859
- /* @__PURE__ */ r.jsx(rr, { color: a.colors.error }),
860
- /* @__PURE__ */ r.jsxs("div", { children: [
861
- /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.error, fontSize: 14 }, children: "Node not reachable" }),
862
- /* @__PURE__ */ r.jsx("div", { style: { color: a.colors.muted, fontSize: 12 }, children: n.error ?? `Cannot reach ${t}` })
863
- ] })
864
- ] }),
865
- /* @__PURE__ */ r.jsxs("div", { style: { fontSize: 12, color: a.colors.muted }, children: [
866
- "Start: ",
867
- /* @__PURE__ */ r.jsx("code", { style: { background: "#f3f4f6", padding: "1px 5px", borderRadius: 3 }, children: "bee start" })
860
+ function ue({ children: n, tone: r }) {
861
+ const a = {
862
+ ok: { c: "var(--ok)", b: "var(--ok-line)", w: "var(--ok-wash)" },
863
+ bad: { c: "var(--bad)", b: "var(--bad-line)", w: "var(--bad-wash)" },
864
+ warn: { c: "var(--warn)", b: "var(--warn-line)", w: "var(--warn-wash)" }
865
+ }[r];
866
+ return /* @__PURE__ */ t.jsx("span", { style: {
867
+ fontFamily: "var(--font-mono)",
868
+ fontSize: 10,
869
+ letterSpacing: ".04em",
870
+ textTransform: "uppercase",
871
+ color: a.c,
872
+ background: a.w,
873
+ border: `1px solid ${a.b}`,
874
+ borderRadius: 3,
875
+ padding: "2px 6px",
876
+ lineHeight: 1.3
877
+ }, children: n });
878
+ }
879
+ function H({ tone: n, title: r, sub: a, children: i }) {
880
+ const s = {
881
+ ok: { b: "var(--ok-line)", w: "var(--ok-wash)", d: "var(--ok)" },
882
+ bad: { b: "var(--bad-line)", w: "var(--bad-wash)", d: "var(--bad)" },
883
+ warn: { b: "var(--warn-line)", w: "var(--warn-wash)", d: "var(--warn)" },
884
+ flat: { b: "var(--line)", w: "var(--raised)", d: "var(--fg-muted)" }
885
+ }[n], d = !!a && (a.startsWith("0x") || a.includes("localhost") || a.includes("http"));
886
+ return /* @__PURE__ */ t.jsxs("div", { style: {
887
+ display: "flex",
888
+ alignItems: "center",
889
+ gap: 12,
890
+ padding: "12px 14px",
891
+ border: `1px solid ${s.b}`,
892
+ borderRadius: 8,
893
+ background: s.w
894
+ }, children: [
895
+ n !== "flat" && /* @__PURE__ */ t.jsx("span", { style: {
896
+ width: 8,
897
+ height: 8,
898
+ flexShrink: 0,
899
+ borderRadius: "50%",
900
+ background: s.d,
901
+ boxShadow: `0 0 8px ${s.d}`,
902
+ animation: n === "warn" ? "sc-pulse-dot 1.6s var(--ease) infinite" : "none"
903
+ } }),
904
+ /* @__PURE__ */ t.jsxs("div", { style: { minWidth: 0 }, children: [
905
+ r && /* @__PURE__ */ t.jsx("div", { style: { fontWeight: 600, fontSize: 13.5, color: n === "flat" ? "var(--fg-soft)" : s.d }, children: r }),
906
+ a && /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--fg-muted)", marginTop: 2, fontFamily: d ? "var(--font-mono)" : "inherit", wordBreak: "break-all" }, children: a })
868
907
  ] }),
869
- /* @__PURE__ */ r.jsx("button", { onClick: i, style: Ce, children: "Retry" })
908
+ i && /* @__PURE__ */ t.jsx("div", { style: { marginLeft: "auto", flexShrink: 0 }, children: i })
870
909
  ] });
871
910
  }
872
- function it({ stamps: t }) {
873
- return t.isLoading ? /* @__PURE__ */ r.jsxs("div", { style: { ...N, gap: 10 }, children: [
874
- /* @__PURE__ */ r.jsx(ar, {}),
875
- /* @__PURE__ */ r.jsx("span", { style: { color: a.colors.muted, fontSize: 14 }, children: "Loading stamps…" })
876
- ] }) : t.error ? /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
877
- /* @__PURE__ */ r.jsx("div", { style: { ...N, borderColor: a.colors.error, background: a.colors.errorLight }, children: /* @__PURE__ */ r.jsx("span", { style: { color: a.colors.error, fontSize: 13 }, children: t.error }) }),
878
- /* @__PURE__ */ r.jsx("button", { onClick: t.fetchStamps, style: Ce, children: "Retry" })
879
- ] }) : t.stamps.length === 0 ? /* @__PURE__ */ r.jsxs("div", { style: { ...N, flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
880
- /* @__PURE__ */ r.jsx("div", { style: { fontSize: 14, color: a.colors.muted }, children: "No postage stamps found." }),
881
- /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.muted }, children: "Buy a stamp via the Bee API or Swarm Desktop to continue." })
882
- ] }) : /* @__PURE__ */ r.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: t.stamps.map((n) => /* @__PURE__ */ r.jsx(
883
- st,
911
+ function q({ children: n, onClick: r, disabled: a }) {
912
+ const [i, s] = F(!1);
913
+ return /* @__PURE__ */ t.jsx(
914
+ "button",
884
915
  {
885
- stamp: n,
886
- selected: t.selectedStampId === n.batchID,
887
- onSelect: () => t.selectStamp(n.batchID)
888
- },
889
- n.batchID
890
- )) });
916
+ onClick: r,
917
+ disabled: a,
918
+ onMouseEnter: () => s(!0),
919
+ onMouseLeave: () => s(!1),
920
+ style: {
921
+ fontFamily: "var(--font-mono)",
922
+ fontSize: 12,
923
+ letterSpacing: ".04em",
924
+ background: "transparent",
925
+ border: `1px solid ${i && !a ? "var(--line-orange)" : "var(--line-2)"}`,
926
+ color: a ? "var(--fg-faint)" : i ? "var(--accent-bright)" : "var(--fg-soft)",
927
+ borderRadius: 4,
928
+ padding: "7px 14px",
929
+ cursor: a ? "default" : "pointer",
930
+ transition: "all .15s var(--ease)",
931
+ opacity: a ? 0.5 : 1
932
+ },
933
+ children: n
934
+ }
935
+ );
891
936
  }
892
- function st({ stamp: t, selected: n, onSelect: i }) {
893
- const c = Math.floor(t.batchTTL / 86400), u = `${t.batchID.slice(0, 8)}…${t.batchID.slice(-6)}`;
894
- return /* @__PURE__ */ r.jsxs(
937
+ function wt({ children: n, onClick: r, pending: a, block: i, style: s }) {
938
+ const [d, h] = F(!1);
939
+ return /* @__PURE__ */ t.jsx(
895
940
  "button",
896
941
  {
897
- onClick: i,
942
+ onClick: r,
943
+ disabled: a,
944
+ onMouseEnter: () => h(!0),
945
+ onMouseLeave: () => h(!1),
898
946
  style: {
899
- display: "flex",
947
+ display: "inline-flex",
900
948
  alignItems: "center",
901
- justifyContent: "space-between",
902
- padding: "10px 14px",
903
- border: `1.5px solid ${n ? a.colors.primary : a.colors.border}`,
904
- borderRadius: 8,
905
- cursor: "pointer",
906
- background: n ? "#eff6ff" : "#fff",
907
- textAlign: "left",
908
- width: "100%",
909
- transition: "all 0.15s"
949
+ justifyContent: "center",
950
+ gap: 8,
951
+ fontFamily: "var(--font-mono)",
952
+ fontSize: 13,
953
+ fontWeight: 600,
954
+ letterSpacing: ".06em",
955
+ textTransform: "uppercase",
956
+ width: i ? "100%" : "auto",
957
+ background: "var(--accent)",
958
+ color: "var(--accent-ink)",
959
+ border: "none",
960
+ borderRadius: 4,
961
+ padding: "11px 20px",
962
+ cursor: a ? "default" : "pointer",
963
+ boxShadow: d ? "0 0 24px var(--accent-glow)" : "0 0 14px var(--accent-glow)",
964
+ transform: d ? "translateY(-1px)" : "none",
965
+ transition: "all .15s var(--ease)",
966
+ opacity: a ? 0.8 : 1,
967
+ whiteSpace: "nowrap",
968
+ ...s
910
969
  },
911
- children: [
912
- /* @__PURE__ */ r.jsxs("div", { children: [
913
- /* @__PURE__ */ r.jsx("div", { style: { fontFamily: "monospace", fontSize: 12, color: a.colors.text }, children: u }),
914
- t.label && /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.muted, marginTop: 2 }, children: t.label })
915
- ] }),
916
- /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexShrink: 0 }, children: [
917
- /* @__PURE__ */ r.jsx("span", { style: { fontSize: 11, color: a.colors.muted }, children: c > 0 ? `${c}d` : "expiring" }),
918
- t.usable ? /* @__PURE__ */ r.jsx(er, { bg: a.colors.successLight, color: a.colors.success, children: "usable" }) : /* @__PURE__ */ r.jsx(er, { bg: a.colors.errorLight, color: a.colors.error, children: "unusable" }),
919
- /* @__PURE__ */ r.jsx("div", { style: {
920
- width: 16,
921
- height: 16,
922
- borderRadius: "50%",
923
- flexShrink: 0,
924
- border: `2px solid ${n ? a.colors.primary : a.colors.border}`,
925
- background: n ? a.colors.primary : "transparent"
926
- } })
927
- ] })
928
- ]
970
+ children: n
929
971
  }
930
972
  );
931
973
  }
932
- function er({ children: t, bg: n, color: i }) {
933
- return /* @__PURE__ */ r.jsx("span", { style: { fontSize: 11, background: n, color: i, borderRadius: 4, padding: "2px 6px" }, children: t });
974
+ function ee({ children: n }) {
975
+ return /* @__PURE__ */ t.jsxs("div", { style: {
976
+ display: "flex",
977
+ alignItems: "center",
978
+ gap: 10,
979
+ padding: "12px 14px",
980
+ border: "1px dashed var(--line-2)",
981
+ borderRadius: 8,
982
+ background: "var(--bunker)"
983
+ }, children: [
984
+ /* @__PURE__ */ t.jsxs(kn, { size: 15, stroke: "var(--fg-faint)", glow: !1, children: [
985
+ /* @__PURE__ */ t.jsx("rect", { x: "5", y: "11", width: "14", height: "9", rx: "1.5" }),
986
+ /* @__PURE__ */ t.jsx("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })
987
+ ] }),
988
+ /* @__PURE__ */ t.jsx("span", { style: { fontSize: 12.5, color: "var(--fg-muted)" }, children: n })
989
+ ] });
934
990
  }
935
- function rr({ color: t }) {
936
- return /* @__PURE__ */ r.jsx("span", { style: { fontSize: 10, color: t, lineHeight: 1 }, children: "" });
991
+ function jn({ step: n, state: r, children: a, hint: i }) {
992
+ const s = r === "done", d = r === "locked";
993
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, marginBottom: 12 }, children: [
994
+ /* @__PURE__ */ t.jsx("span", { style: {
995
+ display: "inline-flex",
996
+ alignItems: "center",
997
+ justifyContent: "center",
998
+ width: 22,
999
+ height: 22,
1000
+ flexShrink: 0,
1001
+ fontFamily: "var(--font-mono)",
1002
+ fontSize: 11,
1003
+ fontWeight: 600,
1004
+ lineHeight: 1,
1005
+ color: s ? "var(--ok)" : d ? "var(--fg-faint)" : "var(--accent-ink)",
1006
+ background: s ? "var(--ok-wash)" : d ? "transparent" : "var(--accent)",
1007
+ border: s ? "1px solid var(--ok-line)" : d ? "1px solid var(--line-2)" : "none",
1008
+ clipPath: "polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%)",
1009
+ boxShadow: !s && !d ? "0 0 14px var(--accent-glow)" : "none"
1010
+ }, children: s ? "✓" : n }),
1011
+ /* @__PURE__ */ t.jsx("span", { style: {
1012
+ fontFamily: "var(--font-mono)",
1013
+ fontSize: 11,
1014
+ fontWeight: 600,
1015
+ textTransform: "uppercase",
1016
+ letterSpacing: ".18em",
1017
+ color: d ? "var(--fg-faint)" : "var(--fg-soft)"
1018
+ }, children: a }),
1019
+ i && /* @__PURE__ */ t.jsx("span", { style: { marginLeft: "auto", fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".06em", color: "var(--fg-faint)" }, children: i })
1020
+ ] });
937
1021
  }
938
- function ar() {
939
- return /* @__PURE__ */ r.jsx("div", { style: {
940
- width: 15,
941
- height: 15,
1022
+ function Sn({ size: n = 30 }) {
1023
+ return /* @__PURE__ */ t.jsx("span", { style: {
1024
+ width: n,
1025
+ height: n,
942
1026
  flexShrink: 0,
943
- border: "2px solid #e5e7eb",
944
- borderTopColor: a.colors.primary,
1027
+ display: "inline-flex",
1028
+ alignItems: "center",
1029
+ justifyContent: "center",
1030
+ background: "var(--accent)",
1031
+ color: "var(--accent-ink)",
1032
+ clipPath: "polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%)",
1033
+ boxShadow: "0 0 18px var(--accent-glow)"
1034
+ }, children: /* @__PURE__ */ t.jsxs(
1035
+ "svg",
1036
+ {
1037
+ width: n * 0.56,
1038
+ height: n * 0.56,
1039
+ viewBox: "0 0 24 24",
1040
+ fill: "none",
1041
+ stroke: "var(--accent-ink)",
1042
+ strokeWidth: "1.8",
1043
+ strokeLinecap: "round",
1044
+ strokeLinejoin: "round",
1045
+ children: [
1046
+ /* @__PURE__ */ t.jsx("ellipse", { cx: "12", cy: "14", rx: "5", ry: "6.5" }),
1047
+ /* @__PURE__ */ t.jsx("path", { d: "M7 12h10M7 16h10M12 7.5V4M12 4l-2.5-1.5M12 4l2.5-1.5" })
1048
+ ]
1049
+ }
1050
+ ) });
1051
+ }
1052
+ function Cn({ states: n }) {
1053
+ return /* @__PURE__ */ t.jsx("span", { style: { display: "inline-flex", gap: 5 }, children: n.map((r, a) => /* @__PURE__ */ t.jsx("span", { style: {
1054
+ width: 7,
1055
+ height: 7,
945
1056
  borderRadius: "50%",
946
- animation: "spin 0.7s linear infinite"
947
- } });
1057
+ background: r ? "var(--ok)" : "var(--line-2)",
1058
+ boxShadow: r ? "0 0 8px var(--ok)" : "none",
1059
+ transition: "all .2s"
1060
+ } }, a)) });
948
1061
  }
949
- const N = {
950
- display: "flex",
951
- alignItems: "center",
952
- gap: 12,
953
- padding: "11px 14px",
954
- border: `1px solid ${a.colors.border}`,
955
- borderRadius: 8,
956
- background: "#fff"
957
- }, Ce = {
958
- background: "none",
959
- border: `1px solid ${a.colors.border}`,
960
- borderRadius: 6,
961
- padding: "5px 14px",
962
- cursor: "pointer",
963
- fontSize: 13,
964
- color: a.colors.muted,
965
- alignSelf: "flex-start"
966
- };
967
- function at(t) {
968
- const n = {
1062
+ function Rn(n) {
1063
+ const r = {
969
1064
  formatters: void 0,
970
1065
  fees: void 0,
971
1066
  serializers: void 0,
972
- ...t
1067
+ ...n
973
1068
  };
974
- function i(c) {
975
- return (u) => {
976
- const p = typeof u == "function" ? u(c) : u, g = { ...c, ...p };
977
- return Object.assign(g, { extend: i(g) });
1069
+ function a(i) {
1070
+ return (s) => {
1071
+ const d = typeof s == "function" ? s(i) : s, h = { ...i, ...d };
1072
+ return Object.assign(h, { extend: a(h) });
978
1073
  };
979
1074
  }
980
- return Object.assign(n, {
981
- extend: i(n)
1075
+ return Object.assign(r, {
1076
+ extend: a(r)
982
1077
  });
983
1078
  }
984
- const Se = /* @__PURE__ */ at({
1079
+ const Oe = /* @__PURE__ */ Rn({
985
1080
  id: 100,
986
1081
  name: "Gnosis",
987
1082
  nativeCurrency: {
@@ -1010,343 +1105,731 @@ const Se = /* @__PURE__ */ at({
1010
1105
  }
1011
1106
  }
1012
1107
  });
1013
- function ct({ swarmReady: t }) {
1014
- const { address: n, isConnected: i } = or(), c = ir(), u = c === ce;
1015
- return /* @__PURE__ */ r.jsxs("section", { style: { opacity: t ? 1 : 0.5 }, children: [
1016
- /* @__PURE__ */ r.jsx(je, { step: 3, done: i && u, children: "Wallet" }),
1017
- /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
1018
- i ? /* @__PURE__ */ r.jsx(lt, { address: n }) : t ? /* @__PURE__ */ r.jsx(dt, {}) : /* @__PURE__ */ r.jsx(ut, {}),
1019
- i && /* @__PURE__ */ r.jsx(ft, { isOnGnosis: u, chainId: c })
1020
- ] })
1021
- ] });
1108
+ function ze(n) {
1109
+ if (n)
1110
+ return n.shortMessage ?? n.message;
1022
1111
  }
1023
- function lt({ address: t }) {
1024
- const { disconnect: n } = zr();
1025
- return /* @__PURE__ */ r.jsxs("div", { style: {
1026
- display: "flex",
1027
- alignItems: "center",
1028
- justifyContent: "space-between",
1029
- padding: "11px 14px",
1030
- border: `1px solid ${a.colors.success}`,
1031
- borderRadius: 8,
1032
- background: a.colors.successLight
1033
- }, children: [
1034
- /* @__PURE__ */ r.jsxs("div", { children: [
1035
- /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.success, fontSize: 14 }, children: "Connected" }),
1036
- t && /* @__PURE__ */ r.jsx("div", { style: { fontFamily: "monospace", fontSize: 12, color: a.colors.muted, marginTop: 2 }, children: `${t.slice(0, 8)}…${t.slice(-6)}` })
1037
- ] }),
1038
- /* @__PURE__ */ r.jsx(
1039
- "button",
1112
+ function _n({ name: n, icon: r, pending: a, disabled: i, onClick: s }) {
1113
+ const [d, h] = F(!1);
1114
+ return /* @__PURE__ */ t.jsxs(
1115
+ "button",
1116
+ {
1117
+ onClick: s,
1118
+ disabled: i || a,
1119
+ onMouseEnter: () => h(!0),
1120
+ onMouseLeave: () => h(!1),
1121
+ style: {
1122
+ display: "flex",
1123
+ alignItems: "center",
1124
+ gap: 12,
1125
+ width: "100%",
1126
+ textAlign: "left",
1127
+ padding: "11px 13px",
1128
+ borderRadius: 8,
1129
+ cursor: i ? "default" : "pointer",
1130
+ opacity: i ? 0.45 : 1,
1131
+ border: `1px solid ${d && !i ? "var(--line-orange)" : "var(--line)"}`,
1132
+ background: d && !i ? "var(--raised-2)" : "var(--raised)",
1133
+ transition: "all .15s var(--ease)"
1134
+ },
1135
+ children: [
1136
+ /* @__PURE__ */ t.jsx("span", { style: {
1137
+ width: 30,
1138
+ height: 30,
1139
+ flexShrink: 0,
1140
+ borderRadius: 7,
1141
+ display: "inline-flex",
1142
+ alignItems: "center",
1143
+ justifyContent: "center",
1144
+ background: "var(--bunker)",
1145
+ border: "1px solid var(--line-2)",
1146
+ color: "var(--accent-bright)",
1147
+ overflow: "hidden",
1148
+ fontFamily: "var(--font-display)",
1149
+ fontWeight: 700,
1150
+ fontSize: 15
1151
+ }, children: r ? /* @__PURE__ */ t.jsx("img", { src: r, width: 30, height: 30, alt: "", style: { borderRadius: 7 } }) : n.charAt(0) }),
1152
+ /* @__PURE__ */ t.jsx("span", { style: { flex: 1, fontSize: 14, fontWeight: 500, color: "var(--fg)" }, children: n }),
1153
+ a ? /* @__PURE__ */ t.jsx(ke, { size: 14 }) : /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 16, color: d && !i ? "var(--accent)" : "var(--fg-faint)", transition: "color .15s" }, children: "→" })
1154
+ ]
1155
+ }
1156
+ );
1157
+ }
1158
+ function En({ isConnected: n, address: r }) {
1159
+ const { connectors: a, connect: i, isPending: s, variables: d, error: h } = Xt(), { disconnect: p } = gt(), { connector: u } = we();
1160
+ if (n)
1161
+ return /* @__PURE__ */ t.jsx(
1162
+ H,
1040
1163
  {
1041
- onClick: () => n(),
1042
- style: {
1043
- background: "none",
1044
- border: `1px solid ${a.colors.border}`,
1045
- borderRadius: 6,
1046
- padding: "5px 12px",
1047
- cursor: "pointer",
1048
- fontSize: 12,
1049
- color: a.colors.muted
1050
- },
1051
- children: "Disconnect"
1164
+ tone: "ok",
1165
+ title: `Wallet connected${u ? ` · ${u.name}` : ""}`,
1166
+ sub: r,
1167
+ children: /* @__PURE__ */ t.jsx(q, { onClick: () => p(), children: "disconnect" })
1052
1168
  }
1053
- )
1169
+ );
1170
+ const o = s && d != null && d.connector && "uid" in d.connector ? d.connector.uid : void 0;
1171
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1172
+ a.map((l) => /* @__PURE__ */ t.jsx(
1173
+ _n,
1174
+ {
1175
+ name: l.name,
1176
+ icon: l.icon,
1177
+ pending: o === l.uid,
1178
+ disabled: s && o !== l.uid,
1179
+ onClick: () => i({ connector: l })
1180
+ },
1181
+ l.uid
1182
+ )),
1183
+ h && /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--bad)", fontFamily: "var(--font-mono)" }, children: h.message })
1054
1184
  ] });
1055
1185
  }
1056
- function ut() {
1057
- return /* @__PURE__ */ r.jsxs("div", { style: {
1186
+ function In({ locked: n, isOnGnosis: r, chainId: a }) {
1187
+ const { switchChain: i, isPending: s, error: d } = Qt();
1188
+ return n ? /* @__PURE__ */ t.jsx(ee, { children: "Connect a wallet to verify it is on the Gnosis chain." }) : r ? /* @__PURE__ */ t.jsx(H, { tone: "ok", title: "Gnosis chain", sub: `wallet reports chain id ${a}`, children: /* @__PURE__ */ t.jsx(ue, { tone: "ok", children: "synced" }) }) : /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1189
+ /* @__PURE__ */ t.jsx(H, { tone: "warn", title: "Wrong network", sub: `chain ${a ?? "—"} active — Gnosis (${G}) required` }),
1190
+ /* @__PURE__ */ t.jsx(wt, { onClick: () => i({ chainId: Oe.id }), pending: s, block: !0, children: s ? "switching…" : "switch to Gnosis" }),
1191
+ d && /* @__PURE__ */ t.jsxs("div", { style: { fontSize: 12, color: "var(--bad)", fontFamily: "var(--font-mono)", lineHeight: 1.5 }, children: [
1192
+ "switch failed: ",
1193
+ ze(d)
1194
+ ] })
1195
+ ] });
1196
+ }
1197
+ function Ae({ symbol: n, role: r, amount: a, loading: i }) {
1198
+ const s = !i && a === 0, d = s ? "var(--warn)" : "var(--ok)", h = s ? "var(--warn-line)" : "var(--ok-line)", p = s ? "var(--warn-wash)" : "var(--ok-wash)";
1199
+ return /* @__PURE__ */ t.jsxs("div", { style: {
1058
1200
  display: "flex",
1059
1201
  alignItems: "center",
1060
1202
  gap: 12,
1061
- padding: "11px 14px",
1062
- border: `1px dashed ${a.colors.border}`,
1203
+ padding: "12px 14px",
1204
+ border: `1px solid ${i ? "var(--line)" : h}`,
1063
1205
  borderRadius: 8,
1064
- background: "#fafafa"
1206
+ background: i ? "var(--raised)" : p
1065
1207
  }, children: [
1066
- /* @__PURE__ */ r.jsx("span", { style: { fontSize: 13 }, children: "🔒" }),
1067
- /* @__PURE__ */ r.jsx("span", { style: { fontSize: 13, color: a.colors.muted }, children: "Complete steps 1 and 2 — a running Bee node and a selected postage stamp — to connect your wallet." })
1208
+ i ? /* @__PURE__ */ t.jsx(ke, { size: 14 }) : /* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, flexShrink: 0, borderRadius: "50%", background: d, boxShadow: `0 0 8px ${d}`, animation: s ? "sc-pulse-dot 1.6s var(--ease) infinite" : "none" } }),
1209
+ /* @__PURE__ */ t.jsxs("div", { style: { minWidth: 0 }, children: [
1210
+ /* @__PURE__ */ t.jsx("div", { style: { fontWeight: 600, fontSize: 13.5, color: i ? "var(--fg-soft)" : d }, children: n }),
1211
+ /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--fg-muted)", marginTop: 2 }, children: r })
1212
+ ] }),
1213
+ /* @__PURE__ */ t.jsxs("div", { style: { marginLeft: "auto", display: "flex", alignItems: "center", gap: 10, flexShrink: 0 }, children: [
1214
+ !i && /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 13.5, fontWeight: 500, color: s ? "var(--warn)" : "var(--fg)" }, children: a.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 }) }),
1215
+ !i && /* @__PURE__ */ t.jsx(ue, { tone: s ? "warn" : "ok", children: s ? "empty" : "ok" })
1216
+ ] })
1068
1217
  ] });
1069
1218
  }
1070
- function dt() {
1071
- const { connectors: t, connect: n, isPending: i, error: c } = Ur();
1072
- return /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1073
- t.map((u) => /* @__PURE__ */ r.jsxs(
1074
- "button",
1075
- {
1076
- onClick: () => n({ connector: u }),
1077
- disabled: i,
1078
- style: {
1079
- display: "flex",
1080
- alignItems: "center",
1081
- gap: 10,
1082
- padding: "11px 14px",
1083
- border: `1.5px solid ${a.colors.border}`,
1084
- borderRadius: 8,
1085
- cursor: i ? "not-allowed" : "pointer",
1086
- background: "#fff",
1087
- fontSize: 14,
1088
- fontWeight: 500,
1089
- color: a.colors.text,
1090
- opacity: i ? 0.6 : 1,
1091
- transition: "border-color 0.15s",
1092
- width: "100%"
1093
- },
1094
- onMouseOver: (p) => {
1095
- i || (p.currentTarget.style.borderColor = a.colors.primary);
1096
- },
1097
- onMouseOut: (p) => {
1098
- p.currentTarget.style.borderColor = a.colors.border;
1099
- },
1100
- children: [
1101
- u.icon ? /* @__PURE__ */ r.jsx("img", { src: u.icon, width: 20, height: 20, alt: "", style: { borderRadius: 4 } }) : /* @__PURE__ */ r.jsx("span", { style: { width: 20, textAlign: "center", fontSize: 16 }, children: "🔗" }),
1102
- u.name
1103
- ]
1104
- },
1105
- u.uid
1106
- )),
1107
- c && /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.error, marginTop: 2 }, children: c.message })
1219
+ function Tn({ locked: n, balance: r }) {
1220
+ if (n) return /* @__PURE__ */ t.jsx(ee, { children: "Switch to the Gnosis chain to read your wallet's xDAI balance." });
1221
+ const a = r.xdai ?? 0, i = !r.isLoading && a === 0;
1222
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1223
+ /* @__PURE__ */ t.jsx(Ae, { symbol: "xDAI", role: "gas for transactions from this wallet", amount: a, loading: r.isLoading }),
1224
+ /* @__PURE__ */ t.jsx("div", { style: be, children: "Your connected wallet signs and pays gas for its own transactions — separate from the wallet running your Bee node." }),
1225
+ i && /* @__PURE__ */ t.jsx(wt, { onClick: () => window.open("https://www.gnosisfaucet.com", "_blank", "noopener"), block: !0, children: "get xDAI" })
1108
1226
  ] });
1109
1227
  }
1110
- function ft({ isOnGnosis: t, chainId: n }) {
1111
- const { switchChain: i, isPending: c, error: u } = Mr();
1112
- return t ? /* @__PURE__ */ r.jsxs("div", { style: {
1113
- display: "flex",
1114
- alignItems: "center",
1115
- gap: 12,
1116
- padding: "11px 14px",
1117
- border: `1px solid ${a.colors.success}`,
1118
- borderRadius: 8,
1119
- background: a.colors.successLight
1120
- }, children: [
1121
- /* @__PURE__ */ r.jsx("span", { style: { color: a.colors.success, fontSize: 10, lineHeight: 1 }, children: "●" }),
1122
- /* @__PURE__ */ r.jsxs("div", { children: [
1123
- /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.success, fontSize: 14 }, children: "Gnosis chain" }),
1124
- /* @__PURE__ */ r.jsxs("div", { style: { fontSize: 12, color: a.colors.muted }, children: [
1125
- "Chain ID ",
1126
- ce
1127
- ] })
1228
+ function Fn({ value: n, disabled: r, onSubmit: a }) {
1229
+ const [i, s] = F(n), [d, h] = F(!1);
1230
+ Q(() => {
1231
+ s(n);
1232
+ }, [n]);
1233
+ const p = i.trim().replace(/\/+$/, ""), u = p !== n && p.length > 0, o = () => {
1234
+ u && a(p);
1235
+ };
1236
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
1237
+ /* @__PURE__ */ t.jsxs("div", { style: {
1238
+ flex: 1,
1239
+ minWidth: 0,
1240
+ display: "flex",
1241
+ alignItems: "center",
1242
+ gap: 8,
1243
+ padding: "0 12px",
1244
+ borderRadius: 6,
1245
+ border: `1px solid ${d ? "var(--line-orange)" : "var(--line-2)"}`,
1246
+ background: r ? "var(--bunker)" : "var(--surface)",
1247
+ boxShadow: d ? "0 0 0 3px var(--accent-wash)" : "none",
1248
+ transition: "all .15s var(--ease)"
1249
+ }, children: [
1250
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 12, color: "var(--accent)" }, children: ">" }),
1251
+ /* @__PURE__ */ t.jsx(
1252
+ "input",
1253
+ {
1254
+ type: "url",
1255
+ value: i,
1256
+ disabled: r,
1257
+ spellCheck: !1,
1258
+ autoComplete: "off",
1259
+ onFocus: () => h(!0),
1260
+ onBlur: () => h(!1),
1261
+ onChange: (l) => s(l.target.value),
1262
+ onKeyDown: (l) => {
1263
+ l.key === "Enter" && o();
1264
+ },
1265
+ placeholder: "http://localhost:1633",
1266
+ style: {
1267
+ flex: 1,
1268
+ minWidth: 0,
1269
+ background: "transparent",
1270
+ border: "none",
1271
+ outline: "none",
1272
+ color: "var(--fg)",
1273
+ fontFamily: "var(--font-mono)",
1274
+ fontSize: 12.5,
1275
+ padding: "9px 0"
1276
+ }
1277
+ }
1278
+ )
1279
+ ] }),
1280
+ /* @__PURE__ */ t.jsx(q, { onClick: o, disabled: r || !u, children: "connect" })
1281
+ ] });
1282
+ }
1283
+ function Pn({ node: n, beeApiUrl: r }) {
1284
+ return n.isChecking ? /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12, padding: "12px 14px", border: "1px solid var(--line)", borderRadius: 8, background: "var(--raised)" }, children: [
1285
+ /* @__PURE__ */ t.jsx(ke, {}),
1286
+ /* @__PURE__ */ t.jsxs("span", { style: { color: "var(--fg-muted)", fontSize: 13, fontFamily: "var(--font-mono)" }, children: [
1287
+ "probing ",
1288
+ r,
1289
+ "…"
1290
+ ] })
1291
+ ] }) : n.isRunning ? /* @__PURE__ */ t.jsx(H, { tone: "ok", title: "Node online", sub: `bee ${n.version ?? "—"} · ${r}`, children: /* @__PURE__ */ t.jsx(ue, { tone: "ok", children: "health ok" }) }) : n.error ? /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1292
+ /* @__PURE__ */ t.jsx(H, { tone: "bad", title: "Node unreachable", sub: n.error }),
1293
+ /* @__PURE__ */ t.jsxs("div", { style: { fontSize: 12, color: "var(--fg-muted)", display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
1294
+ /* @__PURE__ */ t.jsx("span", { children: "start one with" }),
1295
+ /* @__PURE__ */ t.jsx("code", { style: { fontFamily: "var(--font-mono)", fontSize: 11.5, background: "var(--bunker)", border: "1px solid var(--line)", color: "var(--accent-bright)", padding: "2px 7px", borderRadius: 3 }, children: "bee start" }),
1296
+ /* @__PURE__ */ t.jsx(q, { onClick: n.check, children: "retry" })
1128
1297
  ] })
1129
- ] }) : /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1130
- /* @__PURE__ */ r.jsxs("div", { style: {
1298
+ ] }) : /* @__PURE__ */ t.jsx(H, { tone: "flat", title: "Node not connected", sub: r, children: /* @__PURE__ */ t.jsx(q, { onClick: n.check, children: "connect" }) });
1299
+ }
1300
+ function ft({ symbol: n, value: r, onChange: a, onSend: i, pending: s, confirming: d, done: h, disabled: p }) {
1301
+ const u = s || d;
1302
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
1303
+ /* @__PURE__ */ t.jsxs("div", { style: {
1304
+ flex: 1,
1305
+ minWidth: 0,
1131
1306
  display: "flex",
1132
1307
  alignItems: "center",
1133
- gap: 12,
1134
- padding: "11px 14px",
1135
- border: `1px solid ${a.colors.warning}`,
1136
- borderRadius: 8,
1137
- background: a.colors.warningLight
1308
+ gap: 8,
1309
+ padding: "0 12px",
1310
+ borderRadius: 6,
1311
+ border: "1px solid var(--line-2)",
1312
+ background: u || p ? "var(--bunker)" : "var(--surface)"
1138
1313
  }, children: [
1139
- /* @__PURE__ */ r.jsx("span", { style: { color: a.colors.warning, fontSize: 10, lineHeight: 1 }, children: "●" }),
1140
- /* @__PURE__ */ r.jsxs("div", { children: [
1141
- /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.warning, fontSize: 14 }, children: "Wrong network" }),
1142
- /* @__PURE__ */ r.jsxs("div", { style: { fontSize: 12, color: a.colors.muted }, children: [
1143
- "Chain ",
1144
- n ?? "—",
1145
- " active — Gnosis (",
1146
- ce,
1147
- ") required"
1148
- ] })
1149
- ] })
1314
+ /* @__PURE__ */ t.jsx(
1315
+ "input",
1316
+ {
1317
+ inputMode: "decimal",
1318
+ value: r,
1319
+ disabled: u || p,
1320
+ spellCheck: !1,
1321
+ onChange: (o) => a(o.target.value),
1322
+ style: {
1323
+ flex: 1,
1324
+ minWidth: 0,
1325
+ background: "transparent",
1326
+ border: "none",
1327
+ outline: "none",
1328
+ color: "var(--fg)",
1329
+ fontFamily: "var(--font-mono)",
1330
+ fontSize: 12.5,
1331
+ padding: "8px 0"
1332
+ }
1333
+ }
1334
+ ),
1335
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 11, color: "var(--fg-muted)", flexShrink: 0 }, children: n })
1150
1336
  ] }),
1151
- /* @__PURE__ */ r.jsx(
1152
- "button",
1337
+ h ? /* @__PURE__ */ t.jsx(ue, { tone: "ok", children: "sent" }) : /* @__PURE__ */ t.jsx(q, { onClick: i, disabled: u || p || !r.trim(), children: s ? "sign…" : d ? "mining…" : `send ${n.toLowerCase()}` })
1338
+ ] });
1339
+ }
1340
+ function Dn({ to: n, onSettled: r }) {
1341
+ const [a, i] = F(vn), [s, d] = F(gn), { address: h } = we(), p = en(), u = tn(), o = at({ hash: p.data }), l = at({ hash: u.data });
1342
+ Q(() => {
1343
+ o.isSuccess && r();
1344
+ }, [o.isSuccess]), Q(() => {
1345
+ l.isSuccess && r();
1346
+ }, [l.isSuccess]);
1347
+ const v = nn({
1348
+ abi: ot,
1349
+ address: dt,
1350
+ functionName: "balanceOf",
1351
+ args: h ? [h] : void 0,
1352
+ chainId: G,
1353
+ query: { enabled: !!h }
1354
+ }), g = v.data !== void 0 ? Number(v.data) / 10 ** De : void 0, b = (g ?? 0) > 0, _ = () => {
1355
+ const S = ht(() => sn(a.trim()));
1356
+ S !== void 0 && p.sendTransaction({ to: n, value: S, chainId: G });
1357
+ }, E = () => {
1358
+ const S = ht(() => cn(s.trim(), De));
1359
+ S !== void 0 && u.writeContract({
1360
+ abi: ot,
1361
+ address: dt,
1362
+ functionName: "transfer",
1363
+ args: [n, S],
1364
+ chainId: G
1365
+ });
1366
+ }, O = ze(p.error) ?? ze(u.error);
1367
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1368
+ /* @__PURE__ */ t.jsx("div", { style: be, children: "One-time top-up — sent from your connected wallet to the node wallet:" }),
1369
+ /* @__PURE__ */ t.jsx(
1370
+ ft,
1153
1371
  {
1154
- onClick: () => i({ chainId: Se.id }),
1155
- disabled: c,
1156
- style: {
1157
- background: a.colors.primary,
1158
- color: "#fff",
1159
- border: "none",
1160
- borderRadius: 6,
1161
- padding: "9px 20px",
1162
- cursor: c ? "not-allowed" : "pointer",
1163
- fontSize: 14,
1164
- fontWeight: 500,
1165
- opacity: c ? 0.7 : 1,
1166
- alignSelf: "flex-start"
1167
- },
1168
- children: c ? "Switching…" : "Switch to Gnosis"
1372
+ symbol: "xDAI",
1373
+ value: a,
1374
+ onChange: i,
1375
+ onSend: _,
1376
+ pending: p.isPending,
1377
+ confirming: o.isLoading && !!p.data,
1378
+ done: o.isSuccess,
1379
+ disabled: !1
1169
1380
  }
1170
1381
  ),
1171
- u && /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.error }, children: u.message })
1382
+ /* @__PURE__ */ t.jsx(
1383
+ ft,
1384
+ {
1385
+ symbol: "xBZZ",
1386
+ value: s,
1387
+ onChange: d,
1388
+ onSend: E,
1389
+ pending: u.isPending,
1390
+ confirming: l.isLoading && !!u.data,
1391
+ done: l.isSuccess,
1392
+ disabled: !b
1393
+ }
1394
+ ),
1395
+ g !== void 0 && /* @__PURE__ */ t.jsxs("div", { style: { ...be, display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }, children: [
1396
+ /* @__PURE__ */ t.jsxs("span", { children: [
1397
+ "your wallet holds",
1398
+ " ",
1399
+ /* @__PURE__ */ t.jsxs("span", { style: { fontFamily: "var(--font-mono)", color: b ? "var(--fg-soft)" : "var(--warn)" }, children: [
1400
+ g.toLocaleString("en-US", { maximumFractionDigits: 4 }),
1401
+ " xBZZ"
1402
+ ] })
1403
+ ] }),
1404
+ !b && /* @__PURE__ */ t.jsx(q, { onClick: () => window.open("https://www.ethswarm.org/get-bzz", "_blank", "noopener"), children: "get xBZZ" })
1405
+ ] }),
1406
+ O && /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--bad)", fontFamily: "var(--font-mono)" }, children: O })
1172
1407
  ] });
1173
1408
  }
1174
- function ht({ onClose: t, beeNode: n, stamps: i, beeApiUrl: c, setBeeApiUrl: u }) {
1175
- const p = n.isRunning && !!i.selectedStampId;
1176
- return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1177
- /* @__PURE__ */ r.jsx("style", { children: `
1178
- @keyframes spin { to { transform: rotate(360deg); } }
1179
- @keyframes scIn {
1180
- from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
1181
- to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
1182
- }
1183
- ` }),
1184
- /* @__PURE__ */ r.jsx(
1185
- "div",
1409
+ function ht(n) {
1410
+ try {
1411
+ return n();
1412
+ } catch {
1413
+ return;
1414
+ }
1415
+ }
1416
+ function On({ locked: n, nodeWallet: r }) {
1417
+ if (n) return /* @__PURE__ */ t.jsx(ee, { children: "Bring your Bee node online to read its wallet." });
1418
+ if (r.error)
1419
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1420
+ /* @__PURE__ */ t.jsx(H, { tone: "bad", title: "Could not read node wallet", sub: r.error }),
1421
+ /* @__PURE__ */ t.jsx(q, { onClick: r.refresh, children: "retry" })
1422
+ ] });
1423
+ const a = r.isLoading && r.xdai === void 0;
1424
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1425
+ /* @__PURE__ */ t.jsx(Ae, { symbol: "xDAI", role: "gas for the node's own transactions", amount: r.xdai ?? 0, loading: a }),
1426
+ /* @__PURE__ */ t.jsx(Ae, { symbol: "xBZZ", role: "pays for postage stamps", amount: r.xbzz ?? 0, loading: a }),
1427
+ /* @__PURE__ */ t.jsxs("div", { style: be, children: [
1428
+ "The Bee node has its own wallet",
1429
+ r.address && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1430
+ " ",
1431
+ /* @__PURE__ */ t.jsxs("span", { style: { fontFamily: "var(--font-mono)", color: "var(--fg-soft)" }, children: [
1432
+ r.address.slice(0, 8),
1433
+ "…",
1434
+ r.address.slice(-6)
1435
+ ] })
1436
+ ] }),
1437
+ " ",
1438
+ "— it buys and renews postage stamps on chain."
1439
+ ] }),
1440
+ !r.isFunded && r.address && /* @__PURE__ */ t.jsx(Dn, { to: r.address, onSettled: r.refresh })
1441
+ ] });
1442
+ }
1443
+ function zn({ stamp: n, selected: r, onSelect: a }) {
1444
+ const [i, s] = F(!1), d = Math.floor(n.batchTTL / 86400), h = `${n.batchID.slice(0, 8)}…${n.batchID.slice(-6)}`, p = r || i;
1445
+ return /* @__PURE__ */ t.jsxs(
1446
+ "button",
1447
+ {
1448
+ onClick: a,
1449
+ onMouseEnter: () => s(!0),
1450
+ onMouseLeave: () => s(!1),
1451
+ style: {
1452
+ display: "flex",
1453
+ alignItems: "center",
1454
+ gap: 12,
1455
+ width: "100%",
1456
+ textAlign: "left",
1457
+ padding: "12px 14px",
1458
+ borderRadius: 8,
1459
+ cursor: "pointer",
1460
+ border: `1px solid ${r ? "var(--ok-line)" : p ? "var(--line-2)" : "var(--line)"}`,
1461
+ background: r ? "var(--ok-wash)" : "var(--raised)",
1462
+ boxShadow: r ? "0 0 0 1px var(--ok-line), 0 0 18px var(--ok-wash)" : "none",
1463
+ transition: "all .15s var(--ease)"
1464
+ },
1465
+ children: [
1466
+ /* @__PURE__ */ t.jsx("span", { style: {
1467
+ width: 8,
1468
+ height: 8,
1469
+ flexShrink: 0,
1470
+ borderRadius: "50%",
1471
+ background: r ? "var(--ok)" : "var(--line-2)",
1472
+ boxShadow: r ? "0 0 8px var(--ok)" : "none",
1473
+ transition: "all .15s var(--ease)"
1474
+ } }),
1475
+ /* @__PURE__ */ t.jsxs("div", { style: { minWidth: 0, flex: 1 }, children: [
1476
+ /* @__PURE__ */ t.jsx("div", { style: { fontFamily: "var(--font-mono)", fontSize: 12.5, color: "var(--fg)" }, children: h }),
1477
+ /* @__PURE__ */ t.jsxs("div", { style: { fontSize: 11.5, color: "var(--fg-muted)", marginTop: 3, display: "flex", gap: 8 }, children: [
1478
+ n.label && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1479
+ /* @__PURE__ */ t.jsx("span", { children: n.label }),
1480
+ /* @__PURE__ */ t.jsx("span", { style: { color: "var(--fg-faint)" }, children: "·" })
1481
+ ] }),
1482
+ /* @__PURE__ */ t.jsxs("span", { children: [
1483
+ "depth ",
1484
+ n.depth
1485
+ ] })
1486
+ ] })
1487
+ ] }),
1488
+ /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexShrink: 0 }, children: [
1489
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 11, color: d > 30 ? "var(--fg-muted)" : "var(--warn)" }, children: d > 0 ? `${d}d ttl` : "expiring" }),
1490
+ /* @__PURE__ */ t.jsx(ue, { tone: n.usable ? "ok" : "bad", children: n.usable ? "usable" : "unusable" })
1491
+ ] })
1492
+ ]
1493
+ }
1494
+ );
1495
+ }
1496
+ function An({ stamps: n, locked: r, lockedHint: a }) {
1497
+ return r ? /* @__PURE__ */ t.jsx(ee, { children: a }) : n.isLoading ? /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12, padding: "12px 14px", border: "1px solid var(--line)", borderRadius: 8, background: "var(--raised)" }, children: [
1498
+ /* @__PURE__ */ t.jsx(ke, {}),
1499
+ /* @__PURE__ */ t.jsx("span", { style: { color: "var(--fg-muted)", fontSize: 13, fontFamily: "var(--font-mono)" }, children: "reading /stamps…" })
1500
+ ] }) : n.error ? /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1501
+ /* @__PURE__ */ t.jsx(H, { tone: "bad", title: "Could not read stamps", sub: n.error }),
1502
+ /* @__PURE__ */ t.jsx(q, { onClick: n.fetchStamps, children: "retry" })
1503
+ ] }) : /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1504
+ n.stamps.length === 0 && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1505
+ /* @__PURE__ */ t.jsx(ee, { children: "No postage stamps on this node yet — once the dApp buys one it will appear here." }),
1506
+ /* @__PURE__ */ t.jsx(q, { onClick: n.fetchStamps, children: "refresh" })
1507
+ ] }),
1508
+ n.stamps.map((i) => /* @__PURE__ */ t.jsx(
1509
+ zn,
1186
1510
  {
1187
- onClick: t,
1188
- style: {
1189
- position: "fixed",
1190
- inset: 0,
1191
- background: a.colors.overlay,
1192
- zIndex: 9998
1511
+ stamp: i,
1512
+ selected: n.selectedStampId === i.batchID,
1513
+ onSelect: () => n.selectStamp(i.batchID)
1514
+ },
1515
+ i.batchID
1516
+ ))
1517
+ ] });
1518
+ }
1519
+ const be = {
1520
+ fontSize: 11.5,
1521
+ color: "var(--fg-faint)",
1522
+ lineHeight: 1.5,
1523
+ paddingLeft: 2
1524
+ };
1525
+ function $n({
1526
+ onClose: n,
1527
+ beeNode: r,
1528
+ stamps: a,
1529
+ beeApiUrl: i,
1530
+ setBeeApiUrl: s,
1531
+ requirements: d,
1532
+ nodeWallet: h
1533
+ }) {
1534
+ yt();
1535
+ const p = { ...xt, ...d }, { address: u, isConnected: o, chainId: l } = we(), v = o && l === G, { data: g, isLoading: b } = vt({
1536
+ address: u,
1537
+ chainId: G,
1538
+ query: { enabled: o }
1539
+ }), _ = g ? Number(g.formatted) : void 0, E = v && !!g && g.value > 0n, O = { xdai: _, isLoading: o && b, hasGas: E }, S = bt(i), w = h ?? S, I = Jt(!1);
1540
+ Q(() => {
1541
+ !I.current && (I.current = !0, r.isRunning) || r.check();
1542
+ }, [i]), Q(() => {
1543
+ r.isRunning && (a.fetchStamps(), p.xbzz && w.refresh());
1544
+ }, [r.isRunning]);
1545
+ const R = !p.xdai || E, k = !p.xbzz || w.isFunded, z = o ? "done" : "active", Y = o ? v ? "done" : "active" : "locked", Z = v ? E ? "done" : "active" : "locked", W = v && R ? r.isRunning ? "done" : "active" : "locked", te = W !== "done" ? "locked" : w.isFunded ? "done" : "active", ne = W === "done" && k ? a.selectedStampId ? "done" : "active" : "locked", re = o && v && r.isRunning && R && k && (!p.postageStamp || !!a.selectedStampId), { disconnect: B } = gt(), M = () => {
1546
+ B(), r.disconnect(), n();
1547
+ }, N = [
1548
+ {
1549
+ key: "wallet",
1550
+ title: "Wallet",
1551
+ state: z,
1552
+ hint: o ? "linked" : null,
1553
+ body: /* @__PURE__ */ t.jsx(En, { isConnected: o, address: u })
1554
+ },
1555
+ {
1556
+ key: "network",
1557
+ title: "Network chain",
1558
+ state: Y,
1559
+ hint: o ? v ? "gnosis" : "wrong net" : null,
1560
+ body: /* @__PURE__ */ t.jsx(In, { locked: Y === "locked", isOnGnosis: v, chainId: l })
1561
+ },
1562
+ ...p.xdai ? [{
1563
+ key: "balance",
1564
+ title: "Balance",
1565
+ state: Z,
1566
+ hint: v ? E ? "funded" : "low" : null,
1567
+ body: /* @__PURE__ */ t.jsx(Tn, { locked: Z === "locked", balance: O })
1568
+ }] : [],
1569
+ {
1570
+ key: "node",
1571
+ title: "Bee node",
1572
+ state: W,
1573
+ hint: r.isRunning ? r.version : null,
1574
+ body: W === "locked" ? /* @__PURE__ */ t.jsx(ee, { children: p.xdai ? "Top up xDAI gas to unlock the Bee node connection." : "Switch to the Gnosis chain to unlock the Bee node connection." }) : /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1575
+ /* @__PURE__ */ t.jsx(Fn, { value: i, disabled: r.isChecking, onSubmit: s }),
1576
+ /* @__PURE__ */ t.jsx(Pn, { node: r, beeApiUrl: i })
1577
+ ] })
1578
+ },
1579
+ ...p.xbzz ? [{
1580
+ key: "nodeWallet",
1581
+ title: "Node wallet",
1582
+ state: te,
1583
+ hint: te === "locked" ? null : w.isFunded ? "funded" : "top up",
1584
+ body: /* @__PURE__ */ t.jsx(On, { locked: te === "locked", nodeWallet: w })
1585
+ }] : [],
1586
+ ...p.postageStamp ? [{
1587
+ key: "stamp",
1588
+ title: "Postage stamp",
1589
+ state: ne,
1590
+ hint: a.selectedStampId ? "1 selected" : ne !== "locked" ? `${a.stamps.length} found` : null,
1591
+ body: /* @__PURE__ */ t.jsx(
1592
+ An,
1593
+ {
1594
+ stamps: a,
1595
+ locked: ne === "locked",
1596
+ lockedHint: p.xbzz ? "Fund the node wallet to manage postage stamps." : "Bring a node online to load its postage stamps."
1193
1597
  }
1194
- }
1195
- ),
1196
- /* @__PURE__ */ r.jsxs("div", { style: {
1598
+ )
1599
+ }] : []
1600
+ ], fe = N.map((D) => ({
1601
+ wallet: "wallet",
1602
+ network: "chain",
1603
+ balance: "gas",
1604
+ node: "node",
1605
+ nodeWallet: "fund",
1606
+ stamp: "stamp"
1607
+ })[D.key]).join(" · ");
1608
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1609
+ /* @__PURE__ */ t.jsx("div", { className: "swarm-connect", onClick: n, style: {
1610
+ position: "fixed",
1611
+ inset: 0,
1612
+ zIndex: 9998,
1613
+ background: "rgba(4,6,8,0.72)",
1614
+ backdropFilter: "blur(6px)",
1615
+ WebkitBackdropFilter: "blur(6px)",
1616
+ animation: "sc-backdrop-in .2s var(--ease)"
1617
+ } }),
1618
+ /* @__PURE__ */ t.jsxs("div", { className: "swarm-connect", role: "dialog", "aria-label": "Connect to Swarm", style: {
1197
1619
  position: "fixed",
1198
1620
  top: "50%",
1199
1621
  left: "50%",
1622
+ transform: "translate(-50%, -50%)",
1200
1623
  zIndex: 9999,
1201
- background: "#fff",
1202
- borderRadius: 16,
1203
- boxShadow: "0 24px 64px rgba(0,0,0,0.18)",
1204
- width: 460,
1205
- maxWidth: "calc(100vw - 32px)",
1206
- animation: "scIn 0.2s ease forwards",
1624
+ width: 440,
1625
+ maxWidth: "calc(100vw - 28px)",
1626
+ background: "var(--surface)",
1627
+ borderRadius: 14,
1628
+ border: "1px solid var(--line-2)",
1629
+ boxShadow: "0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,107,0,.08), 0 0 60px rgba(255,107,0,.08)",
1207
1630
  overflow: "hidden",
1208
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
1631
+ animation: "sc-modal-in .26s var(--ease) forwards",
1632
+ fontFamily: "var(--font-body)"
1209
1633
  }, children: [
1210
- /* @__PURE__ */ r.jsxs("div", { style: {
1211
- padding: "18px 20px 0",
1212
- display: "flex",
1213
- justifyContent: "space-between",
1214
- alignItems: "center"
1215
- }, children: [
1216
- /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
1217
- /* @__PURE__ */ r.jsx("span", { style: { fontSize: 20 }, children: "🐝" }),
1218
- /* @__PURE__ */ r.jsx("span", { style: { fontWeight: 700, fontSize: 16, color: a.colors.text }, children: "Swarm Connect" })
1219
- ] }),
1220
- /* @__PURE__ */ r.jsx(
1221
- "button",
1222
- {
1223
- onClick: t,
1224
- "aria-label": "Close",
1225
- style: {
1226
- background: "none",
1227
- border: "none",
1228
- cursor: "pointer",
1229
- color: a.colors.muted,
1230
- fontSize: 22,
1231
- lineHeight: 1,
1232
- padding: "0 2px",
1233
- borderRadius: 4
1234
- },
1235
- children: "×"
1236
- }
1237
- )
1634
+ /* @__PURE__ */ t.jsxs("div", { style: { position: "relative", padding: "18px 20px 16px", borderBottom: "1px solid var(--line)", overflow: "hidden" }, children: [
1635
+ /* @__PURE__ */ t.jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none", background: "radial-gradient(ellipse 60% 140% at 88% 0%, var(--accent-wash), transparent 70%)" } }),
1636
+ /* @__PURE__ */ t.jsxs("div", { style: { position: "relative", display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
1637
+ /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 11 }, children: [
1638
+ /* @__PURE__ */ t.jsx(Sn, { size: 30 }),
1639
+ /* @__PURE__ */ t.jsxs("div", { children: [
1640
+ /* @__PURE__ */ t.jsx("div", { style: { fontFamily: "var(--font-display)", fontWeight: 600, fontSize: 16, color: "var(--fg)", lineHeight: 1.1 }, children: "Connect to Swarm" }),
1641
+ /* @__PURE__ */ t.jsxs("div", { style: { fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".12em", color: "var(--fg-muted)", marginTop: 3 }, children: [
1642
+ "// ",
1643
+ re ? "ready" : fe
1644
+ ] })
1645
+ ] })
1646
+ ] }),
1647
+ /* @__PURE__ */ t.jsx(
1648
+ "button",
1649
+ {
1650
+ onClick: n,
1651
+ "aria-label": "Close",
1652
+ style: {
1653
+ background: "transparent",
1654
+ border: "1px solid var(--line)",
1655
+ color: "var(--fg-muted)",
1656
+ width: 30,
1657
+ height: 30,
1658
+ borderRadius: 6,
1659
+ cursor: "pointer",
1660
+ fontSize: 18,
1661
+ lineHeight: 1,
1662
+ display: "inline-flex",
1663
+ alignItems: "center",
1664
+ justifyContent: "center",
1665
+ transition: "all .15s"
1666
+ },
1667
+ onMouseEnter: (D) => {
1668
+ D.currentTarget.style.borderColor = "var(--line-orange)", D.currentTarget.style.color = "var(--accent-bright)";
1669
+ },
1670
+ onMouseLeave: (D) => {
1671
+ D.currentTarget.style.borderColor = "var(--line)", D.currentTarget.style.color = "var(--fg-muted)";
1672
+ },
1673
+ children: "×"
1674
+ }
1675
+ )
1676
+ ] })
1238
1677
  ] }),
1239
- /* @__PURE__ */ r.jsxs("div", { style: {
1240
- padding: "20px",
1241
- marginTop: 6,
1242
- minHeight: 260,
1243
- maxHeight: "64vh",
1244
- overflowY: "auto",
1678
+ /* @__PURE__ */ t.jsx("div", { className: "sc-scroll", style: { padding: 20, display: "flex", flexDirection: "column", gap: 24, maxHeight: "62vh", overflowY: "auto" }, children: N.map((D, ae) => /* @__PURE__ */ t.jsxs("section", { style: ae === 0 ? { animation: "sc-step-in .3s var(--ease)" } : { opacity: D.state === "locked" ? 0.55 : 1, transition: "opacity .3s var(--ease)" }, children: [
1679
+ /* @__PURE__ */ t.jsx(jn, { step: ae + 1, state: D.state, hint: D.hint, children: D.title }),
1680
+ D.body
1681
+ ] }, D.key)) }),
1682
+ re ? /* @__PURE__ */ t.jsx(Ln, { onDisconnect: M, onDone: n }) : /* @__PURE__ */ t.jsxs("div", { style: {
1683
+ padding: "12px 20px",
1684
+ borderTop: "1px solid var(--line)",
1245
1685
  display: "flex",
1246
- flexDirection: "column",
1247
- gap: 28
1686
+ alignItems: "center",
1687
+ justifyContent: "space-between",
1688
+ background: "var(--bunker)",
1689
+ transition: "background .3s"
1248
1690
  }, children: [
1249
- /* @__PURE__ */ r.jsx(
1250
- rt,
1251
- {
1252
- beeApiUrl: c,
1253
- setBeeApiUrl: u,
1254
- beeNode: n,
1255
- stamps: i
1256
- }
1257
- ),
1258
- /* @__PURE__ */ r.jsx(ct, { swarmReady: p })
1691
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".06em", color: "var(--fg-muted)" }, children: "// gated · each step unlocks the next" }),
1692
+ /* @__PURE__ */ t.jsx(Cn, { states: N.map((D) => D.state === "done") })
1259
1693
  ] })
1260
1694
  ] })
1261
1695
  ] });
1262
1696
  }
1263
- function Ct({ beeApiUrl: t = ue, label: n }) {
1264
- const [i, c] = U(!1), {
1265
- beeNode: u,
1266
- stamps: p,
1267
- beeApiUrl: g,
1268
- setBeeApiUrl: x,
1269
- isWalletConnected: f,
1270
- address: s,
1271
- isOnGnosis: d,
1272
- isFullyConnected: v
1273
- } = et({ beeApiUrl: t }), b = n ?? (v ? s ? `${s.slice(0, 6)}…${s.slice(-4)}` : "Connected" : "Connect to Swarm");
1274
- return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1275
- /* @__PURE__ */ r.jsxs(
1697
+ function Ln({ onDisconnect: n, onDone: r }) {
1698
+ const [a, i] = F(!1), [s, d] = F(!1);
1699
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", borderTop: "1px solid var(--line)" }, children: [
1700
+ /* @__PURE__ */ t.jsx(
1276
1701
  "button",
1277
1702
  {
1278
- onClick: () => c(!0),
1703
+ onClick: n,
1704
+ onMouseEnter: () => i(!0),
1705
+ onMouseLeave: () => i(!1),
1279
1706
  style: {
1280
- display: "inline-flex",
1281
- alignItems: "center",
1282
- gap: 8,
1283
- background: v ? a.colors.successLight : a.colors.primary,
1284
- color: v ? a.colors.success : "#fff",
1285
- border: v ? `1.5px solid ${a.colors.success}` : "none",
1286
- borderRadius: 8,
1287
- padding: "10px 18px",
1707
+ flex: "1 1 50%",
1708
+ minWidth: 0,
1709
+ padding: "13px 20px",
1288
1710
  cursor: "pointer",
1289
- fontSize: 15,
1711
+ background: a ? "var(--bad-wash)" : "var(--bunker)",
1712
+ border: "none",
1713
+ borderRight: "1px solid var(--line)",
1714
+ color: a ? "var(--bad)" : "var(--fg-muted)",
1715
+ fontFamily: "var(--font-mono)",
1716
+ fontSize: 11,
1290
1717
  fontWeight: 600,
1291
- boxShadow: v ? "none" : "0 2px 8px rgba(26,86,219,0.25)",
1292
- transition: "all 0.15s",
1293
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
1718
+ letterSpacing: ".1em",
1719
+ textTransform: "uppercase",
1720
+ transition: "all .15s var(--ease)",
1721
+ whiteSpace: "nowrap"
1294
1722
  },
1295
- onMouseOver: (R) => {
1296
- v || (R.currentTarget.style.background = a.colors.primaryHover);
1723
+ children: "disconnect"
1724
+ }
1725
+ ),
1726
+ /* @__PURE__ */ t.jsx(
1727
+ "button",
1728
+ {
1729
+ onClick: r,
1730
+ onMouseEnter: () => d(!0),
1731
+ onMouseLeave: () => d(!1),
1732
+ style: {
1733
+ flex: "1 1 50%",
1734
+ minWidth: 0,
1735
+ padding: "13px 20px",
1736
+ cursor: "pointer",
1737
+ background: s ? "var(--ok-wash)" : "var(--bunker)",
1738
+ border: "none",
1739
+ color: "var(--ok)",
1740
+ fontFamily: "var(--font-mono)",
1741
+ fontSize: 11,
1742
+ fontWeight: 600,
1743
+ letterSpacing: ".1em",
1744
+ textTransform: "uppercase",
1745
+ transition: "all .15s var(--ease)",
1746
+ whiteSpace: "nowrap"
1297
1747
  },
1298
- onMouseOut: (R) => {
1299
- R.currentTarget.style.background = v ? a.colors.successLight : a.colors.primary;
1748
+ children: /* @__PURE__ */ t.jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 7 }, children: [
1749
+ /* @__PURE__ */ t.jsx("span", { style: { width: 7, height: 7, borderRadius: "50%", background: "var(--ok)", boxShadow: "0 0 8px var(--ok)" } }),
1750
+ "connected"
1751
+ ] })
1752
+ }
1753
+ )
1754
+ ] });
1755
+ }
1756
+ function Kn({ beeApiUrl: n = de, requirements: r, label: a }) {
1757
+ yt();
1758
+ const [i, s] = F(!1), d = yn({ beeApiUrl: n, requirements: r }), { beeApiUrl: h, setBeeApiUrl: p, beeNode: u, stamps: o, nodeWallet: l, isFullyConnected: v, address: g } = d, [b, _] = F(!1), E = a ?? (v && g ? `${g.slice(0, 6)}…${g.slice(-4)}` : "Connect to Swarm");
1759
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1760
+ /* @__PURE__ */ t.jsxs(
1761
+ "button",
1762
+ {
1763
+ className: "swarm-connect",
1764
+ onClick: () => s(!0),
1765
+ onMouseEnter: () => _(!0),
1766
+ onMouseLeave: () => _(!1),
1767
+ style: {
1768
+ display: "inline-flex",
1769
+ alignItems: "center",
1770
+ gap: 10,
1771
+ fontFamily: "var(--font-mono)",
1772
+ fontSize: 13,
1773
+ fontWeight: 600,
1774
+ letterSpacing: ".04em",
1775
+ padding: "10px 16px",
1776
+ borderRadius: 6,
1777
+ cursor: "pointer",
1778
+ background: v ? "var(--ok-wash)" : "var(--accent)",
1779
+ color: v ? "var(--ok)" : "var(--accent-ink)",
1780
+ border: `1px solid ${v ? "var(--ok-line)" : "transparent"}`,
1781
+ boxShadow: v ? "none" : b ? "0 0 26px var(--accent-glow)" : "0 0 14px var(--accent-glow)",
1782
+ transform: b && !v ? "translateY(-1px)" : "none",
1783
+ transition: "all .15s var(--ease)",
1784
+ whiteSpace: "nowrap"
1300
1785
  },
1301
1786
  children: [
1302
- !v && /* @__PURE__ */ r.jsxs("span", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [
1303
- /* @__PURE__ */ r.jsx(ie, { ok: u.isRunning, checking: u.isChecking }),
1304
- /* @__PURE__ */ r.jsx(ie, { ok: !!p.selectedStampId }),
1305
- /* @__PURE__ */ r.jsx(ie, { ok: f }),
1306
- /* @__PURE__ */ r.jsx(ie, { ok: d })
1307
- ] }),
1308
- b
1787
+ v ? /* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, borderRadius: "50%", background: "var(--ok)", boxShadow: "0 0 8px var(--ok)" } }) : /* @__PURE__ */ t.jsx(Wn, { swarm: d }),
1788
+ E
1309
1789
  ]
1310
1790
  }
1311
1791
  ),
1312
- i && /* @__PURE__ */ r.jsx(
1313
- ht,
1792
+ i && /* @__PURE__ */ t.jsx(
1793
+ $n,
1314
1794
  {
1315
- onClose: () => c(!1),
1795
+ onClose: () => s(!1),
1316
1796
  beeNode: u,
1317
- stamps: p,
1318
- beeApiUrl: g,
1319
- setBeeApiUrl: x
1797
+ stamps: o,
1798
+ beeApiUrl: h,
1799
+ setBeeApiUrl: p,
1800
+ requirements: d.requirements,
1801
+ nodeWallet: l
1320
1802
  }
1321
1803
  )
1322
1804
  ] });
1323
1805
  }
1324
- function ie({ ok: t, checking: n }) {
1325
- const i = n ? a.colors.warning : t ? a.colors.success : a.colors.error;
1326
- return /* @__PURE__ */ r.jsx("span", { style: {
1327
- display: "inline-block",
1328
- width: 7,
1329
- height: 7,
1330
- borderRadius: "50%",
1331
- background: i
1332
- } });
1806
+ function Wn({ swarm: n }) {
1807
+ const { beeNode: r, stamps: a, nodeWallet: i, requirements: s, isWalletConnected: d, isOnGnosis: h, balance: p } = n, u = [
1808
+ d ? "ok" : "bad",
1809
+ h ? "ok" : "bad",
1810
+ ...s.xdai ? [p.hasGas ? "ok" : h ? "warn" : "bad"] : [],
1811
+ r.isChecking ? "warn" : r.isRunning ? "ok" : "bad",
1812
+ ...s.xbzz ? [i.isFunded ? "ok" : "bad"] : [],
1813
+ ...s.postageStamp ? [a.selectedStampId ? "ok" : "bad"] : []
1814
+ ], o = { ok: "var(--accent-ink)", bad: "rgba(26,14,2,.32)", warn: "#7a4a00" };
1815
+ return /* @__PURE__ */ t.jsx("span", { style: { display: "inline-flex", gap: 4, alignItems: "center" }, children: u.map((l, v) => /* @__PURE__ */ t.jsx("span", { style: { width: 6, height: 6, borderRadius: "50%", background: o[l], animation: l === "warn" ? "sc-pulse-dot 1.4s var(--ease) infinite" : "none" } }, v)) });
1333
1816
  }
1334
- const pt = "2.22.1", gt = () => `@wagmi/core@${pt}`;
1335
- var cr = function(t, n, i, c) {
1336
- if (i === "a" && !c) throw new TypeError("Private accessor was defined without a getter");
1337
- if (typeof n == "function" ? t !== n || !c : !n.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1338
- return i === "m" ? c : i === "a" ? c.call(t) : c ? c.value : n.get(t);
1339
- }, le, lr;
1340
- class Z extends Error {
1817
+ const Bn = "2.22.1", Mn = () => `@wagmi/core@${Bn}`;
1818
+ var kt = function(n, r, a, i) {
1819
+ if (a === "a" && !i) throw new TypeError("Private accessor was defined without a getter");
1820
+ if (typeof r == "function" ? n !== r || !i : !r.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1821
+ return a === "m" ? i : a === "a" ? i.call(n) : i ? i.value : r.get(n);
1822
+ }, ye, jt;
1823
+ class le extends Error {
1341
1824
  get docsBaseUrl() {
1342
1825
  return "https://wagmi.sh/core";
1343
1826
  }
1344
1827
  get version() {
1345
- return gt();
1828
+ return Mn();
1346
1829
  }
1347
- constructor(n, i = {}) {
1348
- var p;
1349
- super(), le.add(this), Object.defineProperty(this, "details", {
1830
+ constructor(r, a = {}) {
1831
+ var d;
1832
+ super(), ye.add(this), Object.defineProperty(this, "details", {
1350
1833
  enumerable: !0,
1351
1834
  configurable: !0,
1352
1835
  writable: !0,
@@ -1372,27 +1855,27 @@ class Z extends Error {
1372
1855
  writable: !0,
1373
1856
  value: "WagmiCoreError"
1374
1857
  });
1375
- const c = i.cause instanceof Z ? i.cause.details : (p = i.cause) != null && p.message ? i.cause.message : i.details, u = i.cause instanceof Z && i.cause.docsPath || i.docsPath;
1858
+ const i = a.cause instanceof le ? a.cause.details : (d = a.cause) != null && d.message ? a.cause.message : a.details, s = a.cause instanceof le && a.cause.docsPath || a.docsPath;
1376
1859
  this.message = [
1377
- n || "An error occurred.",
1860
+ r || "An error occurred.",
1378
1861
  "",
1379
- ...i.metaMessages ? [...i.metaMessages, ""] : [],
1380
- ...u ? [
1381
- `Docs: ${this.docsBaseUrl}${u}.html${i.docsSlug ? `#${i.docsSlug}` : ""}`
1862
+ ...a.metaMessages ? [...a.metaMessages, ""] : [],
1863
+ ...s ? [
1864
+ `Docs: ${this.docsBaseUrl}${s}.html${a.docsSlug ? `#${a.docsSlug}` : ""}`
1382
1865
  ] : [],
1383
- ...c ? [`Details: ${c}`] : [],
1866
+ ...i ? [`Details: ${i}`] : [],
1384
1867
  `Version: ${this.version}`
1385
1868
  ].join(`
1386
- `), i.cause && (this.cause = i.cause), this.details = c, this.docsPath = u, this.metaMessages = i.metaMessages, this.shortMessage = n;
1869
+ `), a.cause && (this.cause = a.cause), this.details = i, this.docsPath = s, this.metaMessages = a.metaMessages, this.shortMessage = r;
1387
1870
  }
1388
- walk(n) {
1389
- return cr(this, le, "m", lr).call(this, this, n);
1871
+ walk(r) {
1872
+ return kt(this, ye, "m", jt).call(this, this, r);
1390
1873
  }
1391
1874
  }
1392
- le = /* @__PURE__ */ new WeakSet(), lr = function t(n, i) {
1393
- return i != null && i(n) ? n : n.cause ? cr(this, le, "m", t).call(this, n.cause, i) : n;
1875
+ ye = /* @__PURE__ */ new WeakSet(), jt = function n(r, a) {
1876
+ return a != null && a(r) ? r : r.cause ? kt(this, ye, "m", n).call(this, r.cause, a) : r;
1394
1877
  };
1395
- class vt extends Z {
1878
+ class Nn extends le {
1396
1879
  constructor() {
1397
1880
  super("Chain not configured."), Object.defineProperty(this, "name", {
1398
1881
  enumerable: !0,
@@ -1402,7 +1885,7 @@ class vt extends Z {
1402
1885
  });
1403
1886
  }
1404
1887
  }
1405
- class V extends Z {
1888
+ class X extends le {
1406
1889
  constructor() {
1407
1890
  super("Provider not found."), Object.defineProperty(this, "name", {
1408
1891
  enumerable: !0,
@@ -1412,103 +1895,103 @@ class V extends Z {
1412
1895
  });
1413
1896
  }
1414
1897
  }
1415
- Re.type = "injected";
1416
- function Re(t = {}) {
1417
- const { shimDisconnect: n = !0, unstable_shimAsyncInject: i } = t;
1418
- function c() {
1419
- const f = t.target;
1420
- if (typeof f == "function") {
1421
- const s = f();
1422
- if (s)
1423
- return s;
1898
+ $e.type = "injected";
1899
+ function $e(n = {}) {
1900
+ const { shimDisconnect: r = !0, unstable_shimAsyncInject: a } = n;
1901
+ function i() {
1902
+ const u = n.target;
1903
+ if (typeof u == "function") {
1904
+ const o = u();
1905
+ if (o)
1906
+ return o;
1424
1907
  }
1425
- return typeof f == "object" ? f : typeof f == "string" ? {
1426
- ...yt[f] ?? {
1427
- id: f,
1428
- name: `${f[0].toUpperCase()}${f.slice(1)}`,
1429
- provider: `is${f[0].toUpperCase()}${f.slice(1)}`
1908
+ return typeof u == "object" ? u : typeof u == "string" ? {
1909
+ ...Un[u] ?? {
1910
+ id: u,
1911
+ name: `${u[0].toUpperCase()}${u.slice(1)}`,
1912
+ provider: `is${u[0].toUpperCase()}${u.slice(1)}`
1430
1913
  }
1431
1914
  } : {
1432
1915
  id: "injected",
1433
1916
  name: "Injected",
1434
- provider(s) {
1435
- return s == null ? void 0 : s.ethereum;
1917
+ provider(o) {
1918
+ return o == null ? void 0 : o.ethereum;
1436
1919
  }
1437
1920
  };
1438
1921
  }
1439
- let u, p, g, x;
1440
- return (f) => ({
1922
+ let s, d, h, p;
1923
+ return (u) => ({
1441
1924
  get icon() {
1442
- return c().icon;
1925
+ return i().icon;
1443
1926
  },
1444
1927
  get id() {
1445
- return c().id;
1928
+ return i().id;
1446
1929
  },
1447
1930
  get name() {
1448
- return c().name;
1931
+ return i().name;
1449
1932
  },
1450
1933
  /** @deprecated */
1451
1934
  get supportsSimulation() {
1452
1935
  return !0;
1453
1936
  },
1454
- type: Re.type,
1937
+ type: $e.type,
1455
1938
  async setup() {
1456
- const s = await this.getProvider();
1457
- s != null && s.on && t.target && (g || (g = this.onConnect.bind(this), s.on("connect", g)), u || (u = this.onAccountsChanged.bind(this), s.on("accountsChanged", u)));
1939
+ const o = await this.getProvider();
1940
+ o != null && o.on && n.target && (h || (h = this.onConnect.bind(this), o.on("connect", h)), s || (s = this.onAccountsChanged.bind(this), o.on("accountsChanged", s)));
1458
1941
  },
1459
- async connect({ chainId: s, isReconnecting: d, withCapabilities: v } = {}) {
1460
- var A, W, L, I, S, T;
1461
- const b = await this.getProvider();
1462
- if (!b)
1463
- throw new V();
1464
- let R = [];
1465
- if (d)
1466
- R = await this.getAccounts().catch(() => []);
1467
- else if (n)
1942
+ async connect({ chainId: o, isReconnecting: l, withCapabilities: v } = {}) {
1943
+ var _, E, O, S, w, I;
1944
+ const g = await this.getProvider();
1945
+ if (!g)
1946
+ throw new X();
1947
+ let b = [];
1948
+ if (l)
1949
+ b = await this.getAccounts().catch(() => []);
1950
+ else if (r)
1468
1951
  try {
1469
- R = (I = (L = (W = (A = (await b.request({
1952
+ b = (S = (O = (E = (_ = (await g.request({
1470
1953
  method: "wallet_requestPermissions",
1471
1954
  params: [{ eth_accounts: {} }]
1472
- }))[0]) == null ? void 0 : A.caveats) == null ? void 0 : W[0]) == null ? void 0 : L.value) == null ? void 0 : I.map((C) => oe(C)), R.length > 0 && (R = await this.getAccounts());
1473
- } catch (_) {
1474
- const C = _;
1475
- if (C.code === F.code)
1476
- throw new F(C);
1477
- if (C.code === xe.code)
1478
- throw C;
1955
+ }))[0]) == null ? void 0 : _.caveats) == null ? void 0 : E[0]) == null ? void 0 : O.value) == null ? void 0 : S.map((k) => me(k)), b.length > 0 && (b = await this.getAccounts());
1956
+ } catch (R) {
1957
+ const k = R;
1958
+ if (k.code === U.code)
1959
+ throw new U(k);
1960
+ if (k.code === Fe.code)
1961
+ throw k;
1479
1962
  }
1480
1963
  try {
1481
- !(R != null && R.length) && !d && (R = (await b.request({
1964
+ !(b != null && b.length) && !l && (b = (await g.request({
1482
1965
  method: "eth_requestAccounts"
1483
- })).map(($) => oe($))), g && (b.removeListener("connect", g), g = void 0), u || (u = this.onAccountsChanged.bind(this), b.on("accountsChanged", u)), p || (p = this.onChainChanged.bind(this), b.on("chainChanged", p)), x || (x = this.onDisconnect.bind(this), b.on("disconnect", x));
1484
- let _ = await this.getChainId();
1485
- if (s && _ !== s) {
1486
- const C = await this.switchChain({ chainId: s }).catch(($) => {
1487
- if ($.code === F.code)
1488
- throw $;
1489
- return { id: _ };
1966
+ })).map((z) => me(z))), h && (g.removeListener("connect", h), h = void 0), s || (s = this.onAccountsChanged.bind(this), g.on("accountsChanged", s)), d || (d = this.onChainChanged.bind(this), g.on("chainChanged", d)), p || (p = this.onDisconnect.bind(this), g.on("disconnect", p));
1967
+ let R = await this.getChainId();
1968
+ if (o && R !== o) {
1969
+ const k = await this.switchChain({ chainId: o }).catch((z) => {
1970
+ if (z.code === U.code)
1971
+ throw z;
1972
+ return { id: R };
1490
1973
  });
1491
- _ = (C == null ? void 0 : C.id) ?? _;
1974
+ R = (k == null ? void 0 : k.id) ?? R;
1492
1975
  }
1493
- return n && await ((S = f.storage) == null ? void 0 : S.removeItem(`${this.id}.disconnected`)), t.target || await ((T = f.storage) == null ? void 0 : T.setItem("injected.connected", !0)), {
1494
- accounts: v ? R.map((C) => ({ address: C, capabilities: {} })) : R,
1495
- chainId: _
1976
+ return r && await ((w = u.storage) == null ? void 0 : w.removeItem(`${this.id}.disconnected`)), n.target || await ((I = u.storage) == null ? void 0 : I.setItem("injected.connected", !0)), {
1977
+ accounts: v ? b.map((k) => ({ address: k, capabilities: {} })) : b,
1978
+ chainId: R
1496
1979
  };
1497
- } catch (_) {
1498
- const C = _;
1499
- throw C.code === F.code ? new F(C) : C.code === xe.code ? new xe(C) : C;
1980
+ } catch (R) {
1981
+ const k = R;
1982
+ throw k.code === U.code ? new U(k) : k.code === Fe.code ? new Fe(k) : k;
1500
1983
  }
1501
1984
  },
1502
1985
  async disconnect() {
1503
- var d, v;
1504
- const s = await this.getProvider();
1505
- if (!s)
1506
- throw new V();
1507
- p && (s.removeListener("chainChanged", p), p = void 0), x && (s.removeListener("disconnect", x), x = void 0), g || (g = this.onConnect.bind(this), s.on("connect", g));
1986
+ var l, v;
1987
+ const o = await this.getProvider();
1988
+ if (!o)
1989
+ throw new X();
1990
+ d && (o.removeListener("chainChanged", d), d = void 0), p && (o.removeListener("disconnect", p), p = void 0), h || (h = this.onConnect.bind(this), o.on("connect", h));
1508
1991
  try {
1509
- await Hr(() => (
1992
+ await dn(() => (
1510
1993
  // TODO: Remove explicit type for viem@3
1511
- s.request({
1994
+ o.request({
1512
1995
  // `'wallet_revokePermissions'` added in `viem@2.10.3`
1513
1996
  method: "wallet_revokePermissions",
1514
1997
  params: [{ eth_accounts: {} }]
@@ -1516,164 +1999,164 @@ function Re(t = {}) {
1516
1999
  ), { timeout: 100 });
1517
2000
  } catch {
1518
2001
  }
1519
- n && await ((d = f.storage) == null ? void 0 : d.setItem(`${this.id}.disconnected`, !0)), t.target || await ((v = f.storage) == null ? void 0 : v.removeItem("injected.connected"));
2002
+ r && await ((l = u.storage) == null ? void 0 : l.setItem(`${this.id}.disconnected`, !0)), n.target || await ((v = u.storage) == null ? void 0 : v.removeItem("injected.connected"));
1520
2003
  },
1521
2004
  async getAccounts() {
1522
- const s = await this.getProvider();
1523
- if (!s)
1524
- throw new V();
1525
- return (await s.request({ method: "eth_accounts" })).map((v) => oe(v));
2005
+ const o = await this.getProvider();
2006
+ if (!o)
2007
+ throw new X();
2008
+ return (await o.request({ method: "eth_accounts" })).map((v) => me(v));
1526
2009
  },
1527
2010
  async getChainId() {
1528
- const s = await this.getProvider();
1529
- if (!s)
1530
- throw new V();
1531
- const d = await s.request({ method: "eth_chainId" });
1532
- return Number(d);
2011
+ const o = await this.getProvider();
2012
+ if (!o)
2013
+ throw new X();
2014
+ const l = await o.request({ method: "eth_chainId" });
2015
+ return Number(l);
1533
2016
  },
1534
2017
  async getProvider() {
1535
2018
  if (typeof window > "u")
1536
2019
  return;
1537
- let s;
1538
- const d = c();
1539
- return typeof d.provider == "function" ? s = d.provider(window) : typeof d.provider == "string" ? s = se(window, d.provider) : s = d.provider, s && !s.removeListener && ("off" in s && typeof s.off == "function" ? s.removeListener = s.off : s.removeListener = () => {
1540
- }), s;
2020
+ let o;
2021
+ const l = i();
2022
+ return typeof l.provider == "function" ? o = l.provider(window) : typeof l.provider == "string" ? o = xe(window, l.provider) : o = l.provider, o && !o.removeListener && ("off" in o && typeof o.off == "function" ? o.removeListener = o.off : o.removeListener = () => {
2023
+ }), o;
1541
2024
  },
1542
2025
  async isAuthorized() {
1543
- var s, d;
2026
+ var o, l;
1544
2027
  try {
1545
- if (n && // If shim exists in storage, connector is disconnected
1546
- await ((s = f.storage) == null ? void 0 : s.getItem(`${this.id}.disconnected`)) || !t.target && !await ((d = f.storage) == null ? void 0 : d.getItem("injected.connected")))
2028
+ if (r && // If shim exists in storage, connector is disconnected
2029
+ await ((o = u.storage) == null ? void 0 : o.getItem(`${this.id}.disconnected`)) || !n.target && !await ((l = u.storage) == null ? void 0 : l.getItem("injected.connected")))
1547
2030
  return !1;
1548
2031
  if (!await this.getProvider()) {
1549
- if (i !== void 0 && i !== !1) {
1550
- const A = async () => (typeof window < "u" && window.removeEventListener("ethereum#initialized", A), !!await this.getProvider()), W = typeof i == "number" ? i : 1e3;
2032
+ if (a !== void 0 && a !== !1) {
2033
+ const _ = async () => (typeof window < "u" && window.removeEventListener("ethereum#initialized", _), !!await this.getProvider()), E = typeof a == "number" ? a : 1e3;
1551
2034
  if (await Promise.race([
1552
2035
  ...typeof window < "u" ? [
1553
- new Promise((I) => window.addEventListener("ethereum#initialized", () => I(A()), { once: !0 }))
2036
+ new Promise((S) => window.addEventListener("ethereum#initialized", () => S(_()), { once: !0 }))
1554
2037
  ] : [],
1555
- new Promise((I) => setTimeout(() => I(A()), W))
2038
+ new Promise((S) => setTimeout(() => S(_()), E))
1556
2039
  ]))
1557
2040
  return !0;
1558
2041
  }
1559
- throw new V();
2042
+ throw new X();
1560
2043
  }
1561
- return !!(await Gr(() => this.getAccounts())).length;
2044
+ return !!(await ln(() => this.getAccounts())).length;
1562
2045
  } catch {
1563
2046
  return !1;
1564
2047
  }
1565
2048
  },
1566
- async switchChain({ addEthereumChainParameter: s, chainId: d }) {
1567
- var A, W, L, I;
2049
+ async switchChain({ addEthereumChainParameter: o, chainId: l }) {
2050
+ var _, E, O, S;
1568
2051
  const v = await this.getProvider();
1569
2052
  if (!v)
1570
- throw new V();
1571
- const b = f.chains.find((S) => S.id === d);
1572
- if (!b)
1573
- throw new Je(new vt());
1574
- const R = new Promise((S) => {
1575
- const T = (_) => {
1576
- "chainId" in _ && _.chainId === d && (f.emitter.off("change", T), S());
2053
+ throw new X();
2054
+ const g = u.chains.find((w) => w.id === l);
2055
+ if (!g)
2056
+ throw new it(new Nn());
2057
+ const b = new Promise((w) => {
2058
+ const I = (R) => {
2059
+ "chainId" in R && R.chainId === l && (u.emitter.off("change", I), w());
1577
2060
  };
1578
- f.emitter.on("change", T);
2061
+ u.emitter.on("change", I);
1579
2062
  });
1580
2063
  try {
1581
2064
  return await Promise.all([
1582
2065
  v.request({
1583
2066
  method: "wallet_switchEthereumChain",
1584
- params: [{ chainId: Xe(d) }]
2067
+ params: [{ chainId: st(l) }]
1585
2068
  }).then(async () => {
1586
- await this.getChainId() === d && f.emitter.emit("change", { chainId: d });
2069
+ await this.getChainId() === l && u.emitter.emit("change", { chainId: l });
1587
2070
  }),
1588
- R
1589
- ]), b;
1590
- } catch (S) {
1591
- const T = S;
1592
- if (T.code === 4902 || // Unwrapping for MetaMask Mobile
2071
+ b
2072
+ ]), g;
2073
+ } catch (w) {
2074
+ const I = w;
2075
+ if (I.code === 4902 || // Unwrapping for MetaMask Mobile
1593
2076
  // https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719
1594
- ((W = (A = T == null ? void 0 : T.data) == null ? void 0 : A.originalError) == null ? void 0 : W.code) === 4902)
2077
+ ((E = (_ = I == null ? void 0 : I.data) == null ? void 0 : _.originalError) == null ? void 0 : E.code) === 4902)
1595
2078
  try {
1596
- const { default: _, ...C } = b.blockExplorers ?? {};
1597
- let $;
1598
- s != null && s.blockExplorerUrls ? $ = s.blockExplorerUrls : _ && ($ = [
1599
- _.url,
1600
- ...Object.values(C).map((H) => H.url)
2079
+ const { default: R, ...k } = g.blockExplorers ?? {};
2080
+ let z;
2081
+ o != null && o.blockExplorerUrls ? z = o.blockExplorerUrls : R && (z = [
2082
+ R.url,
2083
+ ...Object.values(k).map((W) => W.url)
1601
2084
  ]);
1602
- let G;
1603
- (L = s == null ? void 0 : s.rpcUrls) != null && L.length ? G = s.rpcUrls : G = [((I = b.rpcUrls.default) == null ? void 0 : I.http[0]) ?? ""];
1604
- const de = {
1605
- blockExplorerUrls: $,
1606
- chainId: Xe(d),
1607
- chainName: (s == null ? void 0 : s.chainName) ?? b.name,
1608
- iconUrls: s == null ? void 0 : s.iconUrls,
1609
- nativeCurrency: (s == null ? void 0 : s.nativeCurrency) ?? b.nativeCurrency,
1610
- rpcUrls: G
2085
+ let Y;
2086
+ (O = o == null ? void 0 : o.rpcUrls) != null && O.length ? Y = o.rpcUrls : Y = [((S = g.rpcUrls.default) == null ? void 0 : S.http[0]) ?? ""];
2087
+ const Z = {
2088
+ blockExplorerUrls: z,
2089
+ chainId: st(l),
2090
+ chainName: (o == null ? void 0 : o.chainName) ?? g.name,
2091
+ iconUrls: o == null ? void 0 : o.iconUrls,
2092
+ nativeCurrency: (o == null ? void 0 : o.nativeCurrency) ?? g.nativeCurrency,
2093
+ rpcUrls: Y
1611
2094
  };
1612
2095
  return await Promise.all([
1613
2096
  v.request({
1614
2097
  method: "wallet_addEthereumChain",
1615
- params: [de]
2098
+ params: [Z]
1616
2099
  }).then(async () => {
1617
- if (await this.getChainId() === d)
1618
- f.emitter.emit("change", { chainId: d });
2100
+ if (await this.getChainId() === l)
2101
+ u.emitter.emit("change", { chainId: l });
1619
2102
  else
1620
- throw new F(new Error("User rejected switch after adding network."));
2103
+ throw new U(new Error("User rejected switch after adding network."));
1621
2104
  }),
1622
- R
1623
- ]), b;
1624
- } catch (_) {
1625
- throw new F(_);
2105
+ b
2106
+ ]), g;
2107
+ } catch (R) {
2108
+ throw new U(R);
1626
2109
  }
1627
- throw T.code === F.code ? new F(T) : new Je(T);
2110
+ throw I.code === U.code ? new U(I) : new it(I);
1628
2111
  }
1629
2112
  },
1630
- async onAccountsChanged(s) {
1631
- var d;
1632
- if (s.length === 0)
2113
+ async onAccountsChanged(o) {
2114
+ var l;
2115
+ if (o.length === 0)
1633
2116
  this.onDisconnect();
1634
- else if (f.emitter.listenerCount("connect")) {
2117
+ else if (u.emitter.listenerCount("connect")) {
1635
2118
  const v = (await this.getChainId()).toString();
1636
- this.onConnect({ chainId: v }), n && await ((d = f.storage) == null ? void 0 : d.removeItem(`${this.id}.disconnected`));
2119
+ this.onConnect({ chainId: v }), r && await ((l = u.storage) == null ? void 0 : l.removeItem(`${this.id}.disconnected`));
1637
2120
  } else
1638
- f.emitter.emit("change", {
1639
- accounts: s.map((v) => oe(v))
2121
+ u.emitter.emit("change", {
2122
+ accounts: o.map((v) => me(v))
1640
2123
  });
1641
2124
  },
1642
- onChainChanged(s) {
1643
- const d = Number(s);
1644
- f.emitter.emit("change", { chainId: d });
2125
+ onChainChanged(o) {
2126
+ const l = Number(o);
2127
+ u.emitter.emit("change", { chainId: l });
1645
2128
  },
1646
- async onConnect(s) {
1647
- const d = await this.getAccounts();
1648
- if (d.length === 0)
2129
+ async onConnect(o) {
2130
+ const l = await this.getAccounts();
2131
+ if (l.length === 0)
1649
2132
  return;
1650
- const v = Number(s.chainId);
1651
- f.emitter.emit("connect", { accounts: d, chainId: v });
1652
- const b = await this.getProvider();
1653
- b && (g && (b.removeListener("connect", g), g = void 0), u || (u = this.onAccountsChanged.bind(this), b.on("accountsChanged", u)), p || (p = this.onChainChanged.bind(this), b.on("chainChanged", p)), x || (x = this.onDisconnect.bind(this), b.on("disconnect", x)));
2133
+ const v = Number(o.chainId);
2134
+ u.emitter.emit("connect", { accounts: l, chainId: v });
2135
+ const g = await this.getProvider();
2136
+ g && (h && (g.removeListener("connect", h), h = void 0), s || (s = this.onAccountsChanged.bind(this), g.on("accountsChanged", s)), d || (d = this.onChainChanged.bind(this), g.on("chainChanged", d)), p || (p = this.onDisconnect.bind(this), g.on("disconnect", p)));
1654
2137
  },
1655
- async onDisconnect(s) {
1656
- const d = await this.getProvider();
1657
- s && s.code === 1013 && d && (await this.getAccounts()).length || (f.emitter.emit("disconnect"), d && (p && (d.removeListener("chainChanged", p), p = void 0), x && (d.removeListener("disconnect", x), x = void 0), g || (g = this.onConnect.bind(this), d.on("connect", g))));
2138
+ async onDisconnect(o) {
2139
+ const l = await this.getProvider();
2140
+ o && o.code === 1013 && l && (await this.getAccounts()).length || (u.emitter.emit("disconnect"), l && (d && (l.removeListener("chainChanged", d), d = void 0), p && (l.removeListener("disconnect", p), p = void 0), h || (h = this.onConnect.bind(this), l.on("connect", h))));
1658
2141
  }
1659
2142
  });
1660
2143
  }
1661
- const yt = {
2144
+ const Un = {
1662
2145
  coinbaseWallet: {
1663
2146
  id: "coinbaseWallet",
1664
2147
  name: "Coinbase Wallet",
1665
- provider(t) {
1666
- return t != null && t.coinbaseWalletExtension ? t.coinbaseWalletExtension : se(t, "isCoinbaseWallet");
2148
+ provider(n) {
2149
+ return n != null && n.coinbaseWalletExtension ? n.coinbaseWalletExtension : xe(n, "isCoinbaseWallet");
1667
2150
  }
1668
2151
  },
1669
2152
  metaMask: {
1670
2153
  id: "metaMask",
1671
2154
  name: "MetaMask",
1672
- provider(t) {
1673
- return se(t, (n) => {
1674
- if (!n.isMetaMask || n.isBraveWallet && !n._events && !n._state)
2155
+ provider(n) {
2156
+ return xe(n, (r) => {
2157
+ if (!r.isMetaMask || r.isBraveWallet && !r._events && !r._state)
1675
2158
  return !1;
1676
- const i = [
2159
+ const a = [
1677
2160
  "isApexWallet",
1678
2161
  "isAvalanche",
1679
2162
  "isBitKeep",
@@ -1693,8 +2176,8 @@ const yt = {
1693
2176
  "isUniswapWallet",
1694
2177
  "isZerion"
1695
2178
  ];
1696
- for (const c of i)
1697
- if (n[c])
2179
+ for (const i of a)
2180
+ if (r[i])
1698
2181
  return !1;
1699
2182
  return !0;
1700
2183
  });
@@ -1703,37 +2186,38 @@ const yt = {
1703
2186
  phantom: {
1704
2187
  id: "phantom",
1705
2188
  name: "Phantom",
1706
- provider(t) {
1707
- var n, i;
1708
- return (n = t == null ? void 0 : t.phantom) != null && n.ethereum ? (i = t.phantom) == null ? void 0 : i.ethereum : se(t, "isPhantom");
2189
+ provider(n) {
2190
+ var r, a;
2191
+ return (r = n == null ? void 0 : n.phantom) != null && r.ethereum ? (a = n.phantom) == null ? void 0 : a.ethereum : xe(n, "isPhantom");
1709
2192
  }
1710
2193
  }
1711
2194
  };
1712
- function se(t, n) {
1713
- function i(u) {
1714
- return typeof n == "function" ? n(u) : typeof n == "string" ? u[n] : !0;
2195
+ function xe(n, r) {
2196
+ function a(s) {
2197
+ return typeof r == "function" ? r(s) : typeof r == "string" ? s[r] : !0;
1715
2198
  }
1716
- const c = t.ethereum;
1717
- if (c != null && c.providers)
1718
- return c.providers.find((u) => i(u));
1719
- if (c && i(c))
1720
- return c;
2199
+ const i = n.ethereum;
2200
+ if (i != null && i.providers)
2201
+ return i.providers.find((s) => a(s));
2202
+ if (i && a(i))
2203
+ return i;
1721
2204
  }
1722
- const mt = new qr(), bt = Br({
1723
- chains: [Se],
1724
- connectors: [Re()],
2205
+ const qn = new un(), Yn = rn({
2206
+ chains: [Oe],
2207
+ connectors: [$e()],
1725
2208
  transports: {
1726
- [Se.id]: Nr()
2209
+ [Oe.id]: an()
1727
2210
  }
1728
2211
  });
1729
- function Rt({ children: t }) {
1730
- return /* @__PURE__ */ r.jsx(Yr, { config: bt, children: /* @__PURE__ */ r.jsx(Vr, { client: mt, children: t }) });
2212
+ function Jn({ children: n }) {
2213
+ return /* @__PURE__ */ t.jsx(on, { config: Yn, children: /* @__PURE__ */ t.jsx(fn, { client: qn, children: n }) });
1731
2214
  }
1732
2215
  export {
1733
- Ct as SwarmConnectButton,
1734
- ht as SwarmConnectModal,
1735
- Rt as SwarmConnectProvider,
1736
- Xr as useBeeNode,
1737
- Qr as usePostageStamps,
1738
- et as useSwarmConnect
2216
+ Kn as SwarmConnectButton,
2217
+ $n as SwarmConnectModal,
2218
+ Jn as SwarmConnectProvider,
2219
+ mn as useBeeNode,
2220
+ bt as useNodeWallet,
2221
+ xn as usePostageStamps,
2222
+ yn as useSwarmConnect
1739
2223
  };