{"version":3,"file":"AIUserMessage.mjs","names":[],"sources":["../../../../../src/plugins/AIComponents/Message/AIUserMessage.tsx"],"sourcesContent":["import React from 'react';\nimport clsx from 'clsx';\n\nimport { useTranslationContext } from '../../../context/TranslationContext';\nimport { useComponentContextIcons } from '../../../context/useComponentContextIcons';\nimport { AIMessageAttachment, type AIMessageAttachmentData } from './AIMessageAttachment';\nimport { ThemeScopeProvider, useAIThemeScopeClassName } from '../themeScope';\n\nexport type AIUserMessageProps = {\n  /** What the person wrote. */\n  text: string;\n  /** What they sent with it, such as images and files. */\n  attachments?: AIMessageAttachmentData[];\n  className?: string;\n  /** Edits the message, such as by putting its text back in the composer. Without it, no edit button. */\n  onEdit?: () => void;\n};\n\n/**\n * The person's message: its attachments, then its text in a bubble on the trailing side. The\n * counterpart of `AIUserMessageView`.\n */\nexport const AIUserMessage = ({\n  attachments = [],\n  className,\n  onEdit,\n  text,\n}: AIUserMessageProps) => {\n  const themeScopeClassName = useAIThemeScopeClassName();\n  const { t } = useTranslationContext();\n  const { IconEdit } = useComponentContextIcons();\n  return (\n    <ThemeScopeProvider>\n      <div className={clsx(themeScopeClassName, 'str-chat__ai-user-message', className)}>\n        {attachments.length > 0 && (\n          <div className='str-chat__ai-user-message__attachments'>\n            {attachments.map((attachment, index) => (\n              <AIMessageAttachment attachment={attachment} key={index} role='user' />\n            ))}\n          </div>\n        )}\n        {text !== '' && (\n          <div className='str-chat__ai-user-message__row'>\n            {onEdit && (\n              <button\n                aria-label={t('aiComponents.userMessage.edit.ariaLabel', 'Edit')}\n                className='str-chat__ai-reply-actions__button str-chat__ai-user-message__edit'\n                onClick={onEdit}\n                title={t('aiComponents.userMessage.edit.ariaLabel', 'Edit')}\n                type='button'\n              >\n                <IconEdit />\n              </button>\n            )}\n            <div className='str-chat__ai-user-message__bubble'>{text}</div>\n          </div>\n        )}\n      </div>\n    </ThemeScopeProvider>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAa,iBAAiB,EAC5B,cAAc,CAAC,GACf,WACA,QACA,WACwB;CACxB,MAAM,sBAAsB,yBAAyB;CACrD,MAAM,EAAE,MAAM,sBAAsB;CACpC,MAAM,EAAE,aAAa,yBAAyB;CAC9C,OACE,oBAAC,oBAAD,EAAA,UACE,qBAAC,OAAD;EAAK,WAAW,KAAK,qBAAqB,6BAA6B,SAAS;YAAhF,CACG,YAAY,SAAS,KACpB,oBAAC,OAAD;GAAK,WAAU;aACZ,YAAY,KAAK,YAAY,UAC5B,oBAAC,qBAAD;IAAiC;IAAwB,MAAK;GAAQ,GAApB,KAAoB,CACvE;EACE,CAAA,GAEN,SAAS,MACR,qBAAC,OAAD;GAAK,WAAU;aAAf,CACG,UACC,oBAAC,UAAD;IACE,cAAY,EAAE,2CAA2C,MAAM;IAC/D,WAAU;IACV,SAAS;IACT,OAAO,EAAE,2CAA2C,MAAM;IAC1D,MAAK;cAEL,oBAAC,UAAD,CAAW,CAAA;GACL,CAAA,GAEV,oBAAC,OAAD;IAAK,WAAU;cAAqC;GAAU,CAAA,CAC3D;IAEJ;IACa,CAAA;AAExB"}