@cartridge/controller 0.13.5 → 0.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1072 @@
1
+ import { shortString as u, constants as I, CallData as x, addAddressPadding as T, getChecksumAddress as f, hash as y, typedData as p, TypedDataRevision as h } from "starknet";
2
+ const E = "0.13.7", Q = {
3
+ version: E
4
+ }, M = [
5
+ "metamask",
6
+ "rabby",
7
+ "phantom-evm"
8
+ ], w = [
9
+ "argent",
10
+ "braavos",
11
+ "phantom",
12
+ "base"
13
+ ], C = [
14
+ ...M,
15
+ ...w
16
+ ], D = [
17
+ "google",
18
+ "webauthn",
19
+ "discord",
20
+ "walletconnect",
21
+ "password"
22
+ ], G = [
23
+ ...D,
24
+ ...C
25
+ ], V = [
26
+ ...D,
27
+ ...M
28
+ ];
29
+ var Y = /* @__PURE__ */ ((t) => (t.SUCCESS = "SUCCESS", t.NOT_CONNECTED = "NOT_CONNECTED", t.ERROR = "ERROR", t.CANCELED = "CANCELED", t.USER_INTERACTION_REQUIRED = "USER_INTERACTION_REQUIRED", t))(Y || {}), O = /* @__PURE__ */ ((t) => (t.PAYMASTER = "PAYMASTER", t.CREDITS = "CREDITS", t))(O || {});
30
+ const S = /* @__PURE__ */ new Set([
31
+ "contracts",
32
+ "messages",
33
+ "target",
34
+ "method",
35
+ "name",
36
+ "description",
37
+ "types",
38
+ "domain",
39
+ "primaryType"
40
+ ]);
41
+ function k(t) {
42
+ if (!S.has(t))
43
+ throw new Error(`Invalid property name: ${t}`);
44
+ }
45
+ function c(t, e) {
46
+ return k(e), t[e];
47
+ }
48
+ function $(t) {
49
+ return b(t).map((e) => ({
50
+ entrypoint: e.entrypoint,
51
+ contractAddress: T(e.contractAddress),
52
+ calldata: x.toHex(e.calldata)
53
+ }));
54
+ }
55
+ function F(t, e) {
56
+ const s = u.decodeShortString(e), r = t.chains?.[s];
57
+ if (r?.policies)
58
+ return L(r.policies);
59
+ }
60
+ function L(t) {
61
+ return Array.isArray(t) ? t.reduce(
62
+ (e, s) => {
63
+ if (c(s, "target")) {
64
+ const a = f(
65
+ c(s, "target")
66
+ ), r = c(s, "method"), o = c(
67
+ e,
68
+ "contracts"
69
+ ), l = {
70
+ name: P(r),
71
+ entrypoint: r,
72
+ description: c(s, "description")
73
+ };
74
+ if (a in o) {
75
+ const d = b(o[a].methods);
76
+ o[a] = {
77
+ methods: [...d, l]
78
+ };
79
+ } else
80
+ o[a] = {
81
+ methods: [l]
82
+ };
83
+ } else
84
+ c(e, "messages").push(s);
85
+ return e;
86
+ },
87
+ { contracts: {}, messages: [] }
88
+ ) : t;
89
+ }
90
+ function X(t) {
91
+ return [
92
+ ...Object.entries(t.contracts ?? {}).sort(([e], [s]) => e.toLowerCase().localeCompare(s.toLowerCase())).flatMap(
93
+ ([e, { methods: s }]) => b(s).slice().sort((a, r) => a.entrypoint.localeCompare(r.entrypoint)).map((a) => {
94
+ if (a.entrypoint === "approve") {
95
+ if ("spender" in a && "amount" in a && a.spender && a.amount)
96
+ return {
97
+ target: f(e),
98
+ spender: a.spender,
99
+ amount: String(a.amount)
100
+ };
101
+ console.warn(
102
+ `[DEPRECATED] Approve method without spender and amount fields will be rejected in future versions. Please update your preset or policies to include both 'spender' and 'amount' fields for approve calls on contract ${e}. Example: { entrypoint: "approve", spender: "0x...", amount: "0x..." }`
103
+ );
104
+ }
105
+ return {
106
+ target: f(e),
107
+ method: y.getSelectorFromName(a.entrypoint),
108
+ authorized: !!a.authorized
109
+ };
110
+ })
111
+ ),
112
+ ...(t.messages ?? []).map((e) => {
113
+ const s = p.getStructHash(
114
+ e.types,
115
+ "StarknetDomain",
116
+ e.domain,
117
+ h.ACTIVE
118
+ ), a = p.getTypeHash(
119
+ e.types,
120
+ e.primaryType,
121
+ h.ACTIVE
122
+ );
123
+ return {
124
+ scope_hash: y.computePoseidonHash(s, a),
125
+ authorized: !!e.authorized
126
+ };
127
+ }).sort(
128
+ (e, s) => e.scope_hash.toString().localeCompare(s.scope_hash.toString())
129
+ )
130
+ ];
131
+ }
132
+ function b(t) {
133
+ return Array.isArray(t) ? t : [t];
134
+ }
135
+ function P(t) {
136
+ return t.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ").toLowerCase().replace(/^\w/, (e) => e.toUpperCase());
137
+ }
138
+ function J(t) {
139
+ const e = t.pathname.split("/");
140
+ if (!(t.hostname === "api.cartridge.gg")) {
141
+ if (typeof XMLHttpRequest > "u")
142
+ return console.warn(
143
+ `Cannot make synchronous HTTP call in Node.js environment for ${t.toString()}`
144
+ ), u.encodeShortString("LOCALHOST");
145
+ const a = new XMLHttpRequest();
146
+ a.open("POST", t.toString(), !1), a.setRequestHeader("Content-Type", "application/json");
147
+ const r = JSON.stringify({
148
+ jsonrpc: "2.0",
149
+ method: "starknet_chainId",
150
+ params: [],
151
+ id: 1
152
+ });
153
+ try {
154
+ if (a.send(r), a.status === 200) {
155
+ const o = JSON.parse(a.responseText);
156
+ if (o.result)
157
+ return o.result;
158
+ }
159
+ throw new Error(
160
+ `Failed to get chain ID from ${t.toString()}: ${a.status} ${a.statusText}`
161
+ );
162
+ } catch (o) {
163
+ throw new Error(`Failed to connect to ${t.toString()}: ${o}`);
164
+ }
165
+ }
166
+ if (e.includes("starknet")) {
167
+ if (e.includes("mainnet"))
168
+ return I.StarknetChainId.SN_MAIN;
169
+ if (e.includes("sepolia"))
170
+ return I.StarknetChainId.SN_SEPOLIA;
171
+ } else if (e.length >= 3) {
172
+ const a = e[2];
173
+ if (e.includes("katana"))
174
+ return u.encodeShortString(
175
+ `WP_${a.toUpperCase().replace(/-/g, "_")}`
176
+ );
177
+ if (e.includes("mainnet"))
178
+ return u.encodeShortString(
179
+ `GG_${a.toUpperCase().replace(/-/g, "_")}`
180
+ );
181
+ }
182
+ throw new Error(`Chain ${t.toString()} not supported`);
183
+ }
184
+ function K() {
185
+ return window.matchMedia("(max-width: 768px)").matches || "ontouchstart" in window || navigator.maxTouchPoints > 0;
186
+ }
187
+ function q(t) {
188
+ try {
189
+ const e = new URL(t, window.location.origin);
190
+ if (e.protocol === "http:" || e.protocol === "https:")
191
+ return e.href;
192
+ } catch {
193
+ }
194
+ return "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
195
+ }
196
+ const ee = "https://x.cartridge.gg", te = "https://api.cartridge.gg";
197
+ class _ extends Error {
198
+ constructor() {
199
+ super("Not ready to connect"), Object.setPrototypeOf(this, _.prototype);
200
+ }
201
+ }
202
+ class m extends Error {
203
+ constructor(e, s) {
204
+ super(e), this.cause = s, this.name = "HeadlessAuthenticationError", Object.setPrototypeOf(this, m.prototype);
205
+ }
206
+ }
207
+ class A extends m {
208
+ constructor(e) {
209
+ super(`Invalid credentials provided for type: ${e}`), this.name = "InvalidCredentialsError", Object.setPrototypeOf(this, A.prototype);
210
+ }
211
+ }
212
+ class j extends Error {
213
+ constructor(e) {
214
+ super(`Operation "${e}" is not supported in headless mode`), this.name = "HeadlessModeNotSupportedError", Object.setPrototypeOf(this, j.prototype);
215
+ }
216
+ }
217
+ const R = {
218
+ ACCOUNTS: "accounts"
219
+ }, v = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjgwMCIgdmlld0JveD0iMCAwIDgwMCA4MDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIwX2RfNTExMl83ODIpIj4KPHBhdGggZD0iTTQ2OS4yMzYgNzBDNDgyLjM5IDcwIDQ5My4wNTMgODAuNjYzIDQ5My4wNTMgOTMuODE2NFYxNDcuMTQ3TDUxNS4zMzggMTQ3LjE0N0w1MTUuNDI4IDE0Ny4xNDdMNTE1LjU1NCAxNDcuMTQ3TDUxNS44MjYgMTQ3LjE0OUM1MTYuMDE2IDE0Ny4xNTEgNTE2LjIyNSAxNDcuMTUzIDUx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gMCAwIDAgMCAwIDAuMjUgMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iQmFja2dyb3VuZEltYWdlRml4IiByZXN1bHQ9ImVmZmVjdDFfZHJvcFNoYWRvd181MTEyXzc4MiIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluPSJTb3VyY2VHcmFwaGljIiBpbjI9ImVmZmVjdDFfZHJvcFNoYWRvd181MTEyXzc4MiIgcmVzdWx0PSJzaGFwZSIvPgo8L2ZpbHRlcj4KPC9kZWZzPgo8L3N2Zz4K";
220
+ function U() {
221
+ }
222
+ class B {
223
+ m_lastPromise = Promise.resolve();
224
+ /**
225
+ * Acquire lock
226
+ * @param [bypass=false] option to skip lock acquisition
227
+ */
228
+ async obtain(e = !1) {
229
+ let s = U;
230
+ if (e) return s;
231
+ const a = this.m_lastPromise;
232
+ return this.m_lastPromise = new Promise((r) => s = r), await a, s;
233
+ }
234
+ }
235
+ const H = new B();
236
+ class ae {
237
+ id = "controller";
238
+ name = "Controller";
239
+ version = Q.version;
240
+ icon = v;
241
+ account;
242
+ subscriptions = [];
243
+ _probePromise = null;
244
+ async safeProbe() {
245
+ if (this.account)
246
+ return this.account;
247
+ if (this._probePromise)
248
+ return this._probePromise;
249
+ const e = await H.obtain();
250
+ return await new Promise(async (s) => {
251
+ try {
252
+ this._probePromise = this.probe();
253
+ const a = await this._probePromise;
254
+ s(a);
255
+ } finally {
256
+ this._probePromise = null;
257
+ }
258
+ }).finally(() => {
259
+ e();
260
+ });
261
+ }
262
+ request = async (e) => {
263
+ switch (e.type) {
264
+ case "wallet_getPermissions":
265
+ return await this.safeProbe(), this.account ? [R.ACCOUNTS] : [];
266
+ case "wallet_requestAccounts": {
267
+ if (this.account)
268
+ return [this.account.address];
269
+ const a = e.params && e.params.silent_mode;
270
+ return this.account = await this.safeProbe(), !this.account && !a && (this.account = await this.connect()), this.account ? [this.account.address] : [];
271
+ }
272
+ case "wallet_watchAsset":
273
+ throw {
274
+ code: 63,
275
+ message: "An unexpected error occurred",
276
+ data: "wallet_watchAsset not implemented"
277
+ };
278
+ case "wallet_addStarknetChain": {
279
+ let a = e.params;
280
+ return this.addStarknetChain(a);
281
+ }
282
+ case "wallet_switchStarknetChain": {
283
+ let a = e.params;
284
+ return this.switchStarknetChain(a.chainId);
285
+ }
286
+ case "wallet_requestChainId":
287
+ if (!this.account)
288
+ throw {
289
+ code: 63,
290
+ message: "An unexpected error occurred",
291
+ data: "Account not initialized"
292
+ };
293
+ return await this.account.getChainId();
294
+ case "wallet_deploymentData":
295
+ throw {
296
+ code: 63,
297
+ message: "An unexpected error occurred",
298
+ data: "wallet_deploymentData not implemented"
299
+ };
300
+ case "wallet_addInvokeTransaction":
301
+ if (!this.account)
302
+ throw {
303
+ code: 63,
304
+ message: "An unexpected error occurred",
305
+ data: "Account not initialized"
306
+ };
307
+ let s = e.params;
308
+ return await this.account.execute(
309
+ s.calls.map((a) => ({
310
+ contractAddress: a.contract_address,
311
+ entrypoint: a.entry_point,
312
+ calldata: a.calldata
313
+ }))
314
+ );
315
+ case "wallet_addDeclareTransaction":
316
+ throw {
317
+ code: 63,
318
+ message: "An unexpected error occurred",
319
+ data: "wallet_addDeclareTransaction not implemented"
320
+ };
321
+ case "wallet_signTypedData": {
322
+ if (!this.account)
323
+ throw {
324
+ code: 63,
325
+ message: "An unexpected error occurred",
326
+ data: "Account not initialized"
327
+ };
328
+ return await this.account.signMessage(e.params);
329
+ }
330
+ case "wallet_supportedSpecs":
331
+ return [];
332
+ case "wallet_supportedWalletApi":
333
+ return [];
334
+ default:
335
+ throw {
336
+ code: 63,
337
+ message: "An unexpected error occurred",
338
+ data: `Unknown RPC call type: ${e.type}`
339
+ };
340
+ }
341
+ };
342
+ on = (e, s) => {
343
+ if (e !== "accountsChanged" && e !== "networkChanged")
344
+ throw new Error(`Unknown event: ${e}`);
345
+ this.subscriptions.push({ type: e, handler: s });
346
+ };
347
+ off = (e, s) => {
348
+ if (e !== "accountsChanged" && e !== "networkChanged")
349
+ throw new Error(`Unknown event: ${e}`);
350
+ const a = this.subscriptions.findIndex(
351
+ (r) => r.type === e && r.handler === s
352
+ );
353
+ a >= 0 && this.subscriptions.splice(a, 1);
354
+ };
355
+ emitNetworkChanged(e) {
356
+ this.subscriptions.filter((s) => s.type === "networkChanged").forEach((s) => {
357
+ s.handler(e);
358
+ });
359
+ }
360
+ emitAccountsChanged(e) {
361
+ this.subscriptions.filter((s) => s.type === "accountsChanged").forEach((s) => {
362
+ s.handler(e);
363
+ });
364
+ }
365
+ }
366
+ function oe(t) {
367
+ return {
368
+ verified: !1,
369
+ contracts: t.contracts ? Object.fromEntries(
370
+ Object.entries(t.contracts).map(([e, s]) => [
371
+ e,
372
+ {
373
+ ...s,
374
+ methods: s.methods.map((a) => ({
375
+ ...a,
376
+ authorized: !0
377
+ }))
378
+ }
379
+ ])
380
+ ) : void 0,
381
+ messages: t.messages?.map((e) => ({
382
+ ...e,
383
+ authorized: !0
384
+ }))
385
+ };
386
+ }
387
+ var W = [
388
+ {
389
+ name: "Wrapped BTC",
390
+ symbol: "WBTC",
391
+ decimals: 8,
392
+ l2_token_address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
393
+ sort_order: 0,
394
+ total_supply: null,
395
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/7dcb2db2-a7a7-44af-660b-8262e057a100/logo"
396
+ },
397
+ {
398
+ name: "USD Coin",
399
+ symbol: "USDC",
400
+ decimals: 6,
401
+ l2_token_address: "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
402
+ sort_order: 5,
403
+ total_supply: null,
404
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/e5aaa970-a998-47e8-bd43-4a3b56b87200/logo"
405
+ },
406
+ {
407
+ name: "LUSD Stablecoin",
408
+ symbol: "LUSD",
409
+ decimals: 18,
410
+ l2_token_address: "0x070a76fd48ca0ef910631754d77dd822147fe98a569b826ec85e3c33fde586ac",
411
+ sort_order: 3,
412
+ total_supply: null,
413
+ hidden: !0,
414
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/dc0ae733-5498-4afa-f475-48dba677aa00/logo"
415
+ },
416
+ {
417
+ name: "Tether USD",
418
+ symbol: "USDT",
419
+ decimals: 6,
420
+ l2_token_address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
421
+ sort_order: 4,
422
+ total_supply: null,
423
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/c8a721d1-07c3-46e4-ab4e-523977c30b00/logo"
424
+ },
425
+ {
426
+ name: "Ether",
427
+ symbol: "ETH",
428
+ decimals: 18,
429
+ l2_token_address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
430
+ sort_order: 3,
431
+ total_supply: null,
432
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/e07829b7-0382-4e03-7ecd-a478c5aa9f00/logo"
433
+ },
434
+ {
435
+ name: "Dai Stablecoin",
436
+ symbol: "DAIv0",
437
+ decimals: 18,
438
+ l2_token_address: "0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3",
439
+ sort_order: 4,
440
+ total_supply: null,
441
+ hidden: !0,
442
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/919e761b-56f7-4f53-32aa-5e066f7f6200/logo"
443
+ },
444
+ {
445
+ name: "Dai Stablecoin",
446
+ symbol: "DAI",
447
+ decimals: 18,
448
+ l2_token_address: "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",
449
+ sort_order: 4,
450
+ total_supply: null,
451
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/919e761b-56f7-4f53-32aa-5e066f7f6200/logo"
452
+ },
453
+ {
454
+ name: "Legacy Starknet Wrapped Staked Ether",
455
+ symbol: "wstETH-legacy",
456
+ decimals: 18,
457
+ l2_token_address: "0x042b8f0484674ca266ac5d08e4ac6a3fe65bd3129795def2dca5c34ecc5f96d2",
458
+ sort_order: 1,
459
+ total_supply: null,
460
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/26162dcc-29c2-4f5e-3acd-5e6be1f07a00/logo"
461
+ },
462
+ {
463
+ name: "Wrapped Staked Ether",
464
+ symbol: "wstETH",
465
+ decimals: 18,
466
+ l2_token_address: "0x0057912720381af14b0e5c87aa4718ed5e527eab60b3801ebf702ab09139e38b",
467
+ sort_order: 1,
468
+ total_supply: null,
469
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/dbbcbdea-1a92-437d-3701-4a5ee129d000/logo"
470
+ },
471
+ {
472
+ name: "Rocket Pool ETH",
473
+ symbol: "rETH",
474
+ decimals: 18,
475
+ l2_token_address: "0x0319111a5037cbec2b3e638cc34a3474e2d2608299f3e62866e9cc683208c610",
476
+ sort_order: 1,
477
+ total_supply: null,
478
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/c9f2d6fe-fbc6-4384-0990-923dfcb7a200/logo"
479
+ },
480
+ {
481
+ name: "LORDS",
482
+ symbol: "LORDS",
483
+ decimals: 18,
484
+ l2_token_address: "0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49",
485
+ sort_order: 1,
486
+ total_supply: 509e5,
487
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/a3bfe959-50c4-4f89-0aef-b19207d82a00/logo"
488
+ },
489
+ {
490
+ name: "R Stablecoin",
491
+ symbol: "R",
492
+ decimals: 18,
493
+ l2_token_address: "0x01fa2fb85f624600112040e1f3a848f53a37ed5a7385810063d5fe6887280333",
494
+ sort_order: 3,
495
+ total_supply: null,
496
+ hidden: !0,
497
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/77612e4e-f7ee-4dba-2066-af321843ef00/logo"
498
+ },
499
+ {
500
+ name: "Frax",
501
+ symbol: "FRAX",
502
+ decimals: 18,
503
+ l2_token_address: "0x009c6b4fb13dfaa025c1383ed6190af8ed8cbb09d9588a3bb020feb152442406",
504
+ sort_order: 1,
505
+ total_supply: 649462235,
506
+ hidden: !0,
507
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/eeaf0779-e492-474c-ef19-b27843525600/logo"
508
+ },
509
+ {
510
+ name: "Frax Share",
511
+ symbol: "FXS",
512
+ decimals: 18,
513
+ l2_token_address: "0x0058efd0e73c33a848ffaa88738d128ebf0af98ea78cf3c14dc757bb02d39ffb",
514
+ sort_order: 1,
515
+ total_supply: null,
516
+ hidden: !0,
517
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/98bea621-1e4f-4d63-9689-bdaef0d56500/logo"
518
+ },
519
+ {
520
+ name: "Staked Frax Ether",
521
+ symbol: "sfrxETH",
522
+ decimals: 18,
523
+ l2_token_address: "0x04578fffc279e61b5cb0267a5f8e24b6089d40f93158fbbad2cb23b8622c9233",
524
+ sort_order: 1,
525
+ total_supply: null,
526
+ hidden: !0,
527
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/cd6fe18a-25db-4de9-758a-daf3b364ea00/logo"
528
+ },
529
+ {
530
+ name: "Uniswap",
531
+ symbol: "UNI",
532
+ decimals: 18,
533
+ l2_token_address: "0x049210ffc442172463f3177147c1aeaa36c51d152c1b0630f2364c300d4f48ee",
534
+ sort_order: 1,
535
+ total_supply: 1e9,
536
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/361b018e-bd53-4019-27c8-7cf8d9031b00/logo"
537
+ },
538
+ {
539
+ name: "Paper",
540
+ symbol: "PAPER",
541
+ decimals: 18,
542
+ l2_token_address: "0x0410466536b5ae074f7fea81e5533b8134a9fa08b3dd077dd9db08f64997d113",
543
+ sort_order: 1,
544
+ total_supply: null,
545
+ hidden: !0,
546
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/811f019a-0461-4cff-6c1e-442102863f00/logo"
547
+ },
548
+ {
549
+ name: "StarkPepe",
550
+ symbol: "xSPEPE",
551
+ decimals: 18,
552
+ l2_token_address: "0x06f15ec4b6ff0b7f7a216c4b2ccdefc96cbf114d6242292ca82971592f62273b",
553
+ sort_order: 1,
554
+ total_supply: null,
555
+ hidden: !0,
556
+ disabled: !0
557
+ },
558
+ {
559
+ name: "StarkNet Token",
560
+ symbol: "STRK",
561
+ decimals: 18,
562
+ l2_token_address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
563
+ sort_order: 2,
564
+ total_supply: 1e10,
565
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/1b126320-367c-48ed-cf5a-ba7580e49600/logo"
566
+ },
567
+ {
568
+ name: "zkLend Token",
569
+ symbol: "ZEND",
570
+ decimals: 18,
571
+ l2_token_address: "0x00585c32b625999e6e5e78645ff8df7a9001cf5cf3eb6b80ccdd16cb64bd3a34",
572
+ sort_order: 1,
573
+ total_supply: null,
574
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/95515b0e-1230-4158-10f1-56888f613c00/logo"
575
+ },
576
+ {
577
+ name: "Ekubo Protocol",
578
+ symbol: "EKUBO",
579
+ decimals: 18,
580
+ l2_token_address: "0x075afe6402ad5a5c20dd25e10ec3b3986acaa647b77e4ae24b0cbc9a54a27a87",
581
+ sort_order: 1,
582
+ total_supply: 1e7,
583
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/634d9c36-2f0b-4781-93e6-72d701b5af00/logo"
584
+ },
585
+ {
586
+ name: "SOCKS",
587
+ symbol: "SOCKS",
588
+ decimals: 18,
589
+ l2_token_address: "0x023ed2ba4fb5709302c5dfd739fa7613359042f143286c115b6c7f7dc2601015",
590
+ sort_order: 1,
591
+ total_supply: 1e11,
592
+ hidden: !0,
593
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/2db5a2a6-c98e-4b80-35e0-31b489132100/logo"
594
+ },
595
+ {
596
+ name: "Nostra",
597
+ symbol: "NSTR",
598
+ decimals: 18,
599
+ l2_token_address: "0x00c530f2c0aa4c16a0806365b0898499fba372e5df7a7172dc6fe9ba777e8007",
600
+ sort_order: 1,
601
+ total_supply: 1e8,
602
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/a45c2224-17a7-4269-ea7e-3924e9755800/logo"
603
+ },
604
+ {
605
+ name: "Carmine",
606
+ symbol: "CRM",
607
+ decimals: 18,
608
+ l2_token_address: "0x51c4b1fe3bf6774b87ad0b15ef5d1472759076e42944fff9b9f641ff13e5bbe",
609
+ sort_order: 1,
610
+ total_supply: 1e8,
611
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/6ab817f1-8075-4a94-6e14-f112f1f89d00/logo"
612
+ },
613
+ {
614
+ name: "Cash",
615
+ symbol: "CASH",
616
+ decimals: 18,
617
+ l2_token_address: "0x498edfaf50ca5855666a700c25dd629d577eb9afccdf3b5977aec79aee55ada",
618
+ sort_order: 3,
619
+ total_supply: null,
620
+ hidden: !1,
621
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/6bd6d156-f509-4b51-5dfc-3ee566143600/logo"
622
+ },
623
+ {
624
+ name: "Nums",
625
+ symbol: "NUMS",
626
+ decimals: 18,
627
+ l2_token_address: "0xe5f10eddc01699dc899a30dbc3c9858148fa4aa0a47c0ffd85f887ffc4653e",
628
+ sort_order: 1,
629
+ total_supply: 1,
630
+ hidden: !0,
631
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/90868d05-cb75-4c42-278c-5a540db2cf00/logo"
632
+ },
633
+ {
634
+ name: "Flip",
635
+ symbol: "FLIP",
636
+ decimals: 18,
637
+ l2_token_address: "0x01bfe97d729138fc7c2d93c77d6d1d8a24708d5060608017d9b384adf38f04c7",
638
+ sort_order: 1,
639
+ total_supply: null,
640
+ hidden: !0,
641
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/275f0fa8-a691-471c-ace6-0eb0315dde00/logo"
642
+ },
643
+ {
644
+ name: "Eternum Stone",
645
+ symbol: "STONE",
646
+ decimals: 18,
647
+ l2_token_address: "0x439a1c010e3e1bb2d43d43411000893c0042bd88f6c701611a0ea914d426da4",
648
+ sort_order: 1,
649
+ total_supply: null,
650
+ hidden: !0,
651
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/932e7f83-a4c2-40f0-3048-35af3b194100/logo"
652
+ },
653
+ {
654
+ name: "Eternum Coal",
655
+ symbol: "COAL",
656
+ decimals: 18,
657
+ l2_token_address: "0xce635e3f241b0ae78c46a929d84a9101910188f9c4024eaa7559556503c31a",
658
+ sort_order: 1,
659
+ total_supply: null,
660
+ hidden: !0,
661
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/cf2ee180-06bf-4443-e3aa-724d7c28e800/logo"
662
+ },
663
+ {
664
+ name: "Eternum Wood",
665
+ symbol: "WOOD",
666
+ decimals: 18,
667
+ l2_token_address: "0x40d8907cec0f7ae9c364dfb12485a1314d84c129bf1898d2f3d4b7fcc7d44f4",
668
+ sort_order: 1,
669
+ total_supply: null,
670
+ hidden: !0,
671
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/1db5f954-c1ef-447e-9f8f-05bd9f3b2b00/logo"
672
+ },
673
+ {
674
+ name: "Eternum Copper",
675
+ symbol: "COPPER",
676
+ decimals: 18,
677
+ l2_token_address: "0x66ed5c928ee027a9419ace1cbea8389885161db5572a7c5c4fef2310e9bf494",
678
+ sort_order: 1,
679
+ total_supply: null,
680
+ hidden: !0,
681
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/6bbcdcc9-6146-404d-9501-92a664cf3100/logo"
682
+ },
683
+ {
684
+ name: "Eternum Ironwood",
685
+ symbol: "IRONWOOD",
686
+ decimals: 18,
687
+ l2_token_address: "0x1720cf6318bff45e62acc588680ae3cd4d5f8465b1d52cb710533c9299b031a",
688
+ sort_order: 1,
689
+ total_supply: null,
690
+ hidden: !0,
691
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/5af7c03b-e4ae-4aee-eba4-a4e2160a1d00/logo"
692
+ },
693
+ {
694
+ name: "Eternum Obsidian",
695
+ symbol: "OBSIDIAN",
696
+ decimals: 18,
697
+ l2_token_address: "0x3b6448d09dcd023507376402686261f5d6739455fa02f804907b066e488da66",
698
+ sort_order: 1,
699
+ total_supply: null,
700
+ hidden: !0,
701
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/8be9bc66-486b-4181-6804-725a1db8ad00/logo"
702
+ },
703
+ {
704
+ name: "Eternum Gold",
705
+ symbol: "GOLD",
706
+ decimals: 18,
707
+ l2_token_address: "0xdff9dca192609c4e86ab3be22c7ec1e968876c992d21986f3c542be97fa2f",
708
+ sort_order: 1,
709
+ total_supply: null,
710
+ hidden: !0,
711
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/fb9e90f7-3c2f-4c64-7e43-c3f694f35e00/logo"
712
+ },
713
+ {
714
+ name: "Eternum Silver",
715
+ symbol: "SILVER",
716
+ decimals: 18,
717
+ l2_token_address: "0x6fe21d2d4a8a05bdb70f09c9250af9870020d5dcc35f410b4a39d6605c3e353",
718
+ sort_order: 1,
719
+ total_supply: null,
720
+ hidden: !0,
721
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/e443afeb-850b-46a0-a7ba-a473306d6b00/logo"
722
+ },
723
+ {
724
+ name: "Eternum Mithral",
725
+ symbol: "MITHRAL",
726
+ decimals: 18,
727
+ l2_token_address: "0x67ba235c569c23877064b2ac6ebd4d79f32d3c00f5fab8e28a3b5700b957f6",
728
+ sort_order: 1,
729
+ total_supply: null,
730
+ hidden: !0,
731
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/33dc517f-8a66-45eb-f2c5-de5388e47500/logo"
732
+ },
733
+ {
734
+ name: "Eternum Alchemical Silver",
735
+ symbol: "ALCHEMICALSILVER",
736
+ decimals: 18,
737
+ l2_token_address: "0x3956a5301e99522038a2e7dcb9c2a89bf087ffa79310ee0a508b5538efd8ddd",
738
+ sort_order: 1,
739
+ total_supply: null,
740
+ hidden: !0,
741
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/3d2e0fd8-4af8-49a0-4bdb-691a4d6ef800/logo"
742
+ },
743
+ {
744
+ name: "Eternum Cold Iron",
745
+ symbol: "COLDIRON",
746
+ decimals: 18,
747
+ l2_token_address: "0x555d713e59d4ff96b7960447e9bc9e79bfdeab5b0eea74e3df81bce61cfbc77",
748
+ sort_order: 1,
749
+ total_supply: null,
750
+ hidden: !0,
751
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/878c0d8a-8e2c-4281-0896-9cbbb2ef9400/logo"
752
+ },
753
+ {
754
+ name: "Eternum Deep Crystal",
755
+ symbol: "DEEPCRYSTAL",
756
+ decimals: 18,
757
+ l2_token_address: "0x1d655ac834d38df7921074fc1588411e202b1af83307cbd996983aff52db3a8",
758
+ sort_order: 1,
759
+ total_supply: null,
760
+ hidden: !0,
761
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/1c2c954f-448c-476b-a4a6-19b52efe3e00/logo"
762
+ },
763
+ {
764
+ name: "Eternum Ruby",
765
+ symbol: "RUBY",
766
+ decimals: 18,
767
+ l2_token_address: "0x3d9b66720959d0e7687b898292c10e62e78626f2dba5e1909961a2ce3f86612",
768
+ sort_order: 1,
769
+ total_supply: null,
770
+ hidden: !0,
771
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/6a45b34d-3bfe-4994-45b0-f2bee8abac00/logo"
772
+ },
773
+ {
774
+ name: "Eternum Diamonds",
775
+ symbol: "DIAMONDS",
776
+ decimals: 18,
777
+ l2_token_address: "0xe03ea8ae385f64754820af5c01c36abf1b8130dd6797d3fd9d430e4114e876",
778
+ sort_order: 1,
779
+ total_supply: null,
780
+ hidden: !0,
781
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/b1fa609d-8799-4754-cdea-ab69514ca700/logo"
782
+ },
783
+ {
784
+ name: "Eternum Hartwood",
785
+ symbol: "HARTWOOD",
786
+ decimals: 18,
787
+ l2_token_address: "0x5620aa7170cd66dbcbc37d03087bfe4633ffef91d3e4d97b501de906004f79b",
788
+ sort_order: 1,
789
+ total_supply: null,
790
+ hidden: !0,
791
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/27e37e85-91bd-4ee1-0552-1e0795077400/logo"
792
+ },
793
+ {
794
+ name: "Eternum Ignium",
795
+ symbol: "IGNIUM",
796
+ decimals: 18,
797
+ l2_token_address: "0x625c1f789b03ebebc7a9322366f38ebad1f693b84b2abd8cb8f5b2748b0cdd5",
798
+ sort_order: 1,
799
+ total_supply: null,
800
+ hidden: !0,
801
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/58591e20-24fb-4353-417a-81d877a5a200/logo"
802
+ },
803
+ {
804
+ name: "Eternum Twilight Quartz",
805
+ symbol: "TWILIGHTQUARTZ",
806
+ decimals: 18,
807
+ l2_token_address: "0x35e24c02409c3cfe8d5646399a62c4d102bb782938d5f5180e92c9c62d3faf7",
808
+ sort_order: 1,
809
+ total_supply: null,
810
+ hidden: !0,
811
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/2f8cb892-e82a-4af3-bd09-316061faec00/logo"
812
+ },
813
+ {
814
+ name: "Eternum True Ice",
815
+ symbol: "TRUEICE",
816
+ decimals: 18,
817
+ l2_token_address: "0x4485f5a6e16562e1c761cd348e63256d00389e3ddf4f5d98afe7ab44c57c481",
818
+ sort_order: 1,
819
+ total_supply: null,
820
+ hidden: !0,
821
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/fe4bfc17-6553-4dc5-58d2-f452b4aa8a00/logo"
822
+ },
823
+ {
824
+ name: "Eternum Adamantine",
825
+ symbol: "ADAMANTINE",
826
+ decimals: 18,
827
+ l2_token_address: "0x367f838f85a2f5e1580d6f011e4476f581083314cff8721ba3dda9706076eed",
828
+ sort_order: 1,
829
+ total_supply: null,
830
+ hidden: !0,
831
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/13bd026b-3612-480e-0119-04cf4c505a00/logo"
832
+ },
833
+ {
834
+ name: "Eternum Sapphire",
835
+ symbol: "SAPPHIRE",
836
+ decimals: 18,
837
+ l2_token_address: "0x2f8dd022568af8f9f718aa37707a9b858529db56910633a160456838b6cbcbc",
838
+ sort_order: 1,
839
+ total_supply: null,
840
+ hidden: !0,
841
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/0ebf555f-e732-4054-f8e5-55b2ed49ba00/logo"
842
+ },
843
+ {
844
+ name: "Eternum Ethereal Silica",
845
+ symbol: "ETHEREALSILICA",
846
+ decimals: 18,
847
+ l2_token_address: "0x68b6e23cbbd58a644700f55e96c83580921e9f521b6e5175396b53ba7910e7d",
848
+ sort_order: 1,
849
+ total_supply: null,
850
+ hidden: !0,
851
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/f02a5b43-bfcf-408c-7d1b-fcfe68b02d00/logo"
852
+ },
853
+ {
854
+ name: "Eternum Dragon Hide",
855
+ symbol: "DRAGONHIDE",
856
+ decimals: 18,
857
+ l2_token_address: "0x3bf856515bece3c93f5061b7941b8645f817a0acab93c758b8c7b4bc0afa3c6",
858
+ sort_order: 1,
859
+ total_supply: null,
860
+ hidden: !0,
861
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/e74955fc-5c8a-4dff-4882-a49a46a5a800/logo"
862
+ },
863
+ {
864
+ name: "Eternum Ancient Fragment",
865
+ symbol: "ANCIENTFRAGMENT",
866
+ decimals: 18,
867
+ l2_token_address: "0x0695b08ecdfdd828c2e6267da62f59e6d7543e690ef56a484df25c8566b332a5",
868
+ sort_order: 1,
869
+ total_supply: null,
870
+ hidden: !0,
871
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/9af855b7-4790-4390-9466-6bed4481ab00/logo"
872
+ },
873
+ {
874
+ name: "Eternum Donkey",
875
+ symbol: "DONKEY",
876
+ decimals: 18,
877
+ l2_token_address: "0x264be95a4a2ace20add68cb321acdccd2f9f8440ee1c7abd85da44ddab01085",
878
+ sort_order: 1,
879
+ total_supply: null,
880
+ hidden: !0,
881
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/20817378-a45e-4521-f464-10f6dd13c500/logo"
882
+ },
883
+ {
884
+ name: "Eternum Knight",
885
+ symbol: "KNIGHT",
886
+ decimals: 18,
887
+ l2_token_address: "0xac965f9e67164723c16735a9da8dbc9eb8e43b1bd0323591e87c056badf606",
888
+ sort_order: 1,
889
+ total_supply: null,
890
+ hidden: !0,
891
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/8787ed1f-af5c-4873-c01a-55f05e999a00/logo"
892
+ },
893
+ {
894
+ name: "Eternum Crossbowman",
895
+ symbol: "CROSSBOWMAN",
896
+ decimals: 18,
897
+ l2_token_address: "0x67e4ac00a241be06ba6afc11fa2715ec7da0c42c05a67ef6ecfcfeda725aaa8",
898
+ sort_order: 1,
899
+ total_supply: null,
900
+ hidden: !0,
901
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/dec7f31b-4b1d-46bb-4fca-c0253cf55a00/logo"
902
+ },
903
+ {
904
+ name: "Eternum Paladin",
905
+ symbol: "PALADIN",
906
+ decimals: 18,
907
+ l2_token_address: "0x3bc86299bee061c7c8d7546ccb62b9daf9bffc653b1508facb722c6593874bc",
908
+ sort_order: 1,
909
+ total_supply: null,
910
+ hidden: !0,
911
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/7d2cd5a5-f38a-49f6-11f8-ba3b59a59e00/logo"
912
+ },
913
+ {
914
+ name: "Eternum Wheat",
915
+ symbol: "WHEAT",
916
+ decimals: 18,
917
+ l2_token_address: "0x57a3f1ee475e072ce3be41785c0e889b7295d7a0dcc22b992c5b9408dbeb280",
918
+ sort_order: 1,
919
+ total_supply: null,
920
+ hidden: !0,
921
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/c338b6a8-77c4-4dd6-34f5-1af0d3fb1e00/logo"
922
+ },
923
+ {
924
+ name: "Eternum Fish",
925
+ symbol: "FISH",
926
+ decimals: 18,
927
+ l2_token_address: "0x27719173cfe10f1aa38d2aaed0a075b6077290f1e817aa3485d2b828394f4d9",
928
+ sort_order: 1,
929
+ total_supply: null,
930
+ hidden: !0,
931
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/6deef27f-df40-4248-4e1b-ed1d79a3f000/logo"
932
+ },
933
+ {
934
+ name: "Fools",
935
+ symbol: "FOOLS",
936
+ decimals: 18,
937
+ l2_token_address: "0x068a7a07e08fc3e723a878223d00f669106780d5ea6665eb15d893476d47bf3b",
938
+ sort_order: 1,
939
+ total_supply: null,
940
+ logo_url: "https://assets.underware.gg/pistols/fools.svg"
941
+ },
942
+ {
943
+ name: "Fame",
944
+ symbol: "FAME",
945
+ decimals: 18,
946
+ l2_token_address: "0x02549653a4ae1ff8d04a20b8820a49cbe97486c536ec0e4c8f68aa33d80067cf",
947
+ sort_order: 1,
948
+ total_supply: null,
949
+ logo_url: "https://assets.underware.gg/pistols/fame.svg"
950
+ },
951
+ {
952
+ name: "Survivor",
953
+ symbol: "SURVIVOR",
954
+ decimals: 18,
955
+ l2_token_address: "0x42dd777885ad2c116be96d4d634abc90a26a790ffb5871e037dd5ae7d2ec86b",
956
+ sort_order: 1,
957
+ total_supply: null,
958
+ logo_url: "https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/399cb277-f675-4efe-97fb-fac94a236a00/logo"
959
+ },
960
+ {
961
+ name: "Dungeon Ticket",
962
+ symbol: "TICKET",
963
+ decimals: 18,
964
+ l2_token_address: "0x035f581b050a39958b7188ab5c75daaa1f9d3571a0c032203038c898663f31f8",
965
+ sort_order: 1,
966
+ total_supply: null,
967
+ logo_url: " https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/f96b51e2-e978-42e2-c67a-e84159015000/logo"
968
+ }
969
+ ], z = {
970
+ theme: {
971
+ name: "Cartridge",
972
+ icon: "icon.svg"
973
+ }
974
+ }, g = "https://static.cartridge.gg/presets";
975
+ async function N() {
976
+ try {
977
+ const t = await fetch(`${g}/index.json`);
978
+ if (!t.ok)
979
+ throw new Error(`Failed to load configs index: ${t.statusText}`);
980
+ return await t.json();
981
+ } catch (t) {
982
+ return console.error("Error loading configs index:", t), { configs: [], baseUrl: g };
983
+ }
984
+ }
985
+ async function se() {
986
+ return (await N()).configs;
987
+ }
988
+ async function re(t) {
989
+ try {
990
+ const a = `${(await N()).baseUrl || g}/${t}`, r = await fetch(`${a}/config.json`);
991
+ if (!r.ok)
992
+ throw new Error(
993
+ `Failed to load config ${t}: ${r.statusText}`
994
+ );
995
+ const o = await r.json();
996
+ if (o && o.theme) {
997
+ o.theme.icon && !o.theme.icon.startsWith("http") && (o.theme.icon = `${a}/${o.theme.icon}`), o.theme.cover && (typeof o.theme.cover == "string" ? o.theme.cover.startsWith("http") || (o.theme.cover = `${a}/${o.theme.cover}`) : (o.theme.cover.light && !o.theme.cover.light.startsWith("http") && (o.theme.cover.light = `${a}/${o.theme.cover.light}`), o.theme.cover.dark && !o.theme.cover.dark.startsWith("http") && (o.theme.cover.dark = `${a}/${o.theme.cover.dark}`)));
998
+ const l = (d) => {
999
+ if (d) {
1000
+ for (const n in d)
1001
+ if (d[n])
1002
+ for (const i in d[n])
1003
+ d[n][i] && !d[n][i].startsWith("http") && (d[n][i] = `${a}/${d[n][i]}`);
1004
+ }
1005
+ };
1006
+ if (o.theme.optimizedIcon && l(o.theme.optimizedIcon), o.theme.optimizedCover)
1007
+ if (typeof o.theme.optimizedCover == "string")
1008
+ o.theme.optimizedCover.startsWith("http") || (o.theme.optimizedCover = `${a}/${o.theme.optimizedCover}`);
1009
+ else if (o.theme.optimizedCover.light || o.theme.optimizedCover.dark) {
1010
+ const d = o.theme.optimizedCover;
1011
+ d.light && l(d.light), d.dark && l(d.dark);
1012
+ } else
1013
+ l(o.theme.optimizedCover);
1014
+ }
1015
+ return o;
1016
+ } catch (e) {
1017
+ return console.error(`Error loading config ${t}:`, e), null;
1018
+ }
1019
+ }
1020
+ async function de() {
1021
+ const t = await N(), e = t.configs, s = t.baseUrl || g, a = {};
1022
+ return await Promise.all(
1023
+ e.map(async (r) => {
1024
+ try {
1025
+ const o = await fetch(`${s}/${r}/config.json`);
1026
+ if (o.ok) {
1027
+ const l = await o.json();
1028
+ a[r] = l;
1029
+ }
1030
+ } catch (o) {
1031
+ console.error(`Error loading config ${r}:`, o);
1032
+ }
1033
+ })
1034
+ ), a;
1035
+ }
1036
+ z.theme.icon = "https://static.cartridge.gg/presets/cartridge/icon.svg";
1037
+ var le = W, ne = z.theme;
1038
+ export {
1039
+ te as A,
1040
+ ae as B,
1041
+ D as E,
1042
+ O as F,
1043
+ m as H,
1044
+ V as I,
1045
+ ee as K,
1046
+ _ as N,
1047
+ Y as R,
1048
+ A as a,
1049
+ j as b,
1050
+ G as c,
1051
+ L as d,
1052
+ X as e,
1053
+ oe as f,
1054
+ F as g,
1055
+ P as h,
1056
+ K as i,
1057
+ M as j,
1058
+ w as k,
1059
+ C as l,
1060
+ ne as m,
1061
+ $ as n,
1062
+ le as o,
1063
+ J as p,
1064
+ se as q,
1065
+ N as r,
1066
+ q as s,
1067
+ b as t,
1068
+ de as u,
1069
+ E as v,
1070
+ re as w
1071
+ };
1072
+ //# sourceMappingURL=index-CYAUAqql.js.map