import { s as __toESM } from "./chunk-BNovOVIE.js";
import { t as require_react } from "./react-Bs6Z0kvn.js";
import "./compiler-runtime-B_OLMU9S.js";
import { g as Logger } from "./button-DNlNlZY_.js";
import "./react-dom-BSUuJjCR.js";
import { t as require_jsx_runtime } from "./jsx-runtime-9hcJiI23.js";
import "./zod-C6UGQ3fz.js";
import { n as ErrorBanner } from "./error-banner-Cjf0RU9I.js";
import { t as esm_default, u as CopyClipboardIcon } from "./esm-4wmsH2lp.js";
import "./dist-CxZvoNao.js";
import "./dist-DbnBiLNH.js";
import "./dist-B43sbpd0.js";
import "./dist-Ci0CXEFt.js";
import "./dist-DJ9F1eHs.js";
import "./dist-DAfcmt-d.js";
import "./dist-CcMfr7jD.js";
import "./dist-VqF3W_ue.js";
import "./dist-ej6AQKaS.js";
import "./dist-DJKubHDd.js";
import "./dist-DLafRu9s.js";
import "./dist-CNF0QBLR.js";
import "./dist-DD_cYHOl.js";
import "./dist-BjDuO5JW.js";
import "./dist--6TSlp8H.js";
import { n as loadLanguage, t as langs } from "./esm-CD1iby2n.js";
var import_react = /* @__PURE__ */ __toESM(require_react(), 1), import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
const LANGUAGE_MAP = {
  python: "py",
  python3: "py",
  javascript: "js",
  typescript: "ts",
  shell: "sh",
  bash: "sh",
  unknown: "text",
  undefined: "text"
};
function isSupportedLanguage(e) {
  return e ? e in langs : false;
}
var any_language_editor_default = ({ language: e, hideUnsupportedLanguageErrors: d, showCopyButton: f, extensions: p = [], ...m }) => {
  e = LANGUAGE_MAP[e || ""] || e;
  let h = isSupportedLanguage(e);
  h || Logger.warn(`Language ${e} not found in CodeMirror.`);
  let g = (0, import_react.useMemo)(() => isSupportedLanguage(e) ? [loadLanguage(e), ...p].filter(Boolean) : p, [e, p]);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
    className: "relative w-full group hover-actions-parent",
    children: [
      !h && !d && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, {
        className: "mb-1 rounded-sm",
        error: `Language ${e} not supported. Supported languages are: ${Object.keys(langs).join(", ")}`
      }),
      f && h && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyClipboardIcon, {
        tooltip: false,
        buttonClassName: "absolute top-2 right-2 z-10 hover-action",
        className: "h-4 w-4 text-muted-foreground",
        value: m.value || "",
        toastTitle: "Copied to clipboard"
      }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(esm_default, {
        ...m,
        extensions: g
      })
    ]
  });
};
export {
  LANGUAGE_MAP,
  any_language_editor_default as default
};
