@xyo-network/react-connected-accounts 2.78.0 → 2.78.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,575 @@
1
- "use strict";var He=Object.create;var H=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,_e=Object.prototype.hasOwnProperty;var ze=(o,e)=>{for(var t in e)H(o,t,{get:e[t],enumerable:!0})},pe=(o,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Xe(e))!_e.call(o,n)&&n!==t&&H(o,n,{get:()=>e[n],enumerable:!(l=Ke(e,n))||l.enumerable});return o};var Ce=(o,e,t)=>(t=o!=null?He(Ve(o)):{},pe(e||!o||!o.__esModule?H(t,"default",{value:o,enumerable:!0}):t,o)),Je=o=>pe(H({},"__esModule",{value:!0}),o);var Ue={};ze(Ue,{CheckboxFormControl:()=>U,ConnectWalletDialog:()=>Z,ConnectedAccountsFlexbox:()=>Be,ConnectedWalletState:()=>ne,ConnectedWalletTableCells:()=>re,ConnectedWalletsAccountsTableCell:()=>ee,ConnectedWalletsActionsTableCell:()=>oe,ConnectedWalletsChainNameTableCell:()=>te,ConnectedWalletsTable:()=>ce,ConnectedWalletsWalletTableCell:()=>ae,EnabledEthWalletConnections:()=>k,RevokeWalletConnectionDialog:()=>j,WalletConnectionsTableRow:()=>ie,useActiveProviderDialogState:()=>_,useDetectedWallets:()=>$,useEnabledWallets:()=>G,useEnabledWalletsInner:()=>ge});module.exports=Je(Ue);var me="XYO|EnabledWallets",k=class{persistPreferences=!0;enabledWallets={};ethWalletsState={};listeners=[];localStorageKey=me;constructor(e=me){this.localStorageKey=e,this.reviveSettings()}get wallets(){return this.ethWalletsState}disableWallet(e){this.toggleEnabledWallet(e,!1)}enableWallet(e){this.toggleEnabledWallet(e,!0)}resetWallets(e){let t={},l=([n,a])=>{t[n]={enabled:n in this.enabledWallets?this.enabledWallets[n]:!0,wallet:a}};Object.entries(e).forEach(l.bind(this)),this.ethWalletsState=t,this.emitChange()}subscribe(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}toggleEnabledWallet(e,t){e&&this.ethWalletsState[e]&&(this.ethWalletsState[e].enabled=t,this.ethWalletsState={...this.ethWalletsState},this.emitChange())}emitChange(){for(let e of this.listeners)e();this.persistSettings()}isPersistance(e){this.persistPreferences&&e()}persistSettings(){this.isPersistance(()=>{let e=Object.entries(this.ethWalletsState).reduce((t,[l,{enabled:n}])=>(t[l]=n,t),{});localStorage.setItem(this.localStorageKey,JSON.stringify(e))})}reviveSettings(){this.isPersistance(()=>{let e=localStorage.getItem(this.localStorageKey);try{let t=e?JSON.parse(e):{};this.enabledWallets=t}catch(t){console.warn(`Error parsing saved enabled wallet entries: ${t.message}`)}})}};var Y=require("@mui/material"),de=require("@xylabs/react-flexbox"),Le=require("react");var R=require("@xylabs/react-crypto"),u=require("react"),$e=o=>Object.values(o).reduce((e,t)=>(t.allowedAccounts.length>0?e.unshift(t):e.push(t),e),[]),$=()=>{let o=(0,R.useWalletDiscovery)(),[e,t]=(0,u.useState)(0),[l,n]=(0,u.useState)([]);(0,u.useEffect)(()=>{n($e(o))},[o,e]),(0,u.useEffect)(()=>{let r=()=>{t(f=>f+1)};return window.addEventListener(R.AccountsChangedEventName,r),()=>{window.removeEventListener(R.AccountsChangedEventName,r)}},[o]);let a=(0,u.useMemo)(()=>Object.values(l).reduce((r,f)=>r+f.allowedAccounts.length,0),[l]);return{sortedWallets:l,totalConnectedAccounts:a}};var be=require("@xylabs/react-crypto"),I=require("react");var b,ge=o=>{let e=(0,be.useWalletDiscovery)(),t=(0,I.useMemo)(()=>{b===void 0&&(b=new k),b.resetWallets(e);for(let[l,n]of Object.entries(o??{}))b?.toggleEnabledWallet(l,n);return b},[e,o]);return(0,I.useSyncExternalStore)(t.subscribe.bind(t),()=>t.wallets)},G=o=>{let e=ge(o),t=(0,I.useMemo)(()=>Object.entries(e).reduce((l,[n,a])=>(a.enabled&&(l[n]=a),l),{}),[e]);return{disableWallet:b?.disableWallet.bind(b),enableWallet:b?.enableWallet.bind(b),enabledWallets:t,wallets:e}};var w=require("@mui/material"),L=require("react/jsx-runtime"),U=({onCheckChanged:o,...e})=>(0,L.jsx)(w.FormControl,{...e,children:(0,L.jsxs)(w.FormLabel,{children:[(0,L.jsx)(w.Checkbox,{onChange:(t,l)=>o?.(l)}),"Do not show this again."]})});var d=require("@mui/material");var he=require("@mui/icons-material"),Q=require("@mui/material"),fe=require("@xylabs/react-crypto"),B=require("@xylabs/react-flexbox");var q=Ce(require("./xyo-color-logo-LHR2SMEM.svg"),1),Ge=Ce(require("./xyo-color-logo-text-only-QPAW5BSQ.svg"),1);var C=require("react/jsx-runtime"),ve=({icon:o,providerName:e,...t})=>(0,C.jsxs)(B.FlexRow,{gap:4,justifyContent:"space-evenly",...t,children:[(0,C.jsxs)(B.FlexCol,{gap:.5,children:[(0,C.jsx)("img",{alt:"XYO Logo",src:q.default,style:{height:"48px"}}),(0,C.jsx)(Q.Typography,{variant:"subtitle1",children:"XYO App"})]}),(0,C.jsx)(he.SyncAlt,{fontSize:"large"}),(0,C.jsxs)(B.FlexCol,{gap:.5,children:[(0,C.jsx)(fe.ConstrainedImage,{constrainedValue:"48px",src:o,alt:e,style:{height:"48px",maxWidth:"48px"}}),(0,C.jsx)(Q.Typography,{variant:"subtitle1",children:e})]})]});var O=require("@mui/material"),ue=require("@xylabs/react-flexbox"),g=require("react/jsx-runtime"),We=o=>(0,g.jsxs)(ue.FlexCol,{gap:4,...o,children:[(0,g.jsx)(O.Typography,{fontWeight:"bold",sx:{textAlign:"center"},children:"This will allow XYO to:"}),(0,g.jsxs)("ul",{children:[(0,g.jsx)("li",{children:"View your wallet account(s) and address(es)"}),(0,g.jsx)("li",{children:"Read-only access to browse the public blockchain(s) you select"})]}),(0,g.jsxs)(O.Typography,{variant:"subtitle1",sx:{textAlign:"center"},children:["You control what accounts to share and what blockchains to view. You can see or revoke access via your wallet's settings at anytime. View more on XYO's sovereign data philosophy"," ",(0,g.jsx)(O.Link,{href:"https://cointelegraph.com/innovation-circle/decentralization-and-sovereignty-debunking-our-approach-to-digital-sovereignty",sx:{fontWeight:"bold"},target:"_blank",children:"here"}),"."]})]});var c=require("react/jsx-runtime"),Z=({activeProvider:o,onIgnoreConnectDialog:e,...t})=>{let{icon:l,providerName:n}=o??{};return(0,c.jsxs)(d.Dialog,{PaperProps:{sx:{display:"flex",gap:4}},...t,children:[(0,c.jsx)(d.DialogTitle,{sx:{textAlign:"center"},children:"XYO Wants To Access The Blockchain on Your Behalf"}),(0,c.jsxs)(d.DialogContent,{sx:{display:"flex",flexDirection:"column",gap:4},children:[(0,c.jsx)(ve,{icon:l,providerName:n}),(0,c.jsx)(We,{}),(0,c.jsx)(U,{onCheckChanged:e})]}),(0,c.jsxs)(d.DialogActions,{children:[(0,c.jsx)(d.Button,{variant:"outlined",onClick:()=>t.onClose?.({},"escapeKeyDown"),children:"Close"}),(0,c.jsx)(d.Button,{variant:"contained",onClick:async()=>{try{await o?.connectWallet?.(),t.onClose?.({},"escapeKeyDown")}catch(r){console.warn(`Error connecting to wallet: ${r.message}`)}},children:"Connect"})]})]})};var s=require("@mui/material"),xe=require("@xylabs/react-crypto"),Pe=require("@xylabs/react-flexbox"),p=require("react/jsx-runtime"),j=({activeProvider:o,...e})=>(0,p.jsxs)(s.Dialog,{...e,children:[(0,p.jsxs)(Pe.FlexRow,{gap:2,justifyContent:"start",pl:2,children:[(0,p.jsx)(xe.ConstrainedImage,{src:o?.icon,constrainedValue:"24px"}),(0,p.jsxs)(s.DialogTitle,{sx:{pl:0},children:["Revoke ",o?.providerName," Access"]})]}),(0,p.jsxs)(s.DialogContent,{children:[(0,p.jsxs)(s.Typography,{children:["Revoking access to your wallet must be done from the wallet's browser extension. Wallets grant access to specific domains please consult ",o?.providerName,"'s documentation on how to revoke access to this website:"]}),(0,p.jsx)(s.Typography,{children:window.location.origin})]}),(0,p.jsx)(s.DialogActions,{children:(0,p.jsx)(s.Button,{variant:"contained",onClick:()=>e.onClose?.({},"escapeKeyDown"),children:"Close"})})]});var S=require("@mui/material"),N=require("react/jsx-runtime"),ee=({additionalAccounts:o,currentAccount:e,totalAccounts:t,tableCellProps:l})=>(0,N.jsx)(S.TableCell,{...l,children:(0,N.jsx)(S.Tooltip,{sx:{cursor:t>0?"pointer":"auto"},title:[...e??[],...o??[]].map((n,a)=>(0,N.jsx)("p",{children:n},a)),children:(0,N.jsx)(S.Typography,{children:t})})});var K=require("@mui/icons-material"),W=require("@mui/material"),Te=require("@xylabs/react-flexbox"),h=require("react/jsx-runtime"),oe=({connected:o,onConnect:e,onRevoke:t,tableCellProps:l})=>(0,h.jsx)(W.TableCell,{...l,children:(0,h.jsxs)(Te.FlexRow,{gap:2,justifyContent:"start",children:[o?(0,h.jsxs)(W.Typography,{sx:{display:"inline-flex",gap:.5},children:[(0,h.jsx)(K.Check,{}),"Connected"]}):(0,h.jsx)(W.Button,{variant:"contained",onClick:e,children:"Connect"}),o?(0,h.jsx)(W.IconButton,{onClick:t,children:(0,h.jsx)(K.InfoOutlined,{})}):null]})});var ye=require("@mui/material"),we=require("react/jsx-runtime"),te=({chainName:o,tableCellProps:e})=>(0,we.jsx)(ye.TableCell,{...e,children:o});var X=require("@mui/material"),Se=require("react");var le=require("react/jsx-runtime"),ne=({connected:o,walletRdns:e,tableCellProps:t})=>{let{disableWallet:l,enableWallet:n,wallets:a}=G(),r=(0,Se.useMemo)(()=>e?a[e].enabled:!1,[a,e]);return(0,le.jsx)(X.TableCell,{...t,children:(0,le.jsx)(X.Switch,{disabled:!o,checked:o&&r,onChange:v=>{let P=v.target?.checked;e&&(P?n?.(e):l?.(e))}})})};var V=require("@mui/material"),Ae=require("@xylabs/react-crypto"),Ee=require("@xylabs/react-flexbox"),M=require("react/jsx-runtime"),ae=({icon:o,walletName:e,tableCellProps:t})=>{let l=(0,V.useTheme)();return(0,M.jsx)(V.TableCell,{...t,children:(0,M.jsxs)(Ee.FlexRow,{gap:2,justifyContent:"start",children:[(0,M.jsx)(Ae.ConstrainedImage,{constrainedValue:l.spacing(4),src:o}),e]})})};var re=[ae,te,ee,oe,ne];var m=require("@mui/material"),Ie=require("react");var Fe=[{disablePadding:!1,id:"wallet",label:"Wallet",numeric:!1,showOnMobile:!0},{disablePadding:!1,id:"chain",label:"Chain",numeric:!1,showOnMobile:!0},{disablePadding:!1,id:"accounts",label:"Accounts",numeric:!0,showOnMobile:!0},{disablePadding:!1,id:"actions",label:"Actions",numeric:!1,showOnMobile:!0},{disablePadding:!1,id:"enabled",label:"Enabled",numeric:!1,showOnMobile:!0}];var De=require("@mui/material"),ke=require("@xylabs/react-crypto"),A=require("react");var se=require("react/jsx-runtime"),ie=({ignoreConnectDialog:o,onConnectClick:e,onRevoke:t,wallet:l,...n})=>{let{currentAccount:a,additionalAccounts:r,chainName:f,connectWallet:v,providerInfo:P}=(0,ke.useEthWallet)(l),E=a?.toString()?[a.toString()]:[],z=(r?.length??0)+(E?.length??0),T=!!(E?.length??!1),{icon:F,name:D,rdns:J}=(0,A.useMemo)(()=>P??{icon:void 0,name:void 0,rdns:void 0},[P]),y=(0,A.useMemo)(()=>({connectWallet:v,icon:F,providerName:D}),[v,F,D]),Oe=(0,A.useCallback)(()=>{t?.(y)},[y,t]),Ne=(0,A.useCallback)(async()=>{o?await v?.():e?.(y)},[y,v,o,e]);return(0,se.jsx)(De.TableRow,{...n,children:Object.values(re).map((Me,Ye)=>(0,se.jsx)(Me,{additionalAccounts:r,chainName:f,connected:T,currentAccount:E,icon:F,onConnect:Ne,onRevoke:Oe,totalAccounts:z,walletName:D,walletRdns:J},Ye))})};var Re=require("react"),_=o=>{let[e,t]=(0,Re.useState)(!1);return[e,a=>{t(!0),o(a)},()=>{t(!1),o({})}]};var i=require("react/jsx-runtime"),ce=({ignoreConnectDialog:o,onIgnoreConnectDialog:e,wallets:t,...l})=>{let[n,a]=(0,Ie.useState)(),[r,f,v]=_(a),[P,E,z]=_(a);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(m.Table,{...l,children:[(0,i.jsx)(m.TableHead,{children:(0,i.jsx)(m.TableRow,{children:Fe.map(({disablePadding:T,id:F,label:D,align:J,width:y})=>(0,i.jsx)(m.TableCell,{align:J,padding:T?"none":"normal",width:y??"auto",children:D},F))})}),(0,i.jsx)(m.TableBody,{children:(t??[]).map(T=>(0,i.jsx)(ie,{ignoreConnectDialog:o,onConnectClick:f,onRevoke:E,wallet:T},T.providerInfo?.rdns))})]}),(0,i.jsx)(j,{open:P,onClose:z,activeProvider:n}),(0,i.jsx)(Z,{activeProvider:n,onClose:v,open:r,onIgnoreConnectDialog:e})]})};var x=require("react/jsx-runtime"),Be=(0,Le.forwardRef)(({ignoreConnectDialog:o,onIgnoreConnectDialog:e,...t},l)=>{let n=(0,Y.useTheme)(),{totalConnectedAccounts:a,sortedWallets:r}=$();return(0,x.jsxs)(de.FlexCol,{alignItems:"stretch",justifyContent:"start",gap:2,ref:l,...t,children:[(0,x.jsxs)(de.FlexCol,{alignItems:"start",children:[(0,x.jsx)(Y.Typography,{variant:"h2",sx:{mb:.5},children:"Detected Web3 Wallets"}),a?(0,x.jsxs)(Y.Typography,{variant:"subtitle1",color:n.palette.secondary.main,sx:{opacity:.5},children:["Total Connected Accounts: ",a]}):null]}),(0,x.jsx)(ce,{wallets:r,ignoreConnectDialog:o,onIgnoreConnectDialog:e})]})});Be.displayName="ConnectedAccountsFlexbox";
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ CheckboxFormControl: () => CheckboxFormControl,
34
+ ConnectWalletDialog: () => ConnectWalletDialog,
35
+ ConnectedAccountsFlexbox: () => ConnectedAccountsFlexbox,
36
+ ConnectedWalletState: () => ConnectedWalletState,
37
+ ConnectedWalletTableCells: () => ConnectedWalletTableCells,
38
+ ConnectedWalletsAccountsTableCell: () => ConnectedWalletsAccountsTableCell,
39
+ ConnectedWalletsActionsTableCell: () => ConnectedWalletsActionsTableCell,
40
+ ConnectedWalletsChainNameTableCell: () => ConnectedWalletsChainNameTableCell,
41
+ ConnectedWalletsTable: () => ConnectedWalletsTable,
42
+ ConnectedWalletsWalletTableCell: () => ConnectedWalletsWalletTableCell,
43
+ EnabledEthWalletConnections: () => EnabledEthWalletConnections,
44
+ RevokeWalletConnectionDialog: () => RevokeWalletConnectionDialog,
45
+ WalletConnectionsTableRow: () => WalletConnectionsTableRow,
46
+ useActiveProviderDialogState: () => useActiveProviderDialogState,
47
+ useDetectedWallets: () => useDetectedWallets,
48
+ useEnabledWallets: () => useEnabledWallets,
49
+ useEnabledWalletsInner: () => useEnabledWalletsInner
50
+ });
51
+ module.exports = __toCommonJS(src_exports);
52
+
53
+ // src/classes/EnabledWallets.ts
54
+ var DEFAULT_LOCAL_STORAGE_KEY = "XYO|EnabledWallets";
55
+ var EnabledEthWalletConnections = class {
56
+ // control whether or not enabled/disabled preferences are persisted (i.e. in localStorage)
57
+ persistPreferences = true;
58
+ // Map of wallet names and their enabled/disabled state
59
+ enabledWallets = {};
60
+ // Map of wallet names, their enabled/disabled state, and their wallet class
61
+ ethWalletsState = {};
62
+ // list of listeners that want to be notified on wallet changes
63
+ listeners = [];
64
+ // key to use in localStorage when persisting preferences
65
+ localStorageKey = DEFAULT_LOCAL_STORAGE_KEY;
66
+ constructor(localStorageKey = DEFAULT_LOCAL_STORAGE_KEY) {
67
+ this.localStorageKey = localStorageKey;
68
+ this.reviveSettings();
69
+ }
70
+ get wallets() {
71
+ return this.ethWalletsState;
72
+ }
73
+ disableWallet(rdns) {
74
+ this.toggleEnabledWallet(rdns, false);
75
+ }
76
+ enableWallet(rdns) {
77
+ this.toggleEnabledWallet(rdns, true);
78
+ }
79
+ /**
80
+ * Given a new set of wallets, set their enabled state based off previous preferences
81
+ */
82
+ resetWallets(wallets) {
83
+ const newWallets = {};
84
+ const addWallet = ([walletName, wallet]) => {
85
+ newWallets[walletName] = {
86
+ // preserve the existing enabled state
87
+ enabled: walletName in this.enabledWallets ? this.enabledWallets[walletName] : true,
88
+ wallet
89
+ };
90
+ };
91
+ Object.entries(wallets).forEach(addWallet.bind(this));
92
+ this.ethWalletsState = newWallets;
93
+ this.emitChange();
94
+ }
95
+ subscribe(listener) {
96
+ this.listeners = [...this.listeners, listener];
97
+ return () => {
98
+ this.listeners = this.listeners.filter((existingListener) => existingListener !== listener);
99
+ };
100
+ }
101
+ toggleEnabledWallet(rdns, enabled) {
102
+ if (rdns && this.ethWalletsState[rdns]) {
103
+ this.ethWalletsState[rdns].enabled = enabled;
104
+ this.ethWalletsState = { ...this.ethWalletsState };
105
+ this.emitChange();
106
+ }
107
+ }
108
+ emitChange() {
109
+ for (const listener of this.listeners) {
110
+ listener();
111
+ }
112
+ this.persistSettings();
113
+ }
114
+ isPersistance(method) {
115
+ if (this.persistPreferences) {
116
+ method();
117
+ }
118
+ }
119
+ persistSettings() {
120
+ this.isPersistance(() => {
121
+ const enabledWallets = Object.entries(this.ethWalletsState).reduce((acc, [rdns, { enabled }]) => {
122
+ acc[rdns] = enabled;
123
+ return acc;
124
+ }, {});
125
+ localStorage.setItem(this.localStorageKey, JSON.stringify(enabledWallets));
126
+ });
127
+ }
128
+ reviveSettings() {
129
+ this.isPersistance(() => {
130
+ const existingEntries = localStorage.getItem(this.localStorageKey);
131
+ try {
132
+ const entries = existingEntries ? JSON.parse(existingEntries) : {};
133
+ this.enabledWallets = entries;
134
+ } catch (e) {
135
+ console.warn(`Error parsing saved enabled wallet entries: ${e.message}`);
136
+ }
137
+ });
138
+ }
139
+ };
140
+
141
+ // src/components/ConnectedAccountsFlexbox.tsx
142
+ var import_material13 = require("@mui/material");
143
+ var import_react_flexbox6 = require("@xylabs/react-flexbox");
144
+ var import_react7 = require("react");
145
+
146
+ // src/hooks/useDetectWallets.tsx
147
+ var import_react_crypto = require("@xylabs/react-crypto");
148
+ var import_react = require("react");
149
+ var sortWallets = (wallets) => (
150
+ // eslint-disable-next-line unicorn/no-array-reduce
151
+ Object.values(wallets).reduce((acc, wallet) => {
152
+ wallet.allowedAccounts.length > 0 ? acc.unshift(wallet) : acc.push(wallet);
153
+ return acc;
154
+ }, [])
155
+ );
156
+ var useDetectedWallets = () => {
157
+ const wallets = (0, import_react_crypto.useWalletDiscovery)();
158
+ const [refresh, setRefresh] = (0, import_react.useState)(0);
159
+ const [sortedWallets, setSortedWallets] = (0, import_react.useState)([]);
160
+ (0, import_react.useEffect)(() => {
161
+ setSortedWallets(sortWallets(wallets));
162
+ }, [wallets, refresh]);
163
+ (0, import_react.useEffect)(() => {
164
+ const listener = () => {
165
+ setRefresh((refresh2) => refresh2 + 1);
166
+ };
167
+ window.addEventListener(import_react_crypto.AccountsChangedEventName, listener);
168
+ return () => {
169
+ window.removeEventListener(import_react_crypto.AccountsChangedEventName, listener);
170
+ };
171
+ }, [wallets]);
172
+ const totalConnectedAccounts = (0, import_react.useMemo)(
173
+ () => Object.values(sortedWallets).reduce((acc, wallet) => acc + wallet.allowedAccounts.length, 0),
174
+ [sortedWallets]
175
+ );
176
+ return { sortedWallets, totalConnectedAccounts };
177
+ };
178
+
179
+ // src/hooks/useEnabledWallets.tsx
180
+ var import_react_crypto2 = require("@xylabs/react-crypto");
181
+ var import_react2 = require("react");
182
+ var enabledEthWallets;
183
+ var useEnabledWalletsInner = (enabledWalletsRdns) => {
184
+ const discoveredWallets = (0, import_react_crypto2.useWalletDiscovery)();
185
+ const wallets = (0, import_react2.useMemo)(() => {
186
+ if (enabledEthWallets === void 0) enabledEthWallets = new EnabledEthWalletConnections();
187
+ enabledEthWallets.resetWallets(discoveredWallets);
188
+ for (const [rdns, enabled] of Object.entries(enabledWalletsRdns ?? {})) enabledEthWallets?.toggleEnabledWallet(rdns, enabled);
189
+ return enabledEthWallets;
190
+ }, [discoveredWallets, enabledWalletsRdns]);
191
+ return (0, import_react2.useSyncExternalStore)(wallets.subscribe.bind(wallets), () => wallets.wallets);
192
+ };
193
+ var useEnabledWallets = (enabledWalletsRdns) => {
194
+ const wallets = useEnabledWalletsInner(enabledWalletsRdns);
195
+ const enabledWallets = (0, import_react2.useMemo)(
196
+ () => (
197
+ // eslint-disable-next-line unicorn/no-array-reduce
198
+ Object.entries(wallets).reduce((acc, [walletName, wallet]) => {
199
+ if (wallet.enabled) acc[walletName] = wallet;
200
+ return acc;
201
+ }, {})
202
+ ),
203
+ [wallets]
204
+ );
205
+ return {
206
+ disableWallet: enabledEthWallets?.disableWallet.bind(enabledEthWallets),
207
+ enableWallet: enabledEthWallets?.enableWallet.bind(enabledEthWallets),
208
+ enabledWallets,
209
+ wallets
210
+ };
211
+ };
212
+
213
+ // src/components/wallet/dialogs/connect/CheckboxFormControl.tsx
214
+ var import_material = require("@mui/material");
215
+ var import_jsx_runtime = require("react/jsx-runtime");
216
+ var CheckboxFormControl = ({ onCheckChanged, ...props }) => {
217
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.FormControl, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.FormLabel, { children: [
218
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Checkbox, { onChange: (_, checked) => onCheckChanged?.(checked) }),
219
+ "Do not show this again."
220
+ ] }) });
221
+ };
222
+
223
+ // src/components/wallet/dialogs/connect/Dialog.tsx
224
+ var import_material4 = require("@mui/material");
225
+
226
+ // src/components/wallet/dialogs/connect/LinkedProvidersFlexbox.tsx
227
+ var import_icons_material = require("@mui/icons-material");
228
+ var import_material2 = require("@mui/material");
229
+ var import_react_crypto3 = require("@xylabs/react-crypto");
230
+ var import_react_flexbox = require("@xylabs/react-flexbox");
231
+
232
+ // src/img/index.ts
233
+ var import_xyo_color_logo = __toESM(require("./xyo-color-logo-LHR2SMEM.svg"), 1);
234
+ var import_xyo_color_logo_text_only = __toESM(require("./xyo-color-logo-text-only-QPAW5BSQ.svg"), 1);
235
+
236
+ // src/components/wallet/dialogs/connect/LinkedProvidersFlexbox.tsx
237
+ var import_jsx_runtime2 = require("react/jsx-runtime");
238
+ var LinkedProvidersFlexbox = ({ icon, providerName, ...props }) => {
239
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexRow, { gap: 4, justifyContent: "space-evenly", ...props, children: [
240
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexCol, { gap: 0.5, children: [
241
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { alt: "XYO Logo", src: import_xyo_color_logo.default, style: { height: "48px" } }),
242
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { variant: "subtitle1", children: "XYO App" })
243
+ ] }),
244
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SyncAlt, { fontSize: "large" }),
245
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexCol, { gap: 0.5, children: [
246
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_crypto3.ConstrainedImage, { constrainedValue: "48px", src: icon, alt: providerName, style: { height: "48px", maxWidth: "48px" } }),
247
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { variant: "subtitle1", children: providerName })
248
+ ] })
249
+ ] });
250
+ };
251
+
252
+ // src/components/wallet/dialogs/connect/Permissions.tsx
253
+ var import_material3 = require("@mui/material");
254
+ var import_react_flexbox2 = require("@xylabs/react-flexbox");
255
+ var import_jsx_runtime3 = require("react/jsx-runtime");
256
+ var WalletPermissionsFlexbox = (props) => {
257
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_flexbox2.FlexCol, { gap: 4, ...props, children: [
258
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Typography, { fontWeight: "bold", sx: { textAlign: "center" }, children: "This will allow XYO to:" }),
259
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("ul", { children: [
260
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: "View your wallet account(s) and address(es)" }),
261
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: "Read-only access to browse the public blockchain(s) you select" })
262
+ ] }),
263
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_material3.Typography, { variant: "subtitle1", sx: { textAlign: "center" }, children: [
264
+ "You control what accounts to share and what blockchains to view. You can see or revoke access via your wallet's settings at anytime. View more on XYO's sovereign data philosophy",
265
+ " ",
266
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
267
+ import_material3.Link,
268
+ {
269
+ href: "https://cointelegraph.com/innovation-circle/decentralization-and-sovereignty-debunking-our-approach-to-digital-sovereignty",
270
+ sx: { fontWeight: "bold" },
271
+ target: "_blank",
272
+ children: "here"
273
+ }
274
+ ),
275
+ "."
276
+ ] })
277
+ ] });
278
+ };
279
+
280
+ // src/components/wallet/dialogs/connect/Dialog.tsx
281
+ var import_jsx_runtime4 = require("react/jsx-runtime");
282
+ var ConnectWalletDialog = ({ activeProvider, onIgnoreConnectDialog, ...props }) => {
283
+ const { icon, providerName } = activeProvider ?? {};
284
+ const onConnect = async () => {
285
+ try {
286
+ await activeProvider?.connectWallet?.();
287
+ props.onClose?.({}, "escapeKeyDown");
288
+ } catch (e) {
289
+ console.warn(`Error connecting to wallet: ${e.message}`);
290
+ }
291
+ };
292
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material4.Dialog, { PaperProps: { sx: { display: "flex", gap: 4 } }, ...props, children: [
293
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.DialogTitle, { sx: { textAlign: "center" }, children: "XYO Wants To Access The Blockchain on Your Behalf" }),
294
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material4.DialogContent, { sx: { display: "flex", flexDirection: "column", gap: 4 }, children: [
295
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LinkedProvidersFlexbox, { icon, providerName }),
296
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(WalletPermissionsFlexbox, {}),
297
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckboxFormControl, { onCheckChanged: onIgnoreConnectDialog })
298
+ ] }),
299
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material4.DialogActions, { children: [
300
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.Button, { variant: "outlined", onClick: () => props.onClose?.({}, "escapeKeyDown"), children: "Close" }),
301
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.Button, { variant: "contained", onClick: onConnect, children: "Connect" })
302
+ ] })
303
+ ] });
304
+ };
305
+
306
+ // src/components/wallet/dialogs/revoke/Dialog.tsx
307
+ var import_material5 = require("@mui/material");
308
+ var import_react_crypto4 = require("@xylabs/react-crypto");
309
+ var import_react_flexbox3 = require("@xylabs/react-flexbox");
310
+ var import_jsx_runtime5 = require("react/jsx-runtime");
311
+ var RevokeWalletConnectionDialog = ({ activeProvider, ...props }) => {
312
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.Dialog, { ...props, children: [
313
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_flexbox3.FlexRow, { gap: 2, justifyContent: "start", pl: 2, children: [
314
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_crypto4.ConstrainedImage, { src: activeProvider?.icon, constrainedValue: "24px" }),
315
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.DialogTitle, { sx: { pl: 0 }, children: [
316
+ "Revoke ",
317
+ activeProvider?.providerName,
318
+ " Access"
319
+ ] })
320
+ ] }),
321
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.DialogContent, { children: [
322
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.Typography, { children: [
323
+ "Revoking access to your wallet must be done from the wallet's browser extension. Wallets grant access to specific domains please consult ",
324
+ activeProvider?.providerName,
325
+ "'s documentation on how to revoke access to this website:"
326
+ ] }),
327
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.Typography, { children: window.location.origin })
328
+ ] }),
329
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.DialogActions, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.Button, { variant: "contained", onClick: () => props.onClose?.({}, "escapeKeyDown"), children: "Close" }) })
330
+ ] });
331
+ };
332
+
333
+ // src/components/wallet/table/cells/Accounts.tsx
334
+ var import_material6 = require("@mui/material");
335
+ var import_jsx_runtime6 = require("react/jsx-runtime");
336
+ var ConnectedWalletsAccountsTableCell = ({
337
+ additionalAccounts,
338
+ currentAccount,
339
+ totalAccounts,
340
+ tableCellProps
341
+ }) => {
342
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material6.TableCell, { ...tableCellProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
343
+ import_material6.Tooltip,
344
+ {
345
+ sx: { cursor: totalAccounts > 0 ? "pointer" : "auto" },
346
+ title: [...currentAccount ?? [], ...additionalAccounts ?? []].map((address, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: address }, index)),
347
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material6.Typography, { children: totalAccounts })
348
+ }
349
+ ) });
350
+ };
351
+
352
+ // src/components/wallet/table/cells/Actions.tsx
353
+ var import_icons_material2 = require("@mui/icons-material");
354
+ var import_material7 = require("@mui/material");
355
+ var import_react_flexbox4 = require("@xylabs/react-flexbox");
356
+ var import_jsx_runtime7 = require("react/jsx-runtime");
357
+ var ConnectedWalletsActionsTableCell = ({ connected, onConnect, onRevoke, tableCellProps }) => {
358
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material7.TableCell, { ...tableCellProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_flexbox4.FlexRow, { gap: 2, justifyContent: "start", children: [
359
+ connected ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_material7.Typography, { sx: { display: "inline-flex", gap: 0.5 }, children: [
360
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons_material2.Check, {}),
361
+ "Connected"
362
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material7.Button, { variant: "contained", onClick: onConnect, children: "Connect" }),
363
+ connected ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material7.IconButton, { onClick: onRevoke, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons_material2.InfoOutlined, {}) }) : null
364
+ ] }) });
365
+ };
366
+
367
+ // src/components/wallet/table/cells/ChainName.tsx
368
+ var import_material8 = require("@mui/material");
369
+ var import_jsx_runtime8 = require("react/jsx-runtime");
370
+ var ConnectedWalletsChainNameTableCell = ({ chainName, tableCellProps }) => {
371
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material8.TableCell, { ...tableCellProps, children: chainName });
372
+ };
373
+
374
+ // src/components/wallet/table/cells/State.tsx
375
+ var import_material9 = require("@mui/material");
376
+ var import_react3 = require("react");
377
+ var import_jsx_runtime9 = require("react/jsx-runtime");
378
+ var ConnectedWalletState = ({ connected, walletRdns, tableCellProps }) => {
379
+ const { disableWallet, enableWallet, wallets } = useEnabledWallets();
380
+ const enabled = (0, import_react3.useMemo)(() => walletRdns ? wallets[walletRdns].enabled : false, [wallets, walletRdns]);
381
+ const handleClick = (event) => {
382
+ const checked = event.target?.checked;
383
+ if (walletRdns) {
384
+ checked ? enableWallet?.(walletRdns) : disableWallet?.(walletRdns);
385
+ }
386
+ };
387
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material9.TableCell, { ...tableCellProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material9.Switch, { disabled: !connected, checked: connected && enabled, onChange: handleClick }) });
388
+ };
389
+
390
+ // src/components/wallet/table/cells/Wallet.tsx
391
+ var import_material10 = require("@mui/material");
392
+ var import_react_crypto5 = require("@xylabs/react-crypto");
393
+ var import_react_flexbox5 = require("@xylabs/react-flexbox");
394
+ var import_jsx_runtime10 = require("react/jsx-runtime");
395
+ var ConnectedWalletsWalletTableCell = ({ icon, walletName, tableCellProps }) => {
396
+ const theme = (0, import_material10.useTheme)();
397
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material10.TableCell, { ...tableCellProps, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_flexbox5.FlexRow, { gap: 2, justifyContent: "start", children: [
398
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_crypto5.ConstrainedImage, { constrainedValue: theme.spacing(4), src: icon }),
399
+ walletName
400
+ ] }) });
401
+ };
402
+
403
+ // src/components/wallet/table/cells/Cells.tsx
404
+ var ConnectedWalletTableCells = [
405
+ ConnectedWalletsWalletTableCell,
406
+ ConnectedWalletsChainNameTableCell,
407
+ ConnectedWalletsAccountsTableCell,
408
+ ConnectedWalletsActionsTableCell,
409
+ ConnectedWalletState
410
+ ];
411
+
412
+ // src/components/wallet/table/ConnectedWalletsTable.tsx
413
+ var import_material12 = require("@mui/material");
414
+ var import_react6 = require("react");
415
+
416
+ // src/components/wallet/lib/TableHeadData.ts
417
+ var WalletsTableHeadCells = [
418
+ {
419
+ disablePadding: false,
420
+ id: "wallet",
421
+ label: "Wallet",
422
+ numeric: false,
423
+ showOnMobile: true
424
+ },
425
+ {
426
+ disablePadding: false,
427
+ id: "chain",
428
+ label: "Chain",
429
+ numeric: false,
430
+ showOnMobile: true
431
+ },
432
+ {
433
+ disablePadding: false,
434
+ id: "accounts",
435
+ label: "Accounts",
436
+ numeric: true,
437
+ showOnMobile: true
438
+ },
439
+ {
440
+ disablePadding: false,
441
+ id: "actions",
442
+ label: "Actions",
443
+ numeric: false,
444
+ showOnMobile: true
445
+ },
446
+ {
447
+ disablePadding: false,
448
+ id: "enabled",
449
+ label: "Enabled",
450
+ numeric: false,
451
+ showOnMobile: true
452
+ }
453
+ ];
454
+
455
+ // src/components/wallet/table/ConnectedWalletsTableRow.tsx
456
+ var import_material11 = require("@mui/material");
457
+ var import_react_crypto6 = require("@xylabs/react-crypto");
458
+ var import_react4 = require("react");
459
+ var import_jsx_runtime11 = require("react/jsx-runtime");
460
+ var WalletConnectionsTableRow = ({
461
+ ignoreConnectDialog,
462
+ onConnectClick,
463
+ onRevoke,
464
+ wallet,
465
+ ...props
466
+ }) => {
467
+ const { currentAccount: currentAccountFromWallet, additionalAccounts, chainName, connectWallet, providerInfo } = (0, import_react_crypto6.useEthWallet)(wallet);
468
+ const currentAccount = currentAccountFromWallet?.toString() ? [currentAccountFromWallet.toString()] : [];
469
+ const totalAccounts = (additionalAccounts?.length ?? 0) + (currentAccount?.length ?? 0);
470
+ const connected = !!(currentAccount?.length ?? 0 > 0);
471
+ const { icon, name, rdns } = (0, import_react4.useMemo)(() => providerInfo ?? { icon: void 0, name: void 0, rdns: void 0 }, [providerInfo]);
472
+ const activeProvider = (0, import_react4.useMemo)(
473
+ () => ({
474
+ connectWallet,
475
+ icon,
476
+ providerName: name
477
+ }),
478
+ [connectWallet, icon, name]
479
+ );
480
+ const onRevokeLocal = (0, import_react4.useCallback)(() => {
481
+ onRevoke?.(activeProvider);
482
+ }, [activeProvider, onRevoke]);
483
+ const onConnectLocal = (0, import_react4.useCallback)(async () => {
484
+ if (ignoreConnectDialog) {
485
+ await connectWallet?.();
486
+ } else {
487
+ onConnectClick?.(activeProvider);
488
+ }
489
+ }, [activeProvider, connectWallet, ignoreConnectDialog, onConnectClick]);
490
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material11.TableRow, { ...props, children: Object.values(ConnectedWalletTableCells).map((Cell, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
491
+ Cell,
492
+ {
493
+ additionalAccounts,
494
+ chainName,
495
+ connected,
496
+ currentAccount,
497
+ icon,
498
+ onConnect: onConnectLocal,
499
+ onRevoke: onRevokeLocal,
500
+ totalAccounts,
501
+ walletName: name,
502
+ walletRdns: rdns
503
+ },
504
+ index
505
+ )) });
506
+ };
507
+
508
+ // src/components/wallet/table/hooks/useActiveProviderDialogState.tsx
509
+ var import_react5 = require("react");
510
+ var useActiveProviderDialogState = (setActiveProvider) => {
511
+ const [show, setShow] = (0, import_react5.useState)(false);
512
+ const onSetActiveProvider = (activeProvider) => {
513
+ setShow(true);
514
+ setActiveProvider(activeProvider);
515
+ };
516
+ const onClose = () => {
517
+ setShow(false);
518
+ setActiveProvider({});
519
+ };
520
+ return [show, onSetActiveProvider, onClose];
521
+ };
522
+
523
+ // src/components/wallet/table/ConnectedWalletsTable.tsx
524
+ var import_jsx_runtime12 = require("react/jsx-runtime");
525
+ var ConnectedWalletsTable = ({ ignoreConnectDialog, onIgnoreConnectDialog, wallets, ...props }) => {
526
+ const [activeProvider, setActiveProvider] = (0, import_react6.useState)();
527
+ const [showConnect, onSetActiveProviderConnect, onConnectClose] = useActiveProviderDialogState(setActiveProvider);
528
+ const [showRevoke, onSetActiveProviderRevoke, onRevokeClose] = useActiveProviderDialogState(setActiveProvider);
529
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
530
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_material12.Table, { ...props, children: [
531
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material12.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material12.TableRow, { children: WalletsTableHeadCells.map(({ disablePadding, id, label, align, width }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material12.TableCell, { align, padding: disablePadding ? "none" : "normal", width: width ?? "auto", children: label }, id)) }) }),
532
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material12.TableBody, { children: (wallets ?? []).map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
533
+ WalletConnectionsTableRow,
534
+ {
535
+ ignoreConnectDialog,
536
+ onConnectClick: onSetActiveProviderConnect,
537
+ onRevoke: onSetActiveProviderRevoke,
538
+ wallet
539
+ },
540
+ wallet.providerInfo?.rdns
541
+ )) })
542
+ ] }),
543
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RevokeWalletConnectionDialog, { open: showRevoke, onClose: onRevokeClose, activeProvider }),
544
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
545
+ ConnectWalletDialog,
546
+ {
547
+ activeProvider,
548
+ onClose: onConnectClose,
549
+ open: showConnect,
550
+ onIgnoreConnectDialog
551
+ }
552
+ )
553
+ ] });
554
+ };
555
+
556
+ // src/components/ConnectedAccountsFlexbox.tsx
557
+ var import_jsx_runtime13 = require("react/jsx-runtime");
558
+ var ConnectedAccountsFlexbox = (0, import_react7.forwardRef)(
559
+ ({ ignoreConnectDialog, onIgnoreConnectDialog, ...props }, ref) => {
560
+ const theme = (0, import_material13.useTheme)();
561
+ const { totalConnectedAccounts, sortedWallets } = useDetectedWallets();
562
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_flexbox6.FlexCol, { alignItems: "stretch", justifyContent: "start", gap: 2, ref, ...props, children: [
563
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_flexbox6.FlexCol, { alignItems: "start", children: [
564
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material13.Typography, { variant: "h2", sx: { mb: 0.5 }, children: "Detected Web3 Wallets" }),
565
+ totalConnectedAccounts ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_material13.Typography, { variant: "subtitle1", color: theme.palette.secondary.main, sx: { opacity: 0.5 }, children: [
566
+ "Total Connected Accounts: ",
567
+ totalConnectedAccounts
568
+ ] }) : null
569
+ ] }),
570
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ConnectedWalletsTable, { wallets: sortedWallets, ignoreConnectDialog, onIgnoreConnectDialog })
571
+ ] });
572
+ }
573
+ );
574
+ ConnectedAccountsFlexbox.displayName = "ConnectedAccountsFlexbox";
2
575
  //# sourceMappingURL=index.cjs.map