markdown-flow-ui 0.3.5 → 0.3.7

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 (352) hide show
  1. package/dist/_virtual/index8.cjs +1 -1
  2. package/dist/_virtual/index8.es.js +2 -2
  3. package/dist/_virtual/index9.cjs +1 -1
  4. package/dist/_virtual/index9.es.js +2 -2
  5. package/dist/assets/markdown-flow-ui.css +1 -1
  6. package/dist/components/ContentRender/ContentRender.cjs +2 -2
  7. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  8. package/dist/components/ContentRender/ContentRender.d.ts +2 -0
  9. package/dist/components/ContentRender/ContentRender.es.js +513 -509
  10. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  11. package/dist/components/ContentRender/MarkdownFlowInput.cjs +1 -1
  12. package/dist/components/ContentRender/MarkdownFlowInput.cjs.map +1 -1
  13. package/dist/components/ContentRender/MarkdownFlowInput.d.ts +2 -0
  14. package/dist/components/ContentRender/MarkdownFlowInput.es.js +40 -38
  15. package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
  16. package/dist/components/ContentRender/plugins/CustomVariable.cjs +1 -1
  17. package/dist/components/ContentRender/plugins/CustomVariable.cjs.map +1 -1
  18. package/dist/components/ContentRender/plugins/CustomVariable.d.ts +2 -1
  19. package/dist/components/ContentRender/plugins/CustomVariable.es.js +110 -90
  20. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  21. package/dist/components/ContentRender/utils/accept-placeholder.cjs +2 -0
  22. package/dist/components/ContentRender/utils/accept-placeholder.cjs.map +1 -0
  23. package/dist/components/ContentRender/utils/accept-placeholder.d.ts +3 -0
  24. package/dist/components/ContentRender/utils/accept-placeholder.es.js +10 -0
  25. package/dist/components/ContentRender/utils/accept-placeholder.es.js.map +1 -0
  26. package/dist/components/MarkdownFlow/MarkdownFlow.cjs +1 -1
  27. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.map +1 -1
  28. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +2 -0
  29. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +23 -21
  30. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  31. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  32. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  33. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +145 -143
  34. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  35. package/dist/components/Slide/Slide.cjs +1 -1
  36. package/dist/components/Slide/Slide.cjs.map +1 -1
  37. package/dist/components/Slide/Slide.d.ts +2 -0
  38. package/dist/components/Slide/Slide.es.js +348 -344
  39. package/dist/components/Slide/Slide.es.js.map +1 -1
  40. package/dist/markdown-flow-ui-lib.css +1 -1
  41. package/dist/markdown-flow-ui.css +1 -1
  42. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
  43. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  44. package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs.map +1 -0
  45. package/dist/node_modules/@radix-ui/react-arrow/dist/index.es.js.map +1 -0
  46. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +1 -1
  47. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
  48. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +92 -89
  49. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
  50. package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +2 -0
  51. package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs.map +1 -0
  52. package/dist/node_modules/@radix-ui/{react-tooltip/node_modules/@radix-ui/react-popper → react-popper}/dist/index.es.js +5 -5
  53. package/dist/node_modules/@radix-ui/react-popper/dist/index.es.js.map +1 -0
  54. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +1 -1
  55. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
  56. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js +50 -47
  57. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
  58. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +1 -1
  59. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs.map +1 -1
  60. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js +9 -9
  61. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +1 -1
  62. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -1
  63. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +10 -7
  64. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -1
  65. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +1 -1
  66. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs.map +1 -1
  67. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.es.js +1 -1
  68. package/dist/node_modules/classnames/index.cjs +1 -1
  69. package/dist/node_modules/classnames/index.es.js +1 -1
  70. package/dist/node_modules/i18next/dist/esm/i18next.cjs +1 -1
  71. package/dist/node_modules/i18next/dist/esm/i18next.cjs.map +1 -1
  72. package/dist/node_modules/i18next/dist/esm/i18next.es.js +809 -900
  73. package/dist/node_modules/i18next/dist/esm/i18next.es.js.map +1 -1
  74. package/dist/node_modules/katex/dist/katex.cjs +14 -14
  75. package/dist/node_modules/katex/dist/katex.cjs.map +1 -1
  76. package/dist/node_modules/katex/dist/katex.es.js +1302 -1192
  77. package/dist/node_modules/katex/dist/katex.es.js.map +1 -1
  78. package/dist/node_modules/lucide-react/dist/esm/Icon.cjs +1 -1
  79. package/dist/node_modules/lucide-react/dist/esm/Icon.cjs.map +1 -1
  80. package/dist/node_modules/lucide-react/dist/esm/Icon.es.js +52 -29
  81. package/dist/node_modules/lucide-react/dist/esm/Icon.es.js.map +1 -1
  82. package/dist/node_modules/lucide-react/dist/esm/context.cjs +2 -0
  83. package/dist/node_modules/lucide-react/dist/esm/context.cjs.map +1 -0
  84. package/dist/node_modules/lucide-react/dist/esm/context.es.js +6 -0
  85. package/dist/node_modules/lucide-react/dist/esm/context.es.js.map +1 -0
  86. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +1 -1
  87. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs.map +1 -1
  88. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.es.js +13 -16
  89. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.es.js.map +1 -1
  90. package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.cjs +1 -1
  91. package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.cjs.map +1 -1
  92. package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.es.js +16 -10
  93. package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.es.js.map +1 -1
  94. package/dist/node_modules/lucide-react/dist/esm/icons/captions.cjs +1 -1
  95. package/dist/node_modules/lucide-react/dist/esm/icons/captions.cjs.map +1 -1
  96. package/dist/node_modules/lucide-react/dist/esm/icons/captions.es.js +13 -6
  97. package/dist/node_modules/lucide-react/dist/esm/icons/captions.es.js.map +1 -1
  98. package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs +1 -1
  99. package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs.map +1 -1
  100. package/dist/node_modules/lucide-react/dist/esm/icons/check.es.js +8 -2
  101. package/dist/node_modules/lucide-react/dist/esm/icons/check.es.js.map +1 -1
  102. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs +1 -1
  103. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.map +1 -1
  104. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.es.js +10 -4
  105. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.es.js.map +1 -1
  106. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs +1 -1
  107. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs.map +1 -1
  108. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js +12 -6
  109. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js.map +1 -1
  110. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.cjs +1 -1
  111. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.cjs.map +1 -1
  112. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.es.js +14 -7
  113. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.es.js.map +1 -1
  114. package/dist/node_modules/lucide-react/dist/esm/icons/copy.cjs +1 -1
  115. package/dist/node_modules/lucide-react/dist/esm/icons/copy.cjs.map +1 -1
  116. package/dist/node_modules/lucide-react/dist/esm/icons/copy.es.js +11 -5
  117. package/dist/node_modules/lucide-react/dist/esm/icons/copy.es.js.map +1 -1
  118. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs +1 -1
  119. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.map +1 -1
  120. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js +13 -6
  121. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js.map +1 -1
  122. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs +1 -1
  123. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs.map +1 -1
  124. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js +22 -7
  125. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js.map +1 -1
  126. package/dist/node_modules/lucide-react/dist/esm/icons/file-type.cjs +1 -1
  127. package/dist/node_modules/lucide-react/dist/esm/icons/file-type.cjs.map +1 -1
  128. package/dist/node_modules/lucide-react/dist/esm/icons/file-type.es.js +20 -8
  129. package/dist/node_modules/lucide-react/dist/esm/icons/file-type.es.js.map +1 -1
  130. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs +1 -1
  131. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs.map +1 -1
  132. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js +17 -11
  133. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js.map +1 -1
  134. package/dist/node_modules/lucide-react/dist/esm/icons/image.cjs +1 -1
  135. package/dist/node_modules/lucide-react/dist/esm/icons/image.cjs.map +1 -1
  136. package/dist/node_modules/lucide-react/dist/esm/icons/image.es.js +14 -8
  137. package/dist/node_modules/lucide-react/dist/esm/icons/image.es.js.map +1 -1
  138. package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.cjs +1 -1
  139. package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.cjs.map +1 -1
  140. package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js +11 -4
  141. package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js.map +1 -1
  142. package/dist/node_modules/lucide-react/dist/esm/icons/maximize.cjs +1 -1
  143. package/dist/node_modules/lucide-react/dist/esm/icons/maximize.cjs.map +1 -1
  144. package/dist/node_modules/lucide-react/dist/esm/icons/maximize.es.js +15 -9
  145. package/dist/node_modules/lucide-react/dist/esm/icons/maximize.es.js.map +1 -1
  146. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs +1 -1
  147. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs.map +1 -1
  148. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js +25 -7
  149. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js.map +1 -1
  150. package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.cjs +1 -1
  151. package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.cjs.map +1 -1
  152. package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.es.js +16 -10
  153. package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.es.js.map +1 -1
  154. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs +1 -1
  155. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs.map +1 -1
  156. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js +19 -7
  157. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js.map +1 -1
  158. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs +1 -1
  159. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs.map +1 -1
  160. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js +19 -7
  161. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js.map +1 -1
  162. package/dist/node_modules/lucide-react/dist/esm/icons/square-check.cjs +1 -1
  163. package/dist/node_modules/lucide-react/dist/esm/icons/square-check.cjs.map +1 -1
  164. package/dist/node_modules/lucide-react/dist/esm/icons/square-check.es.js +14 -7
  165. package/dist/node_modules/lucide-react/dist/esm/icons/square-check.es.js.map +1 -1
  166. package/dist/node_modules/lucide-react/dist/esm/icons/square-play.cjs +1 -1
  167. package/dist/node_modules/lucide-react/dist/esm/icons/square-play.cjs.map +1 -1
  168. package/dist/node_modules/lucide-react/dist/esm/icons/square-play.es.js +19 -6
  169. package/dist/node_modules/lucide-react/dist/esm/icons/square-play.es.js.map +1 -1
  170. package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.cjs +1 -1
  171. package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.cjs.map +1 -1
  172. package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.es.js +15 -9
  173. package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.es.js.map +1 -1
  174. package/dist/node_modules/lucide-react/dist/esm/icons/upload.cjs +1 -1
  175. package/dist/node_modules/lucide-react/dist/esm/icons/upload.cjs.map +1 -1
  176. package/dist/node_modules/lucide-react/dist/esm/icons/upload.es.js +13 -7
  177. package/dist/node_modules/lucide-react/dist/esm/icons/upload.es.js.map +1 -1
  178. package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.cjs +1 -1
  179. package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.map +1 -1
  180. package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.es.js +19 -13
  181. package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.es.js.map +1 -1
  182. package/dist/node_modules/lucide-react/dist/esm/icons/x.cjs +1 -1
  183. package/dist/node_modules/lucide-react/dist/esm/icons/x.cjs.map +1 -1
  184. package/dist/node_modules/lucide-react/dist/esm/icons/x.es.js +13 -7
  185. package/dist/node_modules/lucide-react/dist/esm/icons/x.es.js.map +1 -1
  186. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.cjs +2 -0
  187. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.cjs.map +1 -0
  188. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.es.js +18 -0
  189. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.es.js.map +1 -0
  190. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.cjs +2 -0
  191. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.cjs.map +1 -0
  192. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.es.js +44 -0
  193. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.es.js.map +1 -0
  194. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.cjs +2 -0
  195. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.cjs.map +1 -0
  196. package/dist/node_modules/lucide-react/dist/esm/{defaultAttributes.es.js → shared/src/build/defaultAttributes.es.js} +4 -4
  197. package/dist/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.es.js.map +1 -0
  198. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.cjs +2 -0
  199. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.cjs.map +1 -0
  200. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.es.js +10 -0
  201. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.es.js.map +1 -0
  202. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.cjs +2 -0
  203. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.cjs.map +1 -0
  204. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.es.js +5 -0
  205. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.es.js.map +1 -0
  206. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.cjs +2 -0
  207. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.cjs.map +1 -0
  208. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.es.js +15 -0
  209. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.es.js.map +1 -0
  210. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.cjs +2 -0
  211. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.cjs.map +1 -0
  212. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.es.js +5 -0
  213. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.es.js.map +1 -0
  214. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.cjs +2 -0
  215. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.cjs.map +1 -0
  216. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.es.js +15 -0
  217. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.es.js.map +1 -0
  218. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.cjs +2 -0
  219. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.cjs.map +1 -0
  220. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.es.js +9 -0
  221. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.es.js.map +1 -0
  222. package/dist/node_modules/micromark/lib/create-tokenizer.cjs +3 -3
  223. package/dist/node_modules/micromark/lib/create-tokenizer.cjs.map +1 -1
  224. package/dist/node_modules/micromark/lib/create-tokenizer.es.js +78 -76
  225. package/dist/node_modules/micromark/lib/create-tokenizer.es.js.map +1 -1
  226. package/dist/node_modules/micromark/lib/initialize/document.cjs +1 -1
  227. package/dist/node_modules/micromark/lib/initialize/document.cjs.map +1 -1
  228. package/dist/node_modules/micromark/lib/initialize/document.es.js +77 -75
  229. package/dist/node_modules/micromark/lib/initialize/document.es.js.map +1 -1
  230. package/dist/node_modules/micromark/lib/initialize/text.cjs +1 -1
  231. package/dist/node_modules/micromark/lib/initialize/text.cjs.map +1 -1
  232. package/dist/node_modules/micromark/lib/initialize/text.es.js +67 -64
  233. package/dist/node_modules/micromark/lib/initialize/text.es.js.map +1 -1
  234. package/dist/node_modules/micromark/lib/preprocess.cjs +1 -1
  235. package/dist/node_modules/micromark/lib/preprocess.cjs.map +1 -1
  236. package/dist/node_modules/micromark/lib/preprocess.es.js +19 -14
  237. package/dist/node_modules/micromark/lib/preprocess.es.js.map +1 -1
  238. package/dist/node_modules/micromark-core-commonmark/lib/attention.cjs +1 -1
  239. package/dist/node_modules/micromark-core-commonmark/lib/attention.cjs.map +1 -1
  240. package/dist/node_modules/micromark-core-commonmark/lib/attention.es.js +36 -32
  241. package/dist/node_modules/micromark-core-commonmark/lib/attention.es.js.map +1 -1
  242. package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.cjs +1 -1
  243. package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.cjs.map +1 -1
  244. package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.es.js +49 -61
  245. package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.es.js.map +1 -1
  246. package/dist/node_modules/micromark-core-commonmark/lib/code-indented.cjs +1 -1
  247. package/dist/node_modules/micromark-core-commonmark/lib/code-indented.cjs.map +1 -1
  248. package/dist/node_modules/micromark-core-commonmark/lib/code-indented.es.js +21 -27
  249. package/dist/node_modules/micromark-core-commonmark/lib/code-indented.es.js.map +1 -1
  250. package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.cjs +1 -1
  251. package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.cjs.map +1 -1
  252. package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.es.js +18 -14
  253. package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.es.js.map +1 -1
  254. package/dist/node_modules/micromark-core-commonmark/lib/html-flow.cjs +1 -1
  255. package/dist/node_modules/micromark-core-commonmark/lib/html-flow.cjs.map +1 -1
  256. package/dist/node_modules/micromark-core-commonmark/lib/html-flow.es.js +59 -71
  257. package/dist/node_modules/micromark-core-commonmark/lib/html-flow.es.js.map +1 -1
  258. package/dist/node_modules/micromark-core-commonmark/lib/label-end.cjs +1 -1
  259. package/dist/node_modules/micromark-core-commonmark/lib/label-end.cjs.map +1 -1
  260. package/dist/node_modules/micromark-core-commonmark/lib/label-end.es.js +87 -85
  261. package/dist/node_modules/micromark-core-commonmark/lib/label-end.es.js.map +1 -1
  262. package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.cjs +1 -1
  263. package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.cjs.map +1 -1
  264. package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.es.js +11 -10
  265. package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.es.js.map +1 -1
  266. package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.cjs +1 -1
  267. package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.cjs.map +1 -1
  268. package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.es.js +12 -11
  269. package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.es.js.map +1 -1
  270. package/dist/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.cjs +2 -0
  271. package/dist/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.cjs.map +1 -0
  272. package/dist/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.es.js +18 -0
  273. package/dist/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.es.js.map +1 -0
  274. package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.cjs +1 -1
  275. package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.cjs.map +1 -1
  276. package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.es.js +35 -33
  277. package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.es.js.map +1 -1
  278. package/dist/node_modules/micromark-extension-gfm-table/lib/edit-map.cjs +1 -1
  279. package/dist/node_modules/micromark-extension-gfm-table/lib/edit-map.cjs.map +1 -1
  280. package/dist/node_modules/micromark-extension-gfm-table/lib/edit-map.es.js +32 -28
  281. package/dist/node_modules/micromark-extension-gfm-table/lib/edit-map.es.js.map +1 -1
  282. package/dist/node_modules/micromark-extension-gfm-table/lib/syntax.cjs +1 -1
  283. package/dist/node_modules/micromark-extension-gfm-table/lib/syntax.cjs.map +1 -1
  284. package/dist/node_modules/micromark-extension-gfm-table/lib/syntax.es.js +18 -14
  285. package/dist/node_modules/micromark-extension-gfm-table/lib/syntax.es.js.map +1 -1
  286. package/dist/node_modules/micromark-factory-space/index.cjs +1 -1
  287. package/dist/node_modules/micromark-factory-space/index.cjs.map +1 -1
  288. package/dist/node_modules/micromark-factory-space/index.es.js +24 -10
  289. package/dist/node_modules/micromark-factory-space/index.es.js.map +1 -1
  290. package/dist/node_modules/micromark-util-edit-map/index.cjs +2 -0
  291. package/dist/node_modules/micromark-util-edit-map/index.cjs.map +1 -0
  292. package/dist/node_modules/micromark-util-edit-map/index.es.js +83 -0
  293. package/dist/node_modules/micromark-util-edit-map/index.es.js.map +1 -0
  294. package/package.json +24 -17
  295. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive/dist/index.cjs +0 -2
  296. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive/dist/index.cjs.map +0 -1
  297. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive/dist/index.es.js +0 -50
  298. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive/dist/index.es.js.map +0 -1
  299. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-arrow/dist/index.cjs.map +0 -1
  300. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-arrow/dist/index.es.js.map +0 -1
  301. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.cjs +0 -2
  302. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.cjs.map +0 -1
  303. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.es.js +0 -82
  304. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.es.js.map +0 -1
  305. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +0 -2
  306. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +0 -1
  307. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +0 -216
  308. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +0 -1
  309. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +0 -2
  310. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +0 -1
  311. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +0 -105
  312. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +0 -1
  313. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper/dist/index.cjs +0 -2
  314. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper/dist/index.cjs.map +0 -1
  315. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper/dist/index.es.js.map +0 -1
  316. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.cjs +0 -2
  317. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.cjs.map +0 -1
  318. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.es.js +0 -18
  319. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.es.js.map +0 -1
  320. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.cjs +0 -2
  321. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +0 -1
  322. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.es.js +0 -39
  323. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +0 -1
  324. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs +0 -2
  325. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs.map +0 -1
  326. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js +0 -99
  327. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js.map +0 -1
  328. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +0 -2
  329. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +0 -1
  330. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +0 -16
  331. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +0 -1
  332. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +0 -2
  333. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs.map +0 -1
  334. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js +0 -70
  335. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js.map +0 -1
  336. package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive/dist/index.cjs +0 -2
  337. package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +0 -1
  338. package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive/dist/index.es.js +0 -39
  339. package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +0 -1
  340. package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot/dist/index.cjs +0 -2
  341. package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot/dist/index.cjs.map +0 -1
  342. package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot/dist/index.es.js +0 -99
  343. package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot/dist/index.es.js.map +0 -1
  344. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs +0 -2
  345. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs.map +0 -1
  346. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.es.js.map +0 -1
  347. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs +0 -2
  348. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs.map +0 -1
  349. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.es.js +0 -19
  350. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.es.js.map +0 -1
  351. /package/dist/node_modules/@radix-ui/{react-tooltip/node_modules/@radix-ui/react-arrow → react-arrow}/dist/index.cjs +0 -0
  352. /package/dist/node_modules/@radix-ui/{react-tooltip/node_modules/@radix-ui/react-arrow → react-arrow}/dist/index.es.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ContentRender.cjs","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import { trimVariablePadding } from \"remark-flow\";\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport { unified, type PluggableList, type Plugin } from \"unified\";\nimport remarkRehype from \"remark-rehype\";\nimport type { Element, Root } from \"hast\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport CodeBlock, { CodeBlockContext } from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart, { type MermaidChartProps } from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport {\n getInlineCodeRanges,\n getMarkdownSourceAnalysis,\n} from \"./utils/inline-code-ranges\";\nimport { remarkPlugins } from \"./utils/markdown-plugins\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport {\n escapeTypedMarkdownMetadata,\n type MarkdownMetadataRange,\n} from \"./utils/escape-typed-metadata\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n appendContentAwareTypewriterQueue,\n CONTENT_AWARE_TYPEWRITER_TICK_BUDGET,\n consumeContentAwareTypewriterQueue,\n getTrailingTypewriterGrapheme,\n isContentAwareTypewriterQueueEmpty,\n type ContentAwareTypewriterQueue,\n} from \"./utils/typewriter-pacing\";\nimport {\n normalizeWrappedSandboxContent,\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport {\n createVideoMarkdownRunPlan,\n cloneVideoMarkdownSourceTree,\n projectVideoMarkdownRun,\n prepareVideoMarkdownRun,\n getVideoMarkdownNodeState,\n type VideoMarkdownRunPlan,\n} from \"./utils/video-markdown-run\";\n\nconst FIXED_TYPEWRITER_CHUNK_SIZE = 2;\n\nexport type ContentRenderTypewriterPacing = \"fixed\" | \"content-aware\";\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /** Locale used for built-in UI text when a more specific text prop is not provided. */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language; omitted values inherit from the host. */\n lang?: string;\n /** Overrides locale-derived direction; omitted values inherit when no locale is set. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n /** Types prose only; following HTML renders progressively once preceding prose is displayed. */\n enableTypewriter?: boolean;\n /** Controls how much text is revealed per tick. Defaults to the legacy fixed pacing. */\n typewriterPacing?: ContentRenderTypewriterPacing;\n onTypeFinished?: () => void;\n onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Exit fullscreen button text for iframe sandbox\n sandboxExitFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n}\n\nexport interface ContentRenderTypewriterState {\n isTypewriterEnabled: boolean;\n isTyping: boolean;\n isComplete: boolean;\n /** Received source units already displayed, including unpaced HTML. */\n renderedLength: number;\n totalLength: number;\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string; inline?: boolean }> = ({\n svg,\n inline = false,\n}) => {\n const hostRef = useRef<HTMLElement | null>(null);\n const Wrapper = inline ? \"span\" : \"div\";\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <Wrapper className=\"content-render-svg-scroll\">\n <Wrapper\n className=\"content-render-svg\"\n ref={(node) => {\n hostRef.current = node;\n }}\n />\n </Wrapper>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\ntype MarkdownComponentRuntimeValues = {\n direction?: ContentRenderProps[\"dir\"];\n language?: string;\n mermaidMessages: MermaidChartProps[\"messages\"];\n beforeSend?: (param: OnSendContentParams) => boolean;\n locale?: MarkdownFlowLocale;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n readonly: boolean;\n renderContent: string;\n resolvedConfirmButtonText: string;\n resolvedCopiedButtonText: string;\n resolvedCopyButtonText: string;\n resolvedDefaultButtonText?: string;\n resolvedDefaultInputText?: string;\n resolvedDefaultSelectedValues?: string[];\n};\n\nconst MarkdownComponentRuntimeContext =\n React.createContext<React.RefObject<MarkdownComponentRuntimeValues> | null>(\n null\n );\n\nconst MarkdownCode = (\n props: React.ComponentProps<\"code\"> & { receivedTree?: boolean }\n) => {\n const { receivedTree, ...codeProps } = props;\n const runtimeValuesRef = React.useContext(MarkdownComponentRuntimeContext);\n const isInCodeBlock = React.useContext(CodeBlockContext);\n if (!runtimeValuesRef) {\n throw new Error(\"Markdown code renderer requires ContentRender context.\");\n }\n const { className, children, ...rest } = codeProps as {\n className?: string;\n children?: React.ReactNode;\n dir?: string;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const complete = mermaidBlockIsComplete(\n runtimeValuesRef.current.renderContent,\n chartContent\n );\n // The received-tree path replaces standalone Mermaid segments, whose\n // unfinished charts freeze until the closing fence reaches the prose budget.\n const frozen = receivedTree ? !complete : complete;\n return (\n <MermaidChart\n chart={chartContent}\n frozen={frozen}\n messages={runtimeValuesRef.current.mermaidMessages}\n />\n );\n }\n\n return (\n <code\n className={className}\n {...rest}\n dir={rest.dir ?? (isInCodeBlock ? undefined : \"ltr\")}\n >\n {children}\n </code>\n );\n};\n\nconst sourceRehypePlugins: PluggableList = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n];\nconst formattingRehypePlugins: PluggableList = [\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\nconst rehypePlugins: PluggableList = [\n ...sourceRehypePlugins,\n ...formattingRehypePlugins,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ content: markdownContent, components, locale }) => {\n const texts = getContentRenderLocaleTexts(locale);\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n remarkRehypeOptions={{\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) => {\n const reference =\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\");\n return texts.footnoteBackLabel.replace(\"{reference}\", reference);\n },\n }}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n );\n};\n\n// ReactMarkdown still owns URL handling and JSX conversion. Its parser is\n// bypassed because the received source was already parsed and transformed.\nconst usePreparedTree: Plugin = function () {\n this.parser = () => ({ type: \"root\", children: [] });\n};\n\nconst StableVideoMarkdownRenderer: React.FC<{\n plan: VideoMarkdownRunPlan;\n renderedSegments: readonly RenderSegment[];\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ plan, renderedSegments, components, locale }) => {\n const prepared = useMemo(() => {\n const texts = getContentRenderLocaleTexts(locale);\n const sourceProcessor = unified()\n .use(remarkPlugins)\n .use(remarkRehype, {\n allowDangerousHtml: true,\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) =>\n texts.footnoteBackLabel.replace(\n \"{reference}\",\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\")\n ),\n })\n .use(sourceRehypePlugins);\n const formattingProcessor = unified().use(formattingRehypePlugins);\n const tree = sourceProcessor.runSync(\n cloneVideoMarkdownSourceTree(plan),\n plan.markdownSource\n ) as Root;\n return prepareVideoMarkdownRun(\n plan,\n tree,\n (value) => formattingProcessor.runSync(value, plan.fullSource) as Root\n );\n }, [plan, locale]);\n const projected = useMemo(\n () => projectVideoMarkdownRun(prepared, renderedSegments),\n [prepared, renderedSegments]\n );\n const originalComponents = useRef(components);\n originalComponents.current = components;\n const wrappers = useRef(\n new Map<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n >()\n );\n const stableComponents = useMemo(() => {\n const tags = new Set<string>();\n const collect = (node: Root | Root[\"children\"][number]) => {\n if (node.type === \"element\") tags.add(node.tagName);\n if (\"children\" in node) node.children.forEach(collect);\n };\n collect(prepared.tree!);\n const result: Record<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n > = {};\n for (const tag of tags) {\n if (!wrappers.current.has(tag)) {\n const Component = ({\n node,\n children,\n ...props\n }: {\n node: Element;\n children?: React.ReactNode;\n }) => {\n const state = getVideoMarkdownNodeState(node);\n if (state?.svg) {\n return state.svgSource ? (\n <SvgBlockInShadow svg={state.svgSource} inline />\n ) : null;\n }\n if (state?.atomic) {\n return state.active ? <>{children}</> : null;\n }\n if (state?.active === false && tag !== \"a\") return null;\n const current = originalComponents.current as Record<\n string,\n React.ElementType\n >;\n const Original = current[tag];\n const visibleProps =\n state?.active === false\n ? { ...props, href: undefined, tabIndex: -1 }\n : props;\n return Original\n ? React.createElement(\n Original,\n {\n ...visibleProps,\n node,\n ...(Original === MarkdownCode ? { receivedTree: true } : {}),\n },\n children\n )\n : React.createElement(tag, visibleProps, children);\n };\n Component.displayName = `StableMarkdown(${tag})`;\n wrappers.current.set(tag, Component);\n }\n result[tag] = wrappers.current.get(tag)!;\n }\n return result as CustomComponents;\n }, [prepared]);\n const preparedPlugins = useMemo<PluggableList>(\n () => [() => () => projected],\n [projected]\n );\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={[usePreparedTree]}\n rehypePlugins={preparedPlugins}\n components={stableComponents}\n >\n {\"\"}\n </ReactMarkdown>\n </div>\n );\n};\n\nconst isImmediateSegment = (segment: RenderSegment) =>\n segment.type === \"markdown\" && segment.immediate === true;\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\" && !isImmediateSegment(last)) {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst closeTypedInlineCode = (\n visible: string,\n source: string,\n ranges: ReturnType<typeof getInlineCodeRanges>\n) => {\n if (visible.length >= source.length) return visible;\n const range = ranges.find(\n ({ start, end }) => start < visible.length && visible.length < end\n );\n if (!range) return visible;\n const delimiter = /^`+/.exec(source.slice(range.start))?.[0];\n if (!delimiter || visible.length < range.start + delimiter.length) {\n return visible;\n }\n const closingStart = range.end - delimiter.length;\n if (visible.length > closingStart) {\n return visible + delimiter.slice(visible.length - closingStart);\n }\n // Close only the render copy so a typed prefix cannot activate code as HTML.\n return visible + (visible.endsWith(\"`\") ? \" \" : \"\") + delimiter;\n};\n\nconst protectTypedMarkdownPrefix = (\n visible: string,\n source: string,\n inlineCodeRanges: ReturnType<typeof getInlineCodeRanges>,\n metadataRanges: readonly MarkdownMetadataRange[],\n sourceOffset = 0\n) => {\n // Both protections use raw coordinates. Append any synthetic code delimiter\n // after escaping so encoded '<' characters cannot shift the typing budget.\n const closed = closeTypedInlineCode(visible, source, inlineCodeRanges);\n return (\n escapeTypedMarkdownMetadata(visible, metadataRanges, sourceOffset) +\n closed.slice(visible.length)\n );\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst areStringArraysEqual = (left?: string[], right?: string[]) => {\n if (left === right) {\n return true;\n }\n if (!left || !right || left.length !== right.length) {\n return false;\n }\n return left.every((value, index) => value === right[index]);\n};\n\nconst useStableStringArray = (values?: string[]) => {\n const valuesRef = useRef<string[] | undefined>(values);\n\n if (!areStringArraysEqual(valuesRef.current, values)) {\n valuesRef.current = values;\n }\n\n return valuesRef.current;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n contentType,\n locale,\n lang,\n dir,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n typewriterPacing = \"fixed\",\n onTypeFinished,\n onTypewriterStateChange,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxExitFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const mermaidMessages = useMemo(\n () => ({\n loading: localeTexts.mermaidLoadingText,\n emptyChart: localeTexts.mermaidEmptyChartText,\n error: localeTexts.mermaidErrorText,\n }),\n [localeTexts]\n );\n const direction = dir ?? getMarkdownFlowDirection(locale);\n const language = lang ?? getMarkdownFlowLanguage(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const resolvedCopyButtonText = copyButtonText || localeTexts.copyButtonText;\n const resolvedCopiedButtonText =\n copiedButtonText || localeTexts.copiedButtonText;\n const resolvedSandboxFullscreenButtonText =\n sandboxFullscreenButtonText || localeTexts.sandboxFullscreenButtonText;\n const resolvedSandboxExitFullscreenButtonText =\n sandboxExitFullscreenButtonText ||\n localeTexts.sandboxExitFullscreenButtonText;\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const sourceContent = useMemo(\n () => normalizeWrappedSandboxContent(content),\n [content]\n );\n const sourceAnalysis = useMemo(\n () => getMarkdownSourceAnalysis(sourceContent),\n [sourceContent]\n );\n // Parse the received source, never a typewriter-truncated HTML string.\n const sourceSegments = useMemo(() => {\n const segments = mergeNonSandboxSegments(\n splitContentSegments(sourceContent, true, true, sourceAnalysis)\n );\n if (\n sourceContent !== content &&\n segments.length &&\n (segments[0].type === \"sandbox\" || isImmediateSegment(segments[0]))\n ) {\n // The removed opening quote occupied a prose slot before the wrapper\n // completed. Retain its empty slot so the existing iframe keeps its key.\n return [{ type: \"text\" as const, value: \"\" }, ...segments];\n }\n return segments;\n }, [content, sourceContent, sourceAnalysis]);\n const hasRichSegments = sourceSegments.some(\n (segment) => segment.type === \"sandbox\" || isImmediateSegment(segment)\n );\n const typewriterContent = hasRichSegments\n ? sourceSegments\n .filter(\n (segment) =>\n segment.type !== \"sandbox\" && !isImmediateSegment(segment)\n )\n .map((segment) => segment.value)\n .join(\"\")\n : sourceContent;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const fixedTypewriterContentVersion =\n typewriterPacing === \"fixed\" ? typewriterContent : undefined;\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : typewriterContent\n );\n const displayContentRef = useRef(displayContent);\n const pendingContentRef = useRef(\"\");\n const contentAwareQueueRef = useRef<ContentAwareTypewriterQueue>({\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n });\n const contentAwareBudgetRef = useRef(0);\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n const previousTypewriterPacingRef = useRef(typewriterPacing);\n const previousSourceContentRef = useRef(typewriterContent);\n const previousReceivedContentRef = useRef(content);\n const hasReportedTypeFinishedRef = useRef(false);\n const [typewriterWakeVersion, setTypewriterWakeVersion] = useState(0);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n const previousTypewriterPacing = previousTypewriterPacingRef.current;\n const previousSourceContent = previousSourceContentRef.current;\n const wasPending = Boolean(pendingContentRef.current);\n const receivedContentChanged =\n previousReceivedContentRef.current !== content;\n const receivedContentAppended =\n receivedContentChanged &&\n content.startsWith(previousReceivedContentRef.current);\n previousReceivedContentRef.current = content;\n\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n previousTypewriterPacingRef.current = typewriterPacing;\n previousSourceContentRef.current = typewriterContent;\n\n if (\n receivedContentChanged ||\n isTypewriterEnabled !== wasTypewriterEnabled\n ) {\n hasReportedTypeFinishedRef.current = false;\n }\n\n const clearPendingContent = () => {\n pendingContentRef.current = \"\";\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n };\n\n const updateDisplayContent = (nextContent: string) => {\n displayContentRef.current = nextContent;\n setDisplayContent(nextContent);\n };\n\n if (!isTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(typewriterContent);\n return;\n }\n\n if (!wasTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(\"\");\n }\n\n let visibleContent = !wasTypewriterEnabled ? \"\" : displayContentRef.current;\n\n if (!typewriterContent.startsWith(visibleContent)) {\n clearPendingContent();\n if (!receivedContentAppended) {\n updateDisplayContent(typewriterContent);\n if (typewriterPacing === \"content-aware\") {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(typewriterContent),\n };\n }\n return;\n }\n // A newly recognized HTML tag can replace a previously literal prefix.\n // Keep the shared prose visible and pace only the newly received prose.\n let sharedLength = 0;\n while (\n sharedLength < visibleContent.length &&\n sharedLength < typewriterContent.length &&\n visibleContent[sharedLength] === typewriterContent[sharedLength]\n ) {\n sharedLength += 1;\n }\n visibleContent = visibleContent.slice(0, sharedLength);\n updateDisplayContent(visibleContent);\n }\n\n let nextPendingContent = typewriterContent.slice(visibleContent.length);\n if (!nextPendingContent) {\n pendingContentRef.current = \"\";\n contentAwareBudgetRef.current = 0;\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n return;\n }\n\n if (typewriterPacing === \"content-aware\") {\n const previousPendingContent = previousSourceContent.slice(\n visibleContent.length\n );\n const canAppendToCachedQueue =\n wasTypewriterEnabled &&\n previousTypewriterPacing === \"content-aware\" &&\n typewriterContent.startsWith(previousSourceContent) &&\n pendingContentRef.current === previousPendingContent;\n\n if (canAppendToCachedQueue) {\n const appended = appendContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n typewriterContent.slice(previousSourceContent.length)\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n } else {\n const appended = appendContentAwareTypewriterQueue(\n {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n },\n nextPendingContent\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n\n contentAwareBudgetRef.current = 0;\n }\n } else {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n }\n\n pendingContentRef.current = nextPendingContent;\n\n if (!wasPending && nextPendingContent) {\n setTypewriterWakeVersion((version) => version + 1);\n }\n }, [content, typewriterContent, isTypewriterEnabled, typewriterPacing]);\n\n useEffect(() => {\n if (!isTypewriterEnabled) {\n return;\n }\n\n if (\n hasReportedTypeFinishedRef.current ||\n pendingContentRef.current ||\n displayContent !== typewriterContent\n ) {\n return;\n }\n\n hasReportedTypeFinishedRef.current = true;\n onTypeFinished?.();\n }, [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n onTypeFinished,\n ]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n if (!pendingContentRef.current) {\n return;\n }\n\n let chunk = \"\";\n\n if (typewriterPacing === \"content-aware\") {\n const result = consumeContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n contentAwareBudgetRef.current + CONTENT_AWARE_TYPEWRITER_TICK_BUDGET\n );\n\n chunk = result.chunk;\n contentAwareQueueRef.current = result.queue;\n\n if (isContentAwareTypewriterQueueEmpty(result.queue)) {\n contentAwareBudgetRef.current = 0;\n } else {\n contentAwareBudgetRef.current = result.remainingBudget;\n }\n } else {\n const fixedChunk = splitTextByCharacterChunk(\n pendingContentRef.current,\n FIXED_TYPEWRITER_CHUNK_SIZE\n );\n chunk = fixedChunk.chunk;\n }\n\n if (!chunk) {\n return;\n }\n\n pendingContentRef.current = pendingContentRef.current.slice(chunk.length);\n if (!pendingContentRef.current) {\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: contentAwareQueueRef.current.trailingGrapheme,\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n contentAwareBudgetRef.current = 0;\n }\n\n const nextDisplayContent = `${displayContentRef.current}${chunk}`;\n displayContentRef.current = nextDisplayContent;\n setDisplayContent(nextDisplayContent);\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n displayContent,\n fixedTypewriterContentVersion,\n isTypewriterEnabled,\n typewriterPacing,\n typewriterTickMs,\n typewriterWakeVersion,\n ]);\n\n const mergedRenderSegments = useMemo(() => {\n let textOffset = 0;\n return sourceSegments.map((segment) => {\n if (!isTypewriterEnabled) return segment;\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n // HTML skips the prose budget only after earlier prose has caught up.\n // Retain its source slot so later updates keep the same render key.\n return displayContent.length >= textOffset\n ? segment\n : { ...segment, value: \"\" };\n }\n const value = displayContent.slice(\n textOffset,\n textOffset + segment.value.length\n );\n textOffset += segment.value.length;\n // Keep empty prose slots so an existing sandbox never changes its key.\n return { ...segment, value };\n });\n }, [sourceSegments, displayContent, isTypewriterEnabled]);\n const typewriterState = useMemo<ContentRenderTypewriterState>(\n () => ({\n isTypewriterEnabled,\n isTyping: isTypewriterEnabled && displayContent !== typewriterContent,\n isComplete: displayContent === typewriterContent,\n renderedLength:\n content.length -\n sourceSegments.reduce(\n (remaining, segment, index) =>\n remaining +\n segment.value.length -\n mergedRenderSegments[index].value.length,\n 0\n ),\n totalLength: content.length,\n }),\n [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n sourceSegments,\n mergedRenderSegments,\n ]\n );\n\n useEffect(() => {\n onTypewriterStateChange?.(typewriterState);\n }, [onTypewriterStateChange, typewriterState]);\n const sourceSegmentOffsets = useMemo(() => {\n let offset = 0;\n return sourceSegments.map((segment) => {\n const start = offset;\n offset += segment.value.length;\n return start;\n });\n }, [sourceSegments]);\n const sourceInlineCodeRanges = useMemo(\n () =>\n isTypewriterEnabled\n ? sourceSegments.map((segment) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? []\n : segment.value === sourceContent\n ? sourceAnalysis.inline\n : getInlineCodeRanges(segment.value)\n )\n : [],\n [isTypewriterEnabled, sourceSegments, sourceContent, sourceAnalysis]\n );\n const safeRichMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? mergedRenderSegments.map((segment, index) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? segment.value\n : isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n segment.value,\n sourceSegments[index].value,\n sourceInlineCodeRanges[index] ?? [],\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n : escapeTypedMarkdownMetadata(\n segment.value,\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n )\n : [],\n [\n hasRichSegments,\n isTypewriterEnabled,\n mergedRenderSegments,\n sourceInlineCodeRanges,\n sourceSegments,\n sourceAnalysis.metadata,\n sourceSegmentOffsets,\n ]\n );\n const richRenderRuns = useMemo(() => {\n const runs: Array<{\n indices: number[];\n sandbox: boolean;\n plan?: ReturnType<typeof createVideoMarkdownRunPlan>;\n }> = [];\n sourceSegments.forEach((segment, index) => {\n const previous = runs.at(-1);\n if (segment.type !== \"sandbox\" && previous && !previous.sandbox) {\n previous.indices.push(index);\n } else {\n runs.push({ indices: [index], sandbox: segment.type === \"sandbox\" });\n }\n });\n for (const run of runs) {\n if (\n !run.sandbox &&\n run.indices.some((index) => isImmediateSegment(sourceSegments[index]))\n ) {\n const segments = run.indices.map((index) => sourceSegments[index]);\n const fullSource = segments.map((segment) => segment.value).join(\"\");\n run.plan = createVideoMarkdownRunPlan(\n segments,\n fullSource === sourceContent ? sourceAnalysis : undefined\n );\n }\n }\n return runs;\n }, [sourceSegments, sourceContent, sourceAnalysis]);\n const renderContent = hasRichSegments\n ? mergedRenderSegments.map((segment) => segment.value).join(\"\")\n : isTypewriterEnabled\n ? displayContent\n : sourceContent;\n const normalizedContent = useMemo(\n () => (customRenderBar ? normalizeInlineHtml(renderContent) : \"\"),\n [customRenderBar, renderContent]\n );\n\n const safeMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? \"\"\n : normalizeInlineHtml(\n isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n renderContent,\n sourceContent,\n sourceInlineCodeRanges[0] ?? [],\n sourceAnalysis.metadata\n )\n : escapeTypedMarkdownMetadata(\n renderContent,\n sourceAnalysis.metadata\n )\n ),\n [\n sourceContent,\n hasRichSegments,\n isTypewriterEnabled,\n renderContent,\n sourceInlineCodeRanges,\n sourceAnalysis.metadata,\n ]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n (defaultButtonText ? trimVariablePadding(defaultButtonText) : undefined) ||\n interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => trimVariablePadding(value))\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n const stableDefaultSelectedValues = useStableStringArray(\n resolvedDefaultSelectedValues\n );\n const componentRuntimeValuesRef = useRef<MarkdownComponentRuntimeValues>({\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n });\n\n componentRuntimeValuesRef.current = {\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n };\n\n const components = useMemo<CustomComponents>(\n () => ({\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={\n componentRuntimeValuesRef.current.onClickCustomButtonAfterContent\n }\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={componentRuntimeValuesRef.current.readonly}\n defaultButtonText={\n componentRuntimeValuesRef.current.resolvedDefaultButtonText\n }\n defaultInputText={\n componentRuntimeValuesRef.current.resolvedDefaultInputText\n }\n defaultSelectedValues={\n componentRuntimeValuesRef.current.resolvedDefaultSelectedValues\n }\n onSend={componentRuntimeValuesRef.current.onSend}\n beforeSend={componentRuntimeValuesRef.current.beforeSend}\n locale={componentRuntimeValuesRef.current.locale}\n dir={componentRuntimeValuesRef.current.direction}\n lang={componentRuntimeValuesRef.current.language}\n confirmButtonText={\n componentRuntimeValuesRef.current.resolvedConfirmButtonText\n }\n />\n ),\n code: MarkdownCode,\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className: unknown = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={\n componentRuntimeValuesRef.current.resolvedCopyButtonText\n }\n copiedButtonText={\n componentRuntimeValuesRef.current.resolvedCopiedButtonText\n }\n />\n ),\n }),\n []\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(safeMarkdownContent),\n [safeMarkdownContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={key}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={key}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n const customBar = customRenderBar ? (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n ) : null;\n\n if (hasRichSegments) {\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {richRenderRuns.map((run) => {\n const idx = run.indices[0];\n const segment = mergedRenderSegments[idx];\n if (run.sandbox)\n return segment.type === \"sandbox\" &&\n segment.value &&\n !segment.pending ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n locale={locale}\n dir={direction}\n lang={language}\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={resolvedSandboxFullscreenButtonText}\n exitFullScreenButtonText={\n resolvedSandboxExitFullscreenButtonText\n }\n mode={sandboxMode}\n />\n ) : null;\n if (run.plan)\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={`md-${idx}`}\n value={componentRuntimeValuesRef}\n >\n <StableVideoMarkdownRenderer\n locale={locale}\n components={components}\n plan={run.plan}\n renderedSegments={run.indices.map(\n (index) => mergedRenderSegments[index]\n )}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n return run.indices.map((index) => (\n <React.Fragment key={`md-${index}`}>\n {mergedRenderSegments[index].type === \"markdown\" &&\n mergedRenderSegments[index].pending\n ? null\n : renderMarkdownSegments(\n safeRichMarkdownContent[index],\n `md-${index}`\n )}\n </React.Fragment>\n ));\n })}\n {customBar}\n </div>\n );\n }\n\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={index}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customBar}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["FIXED_TYPEWRITER_CHUNK_SIZE","SvgBlockInShadow","svg","inline","hostRef","useRef","Wrapper","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","MarkdownComponentRuntimeContext","React","MarkdownCode","props","receivedTree","codeProps","runtimeValuesRef","isInCodeBlock","CodeBlockContext","className","children","rest","chartContent","complete","mermaidBlockIsComplete","frozen","MermaidChart","sourceRehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","formattingRehypePlugins","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","rehypePlugins","MarkdownRenderer","markdownContent","components","locale","texts","getContentRenderLocaleTexts","ReactMarkdown","remarkPlugins","referenceIndex","rereferenceIndex","reference","usePreparedTree","StableVideoMarkdownRenderer","plan","renderedSegments","prepared","useMemo","sourceProcessor","unified","remarkRehype","formattingProcessor","tree","cloneVideoMarkdownSourceTree","prepareVideoMarkdownRun","projected","projectVideoMarkdownRun","originalComponents","wrappers","stableComponents","tags","collect","result","tag","Component","state","getVideoMarkdownNodeState","Fragment","Original","visibleProps","preparedPlugins","isImmediateSegment","segment","mergeNonSandboxSegments","segments","merged","last","closeTypedInlineCode","visible","source","ranges","range","start","end","delimiter","closingStart","protectTypedMarkdownPrefix","inlineCodeRanges","metadataRanges","sourceOffset","closed","escapeTypedMarkdownMetadata","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","areStringArraysEqual","left","right","index","useStableStringArray","values","valuesRef","ContentRender","content","contentType","lang","dir","customRenderBar","onSend","typingSpeed","enableTypewriter","typewriterPacing","onTypeFinished","onTypewriterStateChange","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","localeTexts","mermaidMessages","direction","getMarkdownFlowDirection","language","getMarkdownFlowLanguage","resolvedConfirmButtonText","resolvedCopyButtonText","resolvedCopiedButtonText","resolvedSandboxFullscreenButtonText","resolvedSandboxExitFullscreenButtonText","isTypewriterEnabled","sourceContent","normalizeWrappedSandboxContent","sourceAnalysis","getMarkdownSourceAnalysis","sourceSegments","splitContentSegments","hasRichSegments","typewriterContent","typewriterTickMs","fixedTypewriterContentVersion","displayContent","setDisplayContent","useState","displayContentRef","pendingContentRef","contentAwareQueueRef","contentAwareBudgetRef","previousTypewriterEnabledRef","previousTypewriterPacingRef","previousSourceContentRef","previousReceivedContentRef","hasReportedTypeFinishedRef","typewriterWakeVersion","setTypewriterWakeVersion","wasTypewriterEnabled","previousTypewriterPacing","previousSourceContent","wasPending","receivedContentChanged","receivedContentAppended","clearPendingContent","updateDisplayContent","nextContent","visibleContent","getTrailingTypewriterGrapheme","sharedLength","nextPendingContent","previousPendingContent","appended","appendContentAwareTypewriterQueue","version","typewriterTimer","chunk","consumeContentAwareTypewriterQueue","CONTENT_AWARE_TYPEWRITER_TICK_BUDGET","isContentAwareTypewriterQueueEmpty","nextDisplayContent","mergedRenderSegments","textOffset","typewriterState","remaining","sourceSegmentOffsets","offset","sourceInlineCodeRanges","getInlineCodeRanges","safeRichMarkdownContent","richRenderRuns","runs","previous","run","fullSource","createVideoMarkdownRunPlan","renderContent","normalizedContent","normalizeInlineHtml","safeMarkdownContent","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","trimVariablePadding","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","stableDefaultSelectedValues","componentRuntimeValuesRef","CustomButtonInputVariable","CodeBlock","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","key","customBar","jsxs","idx","IframeSandbox"],"mappings":"wjDA4EMA,GAA8B,EA4E9BC,GAAgE,CAAC,CACrE,IAAAC,EACA,OAAAC,EAAS,EACX,IAAM,CACJ,MAAMC,EAAUC,EAAAA,OAA2B,IAAI,EACzCC,EAAUH,EAAS,OAAS,MAElCI,OAAAA,EAAAA,UAAU,IAAM,CACd,MAA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IAAU,CAC5B,GAAI+H,EAAI,OAAS,OACf,OACEhO,EAAAA,IAACC,GAAgC,SAAhC,CAEC,MAAOwN,EAEP,SAAAzN,EAAAA,IAAC6B,GAAA,CAAA,OACCG,EACA,WAAAD,GACA,QAASiM,EAAI,KAAA,CAAA,CACf,EAPK/H,CAAA,EAYX,GAAI+H,EAAI,OAAS,UACf,OACEhO,EAAAA,IAACiB,GAAAA,QAAA,CAEC,MAAO+M,EAAI,MACX,OAAQ,CAACA,EAAI,SACb,SAAU5F,CAAA,EAHLnC,CAAA,EAQX,GAAI+H,EAAI,OAAS,MACf,OAAOhO,EAAAA,IAACpC,GAAA,CAA6B,IAAKoQ,EAAI,OAAhB/H,CAAuB,CAEzD,CAAC,EAEAiI,EAAA,CAAA,CAAA,CAGP"}
