@8wave/ai-elements 0.106.0-beta.2 → 0.106.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{PkLazyImg-BoH1s5ni.js → PkLazyImg-Beug40gC.js} +2 -2
- package/dist/_chunks/{PkLazyImg-BoH1s5ni.js.map → PkLazyImg-Beug40gC.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-CNAtslfG.js → PkToolRequestGeolocation-DUHzWOSe.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-CNAtslfG.js.map → PkToolRequestGeolocation-DUHzWOSe.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-DNZHj2Kx.js → PkToolRequestOAuthConnection-CdtnIiy6.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-DNZHj2Kx.js.map → PkToolRequestOAuthConnection-CdtnIiy6.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-Kfm50DPr.js → PkToolShowArtifact-B0gZZGvT.js} +3 -3
- package/dist/_chunks/{PkToolShowArtifact-Kfm50DPr.js.map → PkToolShowArtifact-B0gZZGvT.js.map} +1 -1
- package/dist/_chunks/{PkToolShowCalendarEvent-KJXNC-E_.js → PkToolShowCalendarEvent-DpEWSENB.js} +3 -3
- package/dist/_chunks/{PkToolShowCalendarEvent-KJXNC-E_.js.map → PkToolShowCalendarEvent-DpEWSENB.js.map} +1 -1
- package/dist/_chunks/{PkToolShowComparison-C1GPvcNH.js → PkToolShowComparison-DkHRpM8n.js} +3 -3
- package/dist/_chunks/{PkToolShowComparison-C1GPvcNH.js.map → PkToolShowComparison-DkHRpM8n.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-Ws8DysdD.js → PkToolShowContactForm-B8YI2e0B.js} +3 -3
- package/dist/_chunks/{PkToolShowContactForm-Ws8DysdD.js.map → PkToolShowContactForm-B8YI2e0B.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-CMuKde1V.js → PkToolShowDiagram-vmSzw6s0.js} +3 -3
- package/dist/_chunks/{PkToolShowDiagram-CMuKde1V.js.map → PkToolShowDiagram-vmSzw6s0.js.map} +1 -1
- package/dist/_chunks/{PkToolShowEmail-DvA69GLP.js → PkToolShowEmail-BtntDg5l.js} +3 -3
- package/dist/_chunks/{PkToolShowEmail-DvA69GLP.js.map → PkToolShowEmail-BtntDg5l.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CadrjzZx.js → PkToolShowForm-gD0MfOjQ.js} +104 -104
- package/dist/_chunks/PkToolShowForm-gD0MfOjQ.js.map +1 -0
- package/dist/_chunks/{PkToolShowImageGallery-CosOsHSh.js → PkToolShowImageGallery-DL-bFOKl.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-CosOsHSh.js.map → PkToolShowImageGallery-DL-bFOKl.js.map} +1 -1
- package/dist/_chunks/{PkToolShowLocation-BLSkytqC.js → PkToolShowLocation-DXPAEQCf.js} +3 -3
- package/dist/_chunks/{PkToolShowLocation-BLSkytqC.js.map → PkToolShowLocation-DXPAEQCf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowMessage-Bb1fhAcX.js → PkToolShowMessage-WendSuVW.js} +3 -3
- package/dist/_chunks/{PkToolShowMessage-Bb1fhAcX.js.map → PkToolShowMessage-WendSuVW.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-DkaEOhxY.js → PkToolShowProductList-_ULcSOL_.js} +3 -3
- package/dist/_chunks/{PkToolShowProductList-DkaEOhxY.js.map → PkToolShowProductList-_ULcSOL_.js.map} +1 -1
- package/dist/_chunks/{PkToolShowQrCode-GaZJBhqE.js → PkToolShowQrCode-BIhYJSTf.js} +3 -3
- package/dist/_chunks/{PkToolShowQrCode-GaZJBhqE.js.map → PkToolShowQrCode-BIhYJSTf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-BcxmwOsZ.js → PkToolShowSources-BprUew-i.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-BcxmwOsZ.js.map → PkToolShowSources-BprUew-i.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-4S7VvK7s.js → PkToolShowSuggestedReply-FJMsf1Ft.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-4S7VvK7s.js.map → PkToolShowSuggestedReply-FJMsf1Ft.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-CbSNJlH1.js → PkToolShowVideo-DXQo_Frk.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-CbSNJlH1.js.map → PkToolShowVideo-DXQo_Frk.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-Cr3NJEMI.js → PkToolShowWeather-Ca-ZrKx3.js} +2 -2
- package/dist/_chunks/{PkToolShowWeather-Cr3NJEMI.js.map → PkToolShowWeather-Ca-ZrKx3.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-DLpd7Kg0.js → PkToolShowWebPages-DxxqCOav.js} +3 -3
- package/dist/_chunks/{PkToolShowWebPages-DLpd7Kg0.js.map → PkToolShowWebPages-DxxqCOav.js.map} +1 -1
- package/dist/_chunks/{VvCheckboxGroup.es-DLgx43U_.js → VvCheckboxGroup.es-6rXZzFDs.js} +2 -2
- package/dist/_chunks/{VvCheckboxGroup.es-DLgx43U_.js.map → VvCheckboxGroup.es-6rXZzFDs.js.map} +1 -1
- package/dist/_chunks/{VvCombobox.es-D5zLGtOy.js → VvCombobox.es-DgB4YbSj.js} +409 -409
- package/dist/_chunks/{VvCombobox.es-D5zLGtOy.js.map → VvCombobox.es-DgB4YbSj.js.map} +1 -1
- package/dist/_chunks/{VvInputText.es-DWwDzlwZ.js → VvInputText.es-UTEISDKU.js} +181 -181
- package/dist/_chunks/{VvInputText.es-DWwDzlwZ.js.map → VvInputText.es-UTEISDKU.js.map} +1 -1
- package/dist/_chunks/{VvRadioGroup.es-BZdnaITO.js → VvRadioGroup.es-CqMnxRGR.js} +2 -2
- package/dist/_chunks/{VvRadioGroup.es-BZdnaITO.js.map → VvRadioGroup.es-CqMnxRGR.js.map} +1 -1
- package/dist/_chunks/{VvSelect.es-BP6Gn5BZ.js → VvSelect.es-BLNrNcIi.js} +6 -6
- package/dist/_chunks/{VvSelect.es-BP6Gn5BZ.js.map → VvSelect.es-BLNrNcIi.js.map} +1 -1
- package/dist/_chunks/{VvTextarea.es-BuLyBuYz.js → VvTextarea.es-ChkbZSw6.js} +296 -296
- package/dist/_chunks/{VvTextarea.es-BuLyBuYz.js.map → VvTextarea.es-ChkbZSw6.js.map} +1 -1
- package/dist/_chunks/{dist-vbhhaYbZ.js → dist-Dhop5_et.js} +91 -28
- package/dist/_chunks/{dist-vbhhaYbZ.js.map → dist-Dhop5_et.js.map} +1 -1
- package/dist/_chunks/{index.es-DFq55nZZ.js → index.es-CNKCTfCu.js} +93 -93
- package/dist/_chunks/{index.es-DFq55nZZ.js.map → index.es-CNKCTfCu.js.map} +1 -1
- package/dist/_chunks/{index.es-DhjFGu5c.js → index.es-DB9_sQvG.js} +16 -16
- package/dist/_chunks/{index.es-DhjFGu5c.js.map → index.es-DB9_sQvG.js.map} +1 -1
- package/dist/ai-elements.es.js +2334 -2327
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-a8Wh4tN4.js → PkChatbot-i_07-rvf.js} +76 -68
- package/dist-vue/_chunks/PkChatbot-i_07-rvf.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotEmptyState-C7W0QgqW.js.map +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-D6rNh6PF.js → PkChatbotMessages-CZLj_OeK.js} +4 -4
- package/dist-vue/_chunks/PkChatbotMessages-CZLj_OeK.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-DUn7M4SL.js → PkChatbotViewChat-B6MfjQIa.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewChat-DUn7M4SL.js.map → PkChatbotViewChat-B6MfjQIa.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-Bbqo6jm8.js → PkToolShowDiagram-D7jh-yIc.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-Bbqo6jm8.js.map → PkToolShowDiagram-D7jh-yIc.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-CJtmt5yd.js → PkToolShowForm-BGp_gbtr.js} +54 -54
- package/dist-vue/_chunks/PkToolShowForm-BGp_gbtr.js.map +1 -0
- package/dist-vue/index.js +8 -8
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkToolShowForm-CadrjzZx.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-a8Wh4tN4.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-D6rNh6PF.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowForm-CJtmt5yd.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./src-DT8FLE4_.js";
|
|
2
|
-
import { a as e } from "./PkChatbotMessages-
|
|
2
|
+
import { a as e } from "./PkChatbotMessages-CZLj_OeK.js";
|
|
3
3
|
import { t } from "./PkSvgViewer-DPpE9fiz.js";
|
|
4
4
|
import { VvButton as n, VvButtonGroup as r, VvIcon as i } from "@volverjs/ui-vue/components";
|
|
5
5
|
import { computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, onMounted as f, openBlock as p, ref as m, toDisplayString as h, unref as g, watch as _, withCtx as v } from "vue";
|
|
@@ -119,4 +119,4 @@ var x = {
|
|
|
119
119
|
//#endregion
|
|
120
120
|
export { k as default };
|
|
121
121
|
|
|
122
|
-
//# sourceMappingURL=PkToolShowDiagram-
|
|
122
|
+
//# sourceMappingURL=PkToolShowDiagram-D7jh-yIc.js.map
|
package/dist-vue/_chunks/{PkToolShowDiagram-Bbqo6jm8.js.map → PkToolShowDiagram-D7jh-yIc.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowDiagram-Bbqo6jm8.js","names":[],"sources":["../../../../packages/components/src/chat/PkToolShowDiagram.vue","../../../../packages/components/src/chat/PkToolShowDiagram.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, onMounted, ref, watch } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import { toSnakeCase } from 'utils'\n import PkSvgViewer from '../PkSvgViewer.vue'\n\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const { t: $t, te: $te } = useI18n({\n useScope: 'global',\n })\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n code: string\n title?: string\n caption?: string\n }\n }\n return part\n })\n\n const svgError = ref(false)\n\n // Serialized SVG content\n const svgContent = ref('')\n\n enum DiagramType {\n Sequence = 'sequenceDiagram',\n Class = 'classDiagram',\n State = 'stateDiagram',\n ER = 'erDiagram',\n XYChart = 'xychart',\n Flowchart = 'flowchart',\n Graph = 'graph',\n }\n\n const diagramType = computed<DiagramType | undefined>(() => {\n const code = toolPart.value.input?.code?.trimStart()\n if (!code) {\n return undefined\n }\n const firstWord = code.match(/^[A-Za-z-]+/)?.[0]\n switch (firstWord) {\n case 'sequenceDiagram':\n return DiagramType.Sequence\n case 'classDiagram':\n return DiagramType.Class\n case 'stateDiagram':\n return DiagramType.State\n case 'erDiagram':\n return DiagramType.ER\n case 'xychart-beta':\n return DiagramType.XYChart\n case 'flowchart':\n return DiagramType.Flowchart\n case 'graph':\n return DiagramType.Graph\n default:\n return undefined\n }\n })\n\n const diagramTypeLabel = computed(() => {\n if (!diagramType.value) {\n return ''\n }\n return $te(`diagram.${diagramType.value}`)\n ? $t(`diagram.${diagramType.value}`)\n : diagramType.value\n })\n\n const diagramTypeIcon = computed(() => {\n switch (diagramType.value) {\n case DiagramType.Sequence:\n return 'ri:timeline-view'\n case DiagramType.Class:\n return 'ri:organization-chart'\n case DiagramType.State:\n return 'ri:organization-chart'\n case DiagramType.ER:\n return 'ri:organization-chart'\n case DiagramType.XYChart:\n return 'ri:line-chart-line'\n case DiagramType.Flowchart:\n return 'ri:flow-chart'\n case DiagramType.Graph:\n return 'ri:flow-chart'\n default:\n return 'ri:flow-chart'\n }\n })\n\n async function renderDiagram() {\n const code = toolPart.value.input?.code\n if (!code) return\n\n svgError.value = false\n try {\n const { renderMermaidSVG, THEMES } =\n await import('beautiful-mermaid')\n const theme = props.isDark\n ? THEMES['github-dark']\n : THEMES['github-light']\n svgContent.value = renderMermaidSVG(code, theme)\n } catch {\n svgError.value = true\n }\n }\n\n watch([() => toolPart.value.input?.code, () => props.isDark], renderDiagram)\n onMounted(async () => {\n await renderDiagram()\n })\n\n const downloadSvg = () => {\n if (!svgContent.value) {\n return\n }\n const blob = new Blob([svgContent.value], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(toolPart.value.input?.title || 'diagram')}.svg`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n\n const copyCode = () => {\n const code = toolPart.value.input?.code\n if (code) {\n copy(code)\n }\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input?.code\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon :name=\"diagramTypeIcon\" class=\"text-16\" />\n <div class=\"flex flex-col items-start gap-2\">\n <strong class=\"font-bold\">{{\n diagramTypeLabel ?? $t('label.diagram')\n }}</strong>\n </div>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyCode\" />\n <VvButton\n v-if=\"svgContent\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadSvg\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"svgError\" class=\"text-12 text-danger py-8 px-sm\">\n {{ $t('message.diagramRenderError') }}\n </div>\n <PkSvgViewer\n v-else-if=\"svgContent\"\n class=\"pk-tool-show-diagram__stage\"\n :svg=\"svgContent\"\n :title=\"toolPart.input?.title\" />\n <div\n v-else\n class=\"pk-tool-show-diagram__stage flex justify-center items-center\">\n <VvIcon name=\"line-md:loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-if=\"toolPart.input.caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ toolPart.input.caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-diagram {\n // Fixed stage height: the diagram renders lazily (async chunk +\n // dynamic mermaid import), so the loader and the rendered SVG must\n // occupy the same space or the chat scroll position jumps around.\n // The SVG scales to fit; zoom/pan and the lightbox cover the rest.\n &__stage {\n height: 384px;\n\n .pk-svg-viewer__stage,\n .pk-svg-viewer__content {\n height: 100%;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, onMounted, ref, watch } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import { toSnakeCase } from 'utils'\n import PkSvgViewer from '../PkSvgViewer.vue'\n\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const { t: $t, te: $te } = useI18n({\n useScope: 'global',\n })\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n code: string\n title?: string\n caption?: string\n }\n }\n return part\n })\n\n const svgError = ref(false)\n\n // Serialized SVG content\n const svgContent = ref('')\n\n enum DiagramType {\n Sequence = 'sequenceDiagram',\n Class = 'classDiagram',\n State = 'stateDiagram',\n ER = 'erDiagram',\n XYChart = 'xychart',\n Flowchart = 'flowchart',\n Graph = 'graph',\n }\n\n const diagramType = computed<DiagramType | undefined>(() => {\n const code = toolPart.value.input?.code?.trimStart()\n if (!code) {\n return undefined\n }\n const firstWord = code.match(/^[A-Za-z-]+/)?.[0]\n switch (firstWord) {\n case 'sequenceDiagram':\n return DiagramType.Sequence\n case 'classDiagram':\n return DiagramType.Class\n case 'stateDiagram':\n return DiagramType.State\n case 'erDiagram':\n return DiagramType.ER\n case 'xychart-beta':\n return DiagramType.XYChart\n case 'flowchart':\n return DiagramType.Flowchart\n case 'graph':\n return DiagramType.Graph\n default:\n return undefined\n }\n })\n\n const diagramTypeLabel = computed(() => {\n if (!diagramType.value) {\n return ''\n }\n return $te(`diagram.${diagramType.value}`)\n ? $t(`diagram.${diagramType.value}`)\n : diagramType.value\n })\n\n const diagramTypeIcon = computed(() => {\n switch (diagramType.value) {\n case DiagramType.Sequence:\n return 'ri:timeline-view'\n case DiagramType.Class:\n return 'ri:organization-chart'\n case DiagramType.State:\n return 'ri:organization-chart'\n case DiagramType.ER:\n return 'ri:organization-chart'\n case DiagramType.XYChart:\n return 'ri:line-chart-line'\n case DiagramType.Flowchart:\n return 'ri:flow-chart'\n case DiagramType.Graph:\n return 'ri:flow-chart'\n default:\n return 'ri:flow-chart'\n }\n })\n\n async function renderDiagram() {\n const code = toolPart.value.input?.code\n if (!code) return\n\n svgError.value = false\n try {\n const { renderMermaidSVG, THEMES } =\n await import('beautiful-mermaid')\n const theme = props.isDark\n ? THEMES['github-dark']\n : THEMES['github-light']\n svgContent.value = renderMermaidSVG(code, theme)\n } catch {\n svgError.value = true\n }\n }\n\n watch([() => toolPart.value.input?.code, () => props.isDark], renderDiagram)\n onMounted(async () => {\n await renderDiagram()\n })\n\n const downloadSvg = () => {\n if (!svgContent.value) {\n return\n }\n const blob = new Blob([svgContent.value], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(toolPart.value.input?.title || 'diagram')}.svg`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n\n const copyCode = () => {\n const code = toolPart.value.input?.code\n if (code) {\n copy(code)\n }\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input?.code\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon :name=\"diagramTypeIcon\" class=\"text-16\" />\n <div class=\"flex flex-col items-start gap-2\">\n <strong class=\"font-bold\">{{\n diagramTypeLabel ?? $t('label.diagram')\n }}</strong>\n </div>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyCode\" />\n <VvButton\n v-if=\"svgContent\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadSvg\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"svgError\" class=\"text-12 text-danger py-8 px-sm\">\n {{ $t('message.diagramRenderError') }}\n </div>\n <PkSvgViewer\n v-else-if=\"svgContent\"\n class=\"pk-tool-show-diagram__stage\"\n :svg=\"svgContent\"\n :title=\"toolPart.input?.title\" />\n <div\n v-else\n class=\"pk-tool-show-diagram__stage flex justify-center items-center\">\n <VvIcon name=\"line-md:loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-if=\"toolPart.input.caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ toolPart.input.caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-diagram {\n // Fixed stage height: the diagram renders lazily (async chunk +\n // dynamic mermaid import), so the loader and the rendered SVG must\n // occupy the same space or the chat scroll position jumps around.\n // The SVG scales to fit; zoom/pan and the lightbox cover the rest.\n &__stage {\n height: 384px;\n\n .pk-svg-viewer__stage,\n .pk-svg-viewer__content {\n height: 100%;\n }\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;GAkCS,IAAL,yBAAA,GAAA;QACI,EAAA,WAAA,mBACA,EAAA,QAAA,gBACA,EAAA,QAAA,gBACA,EAAA,KAAA,aACA,EAAA,UAAA,WACA,EAAA,YAAA,aACA,EAAA,QAAA;AACJ,EARK,KAAA,CAAA,CAQL;;;;;;;EAnCA,IAAM,IAAQ,GAKR,EAAE,GAAG,GAAI,IAAI,MAAQ,EAAQ,EAC/B,UAAU,SACd,CAAC,GAEK,EAAE,SAAM,cAAW,EAAa,GAEhC,IAAW,QACA,EAAM,IAQtB,GAEK,IAAW,EAAI,EAAK,GAGpB,IAAa,EAAI,EAAE,GAYnB,IAAc,QAAwC;GACxD,IAAM,IAAO,EAAS,MAAM,OAAO,MAAM,UAAU;GAC9C,OAIL,QADkB,EAAK,MAAM,aAAa,CAAC,GAAG,IAC9C;IACI,KAAK,mBACD,OAAO,EAAY;IACvB,KAAK,gBACD,OAAO,EAAY;IACvB,KAAK,gBACD,OAAO,EAAY;IACvB,KAAK,aACD,OAAO,EAAY;IACvB,KAAK,gBACD,OAAO,EAAY;IACvB,KAAK,aACD,OAAO,EAAY;IACvB,KAAK,SACD,OAAO,EAAY;IACvB,SACI;GACR;EACJ,CAAC,GAEK,IAAmB,QAChB,EAAY,QAGV,EAAI,WAAW,EAAY,OAAO,IACnC,EAAG,WAAW,EAAY,OAAO,IACjC,EAAY,QAJP,EAKd,GAEK,IAAkB,QAAe;GACnC,QAAQ,EAAY,OAApB;IACI,KAAK,EAAY,UACb,OAAO;IACX,KAAK,EAAY,OACb,OAAO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X,GAEW,EADP,EAAA,SAAoB,EAAA,CAAA,CAAE,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,CAAA;KAG9B,EAYgB,GAAA;MAZD,WAAU;MAAU,OAAM;;MACrC,SAAA,QAIwB,CAJxB,EAIwB,GAAA;OAHpB,WAAU;OACT,MAAM,EAAA,CAAA,IAAM,kBAAA;OACZ,OAAO,EAAA,CAAA,IAAS,EAAA,CAAA,CAAE,CAAA,eAAA,IAAoB,EAAA,CAAA,CAAE,CAAA,aAAA;OACxC,SAAO;MAEF,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,GAAA,EAAA,SADV,EAAA,GAAA,EAK2B,GAAA;;OAHvB,WAAU;OACV,MAAK;OACJ,OAAO,EAAA,CAAA,CAAE,CAAA,iBAAA;OACT,SAAO;;;;;IAGT,EAAA,SAAX,EAAA,GAAA,EAEM,OAFN,GAEM,EADC,EAAA,CAAA,CAAE,CAAA,4BAAA,CAAA,GAAA,CAAA,KAGM,EAAA,SADf,EAAA,GAAA,EAIqC,GAAA;;KAFjC,OAAM;KACL,KAAK,EAAA;KACL,OAAO,EAAA,MAAS,OAAO;IAC5B,GAAA,MAAA,GAAA,CAAA,OAAA,OAAA,CAAA,MAAA,EAAA,GAAA,EAIM,OAJN,GAIM,CADF,EAAoE,GAAA;KAA5D,MAAK;KAAuB,OAAM;;IAGpC,EAAA,MAAS,MAAM,WADzB,EAAA,GAAA,EAIM,OAJN,GAIM,EADC,EAAA,MAAS,MAAM,OAAO,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA"}
|
|
1
|
+
{"version":3,"file":"PkToolShowDiagram-D7jh-yIc.js","names":[],"sources":["../../../../packages/components/src/chat/PkToolShowDiagram.vue","../../../../packages/components/src/chat/PkToolShowDiagram.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, onMounted, ref, watch } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import { toSnakeCase } from 'utils'\n import PkSvgViewer from '../PkSvgViewer.vue'\n\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const { t: $t, te: $te } = useI18n({\n useScope: 'global',\n })\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n code: string\n title?: string\n caption?: string\n }\n }\n return part\n })\n\n const svgError = ref(false)\n\n // Serialized SVG content\n const svgContent = ref('')\n\n enum DiagramType {\n Sequence = 'sequenceDiagram',\n Class = 'classDiagram',\n State = 'stateDiagram',\n ER = 'erDiagram',\n XYChart = 'xychart',\n Flowchart = 'flowchart',\n Graph = 'graph',\n }\n\n const diagramType = computed<DiagramType | undefined>(() => {\n const code = toolPart.value.input?.code?.trimStart()\n if (!code) {\n return undefined\n }\n const firstWord = code.match(/^[A-Za-z-]+/)?.[0]\n switch (firstWord) {\n case 'sequenceDiagram':\n return DiagramType.Sequence\n case 'classDiagram':\n return DiagramType.Class\n case 'stateDiagram':\n return DiagramType.State\n case 'erDiagram':\n return DiagramType.ER\n case 'xychart-beta':\n return DiagramType.XYChart\n case 'flowchart':\n return DiagramType.Flowchart\n case 'graph':\n return DiagramType.Graph\n default:\n return undefined\n }\n })\n\n const diagramTypeLabel = computed(() => {\n if (!diagramType.value) {\n return ''\n }\n return $te(`diagram.${diagramType.value}`)\n ? $t(`diagram.${diagramType.value}`)\n : diagramType.value\n })\n\n const diagramTypeIcon = computed(() => {\n switch (diagramType.value) {\n case DiagramType.Sequence:\n return 'ri:timeline-view'\n case DiagramType.Class:\n return 'ri:organization-chart'\n case DiagramType.State:\n return 'ri:organization-chart'\n case DiagramType.ER:\n return 'ri:organization-chart'\n case DiagramType.XYChart:\n return 'ri:line-chart-line'\n case DiagramType.Flowchart:\n return 'ri:flow-chart'\n case DiagramType.Graph:\n return 'ri:flow-chart'\n default:\n return 'ri:flow-chart'\n }\n })\n\n async function renderDiagram() {\n const code = toolPart.value.input?.code\n if (!code) return\n\n svgError.value = false\n try {\n const { renderMermaidSVG, THEMES } =\n await import('beautiful-mermaid')\n const theme = props.isDark\n ? THEMES['github-dark']\n : THEMES['github-light']\n svgContent.value = renderMermaidSVG(code, theme)\n } catch {\n svgError.value = true\n }\n }\n\n watch([() => toolPart.value.input?.code, () => props.isDark], renderDiagram)\n onMounted(async () => {\n await renderDiagram()\n })\n\n const downloadSvg = () => {\n if (!svgContent.value) {\n return\n }\n const blob = new Blob([svgContent.value], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(toolPart.value.input?.title || 'diagram')}.svg`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n\n const copyCode = () => {\n const code = toolPart.value.input?.code\n if (code) {\n copy(code)\n }\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input?.code\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon :name=\"diagramTypeIcon\" class=\"text-16\" />\n <div class=\"flex flex-col items-start gap-2\">\n <strong class=\"font-bold\">{{\n diagramTypeLabel ?? $t('label.diagram')\n }}</strong>\n </div>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyCode\" />\n <VvButton\n v-if=\"svgContent\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadSvg\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"svgError\" class=\"text-12 text-danger py-8 px-sm\">\n {{ $t('message.diagramRenderError') }}\n </div>\n <PkSvgViewer\n v-else-if=\"svgContent\"\n class=\"pk-tool-show-diagram__stage\"\n :svg=\"svgContent\"\n :title=\"toolPart.input?.title\" />\n <div\n v-else\n class=\"pk-tool-show-diagram__stage flex justify-center items-center\">\n <VvIcon name=\"line-md:loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-if=\"toolPart.input.caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ toolPart.input.caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-diagram {\n // Fixed stage height: the diagram renders lazily (async chunk +\n // dynamic mermaid import), so the loader and the rendered SVG must\n // occupy the same space or the chat scroll position jumps around.\n // The SVG scales to fit; zoom/pan and the lightbox cover the rest.\n &__stage {\n height: 384px;\n\n .pk-svg-viewer__stage,\n .pk-svg-viewer__content {\n height: 100%;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, onMounted, ref, watch } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import { toSnakeCase } from 'utils'\n import PkSvgViewer from '../PkSvgViewer.vue'\n\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const { t: $t, te: $te } = useI18n({\n useScope: 'global',\n })\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n code: string\n title?: string\n caption?: string\n }\n }\n return part\n })\n\n const svgError = ref(false)\n\n // Serialized SVG content\n const svgContent = ref('')\n\n enum DiagramType {\n Sequence = 'sequenceDiagram',\n Class = 'classDiagram',\n State = 'stateDiagram',\n ER = 'erDiagram',\n XYChart = 'xychart',\n Flowchart = 'flowchart',\n Graph = 'graph',\n }\n\n const diagramType = computed<DiagramType | undefined>(() => {\n const code = toolPart.value.input?.code?.trimStart()\n if (!code) {\n return undefined\n }\n const firstWord = code.match(/^[A-Za-z-]+/)?.[0]\n switch (firstWord) {\n case 'sequenceDiagram':\n return DiagramType.Sequence\n case 'classDiagram':\n return DiagramType.Class\n case 'stateDiagram':\n return DiagramType.State\n case 'erDiagram':\n return DiagramType.ER\n case 'xychart-beta':\n return DiagramType.XYChart\n case 'flowchart':\n return DiagramType.Flowchart\n case 'graph':\n return DiagramType.Graph\n default:\n return undefined\n }\n })\n\n const diagramTypeLabel = computed(() => {\n if (!diagramType.value) {\n return ''\n }\n return $te(`diagram.${diagramType.value}`)\n ? $t(`diagram.${diagramType.value}`)\n : diagramType.value\n })\n\n const diagramTypeIcon = computed(() => {\n switch (diagramType.value) {\n case DiagramType.Sequence:\n return 'ri:timeline-view'\n case DiagramType.Class:\n return 'ri:organization-chart'\n case DiagramType.State:\n return 'ri:organization-chart'\n case DiagramType.ER:\n return 'ri:organization-chart'\n case DiagramType.XYChart:\n return 'ri:line-chart-line'\n case DiagramType.Flowchart:\n return 'ri:flow-chart'\n case DiagramType.Graph:\n return 'ri:flow-chart'\n default:\n return 'ri:flow-chart'\n }\n })\n\n async function renderDiagram() {\n const code = toolPart.value.input?.code\n if (!code) return\n\n svgError.value = false\n try {\n const { renderMermaidSVG, THEMES } =\n await import('beautiful-mermaid')\n const theme = props.isDark\n ? THEMES['github-dark']\n : THEMES['github-light']\n svgContent.value = renderMermaidSVG(code, theme)\n } catch {\n svgError.value = true\n }\n }\n\n watch([() => toolPart.value.input?.code, () => props.isDark], renderDiagram)\n onMounted(async () => {\n await renderDiagram()\n })\n\n const downloadSvg = () => {\n if (!svgContent.value) {\n return\n }\n const blob = new Blob([svgContent.value], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(toolPart.value.input?.title || 'diagram')}.svg`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n\n const copyCode = () => {\n const code = toolPart.value.input?.code\n if (code) {\n copy(code)\n }\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input?.code\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon :name=\"diagramTypeIcon\" class=\"text-16\" />\n <div class=\"flex flex-col items-start gap-2\">\n <strong class=\"font-bold\">{{\n diagramTypeLabel ?? $t('label.diagram')\n }}</strong>\n </div>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyCode\" />\n <VvButton\n v-if=\"svgContent\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadSvg\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"svgError\" class=\"text-12 text-danger py-8 px-sm\">\n {{ $t('message.diagramRenderError') }}\n </div>\n <PkSvgViewer\n v-else-if=\"svgContent\"\n class=\"pk-tool-show-diagram__stage\"\n :svg=\"svgContent\"\n :title=\"toolPart.input?.title\" />\n <div\n v-else\n class=\"pk-tool-show-diagram__stage flex justify-center items-center\">\n <VvIcon name=\"line-md:loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-if=\"toolPart.input.caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ toolPart.input.caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-diagram {\n // Fixed stage height: the diagram renders lazily (async chunk +\n // dynamic mermaid import), so the loader and the rendered SVG must\n // occupy the same space or the chat scroll position jumps around.\n // The SVG scales to fit; zoom/pan and the lightbox cover the rest.\n &__stage {\n height: 384px;\n\n .pk-svg-viewer__stage,\n .pk-svg-viewer__content {\n height: 100%;\n }\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;GAkCS,IAAL,yBAAA,GAAA;QACI,EAAA,WA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xC,SAAO;MAEF,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,GAAA,EAAA,SADV,EAAA,GAAA,EAK2B,GAAA;;OAHvB,WAAU;OACV,MAAK;OACJ,OAAO,EAAA,CAAA,CAAE,CAAA,iBAAA;OACT,SAAO;;;;;IAGT,EAAA,SAAX,EAAA,GAAA,EAEM,OAFN,GAEM,EADC,EAAA,CAAA,CAAE,CAAA,4BAAA,CAAA,GAAA,CAAA,KAGM,EAAA,SADf,EAAA,GAAA,EAIqC,GAAA;;KAFjC,OAAM;KACL,KAAK,EAAA;KACL,OAAO,EAAA,MAAS,OAAO;IAC5B,GAAA,MAAA,GAAA,CAAA,OAAA,OAAA,CAAA,MAAA,EAAA,GAAA,EAIM,OAJN,GAIM,CADF,EAAoE,GAAA;KAA5D,MAAK;KAAuB,OAAM;;IAGpC,EAAA,MAAS,MAAM,WADzB,EAAA,GAAA,EAIM,OAJN,GAIM,EADC,EAAA,MAAS,MAAM,OAAO,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA"}
|
|
@@ -3,11 +3,11 @@ import { D as t } from "./Agent-CpIgGdU4.js";
|
|
|
3
3
|
import { t as n } from "./PkStreamingMarkdown-DM_5YqQX.js";
|
|
4
4
|
import { a as r, i } from "./utils-Coqik0XI.js";
|
|
5
5
|
import { VvButton as a, VvCheckbox as o, VvCheckboxGroup as s, VvIcon as ee, VvInputText as te, VvRadio as c, VvRadioGroup as l } from "@volverjs/ui-vue/components";
|
|
6
|
-
import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createSlots as g, createTextVNode as _, createVNode as v, defineComponent as y, mergeModels as b, mergeProps as x, normalizeClass as ne, normalizeStyle as re, openBlock as S, reactive as ie, ref as C, renderList as w, renderSlot as T, toDisplayString as E, unref as D,
|
|
6
|
+
import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createSlots as g, createTextVNode as _, createVNode as v, defineComponent as y, mergeModels as b, mergeProps as x, normalizeClass as ne, normalizeStyle as re, openBlock as S, reactive as ie, ref as C, renderList as w, renderSlot as T, toDisplayString as E, unref as D, useId as O, useModel as k, watch as A, withCtx as j, withKeys as ae, withModifiers as M } from "vue";
|
|
7
7
|
import { useI18n as oe } from "vue-i18n";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region ../../packages/components/src/PkEditorRadioButtons.vue
|
|
10
|
-
var
|
|
10
|
+
var N = /* @__PURE__ */ y({
|
|
11
11
|
__name: "PkEditorRadioButtons",
|
|
12
12
|
props: /*@__PURE__*/ b({
|
|
13
13
|
name: {},
|
|
@@ -36,29 +36,29 @@ var M = /* @__PURE__ */ y({
|
|
|
36
36
|
}),
|
|
37
37
|
emits: ["update:modelValue"],
|
|
38
38
|
setup(e) {
|
|
39
|
-
let t = e, n =
|
|
40
|
-
return (t,
|
|
41
|
-
let
|
|
42
|
-
return S(), f(
|
|
39
|
+
let t = e, n = k(e, "modelValue"), r = O(), i = d(() => `${t.name}-${r}`), a = d(() => [...t.modifiers ? Array.isArray(t.modifiers) ? t.modifiers : [t.modifiers] : [], t.segmented ? "segment" : "button"]);
|
|
40
|
+
return (t, r) => {
|
|
41
|
+
let o = c, s = l;
|
|
42
|
+
return S(), f(s, {
|
|
43
43
|
modelValue: n.value,
|
|
44
|
-
"onUpdate:modelValue":
|
|
45
|
-
name:
|
|
44
|
+
"onUpdate:modelValue": r[0] ||= (e) => n.value = e,
|
|
45
|
+
name: i.value,
|
|
46
46
|
label: e.label,
|
|
47
47
|
"hint-label": e.hintLabel,
|
|
48
48
|
invalid: e.invalid,
|
|
49
49
|
"invalid-label": e.invalidLabel,
|
|
50
50
|
modifiers: e.segmented ? "segmented" : "buttons"
|
|
51
51
|
}, {
|
|
52
|
-
default:
|
|
53
|
-
key:
|
|
54
|
-
name:
|
|
52
|
+
default: j(() => [(S(!0), m(u, null, w(e.options, (n, r) => (S(), f(o, {
|
|
53
|
+
key: r,
|
|
54
|
+
name: i.value,
|
|
55
55
|
required: e.required,
|
|
56
56
|
readonly: e.readonly,
|
|
57
57
|
disabled: e.disabled,
|
|
58
58
|
value: n.value,
|
|
59
|
-
modifiers:
|
|
59
|
+
modifiers: a.value
|
|
60
60
|
}, {
|
|
61
|
-
default:
|
|
61
|
+
default: j(() => [T(t.$slots, n.value, x({ ref_for: !0 }, { option: n }), () => [_(E(n.label), 1)])]),
|
|
62
62
|
_: 2
|
|
63
63
|
}, 1032, [
|
|
64
64
|
"name",
|
|
@@ -80,7 +80,7 @@ var M = /* @__PURE__ */ y({
|
|
|
80
80
|
]);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
}),
|
|
83
|
+
}), P = /* @__PURE__ */ y({
|
|
84
84
|
__name: "PkEditorCheckboxButtons",
|
|
85
85
|
props: /*@__PURE__*/ b({
|
|
86
86
|
name: {},
|
|
@@ -94,7 +94,7 @@ var M = /* @__PURE__ */ y({
|
|
|
94
94
|
}),
|
|
95
95
|
emits: ["update:modelValue"],
|
|
96
96
|
setup(e) {
|
|
97
|
-
let t =
|
|
97
|
+
let t = k(e, "modelValue");
|
|
98
98
|
return (n, r) => {
|
|
99
99
|
let i = o, a = s;
|
|
100
100
|
return S(), f(a, {
|
|
@@ -103,7 +103,7 @@ var M = /* @__PURE__ */ y({
|
|
|
103
103
|
name: e.name,
|
|
104
104
|
modifiers: "buttons"
|
|
105
105
|
}, {
|
|
106
|
-
default:
|
|
106
|
+
default: j(() => [(S(!0), m(u, null, w(e.options, (t, r) => (S(), f(i, {
|
|
107
107
|
key: r,
|
|
108
108
|
name: e.name,
|
|
109
109
|
required: e.required,
|
|
@@ -112,7 +112,7 @@ var M = /* @__PURE__ */ y({
|
|
|
112
112
|
value: t.value,
|
|
113
113
|
modifiers: "button"
|
|
114
114
|
}, {
|
|
115
|
-
default:
|
|
115
|
+
default: j(() => [T(n.$slots, String(t.value), x({ ref_for: !0 }, { option: t }), () => [_(E(t.label), 1)])]),
|
|
116
116
|
_: 2
|
|
117
117
|
}, 1032, [
|
|
118
118
|
"name",
|
|
@@ -137,22 +137,22 @@ var M = /* @__PURE__ */ y({
|
|
|
137
137
|
}, ue = {
|
|
138
138
|
key: 1,
|
|
139
139
|
class: "flex flex-col gap-4 p-sm"
|
|
140
|
-
}, de = { class: "flex justify-between text-10 text-word-3" }, fe = { class: "h-4 bg-surface-3 rounded-full overflow-hidden" }, pe = { class: "px-sm py-16 flex flex-col gap-12" }, me = { class: "leading-normal text-12" }, he = { class: "font-semibold" }, ge = { class: "text-12" }, _e = { class: "font-semibold" },
|
|
140
|
+
}, de = { class: "flex justify-between text-10 text-word-3" }, fe = { class: "h-4 bg-surface-3 rounded-full overflow-hidden" }, pe = { class: "px-sm py-16 flex flex-col gap-12" }, me = { class: "leading-normal text-12" }, he = { class: "font-semibold" }, ge = { class: "text-12" }, _e = { class: "font-semibold" }, F = {
|
|
141
141
|
key: 0,
|
|
142
142
|
class: "text-word-3"
|
|
143
|
-
},
|
|
143
|
+
}, I = { class: "text-12" }, ve = { class: "font-semibold" }, ye = {
|
|
144
144
|
key: 0,
|
|
145
145
|
class: "text-word-3"
|
|
146
|
-
},
|
|
146
|
+
}, be = {
|
|
147
147
|
key: 2,
|
|
148
148
|
class: "flex flex-col gap-6 w-full"
|
|
149
|
-
},
|
|
149
|
+
}, xe = {
|
|
150
150
|
key: 0,
|
|
151
151
|
class: "px-sm pb-sm border-t border-surface-3"
|
|
152
|
-
},
|
|
152
|
+
}, Se = {
|
|
153
153
|
key: 1,
|
|
154
154
|
class: "px-sm py-10 bg-surface border-t border-surface-3 flex justify-between gap-12"
|
|
155
|
-
},
|
|
155
|
+
}, Ce = { key: 1 }, we = { class: "px-sm py-12 bg-surface space-y-10" }, Te = { class: "flex flex-col gap-8" }, Ee = { class: "text-12 text-word-3" }, De = { class: "text-12 text-word-2 font-semibold" }, Oe = { class: "px-sm py-12 bg-surface border-t border-surface-3 flex items-center gap-10" }, L = { class: "w-20 h-20 rounded-full border border-success text-success flex items-center justify-center" }, ke = { class: "flex flex-col" }, Ae = { class: "font-semibold text-12 text-word-1 leading-tight" }, R = /*@__PURE__*/ y({
|
|
156
156
|
__name: "PkToolShowForm",
|
|
157
157
|
props: {
|
|
158
158
|
part: {},
|
|
@@ -163,16 +163,16 @@ var M = /* @__PURE__ */ y({
|
|
|
163
163
|
setup(e, { emit: o }) {
|
|
164
164
|
let s = e, c = o, { t: l, d: _ } = oe({ useScope: "global" }), y = d(() => JSON.parse(JSON.stringify(s.part))), b = d(() => y.value.toolName === "showMultipleChoice" || y.value.type === "tool-showMultipleChoice"), x = d(() => t(y.value.output)), T = d(() => !s.answered && (y.value.state === "input-available" || x.value)), O = d(() => {
|
|
165
165
|
let e = H.value;
|
|
166
|
-
return e ?
|
|
167
|
-
}),
|
|
166
|
+
return e ? z.value.length === 1 && !e.allowFreeformInput && !s.allowCustomAnswer : !1;
|
|
167
|
+
}), k = d(() => b.value && z.value.length === 1 && !H.value?.multiSelect), R = d(() => !!H.value?.options && !H.value?.multiSelect && (O.value || k.value)), z = d(() => {
|
|
168
168
|
let e = y.value.input;
|
|
169
169
|
return e?.steps?.length ? e.steps : e?.question && e?.options ? [{
|
|
170
170
|
id: "legacy",
|
|
171
171
|
question: e.question,
|
|
172
172
|
options: e.options.map((e) => typeof e == "string" ? { label: e } : e)
|
|
173
173
|
}] : [];
|
|
174
|
-
}),
|
|
175
|
-
|
|
174
|
+
}), B = d(() => y.value.state === "output-error" && !z.value.length), V = C(0), H = d(() => z.value[V.value]), U = d(() => V.value > 0), W = d(() => V.value < z.value.length - 1), je = d(() => z.value.length > 1), G = d(() => je.value ? Math.round((V.value + 1) / z.value.length * 100) : null), K = ie({}), q = C("");
|
|
175
|
+
A(V, () => {
|
|
176
176
|
q.value = "";
|
|
177
177
|
});
|
|
178
178
|
let J = d({
|
|
@@ -197,8 +197,8 @@ var M = /* @__PURE__ */ y({
|
|
|
197
197
|
let t = e.answers;
|
|
198
198
|
return Array.isArray(t) ? t : void 0;
|
|
199
199
|
}
|
|
200
|
-
|
|
201
|
-
!e || t(e) || Object.assign(K, i(
|
|
200
|
+
A(() => y.value.output, (e) => {
|
|
201
|
+
!e || t(e) || Object.assign(K, i(z.value, e));
|
|
202
202
|
}, { immediate: !0 });
|
|
203
203
|
let Ne = d(() => {
|
|
204
204
|
let e = y.value.output;
|
|
@@ -210,7 +210,7 @@ var M = /* @__PURE__ */ y({
|
|
|
210
210
|
return Array.isArray(e) ? e.join(", ") : String(e);
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
-
|
|
213
|
+
A(Ne, (e) => {
|
|
214
214
|
!e || !H.value || (H.value.options ?? []).map((e) => e.label).includes(e) || (q.value = e);
|
|
215
215
|
}, { immediate: !0 });
|
|
216
216
|
let X = d(() => r(H.value));
|
|
@@ -226,21 +226,21 @@ var M = /* @__PURE__ */ y({
|
|
|
226
226
|
}
|
|
227
227
|
function Q() {
|
|
228
228
|
if (!T.value) return;
|
|
229
|
-
let e =
|
|
229
|
+
let e = z.value.map((e, t) => ({
|
|
230
230
|
id: e.id,
|
|
231
231
|
value: K[t] ?? null
|
|
232
232
|
}));
|
|
233
|
-
if (
|
|
233
|
+
if (k.value && !H.value?.allowFreeformInput) {
|
|
234
234
|
let t = e[0].value;
|
|
235
235
|
c("select", Array.isArray(t) ? t[0] : t);
|
|
236
236
|
} else c("select", { answers: e });
|
|
237
237
|
}
|
|
238
238
|
function $() {
|
|
239
239
|
let e = q.value.trim();
|
|
240
|
-
e && (K[V.value] = e, q.value = "",
|
|
240
|
+
e && (K[V.value] = e, q.value = "", z.value.length === 1 ? Q() : Z());
|
|
241
241
|
}
|
|
242
242
|
function Fe() {
|
|
243
|
-
T.value && (O.value ||
|
|
243
|
+
T.value && (O.value || k.value) && Q();
|
|
244
244
|
}
|
|
245
245
|
function Ie(e, t) {
|
|
246
246
|
let n = K[t];
|
|
@@ -248,12 +248,12 @@ var M = /* @__PURE__ */ y({
|
|
|
248
248
|
}
|
|
249
249
|
return (e, t) => {
|
|
250
250
|
let r = te, i = a, o = ee;
|
|
251
|
-
return
|
|
251
|
+
return B.value ? (S(), m("div", se, [t[4] ||= h("span", { class: "i-vv-alert-circle text-16 shrink-0" }, null, -1), h("span", null, E(D(l)("message.formRenderError")), 1)])) : z.value.length ? (S(), m("div", ce, [y.value.input?.title || T.value && z.value.length > 1 ? (S(), m("div", le, [y.value.input?.title ? (S(), m("div", {
|
|
252
252
|
key: 0,
|
|
253
|
-
class: ne(["px-sm py-10 font-bold", { "border-b border-surface-3": T.value &&
|
|
254
|
-
}, E(y.value.input?.title), 3)) : p("", !0), T.value &&
|
|
253
|
+
class: ne(["px-sm py-10 font-bold", { "border-b border-surface-3": T.value && z.value.length > 1 }])
|
|
254
|
+
}, E(y.value.input?.title), 3)) : p("", !0), T.value && z.value.length > 1 ? (S(), m("div", ue, [h("div", de, [h("span", null, E(D(l)("showForm.step", {
|
|
255
255
|
current: V.value + 1,
|
|
256
|
-
total:
|
|
256
|
+
total: z.value.length
|
|
257
257
|
})), 1), h("span", null, E(G.value) + "%", 1)]), h("div", fe, [h("div", {
|
|
258
258
|
class: "h-full bg-word-4 transition-all duration-300",
|
|
259
259
|
style: re({ width: `${G.value}%` })
|
|
@@ -262,7 +262,7 @@ var M = /* @__PURE__ */ y({
|
|
|
262
262
|
key: 0,
|
|
263
263
|
markdown: H.value.message,
|
|
264
264
|
class: "text-word-2 mt-4"
|
|
265
|
-
}, null, 8, ["markdown"])) : p("", !0)]), H.value.options && H.value.multiSelect ? (S(), f(
|
|
265
|
+
}, null, 8, ["markdown"])) : p("", !0)]), H.value.options && H.value.multiSelect ? (S(), f(P, {
|
|
266
266
|
key: 0,
|
|
267
267
|
modelValue: Y.value,
|
|
268
268
|
"onUpdate:modelValue": t[0] ||= (e) => Y.value = e,
|
|
@@ -273,13 +273,13 @@ var M = /* @__PURE__ */ y({
|
|
|
273
273
|
vertical: ""
|
|
274
274
|
}, g({ _: 2 }, [w(X.value, (e) => ({
|
|
275
275
|
name: e.value,
|
|
276
|
-
fn:
|
|
276
|
+
fn: j(() => [h("div", ge, [h("div", _e, E(e.label), 1), e.description ? (S(), m("div", F, E(e.description), 1)) : p("", !0)])])
|
|
277
277
|
}))]), 1032, [
|
|
278
278
|
"modelValue",
|
|
279
279
|
"name",
|
|
280
280
|
"options",
|
|
281
281
|
"readonly"
|
|
282
|
-
])) : H.value.options && !H.value.multiSelect ? (S(), f(
|
|
282
|
+
])) : H.value.options && !H.value.multiSelect ? (S(), f(N, {
|
|
283
283
|
key: 1,
|
|
284
284
|
modelValue: J.value,
|
|
285
285
|
"onUpdate:modelValue": [t[1] ||= (e) => J.value = e, Fe],
|
|
@@ -290,13 +290,13 @@ var M = /* @__PURE__ */ y({
|
|
|
290
290
|
class: "mb-0"
|
|
291
291
|
}, g({ _: 2 }, [w(X.value, (e) => ({
|
|
292
292
|
name: e.value,
|
|
293
|
-
fn:
|
|
293
|
+
fn: j(() => [h("div", I, [h("div", ve, E(e.label), 1), e.description ? (S(), m("div", ye, E(e.description), 1)) : p("", !0)])])
|
|
294
294
|
}))]), 1032, [
|
|
295
295
|
"modelValue",
|
|
296
296
|
"name",
|
|
297
297
|
"options",
|
|
298
298
|
"readonly"
|
|
299
|
-
])) : H.value.options ? p("", !0) : (S(), m("div",
|
|
299
|
+
])) : H.value.options ? p("", !0) : (S(), m("div", be, [(S(), f(r, {
|
|
300
300
|
key: H.value.id,
|
|
301
301
|
modelValue: J.value,
|
|
302
302
|
"onUpdate:modelValue": t[2] ||= (e) => J.value = e,
|
|
@@ -314,9 +314,9 @@ var M = /* @__PURE__ */ y({
|
|
|
314
314
|
"name",
|
|
315
315
|
"disabled"
|
|
316
316
|
]))]))]),
|
|
317
|
-
H.value.allowFreeformInput && H.value.options ? (S(), m("div",
|
|
317
|
+
H.value.allowFreeformInput && H.value.options ? (S(), m("div", xe, [h("form", {
|
|
318
318
|
class: "flex gap-xs pt-sm",
|
|
319
|
-
onSubmit:
|
|
319
|
+
onSubmit: M($, ["prevent"])
|
|
320
320
|
}, [(S(), f(r, {
|
|
321
321
|
key: `${H.value.id}-custom`,
|
|
322
322
|
modelValue: q.value,
|
|
@@ -332,34 +332,34 @@ var M = /* @__PURE__ */ y({
|
|
|
332
332
|
"disabled",
|
|
333
333
|
"placeholder"
|
|
334
334
|
]))], 32)])) : p("", !0),
|
|
335
|
-
|
|
335
|
+
R.value ? p("", !0) : (S(), m("div", Se, [U.value ? (S(), f(i, {
|
|
336
336
|
key: 0,
|
|
337
337
|
modifiers: "action-quiet",
|
|
338
338
|
icon: "ri:arrow-left-s-line",
|
|
339
339
|
label: D(l)("action.back"),
|
|
340
|
-
onClick:
|
|
341
|
-
}, null, 8, ["label"])) : (S(), m("div",
|
|
340
|
+
onClick: M(Pe, ["stop"])
|
|
341
|
+
}, null, 8, ["label"])) : (S(), m("div", Ce)), v(i, {
|
|
342
342
|
modifiers: W.value ? "action-quiet" : "action-primary",
|
|
343
343
|
icon: W.value ? "ri:arrow-right-s-line" : "ri:send-plane-2-line",
|
|
344
344
|
"icon-position": "right",
|
|
345
345
|
label: W.value ? D(l)("action.next") : D(l)("action.submit"),
|
|
346
|
-
onClick:
|
|
346
|
+
onClick: M(Z, ["stop"])
|
|
347
347
|
}, null, 8, [
|
|
348
348
|
"modifiers",
|
|
349
349
|
"icon",
|
|
350
350
|
"label"
|
|
351
351
|
])]))
|
|
352
|
-
], 64)) : (S(), m(u, { key: 2 }, [h("div",
|
|
352
|
+
], 64)) : (S(), m(u, { key: 2 }, [h("div", we, [h("ul", Te, [(S(!0), m(u, null, w(z.value, (e, t) => (S(), m("li", {
|
|
353
353
|
key: t,
|
|
354
354
|
class: "leading-normal"
|
|
355
|
-
}, [h("div",
|
|
355
|
+
}, [h("div", Ee, E(e.question), 1), h("span", De, E(Ie(e, t)), 1)]))), 128))])]), h("div", Oe, [h("div", L, [v(o, {
|
|
356
356
|
name: "ri:check-line",
|
|
357
357
|
class: "text-12"
|
|
358
|
-
})]), h("div",
|
|
358
|
+
})]), h("div", ke, [h("span", Ae, E(D(l)("showForm.completed")), 1)])])], 64))])) : p("", !0);
|
|
359
359
|
};
|
|
360
360
|
}
|
|
361
361
|
}), z = /* @__PURE__ */ e({ default: () => B }), B = R;
|
|
362
362
|
//#endregion
|
|
363
|
-
export {
|
|
363
|
+
export { N as i, z as n, P as r, B as t };
|
|
364
364
|
|
|
365
|
-
//# sourceMappingURL=PkToolShowForm-
|
|
365
|
+
//# sourceMappingURL=PkToolShowForm-BGp_gbtr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkToolShowForm-BGp_gbtr.js","names":[],"sources":["../../../../packages/components/src/PkEditorRadioButtons.vue","../../../../packages/components/src/PkEditorRadioButtons.vue","../../../../packages/components/src/PkEditorCheckboxButtons.vue","../../../../packages/components/src/PkEditorCheckboxButtons.vue","../../../../packages/components/src/chat/PkToolShowForm.vue","../../../../packages/components/src/chat/PkToolShowForm.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import type { Option } from '@volverjs/ui-vue'\n import { computed, useId } from 'vue'\n\n const props = defineProps<{\n name: string\n label?: string\n hintLabel?: string\n invalid?: boolean\n invalidLabel?: string | string[]\n required?: boolean\n options: Option[]\n readonly?: boolean\n disabled?: boolean\n modifiers?: string | string[]\n /**\n * Render the options as one segmented control (a recessed track with\n * the chosen option raised) instead of a row of boxed cards. Suits a\n * choice between a few short named states, such as a level or a mode.\n */\n segmented?: boolean\n }>()\n\n const modelValue = defineModel<\n string | number | boolean | symbol | unknown[] | undefined\n >({ default: undefined })\n\n // Native radios group by their name attribute across the whole document, so\n // two instances sharing one name become a single group: the browser unchecks\n // the other instance's inputs and Vue never puts them back, because its own\n // model did not change. It happened with \"theme\", offered by the profile\n // menu and the agent settings panel at the same time, and it can happen to\n // any two tool forms with the same step id. Scope the name to the instance.\n const uid = useId()\n const groupName = computed(() => `${props.name}-${uid}`)\n\n const radioModifiers = computed(() => {\n const toReturn = props.modifiers\n ? Array.isArray(props.modifiers)\n ? props.modifiers\n : [props.modifiers]\n : []\n return [...toReturn, props.segmented ? 'segment' : 'button']\n })\n</script>\n\n<template>\n <VvRadioGroup\n v-model=\"modelValue\"\n :name=\"groupName\"\n :label\n :hint-label=\"hintLabel\"\n :invalid\n :invalid-label=\"invalidLabel\"\n :modifiers=\"segmented ? 'segmented' : 'buttons'\">\n <VvRadio\n v-for=\"(option, key) in options\"\n :key\n :name=\"groupName\"\n :required\n :readonly\n :disabled\n :value=\"option.value\"\n :modifiers=\"radioModifiers\">\n <slot :name=\"option.value\" v-bind=\"{ option }\">\n {{ option.label }}\n </slot>\n </VvRadio>\n </VvRadioGroup>\n</template>\n","<script setup lang=\"ts\">\n import type { Option } from '@volverjs/ui-vue'\n import { computed, useId } from 'vue'\n\n const props = defineProps<{\n name: string\n label?: string\n hintLabel?: string\n invalid?: boolean\n invalidLabel?: string | string[]\n required?: boolean\n options: Option[]\n readonly?: boolean\n disabled?: boolean\n modifiers?: string | string[]\n /**\n * Render the options as one segmented control (a recessed track with\n * the chosen option raised) instead of a row of boxed cards. Suits a\n * choice between a few short named states, such as a level or a mode.\n */\n segmented?: boolean\n }>()\n\n const modelValue = defineModel<\n string | number | boolean | symbol | unknown[] | undefined\n >({ default: undefined })\n\n // Native radios group by their name attribute across the whole document, so\n // two instances sharing one name become a single group: the browser unchecks\n // the other instance's inputs and Vue never puts them back, because its own\n // model did not change. It happened with \"theme\", offered by the profile\n // menu and the agent settings panel at the same time, and it can happen to\n // any two tool forms with the same step id. Scope the name to the instance.\n const uid = useId()\n const groupName = computed(() => `${props.name}-${uid}`)\n\n const radioModifiers = computed(() => {\n const toReturn = props.modifiers\n ? Array.isArray(props.modifiers)\n ? props.modifiers\n : [props.modifiers]\n : []\n return [...toReturn, props.segmented ? 'segment' : 'button']\n })\n</script>\n\n<template>\n <VvRadioGroup\n v-model=\"modelValue\"\n :name=\"groupName\"\n :label\n :hint-label=\"hintLabel\"\n :invalid\n :invalid-label=\"invalidLabel\"\n :modifiers=\"segmented ? 'segmented' : 'buttons'\">\n <VvRadio\n v-for=\"(option, key) in options\"\n :key\n :name=\"groupName\"\n :required\n :readonly\n :disabled\n :value=\"option.value\"\n :modifiers=\"radioModifiers\">\n <slot :name=\"option.value\" v-bind=\"{ option }\">\n {{ option.label }}\n </slot>\n </VvRadio>\n </VvRadioGroup>\n</template>\n","<script setup lang=\"ts\">\n import type { Option } from '@volverjs/ui-vue'\n\n defineProps<{\n name: string\n required?: boolean\n options: Option[]\n readonly?: boolean\n disabled?: boolean\n }>()\n\n const modelValue = defineModel<unknown[] | undefined>({\n default: undefined,\n })\n</script>\n\n<template>\n <VvCheckboxGroup v-model=\"modelValue\" :name modifiers=\"buttons\">\n <VvCheckbox\n v-for=\"(option, key) in options\"\n :key\n :name\n :required\n :readonly\n :disabled\n :value=\"option.value\"\n modifiers=\"button\">\n <slot :name=\"String(option.value)\" v-bind=\"{ option }\">\n {{ option.label }}\n </slot>\n </VvCheckbox>\n </VvCheckboxGroup>\n</template>\n","<script setup lang=\"ts\">\n import type { Option } from '@volverjs/ui-vue'\n\n defineProps<{\n name: string\n required?: boolean\n options: Option[]\n readonly?: boolean\n disabled?: boolean\n }>()\n\n const modelValue = defineModel<unknown[] | undefined>({\n default: undefined,\n })\n</script>\n\n<template>\n <VvCheckboxGroup v-model=\"modelValue\" :name modifiers=\"buttons\">\n <VvCheckbox\n v-for=\"(option, key) in options\"\n :key\n :name\n :required\n :readonly\n :disabled\n :value=\"option.value\"\n modifiers=\"button\">\n <slot :name=\"String(option.value)\" v-bind=\"{ option }\">\n {{ option.label }}\n </slot>\n </VvCheckbox>\n </VvCheckboxGroup>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, reactive, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n import { formAnswerSlots, formStepOptions } from './utils'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkEditorRadioButtons from '../PkEditorRadioButtons.vue'\n import PkEditorCheckboxButtons from '../PkEditorCheckboxButtons.vue'\n\n // --- Types ---\n\n interface FormOption {\n label: string\n description?: string\n }\n\n interface FormStep {\n id: string\n question: string\n message?: string\n type?: 'text' | 'number' | 'date'\n options?: FormOption[]\n multiSelect?: boolean\n allowFreeformInput?: boolean\n placeholder?: string\n }\n\n interface FormAnswer {\n id: string\n value: string | string[] | number | null\n }\n\n interface ToolPartShape {\n state?: 'input-available' | 'output-available' | 'output-error'\n toolCallId?: string\n // AI SDK v5 encodes the tool name in `type` (e.g. 'tool-showMultipleChoice').\n // `toolName` is kept for backward compatibility but is normally absent.\n type?: string\n toolName?: string\n input?: {\n title?: string\n steps?: FormStep[]\n // Legacy showMultipleChoice fields\n question?: string\n options?: (string | FormOption)[]\n }\n // The web card submits `{ answers: [...] }`; the platform channels\n // (Teams modal) submit a flat record keyed by step id.\n output?: string | { answers: FormAnswer[] } | Record<string, unknown>\n }\n\n type AnswerValue = string | string[] | number | null\n\n // --- Props & Emits ---\n\n const props = defineProps<{\n part: unknown\n allowCustomAnswer?: boolean\n /**\n * Answered during a call. Nothing in the part says so (the answer went\n * to the agent as speech, not to the tool call), so the surface that\n * sent it is the only one that knows, and without it the same form\n * could be submitted again and again.\n */\n answered?: boolean\n }>()\n\n const emit = defineEmits<{\n select: [answer: string | { answers: FormAnswer[] }]\n }>()\n\n const { t: $t, d: $d } = useI18n({ useScope: 'global' })\n\n // --- Parsed tool part ---\n\n const toolPart = computed(\n () => JSON.parse(JSON.stringify(props.part)) as ToolPartShape,\n )\n\n const isLegacy = computed(\n () =>\n toolPart.value.toolName === 'showMultipleChoice' ||\n toolPart.value.type === 'tool-showMultipleChoice',\n )\n\n /**\n * A form drawn during a CALL is already \"answered\" as far as the tool loop\n * is concerned: the turn could not wait for it, so the backend closed it\n * with a note saying the widget was drawn (see `isVoiceRenderAck`). That\n * note is not an answer, and the caller still has to give one.\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n const isInteractive = computed(\n () =>\n !props.answered &&\n (toolPart.value.state === 'input-available' || isRenderAck.value),\n )\n\n /** Single-step with no custom-answer and no freeform → auto-submit on option pick */\n const isAutoSubmitStep = computed(() => {\n const step = currentStep.value\n if (!step) return false\n return (\n steps.value.length === 1 &&\n !step.allowFreeformInput &&\n !props.allowCustomAnswer\n )\n })\n\n /** Legacy tool should auto-submit on option pick regardless of allowCustomAnswer */\n const isLegacyAutoSubmit = computed(\n () =>\n isLegacy.value &&\n steps.value.length === 1 &&\n !currentStep.value?.multiSelect,\n )\n\n /**\n * True only for the steps that send themselves as soon as an option is\n * picked: the single case where the footer button would be redundant.\n * Every other shape needs it, single-step forms included: with\n * `allowFreeformInput` (or `allowCustomAnswer`) the radio pick no longer\n * auto-submits, so without the footer the user was left with a chosen\n * option and no way to send it.\n */\n const isSelfSubmitting = computed(\n () =>\n Boolean(currentStep.value?.options) &&\n !currentStep.value?.multiSelect &&\n (isAutoSubmitStep.value || isLegacyAutoSubmit.value),\n )\n\n // --- Steps ---\n\n const steps = computed<FormStep[]>(() => {\n const input = toolPart.value.input\n if (input?.steps?.length) {\n return input.steps\n }\n // Legacy showMultipleChoice → normalize into a single step\n if (input?.question && input?.options) {\n return [\n {\n id: 'legacy',\n question: input.question,\n options: input.options.map((o) =>\n typeof o === 'string' ? { label: o } : o,\n ),\n },\n ]\n }\n return []\n })\n\n /**\n * The reason the card has nothing to draw. A call the SDK rejected keeps\n * `state: 'output-error'` and moves the arguments it could not validate to\n * `rawInput`, so `input` is empty and there are no steps: without this the\n * component rendered NOTHING, and the user was left with a question that\n * had been announced and never appeared.\n */\n const hasFailed = computed(\n () => toolPart.value.state === 'output-error' && !steps.value.length,\n )\n\n // --- Navigation state ---\n\n const currentStepIndex = ref(0)\n const currentStep = computed(() => steps.value[currentStepIndex.value])\n const canGoBack = computed(() => currentStepIndex.value > 0)\n const canGoNext = computed(\n () => currentStepIndex.value < steps.value.length - 1,\n )\n const isMultiStep = computed(() => steps.value.length > 1)\n\n const progress = computed(() => {\n if (!isMultiStep.value) return null\n return Math.round(\n ((currentStepIndex.value + 1) / steps.value.length) * 100,\n )\n })\n\n // --- Answers ---\n\n /**\n * One slot PER STEP, keyed by position and not by step id: the ids come\n * from the model and nothing enforces they are unique, and keyed by id two\n * steps sharing one collapsed onto a single answer. See `formAnswerSlots`.\n */\n const answers = reactive<Record<number, AnswerValue>>({})\n const customAnswer = ref('')\n\n // The freeform field belongs to the step showing it: text left behind\n // (unsubmitted, or arriving from a late input update) must not follow the\n // user to the next or previous question.\n watch(currentStepIndex, () => {\n customAnswer.value = ''\n })\n\n // Single scalar answer shared by radio buttons and freeform text/number/date inputs.\n const scalarValue = computed<string | number | undefined>({\n get: () => {\n const val = currentStep.value\n ? answers[currentStepIndex.value]\n : undefined\n if (val == null || Array.isArray(val)) return undefined\n return val\n },\n set: (val) => {\n if (currentStep.value) {\n answers[currentStepIndex.value] = val ?? null\n }\n },\n })\n\n const activeCheckboxValue = computed<unknown[] | undefined>({\n get: () => {\n const val = currentStep.value\n ? answers[currentStepIndex.value]\n : undefined\n return Array.isArray(val) ? val : []\n },\n set: (val) => {\n if (currentStep.value) {\n answers[currentStepIndex.value] = (val as string[]) ?? []\n }\n },\n })\n\n // --- Initialize answers from existing output ---\n\n /** The `{ answers: [...] }` list, when the output carries one. */\n function outputAnswers(output: ToolPartShape['output']) {\n if (!output || typeof output === 'string') return undefined\n const list = (output as { answers?: unknown }).answers\n return Array.isArray(list) ? (list as FormAnswer[]) : undefined\n }\n\n watch(\n () => toolPart.value.output,\n (output) => {\n if (!output || isVoiceRenderAck(output)) return\n // Every shape an answered form comes back in (the web card's list,\n // a legacy plain string, the flat record a platform channel posts)\n // lands on the same per-position slots: see `formAnswerSlots`.\n Object.assign(\n answers,\n formAnswerSlots(steps.value, output) as Record<\n number,\n AnswerValue\n >,\n )\n },\n { immediate: true },\n )\n\n // --- Restore custom answer from output when it doesn't match any option ---\n\n const normalizedOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || isVoiceRenderAck(out)) return undefined\n if (typeof out === 'string') return out\n const list = outputAnswers(out)\n if (list?.length === 1) {\n const val = list[0].value\n return Array.isArray(val) ? val.join(', ') : String(val)\n }\n return undefined\n })\n\n watch(\n normalizedOutput,\n (value) => {\n if (!value || !currentStep.value) return\n const optionLabels = (currentStep.value.options ?? []).map(\n (o) => o.label,\n )\n if (!optionLabels.includes(value)) {\n customAnswer.value = value\n }\n },\n { immediate: true },\n )\n\n // --- Option mapping for radio/checkbox components ---\n\n const radioOptions = computed(() => formStepOptions(currentStep.value))\n\n // --- Navigation & Submission ---\n\n /** Footer button, and Enter on a pure freeform step. */\n function goNext() {\n // A typed freeform answer wins over the picked option: it is the more\n // recent intent, and the footer button is now the visible way to send\n // it (the freeform field only submits on Enter).\n if (customAnswer.value.trim()) {\n submitCustomAnswer()\n return\n }\n if (canGoNext.value) {\n currentStepIndex.value++\n } else {\n submitForm()\n }\n }\n\n function goBack() {\n if (canGoBack.value) {\n currentStepIndex.value--\n }\n }\n\n function submitForm() {\n if (!isInteractive.value) return\n\n const finalAnswers: FormAnswer[] = steps.value.map((step, index) => ({\n id: step.id,\n value: answers[index] ?? null,\n }))\n\n // Legacy backward compatibility: single-step, single-select → return plain string\n if (\n isLegacyAutoSubmit.value &&\n !currentStep.value?.allowFreeformInput\n ) {\n const val = finalAnswers[0].value\n emit('select', Array.isArray(val) ? val[0] : (val as string))\n } else {\n emit('select', { answers: finalAnswers })\n }\n }\n\n /** Enter inside the freeform field shown alongside the options. */\n function submitCustomAnswer() {\n const value = customAnswer.value.trim()\n if (!value) return\n\n answers[currentStepIndex.value] = value\n // Cleared before navigating: `goNext()` reads it back to route a typed\n // answer here, so leaving it set would recurse.\n customAnswer.value = ''\n if (steps.value.length === 1) {\n submitForm()\n } else {\n goNext()\n }\n }\n\n function onRadioChange() {\n if (!isInteractive.value) return\n if (isAutoSubmitStep.value || isLegacyAutoSubmit.value) {\n submitForm()\n }\n }\n\n // --- Summary helpers ---\n\n function getSummaryValue(step: FormStep, index: number) {\n const val = answers[index]\n if (val == null) return '—'\n if (Array.isArray(val)) return val.join(', ')\n if (step.type === 'date') return $d(new Date(val), 'short')\n return val\n }\n</script>\n\n<template>\n <div\n v-if=\"hasFailed\"\n class=\"text-12 text-danger flex items-center gap-6 py-8\">\n <span class=\"i-vv-alert-circle text-16 shrink-0\" />\n <span>{{ $t('message.formRenderError') }}</span>\n </div>\n <div\n v-else-if=\"steps.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden flex flex-col bg-surface\">\n <!-- Header -->\n <div\n v-if=\"toolPart.input?.title || (isInteractive && steps.length > 1)\"\n class=\"text-12 border-b border-surface-3 text-word-3 bg-surface-1\">\n <div\n v-if=\"toolPart.input?.title\"\n class=\"px-sm py-10 font-bold\"\n :class=\"{\n 'border-b border-surface-3':\n isInteractive && steps.length > 1,\n }\">\n {{ toolPart.input?.title }}\n </div>\n <!-- Progress for multi-step -->\n <div\n v-if=\"isInteractive && steps.length > 1\"\n class=\"flex flex-col gap-4 p-sm\">\n <div class=\"flex justify-between text-10 text-word-3\">\n <span>\n {{\n $t('showForm.step', {\n current: currentStepIndex + 1,\n total: steps.length,\n })\n }}\n </span>\n <span>{{ progress }}%</span>\n </div>\n <div class=\"h-4 bg-surface-3 rounded-full overflow-hidden\">\n <div\n class=\"h-full bg-word-4 transition-all duration-300\"\n :style=\"{ width: `${progress}%` }\"></div>\n </div>\n </div>\n </div>\n\n <!-- Input Available State -->\n <template v-if=\"isInteractive\">\n <!-- Current Step Content -->\n <div class=\"px-sm py-16 flex flex-col gap-12\">\n <div class=\"leading-normal text-12\">\n <strong class=\"font-semibold\">\n {{ currentStep.question }}\n </strong>\n <PkStreamingMarkdown\n v-if=\"currentStep.message\"\n :markdown=\"currentStep.message\"\n class=\"text-word-2 mt-4\" />\n </div>\n\n <!-- Checkbox list for multi-select -->\n <PkEditorCheckboxButtons\n v-if=\"currentStep.options && currentStep.multiSelect\"\n v-model=\"activeCheckboxValue\"\n :name=\"currentStep.id\"\n :options=\"radioOptions\"\n :readonly=\"!isInteractive\"\n class=\"mb-0\"\n vertical>\n <template\n v-for=\"option in radioOptions\"\n :key=\"option.value\"\n #[option.value]>\n <!-- Shared option layout: label + optional description -->\n <div class=\"text-12\">\n <div class=\"font-semibold\">{{ option.label }}</div>\n <div v-if=\"option.description\" class=\"text-word-3\">\n {{ option.description }}\n </div>\n </div>\n </template>\n </PkEditorCheckboxButtons>\n\n <!-- Radio buttons for single-select -->\n <PkEditorRadioButtons\n v-else-if=\"currentStep.options && !currentStep.multiSelect\"\n v-model=\"scalarValue\"\n :name=\"currentStep.id\"\n :options=\"radioOptions\"\n :readonly=\"!isInteractive\"\n vertical\n class=\"mb-0\"\n @update:model-value=\"onRadioChange\">\n <template\n v-for=\"option in radioOptions\"\n :key=\"option.value\"\n #[option.value]>\n <!-- Shared option layout: label + optional description -->\n <div class=\"text-12\">\n <div class=\"font-semibold\">{{ option.label }}</div>\n <div v-if=\"option.description\" class=\"text-word-3\">\n {{ option.description }}\n </div>\n </div>\n </template>\n </PkEditorRadioButtons>\n\n <!-- Pure Freeform Input (text, number, date) -->\n <div\n v-else-if=\"!currentStep.options\"\n class=\"flex flex-col gap-6 w-full\">\n <VvInputText\n :key=\"currentStep.id\"\n v-model=\"scalarValue\"\n :placeholder=\"\n currentStep.placeholder || $t('placeholder.insert')\n \"\n :type=\"currentStep.type\"\n class=\"w-full\"\n :name=\"currentStep.id\"\n modifiers=\"compact\"\n :disabled=\"!isInteractive\"\n @keyup.enter=\"goNext\" />\n </div>\n </div>\n\n <!-- Custom footer freeform input (shown alongside options when allowFreeformInput) -->\n <div\n v-if=\"currentStep.allowFreeformInput && currentStep.options\"\n class=\"px-sm pb-sm border-t border-surface-3\">\n <form\n class=\"flex gap-xs pt-sm\"\n @submit.prevent=\"submitCustomAnswer\">\n <VvInputText\n :key=\"`${currentStep.id}-custom`\"\n v-model=\"customAnswer\"\n class=\"flex-1\"\n :name=\"`${currentStep.id}-custom`\"\n modifiers=\"compact\"\n :disabled=\"!isInteractive\"\n :placeholder=\"\n currentStep.placeholder ||\n $t('showForm.otherPlaceholder')\n \" />\n </form>\n </div>\n\n <!-- Footer navigation: shown for every step that does not submit\n itself on option pick (see `isSelfSubmitting`). -->\n <div\n v-if=\"!isSelfSubmitting\"\n class=\"px-sm py-10 bg-surface border-t border-surface-3 flex justify-between gap-12\">\n <VvButton\n v-if=\"canGoBack\"\n modifiers=\"action-quiet\"\n icon=\"ri:arrow-left-s-line\"\n :label=\"$t('action.back')\"\n @click.stop=\"goBack\" />\n <div v-else></div>\n\n <VvButton\n :modifiers=\"canGoNext ? 'action-quiet' : 'action-primary'\"\n :icon=\"\n canGoNext\n ? 'ri:arrow-right-s-line'\n : 'ri:send-plane-2-line'\n \"\n icon-position=\"right\"\n :label=\"canGoNext ? $t('action.next') : $t('action.submit')\"\n @click.stop=\"goNext\" />\n </div>\n </template>\n\n <!-- Output Available State (Multi-step Summary) -->\n <template v-else>\n <div class=\"px-sm py-12 bg-surface space-y-10\">\n <ul class=\"flex flex-col gap-8\">\n <li\n v-for=\"(step, index) in steps\"\n :key=\"index\"\n class=\"leading-normal\">\n <div class=\"text-12 text-word-3\">\n {{ step.question }}\n </div>\n <span class=\"text-12 text-word-2 font-semibold\">\n {{ getSummaryValue(step, index) }}\n </span>\n </li>\n </ul>\n </div>\n <div\n class=\"px-sm py-12 bg-surface border-t border-surface-3 flex items-center gap-10\">\n <div\n class=\"w-20 h-20 rounded-full border border-success text-success flex items-center justify-center\">\n <VvIcon name=\"ri:check-line\" class=\"text-12\" />\n </div>\n <div class=\"flex flex-col\">\n <span\n class=\"font-semibold text-12 text-word-1 leading-tight\">\n {{ $t('showForm.completed') }}\n </span>\n </div>\n </div>\n </template>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, reactive, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n import { formAnswerSlots, formStepOptions } from './utils'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkEditorRadioButtons from '../PkEditorRadioButtons.vue'\n import PkEditorCheckboxButtons from '../PkEditorCheckboxButtons.vue'\n\n // --- Types ---\n\n interface FormOption {\n label: string\n description?: string\n }\n\n interface FormStep {\n id: string\n question: string\n message?: string\n type?: 'text' | 'number' | 'date'\n options?: FormOption[]\n multiSelect?: boolean\n allowFreeformInput?: boolean\n placeholder?: string\n }\n\n interface FormAnswer {\n id: string\n value: string | string[] | number | null\n }\n\n interface ToolPartShape {\n state?: 'input-available' | 'output-available' | 'output-error'\n toolCallId?: string\n // AI SDK v5 encodes the tool name in `type` (e.g. 'tool-showMultipleChoice').\n // `toolName` is kept for backward compatibility but is normally absent.\n type?: string\n toolName?: string\n input?: {\n title?: string\n steps?: FormStep[]\n // Legacy showMultipleChoice fields\n question?: string\n options?: (string | FormOption)[]\n }\n // The web card submits `{ answers: [...] }`; the platform channels\n // (Teams modal) submit a flat record keyed by step id.\n output?: string | { answers: FormAnswer[] } | Record<string, unknown>\n }\n\n type AnswerValue = string | string[] | number | null\n\n // --- Props & Emits ---\n\n const props = defineProps<{\n part: unknown\n allowCustomAnswer?: boolean\n /**\n * Answered during a call. Nothing in the part says so (the answer went\n * to the agent as speech, not to the tool call), so the surface that\n * sent it is the only one that knows, and without it the same form\n * could be submitted again and again.\n */\n answered?: boolean\n }>()\n\n const emit = defineEmits<{\n select: [answer: string | { answers: FormAnswer[] }]\n }>()\n\n const { t: $t, d: $d } = useI18n({ useScope: 'global' })\n\n // --- Parsed tool part ---\n\n const toolPart = computed(\n () => JSON.parse(JSON.stringify(props.part)) as ToolPartShape,\n )\n\n const isLegacy = computed(\n () =>\n toolPart.value.toolName === 'showMultipleChoice' ||\n toolPart.value.type === 'tool-showMultipleChoice',\n )\n\n /**\n * A form drawn during a CALL is already \"answered\" as far as the tool loop\n * is concerned: the turn could not wait for it, so the backend closed it\n * with a note saying the widget was drawn (see `isVoiceRenderAck`). That\n * note is not an answer, and the caller still has to give one.\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n const isInteractive = computed(\n () =>\n !props.answered &&\n (toolPart.value.state === 'input-available' || isRenderAck.value),\n )\n\n /** Single-step with no custom-answer and no freeform → auto-submit on option pick */\n const isAutoSubmitStep = computed(() => {\n const step = currentStep.value\n if (!step) return false\n return (\n steps.value.length === 1 &&\n !step.allowFreeformInput &&\n !props.allowCustomAnswer\n )\n })\n\n /** Legacy tool should auto-submit on option pick regardless of allowCustomAnswer */\n const isLegacyAutoSubmit = computed(\n () =>\n isLegacy.value &&\n steps.value.length === 1 &&\n !currentStep.value?.multiSelect,\n )\n\n /**\n * True only for the steps that send themselves as soon as an option is\n * picked: the single case where the footer button would be redundant.\n * Every other shape needs it, single-step forms included: with\n * `allowFreeformInput` (or `allowCustomAnswer`) the radio pick no longer\n * auto-submits, so without the footer the user was left with a chosen\n * option and no way to send it.\n */\n const isSelfSubmitting = computed(\n () =>\n Boolean(currentStep.value?.options) &&\n !currentStep.value?.multiSelect &&\n (isAutoSubmitStep.value || isLegacyAutoSubmit.value),\n )\n\n // --- Steps ---\n\n const steps = computed<FormStep[]>(() => {\n const input = toolPart.value.input\n if (input?.steps?.length) {\n return input.steps\n }\n // Legacy showMultipleChoice → normalize into a single step\n if (input?.question && input?.options) {\n return [\n {\n id: 'legacy',\n question: input.question,\n options: input.options.map((o) =>\n typeof o === 'string' ? { label: o } : o,\n ),\n },\n ]\n }\n return []\n })\n\n /**\n * The reason the card has nothing to draw. A call the SDK rejected keeps\n * `state: 'output-error'` and moves the arguments it could not validate to\n * `rawInput`, so `input` is empty and there are no steps: without this the\n * component rendered NOTHING, and the user was left with a question that\n * had been announced and never appeared.\n */\n const hasFailed = computed(\n () => toolPart.value.state === 'output-error' && !steps.value.length,\n )\n\n // --- Navigation state ---\n\n const currentStepIndex = ref(0)\n const currentStep = computed(() => steps.value[currentStepIndex.value])\n const canGoBack = computed(() => currentStepIndex.value > 0)\n const canGoNext = computed(\n () => currentStepIndex.value < steps.value.length - 1,\n )\n const isMultiStep = computed(() => steps.value.length > 1)\n\n const progress = computed(() => {\n if (!isMultiStep.value) return null\n return Math.round(\n ((currentStepIndex.value + 1) / steps.value.length) * 100,\n )\n })\n\n // --- Answers ---\n\n /**\n * One slot PER STEP, keyed by position and not by step id: the ids come\n * from the model and nothing enforces they are unique, and keyed by id two\n * steps sharing one collapsed onto a single answer. See `formAnswerSlots`.\n */\n const answers = reactive<Record<number, AnswerValue>>({})\n const customAnswer = ref('')\n\n // The freeform field belongs to the step showing it: text left behind\n // (unsubmitted, or arriving from a late input update) must not follow the\n // user to the next or previous question.\n watch(currentStepIndex, () => {\n customAnswer.value = ''\n })\n\n // Single scalar answer shared by radio buttons and freeform text/number/date inputs.\n const scalarValue = computed<string | number | undefined>({\n get: () => {\n const val = currentStep.value\n ? answers[currentStepIndex.value]\n : undefined\n if (val == null || Array.isArray(val)) return undefined\n return val\n },\n set: (val) => {\n if (currentStep.value) {\n answers[currentStepIndex.value] = val ?? null\n }\n },\n })\n\n const activeCheckboxValue = computed<unknown[] | undefined>({\n get: () => {\n const val = currentStep.value\n ? answers[currentStepIndex.value]\n : undefined\n return Array.isArray(val) ? val : []\n },\n set: (val) => {\n if (currentStep.value) {\n answers[currentStepIndex.value] = (val as string[]) ?? []\n }\n },\n })\n\n // --- Initialize answers from existing output ---\n\n /** The `{ answers: [...] }` list, when the output carries one. */\n function outputAnswers(output: ToolPartShape['output']) {\n if (!output || typeof output === 'string') return undefined\n const list = (output as { answers?: unknown }).answers\n return Array.isArray(list) ? (list as FormAnswer[]) : undefined\n }\n\n watch(\n () => toolPart.value.output,\n (output) => {\n if (!output || isVoiceRenderAck(output)) return\n // Every shape an answered form comes back in (the web card's list,\n // a legacy plain string, the flat record a platform channel posts)\n // lands on the same per-position slots: see `formAnswerSlots`.\n Object.assign(\n answers,\n formAnswerSlots(steps.value, output) as Record<\n number,\n AnswerValue\n >,\n )\n },\n { immediate: true },\n )\n\n // --- Restore custom answer from output when it doesn't match any option ---\n\n const normalizedOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || isVoiceRenderAck(out)) return undefined\n if (typeof out === 'string') return out\n const list = outputAnswers(out)\n if (list?.length === 1) {\n const val = list[0].value\n return Array.isArray(val) ? val.join(', ') : String(val)\n }\n return undefined\n })\n\n watch(\n normalizedOutput,\n (value) => {\n if (!value || !currentStep.value) return\n const optionLabels = (currentStep.value.options ?? []).map(\n (o) => o.label,\n )\n if (!optionLabels.includes(value)) {\n customAnswer.value = value\n }\n },\n { immediate: true },\n )\n\n // --- Option mapping for radio/checkbox components ---\n\n const radioOptions = computed(() => formStepOptions(currentStep.value))\n\n // --- Navigation & Submission ---\n\n /** Footer button, and Enter on a pure freeform step. */\n function goNext() {\n // A typed freeform answer wins over the picked option: it is the more\n // recent intent, and the footer button is now the visible way to send\n // it (the freeform field only submits on Enter).\n if (customAnswer.value.trim()) {\n submitCustomAnswer()\n return\n }\n if (canGoNext.value) {\n currentStepIndex.value++\n } else {\n submitForm()\n }\n }\n\n function goBack() {\n if (canGoBack.value) {\n currentStepIndex.value--\n }\n }\n\n function submitForm() {\n if (!isInteractive.value) return\n\n const finalAnswers: FormAnswer[] = steps.value.map((step, index) => ({\n id: step.id,\n value: answers[index] ?? null,\n }))\n\n // Legacy backward compatibility: single-step, single-select → return plain string\n if (\n isLegacyAutoSubmit.value &&\n !currentStep.value?.allowFreeformInput\n ) {\n const val = finalAnswers[0].value\n emit('select', Array.isArray(val) ? val[0] : (val as string))\n } else {\n emit('select', { answers: finalAnswers })\n }\n }\n\n /** Enter inside the freeform field shown alongside the options. */\n function submitCustomAnswer() {\n const value = customAnswer.value.trim()\n if (!value) return\n\n answers[currentStepIndex.value] = value\n // Cleared before navigating: `goNext()` reads it back to route a typed\n // answer here, so leaving it set would recurse.\n customAnswer.value = ''\n if (steps.value.length === 1) {\n submitForm()\n } else {\n goNext()\n }\n }\n\n function onRadioChange() {\n if (!isInteractive.value) return\n if (isAutoSubmitStep.value || isLegacyAutoSubmit.value) {\n submitForm()\n }\n }\n\n // --- Summary helpers ---\n\n function getSummaryValue(step: FormStep, index: number) {\n const val = answers[index]\n if (val == null) return '—'\n if (Array.isArray(val)) return val.join(', ')\n if (step.type === 'date') return $d(new Date(val), 'short')\n return val\n }\n</script>\n\n<template>\n <div\n v-if=\"hasFailed\"\n class=\"text-12 text-danger flex items-center gap-6 py-8\">\n <span class=\"i-vv-alert-circle text-16 shrink-0\" />\n <span>{{ $t('message.formRenderError') }}</span>\n </div>\n <div\n v-else-if=\"steps.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden flex flex-col bg-surface\">\n <!-- Header -->\n <div\n v-if=\"toolPart.input?.title || (isInteractive && steps.length > 1)\"\n class=\"text-12 border-b border-surface-3 text-word-3 bg-surface-1\">\n <div\n v-if=\"toolPart.input?.title\"\n class=\"px-sm py-10 font-bold\"\n :class=\"{\n 'border-b border-surface-3':\n isInteractive && steps.length > 1,\n }\">\n {{ toolPart.input?.title }}\n </div>\n <!-- Progress for multi-step -->\n <div\n v-if=\"isInteractive && steps.length > 1\"\n class=\"flex flex-col gap-4 p-sm\">\n <div class=\"flex justify-between text-10 text-word-3\">\n <span>\n {{\n $t('showForm.step', {\n current: currentStepIndex + 1,\n total: steps.length,\n })\n }}\n </span>\n <span>{{ progress }}%</span>\n </div>\n <div class=\"h-4 bg-surface-3 rounded-full overflow-hidden\">\n <div\n class=\"h-full bg-word-4 transition-all duration-300\"\n :style=\"{ width: `${progress}%` }\"></div>\n </div>\n </div>\n </div>\n\n <!-- Input Available State -->\n <template v-if=\"isInteractive\">\n <!-- Current Step Content -->\n <div class=\"px-sm py-16 flex flex-col gap-12\">\n <div class=\"leading-normal text-12\">\n <strong class=\"font-semibold\">\n {{ currentStep.question }}\n </strong>\n <PkStreamingMarkdown\n v-if=\"currentStep.message\"\n :markdown=\"currentStep.message\"\n class=\"text-word-2 mt-4\" />\n </div>\n\n <!-- Checkbox list for multi-select -->\n <PkEditorCheckboxButtons\n v-if=\"currentStep.options && currentStep.multiSelect\"\n v-model=\"activeCheckboxValue\"\n :name=\"currentStep.id\"\n :options=\"radioOptions\"\n :readonly=\"!isInteractive\"\n class=\"mb-0\"\n vertical>\n <template\n v-for=\"option in radioOptions\"\n :key=\"option.value\"\n #[option.value]>\n <!-- Shared option layout: label + optional description -->\n <div class=\"text-12\">\n <div class=\"font-semibold\">{{ option.label }}</div>\n <div v-if=\"option.description\" class=\"text-word-3\">\n {{ option.description }}\n </div>\n </div>\n </template>\n </PkEditorCheckboxButtons>\n\n <!-- Radio buttons for single-select -->\n <PkEditorRadioButtons\n v-else-if=\"currentStep.options && !currentStep.multiSelect\"\n v-model=\"scalarValue\"\n :name=\"currentStep.id\"\n :options=\"radioOptions\"\n :readonly=\"!isInteractive\"\n vertical\n class=\"mb-0\"\n @update:model-value=\"onRadioChange\">\n <template\n v-for=\"option in radioOptions\"\n :key=\"option.value\"\n #[option.value]>\n <!-- Shared option layout: label + optional description -->\n <div class=\"text-12\">\n <div class=\"font-semibold\">{{ option.label }}</div>\n <div v-if=\"option.description\" class=\"text-word-3\">\n {{ option.description }}\n </div>\n </div>\n </template>\n </PkEditorRadioButtons>\n\n <!-- Pure Freeform Input (text, number, date) -->\n <div\n v-else-if=\"!currentStep.options\"\n class=\"flex flex-col gap-6 w-full\">\n <VvInputText\n :key=\"currentStep.id\"\n v-model=\"scalarValue\"\n :placeholder=\"\n currentStep.placeholder || $t('placeholder.insert')\n \"\n :type=\"currentStep.type\"\n class=\"w-full\"\n :name=\"currentStep.id\"\n modifiers=\"compact\"\n :disabled=\"!isInteractive\"\n @keyup.enter=\"goNext\" />\n </div>\n </div>\n\n <!-- Custom footer freeform input (shown alongside options when allowFreeformInput) -->\n <div\n v-if=\"currentStep.allowFreeformInput && currentStep.options\"\n class=\"px-sm pb-sm border-t border-surface-3\">\n <form\n class=\"flex gap-xs pt-sm\"\n @submit.prevent=\"submitCustomAnswer\">\n <VvInputText\n :key=\"`${currentStep.id}-custom`\"\n v-model=\"customAnswer\"\n class=\"flex-1\"\n :name=\"`${currentStep.id}-custom`\"\n modifiers=\"compact\"\n :disabled=\"!isInteractive\"\n :placeholder=\"\n currentStep.placeholder ||\n $t('showForm.otherPlaceholder')\n \" />\n </form>\n </div>\n\n <!-- Footer navigation: shown for every step that does not submit\n itself on option pick (see `isSelfSubmitting`). -->\n <div\n v-if=\"!isSelfSubmitting\"\n class=\"px-sm py-10 bg-surface border-t border-surface-3 flex justify-between gap-12\">\n <VvButton\n v-if=\"canGoBack\"\n modifiers=\"action-quiet\"\n icon=\"ri:arrow-left-s-line\"\n :label=\"$t('action.back')\"\n @click.stop=\"goBack\" />\n <div v-else></div>\n\n <VvButton\n :modifiers=\"canGoNext ? 'action-quiet' : 'action-primary'\"\n :icon=\"\n canGoNext\n ? 'ri:arrow-right-s-line'\n : 'ri:send-plane-2-line'\n \"\n icon-position=\"right\"\n :label=\"canGoNext ? $t('action.next') : $t('action.submit')\"\n @click.stop=\"goNext\" />\n </div>\n </template>\n\n <!-- Output Available State (Multi-step Summary) -->\n <template v-else>\n <div class=\"px-sm py-12 bg-surface space-y-10\">\n <ul class=\"flex flex-col gap-8\">\n <li\n v-for=\"(step, index) in steps\"\n :key=\"index\"\n class=\"leading-normal\">\n <div class=\"text-12 text-word-3\">\n {{ step.question }}\n </div>\n <span class=\"text-12 text-word-2 font-semibold\">\n {{ getSummaryValue(step, index) }}\n </span>\n </li>\n </ul>\n </div>\n <div\n class=\"px-sm py-12 bg-surface border-t border-surface-3 flex items-center gap-10\">\n <div\n class=\"w-20 h-20 rounded-full border border-success text-success flex items-center justify-center\">\n <VvIcon name=\"ri:check-line\" class=\"text-12\" />\n </div>\n <div class=\"flex flex-col\">\n <span\n class=\"font-semibold text-12 text-word-1 leading-tight\">\n {{ $t('showForm.completed') }}\n </span>\n </div>\n </div>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAII,IAAM,IAAQ,GAmBR,IAAa,EAElB,GAAA,YAAuB,GA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