@ffaerber/swarm-connect 0.3.0 → 0.4.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 mt, { useState as T, useCallback as me, useEffect as Q } from "react";
2
+ import { useAccount as Ae, useChainId as xt, useBalance as bt, useConnect as Xt, useDisconnect as Qt, useSwitchChain as en, useSendTransaction as tn, useWriteContract as nn, useWaitForTransactionReceipt as it, useReadContract as rn, createConfig as an, http as on, WagmiProvider as sn } from "wagmi";
3
+ import { erc20Abi as st, parseEther as cn, parseUnits as ln, getAddress as ve, SwitchChainError as ct, numberToHex as lt, UserRejectedRequestError as N, withRetry as dn, withTimeout as un, ResourceUnavailableRpcError as Ee } from "viem";
4
+ import { QueryClient as fn, QueryClientProvider as hn } from "@tanstack/react-query";
5
+ var Te = { exports: {} }, re = {};
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 dt;
16
+ function pn() {
17
+ if (dt) return re;
18
+ dt = 1;
19
+ var n = mt, r = Symbol.for("react.element"), a = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, i = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function p(h, d, o) {
21
+ var u, v = {}, g = null, b = null;
22
+ o !== void 0 && (g = "" + o), d.key !== void 0 && (g = "" + d.key), d.ref !== void 0 && (b = d.ref);
23
+ for (u in d) s.call(d, u) && !l.hasOwnProperty(u) && (v[u] = d[u]);
24
+ if (h && h.defaultProps) for (u in d = h.defaultProps, d) v[u] === void 0 && (v[u] = d[u]);
25
+ return { $$typeof: r, type: h, key: g, ref: b, props: v, _owner: i.current };
26
26
  }
27
- return X.Fragment = i, X.jsx = g, X.jsxs = g, X;
27
+ return re.Fragment = a, re.jsx = p, re.jsxs = p, re;
28
28
  }
29
- var Q = {};
29
+ var ae = {};
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 ut;
40
+ function vn() {
41
+ return ut || (ut = 1, process.env.NODE_ENV !== "production" && function() {
42
+ var n = mt, r = Symbol.for("react.element"), a = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), p = Symbol.for("react.provider"), h = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), o = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), E = Symbol.iterator, _ = "@@iterator";
43
+ function A(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] || 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 R = f.map(function(y) {
62
+ return String(y);
63
63
  });
