"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require$$0 = require("react/jsx-runtime");
const iconsReact = require("@choiceform/icons-react");
const react = require("../../../_vendor/@legendapp/state/react.cjs");
const designSystem = require("@choiceform/design-system");
const messageStore = require("../../../stores/message-store.cjs");
const errorTv = designSystem.tcv({
  slots: {
    root: "text-danger-foreground",
    icon: "mr-1 inline-block align-top"
  },
  variants: {
    hasAvatar: {
      true: {
        root: "col-start-2"
      },
      false: {
        root: ""
      }
    },
    hasActions: {
      true: "",
      false: ""
    },
    hasTimestamp: {
      true: "",
      false: ""
    }
  },
  compoundVariants: [
    {
      hasActions: true,
      hasTimestamp: true,
      class: {
        root: "col-span-2"
      }
    }
  ]
});
const ResponseError = react.observer(function ResponseError2({
  response,
  messageId,
  hasActions,
  hasAvatar,
  hasTimestamp
}) {
  const id = messageId ?? response?.message?.id;
  const message = react.use$(id ? messageStore.messageComputed$.getMessage(id) : void 0);
  if (!message) return null;
  if (!message.error) return null;
  const tv = errorTv({
    hasAvatar: hasAvatar ?? false,
    hasActions: hasActions ?? false,
    hasTimestamp: hasTimestamp ?? false
  });
  return /* @__PURE__ */ require$$0.jsxs("div", { className: tv.root(), children: [
    /* @__PURE__ */ require$$0.jsx(iconsReact.WarningTriangleSmall, { className: tv.icon() }),
    message.error.message
  ] });
});
exports.ResponseError = ResponseError;
//# sourceMappingURL=response-error.cjs.map
