import { useState as r, useEffect as a } from "react";
async function c() {
  const t = await fetch("/editor/config");
  return t.status === 200 && t.headers.get("content-type")?.startsWith("application/json") ? await t.json() ?? {} : (console.warn("useConfig: ignoring invalid response"), {});
}
function u() {
  const [e, t] = r({
    credits: 0
  });
  return a(() => {
    async function n() {
      const s = await c();
      t((i) => ({
        ...i,
        ...s
      }));
    }
    const o = setInterval(n, 1e4);
    return n(), () => {
      clearInterval(o);
    };
  }, []), e;
}
export {
  u as useUserConfig
};
//# sourceMappingURL=use-user-config.js.map
