web3bio-profile-kit 0.2.5 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,35 +7,43 @@ const MATCH_IPFS_CID_RE = new RegExp(IPFS_CID_PATTERN);
7
7
  const MATCH_IPFS_CID_AT_STARTS_RE = new RegExp(`^https://(?:${IPFS_CID_PATTERN})`);
8
8
  const MATCH_IPFS_CID_AND_PATHNAME_RE = new RegExp(`(?:${IPFS_CID_PATTERN})(?:/.*)?`);
9
9
  const CORS_HOST_RE = new RegExp(`^(?:${CORS_HOST}|${CF_IPFS_HOST})\\??`);
10
+ const tryDecodeURIComponent = (value) => {
11
+ try {
12
+ return decodeURIComponent(value);
13
+ }
14
+ catch (_a) {
15
+ return value;
16
+ }
17
+ };
10
18
  const resolveIPFS_CID = (str) => { var _a; return (_a = str.match(MATCH_IPFS_CID_RE)) === null || _a === void 0 ? void 0 : _a[0]; };
11
19
  const isIPFS = (str) => MATCH_IPFS_CID_RE.test(str);
12
20
  function resolveIPFS_URL(cidOrURL) {
13
21
  if (!cidOrURL)
14
22
  return cidOrURL;
15
- // Normalize input by trimming and decoding
23
+ // Normalize input by trimming and decoding.
16
24
  const queryIndex = cidOrURL.indexOf("?");
17
- let normalizedURL = decodeURIComponent(queryIndex !== -1 ? cidOrURL.slice(0, queryIndex) : cidOrURL);
18
- // Handle CORS proxies first
25
+ let normalizedURL = tryDecodeURIComponent(queryIndex !== -1 ? cidOrURL.slice(0, queryIndex) : cidOrURL);
26
+ // Handle CORS proxies first.
19
27
  if (normalizedURL.startsWith(CORS_HOST) ||
20
28
  normalizedURL.startsWith(CF_IPFS_HOST)) {
21
29
  normalizedURL = normalizedURL.replace(CORS_HOST_RE, "");
22
- // Continue processing the URL without the proxy prefix
30
+ // Continue processing the URL without the proxy prefix.
23
31
  }
24
- // Handle ipfs.io URLs
25
- if (normalizedURL.startsWith("https://ipfs.io")) {
32
+ // Handle ipfs.io URLs.
33
+ if (normalizedURL.startsWith(IPFS_GATEWAY_HOST)) {
26
34
  const dataMatch = normalizedURL.match(MATCH_IPFS_DATA_RE);
27
35
  if (dataMatch === null || dataMatch === void 0 ? void 0 : dataMatch[1]) {
28
- return decodeURIComponent(dataMatch[1]);
36
+ return tryDecodeURIComponent(dataMatch[1]);
29
37
  }
30
38
  return normalizedURL;
31
39
  }
32
- // Handle ipfs protocol and CIDs
40
+ // Handle ipfs protocol and CIDs.
33
41
  if (normalizedURL.includes("ipfs:") || isIPFS(normalizedURL)) {
34
- // Convert ipfs:// protocol to CID format
42
+ // Convert ipfs:// protocol to CID format.
35
43
  if (normalizedURL.startsWith("ipfs://")) {
36
44
  normalizedURL = normalizedURL.slice(7);
37
45
  }
38
- // Handle URLs that start with a CID
46
+ // Handle URLs that start with a CID.
39
47
  if (MATCH_IPFS_CID_AT_STARTS_RE.test(normalizedURL)) {
40
48
  try {
41
49
  const url = new URL(normalizedURL);
@@ -49,7 +57,7 @@ function resolveIPFS_URL(cidOrURL) {
49
57
  console.debug("Failed to parse URL with CID", { normalizedURL, error });
50
58
  }
51
59
  }
52
- // Handle bare CIDs or CIDs with paths
60
+ // Handle bare CIDs or CIDs with paths.
53
61
  const pathMatch = normalizedURL.match(MATCH_IPFS_CID_AND_PATHNAME_RE);
54
62
  if (pathMatch === null || pathMatch === void 0 ? void 0 : pathMatch[0]) {
55
63
  return `${IPFS_GATEWAY_HOST}/ipfs/${pathMatch[0]}`;
@@ -371,6 +371,21 @@ const NETWORK_DATA = {
371
371
  short: "zora",
372
372
  },
373
373
  };
374
+ const NETWORK_VALUES = Object.values(NETWORK_DATA);
375
+ const NETWORK_BY_CHAIN_ID = new Map(NETWORK_VALUES
376
+ .filter((network) => typeof network.chainId === "number")
377
+ .map((network) => [network.chainId, network]));
378
+ const NETWORK_BY_SHORT = new Map(NETWORK_VALUES
379
+ .filter((network) => typeof network.short === "string" && network.short.length > 0)
380
+ .map((network) => [network.short, network]));
381
+ const toFallbackNetwork = (networkIdentifier) => ({
382
+ key: String(networkIdentifier),
383
+ icon: "",
384
+ label: String(networkIdentifier),
385
+ primaryColor: "#000000",
386
+ bgColor: "#efefef",
387
+ scanPrefix: "",
388
+ });
374
389
  /**
375
390
  * Gets network metadata for a given network identifier
376
391
  * Supports lookup by network key, network short name, or chainId
@@ -379,28 +394,15 @@ const NETWORK_DATA = {
379
394
  * @returns Network metadata object
380
395
  */
381
396
  const getNetwork = (networkIdentifier) => {
382
- const isNumberParam = !isNaN(Number(networkIdentifier));
397
+ const numericIdentifier = Number(networkIdentifier);
398
+ const isNumberParam = !Number.isNaN(numericIdentifier);
383
399
  if (isNumberParam) {
384
- const networkByChainId = Object.values(NETWORK_DATA).find((x) => x.chainId === Number(networkIdentifier));
385
- if (networkByChainId)
386
- return networkByChainId;
400
+ return NETWORK_BY_CHAIN_ID.get(numericIdentifier) || toFallbackNetwork(networkIdentifier);
387
401
  }
388
- else {
389
- if (NETWORK_DATA[networkIdentifier])
390
- return NETWORK_DATA[networkIdentifier];
391
- const networkByShort = Object.values(NETWORK_DATA).find((network) => network.short === networkIdentifier);
392
- if (networkByShort) {
393
- return networkByShort;
394
- }
395
- }
396
- return {
397
- key: String(networkIdentifier),
398
- icon: "",
399
- label: String(networkIdentifier),
400
- primaryColor: "#000000",
401
- bgColor: "#efefef",
402
- scanPrefix: "",
403
- };
402
+ const networkKey = networkIdentifier;
403
+ if (NETWORK_DATA[networkKey])
404
+ return NETWORK_DATA[networkKey];
405
+ return NETWORK_BY_SHORT.get(String(networkIdentifier)) || toFallbackNetwork(networkIdentifier);
404
406
  };
405
407
 
406
408
  exports.NETWORK_DATA = NETWORK_DATA;
@@ -369,6 +369,21 @@ const NETWORK_DATA = {
369
369
  short: "zora",
370
370
  },
371
371
  };
372
+ const NETWORK_VALUES = Object.values(NETWORK_DATA);
373
+ const NETWORK_BY_CHAIN_ID = new Map(NETWORK_VALUES
374
+ .filter((network) => typeof network.chainId === "number")
375
+ .map((network) => [network.chainId, network]));
376
+ const NETWORK_BY_SHORT = new Map(NETWORK_VALUES
377
+ .filter((network) => typeof network.short === "string" && network.short.length > 0)
378
+ .map((network) => [network.short, network]));
379
+ const toFallbackNetwork = (networkIdentifier) => ({
380
+ key: String(networkIdentifier),
381
+ icon: "",
382
+ label: String(networkIdentifier),
383
+ primaryColor: "#000000",
384
+ bgColor: "#efefef",
385
+ scanPrefix: "",
386
+ });
372
387
  /**
373
388
  * Gets network metadata for a given network identifier
374
389
  * Supports lookup by network key, network short name, or chainId
@@ -377,28 +392,15 @@ const NETWORK_DATA = {
377
392
  * @returns Network metadata object
378
393
  */
379
394
  const getNetwork = (networkIdentifier) => {
380
- const isNumberParam = !isNaN(Number(networkIdentifier));
395
+ const numericIdentifier = Number(networkIdentifier);
396
+ const isNumberParam = !Number.isNaN(numericIdentifier);
381
397
  if (isNumberParam) {
382
- const networkByChainId = Object.values(NETWORK_DATA).find((x) => x.chainId === Number(networkIdentifier));
383
- if (networkByChainId)
384
- return networkByChainId;
398
+ return NETWORK_BY_CHAIN_ID.get(numericIdentifier) || toFallbackNetwork(networkIdentifier);
385
399
  }
386
- else {
387
- if (NETWORK_DATA[networkIdentifier])
388
- return NETWORK_DATA[networkIdentifier];
389
- const networkByShort = Object.values(NETWORK_DATA).find((network) => network.short === networkIdentifier);
390
- if (networkByShort) {
391
- return networkByShort;
392
- }
393
- }
394
- return {
395
- key: String(networkIdentifier),
396
- icon: "",
397
- label: String(networkIdentifier),
398
- primaryColor: "#000000",
399
- bgColor: "#efefef",
400
- scanPrefix: "",
401
- };
400
+ const networkKey = networkIdentifier;
401
+ if (NETWORK_DATA[networkKey])
402
+ return NETWORK_DATA[networkKey];
403
+ return NETWORK_BY_SHORT.get(String(networkIdentifier)) || toFallbackNetwork(networkIdentifier);
402
404
  };
403
405
 
404
406
  export { NETWORK_DATA, getNetwork };
@@ -38,9 +38,7 @@ const WEB2_PLATFORM_SET = new Set(WEB2_PLATFORMS);
38
38
  * @public
39
39
  */
40
40
  const isWeb2Platform = (platform) => {
41
- if (!Boolean(platform))
42
- return false;
43
- return WEB2_PLATFORM_SET.has(platform);
41
+ return !!platform && WEB2_PLATFORM_SET.has(platform);
44
42
  };
45
43
  /**
46
44
  * Default data
@@ -61,26 +59,6 @@ const DEFAULT_PLATFORM = {
61
59
  * @public
62
60
  */
63
61
  const PLATFORM_DATA = new Map([
64
- [
65
- platform.Platform.ailayer,
66
- {
67
- color: "#A283FF",
68
- icon: "icons/icon-ailayer.svg",
69
- label: "AILayer Name Service",
70
- urlPrefix: "https://mainnet-explorer.ailayer.xyz/address/",
71
- registerlink: "https://space.id/tld/19/domains?query={name}",
72
- },
73
- ],
74
- [
75
- platform.Platform.alienx,
76
- {
77
- color: "#D5F462",
78
- icon: "icons/icon-alienx.svg",
79
- label: "AlienX Name Service",
80
- urlPrefix: "https://explorer.alienxchain.io/address/",
81
- registerlink: "https://space.id/tld/17/domains?query={name}",
82
- },
83
- ],
84
62
  [
85
63
  platform.Platform.aptos,
86
64
  {
@@ -212,24 +190,6 @@ const PLATFORM_DATA = new Map([
212
190
  urlPrefix: "https://www.coingecko.com/en/coins/",
213
191
  },
214
192
  ],
215
- [
216
- platform.Platform.cosmos,
217
- {
218
- color: "#000000",
219
- icon: "icons/icon-cosmos.svg",
220
- label: "Cosmos",
221
- urlPrefix: "https://www.mintscan.io/cosmos/account/",
222
- },
223
- ],
224
- [
225
- platform.Platform.cyberconnect,
226
- {
227
- color: "#000000",
228
- icon: "icons/icon-cyberconnect.svg",
229
- label: "CyberConnect",
230
- urlPrefix: "https://link3.to/",
231
- },
232
- ],
233
193
  [
234
194
  platform.Platform.deepdao,
235
195
  {
@@ -302,15 +262,6 @@ const PLATFORM_DATA = new Map([
302
262
  registerlink: "https://www.ethcomments.xyz/",
303
263
  },
304
264
  ],
305
- [
306
- platform.Platform.edgeless,
307
- {
308
- color: "#a0eb67",
309
- icon: "icons/icon-edgeless.svg",
310
- label: "Edgeless",
311
- urlPrefix: "https://explorer.edgeless.network/address/",
312
- },
313
- ],
314
265
  [
315
266
  platform.Platform.efp,
316
267
  {
@@ -516,16 +467,6 @@ const PLATFORM_DATA = new Map([
516
467
  registerlink: "https://www.lens.xyz/mint?name={name}",
517
468
  },
518
469
  ],
519
- [
520
- platform.Platform.lightlink,
521
- {
522
- color: "#00BFFF",
523
- icon: "icons/icon-lightlink.svg",
524
- label: "LightLink Name Service",
525
- urlPrefix: "https://phoenix.lightlink.io/address/",
526
- registerlink: "https://space.id/tld/9/domains?query={name}",
527
- },
528
- ],
529
470
  [
530
471
  platform.Platform.linea,
531
472
  {
@@ -557,16 +498,6 @@ const PLATFORM_DATA = new Map([
557
498
  urlPrefix: "https://lobste.rs/~",
558
499
  },
559
500
  ],
560
- [
561
- platform.Platform.manta,
562
- {
563
- color: "#0091ff",
564
- icon: "icons/icon-manta.svg",
565
- label: "Manta Name Service",
566
- urlPrefix: "https://pacific-explorer.manta.network/address/",
567
- registerlink: "https://space.id/tld/3/domains?query={name}",
568
- },
569
- ],
570
501
  [
571
502
  platform.Platform.matters,
572
503
  {
@@ -585,16 +516,6 @@ const PLATFORM_DATA = new Map([
585
516
  urlPrefix: "https://medium.com/",
586
517
  },
587
518
  ],
588
- [
589
- platform.Platform.merlin,
590
- {
591
- color: "#5A32A3",
592
- icon: "icons/icon-merlin.svg",
593
- label: "Merlin Name Service",
594
- urlPrefix: "https://scan.merlinchain.io/address/",
595
- registerlink: "https://space.id/tld/12/domains?query={name}",
596
- },
597
- ],
598
519
  [
599
520
  platform.Platform.minds,
600
521
  {
@@ -604,26 +525,6 @@ const PLATFORM_DATA = new Map([
604
525
  urlPrefix: "https://www.minds.com/",
605
526
  },
606
527
  ],
607
- [
608
- platform.Platform.mint,
609
- {
610
- color: "#00A57C",
611
- icon: "icons/icon-mint.svg",
612
- label: "Mint Name Service",
613
- urlPrefix: "https://explorer.mintchain.io/address/",
614
- registerlink: "https://space.id/tld/18/domains?query={name}",
615
- },
616
- ],
617
- [
618
- platform.Platform.mode,
619
- {
620
- color: "#E5FD52",
621
- icon: "icons/icon-mode.svg",
622
- label: "Mode Name Service",
623
- urlPrefix: "https://explorer.mode.network/address/",
624
- registerlink: "https://space.id/tld/6/domains?query={name}",
625
- },
626
- ],
627
528
  [
628
529
  platform.Platform.mstdnjp,
629
530
  {
@@ -829,16 +730,6 @@ const PLATFORM_DATA = new Map([
829
730
  urlPrefix: "https://substack.com/@",
830
731
  },
831
732
  ],
832
- [
833
- platform.Platform.taiko,
834
- {
835
- color: "#E81899",
836
- icon: "icons/icon-taiko.svg",
837
- label: "DotTaiko Name Service",
838
- urlPrefix: "https://taikoscan.io/address/",
839
- registerlink: "https://space.id/tld/16/domains?query={name}",
840
- },
841
- ],
842
733
  [
843
734
  platform.Platform.talent,
844
735
  {
@@ -885,15 +776,6 @@ const PLATFORM_DATA = new Map([
885
776
  urlPrefix: "https://www.tiktok.com/@",
886
777
  },
887
778
  ],
888
- [
889
- platform.Platform.tomo,
890
- {
891
- color: "#DE3A7E",
892
- icon: "icons/icon-tomo.svg",
893
- label: "Tomo Name Service",
894
- registerlink: "https://space.id/tld/10/domains?query={name}",
895
- },
896
- ],
897
779
  [
898
780
  platform.Platform.ton,
899
781
  {
@@ -1024,26 +906,6 @@ const PLATFORM_DATA = new Map([
1024
906
  ensText: ["com.youtube", "youtube"],
1025
907
  },
1026
908
  ],
1027
- [
1028
- platform.Platform.zeta,
1029
- {
1030
- color: "#005741",
1031
- icon: "icons/icon-zeta.svg",
1032
- label: "Zeta Name Service",
1033
- urlPrefix: "https://explorer.zetachain.com/address/",
1034
- registerlink: "https://space.id/tld/11/domains?query={name}",
1035
- },
1036
- ],
1037
- [
1038
- platform.Platform.zkfair,
1039
- {
1040
- color: "#D43F36",
1041
- icon: "icons/icon-zkfair.svg",
1042
- label: "zkFair",
1043
- urlPrefix: "https://scan.zkfair.io/address/",
1044
- registerlink: "https://space.id/tld/8/domains?query={name}",
1045
- },
1046
- ],
1047
909
  [
1048
910
  platform.Platform.zkme,
1049
911
  {
@@ -1067,7 +929,8 @@ const PLATFORM_DATA = new Map([
1067
929
  * @public
1068
930
  */
1069
931
  const getPlatform = (platform) => {
1070
- return (PLATFORM_DATA.get(platform) || { ...DEFAULT_PLATFORM, label: platform });
932
+ var _a;
933
+ return (_a = PLATFORM_DATA.get(platform)) !== null && _a !== void 0 ? _a : { ...DEFAULT_PLATFORM, label: platform };
1071
934
  };
1072
935
 
1073
936
  exports.DEFAULT_PLATFORM = DEFAULT_PLATFORM;
@@ -36,9 +36,7 @@ const WEB2_PLATFORM_SET = new Set(WEB2_PLATFORMS);
36
36
  * @public
37
37
  */
38
38
  const isWeb2Platform = (platform) => {
39
- if (!Boolean(platform))
40
- return false;
41
- return WEB2_PLATFORM_SET.has(platform);
39
+ return !!platform && WEB2_PLATFORM_SET.has(platform);
42
40
  };
43
41
  /**
44
42
  * Default data
@@ -59,26 +57,6 @@ const DEFAULT_PLATFORM = {
59
57
  * @public
60
58
  */
61
59
  const PLATFORM_DATA = new Map([
62
- [
63
- Platform.ailayer,
64
- {
65
- color: "#A283FF",
66
- icon: "icons/icon-ailayer.svg",
67
- label: "AILayer Name Service",
68
- urlPrefix: "https://mainnet-explorer.ailayer.xyz/address/",
69
- registerlink: "https://space.id/tld/19/domains?query={name}",
70
- },
71
- ],
72
- [
73
- Platform.alienx,
74
- {
75
- color: "#D5F462",
76
- icon: "icons/icon-alienx.svg",
77
- label: "AlienX Name Service",
78
- urlPrefix: "https://explorer.alienxchain.io/address/",
79
- registerlink: "https://space.id/tld/17/domains?query={name}",
80
- },
81
- ],
82
60
  [
83
61
  Platform.aptos,
84
62
  {
@@ -210,24 +188,6 @@ const PLATFORM_DATA = new Map([
210
188
  urlPrefix: "https://www.coingecko.com/en/coins/",
211
189
  },
212
190
  ],
213
- [
214
- Platform.cosmos,
215
- {
216
- color: "#000000",
217
- icon: "icons/icon-cosmos.svg",
218
- label: "Cosmos",
219
- urlPrefix: "https://www.mintscan.io/cosmos/account/",
220
- },
221
- ],
222
- [
223
- Platform.cyberconnect,
224
- {
225
- color: "#000000",
226
- icon: "icons/icon-cyberconnect.svg",
227
- label: "CyberConnect",
228
- urlPrefix: "https://link3.to/",
229
- },
230
- ],
231
191
  [
232
192
  Platform.deepdao,
233
193
  {
@@ -300,15 +260,6 @@ const PLATFORM_DATA = new Map([
300
260
  registerlink: "https://www.ethcomments.xyz/",
301
261
  },
302
262
  ],
303
- [
304
- Platform.edgeless,
305
- {
306
- color: "#a0eb67",
307
- icon: "icons/icon-edgeless.svg",
308
- label: "Edgeless",
309
- urlPrefix: "https://explorer.edgeless.network/address/",
310
- },
311
- ],
312
263
  [
313
264
  Platform.efp,
314
265
  {
@@ -514,16 +465,6 @@ const PLATFORM_DATA = new Map([
514
465
  registerlink: "https://www.lens.xyz/mint?name={name}",
515
466
  },
516
467
  ],
517
- [
518
- Platform.lightlink,
519
- {
520
- color: "#00BFFF",
521
- icon: "icons/icon-lightlink.svg",
522
- label: "LightLink Name Service",
523
- urlPrefix: "https://phoenix.lightlink.io/address/",
524
- registerlink: "https://space.id/tld/9/domains?query={name}",
525
- },
526
- ],
527
468
  [
528
469
  Platform.linea,
529
470
  {
@@ -555,16 +496,6 @@ const PLATFORM_DATA = new Map([
555
496
  urlPrefix: "https://lobste.rs/~",
556
497
  },
557
498
  ],
558
- [
559
- Platform.manta,
560
- {
561
- color: "#0091ff",
562
- icon: "icons/icon-manta.svg",
563
- label: "Manta Name Service",
564
- urlPrefix: "https://pacific-explorer.manta.network/address/",
565
- registerlink: "https://space.id/tld/3/domains?query={name}",
566
- },
567
- ],
568
499
  [
569
500
  Platform.matters,
570
501
  {
@@ -583,16 +514,6 @@ const PLATFORM_DATA = new Map([
583
514
  urlPrefix: "https://medium.com/",
584
515
  },
585
516
  ],
586
- [
587
- Platform.merlin,
588
- {
589
- color: "#5A32A3",
590
- icon: "icons/icon-merlin.svg",
591
- label: "Merlin Name Service",
592
- urlPrefix: "https://scan.merlinchain.io/address/",
593
- registerlink: "https://space.id/tld/12/domains?query={name}",
594
- },
595
- ],
596
517
  [
597
518
  Platform.minds,
598
519
  {
@@ -602,26 +523,6 @@ const PLATFORM_DATA = new Map([
602
523
  urlPrefix: "https://www.minds.com/",
603
524
  },
604
525
  ],
605
- [
606
- Platform.mint,
607
- {
608
- color: "#00A57C",
609
- icon: "icons/icon-mint.svg",
610
- label: "Mint Name Service",
611
- urlPrefix: "https://explorer.mintchain.io/address/",
612
- registerlink: "https://space.id/tld/18/domains?query={name}",
613
- },
614
- ],
615
- [
616
- Platform.mode,
617
- {
618
- color: "#E5FD52",
619
- icon: "icons/icon-mode.svg",
620
- label: "Mode Name Service",
621
- urlPrefix: "https://explorer.mode.network/address/",
622
- registerlink: "https://space.id/tld/6/domains?query={name}",
623
- },
624
- ],
625
526
  [
626
527
  Platform.mstdnjp,
627
528
  {
@@ -827,16 +728,6 @@ const PLATFORM_DATA = new Map([
827
728
  urlPrefix: "https://substack.com/@",
828
729
  },
829
730
  ],
830
- [
831
- Platform.taiko,
832
- {
833
- color: "#E81899",
834
- icon: "icons/icon-taiko.svg",
835
- label: "DotTaiko Name Service",
836
- urlPrefix: "https://taikoscan.io/address/",
837
- registerlink: "https://space.id/tld/16/domains?query={name}",
838
- },
839
- ],
840
731
  [
841
732
  Platform.talent,
842
733
  {
@@ -883,15 +774,6 @@ const PLATFORM_DATA = new Map([
883
774
  urlPrefix: "https://www.tiktok.com/@",
884
775
  },
885
776
  ],
886
- [
887
- Platform.tomo,
888
- {
889
- color: "#DE3A7E",
890
- icon: "icons/icon-tomo.svg",
891
- label: "Tomo Name Service",
892
- registerlink: "https://space.id/tld/10/domains?query={name}",
893
- },
894
- ],
895
777
  [
896
778
  Platform.ton,
897
779
  {
@@ -1022,26 +904,6 @@ const PLATFORM_DATA = new Map([
1022
904
  ensText: ["com.youtube", "youtube"],
1023
905
  },
1024
906
  ],
1025
- [
1026
- Platform.zeta,
1027
- {
1028
- color: "#005741",
1029
- icon: "icons/icon-zeta.svg",
1030
- label: "Zeta Name Service",
1031
- urlPrefix: "https://explorer.zetachain.com/address/",
1032
- registerlink: "https://space.id/tld/11/domains?query={name}",
1033
- },
1034
- ],
1035
- [
1036
- Platform.zkfair,
1037
- {
1038
- color: "#D43F36",
1039
- icon: "icons/icon-zkfair.svg",
1040
- label: "zkFair",
1041
- urlPrefix: "https://scan.zkfair.io/address/",
1042
- registerlink: "https://space.id/tld/8/domains?query={name}",
1043
- },
1044
- ],
1045
907
  [
1046
908
  Platform.zkme,
1047
909
  {
@@ -1065,7 +927,8 @@ const PLATFORM_DATA = new Map([
1065
927
  * @public
1066
928
  */
1067
929
  const getPlatform = (platform) => {
1068
- return (PLATFORM_DATA.get(platform) || { ...DEFAULT_PLATFORM, label: platform });
930
+ var _a;
931
+ return (_a = PLATFORM_DATA.get(platform)) !== null && _a !== void 0 ? _a : { ...DEFAULT_PLATFORM, label: platform };
1069
932
  };
1070
933
 
1071
934
  export { DEFAULT_PLATFORM, PLATFORM_DATA, WEB2_PLATFORMS, getPlatform, isWeb2Platform };
@@ -2,11 +2,12 @@
2
2
 
3
3
  var ipfs = require('./ipfs.cjs');
4
4
 
5
+ const DIRECT_MEDIA_PREFIXES = ["data:", "https:"];
5
6
  const resolveMediaURL = (url) => {
6
7
  if (!url)
7
8
  return "";
8
- // Fast path for common protocols
9
- if (url.startsWith("data:") || url.startsWith("https:")) {
9
+ // Fast path for common protocols.
10
+ if (DIRECT_MEDIA_PREFIXES.some((prefix) => url.startsWith(prefix))) {
10
11
  return url;
11
12
  }
12
13
  // Handle Arweave
@@ -1,10 +1,11 @@
1
1
  import { isIPFS, resolveIPFS_URL } from './ipfs.js';
2
2
 
3
+ const DIRECT_MEDIA_PREFIXES = ["data:", "https:"];
3
4
  const resolveMediaURL = (url) => {
4
5
  if (!url)
5
6
  return "";
6
- // Fast path for common protocols
7
- if (url.startsWith("data:") || url.startsWith("https:")) {
7
+ // Fast path for common protocols.
8
+ if (DIRECT_MEDIA_PREFIXES.some((prefix) => url.startsWith(prefix))) {
8
9
  return url;
9
10
  }
10
11
  // Handle Arweave