"use strict";
var import_Badge = require("../Badge.css");
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const kit_internal_functions = require("./internal/functions.cjs");
const kit_Theme_UI = require("./Theme/UI.cjs");
require("./Theme/themeUtils.cjs");
require("./Theme/themes.cjs");
const base = "Badge_base_6715f";
const dashed = "Badge_dashed_6715f";
const css = {
  base,
  dashed
};
const fontColorLight = "#FFFFFF";
const fontColorDark = "#000810";
const Badge = ({
  text,
  dashed: dashed2 = false,
  backgroundColor,
  ...props
}) => {
  const {
    themeSettings: { themeIsDark, className: themeClass },
    getThemeVar
  } = kit_Theme_UI.useTheme();
  const bgColor = backgroundColor ? backgroundColor : kit_internal_functions.str2hsl(getThemeVar("surface"));
  const { classes, style } = React.useMemo(() => {
    const classes2 = [css.base, themeClass];
    const style2 = {
      backgroundColor: kit_internal_functions.hsl2str(bgColor),
      border: bgColor.l < 15 ? "1px solid #646464" : "",
      color: bgColor.l > 70 ? fontColorDark : fontColorLight
    };
    if (dashed2)
      classes2.push(css.dashed);
    const isDark = themeIsDark;
    style2.backgroundColor = kit_internal_functions.hsl2str({
      ...bgColor,
      s: bgColor.s > 0 ? isDark ? 70 : 50 : 0
    });
    return { classes: classes2, style: style2 };
  }, [dashed2, bgColor, themeClass, themeIsDark]);
  return (
    // Need this wrapper for tooltip to apply
    /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classes.join(" "), style, children: text }) })
  );
};
module.exports = Badge;
