import { useState as m } from "react";
import { useIsomorphicLayoutEffect as c } from "./use-isomorphic-layout-effect.js";
import { getShikiHighlightedHtml as f } from "../utils/shiki/index.js";
const h = (o) => {
  const t = f(o), [n, e] = m(
    t instanceof Promise ? void 0 : t
  );
  return c(() => {
    if (!(t instanceof Promise)) {
      e(t);
      return;
    }
    let i = !1;
    async function s() {
      if (!(t instanceof Promise)) {
        e(t);
        return;
      }
      try {
        const r = await t;
        i || e(r);
      } catch (r) {
        console.error(r), i || e(void 0);
      }
    }
    return s(), () => {
      i = !0;
    };
  }, [o, t]), n;
};
export {
  h as useGetShikiHighlightedHtml
};
