{"version":3,"file":"text-fill.cjs","sources":["../../../../packages/components-wc/src/subject/text-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SUB_TEXT_EDITOR_TOOLBAR } from '../editor/toolbar'\nimport { buildSubjectPreviewTitle, buildSubjectSortingTitle, emitSubjectEvent, emitSubjectModelValue, getSubjectImageResources, getSubjectVideoResource, resolveSubjectCategoryLabel, showSubjectToast } from './shared-methods'\nimport { subjectControlResetStyles, subjectFormBaseStyles, subjectHostStyles, subjectPreviewBaseStyles, subjectTextareaStyles } from './shared-styles'\nimport { type Category, type Resource, SubjectError, type TagItem, trimCommaSeparatedText, trimText } from './single'\nimport { renderSortingCard, sortingCardStyles } from './sorting-card'\nimport { SubjectType, SubjectTypeLabel } from './types'\n\ninterface TextAnswer {\n  title: string\n  tag: string\n  showInput: boolean\n  answerId?: string | number\n  customAnswerId?: string | number\n}\n\ninterface TextAnswerSetting {\n  isInOrder?: boolean\n  isIgnoreCase?: boolean\n  keywordCount?: number\n}\n\nconst TAG_COLORS = [\n  { bg: '#ecf5ff', color: '#3D61E3', border: '#d9ecff' },\n  { bg: '#f0f9eb', color: '#67c23a', border: '#c2e7b0' },\n  { bg: '#fdf6ec', color: '#e6a23c', border: '#faecd8' },\n  { bg: '#fef0f0', color: '#f56c6c', border: '#fde2e2' },\n  { bg: '#f4f4f5', color: '#909399', border: '#e9e9eb' },\n]\n\n@safeCustomElement('qxs-text-fill')\nexport class QxsTextFill extends LitElement {\n  private readonly _iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\n  private readonly _iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\n\n  static styles = [sortingCardStyles, subjectHostStyles, subjectControlResetStyles, subjectPreviewBaseStyles, subjectFormBaseStyles, subjectTextareaStyles, css`\n    .preview-keyword-list {\n      display: flex;\n      flex-wrap: wrap;\n      gap: 8px;\n      margin-top: 16px;\n    }\n    .preview-answer-key {\n      display: inline-flex;\n      align-items: center;\n      padding: 2px 10px;\n      border-radius: 999px;\n      background: #f3f6fb;\n      font-size: 12px;\n      line-height: 1.6;\n      font-weight: 500;\n      color: #6b7280;\n    }\n    .preview-answer-body {\n      position: relative;\n      margin-top: 16px;\n      padding-left: 16px;\n      font-size: 14px;\n      line-height: 1.85;\n      font-weight: 600;\n      color: #3c4758;\n      white-space: pre-wrap;\n    }\n    .preview-answer-body::before {\n      content: '';\n      position: absolute;\n      left: 0;\n      top: 0.72em;\n      width: 6px;\n      height: 6px;\n      border-radius: 999px;\n      background: #c9d5ff;\n    }\n    .preview-analysis {\n      margin-top: 20px;\n      padding-left: 10px;\n      border-left: 2px solid #e5eaf3;\n      font-size: 13px;\n      line-height: 1.8;\n      color: #6b7280;\n    }\n\n    .flex { display: flex; }\n    .flex-items-center { display: flex; align-items: center; }\n    .flex-items-start { display: flex; align-items: flex-start; }\n    .flex-justify-end { display: flex; justify-content: flex-end; }\n    .edit-inline {\n      display: flex;\n      align-items: center;\n      flex-wrap: wrap;\n      gap: 8px 14px;\n      min-height: 32px;\n    }\n    .setting-copy {\n      font-size: 13px;\n      color: #606266;\n    }\n    .setting-number {\n      width: 68px;\n      height: 32px;\n      border: 1px solid #dcdfe6;\n      border-radius: 6px;\n      padding: 0 10px;\n      font-size: 13px;\n      line-height: 32px;\n      font-family: inherit;\n    }\n    .setting-number:focus {\n      border-color: #3D61E3;\n      outline: none;\n    }\n    .setting-toggle {\n      display: inline-flex;\n      align-items: center;\n      gap: 4px;\n      cursor: pointer;\n      font-size: 12px;\n      color: #606266;\n      user-select: none;\n    }\n    .edit-note {\n      margin-bottom: 8px;\n      font-size: 12px;\n      line-height: 1.6;\n      color: #909399;\n    }\n\n    .answer-list { display: flex; flex-direction: column; gap: 10px; }\n    .answer-item {\n      display: grid;\n      grid-template-columns: 76px minmax(0, 1fr) auto auto;\n      gap: 8px;\n      align-items: center;\n      border-radius: 4px;\n    }\n    .answer-item-label {\n      min-width: 0;\n      font-size: 13px;\n      line-height: 1.5;\n      font-weight: 600;\n      color: #6b7280;\n      letter-spacing: 0;\n    }\n    .answer-item .icon {\n      margin-left: 6px; cursor: pointer; display: inline-flex;\n      align-items: center; justify-content: center;\n      width: 24px; height: 24px; border-radius: 4px;\n      border: 1px solid #dcdfe6; background: #fff; color: #909399;\n      transition: all 0.2s;\n    }\n    .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n    .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n    .answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }\n    .answer-item .link:hover { color: #2D4CB8; }\n\n    .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; background: none; border: none; padding: 0; margin: 0; font-family: inherit; line-height: 1; }\n    .el-link:hover { color: #2D4CB8; }\n    .el-link.danger { color: #f56c6c; }\n\n    .value-text { font-size: 13px; color: #606266; white-space: pre-wrap; }\n    .tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }\n    .tag-item {\n      display: inline-flex; align-items: center; gap: 4px;\n      padding: 4px 8px; font-size: 12px; line-height: 1;\n      color: #3D61E3; background: #ecf5ff; border: 1px solid #d9ecff; border-radius: 4px;\n    }\n    .tag-item .close { cursor: pointer; color: #909399; }\n    .tag-item .close:hover { color: #f56c6c; }\n    .tag-hint { font-size: 12px; color: #909399; }\n    .el-select {\n      width: 150px; height: 34px; border: 1px solid #dcdfe6; border-radius: 6px;\n      padding: 0 8px; font-size: 13px; background: #fff; appearance: none;\n      background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c0c4cc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\");\n      background-repeat: no-repeat; background-position: right 8px center;\n    }\n    .resource-summary { font-size: 12px; color: #606266; }\n    .resource-thumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }\n    .resource-thumb {\n      width: 72px; height: 72px; object-fit: cover; border-radius: 6px;\n      border: 1px solid #e4e7ed; background: #f5f7fa;\n    }\n    .answer-tags {\n      display: flex;\n      flex-wrap: wrap;\n      gap: 6px;\n      align-items: center;\n      flex: 1;\n      max-width: 420px;\n      min-height: 28px;\n    }\n    .keyword-section { display: flex; flex-direction: column; gap: 10px; }\n    .keyword-section-row > .label { padding-top: 0; }\n    .keyword-input {\n      width: 88px;\n      height: 28px;\n      border: 1px solid #dcdfe6;\n      border-radius: 6px;\n      padding: 0 8px;\n      font-size: 12px;\n      font-family: inherit;\n    }\n    .keyword-input:focus {\n      border-color: #3D61E3;\n      outline: none;\n    }\n\n    @media (max-width: 720px) {\n      .edit-row,\n      .section-row {\n        flex-direction: column;\n        gap: 8px;\n      }\n\n      .edit-row > .label,\n      .section-row > .label {\n        min-width: 0;\n        padding-top: 0;\n      }\n\n      .answer-item-label {\n        min-width: 0;\n      }\n\n      .answer-tags {\n        max-width: none;\n      }\n    }\n  `]\n\n  @property({ type: Number, attribute: 'order-index' }) 'order-index' = 0\n  @property({ type: String, attribute: 'subject-prefix' }) 'subject-prefix'?: string\n  @property({ type: String }) title = ''\n  @property({ type: String, attribute: 'custom-id' }) 'custom-id' = ''\n  @property({ type: Boolean, attribute: 'is-edit' }) 'is-edit' = false\n  @property({ type: Boolean, attribute: 'is-save' }) 'is-save' = false\n  @property({ type: Boolean, attribute: 'is-set' }) 'is-set' = false\n  @property({ type: Boolean, attribute: 'is-key' }) 'is-key' = false\n  @property({ type: Boolean, attribute: 'show-action' }) 'show-action' = true\n  @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n  @property({ type: Boolean, attribute: 'hide-add-rich-text' }) 'hide-add-rich-text' = false\n  @property({ type: Boolean, attribute: 'show-rich-text' }) 'show-rich-text' = false\n  @property({ type: Boolean, attribute: 'show-delete-action' }) 'show-delete-action' = true\n  @property({ type: Boolean, attribute: 'show-save-action' }) 'show-save-action' = true\n  @property({ type: Boolean, reflect: true }) sorting = false\n  @property({ type: Boolean, attribute: 'show-answer-setting' }) 'show-answer-setting' = false\n  @property({ type: Boolean, attribute: 'show-analysis' }) 'show-analysis' = false\n  @property({ type: String, attribute: 'rich-text-content' }) 'rich-text-content' = ''\n  @property({ type: String }) analysis = ''\n  @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\n  @property({ type: String, attribute: 'exam-expand' }) 'exam-expand' = ''\n  @property({ type: Number, attribute: 'exam-id' }) 'exam-id' = 0\n  @property({ type: String, attribute: 'category-id' }) 'category-id' = ''\n  @property({ type: Object, attribute: 'exam-answer-setting' })\n  'exam-answer-setting': TextAnswerSetting = { isInOrder: false, isIgnoreCase: true }\n\n  @property({ type: Object, attribute: 'upload-image' })\n  'upload-image': (file: File) => Promise<string> = async (file: File) => {\n    return new Promise((resolve, reject) => {\n      const reader = new FileReader()\n      reader.onload = e => resolve(e.target?.result as string)\n      reader.onerror = reject\n      reader.readAsDataURL(file)\n    })\n  }\n\n  @property({ type: Array, attribute: 'answer-list' }) 'answer-list': any[] = []\n  @property({ type: Array, attribute: 'tag-list' }) 'tag-list': TagItem[] = []\n  @property({ type: Array, attribute: 'category-list' }) 'category-list': Category[] = []\n  @property({ type: Array, attribute: 'resource-list' }) 'resource-list': Resource[] = []\n  @property({ type: Boolean, attribute: 'show-tag' }) 'show-tag' = false\n  @property({ type: Boolean, attribute: 'show-category' }) 'show-category' = false\n  @property({ type: Boolean, attribute: 'show-resource' }) 'show-resource' = false\n  @property({ type: Object, attribute: 'search-handler' }) 'search-handler'?: (query: string, answerType: number) => Promise<any[]>\n\n  @property({ type: String, attribute: 'model-value' }) 'model-value' = ''\n  @property({ type: Boolean, attribute: 'use-model' }) 'use-model' = false\n\n  @state() private _answers: TextAnswer[] = [{ title: '', tag: '', showInput: false }]\n  @state() private _title = ''\n  @state() private _analysis = ''\n  @state() private _isInOrder = false\n  @state() private _isIgnoreCase = true\n  @state() private _keywordCount: number | null = null\n  @state() private _correct = ''\n  @state() private _showRichText = false\n  @state() private _richText = ''\n  @state() private _selectedTagList: TagItem[] = []\n  @state() private _categoryId = ''\n\n  private readonly TITLE_MAX = 200\n\n  willUpdate(changed: Map<string, unknown>) {\n    if (changed.has('is-edit') && this['is-edit']) { this._syncProps() }\n    if (!this['is-edit'] && (changed.has('title') || changed.has('answer-list') || changed.has('analysis') || changed.has('exam-answer-setting') || changed.has('rich-text-content') || changed.has('exam-expand') || changed.has('tag-list') || changed.has('category-id'))) {\n      this._syncProps()\n    }\n    if (changed.has('model-value') && this['use-model']) {\n      this._title = this['model-value']\n    }\n    if (changed.has('tag-list')) {\n      this._selectedTagList = Array.isArray(this['tag-list']) ? this['tag-list'].map(item => ({ ...item })) : []\n    }\n    if (changed.has('category-id')) {\n      this._categoryId = this['category-id'] ? String(this['category-id']) : ''\n    }\n  }\n\n  private _normalizeAnswerTitle(answer: any) {\n    return trimCommaSeparatedText(answer?.title ?? answer?.answer ?? '')\n  }\n\n  private _normalizedAnswerList(source: any[] = []) {\n    return (Array.isArray(source) ? source : []).map((answer: any) => ({\n      ...answer,\n      answerId: answer?.answerId ?? answer?.examAnswerId,\n      title: this._normalizeAnswerTitle(answer),\n    }))\n  }\n\n  private _filledAnswers(source: any[] = []) {\n    return source.filter(answer => this._normalizeAnswerTitle(answer))\n  }\n\n  private _previewKeywordItems(source: any[] = []) {\n    return this._filledAnswers(source)\n      .flatMap((answer) => {\n        return this._normalizeAnswerTitle(answer)\n          .split(',')\n          .map(item => item.trim())\n          .filter(Boolean)\n      })\n  }\n\n  private _readKeywordCount(setting?: TextAnswerSetting | null) {\n    if (!setting || setting.keywordCount === undefined || setting.keywordCount === null || setting.keywordCount === '') {\n      return null\n    }\n    return Number(setting.keywordCount)\n  }\n\n  private _syncProps() {\n    this._title = this.title || ''\n    this._analysis = this.analysis || ''\n    if (this['answer-list']?.length) {\n      this._answers = this._normalizedAnswerList(this['answer-list']).map((answer: any) => ({\n        title: answer.title || '',\n        tag: '',\n        showInput: false,\n        answerId: answer.answerId,\n        customAnswerId: answer.customAnswerId,\n      }))\n    }\n    else {\n      this._answers = [{ title: '', tag: '', showInput: false }]\n    }\n    this._isInOrder = !!this['exam-answer-setting']?.isInOrder\n    this._isIgnoreCase = this['exam-answer-setting']?.isIgnoreCase ?? true\n    this._keywordCount = this._readKeywordCount(this['exam-answer-setting'])\n    this._richText = this['rich-text-content'] || ''\n    this._showRichText = !!this['rich-text-content']\n    this._correct = this['exam-expand'] || ''\n    this._selectedTagList = Array.isArray(this['tag-list']) ? this['tag-list'].map(item => ({ ...item })) : []\n    this._categoryId = this['category-id'] ? String(this['category-id']) : ''\n  }\n\n  private _emit(name: string, detail?: unknown) {\n    emitSubjectEvent(this, name, detail)\n  }\n\n  private _onTitleInput(e: Event) {\n    const el = e.target as HTMLTextAreaElement\n    if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n    this._title = el.value\n    if (this['use-model']) {\n      emitSubjectModelValue(this, this._title)\n    }\n  }\n\n  private _addTag(index: number) {\n    const answer = { ...this._answers[index] }\n    if (answer.tag) {\n      answer.title = answer.title ? [answer.title, answer.tag].join(',') : answer.tag\n      answer.tag = ''\n    }\n    answer.showInput = false\n    this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? answer : item)\n  }\n\n  private _closeTag(tag: string, index: number) {\n    const answer = { ...this._answers[index] }\n    answer.title = answer.title.split(',').filter(item => item !== tag).join(',')\n    this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? answer : item)\n  }\n\n  private _addAnswer() {\n    this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n  }\n\n  private _deleteAnswer(index: number) {\n    if (this._answers.length < 2) { return }\n    this._answers = this._answers.filter((_, currentIndex) => currentIndex !== index)\n  }\n\n  private _onCategoryChange(value: string) {\n    this._categoryId = value\n    this._emit('category-change', {\n      value,\n      customId: this['custom-id'] || '',\n      examId: this['exam-id'] || 0,\n    })\n  }\n\n  private _imageResources() {\n    return getSubjectImageResources(this['resource-list'] || [])\n  }\n\n  private _videoResource() {\n    return getSubjectVideoResource(this['resource-list'] || [])\n  }\n\n  private _categoryLabel() {\n    return resolveSubjectCategoryLabel(this['category-list'], this._categoryId)\n  }\n\n  private _validateState(options: {\n    row: any\n    title: string\n    answers: TextAnswer[]\n    correct: string\n    keywordCount: number | null\n  }) {\n    const { row, title, answers, correct, keywordCount } = options\n    if (!title) {\n      return new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row)\n    }\n\n    const filledAnswers = this._filledAnswers(answers)\n    const shouldValidateAnswers = !!correct || keywordCount !== null || filledAnswers.length > 0\n\n    if (!shouldValidateAnswers) { return null }\n    if (!correct) {\n      return new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row)\n    }\n    if (!keywordCount || keywordCount < 1) {\n      return new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row)\n    }\n    if (!filledAnswers.length) {\n      return new SubjectError('请设置关键词', 'NO_KEYWORDS', 'answers', row)\n    }\n    if (keywordCount > filledAnswers.length) {\n      return new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row)\n    }\n    return null\n  }\n\n  async toJSON(): Promise<any> {\n    return new Promise((resolve, reject) => {\n      const row = { customId: this['custom-id'] || undefined, answerType: 'text_fill', orderIndex: this['order-index'] }\n\n      const title = trimText(this['is-edit'] ? this._title : this.title || '')\n      const answers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n      const analysis = trimText(this['is-edit'] ? this._analysis : this.analysis || '')\n      const correct = trimText(this['is-edit'] ? this._correct : this['exam-expand'] || '')\n      const keywordCount = this['is-edit'] ? this._keywordCount : this._readKeywordCount(this['exam-answer-setting'])\n      const isInOrder = this['is-edit'] ? this._isInOrder : (this['exam-answer-setting']?.isInOrder ?? false)\n      const isIgnoreCase = this['is-edit'] ? this._isIgnoreCase : (this['exam-answer-setting']?.isIgnoreCase ?? true)\n      const showRichText = this['is-edit'] ? this._showRichText : !!this['rich-text-content']\n      const richText = this['is-edit'] ? this._richText : this['rich-text-content'] || ''\n      const validationError = this._validateState({ row, title, answers, correct, keywordCount })\n      if (validationError) {\n        reject(validationError)\n        return\n      }\n\n      const result: any = {\n        answerType: SubjectType.TEXT_FILL,\n        examTypeEnum: SubjectType.TEXT_FILL,\n        title,\n        answers: this._filledAnswers(answers).map((answer: any, index: number) => {\n          const title = this._normalizeAnswerTitle(answer)\n          const next: any = {\n            title,\n            answer: title,\n            orderIndex: index + 1,\n          }\n          if (answer.answerId) {\n            next.answerId = answer.answerId\n            next.examAnswerId = answer.answerId\n          }\n          if (answer.customAnswerId) {\n            next.customAnswerId = answer.customAnswerId\n          }\n          return next\n        }),\n        analysis,\n        isSetCorrectAnswer: !!correct,\n        isKey: this['is-key'],\n        examExpand: correct,\n        examAnswerSettingBO: {\n          isIgnoreCase,\n          isInOrder,\n          ...(keywordCount !== null ? { keywordCount } : {}),\n        },\n        examAnswerSettingVO: {\n          isIgnoreCase,\n          isInOrder,\n          ...(keywordCount !== null ? { keywordCount } : {}),\n        },\n        examRichTextContent: showRichText ? richText : '',\n      }\n      if (this['custom-id']) { result.customId = this['custom-id'] }\n      resolve(result)\n    })\n  }\n\n  private async _save(e?: Event) {\n    e?.stopImmediatePropagation()\n    try {\n      const data = await this.toJSON()\n      this._emit('save', data)\n    }\n    catch (err: any) {\n      showSubjectToast(err.message)\n    }\n  }\n\n  validate(): SubjectError[] {\n    const row = { customId: this['custom-id'] || undefined, answerType: 'text_fill', orderIndex: this['order-index'] }\n    const title = trimText(this['is-edit'] ? this._title : this.title || '')\n    const answers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n    const correct = trimText(this['is-edit'] ? this._correct : this['exam-expand'] || '')\n    const keywordCount = this['is-edit'] ? this._keywordCount : this._readKeywordCount(this['exam-answer-setting'])\n    const validationError = this._validateState({ row, title, answers, correct, keywordCount })\n    return validationError ? [validationError] : []\n  }\n\n  private _renderPreview() {\n    const previewAnswers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n    const previewCorrect = this['is-edit'] ? this._correct : (this['exam-expand'] || '')\n    const previewTitle = buildSubjectPreviewTitle(this['subject-prefix'], this['order-index'], this.title)\n    const previewKeywords = this._previewKeywordItems(previewAnswers)\n    return html`\n      <div class=\"preview\">\n        <div class=\"preview-header\">\n          <div class=\"preview-title-row\">\n            <span class=\"title\">${previewTitle}</span>\n            <span class=\"preview-type\">问答题</span>\n          </div>\n          ${this['show-rich-text'] && this['rich-text-content'] ? html`<div class=\"rich-text\" .innerHTML=${this['rich-text-content']}></div>` : ''}\n        </div>\n        ${previewKeywords.length\n          ? html`\n          <div class=\"preview-keyword-list\">\n            ${previewKeywords.map((keyword) => html`\n              <span class=\"preview-answer-key\">${keyword}</span>\n            `)}\n          </div>\n        `\n          : ''}\n        ${previewCorrect ? html`<div class=\"preview-answer-body\">${previewCorrect}</div>` : ''}\n        ${this.analysis ? html`<div class=\"preview-analysis\">${this.analysis}</div>` : ''}\n        ${this['show-category'] && this._categoryId\n          ? html`<div class=\"section-row\"><span class=\"value-text\">分类：${this._categoryLabel()}</span></div>`\n          : ''}\n        ${this._renderResourceSection()}\n      </div>\n    `\n  }\n\n  private _renderSorting() {\n    const title = trimText(this['is-edit'] ? this._title : this.title || '') || '未命名题目'\n    const orderText = buildSubjectSortingTitle(this['subject-prefix'], this['order-index'], title)\n    return renderSortingCard(orderText, SubjectTypeLabel[SubjectType.TEXT_FILL] || SubjectType.TEXT_FILL)\n  }\n\n  private _renderCategorySection() {\n    if (!this['show-category']) { return '' }\n    return html`\n      <div class=\"flex-items-start section-row\">\n        <div class=\"label\"><span>分类:</span></div>\n        <div style=\"flex:1\">\n          ${this['is-edit']\n            ? html`\n            <select class=\"el-select\" .value=${String(this._categoryId)}\n              @change=${(e: Event) => this._onCategoryChange((e.target as HTMLSelectElement).value)}>\n              <option value=\"\">选择分类</option>\n              ${this['category-list'].map((item: any) => html`\n                <option value=${String(item.categoryId)} ?selected=${String(item.categoryId) === String(this._categoryId)}>${item.title || item.categoryName}</option>\n              `)}\n            </select>\n          `\n            : html`<span class=\"value-text\">${this._categoryLabel()}</span>`}\n        </div>\n      </div>\n    `\n  }\n\n  private _renderResourceSection() {\n    if (!this['show-resource']) { return '' }\n    const images = this._imageResources()\n    const video = this._videoResource()\n    return html`\n      <div class=\"flex-items-start section-row\">\n        <div class=\"label\"><span>资源:</span></div>\n        <div style=\"flex:1\">\n          <div class=\"resource-summary\">图片 ${images.length} 张${video?.url ? '，含视频资源' : ''}</div>\n          ${images.length\n            ? html`\n            <div class=\"resource-thumbs\">\n              ${images.slice(0, 4).map(src => html`<img class=\"resource-thumb\" src=${src} alt=\"resource\" />`)}\n            </div>\n          `\n            : ''}\n          ${video?.url ? html`<div style=\"margin-top:8px\"><a class=\"el-link\" href=${video.url} target=\"_blank\" rel=\"noreferrer\">查看视频</a></div>` : ''}\n          ${!images.length && !video?.url ? html`<div class=\"tag-hint\">暂无资源</div>` : ''}\n        </div>\n      </div>\n    `\n  }\n\n  private _renderEdit() {\n    return html`\n      <div class=\"edit-form\">\n        <div class=\"edit-row\">\n          <div class=\"label\"><span>题目:</span></div>\n          <div class=\"row-body\">\n            <div class=\"el-input\">\n              <textarea rows=\"2\" .value=${this._title}\n                maxlength=${this.TITLE_MAX}\n                @input=${(e: Event) => this._onTitleInput(e)}\n                placeholder=\"【问答题】请输入问题\"></textarea>\n              <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n            </div>\n          </div>\n        </div>\n\n        <div class=\"edit-row section-row\">\n          <div class=\"label\"><span>答题设置:</span></div>\n          <div class=\"row-body edit-inline\">\n            <span class=\"setting-copy\">共答对</span>\n            <input\n              type=\"number\"\n              class=\"setting-number\"\n              .value=${this._keywordCount === null ? '' : String(this._keywordCount)}\n              min=\"1\"\n              @change=${(e: Event) => {\n                const value = (e.target as HTMLInputElement).value\n                this._keywordCount = value === '' ? null : Number(value)\n              }} />\n            <span class=\"setting-copy\">个关键词，算是正确的</span>\n            <label class=\"setting-toggle\">\n              <input type=\"checkbox\" .checked=${this._isInOrder}\n                @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n              答案不分顺序\n            </label>\n            <label class=\"setting-toggle\">\n              <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n                @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n              忽略大小写\n            </label>\n          </div>\n        </div>\n\n        <slot name=\"business-tag\"></slot>\n\n        ${this._renderCategorySection()}\n\n        ${this._renderResourceSection()}\n\n        <div class=\"edit-row section-row\">\n          <div class=\"label\"><span>答案:</span></div>\n          <div class=\"row-body\">\n            <div class=\"el-input\">\n              <textarea rows=\"2\" .value=${this._correct}\n                maxlength=\"200\"\n                @input=${(e: Event) => { this._correct = (e.target as HTMLTextAreaElement).value }}\n                placeholder=\"请输入正确答案\"></textarea>\n              <span class=\"char-counter\">${this._correct.length}/200</span>\n            </div>\n          </div>\n        </div>\n\n        <div class=\"edit-row section-row keyword-section-row\">\n          <div class=\"label\"><span>关键词:</span></div>\n          <div class=\"row-body\">\n            <div class=\"keyword-section\">\n              <div class=\"edit-note\">如遇特殊字符关键词，请补充同义词，例如 “CO₂” 同时补充 “CO2”。</div>\n              <div class=\"answer-list\">\n                ${this._answers.map((answer, index) => html`\n                  <div class=\"answer-item\">\n                    <span class=\"answer-item-label\">关键词${index + 1}:</span>\n                    <div class=\"answer-tags\">\n                      ${answer.title.split(',').filter(Boolean).map((tag) => {\n                        const color = TAG_COLORS[index % TAG_COLORS.length]\n                        return html`\n                        <span style=\"display:inline-flex;align-items:center;background:${color.bg};color:${color.color};border:1px solid ${color.border};border-radius:6px;padding:2px 8px;font-size:12px;line-height:16px\">\n                          ${tag}\n                          <span style=\"cursor:pointer;margin-left:4px;color:#909399\" @click=${() => this._closeTag(tag, index)}>×</span>\n                        </span>\n                      `\n                      })}\n                      ${html`\n                        ${answer.showInput\n                          ? html`\n                          <input type=\"text\" class=\"keyword-input\"\n                            @keydown=${(e: KeyboardEvent) => {\n                              if (e.key === 'Enter') { this._addTag(index) }\n                            }}\n                            @input=${(e: Event) => { answer.tag = (e.target as HTMLInputElement).value }}\n                            @blur=${() => this._addTag(index)} />\n                          <button class=\"el-link\" @click=${() => this._addTag(index)}>确认</button>\n                        `\n                          : html`\n                          <button class=\"link\" @click=${() => {\n                            this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? { ...item, showInput: true } : item)\n                            this.updateComplete.then(() => {\n                              (this.shadowRoot?.querySelector('.keyword-input') as HTMLInputElement)?.focus()\n                            })\n                          }}>\n                            ${answer.title ? '添加同义词' : '添加关键词'}\n                          </button>\n                        `}\n                      `}\n                    </div>\n                    <span class=\"icon\" @click=${() => this._addAnswer()}>${this._iconPlus}</span>\n                    <span class=\"icon ${this._answers.length < 2 ? 'disabled' : ''}\" @click=${() => this._deleteAnswer(index)}>${this._iconRemove}</span>\n                  </div>\n                `)}\n              </div>\n            </div>\n          </div>\n        </div>\n\n        ${this['show-rich-text'] && this._showRichText\n          ? html`\n          <div class=\"edit-row section-row\">\n            <div class=\"label\"><span>副文本:</span></div>\n            <div class=\"row-body\">\n              <slot name=\"sub-text\">\n                <qxs-blocksuite-editor\n                  .content=${this._richText}\n                  .toolbar=${SUB_TEXT_EDITOR_TOOLBAR}\n                  .upload-image=${this['upload-image']}\n                  ?is-edit=${true}\n                  @input=${(e: CustomEvent) => { this._richText = (e.target as any).getContent() }}\n                ></qxs-blocksuite-editor>\n              </slot>\n              ${!this['show-action']\n                ? html`<div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>`\n                : ''}\n            </div>\n          </div>\n        `\n          : ''}\n\n        ${this['show-analysis']\n          ? html`\n          <div class=\"edit-row section-row\">\n            <div class=\"label\"><span>解析:</span></div>\n            <div class=\"row-body\">\n              <div class=\"el-input\">\n                <textarea rows=\"2\" .value=${this._analysis}\n                  @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n                  placeholder=\"请输入题目解析\"></textarea>\n              </div>\n            </div>\n          </div>\n        `\n          : ''}\n      </div>\n    `\n  }\n\n  render() {\n    if (this.sorting) {\n      return this._renderSorting()\n    }\n\n    const content = this['is-edit']\n      ? html`<div slot=\"edit\">${this._renderEdit()}</div>`\n      : html`<div slot=\"preview\">${this._renderPreview()}</div>`\n\n    return html`\n      <qxs-subject-layout .show-edit=${this['is-edit']}>\n        ${content}\n        ${this['show-action']\n          ? html`\n          <qxs-subject-action\n            .is-edit=${this['is-edit']}\n            .is-set=${this['is-set']}\n            .show-add=${this['show-add']}\n            .show-rich-text=${this['show-rich-text'] && this._showRichText}\n            .hide-add-rich-text=${!this['show-rich-text'] || this['hide-add-rich-text']}\n            .show-delete-action=${this['show-delete-action']}\n            .show-save-action=${this['show-save-action']}\n            exam-answer-relation-type=${this['exam-answer-relation-type']}\n            @delete=${() => this._emit('delete')}\n            @save=${this._save}\n            @edit=${() => this._emit('edit')}\n            @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n            @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n            @on-show-rich-text=${() => {\n              this._showRichText = !this._showRichText\n              if (!this._showRichText) {\n                this._richText = ''\n              }\n            }}\n          ></qxs-subject-action>\n        `\n          : ''}\n        <slot name=\"action\"></slot>\n      </qxs-subject-layout>\n    `\n  }\n}\n\nexport function register() {}\n"],"names":["TAG_COLORS","bg","color","border","QxsTextFill","LitElement","constructor","super","arguments","this","_iconPlus","html","_iconRemove","title","sorting","analysis","isInOrder","isIgnoreCase","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_answers","tag","showInput","_title","_analysis","_isInOrder","_isIgnoreCase","_keywordCount","_correct","_showRichText","_richText","_selectedTagList","_categoryId","TITLE_MAX","willUpdate","changed","has","_syncProps","Array","isArray","map","item","String","_normalizeAnswerTitle","answer","trimCommaSeparatedText","_normalizedAnswerList","source","length","undefined","answerId","examAnswerId","_filledAnswers","filter","_previewKeywordItems","flatMap","split","trim","Boolean","_readKeywordCount","setting","keywordCount","Number","customAnswerId","_emit","name","detail","emitSubjectEvent","_onTitleInput","el","value","slice","emitSubjectModelValue","_addTag","index","join","currentIndex","_closeTag","_addAnswer","_deleteAnswer","_","_onCategoryChange","customId","examId","_imageResources","getSubjectImageResources","_videoResource","getSubjectVideoResource","_categoryLabel","resolveSubjectCategoryLabel","_validateState","options","row","answers","correct","SubjectError","filledAnswers","toJSON","answerType","orderIndex","trimText","showRichText","richText","validationError","SubjectType","TEXT_FILL","examTypeEnum","next","isSetCorrectAnswer","isKey","examExpand","examAnswerSettingBO","examAnswerSettingVO","examRichTextContent","_save","stopImmediatePropagation","data","err","showSubjectToast","message","validate","_renderPreview","previewAnswers","previewCorrect","previewTitle","buildSubjectPreviewTitle","previewKeywords","keyword","_renderResourceSection","_renderSorting","orderText","buildSubjectSortingTitle","renderSortingCard","SubjectTypeLabel","_renderCategorySection","categoryId","categoryName","images","video","url","src","_renderEdit","checked","key","updateComplete","then","shadowRoot","querySelector","focus","SUB_TEXT_EDITOR_TOOLBAR","getContent","render","content","styles","sortingCardStyles","subjectHostStyles","subjectControlResetStyles","subjectPreviewBaseStyles","subjectFormBaseStyles","subjectTextareaStyles","css","__decorateClass","property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