"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const designSystem = require("@choiceform/design-system");
const react = require("../../../_vendor/@legendapp/state/react.cjs");
const messageStore = require("../../../stores/message-store.cjs");
const coreStore = require("../../../stores/core-store.cjs");
const timestampTv = designSystem.tcv({
  base: "text-secondary-foreground leading-5",
  variants: {
    showActions: {
      true: "opacity-100",
      false: "opacity-0"
    },
    hasAvatar: {
      true: {},
      false: {}
    },
    hasActions: {
      true: "place-self-end",
      false: "place-self-start"
    }
  },
  compoundVariants: [
    {
      hasAvatar: true,
      hasActions: false,
      class: "col-start-2"
    }
  ],
  defaultVariants: {
    showActions: false,
    hasActions: false
  }
});
const ResponseTimestamp = react.observer(function ResponseTimestamp2(props) {
  const { className, response, messageId, hasActions, hasAvatar, showActions } = props;
  const id = messageId ?? response?.message?.id;
  const message = react.use$(id ? messageStore.messageComputed$.getMessage(id) : void 0);
  const language = react.use$(coreStore.coreStore$.ui.language);
  if (!message || !message.createdAt) return null;
  const isStreaming = message.isStreaming === true;
  const languageMap = {
    us: "en",
    cn: "cn"
  };
  const tv = timestampTv({
    showActions: (showActions ?? false) && !isStreaming,
    hasActions,
    hasAvatar
  });
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: designSystem.tcx(tv, className), children: designSystem.formatRelativeTime(new Date(message.createdAt), {
    showSpecificTime: true,
    language: languageMap[language]
  }) });
});
exports.ResponseTimestamp = ResponseTimestamp;
//# sourceMappingURL=response-timestamp.cjs.map
