@ffaerber/swarm-connect 0.1.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.
@@ -0,0 +1,1628 @@
1
+ import tr, { useState as B, useCallback as nr, useEffect as Ge } from "react";
2
+ import { useAccount as or, useChainId as ir, useDisconnect as zr, useConnect as Mr, useSwitchChain as Ur, 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 He, numberToHex as Ke, UserRejectedRequestError as L, withRetry as Gr, withTimeout as Hr, ResourceUnavailableRpcError as ye } from "viem";
5
+ var be = { exports: {} }, X = {};
6
+ /**
7
+ * @license React
8
+ * react-jsx-runtime.production.min.js
9
+ *
10
+ * Copyright (c) Facebook, Inc. and its affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var Je;
16
+ function Kr() {
17
+ if (Je) return X;
18
+ Je = 1;
19
+ var t = tr, o = Symbol.for("react.element"), s = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, d = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function g(b, f, i) {
21
+ var l, y = {}, x = null, E = null;
22
+ i !== void 0 && (x = "" + i), f.key !== void 0 && (x = "" + f.key), f.ref !== void 0 && (E = f.ref);
23
+ for (l in f) u.call(f, l) && !p.hasOwnProperty(l) && (y[l] = f[l]);
24
+ if (b && b.defaultProps) for (l in f = b.defaultProps, f) y[l] === void 0 && (y[l] = f[l]);
25
+ return { $$typeof: o, type: b, key: x, ref: E, props: y, _owner: d.current };
26
+ }
27
+ return X.Fragment = s, X.jsx = g, X.jsxs = g, X;
28
+ }
29
+ var Q = {};
30
+ /**
31
+ * @license React
32
+ * react-jsx-runtime.development.js
33
+ *
34
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */
39
+ var Xe;
40
+ function Jr() {
41
+ return Xe || (Xe = 1, process.env.NODE_ENV !== "production" && function() {
42
+ var t = tr, o = Symbol.for("react.element"), s = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), b = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), i = Symbol.for("react.suspense"), l = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), E = Symbol.for("react.offscreen"), D = Symbol.iterator, W = "@@iterator";
43
+ function F(e) {
44
+ if (e === null || typeof e != "object")
45
+ return null;
46
+ var n = D && e[D] || e[W];
47
+ return typeof n == "function" ? n : null;
48
+ }
49
+ var T = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
+ function S(e) {
51
+ {
52
+ for (var n = arguments.length, c = new Array(n > 1 ? n - 1 : 0), h = 1; h < n; h++)
53
+ c[h - 1] = arguments[h];
54
+ I("error", e, c);
55
+ }
56
+ }
57
+ function I(e, n, c) {
58
+ {
59
+ var h = T.ReactDebugCurrentFrame, w = h.getStackAddendum();
60
+ w !== "" && (n += "%s", c = c.concat([w]));
61
+ var j = c.map(function(m) {
62
+ return String(m);
63
+ });
64
+ j.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, j);
65
+ }
66
+ }
67
+ var k = !1, C = !1, A = !1, G = !1, le = !1, H;
68
+ H = Symbol.for("react.module.reference");
69
+ function ur(e) {
70
+ return !!(typeof e == "string" || typeof e == "function" || e === u || e === p || le || e === d || e === i || e === l || G || e === E || k || C || A || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === y || e.$$typeof === g || e.$$typeof === b || e.$$typeof === f || // This needs to include all possible module reference object
71
+ // types supported by any Flight configuration anywhere since
72
+ // we don't know which Flight build this will end up being used
73
+ // with.
74
+ e.$$typeof === H || e.getModuleId !== void 0));
75
+ }
76
+ function dr(e, n, c) {
77
+ var h = e.displayName;
78
+ if (h)
79
+ return h;
80
+ var w = n.displayName || n.name || "";
81
+ return w !== "" ? c + "(" + w + ")" : c;
82
+ }
83
+ function Se(e) {
84
+ return e.displayName || "Context";
85
+ }
86
+ function z(e) {
87
+ if (e == null)
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")
90
+ return e.displayName || e.name || null;
91
+ if (typeof e == "string")
92
+ return e;
93
+ switch (e) {
94
+ case u:
95
+ return "Fragment";
96
+ case s:
97
+ return "Portal";
98
+ case p:
99
+ return "Profiler";
100
+ case d:
101
+ return "StrictMode";
102
+ case i:
103
+ return "Suspense";
104
+ case l:
105
+ return "SuspenseList";
106
+ }
107
+ if (typeof e == "object")
108
+ switch (e.$$typeof) {
109
+ case b:
110
+ var n = e;
111
+ return Se(n) + ".Consumer";
112
+ case g:
113
+ var c = e;
114
+ return Se(c._context) + ".Provider";
115
+ case f:
116
+ return dr(e, e.render, "ForwardRef");
117
+ case y:
118
+ var h = e.displayName || null;
119
+ return h !== null ? h : z(e.type) || "Memo";
120
+ case x: {
121
+ var w = e, j = w._payload, m = w._init;
122
+ try {
123
+ return z(m(j));
124
+ } catch {
125
+ return null;
126
+ }
127
+ }
128
+ }
129
+ return null;
130
+ }
131
+ var M = Object.assign, K = 0, Ce, Re, ke, _e, Ee, Te, Ie;
132
+ function Pe() {
133
+ }
134
+ Pe.__reactDisabledLog = !0;
135
+ function fr() {
136
+ {
137
+ if (K === 0) {
138
+ Ce = console.log, Re = console.info, ke = console.warn, _e = console.error, Ee = console.group, Te = console.groupCollapsed, Ie = console.groupEnd;
139
+ var e = {
140
+ configurable: !0,
141
+ enumerable: !0,
142
+ value: Pe,
143
+ writable: !0
144
+ };
145
+ Object.defineProperties(console, {
146
+ info: e,
147
+ log: e,
148
+ warn: e,
149
+ error: e,
150
+ group: e,
151
+ groupCollapsed: e,
152
+ groupEnd: e
153
+ });
154
+ }
155
+ K++;
156
+ }
157
+ }
158
+ function hr() {
159
+ {
160
+ if (K--, K === 0) {
161
+ var e = {
162
+ configurable: !0,
163
+ enumerable: !0,
164
+ writable: !0
165
+ };
166
+ Object.defineProperties(console, {
167
+ log: M({}, e, {
168
+ value: Ce
169
+ }),
170
+ info: M({}, e, {
171
+ value: Re
172
+ }),
173
+ warn: M({}, e, {
174
+ value: ke
175
+ }),
176
+ error: M({}, e, {
177
+ value: _e
178
+ }),
179
+ group: M({}, e, {
180
+ value: Ee
181
+ }),
182
+ groupCollapsed: M({}, e, {
183
+ value: Te
184
+ }),
185
+ groupEnd: M({}, e, {
186
+ value: Ie
187
+ })
188
+ });
189
+ }
190
+ K < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
191
+ }
192
+ }
193
+ var ue = T.ReactCurrentDispatcher, de;
194
+ function ee(e, n, c) {
195
+ {
196
+ if (de === void 0)
197
+ try {
198
+ throw Error();
199
+ } catch (w) {
200
+ var h = w.stack.trim().match(/\n( *(at )?)/);
201
+ de = h && h[1] || "";
202
+ }
203
+ return `
204
+ ` + de + e;
205
+ }
206
+ }
207
+ var fe = !1, re;
208
+ {
209
+ var pr = typeof WeakMap == "function" ? WeakMap : Map;
210
+ re = new pr();
211
+ }
212
+ function Oe(e, n) {
213
+ if (!e || fe)
214
+ return "";
215
+ {
216
+ var c = re.get(e);
217
+ if (c !== void 0)
218
+ return c;
219
+ }
220
+ var h;
221
+ fe = !0;
222
+ var w = Error.prepareStackTrace;
223
+ Error.prepareStackTrace = void 0;
224
+ var j;
225
+ j = ue.current, ue.current = null, fr();
226
+ try {
227
+ if (n) {
228
+ var m = function() {
229
+ throw Error();
230
+ };
231
+ if (Object.defineProperty(m.prototype, "props", {
232
+ set: function() {
233
+ throw Error();
234
+ }
235
+ }), typeof Reflect == "object" && Reflect.construct) {
236
+ try {
237
+ Reflect.construct(m, []);
238
+ } catch (O) {
239
+ h = O;
240
+ }
241
+ Reflect.construct(e, [], m);
242
+ } else {
243
+ try {
244
+ m.call();
245
+ } catch (O) {
246
+ h = O;
247
+ }
248
+ e.call(m.prototype);
249
+ }
250
+ } else {
251
+ try {
252
+ throw Error();
253
+ } catch (O) {
254
+ h = O;
255
+ }
256
+ e();
257
+ }
258
+ } catch (O) {
259
+ if (O && h && typeof O.stack == "string") {
260
+ for (var v = O.stack.split(`
261
+ `), P = h.stack.split(`
262
+ `), R = v.length - 1, _ = P.length - 1; R >= 1 && _ >= 0 && v[R] !== P[_]; )
263
+ _--;
264
+ for (; R >= 1 && _ >= 0; R--, _--)
265
+ if (v[R] !== P[_]) {
266
+ if (R !== 1 || _ !== 1)
267
+ do
268
+ if (R--, _--, _ < 0 || v[R] !== P[_]) {
269
+ var $ = `
270
+ ` + v[R].replace(" at new ", " at ");
271
+ return e.displayName && $.includes("<anonymous>") && ($ = $.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, $), $;
272
+ }
273
+ while (R >= 1 && _ >= 0);
274
+ break;
275
+ }
276
+ }
277
+ } finally {
278
+ fe = !1, ue.current = j, hr(), Error.prepareStackTrace = w;
279
+ }
280
+ var Y = e ? e.displayName || e.name : "", U = Y ? ee(Y) : "";
281
+ return typeof e == "function" && re.set(e, U), U;
282
+ }
283
+ function gr(e, n, c) {
284
+ return Oe(e, !1);
285
+ }
286
+ function vr(e) {
287
+ var n = e.prototype;
288
+ return !!(n && n.isReactComponent);
289
+ }
290
+ function te(e, n, c) {
291
+ if (e == null)
292
+ return "";
293
+ if (typeof e == "function")
294
+ return Oe(e, vr(e));
295
+ if (typeof e == "string")
296
+ return ee(e);
297
+ switch (e) {
298
+ case i:
299
+ return ee("Suspense");
300
+ case l:
301
+ return ee("SuspenseList");
302
+ }
303
+ if (typeof e == "object")
304
+ switch (e.$$typeof) {
305
+ case f:
306
+ return gr(e.render);
307
+ case y:
308
+ return te(e.type, n, c);
309
+ case x: {
310
+ var h = e, w = h._payload, j = h._init;
311
+ try {
312
+ return te(j(w), n, c);
313
+ } catch {
314
+ }
315
+ }
316
+ }
317
+ return "";
318
+ }
319
+ var J = Object.prototype.hasOwnProperty, De = {}, $e = T.ReactDebugCurrentFrame;
320
+ function ne(e) {
321
+ if (e) {
322
+ var n = e._owner, c = te(e.type, e._source, n ? n.type : null);
323
+ $e.setExtraStackFrame(c);
324
+ } else
325
+ $e.setExtraStackFrame(null);
326
+ }
327
+ function mr(e, n, c, h, w) {
328
+ {
329
+ var j = Function.call.bind(J);
330
+ for (var m in e)
331
+ if (j(e, m)) {
332
+ var v = void 0;
333
+ try {
334
+ if (typeof e[m] != "function") {
335
+ var P = Error((h || "React class") + ": " + c + " 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;
337
+ }
338
+ v = e[m](n, m, h, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
+ } catch (R) {
340
+ v = R;
341
+ }
342
+ v && !(v 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", c, m, typeof v), ne(null)), v instanceof Error && !(v.message in De) && (De[v.message] = !0, ne(w), S("Failed %s type: %s", c, v.message), ne(null));
343
+ }
344
+ }
345
+ }
346
+ var yr = Array.isArray;
347
+ function he(e) {
348
+ return yr(e);
349
+ }
350
+ function br(e) {
351
+ {
352
+ var n = typeof Symbol == "function" && Symbol.toStringTag, c = n && e[Symbol.toStringTag] || e.constructor.name || "Object";
353
+ return c;
354
+ }
355
+ }
356
+ function xr(e) {
357
+ try {
358
+ return Ae(e), !1;
359
+ } catch {
360
+ return !0;
361
+ }
362
+ }
363
+ function Ae(e) {
364
+ return "" + e;
365
+ }
366
+ function We(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)), Ae(e);
369
+ }
370
+ var Le = T.ReactCurrentOwner, wr = {
371
+ key: !0,
372
+ ref: !0,
373
+ __self: !0,
374
+ __source: !0
375
+ }, Fe, ze;
376
+ function jr(e) {
377
+ if (J.call(e, "ref")) {
378
+ var n = Object.getOwnPropertyDescriptor(e, "ref").get;
379
+ if (n && n.isReactWarning)
380
+ return !1;
381
+ }
382
+ return e.ref !== void 0;
383
+ }
384
+ function Sr(e) {
385
+ if (J.call(e, "key")) {
386
+ var n = Object.getOwnPropertyDescriptor(e, "key").get;
387
+ if (n && n.isReactWarning)
388
+ return !1;
389
+ }
390
+ return e.key !== void 0;
391
+ }
392
+ function Cr(e, n) {
393
+ typeof e.ref == "string" && Le.current;
394
+ }
395
+ function Rr(e, n) {
396
+ {
397
+ var c = function() {
398
+ Fe || (Fe = !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)", n));
399
+ };
400
+ c.isReactWarning = !0, Object.defineProperty(e, "key", {
401
+ get: c,
402
+ configurable: !0
403
+ });
404
+ }
405
+ }
406
+ function kr(e, n) {
407
+ {
408
+ var c = function() {
409
+ ze || (ze = !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)", n));
410
+ };
411
+ c.isReactWarning = !0, Object.defineProperty(e, "ref", {
412
+ get: c,
413
+ configurable: !0
414
+ });
415
+ }
416
+ }
417
+ var _r = function(e, n, c, h, w, j, m) {
418
+ var v = {
419
+ // This tag allows us to uniquely identify this as a React Element
420
+ $$typeof: o,
421
+ // Built-in properties that belong on the element
422
+ type: e,
423
+ key: n,
424
+ ref: c,
425
+ props: m,
426
+ // Record the component responsible for creating this element.
427
+ _owner: j
428
+ };
429
+ return v._store = {}, Object.defineProperty(v._store, "validated", {
430
+ configurable: !1,
431
+ enumerable: !1,
432
+ writable: !0,
433
+ value: !1
434
+ }), Object.defineProperty(v, "_self", {
435
+ configurable: !1,
436
+ enumerable: !1,
437
+ writable: !1,
438
+ value: h
439
+ }), Object.defineProperty(v, "_source", {
440
+ configurable: !1,
441
+ enumerable: !1,
442
+ writable: !1,
443
+ value: w
444
+ }), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
445
+ };
446
+ function Er(e, n, c, h, w) {
447
+ {
448
+ var j, m = {}, v = null, P = null;
449
+ c !== void 0 && (We(c), v = "" + c), Sr(n) && (We(n.key), v = "" + n.key), jr(n) && (P = n.ref, Cr(n, w));
450
+ for (j in n)
451
+ J.call(n, j) && !wr.hasOwnProperty(j) && (m[j] = n[j]);
452
+ if (e && e.defaultProps) {
453
+ var R = e.defaultProps;
454
+ for (j in R)
455
+ m[j] === void 0 && (m[j] = R[j]);
456
+ }
457
+ if (v || P) {
458
+ var _ = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ v && Rr(m, _), P && kr(m, _);
460
+ }
461
+ return _r(e, v, P, w, h, Le.current, m);
462
+ }
463
+ }
464
+ var pe = T.ReactCurrentOwner, Me = T.ReactDebugCurrentFrame;
465
+ function N(e) {
466
+ if (e) {
467
+ var n = e._owner, c = te(e.type, e._source, n ? n.type : null);
468
+ Me.setExtraStackFrame(c);
469
+ } else
470
+ Me.setExtraStackFrame(null);
471
+ }
472
+ var ge;
473
+ ge = !1;
474
+ function ve(e) {
475
+ return typeof e == "object" && e !== null && e.$$typeof === o;
476
+ }
477
+ function Ue() {
478
+ {
479
+ if (pe.current) {
480
+ var e = z(pe.current.type);
481
+ if (e)
482
+ return `
483
+
484
+ Check the render method of \`` + e + "`.";
485
+ }
486
+ return "";
487
+ }
488
+ }
489
+ function Tr(e) {
490
+ return "";
491
+ }
492
+ var Be = {};
493
+ function Ir(e) {
494
+ {
495
+ var n = Ue();
496
+ if (!n) {
497
+ var c = typeof e == "string" ? e : e.displayName || e.name;
498
+ c && (n = `
499
+
500
+ Check the top-level render call using <` + c + ">.");
501
+ }
502
+ return n;
503
+ }
504
+ }
505
+ function Ne(e, n) {
506
+ {
507
+ if (!e._store || e._store.validated || e.key != null)
508
+ return;
509
+ e._store.validated = !0;
510
+ var c = Ir(n);
511
+ if (Be[c])
512
+ return;
513
+ Be[c] = !0;
514
+ var h = "";
515
+ e && e._owner && e._owner !== pe.current && (h = " It was passed a child from " + z(e._owner.type) + "."), N(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.', c, h), N(null);
516
+ }
517
+ }
518
+ function Ye(e, n) {
519
+ {
520
+ if (typeof e != "object")
521
+ return;
522
+ if (he(e))
523
+ for (var c = 0; c < e.length; c++) {
524
+ var h = e[c];
525
+ ve(h) && Ne(h, n);
526
+ }
527
+ else if (ve(e))
528
+ e._store && (e._store.validated = !0);
529
+ else if (e) {
530
+ var w = F(e);
531
+ if (typeof w == "function" && w !== e.entries)
532
+ for (var j = w.call(e), m; !(m = j.next()).done; )
533
+ ve(m.value) && Ne(m.value, n);
534
+ }
535
+ }
536
+ }
537
+ function Pr(e) {
538
+ {
539
+ var n = e.type;
540
+ if (n == null || typeof n == "string")
541
+ return;
542
+ var c;
543
+ if (typeof n == "function")
544
+ c = n.propTypes;
545
+ else if (typeof n == "object" && (n.$$typeof === f || // Note: Memo only checks outer props here.
546
+ // Inner props are checked in the reconciler.
547
+ n.$$typeof === y))
548
+ c = n.propTypes;
549
+ else
550
+ return;
551
+ if (c) {
552
+ var h = z(n);
553
+ mr(c, e.props, "prop", h, e);
554
+ } else if (n.PropTypes !== void 0 && !ge) {
555
+ ge = !0;
556
+ var w = z(n);
557
+ S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", w || "Unknown");
558
+ }
559
+ typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
560
+ }
561
+ }
562
+ function Or(e) {
563
+ {
564
+ for (var n = Object.keys(e.props), c = 0; c < n.length; c++) {
565
+ var h = n[c];
566
+ if (h !== "children" && h !== "key") {
567
+ N(e), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", h), N(null);
568
+ break;
569
+ }
570
+ }
571
+ e.ref !== null && (N(e), S("Invalid attribute `ref` supplied to `React.Fragment`."), N(null));
572
+ }
573
+ }
574
+ var qe = {};
575
+ function Ve(e, n, c, h, w, j) {
576
+ {
577
+ var m = ur(e);
578
+ if (!m) {
579
+ var v = "";
580
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (v += " 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 = Tr();
582
+ P ? v += P : v += Ue();
583
+ var R;
584
+ e === null ? R = "null" : he(e) ? R = "array" : e !== void 0 && e.$$typeof === o ? (R = "<" + (z(e.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : R = 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", R, v);
585
+ }
586
+ var _ = Er(e, n, c, w, j);
587
+ if (_ == null)
588
+ return _;
589
+ if (m) {
590
+ var $ = n.children;
591
+ if ($ !== void 0)
592
+ if (h)
593
+ if (he($)) {
594
+ for (var Y = 0; Y < $.length; Y++)
595
+ Ye($[Y], e);
596
+ Object.freeze && Object.freeze($);
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.");
599
+ else
600
+ Ye($, e);
601
+ }
602
+ if (J.call(n, "key")) {
603
+ var U = z(e), O = Object.keys(n).filter(function(Fr) {
604
+ return Fr !== "key";
605
+ }), me = O.length > 0 ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}";
606
+ if (!qe[U + me]) {
607
+ var Lr = O.length > 0 ? "{" + O.join(": ..., ") + ": ...}" : "{}";
608
+ S(`A props object containing a "key" prop is being spread into JSX:
609
+ let props = %s;
610
+ <%s {...props} />
611
+ React keys must be passed directly to JSX without using spread:
612
+ let props = %s;
613
+ <%s key={someKey} {...props} />`, me, U, Lr, U), qe[U + me] = !0;
614
+ }
615
+ }
616
+ return e === u ? Or(_) : Pr(_), _;
617
+ }
618
+ }
619
+ function Dr(e, n, c) {
620
+ return Ve(e, n, c, !0);
621
+ }
622
+ function $r(e, n, c) {
623
+ return Ve(e, n, c, !1);
624
+ }
625
+ var Ar = $r, Wr = Dr;
626
+ Q.Fragment = u, Q.jsx = Ar, Q.jsxs = Wr;
627
+ }()), Q;
628
+ }
629
+ process.env.NODE_ENV === "production" ? be.exports = Kr() : be.exports = Jr();
630
+ var r = be.exports;
631
+ const ae = 100, we = "http://localhost:1633", 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
+ }
646
+ };
647
+ function Xr(t = we) {
648
+ const [o, s] = B({
649
+ isRunning: !1,
650
+ isChecking: !1
651
+ }), u = nr(async () => {
652
+ s({ isRunning: !1, isChecking: !0 });
653
+ try {
654
+ const d = await fetch(`${t}/health`, {
655
+ signal: AbortSignal.timeout(5e3)
656
+ });
657
+ if (d.ok) {
658
+ const p = await d.json();
659
+ s({ isRunning: !0, isChecking: !1, version: p.version });
660
+ } else
661
+ s({ isRunning: !1, isChecking: !1, error: `Node returned HTTP ${d.status}` });
662
+ } catch {
663
+ s({
664
+ isRunning: !1,
665
+ isChecking: !1,
666
+ error: `Cannot reach Bee node at ${t}`
667
+ });
668
+ }
669
+ }, [t]);
670
+ return { ...o, check: u };
671
+ }
672
+ function Qr(t = we) {
673
+ const [o, s] = B([]), [u, d] = B(!1), [p, g] = B(), [b, f] = B(), i = nr(async () => {
674
+ d(!0), g(void 0);
675
+ try {
676
+ const l = await fetch(`${t}/stamps`, {
677
+ signal: AbortSignal.timeout(5e3)
678
+ });
679
+ if (l.ok) {
680
+ const y = await l.json();
681
+ s(y.stamps ?? []);
682
+ } else
683
+ g(`HTTP ${l.status}`);
684
+ } catch {
685
+ g("Could not fetch postage stamps");
686
+ } finally {
687
+ d(!1);
688
+ }
689
+ }, [t]);
690
+ return { stamps: o, isLoading: u, error: p, fetchStamps: i, selectedStampId: b, selectStamp: f };
691
+ }
692
+ function Zr(t = {}) {
693
+ const o = Xr(t.beeApiUrl), s = Qr(t.beeApiUrl), { address: u, isConnected: d } = or(), p = ir(), g = p === ae;
694
+ return {
695
+ beeNode: o,
696
+ stamps: s,
697
+ isWalletConnected: d,
698
+ address: u,
699
+ isOnGnosis: g,
700
+ chainId: p,
701
+ isFullyConnected: o.isRunning && !!s.selectedStampId && d && g
702
+ };
703
+ }
704
+ function et({ beeApiUrl: t, beeNode: o, stamps: s }) {
705
+ return Ge(() => {
706
+ o.check();
707
+ }, []), Ge(() => {
708
+ o.isRunning && s.fetchStamps();
709
+ }, [o.isRunning]), /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 24 }, children: [
710
+ /* @__PURE__ */ r.jsxs("section", { children: [
711
+ /* @__PURE__ */ r.jsx(Qe, { children: "Bee Node" }),
712
+ /* @__PURE__ */ r.jsx(rt, { beeApiUrl: t, status: o, onRetry: o.check })
713
+ ] }),
714
+ o.isRunning && /* @__PURE__ */ r.jsxs("section", { children: [
715
+ /* @__PURE__ */ r.jsx(Qe, { children: "Postage Stamp" }),
716
+ /* @__PURE__ */ r.jsx(tt, { stamps: s })
717
+ ] })
718
+ ] });
719
+ }
720
+ function Qe({ children: t }) {
721
+ return /* @__PURE__ */ r.jsx("div", { style: {
722
+ fontSize: 11,
723
+ fontWeight: 700,
724
+ textTransform: "uppercase",
725
+ letterSpacing: "0.06em",
726
+ color: a.colors.muted,
727
+ marginBottom: 8
728
+ }, children: t });
729
+ }
730
+ function rt({ beeApiUrl: t, status: o, onRetry: s }) {
731
+ return o.isChecking ? /* @__PURE__ */ r.jsxs("div", { style: V, children: [
732
+ /* @__PURE__ */ r.jsx(sr, {}),
733
+ /* @__PURE__ */ r.jsxs("span", { style: { color: a.colors.muted, fontSize: 14 }, children: [
734
+ "Checking ",
735
+ t,
736
+ "…"
737
+ ] })
738
+ ] }) : o.isRunning ? /* @__PURE__ */ r.jsxs("div", { style: { ...V, borderColor: a.colors.success, background: a.colors.successLight }, children: [
739
+ /* @__PURE__ */ r.jsx(er, { color: a.colors.success }),
740
+ /* @__PURE__ */ r.jsxs("div", { children: [
741
+ /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.success, fontSize: 14 }, children: "Node running" }),
742
+ o.version && /* @__PURE__ */ r.jsxs("div", { style: { color: a.colors.muted, fontSize: 12 }, children: [
743
+ "v",
744
+ o.version
745
+ ] })
746
+ ] })
747
+ ] }) : /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
748
+ /* @__PURE__ */ r.jsxs("div", { style: { ...V, borderColor: a.colors.error, background: a.colors.errorLight }, children: [
749
+ /* @__PURE__ */ r.jsx(er, { color: a.colors.error }),
750
+ /* @__PURE__ */ r.jsxs("div", { children: [
751
+ /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.error, fontSize: 14 }, children: "Node not reachable" }),
752
+ /* @__PURE__ */ r.jsx("div", { style: { color: a.colors.muted, fontSize: 12 }, children: o.error ?? `Cannot reach ${t}` })
753
+ ] })
754
+ ] }),
755
+ /* @__PURE__ */ r.jsxs("div", { style: { fontSize: 12, color: a.colors.muted }, children: [
756
+ "Start: ",
757
+ /* @__PURE__ */ r.jsx("code", { style: { background: "#f3f4f6", padding: "1px 5px", borderRadius: 3 }, children: "bee start" })
758
+ ] }),
759
+ /* @__PURE__ */ r.jsx("button", { onClick: s, style: ar, children: "Retry" })
760
+ ] });
761
+ }
762
+ function tt({ stamps: t }) {
763
+ return t.isLoading ? /* @__PURE__ */ r.jsxs("div", { style: { ...V, gap: 10 }, children: [
764
+ /* @__PURE__ */ r.jsx(sr, {}),
765
+ /* @__PURE__ */ r.jsx("span", { style: { color: a.colors.muted, fontSize: 14 }, children: "Loading stamps…" })
766
+ ] }) : t.error ? /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
767
+ /* @__PURE__ */ r.jsx("div", { style: { ...V, borderColor: a.colors.error, background: a.colors.errorLight }, children: /* @__PURE__ */ r.jsx("span", { style: { color: a.colors.error, fontSize: 13 }, children: t.error }) }),
768
+ /* @__PURE__ */ r.jsx("button", { onClick: t.fetchStamps, style: ar, children: "Retry" })
769
+ ] }) : t.stamps.length === 0 ? /* @__PURE__ */ r.jsxs("div", { style: { ...V, flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
770
+ /* @__PURE__ */ r.jsx("div", { style: { fontSize: 14, color: a.colors.muted }, children: "No postage stamps found." }),
771
+ /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.muted }, children: "Buy a stamp via the Bee API or Swarm Desktop to continue." })
772
+ ] }) : /* @__PURE__ */ r.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: t.stamps.map((o) => /* @__PURE__ */ r.jsx(
773
+ nt,
774
+ {
775
+ stamp: o,
776
+ selected: t.selectedStampId === o.batchID,
777
+ onSelect: () => t.selectStamp(o.batchID)
778
+ },
779
+ o.batchID
780
+ )) });
781
+ }
782
+ function nt({ stamp: t, selected: o, onSelect: s }) {
783
+ const u = Math.floor(t.batchTTL / 86400), d = `${t.batchID.slice(0, 8)}…${t.batchID.slice(-6)}`;
784
+ return /* @__PURE__ */ r.jsxs(
785
+ "button",
786
+ {
787
+ onClick: s,
788
+ style: {
789
+ display: "flex",
790
+ alignItems: "center",
791
+ justifyContent: "space-between",
792
+ padding: "10px 14px",
793
+ border: `1.5px solid ${o ? a.colors.primary : a.colors.border}`,
794
+ borderRadius: 8,
795
+ cursor: "pointer",
796
+ background: o ? "#eff6ff" : "#fff",
797
+ textAlign: "left",
798
+ width: "100%",
799
+ transition: "all 0.15s"
800
+ },
801
+ children: [
802
+ /* @__PURE__ */ r.jsxs("div", { children: [
803
+ /* @__PURE__ */ r.jsx("div", { style: { fontFamily: "monospace", fontSize: 12, color: a.colors.text }, children: d }),
804
+ t.label && /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.muted, marginTop: 2 }, children: t.label })
805
+ ] }),
806
+ /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexShrink: 0 }, children: [
807
+ /* @__PURE__ */ r.jsx("span", { style: { fontSize: 11, color: a.colors.muted }, children: u > 0 ? `${u}d` : "expiring" }),
808
+ t.usable ? /* @__PURE__ */ r.jsx(Ze, { bg: a.colors.successLight, color: a.colors.success, children: "usable" }) : /* @__PURE__ */ r.jsx(Ze, { bg: a.colors.errorLight, color: a.colors.error, children: "unusable" }),
809
+ /* @__PURE__ */ r.jsx("div", { style: {
810
+ width: 16,
811
+ height: 16,
812
+ borderRadius: "50%",
813
+ flexShrink: 0,
814
+ border: `2px solid ${o ? a.colors.primary : a.colors.border}`,
815
+ background: o ? a.colors.primary : "transparent"
816
+ } })
817
+ ] })
818
+ ]
819
+ }
820
+ );
821
+ }
822
+ function Ze({ children: t, bg: o, color: s }) {
823
+ return /* @__PURE__ */ r.jsx("span", { style: { fontSize: 11, background: o, color: s, borderRadius: 4, padding: "2px 6px" }, children: t });
824
+ }
825
+ function er({ color: t }) {
826
+ return /* @__PURE__ */ r.jsx("span", { style: { fontSize: 10, color: t, lineHeight: 1 }, children: "●" });
827
+ }
828
+ function sr() {
829
+ return /* @__PURE__ */ r.jsx("div", { style: {
830
+ width: 15,
831
+ height: 15,
832
+ flexShrink: 0,
833
+ border: "2px solid #e5e7eb",
834
+ borderTopColor: a.colors.primary,
835
+ borderRadius: "50%",
836
+ animation: "spin 0.7s linear infinite"
837
+ } });
838
+ }
839
+ const V = {
840
+ display: "flex",
841
+ alignItems: "center",
842
+ gap: 12,
843
+ padding: "11px 14px",
844
+ border: `1px solid ${a.colors.border}`,
845
+ borderRadius: 8,
846
+ background: "#fff"
847
+ }, ar = {
848
+ background: "none",
849
+ border: `1px solid ${a.colors.border}`,
850
+ borderRadius: 6,
851
+ padding: "5px 14px",
852
+ cursor: "pointer",
853
+ fontSize: 13,
854
+ color: a.colors.muted,
855
+ alignSelf: "flex-start"
856
+ };
857
+ function ot(t) {
858
+ const o = {
859
+ formatters: void 0,
860
+ fees: void 0,
861
+ serializers: void 0,
862
+ ...t
863
+ };
864
+ function s(u) {
865
+ return (d) => {
866
+ const p = typeof d == "function" ? d(u) : d, g = { ...u, ...p };
867
+ return Object.assign(g, { extend: s(g) });
868
+ };
869
+ }
870
+ return Object.assign(o, {
871
+ extend: s(o)
872
+ });
873
+ }
874
+ const xe = /* @__PURE__ */ ot({
875
+ id: 100,
876
+ name: "Gnosis",
877
+ nativeCurrency: {
878
+ decimals: 18,
879
+ name: "xDAI",
880
+ symbol: "XDAI"
881
+ },
882
+ blockTime: 5e3,
883
+ rpcUrls: {
884
+ default: {
885
+ http: ["https://rpc.gnosischain.com"],
886
+ webSocket: ["wss://rpc.gnosischain.com/wss"]
887
+ }
888
+ },
889
+ blockExplorers: {
890
+ default: {
891
+ name: "Gnosisscan",
892
+ url: "https://gnosisscan.io",
893
+ apiUrl: "https://api.gnosisscan.io/api"
894
+ }
895
+ },
896
+ contracts: {
897
+ multicall3: {
898
+ address: "0xca11bde05977b3631167028862be2a173976ca11",
899
+ blockCreated: 21022491
900
+ }
901
+ }
902
+ });
903
+ function it() {
904
+ const { address: t, isConnected: o } = or(), s = ir(), u = s === ae;
905
+ return /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 24 }, children: [
906
+ /* @__PURE__ */ r.jsxs("section", { children: [
907
+ /* @__PURE__ */ r.jsx(rr, { children: "Wallet" }),
908
+ o ? /* @__PURE__ */ r.jsx(st, { address: t }) : /* @__PURE__ */ r.jsx(at, {})
909
+ ] }),
910
+ o && /* @__PURE__ */ r.jsxs("section", { children: [
911
+ /* @__PURE__ */ r.jsx(rr, { children: "Network" }),
912
+ /* @__PURE__ */ r.jsx(ct, { isOnGnosis: u, chainId: s })
913
+ ] })
914
+ ] });
915
+ }
916
+ function rr({ children: t }) {
917
+ return /* @__PURE__ */ r.jsx("div", { style: {
918
+ fontSize: 11,
919
+ fontWeight: 700,
920
+ textTransform: "uppercase",
921
+ letterSpacing: "0.06em",
922
+ color: a.colors.muted,
923
+ marginBottom: 8
924
+ }, children: t });
925
+ }
926
+ function st({ address: t }) {
927
+ const { disconnect: o } = zr();
928
+ return /* @__PURE__ */ r.jsxs("div", { style: {
929
+ display: "flex",
930
+ alignItems: "center",
931
+ justifyContent: "space-between",
932
+ padding: "11px 14px",
933
+ border: `1px solid ${a.colors.success}`,
934
+ borderRadius: 8,
935
+ background: a.colors.successLight
936
+ }, children: [
937
+ /* @__PURE__ */ r.jsxs("div", { children: [
938
+ /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.success, fontSize: 14 }, children: "Connected" }),
939
+ t && /* @__PURE__ */ r.jsx("div", { style: { fontFamily: "monospace", fontSize: 12, color: a.colors.muted, marginTop: 2 }, children: `${t.slice(0, 8)}…${t.slice(-6)}` })
940
+ ] }),
941
+ /* @__PURE__ */ r.jsx(
942
+ "button",
943
+ {
944
+ onClick: () => o(),
945
+ style: {
946
+ background: "none",
947
+ border: `1px solid ${a.colors.border}`,
948
+ borderRadius: 6,
949
+ padding: "5px 12px",
950
+ cursor: "pointer",
951
+ fontSize: 12,
952
+ color: a.colors.muted
953
+ },
954
+ children: "Disconnect"
955
+ }
956
+ )
957
+ ] });
958
+ }
959
+ function at() {
960
+ const { connectors: t, connect: o, isPending: s, error: u } = Mr();
961
+ return /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
962
+ t.map((d) => /* @__PURE__ */ r.jsxs(
963
+ "button",
964
+ {
965
+ onClick: () => o({ connector: d }),
966
+ disabled: s,
967
+ style: {
968
+ display: "flex",
969
+ alignItems: "center",
970
+ gap: 10,
971
+ padding: "11px 14px",
972
+ border: `1.5px solid ${a.colors.border}`,
973
+ borderRadius: 8,
974
+ cursor: s ? "not-allowed" : "pointer",
975
+ background: "#fff",
976
+ fontSize: 14,
977
+ fontWeight: 500,
978
+ color: a.colors.text,
979
+ opacity: s ? 0.6 : 1,
980
+ transition: "border-color 0.15s",
981
+ width: "100%"
982
+ },
983
+ onMouseOver: (p) => {
984
+ s || (p.currentTarget.style.borderColor = a.colors.primary);
985
+ },
986
+ onMouseOut: (p) => {
987
+ p.currentTarget.style.borderColor = a.colors.border;
988
+ },
989
+ children: [
990
+ d.icon ? /* @__PURE__ */ r.jsx("img", { src: d.icon, width: 20, height: 20, alt: "", style: { borderRadius: 4 } }) : /* @__PURE__ */ r.jsx("span", { style: { width: 20, textAlign: "center", fontSize: 16 }, children: "🔗" }),
991
+ d.name
992
+ ]
993
+ },
994
+ d.uid
995
+ )),
996
+ u && /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.error, marginTop: 2 }, children: u.message })
997
+ ] });
998
+ }
999
+ function ct({ isOnGnosis: t, chainId: o }) {
1000
+ const { switchChain: s, isPending: u, error: d } = Ur();
1001
+ return t ? /* @__PURE__ */ r.jsxs("div", { style: {
1002
+ display: "flex",
1003
+ alignItems: "center",
1004
+ gap: 12,
1005
+ padding: "11px 14px",
1006
+ border: `1px solid ${a.colors.success}`,
1007
+ borderRadius: 8,
1008
+ background: a.colors.successLight
1009
+ }, children: [
1010
+ /* @__PURE__ */ r.jsx("span", { style: { color: a.colors.success, fontSize: 10, lineHeight: 1 }, children: "●" }),
1011
+ /* @__PURE__ */ r.jsxs("div", { children: [
1012
+ /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.success, fontSize: 14 }, children: "Gnosis chain" }),
1013
+ /* @__PURE__ */ r.jsxs("div", { style: { fontSize: 12, color: a.colors.muted }, children: [
1014
+ "Chain ID ",
1015
+ ae
1016
+ ] })
1017
+ ] })
1018
+ ] }) : /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1019
+ /* @__PURE__ */ r.jsxs("div", { style: {
1020
+ display: "flex",
1021
+ alignItems: "center",
1022
+ gap: 12,
1023
+ padding: "11px 14px",
1024
+ border: `1px solid ${a.colors.warning}`,
1025
+ borderRadius: 8,
1026
+ background: a.colors.warningLight
1027
+ }, children: [
1028
+ /* @__PURE__ */ r.jsx("span", { style: { color: a.colors.warning, fontSize: 10, lineHeight: 1 }, children: "●" }),
1029
+ /* @__PURE__ */ r.jsxs("div", { children: [
1030
+ /* @__PURE__ */ r.jsx("div", { style: { fontWeight: 600, color: a.colors.warning, fontSize: 14 }, children: "Wrong network" }),
1031
+ /* @__PURE__ */ r.jsxs("div", { style: { fontSize: 12, color: a.colors.muted }, children: [
1032
+ "Chain ",
1033
+ o ?? "—",
1034
+ " active — Gnosis (",
1035
+ ae,
1036
+ ") required"
1037
+ ] })
1038
+ ] })
1039
+ ] }),
1040
+ /* @__PURE__ */ r.jsx(
1041
+ "button",
1042
+ {
1043
+ onClick: () => s({ chainId: xe.id }),
1044
+ disabled: u,
1045
+ style: {
1046
+ background: a.colors.primary,
1047
+ color: "#fff",
1048
+ border: "none",
1049
+ borderRadius: 6,
1050
+ padding: "9px 20px",
1051
+ cursor: u ? "not-allowed" : "pointer",
1052
+ fontSize: 14,
1053
+ fontWeight: 500,
1054
+ opacity: u ? 0.7 : 1,
1055
+ alignSelf: "flex-start"
1056
+ },
1057
+ children: u ? "Switching…" : "Switch to Gnosis"
1058
+ }
1059
+ ),
1060
+ d && /* @__PURE__ */ r.jsx("div", { style: { fontSize: 12, color: a.colors.error }, children: d.message })
1061
+ ] });
1062
+ }
1063
+ function lt({ onClose: t, beeNode: o, stamps: s, beeApiUrl: u }) {
1064
+ const [d, p] = B("swarm");
1065
+ return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1066
+ /* @__PURE__ */ r.jsx("style", { children: `
1067
+ @keyframes spin { to { transform: rotate(360deg); } }
1068
+ @keyframes scIn {
1069
+ from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
1070
+ to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
1071
+ }
1072
+ ` }),
1073
+ /* @__PURE__ */ r.jsx(
1074
+ "div",
1075
+ {
1076
+ onClick: t,
1077
+ style: {
1078
+ position: "fixed",
1079
+ inset: 0,
1080
+ background: a.colors.overlay,
1081
+ zIndex: 9998
1082
+ }
1083
+ }
1084
+ ),
1085
+ /* @__PURE__ */ r.jsxs("div", { style: {
1086
+ position: "fixed",
1087
+ top: "50%",
1088
+ left: "50%",
1089
+ zIndex: 9999,
1090
+ background: "#fff",
1091
+ borderRadius: 16,
1092
+ boxShadow: "0 24px 64px rgba(0,0,0,0.18)",
1093
+ width: 460,
1094
+ maxWidth: "calc(100vw - 32px)",
1095
+ animation: "scIn 0.2s ease forwards",
1096
+ overflow: "hidden",
1097
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
1098
+ }, children: [
1099
+ /* @__PURE__ */ r.jsxs("div", { style: {
1100
+ padding: "18px 20px 0",
1101
+ display: "flex",
1102
+ justifyContent: "space-between",
1103
+ alignItems: "center"
1104
+ }, children: [
1105
+ /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
1106
+ /* @__PURE__ */ r.jsx("span", { style: { fontSize: 20 }, children: "🐝" }),
1107
+ /* @__PURE__ */ r.jsx("span", { style: { fontWeight: 700, fontSize: 16, color: a.colors.text }, children: "Swarm Connect" })
1108
+ ] }),
1109
+ /* @__PURE__ */ r.jsx(
1110
+ "button",
1111
+ {
1112
+ onClick: t,
1113
+ "aria-label": "Close",
1114
+ style: {
1115
+ background: "none",
1116
+ border: "none",
1117
+ cursor: "pointer",
1118
+ color: a.colors.muted,
1119
+ fontSize: 22,
1120
+ lineHeight: 1,
1121
+ padding: "0 2px",
1122
+ borderRadius: 4
1123
+ },
1124
+ children: "×"
1125
+ }
1126
+ )
1127
+ ] }),
1128
+ /* @__PURE__ */ r.jsx("div", { style: {
1129
+ display: "flex",
1130
+ margin: "14px 20px 0",
1131
+ borderBottom: `1px solid ${a.colors.border}`
1132
+ }, children: ["swarm", "wallet"].map((g) => {
1133
+ const b = d === g;
1134
+ return /* @__PURE__ */ r.jsx(
1135
+ "button",
1136
+ {
1137
+ onClick: () => p(g),
1138
+ style: {
1139
+ background: "none",
1140
+ border: "none",
1141
+ cursor: "pointer",
1142
+ padding: "8px 18px 10px",
1143
+ fontSize: 14,
1144
+ fontWeight: b ? 600 : 400,
1145
+ color: b ? a.colors.primary : a.colors.muted,
1146
+ borderBottom: `2px solid ${b ? a.colors.primary : "transparent"}`,
1147
+ marginBottom: -1,
1148
+ transition: "all 0.15s"
1149
+ },
1150
+ children: g === "swarm" ? "🐝 Swarm" : "🦊 Wallet"
1151
+ },
1152
+ g
1153
+ );
1154
+ }) }),
1155
+ /* @__PURE__ */ r.jsxs("div", { style: { padding: "20px", minHeight: 260, maxHeight: "60vh", overflowY: "auto" }, children: [
1156
+ d === "swarm" && /* @__PURE__ */ r.jsx(et, { beeApiUrl: u, beeNode: o, stamps: s }),
1157
+ d === "wallet" && /* @__PURE__ */ r.jsx(it, {})
1158
+ ] })
1159
+ ] })
1160
+ ] });
1161
+ }
1162
+ function xt({ beeApiUrl: t = we, label: o }) {
1163
+ const [s, u] = B(!1), { beeNode: d, stamps: p, isWalletConnected: g, address: b, isOnGnosis: f, isFullyConnected: i } = Zr({ beeApiUrl: t }), l = o ?? (i ? b ? `${b.slice(0, 6)}…${b.slice(-4)}` : "Connected" : "Connect to Swarm");
1164
+ return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1165
+ /* @__PURE__ */ r.jsxs(
1166
+ "button",
1167
+ {
1168
+ onClick: () => u(!0),
1169
+ style: {
1170
+ display: "inline-flex",
1171
+ alignItems: "center",
1172
+ gap: 8,
1173
+ background: i ? a.colors.successLight : a.colors.primary,
1174
+ color: i ? a.colors.success : "#fff",
1175
+ border: i ? `1.5px solid ${a.colors.success}` : "none",
1176
+ borderRadius: 8,
1177
+ padding: "10px 18px",
1178
+ cursor: "pointer",
1179
+ fontSize: 15,
1180
+ fontWeight: 600,
1181
+ boxShadow: i ? "none" : "0 2px 8px rgba(26,86,219,0.25)",
1182
+ transition: "all 0.15s",
1183
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
1184
+ },
1185
+ onMouseOver: (y) => {
1186
+ i || (y.currentTarget.style.background = a.colors.primaryHover);
1187
+ },
1188
+ onMouseOut: (y) => {
1189
+ y.currentTarget.style.background = i ? a.colors.successLight : a.colors.primary;
1190
+ },
1191
+ children: [
1192
+ !i && /* @__PURE__ */ r.jsxs("span", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [
1193
+ /* @__PURE__ */ r.jsx(ie, { ok: d.isRunning, checking: d.isChecking }),
1194
+ /* @__PURE__ */ r.jsx(ie, { ok: !!p.selectedStampId }),
1195
+ /* @__PURE__ */ r.jsx(ie, { ok: g }),
1196
+ /* @__PURE__ */ r.jsx(ie, { ok: f })
1197
+ ] }),
1198
+ l
1199
+ ]
1200
+ }
1201
+ ),
1202
+ s && /* @__PURE__ */ r.jsx(
1203
+ lt,
1204
+ {
1205
+ onClose: () => u(!1),
1206
+ beeNode: d,
1207
+ stamps: p,
1208
+ beeApiUrl: t
1209
+ }
1210
+ )
1211
+ ] });
1212
+ }
1213
+ function ie({ ok: t, checking: o }) {
1214
+ const s = o ? a.colors.warning : t ? a.colors.success : a.colors.error;
1215
+ return /* @__PURE__ */ r.jsx("span", { style: {
1216
+ display: "inline-block",
1217
+ width: 7,
1218
+ height: 7,
1219
+ borderRadius: "50%",
1220
+ background: s
1221
+ } });
1222
+ }
1223
+ const ut = "2.22.1", dt = () => `@wagmi/core@${ut}`;
1224
+ var cr = function(t, o, s, u) {
1225
+ if (s === "a" && !u) throw new TypeError("Private accessor was defined without a getter");
1226
+ if (typeof o == "function" ? t !== o || !u : !o.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1227
+ return s === "m" ? u : s === "a" ? u.call(t) : u ? u.value : o.get(t);
1228
+ }, ce, lr;
1229
+ class Z extends Error {
1230
+ get docsBaseUrl() {
1231
+ return "https://wagmi.sh/core";
1232
+ }
1233
+ get version() {
1234
+ return dt();
1235
+ }
1236
+ constructor(o, s = {}) {
1237
+ var p;
1238
+ super(), ce.add(this), Object.defineProperty(this, "details", {
1239
+ enumerable: !0,
1240
+ configurable: !0,
1241
+ writable: !0,
1242
+ value: void 0
1243
+ }), Object.defineProperty(this, "docsPath", {
1244
+ enumerable: !0,
1245
+ configurable: !0,
1246
+ writable: !0,
1247
+ value: void 0
1248
+ }), Object.defineProperty(this, "metaMessages", {
1249
+ enumerable: !0,
1250
+ configurable: !0,
1251
+ writable: !0,
1252
+ value: void 0
1253
+ }), Object.defineProperty(this, "shortMessage", {
1254
+ enumerable: !0,
1255
+ configurable: !0,
1256
+ writable: !0,
1257
+ value: void 0
1258
+ }), Object.defineProperty(this, "name", {
1259
+ enumerable: !0,
1260
+ configurable: !0,
1261
+ writable: !0,
1262
+ value: "WagmiCoreError"
1263
+ });
1264
+ const u = s.cause instanceof Z ? s.cause.details : (p = s.cause) != null && p.message ? s.cause.message : s.details, d = s.cause instanceof Z && s.cause.docsPath || s.docsPath;
1265
+ this.message = [
1266
+ o || "An error occurred.",
1267
+ "",
1268
+ ...s.metaMessages ? [...s.metaMessages, ""] : [],
1269
+ ...d ? [
1270
+ `Docs: ${this.docsBaseUrl}${d}.html${s.docsSlug ? `#${s.docsSlug}` : ""}`
1271
+ ] : [],
1272
+ ...u ? [`Details: ${u}`] : [],
1273
+ `Version: ${this.version}`
1274
+ ].join(`
1275
+ `), s.cause && (this.cause = s.cause), this.details = u, this.docsPath = d, this.metaMessages = s.metaMessages, this.shortMessage = o;
1276
+ }
1277
+ walk(o) {
1278
+ return cr(this, ce, "m", lr).call(this, this, o);
1279
+ }
1280
+ }
1281
+ ce = /* @__PURE__ */ new WeakSet(), lr = function t(o, s) {
1282
+ return s != null && s(o) ? o : o.cause ? cr(this, ce, "m", t).call(this, o.cause, s) : o;
1283
+ };
1284
+ class ft extends Z {
1285
+ constructor() {
1286
+ super("Chain not configured."), Object.defineProperty(this, "name", {
1287
+ enumerable: !0,
1288
+ configurable: !0,
1289
+ writable: !0,
1290
+ value: "ChainNotConfiguredError"
1291
+ });
1292
+ }
1293
+ }
1294
+ class q extends Z {
1295
+ constructor() {
1296
+ super("Provider not found."), Object.defineProperty(this, "name", {
1297
+ enumerable: !0,
1298
+ configurable: !0,
1299
+ writable: !0,
1300
+ value: "ProviderNotFoundError"
1301
+ });
1302
+ }
1303
+ }
1304
+ je.type = "injected";
1305
+ function je(t = {}) {
1306
+ const { shimDisconnect: o = !0, unstable_shimAsyncInject: s } = t;
1307
+ function u() {
1308
+ const f = t.target;
1309
+ if (typeof f == "function") {
1310
+ const i = f();
1311
+ if (i)
1312
+ return i;
1313
+ }
1314
+ return typeof f == "object" ? f : typeof f == "string" ? {
1315
+ ...ht[f] ?? {
1316
+ id: f,
1317
+ name: `${f[0].toUpperCase()}${f.slice(1)}`,
1318
+ provider: `is${f[0].toUpperCase()}${f.slice(1)}`
1319
+ }
1320
+ } : {
1321
+ id: "injected",
1322
+ name: "Injected",
1323
+ provider(i) {
1324
+ return i == null ? void 0 : i.ethereum;
1325
+ }
1326
+ };
1327
+ }
1328
+ let d, p, g, b;
1329
+ return (f) => ({
1330
+ get icon() {
1331
+ return u().icon;
1332
+ },
1333
+ get id() {
1334
+ return u().id;
1335
+ },
1336
+ get name() {
1337
+ return u().name;
1338
+ },
1339
+ /** @deprecated */
1340
+ get supportsSimulation() {
1341
+ return !0;
1342
+ },
1343
+ type: je.type,
1344
+ async setup() {
1345
+ const i = await this.getProvider();
1346
+ i != null && i.on && t.target && (g || (g = this.onConnect.bind(this), i.on("connect", g)), d || (d = this.onAccountsChanged.bind(this), i.on("accountsChanged", d)));
1347
+ },
1348
+ async connect({ chainId: i, isReconnecting: l, withCapabilities: y } = {}) {
1349
+ var D, W, F, T, S, I;
1350
+ const x = await this.getProvider();
1351
+ if (!x)
1352
+ throw new q();
1353
+ let E = [];
1354
+ if (l)
1355
+ E = await this.getAccounts().catch(() => []);
1356
+ else if (o)
1357
+ try {
1358
+ E = (T = (F = (W = (D = (await x.request({
1359
+ method: "wallet_requestPermissions",
1360
+ params: [{ eth_accounts: {} }]
1361
+ }))[0]) == null ? void 0 : D.caveats) == null ? void 0 : W[0]) == null ? void 0 : F.value) == null ? void 0 : T.map((C) => oe(C)), E.length > 0 && (E = await this.getAccounts());
1362
+ } catch (k) {
1363
+ const C = k;
1364
+ if (C.code === L.code)
1365
+ throw new L(C);
1366
+ if (C.code === ye.code)
1367
+ throw C;
1368
+ }
1369
+ try {
1370
+ !(E != null && E.length) && !l && (E = (await x.request({
1371
+ method: "eth_requestAccounts"
1372
+ })).map((A) => oe(A))), g && (x.removeListener("connect", g), g = void 0), d || (d = this.onAccountsChanged.bind(this), x.on("accountsChanged", d)), p || (p = this.onChainChanged.bind(this), x.on("chainChanged", p)), b || (b = this.onDisconnect.bind(this), x.on("disconnect", b));
1373
+ let k = await this.getChainId();
1374
+ if (i && k !== i) {
1375
+ const C = await this.switchChain({ chainId: i }).catch((A) => {
1376
+ if (A.code === L.code)
1377
+ throw A;
1378
+ return { id: k };
1379
+ });
1380
+ k = (C == null ? void 0 : C.id) ?? k;
1381
+ }
1382
+ return o && await ((S = f.storage) == null ? void 0 : S.removeItem(`${this.id}.disconnected`)), t.target || await ((I = f.storage) == null ? void 0 : I.setItem("injected.connected", !0)), {
1383
+ accounts: y ? E.map((C) => ({ address: C, capabilities: {} })) : E,
1384
+ chainId: k
1385
+ };
1386
+ } catch (k) {
1387
+ const C = k;
1388
+ throw C.code === L.code ? new L(C) : C.code === ye.code ? new ye(C) : C;
1389
+ }
1390
+ },
1391
+ async disconnect() {
1392
+ var l, y;
1393
+ const i = await this.getProvider();
1394
+ if (!i)
1395
+ throw new q();
1396
+ p && (i.removeListener("chainChanged", p), p = void 0), b && (i.removeListener("disconnect", b), b = void 0), g || (g = this.onConnect.bind(this), i.on("connect", g));
1397
+ try {
1398
+ await Hr(() => (
1399
+ // TODO: Remove explicit type for viem@3
1400
+ i.request({
1401
+ // `'wallet_revokePermissions'` added in `viem@2.10.3`
1402
+ method: "wallet_revokePermissions",
1403
+ params: [{ eth_accounts: {} }]
1404
+ })
1405
+ ), { timeout: 100 });
1406
+ } catch {
1407
+ }
1408
+ o && await ((l = f.storage) == null ? void 0 : l.setItem(`${this.id}.disconnected`, !0)), t.target || await ((y = f.storage) == null ? void 0 : y.removeItem("injected.connected"));
1409
+ },
1410
+ async getAccounts() {
1411
+ const i = await this.getProvider();
1412
+ if (!i)
1413
+ throw new q();
1414
+ return (await i.request({ method: "eth_accounts" })).map((y) => oe(y));
1415
+ },
1416
+ async getChainId() {
1417
+ const i = await this.getProvider();
1418
+ if (!i)
1419
+ throw new q();
1420
+ const l = await i.request({ method: "eth_chainId" });
1421
+ return Number(l);
1422
+ },
1423
+ async getProvider() {
1424
+ if (typeof window > "u")
1425
+ return;
1426
+ let i;
1427
+ const l = u();
1428
+ return typeof l.provider == "function" ? i = l.provider(window) : typeof l.provider == "string" ? i = se(window, l.provider) : i = l.provider, i && !i.removeListener && ("off" in i && typeof i.off == "function" ? i.removeListener = i.off : i.removeListener = () => {
1429
+ }), i;
1430
+ },
1431
+ async isAuthorized() {
1432
+ var i, l;
1433
+ try {
1434
+ if (o && // If shim exists in storage, connector is disconnected
1435
+ await ((i = f.storage) == null ? void 0 : i.getItem(`${this.id}.disconnected`)) || !t.target && !await ((l = f.storage) == null ? void 0 : l.getItem("injected.connected")))
1436
+ return !1;
1437
+ if (!await this.getProvider()) {
1438
+ if (s !== void 0 && s !== !1) {
1439
+ const D = async () => (typeof window < "u" && window.removeEventListener("ethereum#initialized", D), !!await this.getProvider()), W = typeof s == "number" ? s : 1e3;
1440
+ if (await Promise.race([
1441
+ ...typeof window < "u" ? [
1442
+ new Promise((T) => window.addEventListener("ethereum#initialized", () => T(D()), { once: !0 }))
1443
+ ] : [],
1444
+ new Promise((T) => setTimeout(() => T(D()), W))
1445
+ ]))
1446
+ return !0;
1447
+ }
1448
+ throw new q();
1449
+ }
1450
+ return !!(await Gr(() => this.getAccounts())).length;
1451
+ } catch {
1452
+ return !1;
1453
+ }
1454
+ },
1455
+ async switchChain({ addEthereumChainParameter: i, chainId: l }) {
1456
+ var D, W, F, T;
1457
+ const y = await this.getProvider();
1458
+ if (!y)
1459
+ throw new q();
1460
+ const x = f.chains.find((S) => S.id === l);
1461
+ if (!x)
1462
+ throw new He(new ft());
1463
+ const E = new Promise((S) => {
1464
+ const I = (k) => {
1465
+ "chainId" in k && k.chainId === l && (f.emitter.off("change", I), S());
1466
+ };
1467
+ f.emitter.on("change", I);
1468
+ });
1469
+ try {
1470
+ return await Promise.all([
1471
+ y.request({
1472
+ method: "wallet_switchEthereumChain",
1473
+ params: [{ chainId: Ke(l) }]
1474
+ }).then(async () => {
1475
+ await this.getChainId() === l && f.emitter.emit("change", { chainId: l });
1476
+ }),
1477
+ E
1478
+ ]), x;
1479
+ } catch (S) {
1480
+ const I = S;
1481
+ if (I.code === 4902 || // Unwrapping for MetaMask Mobile
1482
+ // https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719
1483
+ ((W = (D = I == null ? void 0 : I.data) == null ? void 0 : D.originalError) == null ? void 0 : W.code) === 4902)
1484
+ try {
1485
+ const { default: k, ...C } = x.blockExplorers ?? {};
1486
+ let A;
1487
+ i != null && i.blockExplorerUrls ? A = i.blockExplorerUrls : k && (A = [
1488
+ k.url,
1489
+ ...Object.values(C).map((H) => H.url)
1490
+ ]);
1491
+ let G;
1492
+ (F = i == null ? void 0 : i.rpcUrls) != null && F.length ? G = i.rpcUrls : G = [((T = x.rpcUrls.default) == null ? void 0 : T.http[0]) ?? ""];
1493
+ const le = {
1494
+ blockExplorerUrls: A,
1495
+ chainId: Ke(l),
1496
+ chainName: (i == null ? void 0 : i.chainName) ?? x.name,
1497
+ iconUrls: i == null ? void 0 : i.iconUrls,
1498
+ nativeCurrency: (i == null ? void 0 : i.nativeCurrency) ?? x.nativeCurrency,
1499
+ rpcUrls: G
1500
+ };
1501
+ return await Promise.all([
1502
+ y.request({
1503
+ method: "wallet_addEthereumChain",
1504
+ params: [le]
1505
+ }).then(async () => {
1506
+ if (await this.getChainId() === l)
1507
+ f.emitter.emit("change", { chainId: l });
1508
+ else
1509
+ throw new L(new Error("User rejected switch after adding network."));
1510
+ }),
1511
+ E
1512
+ ]), x;
1513
+ } catch (k) {
1514
+ throw new L(k);
1515
+ }
1516
+ throw I.code === L.code ? new L(I) : new He(I);
1517
+ }
1518
+ },
1519
+ async onAccountsChanged(i) {
1520
+ var l;
1521
+ if (i.length === 0)
1522
+ this.onDisconnect();
1523
+ else if (f.emitter.listenerCount("connect")) {
1524
+ const y = (await this.getChainId()).toString();
1525
+ this.onConnect({ chainId: y }), o && await ((l = f.storage) == null ? void 0 : l.removeItem(`${this.id}.disconnected`));
1526
+ } else
1527
+ f.emitter.emit("change", {
1528
+ accounts: i.map((y) => oe(y))
1529
+ });
1530
+ },
1531
+ onChainChanged(i) {
1532
+ const l = Number(i);
1533
+ f.emitter.emit("change", { chainId: l });
1534
+ },
1535
+ async onConnect(i) {
1536
+ const l = await this.getAccounts();
1537
+ if (l.length === 0)
1538
+ return;
1539
+ const y = Number(i.chainId);
1540
+ f.emitter.emit("connect", { accounts: l, chainId: y });
1541
+ const x = await this.getProvider();
1542
+ x && (g && (x.removeListener("connect", g), g = void 0), d || (d = this.onAccountsChanged.bind(this), x.on("accountsChanged", d)), p || (p = this.onChainChanged.bind(this), x.on("chainChanged", p)), b || (b = this.onDisconnect.bind(this), x.on("disconnect", b)));
1543
+ },
1544
+ async onDisconnect(i) {
1545
+ const l = await this.getProvider();
1546
+ i && i.code === 1013 && l && (await this.getAccounts()).length || (f.emitter.emit("disconnect"), l && (p && (l.removeListener("chainChanged", p), p = void 0), b && (l.removeListener("disconnect", b), b = void 0), g || (g = this.onConnect.bind(this), l.on("connect", g))));
1547
+ }
1548
+ });
1549
+ }
1550
+ const ht = {
1551
+ coinbaseWallet: {
1552
+ id: "coinbaseWallet",
1553
+ name: "Coinbase Wallet",
1554
+ provider(t) {
1555
+ return t != null && t.coinbaseWalletExtension ? t.coinbaseWalletExtension : se(t, "isCoinbaseWallet");
1556
+ }
1557
+ },
1558
+ metaMask: {
1559
+ id: "metaMask",
1560
+ name: "MetaMask",
1561
+ provider(t) {
1562
+ return se(t, (o) => {
1563
+ if (!o.isMetaMask || o.isBraveWallet && !o._events && !o._state)
1564
+ return !1;
1565
+ const s = [
1566
+ "isApexWallet",
1567
+ "isAvalanche",
1568
+ "isBitKeep",
1569
+ "isBlockWallet",
1570
+ "isKuCoinWallet",
1571
+ "isMathWallet",
1572
+ "isOkxWallet",
1573
+ "isOKExWallet",
1574
+ "isOneInchIOSWallet",
1575
+ "isOneInchAndroidWallet",
1576
+ "isOpera",
1577
+ "isPhantom",
1578
+ "isPortal",
1579
+ "isRabby",
1580
+ "isTokenPocket",
1581
+ "isTokenary",
1582
+ "isUniswapWallet",
1583
+ "isZerion"
1584
+ ];
1585
+ for (const u of s)
1586
+ if (o[u])
1587
+ return !1;
1588
+ return !0;
1589
+ });
1590
+ }
1591
+ },
1592
+ phantom: {
1593
+ id: "phantom",
1594
+ name: "Phantom",
1595
+ provider(t) {
1596
+ var o, s;
1597
+ return (o = t == null ? void 0 : t.phantom) != null && o.ethereum ? (s = t.phantom) == null ? void 0 : s.ethereum : se(t, "isPhantom");
1598
+ }
1599
+ }
1600
+ };
1601
+ function se(t, o) {
1602
+ function s(d) {
1603
+ return typeof o == "function" ? o(d) : typeof o == "string" ? d[o] : !0;
1604
+ }
1605
+ const u = t.ethereum;
1606
+ if (u != null && u.providers)
1607
+ return u.providers.find((d) => s(d));
1608
+ if (u && s(u))
1609
+ return u;
1610
+ }
1611
+ const pt = new qr(), gt = Br({
1612
+ chains: [xe],
1613
+ connectors: [je()],
1614
+ transports: {
1615
+ [xe.id]: Nr()
1616
+ }
1617
+ });
1618
+ function wt({ children: t }) {
1619
+ return /* @__PURE__ */ r.jsx(Yr, { config: gt, children: /* @__PURE__ */ r.jsx(Vr, { client: pt, children: t }) });
1620
+ }
1621
+ export {
1622
+ xt as SwarmConnectButton,
1623
+ lt as SwarmConnectModal,
1624
+ wt as SwarmConnectProvider,
1625
+ Xr as useBeeNode,
1626
+ Qr as usePostageStamps,
1627
+ Zr as useSwarmConnect
1628
+ };