@luno-kit/ui 0.0.1

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.
package/dist/index.cjs ADDED
@@ -0,0 +1,1822 @@
1
+ 'use client'
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/index.ts
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
+ ConnectButton: () => ConnectButton,
35
+ LunoKitProvider: () => LunoKitProvider,
36
+ useLunoTheme: () => useLunoTheme
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/components/AccountDetailsModal/index.tsx
41
+ var import_react13 = require("react");
42
+ var import_react14 = require("@luno-kit/react");
43
+
44
+ // src/components/Dialog/index.tsx
45
+ var import_react = __toESM(require("react"), 1);
46
+ var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
47
+
48
+ // src/utils/cs.ts
49
+ var import_clsx = require("clsx");
50
+ var import_tailwind_merge = require("tailwind-merge");
51
+ var customTwMerge = (0, import_tailwind_merge.extendTailwindMerge)({
52
+ extend: {
53
+ classGroups: {
54
+ "font-size": [
55
+ "text-xs",
56
+ "text-sm",
57
+ "text-base",
58
+ "text-lg"
59
+ ]
60
+ }
61
+ }
62
+ });
63
+ function cs(...inputs) {
64
+ return customTwMerge((0, import_clsx.clsx)(inputs));
65
+ }
66
+
67
+ // src/utils/debounce.ts
68
+ function debounce(fn, ms) {
69
+ let timer;
70
+ return () => {
71
+ if (timer) {
72
+ clearTimeout(timer);
73
+ }
74
+ timer = setTimeout(() => {
75
+ timer = null;
76
+ fn();
77
+ }, ms);
78
+ };
79
+ }
80
+
81
+ // src/components/Dialog/index.tsx
82
+ var import_jsx_runtime = require("react/jsx-runtime");
83
+ var DialogRoot = ({
84
+ open,
85
+ onOpenChange,
86
+ children,
87
+ contentClassName,
88
+ overlayClassName
89
+ }) => {
90
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Root, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPrimitive.Portal, { children: [
91
+ import_react.default.createElement(DialogPrimitive.Overlay, {
92
+ className: cs(
93
+ "fixed inset-0 z-[100] bg-modalBackdrop luno-kit",
94
+ "data-[state=open]:[animation:overlay-in_150ms_ease-out]",
95
+ overlayClassName
96
+ )
97
+ }),
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
+ DialogPrimitive.Content,
100
+ {
101
+ className: cs(
102
+ "luno-kit font-body fixed z-[200] text-modalText text-base leading-base",
103
+ "bg-modalBackground shadow-primary focus:outline-none overflow-hidden",
104
+ "transition-all duration-200",
105
+ "rounded-t-modalMobile bottom-0 left-0 w-full",
106
+ "translate-y-0 -translate-x-0",
107
+ "data-[state=open]:[animation:slide-up_200ms_ease-out]",
108
+ "md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2",
109
+ "md:w-auto md:rounded-modal",
110
+ "md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",
111
+ contentClassName
112
+ ),
113
+ children
114
+ }
115
+ )
116
+ ] }) });
117
+ };
118
+ var DialogTitleWrapper = ({ children, className }) => import_react.default.createElement(DialogPrimitive.Title, { className: cs("font-heading", className) }, children);
119
+ var DialogCloseWrapper = ({ children, className, onClick }) => import_react.default.createElement(DialogPrimitive.Close, { className, onClick }, children);
120
+ var Dialog = DialogRoot;
121
+ var DialogClose = DialogCloseWrapper;
122
+ var DialogTitle = DialogTitleWrapper;
123
+
124
+ // src/providers/ModalContext.tsx
125
+ var import_react2 = require("react");
126
+ var import_react3 = require("@luno-kit/react");
127
+ var import_jsx_runtime2 = require("react/jsx-runtime");
128
+ function useModalVisibility() {
129
+ const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
130
+ const open = (0, import_react2.useCallback)(() => setIsOpen(true), []);
131
+ const close = (0, import_react2.useCallback)(() => setIsOpen(false), []);
132
+ return { isOpen, open, close };
133
+ }
134
+ var ModalContext = (0, import_react2.createContext)(void 0);
135
+ var ModalProvider = ({ children }) => {
136
+ const { isOpen: isConnectModalOpen, open: openConnectModal, close: closeConnectModal } = useModalVisibility();
137
+ const { isOpen: isAccountModalOpen, open: openAccountModal, close: closeAccountModal } = useModalVisibility();
138
+ const { isOpen: isChainModalOpen, open: openChainModal, close: closeChainModal } = useModalVisibility();
139
+ const connectionStatus = (0, import_react3.useStatus)();
140
+ const closeAllModals = (0, import_react2.useCallback)(() => {
141
+ closeConnectModal();
142
+ closeAccountModal();
143
+ closeChainModal();
144
+ }, [closeConnectModal, closeAccountModal, closeChainModal]);
145
+ (0, import_react2.useEffect)(() => {
146
+ if (connectionStatus === import_react3.ConnectionStatus.Disconnected) {
147
+ closeAccountModal();
148
+ closeChainModal();
149
+ }
150
+ }, [connectionStatus, closeAccountModal, closeChainModal]);
151
+ const contextValue = (0, import_react2.useMemo)(() => ({
152
+ isConnectModalOpen,
153
+ isAccountModalOpen,
154
+ isChainModalOpen,
155
+ openConnectModal: connectionStatus !== import_react3.ConnectionStatus.Connected ? openConnectModal : void 0,
156
+ closeConnectModal,
157
+ openAccountModal: connectionStatus === import_react3.ConnectionStatus.Connected ? openAccountModal : void 0,
158
+ closeAccountModal,
159
+ openChainModal: connectionStatus === import_react3.ConnectionStatus.Connected ? openChainModal : void 0,
160
+ closeChainModal,
161
+ closeAllModals
162
+ }), [
163
+ isConnectModalOpen,
164
+ openConnectModal,
165
+ closeConnectModal,
166
+ isAccountModalOpen,
167
+ openAccountModal,
168
+ closeAccountModal,
169
+ isChainModalOpen,
170
+ openChainModal,
171
+ closeChainModal,
172
+ closeAllModals,
173
+ connectionStatus
174
+ ]);
175
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ModalContext.Provider, { value: contextValue, children });
176
+ };
177
+ var useConnectModal = () => {
178
+ const context = (0, import_react2.useContext)(ModalContext);
179
+ if (!context) throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");
180
+ return {
181
+ isOpen: context.isConnectModalOpen,
182
+ open: context.openConnectModal,
183
+ close: context.closeConnectModal
184
+ };
185
+ };
186
+ var useAccountModal = () => {
187
+ const context = (0, import_react2.useContext)(ModalContext);
188
+ if (!context) throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");
189
+ return {
190
+ isOpen: context.isAccountModalOpen,
191
+ open: context.openAccountModal,
192
+ close: context.closeAccountModal
193
+ };
194
+ };
195
+ var useChainModal = () => {
196
+ const context = (0, import_react2.useContext)(ModalContext);
197
+ if (!context) throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");
198
+ return {
199
+ isOpen: context.isChainModalOpen,
200
+ open: context.openChainModal,
201
+ close: context.closeChainModal
202
+ };
203
+ };
204
+
205
+ // src/assets/icons/Arrow.tsx
206
+ var import_jsx_runtime3 = require("react/jsx-runtime");
207
+ var SvgArrow = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
208
+ "svg",
209
+ {
210
+ xmlns: "http://www.w3.org/2000/svg",
211
+ className: "arrow_svg__icon",
212
+ viewBox: "0 0 256 256",
213
+ width: "20",
214
+ height: "20",
215
+ fill: "currentColor",
216
+ ...props,
217
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z" })
218
+ }
219
+ );
220
+ var Arrow_default = SvgArrow;
221
+
222
+ // src/assets/icons/Back.tsx
223
+ var import_jsx_runtime4 = require("react/jsx-runtime");
224
+ var SvgBack = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
225
+ "svg",
226
+ {
227
+ xmlns: "http://www.w3.org/2000/svg",
228
+ width: "20",
229
+ height: "20",
230
+ fill: "currentColor",
231
+ viewBox: "0 0 256 256",
232
+ ...props,
233
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z" })
234
+ }
235
+ );
236
+ var Back_default = SvgBack;
237
+
238
+ // src/assets/icons/Close.tsx
239
+ var import_jsx_runtime5 = require("react/jsx-runtime");
240
+ var SvgClose = (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
241
+ "svg",
242
+ {
243
+ xmlns: "http://www.w3.org/2000/svg",
244
+ width: "20",
245
+ height: "20",
246
+ fill: "currentColor",
247
+ viewBox: "0 0 256 256",
248
+ ...props,
249
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z" })
250
+ }
251
+ );
252
+ var Close_default = SvgClose;
253
+
254
+ // src/assets/icons/Copy.tsx
255
+ var import_jsx_runtime6 = require("react/jsx-runtime");
256
+ var SvgCopy = (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
257
+ "svg",
258
+ {
259
+ xmlns: "http://www.w3.org/2000/svg",
260
+ className: "copy_svg__icon",
261
+ width: "16",
262
+ height: "16",
263
+ fill: "currentColor",
264
+ viewBox: "0 0 256 256",
265
+ ...props,
266
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z" })
267
+ }
268
+ );
269
+ var Copy_default = SvgCopy;
270
+
271
+ // src/assets/icons/Disconnect.tsx
272
+ var import_jsx_runtime7 = require("react/jsx-runtime");
273
+ var SvgDisconnect = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
274
+ "svg",
275
+ {
276
+ xmlns: "http://www.w3.org/2000/svg",
277
+ fill: "currentColor",
278
+ viewBox: "0 0 256 256",
279
+ width: "20",
280
+ height: "20",
281
+ ...props,
282
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z" })
283
+ }
284
+ );
285
+ var Disconnect_default = SvgDisconnect;
286
+
287
+ // src/assets/icons/List.tsx
288
+ var import_jsx_runtime8 = require("react/jsx-runtime");
289
+ var SvgList = (props) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
290
+ "svg",
291
+ {
292
+ xmlns: "http://www.w3.org/2000/svg",
293
+ className: "list_svg__icon",
294
+ viewBox: "0 0 256 256",
295
+ width: "20",
296
+ height: "20",
297
+ fill: "currentColor",
298
+ ...props,
299
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M232,48V88a8,8,0,0,1-16,0V56H184a8,8,0,0,1,0-16h40A8,8,0,0,1,232,48ZM72,200H40V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16Zm152-40a8,8,0,0,0-8,8v32H184a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,224,160ZM32,96a8,8,0,0,0,8-8V56H72a8,8,0,0,0,0-16H32a8,8,0,0,0-8,8V88A8,8,0,0,0,32,96ZM188,167l-56,32a8,8,0,0,1-7.94,0L68,167A8,8,0,0,1,64,160V96a8,8,0,0,1,4-7l56-32a8,8,0,0,1,7.94,0l56,32a8,8,0,0,1,4,7v64A8,8,0,0,1,188,167ZM88.12,96,128,118.79,167.88,96,128,73.21ZM80,155.36l40,22.85V132.64L80,109.79Zm96,0V109.79l-40,22.85v45.57Z" })
300
+ }
301
+ );
302
+ var List_default = SvgList;
303
+
304
+ // src/assets/icons/Loading.tsx
305
+ var import_jsx_runtime9 = require("react/jsx-runtime");
306
+ var SvgLoading = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
307
+ "svg",
308
+ {
309
+ xmlns: "http://www.w3.org/2000/svg",
310
+ width: "20",
311
+ height: "20",
312
+ fill: "currentColor",
313
+ className: "loading_svg__icon",
314
+ viewBox: "0 0 256 256",
315
+ ...props,
316
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z" })
317
+ }
318
+ );
319
+ var Loading_default = SvgLoading;
320
+
321
+ // src/assets/icons/Success.tsx
322
+ var import_jsx_runtime10 = require("react/jsx-runtime");
323
+ var SvgSuccess = (props) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
324
+ "svg",
325
+ {
326
+ xmlns: "http://www.w3.org/2000/svg",
327
+ className: "success_svg__icon",
328
+ viewBox: "0 0 256 256",
329
+ width: "20",
330
+ height: "20",
331
+ fill: "currentColor",
332
+ ...props,
333
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z" })
334
+ }
335
+ );
336
+ var Success_default = SvgSuccess;
337
+
338
+ // src/assets/icons/Switch.tsx
339
+ var import_jsx_runtime11 = require("react/jsx-runtime");
340
+ var SvgSwitch = (props) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
341
+ "svg",
342
+ {
343
+ xmlns: "http://www.w3.org/2000/svg",
344
+ width: "20",
345
+ height: "20",
346
+ className: "switch_svg__icon",
347
+ viewBox: "0 0 256 256",
348
+ fill: "currentColor",
349
+ ...props,
350
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M253.66,133.66l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L216,132.69V128A88,88,0,0,0,56.49,76.67a8,8,0,0,1-13-9.34A104,104,0,0,1,232,128v4.69l10.34-10.35a8,8,0,0,1,11.32,11.32Zm-41.18,55A104,104,0,0,1,24,128v-4.69L13.66,133.66A8,8,0,0,1,2.34,122.34l24-24a8,8,0,0,1,11.32,0l24,24a8,8,0,0,1-11.32,11.32L40,123.31V128a87.62,87.62,0,0,0,22.24,58.41A79.66,79.66,0,0,1,98.3,157.66a48,48,0,1,1,59.4,0,79.59,79.59,0,0,1,36.08,28.78,89.68,89.68,0,0,0,5.71-7.11,8,8,0,0,1,13,9.34ZM128,152a32,32,0,1,0-32-32A32,32,0,0,0,128,152Zm0,64a88.2,88.2,0,0,0,53.92-18.49,64,64,0,0,0-107.84,0A87.57,87.57,0,0,0,128,216Z" })
351
+ }
352
+ );
353
+ var Switch_default = SvgSwitch;
354
+
355
+ // src/components/AccountDetailsModal/MainView.tsx
356
+ var import_react4 = require("react");
357
+
358
+ // src/components/ChainIcon/index.tsx
359
+ var import_jsx_runtime12 = require("react/jsx-runtime");
360
+ var ChainIcon = ({
361
+ chainIconUrl,
362
+ chainName,
363
+ className
364
+ }) => {
365
+ if (chainIconUrl) {
366
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
367
+ "img",
368
+ {
369
+ src: chainIconUrl,
370
+ alt: chainName || "Chain icon",
371
+ className: cs("w-full h-full object-cover rounded-full", className)
372
+ }
373
+ );
374
+ }
375
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cs(
376
+ "w-full h-full bg-gray-500 text-modalText font-semibold",
377
+ "flex items-center justify-center rounded-full",
378
+ className
379
+ ), children: chainName ? chainName.charAt(0).toUpperCase() : "C" });
380
+ };
381
+
382
+ // src/components/AccountDetailsModal/MainView.tsx
383
+ var import_react5 = require("@luno-kit/react");
384
+ var import_jsx_runtime13 = require("react/jsx-runtime");
385
+ var MainView = ({
386
+ onViewChange,
387
+ onModalClose
388
+ }) => {
389
+ const { address } = (0, import_react5.useAccount)();
390
+ const { chain } = (0, import_react5.useChain)();
391
+ const { disconnectAsync } = (0, import_react5.useDisconnect)();
392
+ const items = (0, import_react4.useMemo)(() => {
393
+ return [
394
+ {
395
+ key: "Chain Name",
396
+ content: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-stretch w-full justify-between", children: [
397
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
398
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
399
+ ChainIcon,
400
+ {
401
+ className: "w-[20px] h-[20px]",
402
+ chainIconUrl: chain?.chainIconUrl,
403
+ chainName: chain?.name
404
+ }
405
+ ),
406
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-base text-modalText", children: chain?.name || "Polkadot" })
407
+ ] }),
408
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
409
+ "div",
410
+ {
411
+ className: "flex items-center justify-center",
412
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Arrow_default, { className: "w-[16px] h-[16px] " })
413
+ }
414
+ )
415
+ ] }),
416
+ onClick: () => onViewChange("switchChain" /* switchChain */)
417
+ },
418
+ {
419
+ key: "View on Explorer",
420
+ content: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
421
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(List_default, {}),
422
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-base text-accountActionItemText", children: "View on Explorer" })
423
+ ] }),
424
+ onClick: () => window.open((0, import_react5.getExplorerUrl)(chain?.blockExplorers?.default?.url, address, "address"))
425
+ },
426
+ {
427
+ key: "Switch Account",
428
+ content: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
429
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Switch_default, {}),
430
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-base text-accountActionItemText", children: "Switch Account" })
431
+ ] }),
432
+ onClick: () => onViewChange("switchAccount" /* switchAccount */)
433
+ }
434
+ ];
435
+ }, [onViewChange, chain, address]);
436
+ const handleDisconnect = async () => {
437
+ await disconnectAsync();
438
+ onModalClose();
439
+ };
440
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col items-center gap-3 w-full", children: [
441
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-col gap-1.5 w-full px-4", children: items.map((i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectItem, { onClick: i.onClick, children: i.content }, i.key)) }),
442
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w-full mx-[-100px] h-[1px] bg-cutLine" }),
443
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w-full px-4 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(SelectItem, { onClick: handleDisconnect, children: [
444
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Disconnect_default, {}),
445
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-base text-accountActionItemText", children: "Disconnect" })
446
+ ] }) })
447
+ ] });
448
+ };
449
+ var SelectItem = ({ children, onClick }) => {
450
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
451
+ "button",
452
+ {
453
+ type: "button",
454
+ onClick: () => onClick?.(),
455
+ className: cs(
456
+ "w-full p-3.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium",
457
+ "bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover",
458
+ "transition-colors duration-200",
459
+ onClick ? "cursor-pointer" : "cursor-auto"
460
+ ),
461
+ "aria-label": typeof children === "string" ? children : void 0,
462
+ children
463
+ }
464
+ );
465
+ };
466
+
467
+ // src/components/AccountDetailsModal/SwitchAccountView.tsx
468
+ var import_react6 = __toESM(require("react"), 1);
469
+ var import_react7 = require("@luno-kit/react");
470
+ var import_react8 = require("@luno-kit/react");
471
+ var import_jsx_runtime14 = require("react/jsx-runtime");
472
+ var SwitchAccountView = ({ onBack }) => {
473
+ const { accounts, selectAccount } = (0, import_react7.useAccounts)();
474
+ const { address: currentAddress } = (0, import_react7.useAccount)();
475
+ const _selectAccount = (0, import_react6.useCallback)((acc) => {
476
+ selectAccount(acc);
477
+ onBack();
478
+ }, [onBack]);
479
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0", children: accounts.map((acc) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
480
+ AccountItem,
481
+ {
482
+ account: acc,
483
+ isSelected: acc.address === currentAddress,
484
+ selectAccount: _selectAccount
485
+ },
486
+ acc.address
487
+ )) });
488
+ };
489
+ SwitchAccountView.title = "Switch Accounts";
490
+ var AccountItem = import_react6.default.memo(({
491
+ isSelected,
492
+ account,
493
+ selectAccount
494
+ }) => {
495
+ const { chain } = (0, import_react7.useChain)();
496
+ const address = account.address;
497
+ const { data: balance } = (0, import_react7.useBalance)({ address });
498
+ const connector = (0, import_react7.useActiveConnector)();
499
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
500
+ "button",
501
+ {
502
+ type: "button",
503
+ onClick: () => selectAccount(account),
504
+ className: cs(
505
+ "px-3.5 py-2.5 w-full rounded-accountSelectItem border-none",
506
+ "bg-accountSelectItemBackground",
507
+ "text-left flex items-center justify-between gap-2",
508
+ "transition-colors duration-200",
509
+ isSelected ? "cursor-auto" : "cursor-pointer hover:bg-accountSelectItemBackgroundHover"
510
+ ),
511
+ "aria-label": account.name || address,
512
+ disabled: isSelected,
513
+ children: [
514
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
515
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "shrink-0 w-[24px] h-[24px] bg-pink-500 rounded-full flex items-center justify-center", children: connector?.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: connector?.icon, alt: "luno account" }) }),
516
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col items-start", children: [
517
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-sm leading-sm text-accountSelectItemText", children: account.name || (0, import_react8.formatAddress)(address) }),
518
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-xs text-modalTextSecondary font-medium", children: balance === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "animate-pulse rounded w-[60px] h-[18px] bg-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
519
+ balance?.formattedTransferable || "0.00",
520
+ " ",
521
+ chain?.nativeCurrency?.symbol || "DOT"
522
+ ] }) })
523
+ ] })
524
+ ] }),
525
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "rounded-full bg-accentColor w-[10px] h-[10px]" }) })
526
+ ]
527
+ }
528
+ );
529
+ });
530
+
531
+ // src/components/ChainList/index.tsx
532
+ var import_react9 = __toESM(require("react"), 1);
533
+ var import_react10 = require("@luno-kit/react");
534
+ var import_jsx_runtime15 = require("react/jsx-runtime");
535
+ var FILTER_TABS = [
536
+ { key: "All" /* all */, label: "All" /* all */ },
537
+ { key: "Mainnets" /* mainnets */, label: "Mainnets" /* mainnets */ },
538
+ { key: "Testnets" /* testnets */, label: "Testnets" /* testnets */ }
539
+ ];
540
+ var ChainList = ({ onChainSwitched }) => {
541
+ const { chain: currentChain } = (0, import_react10.useChain)();
542
+ const chains = (0, import_react10.useChains)();
543
+ const { switchChainAsync } = (0, import_react10.useSwitchChain)();
544
+ const { isApiReady, apiError } = (0, import_react10.useApi)();
545
+ const [activeFilter, setActiveFilter] = (0, import_react9.useState)("All" /* all */);
546
+ const [switchingChain, setSwitchingChain] = (0, import_react9.useState)(null);
547
+ const filteredChains = (0, import_react9.useMemo)(() => {
548
+ switch (activeFilter) {
549
+ case "Mainnets" /* mainnets */:
550
+ return chains.filter((chain) => !chain.testnet);
551
+ case "Testnets" /* testnets */:
552
+ return chains.filter((chain) => chain.testnet);
553
+ case "All" /* all */:
554
+ default:
555
+ return chains;
556
+ }
557
+ }, [chains, activeFilter]);
558
+ const handleChainSelect = async (chain) => {
559
+ if (chain.genesisHash === currentChain?.genesisHash) return;
560
+ if (!isApiReady && !apiError) return;
561
+ setSwitchingChain(chain.genesisHash);
562
+ try {
563
+ await switchChainAsync({ chainId: chain.genesisHash });
564
+ onChainSwitched?.(chain);
565
+ } catch (error) {
566
+ console.error("Failed to switch chain:", error);
567
+ } finally {
568
+ setSwitchingChain(null);
569
+ }
570
+ };
571
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
572
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center gap-1.5 w-full", children: FILTER_TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
573
+ "button",
574
+ {
575
+ onClick: () => setActiveFilter(tab.key),
576
+ className: cs(
577
+ "px-3.5 flex items-center justify-center cursor-pointer min-w-[48px] min-h-[24px] rounded-networkSelectItem text-[12px] leading-[16px] font-medium transition-colors",
578
+ activeFilter === tab.key ? "bg-navigationButtonBackground text-modalText" : "bg-transparent text-modalTextSecondary hover:text-modalText"
579
+ ),
580
+ children: tab.label
581
+ },
582
+ tab.key
583
+ )) }),
584
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-col gap-1.5 overflow-y-auto custom-scrollbar max-h-[450px]", children: filteredChains.map((chain) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
585
+ ChainItem,
586
+ {
587
+ chain,
588
+ isSelected: chain.genesisHash === currentChain?.genesisHash,
589
+ onSelect: handleChainSelect,
590
+ isLoading: (switchingChain === chain.genesisHash || !isApiReady) && !apiError
591
+ },
592
+ chain.genesisHash
593
+ )) }),
594
+ filteredChains.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "text-modalTextSecondary text-xs", children: [
595
+ "No ",
596
+ activeFilter === "All" /* all */ ? "chains" : activeFilter.toLowerCase(),
597
+ " available"
598
+ ] }) })
599
+ ] });
600
+ };
601
+ var ChainItem = import_react9.default.memo(({
602
+ chain,
603
+ isSelected,
604
+ isLoading,
605
+ onSelect
606
+ }) => {
607
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
608
+ "button",
609
+ {
610
+ onClick: () => onSelect(chain),
611
+ disabled: isSelected || isLoading,
612
+ className: cs(
613
+ "flex items-center justify-between p-2 rounded-sm",
614
+ "bg-networkSelectItemBackground",
615
+ "transition-colors duration-200",
616
+ isSelected || isLoading ? "cursor-default" : "cursor-pointer hover:bg-networkSelectItemBackgroundHover",
617
+ isLoading && "opacity-80"
618
+ ),
619
+ children: [
620
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
621
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
622
+ ChainIcon,
623
+ {
624
+ className: "w-[24px] bg-modal-bg h-[24px] flex items-center justify-center",
625
+ chainIconUrl: chain?.chainIconUrl,
626
+ chainName: chain?.name
627
+ }
628
+ ),
629
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "font-medium text-base text-modalText", children: chain.name }) })
630
+ ] }),
631
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center h-[20px]", children: isSelected ? isLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
632
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-accentColor text-xs leading-xs mr-1.5", children: "Switching" }),
633
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
634
+ Loading_default,
635
+ {
636
+ className: "text-accentColor animate-[spin_2s_linear_infinite]",
637
+ width: "15px",
638
+ height: "15px"
639
+ }
640
+ )
641
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "status-dot-container", children: [
642
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ping-animation" }),
643
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "status-dot" })
644
+ ] }) : null })
645
+ ]
646
+ }
647
+ );
648
+ });
649
+
650
+ // src/components/AccountDetailsModal/SwitchChainView.tsx
651
+ var import_jsx_runtime16 = require("react/jsx-runtime");
652
+ var SwitchChainView = ({ onBack }) => {
653
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-col gap-3.5 p-4 pt-0", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChainList, {}) });
654
+ };
655
+ SwitchChainView.title = "Select Networks";
656
+
657
+ // src/components/Copy/index.tsx
658
+ var import_react11 = require("react");
659
+ var import_jsx_runtime17 = require("react/jsx-runtime");
660
+ var Copy = ({ copyText, label, className = "" }) => {
661
+ const [isCopied, setIsCopied] = (0, import_react11.useState)(false);
662
+ const copyToClipboard = (0, import_react11.useCallback)(async (text) => {
663
+ try {
664
+ if (navigator.clipboard && navigator.clipboard.writeText) {
665
+ await navigator.clipboard.writeText(text);
666
+ setIsCopied(true);
667
+ setTimeout(() => setIsCopied(false), 2e3);
668
+ return true;
669
+ }
670
+ return false;
671
+ } catch (err) {
672
+ console.error("Copy failed:", err);
673
+ return false;
674
+ }
675
+ }, []);
676
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
677
+ "button",
678
+ {
679
+ type: "button",
680
+ className: cs("cursor-pointer bg-transparent border-none p-0 m-0 inline-flex items-center justify-center gap-1", className),
681
+ onClick: () => !isCopied && copyText && copyToClipboard(copyText),
682
+ "aria-label": "Copy address to clipboard",
683
+ disabled: isCopied,
684
+ children: [
685
+ isCopied ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Success_default, { className: "text-accentColor", width: 16, height: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Copy_default, { width: 16, height: 16 }),
686
+ label
687
+ ]
688
+ }
689
+ );
690
+ };
691
+
692
+ // src/components/AccountDetailsModal/index.tsx
693
+ var import_react15 = require("@luno-kit/react");
694
+
695
+ // src/hooks/useAnimatedViews.ts
696
+ var import_react12 = require("react");
697
+ function useAnimatedViews({
698
+ initialView,
699
+ animationDuration = 200,
700
+ animationEasing = "ease-out"
701
+ }) {
702
+ const [currentView, setCurrentView] = (0, import_react12.useState)(initialView);
703
+ const [isAnimating, setIsAnimating] = (0, import_react12.useState)(false);
704
+ const containerRef = (0, import_react12.useRef)(null);
705
+ const currentViewRef = (0, import_react12.useRef)(null);
706
+ const handleViewChange = (0, import_react12.useCallback)((view) => {
707
+ if (view === currentView || isAnimating) return;
708
+ setIsAnimating(true);
709
+ if (!containerRef.current) {
710
+ setCurrentView(view);
711
+ setIsAnimating(false);
712
+ return;
713
+ }
714
+ const container = containerRef.current;
715
+ const currentHeight = container.offsetHeight;
716
+ setCurrentView(view);
717
+ requestAnimationFrame(() => {
718
+ if (!container || !currentViewRef.current) {
719
+ setIsAnimating(false);
720
+ return;
721
+ }
722
+ const newHeight = currentViewRef.current.offsetHeight;
723
+ container.animate([
724
+ { height: currentHeight + "px" },
725
+ { height: newHeight + "px" }
726
+ ], {
727
+ duration: animationDuration,
728
+ easing: animationEasing,
729
+ fill: "forwards"
730
+ }).addEventListener("finish", () => {
731
+ setIsAnimating(false);
732
+ });
733
+ });
734
+ }, [currentView, isAnimating, animationDuration, animationEasing]);
735
+ const resetView = (0, import_react12.useCallback)(() => {
736
+ setCurrentView(initialView);
737
+ setIsAnimating(false);
738
+ }, [initialView]);
739
+ return {
740
+ currentView,
741
+ isAnimating,
742
+ containerRef,
743
+ currentViewRef,
744
+ handleViewChange,
745
+ resetView
746
+ };
747
+ }
748
+
749
+ // src/components/AccountDetailsModal/index.tsx
750
+ var import_jsx_runtime18 = require("react/jsx-runtime");
751
+ var AccountDetailsModal = () => {
752
+ const { isOpen, close } = useAccountModal();
753
+ const { address } = (0, import_react14.useAccount)();
754
+ const { chain } = (0, import_react14.useChain)();
755
+ const { data: balance } = (0, import_react14.useBalance)({ address });
756
+ const activeConnector = (0, import_react14.useActiveConnector)();
757
+ const {
758
+ currentView,
759
+ containerRef,
760
+ currentViewRef,
761
+ handleViewChange,
762
+ resetView
763
+ } = useAnimatedViews({ initialView: "main" /* main */ });
764
+ const handleModalClose = (0, import_react13.useCallback)(() => {
765
+ close();
766
+ resetView();
767
+ }, [close]);
768
+ const viewTitle = (0, import_react13.useMemo)(() => {
769
+ if (currentView === "switchAccount" /* switchAccount */) return "Switch Account";
770
+ if (currentView === "switchChain" /* switchChain */) return SwitchChainView.title;
771
+ return null;
772
+ }, [currentView]);
773
+ const viewComponents = (0, import_react13.useMemo)(() => ({
774
+ ["main" /* main */]: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
775
+ MainView,
776
+ {
777
+ onViewChange: handleViewChange,
778
+ onModalClose: handleModalClose
779
+ }
780
+ ),
781
+ ["switchAccount" /* switchAccount */]: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SwitchAccountView, { onBack: () => handleViewChange("main" /* main */) }),
782
+ ["switchChain" /* switchChain */]: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SwitchChainView, { onBack: () => handleViewChange("main" /* main */) })
783
+ }), [handleViewChange, handleModalClose]);
784
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
785
+ Dialog,
786
+ {
787
+ open: isOpen,
788
+ onOpenChange: handleModalClose,
789
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cs(
790
+ "flex flex-col w-full md:w-[360px] max-h-[500px] text-modalText",
791
+ "bg-modalBackground shadow-modal",
792
+ currentView === "main" /* main */ ? "gap-6" : "gap-3.5"
793
+ ), children: [
794
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-stretch justify-between w-full px-4 pt-4", children: [
795
+ currentView === "main" /* main */ ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-3", children: [
796
+ activeConnector?.icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-center w-[55px] h-[55px]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: activeConnector.icon, alt: "" }) }),
797
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col items-start gap-2 w-full", children: [
798
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { className: "sr-only", children: "Account Details" }),
799
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1.5 w-full", children: [
800
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-base text-modalText font-semibold", children: (0, import_react15.formatAddress)(address) }),
801
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Copy, { copyText: address })
802
+ ] }),
803
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-sm text-modalTextSecondary font-medium min-h-[20px]", children: balance === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "animate-pulse rounded w-[80px] h-[20px] bg-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
804
+ balance?.formattedTransferable || "0.00",
805
+ " ",
806
+ chain?.nativeCurrency?.symbol || "DOT"
807
+ ] }) })
808
+ ] })
809
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
810
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
811
+ "button",
812
+ {
813
+ className: "flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",
814
+ onClick: () => handleViewChange("main" /* main */),
815
+ "aria-label": "Back",
816
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Back_default, {})
817
+ }
818
+ ),
819
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
820
+ DialogTitle,
821
+ {
822
+ className: "text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",
823
+ children: viewTitle
824
+ }
825
+ )
826
+ ] }),
827
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogClose, { className: "z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Close_default, {}) })
828
+ ] }),
829
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
830
+ "div",
831
+ {
832
+ ref: containerRef,
833
+ className: "relative overflow-hidden",
834
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: currentViewRef, children: viewComponents[currentView] })
835
+ }
836
+ )
837
+ ] })
838
+ }
839
+ );
840
+ };
841
+
842
+ // src/components/ChainModal/index.tsx
843
+ var import_jsx_runtime19 = require("react/jsx-runtime");
844
+ var ChainModal = () => {
845
+ const { isOpen, close } = useChainModal();
846
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog, { open: isOpen, onOpenChange: (open) => !open && close(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col w-full md:w-[360px] max-h-[500px] p-4 gap-3.5 text-modalText", children: [
847
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
848
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-[30px]" }),
849
+ " ",
850
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogTitle, { className: "text-lg leading-lg text-modalText font-semibold transition-opacity duration-300", children: "Select Network" }),
851
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogClose, { className: "z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Close_default, {}) })
852
+ ] }),
853
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChainList, {})
854
+ ] }) });
855
+ };
856
+
857
+ // src/components/ConnectModal/index.tsx
858
+ var import_react22 = require("react");
859
+ var import_react23 = require("@luno-kit/react");
860
+
861
+ // src/hooks/useConnectButton.ts
862
+ var import_react16 = require("@luno-kit/react");
863
+ function useLunoWallet() {
864
+ const connectionStatus = (0, import_react16.useStatus)();
865
+ const { account, address } = (0, import_react16.useAccount)();
866
+ const { chain: currentChain } = (0, import_react16.useChain)();
867
+ const configuredChains = (0, import_react16.useChains)();
868
+ const { data: balance } = (0, import_react16.useBalance)({ address });
869
+ const activeConnector = (0, import_react16.useActiveConnector)();
870
+ const { open: openConnectModal, isOpen: isConnectModalOpen } = useConnectModal();
871
+ const { open: openAccountModal, isOpen: isAccountModalOpen } = useAccountModal();
872
+ const { open: openChainModal, isOpen: isChainModalOpen } = useChainModal();
873
+ const isConnecting = connectionStatus === import_react16.ConnectionStatus.Connecting;
874
+ const isConnected = connectionStatus === import_react16.ConnectionStatus.Connected;
875
+ const isDisconnected = connectionStatus === import_react16.ConnectionStatus.Disconnected || connectionStatus === import_react16.ConnectionStatus.Disconnecting;
876
+ const isChainSupported = !!currentChain && configuredChains.some((c) => c.genesisHash.toLowerCase() === currentChain.genesisHash.toLowerCase());
877
+ return {
878
+ activeConnector,
879
+ connectionStatus,
880
+ isConnected,
881
+ isDisconnected,
882
+ isConnecting,
883
+ account,
884
+ address,
885
+ displayAddress: (0, import_react16.formatAddress)(address),
886
+ currentChain,
887
+ configuredChains,
888
+ isChainSupported,
889
+ chainIconUrl: currentChain?.chainIconUrl,
890
+ chainName: currentChain?.name,
891
+ balance,
892
+ openConnectModal,
893
+ openAccountModal,
894
+ openChainModal,
895
+ isConnectModalOpen,
896
+ isAccountModalOpen,
897
+ isChainModalOpen
898
+ };
899
+ }
900
+
901
+ // src/hooks/useWindowSize.ts
902
+ var import_react17 = require("react");
903
+ var useWindowSize = () => {
904
+ const [windowSize, setWindowSize] = (0, import_react17.useState)({
905
+ height: void 0,
906
+ width: void 0
907
+ });
908
+ (0, import_react17.useEffect)(() => {
909
+ const handleResize = debounce(() => {
910
+ setWindowSize({
911
+ height: window.innerHeight,
912
+ width: window.innerWidth
913
+ });
914
+ }, 500);
915
+ window.addEventListener("resize", handleResize);
916
+ handleResize();
917
+ return () => window.removeEventListener("resize", handleResize);
918
+ }, []);
919
+ return windowSize;
920
+ };
921
+
922
+ // src/components/ConnectModal/WalletView.tsx
923
+ var import_react19 = __toESM(require("react"), 1);
924
+
925
+ // src/components/QRCode/index.tsx
926
+ var import_cuer = require("cuer");
927
+ var import_jsx_runtime20 = require("react/jsx-runtime");
928
+ var QRCode = ({
929
+ logoBackground,
930
+ uri,
931
+ size
932
+ }) => {
933
+ if (!uri) {
934
+ const QR_GRID_SIZE = 57;
935
+ const FINDER_SIZE_WITH_MARGIN = 8;
936
+ const ARENA_GRID_SIZE = Math.floor(QR_GRID_SIZE / 4);
937
+ const cellSize = size / QR_GRID_SIZE;
938
+ const arenaSize = ARENA_GRID_SIZE * cellSize;
939
+ const arenaStart = Math.floor(QR_GRID_SIZE / 2 - ARENA_GRID_SIZE / 2);
940
+ const arenaEnd = arenaStart + ARENA_GRID_SIZE;
941
+ const generateSkeletonDots = () => {
942
+ const dots = [];
943
+ for (let i = 0; i < QR_GRID_SIZE; i++) {
944
+ for (let j = 0; j < QR_GRID_SIZE; j++) {
945
+ if (i >= arenaStart && i <= arenaEnd && j >= arenaStart && j <= arenaEnd) continue;
946
+ const isInFinder = i < FINDER_SIZE_WITH_MARGIN && j < FINDER_SIZE_WITH_MARGIN || i < FINDER_SIZE_WITH_MARGIN && j >= QR_GRID_SIZE - FINDER_SIZE_WITH_MARGIN || i >= QR_GRID_SIZE - FINDER_SIZE_WITH_MARGIN && j < FINDER_SIZE_WITH_MARGIN;
947
+ if (isInFinder) continue;
948
+ const cx = j + 0.5;
949
+ const cy = i + 0.5;
950
+ dots.push(
951
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
952
+ "rect",
953
+ {
954
+ x: cx - 0.4,
955
+ y: cy - 0.4,
956
+ width: 0.8,
957
+ height: 0.8,
958
+ rx: 0.4,
959
+ fill: "var(--color-walletSelectItemBackground)"
960
+ },
961
+ `${i}-${j}`
962
+ )
963
+ );
964
+ }
965
+ }
966
+ return dots;
967
+ };
968
+ const renderFinderPattern = ({ position }) => {
969
+ const finderSize = 7 * cellSize;
970
+ const positionStyles = {
971
+ "top-left": { top: 0, left: 0 },
972
+ "top-right": { top: 0, right: 0 },
973
+ "bottom-left": { bottom: 0, left: 0 }
974
+ };
975
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
976
+ "div",
977
+ {
978
+ className: "absolute z-[4]",
979
+ style: {
980
+ width: `${finderSize}px`,
981
+ height: `${finderSize}px`,
982
+ ...positionStyles[position]
983
+ },
984
+ children: [
985
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
986
+ "div",
987
+ {
988
+ className: "absolute inset-0",
989
+ style: {
990
+ borderRadius: `${2 * cellSize}px`,
991
+ border: `${cellSize}px solid var(--color-walletSelectItemBackground)`
992
+ }
993
+ }
994
+ ),
995
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
996
+ "div",
997
+ {
998
+ className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
999
+ style: {
1000
+ width: `${3 * cellSize}px`,
1001
+ height: `${3 * cellSize}px`,
1002
+ borderRadius: `${0.5 * cellSize}px`,
1003
+ backgroundColor: "var(--color-walletSelectItemBackground)"
1004
+ }
1005
+ }
1006
+ )
1007
+ ]
1008
+ }
1009
+ );
1010
+ };
1011
+ const renderArenaLogo = () => {
1012
+ const logoStart = Math.ceil(QR_GRID_SIZE / 2 - ARENA_GRID_SIZE / 2) * cellSize;
1013
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1014
+ "div",
1015
+ {
1016
+ className: "absolute z-[4] flex items-center justify-center box-border",
1017
+ style: {
1018
+ width: `${arenaSize}px`,
1019
+ height: `${arenaSize}px`,
1020
+ left: `${logoStart}px`,
1021
+ top: `${logoStart}px`,
1022
+ borderRadius: `${cellSize}px`,
1023
+ padding: `${cellSize / 2}px`
1024
+ },
1025
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1026
+ "img",
1027
+ {
1028
+ src: logoBackground,
1029
+ alt: "QR Code Logo",
1030
+ className: "h-full w-full object-cover",
1031
+ style: {
1032
+ borderRadius: `${cellSize}px`
1033
+ }
1034
+ }
1035
+ )
1036
+ }
1037
+ );
1038
+ };
1039
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1040
+ "div",
1041
+ {
1042
+ className: "relative overflow-hidden flex items-center justify-center",
1043
+ style: {
1044
+ width: size,
1045
+ height: size,
1046
+ borderRadius: `${2 * cellSize}px`
1047
+ },
1048
+ children: [
1049
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1050
+ "svg",
1051
+ {
1052
+ className: "absolute inset-0 z-[3]",
1053
+ width: size,
1054
+ height: size,
1055
+ viewBox: `0 0 ${QR_GRID_SIZE} ${QR_GRID_SIZE}`,
1056
+ children: generateSkeletonDots()
1057
+ }
1058
+ ),
1059
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1060
+ "div",
1061
+ {
1062
+ className: "absolute inset-0 z-[100]",
1063
+ style: {
1064
+ background: "linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",
1065
+ backgroundSize: "200% 100%",
1066
+ transform: "scale(1.5) rotate(45deg)",
1067
+ animation: "shimmer 1000ms linear infinite both"
1068
+ }
1069
+ }
1070
+ ),
1071
+ renderFinderPattern({ position: "top-left" }),
1072
+ renderFinderPattern({ position: "top-right" }),
1073
+ renderFinderPattern({ position: "bottom-left" }),
1074
+ logoBackground && renderArenaLogo()
1075
+ ]
1076
+ }
1077
+ );
1078
+ }
1079
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_cuer.Cuer, { arena: logoBackground, value: uri });
1080
+ };
1081
+
1082
+ // src/components/ConnectButton/index.tsx
1083
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1084
+ var transitionClassName = "transition-transform transition-[125] hover:scale-[1.03] transition-ease";
1085
+ var ConnectButton = ({
1086
+ className,
1087
+ label = "Connect Wallet",
1088
+ accountStatus = "full",
1089
+ chainStatus = "full",
1090
+ showBalance = true
1091
+ }) => {
1092
+ const {
1093
+ isConnected,
1094
+ isDisconnected,
1095
+ displayAddress,
1096
+ balance,
1097
+ openConnectModal,
1098
+ openAccountModal,
1099
+ openChainModal,
1100
+ chainIconUrl,
1101
+ chainName,
1102
+ currentChain,
1103
+ activeConnector
1104
+ } = useLunoWallet();
1105
+ const { width: windowWidth } = useWindowSize();
1106
+ const isLargeWindow = windowWidth && windowWidth > 768;
1107
+ if (isDisconnected || !isConnected || !activeConnector) {
1108
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1109
+ "button",
1110
+ {
1111
+ type: "button",
1112
+ onClick: () => openConnectModal?.(),
1113
+ className: cs(
1114
+ "cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none",
1115
+ "text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]",
1116
+ "rounded-connectButton",
1117
+ transitionClassName,
1118
+ "px-3.5 text-base leading-base min-h-[40px]",
1119
+ className
1120
+ ),
1121
+ children: label
1122
+ }
1123
+ );
1124
+ }
1125
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cs("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3", className), children: [
1126
+ chainStatus !== "none" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1127
+ "button",
1128
+ {
1129
+ type: "button",
1130
+ onClick: () => openChainModal?.(),
1131
+ className: cs(
1132
+ "flex items-center rounded-currentNetworkButton cursor-pointer",
1133
+ "bg-currentNetworkButtonBackground shadow-button",
1134
+ "py-2 px-2.5 gap-1.5",
1135
+ transitionClassName
1136
+ ),
1137
+ "aria-label": "Switch chain",
1138
+ children: [
1139
+ chainStatus === "full" || chainStatus === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChainIcon, { chainIconUrl, chainName, className: "w-[24px] h-[24px]" }) : null,
1140
+ (chainStatus === "full" || chainStatus === "name") && isLargeWindow && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: currentChain?.name || "Unknown Chain" })
1141
+ ]
1142
+ }
1143
+ ),
1144
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1145
+ "button",
1146
+ {
1147
+ type: "button",
1148
+ onClick: () => openAccountModal?.(),
1149
+ className: cs(
1150
+ "flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",
1151
+ transitionClassName
1152
+ ),
1153
+ "aria-label": "Open account modal",
1154
+ children: [
1155
+ showBalance && isLargeWindow && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "p-2 pl-3", children: balance === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "", children: [
1156
+ balance?.formattedTransferable || balance?.formattedTotal || 0,
1157
+ " ",
1158
+ currentChain?.nativeCurrency?.symbol || ""
1159
+ ] }) }),
1160
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cs(
1161
+ "flex items-center bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",
1162
+ showBalance && isLargeWindow ? "bg-connectButtonInnerBackground py-1.5 px-2" : "bg-connectButtonBackground py-2 px-2.5"
1163
+ ), children: [
1164
+ accountStatus === "full" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-[24px] h-[24px]", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { src: activeConnector.icon, alt: "luno" }) }),
1165
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1166
+ "span",
1167
+ {
1168
+ "aria-label": "Wallet icon placeholder",
1169
+ className: "",
1170
+ children: displayAddress
1171
+ }
1172
+ )
1173
+ ] })
1174
+ ]
1175
+ }
1176
+ )
1177
+ ] });
1178
+ };
1179
+
1180
+ // src/components/SpiralAnimation/index.tsx
1181
+ var import_react18 = require("react");
1182
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1183
+ var SpiralAnimation = ({
1184
+ size = 160,
1185
+ dotCount = 300,
1186
+ duration = 3,
1187
+ className = ""
1188
+ }) => {
1189
+ const containerRef = (0, import_react18.useRef)(null);
1190
+ (0, import_react18.useEffect)(() => {
1191
+ if (!containerRef.current) return;
1192
+ const DOT_RADIUS = 1;
1193
+ const MARGIN = 2;
1194
+ const GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
1195
+ const CENTER = size / 2;
1196
+ const MAX_RADIUS = CENTER - MARGIN - DOT_RADIUS;
1197
+ const svgNS = "http://www.w3.org/2000/svg";
1198
+ containerRef.current.innerHTML = "";
1199
+ const svg = document.createElementNS(svgNS, "svg");
1200
+ svg.setAttribute("width", size.toString());
1201
+ svg.setAttribute("height", size.toString());
1202
+ svg.setAttribute("viewBox", `0 0 ${size} ${size}`);
1203
+ svg.style.display = "block";
1204
+ containerRef.current.appendChild(svg);
1205
+ for (let i = 0; i < dotCount; i++) {
1206
+ const idx = i + 0.5;
1207
+ const frac = idx / dotCount;
1208
+ const r = Math.sqrt(frac) * MAX_RADIUS;
1209
+ const theta = idx * GOLDEN_ANGLE;
1210
+ const x = CENTER + r * Math.cos(theta);
1211
+ const y = CENTER + r * Math.sin(theta);
1212
+ const circle = document.createElementNS(svgNS, "circle");
1213
+ circle.setAttribute("cx", x.toString());
1214
+ circle.setAttribute("cy", y.toString());
1215
+ circle.setAttribute("r", DOT_RADIUS.toString());
1216
+ circle.setAttribute("fill", "currentColor");
1217
+ circle.setAttribute("opacity", "0.6");
1218
+ svg.appendChild(circle);
1219
+ const animR = document.createElementNS(svgNS, "animate");
1220
+ animR.setAttribute("attributeName", "r");
1221
+ animR.setAttribute(
1222
+ "values",
1223
+ `${DOT_RADIUS * 0.5};${DOT_RADIUS * 1.8};${DOT_RADIUS * 0.5}`
1224
+ );
1225
+ animR.setAttribute("dur", `${duration}s`);
1226
+ animR.setAttribute("begin", `${frac * duration}s`);
1227
+ animR.setAttribute("repeatCount", "indefinite");
1228
+ animR.setAttribute("calcMode", "spline");
1229
+ animR.setAttribute("keySplines", "0.4 0 0.6 1;0.4 0 0.6 1");
1230
+ circle.appendChild(animR);
1231
+ const animO = document.createElementNS(svgNS, "animate");
1232
+ animO.setAttribute("attributeName", "opacity");
1233
+ animO.setAttribute("values", "0.2;1;0.2");
1234
+ animO.setAttribute("dur", `${duration}s`);
1235
+ animO.setAttribute("begin", `${frac * duration}s`);
1236
+ animO.setAttribute("repeatCount", "indefinite");
1237
+ animO.setAttribute("calcMode", "spline");
1238
+ animO.setAttribute("keySplines", "0.4 0 0.6 1;0.4 0 0.6 1");
1239
+ circle.appendChild(animO);
1240
+ }
1241
+ }, [size, dotCount, duration]);
1242
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1243
+ "div",
1244
+ {
1245
+ ref: containerRef,
1246
+ className: cs("text-accentColor inline-flex w-full h-full justify-center align-center", className)
1247
+ }
1248
+ );
1249
+ };
1250
+
1251
+ // src/components/ConnectModal/WalletView.tsx
1252
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1253
+ var WalletView = import_react19.default.memo(({ selectedConnector, onConnect, qrCode, isWide, connectState }) => {
1254
+ const showQRCode = selectedConnector?.hasConnectionUri();
1255
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cs(
1256
+ "flex flex-col items-center",
1257
+ isWide ? "w-[400px] p-4 min-h-[472px]" : "justify-center w-full min-h-[400px]"
1258
+ ), children: [
1259
+ isWide && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
1260
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", {}),
1261
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1262
+ DialogClose,
1263
+ {
1264
+ className: "z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",
1265
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Close_default, {})
1266
+ }
1267
+ )
1268
+ ] }) }),
1269
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: cs(
1270
+ "flex items-center py-12 flex-col grow justify-start",
1271
+ selectedConnector && showQRCode ? "max-w-[220px]" : "max-w-[360px]"
1272
+ ), children: selectedConnector ? showQRCode ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
1273
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(QRCode, { size: 220, logoBackground: selectedConnector.icon, uri: qrCode }),
1274
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "text-secondaryFont leading-secondary font-[500] text-center", children: [
1275
+ "Scan the QR Code with ",
1276
+ selectedConnector.id === "nova" ? "the Nova app" : "your phone"
1277
+ ] }),
1278
+ selectedConnector.links?.browserExtension ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1279
+ "p",
1280
+ {
1281
+ onClick: () => window.open(selectedConnector.links.browserExtension),
1282
+ className: "cursor-pointer pt-[16px] text-base leading-base text-accentColor font-bold text-center",
1283
+ children: [
1284
+ "Don\u2018t have ",
1285
+ selectedConnector.name,
1286
+ "?"
1287
+ ]
1288
+ }
1289
+ ) : qrCode ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Copy, { className: "text-sm leading-sm text-accentColor", copyText: qrCode, label: "Copy Link" }) : null
1290
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
1291
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-[102px] h-[102px] pb-[16px]", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: selectedConnector.icon, className: "w-full h-full", alt: "" }) }),
1292
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "pb-[10px] text-primary leading-primary text-modalFont font-[600]", children: [
1293
+ "Opening ",
1294
+ selectedConnector.name,
1295
+ "..."
1296
+ ] }),
1297
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "pb-[10px] text-secondaryFont text-secondary leading-secondary font-[500] text-center", children: "Confirm connection in the extension" }),
1298
+ connectState.isConnecting && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loading_default, { className: "w-[24px] h-[24px] text-secondaryFont animate-[spin_3s_linear_infinite]" }),
1299
+ !selectedConnector.isInstalled() && selectedConnector.links.browserExtension && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1300
+ "p",
1301
+ {
1302
+ onClick: () => window.open(selectedConnector.links.browserExtension),
1303
+ className: "cursor-pointer pt-[16px] text-base leading-base text-accentColor font-bold text-center",
1304
+ children: [
1305
+ "Don\u2018t have ",
1306
+ selectedConnector.name,
1307
+ "?"
1308
+ ]
1309
+ }
1310
+ ),
1311
+ !connectState.isConnecting && connectState.isError && selectedConnector.isInstalled() && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1312
+ "button",
1313
+ {
1314
+ className: cs(
1315
+ "rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-[600] text-primaryFont bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",
1316
+ transitionClassName
1317
+ ),
1318
+ onClick: () => onConnect(selectedConnector),
1319
+ children: "Retry"
1320
+ }
1321
+ )
1322
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
1323
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-[160px] h-[160px] mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SpiralAnimation, {}) }),
1324
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "cursor-pointer pb-[16px] text-base leading-base text-accentColor font-bold text-center", children: "New to wallets?" }),
1325
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-modalTextSecondary text-sm leading-sm font-medium text-center", children: "Your gateway to the decentralized world Connect a wallet to get started" })
1326
+ ] }) }),
1327
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", {})
1328
+ ] });
1329
+ });
1330
+
1331
+ // src/components/ConnectModal/ConnectOptions.tsx
1332
+ var import_react20 = __toESM(require("react"), 1);
1333
+ var import_react21 = require("@luno-kit/react");
1334
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1335
+ var ConnectOptions = import_react20.default.memo(({ onConnect }) => {
1336
+ const connectors = (0, import_react21.useConnectors)();
1337
+ if ((0, import_react21.isMobileDevice)()) {
1338
+ const filteredConnectors = connectors.filter((i) => i.links.deepLink);
1339
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col items-start gap-1 w-full", children: filteredConnectors.map((i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ConnectorItem, { connector: i, onConnect: () => onConnect(i) }, `${i.id}-${i.name}`)) });
1340
+ }
1341
+ const installedConnectors = connectors.filter((c) => c.isInstalled());
1342
+ const moreConnectors = connectors.filter((c) => !c.isInstalled());
1343
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col items-start gap-4 w-full", children: [
1344
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col items-start gap-3 w-full", children: [
1345
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-base text-modalText font-semibold leading-base", children: "Installed" }),
1346
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col items-start gap-1.5 w-full", children: installedConnectors.map((i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ConnectorItem, { connector: i, onConnect: () => onConnect(i) }, i.id)) })
1347
+ ] }),
1348
+ moreConnectors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col items-start gap-3 w-full", children: [
1349
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-base text-modalText font-semibold leading-base", children: "More" }),
1350
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col items-start gap-1 w-full", children: moreConnectors.map((i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ConnectorItem, { connector: i, onConnect: () => onConnect(i) }, i.id)) })
1351
+ ] })
1352
+ ] });
1353
+ });
1354
+ var ConnectorItem = import_react20.default.memo(({ connector, onConnect }) => {
1355
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1356
+ "button",
1357
+ {
1358
+ onClick: onConnect,
1359
+ className: cs(
1360
+ "cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none",
1361
+ "hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]",
1362
+ "text-left"
1363
+ ),
1364
+ children: [
1365
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "w-[24px] h-[24px]", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1366
+ "img",
1367
+ {
1368
+ src: connector.icon,
1369
+ alt: connector.name,
1370
+ className: "w-full h-full"
1371
+ }
1372
+ ) }),
1373
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-semibold leading-base text-base text-modalText", children: connector.name })
1374
+ ]
1375
+ }
1376
+ );
1377
+ });
1378
+
1379
+ // src/components/ConnectModal/index.tsx
1380
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1381
+ var ConnectModal = ({
1382
+ size = "wide"
1383
+ }) => {
1384
+ const { isOpen, close } = useConnectModal();
1385
+ const { connectAsync, reset: resetConnect, isPending: isConnecting, isError: connectError } = (0, import_react23.useConnect)();
1386
+ const [selectedConnector, setSelectedConnector] = (0, import_react22.useState)(null);
1387
+ const [qrCode, setQrCode] = (0, import_react22.useState)();
1388
+ const { width: windowWidth } = useWindowSize();
1389
+ const isLargeWindow = windowWidth && windowWidth > 768;
1390
+ const isWide = !!(size === "wide" && isLargeWindow);
1391
+ const {
1392
+ containerRef,
1393
+ currentViewRef,
1394
+ resetView,
1395
+ handleViewChange,
1396
+ currentView
1397
+ } = useAnimatedViews({ initialView: "Connect Wallet" /* connectOptions */ });
1398
+ const onQrCode = async (connector) => {
1399
+ const uri = await connector.getConnectionUri();
1400
+ setQrCode(uri);
1401
+ };
1402
+ const handleConnect = async (connector) => {
1403
+ if ((0, import_react23.isMobileDevice)() && connector.links.deepLink) {
1404
+ try {
1405
+ await connectAsync({ connectorId: connector.id });
1406
+ _onOpenChange(false);
1407
+ return;
1408
+ } catch (error) {
1409
+ window.location.href = `${connector.links.deepLink}?url=${window.location.href}`;
1410
+ return;
1411
+ }
1412
+ }
1413
+ !isWide && handleViewChange("walletView" /* walletView */);
1414
+ setSelectedConnector(connector);
1415
+ setQrCode(void 0);
1416
+ if (connector.hasConnectionUri()) {
1417
+ onQrCode(connector);
1418
+ }
1419
+ await connectAsync({ connectorId: connector.id });
1420
+ _onOpenChange(false);
1421
+ };
1422
+ const _onOpenChange = (open) => {
1423
+ !open && close();
1424
+ resetConnect();
1425
+ resetView();
1426
+ setSelectedConnector(null);
1427
+ setQrCode(void 0);
1428
+ };
1429
+ const viewComponents = (0, import_react22.useMemo)(() => {
1430
+ return {
1431
+ ["Connect Wallet" /* connectOptions */]: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ConnectOptions, { onConnect: handleConnect }),
1432
+ ["walletView" /* walletView */]: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1433
+ WalletView,
1434
+ {
1435
+ connectState: { isConnecting, isError: connectError },
1436
+ isWide,
1437
+ selectedConnector,
1438
+ qrCode,
1439
+ onConnect: handleConnect
1440
+ }
1441
+ )
1442
+ };
1443
+ }, [isWide, selectedConnector, qrCode, handleConnect, isConnecting, connectError]);
1444
+ (0, import_react22.useEffect)(() => {
1445
+ if (isWide && currentView === "walletView" /* walletView */) {
1446
+ handleViewChange("Connect Wallet" /* connectOptions */);
1447
+ }
1448
+ }, [isWide, currentView]);
1449
+ (0, import_react22.useEffect)(() => {
1450
+ if (isWide && currentView === "walletView" /* walletView */) {
1451
+ handleViewChange("Connect Wallet" /* connectOptions */);
1452
+ }
1453
+ }, [isWide, currentView]);
1454
+ (0, import_react22.useEffect)(() => {
1455
+ if (isWide && currentView === "walletView" /* walletView */) {
1456
+ handleViewChange("Connect Wallet" /* connectOptions */);
1457
+ }
1458
+ }, [isWide, currentView]);
1459
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Dialog, { open: isOpen, onOpenChange: _onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cs("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"), children: [
1460
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cs(
1461
+ "flex flex-col items-start py-4 px-5 md:min-w-[360px] w-full md:w-auto",
1462
+ isWide && "border-r-[1px] border-r-solid border-r-separatorLine"
1463
+ ), children: [
1464
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cs("flex items-center justify-between w-full", !isWide && "pb-4"), children: [
1465
+ currentView === "Connect Wallet" /* connectOptions */ ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTitle, { className: cs("text-lg leading-lg text-modalText font-bold", isWide && "pb-6"), children: "Connect Wallet" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
1466
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1467
+ "button",
1468
+ {
1469
+ className: "flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",
1470
+ onClick: () => handleViewChange("Connect Wallet" /* connectOptions */),
1471
+ "aria-label": "Back",
1472
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Back_default, {})
1473
+ }
1474
+ ),
1475
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1476
+ DialogTitle,
1477
+ {
1478
+ className: cs(
1479
+ "text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",
1480
+ !selectedConnector?.hasConnectionUri() && "sr-only"
1481
+ ),
1482
+ children: selectedConnector?.hasConnectionUri() && "Scan by your phone"
1483
+ }
1484
+ )
1485
+ ] }),
1486
+ !isWide && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1487
+ DialogClose,
1488
+ {
1489
+ className: "z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",
1490
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Close_default, {})
1491
+ }
1492
+ )
1493
+ ] }),
1494
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1495
+ "div",
1496
+ {
1497
+ ref: containerRef,
1498
+ className: "relative overflow-hidden w-full",
1499
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: currentViewRef, children: viewComponents[currentView] })
1500
+ }
1501
+ )
1502
+ ] }),
1503
+ isWide && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1504
+ WalletView,
1505
+ {
1506
+ connectState: { isConnecting, isError: connectError },
1507
+ isWide,
1508
+ selectedConnector,
1509
+ qrCode,
1510
+ onConnect: handleConnect
1511
+ }
1512
+ )
1513
+ ] }) });
1514
+ };
1515
+
1516
+ // src/providers/LunoKitProvider.tsx
1517
+ var import_react26 = require("react");
1518
+ var import_react27 = require("@luno-kit/react");
1519
+ var import_react_query = require("@tanstack/react-query");
1520
+
1521
+ // src/theme/context.tsx
1522
+ var import_react25 = require("react");
1523
+
1524
+ // src/hooks/useCSSVariableInjection.ts
1525
+ var import_react24 = require("react");
1526
+ var ALL_THEME_VARS = [
1527
+ "--color-accentColor",
1528
+ "--color-walletSelectItemBackground",
1529
+ "--color-walletSelectItemBackgroundHover",
1530
+ "--color-walletSelectItemText",
1531
+ "--color-connectButtonBackground",
1532
+ "--color-connectButtonInnerBackground",
1533
+ "--color-connectButtonText",
1534
+ "--color-accountActionItemBackground",
1535
+ "--color-accountActionItemBackgroundHover",
1536
+ "--color-accountActionItemText",
1537
+ "--color-accountSelectItemBackground",
1538
+ "--color-accountSelectItemBackgroundHover",
1539
+ "--color-accountSelectItemText",
1540
+ "--color-currentNetworkButtonBackground",
1541
+ "--color-currentNetworkButtonText",
1542
+ "--color-networkSelectItemBackground",
1543
+ "--color-networkSelectItemBackgroundHover",
1544
+ "--color-networkSelectItemText",
1545
+ "--color-navigationButtonBackground",
1546
+ "--color-separatorLine",
1547
+ "--color-modalBackground",
1548
+ "--color-modalBackdrop",
1549
+ "--color-modalBorder",
1550
+ "--color-modalText",
1551
+ "--color-modalTextSecondary",
1552
+ "--color-modalControlButtonBackgroundHover",
1553
+ "--color-modalControlButtonText",
1554
+ "--color-success",
1555
+ "--color-successForeground",
1556
+ "--color-warning",
1557
+ "--color-warningForeground",
1558
+ "--color-error",
1559
+ "--color-errorForeground",
1560
+ "--color-info",
1561
+ "--color-infoForeground",
1562
+ "--color-skeleton",
1563
+ "--color-cutLine",
1564
+ "--font-body",
1565
+ "--font-heading",
1566
+ "--font-mono",
1567
+ "--radius-walletSelectItem",
1568
+ "--radius-connectButton",
1569
+ "--radius-modalControlButton",
1570
+ "--radius-accountActionItem",
1571
+ "--radius-accountSelectItem",
1572
+ "--radius-currentNetworkButton",
1573
+ "--radius-networkSelectItem",
1574
+ "--radius-modal",
1575
+ "--radius-modalMobile",
1576
+ "--shadow-button",
1577
+ "--shadow-modal",
1578
+ "--blur-modalOverlay"
1579
+ ];
1580
+ var useCSSVariableInjection = (themeInfo, themeMode) => {
1581
+ (0, import_react24.useEffect)(() => {
1582
+ if (typeof window === "undefined") return;
1583
+ const root = document.documentElement;
1584
+ if (themeInfo.type === "complete" && themeInfo.completeTheme) {
1585
+ Object.entries(themeInfo.completeTheme.colors).forEach(([key, value]) => {
1586
+ if (value) {
1587
+ root.style.setProperty(`--color-${key}`, value);
1588
+ }
1589
+ });
1590
+ Object.entries(themeInfo.completeTheme.fonts).forEach(([key, value]) => {
1591
+ if (value) {
1592
+ root.style.setProperty(`--font-${key}`, value);
1593
+ }
1594
+ });
1595
+ Object.entries(themeInfo.completeTheme.radii).forEach(([key, value]) => {
1596
+ if (value) {
1597
+ root.style.setProperty(`--radius-${key}`, value);
1598
+ }
1599
+ });
1600
+ Object.entries(themeInfo.completeTheme.shadows).forEach(([key, value]) => {
1601
+ if (value) {
1602
+ root.style.setProperty(`--shadow-${key}`, value);
1603
+ }
1604
+ });
1605
+ Object.entries(themeInfo.completeTheme.blurs).forEach(([key, value]) => {
1606
+ if (value) {
1607
+ root.style.setProperty(`--blur-${key}`, value);
1608
+ }
1609
+ });
1610
+ root.removeAttribute("data-theme");
1611
+ } else if (themeInfo.type === "partial" && themeInfo.partialOverrides) {
1612
+ root.setAttribute("data-theme", themeMode);
1613
+ const hasOverrides = Object.keys(themeInfo.partialOverrides).length > 0;
1614
+ if (hasOverrides) {
1615
+ ALL_THEME_VARS.forEach((varName) => {
1616
+ root.style.removeProperty(varName);
1617
+ });
1618
+ if (themeInfo.partialOverrides.colors) {
1619
+ Object.entries(themeInfo.partialOverrides.colors).forEach(([key, value]) => {
1620
+ if (value) {
1621
+ root.style.setProperty(`--color-${key}`, value);
1622
+ }
1623
+ });
1624
+ }
1625
+ if (themeInfo.partialOverrides.fonts) {
1626
+ Object.entries(themeInfo.partialOverrides.fonts).forEach(([key, value]) => {
1627
+ if (value) {
1628
+ root.style.setProperty(`--font-${key}`, value);
1629
+ }
1630
+ });
1631
+ }
1632
+ if (themeInfo.partialOverrides.radii) {
1633
+ Object.entries(themeInfo.partialOverrides.radii).forEach(([key, value]) => {
1634
+ if (value) {
1635
+ root.style.setProperty(`--radius-${key}`, value);
1636
+ }
1637
+ });
1638
+ }
1639
+ if (themeInfo.partialOverrides.shadows) {
1640
+ Object.entries(themeInfo.partialOverrides.shadows).forEach(([key, value]) => {
1641
+ if (value) {
1642
+ root.style.setProperty(`--shadow-${key}`, value);
1643
+ }
1644
+ });
1645
+ }
1646
+ if (themeInfo.partialOverrides.blurs) {
1647
+ Object.entries(themeInfo.partialOverrides.blurs).forEach(([key, value]) => {
1648
+ if (value) {
1649
+ root.style.setProperty(`--blur-${key}`, value);
1650
+ }
1651
+ });
1652
+ }
1653
+ }
1654
+ } else {
1655
+ root.setAttribute("data-theme", themeMode);
1656
+ ALL_THEME_VARS.forEach((varName) => {
1657
+ root.style.removeProperty(varName);
1658
+ });
1659
+ }
1660
+ }, [themeInfo, themeMode]);
1661
+ };
1662
+
1663
+ // src/theme/context.tsx
1664
+ var import_jsx_runtime26 = require("react/jsx-runtime");
1665
+ var THEME_STORAGE_KEY = "luno.lastThemePreference";
1666
+ var saveThemePreference = (preference) => {
1667
+ try {
1668
+ localStorage.setItem(THEME_STORAGE_KEY, JSON.stringify(preference));
1669
+ } catch (e) {
1670
+ }
1671
+ };
1672
+ var ThemeContext = (0, import_react25.createContext)(void 0);
1673
+ var isCompleteTheme = (theme) => {
1674
+ return "colors" in theme && "fonts" in theme && "radii" in theme && "shadows" in theme && "blurs" in theme;
1675
+ };
1676
+ var useSystemTheme = () => {
1677
+ const [systemTheme, setSystemTheme] = (0, import_react25.useState)(() => {
1678
+ if (typeof window === "undefined") return "light";
1679
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1680
+ });
1681
+ (0, import_react25.useEffect)(() => {
1682
+ if (typeof window === "undefined") return;
1683
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
1684
+ const updateTheme = (e) => {
1685
+ setSystemTheme(e.matches ? "dark" : "light");
1686
+ };
1687
+ updateTheme(mediaQuery);
1688
+ mediaQuery.addEventListener("change", updateTheme);
1689
+ return () => mediaQuery.removeEventListener("change", updateTheme);
1690
+ }, []);
1691
+ return systemTheme;
1692
+ };
1693
+ var ThemeProvider = ({
1694
+ children,
1695
+ theme: themeOverrides
1696
+ }) => {
1697
+ const systemTheme = useSystemTheme();
1698
+ const [themeMode, setThemeMode] = (0, import_react25.useState)(() => {
1699
+ if (typeof window !== "undefined") {
1700
+ try {
1701
+ const saved = localStorage.getItem(THEME_STORAGE_KEY);
1702
+ if (saved) {
1703
+ const preference = JSON.parse(saved);
1704
+ if (preference?.isAuto) {
1705
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1706
+ } else if (preference?.preferredTheme) {
1707
+ return preference.preferredTheme;
1708
+ }
1709
+ }
1710
+ } catch (e) {
1711
+ }
1712
+ }
1713
+ if (!themeOverrides || isCompleteTheme(themeOverrides)) {
1714
+ return "light";
1715
+ }
1716
+ const overrides = themeOverrides;
1717
+ return overrides.defaultMode || "light";
1718
+ });
1719
+ const [isAutoMode, setIsAutoMode] = (0, import_react25.useState)(() => {
1720
+ if (typeof window !== "undefined") {
1721
+ try {
1722
+ const saved = localStorage.getItem(THEME_STORAGE_KEY);
1723
+ if (saved) {
1724
+ const preference = JSON.parse(saved);
1725
+ return preference?.isAuto ?? false;
1726
+ }
1727
+ } catch (e) {
1728
+ }
1729
+ }
1730
+ if (!themeOverrides || isCompleteTheme(themeOverrides)) {
1731
+ return false;
1732
+ }
1733
+ const overrides = themeOverrides;
1734
+ return overrides.autoMode ?? false;
1735
+ });
1736
+ const themeInfo = (0, import_react25.useMemo)(() => {
1737
+ if (!themeOverrides) {
1738
+ return { type: "default", completeTheme: null, partialOverrides: null };
1739
+ }
1740
+ if (isCompleteTheme(themeOverrides)) {
1741
+ return { type: "complete", completeTheme: themeOverrides, partialOverrides: null };
1742
+ }
1743
+ const overrides = themeOverrides;
1744
+ if (overrides.theme) {
1745
+ return { type: "complete", completeTheme: overrides.theme, partialOverrides: null };
1746
+ }
1747
+ let partialOverrides = null;
1748
+ if (themeMode === "light" && overrides.light) {
1749
+ partialOverrides = overrides.light;
1750
+ } else if (themeMode === "dark" && overrides.dark) {
1751
+ partialOverrides = overrides.dark;
1752
+ } else {
1753
+ partialOverrides = { ...overrides };
1754
+ }
1755
+ return { type: "partial", completeTheme: null, partialOverrides };
1756
+ }, [themeMode, themeOverrides]);
1757
+ const currentTheme = (0, import_react25.useMemo)(() => {
1758
+ return themeInfo.type === "complete" ? themeInfo.completeTheme : null;
1759
+ }, [themeInfo]);
1760
+ useCSSVariableInjection(themeInfo, themeMode);
1761
+ const setThemeChoice = (0, import_react25.useCallback)((choice) => {
1762
+ const isAuto = choice === "auto";
1763
+ setIsAutoMode(isAuto);
1764
+ if (isAuto) {
1765
+ setThemeMode(systemTheme || "light");
1766
+ } else {
1767
+ setThemeMode(choice);
1768
+ }
1769
+ const preference = {
1770
+ isAuto,
1771
+ ...isAuto ? {} : { preferredTheme: choice }
1772
+ };
1773
+ saveThemePreference(preference);
1774
+ }, [systemTheme]);
1775
+ (0, import_react25.useEffect)(() => {
1776
+ if (isAutoMode) {
1777
+ setThemeMode(systemTheme || "light");
1778
+ }
1779
+ }, [systemTheme, isAutoMode]);
1780
+ const contextValue = (0, import_react25.useMemo)(() => ({
1781
+ themeMode,
1782
+ setThemeChoice,
1783
+ currentTheme
1784
+ }), [themeMode, setThemeChoice, currentTheme]);
1785
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ThemeContext.Provider, { value: contextValue, children });
1786
+ };
1787
+ var useLunoTheme = () => {
1788
+ const context = (0, import_react25.useContext)(ThemeContext);
1789
+ if (!context) {
1790
+ throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");
1791
+ }
1792
+ return context;
1793
+ };
1794
+
1795
+ // src/providers/LunoKitProvider.tsx
1796
+ var import_jsx_runtime27 = require("react/jsx-runtime");
1797
+ var LunoKitProvider = ({
1798
+ children,
1799
+ config,
1800
+ queryClientConfig,
1801
+ theme
1802
+ }) => {
1803
+ const [queryClient] = (0, import_react26.useState)(() => new import_react_query.QueryClient(queryClientConfig));
1804
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react27.LunoProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ThemeProvider, { theme, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ModalProvider, { children: [
1805
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "font-base luno-kit", children }),
1806
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RenderModals, { modalSize: config.modalSize })
1807
+ ] }) }) }) });
1808
+ };
1809
+ var RenderModals = ({ modalSize }) => {
1810
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
1811
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ConnectModal, { size: modalSize }),
1812
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AccountDetailsModal, {}),
1813
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChainModal, {})
1814
+ ] });
1815
+ };
1816
+ // Annotate the CommonJS export names for ESM import in node:
1817
+ 0 && (module.exports = {
1818
+ ConnectButton,
1819
+ LunoKitProvider,
1820
+ useLunoTheme
1821
+ });
1822
+ //# sourceMappingURL=index.cjs.map