"use client";
import { useState as c, useEffect as p } from "react";
import { chainIconsSrcOverrides as l } from "./chainIconSrcOverrides.mjs";
import f from "../assets/images/BlockchainIconImg.svg2.mjs";
import { chainMap as m } from "../../node_modules/.pnpm/@hyperplay_chains@0.5.0_typescript@5.8.3_zod@3.25.76/node_modules/@hyperplay/chains/dist/index.es.mjs";
function a(n, r, i) {
  var e, s;
  let o;
  if (l[r])
    o = l[r];
  else if (n)
    o = f;
  else if (Object.hasOwn(m, r)) {
    const t = m[r];
    o = (s = (e = t == null ? void 0 : t.icon) == null ? void 0 : e[0]) != null && s.url ? t.icon[0].url.replace("ipfs://", i) : void 0;
  }
  return o === void 0 && (o = f), o;
}
const S = (n, r = "https://ipfs.io/ipfs/") => {
  const [i, o] = c(void 0), [e, s] = c(!1);
  return p(() => {
    const u = a(e, n, r);
    o(u);
  }, [n, r, e]), { iconUrl: i, handleImageError: () => {
    s(!0);
  } };
};
export {
  a as getChainIconSrc,
  S as useGetChainIconSrc
};
//# sourceMappingURL=useGetChainIconSrc.mjs.map