64
- j.unshift("Warning: " + o), Function.prototype.apply.call(console[e], console, j);
64
+ R.unshift("Warning: " + c), Function.prototype.apply.call(console[e], console, R);
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 C = !1, k = !1, D = !1, W = !1, V = !1, B;
68
+ B = Symbol.for("react.module.reference");
69
+ function be(e) {
70
+ return !!(typeof e == "string" || typeof e == "function" || e === s || e === l || V || e === i || e === o || e === u || W || e === b || C || k || D || typeof e == "object" && e !== null && (e.$$typeof === g || e.$$typeof === v || e.$$typeof === p || e.$$typeof === h || e.$$typeof === d || // 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 === B || 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 Y(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 de(e) {
84
84
  return e.displayName || "Context";
85
85
  }
86
- function z(e) {
86
+ function M(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:
94
+ case s:
95
95
  return "Fragment";
96
- case i:
96
+ case a:
97
97
  return "Portal";
98
- case p:
98
+ case l:
99
99
  return "Profiler";
100
- case u:
100
+ case i:
101
101
  return "StrictMode";
102
- case s:
102
+ case o:
103
103
  return "Suspense";
104
- case d:
104
+ case u:
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 h:
110
+ var c = e;
111
+ return de(c) + ".Consumer";
112
+ case p:
113
+ var f = e;
114
+ return de(f._context) + ".Provider";
115
+ case d:
116
+ return Y(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 : M(e.type) || "Memo";
120
+ case g: {
121
+ var j = e, R = j._payload, y = j._init;
122
122
  try {
123
- return z(m(j));
123
+ return M(y(R));
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 z = Object.assign, te = 0, ze, Le, We, Be, Me, Ne, Ue;
132
+ function Ye() {
133
133
  }
134
- De.__reactDisabledLog = !0;
135
- function fr() {
134
+ Ye.__reactDisabledLog = !0;
135
+ function Ct() {
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 (te === 0) {
138
+ ze = console.log, Le = console.info, We = console.warn, Be = console.error, Me = console.group, Ne = console.groupCollapsed, Ue = console.groupEnd;
139
139
  var e = {
140
140
  configurable: !0,
141
141
  enumerable: !0,
142
- value: De,
142
+ value: Ye,
143
143
  writable: !0
144
144
  };
145
145
  Object.defineProperties(console, {
@@ -152,332 +152,332 @@ function Jr() {
152
152
  groupEnd: e
153
153
  });
154
154
  }
155
- K++;
155
+ te++;
156
156
  }
157
157
  }
158
- function hr() {
158
+ function Rt() {
159
159
  {
160
- if (K--, K === 0) {
160
+ if (te--, te === 0) {
161
161
  var e = {
162
162
  configurable: !0,
163
163
  enumerable: !0,
164
164
  writable: !0
165
165
  };
166
166
  Object.defineProperties(console, {
167
- log: M({}, e, {
168
- value: _e
167
+ log: z({}, e, {
168
+ value: ze
169
169
  }),
170
- info: M({}, e, {
171
- value: Ee
170
+ info: z({}, e, {
171
+ value: Le
172
172
  }),
173
- warn: M({}, e, {
174
- value: Ie
173
+ warn: z({}, e, {
174
+ value: We
175
175
  }),
176
- error: M({}, e, {
177
- value: Te
176
+ error: z({}, e, {
177
+ value: Be
178
178
  }),
179
- group: M({}, e, {
180
- value: Pe
179
+ group: z({}, e, {
180
+ value: Me
181
181
  }),
182
- groupCollapsed: M({}, e, {
183
- value: Oe
182
+ groupCollapsed: z({}, e, {
183
+ value: Ne
184
184
  }),
185
- groupEnd: M({}, e, {
186
- value: Ae
185
+ groupEnd: z({}, e, {
186
+ value: Ue
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
+ te < 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 ye = S.ReactCurrentDispatcher, we;
194
+ function ue(e, c, f) {
195
195
  {
196
- if (he === void 0)
196
+ if (we === 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
+ we = m && m[1] || "";
202
202
  }
203
203
  return `
204
- ` + he + e;
204
+ ` + we + e;
205
205
  }
206
206
  }
207
- var pe = !1, re;
207
+ var ke = !1, fe;
208
208
  {
209
- var pr = typeof WeakMap == "function" ? WeakMap : Map;
210
- re = new pr();
209
+ var _t = typeof WeakMap == "function" ? WeakMap : Map;
210
+ fe = new _t();
211
211
  }
212
- function $e(e, o) {
213
- if (!e || pe)
212
+ function qe(e, c) {
213
+ if (!e || ke)
214
214
  return "";
215
215
  {
216
- var l = re.get(e);
217
- if (l !== void 0)
218
- return l;
216
+ var f = fe.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
+ ke = !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 R;
225
+ R = ye.current, ye.current = null, Ct();
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
+ `), O = m.stack.split(`
262
+ `), F = x.length - 1, P = O.length - 1; F >= 1 && P >= 0 && x[F] !== O[P]; )
263
+ P--;
264
+ for (; F >= 1 && P >= 0; F--, P--)
265
+ if (x[F] !== O[P]) {
266
+ if (F !== 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 (F--, P--, P < 0 || x[F] !== O[P]) {
269
+ var L = `
270
+ ` + x[F].replace(" at new ", " at ");
271
+ return e.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", e.displayName)), typeof e == "function" && fe.set(e, L), L;
272
272
  }
273
- while (k >= 1 && E >= 0);
273
+ while (F >= 1 && P >= 0);
274
274
  break;
275
275
  }
276
276
  }
277
277
  } finally {
278
- pe = !1, fe.current = j, hr(), Error.prepareStackTrace = w;
278
+ ke = !1, ye.current = R, Rt(), 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 K = e ? e.displayName || e.name : "", q = K ? ue(K) : "";
281
+ return typeof e == "function" && fe.set(e, q), q;
282
282
  }
283
- function gr(e, o, l) {
284
- return $e(e, !1);
283
+ function Et(e, c, f) {
284
+ return qe(e, !1);
285
285
  }
286
- function vr(e) {
287
- var o = e.prototype;
288
- return !!(o && o.isReactComponent);
286
+ function It(e) {
287
+ var c = e.prototype;
288
+ return !!(c && c.isReactComponent);
289
289
  }
290
- function te(e, o, l) {
290
+ function he(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 qe(e, It(e));
295
295
  if (typeof e == "string")
296
- return ee(e);
296
+ return ue(e);
297
297
  switch (e) {
298
- case s:
299
- return ee("Suspense");
300
- case d:
301
- return ee("SuspenseList");
298
+ case o:
299
+ return ue("Suspense");
300
+ case u:
301
+ return ue("SuspenseList");
302
302
  }
303
303
  if (typeof e == "object")
304
304
  switch (e.$$typeof) {
305
- case f:
306
- return gr(e.render);
305
+ case d:
306
+ return Et(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 he(e.type, c, f);
309
+ case g: {
310
+ var m = e, j = m._payload, R = m._init;
311
311
  try {
312
- return te(j(w), o, l);
312
+ return he(R(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 ne = Object.prototype.hasOwnProperty, Ge = {}, He = S.ReactDebugCurrentFrame;
320
+ function pe(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 = he(e.type, e._source, c ? c.type : null);
323
+ He.setExtraStackFrame(f);
324
324
  } else
325
- Fe.setExtraStackFrame(null);
325
+ He.setExtraStackFrame(null);
326
326
  }
327
- function yr(e, o, l, h, w) {
327
+ function Tt(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 R = Function.call.bind(ne);
330
+ for (var y in e)
331
+ if (R(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 O = 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 O.name = "Invariant Violation", O;
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 (F) {
340
+ x = F;
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) && (pe(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), pe(null)), x instanceof Error && !(x.message in Ge) && (Ge[x.message] = !0, pe(j), w("Failed %s type: %s", f, x.message), pe(null));
343
343
  }
344
344
  }
345
345
  }
346
- var mr = Array.isArray;
347
- function ge(e) {
348
- return mr(e);
346
+ var Ft = Array.isArray;
347
+ function je(e) {
348
+ return Ft(e);
349
349
  }
350
- function br(e) {
350
+ function Pt(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 Dt(e) {
357
357
  try {
358
- return Le(e), !1;
358
+ return Ve(e), !1;
359
359
  } catch {
360
360
  return !0;
361
361
  }
362
362
  }
363
- function Le(e) {
363
+ function Ve(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 Ze(e) {
367
+ if (Dt(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.", Pt(e)), Ve(e);
369
369
  }
370
- var Ue = I.ReactCurrentOwner, wr = {
370
+ var Ke = S.ReactCurrentOwner, At = {
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
+ }, Je, Xe;
376
+ function Ot(e) {
377
+ if (ne.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 $t(e) {
385
+ if (ne.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 zt(e, c) {
393
+ typeof e.ref == "string" && Ke.current;
394
394
  }
395
- function Rr(e, o) {
395
+ function Lt(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
+ Je || (Je = !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 Wt(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
+ Xe || (Xe = !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 Bt = function(e, c, f, m, j, R, 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: R
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 Mt(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 R, y = {}, x = null, O = null;
449
+ f !== void 0 && (Ze(f), x = "" + f), $t(c) && (Ze(c.key), x = "" + c.key), Ot(c) && (O = c.ref, zt(c, j));
450
+ for (R in c)
451
+ ne.call(c, R) && !At.hasOwnProperty(R) && (y[R] = c[R]);
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 F = e.defaultProps;
454
+ for (R in F)
455
+ y[R] === void 0 && (y[R] = F[R]);
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 || O) {
458
+ var P = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ x && Lt(y, P), O && Wt(y, P);
460
460
  }
461
- return _r(e, y, P, w, h, Ue.current, m);
461
+ return Bt(e, x, O, j, m, Ke.current, y);
462
462
  }
463
463
  }
464
- var ve = I.ReactCurrentOwner, Ne = I.ReactDebugCurrentFrame;
465
- function Y(e) {
464
+ var Se = S.ReactCurrentOwner, Qe = S.ReactDebugCurrentFrame;
465
+ function Z(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 = he(e.type, e._source, c ? c.type : null);
468
+ Qe.setExtraStackFrame(f);
469
469
  } else
470
- Ne.setExtraStackFrame(null);
470
+ Qe.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 Ce;
473
+ Ce = !1;
474
+ function Re(e) {
475
+ return typeof e == "object" && e !== null && e.$$typeof === r;
476
476
  }
477
- function Ye() {
477
+ function et() {
478
478
  {
479
- if (ve.current) {
480
- var e = z(ve.current.type);
479
+ if (Se.current) {
480
+ var e = M(Se.current.type);
481
481
  if (e)
482
482
  return `
483
483
 
@@ -486,502 +486,591 @@ Check the render method of \`` + e + "`.";
486
486
  return "";
487
487
  }
488
488
  }
489
- function Ir(e) {
489
+ function Nt(e) {
490
490
  return "";
491
491
  }
492
- var qe = {};
493
- function Tr(e) {
492
+ var tt = {};
493
+ function Ut(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 = et();
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 nt(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 = Ut(c);
511
+ if (tt[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
+ tt[f] = !0;
514
+ var m = "";
515
+ e && e._owner && e._owner !== Se.current && (m = " It was passed a child from " + M(e._owner.type) + "."), Z(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), Z(null);
516
516
  }
517
517
  }
518
- function Ge(e, o) {
518
+ function rt(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 (je(e))
523
+ for (var f = 0; f < e.length; f++) {
524
+ var m = e[f];
525
+ Re(m) && nt(m, c);
526
526
  }
527
- else if (me(e))
527
+ else if (Re(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 = A(e);
531
+ if (typeof j == "function" && j !== e.entries)
532
+ for (var R = j.call(e), y; !(y = R.next()).done; )
533
+ Re(y.value) && nt(y.value, c);
534
534
  }
535
535
  }
536
536
  }
537
- function Pr(e) {
537
+ function Yt(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 === d || // 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 = M(c);
553
+ Tt(f, e.props, "prop", m, e);
554
+ } else if (c.PropTypes !== void 0 && !Ce) {
555
+ Ce = !0;
556
+ var j = M(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
+ Z(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", m), Z(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 && (Z(e), w("Invalid attribute `ref` supplied to `React.Fragment`."), Z(null));
572
572
  }
573
573
  }
574
- var He = {};
575
- function Ke(e, o, l, h, w, j) {
574
+ var at = {};
575
+ function ot(e, c, f, m, j, R) {
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 = be(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 O = Nt();
582
+ O ? x += O : x += et();
583
+ var F;
584
+ e === null ? F = "null" : je(e) ? F = "array" : e !== void 0 && e.$$typeof === r ? (F = "<" + (M(e.type) || "Unknown") + " />", x = " Did you accidentally export a JSX literal instead of a component?") : F = 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", F, 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 = Mt(e, c, f, j, R);
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 (je(L)) {
594
+ for (var K = 0; K < L.length; K++)
595
+ rt(L[K], 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
+ rt(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 (ne.call(c, "key")) {
603
+ var q = M(e), $ = Object.keys(c).filter(function(Jt) {
604
+ return Jt !== "key";
605
+ }), _e = $.length > 0 ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}";
606
+ if (!at[q + _e]) {
607
+ var Kt = $.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} />`, _e, q, Kt, q), at[q + _e] = !0;
614
614
  }
615
615
  }
616
- return e === c ? Or(E) : Pr(E), E;
616
+ return e === s ? qt(P) : Yt(P), P;
617
617
  }
618
618
  }
619
- function Ar(e, o, l) {
620
- return Ke(e, o, l, !0);
619
+ function Gt(e, c, f) {
620
+ return ot(e, c, f, !0);
621
621
  }
622
- function Dr(e, o, l) {
623
- return Ke(e, o, l, !1);
622
+ function Ht(e, c, f) {
623
+ return ot(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 Vt = Ht, Zt = Gt;
626
+ ae.Fragment = s, ae.jsx = Vt, ae.jsxs = Zt;
627
+ }()), ae;
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
- }
647
- };
648
- function Xr(t = ue) {
649
- const [n, i] = U({
629
+ process.env.NODE_ENV === "production" ? Te.exports = pn() : Te.exports = vn();
630
+ var t = Te.exports;
631
+ const U = 100, se = "http://localhost:1633", yt = "swarm-connect:bee-api-url", ft = "0xdBF3Ea6F5beE45c02255B2c26a16F300502F68da", Fe = 16, gn = "0.1", mn = "0.5", xn = 20, bn = "1000000000";
632
+ function yn(n = se) {
633
+ const [r, a] = T({
650
634
  isRunning: !1,
651
635
  isChecking: !1
652
- }), c = nr(async () => {
653
- i({ isRunning: !1, isChecking: !0 });
636
+ }), s = me(async () => {
637
+ a({ isRunning: !1, isChecking: !0 });
654
638
  try {
655
- const u = await fetch(`${t}/health`, {
639
+ const i = await fetch(`${n}/health`, {
656
640
  signal: AbortSignal.timeout(5e3)
657
641
  });
658
- if (u.ok) {
659
- const p = await u.json();
660
- i({ isRunning: !0, isChecking: !1, version: p.version });
642
+ if (i.ok) {
643
+ const l = await i.json();
644
+ a({ isRunning: !0, isChecking: !1, version: l.version });
661
645
  } else
662
- i({ isRunning: !1, isChecking: !1, error: `Node returned HTTP ${u.status}` });
646
+ a({ isRunning: !1, isChecking: !1, error: `Node returned HTTP ${i.status}` });
663
647
  } catch {
664
- i({
648
+ a({
665
649
  isRunning: !1,
666
650
  isChecking: !1,
667
- error: `Cannot reach Bee node at ${t}`
651
+ error: `Cannot reach Bee node at ${n}`
668
652
  });
669
653
  }
670
- }, [t]);
671
- return { ...n, check: c };
654
+ }, [n]);
655
+ return { ...r, check: s };
672
656
  }
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);
657
+ function wn(n = se) {
658
+ const [r, a] = T([]), [s, i] = T(!1), [l, p] = T(), [h, d] = T(), [o, u] = T(!1), [v, g] = T(), b = me(async () => {
659
+ i(!0), p(void 0);
676
660
  try {
677
- const d = await fetch(`${t}/stamps`, {
661
+ const _ = await fetch(`${n}/stamps`, {
678
662
  signal: AbortSignal.timeout(5e3)
679
663
  });
680
- if (d.ok) {
681
- const v = await d.json();
682
- i(v.stamps ?? []);
664
+ if (_.ok) {
665
+ const A = await _.json();
666
+ a(A.stamps ?? []);
683
667
  } else
684
- g(`HTTP ${d.status}`);
668
+ p(`HTTP ${_.status}`);
685
669
  } catch {
686
- g("Could not fetch postage stamps");
670
+ p("Could not fetch postage stamps");
671
+ } finally {
672
+ i(!1);
673
+ }
674
+ }, [n]), E = me(async ({ amount: _, depth: A, label: S }) => {
675
+ u(!0), g(void 0);
676
+ try {
677
+ const w = S ? `?label=${encodeURIComponent(S)}` : "", I = await fetch(`${n}/stamps/${_}/${A}${w}`, {
678
+ method: "POST",
679
+ signal: AbortSignal.timeout(24e4)
680
+ });
681
+ if (!I.ok) {
682
+ let k = `HTTP ${I.status}`;
683
+ try {
684
+ const D = await I.json();
685
+ D.message && (k = D.message);
686
+ } catch {
687
+ }
688
+ g(k);
689
+ return;
690
+ }
691
+ const C = await I.json();
692
+ return d(C.batchID), b(), C.batchID;
693
+ } catch {
694
+ g("Stamp purchase failed — is the node wallet funded with xDAI and xBZZ?");
695
+ return;
687
696
  } finally {
688
697
  u(!1);
689
698
  }
690
- }, [t]);
691
- return { stamps: n, isLoading: c, error: p, fetchStamps: s, selectedStampId: x, selectStamp: f };
699
+ }, [n, b]);
700
+ return {
701
+ stamps: r,
702
+ isLoading: s,
703
+ error: l,
704
+ fetchStamps: b,
705
+ selectedStampId: h,
706
+ selectStamp: d,
707
+ createStamp: E,
708
+ isCreating: o,
709
+ createError: v
710
+ };
692
711
  }
693
- function Zr() {
712
+ function wt(n = se) {
713
+ const [r, a] = T({
714
+ isLoading: !1
715
+ }), s = me(async () => {
716
+ a((i) => ({ ...i, isLoading: !0, error: void 0 }));
717
+ try {
718
+ const [i, l] = await Promise.all([
719
+ fetch(`${n}/addresses`, { signal: AbortSignal.timeout(5e3) }),
720
+ fetch(`${n}/wallet`, { signal: AbortSignal.timeout(5e3) })
721
+ ]);
722
+ if (!i.ok || !l.ok) {
723
+ a((u) => ({
724
+ ...u,
725
+ isLoading: !1,
726
+ error: `Node returned HTTP ${i.ok ? l.status : i.status}`
727
+ }));
728
+ return;
729
+ }
730
+ const p = await i.json(), h = await l.json(), d = h.bzzBalance ?? h.bzz, o = h.nativeTokenBalance ?? h.xDai;
731
+ a({
732
+ address: p.ethereum,
733
+ xdai: o !== void 0 ? Number(o) / 1e18 : void 0,
734
+ xbzz: d !== void 0 ? Number(d) / 10 ** Fe : void 0,
735
+ isLoading: !1
736
+ });
737
+ } catch {
738
+ a((i) => ({
739
+ ...i,
740
+ isLoading: !1,
741
+ error: `Cannot read node wallet at ${n}`
742
+ }));
743
+ }
744
+ }, [n]);
745
+ return {
746
+ ...r,
747
+ isFunded: (r.xdai ?? 0) > 0 && (r.xbzz ?? 0) > 0,
748
+ refresh: s
749
+ };
750
+ }
751
+ function kn() {
694
752
  if (!(typeof window > "u"))
695
753
  try {
696
- return window.localStorage.getItem(sr) ?? void 0;
754
+ return window.localStorage.getItem(yt) ?? void 0;
697
755
  } catch {
698
756
  return;
699
757
  }
700
758
  }
701
- function et(t = {}) {
702
- const [n, i] = U(
703
- () => t.beeApiUrl ?? Zr() ?? ue
759
+ function jn(n = {}) {
760
+ const [r, a] = T(
761
+ () => n.beeApiUrl ?? kn() ?? se
704
762
  );
705
- ae(() => {
763
+ Q(() => {
706
764
  if (!(typeof window > "u"))
707
765
  try {
708
- window.localStorage.setItem(sr, n);
766
+ window.localStorage.setItem(yt, r);
709
767
  } catch {
710
768
  }
711
- }, [n]);
712
- const c = Xr(n), u = Qr(n), { address: p, isConnected: g } = or(), x = ir(), f = x === ce;
769
+ }, [r]);
770
+ const s = n.stampMode ?? "select", i = yn(r), l = wn(r), p = wt(r), { address: h, isConnected: d } = Ae(), o = xt(), u = o === U, { data: v, isLoading: g } = bt({
771
+ address: h,
772
+ chainId: U,
773
+ query: { enabled: d }
774
+ }), b = v ? Number(v.formatted) : void 0, E = u && !!v && v.value > 0n;
713
775
  return {
714
- beeNode: c,
715
- stamps: u,
716
- beeApiUrl: n,
717
- setBeeApiUrl: i,
718
- isWalletConnected: g,
719
- address: p,
720
- isOnGnosis: f,
721
- chainId: x,
722
- isFullyConnected: c.isRunning && !!u.selectedStampId && g && f
776
+ beeNode: i,
777
+ stamps: l,
778
+ beeApiUrl: r,
779
+ setBeeApiUrl: a,
780
+ stampMode: s,
781
+ nodeWallet: p,
782
+ isWalletConnected: d,
783
+ address: h,
784
+ isOnGnosis: u,
785
+ chainId: o,
786
+ balance: { xdai: b, isLoading: d && g, hasGas: E },
787
+ isFullyConnected: d && u && E && i.isRunning && (s === "select" || p.isFunded) && !!l.selectedStampId
723
788
  };
724
789
  }
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
- ] });
790
+ const Sn = `
791
+ .swarm-connect {
792
+ --void:#060809; --bunker:#0b0f12; --surface:#121821; --raised:#18202b; --raised-2:#1e2833;
793
+ --line:rgba(255,255,255,0.07); --line-2:rgba(255,255,255,0.12); --line-orange:rgba(255,107,0,0.45);
794
+ --fg:#f3f5f7; --fg-soft:#c3cad3; --fg-muted:#7d8794; --fg-faint:#565f6b;
795
+ --accent:#ff6b00; --accent-bright:#ff8a33; --accent-deep:#d65500; --accent-ink:#1a0e02;
796
+ --accent-glow:rgba(255,107,0,0.40); --accent-wash:rgba(255,107,0,0.10);
797
+ --ok:#36c46a; --ok-wash:rgba(54,196,106,0.12); --ok-line:rgba(54,196,106,0.40);
798
+ --bad:#ff5640; --bad-wash:rgba(255,86,64,0.12); --bad-line:rgba(255,86,64,0.38);
799
+ --warn:#f0a83a; --warn-wash:rgba(240,168,58,0.12); --warn-line:rgba(240,168,58,0.40);
800
+ --font-display:'Space Grotesk',system-ui,sans-serif;
801
+ --font-body:'Inter',system-ui,sans-serif;
802
+ --font-mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
803
+ --ease:cubic-bezier(0.22,0.61,0.36,1);
749
804
  }
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
- ] });
805
+ @keyframes sc-spin { to { transform: rotate(360deg); } }
806
+ @keyframes sc-pulse-dot { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.4; transform:scale(.82); } }
807
+ @keyframes sc-modal-in { from { opacity:0; transform:translate(-50%, calc(-50% + 10px)) scale(.985); } to { opacity:1; transform:translate(-50%,-50%) scale(1); } }
808
+ @keyframes sc-backdrop-in { from { opacity:0; } to { opacity:1; } }
809
+ @keyframes sc-step-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
810
+ .sc-scroll::-webkit-scrollbar { width:8px; }
811
+ .sc-scroll::-webkit-scrollbar-thumb { background:var(--line-2); border-radius:8px; border:2px solid transparent; background-clip:padding-box; }
812
+ .sc-scroll::-webkit-scrollbar-track { background:transparent; }
813
+ `;
814
+ let ht = !1;
815
+ function kt() {
816
+ if (ht || typeof document > "u") return;
817
+ ht = !0;
818
+ const n = document.createElement("style");
819
+ n.dataset.swarmConnect = "", n.textContent = Sn, document.head.appendChild(n);
775
820
  }
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
- ] });
821
+ function Cn({ size: n = 18, stroke: r = "var(--accent)", glow: a = !0, children: s }) {
822
+ return /* @__PURE__ */ t.jsx("span", { style: {
823
+ display: "inline-flex",
824
+ alignItems: "center",
825
+ justifyContent: "center",
826
+ filter: a ? "drop-shadow(0 0 6px var(--accent-glow))" : "none"
827
+ }, children: /* @__PURE__ */ t.jsx(
828
+ "svg",
829
+ {
830
+ width: n,
831
+ height: n,
832
+ viewBox: "0 0 24 24",
833
+ fill: "none",
834
+ stroke: r,
835
+ strokeWidth: "1.4",
836
+ strokeLinecap: "round",
837
+ strokeLinejoin: "round",
838
+ children: s
839
+ }
840
+ ) });
827
841
  }
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
- ] });
842
+ function ce({ size: n = 15 }) {
843
+ return /* @__PURE__ */ t.jsx("span", { style: {
844
+ width: n,
845
+ height: n,
846
+ flexShrink: 0,
847
+ display: "inline-block",
848
+ border: "2px solid rgba(255,255,255,.12)",
849
+ borderTopColor: "var(--accent)",
850
+ borderRadius: "50%",
851
+ animation: "sc-spin .7s linear infinite"
852
+ } });
839
853
  }
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" })
854
+ function le({ children: n, tone: r }) {
855
+ const a = {
856
+ ok: { c: "var(--ok)", b: "var(--ok-line)", w: "var(--ok-wash)" },
857
+ bad: { c: "var(--bad)", b: "var(--bad-line)", w: "var(--bad-wash)" },
858
+ warn: { c: "var(--warn)", b: "var(--warn-line)", w: "var(--warn-wash)" }
859
+ }[r];
860
+ return /* @__PURE__ */ t.jsx("span", { style: {
861
+ fontFamily: "var(--font-mono)",
862
+ fontSize: 10,
863
+ letterSpacing: ".04em",
864
+ textTransform: "uppercase",
865
+ color: a.c,
866
+ background: a.w,
867
+ border: `1px solid ${a.b}`,
868
+ borderRadius: 3,
869
+ padding: "2px 6px",
870
+ lineHeight: 1.3
871
+ }, children: n });
872
+ }
873
+ function G({ tone: n, title: r, sub: a, children: s }) {
874
+ const i = {
875
+ ok: { b: "var(--ok-line)", w: "var(--ok-wash)", d: "var(--ok)" },
876
+ bad: { b: "var(--bad-line)", w: "var(--bad-wash)", d: "var(--bad)" },
877
+ warn: { b: "var(--warn-line)", w: "var(--warn-wash)", d: "var(--warn)" },
878
+ flat: { b: "var(--line)", w: "var(--raised)", d: "var(--fg-muted)" }
879
+ }[n], l = !!a && (a.startsWith("0x") || a.includes("localhost") || a.includes("http"));
880
+ return /* @__PURE__ */ t.jsxs("div", { style: {
881
+ display: "flex",
882
+ alignItems: "center",
883
+ gap: 12,
884
+ padding: "12px 14px",
885
+ border: `1px solid ${i.b}`,
886
+ borderRadius: 8,
887
+ background: i.w
888
+ }, children: [
889
+ n !== "flat" && /* @__PURE__ */ t.jsx("span", { style: {
890
+ width: 8,
891
+ height: 8,
892
+ flexShrink: 0,
893
+ borderRadius: "50%",
894
+ background: i.d,
895
+ boxShadow: `0 0 8px ${i.d}`,
896
+ animation: n === "warn" ? "sc-pulse-dot 1.6s var(--ease) infinite" : "none"
897
+ } }),
898
+ /* @__PURE__ */ t.jsxs("div", { style: { minWidth: 0 }, children: [
899
+ r && /* @__PURE__ */ t.jsx("div", { style: { fontWeight: 600, fontSize: 13.5, color: n === "flat" ? "var(--fg-soft)" : i.d }, children: r }),
900
+ a && /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--fg-muted)", marginTop: 2, fontFamily: l ? "var(--font-mono)" : "inherit", wordBreak: "break-all" }, children: a })
868
901
  ] }),
869
- /* @__PURE__ */ r.jsx("button", { onClick: i, style: Ce, children: "Retry" })
902
+ s && /* @__PURE__ */ t.jsx("div", { style: { marginLeft: "auto", flexShrink: 0 }, children: s })
870
903
  ] });
871
904
  }
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,
905
+ function H({ children: n, onClick: r, disabled: a }) {
906
+ const [s, i] = T(!1);
907
+ return /* @__PURE__ */ t.jsx(
908
+ "button",
884
909
  {
885
- stamp: n,
886
- selected: t.selectedStampId === n.batchID,
887
- onSelect: () => t.selectStamp(n.batchID)
888
- },
889
- n.batchID
890
- )) });
910
+ onClick: r,
911
+ disabled: a,
912
+ onMouseEnter: () => i(!0),
913
+ onMouseLeave: () => i(!1),
914
+ style: {
915
+ fontFamily: "var(--font-mono)",
916
+ fontSize: 12,
917
+ letterSpacing: ".04em",
918
+ background: "transparent",
919
+ border: `1px solid ${s && !a ? "var(--line-orange)" : "var(--line-2)"}`,
920
+ color: a ? "var(--fg-faint)" : s ? "var(--accent-bright)" : "var(--fg-soft)",
921
+ borderRadius: 4,
922
+ padding: "7px 14px",
923
+ cursor: a ? "default" : "pointer",
924
+ transition: "all .15s var(--ease)",
925
+ opacity: a ? 0.5 : 1
926
+ },
927
+ children: n
928
+ }
929
+ );
891
930
  }
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(
931
+ function Oe({ children: n, onClick: r, pending: a, block: s, style: i }) {
932
+ const [l, p] = T(!1);
933
+ return /* @__PURE__ */ t.jsx(
895
934
  "button",
896
935
  {
897
- onClick: i,
936
+ onClick: r,
937
+ disabled: a,
938
+ onMouseEnter: () => p(!0),
939
+ onMouseLeave: () => p(!1),
898
940
  style: {
899
- display: "flex",
941
+ display: "inline-flex",
900
942
  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"
943
+ justifyContent: "center",
944
+ gap: 8,
945
+ fontFamily: "var(--font-mono)",
946
+ fontSize: 13,
947
+ fontWeight: 600,
948
+ letterSpacing: ".06em",
949
+ textTransform: "uppercase",
950
+ width: s ? "100%" : "auto",
951
+ background: "var(--accent)",
952
+ color: "var(--accent-ink)",
953
+ border: "none",
954
+ borderRadius: 4,
955
+ padding: "11px 20px",
956
+ cursor: a ? "default" : "pointer",
957
+ boxShadow: l ? "0 0 24px var(--accent-glow)" : "0 0 14px var(--accent-glow)",
958
+ transform: l ? "translateY(-1px)" : "none",
959
+ transition: "all .15s var(--ease)",
960
+ opacity: a ? 0.8 : 1,
961
+ whiteSpace: "nowrap",
962
+ ...i
910
963
  },
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
- ]
964
+ children: n
929
965
  }
930
966
  );
931
967
  }
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 });
968
+ function ee({ children: n }) {
969
+ return /* @__PURE__ */ t.jsxs("div", { style: {
970
+ display: "flex",
971
+ alignItems: "center",
972
+ gap: 10,
973
+ padding: "12px 14px",
974
+ border: "1px dashed var(--line-2)",
975
+ borderRadius: 8,
976
+ background: "var(--bunker)"
977
+ }, children: [
978
+ /* @__PURE__ */ t.jsxs(Cn, { size: 15, stroke: "var(--fg-faint)", glow: !1, children: [
979
+ /* @__PURE__ */ t.jsx("rect", { x: "5", y: "11", width: "14", height: "9", rx: "1.5" }),
980
+ /* @__PURE__ */ t.jsx("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })
981
+ ] }),
982
+ /* @__PURE__ */ t.jsx("span", { style: { fontSize: 12.5, color: "var(--fg-muted)" }, children: n })
983
+ ] });
934
984
  }
935
- function rr({ color: t }) {
936
- return /* @__PURE__ */ r.jsx("span", { style: { fontSize: 10, color: t, lineHeight: 1 }, children: "" });
985
+ function J({ step: n, state: r, children: a, hint: s }) {
986
+ const i = r === "done", l = r === "locked";
987
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, marginBottom: 12 }, children: [
988
+ /* @__PURE__ */ t.jsx("span", { style: {
989
+ display: "inline-flex",
990
+ alignItems: "center",
991
+ justifyContent: "center",
992
+ width: 22,
993
+ height: 22,
994
+ flexShrink: 0,
995
+ fontFamily: "var(--font-mono)",
996
+ fontSize: 11,
997
+ fontWeight: 600,
998
+ lineHeight: 1,
999
+ color: i ? "var(--ok)" : l ? "var(--fg-faint)" : "var(--accent-ink)",
1000
+ background: i ? "var(--ok-wash)" : l ? "transparent" : "var(--accent)",
1001
+ border: i ? "1px solid var(--ok-line)" : l ? "1px solid var(--line-2)" : "none",
1002
+ clipPath: "polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%)",
1003
+ boxShadow: !i && !l ? "0 0 14px var(--accent-glow)" : "none"
1004
+ }, children: i ? "✓" : n }),
1005
+ /* @__PURE__ */ t.jsx("span", { style: {
1006
+ fontFamily: "var(--font-mono)",
1007
+ fontSize: 11,
1008
+ fontWeight: 600,
1009
+ textTransform: "uppercase",
1010
+ letterSpacing: ".18em",
1011
+ color: l ? "var(--fg-faint)" : "var(--fg-soft)"
1012
+ }, children: a }),
1013
+ s && /* @__PURE__ */ t.jsx("span", { style: { marginLeft: "auto", fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".06em", color: "var(--fg-faint)" }, children: s })
1014
+ ] });
937
1015
  }
938
- function ar() {
939
- return /* @__PURE__ */ r.jsx("div", { style: {
940
- width: 15,
941
- height: 15,
1016
+ function Rn({ size: n = 30 }) {
1017
+ return /* @__PURE__ */ t.jsx("span", { style: {
1018
+ width: n,
1019
+ height: n,
942
1020
  flexShrink: 0,
943
- border: "2px solid #e5e7eb",
944
- borderTopColor: a.colors.primary,
1021
+ display: "inline-flex",
1022
+ alignItems: "center",
1023
+ justifyContent: "center",
1024
+ background: "var(--accent)",
1025
+ color: "var(--accent-ink)",
1026
+ clipPath: "polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%)",
1027
+ boxShadow: "0 0 18px var(--accent-glow)"
1028
+ }, children: /* @__PURE__ */ t.jsxs(
1029
+ "svg",
1030
+ {
1031
+ width: n * 0.56,
1032
+ height: n * 0.56,
1033
+ viewBox: "0 0 24 24",
1034
+ fill: "none",
1035
+ stroke: "var(--accent-ink)",
1036
+ strokeWidth: "1.8",
1037
+ strokeLinecap: "round",
1038
+ strokeLinejoin: "round",
1039
+ children: [
1040
+ /* @__PURE__ */ t.jsx("ellipse", { cx: "12", cy: "14", rx: "5", ry: "6.5" }),
1041
+ /* @__PURE__ */ t.jsx("path", { d: "M7 12h10M7 16h10M12 7.5V4M12 4l-2.5-1.5M12 4l2.5-1.5" })
1042
+ ]
1043
+ }
1044
+ ) });
1045
+ }
1046
+ function _n({ states: n }) {
1047
+ return /* @__PURE__ */ t.jsx("span", { style: { display: "inline-flex", gap: 5 }, children: n.map((r, a) => /* @__PURE__ */ t.jsx("span", { style: {
1048
+ width: 7,
1049
+ height: 7,
945
1050
  borderRadius: "50%",
946
- animation: "spin 0.7s linear infinite"
947
- } });
1051
+ background: r ? "var(--ok)" : "var(--line-2)",
1052
+ boxShadow: r ? "0 0 8px var(--ok)" : "none",
1053
+ transition: "all .2s"
1054
+ } }, a)) });
948
1055
  }
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 = {
1056
+ function En(n) {
1057
+ const r = {
969
1058
  formatters: void 0,
970
1059
  fees: void 0,
971
1060
  serializers: void 0,
972
- ...t
1061
+ ...n
973
1062
  };
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) });
1063
+ function a(s) {
1064
+ return (i) => {
1065
+ const l = typeof i == "function" ? i(s) : i, p = { ...s, ...l };
1066
+ return Object.assign(p, { extend: a(p) });
978
1067
  };
979
1068
  }
980
- return Object.assign(n, {
981
- extend: i(n)
1069
+ return Object.assign(r, {
1070
+ extend: a(r)
982
1071
  });
983
1072
  }
984
- const Se = /* @__PURE__ */ at({
1073
+ const Pe = /* @__PURE__ */ En({
985
1074
  id: 100,
986
1075
  name: "Gnosis",
987
1076
  nativeCurrency: {
@@ -1010,343 +1099,708 @@ const Se = /* @__PURE__ */ at({
1010
1099
  }
1011
1100
  }
1012
1101
  });
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
- ] });
1102
+ function pt(n) {
1103
+ if (n)
1104
+ return n.shortMessage ?? n.message;
1022
1105
  }
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",
1106
+ function In({ name: n, icon: r, pending: a, disabled: s, onClick: i }) {
1107
+ const [l, p] = T(!1);
1108
+ return /* @__PURE__ */ t.jsxs(
1109
+ "button",
1110
+ {
1111
+ onClick: i,
1112
+ disabled: s || a,
1113
+ onMouseEnter: () => p(!0),
1114
+ onMouseLeave: () => p(!1),
1115
+ style: {
1116
+ display: "flex",
1117
+ alignItems: "center",
1118
+ gap: 12,
1119
+ width: "100%",
1120
+ textAlign: "left",
1121
+ padding: "11px 13px",
1122
+ borderRadius: 8,
1123
+ cursor: s ? "default" : "pointer",
1124
+ opacity: s ? 0.45 : 1,
1125
+ border: `1px solid ${l && !s ? "var(--line-orange)" : "var(--line)"}`,
1126
+ background: l && !s ? "var(--raised-2)" : "var(--raised)",
1127
+ transition: "all .15s var(--ease)"
1128
+ },
1129
+ children: [
1130
+ /* @__PURE__ */ t.jsx("span", { style: {
1131
+ width: 30,
1132
+ height: 30,
1133
+ flexShrink: 0,
1134
+ borderRadius: 7,
1135
+ display: "inline-flex",
1136
+ alignItems: "center",
1137
+ justifyContent: "center",
1138
+ background: "var(--bunker)",
1139
+ border: "1px solid var(--line-2)",
1140
+ color: "var(--accent-bright)",
1141
+ overflow: "hidden",
1142
+ fontFamily: "var(--font-display)",
1143
+ fontWeight: 700,
1144
+ fontSize: 15
1145
+ }, children: r ? /* @__PURE__ */ t.jsx("img", { src: r, width: 30, height: 30, alt: "", style: { borderRadius: 7 } }) : n.charAt(0) }),
1146
+ /* @__PURE__ */ t.jsx("span", { style: { flex: 1, fontSize: 14, fontWeight: 500, color: "var(--fg)" }, children: n }),
1147
+ a ? /* @__PURE__ */ t.jsx(ce, { size: 14 }) : /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 16, color: l && !s ? "var(--accent)" : "var(--fg-faint)", transition: "color .15s" }, children: "→" })
1148
+ ]
1149
+ }
1150
+ );
1151
+ }
1152
+ function Tn({ isConnected: n, address: r }) {
1153
+ const { connectors: a, connect: s, isPending: i, variables: l, error: p } = Xt(), { disconnect: h } = Qt();
1154
+ if (n)
1155
+ return /* @__PURE__ */ t.jsx(G, { tone: "ok", title: "Wallet connected", sub: r, children: /* @__PURE__ */ t.jsx(H, { onClick: () => h(), children: "disconnect" }) });
1156
+ const d = i && l != null && l.connector && "uid" in l.connector ? l.connector.uid : void 0;
1157
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1158
+ a.map((o) => /* @__PURE__ */ t.jsx(
1159
+ In,
1040
1160
  {
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"
1052
- }
1053
- )
1161
+ name: o.name,
1162
+ icon: o.icon,
1163
+ pending: d === o.uid,
1164
+ disabled: i && d !== o.uid,
1165
+ onClick: () => s({ connector: o })
1166
+ },
1167
+ o.uid
1168
+ )),
1169
+ p && /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--bad)", fontFamily: "var(--font-mono)" }, children: p.message })
1054
1170
  ] });
1055
1171
  }
1056
- function ut() {
1057
- return /* @__PURE__ */ r.jsxs("div", { style: {
1172
+ function Fn({ locked: n, isOnGnosis: r, chainId: a }) {
1173
+ const { switchChain: s, isPending: i } = en();
1174
+ return n ? /* @__PURE__ */ t.jsx(ee, { children: "Connect a wallet to verify it is on the Gnosis chain." }) : r ? /* @__PURE__ */ t.jsx(G, { tone: "ok", title: "Gnosis chain", sub: `chain id ${U}`, children: /* @__PURE__ */ t.jsx(le, { tone: "ok", children: "synced" }) }) : /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1175
+ /* @__PURE__ */ t.jsx(G, { tone: "warn", title: "Wrong network", sub: `chain ${a ?? "—"} active — Gnosis (${U}) required` }),
1176
+ /* @__PURE__ */ t.jsx(Oe, { onClick: () => s({ chainId: Pe.id }), pending: i, block: !0, children: i ? "switching…" : "switch to Gnosis" })
1177
+ ] });
1178
+ }
1179
+ function De({ symbol: n, role: r, amount: a, loading: s }) {
1180
+ const i = !s && a === 0, l = i ? "var(--warn)" : "var(--ok)", p = i ? "var(--warn-line)" : "var(--ok-line)", h = i ? "var(--warn-wash)" : "var(--ok-wash)";
1181
+ return /* @__PURE__ */ t.jsxs("div", { style: {
1058
1182
  display: "flex",
1059
1183
  alignItems: "center",
1060
1184
  gap: 12,
1061
- padding: "11px 14px",
1062
- border: `1px dashed ${a.colors.border}`,
1185
+ padding: "12px 14px",
1186
+ border: `1px solid ${s ? "var(--line)" : p}`,
1063
1187
  borderRadius: 8,
1064
- background: "#fafafa"
1188
+ background: s ? "var(--raised)" : h
1065
1189
  }, 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." })
1190
+ s ? /* @__PURE__ */ t.jsx(ce, { size: 14 }) : /* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, flexShrink: 0, borderRadius: "50%", background: l, boxShadow: `0 0 8px ${l}`, animation: i ? "sc-pulse-dot 1.6s var(--ease) infinite" : "none" } }),
1191
+ /* @__PURE__ */ t.jsxs("div", { style: { minWidth: 0 }, children: [
1192
+ /* @__PURE__ */ t.jsx("div", { style: { fontWeight: 600, fontSize: 13.5, color: s ? "var(--fg-soft)" : l }, children: n }),
1193
+ /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--fg-muted)", marginTop: 2 }, children: r })
1194
+ ] }),
1195
+ /* @__PURE__ */ t.jsxs("div", { style: { marginLeft: "auto", display: "flex", alignItems: "center", gap: 10, flexShrink: 0 }, children: [
1196
+ !s && /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 13.5, fontWeight: 500, color: i ? "var(--warn)" : "var(--fg)" }, children: a.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 }) }),
1197
+ !s && /* @__PURE__ */ t.jsx(le, { tone: i ? "warn" : "ok", children: i ? "empty" : "ok" })
1198
+ ] })
1068
1199
  ] });
1069
1200
  }
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 })
1201
+ function Pn({ locked: n, balance: r }) {
1202
+ if (n) return /* @__PURE__ */ t.jsx(ee, { children: "Switch to the Gnosis chain to read your wallet's xDAI balance." });
1203
+ const a = r.xdai ?? 0, s = !r.isLoading && a === 0;
1204
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1205
+ /* @__PURE__ */ t.jsx(De, { symbol: "xDAI", role: "gas for transactions from this wallet", amount: a, loading: r.isLoading }),
1206
+ /* @__PURE__ */ t.jsx("div", { style: oe, children: "Your connected wallet signs and pays gas for its own transactions — separate from the wallet running your Bee node." }),
1207
+ s && /* @__PURE__ */ t.jsx(Oe, { onClick: () => window.open("https://www.gnosisfaucet.com", "_blank", "noopener"), block: !0, children: "get xDAI" })
1108
1208
  ] });
1109
1209
  }
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
- ] })
1210
+ function Dn({ value: n, disabled: r, onSubmit: a }) {
1211
+ const [s, i] = T(n), [l, p] = T(!1);
1212
+ Q(() => {
1213
+ i(n);
1214
+ }, [n]);
1215
+ const h = s.trim().replace(/\/+$/, ""), d = h !== n && h.length > 0, o = () => {
1216
+ d && a(h);
1217
+ };
1218
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
1219
+ /* @__PURE__ */ t.jsxs("div", { style: {
1220
+ flex: 1,
1221
+ minWidth: 0,
1222
+ display: "flex",
1223
+ alignItems: "center",
1224
+ gap: 8,
1225
+ padding: "0 12px",
1226
+ borderRadius: 6,
1227
+ border: `1px solid ${l ? "var(--line-orange)" : "var(--line-2)"}`,
1228
+ background: r ? "var(--bunker)" : "var(--surface)",
1229
+ boxShadow: l ? "0 0 0 3px var(--accent-wash)" : "none",
1230
+ transition: "all .15s var(--ease)"
1231
+ }, children: [
1232
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 12, color: "var(--accent)" }, children: ">" }),
1233
+ /* @__PURE__ */ t.jsx(
1234
+ "input",
1235
+ {
1236
+ type: "url",
1237
+ value: s,
1238
+ disabled: r,
1239
+ spellCheck: !1,
1240
+ autoComplete: "off",
1241
+ onFocus: () => p(!0),
1242
+ onBlur: () => p(!1),
1243
+ onChange: (u) => i(u.target.value),
1244
+ onKeyDown: (u) => {
1245
+ u.key === "Enter" && o();
1246
+ },
1247
+ placeholder: "http://localhost:1633",
1248
+ style: {
1249
+ flex: 1,
1250
+ minWidth: 0,
1251
+ background: "transparent",
1252
+ border: "none",
1253
+ outline: "none",
1254
+ color: "var(--fg)",
1255
+ fontFamily: "var(--font-mono)",
1256
+ fontSize: 12.5,
1257
+ padding: "9px 0"
1258
+ }
1259
+ }
1260
+ )
1261
+ ] }),
1262
+ /* @__PURE__ */ t.jsx(H, { onClick: o, disabled: r || !d, children: "connect" })
1263
+ ] });
1264
+ }
1265
+ function An({ node: n, beeApiUrl: r }) {
1266
+ 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: [
1267
+ /* @__PURE__ */ t.jsx(ce, {}),
1268
+ /* @__PURE__ */ t.jsxs("span", { style: { color: "var(--fg-muted)", fontSize: 13, fontFamily: "var(--font-mono)" }, children: [
1269
+ "probing ",
1270
+ r,
1271
+ "…"
1128
1272
  ] })
1129
- ] }) : /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1130
- /* @__PURE__ */ r.jsxs("div", { style: {
1273
+ ] }) : n.isRunning ? /* @__PURE__ */ t.jsx(G, { tone: "ok", title: "Node online", sub: `bee ${n.version ?? "—"} · ${r}`, children: /* @__PURE__ */ t.jsx(le, { tone: "ok", children: "health ok" }) }) : /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1274
+ /* @__PURE__ */ t.jsx(G, { tone: "bad", title: "Node unreachable", sub: n.error ?? `no /health response from ${r}` }),
1275
+ /* @__PURE__ */ t.jsxs("div", { style: { fontSize: 12, color: "var(--fg-muted)", display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
1276
+ /* @__PURE__ */ t.jsx("span", { children: "start one with" }),
1277
+ /* @__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" }),
1278
+ /* @__PURE__ */ t.jsx(H, { onClick: n.check, children: "retry" })
1279
+ ] })
1280
+ ] });
1281
+ }
1282
+ function vt({ symbol: n, value: r, onChange: a, onSend: s, pending: i, confirming: l, done: p, disabled: h }) {
1283
+ const d = i || l;
1284
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
1285
+ /* @__PURE__ */ t.jsxs("div", { style: {
1286
+ flex: 1,
1287
+ minWidth: 0,
1131
1288
  display: "flex",
1132
1289
  alignItems: "center",
1133
- gap: 12,
1134
- padding: "11px 14px",
1135
- border: `1px solid ${a.colors.warning}`,
1136
- borderRadius: 8,
1137
- background: a.colors.warningLight
1290
+ gap: 8,
1291
+ padding: "0 12px",
1292
+ borderRadius: 6,
1293
+ border: "1px solid var(--line-2)",
1294
+ background: d || h ? "var(--bunker)" : "var(--surface)"
1138
1295
  }, 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
- ] })
1296
+ /* @__PURE__ */ t.jsx(
1297
+ "input",
1298
+ {
1299
+ inputMode: "decimal",
1300
+ value: r,
1301
+ disabled: d || h,
1302
+ spellCheck: !1,
1303
+ onChange: (o) => a(o.target.value),
1304
+ style: {
1305
+ flex: 1,
1306
+ minWidth: 0,
1307
+ background: "transparent",
1308
+ border: "none",
1309
+ outline: "none",
1310
+ color: "var(--fg)",
1311
+ fontFamily: "var(--font-mono)",
1312
+ fontSize: 12.5,
1313
+ padding: "8px 0"
1314
+ }
1315
+ }
1316
+ ),
1317
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 11, color: "var(--fg-muted)", flexShrink: 0 }, children: n })
1150
1318
  ] }),
1151
- /* @__PURE__ */ r.jsx(
1152
- "button",
1319
+ p ? /* @__PURE__ */ t.jsx(le, { tone: "ok", children: "sent" }) : /* @__PURE__ */ t.jsx(H, { onClick: s, disabled: d || h || !r.trim(), children: i ? "sign…" : l ? "mining…" : `send ${n.toLowerCase()}` })
1320
+ ] });
1321
+ }
1322
+ function On({ to: n, onSettled: r }) {
1323
+ const [a, s] = T(gn), [i, l] = T(mn), { address: p } = Ae(), h = tn(), d = nn(), o = it({ hash: h.data }), u = it({ hash: d.data });
1324
+ Q(() => {
1325
+ o.isSuccess && r();
1326
+ }, [o.isSuccess]), Q(() => {
1327
+ u.isSuccess && r();
1328
+ }, [u.isSuccess]);
1329
+ const v = rn({
1330
+ abi: st,
1331
+ address: ft,
1332
+ functionName: "balanceOf",
1333
+ args: p ? [p] : void 0,
1334
+ chainId: U,
1335
+ query: { enabled: !!p }
1336
+ }), g = v.data !== void 0 ? Number(v.data) / 10 ** Fe : void 0, b = (g ?? 0) > 0, E = () => {
1337
+ const S = gt(() => cn(a.trim()));
1338
+ S !== void 0 && h.sendTransaction({ to: n, value: S, chainId: U });
1339
+ }, _ = () => {
1340
+ const S = gt(() => ln(i.trim(), Fe));
1341
+ S !== void 0 && d.writeContract({
1342
+ abi: st,
1343
+ address: ft,
1344
+ functionName: "transfer",
1345
+ args: [n, S],
1346
+ chainId: U
1347
+ });
1348
+ }, A = pt(h.error) ?? pt(d.error);
1349
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1350
+ /* @__PURE__ */ t.jsx("div", { style: oe, children: "One-time top-up — sent from your connected wallet to the node wallet:" }),
1351
+ /* @__PURE__ */ t.jsx(
1352
+ vt,
1153
1353
  {
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"
1354
+ symbol: "xDAI",
1355
+ value: a,
1356
+ onChange: s,
1357
+ onSend: E,
1358
+ pending: h.isPending,
1359
+ confirming: o.isLoading && !!h.data,
1360
+ done: o.isSuccess,
1361
+ disabled: !1
1169
1362
  }
1170
1363
  ),
1171
- u && /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.error }, children: u.message })
1364
+ /* @__PURE__ */ t.jsx(
1365
+ vt,
1366
+ {
1367
+ symbol: "xBZZ",
1368
+ value: i,
1369
+ onChange: l,
1370
+ onSend: _,
1371
+ pending: d.isPending,
1372
+ confirming: u.isLoading && !!d.data,
1373
+ done: u.isSuccess,
1374
+ disabled: !b
1375
+ }
1376
+ ),
1377
+ g !== void 0 && /* @__PURE__ */ t.jsxs("div", { style: { ...oe, display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }, children: [
1378
+ /* @__PURE__ */ t.jsxs("span", { children: [
1379
+ "your wallet holds",
1380
+ " ",
1381
+ /* @__PURE__ */ t.jsxs("span", { style: { fontFamily: "var(--font-mono)", color: b ? "var(--fg-soft)" : "var(--warn)" }, children: [
1382
+ g.toLocaleString("en-US", { maximumFractionDigits: 4 }),
1383
+ " xBZZ"
1384
+ ] })
1385
+ ] }),
1386
+ !b && /* @__PURE__ */ t.jsx(H, { onClick: () => window.open("https://www.ethswarm.org/get-bzz", "_blank", "noopener"), children: "get xBZZ" })
1387
+ ] }),
1388
+ A && /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--bad)", fontFamily: "var(--font-mono)" }, children: A })
1172
1389
  ] });
1173
1390
  }
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",
1391
+ function gt(n) {
1392
+ try {
1393
+ return n();
1394
+ } catch {
1395
+ return;
1396
+ }
1397
+ }
1398
+ function $n({ locked: n, nodeWallet: r }) {
1399
+ if (n) return /* @__PURE__ */ t.jsx(ee, { children: "Bring your Bee node online to read its wallet." });
1400
+ if (r.error)
1401
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1402
+ /* @__PURE__ */ t.jsx(G, { tone: "bad", title: "Could not read node wallet", sub: r.error }),
1403
+ /* @__PURE__ */ t.jsx(H, { onClick: r.refresh, children: "retry" })
1404
+ ] });
1405
+ const a = r.isLoading && r.xdai === void 0;
1406
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1407
+ /* @__PURE__ */ t.jsx(De, { symbol: "xDAI", role: "gas for the node's own transactions", amount: r.xdai ?? 0, loading: a }),
1408
+ /* @__PURE__ */ t.jsx(De, { symbol: "xBZZ", role: "pays for postage stamps", amount: r.xbzz ?? 0, loading: a }),
1409
+ /* @__PURE__ */ t.jsxs("div", { style: oe, children: [
1410
+ "The Bee node has its own wallet",
1411
+ r.address && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1412
+ " ",
1413
+ /* @__PURE__ */ t.jsxs("span", { style: { fontFamily: "var(--font-mono)", color: "var(--fg-soft)" }, children: [
1414
+ r.address.slice(0, 8),
1415
+ "…",
1416
+ r.address.slice(-6)
1417
+ ] })
1418
+ ] }),
1419
+ " ",
1420
+ "— it buys and renews postage stamps on chain."
1421
+ ] }),
1422
+ !r.isFunded && r.address && /* @__PURE__ */ t.jsx(On, { to: r.address, onSettled: r.refresh })
1423
+ ] });
1424
+ }
1425
+ function zn({ stamp: n, selected: r, onSelect: a }) {
1426
+ const [s, i] = T(!1), l = Math.floor(n.batchTTL / 86400), p = `${n.batchID.slice(0, 8)}…${n.batchID.slice(-6)}`, h = r || s;
1427
+ return /* @__PURE__ */ t.jsxs(
1428
+ "button",
1429
+ {
1430
+ onClick: a,
1431
+ onMouseEnter: () => i(!0),
1432
+ onMouseLeave: () => i(!1),
1433
+ style: {
1434
+ display: "flex",
1435
+ alignItems: "center",
1436
+ gap: 12,
1437
+ width: "100%",
1438
+ textAlign: "left",
1439
+ padding: "12px 14px",
1440
+ borderRadius: 8,
1441
+ cursor: "pointer",
1442
+ border: `1px solid ${r ? "var(--ok-line)" : h ? "var(--line-2)" : "var(--line)"}`,
1443
+ background: r ? "var(--ok-wash)" : "var(--raised)",
1444
+ boxShadow: r ? "0 0 0 1px var(--ok-line), 0 0 18px var(--ok-wash)" : "none",
1445
+ transition: "all .15s var(--ease)"
1446
+ },
1447
+ children: [
1448
+ /* @__PURE__ */ t.jsx("span", { style: {
1449
+ width: 8,
1450
+ height: 8,
1451
+ flexShrink: 0,
1452
+ borderRadius: "50%",
1453
+ background: r ? "var(--ok)" : "var(--line-2)",
1454
+ boxShadow: r ? "0 0 8px var(--ok)" : "none",
1455
+ transition: "all .15s var(--ease)"
1456
+ } }),
1457
+ /* @__PURE__ */ t.jsxs("div", { style: { minWidth: 0, flex: 1 }, children: [
1458
+ /* @__PURE__ */ t.jsx("div", { style: { fontFamily: "var(--font-mono)", fontSize: 12.5, color: "var(--fg)" }, children: p }),
1459
+ /* @__PURE__ */ t.jsxs("div", { style: { fontSize: 11.5, color: "var(--fg-muted)", marginTop: 3, display: "flex", gap: 8 }, children: [
1460
+ n.label && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1461
+ /* @__PURE__ */ t.jsx("span", { children: n.label }),
1462
+ /* @__PURE__ */ t.jsx("span", { style: { color: "var(--fg-faint)" }, children: "·" })
1463
+ ] }),
1464
+ /* @__PURE__ */ t.jsxs("span", { children: [
1465
+ "depth ",
1466
+ n.depth
1467
+ ] })
1468
+ ] })
1469
+ ] }),
1470
+ /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexShrink: 0 }, children: [
1471
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 11, color: l > 30 ? "var(--fg-muted)" : "var(--warn)" }, children: l > 0 ? `${l}d ttl` : "expiring" }),
1472
+ /* @__PURE__ */ t.jsx(le, { tone: n.usable ? "ok" : "bad", children: n.usable ? "usable" : "unusable" })
1473
+ ] })
1474
+ ]
1475
+ }
1476
+ );
1477
+ }
1478
+ function Ie({ label: n, value: r, onChange: a, placeholder: s, width: i }) {
1479
+ return /* @__PURE__ */ t.jsxs("label", { style: { display: "flex", flexDirection: "column", gap: 4, flex: i ? `0 0 ${i}px` : 1, minWidth: 0 }, children: [
1480
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 9.5, letterSpacing: ".1em", textTransform: "uppercase", color: "var(--fg-faint)" }, children: n }),
1481
+ /* @__PURE__ */ t.jsx(
1482
+ "input",
1186
1483
  {
1187
- onClick: t,
1484
+ value: r,
1485
+ placeholder: s,
1486
+ spellCheck: !1,
1487
+ autoComplete: "off",
1488
+ onChange: (l) => a(l.target.value),
1188
1489
  style: {
1189
- position: "fixed",
1190
- inset: 0,
1191
- background: a.colors.overlay,
1192
- zIndex: 9998
1490
+ minWidth: 0,
1491
+ background: "var(--surface)",
1492
+ border: "1px solid var(--line-2)",
1493
+ borderRadius: 6,
1494
+ outline: "none",
1495
+ color: "var(--fg)",
1496
+ fontFamily: "var(--font-mono)",
1497
+ fontSize: 12,
1498
+ padding: "8px 10px"
1193
1499
  }
1194
1500
  }
1501
+ )
1502
+ ] });
1503
+ }
1504
+ function Ln({ stamps: n }) {
1505
+ const [r, a] = T(""), [s, i] = T(String(xn)), [l, p] = T(bn);
1506
+ if (n.isCreating)
1507
+ return /* @__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: [
1508
+ /* @__PURE__ */ t.jsx(ce, {}),
1509
+ /* @__PURE__ */ t.jsx("span", { style: { color: "var(--fg-muted)", fontSize: 13, fontFamily: "var(--font-mono)" }, children: "buying stamp — waiting for the on-chain batch…" })
1510
+ ] });
1511
+ const h = Number(s), d = Number.isInteger(h) && h >= 17 && /^\d+$/.test(l.trim());
1512
+ return /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8, padding: "12px 14px", border: "1px dashed var(--line-2)", borderRadius: 8, background: "var(--bunker)" }, children: [
1513
+ /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
1514
+ /* @__PURE__ */ t.jsx(Ie, { label: "label", value: r, onChange: a, placeholder: "optional" }),
1515
+ /* @__PURE__ */ t.jsx(Ie, { label: "depth", value: s, onChange: i, width: 64 }),
1516
+ /* @__PURE__ */ t.jsx(Ie, { label: "amount (plur)", value: l, onChange: p, width: 120 })
1517
+ ] }),
1518
+ /* @__PURE__ */ t.jsx("div", { style: oe, children: "Cost ≈ 2^depth × amount PLUR, paid in xBZZ from the node wallet. Higher amount → longer stamp lifetime." }),
1519
+ /* @__PURE__ */ t.jsx(
1520
+ Oe,
1521
+ {
1522
+ block: !0,
1523
+ onClick: () => d && n.createStamp({ amount: l.trim(), depth: h, label: r.trim() || void 0 }),
1524
+ style: d ? void 0 : { opacity: 0.5, cursor: "default" },
1525
+ children: "buy stamp"
1526
+ }
1195
1527
  ),
1196
- /* @__PURE__ */ r.jsxs("div", { style: {
1528
+ n.createError && /* @__PURE__ */ t.jsx("div", { style: { fontSize: 12, color: "var(--bad)", fontFamily: "var(--font-mono)" }, children: n.createError })
1529
+ ] });
1530
+ }
1531
+ function Wn({ stamps: n, locked: r, lockedHint: a, canCreate: s }) {
1532
+ 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: [
1533
+ /* @__PURE__ */ t.jsx(ce, {}),
1534
+ /* @__PURE__ */ t.jsx("span", { style: { color: "var(--fg-muted)", fontSize: 13, fontFamily: "var(--font-mono)" }, children: "reading /stamps…" })
1535
+ ] }) : n.error ? /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1536
+ /* @__PURE__ */ t.jsx(G, { tone: "bad", title: "Could not read stamps", sub: n.error }),
1537
+ /* @__PURE__ */ t.jsx(H, { onClick: n.fetchStamps, children: "retry" })
1538
+ ] }) : /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1539
+ n.stamps.length === 0 && !s && /* @__PURE__ */ t.jsx(ee, { children: "No postage stamps on this node — buy one via the Bee API to continue." }),
1540
+ n.stamps.map((i) => /* @__PURE__ */ t.jsx(
1541
+ zn,
1542
+ {
1543
+ stamp: i,
1544
+ selected: n.selectedStampId === i.batchID,
1545
+ onSelect: () => n.selectStamp(i.batchID)
1546
+ },
1547
+ i.batchID
1548
+ )),
1549
+ s && /* @__PURE__ */ t.jsx(Ln, { stamps: n })
1550
+ ] });
1551
+ }
1552
+ const oe = {
1553
+ fontSize: 11.5,
1554
+ color: "var(--fg-faint)",
1555
+ lineHeight: 1.5,
1556
+ paddingLeft: 2
1557
+ };
1558
+ function Bn({
1559
+ onClose: n,
1560
+ beeNode: r,
1561
+ stamps: a,
1562
+ beeApiUrl: s,
1563
+ setBeeApiUrl: i,
1564
+ stampMode: l = "select",
1565
+ nodeWallet: p
1566
+ }) {
1567
+ kt();
1568
+ const h = l === "create", { address: d, isConnected: o } = Ae(), u = xt(), v = u === U, { data: g, isLoading: b } = bt({
1569
+ address: d,
1570
+ chainId: U,
1571
+ query: { enabled: o }
1572
+ }), E = g ? Number(g.formatted) : void 0, _ = v && !!g && g.value > 0n, A = { xdai: E, isLoading: o && b, hasGas: _ }, S = wt(s), w = p ?? S;
1573
+ Q(() => {
1574
+ r.check();
1575
+ }, [s]), Q(() => {
1576
+ r.isRunning && (a.fetchStamps(), h && w.refresh());
1577
+ }, [r.isRunning]);
1578
+ const I = o ? "done" : "active", C = o ? v ? "done" : "active" : "locked", k = v ? _ ? "done" : "active" : "locked", D = _ ? r.isRunning ? "done" : "active" : "locked", W = D !== "done" ? "locked" : w.isFunded ? "done" : "active", V = h ? W === "done" : D === "done", B = V ? a.selectedStampId ? "done" : "active" : "locked", be = h ? 6 : 5, Y = B === "done", de = [
1579
+ o,
1580
+ v,
1581
+ _,
1582
+ r.isRunning,
1583
+ ...h ? [w.isFunded] : [],
1584
+ !!a.selectedStampId
1585
+ ], M = h ? "wallet · chain · gas · node · fund · stamp" : "wallet · chain · gas · node · stamp";
1586
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1587
+ /* @__PURE__ */ t.jsx("div", { className: "swarm-connect", onClick: n, style: {
1588
+ position: "fixed",
1589
+ inset: 0,
1590
+ zIndex: 9998,
1591
+ background: "rgba(4,6,8,0.72)",
1592
+ backdropFilter: "blur(6px)",
1593
+ WebkitBackdropFilter: "blur(6px)",
1594
+ animation: "sc-backdrop-in .2s var(--ease)"
1595
+ } }),
1596
+ /* @__PURE__ */ t.jsxs("div", { className: "swarm-connect", role: "dialog", "aria-label": "Connect to Swarm", style: {
1197
1597
  position: "fixed",
1198
1598
  top: "50%",
1199
1599
  left: "50%",
1600
+ transform: "translate(-50%, -50%)",
1200
1601
  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",
1602
+ width: 440,
1603
+ maxWidth: "calc(100vw - 28px)",
1604
+ background: "var(--surface)",
1605
+ borderRadius: 14,
1606
+ border: "1px solid var(--line-2)",
1607
+ 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
1608
  overflow: "hidden",
1208
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
1609
+ animation: "sc-modal-in .26s var(--ease) forwards",
1610
+ fontFamily: "var(--font-body)"
1209
1611
  }, 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" })
1612
+ /* @__PURE__ */ t.jsxs("div", { style: { position: "relative", padding: "18px 20px 16px", borderBottom: "1px solid var(--line)", overflow: "hidden" }, children: [
1613
+ /* @__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%)" } }),
1614
+ /* @__PURE__ */ t.jsxs("div", { style: { position: "relative", display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
1615
+ /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 11 }, children: [
1616
+ /* @__PURE__ */ t.jsx(Rn, { size: 30 }),
1617
+ /* @__PURE__ */ t.jsxs("div", { children: [
1618
+ /* @__PURE__ */ t.jsx("div", { style: { fontFamily: "var(--font-display)", fontWeight: 600, fontSize: 16, color: "var(--fg)", lineHeight: 1.1 }, children: "Connect to Swarm" }),
1619
+ /* @__PURE__ */ t.jsxs("div", { style: { fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".12em", color: "var(--fg-muted)", marginTop: 3 }, children: [
1620
+ "// ",
1621
+ Y ? "ready" : M
1622
+ ] })
1623
+ ] })
1624
+ ] }),
1625
+ /* @__PURE__ */ t.jsx(
1626
+ "button",
1627
+ {
1628
+ onClick: n,
1629
+ "aria-label": "Close",
1630
+ style: {
1631
+ background: "transparent",
1632
+ border: "1px solid var(--line)",
1633
+ color: "var(--fg-muted)",
1634
+ width: 30,
1635
+ height: 30,
1636
+ borderRadius: 6,
1637
+ cursor: "pointer",
1638
+ fontSize: 18,
1639
+ lineHeight: 1,
1640
+ display: "inline-flex",
1641
+ alignItems: "center",
1642
+ justifyContent: "center",
1643
+ transition: "all .15s"
1644
+ },
1645
+ onMouseEnter: (z) => {
1646
+ z.currentTarget.style.borderColor = "var(--line-orange)", z.currentTarget.style.color = "var(--accent-bright)";
1647
+ },
1648
+ onMouseLeave: (z) => {
1649
+ z.currentTarget.style.borderColor = "var(--line)", z.currentTarget.style.color = "var(--fg-muted)";
1650
+ },
1651
+ children: "×"
1652
+ }
1653
+ )
1654
+ ] })
1655
+ ] }),
1656
+ /* @__PURE__ */ t.jsxs("div", { className: "sc-scroll", style: { padding: 20, display: "flex", flexDirection: "column", gap: 24, maxHeight: "62vh", overflowY: "auto" }, children: [
1657
+ /* @__PURE__ */ t.jsxs("section", { style: { animation: "sc-step-in .3s var(--ease)" }, children: [
1658
+ /* @__PURE__ */ t.jsx(J, { step: 1, state: I, hint: o ? "linked" : null, children: "Wallet" }),
1659
+ /* @__PURE__ */ t.jsx(Tn, { isConnected: o, address: d })
1219
1660
  ] }),
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
- )
1661
+ /* @__PURE__ */ t.jsxs("section", { style: { opacity: C === "locked" ? 0.55 : 1, transition: "opacity .3s var(--ease)" }, children: [
1662
+ /* @__PURE__ */ t.jsx(J, { step: 2, state: C, hint: o ? v ? "gnosis" : "wrong net" : null, children: "Network chain" }),
1663
+ /* @__PURE__ */ t.jsx(Fn, { locked: C === "locked", isOnGnosis: v, chainId: u })
1664
+ ] }),
1665
+ /* @__PURE__ */ t.jsxs("section", { style: { opacity: k === "locked" ? 0.55 : 1, transition: "opacity .3s var(--ease)" }, children: [
1666
+ /* @__PURE__ */ t.jsx(J, { step: 3, state: k, hint: v ? _ ? "funded" : "low" : null, children: "Balance" }),
1667
+ /* @__PURE__ */ t.jsx(Pn, { locked: k === "locked", balance: A })
1668
+ ] }),
1669
+ /* @__PURE__ */ t.jsxs("section", { style: { opacity: D === "locked" ? 0.55 : 1, transition: "opacity .3s var(--ease)" }, children: [
1670
+ /* @__PURE__ */ t.jsx(J, { step: 4, state: D, hint: r.isRunning ? r.version : null, children: "Bee node" }),
1671
+ D === "locked" ? /* @__PURE__ */ t.jsx(ee, { children: "Top up xDAI gas to unlock the Bee node connection." }) : /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1672
+ /* @__PURE__ */ t.jsx(Dn, { value: s, disabled: r.isChecking, onSubmit: i }),
1673
+ /* @__PURE__ */ t.jsx(An, { node: r, beeApiUrl: s })
1674
+ ] })
1675
+ ] }),
1676
+ h && /* @__PURE__ */ t.jsxs("section", { style: { opacity: W === "locked" ? 0.55 : 1, transition: "opacity .3s var(--ease)" }, children: [
1677
+ /* @__PURE__ */ t.jsx(
1678
+ J,
1679
+ {
1680
+ step: 5,
1681
+ state: W,
1682
+ hint: W === "locked" ? null : w.isFunded ? "funded" : "top up",
1683
+ children: "Node wallet"
1684
+ }
1685
+ ),
1686
+ /* @__PURE__ */ t.jsx($n, { locked: W === "locked", nodeWallet: w })
1687
+ ] }),
1688
+ /* @__PURE__ */ t.jsxs("section", { style: { opacity: B === "locked" ? 0.55 : 1, transition: "opacity .3s var(--ease)" }, children: [
1689
+ /* @__PURE__ */ t.jsx(
1690
+ J,
1691
+ {
1692
+ step: be,
1693
+ state: B,
1694
+ hint: a.selectedStampId ? "1 selected" : V ? `${a.stamps.length} found` : null,
1695
+ children: "Postage stamp"
1696
+ }
1697
+ ),
1698
+ /* @__PURE__ */ t.jsx(
1699
+ Wn,
1700
+ {
1701
+ stamps: a,
1702
+ locked: B === "locked",
1703
+ canCreate: h,
1704
+ lockedHint: h ? "Fund the node wallet to manage postage stamps." : "Bring a node online to load its postage stamps."
1705
+ }
1706
+ )
1707
+ ] })
1238
1708
  ] }),
1239
- /* @__PURE__ */ r.jsxs("div", { style: {
1240
- padding: "20px",
1241
- marginTop: 6,
1242
- minHeight: 260,
1243
- maxHeight: "64vh",
1244
- overflowY: "auto",
1709
+ /* @__PURE__ */ t.jsxs("div", { style: {
1710
+ padding: "12px 20px",
1711
+ borderTop: "1px solid var(--line)",
1245
1712
  display: "flex",
1246
- flexDirection: "column",
1247
- gap: 28
1713
+ alignItems: "center",
1714
+ justifyContent: "space-between",
1715
+ background: Y ? "var(--accent-wash)" : "var(--bunker)",
1716
+ transition: "background .3s"
1248
1717
  }, 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 })
1718
+ /* @__PURE__ */ t.jsx("span", { style: { fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".06em", color: Y ? "var(--accent-bright)" : "var(--fg-muted)" }, children: Y ? "// fully connected — ready to upload" : "// gated · each step unlocks the next" }),
1719
+ Y ? /* @__PURE__ */ t.jsxs("span", { style: { display: "inline-flex", gap: 4, alignItems: "center", color: "var(--ok)", fontSize: 12, fontFamily: "var(--font-mono)" }, children: [
1720
+ /* @__PURE__ */ t.jsx("span", { style: { width: 7, height: 7, borderRadius: "50%", background: "var(--ok)", boxShadow: "0 0 8px var(--ok)" } }),
1721
+ "done"
1722
+ ] }) : /* @__PURE__ */ t.jsx(_n, { states: de })
1259
1723
  ] })
1260
1724
  ] })
1261
1725
  ] });
1262
1726
  }
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(
1727
+ function Xn({ beeApiUrl: n = se, stampMode: r, label: a }) {
1728
+ kt();
1729
+ const [s, i] = T(!1), l = jn({ beeApiUrl: n, stampMode: r }), { beeApiUrl: p, setBeeApiUrl: h, beeNode: d, stamps: o, nodeWallet: u, isFullyConnected: v, address: g } = l, [b, E] = T(!1), _ = a ?? (v && g ? `${g.slice(0, 6)}…${g.slice(-4)}` : "Connect to Swarm");
1730
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1731
+ /* @__PURE__ */ t.jsxs(
1276
1732
  "button",
1277
1733
  {
1278
- onClick: () => c(!0),
1734
+ className: "swarm-connect",
1735
+ onClick: () => i(!0),
1736
+ onMouseEnter: () => E(!0),
1737
+ onMouseLeave: () => E(!1),
1279
1738
  style: {
1280
1739
  display: "inline-flex",
1281
1740
  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",
1288
- cursor: "pointer",
1289
- fontSize: 15,
1741
+ gap: 10,
1742
+ fontFamily: "var(--font-mono)",
1743
+ fontSize: 13,
1290
1744
  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'
1294
- },
1295
- onMouseOver: (R) => {
1296
- v || (R.currentTarget.style.background = a.colors.primaryHover);
1297
- },
1298
- onMouseOut: (R) => {
1299
- R.currentTarget.style.background = v ? a.colors.successLight : a.colors.primary;
1745
+ letterSpacing: ".04em",
1746
+ padding: "10px 16px",
1747
+ borderRadius: 6,
1748
+ cursor: "pointer",
1749
+ background: v ? "var(--ok-wash)" : "var(--accent)",
1750
+ color: v ? "var(--ok)" : "var(--accent-ink)",
1751
+ border: `1px solid ${v ? "var(--ok-line)" : "transparent"}`,
1752
+ boxShadow: v ? "none" : b ? "0 0 26px var(--accent-glow)" : "0 0 14px var(--accent-glow)",
1753
+ transform: b && !v ? "translateY(-1px)" : "none",
1754
+ transition: "all .15s var(--ease)",
1755
+ whiteSpace: "nowrap"
1300
1756
  },
1301
1757
  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
1758
+ v ? /* @__PURE__ */ t.jsx("span", { style: { width: 8, height: 8, borderRadius: "50%", background: "var(--ok)", boxShadow: "0 0 8px var(--ok)" } }) : /* @__PURE__ */ t.jsx(Mn, { swarm: l }),
1759
+ _
1309
1760
  ]
1310
1761
  }
1311
1762
  ),
1312
- i && /* @__PURE__ */ r.jsx(
1313
- ht,
1763
+ s && /* @__PURE__ */ t.jsx(
1764
+ Bn,
1314
1765
  {
1315
- onClose: () => c(!1),
1316
- beeNode: u,
1317
- stamps: p,
1318
- beeApiUrl: g,
1319
- setBeeApiUrl: x
1766
+ onClose: () => i(!1),
1767
+ beeNode: d,
1768
+ stamps: o,
1769
+ beeApiUrl: p,
1770
+ setBeeApiUrl: h,
1771
+ stampMode: l.stampMode,
1772
+ nodeWallet: u
1320
1773
  }
1321
1774
  )
1322
1775
  ] });
1323
1776
  }
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
- } });
1777
+ function Mn({ swarm: n }) {
1778
+ const { beeNode: r, stamps: a, nodeWallet: s, stampMode: i, isWalletConnected: l, isOnGnosis: p, balance: h } = n, d = [
1779
+ l ? "ok" : "bad",
1780
+ p ? "ok" : "bad",
1781
+ h.hasGas ? "ok" : p ? "warn" : "bad",
1782
+ r.isChecking ? "warn" : r.isRunning ? "ok" : "bad",
1783
+ ...i === "create" ? [s.isFunded ? "ok" : "bad"] : [],
1784
+ a.selectedStampId ? "ok" : "bad"
1785
+ ], o = { ok: "var(--accent-ink)", bad: "rgba(26,14,2,.32)", warn: "#7a4a00" };
1786
+ return /* @__PURE__ */ t.jsx("span", { style: { display: "inline-flex", gap: 4, alignItems: "center" }, children: d.map((u, v) => /* @__PURE__ */ t.jsx("span", { style: { width: 6, height: 6, borderRadius: "50%", background: o[u], animation: u === "warn" ? "sc-pulse-dot 1.4s var(--ease) infinite" : "none" } }, v)) });
1333
1787
  }
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 {
1788
+ const Nn = "2.22.1", Un = () => `@wagmi/core@${Nn}`;
1789
+ var jt = function(n, r, a, s) {
1790
+ if (a === "a" && !s) throw new TypeError("Private accessor was defined without a getter");
1791
+ if (typeof r == "function" ? n !== r || !s : !r.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1792
+ return a === "m" ? s : a === "a" ? s.call(n) : s ? s.value : r.get(n);
1793
+ }, xe, St;
1794
+ class ie extends Error {
1341
1795
  get docsBaseUrl() {
1342
1796
  return "https://wagmi.sh/core";
1343
1797
  }
1344
1798
  get version() {
1345
- return gt();
1799
+ return Un();
1346
1800
  }
1347
- constructor(n, i = {}) {
1348
- var p;
1349
- super(), le.add(this), Object.defineProperty(this, "details", {
1801
+ constructor(r, a = {}) {
1802
+ var l;
1803
+ super(), xe.add(this), Object.defineProperty(this, "details", {
1350
1804
  enumerable: !0,
1351
1805
  configurable: !0,
1352
1806
  writable: !0,
@@ -1372,27 +1826,27 @@ class Z extends Error {
1372
1826
  writable: !0,
1373
1827
  value: "WagmiCoreError"
1374
1828
  });
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;
1829
+ const s = a.cause instanceof ie ? a.cause.details : (l = a.cause) != null && l.message ? a.cause.message : a.details, i = a.cause instanceof ie && a.cause.docsPath || a.docsPath;
1376
1830
  this.message = [
1377
- n || "An error occurred.",
1831
+ r || "An error occurred.",
1378
1832
  "",
1379
- ...i.metaMessages ? [...i.metaMessages, ""] : [],
1380
- ...u ? [
1381
- `Docs: ${this.docsBaseUrl}${u}.html${i.docsSlug ? `#${i.docsSlug}` : ""}`
1833
+ ...a.metaMessages ? [...a.metaMessages, ""] : [],
1834
+ ...i ? [
1835
+ `Docs: ${this.docsBaseUrl}${i}.html${a.docsSlug ? `#${a.docsSlug}` : ""}`
1382
1836
  ] : [],
1383
- ...c ? [`Details: ${c}`] : [],
1837
+ ...s ? [`Details: ${s}`] : [],
1384
1838
  `Version: ${this.version}`
1385
1839
  ].join(`
1386
- `), i.cause && (this.cause = i.cause), this.details = c, this.docsPath = u, this.metaMessages = i.metaMessages, this.shortMessage = n;
1840
+ `), a.cause && (this.cause = a.cause), this.details = s, this.docsPath = i, this.metaMessages = a.metaMessages, this.shortMessage = r;
1387
1841
  }
1388
- walk(n) {
1389
- return cr(this, le, "m", lr).call(this, this, n);
1842
+ walk(r) {
1843
+ return jt(this, xe, "m", St).call(this, this, r);
1390
1844
  }
1391
1845
  }
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;
1846
+ xe = /* @__PURE__ */ new WeakSet(), St = function n(r, a) {
1847
+ return a != null && a(r) ? r : r.cause ? jt(this, xe, "m", n).call(this, r.cause, a) : r;
1394
1848
  };
1395
- class vt extends Z {
1849
+ class Yn extends ie {
1396
1850
  constructor() {
1397
1851
  super("Chain not configured."), Object.defineProperty(this, "name", {
1398
1852
  enumerable: !0,
@@ -1402,7 +1856,7 @@ class vt extends Z {
1402
1856
  });
1403
1857
  }
1404
1858
  }
1405
- class V extends Z {
1859
+ class X extends ie {
1406
1860
  constructor() {
1407
1861
  super("Provider not found."), Object.defineProperty(this, "name", {
1408
1862
  enumerable: !0,
@@ -1412,103 +1866,103 @@ class V extends Z {
1412
1866
  });
1413
1867
  }
1414
1868
  }
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;
1869
+ $e.type = "injected";
1870
+ function $e(n = {}) {
1871
+ const { shimDisconnect: r = !0, unstable_shimAsyncInject: a } = n;
1872
+ function s() {
1873
+ const d = n.target;
1874
+ if (typeof d == "function") {
1875
+ const o = d();
1876
+ if (o)
1877
+ return o;
1424
1878
  }
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)}`
1879
+ return typeof d == "object" ? d : typeof d == "string" ? {
1880
+ ...qn[d] ?? {
1881
+ id: d,
1882
+ name: `${d[0].toUpperCase()}${d.slice(1)}`,
1883
+ provider: `is${d[0].toUpperCase()}${d.slice(1)}`
1430
1884
  }
1431
1885
  } : {
1432
1886
  id: "injected",
1433
1887
  name: "Injected",
1434
- provider(s) {
1435
- return s == null ? void 0 : s.ethereum;
1888
+ provider(o) {
1889
+ return o == null ? void 0 : o.ethereum;
1436
1890
  }
1437
1891
  };
1438
1892
  }
1439
- let u, p, g, x;
1440
- return (f) => ({
1893
+ let i, l, p, h;
1894
+ return (d) => ({
1441
1895
  get icon() {
1442
- return c().icon;
1896
+ return s().icon;
1443
1897
  },
1444
1898
  get id() {
1445
- return c().id;
1899
+ return s().id;
1446
1900
  },
1447
1901
  get name() {
1448
- return c().name;
1902
+ return s().name;
1449
1903
  },
1450
1904
  /** @deprecated */
1451
1905
  get supportsSimulation() {
1452
1906
  return !0;
1453
1907
  },
1454
- type: Re.type,
1908
+ type: $e.type,
1455
1909
  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)));
1910
+ const o = await this.getProvider();
1911
+ o != null && o.on && n.target && (p || (p = this.onConnect.bind(this), o.on("connect", p)), i || (i = this.onAccountsChanged.bind(this), o.on("accountsChanged", i)));
1458
1912
  },
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)
1913
+ async connect({ chainId: o, isReconnecting: u, withCapabilities: v } = {}) {
1914
+ var E, _, A, S, w, I;
1915
+ const g = await this.getProvider();
1916
+ if (!g)
1917
+ throw new X();
1918
+ let b = [];
1919
+ if (u)
1920
+ b = await this.getAccounts().catch(() => []);
1921
+ else if (r)
1468
1922
  try {
1469
- R = (I = (L = (W = (A = (await b.request({
1923
+ b = (S = (A = (_ = (E = (await g.request({
1470
1924
  method: "wallet_requestPermissions",
1471
1925
  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;
1926
+ }))[0]) == null ? void 0 : E.caveats) == null ? void 0 : _[0]) == null ? void 0 : A.value) == null ? void 0 : S.map((k) => ve(k)), b.length > 0 && (b = await this.getAccounts());
1927
+ } catch (C) {
1928
+ const k = C;
1929
+ if (k.code === N.code)
1930
+ throw new N(k);
1931
+ if (k.code === Ee.code)
1932
+ throw k;
1479
1933
  }
1480
1934
  try {
1481
- !(R != null && R.length) && !d && (R = (await b.request({
1935
+ !(b != null && b.length) && !u && (b = (await g.request({
1482
1936
  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: _ };
1937
+ })).map((D) => ve(D))), p && (g.removeListener("connect", p), p = void 0), i || (i = this.onAccountsChanged.bind(this), g.on("accountsChanged", i)), l || (l = this.onChainChanged.bind(this), g.on("chainChanged", l)), h || (h = this.onDisconnect.bind(this), g.on("disconnect", h));
1938
+ let C = await this.getChainId();
1939
+ if (o && C !== o) {
1940
+ const k = await this.switchChain({ chainId: o }).catch((D) => {
1941
+ if (D.code === N.code)
1942
+ throw D;
1943
+ return { id: C };
1490
1944
  });
1491
- _ = (C == null ? void 0 : C.id) ?? _;
1945
+ C = (k == null ? void 0 : k.id) ?? C;
1492
1946
  }
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: _
1947
+ return r && await ((w = d.storage) == null ? void 0 : w.removeItem(`${this.id}.disconnected`)), n.target || await ((I = d.storage) == null ? void 0 : I.setItem("injected.connected", !0)), {
1948
+ accounts: v ? b.map((k) => ({ address: k, capabilities: {} })) : b,
1949
+ chainId: C
1496
1950
  };
1497
- } catch (_) {
1498
- const C = _;
1499
- throw C.code === F.code ? new F(C) : C.code === xe.code ? new xe(C) : C;
1951
+ } catch (C) {
1952
+ const k = C;
1953
+ throw k.code === N.code ? new N(k) : k.code === Ee.code ? new Ee(k) : k;
1500
1954
  }
1501
1955
  },
1502
1956
  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));
1957
+ var u, v;
1958
+ const o = await this.getProvider();
1959
+ if (!o)
1960
+ throw new X();
1961
+ l && (o.removeListener("chainChanged", l), l = void 0), h && (o.removeListener("disconnect", h), h = void 0), p || (p = this.onConnect.bind(this), o.on("connect", p));
1508
1962
  try {
1509
- await Hr(() => (
1963
+ await un(() => (
1510
1964
  // TODO: Remove explicit type for viem@3
1511
- s.request({
1965
+ o.request({
1512
1966
  // `'wallet_revokePermissions'` added in `viem@2.10.3`
1513
1967
  method: "wallet_revokePermissions",
1514
1968
  params: [{ eth_accounts: {} }]
@@ -1516,164 +1970,164 @@ function Re(t = {}) {
1516
1970
  ), { timeout: 100 });
1517
1971
  } catch {
1518
1972
  }
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"));
1973
+ r && await ((u = d.storage) == null ? void 0 : u.setItem(`${this.id}.disconnected`, !0)), n.target || await ((v = d.storage) == null ? void 0 : v.removeItem("injected.connected"));
1520
1974
  },
1521
1975
  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));
1976
+ const o = await this.getProvider();
1977
+ if (!o)
1978
+ throw new X();
1979
+ return (await o.request({ method: "eth_accounts" })).map((v) => ve(v));
1526
1980
  },
1527
1981
  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);
1982
+ const o = await this.getProvider();
1983
+ if (!o)
1984
+ throw new X();
1985
+ const u = await o.request({ method: "eth_chainId" });
1986
+ return Number(u);
1533
1987
  },
1534
1988
  async getProvider() {
1535
1989
  if (typeof window > "u")
1536
1990
  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;
1991
+ let o;
1992
+ const u = s();
1993
+ return typeof u.provider == "function" ? o = u.provider(window) : typeof u.provider == "string" ? o = ge(window, u.provider) : o = u.provider, o && !o.removeListener && ("off" in o && typeof o.off == "function" ? o.removeListener = o.off : o.removeListener = () => {
1994
+ }), o;
1541
1995
  },
1542
1996
  async isAuthorized() {
1543
- var s, d;
1997
+ var o, u;
1544
1998
  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")))
1999
+ if (r && // If shim exists in storage, connector is disconnected
2000
+ await ((o = d.storage) == null ? void 0 : o.getItem(`${this.id}.disconnected`)) || !n.target && !await ((u = d.storage) == null ? void 0 : u.getItem("injected.connected")))
1547
2001
  return !1;
1548
2002
  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;
2003
+ if (a !== void 0 && a !== !1) {
2004
+ const E = async () => (typeof window < "u" && window.removeEventListener("ethereum#initialized", E), !!await this.getProvider()), _ = typeof a == "number" ? a : 1e3;
1551
2005
  if (await Promise.race([
1552
2006
  ...typeof window < "u" ? [
1553
- new Promise((I) => window.addEventListener("ethereum#initialized", () => I(A()), { once: !0 }))
2007
+ new Promise((S) => window.addEventListener("ethereum#initialized", () => S(E()), { once: !0 }))
1554
2008
  ] : [],
1555
- new Promise((I) => setTimeout(() => I(A()), W))
2009
+ new Promise((S) => setTimeout(() => S(E()), _))
1556
2010
  ]))
1557
2011
  return !0;
1558
2012
  }
1559
- throw new V();
2013
+ throw new X();
1560
2014
  }
1561
- return !!(await Gr(() => this.getAccounts())).length;
2015
+ return !!(await dn(() => this.getAccounts())).length;
1562
2016
  } catch {
1563
2017
  return !1;
1564
2018
  }
1565
2019
  },
1566
- async switchChain({ addEthereumChainParameter: s, chainId: d }) {
1567
- var A, W, L, I;
2020
+ async switchChain({ addEthereumChainParameter: o, chainId: u }) {
2021
+ var E, _, A, S;
1568
2022
  const v = await this.getProvider();
1569
2023
  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());
2024
+ throw new X();
2025
+ const g = d.chains.find((w) => w.id === u);
2026
+ if (!g)
2027
+ throw new ct(new Yn());
2028
+ const b = new Promise((w) => {
2029
+ const I = (C) => {
2030
+ "chainId" in C && C.chainId === u && (d.emitter.off("change", I), w());
1577
2031
  };
1578
- f.emitter.on("change", T);
2032
+ d.emitter.on("change", I);
1579
2033
  });
1580
2034
  try {
1581
2035
  return await Promise.all([
1582
2036
  v.request({
1583
2037
  method: "wallet_switchEthereumChain",
1584
- params: [{ chainId: Xe(d) }]
2038
+ params: [{ chainId: lt(u) }]
1585
2039
  }).then(async () => {
1586
- await this.getChainId() === d && f.emitter.emit("change", { chainId: d });
2040
+ await this.getChainId() === u && d.emitter.emit("change", { chainId: u });
1587
2041
  }),
1588
- R
1589
- ]), b;
1590
- } catch (S) {
1591
- const T = S;
1592
- if (T.code === 4902 || // Unwrapping for MetaMask Mobile
2042
+ b
2043
+ ]), g;
2044
+ } catch (w) {
2045
+ const I = w;
2046
+ if (I.code === 4902 || // Unwrapping for MetaMask Mobile
1593
2047
  // 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)
2048
+ ((_ = (E = I == null ? void 0 : I.data) == null ? void 0 : E.originalError) == null ? void 0 : _.code) === 4902)
1595
2049
  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)
2050
+ const { default: C, ...k } = g.blockExplorers ?? {};
2051
+ let D;
2052
+ o != null && o.blockExplorerUrls ? D = o.blockExplorerUrls : C && (D = [
2053
+ C.url,
2054
+ ...Object.values(k).map((B) => B.url)
1601
2055
  ]);
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
2056
+ let W;
2057
+ (A = o == null ? void 0 : o.rpcUrls) != null && A.length ? W = o.rpcUrls : W = [((S = g.rpcUrls.default) == null ? void 0 : S.http[0]) ?? ""];
2058
+ const V = {
2059
+ blockExplorerUrls: D,
2060
+ chainId: lt(u),
2061
+ chainName: (o == null ? void 0 : o.chainName) ?? g.name,
2062
+ iconUrls: o == null ? void 0 : o.iconUrls,
2063
+ nativeCurrency: (o == null ? void 0 : o.nativeCurrency) ?? g.nativeCurrency,
2064
+ rpcUrls: W
1611
2065
  };
1612
2066
  return await Promise.all([
1613
2067
  v.request({
1614
2068
  method: "wallet_addEthereumChain",
1615
- params: [de]
2069
+ params: [V]
1616
2070
  }).then(async () => {
1617
- if (await this.getChainId() === d)
1618
- f.emitter.emit("change", { chainId: d });
2071
+ if (await this.getChainId() === u)
2072
+ d.emitter.emit("change", { chainId: u });
1619
2073
  else
1620
- throw new F(new Error("User rejected switch after adding network."));
2074
+ throw new N(new Error("User rejected switch after adding network."));
1621
2075
  }),
1622
- R
1623
- ]), b;
1624
- } catch (_) {
1625
- throw new F(_);
2076
+ b
2077
+ ]), g;
2078
+ } catch (C) {
2079
+ throw new N(C);
1626
2080
  }
1627
- throw T.code === F.code ? new F(T) : new Je(T);
2081
+ throw I.code === N.code ? new N(I) : new ct(I);
1628
2082
  }
1629
2083
  },
1630
- async onAccountsChanged(s) {
1631
- var d;
1632
- if (s.length === 0)
2084
+ async onAccountsChanged(o) {
2085
+ var u;
2086
+ if (o.length === 0)
1633
2087
  this.onDisconnect();
1634
- else if (f.emitter.listenerCount("connect")) {
2088
+ else if (d.emitter.listenerCount("connect")) {
1635
2089
  const v = (await this.getChainId()).toString();
1636
- this.onConnect({ chainId: v }), n && await ((d = f.storage) == null ? void 0 : d.removeItem(`${this.id}.disconnected`));
2090
+ this.onConnect({ chainId: v }), r && await ((u = d.storage) == null ? void 0 : u.removeItem(`${this.id}.disconnected`));
1637
2091
  } else
1638
- f.emitter.emit("change", {
1639
- accounts: s.map((v) => oe(v))
2092
+ d.emitter.emit("change", {
2093
+ accounts: o.map((v) => ve(v))
1640
2094
  });
1641
2095
  },
1642
- onChainChanged(s) {
1643
- const d = Number(s);
1644
- f.emitter.emit("change", { chainId: d });
2096
+ onChainChanged(o) {
2097
+ const u = Number(o);
2098
+ d.emitter.emit("change", { chainId: u });
1645
2099
  },
1646
- async onConnect(s) {
1647
- const d = await this.getAccounts();
1648
- if (d.length === 0)
2100
+ async onConnect(o) {
2101
+ const u = await this.getAccounts();
2102
+ if (u.length === 0)
1649
2103
  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)));
2104
+ const v = Number(o.chainId);
2105
+ d.emitter.emit("connect", { accounts: u, chainId: v });
2106
+ const g = await this.getProvider();
2107
+ g && (p && (g.removeListener("connect", p), p = void 0), i || (i = this.onAccountsChanged.bind(this), g.on("accountsChanged", i)), l || (l = this.onChainChanged.bind(this), g.on("chainChanged", l)), h || (h = this.onDisconnect.bind(this), g.on("disconnect", h)));
1654
2108
  },
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))));
2109
+ async onDisconnect(o) {
2110
+ const u = await this.getProvider();
2111
+ o && o.code === 1013 && u && (await this.getAccounts()).length || (d.emitter.emit("disconnect"), u && (l && (u.removeListener("chainChanged", l), l = void 0), h && (u.removeListener("disconnect", h), h = void 0), p || (p = this.onConnect.bind(this), u.on("connect", p))));
1658
2112
  }
1659
2113
  });
1660
2114
  }
1661
- const yt = {
2115
+ const qn = {
1662
2116
  coinbaseWallet: {
1663
2117
  id: "coinbaseWallet",
1664
2118
  name: "Coinbase Wallet",
1665
- provider(t) {
1666
- return t != null && t.coinbaseWalletExtension ? t.coinbaseWalletExtension : se(t, "isCoinbaseWallet");
2119
+ provider(n) {
2120
+ return n != null && n.coinbaseWalletExtension ? n.coinbaseWalletExtension : ge(n, "isCoinbaseWallet");
1667
2121
  }
1668
2122
  },
1669
2123
  metaMask: {
1670
2124
  id: "metaMask",
1671
2125
  name: "MetaMask",
1672
- provider(t) {
1673
- return se(t, (n) => {
1674
- if (!n.isMetaMask || n.isBraveWallet && !n._events && !n._state)
2126
+ provider(n) {
2127
+ return ge(n, (r) => {
2128
+ if (!r.isMetaMask || r.isBraveWallet && !r._events && !r._state)
1675
2129
  return !1;
1676
- const i = [
2130
+ const a = [
1677
2131
  "isApexWallet",
1678
2132
  "isAvalanche",
1679
2133
  "isBitKeep",
@@ -1693,8 +2147,8 @@ const yt = {
1693
2147
  "isUniswapWallet",
1694
2148
  "isZerion"
1695
2149
  ];
1696
- for (const c of i)
1697
- if (n[c])
2150
+ for (const s of a)
2151
+ if (r[s])
1698
2152
  return !1;
1699
2153
  return !0;
1700
2154
  });
@@ -1703,37 +2157,38 @@ const yt = {
1703
2157
  phantom: {
1704
2158
  id: "phantom",
1705
2159
  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");
2160
+ provider(n) {
2161
+ var r, a;
2162
+ return (r = n == null ? void 0 : n.phantom) != null && r.ethereum ? (a = n.phantom) == null ? void 0 : a.ethereum : ge(n, "isPhantom");
1709
2163
  }
1710
2164
  }
1711
2165
  };
1712
- function se(t, n) {
1713
- function i(u) {
1714
- return typeof n == "function" ? n(u) : typeof n == "string" ? u[n] : !0;
2166
+ function ge(n, r) {
2167
+ function a(i) {
2168
+ return typeof r == "function" ? r(i) : typeof r == "string" ? i[r] : !0;
1715
2169
  }
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;
2170
+ const s = n.ethereum;
2171
+ if (s != null && s.providers)
2172
+ return s.providers.find((i) => a(i));
2173
+ if (s && a(s))
2174
+ return s;
1721
2175
  }
1722
- const mt = new qr(), bt = Br({
1723
- chains: [Se],
1724
- connectors: [Re()],
2176
+ const Gn = new fn(), Hn = an({
2177
+ chains: [Pe],
2178
+ connectors: [$e()],
1725
2179
  transports: {
1726
- [Se.id]: Nr()
2180
+ [Pe.id]: on()
1727
2181
  }
1728
2182
  });
1729
- function Rt({ children: t }) {
1730
- return /* @__PURE__ */ r.jsx(Yr, { config: bt, children: /* @__PURE__ */ r.jsx(Vr, { client: mt, children: t }) });
2183
+ function Qn({ children: n }) {
2184
+ return /* @__PURE__ */ t.jsx(sn, { config: Hn, children: /* @__PURE__ */ t.jsx(hn, { client: Gn, children: n }) });
1731
2185
  }
1732
2186
  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
2187
+ Xn as SwarmConnectButton,
2188
+ Bn as SwarmConnectModal,
2189
+ Qn as SwarmConnectProvider,
2190
+ yn as useBeeNode,
2191
+ wt as useNodeWallet,
2192
+ wn as usePostageStamps,
2193
+ jn as useSwarmConnect
1739
2194
  };