@8wave/ai-elements 0.125.0-beta.42 → 0.125.0-beta.44

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.
Files changed (145) hide show
  1. package/README.md +9 -4
  2. package/dist/_chunks/Chart-1vt0m6l_.js +87 -0
  3. package/dist/_chunks/Chart-1vt0m6l_.js.map +1 -0
  4. package/dist/_chunks/{PkChart-CbtMRGWc.js → PkChart-CYFx_UDq.js} +741 -623
  5. package/dist/_chunks/PkChart-CYFx_UDq.js.map +1 -0
  6. package/dist/_chunks/PkFilePreview-DfYzaj3Y.js +1745 -0
  7. package/dist/_chunks/PkFilePreview-DfYzaj3Y.js.map +1 -0
  8. package/dist/_chunks/{PkFilePreviewDialog-bcTkTcYk.js → PkFilePreviewDialog-COkwyLq6.js} +2 -2
  9. package/dist/_chunks/{PkFilePreviewDialog-bcTkTcYk.js.map → PkFilePreviewDialog-COkwyLq6.js.map} +1 -1
  10. package/dist/_chunks/{PkImageEditorDialog-FpbyhV3t.js → PkImageEditorDialog-Ceas-HZA.js} +2 -2
  11. package/dist/_chunks/{PkImageEditorDialog-FpbyhV3t.js.map → PkImageEditorDialog-Ceas-HZA.js.map} +1 -1
  12. package/dist/_chunks/{PkSelectionActions-BbfVZY0R.js → PkSelectionActions-Dl3cKb7x.js} +2 -2
  13. package/dist/_chunks/PkSelectionActions-Dl3cKb7x.js.map +1 -0
  14. package/dist/_chunks/{PkStreamingMarkdown-COSOOhCg.js → PkStreamingMarkdown-DZvLHy2l.js} +2 -2
  15. package/dist/_chunks/{PkStreamingMarkdown-COSOOhCg.js.map → PkStreamingMarkdown-DZvLHy2l.js.map} +1 -1
  16. package/dist/_chunks/{PkToolChatFile-C_gS0X1j.js → PkToolChatFile-D4ukZ9g6.js} +3 -3
  17. package/dist/_chunks/{PkToolChatFile-C_gS0X1j.js.map → PkToolChatFile-D4ukZ9g6.js.map} +1 -1
  18. package/dist/_chunks/{PkToolShowArtifact-fpFtKrZo.js → PkToolShowArtifact-wIAxyXrL.js} +2 -2
  19. package/dist/_chunks/{PkToolShowArtifact-fpFtKrZo.js.map → PkToolShowArtifact-wIAxyXrL.js.map} +1 -1
  20. package/dist/_chunks/PkToolShowChart-D3E_xBJv.js +138 -0
  21. package/dist/_chunks/PkToolShowChart-D3E_xBJv.js.map +1 -0
  22. package/dist/_chunks/{PkToolShowContactForm-BAM772bm.js → PkToolShowContactForm-BhcM-Z6m.js} +2 -2
  23. package/dist/_chunks/{PkToolShowContactForm-BAM772bm.js.map → PkToolShowContactForm-BhcM-Z6m.js.map} +1 -1
  24. package/dist/_chunks/{PkToolShowForm-DJcL0bgw.js → PkToolShowForm-D6k7_QLF.js} +3 -3
  25. package/dist/_chunks/{PkToolShowForm-DJcL0bgw.js.map → PkToolShowForm-D6k7_QLF.js.map} +1 -1
  26. package/dist/_chunks/{PkToolShowSources-GeWAMHYC.js → PkToolShowSources-Cw1ofky2.js} +2 -2
  27. package/dist/_chunks/{PkToolShowSources-GeWAMHYC.js.map → PkToolShowSources-Cw1ofky2.js.map} +1 -1
  28. package/dist/_chunks/chartFormat-B1T7y-16.js +27 -0
  29. package/dist/_chunks/chartFormat-B1T7y-16.js.map +1 -0
  30. package/dist/_chunks/{excelNumberFormat-BhQjife9.js → excelNumberFormat-CcXF_wJK.js} +101 -88
  31. package/dist/_chunks/excelNumberFormat-CcXF_wJK.js.map +1 -0
  32. package/dist/_chunks/{utils-DMvy5QRR.js → utils-C2aFWWye.js} +132 -110
  33. package/dist/_chunks/utils-C2aFWWye.js.map +1 -0
  34. package/dist/ai-elements.es.js +2939 -2882
  35. package/dist/ai-elements.es.js.map +1 -1
  36. package/dist-vue/PkChatbot.js +1 -1
  37. package/dist-vue/PkChatbotEmptyState.js +1 -1
  38. package/dist-vue/PkChatbotInput.js +1 -1
  39. package/dist-vue/PkChatbotMessages.js +1 -1
  40. package/dist-vue/PkChatbotStepPayload.js +1 -1
  41. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  42. package/dist-vue/PkChatbotSteps.js +1 -1
  43. package/dist-vue/PkChatbotViewChat.js +1 -1
  44. package/dist-vue/PkChatbotViewConversations.js +1 -1
  45. package/dist-vue/_chunks/Chart-DsBNs5rS.js +87 -0
  46. package/dist-vue/_chunks/Chart-DsBNs5rS.js.map +1 -0
  47. package/dist-vue/_chunks/{PkChart-D-K7nc0g.js → PkChart-CrZqhEpp.js} +112 -74
  48. package/dist-vue/_chunks/PkChart-CrZqhEpp.js.map +1 -0
  49. package/dist-vue/_chunks/{PkChatbot-DVQ-Bb7n.js → PkChatbot-CBSe9MOB.js} +6 -6
  50. package/dist-vue/_chunks/{PkChatbot-DVQ-Bb7n.js.map → PkChatbot-CBSe9MOB.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkChatbotEmptyState-OlgewA4_.js → PkChatbotEmptyState-DfyYZXHQ.js} +2 -2
  52. package/dist-vue/_chunks/{PkChatbotEmptyState-OlgewA4_.js.map → PkChatbotEmptyState-DfyYZXHQ.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkChatbotInput-D_I0Gf_u.js → PkChatbotInput-CBalSveL.js} +4 -4
  54. package/dist-vue/_chunks/{PkChatbotInput-D_I0Gf_u.js.map → PkChatbotInput-CBalSveL.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkChatbotMessages-CAXnEfXK.js → PkChatbotMessages-C2AUTqk4.js} +307 -307
  56. package/dist-vue/_chunks/{PkChatbotMessages-CAXnEfXK.js.map → PkChatbotMessages-C2AUTqk4.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkChatbotStepPayload-EBri1L10.js → PkChatbotStepPayload-Bb3Y6kuL.js} +2 -2
  58. package/dist-vue/_chunks/{PkChatbotStepPayload-EBri1L10.js.map → PkChatbotStepPayload-Bb3Y6kuL.js.map} +1 -1
  59. package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiQEa0UV.js → PkChatbotStepToolDetail-CwOxzYOe.js} +16 -16
  60. package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiQEa0UV.js.map → PkChatbotStepToolDetail-CwOxzYOe.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkChatbotSteps-BgLnv2J1.js → PkChatbotSteps-FduD9X9i.js} +38 -38
  62. package/dist-vue/_chunks/{PkChatbotSteps-BgLnv2J1.js.map → PkChatbotSteps-FduD9X9i.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkChatbotViewChat-CmjD1IXf.js → PkChatbotViewChat-jl3ZbK7H.js} +22 -22
  64. package/dist-vue/_chunks/{PkChatbotViewChat-CmjD1IXf.js.map → PkChatbotViewChat-jl3ZbK7H.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkChatbotViewConversations-CVZH5dXx.js → PkChatbotViewConversations-BtwTWqmM.js} +2 -2
  66. package/dist-vue/_chunks/{PkChatbotViewConversations-CVZH5dXx.js.map → PkChatbotViewConversations-BtwTWqmM.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkFilePreview-k5gEl3n8.js → PkFilePreview-CRfDEYYo.js} +701 -624
  68. package/dist-vue/_chunks/PkFilePreview-CRfDEYYo.js.map +1 -0
  69. package/dist-vue/_chunks/{PkFilePreviewDialog-DUwZPErE.js → PkFilePreviewDialog-u-0rhuRx.js} +2 -2
  70. package/dist-vue/_chunks/{PkFilePreviewDialog-DUwZPErE.js.map → PkFilePreviewDialog-u-0rhuRx.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkImageEditorDialog-DQPXePae.js → PkImageEditorDialog-CjMwpb-a.js} +2 -2
  72. package/dist-vue/_chunks/{PkImageEditorDialog-DQPXePae.js.map → PkImageEditorDialog-CjMwpb-a.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkStreamingMarkdown-ZasabxE0.js → PkStreamingMarkdown-7Kl_VBH-.js} +2 -2
  74. package/dist-vue/_chunks/{PkStreamingMarkdown-ZasabxE0.js.map → PkStreamingMarkdown-7Kl_VBH-.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkToolChatFile-CD26Q2xp.js → PkToolChatFile-DcNRCVXy.js} +3 -3
  76. package/dist-vue/_chunks/{PkToolChatFile-CD26Q2xp.js.map → PkToolChatFile-DcNRCVXy.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolShowArtifact-BhVd_ZQ8.js → PkToolShowArtifact-C7CxCqVO.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolShowArtifact-BhVd_ZQ8.js.map → PkToolShowArtifact-C7CxCqVO.js.map} +1 -1
  79. package/dist-vue/_chunks/PkToolShowChart-DULlrMjq.js +133 -0
  80. package/dist-vue/_chunks/PkToolShowChart-DULlrMjq.js.map +1 -0
  81. package/dist-vue/_chunks/{PkToolShowContactForm-CackCDGD.js → PkToolShowContactForm-472d-SAE.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolShowContactForm-CackCDGD.js.map → PkToolShowContactForm-472d-SAE.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShowDiagram-CABPsFi8.js → PkToolShowDiagram-RrqVpOaX.js} +2 -2
  84. package/dist-vue/_chunks/{PkToolShowDiagram-CABPsFi8.js.map → PkToolShowDiagram-RrqVpOaX.js.map} +1 -1
  85. package/dist-vue/_chunks/{PkToolShowForm-BStbk4Iu.js → PkToolShowForm-CgyszDEI.js} +3 -3
  86. package/dist-vue/_chunks/{PkToolShowForm-BStbk4Iu.js.map → PkToolShowForm-CgyszDEI.js.map} +1 -1
  87. package/dist-vue/_chunks/{PkToolShowImageGallery-BeeHsdTp.js → PkToolShowImageGallery-LBx9JE6p.js} +2 -2
  88. package/dist-vue/_chunks/{PkToolShowImageGallery-BeeHsdTp.js.map → PkToolShowImageGallery-LBx9JE6p.js.map} +1 -1
  89. package/dist-vue/_chunks/{PkToolShowProductList-BfUiap9U.js → PkToolShowProductList-THiH4EzZ.js} +2 -2
  90. package/dist-vue/_chunks/{PkToolShowProductList-BfUiap9U.js.map → PkToolShowProductList-THiH4EzZ.js.map} +1 -1
  91. package/dist-vue/_chunks/{PkToolShowSources-CgEkcyRg.js → PkToolShowSources-CEqGXOOt.js} +2 -2
  92. package/dist-vue/_chunks/{PkToolShowSources-CgEkcyRg.js.map → PkToolShowSources-CEqGXOOt.js.map} +1 -1
  93. package/dist-vue/_chunks/{PkToolShowVideo-CqSRnDNC.js → PkToolShowVideo-8Gi3vOer.js} +2 -2
  94. package/dist-vue/_chunks/{PkToolShowVideo-CqSRnDNC.js.map → PkToolShowVideo-8Gi3vOer.js.map} +1 -1
  95. package/dist-vue/_chunks/{PkToolShowWebPages-B-qIS8qY.js → PkToolShowWebPages-xjUPdfOU.js} +2 -2
  96. package/dist-vue/_chunks/{PkToolShowWebPages-B-qIS8qY.js.map → PkToolShowWebPages-xjUPdfOU.js.map} +1 -1
  97. package/dist-vue/_chunks/chartFormat-B1T7y-16.js +27 -0
  98. package/dist-vue/_chunks/chartFormat-B1T7y-16.js.map +1 -0
  99. package/dist-vue/_chunks/{excelNumberFormat-C1sCQrOz.js → excelNumberFormat-BxRi0Y3e.js} +101 -88
  100. package/dist-vue/_chunks/excelNumberFormat-BxRi0Y3e.js.map +1 -0
  101. package/dist-vue/_chunks/{utils-KBB6SDPn.js → utils-VVbH-Liq.js} +30 -30
  102. package/dist-vue/_chunks/utils-VVbH-Liq.js.map +1 -0
  103. package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +6 -6
  104. package/dist-vue/apps/web-component/src/composables/useSelectionActions.d.ts +14 -4
  105. package/dist-vue/composables.js +9 -3
  106. package/dist-vue/composables.js.map +1 -1
  107. package/dist-vue/index.js +42 -42
  108. package/dist-vue/index.js.map +1 -1
  109. package/dist-vue/locales.js +6 -0
  110. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +6 -6
  111. package/dist-vue/packages/components/src/chat/PkChart.d.ts +8 -0
  112. package/dist-vue/packages/components/src/chat/PkChatbotMessages.d.ts +1 -1
  113. package/dist-vue/packages/components/src/chat/PkFileChart.d.ts +14 -0
  114. package/dist-vue/packages/components/src/chat/PkSelectionActionIconPicker.d.ts +2 -2
  115. package/dist-vue/packages/components/src/chat/PkSelectionAnswerCard.d.ts +6 -0
  116. package/dist-vue/packages/components/src/chat/PkWordPreviewRuns.d.ts +4 -1
  117. package/dist-vue/packages/components/src/chat/selectionActionEdits.d.ts +1 -1
  118. package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +240 -0
  119. package/dist-vue/packages/components/src/chat/utils.d.ts +57 -5
  120. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +18 -18
  121. package/dist-vue/packages/composable/src/useSettledSelection.d.ts +2 -2
  122. package/dist-vue/packages/models/src/schema/Agent.d.ts +21 -21
  123. package/dist-vue/packages/models/src/schema/Chart.d.ts +91 -0
  124. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +6 -6
  125. package/dist-vue/packages/models/src/schema/SelectionAction.d.ts +11 -11
  126. package/dist-vue/packages/models/src/schema/SelectionActionPreview.d.ts +3 -3
  127. package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +381 -0
  128. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +6 -6
  129. package/dist-vue/packages/models/src/schema/WordPreview.d.ts +304 -0
  130. package/dist-vue/style.css +1 -1
  131. package/package.json +1 -1
  132. package/dist/_chunks/PkChart-CbtMRGWc.js.map +0 -1
  133. package/dist/_chunks/PkFilePreview-DC4iX7Yc.js +0 -1665
  134. package/dist/_chunks/PkFilePreview-DC4iX7Yc.js.map +0 -1
  135. package/dist/_chunks/PkSelectionActions-BbfVZY0R.js.map +0 -1
  136. package/dist/_chunks/PkToolShowChart-DZWu3Yuo.js +0 -224
  137. package/dist/_chunks/PkToolShowChart-DZWu3Yuo.js.map +0 -1
  138. package/dist/_chunks/excelNumberFormat-BhQjife9.js.map +0 -1
  139. package/dist/_chunks/utils-DMvy5QRR.js.map +0 -1
  140. package/dist-vue/_chunks/PkChart-D-K7nc0g.js.map +0 -1
  141. package/dist-vue/_chunks/PkFilePreview-k5gEl3n8.js.map +0 -1
  142. package/dist-vue/_chunks/PkToolShowChart-BQXxaPIO.js +0 -217
  143. package/dist-vue/_chunks/PkToolShowChart-BQXxaPIO.js.map +0 -1
  144. package/dist-vue/_chunks/excelNumberFormat-C1sCQrOz.js.map +0 -1
  145. package/dist-vue/_chunks/utils-KBB6SDPn.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkSelectionActions-BbfVZY0R.js","names":["settled","_useModel","__unplugin_components_0","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_withKeys","_withModifiers","_withDirectives","_createElementVNode","_vModelText","_toDisplayString","_unref","_Fragment","_createVNode","_createTextVNode","_createCommentVNode","_renderList","_sfc_main","_style_0","normalizeClass","nextTick","useModel","mergeModels","normalizeStyle","createVNode","init_shared_esm_bundler","renderList","useTemplateRef","vModelText","withModifiers","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","withDirectives","init_reactivity_esm_bundler","onScopeDispose","init_runtime_dom_esm_bundler","withKeys","createCommentVNode","shallowRef","unref","createTextVNode","createElementBlock","openBlock","useI18n","selectionBarPosition","useElementSize","Ee","_plugin_vue_export_helper_default","FINE_POINTER","TOUCH_SCREEN","TOUCH_DELAY","isTouchScreen","rangeIn","selection","root","shadow","ranges","first","range","own","useSettledSelection","timer","clear","read","node","enabled","minChars","box","finePointer","byTouch","touch","wait","delay","onChange","MAX_ALIGNED_PAIRS","unmatchedItems","start","before","after","end","n","m","out","gap","j","j0","j1","i","i0","i1","lengths","withoutIds","key","value","contentOf","changedCellIds","idsOf","cells","c","was","old","cell","wordChanges","paragraphs","blocks","b","block","id","cellContents","sheet","preview","spreadsheetChanges","s","now","changed","at","content","chatFilePreviewChanges","revealFirstChange","el","scroller","selector","SELECTION_ACTION_ICON_NAMES","agentActionIcon","icon","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","PkSelectionActions_default","defineComponent","\"asking\"","\"askingModifiers\"","__emit","BUILT_IN_ICONS","props","__props","emit","asking","$t","barEl","inputEl","position","width","height","field","text","openField","closeField","openAsk","iconOf","action","run","onTap","row","event","under","act","submit","onEscape","_component_VvIcon","_cache","$event"],"sources":["../../../../packages/composable/src/useSettledSelection.ts","../../../../packages/components/src/chat/previewChanges.ts","../../../../packages/components/src/chat/selectionActionIcons.ts","../../../../packages/components/src/chat/PkSelectionActions.vue","../../../../packages/components/src/chat/PkSelectionActions.vue","../../../../packages/components/src/chat/PkSelectionActions.vue"],"sourcesContent":["import { onScopeDispose, shallowRef, type ShallowRef } from 'vue'\n\n/** A selection that stayed still: its range and where it is on screen. */\nexport interface SettledSelection {\n range: Range\n /** The box of its first line: a bar goes above the start of a selection. */\n start: DOMRect\n /** The box of the whole selection. */\n box: DOMRect\n}\n\nexport interface UseSettledSelectionOptions {\n /** Where the range is read: the document, or the shadow root the selection is in. */\n root: () => Document | ShadowRoot | null | undefined\n /** Held off while false: the page while the user points, under a modal, during a turn. */\n enabled?: () => boolean\n /** How long the selection stays still before it counts, in ms. */\n delay?: number\n /** The shortest text that counts. */\n minChars?: number\n /**\n * Also on a touch screen, where the bar goes below the selection, away\n * from the system's menu: the chat's file viewer (spec\n * `chat-file-selection-edit.md`, F4). The page leaves a touch selection\n * to the system's menu (spec `selection-actions.md`, F3).\n */\n touch?: boolean\n}\n\n/** A pointer that hovers: on a touch screen the system has its own menu on a selection. */\nconst FINE_POINTER = '(hover: hover) and (pointer: fine)'\n/** A screen read by touch: no hover, a coarse pointer. */\nconst TOUCH_SCREEN = '(hover: none) and (pointer: coarse)'\n/**\n * How long a touch selection stays still before it counts: the finger rests\n * between two moves of a handle, and the bar would flash below it.\n */\nconst TOUCH_DELAY = 400\n\n/** True on a touch screen, where a selection's bar goes below it. */\nexport function isTouchScreen(): boolean {\n return typeof matchMedia === 'function' && matchMedia(TOUCH_SCREEN).matches\n}\n\ntype ComposedSelection = Selection & {\n getComposedRanges?: (\n ...args: [{ shadowRoots: ShadowRoot[] }] | ShadowRoot[]\n ) => StaticRange[]\n}\n\n/**\n * The first range of the selection, read inside `root`, as a copy: the\n * selection's own range is live, and Chrome collapses it as soon as the\n * focus moves into the bar's field. In a shadow root the document's\n * selection stops at its host: the composed range reads past it (Chrome 137,\n * Safari 17, Firefox 142; Safari took the roots as arguments before the\n * options object), and Chromium's own selection of the root is the fallback.\n * Without either nothing is read, and no bar appears.\n */\nfunction rangeIn(root: Document | ShadowRoot): Range | undefined {\n const selection = document.getSelection() as ComposedSelection | null\n if (!selection || selection.rangeCount === 0) {\n return undefined\n }\n if (root.nodeType === Node.DOCUMENT_NODE) {\n return selection.getRangeAt(0).cloneRange()\n }\n const shadow = root as ShadowRoot\n if (selection.getComposedRanges) {\n let ranges: StaticRange[]\n try {\n ranges = selection.getComposedRanges({ shadowRoots: [shadow] })\n } catch {\n ranges = selection.getComposedRanges(shadow)\n }\n const [first] = ranges\n if (!first) {\n return undefined\n }\n const range = document.createRange()\n range.setStart(first.startContainer, first.startOffset)\n range.setEnd(first.endContainer, first.endOffset)\n return range\n }\n const own = (\n shadow as ShadowRoot & { getSelection?: () => Selection | null }\n ).getSelection?.()\n return own && own.rangeCount > 0\n ? own.getRangeAt(0).cloneRange()\n : undefined\n}\n\n/**\n * The selection once it stays still (spec `selection-actions.md`, \"Cosa è\n * comune\"): what the bar of actions appears on, on the page that embeds the\n * widget and in the chat's file viewer. `selectionchange` fires on the\n * document wherever the selection is, so the document is always listened to\n * and `root` only says where the range is read. Nothing on a touch screen\n * unless `touch`. Undefined while the selection moves, is collapsed or\n * shorter than `minChars`; each reader then checks that the range is its own.\n */\nexport function useSettledSelection({\n root,\n enabled = () => true,\n delay = 150,\n minChars = 2,\n touch = false,\n}: UseSettledSelectionOptions) {\n const selection = shallowRef<SettledSelection | undefined>()\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const clear = () => {\n clearTimeout(timer)\n selection.value = undefined\n }\n\n const read = (): SettledSelection | undefined => {\n const node = root()\n if (!node || !enabled()) {\n return undefined\n }\n const range = rangeIn(node)\n if (\n !range ||\n range.collapsed ||\n range.toString().trim().length < minChars\n ) {\n return undefined\n }\n const box = range.getBoundingClientRect()\n return { range, start: range.getClientRects()[0] ?? box, box }\n }\n\n const finePointer =\n typeof document !== 'undefined' &&\n typeof matchMedia === 'function' &&\n matchMedia(FINE_POINTER).matches\n const byTouch = touch && typeof document !== 'undefined' && isTouchScreen()\n const wait = byTouch ? Math.max(delay, TOUCH_DELAY) : delay\n\n const onChange = () => {\n clear()\n timer = setTimeout(() => {\n selection.value = read()\n }, wait)\n }\n\n if (finePointer || byTouch) {\n document.addEventListener('selectionchange', onChange)\n onScopeDispose(() => {\n clearTimeout(timer)\n document.removeEventListener('selectionchange', onChange)\n })\n }\n\n // Not `readonly()`: its deep proxy around a Range breaks the Range's methods\n const settled: Readonly<ShallowRef<SettledSelection | undefined>> =\n selection\n return { selection: settled, clear }\n}\n","import type {\n ChatFilePreview,\n SpreadsheetPreview,\n SpreadsheetPreviewSheet,\n WordPreview,\n WordPreviewBlock,\n WordPreviewCell,\n} from 'models'\n\n/**\n * What a version of a file changed from the one the viewer showed before it\n * (spec `chat-file-selection-edit.md`): the paragraphs of a Word document by\n * their ids in the new version, or the cells of each sheet, by its name, as\n * `row:col`. The viewer marks them for a moment when it follows an edit.\n */\nexport type ChatFilePreviewChanges =\n | { kind: 'word'; paragraphs: ReadonlySet<string> }\n | {\n kind: 'spreadsheet'\n cells: ReadonlyMap<string, ReadonlySet<string>>\n }\n\n/**\n * Past this many pairs the middle of the two lists is not aligned: all of\n * the new one there counts as changed. A thousand paragraphs each side.\n */\nconst MAX_ALIGNED_PAIRS = 1_000_000\n\n/**\n * The items of `after` that `before` does not hold in the same order, each\n * with the item of `before` it took the place of, if any: the one at the\n * same distance from the start of the stretch both lists differ in. The\n * common start and end are skipped, the middle is aligned by its longest\n * common subsequence.\n */\nexport const unmatchedItems = (\n before: readonly string[],\n after: readonly string[],\n): Map<number, number | undefined> => {\n let start = 0\n while (\n start < before.length &&\n start < after.length &&\n before[start] === after[start]\n ) {\n start += 1\n }\n let end = 0\n while (\n end < before.length - start &&\n end < after.length - start &&\n before[before.length - 1 - end] === after[after.length - 1 - end]\n ) {\n end += 1\n }\n const n = before.length - start - end\n const m = after.length - start - end\n const out = new Map<number, number | undefined>()\n // Each stretch between two kept items: its new items stand for its old\n // ones in order\n const gap = (i0: number, i1: number, j0: number, j1: number) => {\n for (let j = j0; j < j1; j++) {\n const i = i0 + (j - j0)\n out.set(j, i < i1 ? i : undefined)\n }\n }\n if (!m) {\n return out\n }\n if (!n || n * m > MAX_ALIGNED_PAIRS) {\n gap(start, start + n, start, start + m)\n return out\n }\n // lengths[i * (m + 1) + j]: the longest common subsequence of the old\n // middle from i and the new one from j\n const lengths = new Uint32Array((n + 1) * (m + 1))\n for (let i = n - 1; i >= 0; i--) {\n for (let j = m - 1; j >= 0; j--) {\n lengths[i * (m + 1) + j] =\n before[start + i] === after[start + j]\n ? lengths[(i + 1) * (m + 1) + j + 1] + 1\n : Math.max(\n lengths[(i + 1) * (m + 1) + j],\n lengths[i * (m + 1) + j + 1],\n )\n }\n }\n let i = 0\n let j = 0\n let i0 = 0\n let j0 = 0\n while (i < n && j < m) {\n if (before[start + i] === after[start + j]) {\n gap(start + i0, start + i, start + j0, start + j)\n i += 1\n j += 1\n i0 = i\n j0 = j\n } else if (\n lengths[(i + 1) * (m + 1) + j] >= lengths[i * (m + 1) + j + 1]\n ) {\n i += 1\n } else {\n j += 1\n }\n }\n gap(start + i0, start + n, start + j0, start + m)\n return out\n}\n\n/** A paragraph's id moves when one is added before it: it is not its content. */\nconst withoutIds = (key: string, value: unknown) =>\n key === 'id' || key === 'ids' ? undefined : value\n\nconst contentOf = (value: unknown) => JSON.stringify(value, withoutIds)\n\n/** The ids of a table's cells that differ from the table it took the place of. */\nconst changedCellIds = (\n after: WordPreviewBlock & { kind: 'table' },\n before: WordPreviewBlock | undefined,\n): string[] => {\n const idsOf = (cells: WordPreviewCell[]) =>\n cells.flatMap((c) => c.ids ?? [])\n if (before?.kind !== 'table') {\n return idsOf(after.rows.flat())\n }\n const rows = unmatchedItems(\n before.rows.map(contentOf),\n after.rows.map(contentOf),\n )\n return [...rows].flatMap(([r, was]) => {\n const old = was === undefined ? undefined : before.rows[was]\n return idsOf(\n after.rows[r].filter(\n (cell, c) => !old?.[c] || contentOf(old[c]) !== contentOf(cell),\n ),\n )\n })\n}\n\nconst wordChanges = (before: WordPreview, after: WordPreview) => {\n const paragraphs = new Set<string>()\n const blocks = unmatchedItems(\n before.blocks.map(contentOf),\n after.blocks.map(contentOf),\n )\n for (const [b, was] of blocks) {\n const block = after.blocks[b]\n if (block.kind === 'table') {\n const old = was === undefined ? undefined : before.blocks[was]\n for (const id of changedCellIds(block, old)) {\n paragraphs.add(id)\n }\n } else if (block.id) {\n paragraphs.add(block.id)\n }\n }\n return paragraphs\n}\n\n/**\n * A cell as it shows: its look and number format by what they are, as each\n * version numbers its own lists of them.\n */\nconst cellContents = (\n preview: SpreadsheetPreview,\n sheet: SpreadsheetPreviewSheet,\n) => {\n const out = new Map<string, string>()\n for (const r of sheet.rows) {\n for (const cell of r.cells) {\n out.set(\n `${r.row}:${cell.col}`,\n JSON.stringify({\n ...cell,\n style:\n cell.style === undefined\n ? undefined\n : preview.styles[cell.style],\n numFmt:\n cell.numFmt === undefined\n ? undefined\n : preview.numberFormats?.[cell.numFmt],\n }),\n )\n }\n }\n return out\n}\n\nconst spreadsheetChanges = (\n before: SpreadsheetPreview,\n after: SpreadsheetPreview,\n) => {\n const cells = new Map<string, ReadonlySet<string>>()\n for (const sheet of after.sheets) {\n const old = before.sheets.find((s) => s.name === sheet.name)\n const now = cellContents(after, sheet)\n const was = old ? cellContents(before, old) : new Map<string, string>()\n const changed = new Set<string>()\n for (const [at, content] of now) {\n if (was.get(at) !== content) {\n changed.add(at)\n }\n }\n // A cell emptied is gone from the new version's list\n for (const at of was.keys()) {\n if (!now.has(at)) {\n changed.add(at)\n }\n }\n if (changed.size) {\n cells.set(sheet.name, changed)\n }\n }\n return cells\n}\n\n/**\n * What `after` changed from `before`, two versions of the same file: none\n * when nothing the viewer draws differs, or the two are not of one format.\n */\nexport const chatFilePreviewChanges = (\n before: ChatFilePreview,\n after: ChatFilePreview,\n): ChatFilePreviewChanges | undefined => {\n if (before.kind === 'word' && after.kind === 'word') {\n const paragraphs = wordChanges(before, after)\n return paragraphs.size ? { kind: 'word', paragraphs } : undefined\n }\n if (before.kind === 'spreadsheet' && after.kind === 'spreadsheet') {\n const cells = spreadsheetChanges(before, after)\n return cells.size ? { kind: 'spreadsheet', cells } : undefined\n }\n return undefined\n}\n\n/**\n * Brings the first marked change into the middle of the viewer's own scroll\n * box, when it is not in sight already. Not `scrollIntoView`: it would scroll\n * the page around the viewer too. False while there is none drawn yet.\n */\nexport const revealFirstChange = (\n scroller: HTMLElement | null | undefined,\n selector: string,\n): boolean => {\n const el = scroller?.querySelector(selector)\n if (!scroller || !el) {\n return false\n }\n const box = scroller.getBoundingClientRect()\n const at = el.getBoundingClientRect()\n if (at.top < box.top || at.bottom > box.bottom) {\n scroller.scrollTop += at.top - box.top - (box.height - at.height) / 2\n }\n if (at.left < box.left || at.right > box.right) {\n scroller.scrollLeft += at.left - box.left - (box.width - at.width) / 2\n }\n return true\n}\n","import type { SelectionActionIcon } from 'models'\n\n/**\n * The Remix icon of each name an action of the agent can wear on the\n * selection menu (`SELECTION_ACTION_ICONS` in `models`): the menu draws it,\n * the backoffice offers it in the grid of the action.\n */\nexport const SELECTION_ACTION_ICON_NAMES: Record<SelectionActionIcon, string> =\n {\n sparkles: 'ri:sparkling-line',\n magic: 'ri:magic-line',\n idea: 'ri:lightbulb-line',\n star: 'ri:star-line',\n heart: 'ri:heart-line',\n lightning: 'ri:flashlight-line',\n fire: 'ri:fire-line',\n rocket: 'ri:rocket-line',\n pen: 'ri:quill-pen-line',\n pencil: 'ri:pencil-line',\n text: 'ri:text',\n paragraph: 'ri:paragraph',\n quote: 'ri:double-quotes-l',\n list: 'ri:list-unordered',\n checklist: 'ri:list-check-2',\n highlighter: 'ri:mark-pen-line',\n document: 'ri:file-text-line',\n folder: 'ri:folder-line',\n book: 'ri:book-open-line',\n bookmark: 'ri:bookmark-line',\n clipboard: 'ri:clipboard-line',\n draft: 'ri:draft-line',\n contract: 'ri:file-paper-2-line',\n attachment: 'ri:attachment-2',\n archive: 'ri:archive-line',\n search: 'ri:search-line',\n filter: 'ri:filter-3-line',\n eye: 'ri:eye-line',\n questions: 'ri:question-answer-line',\n 'pie-chart': 'ri:pie-chart-line',\n 'line-chart': 'ri:line-chart-line',\n table: 'ri:table-line',\n database: 'ri:database-2-line',\n calculator: 'ri:calculator-line',\n percent: 'ri:percent-line',\n scales: 'ri:scales-3-line',\n euro: 'ri:money-euro-circle-line',\n dollar: 'ri:money-dollar-circle-line',\n wallet: 'ri:wallet-3-line',\n bank: 'ri:bank-line',\n card: 'ri:bank-card-line',\n cart: 'ri:shopping-cart-2-line',\n 'price-tag': 'ri:price-tag-3-line',\n bill: 'ri:bill-line',\n gift: 'ri:gift-line',\n shop: 'ri:store-2-line',\n truck: 'ri:truck-line',\n shield: 'ri:shield-check-line',\n lock: 'ri:lock-line',\n key: 'ri:key-2-line',\n gavel: 'ri:auction-line',\n institution: 'ri:government-line',\n passport: 'ri:passport-line',\n person: 'ri:user-line',\n team: 'ri:team-line',\n group: 'ri:group-line',\n smile: 'ri:emotion-happy-line',\n handshake: 'ri:shake-hands-line',\n support: 'ri:customer-service-2-line',\n contacts: 'ri:contacts-book-line',\n mail: 'ri:mail-line',\n send: 'ri:send-plane-line',\n speech: 'ri:chat-3-line',\n phone: 'ri:phone-line',\n megaphone: 'ri:megaphone-line',\n bell: 'ri:notification-3-line',\n share: 'ri:share-line',\n link: 'ri:link',\n globe: 'ri:global-line',\n calendar: 'ri:calendar-line',\n event: 'ri:calendar-event-line',\n clock: 'ri:time-line',\n timer: 'ri:timer-line',\n history: 'ri:history-line',\n hourglass: 'ri:hourglass-line',\n plane: 'ri:plane-line',\n car: 'ri:car-line',\n train: 'ri:train-line',\n ship: 'ri:ship-line',\n map: 'ri:map-2-line',\n pin: 'ri:map-pin-line',\n compass: 'ri:compass-3-line',\n bed: 'ri:hotel-bed-line',\n suitcase: 'ri:suitcase-line',\n home: 'ri:home-4-line',\n building: 'ri:building-line',\n flag: 'ri:flag-line',\n earth: 'ri:earth-line',\n sun: 'ri:sun-line',\n umbrella: 'ri:umbrella-line',\n heartbeat: 'ri:heart-pulse-line',\n capsule: 'ri:capsule-line',\n 'first-aid': 'ri:first-aid-kit-line',\n restaurant: 'ri:restaurant-line',\n cup: 'ri:cup-line',\n leaf: 'ri:leaf-line',\n plant: 'ri:plant-line',\n recycle: 'ri:recycle-line',\n school: 'ri:school-line',\n graduation: 'ri:graduation-cap-line',\n brain: 'ri:brain-line',\n puzzle: 'ri:puzzle-line',\n award: 'ri:award-line',\n trophy: 'ri:trophy-line',\n settings: 'ri:settings-3-line',\n tools: 'ri:tools-line',\n code: 'ri:code-s-slash-line',\n bug: 'ri:bug-line',\n robot: 'ri:robot-2-line',\n cloud: 'ri:cloud-line',\n flask: 'ri:flask-line',\n microscope: 'ri:microscope-line',\n check: 'ri:checkbox-circle-line',\n cross: 'ri:close-circle-line',\n warning: 'ri:alert-line',\n information: 'ri:information-line',\n refresh: 'ri:refresh-line',\n swap: 'ri:arrow-left-right-line',\n arrow: 'ri:arrow-right-circle-line',\n 'thumbs-up': 'ri:thumb-up-line',\n target: 'ri:focus-3-line',\n palette: 'ri:palette-line',\n image: 'ri:image-line',\n music: 'ri:music-2-line',\n video: 'ri:video-line',\n microphone: 'ri:mic-line',\n }\n\n/** The icon of an action of the agent: the one its author chose, else the sparkle. */\nexport const agentActionIcon = (icon?: SelectionActionIcon) =>\n SELECTION_ACTION_ICON_NAMES[icon ?? 'sparkles']\n","<script setup lang=\"ts\">\n import { computed, nextTick, ref, useTemplateRef } from 'vue'\n import { useElementSize } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import type { SelectionActionIcon } from 'models'\n import { agentActionIcon } from './selectionActionIcons'\n import { selectionBarPosition } from './utils'\n\n /**\n * The menu of actions on a selection (spec `selection-actions.md`, \"Cosa\n * è comune\"), on the page that embeds the widget and in the chat's file\n * viewer: a row per action with its icon, the agent's after the built-in\n * ones, then \"Ask…\" below a rule, which turns the menu into a field. An\n * action may ask for a word first (`asks`: \"Translate\" asks the\n * language). It sits above the start of the selection, below it without\n * room there (`selectionBarPosition`). Its rows take no focus on a click,\n * so the selection stays and Cmd+C still copies it; the keyboard reaches\n * them with Tab.\n */\n\n /**\n * The built-in actions by their icon, from the Remix set the app's menus\n * use; an action of the agent has the one its author chose\n * (`agentActionIcon`), the sparkle without one.\n */\n const BUILT_IN_ICONS: Record<string, string> = {\n explain: 'ri:question-line',\n summarize: 'ri:file-list-3-line',\n rewrite: 'ri:edit-line',\n shorten: 'ri:scissors-cut-line',\n proofread: 'ri:check-double-line',\n translate: 'ri:translate-2',\n chart: 'ri:bar-chart-2-line',\n }\n\n export type SelectionBarAction = {\n id: string\n label: string\n /** The placeholder of a field the action opens before it is sent. */\n asks?: string\n /** An action of the agent: the icon its author chose. */\n icon?: SelectionActionIcon\n }\n\n const props = defineProps<{\n actions: SelectionBarAction[]\n /** The selection, in the coordinates of the box the bar is positioned in. */\n anchor: {\n start: { top: number; left: number }\n bottom: number\n bounds: { top: number; left: number; width: number; height: number }\n }\n /** `fixed` over the page, `absolute` inside the file viewer. */\n strategy?: 'fixed' | 'absolute'\n /** A line before the actions: why some are missing. */\n hint?: string\n /** In place of the actions: why there are none, with `noteAction` to act on it. */\n note?: string\n noteAction?: string\n /** On a touch screen the bar goes below, away from the system's menu. */\n touch?: boolean\n }>()\n\n const emit = defineEmits<{\n action: [id: string, value?: string]\n ask: [text: string]\n note: []\n close: []\n }>()\n\n /** The field is open: the selection may move into it, and the bar stays. */\n const asking = defineModel<boolean>('asking', { default: false })\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const barEl = useTemplateRef<HTMLElement>('barEl')\n const inputEl = useTemplateRef<HTMLInputElement>('inputEl')\n const { width, height } = useElementSize(barEl, undefined, {\n box: 'border-box',\n })\n const position = computed(() =>\n selectionBarPosition({\n ...props.anchor,\n bar: { width: width.value, height: height.value },\n touch: props.touch,\n }),\n )\n\n /** The action whose field is open, or \"Ask…\" (no id). */\n const field = ref<{ id?: string; placeholder: string }>()\n const text = ref('')\n\n const openField = async (id: string | undefined, placeholder: string) => {\n field.value = { id, placeholder }\n text.value = ''\n asking.value = true\n await nextTick()\n inputEl.value?.focus()\n }\n const closeField = () => {\n field.value = undefined\n asking.value = false\n }\n const openAsk = () =>\n openField(undefined, $t('selectionActions.askPlaceholder'))\n\n const iconOf = (action: SelectionBarAction) =>\n BUILT_IN_ICONS[action.id] ?? agentActionIcon(action.icon)\n\n const run = (action: SelectionBarAction) => {\n if (action.asks) {\n void openField(action.id, action.asks)\n } else {\n emit('action', action.id)\n }\n }\n\n /**\n * A finger lifted on the row it touched. The menu turns the touch's\n * default off as it starts: on a phone a tap outside the text clears\n * the selection before the click, and the menu went with it. With the\n * default off no click follows, so the row acts here.\n */\n const onTap = (event: TouchEvent, act: () => void) => {\n const row = event.currentTarget as HTMLElement\n const touch = event.changedTouches[0]\n const root = row.getRootNode() as Document | ShadowRoot\n const under =\n touch && root.elementFromPoint(touch.clientX, touch.clientY)\n if (under && row.contains(under)) {\n act()\n }\n }\n\n const submit = () => {\n const value = text.value.trim()\n if (!value || !field.value) {\n return\n }\n if (field.value.id) {\n emit('action', field.value.id, value)\n } else {\n emit('ask', value)\n }\n closeField()\n }\n\n /**\n * Esc closes the field, or the menu, and nothing else: its default would\n * also close the dialog the file viewer is in. Not while an input method\n * composes: there Esc cancels the composition.\n */\n const onEscape = (event: KeyboardEvent) => {\n if (event.isComposing) {\n return\n }\n event.stopPropagation()\n event.preventDefault()\n if (field.value) {\n closeField()\n } else {\n emit('close')\n }\n }\n</script>\n\n<template>\n <div\n class=\"pk-selection-actions\"\n :class=\"{\n 'pk-selection-actions--fixed': strategy === 'fixed',\n 'pk-selection-actions--asking': !!field,\n }\"\n :style=\"{\n top: `${position.top}px`,\n left: `${position.left}px`,\n }\"\n @keydown.esc=\"onEscape\">\n <form\n v-if=\"field\"\n ref=\"barEl\"\n class=\"pk-selection-actions__menu pk-selection-actions__menu--field\"\n @submit.prevent=\"submit\">\n <input\n ref=\"inputEl\"\n v-model=\"text\"\n class=\"pk-selection-actions__input\"\n type=\"text\"\n maxlength=\"500\"\n :placeholder=\"field.placeholder\"\n :aria-label=\"field.placeholder\" />\n <button\n type=\"submit\"\n class=\"pk-selection-actions__button pk-selection-actions__button--send\"\n :disabled=\"!text.trim()\">\n {{ $t('action.send') }}\n </button>\n </form>\n <div\n v-else\n ref=\"barEl\"\n class=\"pk-selection-actions__menu\"\n role=\"toolbar\"\n aria-orientation=\"vertical\"\n :aria-label=\"$t('selectionActions.label')\"\n @touchstart.prevent>\n <template v-if=\"note\">\n <p class=\"pk-selection-actions__text\">{{ note }}</p>\n <button\n v-if=\"noteAction\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"emit('note')\"\n @touchend=\"onTap($event, () => emit('note'))\">\n <VvIcon\n name=\"ri:arrow-right-line\"\n class=\"pk-selection-actions__icon\" />\n {{ noteAction }}\n </button>\n </template>\n <template v-else>\n <p v-if=\"hint\" class=\"pk-selection-actions__text\">\n {{ hint }}\n </p>\n <button\n v-for=\"action in actions\"\n :key=\"action.id\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"run(action)\"\n @touchend=\"onTap($event, () => run(action))\">\n <VvIcon\n :name=\"iconOf(action)\"\n class=\"pk-selection-actions__icon\" />\n {{ action.label }}\n </button>\n <hr class=\"pk-selection-actions__rule\" />\n <button\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"openAsk\"\n @touchend=\"onTap($event, openAsk)\">\n <VvIcon\n name=\"ri:chat-1-line\"\n class=\"pk-selection-actions__icon\" />\n {{ $t('selectionActions.ask') }}\n </button>\n </template>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-selection-actions {\n position: absolute;\n z-index: 10;\n\n // The widths go here: a box placed absolutely takes its width from\n // its content, so a percentage inside it measured the content, and\n // the field shrank to a few words. Here 100% is the box it is in.\n max-width: min(20rem, calc(100% - var(--spacing-16)));\n\n &--fixed {\n position: fixed;\n\n // Above the site's own layers, as the page pointer's bar\n z-index: 2147483647;\n }\n\n &--asking {\n width: min(var(--spacing-384), calc(100% - var(--spacing-16)));\n max-width: none;\n }\n\n // As the app's menus (the ⋮ of a conversation): the surface, its\n // hairline and its shadow, readable over a document and over a page\n &__menu {\n display: flex;\n flex-direction: column;\n min-width: 11rem;\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-4);\n border: var(--spacing-1) solid var(--color-surface-5);\n border-radius: var(--rounded-lg);\n background-color: var(--color-surface);\n color: var(--color-word-2);\n font-family: var(--font-sans);\n font-size: var(--text-12);\n box-shadow: var(--shadow-lg);\n\n &--field {\n flex-direction: row;\n align-items: center;\n gap: var(--spacing-4);\n width: 100%;\n }\n }\n\n &__text {\n max-width: 16rem;\n margin: 0;\n padding: var(--spacing-4) var(--spacing-8) var(--spacing-6);\n color: var(--color-word-3);\n font-size: var(--text-12);\n }\n\n &__button {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n gap: var(--spacing-8);\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-12) var(--spacing-6)\n var(--spacing-8);\n background-color: transparent;\n color: inherit;\n font: inherit;\n text-align: start;\n white-space: nowrap;\n cursor: pointer;\n\n // A finger gets 40px (DESIGN.md, principle 15): the row grows,\n // the text keeps its size\n @media (pointer: coarse) {\n min-height: var(--spacing-40);\n }\n\n &:hover {\n background-color: var(--color-surface-1);\n color: var(--color-word-1);\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-brand);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n\n &--send {\n padding: var(--spacing-6) var(--spacing-10);\n background-color: var(--color-word-1);\n color: var(--color-surface);\n font-weight: var(--font-medium);\n\n &:hover {\n background-color: var(--color-word-1);\n color: var(--color-surface);\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: default;\n }\n }\n }\n\n &__icon {\n flex-shrink: 0;\n width: var(--spacing-16);\n height: var(--spacing-16);\n color: var(--color-word-3);\n }\n\n &__rule {\n margin: var(--spacing-4) 0;\n border: 0;\n border-top: var(--spacing-1) solid var(--color-surface-3);\n }\n\n &__input {\n flex: 1;\n min-width: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-8);\n background-color: var(--color-surface-1);\n color: var(--color-word-1);\n font: inherit;\n\n @media (pointer: coarse) {\n min-height: var(--spacing-40);\n\n // Below 16px Safari on iOS zooms the page on the focus\n font-size: var(--text-16);\n }\n\n &::placeholder {\n color: var(--color-word-3);\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-brand);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, nextTick, ref, useTemplateRef } from 'vue'\n import { useElementSize } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import type { SelectionActionIcon } from 'models'\n import { agentActionIcon } from './selectionActionIcons'\n import { selectionBarPosition } from './utils'\n\n /**\n * The menu of actions on a selection (spec `selection-actions.md`, \"Cosa\n * è comune\"), on the page that embeds the widget and in the chat's file\n * viewer: a row per action with its icon, the agent's after the built-in\n * ones, then \"Ask…\" below a rule, which turns the menu into a field. An\n * action may ask for a word first (`asks`: \"Translate\" asks the\n * language). It sits above the start of the selection, below it without\n * room there (`selectionBarPosition`). Its rows take no focus on a click,\n * so the selection stays and Cmd+C still copies it; the keyboard reaches\n * them with Tab.\n */\n\n /**\n * The built-in actions by their icon, from the Remix set the app's menus\n * use; an action of the agent has the one its author chose\n * (`agentActionIcon`), the sparkle without one.\n */\n const BUILT_IN_ICONS: Record<string, string> = {\n explain: 'ri:question-line',\n summarize: 'ri:file-list-3-line',\n rewrite: 'ri:edit-line',\n shorten: 'ri:scissors-cut-line',\n proofread: 'ri:check-double-line',\n translate: 'ri:translate-2',\n chart: 'ri:bar-chart-2-line',\n }\n\n export type SelectionBarAction = {\n id: string\n label: string\n /** The placeholder of a field the action opens before it is sent. */\n asks?: string\n /** An action of the agent: the icon its author chose. */\n icon?: SelectionActionIcon\n }\n\n const props = defineProps<{\n actions: SelectionBarAction[]\n /** The selection, in the coordinates of the box the bar is positioned in. */\n anchor: {\n start: { top: number; left: number }\n bottom: number\n bounds: { top: number; left: number; width: number; height: number }\n }\n /** `fixed` over the page, `absolute` inside the file viewer. */\n strategy?: 'fixed' | 'absolute'\n /** A line before the actions: why some are missing. */\n hint?: string\n /** In place of the actions: why there are none, with `noteAction` to act on it. */\n note?: string\n noteAction?: string\n /** On a touch screen the bar goes below, away from the system's menu. */\n touch?: boolean\n }>()\n\n const emit = defineEmits<{\n action: [id: string, value?: string]\n ask: [text: string]\n note: []\n close: []\n }>()\n\n /** The field is open: the selection may move into it, and the bar stays. */\n const asking = defineModel<boolean>('asking', { default: false })\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const barEl = useTemplateRef<HTMLElement>('barEl')\n const inputEl = useTemplateRef<HTMLInputElement>('inputEl')\n const { width, height } = useElementSize(barEl, undefined, {\n box: 'border-box',\n })\n const position = computed(() =>\n selectionBarPosition({\n ...props.anchor,\n bar: { width: width.value, height: height.value },\n touch: props.touch,\n }),\n )\n\n /** The action whose field is open, or \"Ask…\" (no id). */\n const field = ref<{ id?: string; placeholder: string }>()\n const text = ref('')\n\n const openField = async (id: string | undefined, placeholder: string) => {\n field.value = { id, placeholder }\n text.value = ''\n asking.value = true\n await nextTick()\n inputEl.value?.focus()\n }\n const closeField = () => {\n field.value = undefined\n asking.value = false\n }\n const openAsk = () =>\n openField(undefined, $t('selectionActions.askPlaceholder'))\n\n const iconOf = (action: SelectionBarAction) =>\n BUILT_IN_ICONS[action.id] ?? agentActionIcon(action.icon)\n\n const run = (action: SelectionBarAction) => {\n if (action.asks) {\n void openField(action.id, action.asks)\n } else {\n emit('action', action.id)\n }\n }\n\n /**\n * A finger lifted on the row it touched. The menu turns the touch's\n * default off as it starts: on a phone a tap outside the text clears\n * the selection before the click, and the menu went with it. With the\n * default off no click follows, so the row acts here.\n */\n const onTap = (event: TouchEvent, act: () => void) => {\n const row = event.currentTarget as HTMLElement\n const touch = event.changedTouches[0]\n const root = row.getRootNode() as Document | ShadowRoot\n const under =\n touch && root.elementFromPoint(touch.clientX, touch.clientY)\n if (under && row.contains(under)) {\n act()\n }\n }\n\n const submit = () => {\n const value = text.value.trim()\n if (!value || !field.value) {\n return\n }\n if (field.value.id) {\n emit('action', field.value.id, value)\n } else {\n emit('ask', value)\n }\n closeField()\n }\n\n /**\n * Esc closes the field, or the menu, and nothing else: its default would\n * also close the dialog the file viewer is in. Not while an input method\n * composes: there Esc cancels the composition.\n */\n const onEscape = (event: KeyboardEvent) => {\n if (event.isComposing) {\n return\n }\n event.stopPropagation()\n event.preventDefault()\n if (field.value) {\n closeField()\n } else {\n emit('close')\n }\n }\n</script>\n\n<template>\n <div\n class=\"pk-selection-actions\"\n :class=\"{\n 'pk-selection-actions--fixed': strategy === 'fixed',\n 'pk-selection-actions--asking': !!field,\n }\"\n :style=\"{\n top: `${position.top}px`,\n left: `${position.left}px`,\n }\"\n @keydown.esc=\"onEscape\">\n <form\n v-if=\"field\"\n ref=\"barEl\"\n class=\"pk-selection-actions__menu pk-selection-actions__menu--field\"\n @submit.prevent=\"submit\">\n <input\n ref=\"inputEl\"\n v-model=\"text\"\n class=\"pk-selection-actions__input\"\n type=\"text\"\n maxlength=\"500\"\n :placeholder=\"field.placeholder\"\n :aria-label=\"field.placeholder\" />\n <button\n type=\"submit\"\n class=\"pk-selection-actions__button pk-selection-actions__button--send\"\n :disabled=\"!text.trim()\">\n {{ $t('action.send') }}\n </button>\n </form>\n <div\n v-else\n ref=\"barEl\"\n class=\"pk-selection-actions__menu\"\n role=\"toolbar\"\n aria-orientation=\"vertical\"\n :aria-label=\"$t('selectionActions.label')\"\n @touchstart.prevent>\n <template v-if=\"note\">\n <p class=\"pk-selection-actions__text\">{{ note }}</p>\n <button\n v-if=\"noteAction\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"emit('note')\"\n @touchend=\"onTap($event, () => emit('note'))\">\n <VvIcon\n name=\"ri:arrow-right-line\"\n class=\"pk-selection-actions__icon\" />\n {{ noteAction }}\n </button>\n </template>\n <template v-else>\n <p v-if=\"hint\" class=\"pk-selection-actions__text\">\n {{ hint }}\n </p>\n <button\n v-for=\"action in actions\"\n :key=\"action.id\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"run(action)\"\n @touchend=\"onTap($event, () => run(action))\">\n <VvIcon\n :name=\"iconOf(action)\"\n class=\"pk-selection-actions__icon\" />\n {{ action.label }}\n </button>\n <hr class=\"pk-selection-actions__rule\" />\n <button\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"openAsk\"\n @touchend=\"onTap($event, openAsk)\">\n <VvIcon\n name=\"ri:chat-1-line\"\n class=\"pk-selection-actions__icon\" />\n {{ $t('selectionActions.ask') }}\n </button>\n </template>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-selection-actions {\n position: absolute;\n z-index: 10;\n\n // The widths go here: a box placed absolutely takes its width from\n // its content, so a percentage inside it measured the content, and\n // the field shrank to a few words. Here 100% is the box it is in.\n max-width: min(20rem, calc(100% - var(--spacing-16)));\n\n &--fixed {\n position: fixed;\n\n // Above the site's own layers, as the page pointer's bar\n z-index: 2147483647;\n }\n\n &--asking {\n width: min(var(--spacing-384), calc(100% - var(--spacing-16)));\n max-width: none;\n }\n\n // As the app's menus (the ⋮ of a conversation): the surface, its\n // hairline and its shadow, readable over a document and over a page\n &__menu {\n display: flex;\n flex-direction: column;\n min-width: 11rem;\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-4);\n border: var(--spacing-1) solid var(--color-surface-5);\n border-radius: var(--rounded-lg);\n background-color: var(--color-surface);\n color: var(--color-word-2);\n font-family: var(--font-sans);\n font-size: var(--text-12);\n box-shadow: var(--shadow-lg);\n\n &--field {\n flex-direction: row;\n align-items: center;\n gap: var(--spacing-4);\n width: 100%;\n }\n }\n\n &__text {\n max-width: 16rem;\n margin: 0;\n padding: var(--spacing-4) var(--spacing-8) var(--spacing-6);\n color: var(--color-word-3);\n font-size: var(--text-12);\n }\n\n &__button {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n gap: var(--spacing-8);\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-12) var(--spacing-6)\n var(--spacing-8);\n background-color: transparent;\n color: inherit;\n font: inherit;\n text-align: start;\n white-space: nowrap;\n cursor: pointer;\n\n // A finger gets 40px (DESIGN.md, principle 15): the row grows,\n // the text keeps its size\n @media (pointer: coarse) {\n min-height: var(--spacing-40);\n }\n\n &:hover {\n background-color: var(--color-surface-1);\n color: var(--color-word-1);\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-brand);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n\n &--send {\n padding: var(--spacing-6) var(--spacing-10);\n background-color: var(--color-word-1);\n color: var(--color-surface);\n font-weight: var(--font-medium);\n\n &:hover {\n background-color: var(--color-word-1);\n color: var(--color-surface);\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: default;\n }\n }\n }\n\n &__icon {\n flex-shrink: 0;\n width: var(--spacing-16);\n height: var(--spacing-16);\n color: var(--color-word-3);\n }\n\n &__rule {\n margin: var(--spacing-4) 0;\n border: 0;\n border-top: var(--spacing-1) solid var(--color-surface-3);\n }\n\n &__input {\n flex: 1;\n min-width: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-8);\n background-color: var(--color-surface-1);\n color: var(--color-word-1);\n font: inherit;\n\n @media (pointer: coarse) {\n min-height: var(--spacing-40);\n\n // Below 16px Safari on iOS zooms the page on the focus\n font-size: var(--text-16);\n }\n\n &::placeholder {\n color: var(--color-word-3);\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-brand);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, nextTick, ref, useTemplateRef } from 'vue'\n import { useElementSize } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import type { SelectionActionIcon } from 'models'\n import { agentActionIcon } from './selectionActionIcons'\n import { selectionBarPosition } from './utils'\n\n /**\n * The menu of actions on a selection (spec `selection-actions.md`, \"Cosa\n * è comune\"), on the page that embeds the widget and in the chat's file\n * viewer: a row per action with its icon, the agent's after the built-in\n * ones, then \"Ask…\" below a rule, which turns the menu into a field. An\n * action may ask for a word first (`asks`: \"Translate\" asks the\n * language). It sits above the start of the selection, below it without\n * room there (`selectionBarPosition`). Its rows take no focus on a click,\n * so the selection stays and Cmd+C still copies it; the keyboard reaches\n * them with Tab.\n */\n\n /**\n * The built-in actions by their icon, from the Remix set the app's menus\n * use; an action of the agent has the one its author chose\n * (`agentActionIcon`), the sparkle without one.\n */\n const BUILT_IN_ICONS: Record<string, string> = {\n explain: 'ri:question-line',\n summarize: 'ri:file-list-3-line',\n rewrite: 'ri:edit-line',\n shorten: 'ri:scissors-cut-line',\n proofread: 'ri:check-double-line',\n translate: 'ri:translate-2',\n chart: 'ri:bar-chart-2-line',\n }\n\n export type SelectionBarAction = {\n id: string\n label: string\n /** The placeholder of a field the action opens before it is sent. */\n asks?: string\n /** An action of the agent: the icon its author chose. */\n icon?: SelectionActionIcon\n }\n\n const props = defineProps<{\n actions: SelectionBarAction[]\n /** The selection, in the coordinates of the box the bar is positioned in. */\n anchor: {\n start: { top: number; left: number }\n bottom: number\n bounds: { top: number; left: number; width: number; height: number }\n }\n /** `fixed` over the page, `absolute` inside the file viewer. */\n strategy?: 'fixed' | 'absolute'\n /** A line before the actions: why some are missing. */\n hint?: string\n /** In place of the actions: why there are none, with `noteAction` to act on it. */\n note?: string\n noteAction?: string\n /** On a touch screen the bar goes below, away from the system's menu. */\n touch?: boolean\n }>()\n\n const emit = defineEmits<{\n action: [id: string, value?: string]\n ask: [text: string]\n note: []\n close: []\n }>()\n\n /** The field is open: the selection may move into it, and the bar stays. */\n const asking = defineModel<boolean>('asking', { default: false })\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const barEl = useTemplateRef<HTMLElement>('barEl')\n const inputEl = useTemplateRef<HTMLInputElement>('inputEl')\n const { width, height } = useElementSize(barEl, undefined, {\n box: 'border-box',\n })\n const position = computed(() =>\n selectionBarPosition({\n ...props.anchor,\n bar: { width: width.value, height: height.value },\n touch: props.touch,\n }),\n )\n\n /** The action whose field is open, or \"Ask…\" (no id). */\n const field = ref<{ id?: string; placeholder: string }>()\n const text = ref('')\n\n const openField = async (id: string | undefined, placeholder: string) => {\n field.value = { id, placeholder }\n text.value = ''\n asking.value = true\n await nextTick()\n inputEl.value?.focus()\n }\n const closeField = () => {\n field.value = undefined\n asking.value = false\n }\n const openAsk = () =>\n openField(undefined, $t('selectionActions.askPlaceholder'))\n\n const iconOf = (action: SelectionBarAction) =>\n BUILT_IN_ICONS[action.id] ?? agentActionIcon(action.icon)\n\n const run = (action: SelectionBarAction) => {\n if (action.asks) {\n void openField(action.id, action.asks)\n } else {\n emit('action', action.id)\n }\n }\n\n /**\n * A finger lifted on the row it touched. The menu turns the touch's\n * default off as it starts: on a phone a tap outside the text clears\n * the selection before the click, and the menu went with it. With the\n * default off no click follows, so the row acts here.\n */\n const onTap = (event: TouchEvent, act: () => void) => {\n const row = event.currentTarget as HTMLElement\n const touch = event.changedTouches[0]\n const root = row.getRootNode() as Document | ShadowRoot\n const under =\n touch && root.elementFromPoint(touch.clientX, touch.clientY)\n if (under && row.contains(under)) {\n act()\n }\n }\n\n const submit = () => {\n const value = text.value.trim()\n if (!value || !field.value) {\n return\n }\n if (field.value.id) {\n emit('action', field.value.id, value)\n } else {\n emit('ask', value)\n }\n closeField()\n }\n\n /**\n * Esc closes the field, or the menu, and nothing else: its default would\n * also close the dialog the file viewer is in. Not while an input method\n * composes: there Esc cancels the composition.\n */\n const onEscape = (event: KeyboardEvent) => {\n if (event.isComposing) {\n return\n }\n event.stopPropagation()\n event.preventDefault()\n if (field.value) {\n closeField()\n } else {\n emit('close')\n }\n }\n</script>\n\n<template>\n <div\n class=\"pk-selection-actions\"\n :class=\"{\n 'pk-selection-actions--fixed': strategy === 'fixed',\n 'pk-selection-actions--asking': !!field,\n }\"\n :style=\"{\n top: `${position.top}px`,\n left: `${position.left}px`,\n }\"\n @keydown.esc=\"onEscape\">\n <form\n v-if=\"field\"\n ref=\"barEl\"\n class=\"pk-selection-actions__menu pk-selection-actions__menu--field\"\n @submit.prevent=\"submit\">\n <input\n ref=\"inputEl\"\n v-model=\"text\"\n class=\"pk-selection-actions__input\"\n type=\"text\"\n maxlength=\"500\"\n :placeholder=\"field.placeholder\"\n :aria-label=\"field.placeholder\" />\n <button\n type=\"submit\"\n class=\"pk-selection-actions__button pk-selection-actions__button--send\"\n :disabled=\"!text.trim()\">\n {{ $t('action.send') }}\n </button>\n </form>\n <div\n v-else\n ref=\"barEl\"\n class=\"pk-selection-actions__menu\"\n role=\"toolbar\"\n aria-orientation=\"vertical\"\n :aria-label=\"$t('selectionActions.label')\"\n @touchstart.prevent>\n <template v-if=\"note\">\n <p class=\"pk-selection-actions__text\">{{ note }}</p>\n <button\n v-if=\"noteAction\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"emit('note')\"\n @touchend=\"onTap($event, () => emit('note'))\">\n <VvIcon\n name=\"ri:arrow-right-line\"\n class=\"pk-selection-actions__icon\" />\n {{ noteAction }}\n </button>\n </template>\n <template v-else>\n <p v-if=\"hint\" class=\"pk-selection-actions__text\">\n {{ hint }}\n </p>\n <button\n v-for=\"action in actions\"\n :key=\"action.id\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"run(action)\"\n @touchend=\"onTap($event, () => run(action))\">\n <VvIcon\n :name=\"iconOf(action)\"\n class=\"pk-selection-actions__icon\" />\n {{ action.label }}\n </button>\n <hr class=\"pk-selection-actions__rule\" />\n <button\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"openAsk\"\n @touchend=\"onTap($event, openAsk)\">\n <VvIcon\n name=\"ri:chat-1-line\"\n class=\"pk-selection-actions__icon\" />\n {{ $t('selectionActions.ask') }}\n </button>\n </template>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-selection-actions {\n position: absolute;\n z-index: 10;\n\n // The widths go here: a box placed absolutely takes its width from\n // its content, so a percentage inside it measured the content, and\n // the field shrank to a few words. Here 100% is the box it is in.\n max-width: min(20rem, calc(100% - var(--spacing-16)));\n\n &--fixed {\n position: fixed;\n\n // Above the site's own layers, as the page pointer's bar\n z-index: 2147483647;\n }\n\n &--asking {\n width: min(var(--spacing-384), calc(100% - var(--spacing-16)));\n max-width: none;\n }\n\n // As the app's menus (the ⋮ of a conversation): the surface, its\n // hairline and its shadow, readable over a document and over a page\n &__menu {\n display: flex;\n flex-direction: column;\n min-width: 11rem;\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-4);\n border: var(--spacing-1) solid var(--color-surface-5);\n border-radius: var(--rounded-lg);\n background-color: var(--color-surface);\n color: var(--color-word-2);\n font-family: var(--font-sans);\n font-size: var(--text-12);\n box-shadow: var(--shadow-lg);\n\n &--field {\n flex-direction: row;\n align-items: center;\n gap: var(--spacing-4);\n width: 100%;\n }\n }\n\n &__text {\n max-width: 16rem;\n margin: 0;\n padding: var(--spacing-4) var(--spacing-8) var(--spacing-6);\n color: var(--color-word-3);\n font-size: var(--text-12);\n }\n\n &__button {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n gap: var(--spacing-8);\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-12) var(--spacing-6)\n var(--spacing-8);\n background-color: transparent;\n color: inherit;\n font: inherit;\n text-align: start;\n white-space: nowrap;\n cursor: pointer;\n\n // A finger gets 40px (DESIGN.md, principle 15): the row grows,\n // the text keeps its size\n @media (pointer: coarse) {\n min-height: var(--spacing-40);\n }\n\n &:hover {\n background-color: var(--color-surface-1);\n color: var(--color-word-1);\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-brand);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n\n &--send {\n padding: var(--spacing-6) var(--spacing-10);\n background-color: var(--color-word-1);\n color: var(--color-surface);\n font-weight: var(--font-medium);\n\n &:hover {\n background-color: var(--color-word-1);\n color: var(--color-surface);\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: default;\n }\n }\n }\n\n &__icon {\n flex-shrink: 0;\n width: var(--spacing-16);\n height: var(--spacing-16);\n color: var(--color-word-3);\n }\n\n &__rule {\n margin: var(--spacing-4) 0;\n border: 0;\n border-top: var(--spacing-1) solid var(--color-surface-3);\n }\n\n &__input {\n flex: 1;\n min-width: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-8);\n background-color: var(--color-surface-1);\n color: var(--color-word-1);\n font: inherit;\n\n @media (pointer: coarse) {\n min-height: var(--spacing-40);\n\n // Below 16px Safari on iOS zooms the page on the focus\n font-size: var(--text-16);\n }\n\n &::placeholder {\n color: var(--color-word-3);\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-brand);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n }\n }\n</style>\n"],"mappings":";;;;;;;;AA8BA,IAAMsD,IAAe,sCAEfC,IAAe,uCAKfC,IAAc;AAGpB,SAAgBC,IAAyB;CACrC,OAAO,OAAO,cAAe,cAAc,WAAWF,CAAY,CAAC,CAAC;AACxE;AAiBA,SAASG,EAAQ,GAAgD;CAC7D,IAAMC,IAAY,SAAS,aAAa;CACxC,IAAI,CAACA,KAAaA,EAAU,eAAe,GACvC;CAEJ,IAAI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A,CAAA;KACjB,UAAK,MAAEwJ,EAAID,CAAM;KACjB,aAAQ,MAAEE,EAAMS,SAAcV,EAAID,CAAM,CAAA;I,IACzChJ,EAEyCyJ,GAAA;KADpC,MAAMV,EAAOC,CAAM;KACpB,OAAM;I,uBAA+B/I,EAAA,MACzCJ,EAAGmJ,EAAO,KAAK,GAAA,CAAA,C;IAEnB,AAAAU,EAAA,OAAA/J,EAAyC,MAAA,EAArC,OAAM,6BAA4B,GAAA,MAAA,EAAA;IACtCA,EAUS,UAAA;KATL,MAAK;KACL,OAAM;KACL,aAAS,AAAA+J,EAAA,OAAAjK,QAAV,CAAA,GAAkB,CAAA,SAAA,CAAA;KACjB,SAAOqJ;KACP,YAAQ,AAAAY,EAAA,QAAA,MAAER,EAAMS,GAAQb,CAAO;I,IAChC9I,EAEyCyJ,GAAA;KADrC,MAAK;KACL,OAAM;I,IAA+BxJ,EAAA,MACzCJ,EAAGC,EAAAsI,CAAA,CAAE,CAAA,sBAAA,CAAA,GAAA,CAAA,C"}
