import { s as __toESM } from "./chunk-BNovOVIE.js";
import { _ as Logger } from "./button-C5K9fIPF.js";
import { t as require_react } from "./react-DA-nE2FX.js";
import "./compiler-runtime-CEbnTgxf.js";
import "./react-dom-BTJzcVJ9.js";
import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
import "./zod-aLSua2NL.js";
import { n as ErrorBanner } from "./error-banner-CJXYJ6Sb.js";
import { f as CopyClipboardIcon } from "./extends-D_hDsj6R.js";
import "./dist-U4F-tbMs.js";
import "./dist-Dv_Y15yk.js";
import "./dist-BSAt6RhH.js";
import "./dist-D-W5ny5a.js";
import "./dist-M9Vag9Y0.js";
import "./dist-C_Y3oV3C.js";
import { t as esm_default } from "./esm-BaH2eg5-.js";
import "./dist-CIYBwstr.js";
import "./dist-abid3KgM.js";
import "./dist-A2846XWO.js";
import "./dist-DZORgqKY.js";
import "./dist-BY018Paw.js";
import "./dist-Dax--nl9.js";
import "./dist-DyyjKEYf.js";
import "./dist-DZo4nSS0.js";
import "./dist-BzEzfugY.js";
import { n as loadLanguage, t as langs } from "./esm-ga2Bf3O2.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
};
