"use client";
import { jsx as m } from "react/jsx-runtime";
import b, { useEffect as i, useContext as d, useState as g } from "react";
const c = b.createContext(null), k = ({
  children: t,
  config: e
}) => (i(() => {
  e?.theme && x(e.theme);
}, [e]), /* @__PURE__ */ m(c.Provider, { value: e, children: t }));
function h(t) {
  return /^#?([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(t);
}
function C(t) {
  return /^rgb\(\s*(\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(t);
}
function $(t) {
  if (h(t)) {
    let e = t.replace(/^#/, "");
    e.length === 3 && (e = e.split("").map((s) => s + s).join(""));
    const r = Number.parseInt(e.slice(0, 2), 16), n = Number.parseInt(e.slice(2, 4), 16), o = Number.parseInt(e.slice(4, 6), 16);
    return `${r} ${n} ${o}`;
  }
  if (C(t))
    return t.replace(/rgb|\(|\)/g, "").split(",").map((e) => e.trim()).join(" ");
  throw new Error("Invalid color code. Supports hex and rgb formats.");
}
function u(t, e) {
  if (typeof document > "u")
    return;
  (document.getElementById("bn-swap-wrap") ?? document.documentElement).style.setProperty(t, e);
}
function x(t) {
  const {
    colors: e,
    fonts: r
  } = t;
  if (e && f(e), r)
    for (const [n, o] of Object.entries(r))
      o && u(`--bn-font-${n}`, o);
}
function f(t, e = []) {
  for (const [r, n] of Object.entries(t)) {
    const o = [...e, r];
    if (typeof n == "object" && n !== null)
      f(n, o);
    else if (typeof n == "string")
      try {
        const l = `--bn-${o.map(y).join("-")}`, p = $(n);
        u(l, p);
      } catch {
        console.warn(`Skipping invalid color value for ${r}: ${n}`);
      }
  }
}
function y(t) {
  return t.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9])/g, "$1-$2").toLowerCase();
}
const a = {
  baseUrl: "https://backend.bungee.exchange",
  theme: {
    colors: {
      success: "#8AE8B6"
      // @fixme: will this be a problem?
    }
  },
  enableMultiOutput: !0,
  multiOutputCap: 2,
  features: {
    internalToasts: !0,
    internalTxHistory: !0
  },
  // temporary
  manualBaseUrl: "https://api.socket.tech/v2",
  manualApiKey: "1b2fd225-062f-41aa-8c63-d1fef19945e7"
}, w = () => {
  const t = d(c), [e, r] = g(a);
  return i(() => {
    const n = {
      ...a,
      ...t
    };
    r(n);
  }, [t]), e;
};
export {
  k as C,
  c as W,
  w as u
};
//# sourceMappingURL=useConfig-BBfpOnV-.js.map
