import { useState as r, useMemo as h, useCallback as w, useEffect as a } from "react";
import m from "./index.es38.js";
import "./index.es39.js";
import "./index.es40.js";
import "./index.es41.js";
import "./index.es42.js";
import "./index.es43.js";
import "./index.es44.js";
import "./index.es45.js";
import "./index.es46.js";
import "./index.es47.js";
import "./index.es48.js";
import "./index.es49.js";
import "./index.es50.js";
import "./index.es51.js";
import "./index.es52.js";
import "./index.es53.js";
import "./index.es54.js";
import "./index.es55.js";
import "./index.es56.js";
import "./index.es57.js";
import "./index.es58.js";
import "./index.es59.js";
import "./index.es60.js";
import "./index.es61.js";
import "./index.es62.js";
import "./index.es63.js";
import "./index.es64.js";
import "./index.es65.js";
import x from "./index.es74.js";
const Y = (s) => {
  const [o, y] = r(), [p, C] = r({}), [n, S] = r(), [c, l] = r(), i = h(() => x.coreCitationStyles, []), f = w((t) => {
    const e = m.findWhere(i, { name: t });
    y(t), S(e == null ? void 0 : e.title);
  }, [i]), u = h(() => ({ name: o, title: n, xml: c }), [o, n, c]);
  return a(() => {
    if (!o) {
      let t;
      s ? t = m.findWhere(i, { name: s }) : t = m.findWhere(i, { isDefault: !0 }), f(t == null ? void 0 : t.name);
    }
  }, [i, s]), a(() => {
    o && (m.has(p, o) ? l(p[o]) : fetch(`https://www.zotero.org/styles/${o}`).then((t) => t.text()).then((t) => {
      l(t), C((e) => ({
        ...e,
        [o]: t
      }));
    }));
  }, [o, p]), {
    onStyleChange: f,
    style: u,
    styles: i
  };
};
export {
  Y as default
};
//# sourceMappingURL=index.es11.js.map