1
+ {"version":3,"file":"ContentRender.cjs","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import { trimVariablePadding } from \"remark-flow\";\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport { unified, type PluggableList, type Plugin } from \"unified\";\nimport remarkRehype from \"remark-rehype\";\nimport type { Element, Root } from \"hast\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport CodeBlock, { CodeBlockContext } from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart, { type MermaidChartProps } from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport {\n getInlineCodeRanges,\n getMarkdownSourceAnalysis,\n} from \"./utils/inline-code-ranges\";\nimport { remarkPlugins } from \"./utils/markdown-plugins\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport {\n escapeTypedMarkdownMetadata,\n type MarkdownMetadataRange,\n} from \"./utils/escape-typed-metadata\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n appendContentAwareTypewriterQueue,\n CONTENT_AWARE_TYPEWRITER_TICK_BUDGET,\n consumeContentAwareTypewriterQueue,\n getTrailingTypewriterGrapheme,\n isContentAwareTypewriterQueueEmpty,\n type ContentAwareTypewriterQueue,\n} from \"./utils/typewriter-pacing\";\nimport {\n normalizeWrappedSandboxContent,\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport {\n createVideoMarkdownRunPlan,\n cloneVideoMarkdownSourceTree,\n projectVideoMarkdownRun,\n prepareVideoMarkdownRun,\n getVideoMarkdownNodeState,\n type VideoMarkdownRunPlan,\n} from \"./utils/video-markdown-run\";\n\nconst FIXED_TYPEWRITER_CHUNK_SIZE = 2;\n\nexport type ContentRenderTypewriterPacing = \"fixed\" | \"content-aware\";\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /** Locale used for built-in UI text when a more specific text prop is not provided. */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language; omitted values inherit from the host. */\n lang?: string;\n /** Overrides locale-derived direction; omitted values inherit when no locale is set. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n /** Observes an accepted Tab completion without receiving authored text. */\n onPlaceholderAccepted?: () => void;\n typingSpeed?: number;\n /** Types prose only; following HTML renders progressively once preceding prose is displayed. */\n enableTypewriter?: boolean;\n /** Controls how much text is revealed per tick. Defaults to the legacy fixed pacing. */\n typewriterPacing?: ContentRenderTypewriterPacing;\n onTypeFinished?: () => void;\n onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Exit fullscreen button text for iframe sandbox\n sandboxExitFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n}\n\nexport interface ContentRenderTypewriterState {\n isTypewriterEnabled: boolean;\n isTyping: boolean;\n isComplete: boolean;\n /** Received source units already displayed, including unpaced HTML. */\n renderedLength: number;\n totalLength: number;\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string; inline?: boolean }> = ({\n svg,\n inline = false,\n}) => {\n const hostRef = useRef<HTMLElement | null>(null);\n const Wrapper = inline ? \"span\" : \"div\";\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <Wrapper className=\"content-render-svg-scroll\">\n <Wrapper\n className=\"content-render-svg\"\n ref={(node) => {\n hostRef.current = node;\n }}\n />\n </Wrapper>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\ntype MarkdownComponentRuntimeValues = {\n onPlaceholderAccepted?: () => void;\n direction?: ContentRenderProps[\"dir\"];\n language?: string;\n mermaidMessages: MermaidChartProps[\"messages\"];\n beforeSend?: (param: OnSendContentParams) => boolean;\n locale?: MarkdownFlowLocale;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n readonly: boolean;\n renderContent: string;\n resolvedConfirmButtonText: string;\n resolvedCopiedButtonText: string;\n resolvedCopyButtonText: string;\n resolvedDefaultButtonText?: string;\n resolvedDefaultInputText?: string;\n resolvedDefaultSelectedValues?: string[];\n};\n\nconst MarkdownComponentRuntimeContext =\n React.createContext<React.RefObject<MarkdownComponentRuntimeValues> | null>(\n null\n );\n\nconst MarkdownCode = (\n props: React.ComponentProps<\"code\"> & { receivedTree?: boolean }\n) => {\n const { receivedTree, ...codeProps } = props;\n const runtimeValuesRef = React.useContext(MarkdownComponentRuntimeContext);\n const isInCodeBlock = React.useContext(CodeBlockContext);\n if (!runtimeValuesRef) {\n throw new Error(\"Markdown code renderer requires ContentRender context.\");\n }\n const { className, children, ...rest } = codeProps as {\n className?: string;\n children?: React.ReactNode;\n dir?: string;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const complete = mermaidBlockIsComplete(\n runtimeValuesRef.current.renderContent,\n chartContent\n );\n // The received-tree path replaces standalone Mermaid segments, whose\n // unfinished charts freeze until the closing fence reaches the prose budget.\n const frozen = receivedTree ? !complete : complete;\n return (\n <MermaidChart\n chart={chartContent}\n frozen={frozen}\n messages={runtimeValuesRef.current.mermaidMessages}\n />\n );\n }\n\n return (\n <code\n className={className}\n {...rest}\n dir={rest.dir ?? (isInCodeBlock ? undefined : \"ltr\")}\n >\n {children}\n </code>\n );\n};\n\nconst sourceRehypePlugins: PluggableList = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n];\nconst formattingRehypePlugins: PluggableList = [\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\nconst rehypePlugins: PluggableList = [\n ...sourceRehypePlugins,\n ...formattingRehypePlugins,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ content: markdownContent, components, locale }) => {\n const texts = getContentRenderLocaleTexts(locale);\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n remarkRehypeOptions={{\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) => {\n const reference =\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\");\n return texts.footnoteBackLabel.replace(\"{reference}\", reference);\n },\n }}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n );\n};\n\n// ReactMarkdown still owns URL handling and JSX conversion. Its parser is\n// bypassed because the received source was already parsed and transformed.\nconst usePreparedTree: Plugin = function () {\n this.parser = () => ({ type: \"root\", children: [] });\n};\n\nconst StableVideoMarkdownRenderer: React.FC<{\n plan: VideoMarkdownRunPlan;\n renderedSegments: readonly RenderSegment[];\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ plan, renderedSegments, components, locale }) => {\n const prepared = useMemo(() => {\n const texts = getContentRenderLocaleTexts(locale);\n const sourceProcessor = unified()\n .use(remarkPlugins)\n .use(remarkRehype, {\n allowDangerousHtml: true,\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) =>\n texts.footnoteBackLabel.replace(\n \"{reference}\",\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\")\n ),\n })\n .use(sourceRehypePlugins);\n const formattingProcessor = unified().use(formattingRehypePlugins);\n const tree = sourceProcessor.runSync(\n cloneVideoMarkdownSourceTree(plan),\n plan.markdownSource\n ) as Root;\n return prepareVideoMarkdownRun(\n plan,\n tree,\n (value) => formattingProcessor.runSync(value, plan.fullSource) as Root\n );\n }, [plan, locale]);\n const projected = useMemo(\n () => projectVideoMarkdownRun(prepared, renderedSegments),\n [prepared, renderedSegments]\n );\n const originalComponents = useRef(components);\n originalComponents.current = components;\n const wrappers = useRef(\n new Map<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n >()\n );\n const stableComponents = useMemo(() => {\n const tags = new Set<string>();\n const collect = (node: Root | Root[\"children\"][number]) => {\n if (node.type === \"element\") tags.add(node.tagName);\n if (\"children\" in node) node.children.forEach(collect);\n };\n collect(prepared.tree!);\n const result: Record<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n > = {};\n for (const tag of tags) {\n if (!wrappers.current.has(tag)) {\n const Component = ({\n node,\n children,\n ...props\n }: {\n node: Element;\n children?: React.ReactNode;\n }) => {\n const state = getVideoMarkdownNodeState(node);\n if (state?.svg) {\n return state.svgSource ? (\n <SvgBlockInShadow svg={state.svgSource} inline />\n ) : null;\n }\n if (state?.atomic) {\n return state.active ? <>{children}</> : null;\n }\n if (state?.active === false && tag !== \"a\") return null;\n const current = originalComponents.current as Record<\n string,\n React.ElementType\n >;\n const Original = current[tag];\n const visibleProps =\n state?.active === false\n ? { ...props, href: undefined, tabIndex: -1 }\n : props;\n return Original\n ? React.createElement(\n Original,\n {\n ...visibleProps,\n node,\n ...(Original === MarkdownCode ? { receivedTree: true } : {}),\n },\n children\n )\n : React.createElement(tag, visibleProps, children);\n };\n Component.displayName = `StableMarkdown(${tag})`;\n wrappers.current.set(tag, Component);\n }\n result[tag] = wrappers.current.get(tag)!;\n }\n return result as CustomComponents;\n }, [prepared]);\n const preparedPlugins = useMemo<PluggableList>(\n () => [() => () => projected],\n [projected]\n );\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={[usePreparedTree]}\n rehypePlugins={preparedPlugins}\n components={stableComponents}\n >\n {\"\"}\n </ReactMarkdown>\n </div>\n );\n};\n\nconst isImmediateSegment = (segment: RenderSegment) =>\n segment.type === \"markdown\" && segment.immediate === true;\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\" && !isImmediateSegment(last)) {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst closeTypedInlineCode = (\n visible: string,\n source: string,\n ranges: ReturnType<typeof getInlineCodeRanges>\n) => {\n if (visible.length >= source.length) return visible;\n const range = ranges.find(\n ({ start, end }) => start < visible.length && visible.length < end\n );\n if (!range) return visible;\n const delimiter = /^`+/.exec(source.slice(range.start))?.[0];\n if (!delimiter || visible.length < range.start + delimiter.length) {\n return visible;\n }\n const closingStart = range.end - delimiter.length;\n if (visible.length > closingStart) {\n return visible + delimiter.slice(visible.length - closingStart);\n }\n // Close only the render copy so a typed prefix cannot activate code as HTML.\n return visible + (visible.endsWith(\"`\") ? \" \" : \"\") + delimiter;\n};\n\nconst protectTypedMarkdownPrefix = (\n visible: string,\n source: string,\n inlineCodeRanges: ReturnType<typeof getInlineCodeRanges>,\n metadataRanges: readonly MarkdownMetadataRange[],\n sourceOffset = 0\n) => {\n // Both protections use raw coordinates. Append any synthetic code delimiter\n // after escaping so encoded '<' characters cannot shift the typing budget.\n const closed = closeTypedInlineCode(visible, source, inlineCodeRanges);\n return (\n escapeTypedMarkdownMetadata(visible, metadataRanges, sourceOffset) +\n closed.slice(visible.length)\n );\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst areStringArraysEqual = (left?: string[], right?: string[]) => {\n if (left === right) {\n return true;\n }\n if (!left || !right || left.length !== right.length) {\n return false;\n }\n return left.every((value, index) => value === right[index]);\n};\n\nconst useStableStringArray = (values?: string[]) => {\n const valuesRef = useRef<string[] | undefined>(values);\n\n if (!areStringArraysEqual(valuesRef.current, values)) {\n valuesRef.current = values;\n }\n\n return valuesRef.current;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n onPlaceholderAccepted,\n content,\n contentType,\n locale,\n lang,\n dir,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n typewriterPacing = \"fixed\",\n onTypeFinished,\n onTypewriterStateChange,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxExitFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const mermaidMessages = useMemo(\n () => ({\n loading: localeTexts.mermaidLoadingText,\n emptyChart: localeTexts.mermaidEmptyChartText,\n error: localeTexts.mermaidErrorText,\n }),\n [localeTexts]\n );\n const direction = dir ?? getMarkdownFlowDirection(locale);\n const language = lang ?? getMarkdownFlowLanguage(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const resolvedCopyButtonText = copyButtonText || localeTexts.copyButtonText;\n const resolvedCopiedButtonText =\n copiedButtonText || localeTexts.copiedButtonText;\n const resolvedSandboxFullscreenButtonText =\n sandboxFullscreenButtonText || localeTexts.sandboxFullscreenButtonText;\n const resolvedSandboxExitFullscreenButtonText =\n sandboxExitFullscreenButtonText ||\n localeTexts.sandboxExitFullscreenButtonText;\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const sourceContent = useMemo(\n () => normalizeWrappedSandboxContent(content),\n [content]\n );\n const sourceAnalysis = useMemo(\n () => getMarkdownSourceAnalysis(sourceContent),\n [sourceContent]\n );\n // Parse the received source, never a typewriter-truncated HTML string.\n const sourceSegments = useMemo(() => {\n const segments = mergeNonSandboxSegments(\n splitContentSegments(sourceContent, true, true, sourceAnalysis)\n );\n if (\n sourceContent !== content &&\n segments.length &&\n (segments[0].type === \"sandbox\" || isImmediateSegment(segments[0]))\n ) {\n // The removed opening quote occupied a prose slot before the wrapper\n // completed. Retain its empty slot so the existing iframe keeps its key.\n return [{ type: \"text\" as const, value: \"\" }, ...segments];\n }\n return segments;\n }, [content, sourceContent, sourceAnalysis]);\n const hasRichSegments = sourceSegments.some(\n (segment) => segment.type === \"sandbox\" || isImmediateSegment(segment)\n );\n const typewriterContent = hasRichSegments\n ? sourceSegments\n .filter(\n (segment) =>\n segment.type !== \"sandbox\" && !isImmediateSegment(segment)\n )\n .map((segment) => segment.value)\n .join(\"\")\n : sourceContent;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const fixedTypewriterContentVersion =\n typewriterPacing === \"fixed\" ? typewriterContent : undefined;\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : typewriterContent\n );\n const displayContentRef = useRef(displayContent);\n const pendingContentRef = useRef(\"\");\n const contentAwareQueueRef = useRef<ContentAwareTypewriterQueue>({\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n });\n const contentAwareBudgetRef = useRef(0);\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n const previousTypewriterPacingRef = useRef(typewriterPacing);\n const previousSourceContentRef = useRef(typewriterContent);\n const previousReceivedContentRef = useRef(content);\n const hasReportedTypeFinishedRef = useRef(false);\n const [typewriterWakeVersion, setTypewriterWakeVersion] = useState(0);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n const previousTypewriterPacing = previousTypewriterPacingRef.current;\n const previousSourceContent = previousSourceContentRef.current;\n const wasPending = Boolean(pendingContentRef.current);\n const receivedContentChanged =\n previousReceivedContentRef.current !== content;\n const receivedContentAppended =\n receivedContentChanged &&\n content.startsWith(previousReceivedContentRef.current);\n previousReceivedContentRef.current = content;\n\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n previousTypewriterPacingRef.current = typewriterPacing;\n previousSourceContentRef.current = typewriterContent;\n\n if (\n receivedContentChanged ||\n isTypewriterEnabled !== wasTypewriterEnabled\n ) {\n hasReportedTypeFinishedRef.current = false;\n }\n\n const clearPendingContent = () => {\n pendingContentRef.current = \"\";\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n };\n\n const updateDisplayContent = (nextContent: string) => {\n displayContentRef.current = nextContent;\n setDisplayContent(nextContent);\n };\n\n if (!isTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(typewriterContent);\n return;\n }\n\n if (!wasTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(\"\");\n }\n\n let visibleContent = !wasTypewriterEnabled ? \"\" : displayContentRef.current;\n\n if (!typewriterContent.startsWith(visibleContent)) {\n clearPendingContent();\n if (!receivedContentAppended) {\n updateDisplayContent(typewriterContent);\n if (typewriterPacing === \"content-aware\") {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(typewriterContent),\n };\n }\n return;\n }\n // A newly recognized HTML tag can replace a previously literal prefix.\n // Keep the shared prose visible and pace only the newly received prose.\n let sharedLength = 0;\n while (\n sharedLength < visibleContent.length &&\n sharedLength < typewriterContent.length &&\n visibleContent[sharedLength] === typewriterContent[sharedLength]\n ) {\n sharedLength += 1;\n }\n visibleContent = visibleContent.slice(0, sharedLength);\n updateDisplayContent(visibleContent);\n }\n\n let nextPendingContent = typewriterContent.slice(visibleContent.length);\n if (!nextPendingContent) {\n pendingContentRef.current = \"\";\n contentAwareBudgetRef.current = 0;\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n return;\n }\n\n if (typewriterPacing === \"content-aware\") {\n const previousPendingContent = previousSourceContent.slice(\n visibleContent.length\n );\n const canAppendToCachedQueue =\n wasTypewriterEnabled &&\n previousTypewriterPacing === \"content-aware\" &&\n typewriterContent.startsWith(previousSourceContent) &&\n pendingContentRef.current === previousPendingContent;\n\n if (canAppendToCachedQueue) {\n const appended = appendContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n typewriterContent.slice(previousSourceContent.length)\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n } else {\n const appended = appendContentAwareTypewriterQueue(\n {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n },\n nextPendingContent\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n\n contentAwareBudgetRef.current = 0;\n }\n } else {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n }\n\n pendingContentRef.current = nextPendingContent;\n\n if (!wasPending && nextPendingContent) {\n setTypewriterWakeVersion((version) => version + 1);\n }\n }, [content, typewriterContent, isTypewriterEnabled, typewriterPacing]);\n\n useEffect(() => {\n if (!isTypewriterEnabled) {\n return;\n }\n\n if (\n hasReportedTypeFinishedRef.current ||\n pendingContentRef.current ||\n displayContent !== typewriterContent\n ) {\n return;\n }\n\n hasReportedTypeFinishedRef.current = true;\n onTypeFinished?.();\n }, [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n onTypeFinished,\n ]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n if (!pendingContentRef.current) {\n return;\n }\n\n let chunk = \"\";\n\n if (typewriterPacing === \"content-aware\") {\n const result = consumeContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n contentAwareBudgetRef.current + CONTENT_AWARE_TYPEWRITER_TICK_BUDGET\n );\n\n chunk = result.chunk;\n contentAwareQueueRef.current = result.queue;\n\n if (isContentAwareTypewriterQueueEmpty(result.queue)) {\n contentAwareBudgetRef.current = 0;\n } else {\n contentAwareBudgetRef.current = result.remainingBudget;\n }\n } else {\n const fixedChunk = splitTextByCharacterChunk(\n pendingContentRef.current,\n FIXED_TYPEWRITER_CHUNK_SIZE\n );\n chunk = fixedChunk.chunk;\n }\n\n if (!chunk) {\n return;\n }\n\n pendingContentRef.current = pendingContentRef.current.slice(chunk.length);\n if (!pendingContentRef.current) {\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: contentAwareQueueRef.current.trailingGrapheme,\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n contentAwareBudgetRef.current = 0;\n }\n\n const nextDisplayContent = `${displayContentRef.current}${chunk}`;\n displayContentRef.current = nextDisplayContent;\n setDisplayContent(nextDisplayContent);\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n displayContent,\n fixedTypewriterContentVersion,\n isTypewriterEnabled,\n typewriterPacing,\n typewriterTickMs,\n typewriterWakeVersion,\n ]);\n\n const mergedRenderSegments = useMemo(() => {\n let textOffset = 0;\n return sourceSegments.map((segment) => {\n if (!isTypewriterEnabled) return segment;\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n // HTML skips the prose budget only after earlier prose has caught up.\n // Retain its source slot so later updates keep the same render key.\n return displayContent.length >= textOffset\n ? segment\n : { ...segment, value: \"\" };\n }\n const value = displayContent.slice(\n textOffset,\n textOffset + segment.value.length\n );\n textOffset += segment.value.length;\n // Keep empty prose slots so an existing sandbox never changes its key.\n return { ...segment, value };\n });\n }, [sourceSegments, displayContent, isTypewriterEnabled]);\n const typewriterState = useMemo<ContentRenderTypewriterState>(\n () => ({\n isTypewriterEnabled,\n isTyping: isTypewriterEnabled && displayContent !== typewriterContent,\n isComplete: displayContent === typewriterContent,\n renderedLength:\n content.length -\n sourceSegments.reduce(\n (remaining, segment, index) =>\n remaining +\n segment.value.length -\n mergedRenderSegments[index].value.length,\n 0\n ),\n totalLength: content.length,\n }),\n [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n sourceSegments,\n mergedRenderSegments,\n ]\n );\n\n useEffect(() => {\n onTypewriterStateChange?.(typewriterState);\n }, [onTypewriterStateChange, typewriterState]);\n const sourceSegmentOffsets = useMemo(() => {\n let offset = 0;\n return sourceSegments.map((segment) => {\n const start = offset;\n offset += segment.value.length;\n return start;\n });\n }, [sourceSegments]);\n const sourceInlineCodeRanges = useMemo(\n () =>\n isTypewriterEnabled\n ? sourceSegments.map((segment) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? []\n : segment.value === sourceContent\n ? sourceAnalysis.inline\n : getInlineCodeRanges(segment.value)\n )\n : [],\n [isTypewriterEnabled, sourceSegments, sourceContent, sourceAnalysis]\n );\n const safeRichMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? mergedRenderSegments.map((segment, index) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? segment.value\n : isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n segment.value,\n sourceSegments[index].value,\n sourceInlineCodeRanges[index] ?? [],\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n : escapeTypedMarkdownMetadata(\n segment.value,\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n )\n : [],\n [\n hasRichSegments,\n isTypewriterEnabled,\n mergedRenderSegments,\n sourceInlineCodeRanges,\n sourceSegments,\n sourceAnalysis.metadata,\n sourceSegmentOffsets,\n ]\n );\n const richRenderRuns = useMemo(() => {\n const runs: Array<{\n indices: number[];\n sandbox: boolean;\n plan?: ReturnType<typeof createVideoMarkdownRunPlan>;\n }> = [];\n sourceSegments.forEach((segment, index) => {\n const previous = runs.at(-1);\n if (segment.type !== \"sandbox\" && previous && !previous.sandbox) {\n previous.indices.push(index);\n } else {\n runs.push({ indices: [index], sandbox: segment.type === \"sandbox\" });\n }\n });\n for (const run of runs) {\n if (\n !run.sandbox &&\n run.indices.some((index) => isImmediateSegment(sourceSegments[index]))\n ) {\n const segments = run.indices.map((index) => sourceSegments[index]);\n const fullSource = segments.map((segment) => segment.value).join(\"\");\n run.plan = createVideoMarkdownRunPlan(\n segments,\n fullSource === sourceContent ? sourceAnalysis : undefined\n );\n }\n }\n return runs;\n }, [sourceSegments, sourceContent, sourceAnalysis]);\n const renderContent = hasRichSegments\n ? mergedRenderSegments.map((segment) => segment.value).join(\"\")\n : isTypewriterEnabled\n ? displayContent\n : sourceContent;\n const normalizedContent = useMemo(\n () => (customRenderBar ? normalizeInlineHtml(renderContent) : \"\"),\n [customRenderBar, renderContent]\n );\n\n const safeMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? \"\"\n : normalizeInlineHtml(\n isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n renderContent,\n sourceContent,\n sourceInlineCodeRanges[0] ?? [],\n sourceAnalysis.metadata\n )\n : escapeTypedMarkdownMetadata(\n renderContent,\n sourceAnalysis.metadata\n )\n ),\n [\n sourceContent,\n hasRichSegments,\n isTypewriterEnabled,\n renderContent,\n sourceInlineCodeRanges,\n sourceAnalysis.metadata,\n ]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n (defaultButtonText ? trimVariablePadding(defaultButtonText) : undefined) ||\n interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => trimVariablePadding(value))\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n const stableDefaultSelectedValues = useStableStringArray(\n resolvedDefaultSelectedValues\n );\n const componentRuntimeValuesRef = useRef<MarkdownComponentRuntimeValues>({\n onPlaceholderAccepted,\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n });\n\n componentRuntimeValuesRef.current = {\n onPlaceholderAccepted,\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n };\n\n const components = useMemo<CustomComponents>(\n () => ({\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={\n componentRuntimeValuesRef.current.onClickCustomButtonAfterContent\n }\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={componentRuntimeValuesRef.current.readonly}\n defaultButtonText={\n componentRuntimeValuesRef.current.resolvedDefaultButtonText\n }\n defaultInputText={\n componentRuntimeValuesRef.current.resolvedDefaultInputText\n }\n defaultSelectedValues={\n componentRuntimeValuesRef.current.resolvedDefaultSelectedValues\n }\n onSend={componentRuntimeValuesRef.current.onSend}\n onPlaceholderAccepted={\n componentRuntimeValuesRef.current.onPlaceholderAccepted\n }\n beforeSend={componentRuntimeValuesRef.current.beforeSend}\n locale={componentRuntimeValuesRef.current.locale}\n dir={componentRuntimeValuesRef.current.direction}\n lang={componentRuntimeValuesRef.current.language}\n confirmButtonText={\n componentRuntimeValuesRef.current.resolvedConfirmButtonText\n }\n />\n ),\n code: MarkdownCode,\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className: unknown = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={\n componentRuntimeValuesRef.current.resolvedCopyButtonText\n }\n copiedButtonText={\n componentRuntimeValuesRef.current.resolvedCopiedButtonText\n }\n />\n ),\n }),\n []\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(safeMarkdownContent),\n [safeMarkdownContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={key}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={key}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n const customBar = customRenderBar ? (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n ) : null;\n\n if (hasRichSegments) {\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {richRenderRuns.map((run) => {\n const idx = run.indices[0];\n const segment = mergedRenderSegments[idx];\n if (run.sandbox)\n return segment.type === \"sandbox\" &&\n segment.value &&\n !segment.pending ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n locale={locale}\n dir={direction}\n lang={language}\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={resolvedSandboxFullscreenButtonText}\n exitFullScreenButtonText={\n resolvedSandboxExitFullscreenButtonText\n }\n mode={sandboxMode}\n />\n ) : null;\n if (run.plan)\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={`md-${idx}`}\n value={componentRuntimeValuesRef}\n >\n <StableVideoMarkdownRenderer\n locale={locale}\n components={components}\n plan={run.plan}\n renderedSegments={run.indices.map(\n (index) => mergedRenderSegments[index]\n )}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n return run.indices.map((index) => (\n <React.Fragment key={`md-${index}`}>\n {mergedRenderSegments[index].type === \"markdown\" &&\n mergedRenderSegments[index].pending\n ? null\n : renderMarkdownSegments(\n safeRichMarkdownContent[index],\n `md-${index}`\n )}\n </React.Fragment>\n ));\n })}\n {customBar}\n </div>\n );\n }\n\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={index}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customBar}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["FIXED_TYPEWRITER_CHUNK_SIZE","SvgBlockInShadow","svg","inline","hostRef","useRef","Wrapper","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","MarkdownComponentRuntimeContext","React","MarkdownCode","props","receivedTree","codeProps","runtimeValuesRef","isInCodeBlock","CodeBlockContext","className","children","rest","chartContent","complete","mermaidBlockIsComplete","frozen","MermaidChart","sourceRehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","formattingRehypePlugins","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","rehypePlugins","MarkdownRenderer","markdownContent","components","locale","texts","getContentRenderLocaleTexts","ReactMarkdown","remarkPlugins","referenceIndex","rereferenceIndex","reference","usePreparedTree","StableVideoMarkdownRenderer","plan","renderedSegments","prepared","useMemo","sourceProcessor","unified","remarkRehype","formattingProcessor","tree","cloneVideoMarkdownSourceTree","prepareVideoMarkdownRun","projected","projectVideoMarkdownRun","originalComponents","wrappers","stableComponents","tags","collect","result","tag","Component","state","getVideoMarkdownNodeState","Fragment","Original","visibleProps","preparedPlugins","isImmediateSegment","segment","mergeNonSandboxSegments","segments","merged","last","closeTypedInlineCode","visible","source","ranges","range","start","end","delimiter","closingStart","protectTypedMarkdownPrefix","inlineCodeRanges","metadataRanges","sourceOffset","closed","escapeTypedMarkdownMetadata","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","areStringArraysEqual","left","right","index","useStableStringArray","values","valuesRef","ContentRender","onPlaceholderAccepted","content","contentType","lang","dir","customRenderBar","onSend","typingSpeed","enableTypewriter","typewriterPacing","onTypeFinished","onTypewriterStateChange","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","localeTexts","mermaidMessages","direction","getMarkdownFlowDirection","language","getMarkdownFlowLanguage","resolvedConfirmButtonText","resolvedCopyButtonText","resolvedCopiedButtonText","resolvedSandboxFullscreenButtonText","resolvedSandboxExitFullscreenButtonText","isTypewriterEnabled","sourceContent","normalizeWrappedSandboxContent","sourceAnalysis","getMarkdownSourceAnalysis","sourceSegments","splitContentSegments","hasRichSegments","typewriterContent","typewriterTickMs","fixedTypewriterContentVersion","displayContent","setDisplayContent","useState","displayContentRef","pendingContentRef","contentAwareQueueRef","contentAwareBudgetRef","previousTypewriterEnabledRef","previousTypewriterPacingRef","previousSourceContentRef","previousReceivedContentRef","hasReportedTypeFinishedRef","typewriterWakeVersion","setTypewriterWakeVersion","wasTypewriterEnabled","previousTypewriterPacing","previousSourceContent","wasPending","receivedContentChanged","receivedContentAppended","clearPendingContent","updateDisplayContent","nextContent","visibleContent","getTrailingTypewriterGrapheme","sharedLength","nextPendingContent","previousPendingContent","appended","appendContentAwareTypewriterQueue","version","typewriterTimer","chunk","consumeContentAwareTypewriterQueue","CONTENT_AWARE_TYPEWRITER_TICK_BUDGET","isContentAwareTypewriterQueueEmpty","nextDisplayContent","mergedRenderSegments","textOffset","typewriterState","remaining","sourceSegmentOffsets","offset","sourceInlineCodeRanges","getInlineCodeRanges","safeRichMarkdownContent","richRenderRuns","runs","previous","run","fullSource","createVideoMarkdownRunPlan","renderContent","normalizedContent","normalizeInlineHtml","safeMarkdownContent","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","trimVariablePadding","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","stableDefaultSelectedValues","componentRuntimeValuesRef","CustomButtonInputVariable","CodeBlock","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","key","customBar","jsxs","idx","IframeSandbox"],"mappings":"wjDA4EMA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AAK,EAAE,QACxB,KACA6H,GACEvB,GAAwBtG,CAAK,EAC7B,MAAMA,CAAK,EAAA,CACb,EAPe,MAAMA,CAAK,EAQhC,CACD,CACH,CAAC,EACAkI,EAAA,CAAA,CAAA,EAMLC,EAAAA,KAAC,MAAA,CACC,UAAU,+BACV,IAAK9F,EACL,KAAME,EAEL,SAAA,CAAAhE,GAAS,IAAI,CAACyJ,EAAKhI,IAAU,CAC5B,GAAIgI,EAAI,OAAS,OACf,OACEjO,EAAAA,IAACC,GAAgC,SAAhC,CAEC,MAAOyN,EAEP,SAAA1N,EAAAA,IAAC6B,GAAA,CAAA,OACCG,EACA,WAAAD,GACA,QAASkM,EAAI,KAAA,CAAA,CACf,EAPKhI,CAAA,EAYX,GAAIgI,EAAI,OAAS,UACf,OACEjO,EAAAA,IAACiB,GAAAA,QAAA,CAEC,MAAOgN,EAAI,MACX,OAAQ,CAACA,EAAI,SACb,SAAU5F,CAAA,EAHLpC,CAAA,EAQX,GAAIgI,EAAI,OAAS,MACf,OAAOjO,EAAAA,IAACpC,GAAA,CAA6B,IAAKqQ,EAAI,OAAhBhI,CAAuB,CAEzD,CAAC,EAEAkI,EAAA,CAAA,CAAA,CAGP"}
@@ -27,6 +27,8 @@ export interface ContentRenderProps {
27
27
  customRenderBar?: CustomRenderBarProps;
28
28
  onClickCustomButtonAfterContent?: () => void;
29
29
  onSend?: (content: OnSendContentParams) => void;
30
+ /** Observes an accepted Tab completion without receiving authored text. */
31
+ onPlaceholderAccepted?: () => void;
30
32
  typingSpeed?: number;
31
33
  /** Types prose only; following HTML renders progressively once preceding prose is displayed. */
32
34
  enableTypewriter?: boolean;