@@ -1,224 +0,0 @@
1
- import { r as e } from "./rolldown-runtime-9rEmUaIe.js";
2
- import { _ as t, b as n, g as r, o as i, r as a, s as o } from "./zod-Cty6wiWN.js";
3
- import { C as s, S as c, Tt as l, V as u, X as d, _ as f, f as p, g as m, gt as h, h as g, k as _, kt as v, ot as y, tt as b, v as x, w as S, wt as C, y as w, z as T } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
4
- import { r as ee } from "./vue-i18n-POtLvOl1.js";
5
- import "./src-JJyCGvqH.js";
6
- import { r as E } from "./text-5F7L8EHi.js";
7
- import { i as D } from "./dist-D6oUr4J_.js";
8
- import { d as O, r as k } from "./index.es-DIHz5I8K.js";
9
- import { t as A } from "./VvButtonLocalized-C8S7XJGv.js";
10
- import { t as j } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
11
- // ../../packages/models/src/schema/Chart.ts
12
- var M = [
13
- "bar",
14
- "line",
15
- "pie",
16
- "doughnut"
17
- ], N = [
18
- "positive",
19
- "warning",
20
- "negative",
21
- "critical",
22
- "neutral"
23
- ], P = [
24
- "number",
25
- "percent",
26
- "currency"
27
- ], F = {
28
- maxCategories: 50,
29
- maxSeries: 8,
30
- maxSlices: 12,
31
- maxCharts: 4
32
- }, I = (e) => e === "pie" || e === "doughnut", L = 120, R = t({
33
- name: n().min(1).max(L).describe("Series name, shown in the legend"),
34
- values: i(r().nullable()).max(F.maxCategories).describe("One number per category, in the same order; null for none"),
35
- tone: a(N).optional().describe("Only when the series means a judgement (e.g. high risk = negative): it takes that color")
36
- }), z = t({
37
- type: a(M).describe("bar to compare amounts, line for a trend over time, pie or doughnut for the shares of one whole"),
38
- title: n().max(200).optional().describe("Short title above the chart"),
39
- horizontal: o().optional().describe("bar only: categories on the vertical axis, for long labels"),
40
- stacked: o().optional().describe("bar only: the series stacked into one bar per category"),
41
- categories: i(n().max(L)).min(1).max(F.maxCategories, `At most ${F.maxCategories} categories: group the smallest ones.`).describe("The labels of the x axis (or of the slices), in display order"),
42
- series: i(R).min(1).max(F.maxSeries, `At most ${F.maxSeries} series.`).describe("One or more named series; exactly one for pie or doughnut"),
43
- valueLabel: n().max(L).optional().describe("What the numbers measure, with the unit (e.g. \"Clienti\")"),
44
- categoryLabel: n().max(L).optional().describe("What the categories are (e.g. \"Fascia di rating\")"),
45
- format: a(P).optional().describe("How values read: percent means 0.25 is 25%, currency is in euro")
46
- }).superRefine((e, t) => {
47
- let { type: n, categories: r, series: i } = e, a = (e, n) => t.addIssue({
48
- code: "custom",
49
- message: e,
50
- path: n
51
- });
52
- i.forEach((e, t) => {
53
- e.values.length !== r.length && a(`Series "${e.name}" has ${e.values.length} values for ${r.length} categories: give one value per category.`, [
54
- "series",
55
- t,
56
- "values"
57
- ]), e.values.every((e) => e === null) && a(`Series "${e.name}" has no values: leave it out, or give its numbers.`, [
58
- "series",
59
- t,
60
- "values"
61
- ]);
62
- }), I(n) && (i.length !== 1 && a(`A ${n} chart has exactly one series: ${i.length} given. Use a bar chart to compare several.`, ["series"]), r.length > F.maxSlices && a(`${r.length} slices: at most ${F.maxSlices} in a ${n}. Group the smallest into one, or use a bar chart.`, ["categories"]), i[0]?.values.some((e) => e !== null && e < 0) ? a(`A ${n} chart cannot show negative values.`, [
63
- "series",
64
- 0,
65
- "values"
66
- ]) : i[0]?.values.some((e) => e !== null) && !i[0].values.some((e) => e !== null && e > 0) && a(`A ${n} chart needs at least one value above zero: every slice is empty.`, [
67
- "series",
68
- 0,
69
- "values"
70
- ]));
71
- }), B = t({
72
- charts: i(z).min(1).max(F.maxCharts).describe("Every chart the user asked for, one entry each (e.g. a pie and a bar chart of the same numbers)"),
73
- caption: n().max(500).optional().describe("Optional note below the charts, e.g. the source")
74
- }), V = (e, t = "number") => {
75
- let n = new Intl.NumberFormat(e, t === "percent" ? {
76
- style: "percent",
77
- maximumFractionDigits: 1
78
- } : t === "currency" ? {
79
- style: "currency",
80
- currency: "EUR",
81
- maximumFractionDigits: 0
82
- } : { maximumFractionDigits: 2 }), r = t === "currency" ? new Intl.NumberFormat(e, {
83
- style: "currency",
84
- currency: "EUR"
85
- }) : n;
86
- return (e) => e === null || !Number.isFinite(e) ? "" : (Number.isInteger(e) ? n : r).format(e);
87
- }, H = (e, t) => {
88
- let n = new Intl.NumberFormat(t, {
89
- useGrouping: !1,
90
- maximumFractionDigits: 10
91
- }), r = (e) => e.replace(/[\t\r\n]+/g, " ");
92
- return [[e.categoryLabel ?? "", ...e.series.map((e) => e.name)], ...e.categories.map((t, r) => [t, ...e.series.map((e) => {
93
- let t = e.values[r];
94
- return t == null ? "" : n.format(t);
95
- })])].map((e) => e.map(r).join(" ")).join("\n");
96
- };
97
- // ../../packages/components/src/chat/PkChartCard.vue?vue&type=script&setup=true&lang.ts
98
- _(), y(), l();
99
- var U = { class: "pk-chart-card border border-surface-3 rounded-xl w-full overflow-hidden" }, W = { 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" }, G = { class: "font-bold truncate" }, K = {
100
- key: 0,
101
- class: "pk-chart-card__table-wrap"
102
- }, q = { class: "pk-chart-card__table text-12" }, J = { scope: "col" }, Y = { scope: "row" }, X = {
103
- key: 1,
104
- class: "pk-chart-card__stage px-sm py-sm"
105
- }, Z = {
106
- key: 2,
107
- class: "px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3"
108
- }, Q = /*#__PURE__*/ j(/* @__PURE__ */ S({
109
- __name: "PkChartCard",
110
- props: {
111
- chart: { type: null },
112
- caption: { type: String },
113
- isDark: { type: Boolean }
114
- },
115
- setup(e) {
116
- let t = s(() => import("./PkChart-CbtMRGWc.js")), n = e, { t: r, locale: i } = ee({ useScope: "global" }), { copy: a, copied: o } = D(), l = g(() => {
117
- switch (n.chart.type) {
118
- case "line": return "ri:line-chart-line";
119
- case "pie": return "ri:pie-chart-line";
120
- case "doughnut": return "ri:donut-chart-line";
121
- default: return n.chart.horizontal ? "ri:bar-chart-horizontal-line" : "ri:bar-chart-2-line";
122
- }
123
- }), _ = h(!1), y = g(() => V(i.value, n.chart.format)), S = d("chartRef"), j = async () => {
124
- let e = await S.value?.toBlob();
125
- if (!e) return;
126
- let t = URL.createObjectURL(e), r = document.createElement("a");
127
- r.href = t, r.download = `${E(n.chart.title || "chart")}.png`, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(t);
128
- };
129
- return (n, s) => {
130
- let d = k, h = A, g = O;
131
- return T(), w("div", U, [
132
- m("div", W, [
133
- c(d, {
134
- name: l.value,
135
- class: "text-16 shrink-0"
136
- }, null, 8, ["name"]),
137
- m("strong", G, v(e.chart.title || C(r)("label.chart")), 1),
138
- c(g, {
139
- modifiers: "compact",
140
- class: "pk-chart-card__actions ml-auto shrink-0"
141
- }, {
142
- default: b(() => [
143
- c(h, {
144
- modifiers: "action-quiet-small",
145
- icon: _.value ? l.value : "ri:table-line",
146
- label: _.value ? C(r)("chart.showChart") : C(r)("chart.showTable"),
147
- onClick: s[0] ||= (e) => _.value = !_.value
148
- }, null, 8, ["icon", "label"]),
149
- c(h, {
150
- modifiers: "action-quiet-small",
151
- icon: C(o) ? "ri:check-line" : "ri:file-copy-line",
152
- label: C(o) ? C(r)("action.copied") : C(r)("chart.copyData"),
153
- onClick: s[1] ||= (t) => C(a)(C(H)(e.chart, C(i)))
154
- }, null, 8, ["icon", "label"]),
155
- _.value ? x("", !0) : (T(), f(h, {
156
- key: 0,
157
- modifiers: "action-quiet-small",
158
- icon: "ri:download-line",
159
- label: C(r)("action.download"),
160
- title: C(r)("chart.downloadPng"),
161
- onClick: j
162
- }, null, 8, ["label", "title"]))
163
- ]),
164
- _: 1
165
- })
166
- ]),
167
- _.value ? (T(), w("div", K, [m("table", q, [m("thead", null, [m("tr", null, [m("th", J, v(e.chart.categoryLabel ?? ""), 1), (T(!0), w(p, null, u(e.chart.series, (e) => (T(), w("th", {
168
- key: e.name,
169
- scope: "col"
170
- }, v(e.name), 1))), 128))])]), m("tbody", null, [(T(!0), w(p, null, u(e.chart.categories, (t, n) => (T(), w("tr", { key: n }, [m("th", Y, v(t), 1), (T(!0), w(p, null, u(e.chart.series, (e) => (T(), w("td", { key: e.name }, v(y.value(e.values[n] ?? null)), 1))), 128))]))), 128))])])])) : (T(), w("div", X, [c(C(t), {
171
- ref_key: "chartRef",
172
- ref: S,
173
- chart: e.chart,
174
- "is-dark": e.isDark
175
- }, null, 8, ["chart", "is-dark"])])),
176
- e.caption ? (T(), w("div", Z, v(e.caption), 1)) : x("", !0)
177
- ]);
178
- };
179
- }
180
- }), [["styles", [".pk-chart-card{container-type:inline-size}@container (width<30rem){.pk-chart-card__actions .vv-button__label{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}}.pk-chart-card__stage{height:320px}.pk-chart-card__table-wrap{max-height:320px;overflow:auto}.pk-chart-card__table{border-collapse:collapse;width:100%}.pk-chart-card__table th,.pk-chart-card__table td{padding:var(--spacing-6) var(--spacing-sm);border-bottom:1px solid var(--color-surface-3);text-align:right;white-space:nowrap}.pk-chart-card__table th:first-child{text-align:left;white-space:normal}.pk-chart-card__table thead th{color:var(--color-word-3);font-weight:600}.pk-chart-card__table tbody th{color:var(--color-word-2);font-weight:400}.pk-chart-card__table td{color:var(--color-word);font-variant-numeric:tabular-nums}.pk-chart-card__table tbody tr:last-child>*{border-bottom:0}"]]]);
181
- // ../../packages/components/src/chat/PkToolShowChart.vue?vue&type=script&setup=true&lang.ts
182
- _(), l();
183
- var te = {
184
- key: 0,
185
- class: "flex flex-col gap-sm w-full"
186
- }, ne = {
187
- key: 1,
188
- class: "pk-tool-show-chart__loading border border-surface-3 rounded-xl w-full flex justify-center items-center"
189
- }, re = {
190
- key: 2,
191
- class: "border border-surface-3 rounded-xl w-full text-12 text-danger py-8 px-sm"
192
- }, ie = /*@__PURE__*/ S({
193
- __name: "PkToolShowChart",
194
- props: {
195
- part: { type: null },
196
- isDark: { type: Boolean }
197
- },
198
- setup(e) {
199
- let t = e, n = g(() => t.part), r = g(() => n.value.state === "input-streaming"), i = g(() => n.value.state === "output-error"), a = g(() => {
200
- if (r.value) return;
201
- let e = B.safeParse(n.value.input);
202
- return e.success ? e.data : void 0;
203
- });
204
- return (t, n) => {
205
- let o = k;
206
- return a.value ? (T(), w("div", te, [(T(!0), w(p, null, u(a.value.charts, (t, n) => (T(), f(Q, {
207
- key: n,
208
- chart: t,
209
- caption: n === a.value.charts.length - 1 ? a.value.caption : void 0,
210
- "is-dark": e.isDark
211
- }, null, 8, [
212
- "chart",
213
- "caption",
214
- "is-dark"
215
- ]))), 128))])) : r.value ? (T(), w("div", ne, [c(o, {
216
- name: "loading-loop",
217
- class: "w-24 h-24 text-word-5"
218
- })])) : i.value ? x("", !0) : (T(), w("div", re, v(t.$t("message.chartRenderError")), 1));
219
- };
220
- }
221
- }), ae = ".pk-tool-show-chart__loading{height:360px}", oe = /* @__PURE__ */ e({ default: () => $ }), $ = /*#__PURE__*/ j(ie, [["styles", [ae]]]);
222
- export { $ as default, V as n, I as r, oe as t };
223
-
224
- //# sourceMappingURL=PkToolShowChart-DZWu3Yuo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkToolShowChart-DZWu3Yuo.js","names":["z.object","z.string","z.array","z.number","z.enum","z.boolean","_hoisted_1","_hoisted_2","_hoisted_3","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_unref","_withCtx","_createBlock","_createCommentVNode","_Fragment","_renderList","_sfc_main","_style_0","$t","__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_renderList","_createBlock","PkChartCard","_createVNode","_toDisplayString","_createCommentVNode","_sfc_main","_style_0","__exportAll","object","string","number","array","_enum","boolean","defineAsyncComponent","createVNode","init_shared_esm_bundler","renderList","useTemplateRef","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","withCtx","createCommentVNode","defineComponent","unref","createElementBlock","openBlock","useI18n","toSnakeCase","useClipboard","ou","Ee","VvButtonLocalized","_plugin_vue_export_helper_default","CHART_TYPES","CHART_TONES","CHART_FORMATS","CHART_LIMITS","isRoundChart","type","LABEL_MAX","ChartSeriesSchema","ChartSchema","chart","issue","ctx","series","s","categories","i","v","ShowChartInputSchema","chartValueFormatter","formatter","locale","format","cents","value","chartAsTsv","clean","text","category","row","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","PkChartCard_default","PkChart","props","__props","$t","icon","showTable","chartRef","downloadPng","blob","url","anchor","_component_VvIcon","_component_VvButton","_component_VvButtonGroup","_cache","copied","copy","_hoisted_1","_hoisted_2","_hoisted_3","PkToolShowChart_vue_vue_type_script_setup_true_lang_default","toolPart","streaming","refused","input","parsed","_ctx","PkToolShowChart_vue_vue_type_style_index_0_inline_lang_default","PkToolShowChart_exports","PkToolShowChart_default"],"sources":["../../../../packages/models/src/schema/Chart.ts","../../../../packages/components/src/chat/chartFormat.ts","../../../../packages/components/src/chat/PkChartCard.vue","../../../../packages/components/src/chat/PkChartCard.vue","../../../../packages/components/src/chat/PkChartCard.vue","../../../../packages/components/src/chat/PkToolShowChart.vue","../../../../packages/components/src/chat/PkToolShowChart.vue","../../../../packages/components/src/chat/PkToolShowChart.vue"],"sourcesContent":["import * as z from 'zod'\nimport { AgentBuiltInTool } from './Agent'\n\n// A chart as the model describes it (spec `chat-charts.md`): categories and\n// named series of numbers, no colors or code. `showChart` draws it in the\n// chat; the Excel and Word files the agent creates write the same shape as a\n// native Office chart.\n\nexport const CHART_TYPES = ['bar', 'line', 'pie', 'doughnut'] as const\nexport type ChartType = (typeof CHART_TYPES)[number]\n\n/** The meaning a series' color carries, drawn with the semantic colors. */\nexport const CHART_TONES = [\n 'positive',\n 'warning',\n 'negative',\n 'critical',\n 'neutral',\n] as const\nexport type ChartTone = (typeof CHART_TONES)[number]\n\nexport const CHART_FORMATS = ['number', 'percent', 'currency'] as const\nexport type ChartFormat = (typeof CHART_FORMATS)[number]\n\nexport const CHART_LIMITS = {\n maxCategories: 50,\n maxSeries: 8,\n /** Slices of a pie or a doughnut: more do not read. */\n maxSlices: 12,\n /** Charts in one `showChart` call. */\n maxCharts: 4,\n} as const\n\n/**\n * The agent can draw a chart in the chat: with `showChart`, or with the\n * Mermaid XY chart of `showDiagram` when it has not got the first. What the\n * \"Make a chart\" selection action needs.\n */\nexport const hasChatChartTool = (\n disabledTools: readonly AgentBuiltInTool[],\n): boolean =>\n !disabledTools.includes(AgentBuiltInTool.ShowChart) ||\n !disabledTools.includes(AgentBuiltInTool.ShowDiagram)\n\n/** A pie or a doughnut: one series, its values the slices. */\nexport const isRoundChart = (type: ChartType): boolean =>\n type === 'pie' || type === 'doughnut'\n\n/** Labels short enough for a legend, an axis and a slice. */\nconst LABEL_MAX = 120\n\nexport const ChartSeriesSchema = z.object({\n name: z\n .string()\n .min(1)\n .max(LABEL_MAX)\n .describe('Series name, shown in the legend'),\n values: z\n .array(z.number().nullable())\n .max(CHART_LIMITS.maxCategories)\n .describe('One number per category, in the same order; null for none'),\n tone: z\n .enum(CHART_TONES)\n .optional()\n .describe(\n 'Only when the series means a judgement (e.g. high risk = negative): it takes that color',\n ),\n})\nexport type ChartSeries = z.infer<typeof ChartSeriesSchema>\n\n/**\n * The fields of a chart, without the checks across them: the schema a tool\n * extends before {@link refineChart} adds those checks.\n */\nexport const ChartFieldsSchema = z.object({\n type: z\n .enum(CHART_TYPES)\n .describe(\n 'bar to compare amounts, line for a trend over time, pie or doughnut for the shares of one whole',\n ),\n title: z\n .string()\n .max(200)\n .optional()\n .describe('Short title above the chart'),\n horizontal: z\n .boolean()\n .optional()\n .describe('bar only: categories on the vertical axis, for long labels'),\n stacked: z\n .boolean()\n .optional()\n .describe('bar only: the series stacked into one bar per category'),\n // The limits in the schema, so the model reads them before it writes\n categories: z\n .array(z.string().max(LABEL_MAX))\n .min(1)\n .max(\n CHART_LIMITS.maxCategories,\n `At most ${CHART_LIMITS.maxCategories} categories: group the smallest ones.`,\n )\n .describe(\n 'The labels of the x axis (or of the slices), in display order',\n ),\n series: z\n .array(ChartSeriesSchema)\n .min(1)\n .max(\n CHART_LIMITS.maxSeries,\n `At most ${CHART_LIMITS.maxSeries} series.`,\n )\n .describe('One or more named series; exactly one for pie or doughnut'),\n valueLabel: z\n .string()\n .max(LABEL_MAX)\n .optional()\n .describe('What the numbers measure, with the unit (e.g. \"Clienti\")'),\n categoryLabel: z\n .string()\n .max(LABEL_MAX)\n .optional()\n .describe('What the categories are (e.g. \"Fascia di rating\")'),\n format: z\n .enum(CHART_FORMATS)\n .optional()\n .describe(\n 'How values read: percent means 0.25 is 25%, currency is in euro',\n ),\n})\n\n/**\n * The checks JSON Schema cannot state, worded for the model that wrote the\n * chart: it reads the message and calls again.\n */\nexport const refineChart = (\n chart: z.infer<typeof ChartFieldsSchema>,\n ctx: z.RefinementCtx,\n) => {\n const { type, categories, series } = chart\n const issue = (message: string, path: (string | number)[]) =>\n ctx.addIssue({ code: 'custom', message, path })\n series.forEach((s, i) => {\n if (s.values.length !== categories.length) {\n issue(\n `Series \"${s.name}\" has ${s.values.length} values for ${categories.length} categories: give one value per category.`,\n ['series', i, 'values'],\n )\n }\n if (s.values.every((v) => v === null)) {\n issue(\n `Series \"${s.name}\" has no values: leave it out, or give its numbers.`,\n ['series', i, 'values'],\n )\n }\n })\n if (isRoundChart(type)) {\n if (series.length !== 1) {\n issue(\n `A ${type} chart has exactly one series: ${series.length} given. Use a bar chart to compare several.`,\n ['series'],\n )\n }\n if (categories.length > CHART_LIMITS.maxSlices) {\n issue(\n `${categories.length} slices: at most ${CHART_LIMITS.maxSlices} in a ${type}. Group the smallest into one, or use a bar chart.`,\n ['categories'],\n )\n }\n if (series[0]?.values.some((v) => v !== null && v < 0)) {\n issue(`A ${type} chart cannot show negative values.`, [\n 'series',\n 0,\n 'values',\n ])\n } else if (\n series[0]?.values.some((v) => v !== null) &&\n !series[0].values.some((v) => v !== null && v > 0)\n ) {\n issue(\n `A ${type} chart needs at least one value above zero: every slice is empty.`,\n ['series', 0, 'values'],\n )\n }\n }\n}\n\nexport const ChartSchema = ChartFieldsSchema.superRefine(refineChart)\nexport type Chart = z.infer<typeof ChartSchema>\n\n/**\n * The input of `showChart`: every chart the user asked for in one call. A\n * presentation tool ends the turn, and a model that calls one chart at a\n * time (GPT-6.1 Sol, asked for a pie and a bar chart, drew the pie only)\n * would never draw the second.\n */\nexport const ShowChartInputSchema = z.object({\n charts: z\n .array(ChartSchema)\n .min(1)\n .max(CHART_LIMITS.maxCharts)\n .describe(\n 'Every chart the user asked for, one entry each (e.g. a pie and a bar chart of the same numbers)',\n ),\n caption: z\n .string()\n .max(500)\n .optional()\n .describe('Optional note below the charts, e.g. the source'),\n})\nexport type ShowChartInput = z.infer<typeof ShowChartInputSchema>\n","import type { ChartFormat } from 'models'\n\n/**\n * How the values of a chart read, on its axis, in its tooltip and in its\n * table: `percent` takes 0.25 as 25%, `currency` is in euro, as the model is\n * told (spec `chat-charts.md`).\n */\nexport const chartValueFormatter = (\n locale: string,\n format: ChartFormat = 'number',\n): ((value: number | null) => string) => {\n const formatter = new Intl.NumberFormat(\n locale,\n format === 'percent'\n ? { style: 'percent', maximumFractionDigits: 1 }\n : format === 'currency'\n ? { style: 'currency', currency: 'EUR', maximumFractionDigits: 0 }\n : { maximumFractionDigits: 2 },\n )\n // 160.000 € on an axis, 12,50 € where there are cents\n const cents =\n format === 'currency'\n ? new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: 'EUR',\n })\n : formatter\n return (value) =>\n value === null || !Number.isFinite(value)\n ? ''\n : (Number.isInteger(value) ? formatter : cents).format(value)\n}\n\n/**\n * The chart as tab-separated text: pasted in Excel or Sheets it lands in\n * cells, one row per category and one column per series. The numbers are\n * written in the reader's locale without grouping: an Italian Excel reads\n * \"12.5\" as text or a date, \"12,5\" as the number.\n */\nexport const chartAsTsv = (\n chart: {\n categories: string[]\n series: { name: string; values: (number | null)[] }[]\n categoryLabel?: string\n },\n locale: string,\n): string => {\n const number = new Intl.NumberFormat(locale, {\n useGrouping: false,\n maximumFractionDigits: 10,\n })\n const clean = (text: string) => text.replace(/[\\t\\r\\n]+/g, ' ')\n const rows = [\n [chart.categoryLabel ?? '', ...chart.series.map((s) => s.name)],\n ...chart.categories.map((category, i) => [\n category,\n ...chart.series.map((s) => {\n const value = s.values[i]\n return value === null || value === undefined\n ? ''\n : number.format(value)\n }),\n ]),\n ]\n return rows.map((row) => row.map(clean).join('\\t')).join('\\n')\n}\n","<script setup lang=\"ts\">\n import { computed, defineAsyncComponent, ref, useTemplateRef } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import type { Chart } from 'models'\n import { toSnakeCase } from 'utils'\n import { chartAsTsv, chartValueFormatter } from './chartFormat'\n\n // Chart.js comes with it: a separate chunk, loaded with the first chart\n const PkChart = defineAsyncComponent(() => import('./PkChart.vue'))\n\n /**\n * One chart of `showChart` (spec `chat-charts.md`) in its card: the chart,\n * the same numbers as a table, \"Copy data\" for a sheet and the chart as a\n * PNG.\n */\n const props = defineProps<{\n chart: Chart\n /** A note below the chart, e.g. the source of the numbers. */\n caption?: string\n isDark?: boolean\n }>()\n\n const { t: $t, locale } = useI18n({ useScope: 'global' })\n const { copy, copied } = useClipboard()\n\n const icon = computed(() => {\n switch (props.chart.type) {\n case 'line':\n return 'ri:line-chart-line'\n case 'pie':\n return 'ri:pie-chart-line'\n case 'doughnut':\n return 'ri:donut-chart-line'\n default:\n return props.chart.horizontal\n ? 'ri:bar-chart-horizontal-line'\n : 'ri:bar-chart-2-line'\n }\n })\n\n const showTable = ref(false)\n const format = computed(() =>\n chartValueFormatter(locale.value, props.chart.format),\n )\n\n const chartRef = useTemplateRef<{ toBlob: () => Promise<Blob | null> }>(\n 'chartRef',\n )\n const downloadPng = async () => {\n const blob = await chartRef.value?.toBlob()\n if (!blob) {\n return\n }\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(props.chart.title || 'chart')}.png`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n</script>\n\n<template>\n <div\n class=\"pk-chart-card 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=\"icon\" class=\"text-16 shrink-0\" />\n <strong class=\"font-bold truncate\">\n {{ chart.title || $t('label.chart') }}\n </strong>\n <VvButtonGroup\n modifiers=\"compact\"\n class=\"pk-chart-card__actions ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"showTable ? icon : 'ri:table-line'\"\n :label=\"\n showTable\n ? $t('chart.showChart')\n : $t('chart.showTable')\n \"\n @click=\"showTable = !showTable\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('chart.copyData')\"\n @click=\"copy(chartAsTsv(chart, locale))\" />\n <VvButton\n v-if=\"!showTable\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n :title=\"$t('chart.downloadPng')\"\n @click=\"downloadPng\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"showTable\" class=\"pk-chart-card__table-wrap\">\n <table class=\"pk-chart-card__table text-12\">\n <thead>\n <tr>\n <th scope=\"col\">{{ chart.categoryLabel ?? '' }}</th>\n <th\n v-for=\"series in chart.series\"\n :key=\"series.name\"\n scope=\"col\">\n {{ series.name }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"(category, i) in chart.categories\" :key=\"i\">\n <th scope=\"row\">{{ category }}</th>\n <td v-for=\"series in chart.series\" :key=\"series.name\">\n {{ format(series.values[i] ?? null) }}\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <div v-else class=\"pk-chart-card__stage px-sm py-sm\">\n <PkChart ref=\"chartRef\" :chart :is-dark />\n </div>\n <div\n v-if=\"caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chart-card {\n // A container for the narrow card below. It is also the containing\n // block of any `position: fixed` inside it, so a menu added here\n // must open in the top layer (docs/agents/gotchas/frontend.md, \"The\n // chat measures its own width\"): today the card has none.\n container-type: inline-size;\n\n // On a narrow card the actions keep their icon and lose the word on\n // screen, still read by a screen reader: the title keeps the room\n // (at 390px it was cut to \"Fattori di ...\")\n @container (width < 30rem) {\n &__actions .vv-button__label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n }\n\n // A fixed stage, as the diagram's: the chart loads in a chunk of its\n // own, and loader and chart must take the same room or the chat's\n // scroll jumps\n &__stage {\n height: 320px;\n }\n\n &__table-wrap {\n max-height: 320px;\n overflow: auto;\n }\n\n &__table {\n width: 100%;\n border-collapse: collapse;\n\n th,\n td {\n padding: var(--spacing-6) var(--spacing-sm);\n border-bottom: 1px solid var(--color-surface-3);\n text-align: right;\n white-space: nowrap;\n }\n\n th:first-child {\n text-align: left;\n white-space: normal;\n }\n\n thead th {\n color: var(--color-word-3);\n font-weight: 600;\n }\n\n tbody th {\n color: var(--color-word-2);\n font-weight: 400;\n }\n\n td {\n color: var(--color-word);\n font-variant-numeric: tabular-nums;\n }\n\n tbody tr:last-child > * {\n border-bottom: 0;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, defineAsyncComponent, ref, useTemplateRef } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import type { Chart } from 'models'\n import { toSnakeCase } from 'utils'\n import { chartAsTsv, chartValueFormatter } from './chartFormat'\n\n // Chart.js comes with it: a separate chunk, loaded with the first chart\n const PkChart = defineAsyncComponent(() => import('./PkChart.vue'))\n\n /**\n * One chart of `showChart` (spec `chat-charts.md`) in its card: the chart,\n * the same numbers as a table, \"Copy data\" for a sheet and the chart as a\n * PNG.\n */\n const props = defineProps<{\n chart: Chart\n /** A note below the chart, e.g. the source of the numbers. */\n caption?: string\n isDark?: boolean\n }>()\n\n const { t: $t, locale } = useI18n({ useScope: 'global' })\n const { copy, copied } = useClipboard()\n\n const icon = computed(() => {\n switch (props.chart.type) {\n case 'line':\n return 'ri:line-chart-line'\n case 'pie':\n return 'ri:pie-chart-line'\n case 'doughnut':\n return 'ri:donut-chart-line'\n default:\n return props.chart.horizontal\n ? 'ri:bar-chart-horizontal-line'\n : 'ri:bar-chart-2-line'\n }\n })\n\n const showTable = ref(false)\n const format = computed(() =>\n chartValueFormatter(locale.value, props.chart.format),\n )\n\n const chartRef = useTemplateRef<{ toBlob: () => Promise<Blob | null> }>(\n 'chartRef',\n )\n const downloadPng = async () => {\n const blob = await chartRef.value?.toBlob()\n if (!blob) {\n return\n }\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(props.chart.title || 'chart')}.png`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n</script>\n\n<template>\n <div\n class=\"pk-chart-card 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=\"icon\" class=\"text-16 shrink-0\" />\n <strong class=\"font-bold truncate\">\n {{ chart.title || $t('label.chart') }}\n </strong>\n <VvButtonGroup\n modifiers=\"compact\"\n class=\"pk-chart-card__actions ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"showTable ? icon : 'ri:table-line'\"\n :label=\"\n showTable\n ? $t('chart.showChart')\n : $t('chart.showTable')\n \"\n @click=\"showTable = !showTable\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('chart.copyData')\"\n @click=\"copy(chartAsTsv(chart, locale))\" />\n <VvButton\n v-if=\"!showTable\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n :title=\"$t('chart.downloadPng')\"\n @click=\"downloadPng\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"showTable\" class=\"pk-chart-card__table-wrap\">\n <table class=\"pk-chart-card__table text-12\">\n <thead>\n <tr>\n <th scope=\"col\">{{ chart.categoryLabel ?? '' }}</th>\n <th\n v-for=\"series in chart.series\"\n :key=\"series.name\"\n scope=\"col\">\n {{ series.name }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"(category, i) in chart.categories\" :key=\"i\">\n <th scope=\"row\">{{ category }}</th>\n <td v-for=\"series in chart.series\" :key=\"series.name\">\n {{ format(series.values[i] ?? null) }}\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <div v-else class=\"pk-chart-card__stage px-sm py-sm\">\n <PkChart ref=\"chartRef\" :chart :is-dark />\n </div>\n <div\n v-if=\"caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chart-card {\n // A container for the narrow card below. It is also the containing\n // block of any `position: fixed` inside it, so a menu added here\n // must open in the top layer (docs/agents/gotchas/frontend.md, \"The\n // chat measures its own width\"): today the card has none.\n container-type: inline-size;\n\n // On a narrow card the actions keep their icon and lose the word on\n // screen, still read by a screen reader: the title keeps the room\n // (at 390px it was cut to \"Fattori di ...\")\n @container (width < 30rem) {\n &__actions .vv-button__label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n }\n\n // A fixed stage, as the diagram's: the chart loads in a chunk of its\n // own, and loader and chart must take the same room or the chat's\n // scroll jumps\n &__stage {\n height: 320px;\n }\n\n &__table-wrap {\n max-height: 320px;\n overflow: auto;\n }\n\n &__table {\n width: 100%;\n border-collapse: collapse;\n\n th,\n td {\n padding: var(--spacing-6) var(--spacing-sm);\n border-bottom: 1px solid var(--color-surface-3);\n text-align: right;\n white-space: nowrap;\n }\n\n th:first-child {\n text-align: left;\n white-space: normal;\n }\n\n thead th {\n color: var(--color-word-3);\n font-weight: 600;\n }\n\n tbody th {\n color: var(--color-word-2);\n font-weight: 400;\n }\n\n td {\n color: var(--color-word);\n font-variant-numeric: tabular-nums;\n }\n\n tbody tr:last-child > * {\n border-bottom: 0;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, defineAsyncComponent, ref, useTemplateRef } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import type { Chart } from 'models'\n import { toSnakeCase } from 'utils'\n import { chartAsTsv, chartValueFormatter } from './chartFormat'\n\n // Chart.js comes with it: a separate chunk, loaded with the first chart\n const PkChart = defineAsyncComponent(() => import('./PkChart.vue'))\n\n /**\n * One chart of `showChart` (spec `chat-charts.md`) in its card: the chart,\n * the same numbers as a table, \"Copy data\" for a sheet and the chart as a\n * PNG.\n */\n const props = defineProps<{\n chart: Chart\n /** A note below the chart, e.g. the source of the numbers. */\n caption?: string\n isDark?: boolean\n }>()\n\n const { t: $t, locale } = useI18n({ useScope: 'global' })\n const { copy, copied } = useClipboard()\n\n const icon = computed(() => {\n switch (props.chart.type) {\n case 'line':\n return 'ri:line-chart-line'\n case 'pie':\n return 'ri:pie-chart-line'\n case 'doughnut':\n return 'ri:donut-chart-line'\n default:\n return props.chart.horizontal\n ? 'ri:bar-chart-horizontal-line'\n : 'ri:bar-chart-2-line'\n }\n })\n\n const showTable = ref(false)\n const format = computed(() =>\n chartValueFormatter(locale.value, props.chart.format),\n )\n\n const chartRef = useTemplateRef<{ toBlob: () => Promise<Blob | null> }>(\n 'chartRef',\n )\n const downloadPng = async () => {\n const blob = await chartRef.value?.toBlob()\n if (!blob) {\n return\n }\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(props.chart.title || 'chart')}.png`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n</script>\n\n<template>\n <div\n class=\"pk-chart-card 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=\"icon\" class=\"text-16 shrink-0\" />\n <strong class=\"font-bold truncate\">\n {{ chart.title || $t('label.chart') }}\n </strong>\n <VvButtonGroup\n modifiers=\"compact\"\n class=\"pk-chart-card__actions ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"showTable ? icon : 'ri:table-line'\"\n :label=\"\n showTable\n ? $t('chart.showChart')\n : $t('chart.showTable')\n \"\n @click=\"showTable = !showTable\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('chart.copyData')\"\n @click=\"copy(chartAsTsv(chart, locale))\" />\n <VvButton\n v-if=\"!showTable\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n :title=\"$t('chart.downloadPng')\"\n @click=\"downloadPng\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"showTable\" class=\"pk-chart-card__table-wrap\">\n <table class=\"pk-chart-card__table text-12\">\n <thead>\n <tr>\n <th scope=\"col\">{{ chart.categoryLabel ?? '' }}</th>\n <th\n v-for=\"series in chart.series\"\n :key=\"series.name\"\n scope=\"col\">\n {{ series.name }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"(category, i) in chart.categories\" :key=\"i\">\n <th scope=\"row\">{{ category }}</th>\n <td v-for=\"series in chart.series\" :key=\"series.name\">\n {{ format(series.values[i] ?? null) }}\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <div v-else class=\"pk-chart-card__stage px-sm py-sm\">\n <PkChart ref=\"chartRef\" :chart :is-dark />\n </div>\n <div\n v-if=\"caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chart-card {\n // A container for the narrow card below. It is also the containing\n // block of any `position: fixed` inside it, so a menu added here\n // must open in the top layer (docs/agents/gotchas/frontend.md, \"The\n // chat measures its own width\"): today the card has none.\n container-type: inline-size;\n\n // On a narrow card the actions keep their icon and lose the word on\n // screen, still read by a screen reader: the title keeps the room\n // (at 390px it was cut to \"Fattori di ...\")\n @container (width < 30rem) {\n &__actions .vv-button__label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n }\n\n // A fixed stage, as the diagram's: the chart loads in a chunk of its\n // own, and loader and chart must take the same room or the chat's\n // scroll jumps\n &__stage {\n height: 320px;\n }\n\n &__table-wrap {\n max-height: 320px;\n overflow: auto;\n }\n\n &__table {\n width: 100%;\n border-collapse: collapse;\n\n th,\n td {\n padding: var(--spacing-6) var(--spacing-sm);\n border-bottom: 1px solid var(--color-surface-3);\n text-align: right;\n white-space: nowrap;\n }\n\n th:first-child {\n text-align: left;\n white-space: normal;\n }\n\n thead th {\n color: var(--color-word-3);\n font-weight: 600;\n }\n\n tbody th {\n color: var(--color-word-2);\n font-weight: 400;\n }\n\n td {\n color: var(--color-word);\n font-variant-numeric: tabular-nums;\n }\n\n tbody tr:last-child > * {\n border-bottom: 0;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { ShowChartInputSchema } from 'models'\n import PkChartCard from './PkChartCard.vue'\n\n /**\n * The cards of `showChart` (spec `chat-charts.md`): every chart of the\n * call in its own card, one under the other, the caption under the last.\n */\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const toolPart = computed(\n () => props.part as { state?: string; input?: unknown },\n )\n // A half-written input has series shorter than the categories\n const streaming = computed(() => toolPart.value.state === 'input-streaming')\n // A call the tool refused for its input: the model reads why and calls\n // again, and the corrected chart follows it. Nothing to show here.\n const refused = computed(() => toolPart.value.state === 'output-error')\n /** The input as the tool validated it; a stored one that is not stays a message. */\n const input = computed(() => {\n if (streaming.value) {\n return undefined\n }\n const parsed = ShowChartInputSchema.safeParse(toolPart.value.input)\n return parsed.success ? parsed.data : undefined\n })\n</script>\n\n<template>\n <div v-if=\"input\" class=\"flex flex-col gap-sm w-full\">\n <PkChartCard\n v-for=\"(chart, i) in input.charts\"\n :key=\"i\"\n :chart\n :caption=\"i === input.charts.length - 1 ? input.caption : undefined\"\n :is-dark />\n </div>\n <div\n v-else-if=\"streaming\"\n class=\"pk-tool-show-chart__loading border border-surface-3 rounded-xl w-full flex justify-center items-center\">\n <VvIcon name=\"loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-else-if=\"!refused\"\n class=\"border border-surface-3 rounded-xl w-full text-12 text-danger py-8 px-sm\">\n {{ $t('message.chartRenderError') }}\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-chart {\n // The height of a card while the call is written: the card that\n // replaces it takes about as much, and the chat's scroll stays put\n &__loading {\n height: 360px;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { ShowChartInputSchema } from 'models'\n import PkChartCard from './PkChartCard.vue'\n\n /**\n * The cards of `showChart` (spec `chat-charts.md`): every chart of the\n * call in its own card, one under the other, the caption under the last.\n */\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const toolPart = computed(\n () => props.part as { state?: string; input?: unknown },\n )\n // A half-written input has series shorter than the categories\n const streaming = computed(() => toolPart.value.state === 'input-streaming')\n // A call the tool refused for its input: the model reads why and calls\n // again, and the corrected chart follows it. Nothing to show here.\n const refused = computed(() => toolPart.value.state === 'output-error')\n /** The input as the tool validated it; a stored one that is not stays a message. */\n const input = computed(() => {\n if (streaming.value) {\n return undefined\n }\n const parsed = ShowChartInputSchema.safeParse(toolPart.value.input)\n return parsed.success ? parsed.data : undefined\n })\n</script>\n\n<template>\n <div v-if=\"input\" class=\"flex flex-col gap-sm w-full\">\n <PkChartCard\n v-for=\"(chart, i) in input.charts\"\n :key=\"i\"\n :chart\n :caption=\"i === input.charts.length - 1 ? input.caption : undefined\"\n :is-dark />\n </div>\n <div\n v-else-if=\"streaming\"\n class=\"pk-tool-show-chart__loading border border-surface-3 rounded-xl w-full flex justify-center items-center\">\n <VvIcon name=\"loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-else-if=\"!refused\"\n class=\"border border-surface-3 rounded-xl w-full text-12 text-danger py-8 px-sm\">\n {{ $t('message.chartRenderError') }}\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-chart {\n // The height of a card while the call is written: the card that\n // replaces it takes about as much, and the chat's scroll stays put\n &__loading {\n height: 360px;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { ShowChartInputSchema } from 'models'\n import PkChartCard from './PkChartCard.vue'\n\n /**\n * The cards of `showChart` (spec `chat-charts.md`): every chart of the\n * call in its own card, one under the other, the caption under the last.\n */\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const toolPart = computed(\n () => props.part as { state?: string; input?: unknown },\n )\n // A half-written input has series shorter than the categories\n const streaming = computed(() => toolPart.value.state === 'input-streaming')\n // A call the tool refused for its input: the model reads why and calls\n // again, and the corrected chart follows it. Nothing to show here.\n const refused = computed(() => toolPart.value.state === 'output-error')\n /** The input as the tool validated it; a stored one that is not stays a message. */\n const input = computed(() => {\n if (streaming.value) {\n return undefined\n }\n const parsed = ShowChartInputSchema.safeParse(toolPart.value.input)\n return parsed.success ? parsed.data : undefined\n })\n</script>\n\n<template>\n <div v-if=\"input\" class=\"flex flex-col gap-sm w-full\">\n <PkChartCard\n v-for=\"(chart, i) in input.charts\"\n :key=\"i\"\n :chart\n :caption=\"i === input.charts.length - 1 ? input.caption : undefined\"\n :is-dark />\n </div>\n <div\n v-else-if=\"streaming\"\n class=\"pk-tool-show-chart__loading border border-surface-3 rounded-xl w-full flex justify-center items-center\">\n <VvIcon name=\"loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-else-if=\"!refused\"\n class=\"border border-surface-3 rounded-xl w-full text-12 text-danger py-8 px-sm\">\n {{ $t('message.chartRenderError') }}\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-chart {\n // The height of a card while the call is written: the card that\n // replaces it takes about as much, and the chat's scroll stays put\n &__loading {\n height: 360px;\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;AAQA,IAAauE,IAAc;CAAC;CAAO;CAAQ;CAAO;AAAU,GAI/CC,IAAc;CACv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