@luno-kit/ui 0.0.7 → 0.0.8
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,8 +2,6 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { Config } from '@luno-kit/react/types';
|
|
3
3
|
import { QueryClientConfig } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
|
-
type ModalSize = 'compact' | 'wide';
|
|
6
|
-
|
|
7
5
|
interface ConnectButtonProps {
|
|
8
6
|
className?: string;
|
|
9
7
|
label?: string;
|
|
@@ -14,6 +12,8 @@ interface ConnectButtonProps {
|
|
|
14
12
|
}
|
|
15
13
|
declare const ConnectButton: React.FC<ConnectButtonProps>;
|
|
16
14
|
|
|
15
|
+
type ModalSize = 'compact' | 'wide';
|
|
16
|
+
|
|
17
17
|
interface LunokitTheme {
|
|
18
18
|
colors: {
|
|
19
19
|
accentColor: string;
|
|
@@ -123,6 +123,6 @@ declare const useChainModal: () => {
|
|
|
123
123
|
open?: () => void;
|
|
124
124
|
close: () => void;
|
|
125
125
|
};
|
|
126
|
-
declare const useCloseAllModals: () => () => void;
|
|
126
|
+
declare const useCloseAllModals: () => (() => void);
|
|
127
127
|
|
|
128
128
|
export { ConnectButton, LunoKitProvider, type LunoKitProviderProps, type LunokitTheme, type ThemeMode, useAccountModal, useChainModal, useCloseAllModals, useConnectModal, useLunoTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { Config } from '@luno-kit/react/types';
|
|
3
3
|
import { QueryClientConfig } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
|
-
type ModalSize = 'compact' | 'wide';
|
|
6
|
-
|
|
7
5
|
interface ConnectButtonProps {
|
|
8
6
|
className?: string;
|
|
9
7
|
label?: string;
|
|
@@ -14,6 +12,8 @@ interface ConnectButtonProps {
|
|
|
14
12
|
}
|
|
15
13
|
declare const ConnectButton: React.FC<ConnectButtonProps>;
|
|
16
14
|
|
|
15
|
+
type ModalSize = 'compact' | 'wide';
|
|
16
|
+
|
|
17
17
|
interface LunokitTheme {
|
|
18
18
|
colors: {
|
|
19
19
|
accentColor: string;
|
|
@@ -123,6 +123,6 @@ declare const useChainModal: () => {
|
|
|
123
123
|
open?: () => void;
|
|
124
124
|
close: () => void;
|
|
125
125
|
};
|
|
126
|
-
declare const useCloseAllModals: () => () => void;
|
|
126
|
+
declare const useCloseAllModals: () => (() => void);
|
|
127
127
|
|
|
128
128
|
export { ConnectButton, LunoKitProvider, type LunoKitProviderProps, type LunokitTheme, type ThemeMode, useAccountModal, useChainModal, useCloseAllModals, useConnectModal, useLunoTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import{useCallback as ko,useMemo as nt}from"react";import{useAccount as Ao,useActiveConnector as To}from"@luno-kit/react";import ce from"react";import*as k from"@radix-ui/react-dialog";import{clsx as xt}from"clsx";import{extendTailwindMerge as gt}from"tailwind-merge";var wt=gt({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function m(...e){return wt(xt(e))}function ke(e,o){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},o)}}import{jsx as Ae,jsxs as yt}from"react/jsx-runtime";var vt=({open:e,onOpenChange:o,children:t,contentClassName:n,overlayClassName:r})=>Ae(k.Root,{open:e,onOpenChange:o,children:yt(k.Portal,{children:[ce.createElement(k.Overlay,{className:m("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",r)}),Ae(k.Content,{className:m("luno-kit font-body fixed z-[200] text-modalText text-base leading-base","bg-modalBackground shadow-modal focus:outline-none overflow-hidden border border-modalBorder","transition-all duration-200","rounded-t-modalMobile bottom-0 left-0 w-full","translate-y-0 -translate-x-0","data-[state=open]:[animation:slide-up_200ms_ease-out]","md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2","md:w-auto md:rounded-modal","md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",n),children:t})]})}),Ct=({children:e,className:o})=>ce.createElement(k.Title,{className:o},e),bt=({children:e,className:o,onClick:t})=>ce.createElement(k.Close,{className:o,onClick:t},e),G=vt,B=bt,E=Ct;import{useState as Ot}from"react";import{LunoProvider as _t}from"@luno-kit/react";import{QueryClient as Ht,QueryClientProvider as Gt}from"@tanstack/react-query";import{createContext as St,useCallback as de,useContext as ee,useEffect as Nt,useMemo as Mt,useState as kt}from"react";import{ConnectionStatus as Y,useStatus as At}from"@luno-kit/react";import{jsx as Pt}from"react/jsx-runtime";function le(){let[e,o]=kt(!1),t=de(()=>o(!0),[]),n=de(()=>o(!1),[]);return{isOpen:e,open:t,close:n}}var Q=St(void 0),Te=({children:e})=>{let{isOpen:o,open:t,close:n}=le(),{isOpen:r,open:a,close:i}=le(),{isOpen:c,open:d,close:p}=le(),f=At(),l=de(()=>{n(),i(),p()},[n,i,p]);Nt(()=>{f===Y.Disconnected&&(i(),p())},[f,i,p]);let u=Mt(()=>({isConnectModalOpen:o,isAccountModalOpen:r,isChainModalOpen:c,openConnectModal:f!==Y.Connected?t:void 0,closeConnectModal:n,openAccountModal:f===Y.Connected?a:void 0,closeAccountModal:i,openChainModal:f===Y.Connected?d:void 0,closeChainModal:p,closeAllModals:l}),[o,t,n,r,a,i,c,d,p,l,f]);return Pt(Q.Provider,{value:u,children:e})},W=()=>{let e=ee(Q);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},j=()=>{let e=ee(Q);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},U=()=>{let e=ee(Q);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}},Tt=()=>{let e=ee(Q);if(!e)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return e.closeAllModals};import{createContext as Vt,useState as pe,useContext as It,useMemo as me,useCallback as Bt,useEffect as Ve}from"react";import{useEffect as Rt}from"react";var Pe=["--color-accentColor","--color-walletSelectItemBackground","--color-walletSelectItemBackgroundHover","--color-walletSelectItemText","--color-connectButtonBackground","--color-connectButtonInnerBackground","--color-connectButtonText","--color-accountActionItemBackground","--color-accountActionItemBackgroundHover","--color-accountActionItemText","--color-accountSelectItemBackground","--color-accountSelectItemBackgroundHover","--color-accountSelectItemText","--color-currentNetworkButtonBackground","--color-currentNetworkButtonText","--color-networkSelectItemBackground","--color-networkSelectItemBackgroundHover","--color-networkSelectItemText","--color-navigationButtonBackground","--color-separatorLine","--color-modalBackground","--color-modalBackdrop","--color-modalBorder","--color-modalText","--color-modalTextSecondary","--color-modalControlButtonBackgroundHover","--color-modalControlButtonText","--color-success","--color-successForeground","--color-warning","--color-warningForeground","--color-error","--color-errorForeground","--color-info","--color-infoForeground","--color-skeleton","--font-body","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],Re=(e,o)=>{Rt(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([n,r])=>{r&&t.style.setProperty(`--color-${n}`,r)}),Object.entries(e.completeTheme.fonts).forEach(([n,r])=>{r&&t.style.setProperty(`--font-${n}`,r)}),Object.entries(e.completeTheme.radii).forEach(([n,r])=>{r&&t.style.setProperty(`--radius-${n}`,r)}),Object.entries(e.completeTheme.shadows).forEach(([n,r])=>{r&&t.style.setProperty(`--shadow-${n}`,r)}),Object.entries(e.completeTheme.blurs).forEach(([n,r])=>{r&&t.style.setProperty(`--blur-${n}`,r)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",o),Object.keys(e.partialOverrides).length>0&&(Pe.forEach(r=>{t.style.removeProperty(r)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([r,a])=>{a&&t.style.setProperty(`--color-${r}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([r,a])=>{a&&t.style.setProperty(`--font-${r}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([r,a])=>{a&&t.style.setProperty(`--radius-${r}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([r,a])=>{a&&t.style.setProperty(`--shadow-${r}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([r,a])=>{a&&t.style.setProperty(`--blur-${r}`,a)}))):(t.setAttribute("data-theme",o),Pe.forEach(n=>{t.style.removeProperty(n)}))},[e,o])};import{jsx as Lt}from"react/jsx-runtime";var fe="luno.lastThemePreference",Et=e=>{try{localStorage.setItem(fe,JSON.stringify(e))}catch{}},Ie=Vt(void 0),ue=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Dt=()=>{let[e,o]=pe(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return Ve(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),n=r=>{o(r.matches?"dark":"light")};return n(t),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e},he=({children:e,theme:o})=>{let t=Dt(),[n,r]=pe(()=>{if(typeof window<"u")try{let u=localStorage.getItem(fe);if(u){let s=JSON.parse(u);if(s?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(s?.preferredTheme)return s.preferredTheme}}catch{}return!o||ue(o)?"light":o.defaultMode||"light"}),[a,i]=pe(()=>{if(typeof window<"u")try{let u=localStorage.getItem(fe);if(u)return JSON.parse(u)?.isAuto??!1}catch{}return!o||ue(o)?!1:o.autoMode??!1}),c=me(()=>{if(!o)return{type:"default",completeTheme:null,partialOverrides:null};if(ue(o))return{type:"complete",completeTheme:o,partialOverrides:null};let l=o;if(l.theme)return{type:"complete",completeTheme:l.theme,partialOverrides:null};let u=null;return n==="light"&&l.light?u=l.light:n==="dark"&&l.dark?u=l.dark:u={...l},{type:"partial",completeTheme:null,partialOverrides:u}},[n,o]),d=me(()=>c.type==="complete"?c.completeTheme:null,[c]);Re(c,n);let p=Bt(l=>{let u=l==="auto";i(u),r(u?t||"light":l);let s={isAuto:u,...u?{}:{preferredTheme:l}};Et(s)},[t]);Ve(()=>{a&&r(t||"light")},[t,a]);let f=me(()=>({themeMode:n,setThemeChoice:p,currentTheme:d}),[n,p,d]);return Lt(Ie.Provider,{value:f,children:e})},Be=()=>{let e=It(Ie);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};import{Fragment as Zt,jsx as D,jsxs as Ee}from"react/jsx-runtime";var Ln=({children:e,config:o,queryClientConfig:t,theme:n})=>{let[r]=Ot(()=>new Ht(t));return D(Gt,{client:r,children:D(_t,{config:o,children:D(he,{theme:n,children:Ee(Te,{children:[D("div",{className:"font-base luno-kit",children:e}),D($t,{modalSize:o.modalSize})]})})})})},$t=({modalSize:e})=>Ee(Zt,{children:[D(Oe,{size:e}),D(De,{}),D(Le,{})]});import{jsx as _e}from"react/jsx-runtime";var Ft=e=>_e("svg",{xmlns:"http://www.w3.org/2000/svg",className:"arrow_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:_e("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"})}),xe=Ft;import{jsx as He}from"react/jsx-runtime";var zt=e=>He("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:He("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"})}),q=zt;import{jsx as Ge}from"react/jsx-runtime";var Qt=e=>Ge("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Ge("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"})}),R=Qt;import{jsx as $e}from"react/jsx-runtime";var Wt=e=>$e("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...e,children:$e("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"})}),ge=Wt;import{jsx as Ze}from"react/jsx-runtime";var jt=e=>Ze("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:Ze("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"})}),we=jt;import{jsx as Fe}from"react/jsx-runtime";var Ut=e=>Fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Fe("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"})}),ve=Ut;import{jsx as ze}from"react/jsx-runtime";var qt=e=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:ze("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"})}),Ce=qt;import{jsx as Qe}from"react/jsx-runtime";var Kt=e=>Qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...e,children:Qe("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"})}),be=Kt;import{useMemo as Jt}from"react";import{jsx as We}from"react/jsx-runtime";var $=({chainIconUrl:e,chainName:o,className:t})=>e?We("img",{src:e,alt:o||"Chain icon",className:m("w-full h-full object-cover rounded-full",t)}):We("div",{className:m("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:o?o.charAt(0).toUpperCase():"C"});import{useAccount as Xt,useBalance as Yt,useChain as eo,useDisconnect as to}from"@luno-kit/react";import{getExplorerUrl as oo}from"@luno-kit/react/utils";import{Fragment as Ue,jsx as w,jsxs as L}from"react/jsx-runtime";var qe=({onViewChange:e,onModalClose:o})=>{let{address:t}=Xt(),{chain:n}=eo(),{disconnectAsync:r}=to(),{data:a}=Yt({address:t}),i=Jt(()=>[{key:"Chain Name",content:L("div",{className:"flex items-stretch w-full justify-between",children:[L("div",{className:"flex items-center gap-2",children:[w("div",{className:"relative",children:w($,{className:"w-[24px] h-[24px]",chainIconUrl:n?.chainIconUrl,chainName:n?.name})}),L("div",{className:"flex flex-col items-start",children:[w("span",{className:"text-base leading-base text-modalText",children:n?.name||"Polkadot"}),a?L("span",{className:"text-modalTextSecondary text-xs leading-xs",children:[a.formattedTransferable||"0.00"," ",n?.nativeCurrency?.symbol||"DOT"]}):w("span",{className:"animate-pulse rounded w-[80px] h-[16px] bg-skeleton"})]})]}),w("div",{className:"flex items-center justify-center",children:w(xe,{className:"w-[16px] h-[16px] text-modalTextSecondary"})})]}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:L(Ue,{children:[w(ve,{className:"w-[24px] h-[24px]"}),w("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open(oo(n?.blockExplorers?.default?.url,t,"address"))},{key:"Switch Account",content:L(Ue,{children:[w(be,{className:"w-[24px] h-[24px]"}),w("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}],[e,n,t,a]),c=async()=>{await r(),o()};return L("div",{className:"flex flex-col items-center gap-3 w-full",children:[w("div",{className:"flex flex-col gap-1.5 w-full px-4",children:i.map(d=>w(je,{onClick:d.onClick,children:d.content},d.key))}),w("div",{className:"w-full mx-[-100px] h-[1px] bg-separatorLine"}),w("div",{className:"w-full px-4 pb-4",children:L(je,{onClick:c,children:[w(we,{}),w("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},je=({children:e,onClick:o})=>w("button",{type:"button",onClick:()=>o?.(),className:m("w-full p-2.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium","bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover","transition-colors duration-200",o?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});import no,{useCallback as ro}from"react";import{useAccount as ao,useAccounts as io,useActiveConnector as so,useBalance as co,useChain as lo}from"@luno-kit/react";import{formatAddress as mo}from"@luno-kit/react/utils";import{jsx as O,jsxs as te}from"react/jsx-runtime";var ye=({onBack:e})=>{let{accounts:o,selectAccount:t}=io(),{address:n}=ao(),r=ro(a=>{t(a),e()},[e]);return O("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:o.map(a=>O(uo,{account:a,isSelected:a.address===n,selectAccount:r},a.address))})};ye.title="Switch Accounts";var uo=no.memo(({isSelected:e,account:o,selectAccount:t})=>{let{chain:n}=lo(),r=o.address,{data:a}=co({address:r}),i=so();return te("button",{type:"button",onClick:()=>t(o),className:m("px-3.5 py-2.5 w-full rounded-accountSelectItem border-none","bg-accountSelectItemBackground","text-left flex items-center justify-between gap-2","transition-colors duration-200",e?"cursor-auto":"cursor-pointer hover:bg-accountSelectItemBackgroundHover"),"aria-label":o.name||r,disabled:e,children:[te("div",{className:"flex items-center gap-2 grow overflow-hidden",children:[O("div",{className:"shrink-0 w-[24px] h-[24px] rounded-full flex items-center justify-center",children:i?.icon&&O("img",{src:i?.icon,alt:"luno account"})}),te("div",{className:"flex flex-col items-start overflow-hidden",children:[O("span",{className:"whitespace-nowrap max-w-full text-ellipsis overflow-hidden font-medium text-sm leading-sm text-accountSelectItemText",children:o.name||mo(r)}),a?te("span",{className:"text-xs text-modalTextSecondary font-medium",children:[a?.formattedTransferable||"0.00"," ",n?.nativeCurrency?.symbol||"DOT"]}):O("span",{className:"animate-pulse rounded w-[60px] h-[16px] bg-skeleton"})]})]}),e&&O("div",{className:"shrink-0 border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[16px] h-[16px]",children:O("div",{className:"rounded-full bg-accentColor w-[8px] h-[8px]"})})]})});import fo,{useMemo as ho,useState as Xe}from"react";import{useApi as xo,useChain as go,useChains as wo,useSwitchChain as vo}from"@luno-kit/react";import{jsx as Ke}from"react/jsx-runtime";var po=e=>Ke("svg",{xmlns:"http://www.w3.org/2000/svg",className:"search_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Ke("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"})}),Je=po;import{Fragment as bo,jsx as C,jsxs as Z}from"react/jsx-runtime";var oe=({onChainSwitched:e,className:o=""})=>{let{chain:t}=go(),n=wo(),{switchChainAsync:r}=vo(),{isApiReady:a,apiError:i}=xo(),[c,d]=Xe(null),[p,f]=Xe(""),l=ho(()=>n.filter(s=>p.trim()?s.name.toLowerCase().includes(p.toLowerCase()):!0),[n,p]),u=async s=>{if(s.genesisHash!==t?.genesisHash&&!(!a&&!i)){d(s.genesisHash);try{await r({chainId:s.genesisHash}),e?.(s)}catch(h){console.error("Failed to switch chain:",h)}finally{d(null)}}};return Z("div",{className:m("flex flex-col gap-3.5",o),children:[C("div",{className:"relative pt-1",children:Z("div",{className:"relative",children:[C(Je,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-modalTextSecondary"}),C("input",{type:"text",placeholder:"Search by name",value:p,onChange:s=>f(s.target.value),className:"w-full pl-10 pr-3 py-2 text-sm border border-networkSelectItemBackgroundHover rounded-md focus:ring-2 focus:ring-accentColor focus:outline-none focus:border-transparent"})]})}),l.length>0&&C("div",{className:"flex flex-col gap-1.5 overflow-y-auto max-h-[380px]",children:l.map(s=>C(Co,{chain:s,isSelected:s.genesisHash===t?.genesisHash,onSelect:u,isLoading:(c===s.genesisHash||!a)&&!i,isSwitching:c===s.genesisHash},s.genesisHash))}),l.length===0&&C("div",{className:"flex items-center justify-center py-12",children:C("span",{className:"text-modalTextSecondary text-xs",children:"No chains available"})})]})},Co=fo.memo(({chain:e,isSelected:o,isLoading:t,onSelect:n,isSwitching:r})=>Z("button",{onClick:()=>n(e),disabled:o||t,className:m("flex items-center justify-between p-2.5 rounded-networkSelectItem","bg-networkSelectItemBackground","transition-colors duration-200",o||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[Z("div",{className:"flex items-center gap-2",children:[C($,{className:"w-[20px] h-[20px] flex items-center justify-center leading-[20px]",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),C("div",{className:"flex flex-col items-start",children:C("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),C("div",{className:"flex items-center justify-center h-[20px]",children:o?t?Z(bo,{children:[C("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:r?"Switching":"Connecting"}),C("div",{className:"loading text-accentColor w-[15px] h-[15px]"})]}):Z("span",{className:"status-dot-container",children:[C("span",{className:"ping-animation"}),C("span",{className:"status-dot"})]}):null})]}));import{jsx as yo}from"react/jsx-runtime";var ne=({onBack:e})=>yo(oe,{className:"p-4 pt-0"});ne.title="Select Networks";import{useCallback as So,useState as No}from"react";import{jsx as Ye,jsxs as Mo}from"react/jsx-runtime";var re=({copyText:e,label:o,className:t=""})=>{let[n,r]=No(!1),a=So(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),r(!0),setTimeout(()=>r(!1),2e3),!0):!1}catch(c){return console.error("Copy failed:",c),!1}},[]);return Mo("button",{type:"button",className:m("cursor-pointer bg-transparent border-none p-1 m-0 inline-flex items-center justify-center gap-1","rounded-modalControlButton hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",t),onClick:()=>!n&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:n,children:[n?Ye(Ce,{className:"text-accentColor",width:16,height:16}):Ye(ge,{width:16,height:16}),o]})};import{formatAddress as Po}from"@luno-kit/react/utils";import{useCallback as et,useState as tt,useRef as ot}from"react";function ae({initialView:e,animationDuration:o=200,animationEasing:t="ease-out"}){let[n,r]=tt(e),[a,i]=tt(!1),c=ot(null),d=ot(null),p=et(l=>{if(l===n||a)return;if(i(!0),!c.current){r(l),i(!1);return}let u=c.current,s=u.offsetHeight;r(l),requestAnimationFrame(()=>{if(!u||!d.current){i(!1);return}let h=d.current.offsetHeight;u.animate([{height:s+"px"},{height:h+"px"}],{duration:o,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[n,a,o,t]),f=et(()=>{r(e),i(!1)},[e]);return{currentView:n,isAnimating:a,containerRef:c,currentViewRef:d,handleViewChange:p,resetView:f}}import{Fragment as Ro,jsx as v,jsxs as F}from"react/jsx-runtime";var De=()=>{let{isOpen:e,close:o}=j(),{address:t,account:n}=Ao(),r=To(),{currentView:a,containerRef:i,currentViewRef:c,handleViewChange:d,resetView:p}=ae({initialView:"main"}),f=ko(()=>{o(),p()},[o]),l=nt(()=>a==="switchAccount"?"Switch Account":a==="switchChain"?ne.title:null,[a]),u=nt(()=>({main:v(qe,{onViewChange:d,onModalClose:f}),switchAccount:v(ye,{onBack:()=>d("main")}),switchChain:v(ne,{onBack:()=>d("main")})}),[d,f]);return v(G,{open:e,onOpenChange:f,children:F("div",{className:m("flex flex-col w-full md:w-[360px] max-h-[512px] text-modalText","bg-modalBackground shadow-modal",a==="main"?"gap-5":"gap-3.5"),children:[F("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[a==="main"?F("div",{className:"flex items-center gap-3 max-w-[80%]",children:[r?.icon&&v("div",{className:"flex items-center justify-center w-[40px] h-[40px] shrink-0",children:v("img",{src:r.icon,alt:"",className:"w-full h-full object-contain"})}),F("div",{className:"flex flex-col items-start gap-1.5 max-w-full",children:[v(E,{className:"sr-only",children:"Account Details"}),F("div",{className:"flex items-center gap-0.5 w-full ",children:[v("span",{className:"text-base text-modalText font-semibold",children:Po(t)}),v(re,{copyText:t})]}),v("div",{className:m("text-sm leading-sm text-modalTextSecondary font-medium text-ellipsis overflow-hidden whitespace-nowrap",n?.name&&n?.name.length>30?"w-[90%]":""),children:n?.name||r?.name})]})]}):F(Ro,{children:[v("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>d("main"),"aria-label":"Back",children:v(q,{})}),v(E,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:l})]}),v(B,{className:"shrink-0 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:v(R,{})})]}),v("div",{ref:i,className:"relative",children:v("div",{ref:c,children:u[a]})})]})})};import{jsx as z,jsxs as rt}from"react/jsx-runtime";var Le=()=>{let{isOpen:e,close:o}=U();return z(G,{open:e,onOpenChange:t=>!t&&o(),children:rt("div",{className:"flex flex-col w-full md:w-[360px] max-h-[512px] p-4 gap-3.5 text-modalText",children:[rt("div",{className:"flex items-center justify-between w-full",children:[z("div",{className:"w-[30px]"})," ",z(E,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),z(B,{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:z(R,{})})]}),z(oe,{})]})})};import{useEffect as Jo,useMemo as Xo,useState as ft}from"react";import{useConnect as Yo}from"@luno-kit/react";import{isMobileDevice as en}from"@luno-kit/react/utils";import{useStatus as Vo,useAccount as Io,useChain as Bo,useBalance as Eo,ConnectionStatus as ie,useChains as Do,useActiveConnector as Lo}from"@luno-kit/react";function at(){let e=Vo(),{account:o,address:t}=Io(),{chain:n}=Bo(),r=Do(),{data:a}=Eo({address:t}),i=Lo(),{open:c,isOpen:d}=W(),{open:p,isOpen:f}=j(),{open:l,isOpen:u}=U(),s=e===ie.Connecting,h=e===ie.Connected,x=e===ie.Disconnected||e===ie.Disconnecting,T=!!n&&r.some(N=>N.genesisHash.toLowerCase()===n.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:h,isDisconnected:x,isConnecting:s,account:o,address:t,currentChain:n,configuredChains:r,isChainSupported:T,chainIconUrl:n?.chainIconUrl,chainName:n?.name,balance:a,openConnectModal:c,openAccountModal:p,openChainModal:l,isConnectModalOpen:d,isAccountModalOpen:f,isChainModalOpen:u}}import{useEffect as Oo,useState as _o}from"react";var se=()=>{let[e,o]=_o({height:void 0,width:void 0});return Oo(()=>{let t=ke(()=>{o({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};import Qo from"react";import{Cuer as Ho}from"cuer";import{jsx as _,jsxs as it}from"react/jsx-runtime";var st=({logoBackground:e,uri:o,size:t})=>{if(!o){let a=Math.floor(14.25),i=t/57,c=a*i,d=Math.ceil(57/2-a/2),p=d+a,f=()=>{let s=[];for(let h=0;h<57;h++)for(let x=0;x<57;x++){if(h>=d&&h<p&&x>=d&&x<p||h<8&&x<8||h<8&&x>=49||h>=49&&x<8)continue;let N=x+.5,y=h+.5;s.push(_("rect",{x:N-.4,y:y-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${x}`))}return s},l=({position:s})=>{let h=7*i,x={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return it("div",{className:"absolute z-[4]",style:{width:`${h}px`,height:`${h}px`,...x[s]},children:[_("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),_("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",style:{width:`${3*i}px`,height:`${3*i}px`,borderRadius:`${.5*i}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},u=()=>{let s=d*i;return _("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${c}px`,height:`${c}px`,left:`${s}px`,top:`${s}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:_("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return it("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[_("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:f()}),_("div",{className:"absolute inset-0 z-[100]",style:{background:"linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",backgroundSize:"200% 100%",transform:"scale(1.5) rotate(45deg)",animation:"shimmer 1000ms linear infinite both"}}),l({position:"top-left"}),l({position:"top-right"}),l({position:"bottom-left"}),e&&u()]})}return _(Ho,{arena:e,value:o})};import{formatAddress as Go}from"@luno-kit/react/utils";import{jsx as H,jsxs as K}from"react/jsx-runtime";var J="transition-transform transition-[125] hover:scale-[1.03] transition-ease",$o=({className:e,label:o="Connect Wallet",accountStatus:t="full",chainStatus:n="full",showBalance:r=!0,displayPreference:a="address"})=>{let{isConnected:i,isDisconnected:c,account:d,balance:p,openConnectModal:f,openAccountModal:l,openChainModal:u,chainIconUrl:s,chainName:h,currentChain:x,activeConnector:T}=at(),{width:N}=se(),y=N&&N>768;return c||!i||!T?H("button",{type:"button",onClick:()=>f?.(),className:m("cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none","text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]","rounded-connectButton",J,"px-3.5 text-base leading-base min-h-[40px]",e),children:o}):K("div",{className:m("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[n!=="none"&&K("button",{type:"button",onClick:()=>u?.(),className:m("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",J),"aria-label":"Switch chain",children:[n==="full"||n==="icon"?H($,{chainIconUrl:s,chainName:h,className:"w-[24px] h-[24px]"}):null,(n==="full"||n==="name")&&y&&H("span",{children:x?.name||"Unknown Chain"})]}),K("button",{type:"button",onClick:()=>l?.(),className:m("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",J),"aria-label":"Open account modal",children:[r&&y&&H("div",{className:"p-2 pl-3",children:p?K("span",{children:[p?.formattedTransferable||p?.formattedTotal||0," ",x?.nativeCurrency?.symbol||""]}):H("span",{className:"block animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"})}),K("div",{className:m("flex items-center overflow-hidden bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",r&&y?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&H("span",{className:"w-[24px] h-[24px] flex items-center justify-center",children:H("img",{src:T.icon,alt:"luno"})}),H("span",{"aria-label":"Wallet icon placeholder",className:m(a==="name"&&d?.name?"text-ellipsis overflow-hidden max-w-[100px] whitespace-nowrap":""),children:a==="name"&&d?.name?d?.name:Go(d?.address)})]})]})]})};import{useEffect as Zo,useRef as Fo}from"react";import{jsx as zo}from"react/jsx-runtime";var ct=({size:e=160,dotCount:o=300,duration:t=3,className:n=""})=>{let r=Fo(null);return Zo(()=>{if(!r.current)return;let a=1,i=2,c=Math.PI*(3-Math.sqrt(5)),d=e/2,p=d-i-a,f="http://www.w3.org/2000/svg";r.current.innerHTML="";let l=document.createElementNS(f,"svg");l.setAttribute("width",e.toString()),l.setAttribute("height",e.toString()),l.setAttribute("viewBox",`0 0 ${e} ${e}`),l.style.display="block",r.current.appendChild(l);for(let u=0;u<o;u++){let s=u+.5,h=s/o,x=Math.sqrt(h)*p,T=s*c,N=d+x*Math.cos(T),y=d+x*Math.sin(T),P=document.createElementNS(f,"circle");P.setAttribute("cx",N.toString()),P.setAttribute("cy",y.toString()),P.setAttribute("r",a.toString()),P.setAttribute("fill","currentColor"),P.setAttribute("opacity","0.6"),l.appendChild(P);let S=document.createElementNS(f,"animate");S.setAttribute("attributeName","r"),S.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),S.setAttribute("dur",`${t}s`),S.setAttribute("begin",`${h*t}s`),S.setAttribute("repeatCount","indefinite"),S.setAttribute("calcMode","spline"),S.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),P.appendChild(S);let M=document.createElementNS(f,"animate");M.setAttribute("attributeName","opacity"),M.setAttribute("values","0.2;1;0.2"),M.setAttribute("dur",`${t}s`),M.setAttribute("begin",`${h*t}s`),M.setAttribute("repeatCount","indefinite"),M.setAttribute("calcMode","spline"),M.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),P.appendChild(M)}},[e,o,t]),zo("div",{ref:r,className:m("text-accentColor inline-flex w-full h-full justify-center align-center",n)})};import{Fragment as lt,jsx as g,jsxs as V}from"react/jsx-runtime";var Se=Qo.memo(({selectedConnector:e,onConnect:o,qrCode:t,isWide:n,connectState:r})=>{let a=e?.hasConnectionUri();return V("div",{className:m("flex flex-col items-center",n?"w-[450px] p-4 min-h-[472px]":"justify-center w-full min-h-[400px]"),children:[n&&g("div",{className:"w-full",children:V("div",{className:"flex items-center justify-between",children:[g("div",{}),g(B,{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",children:g(R,{})})]})}),g("div",{className:m("flex items-center gap-4 flex-col grow justify-center",e&&a?"max-w-[300px]":"max-w-[360px]"),children:e?a?V("div",{className:"flex flex-col items-center gap-2.5",children:[g(st,{size:300,logoBackground:e.icon,uri:t}),V("div",{className:"text-base leading-base font-medium text-center text-modalTextSecondary",children:["Scan the QR code with ",e.id==="nova"?"the Nova":"your phone"]}),g("div",{className:"min-h-[20px] flex items-center justify-center ",children:e.links?.browserExtension?V("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don't have ",e.name,"?"]}):t?g(re,{className:"text-sm leading-sm font-medium text-accentColor",copyText:t,label:"Copy Link"}):null})]}):V(lt,{children:[g("div",{className:"w-[80px] h-[80px]",children:g("img",{src:e.icon,className:"w-full h-full",alt:""})}),V("p",{className:"text-lg leading-lg text-modalFont font-bold",children:["Opening ",e.name,"..."]}),g("p",{className:"pb-[10px] text-base text-modalTextSecondary leading-base font-medium text-center",children:"Confirm connection in the extension"}),r.isConnecting&&g("div",{className:"loading text-modalText"}),!e.isInstalled()&&e.links.browserExtension&&V("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer pt-6 text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don\u2018t have ",e.name,"?"]}),!r.isConnecting&&r.isError&&e.isInstalled()&&g("button",{className:m("rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-semibold text-sm text-modalText bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",J),onClick:()=>o(e),children:"Retry"})]}):V(lt,{children:[g("div",{className:"w-[160px] h-[160px] mb-4",children:g(ct,{})}),g("p",{className:"cursor-pointer text-base leading-base text-accentColor font-semibold text-center",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}),g("p",{className:"text-modalTextSecondary w-[250px] text-sm leading-sm font-medium text-center",children:"Connect your wallet to start exploring and interacting with DApps."})]})}),g("div",{})]})});import mt,{useMemo as Wo}from"react";import{useConnectors as jo}from"@luno-kit/react";import{isMobileDevice as Uo}from"@luno-kit/react/utils";import{jsx as I,jsxs as pt}from"react/jsx-runtime";var qo=["polkadot-js","subwallet-js","talisman","walletconnect","nova","nova-mobile"],Ko=["polkagate","fearless-wallet","mimir","enkrypt"],ut=mt.memo(({onConnect:e})=>{let o=jo();if(Uo()){let i=o.filter(c=>c.links.deepLink);return I("div",{className:"flex flex-col items-start gap-1 w-full",children:i.map(c=>I(dt,{connector:c,onConnect:()=>e(c)},`${c.id}-${c.name}`))})}let t=o.filter(i=>i.isInstalled()),n=o.filter(i=>qo.includes(i.id)&&!i.isInstalled()),r=o.filter(i=>Ko.includes(i.id)&&!i.isInstalled()),a=Wo(()=>[{title:"Installed",group:t},{title:"Popular",group:n},{title:"More",group:r}],[t,n,r]);return I("div",{className:"flex flex-col items-start gap-4 w-full overflow-y-auto custom-scrollbar max-h-[400px]",children:a.map(i=>i.group.length===0?null:pt("div",{className:"flex flex-col items-start gap-2 w-full",children:[I("div",{className:m("text-sm font-semibold leading-base",i.title==="Installed"?"text-accentColor":"text-modalTextSecondary"),children:i.title}),I("div",{className:"flex flex-col items-start gap-1.5 w-full",children:i.group.map(c=>I(dt,{connector:c,onConnect:()=>e(c)},c.id))})]},i.title))})}),dt=mt.memo(({connector:e,onConnect:o})=>pt("button",{onClick:o,className:m("cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none","hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]","text-left"),children:[I("div",{className:"w-[28px] h-[28px] rounded-[6px] overflow-hidden",children:I("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),I("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));import{Fragment as Ne,jsx as b,jsxs as X}from"react/jsx-runtime";var Oe=({size:e="wide"})=>{let{isOpen:o,close:t}=W(),{connectAsync:n,reset:r,isPending:a,isError:i}=Yo(),[c,d]=ft(null),[p,f]=ft(),{width:l}=se(),u=l&&l>768,s=!!(e==="wide"&&u),{containerRef:h,currentViewRef:x,resetView:T,handleViewChange:N,currentView:y}=ae({initialView:"Connect Wallet"}),P=async A=>{let Me=await A.getConnectionUri();f(Me)},S=async A=>{if(en()&&A.links.deepLink)try{await n({connectorId:A.id}),M(!1);return}catch{window.location.href=`${A.links.deepLink}?url=${window.location.href}`;return}!s&&N("walletView"),d(A),f(void 0),A.hasConnectionUri()&&P(A),await n({connectorId:A.id}),M(!1)},M=A=>{!A&&t(),r(),T(),d(null),f(void 0)},ht=Xo(()=>({"Connect Wallet":b(ut,{onConnect:S}),walletView:b(Se,{connectState:{isConnecting:a,isError:i},isWide:s,selectedConnector:c,qrCode:p,onConnect:S})}),[s,c,p,S,a,i]);return Jo(()=>{s&&y==="walletView"&&N("Connect Wallet")},[s,y]),b(G,{open:o,onOpenChange:M,children:X("div",{className:m("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[X("div",{className:m("flex flex-col items-start py-4 px-5 w-full md:w-auto",s?"md:min-w-[300px] border-r-[1px] border-r-solid border-r-separatorLine":"md:min-w-[360px]"),children:[X("div",{className:m("flex items-center justify-between w-full",!s&&"pb-4"),children:[y==="Connect Wallet"?X(Ne,{children:[!s&&b("div",{className:"w-[30px] h-[30px]","aria-hidden":!0}),b(E,{className:m("text-lg leading-lg text-modalText font-bold",s?"pb-6":"flex-1 text-center"),children:"Connect Wallet"})]}):X(Ne,{children:[b("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>N("Connect Wallet"),"aria-label":"Back",children:b(q,{})}),b(E,{className:m("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300"),children:c?.name})]}),!s&&b(B,{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",children:b(R,{})})]}),b("div",{ref:h,className:"relative overflow-hidden w-full",children:b("div",{ref:x,children:ht[y]})}),!s&&y==="Connect Wallet"&&b(Ne,{children:b("p",{className:"cursor-pointer w-full pt-4 text-sm leading-sm text-accentColor font-medium text-center hover:text-modalText",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})})]}),s&&b(Se,{connectState:{isConnecting:a,isError:i},isWide:s,selectedConnector:c,qrCode:p,onConnect:S})]})})};export{$o as ConnectButton,Ln as LunoKitProvider,j as useAccountModal,U as useChainModal,Tt as useCloseAllModals,W as useConnectModal,Be as useLunoTheme};
|
|
2
|
+
import{useAccount as To,useActiveConnector as Po}from"@luno-kit/react";import{formatAddress as Ro}from"@luno-kit/react/utils";import{useCallback as Vo,useMemo as nt}from"react";import{jsx as Ae}from"react/jsx-runtime";var xt=e=>Ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:"arrow_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Ae("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"})}),ce=xt;import{jsx as Te}from"react/jsx-runtime";var gt=e=>Te("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Te("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"})}),Q=gt;import{jsx as Pe}from"react/jsx-runtime";var wt=e=>Pe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Pe("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"})}),R=wt;import{jsx as Re}from"react/jsx-runtime";var vt=e=>Re("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...e,children:Re("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"})}),le=vt;import{jsx as Ve}from"react/jsx-runtime";var Ct=e=>Ve("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:Ve("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"})}),de=Ct;import{jsx as Ie}from"react/jsx-runtime";var bt=e=>Ie("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Ie("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"})}),me=bt;import{jsx as Be}from"react/jsx-runtime";var yt=e=>Be("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Be("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"})}),pe=yt;import{jsx as Ee}from"react/jsx-runtime";var St=e=>Ee("svg",{xmlns:"http://www.w3.org/2000/svg",className:"search_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:Ee("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"})}),ue=St;import{jsx as De}from"react/jsx-runtime";var Nt=e=>De("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...e,children:De("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"})}),fe=Nt;import{useCallback as Oe,useRef as Le,useState as _e}from"react";function Y({initialView:e,animationDuration:o=200,animationEasing:t="ease-out"}){let[n,r]=_e(e),[a,i]=_e(!1),c=Le(null),m=Le(null),p=Oe(l=>{if(l===n||a)return;if(i(!0),!c.current){r(l),i(!1);return}let u=c.current,s=u.offsetHeight;r(l),requestAnimationFrame(()=>{if(!u||!m.current){i(!1);return}let h=m.current.offsetHeight;u.animate([{height:s+"px"},{height:h+"px"}],{duration:o,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[n,a,o,t]),f=Oe(()=>{r(e),i(!1)},[e]);return{currentView:n,isAnimating:a,containerRef:c,currentViewRef:m,handleViewChange:p,resetView:f}}import{createContext as kt,useCallback as At,useContext as Tt,useEffect as $e,useMemo as he,useState as ge}from"react";import{useEffect as Mt}from"react";var He=["--color-accentColor","--color-walletSelectItemBackground","--color-walletSelectItemBackgroundHover","--color-walletSelectItemText","--color-connectButtonBackground","--color-connectButtonInnerBackground","--color-connectButtonText","--color-accountActionItemBackground","--color-accountActionItemBackgroundHover","--color-accountActionItemText","--color-accountSelectItemBackground","--color-accountSelectItemBackgroundHover","--color-accountSelectItemText","--color-currentNetworkButtonBackground","--color-currentNetworkButtonText","--color-networkSelectItemBackground","--color-networkSelectItemBackgroundHover","--color-networkSelectItemText","--color-navigationButtonBackground","--color-separatorLine","--color-modalBackground","--color-modalBackdrop","--color-modalBorder","--color-modalText","--color-modalTextSecondary","--color-modalControlButtonBackgroundHover","--color-modalControlButtonText","--color-success","--color-successForeground","--color-warning","--color-warningForeground","--color-error","--color-errorForeground","--color-info","--color-infoForeground","--color-skeleton","--font-body","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],Ge=(e,o)=>{Mt(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([n,r])=>{r&&t.style.setProperty(`--color-${n}`,r)}),Object.entries(e.completeTheme.fonts).forEach(([n,r])=>{r&&t.style.setProperty(`--font-${n}`,r)}),Object.entries(e.completeTheme.radii).forEach(([n,r])=>{r&&t.style.setProperty(`--radius-${n}`,r)}),Object.entries(e.completeTheme.shadows).forEach(([n,r])=>{r&&t.style.setProperty(`--shadow-${n}`,r)}),Object.entries(e.completeTheme.blurs).forEach(([n,r])=>{r&&t.style.setProperty(`--blur-${n}`,r)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",o),Object.keys(e.partialOverrides).length>0&&(He.forEach(r=>{t.style.removeProperty(r)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([r,a])=>{a&&t.style.setProperty(`--color-${r}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([r,a])=>{a&&t.style.setProperty(`--font-${r}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([r,a])=>{a&&t.style.setProperty(`--radius-${r}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([r,a])=>{a&&t.style.setProperty(`--shadow-${r}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([r,a])=>{a&&t.style.setProperty(`--blur-${r}`,a)}))):(t.setAttribute("data-theme",o),He.forEach(n=>{t.style.removeProperty(n)}))},[e,o])};import{jsx as Vt}from"react/jsx-runtime";var we="luno.lastThemePreference",Pt=e=>{try{localStorage.setItem(we,JSON.stringify(e))}catch{}},Ze=kt(void 0),xe=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Rt=()=>{let[e,o]=ge(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return $e(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),n=r=>{o(r.matches?"dark":"light")};return n(t),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e},ve=({children:e,theme:o})=>{let t=Rt(),[n,r]=ge(()=>{if(typeof window<"u")try{let u=localStorage.getItem(we);if(u){let s=JSON.parse(u);if(s?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(s?.preferredTheme)return s.preferredTheme}}catch{}return!o||xe(o)?"light":o.defaultMode||"light"}),[a,i]=ge(()=>{if(typeof window<"u")try{let u=localStorage.getItem(we);if(u)return JSON.parse(u)?.isAuto??!1}catch{}return!o||xe(o)?!1:o.autoMode??!1}),c=he(()=>{if(!o)return{type:"default",completeTheme:null,partialOverrides:null};if(xe(o))return{type:"complete",completeTheme:o,partialOverrides:null};let l=o;if(l.theme)return{type:"complete",completeTheme:l.theme,partialOverrides:null};let u=null;return n==="light"&&l.light?u=l.light:n==="dark"&&l.dark?u=l.dark:u={...l},{type:"partial",completeTheme:null,partialOverrides:u}},[n,o]),m=he(()=>c.type==="complete"?c.completeTheme:null,[c]);Ge(c,n);let p=At(l=>{let u=l==="auto";i(u),r(u?t||"light":l);let s={isAuto:u,...u?{}:{preferredTheme:l}};Pt(s)},[t]);$e(()=>{a&&r(t||"light")},[t,a]);let f=he(()=>({themeMode:n,setThemeChoice:p,currentTheme:m}),[n,p,m]);return Vt(Ze.Provider,{value:f,children:e})},Fe=()=>{let e=Tt(Ze);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};import{LunoProvider as Ht}from"@luno-kit/react";import{QueryClient as Gt,QueryClientProvider as $t}from"@tanstack/react-query";import{useState as Zt}from"react";import{ConnectionStatus as ee,useStatus as It}from"@luno-kit/react";import{createContext as Bt,useCallback as be,useContext as te,useEffect as Et,useMemo as Dt,useState as Ot}from"react";import{jsx as _t}from"react/jsx-runtime";function Ce(){let[e,o]=Ot(!1),t=be(()=>o(!0),[]),n=be(()=>o(!1),[]);return{isOpen:e,open:t,close:n}}var W=Bt(void 0),ze=({children:e})=>{let{isOpen:o,open:t,close:n}=Ce(),{isOpen:r,open:a,close:i}=Ce(),{isOpen:c,open:m,close:p}=Ce(),f=It(),l=be(()=>{n(),i(),p()},[n,i,p]);Et(()=>{f===ee.Disconnected&&(i(),p())},[f,i,p]);let u=Dt(()=>({isConnectModalOpen:o,isAccountModalOpen:r,isChainModalOpen:c,openConnectModal:f!==ee.Connected?t:void 0,closeConnectModal:n,openAccountModal:f===ee.Connected?a:void 0,closeAccountModal:i,openChainModal:f===ee.Connected?m:void 0,closeChainModal:p,closeAllModals:l}),[o,t,n,r,a,i,c,m,p,l,f]);return _t(W.Provider,{value:u,children:e})},j=()=>{let e=te(W);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},U=()=>{let e=te(W);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},q=()=>{let e=te(W);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}},Lt=()=>{let e=te(W);if(!e)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return e.closeAllModals};import{Fragment as zt,jsx as B,jsxs as Qe}from"react/jsx-runtime";var er=({children:e,config:o,queryClientConfig:t,theme:n})=>{let[r]=Zt(()=>new Gt(t));return B($t,{client:r,children:B(Ht,{config:o,children:B(ve,{theme:n,children:Qe(ze,{children:[B("div",{className:"font-base luno-kit",children:e}),B(Ft,{modalSize:o.modalSize})]})})})})},Ft=({modalSize:e})=>Qe(zt,{children:[B(Ue,{size:e}),B(We,{}),B(je,{})]});import{clsx as Qt}from"clsx";import{extendTailwindMerge as Wt}from"tailwind-merge";var jt=Wt({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function d(...e){return jt(Qt(e))}function qe(e,o){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},o)}}import{useCallback as Ut,useState as qt}from"react";import{jsx as Ke,jsxs as Kt}from"react/jsx-runtime";var oe=({copyText:e,label:o,className:t=""})=>{let[n,r]=qt(!1),a=Ut(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),r(!0),setTimeout(()=>r(!1),2e3),!0):!1}catch(c){return console.error("Copy failed:",c),!1}},[]);return Kt("button",{type:"button",className:d("cursor-pointer bg-transparent border-none p-1 m-0 inline-flex items-center justify-center gap-1","rounded-modalControlButton hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",t),onClick:()=>!n&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:n,children:[n?Ke(pe,{className:"text-accentColor",width:16,height:16}):Ke(le,{width:16,height:16}),o]})};import*as A from"@radix-ui/react-dialog";import ye from"react";import{jsx as Je,jsxs as eo}from"react/jsx-runtime";var Jt=({open:e,onOpenChange:o,children:t,contentClassName:n,overlayClassName:r})=>Je(A.Root,{open:e,onOpenChange:o,children:eo(A.Portal,{children:[ye.createElement(A.Overlay,{className:d("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",r)}),Je(A.Content,{className:d("luno-kit font-body fixed z-[200] text-modalText text-base leading-base","bg-modalBackground shadow-modal focus:outline-none overflow-hidden border border-modalBorder","transition-all duration-200","rounded-t-modalMobile bottom-0 left-0 w-full","translate-y-0 -translate-x-0","data-[state=open]:[animation:slide-up_200ms_ease-out]","md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2","md:w-auto md:rounded-modal","md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",n),children:t})]})}),Xt=({children:e,className:o})=>ye.createElement(A.Title,{className:o},e),Yt=({children:e,className:o,onClick:t})=>ye.createElement(A.Close,{className:o,onClick:t},e),G=Jt,E=Yt,D=Xt;import{useAccount as to,useBalance as oo,useChain as no,useChains as ro,useDisconnect as ao}from"@luno-kit/react";import{getExplorerUrl as io}from"@luno-kit/react/utils";import{useMemo as so}from"react";import{jsx as Xe}from"react/jsx-runtime";var $=({chainIconUrl:e,chainName:o,className:t})=>e?Xe("img",{src:e,alt:o||"Chain icon",className:d("w-full h-full object-cover rounded-full",t)}):Xe("div",{className:d("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:o?o.charAt(0).toUpperCase():"C"});import{Fragment as et,jsx as w,jsxs as O}from"react/jsx-runtime";var tt=({onViewChange:e,onModalClose:o})=>{let{address:t}=to(),{chain:n}=no(),r=ro(),{disconnectAsync:a}=ao(),{data:i}=oo({address:r.length>0?t:void 0}),c=so(()=>{let p=[{key:"Chain Name",content:O("div",{className:"flex items-stretch w-full justify-between",children:[O("div",{className:"flex items-center gap-2",children:[w("div",{className:"relative",children:w($,{className:"w-[24px] h-[24px]",chainIconUrl:n?.chainIconUrl,chainName:n?.name})}),O("div",{className:"flex flex-col items-start",children:[w("span",{className:"text-base leading-base text-modalText",children:n?.name||"Polkadot"}),i?O("span",{className:"text-modalTextSecondary text-xs leading-xs",children:[i.formattedTransferable||"0.00"," ",n?.nativeCurrency?.symbol||"DOT"]}):w("span",{className:"animate-pulse rounded w-[80px] h-[16px] bg-skeleton"})]})]}),w("div",{className:"flex items-center justify-center",children:w(ce,{className:"w-[16px] h-[16px] text-modalTextSecondary"})})]}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:O(et,{children:[w(me,{className:"w-[24px] h-[24px]"}),w("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open(io(n?.blockExplorers?.default?.url,t,"address"))}],f=[{key:"Switch Account",content:O(et,{children:[w(fe,{className:"w-[24px] h-[24px]"}),w("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}];return r.length>0?[...p,...f]:[...f]},[e,n,t,i,r]),m=async()=>{await a(),o()};return O("div",{className:"flex flex-col items-center gap-3 w-full",children:[w("div",{className:"flex flex-col gap-1.5 w-full px-4",children:c.map(p=>w(Ye,{onClick:p.onClick,children:p.content},p.key))}),w("div",{className:"w-full mx-[-100px] h-[1px] bg-separatorLine"}),w("div",{className:"w-full px-4 pb-4",children:O(Ye,{onClick:m,children:[w(de,{}),w("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},Ye=({children:e,onClick:o})=>w("button",{type:"button",onClick:()=>o?.(),className:d("w-full p-2.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium","bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover","transition-colors duration-200",o?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});import{useAccount as co,useAccounts as lo,useActiveConnector as mo,useBalance as po,useChain as uo,useChains as fo}from"@luno-kit/react";import{formatAddress as ho}from"@luno-kit/react/utils";import xo,{useCallback as go}from"react";import{jsx as L,jsxs as ne}from"react/jsx-runtime";var Se=({onBack:e})=>{let{accounts:o,selectAccount:t}=lo(),{address:n}=co(),r=go(a=>{t(a),e()},[e]);return L("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:o.map(a=>L(wo,{account:a,isSelected:a.address===n,selectAccount:r},a.address))})};Se.title="Switch Accounts";var wo=xo.memo(({isSelected:e,account:o,selectAccount:t})=>{let{chain:n}=uo(),r=fo(),a=o.address,{data:i}=po({address:r.length>0?a:void 0}),c=mo();return ne("button",{type:"button",onClick:()=>t(o),className:d("px-3.5 py-2.5 w-full rounded-accountSelectItem border-none","bg-accountSelectItemBackground","text-left flex items-center justify-between gap-2","transition-colors duration-200",e?"cursor-auto":"cursor-pointer hover:bg-accountSelectItemBackgroundHover"),"aria-label":o.name||a,disabled:e,children:[ne("div",{className:"flex items-center gap-2 grow overflow-hidden",children:[L("div",{className:"shrink-0 w-[24px] h-[24px] rounded-full flex items-center justify-center",children:c?.icon&&L("img",{src:c?.icon,alt:"luno account"})}),ne("div",{className:"flex flex-col items-start overflow-hidden",children:[L("span",{className:"whitespace-nowrap max-w-full text-ellipsis overflow-hidden font-medium text-sm leading-sm text-accountSelectItemText",children:o.name||ho(a)}),r.length>0&&(i?ne("span",{className:"text-xs text-modalTextSecondary font-medium",children:[i?.formattedTransferable||"0.00"," ",n?.nativeCurrency?.symbol||"DOT"]}):L("span",{className:"animate-pulse rounded w-[60px] h-[16px] bg-skeleton"}))]})]}),e&&L("div",{className:"shrink-0 border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]",children:L("div",{className:"rounded-full bg-accentColor w-[10px] h-[10px]"})})]})});import{useApi as vo,useChain as Co,useChains as bo,useSwitchChain as yo}from"@luno-kit/react";import So,{useMemo as No,useState as ot}from"react";import{Fragment as ko,jsx as C,jsxs as Z}from"react/jsx-runtime";var re=({onChainSwitched:e,className:o=""})=>{let{chain:t}=Co(),n=bo(),{switchChainAsync:r}=yo(),{isApiReady:a,apiError:i}=vo(),[c,m]=ot(null),[p,f]=ot(""),l=No(()=>n.filter(s=>p.trim()?s.name.toLowerCase().includes(p.toLowerCase()):!0),[n,p]),u=async s=>{if(s.genesisHash!==t?.genesisHash&&!(!a&&!i)){m(s.genesisHash);try{await r({chainId:s.genesisHash}),e?.(s)}catch(h){console.error("Failed to switch chain:",h)}finally{m(null)}}};return Z("div",{className:d("flex flex-col gap-3.5",o),children:[C("div",{className:"relative pt-1",children:Z("div",{className:"relative",children:[C(ue,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-modalTextSecondary"}),C("input",{type:"text",placeholder:"Search by name",value:p,onChange:s=>f(s.target.value),className:"w-full pl-10 pr-3 py-2 text-sm border border-networkSelectItemBackgroundHover rounded-md focus:ring-2 focus:ring-accentColor focus:outline-none focus:border-transparent"})]})}),l.length>0&&C("div",{className:"flex flex-col gap-1.5 overflow-y-auto max-h-[380px]",children:l.map(s=>C(Mo,{chain:s,isSelected:s.genesisHash===t?.genesisHash,onSelect:u,isLoading:(c===s.genesisHash||!a)&&!i,isSwitching:c===s.genesisHash},s.genesisHash))}),l.length===0&&C("div",{className:"flex items-center justify-center py-12",children:C("span",{className:"text-modalTextSecondary text-xs",children:"No chains available"})})]})},Mo=So.memo(({chain:e,isSelected:o,isLoading:t,onSelect:n,isSwitching:r})=>Z("button",{onClick:()=>n(e),disabled:o||t,className:d("flex items-center justify-between p-2.5 rounded-networkSelectItem","bg-networkSelectItemBackground","transition-colors duration-200",o||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[Z("div",{className:"flex items-center gap-2",children:[C($,{className:"w-[20px] h-[20px] flex items-center justify-center leading-[20px]",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),C("div",{className:"flex flex-col items-start",children:C("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),C("div",{className:"flex items-center justify-center h-[20px]",children:o?t?Z(ko,{children:[C("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:r?"Switching":"Connecting"}),C("div",{className:"loading text-accentColor w-[15px] h-[15px]"})]}):Z("span",{className:"status-dot-container",children:[C("span",{className:"ping-animation"}),C("span",{className:"status-dot"})]}):null})]}));import{jsx as Ao}from"react/jsx-runtime";var ae=({onBack:e})=>Ao(re,{className:"p-4 pt-0"});ae.title="Select Networks";import{Fragment as Io,jsx as v,jsxs as F}from"react/jsx-runtime";var We=()=>{let{isOpen:e,close:o}=U(),{address:t,account:n}=To(),r=Po(),{currentView:a,containerRef:i,currentViewRef:c,handleViewChange:m,resetView:p}=Y({initialView:"main"}),f=Vo(()=>{o(),p()},[o]),l=nt(()=>a==="switchAccount"?"Switch Account":a==="switchChain"?ae.title:null,[a]),u=nt(()=>({main:v(tt,{onViewChange:m,onModalClose:f}),switchAccount:v(Se,{onBack:()=>m("main")}),switchChain:v(ae,{onBack:()=>m("main")})}),[m,f]);return v(G,{open:e,onOpenChange:f,children:F("div",{className:d("flex flex-col w-full md:w-[360px] max-h-[512px] text-modalText","bg-modalBackground shadow-modal",a==="main"?"gap-5":"gap-3.5"),children:[F("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[a==="main"?F("div",{className:"flex items-center gap-3 max-w-[80%]",children:[r?.icon&&v("div",{className:"flex items-center justify-center w-[40px] h-[40px] shrink-0",children:v("img",{src:r.icon,alt:"",className:"w-full h-full object-contain"})}),F("div",{className:"flex flex-col items-start gap-1.5 max-w-full",children:[v(D,{className:"sr-only",children:"Account Details"}),F("div",{className:"flex items-center gap-0.5 w-full ",children:[v("span",{className:"text-base text-modalText font-semibold",children:Ro(t)}),v(oe,{copyText:t})]}),v("div",{className:d("text-sm leading-sm text-modalTextSecondary font-medium text-ellipsis overflow-hidden whitespace-nowrap",n?.name&&n?.name.length>30?"w-[90%]":""),children:n?.name||r?.name})]})]}):F(Io,{children:[v("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>m("main"),"aria-label":"Back",children:v(Q,{})}),v(D,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:l})]}),v(E,{className:"shrink-0 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:v(R,{})})]}),v("div",{ref:i,className:"relative",children:v("div",{ref:c,children:u[a]})})]})})};import{jsx as z,jsxs as rt}from"react/jsx-runtime";var je=()=>{let{isOpen:e,close:o}=q();return z(G,{open:e,onOpenChange:t=>!t&&o(),children:rt("div",{className:"flex flex-col w-full md:w-[360px] max-h-[512px] p-4 gap-3.5 text-modalText",children:[rt("div",{className:"flex items-center justify-between w-full",children:[z("div",{className:"w-[30px]"})," ",z(D,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),z(E,{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:z(R,{})})]}),z(re,{})]})})};import{formatAddress as $o}from"@luno-kit/react/utils";import{ConnectionStatus as ie,useAccount as Bo,useActiveConnector as Eo,useBalance as Do,useChain as Oo,useChains as Lo,useStatus as _o}from"@luno-kit/react";function at(){let e=_o(),{account:o,address:t}=Bo(),{chain:n}=Oo(),r=Lo(),{data:a}=Do({address:r.length>0?t:void 0}),i=Eo(),{open:c,isOpen:m}=j(),{open:p,isOpen:f}=U(),{open:l,isOpen:u}=q(),s=e===ie.Connecting,h=e===ie.Connected,x=e===ie.Disconnected||e===ie.Disconnecting,T=!!n&&r.some(N=>N.genesisHash.toLowerCase()===n.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:h,isDisconnected:x,isConnecting:s,account:o,address:t,currentChain:n,configuredChains:r,isChainSupported:T,chainIconUrl:n?.chainIconUrl,chainName:n?.name,balance:a,openConnectModal:c,openAccountModal:p,openChainModal:l,isConnectModalOpen:m,isAccountModalOpen:f,isChainModalOpen:u}}import{useEffect as Ho,useState as Go}from"react";var se=()=>{let[e,o]=Go({height:void 0,width:void 0});return Ho(()=>{let t=qe(()=>{o({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};import{jsx as _,jsxs as K}from"react/jsx-runtime";var J="transition-transform transition-[125] hover:scale-[1.03] transition-ease",Zo=({className:e,label:o="Connect Wallet",accountStatus:t="full",chainStatus:n="full",showBalance:r=!0,displayPreference:a="address"})=>{let{isConnected:i,isDisconnected:c,account:m,balance:p,openConnectModal:f,openAccountModal:l,openChainModal:u,chainIconUrl:s,chainName:h,currentChain:x,configuredChains:T,activeConnector:N}=at(),{width:M}=se(),y=M&&M>768;return c||!i||!N?_("button",{type:"button",onClick:()=>f?.(),className:d("cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none","text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]","rounded-connectButton",J,"px-3.5 text-base leading-base min-h-[40px]",e),children:o}):K("div",{className:d("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[n!=="none"&&T.length>0&&K("button",{type:"button",onClick:()=>u?.(),className:d("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",J),"aria-label":"Switch chain",children:[n==="full"||n==="icon"?_($,{chainIconUrl:s,chainName:h,className:"w-[24px] h-[24px]"}):null,(n==="full"||n==="name")&&y&&_("span",{children:x?.name||"Unknown Chain"})]}),K("button",{type:"button",onClick:()=>l?.(),className:d("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",J),"aria-label":"Open account modal",children:[T.length>0&&r&&y&&_("div",{className:"p-2 pl-3",children:p?K("span",{children:[p?.formattedTransferable||p?.formattedTotal||0," ",x?.nativeCurrency?.symbol||""]}):_("span",{className:"block animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"})}),K("div",{className:d("flex items-center overflow-hidden bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",T.length>0&&r&&y?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&_("span",{className:"w-[24px] h-[24px] flex items-center justify-center",children:_("img",{src:N.icon,alt:"luno"})}),_("span",{"aria-label":"Wallet icon placeholder",className:d(a==="name"&&m?.name?"text-ellipsis overflow-hidden max-w-[115px] whitespace-nowrap":""),children:a==="name"&&m?.name?m?.name:$o(m?.address)})]})]})]})};import{useConnect as Yo}from"@luno-kit/react";import{isMobileDevice as en}from"@luno-kit/react/utils";import{useEffect as tn,useMemo as on,useState as ft}from"react";import{useConnectors as Fo}from"@luno-kit/react";import{isMobileDevice as zo}from"@luno-kit/react/utils";import st,{useMemo as Qo}from"react";import{jsx as V,jsxs as lt}from"react/jsx-runtime";var Wo=["polkadot-js","subwallet-js","talisman","walletconnect","nova","nova-mobile"],jo=["polkagate","fearless-wallet","mimir","enkrypt"],ct=st.memo(({onConnect:e})=>{let o=Fo();if(zo()){let i=o.filter(c=>c.links.deepLink);return V("div",{className:"flex flex-col items-start gap-1 w-full",children:i.map(c=>V(it,{connector:c,onConnect:()=>e(c)},`${c.id}-${c.name}`))})}let t=o.filter(i=>i.isInstalled()),n=o.filter(i=>Wo.includes(i.id)&&!i.isInstalled()),r=o.filter(i=>jo.includes(i.id)&&!i.isInstalled()),a=Qo(()=>[{title:"Installed",group:t},{title:"Popular",group:n},{title:"More",group:r}],[t,n,r]);return V("div",{className:"flex flex-col items-start gap-4 w-full overflow-y-auto custom-scrollbar max-h-[400px]",children:a.map(i=>i.group.length===0?null:lt("div",{className:"flex flex-col items-start gap-2 w-full",children:[V("div",{className:d("text-sm font-semibold leading-base",i.title==="Installed"?"text-accentColor":"text-modalTextSecondary"),children:i.title}),V("div",{className:"flex flex-col items-start gap-1.5 w-full",children:i.group.map(c=>V(it,{connector:c,onConnect:()=>e(c)},c.id))})]},i.title))})}),it=st.memo(({connector:e,onConnect:o})=>lt("button",{onClick:o,className:d("cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none","hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]","text-left"),children:[V("div",{className:"w-[28px] h-[28px] rounded-[6px] overflow-hidden",children:V("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),V("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));import Xo from"react";import{Cuer as Uo}from"cuer";import{jsx as H,jsxs as dt}from"react/jsx-runtime";var mt=({logoBackground:e,uri:o,size:t})=>{if(!o){let a=Math.floor(14.25),i=t/57,c=a*i,m=Math.ceil(57/2-a/2),p=m+a,f=()=>{let s=[];for(let h=0;h<57;h++)for(let x=0;x<57;x++){if(h>=m&&h<p&&x>=m&&x<p||h<8&&x<8||h<8&&x>=49||h>=49&&x<8)continue;let N=x+.5,M=h+.5;s.push(H("rect",{x:N-.4,y:M-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${h}-${x}`))}return s},l=({position:s})=>{let h=7*i,x={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return dt("div",{className:"absolute z-[4]",style:{width:`${h}px`,height:`${h}px`,...x[s]},children:[H("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),H("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",style:{width:`${3*i}px`,height:`${3*i}px`,borderRadius:`${.5*i}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},u=()=>{let s=m*i;return H("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${c}px`,height:`${c}px`,left:`${s}px`,top:`${s}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:H("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return dt("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[H("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:f()}),H("div",{className:"absolute inset-0 z-[100]",style:{background:"linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",backgroundSize:"200% 100%",transform:"scale(1.5) rotate(45deg)",animation:"shimmer 1000ms linear infinite both"}}),l({position:"top-left"}),l({position:"top-right"}),l({position:"bottom-left"}),e&&u()]})}return H(Uo,{arena:e,value:o})};import{useEffect as qo,useRef as Ko}from"react";import{jsx as Jo}from"react/jsx-runtime";var pt=({size:e=160,dotCount:o=300,duration:t=3,className:n=""})=>{let r=Ko(null);return qo(()=>{if(!r.current)return;let a=1,i=2,c=Math.PI*(3-Math.sqrt(5)),m=e/2,p=m-i-a,f="http://www.w3.org/2000/svg";r.current.innerHTML="";let l=document.createElementNS(f,"svg");l.setAttribute("width",e.toString()),l.setAttribute("height",e.toString()),l.setAttribute("viewBox",`0 0 ${e} ${e}`),l.style.display="block",r.current.appendChild(l);for(let u=0;u<o;u++){let s=u+.5,h=s/o,x=Math.sqrt(h)*p,T=s*c,N=m+x*Math.cos(T),M=m+x*Math.sin(T),y=document.createElementNS(f,"circle");y.setAttribute("cx",N.toString()),y.setAttribute("cy",M.toString()),y.setAttribute("r",a.toString()),y.setAttribute("fill","currentColor"),y.setAttribute("opacity","0.6"),l.appendChild(y);let S=document.createElementNS(f,"animate");S.setAttribute("attributeName","r"),S.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),S.setAttribute("dur",`${t}s`),S.setAttribute("begin",`${h*t}s`),S.setAttribute("repeatCount","indefinite"),S.setAttribute("calcMode","spline"),S.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),y.appendChild(S);let k=document.createElementNS(f,"animate");k.setAttribute("attributeName","opacity"),k.setAttribute("values","0.2;1;0.2"),k.setAttribute("dur",`${t}s`),k.setAttribute("begin",`${h*t}s`),k.setAttribute("repeatCount","indefinite"),k.setAttribute("calcMode","spline"),k.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),y.appendChild(k)}},[e,o,t]),Jo("div",{ref:r,className:d("text-accentColor inline-flex w-full h-full justify-center align-center",n)})};import{Fragment as ut,jsx as g,jsxs as I}from"react/jsx-runtime";var Ne=Xo.memo(({selectedConnector:e,onConnect:o,qrCode:t,isWide:n,connectState:r})=>{let a=e?.hasConnectionUri();return I("div",{className:d("flex flex-col items-center",n?"w-[450px] p-4 min-h-[472px]":"justify-center w-full min-h-[400px]"),children:[n&&g("div",{className:"w-full",children:I("div",{className:"flex items-center justify-between",children:[g("div",{}),g(E,{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",children:g(R,{})})]})}),g("div",{className:d("flex items-center gap-4 flex-col grow justify-center",e&&a?"max-w-[300px]":"max-w-[360px]"),children:e?a?I("div",{className:"flex flex-col items-center gap-2.5",children:[g(mt,{size:300,logoBackground:e.icon,uri:t}),I("div",{className:"text-base leading-base font-medium text-center text-modalTextSecondary",children:["Scan the QR code with"," ",e.id==="nova"?"the Nova":"your phone"]}),g("div",{className:"min-h-[20px] flex items-center justify-center ",children:e.links?.browserExtension?I("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don't have ",e.name,"?"]}):t?g(oe,{className:"text-sm leading-sm font-medium text-accentColor",copyText:t,label:"Copy Link"}):null})]}):I(ut,{children:[g("div",{className:"w-[80px] h-[80px]",children:g("img",{src:e.icon,className:"w-full h-full",alt:""})}),I("p",{className:"text-lg leading-lg text-modalFont font-bold",children:["Opening ",e.name,"..."]}),g("p",{className:"pb-[10px] text-base text-modalTextSecondary leading-base font-medium text-center",children:"Confirm connection in the extension"}),r.isConnecting&&g("div",{className:"loading text-modalText"}),!e.isInstalled()&&e.links.browserExtension&&I("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer pt-6 text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don\u2018t have ",e.name,"?"]}),!r.isConnecting&&r.isError&&e.isInstalled()&&g("button",{className:d("rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-semibold text-sm text-modalText bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",J),onClick:()=>o(e),children:"Retry"})]}):I(ut,{children:[g("div",{className:"w-[160px] h-[160px] mb-4",children:g(pt,{})}),g("p",{className:"cursor-pointer text-base leading-base text-accentColor font-semibold text-center",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}),g("p",{className:"text-modalTextSecondary w-[250px] text-sm leading-sm font-medium text-center",children:"Connect your wallet to start exploring and interacting with DApps."})]})}),g("div",{})]})});import{Fragment as Me,jsx as b,jsxs as X}from"react/jsx-runtime";var Ue=({size:e="wide"})=>{let{isOpen:o,close:t}=j(),{connectAsync:n,reset:r,isPending:a,isError:i}=Yo(),[c,m]=ft(null),[p,f]=ft(),{width:l}=se(),u=l&&l>768,s=!!(e==="wide"&&u),{containerRef:h,currentViewRef:x,resetView:T,handleViewChange:N,currentView:M}=Y({initialView:"Connect Wallet"}),y=async P=>{let ke=await P.getConnectionUri();f(ke)},S=async P=>{if(en()&&P.links.deepLink)try{await n({connectorId:P.id}),k(!1);return}catch{window.location.href=`${P.links.deepLink}?url=${window.location.href}`;return}!s&&N("walletView"),m(P),f(void 0),P.hasConnectionUri()&&y(P),await n({connectorId:P.id}),k(!1)},k=P=>{!P&&t(),r(),T(),m(null),f(void 0)},ht=on(()=>({"Connect Wallet":b(ct,{onConnect:S}),walletView:b(Ne,{connectState:{isConnecting:a,isError:i},isWide:s,selectedConnector:c,qrCode:p,onConnect:S})}),[s,c,p,S,a,i]);return tn(()=>{s&&M==="walletView"&&N("Connect Wallet")},[s,M]),b(G,{open:o,onOpenChange:k,children:X("div",{className:d("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[X("div",{className:d("flex flex-col items-start py-4 px-5 w-full md:w-auto",s?"md:min-w-[300px] border-r-[1px] border-r-solid border-r-separatorLine":"md:min-w-[360px]"),children:[X("div",{className:d("flex items-center justify-between w-full",!s&&"pb-4"),children:[M==="Connect Wallet"?X(Me,{children:[!s&&b("div",{className:"w-[30px] h-[30px]","aria-hidden":!0}),b(D,{className:d("text-lg leading-lg text-modalText font-bold",s?"pb-6":"flex-1 text-center"),children:"Connect Wallet"})]}):X(Me,{children:[b("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>N("Connect Wallet"),"aria-label":"Back",children:b(Q,{})}),b(D,{className:d("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300"),children:c?.name})]}),!s&&b(E,{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",children:b(R,{})})]}),b("div",{ref:h,className:"relative overflow-hidden w-full",children:b("div",{ref:x,children:ht[M]})}),!s&&M==="Connect Wallet"&&b(Me,{children:b("p",{className:"cursor-pointer w-full pt-4 text-sm leading-sm text-accentColor font-medium text-center hover:text-modalText",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})})]}),s&&b(Ne,{connectState:{isConnecting:a,isError:i},isWide:s,selectedConnector:c,qrCode:p,onConnect:S})]})})};export{Zo as ConnectButton,er as LunoKitProvider,U as useAccountModal,q as useChainModal,Lt as useCloseAllModals,j as useConnectModal,Fe as useLunoTheme};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|