1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,139832,690544,329437,e=>{"use strict";e.i(247167);var t=e.i(843476),a=e.i(310126),r=e.i(36487),s=e.i(555764),l=e.i(884913),n=e.i(109870),i=e.i(64692),o=e.i(135613);let c=`#graphql 2query UserWallet($appId: String!) { 3 userWallet(appId: $appId) { 4 name 5 status 6 symbol 7 decimals 8 logo 9 account { 10 address 11 } 12 balance { 13 available 14 locked 15 } 16 walletType 17 accountType 18 id 19 network 20 } 21} 22`,u=`#graphql 23query SupportedWallets { 24 supportedWallets { 25 account { 26 address 27 __typename 28 } 29 balance { 30 available 31 locked 32 __typename 33 } 34 contractAddress 35 decimals 36 logo 37 name 38 symbol 39 networks 40 __typename 41 fee { 42 transfer 43 convert 44 } 45 } 46} 47`,d=`#graphql 48query UserWalletTransactions($symbol: String!, $appId: String) { 49 userWalletTransactions(symbol: $symbol, appId: $appId) { 50 accountId 51 amount 52 appId 53 createdAt 54 from 55 symbol 56 to 57 type 58 updatedAt 59 userId 60 status 61 transactionHash 62 } 63} 64`,p=`#graphql 65mutation CreateUserWallet($symbol: String!, $appId: String, $network: String) { 66 createUserWallet(symbol: $symbol, appId: $appId, network: $network) { 67 name 68 symbol 69 status 70 decimals 71 logo 72 account { 73 address 74 } 75 balance { 76 available 77 locked 78 } 79 } 80} 81`,g=`#graphql 82mutation CreateCheckoutWallet($symbol: String!, $appId: String, $network: String) { 83 createCheckoutWallet(symbol: $symbol, appId: $appId, network: $network) { 84 name 85 symbol 86 status 87 decimals 88 logo 89 account { 90 address 91 } 92 balance { 93 available 94 locked 95 } 96 } 97} 98`;class h{client;constructor(e){this.client=new i.GraphQLClient(e)}async getUserWallets(e){try{let{userWallet:t}=await this.client.executeGraphQL()({query:c,variables:e});return t}catch(e){throw o.logger?.error(e),Error("Failed to get user wallet: "+(e?.message||e))}}async getSupportedWallets(){try{let{supportedWallets:e}=await this.client.executeGraphQL()({query:u});return e}catch(e){throw o.logger?.error(e),Error("Failed to get supported wallets: "+(e?.message||e))}}async getUserWalletTransactions(e){try{let{userWalletTransactions:t}=await this.client.executeGraphQL()({query:d,variables:e});return t}catch(e){throw o.logger?.error(e),Error("Failed to get wallet transactions: "+(e?.message||e))}}async createUserWallet(e){try{let{createUserWallet:t}=await this.client.executeGraphQL()({query:p,variables:e});return t}catch(e){throw o.logger?.error(e),Error("Failed to create user wallet: "+(e?.message||e))}}async createCheckoutWallet(e){try{let{createCheckoutWallet:t}=await this.client.executeGraphQL()({query:g,variables:e});return t}catch(e){throw o.logger?.error(e),Error("Failed to create checkout wallet: "+(e?.message||e))}}}let m=`#graphql 99query GroupedUserWallets( 100 $filters: WalletFiltersInput 101 $pagination: PaginationInput 102 $transactionsPagination: PaginationInput 103) { 104 groupedUserWallets(filters: $filters, pagination: $pagination) { 105 data { 106 symbol 107 logo 108 name 109 accountType 110 walletType 111 walletCount 112 price 113 inTargetCurrency { 114 currency 115 balance { 116 available 117 locked 118 total 119 debit 120 credit 121 } 122 } 123 totalBalance { 124 available 125 locked 126 total 127 debit 128 credit 129 } 130 totalBalanceValue { 131 available 132 locked 133 total 134 } 135 transactions(pagination: $transactionsPagination) { 136 data { 137 _id 138 accountId 139 subAccountId 140 appId 141 userId 142 symbol 143 from 144 to 145 type 146 description 147 failureReason 148 transactionHash 149 transactionSignature 150 status 151 amount 152 metadata 153 category 154 createdAt 155 updatedAt 156 } 157 meta { 158 page 159 limit 160 total 161 count 162 pages 163 hasNextPage 164 hasPreviousPage 165 } 166 } 167 wallets { 168 _id 169 appId 170 userId 171 network 172 name 173 symbol 174 logo 175 contractAddress 176 decimals 177 account { 178 address 179 data 180 } 181 metadata { 182 data 183 } 184 ownerId 185 parentWallet 186 accountType 187 walletType 188 status 189 balance { 190 available 191 locked 192 } 193 createdAt 194 updatedAt 195 } 196 } 197 meta { 198 page 199 limit 200 count 201 total 202 pages 203 hasNextPage 204 hasPreviousPage 205 } 206 } 207} 208`,y=`#graphql 209query GroupedUserWalletBySymbol(
210 $symbol: String! 211 $userId: ID 212 $appId: ID 213 $transactionPagination: PaginationInput 214 $filters: WalletFiltersInput 215) { 216 groupedUserWalletBySymbol(symbol: $symbol, userId: $userId, appId: $appId, filters: $filters) { 217 symbol 218 logo 219 name 220 accountType 221 walletType 222 walletCount 223 price 224 inTargetCurrency { 225 currency 226 balance { 227 available 228 locked 229 total 230 debit 231 credit 232 } 233 } 234 totalBalance { 235 available 236 locked 237 total 238 debit 239 credit 240 } 241 totalBalanceValue { 242 available 243 locked 244 total 245 } 246 transactions(pagination: $transactionPagination) { 247 data { 248 _id 249 accountId 250 subAccountId 251 appId 252 userId 253 symbol 254 from 255 to 256 type 257 description 258 failureReason 259 transactionHash 260 transactionSignature 261 status 262 amount 263 metadata 264 category 265 createdAt 266 updatedAt 267 } 268 meta { 269 page 270 limit 271 total 272 count 273 pages 274 hasNextPage 275 hasPreviousPage 276 } 277 } 278 wallets { 279 _id 280 appId 281 userId 282 network 283 name 284 symbol 285 logo 286 contractAddress 287 decimals 288 account { 289 address 290 data 291 } 292 metadata { 293 data 294 } 295 ownerId 296 parentWallet 297 accountType 298 walletType 299 status 300 balance { 301 available 302 locked 303 } 304 createdAt 305 updatedAt 306 } 307 } 308} 309`,f=class{client;constructor(e){this.client=new i.GraphQLClient(e)}async getGroupedUserWallets(e){return await this.client.executeGraphQL()({query:m,variables:e})}async getGroupedUserWalletBySymbol(e){return await this.client.executeGraphQL()({query:y,variables:e})}};e.s(["default",0,f],690544);var b=e.i(271645);let w=({sections:e})=>{let[t,a]=(0,b.useState)(!1),[r,s]=(0,b.useState)(null);return null},v=`#graphql 310query TotalUserBalance( 311 $filters: WalletFiltersInput 312 $targetCurrency: String 313 $userId: String 314 $appId: String 315) { 316 totalUserBalance( 317 filters: $filters 318 targetCurrency: $targetCurrency 319 userId: $userId 320 appId: $appId 321 ) { 322 totalValue { 323 available 324 credit 325 debit 326 locked 327 total 328 } 329 inUSD { 330 available 331 credit 332 debit 333 locked 334 total 335 } 336 currency 337 assetCount 338 totalWalletCount 339 breakdown { 340 symbol 341 balance { 342 available 343 locked 344 total 345 debit 346 credit 347 } 348 price 349 value { 350 available 351 locked 352 total 353 } 354 walletCount 355 } 356 } 357} 358`,S=class{client;constructor(e){this.client=new i.GraphQLClient(e)}async getTotalUserBalance(e){return await this.client.executeGraphQL()({query:v,variables:e})}async getTotalUserBalanceInCurrency(e,t){return this.getTotalUserBalance({targetCurrency:e,filters:t})}async getTotalUserBalanceForUser(e,t="USD",a){return this.getTotalUserBalance({userId:e,targetCurrency:t,filters:a})}async getTotalUserBalanceForApp(e,t="USD",a){return this.getTotalUserBalance({appId:e,targetCurrency:t,filters:a})}},k=`#graphql 359query GetAllRates { 360 rates { 361 symbol 362 price 363 name 364 lastUpdated 365 } 366} 367`,C=`#graphql 368query GetRate($symbol: String!) { 369 rate(symbol: $symbol) { 370 symbol 371 price 372 name 373 lastUpdated 374 } 375} 376`,W=`#graphql 377query GetRatesBySymbols($symbols: [String!]!) { 378 ratesBySymbols(symbols: $symbols) { 379 symbol 380 price 381 name 382 lastUpdated 383 } 384} 385`,U=`#graphql 386query ConvertCurrency( 387 $fromSymbol: String! 388 $toSymbol: String! 389 $amount: Float! 390 $includeFees: Boolean 391 $customFeePercentage: Float 392) { 393 convertCurrency( 394 fromSymbol: $fromSymbol 395 toSymbol: $toSymbol 396 amount: $amount 397 includeFees: $includeFees 398 customFeePercentage: $customFeePercentage 399 ) { 400 fromSymbol 401 toSymbol 402 amount 403 convertedAmount 404 totalAmount 405 feeInUSD 406 feeInToCurrency 407 feeInFromCurrency 408 conversionFeeInUSD 409 conversionFeeInToCurrency 410 conversionFeeInFromCurrency 411 fromRate 412 toRate 413 effectiveRate 414 feePercentage 415 intermediateUSDAmount 416 } 417} 418`,x=`#graphql 419mutation RefreshRatesCache { 420 refreshRatesCache { 421 success 422 message 423 ratesCount 424 } 425} 426`,F=class{client;constructor(e){this.client=new i.GraphQLClient(e)}async getAllRates(){return await this.client.executeGraphQL()({query:k})}async getRate(e){return await this.client.executeGraphQL()({query:C,variables:e})}async getRatesBySymbols(e){return await this.client.executeGraphQL()({query:W,variables:e})}async convertCurrency(e){return await this.client.executeGraphQL()({query:U,variables:e})}async convertWithStandardFee(e,t,a){return this.convertCurrency({fromSymbol
426:e,toSymbol:t,amount:a,includeFees:!0,customFeePercentage:.03})}async convertWithoutFees(e,t,a){return this.convertCurrency({fromSymbol:e,toSymbol:t,amount:a,includeFees:!1,customFeePercentage:0})}async convertWithCustomFee(e,t,a,r){return this.convertCurrency({fromSymbol:e,toSymbol:t,amount:a,includeFees:!0,customFeePercentage:r})}async getPriceInUSD(e){let t=await this.getRate({symbol:e});return t?.rate?.price??null}async getPricesInUSD(e){let t=await this.getRatesBySymbols({symbols:e}),a=new Map;return t?.ratesBySymbols?.forEach(e=>{e?.symbol&&e?.price&&a.set(e?.symbol,e?.price)}),a}async calculateValue(e,t,a="USD"){let r=await this.convertWithoutFees(t,a,e);return r?.convertCurrency?.convertedAmount??0}async refreshCache(){return await this.client.executeGraphQL()({query:x,variables:{}})}async getExchangeRate(e,t){let a=await this.convertWithoutFees(e,t,1);return a?.convertCurrency?.effectiveRate??null}async batchConvert(e,t,a,r=!1){let s=await this.convertWithoutFees(e,t,1),l=s?.convertCurrency?.effectiveRate??0;if(0===l)throw Error(`Unable to get exchange rate for ${e}/${t}`);return r?(await Promise.all(a.map(a=>this.convertWithStandardFee(e,t,a)))).map(e=>e?.convertCurrency?.totalAmount??0):a.map(e=>e*l)}},$=`#graphql 427query BasicSupportedWallets { 428 basicSupportedWallets { 429 name 430 symbol 431 decimals 432 networks 433 hotwallet 434 balance { 435 available 436 locked 437 } 438 account { 439 address 440 } 441 fee { 442 transfer 443 convert 444 } 445 logo 446 contract 447 contractAddress 448 } 449} 450`;class P{client;constructor(e){this.client=new i.GraphQLClient(e)}async getBasicSupportedWallets(){try{let{basicSupportedWallets:e}=await this.client.executeGraphQL()({query:$});return e}catch(e){throw o.logger?.error(e),Error("Failed to get basic supported wallets: "+(e?.message||e))}}}var I=e.i(618566);let T=(0,e.i(768834).create)(e=>({activeTab:"crypto",setActiveTab:t=>e({activeTab:t})}));e.s(["default",0,T],329437);let E=()=>{let{token:e}=(0,n.useUserDataStore)(),{appData:t,isHydrated:a}=(0,l.useAppDataStore)(),{state:i,setState:c}=(0,r.usePersistedState)({storageKey:"groupedUserWallets"}),{state:u,setState:d}=(0,r.usePersistedState)({storageKey:"totalUserBalance"}),{state:p,setState:g}=(0,r.usePersistedState)({storageKey:"ratesState"}),{state:m,setState:y}=(0,r.usePersistedState)({main:!1},{storageKey:"assetBalanceShowBalance"}),{state:w,setState:v,isHydrated:k}=(0,r.usePersistedState)({storageKey:"groupedUserWalletsBySymbol"}),{state:C,setState:W,isHydrated:U}=(0,r.usePersistedState)({storageKey:"groupedUserWalletsBySymbolTransactions"}),{state:x,setState:$}=(0,r.usePersistedState)({storageKey:"supportedWalletsState"}),{state:I,setState:E}=(0,r.usePersistedState)({storageKey:"userWalletsState"}),{activeTab:A}=T(),L=(0,b.useMemo)(()=>{let e=[t?.currency||"NGN","PAY","USDC","USDT"];return i?.wallets?.data?.sort((t,a)=>{let r=e.indexOf(t?.symbol||""),s=e.indexOf(a?.symbol||""),l=-1!==r,n=-1!==s;if(l&&!n)return -1;if(!l&&n)return 1;if(l&&n)return r-s;let i=t?.totalBalance?.available||0;return(a?.totalBalance?.available||0)-i}).filter(e=>e?.name!==null)},[t?.currency,i?.wallets?.data]),G=(0,b.useMemo)(()=>{let e=[t?.currency||"NGN","PAY","USDC","USDT"];return i?.wallets?.data?.sort((t,a)=>{let r=e.indexOf(t?.symbol||""),s=e.indexOf(a?.symbol||""),l=-1!==r,n=-1!==s;if(l&&!n)return -1;if(!l&&n)return 1;if(l&&n)return r-s;let i=t?.totalBalance?.available||0;return(a?.totalBalance?.available||0)-i}).filter(e=>e?.name!==null).filter(e=>"fiat"===A?e?.walletType==="local":"crypto"===A?e?.walletType==="crypto":"xstocks"!==A||e?.walletType==="xstocks")},[t?.currency,i?.wallets?.data,A]),{status:R,setStatus:q,aggregatedStatus:B}=(0,s.useStatus)({defaultStatuses:{groupedUserWallets:{name:"Grouped User Wallets",message:"Fetch Grouped User Wallets",status:"idle"},totalUserBalance:{name:"Total User Balance",message:"Fetch Total User Balance",status:"idle"},rates:{name:"Currency Rates",message:"Fetch rates",status:"idle"},supportedWallets:{message:"Fetch supported wallets",status:"idle"},userWallets:{name:"User Wallets",message:"Fetch user wallets",status:"idle"}},aggregation:{enabled:!0}}),D=(0,b.useRef)({wallets:!1,balance:!1,rates:!1,supportedWallets:!1,userWallets:!1}),_=(0,b.useRef)(!1),O=(0,b.useMemo)(()=>
450{let a={apiUrl:"https://graph.100pay.co/graphql",headers:{"app-id":t?._id||"","auth-token":e}};return{groupedUserWallets:new f(a),totalUserBalance:new S(a),rates:new F(a),supportedWallets:new P(a),walletService:new h(a)}},[t?._id,e]),j=(0,b.useCallback)((e,a)=>!e||a!==t?._id||Date.now()-e>3e5,[t?._id]),z=(0,b.useCallback)(async(e,a=!1)=>{if(D.current.wallets)return void o.logger.log("Wallets request already in progress, skipping...");if(!a&&!j(i?.lastFetched,i?.appId)&&i?.wallets)return void o.logger.log("Using cached wallets data");if(!O||!t?._id)return void o.logger.warn("Services not initialized or no app ID");D.current.wallets=!0,c(e=>({...e,loading:!0}));try{q("groupedUserWallets",{status:"loading",message:"Getting grouped user wallets..."});let a=await O.groupedUserWallets.getGroupedUserWallets({pagination:{limit:100},...e});a.groupedUserWallets?.data&&(c({wallets:a.groupedUserWallets,loading:!1,lastFetched:Date.now(),appId:t._id}),q("groupedUserWallets",{status:"success",message:`${a.groupedUserWallets.data.length} wallets fetched successfully!`}))}catch(e){c(e=>({...e,loading:!1})),q("groupedUserWallets",{status:"error",message:`${e?.message}`})}finally{D.current.wallets=!1}},[O,t?._id,j,i?.lastFetched,i?.appId,i?.wallets,c,q]),Q=(0,b.useCallback)(async(e,a=!1)=>{if(D.current.balance)return void o.logger.log("Balance request already in progress, skipping...");if(!a&&!j(u?.lastFetched,u?.appId)&&u?.balance)return void o.logger.log("Using cached balance data");if(!O||!t?._id)return void o.logger.warn("Services not initialized or no app ID");D.current.balance=!0,d(e=>({...e,loading:!0}));try{q("totalUserBalance",{status:"loading",message:"Getting total user balance..."});let a=await O.totalUserBalance.getTotalUserBalance({targetCurrency:t?.currency,...e});a.totalUserBalance?.totalValue&&(d({balance:a.totalUserBalance,loading:!1,lastFetched:Date.now(),appId:t._id}),q("totalUserBalance",{status:"success",message:"Total user balance fetched successfully!"}))}catch(e){d(e=>({...e,loading:!1})),q("totalUserBalance",{status:"error",message:`${e?.message}`})}finally{D.current.balance=!1}},[O,t?._id,t?.currency,j,u?.lastFetched,u?.appId,u?.balance,d,q]),M=(0,b.useCallback)(async(e=!1)=>{if(D.current.rates)return void o.logger.log("Rates request already in progress, skipping...");if(!e&&p?.lastFetched&&!(Date.now()-p.lastFetched>3e5)&&p?.rates)return void o.logger.log("Using cached rates data");if(!O)return void o.logger.warn("Services not initialized");D.current.rates=!0,g(e=>({...e,loading:!0}));try{q("rates",{status:"loading",message:"Getting rates..."});let e=await O.rates.getAllRates();g({rates:e?.rates,loading:!1,lastFetched:Date.now()}),q("rates",{status:"success",message:"Rates fetched successfully!"})}catch(e){g(e=>({...e,loading:!1})),q("rates",{status:"error",message:`${e?.message}`})}finally{D.current.rates=!1}},[O,p?.lastFetched,p?.rates,g,q]),H=(0,b.useCallback)(async(e=!1)=>{if(D.current.supportedWallets)return void o.logger.log("Supported wallets request already in progress, skipping...");if(!e&&!j(x?.lastFetched,t?._id)&&x?.wallets)return void o.logger.log("Using cached supported wallets data");if(!O)return void o.logger.warn("Services not initialized");D.current.supportedWallets=!0,$(e=>({...e,loading:!0}));try{q("supportedWallets",{status:"loading",message:"Getting supported wallets..."});let e=await O.supportedWallets.getBasicSupportedWallets();$({wallets:e,loading:!1,lastFetched:Date.now()}),q("supportedWallets",{status:"success",message:"Supported wallets fetched successfully!"})}catch(e){$(e=>({...e,loading:!1})),q("supportedWallets",{status:"error",message:`${e?.message}`})}finally{D.current.supportedWallets=!1}},[O,x?.lastFetched,x?.wallets,$,q,j,t?._id]),N=(0,b.useCallback)(async(e,a=!1)=>{if(D.current.userWallets)return void o.logger.log("User wallets request already in progress, skipping...");let r=e?.appId||t?._id;if(!a&&!j(I?.lastFetched,I?.appId)&&I?.wallets)return void o.logger.log("Using cached user wallets data");if(!O||!r)return void o.logger.warn("Services not initialized or no app ID");D.current.userWallets=!0,E(e=>({...e,loading:!0}));try{q("userWallets",{status:"loading",message:"Getting user wallets..."});let e=await O.walletService.getUserWallets({appId:r});E({wallets:e||[],loading:!1,lastFetched:Date.now(),appId:r}),q("userWallets",{status:"success",message:`${e?.length||0} user wallets fetched successfully!`})}catch(e){E(e=>({...e,loading:!1})),q("userWallets",{status:"error",message:`${e?.message}`})}
450finally{D.current.userWallets=!1}},[O,I?.lastFetched,I?.wallets,I?.appId,E,q,j,t?._id]),K=(0,b.useCallback)(async(e=!1)=>{await Promise.all([z({pagination:{limit:100},transactionsPagination:{limit:0}},e),Q(void 0,e),M(e),H(e),N({appId:t?._id||""},e)])},[z,Q,M,H,N]);return{groupedUserWalletsState:i,setGroupedUserWalletsState:c,totalUserBalanceState:u,setTotalUserBalanceState:d,sortedGroupedWallets:L,assetsListSortedGroupedWallets:G,requestsInProgress:D,handleGetGroupedUserWallets:z,handleGetTotalUserBalance:Q,handleGetRates:M,handleGetSupportedWallets:H,handleFetchAllInParallel:K,groupedUserWalletsBySymbol:w,groupedUserWalletsTransactionsBySymbol:C,setGroupedUserWalletsTransactionsBySymbol:W,groupedUserWalletsTransactionsBySymbolIsHydrated:U,status:R,setStatus:q,aggregatedStatus:B,clearState:()=>{c({loading:!1,wallets:null,lastFetched:void 0,appId:void 0}),d({balance:null,loading:!1,lastFetched:void 0,appId:void 0}),g({loading:!1,rates:null,lastFetched:void 0}),$({loading:!1,wallets:null,lastFetched:void 0}),E({wallets:null,loading:!1,lastFetched:void 0,appId:void 0})},initialFetchDone:_,effectiveToken:e,userWalletServices:O,showBalanceState:m,setShowBalanceState:y,groupedUserWalletsBySymbolIsHydrated:k,setGroupedUserWalletsBySymbol:v,appData:t,ratesState:p,supportedWalletsState:x,userWalletsState:I,setUserWalletsState:E,handleGetUserWallets:N}};e.s(["default",0,({children:e})=>{let r=(0,I.usePathname)(),{groupedUserWalletsState:s,setGroupedUserWalletsState:l,sortedGroupedWallets:n,totalUserBalanceState:i,ratesState:o,status:c,setStatus:u,aggregatedStatus:d,handleGetGroupedUserWallets:p,handleGetTotalUserBalance:g,handleGetRates:h,handleGetSupportedWallets:m,handleFetchAllInParallel:y,initialFetchDone:f,userWalletServices:v,effectiveToken:S,appData:k,requestsInProgress:C,groupedUserWalletsBySymbol:W,groupedUserWalletsTransactionsBySymbol:U,supportedWalletsState:x,userWalletsState:F,handleGetUserWallets:$}=E(),{setWallets:P,setRates:T,setAllWallets:A}=(0,a.useWalletStore)();(0,b.useEffect)(()=>{n&&P(n)},[n,P]),(0,b.useEffect)(()=>{o?.rates&&T(o.rates)},[o?.rates,T]),(0,b.useEffect)(()=>{x?.wallets&&A(x.wallets)},[x?.wallets,A]),(0,b.useCallback)(()=>{l({wallets:null,loading:!1,lastFetched:void 0,appId:void 0}),u("groupedUserWallets",{status:"idle",message:"Reset to idle state"}),f.current=!1,p({pagination:{limit:100},transactionsPagination:{limit:0}},!0)},[l,u,p]);let L=(0,b.useCallback)(()=>{p({pagination:{limit:100},transactionsPagination:{limit:0}},!0)},[p]),G=(0,b.useCallback)(()=>{g(void 0,!0)},[g]),R=(0,b.useCallback)(()=>{m(!0)},[m]),q=(0,b.useCallback)(()=>{$(void 0,!0)},[$]);return(0,b.useEffect)(()=>{f.current||!v||(async()=>{await y(),f.current=!0})()},[v,y]),(0,b.useEffect)(()=>{k?._id&&v&&(f.current=!1,y())},[k?._id,v,y]),(0,b.useEffect)(()=>{r&&v&&(f.current=!1,y())},[r,v,y]),(0,t.jsxs)(t.Fragment,{children:[e,(0,t.jsx)(w,{sections:[{title:"Grouped User Wallets",status:c.groupedUserWallets.status,message:c.groupedUserWallets.message,lastFetched:s?.lastFetched,onRefresh:L,isLoading:s?.loading,data:s?.wallets},{title:"User Wallets",status:c.userWallets.status,message:c.userWallets.message,lastFetched:F?.lastFetched,onRefresh:q,isLoading:F?.loading,data:F?.wallets},{title:"Total User Balance",status:c.totalUserBalance.status,message:c.totalUserBalance.message,lastFetched:i?.lastFetched,onRefresh:G,isLoading:i?.loading,data:i?.balance},{title:"Supported Wallets",status:c.supportedWallets.status,message:c.supportedWallets.message,lastFetched:x?.lastFetched,onRefresh:R,isLoading:x?.loading,data:x?.wallets}]})]})},"useGroupedWalletTransactions",0,e=>{let{symbol:t,autoFetch:a=!0}=e||{},r=(0,I.useSearchParams)(),s=r.get("symbol")?.toUpperCase()||e?.symbol,l=r.get("wallet-type"),{userWalletServices:n,groupedUserWalletsBySymbol:i,groupedUserWalletsTransactionsBySymbol:o,groupedUserWalletsTransactionsBySymbolIsHydrated:c,setGroupedUserWalletsBySymbol:u,setGroupedUserWalletsTransactionsBySymbol:d}=E(),[p,g]=(0,b.useState)([]),{data:h,error:m,isLoading:y,pagination:f,setPagination:w,refresh:v}=function({getData:e,state:t,args:a,initialPagination:r={page:1,limit:20},autoFetch:s=!0}){let[l,n]=(0,b.useState)(r),[i,o]=(0,b.useState)(!1),[c,u]=(0,b.useState)(null),d=(0,b.useCallback)(async r=>{if(!a)return void console.warn("Args not provided, skipping fetch");o(!0),u(null);try{let s=await e({args:a,pagination:r||l});s&&t.setState(s)}catch(t){let e=t instanceof Error?t:Error(String(t));u(e),console.error("Error fetching data:",e)}finally{o(!1)}},[e,a,l,t]),p=(0,b.useCallback)(async()=>{await d()},[d]);return(0,b.useEffect)(()=>{s&&a&&d()},[s,a,l]),{data:t.getState(),error:c,isLoading:i,pagination:l,refresh:p,setPagination:n,fetchData:d}}({async getData(e){if(!n?.groupedUserWallets)throw Error("Wallet services not initialized");let t=await n.groupedUserWallets.getGroupedUserWalletBySymbol({...e.args,transactionPagination:e.pagination});return t?.groupedUserWalletBySymbol},state:{setState:e=>{s&&e&&(u(t=>({...t,[s]:e})),e.transactions?.data&&g(t=>{let a=e.transactions?.meta?.page??1,r=e=>{if(!e)return Math.random().toString();let t=e._id||e.transactionHash||`${e.createdAt}-${e.amount}-${e.type}`;return console.log("DEBUGGER: getTxId",{id:t,tx:e}),t};if(1===a)return console.log("DEBUGGER: Resetting accumulation (Page 1)"),e.transactions?.data??[];let s=new Set(t.map(e=>r(e)));return[...t,...(e.transactions?.data??[]).filter(e=>!s.has(r(e)))]}))},getState:()=>s?i?.[s]??null:null},args:(0,b.useMemo)(()=>
450{if(s)return{symbol:s,..."checkout"===l&&{filters:{walletType:l}}}},[s,l]),initialPagination:{page:1,limit:50},autoFetch:a});(0,b.useEffect)(()=>{s&&p.length>0&&d(e=>{console.log("DEBUGGER: Syncing to global store",{currency:s,count:p.length});let t={[s?.toUpperCase()||""]:{data:p,meta:h?.transactions?.meta}};return{...e,...t}})},[p,s,d,h?.transactions?.meta]);let S=(0,b.useCallback)(e=>{w(t=>({...t,page:e}))},[w]),k=(0,b.useCallback)(e=>{w(t=>({...t,page:1,limit:e})),g([]),d(e=>({...e,[s||""]:{data:[],meta:h?.transactions?.meta}}))},[w]),C=(0,b.useMemo)(()=>h?.transactions?{data:p,meta:h.transactions.meta}:null,[h?.transactions,p]);return{currency:s,pagination:f,data:h,error:m,isLoading:y,refresh:()=>{g([]),v()},setPagination:w,handlePageChange:S,handleLimitChange:k,mergedTransactions:C,groupedUserWalletsTransactionsBySymbolIsHydrated:c,groupedUserWalletsTransactionsBySymbol:o,accumulatedTransactions:p}},"useWalletsState",0,E],139832)},135613,(e,t,a)=>{"use strict";var r=e.i(247167);Object.defineProperty(a,"__esModule",{value:!0}),a.logger=a.Logger=void 0;class s{constructor(e={}){var t,a,r,s,l,n,i,o,c;this.showInProd=null!=(t=e.showInProd)&&t,this.includeTimestamp=null==(a=e.includeTimestamp)||a,this.maxDepth=null!=(r=e.maxDepth)?r:5,this.maxStringLength=null!=(s=e.maxStringLength)?s:1e4,this.enableCircularHandling=null==(l=e.enableCircularHandling)||l,this.domElementFormat=null!=(n=e.domElementFormat)?n:"summary",this.prettyPrint=null==(i=e.prettyPrint)||i,this.indentSize=null!=(o=e.indentSize)?o:2,this.useColors=null==(c=e.colors)||c,this.env=this.getEnvironment(),this.consoleColors={string:"\x1b[32m",number:"\x1b[36m",boolean:"\x1b[35m",null:"\x1b[90m",undefined:"\x1b[90m",function:"\x1b[36m",symbol
450:"\x1b[35m",date:"\x1b[34m",regexp:"\x1b[35m",key:"\x1b[33m",bracket:"\x1b[90m",circular:"\x1b[31m",truncated:"\x1b[90m",maxDepth:"\x1b[90m",reset:"\x1b[0m"},this.browserColors={string:"color: green;",number:"color: cyan;",boolean:"color: magenta;",null:"color: gray;",undefined:"color: gray;",function:"color: cyan;",symbol:"color: magenta;",date:"color: blue;",regexp:"color: magenta;",key:"color: #b58900;",bracket:"color: gray;",circular:"color: red;",truncated:"color: gray;",maxDepth:"color: gray;",reset:""}}getEnvironment(){let e=!1,t=!1,a=!0;if("u">typeof window)t=!0,a=!window.location.hostname.includes("production")&&(void 0===r.default||"object"==typeof r.default.env&&!1);else if(void 0!==r.default)try{e="object"==typeof r.default.versions&&null!=r.default.versions,a="object"==typeof r.default.env&&!1}catch(t){e=!1}return{isDevelopment:a,isNode:e,isBrowser:t,isEdgeRuntime:!1}}getCallerInfo(){var e,t;let a={file:"unknown",line:"unknown",column:"unknown"};try{let r=Error().stack;if(r){let s=r.split("\n"),l="";for(let e=1;e<s.length;e++)if(!s[e].includes("debugLogger.ts")&&!s[e].includes("at Logger.")){l=s[e];break}if(this.env.isNode){let t=null==l?void 0:l.match(/\((.*):(\d+):(\d+)\)$/);t&&(a.file=(null==(e=t[1])?void 0:e.split("/").pop())||"unknown",a.line=t[2]||"unknown",a.column=t[3]||"unknown")}else{let e=null==l?void 0:l.match(/at (?:.*? \()?(.+):(\d+):(\d+)/);e&&(a.file=(null==(t=e[1])?void 0:t.split("/").pop())||"unknown",a.line=e[2]||"unknown",a.column=e[3]||"unknown")}}}catch(e){}return a}formatMetadata(e){let t=this.getCallerInfo(),a=this.includeTimestamp?new Date().toISOString():"";return[`[${e.toUpperCase()}]`,this.includeTimestamp?`[${a}]`:"",`[${t.file}:${t.line}]`].filter(Boolean)}formatDOMElement(e){var t,a;if("disabled"===this.domElementFormat||!this.env.isBrowser||!e||"string"!=typeof e.tagName)return"[DOM Element]";if("inspect"===this.domElementFormat){let t="";if(e.attributes)for(let a=0;a<e.attributes.length;a++){let r=e.attributes[a];t+=` ${r.name}="${r.value}"`}let a="";return e.children&&e.children.length>0&&(a=` (${e.children.length} children)`),`<${e.tagName.toLowerCase()}${t}>${a}`}return`<${e.tagName.toLowerCase()}> with ${(null==(t=e.attributes)?void 0:t.length)||0} attributes and ${(null==(a=e.children)?void 0:a.length)||0} children`}colorizeText(e,t){return this.useColors&&this.env.isNode&&!this.env.isEdgeRuntime?`${this.consoleColors[t]}${e}${this.consoleColors.reset}`:e}getIndentation(e){return" ".repeat(e*this.indentSize)}formatArgument(e,t={}){var a,r,s;let l=null!=(a=t.depth)?a:0,n=null!=(r=t.seen)?r:new WeakMap,i=null!=(s=t.indentation)?s:"";if(l>this.maxDepth)return this.colorizeText("[Max Depth Reached]","maxDepth");if(null===e)return this.colorizeText("null","null");if(void 0===e)return this.colorizeText("undefined","undefined");if("string"==typeof e){if(e.length>this.maxStringLength){let t=`${e.substring(0,this.maxStringLength)}...`,a=this.colorizeText(` [truncated, ${e.length} chars total]`,"truncated");return this.colorizeText(`"${t}"`,"string")+a}return this.colorizeText(`"${e}"`,"string")}if("number"==typeof e)return this.colorizeText(String(e),"number");if("boolean"==typeof e)return this.colorizeText(String(e),"boolean");if("symbol"==typeof e)return this.colorizeText(String(e),"symbol");if("bigint"==typeof e)return this.colorizeText(`${String(e)}n`,"number");if("function"==typeof e)return this.colorizeText(`[Function: ${e.name||"anonymous"}]`,"function");if(this.env.isBrowser&&"u">typeof window&&"u">typeof Element&&e instanceof Element)return this.formatDOMElement(e);if(e instanceof Error)return`${e.name}: ${e.message} 451${e.stack||""}`;if(e instanceof Date)return this.colorizeText(e.toISOString(),"date");if(e instanceof RegExp)return this.colorizeText(e.toString(),"regexp");if(Array.isArray(e)){if(this.enableCircularHandling&&n.has(e))return this.colorizeText("[Circular Reference]","circular");if(this.enableCircularHandling&&n.set(e,!0),0===e.length)return this.colorizeText("[]","bracket");if(!this.prettyPrint){let t=e.map(e=>this.formatArgument(e,{depth:l+1,seen:n})).join(", ");return this.colorizeText("[","bracket")+t+this.colorizeText("]","bracket")}let t=i+this.getIndentation(1),a=e.map(e=>t+this.formatArgument(e,{depth:l+1,seen:n,indentation:t})).join(",\n");return this.colorizeText("[","bracket")+"\n"+a+"\n"+i+this.colorizeText("]","bracket")}if("object"==typeof e&&null!==e){if(this.enableCircularHandling&&n.has(e))return this.colorizeText("[Circular Reference]","circular");this.enableCircularHandling&&n.set(e,!0);try{let t=Object.entries(e);if(0===t.length)return this.colorizeText("{}","bracket");if(!this.prettyPrint){let e=t.map(([e,t])=>this.colorizeText(e,"key")+": "+this.formatArgument(t,{depth:l+1,seen:n}));return this.colorizeText("{","bracket")+e.join(", ")+this.colorizeText("}","bracket")}let a=i+this.getIndentation(1),r=t.map(([e,t])=>a+this.colorizeText(e,"key")+": "+this.formatArgument(t,{depth:l+1,seen:n,indentation:a})).join(",\n");return this.colorizeText("{","bracket")+"\n"+r+"\n"+i+this.colorizeText("}","bracket")}catch(t){let e=t instanceof Error?t.message:"unknown error";return`[Object: failed to stringify - ${e}]`}}
451return String(e)}_log(e,...t){if(!this.env.isDevelopment&&!this.showInProd)return;let a=this.formatMetadata(e);if(this.env.isBrowser&&!this.env.isNode){let r=[],s=[];t.forEach(e=>{"u">typeof window&&"u">typeof Element&&e instanceof Element||"object"==typeof e&&null!==e?(r.push(this.formatArgument(e)),this.prettyPrint&&s.push(e)):r.push(this.formatArgument(e))}),console[e](`%c${[...a,...r].join(" ")}`,{log:"color: #0099cc",debug:"color: #0099cc",info:"color: #00cc00",warn:"color: #cccc00",error:"color: #cc0000"}[e]),this.prettyPrint&&s.length>0&&(console.groupCollapsed("Raw Objects (for inspection)"),s.forEach(t=>console[e](t)),console.groupEnd());return}let r={log:"\x1b[36m",debug:"\x1b[36m",info:"\x1b[32m",warn:"\x1b[33m",error:"\x1b[31m",reset:"\x1b[0m"};if(this.env.isEdgeRuntime||!this.useColors)console[e](...a,...t.map(e=>this.formatArgument(e)));else{let s=t.map(e=>this.formatArgument(e));console[e](r[e],...a,...s,r.reset)}}log(...e){this._log("log",...e)}debug(...e){this._log("debug",...e)}info(...e){this._log("info",...e)}warn(...e){this._log("warn",...e)}error(...e){this._log("error",...e)}group(e){(this.env.isDevelopment||this.showInProd)&&("function"==typeof console.group?console.group(e):console.log(`=== GROUP START: ${e} ===`))}groupEnd(){(this.env.isDevelopment||this.showInProd)&&("function"==typeof console.groupEnd?console.groupEnd():console.log("=== GROUP END ==="))}time(e){(this.env.isDevelopment||this.showInProd)&&"function"==typeof console.time&&console.time(e)}timeEnd(e){(this.env.isDevelopment||this.showInProd)&&"function"==typeof console.timeEnd&&console.timeEnd(e)}}a.Logger=s,a.logger=new s({prettyPrint:!0,colors:!0})},622598,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.extractFiles=a.hasFiles=a.convertToFileArray=a.getFilesLength=void 0,a.getFilesLength=e=>e?Array.isArray(e)||"u">typeof FileList&&e instanceof FileList?e.length:1:0,a.convertToFileArray=e=>e?Array.isArray(e)?e:"u">typeof FileList&&e instanceof FileList?Array.from(e):"u">typeof File&&e instanceof File?[e]:[]:[],a.hasFiles=e=>{let t=e=>!!("u">typeof File&&e instanceof File||"u">typeof FileList&&e instanceof FileList)||!!e&&"object"==typeof e&&"name"in e&&"type"in e&&"size"in e||(Array.isArray(e)?e.some(t):!!e&&"object"==typeof e&&Object.values(e).some(t));return!!e&&t(e)},a.extractFiles=e=>{let t=[],a={},r=(e,s)=>{if("u">typeof File&&e instanceof File||e&&"object"==typeof e&&"name"in e&&"type"in e&&"size"in e){let r=t.length;return t.push(e),a[r.toString()]=[`variables.${s}`],null}if("u">typeof FileList&&e instanceof FileList||e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length)return Array.from(e).map((e,t)=>r(e,`${s}.${t}`));if(Array.isArray(e))return e.map((e,t)=>r(e,`${s}.${t}`));if(e&&"object"==typeof e){let t={};for(let[a,l]of Object.entries(e))t[a]=r(l,s?`${s}.${a}`:a);return t}return e};return{files:t,map:a,cleanVariables:r(e,"")}}},490749,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.createGraphqlRequest=void 0;let r=e.r(622598),s=e.r(622598);a.createGraphqlRequest=(e,t,a)=>async function({url:l,options:n,headers:i={},apiKey:o}){var c;try{let u,d=o||e;null==t||t.log({apiKey:d?"[REDACTED]":void 0,headers:i,url:l,options:{...n,files:n.files?`${(0,s.getFilesLength)(n.files)} files`:void 0}});let p=n.files&&(0,s.getFilesLength)(n.files)>0||n.variables&&(0,r.hasFiles)(n.variables),g={method:"POST",cache:"no-store"};if(p){let e=new FormData,t=[],l=n.variables||{},o={};if(n.files&&(0,s.getFilesLength)(n.files)>0){let e=(0,s.convertToFileArray)(n.files);e.forEach((e,a)=>{t.push(e),o[a.toString()]=[`variables.files.${a}`]}),l.files||(l={...l,files:Array(e.length).fill(null)})}if(n.variables&&(0,r.hasFiles)(n.variables)){let e=(0,r.extractFiles)(n.variables),a=t.length;e.files.forEach((r,s)=>{t.push(r);let l=Object.keys(e.map)[s];o[(a+s).toString()]=e.map[l]}),l=e.cleanVariables}e.append("operations",JSON.stringify({query:n.query,variables:l})),e.append("map",JSON.stringify(o)),t.forEach((t,a)=>{e.append(a.toString(),t)});let c={...d?{"x-api-key":d}:{},...a||{},...i};u={...g,headers:c,body:e}}else{let e={"Content-Type":"application/json",...d?{"x-api-key":d}:{},...a||{},...i};u={...g,headers:e,body:JSON.stringify(n)}}null==t||t.log("Final fetch options:",{method:u.method,headers:Object.keys(u.headers||{}),hasBody:!!u.body,bodyType:u.body instanceof FormData?"FormData":"JSON"});let h=await fetch(l,u),m=h.clone();if(!h.ok){let e={};try{e=await h.json()}catch(a){let t=await m.text();e.error=t}throw null==t||t.error("GraphQL request error:",e),(null==e?void 0:e.error)||(null==e?void 0:e.message)||(null==(c=null==e?void 0:e.error)?void 0:c.message)||h.statusText}return await h.json()}catch(e){return null==t||t.error("GraphQL request error:",e),{data:void 0,errors:[{message:(null==e?void 0:e.message)||String(e)||"An error occurred"}]}}}},296954,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.createExecuteGraphQL=void 0;let r=e.r(490749);a.createExecuteGraphQL=(e,t,a,s)=>{let l=(0,r.createGraphqlRequest)(t,a);return async function({query:r,variables:n,headers:i={},url:o=e,files:c}){if(!o)throw Error("GraphQL API URL is required. Either provide it in the request or set a default URL.");try{let e=await l({url:o,options:{query:r,variables:n,files:c},headers:{...s,...i},apiKey:t});if(e.errors)throw Error(e.errors[0].message);if(!e.data)throw Error("No data returned from GraphQL response.");return e.data}catch(e){throw null==a||a.error("GraphQL request error:",e),Error(e.message||"Unknown error occurred.")}}}},717327,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.GraphQLWebSocketClient=void 0,a.GraphQLWebSocketClient=class{constructor(e,t={},a,r){this.ws=null,this.subscriptions=new Map,this.messageId=0,this.isConnecting=!1,this.shouldReconnect=!0,this.reconnectAttempts=0,this.maxReconnectAttempts=10,this.reconnectDelay=1e3,this.wsUrl=e,this.protocols=a,this.connectionParams=t,this.logger=r}async connect(){return this.isConnecting||this.ws&&this.ws.readyState===WebSocket.OPEN?this.connectionPromise||Promise.resolve():(this.isConnecting=!0,this.connectionPromise=new Promise((e,t)=>
451{try{this.ws=new WebSocket(this.wsUrl,this.protocols),this.ws.onopen=()=>{var t;null==(t=this.logger)||t.log("WebSocket connected"),this.isConnecting=!1,this.reconnectAttempts=0,this.send({type:"connection_init",payload:this.connectionParams}),this.startPing(),e()},this.ws.onmessage=e=>{this.handleMessage(JSON.parse(e.data))},this.ws.onclose=e=>{var t;null==(t=this.logger)||t.log("WebSocket closed:",e.code,e.reason),this.isConnecting=!1,this.stopPing(),this.shouldReconnect&&this.reconnectAttempts<this.maxReconnectAttempts&&this.scheduleReconnect()},this.ws.onerror=e=>{var a;null==(a=this.logger)||a.error("WebSocket error:",e),this.isConnecting=!1,t(Error("WebSocket connection failed"))}}catch(e){this.isConnecting=!1,t(e)}}),this.connectionPromise)}handleMessage(e){var t,a;switch(e.type){case"connection_ack":null==(t=this.logger)||t.log("Connection acknowledged");break;case"ping":this.send({type:"pong"});break;case"pong":break;case"next":let r=this.subscriptions.get(e.id);(null==r?void 0:r.onNext)&&r.onNext(e.payload);break;case"error":let s=this.subscriptions.get(e.id);(null==s?void 0:s.onError)&&s.onError(Error(e.payload.message||"Subscription error"));break;case"complete":let l=this.subscriptions.get(e.id);(null==l?void 0:l.onComplete)&&l.onComplete(),this.subscriptions.delete(e.id);break;default:null==(a=this.logger)||a.log("Unknown message type:",e.type)}}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}startPing(){this.pingInterval=setInterval(()=>{this.send({type:"ping"})},3e4)}stopPing(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=void 0)}scheduleReconnect(){var e;this.reconnectAttempts++;let t=this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);null==(e=this.logger)||e.log(`Reconnecting in ${t}ms (attempt ${this.reconnectAttempts})`),setTimeout(()=>{this.shouldReconnect&&this.connect().catch(()=>{})},t)}async subscribe(e){await this.connect();let t=(++this.messageId).toString();return this.subscriptions.set(t,e),this.send({id:t,type:"start",payload:{query:e.query,variables:e.variables}}),()=>{this.send({id:t,type:"stop"}),this.subscriptions.delete(t)}}close(){this.shouldReconnect=!1,this.stopPing(),this.ws&&(this.ws.close(),this.ws=null),this.subscriptions.clear()}reconnect(){this.close(),this.shouldReconnect=!0,this.reconnectAttempts=0,this.connect()}isConnected(){var e;return(null==(e=this.ws)?void 0:e.readyState)===WebSocket.OPEN}updateConnectionParams(e){this.connectionParams={...this.connectionParams,...e}}}},895118,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0})},64692,(e,t,a)=>{"use strict";var r=e.i(247167),s=e.e&&e.e.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var s=Object.getOwnPropertyDescriptor(t,a);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,s)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),l=e.e&&e.e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(a,"__esModule",{value:!0}),a.defaultGraphQLClient=a.executeGraphQL=a.graphqlRequest=a.GraphQLClient=a.GraphQLWebSocketClient=void 0;let n=e.r(490749),i=e.r(296954),o=e.r(717327);l(e.r(895118),a),l(e.r(622598),a);var c=e.r(717327);Object.defineProperty(a,"GraphQLWebSocketClient",{enumerable:!0,get:function(){return c.GraphQLWebSocketClient}});class u{constructor(e={}){this.graphqlRequest=(0,n.createGraphqlRequest)(this.apiKey,this.logger,this.headers),this.executeGraphQL=()=>(0,i.createExecuteGraphQL)(this.apiUrl,this.apiKey,this.logger,this.headers),this.apiUrl=e.apiUrl,this.apiKey=e.apiKey,this.headers=e.headers,this.logger=e.logger,this.wsUrl=e.wsUrl,this.wsHeaders=e.wsHeaders,this.wsProtocols=e.wsProtocols}getWebSocketClient(){if(!this.wsClient){if(!this.wsUrl)if(this.apiUrl){let e=new URL(this.apiUrl);e.protocol="https:"===e.protocol?"wss:":"ws:",this.wsUrl=e.toString()}else throw Error("WebSocket URL is required for subscriptions");let e={};this.apiKey&&(e.authorization=`Bearer ${this.apiKey}`),this.wsHeaders&&Object.assign(e,this.wsHeaders),this.headers&&Object.assign(e,this.headers),this.wsClient=new o.GraphQLWebSocketClient(this.wsUrl,e,this.wsProtocols,this.logger)}return this.wsClient}async subscribe(e){let t=this.getWebSocketClient();return await t.subscribe(e)}closeWebSocket(){this.wsClient&&(this.wsClient.close(),this.wsClient=void 0)}
451reconnectWebSocket(){this.wsClient&&this.wsClient.reconnect()}isWebSocketConnected(){var e,t;return null!=(t=null==(e=this.wsClient)?void 0:e.isConnected())&&t}updateWebSocketAuth(e){this.wsClient&&(this.wsClient.updateConnectionParams({authorization:`Bearer ${e}`}),this.wsClient.reconnect())}}a.GraphQLClient=u;let d=void 0!==r.default?"https://graph.100pay.co/graphql":void 0,p=void 0!==r.default?r.default.env.API_KEY:void 0,g=void 0!==r.default?r.default.env.NEXT_PUBLIC_GRAPHQL_WS_URL:void 0;a.graphqlRequest=(0,n.createGraphqlRequest)(p),a.executeGraphQL=(0,i.createExecuteGraphQL)(d,p),a.defaultGraphQLClient=new u({apiUrl:d,apiKey:p,wsUrl:g})},555764,36487,e=>{"use strict";var t=e.i(271645),a=e.i(768834),r=e.i(579473);let s=new Map,l=(e,t)=>{let l,i;t?(l=e,i=t):(l=void 0,i=e);let{storageKey:o,enablePersistence:c=!0,selectForPersistence:u,storage:d=window.localStorage}=i;if(!o)throw Error("usePersistedState: storageKey is required");if(s.has(o))return n(s.get(o));let p=function(e,t,s,l,n){let i=(t,a)=>({userState:e,isHydrated:!1,setUserState:e=>{t(t=>({userState:"function"==typeof e?e(t.userState):e}))},resetToInitial:()=>{t({userState:e,isHydrated:a().isHydrated})},markAsHydrated:e=>{t({isHydrated:e})}});if(s&&n)return(0,a.create)()((0,r.persist)(i,{name:t,storage:(0,r.createJSONStorage)(()=>n),partialize:l?e=>({userState:l(e.userState)}):e=>({userState:e.userState}),onRehydrateStorage:()=>e=>{e?.markAsHydrated(!0)}}));{let e=(0,a.create)()(i);return e.getState().markAsHydrated(!0),e}}(l,o,c,u,d);return s.set(o,p),n(p)};function n(e){return{state:e(e=>e.userState),setState:e(e=>e.setUserState),resetState:e(e=>e.resetToInitial),isHydrated:e(e=>e.isHydrated)}}e.s(["usePersistedState",0,l],36487);var i=e.i(135613);e.s(["useStatus",0,(e={})=>{let{strategy:a="local",namespace:r="default",defaultStatuses:s={},aggregation:n={},persistence:o={}}=e,{enabled:c=!1,priority:u=[],defaultTitle:d="",defaultDescription:p=""}=n,{enabled:g=!1,storage:h=window.localStorage}=o,m=(0,t.useRef)(!1),y=(0,t.useCallback)(()=>{let e={};return Object.entries(s).forEach(([t,a])=>{e[t]={...a,timestamp:a.timestamp||Date.now()}}),e},[s]),[f,b]=(0,t.useState)(y),{state:w,setState:v}=l({namespaced:{}},{storageKey:"status-store",enablePersistence:g,storage:h}),S=(0,t.useMemo)(()=>w.namespaced[r]||{},[w.namespaced,r]),k=(0,t.useCallback)(()=>{w.namespaced[r]||v(e=>({...e,namespaced:{...e.namespaced,[r]:{}}}))},[w.namespaced,r,v]);if("global"===a&&k(),"global"===a&&!m.current&&Object.keys(s).length>0){let e=w.namespaced[r]||{};if(!Object.keys(s).some(t=>void 0!==e[t])){let t=Object.entries(s).reduce((e,[t,a])=>(e[t]={...a,timestamp:a.timestamp||Date.now()},e),{});v(a=>({...a,namespaced:{...a.namespaced,[r]:{...e,...t}}}))}m.current=!0}let C=(0,t.useMemo)(()=>"global"===a?S:f,[a,S,f]),W=(0,t.useCallback)((e,t)=>{let s={...t,timestamp:Date.now()};"global"===a?v(t=>({...t,namespaced:{...t.namespaced,[r]:{...t.namespaced[r],[e]:{...t.namespaced[r]?.[e],...s}}}})):b(t=>({...t,[e]:{...t[e],...s}}))},[a,r,v]),U=(0,t.useCallback)(e=>{"global"===a?v(t=>{let a=t.namespaced[r]||{};if(e){let{[e]:s,...l}=a;return i.logger.debug("clearStatus",{key:e,removedItem:s,rest:l}),{...t,namespaced:{...t.namespaced,[r]:l}}}{let e=Object.entries(s).reduce((e,[t,a])=>(e[t]={...a,timestamp:a.timestamp||Date.now()},e),{});return{...t,namespaced:{...t.namespaced,[r]:e}}}}):e?b(t=>{let{[e]:a,...r}=t;return i.logger.debug("clearStatus",{key:e,removedItem:a,rest:r}),r}):b(y())},[a,r,v,s,y]),x=(0,t.useMemo)(()=>{if(!c)return{title:d,description:p,type:"idle",loading:!1};let e=Object.entries(C).filter(([,e])=>e);if(0===e.length)return{title:d,description:p,type:"idle",loading:!1};let[,t]=e.sort(([e],[t])=>{if(u.length>0){let a=u.indexOf(e),r=u.indexOf(t);if(-1!==a&&-1!==r)return a-r;if(-1!==a)return -1;if(-1!==r)return 1}let a=C[e]?.timestamp||0,r=C[t]?.timestamp||0;if(a!==r)return r-a;let s={loading:0,error:1,warning:2,success:3,idle:4};return s[C[e]?.status||"idle"]-s[C[t]?.status||"idle"]})[0],a=e.some(([,e])=>e?.status==="loading");return{title:t?.name||d,description:t?.message||p,type:t?.status||"idle",loading:a}},[C,c,u,d,p]);return{status:C,setStatus:W,clearStatus:U,isLoading:e=>(e||Object.keys(C)).some(e=>C[e]?.status==="loading"),hasError:e=>(e||Object.keys(C)).some(e=>C[e]?.status==="error"),allSuccess:e=>{let t=e||Object.keys(C);return t.length>0&&t.every(e=>C[e]?.status==="success")},...c&&{aggregatedStatus:x}}}],555764)},310126,e=>{"use strict";var t=e.i(768834),a=e.i(579473);let r=(0,t.create)()((0,a.persist)(e=>({wallets:[],setWallets:t=>e({wallets:t}),addWallet:t=>e(e=>e.wallets.find(e=>e.name===t.name)?{wallets:e.wallets.map(e=>e.name===t.name?{...e,balance:t.balance}:e)}:{wallets:[...e.wallets,t]}),allWallets:[],setAllWallets:t=>e({allWallets:t}),dashboardWallets:[],setDashboardWallets:t=>e({dashboardWallets:t}),topWallets:[],setTopWallet:t=>
451e({topWallets:t}),rates:[],setRates:t=>e({rates:t}),walletHistory:[],setWalletHistory:t=>e({walletHistory:t}),currencyDetails:null,setCurrencyDetails:t=>e({currencyDetails:t}),tokenPrice:0,setTokenPrice:t=>e({tokenPrice:t}),fiatCheckoutWallet:null,setFiatCheckoutWallet:t=>e({fiatCheckoutWallet:t})}),{name:"wallet-storage",storage:(0,a.createJSONStorage)(()=>localStorage)}));e.s(["useWalletStore",0,r])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.