@flamingo-stack/openframe-frontend-core 0.0.457 → 0.0.458-snapshot.20260720215024

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 (290) hide show
  1. package/dist/chat-protocol/decode.d.ts +58 -0
  2. package/dist/chat-protocol/decode.d.ts.map +1 -0
  3. package/dist/chat-protocol/encode.d.ts +44 -0
  4. package/dist/chat-protocol/encode.d.ts.map +1 -0
  5. package/dist/chat-protocol/env-flag.d.ts +35 -0
  6. package/dist/chat-protocol/env-flag.d.ts.map +1 -0
  7. package/dist/chat-protocol/events.d.ts +192 -0
  8. package/dist/chat-protocol/events.d.ts.map +1 -0
  9. package/dist/chat-protocol/frames.d.ts +206 -0
  10. package/dist/chat-protocol/frames.d.ts.map +1 -0
  11. package/dist/chat-protocol/index.cjs +493 -0
  12. package/dist/chat-protocol/index.cjs.map +1 -0
  13. package/dist/chat-protocol/index.d.ts +18 -0
  14. package/dist/chat-protocol/index.d.ts.map +1 -0
  15. package/dist/chat-protocol/index.js +477 -0
  16. package/dist/chat-protocol/index.js.map +1 -0
  17. package/dist/chat-protocol/ip-normalize.d.ts +44 -0
  18. package/dist/chat-protocol/ip-normalize.d.ts.map +1 -0
  19. package/dist/chat-protocol/nats-decoder.d.ts +26 -0
  20. package/dist/chat-protocol/nats-decoder.d.ts.map +1 -0
  21. package/dist/{chunk-SQ3CP2IV.cjs → chunk-3N3TMZ62.cjs} +7 -7
  22. package/dist/{chunk-SQ3CP2IV.cjs.map → chunk-3N3TMZ62.cjs.map} +1 -1
  23. package/dist/{chunk-I7M6KCCS.js → chunk-4R6H2U77.js} +4 -4
  24. package/dist/{chunk-CCT5VCRP.cjs → chunk-4XDWNAZW.cjs} +9 -9
  25. package/dist/{chunk-CCT5VCRP.cjs.map → chunk-4XDWNAZW.cjs.map} +1 -1
  26. package/dist/{chunk-KQ36EHE4.cjs → chunk-7KSEINAE.cjs} +15 -15
  27. package/dist/{chunk-KQ36EHE4.cjs.map → chunk-7KSEINAE.cjs.map} +1 -1
  28. package/dist/{chunk-FM5DTJPA.cjs → chunk-ADD3FPDG.cjs} +6851 -4713
  29. package/dist/chunk-ADD3FPDG.cjs.map +1 -0
  30. package/dist/{chunk-RSW42GTZ.js → chunk-APF5QBAU.js} +2 -2
  31. package/dist/{chunk-YCIVMKRS.cjs → chunk-BLZZXZNM.cjs} +26 -26
  32. package/dist/{chunk-YCIVMKRS.cjs.map → chunk-BLZZXZNM.cjs.map} +1 -1
  33. package/dist/{chunk-YHB4MNUX.cjs → chunk-BQ7PMWLM.cjs} +28 -27
  34. package/dist/chunk-BQ7PMWLM.cjs.map +1 -0
  35. package/dist/{chunk-GJ7BN4MI.js → chunk-CGNDAJ7V.js} +4 -4
  36. package/dist/{chunk-R5IQJXA3.js → chunk-F2NMWV44.js} +2 -2
  37. package/dist/{chunk-EOVQVVDJ.cjs → chunk-F7F43U7Q.cjs} +11 -11
  38. package/dist/{chunk-EOVQVVDJ.cjs.map → chunk-F7F43U7Q.cjs.map} +1 -1
  39. package/dist/{chunk-2ZW2ZPDW.js → chunk-LAOO7XHO.js} +2 -2
  40. package/dist/{chunk-O7F7RZFN.js → chunk-LJKZIIK4.js} +6 -5
  41. package/dist/chunk-LJKZIIK4.js.map +1 -0
  42. package/dist/{chunk-AJGZ3YSR.js → chunk-OR5AMXYN.js} +2 -2
  43. package/dist/{chunk-5XFJG3TC.cjs → chunk-P5JQDFRM.cjs} +60 -60
  44. package/dist/chunk-P5JQDFRM.cjs.map +1 -0
  45. package/dist/{chunk-U4APSAAR.cjs → chunk-PXZ7YQ5V.cjs} +5 -5
  46. package/dist/{chunk-U4APSAAR.cjs.map → chunk-PXZ7YQ5V.cjs.map} +1 -1
  47. package/dist/{chunk-WXDEMTLD.js → chunk-QO2XD3FR.js} +2 -2
  48. package/dist/{chunk-C2TDHJBO.cjs → chunk-QSGZE6AZ.cjs} +37 -37
  49. package/dist/{chunk-C2TDHJBO.cjs.map → chunk-QSGZE6AZ.cjs.map} +1 -1
  50. package/dist/{chunk-NSL5MNS4.js → chunk-REWRUV3K.js} +11644 -9506
  51. package/dist/chunk-REWRUV3K.js.map +1 -0
  52. package/dist/{chunk-BDTQIIJR.cjs → chunk-TA7MFVUS.cjs} +31 -31
  53. package/dist/{chunk-BDTQIIJR.cjs.map → chunk-TA7MFVUS.cjs.map} +1 -1
  54. package/dist/{chunk-4423DHRX.js → chunk-UI7CIUAR.js} +2 -2
  55. package/dist/{chunk-5BKBG653.js → chunk-VXJH5TDN.js} +10 -10
  56. package/dist/chunk-VXJH5TDN.js.map +1 -0
  57. package/dist/{chunk-AB65PWU2.cjs → chunk-WCE66C2Z.cjs} +62 -62
  58. package/dist/{chunk-AB65PWU2.cjs.map → chunk-WCE66C2Z.cjs.map} +1 -1
  59. package/dist/{chunk-KXIIUE75.js → chunk-XF5ROTMQ.js} +2 -2
  60. package/dist/components/case-studies/index.cjs +8 -8
  61. package/dist/components/case-studies/index.js +2 -2
  62. package/dist/components/chart.d.ts +1 -1
  63. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  64. package/dist/components/chat/chat-message-list.d.ts.map +1 -1
  65. package/dist/components/chat/hooks/index.d.ts +0 -1
  66. package/dist/components/chat/hooks/index.d.ts.map +1 -1
  67. package/dist/components/chat/hooks/use-chat.d.ts.map +1 -1
  68. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +15 -48
  69. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  70. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts +3 -47
  71. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  72. package/dist/components/chat/index.cjs +10 -2
  73. package/dist/components/chat/index.cjs.map +1 -1
  74. package/dist/components/chat/index.d.ts +1 -0
  75. package/dist/components/chat/index.d.ts.map +1 -1
  76. package/dist/components/chat/index.js +21 -13
  77. package/dist/components/chat/stream/chat-dialog-store.d.ts +184 -0
  78. package/dist/components/chat/stream/chat-dialog-store.d.ts.map +1 -0
  79. package/dist/components/chat/stream/chat-stream-reducer.d.ts +367 -0
  80. package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +1 -0
  81. package/dist/components/chat/stream/delta-batcher.d.ts +51 -0
  82. package/dist/components/chat/stream/delta-batcher.d.ts.map +1 -0
  83. package/dist/components/chat/stream/index.d.ts +17 -0
  84. package/dist/components/chat/stream/index.d.ts.map +1 -0
  85. package/dist/components/chat/stream/message-mutations.d.ts +77 -0
  86. package/dist/components/chat/stream/message-mutations.d.ts.map +1 -0
  87. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts +22 -0
  88. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts.map +1 -0
  89. package/dist/components/chat/types/api.types.d.ts +1 -81
  90. package/dist/components/chat/types/api.types.d.ts.map +1 -1
  91. package/dist/components/chat/types/processing.types.d.ts +2 -90
  92. package/dist/components/chat/types/processing.types.d.ts.map +1 -1
  93. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts +34 -6
  94. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts.map +1 -1
  95. package/dist/components/chat/utils/index.d.ts +2 -3
  96. package/dist/components/chat/utils/index.d.ts.map +1 -1
  97. package/dist/components/chat/utils/process-historical-messages.d.ts +59 -11
  98. package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
  99. package/dist/components/contact/index.cjs +3 -3
  100. package/dist/components/contact/index.js +2 -2
  101. package/dist/components/docs/index.cjs +5 -5
  102. package/dist/components/docs/index.js +4 -4
  103. package/dist/components/embeds/index.cjs +3 -3
  104. package/dist/components/embeds/index.js +2 -2
  105. package/dist/components/faq/index.cjs +3 -3
  106. package/dist/components/faq/index.js +2 -2
  107. package/dist/components/features/index.cjs +2 -2
  108. package/dist/components/features/index.js +1 -1
  109. package/dist/components/features/time-tracker/time-tracker-panel.d.ts.map +1 -1
  110. package/dist/components/help-center-pages/index.cjs +20 -20
  111. package/dist/components/help-center-pages/index.js +11 -11
  112. package/dist/components/index.cjs +171 -129
  113. package/dist/components/index.cjs.map +1 -1
  114. package/dist/components/index.js +63 -21
  115. package/dist/components/index.js.map +1 -1
  116. package/dist/components/layout/page-container.d.ts.map +1 -1
  117. package/dist/components/navigation/index.cjs +2 -2
  118. package/dist/components/navigation/index.js +1 -1
  119. package/dist/components/onboarding-guides/index.cjs +5 -5
  120. package/dist/components/onboarding-guides/index.js +4 -4
  121. package/dist/components/onboarding-guides/onboarding-guide-detail-view.d.ts.map +1 -1
  122. package/dist/components/related-content/index.cjs +3 -3
  123. package/dist/components/related-content/index.js +2 -2
  124. package/dist/components/shared/product-release/release-detail-page.d.ts.map +1 -1
  125. package/dist/components/tickets/index.cjs +5 -5
  126. package/dist/components/tickets/index.js +4 -4
  127. package/dist/components/ui/index.cjs +44 -2
  128. package/dist/components/ui/index.cjs.map +1 -1
  129. package/dist/components/ui/index.d.ts +1 -2
  130. package/dist/components/ui/index.d.ts.map +1 -1
  131. package/dist/components/ui/index.js +55 -13
  132. package/dist/components/ui/markdown/base-components.d.ts +56 -0
  133. package/dist/components/ui/markdown/base-components.d.ts.map +1 -0
  134. package/dist/components/ui/markdown/engine.d.ts +99 -0
  135. package/dist/components/ui/markdown/engine.d.ts.map +1 -0
  136. package/dist/components/ui/markdown/heading-ids.d.ts +65 -0
  137. package/dist/components/ui/markdown/heading-ids.d.ts.map +1 -0
  138. package/dist/components/ui/markdown/index.d.ts +18 -0
  139. package/dist/components/ui/markdown/index.d.ts.map +1 -0
  140. package/dist/components/ui/markdown/mermaid-diagram.d.ts +79 -0
  141. package/dist/components/ui/markdown/mermaid-diagram.d.ts.map +1 -0
  142. package/dist/components/ui/markdown/rich/embed-overrides.d.ts +14 -0
  143. package/dist/components/ui/markdown/rich/embed-overrides.d.ts.map +1 -0
  144. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts +40 -0
  145. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +1 -0
  146. package/dist/components/ui/markdown/rich/shortcodes.d.ts +8 -0
  147. package/dist/components/ui/markdown/rich/shortcodes.d.ts.map +1 -0
  148. package/dist/components/ui/markdown/sanitize.d.ts +153 -0
  149. package/dist/components/ui/markdown/sanitize.d.ts.map +1 -0
  150. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts +23 -0
  151. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts.map +1 -0
  152. package/dist/components/ui/markdown/streaming.d.ts +78 -0
  153. package/dist/components/ui/markdown/streaming.d.ts.map +1 -0
  154. package/dist/components/ui/markdown/text-size.d.ts +34 -0
  155. package/dist/components/ui/markdown/text-size.d.ts.map +1 -0
  156. package/dist/components/ui/modal-v2.d.ts.map +1 -1
  157. package/dist/components/ui/modal.d.ts.map +1 -1
  158. package/dist/index.cjs +60 -2
  159. package/dist/index.cjs.map +1 -1
  160. package/dist/index.js +71 -13
  161. package/dist/utils/index.cjs +169 -40
  162. package/dist/utils/index.cjs.map +1 -1
  163. package/dist/utils/index.d.ts +1 -0
  164. package/dist/utils/index.d.ts.map +1 -1
  165. package/dist/utils/index.js +162 -41
  166. package/dist/utils/index.js.map +1 -1
  167. package/dist/utils/markdown-fences.d.ts +42 -0
  168. package/dist/utils/markdown-fences.d.ts.map +1 -0
  169. package/dist/utils/markdown-heading-id.d.ts +85 -0
  170. package/dist/utils/markdown-heading-id.d.ts.map +1 -0
  171. package/dist/utils/markdown-section-extractor.d.ts.map +1 -1
  172. package/package.json +7 -1
  173. package/src/chat-protocol/__tests__/__snapshots__/nats-decoder-golden.test.ts.snap +307 -0
  174. package/src/chat-protocol/__tests__/chat-protocol.test.ts +515 -0
  175. package/src/chat-protocol/__tests__/env-flag.test.ts +52 -0
  176. package/src/chat-protocol/__tests__/ip-normalize.test.ts +136 -0
  177. package/src/chat-protocol/__tests__/nats-decoder-golden.test.ts +228 -0
  178. package/src/chat-protocol/decode.ts +277 -0
  179. package/src/chat-protocol/encode.ts +71 -0
  180. package/src/chat-protocol/env-flag.ts +39 -0
  181. package/src/chat-protocol/events.ts +228 -0
  182. package/src/chat-protocol/frames.ts +238 -0
  183. package/src/chat-protocol/index.ts +21 -0
  184. package/src/chat-protocol/ip-normalize.ts +146 -0
  185. package/src/chat-protocol/nats-decoder.ts +252 -0
  186. package/src/components/chat/__tests__/chat-message-list.test.tsx +293 -5
  187. package/src/components/chat/__tests__/chat-message-streaming-memo.test.tsx +207 -0
  188. package/src/components/chat/__tests__/chat-pending-turn.test.tsx +209 -0
  189. package/src/components/chat/chat-message-enhanced.tsx +111 -17
  190. package/src/components/chat/chat-message-list.tsx +367 -113
  191. package/src/components/chat/embeddable-chat.tsx +6 -0
  192. package/src/components/chat/hooks/.index.md +1 -1
  193. package/src/components/chat/hooks/.use-nats-chat-adapter.md +1 -1
  194. package/src/components/chat/hooks/__tests__/__snapshots__/persisted-state-v1-golden.test.ts.snap +297 -0
  195. package/src/components/chat/hooks/__tests__/__snapshots__/sse-stream-golden.test.ts.snap +0 -0
  196. package/src/components/chat/hooks/__tests__/persisted-state-v1-golden.test.ts +272 -0
  197. package/src/components/chat/hooks/__tests__/sse-stream-golden.test.ts +318 -0
  198. package/src/components/chat/hooks/index.ts +0 -1
  199. package/src/components/chat/hooks/use-chat.ts +8 -0
  200. package/src/components/chat/hooks/use-nats-chat-adapter.ts +243 -822
  201. package/src/components/chat/hooks/use-sse-chat-adapter.ts +318 -666
  202. package/src/components/chat/index.ts +5 -0
  203. package/src/components/chat/stream/__tests__/__snapshots__/chat-stream-reducer-golden.test.ts.snap +937 -0
  204. package/src/components/chat/stream/__tests__/chat-dialog-store.test.ts +756 -0
  205. package/src/components/chat/stream/__tests__/chat-stream-reducer-golden.test.ts +460 -0
  206. package/src/components/chat/stream/__tests__/chat-stream-reducer.test.ts +894 -0
  207. package/src/components/chat/stream/__tests__/delta-batcher.test.ts +255 -0
  208. package/src/components/chat/stream/__tests__/use-chat-stream-reducer.test.ts +98 -0
  209. package/src/components/chat/stream/chat-dialog-store.ts +536 -0
  210. package/src/components/chat/stream/chat-stream-reducer.ts +1796 -0
  211. package/src/components/chat/stream/delta-batcher.ts +159 -0
  212. package/src/components/chat/stream/index.ts +55 -0
  213. package/src/components/chat/stream/message-mutations.ts +338 -0
  214. package/src/components/chat/stream/use-chat-stream-reducer.ts +126 -0
  215. package/src/components/chat/thinking-display.tsx +1 -1
  216. package/src/components/chat/types/.api.types.md +1 -3
  217. package/src/components/chat/types/.processing.types.md +6 -23
  218. package/src/components/chat/types/api.types.ts +6 -73
  219. package/src/components/chat/types/processing.types.ts +11 -52
  220. package/src/components/chat/utils/.index.md +0 -5
  221. package/src/components/chat/utils/__tests__/__snapshots__/process-historical-messages-golden.test.ts.snap +418 -0
  222. package/src/components/chat/utils/__tests__/__snapshots__/segment-accumulator-golden.test.ts.snap +599 -0
  223. package/src/components/chat/utils/__tests__/process-historical-messages-golden.test.ts +317 -0
  224. package/src/components/chat/utils/__tests__/segment-accumulator-golden.test.ts +270 -0
  225. package/src/components/chat/utils/extract-incomplete-message-state.ts +63 -5
  226. package/src/components/chat/utils/index.ts +5 -8
  227. package/src/components/chat/utils/process-historical-messages.ts +352 -383
  228. package/src/components/features/notifications/notification-drawer.tsx +4 -2
  229. package/src/components/features/time-tracker/time-tracker-panel.tsx +8 -2
  230. package/src/components/layout/page-container.tsx +5 -1
  231. package/src/components/onboarding-guides/onboarding-guide-detail-view.tsx +22 -4
  232. package/src/components/shared/legal-document/legal-document-page.tsx +1 -1
  233. package/src/components/shared/product-release/release-detail-page.tsx +19 -4
  234. package/src/components/ui/__tests__/__snapshots__/markdown-parity.test.tsx.snap +2420 -0
  235. package/src/components/ui/__tests__/markdown-parity.test.tsx +2528 -0
  236. package/src/components/ui/index.ts +1 -2
  237. package/src/components/ui/markdown/__tests__/mermaid-security.test.ts +115 -0
  238. package/src/components/ui/markdown/__tests__/mermaid-stale-render.test.tsx +95 -0
  239. package/src/components/ui/markdown/__tests__/sanitize-invariant.test.ts +309 -0
  240. package/src/components/ui/markdown/__tests__/streaming.test.tsx +388 -0
  241. package/src/components/ui/markdown/base-components.tsx +341 -0
  242. package/src/components/ui/markdown/engine.tsx +315 -0
  243. package/src/components/ui/markdown/heading-ids.ts +239 -0
  244. package/src/components/ui/markdown/index.ts +49 -0
  245. package/src/components/ui/markdown/mermaid-diagram.tsx +291 -0
  246. package/src/components/ui/markdown/rich/embed-overrides.tsx +199 -0
  247. package/src/components/ui/markdown/rich/rich-markdown-renderer.tsx +184 -0
  248. package/src/components/ui/markdown/rich/shortcodes.ts +170 -0
  249. package/src/components/ui/markdown/sanitize.ts +3499 -0
  250. package/src/components/ui/markdown/simple-markdown-renderer.tsx +28 -0
  251. package/src/components/ui/markdown/streaming.ts +362 -0
  252. package/src/components/ui/markdown/text-size.ts +106 -0
  253. package/src/components/ui/modal-v2.tsx +6 -0
  254. package/src/components/ui/modal.tsx +3 -0
  255. package/src/components/ui/release-changelog-section.tsx +1 -1
  256. package/src/components/ui/ticket-info-section.tsx +1 -1
  257. package/src/utils/index.ts +1 -0
  258. package/src/utils/markdown-fences.ts +127 -0
  259. package/src/utils/markdown-heading-id.ts +348 -0
  260. package/src/utils/markdown-section-extractor.ts +41 -56
  261. package/dist/chunk-5BKBG653.js.map +0 -1
  262. package/dist/chunk-5XFJG3TC.cjs.map +0 -1
  263. package/dist/chunk-FM5DTJPA.cjs.map +0 -1
  264. package/dist/chunk-NSL5MNS4.js.map +0 -1
  265. package/dist/chunk-O7F7RZFN.js.map +0 -1
  266. package/dist/chunk-YHB4MNUX.cjs.map +0 -1
  267. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts +0 -6
  268. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts.map +0 -1
  269. package/dist/components/chat/utils/chunk-parser.d.ts +0 -25
  270. package/dist/components/chat/utils/chunk-parser.d.ts.map +0 -1
  271. package/dist/components/ui/rich-markdown-renderer.d.ts +0 -34
  272. package/dist/components/ui/rich-markdown-renderer.d.ts.map +0 -1
  273. package/dist/components/ui/simple-markdown-renderer.d.ts +0 -73
  274. package/dist/components/ui/simple-markdown-renderer.d.ts.map +0 -1
  275. package/src/components/chat/hooks/.use-realtime-chunk-processor.md +0 -50
  276. package/src/components/chat/hooks/use-realtime-chunk-processor.ts +0 -479
  277. package/src/components/chat/utils/.chunk-parser.md +0 -51
  278. package/src/components/chat/utils/chunk-parser.ts +0 -255
  279. package/src/components/ui/.simple-markdown-renderer.md +0 -40
  280. package/src/components/ui/rich-markdown-renderer.tsx +0 -1223
  281. package/src/components/ui/simple-markdown-renderer.tsx +0 -965
  282. /package/dist/{chunk-I7M6KCCS.js.map → chunk-4R6H2U77.js.map} +0 -0
  283. /package/dist/{chunk-RSW42GTZ.js.map → chunk-APF5QBAU.js.map} +0 -0
  284. /package/dist/{chunk-GJ7BN4MI.js.map → chunk-CGNDAJ7V.js.map} +0 -0
  285. /package/dist/{chunk-R5IQJXA3.js.map → chunk-F2NMWV44.js.map} +0 -0
  286. /package/dist/{chunk-2ZW2ZPDW.js.map → chunk-LAOO7XHO.js.map} +0 -0
  287. /package/dist/{chunk-AJGZ3YSR.js.map → chunk-OR5AMXYN.js.map} +0 -0
  288. /package/dist/{chunk-WXDEMTLD.js.map → chunk-QO2XD3FR.js.map} +0 -0
  289. /package/dist/{chunk-4423DHRX.js.map → chunk-UI7CIUAR.js.map} +0 -0
  290. /package/dist/{chunk-KXIIUE75.js.map → chunk-XF5ROTMQ.js.map} +0 -0
package/dist/index.js CHANGED
@@ -193,8 +193,10 @@ import {
193
193
  CveLink,
194
194
  DEFAULT_CONTENT_SUFFIXES,
195
195
  DEFAULT_CUSTOM_STATUS_COLOR,
196
+ DEFAULT_DIALOG_SIDE,
196
197
  DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID,
197
198
  DEFAULT_FOLDER_INDEX_FILE,
199
+ DEFAULT_MAX_REDUCERS,
198
200
  DEFAULT_OS_PLATFORM,
199
201
  DEFAULT_THEME,
200
202
  DEFAULT_VIDEO_BITES_TITLE,
@@ -286,6 +288,7 @@ import {
286
288
  GlobalOverlayScrollbars,
287
289
  GuideModeBanner,
288
290
  GuideWelcome,
291
+ HEADING_EMOJI_RE,
289
292
  HEX_PATTERN,
290
293
  Header,
291
294
  HeaderButton,
@@ -332,12 +335,14 @@ import {
332
335
  LogSeverityDot,
333
336
  LoginForm,
334
337
  LogsList,
338
+ MAX_PENDING_RETAIN_KEYS,
335
339
  MESSAGE_ROLE,
336
340
  MESSAGE_TYPE,
337
341
  MOBILE_NAV_PANEL_ID,
338
342
  MUX_IMAGE_ORIGIN,
339
343
  MUX_STREAM_ORIGIN,
340
344
  MarkdownEditor,
345
+ MarkdownEngine,
341
346
  MarqueeWall,
342
347
  MarqueeWallFades,
343
348
  MediaGalleryManager,
@@ -359,6 +364,7 @@ import {
359
364
  MenubarSubContent,
360
365
  MenubarSubTrigger,
361
366
  MenubarTrigger,
367
+ MermaidDiagram,
362
368
  MessageSegmentAccumulator,
363
369
  MingoAiButton,
364
370
  MingoChatHistory,
@@ -483,6 +489,7 @@ import {
483
489
  RoadmapCard,
484
490
  RoadmapCardSkeleton,
485
491
  RoadmapVoteButton,
492
+ SAFE_HTML_TAGS,
486
493
  SCROLL_ANCHOR,
487
494
  SCROLL_ANCHOR_WIRE_KEY,
488
495
  SECTION_HEADING_CLASS,
@@ -495,6 +502,7 @@ import {
495
502
  SOURCE_ICON_NAMES,
496
503
  SOURCE_LABELS_BY_TABLE,
497
504
  STRIP_CELL_MAX_WIDTH,
505
+ SVG_TAGS,
498
506
  SYNTHETIC_REALTIME_ID_PREFIXES,
499
507
  ScriptArguments,
500
508
  ScriptInfoSection,
@@ -550,6 +558,7 @@ import {
550
558
  TAG_BADGE_CLASS,
551
559
  TASK_TYPE_LABELS,
552
560
  TASK_TYPE_TEXT_COLORS,
561
+ TEXT_SIZE_PRESETS,
553
562
  THEME_ATTRIBUTE,
554
563
  THEME_STORAGE_KEY,
555
564
  TICKET_STATUS_COLOR_PRESETS,
@@ -649,12 +658,16 @@ import {
649
658
  buildDefaultHref,
650
659
  buildDiscussAddendum,
651
660
  buildDocumentTree,
661
+ buildEffectiveTagSet,
662
+ buildHeadingIdMap,
652
663
  buildListUrl,
653
664
  buildNatsWsUrl,
654
665
  buildProductReleaseCardProps,
666
+ buildSanitizeSchema,
655
667
  buildStreamFrames,
656
668
  buildSuggestionUrl,
657
669
  canonicalContentRefType,
670
+ cardAwareUrlTransform,
658
671
  changelogLabels,
659
672
  chatChipClass,
660
673
  cleanEmailDomain,
@@ -662,12 +675,20 @@ import {
662
675
  clearLegacyAnnouncementCache,
663
676
  clickupTaskUrl,
664
677
  columnFromTicketStatus,
678
+ completeStreamingTail,
665
679
  computeHistoryPrepend,
666
680
  computeIsNewTab,
681
+ createChatDialogStore,
682
+ createChatStreamReducer,
667
683
  createColumnHelper,
684
+ createDeltaBatcher,
685
+ createEmptyTurnMeta,
686
+ createFenceTracker,
687
+ createHeadingIdDeduper,
668
688
  createMessageSegmentAccumulator,
669
689
  createUTCTimestamp,
670
690
  decideNewTab,
691
+ decodeHistoricalMessageData,
671
692
  deepClone,
672
693
  defaultBuildProductReleaseCardProps,
673
694
  defaultTableIdForDocumentType,
@@ -680,6 +701,7 @@ import {
680
701
  dismissAnnouncement,
681
702
  ensureBiteIds,
682
703
  escapeMarkdownInline,
704
+ escapeUnknownHtmlTags,
683
705
  executeNavigation,
684
706
  executeNavigationImperative,
685
707
  exportToCSV,
@@ -689,10 +711,11 @@ import {
689
711
  extractErrorMessages,
690
712
  extractImageEdgeColorAsync,
691
713
  extractIncompleteMessageState,
714
+ extractIncompleteTailState,
692
715
  extractItemId,
693
716
  extractItems,
694
717
  extractSections,
695
- extractTextFromChunk,
718
+ extractText,
696
719
  extractYouTubeId,
697
720
  faqItemAnchor,
698
721
  faqSectionSlug,
@@ -817,15 +840,13 @@ import {
817
840
  interleave,
818
841
  isAnnouncementDismissed,
819
842
  isApprovalNotification,
820
- isControlChunk,
843
+ isBlankLine,
821
844
  isCrossOriginUrl,
822
845
  isDismissedCookieValue,
823
- isErrorChunk,
824
846
  isFigmaSlidesUrl,
825
847
  isGenericDomain,
826
848
  isGenericWebsiteDomain,
827
849
  isHistoricalUserTurn,
828
- isMetadataChunk,
829
850
  isModifierClick,
830
851
  isOSPlatform,
831
852
  isQuickActionIconSpec,
@@ -857,7 +878,6 @@ import {
857
878
  normalizeToolTypeWithFallback,
858
879
  orderContentRefTypes,
859
880
  osLabels,
860
- parseChunkToAction,
861
881
  parseFaqHash,
862
882
  parseScrollAnchor,
863
883
  parseWireCommandOverride,
@@ -865,9 +885,11 @@ import {
865
885
  pickReadableTextColor,
866
886
  processHistoricalMessages,
867
887
  processHistoricalMessagesWithErrors,
888
+ processShortcodes,
868
889
  programItemToStripProfile,
869
890
  ratioToCategory,
870
891
  readLeadingDecisionFrame,
892
+ rehypeStripUnsafe,
871
893
  releaseStatusOptions,
872
894
  releaseTypeOptions,
873
895
  releaseTypeToBadgeColor,
@@ -883,19 +905,25 @@ import {
883
905
  resolveSourceIcon,
884
906
  resolveSourceRowCTA,
885
907
  resolveStatusTagProps,
908
+ resolveTextSizeConfig,
886
909
  resolveTicketStatus,
887
910
  rgbToHex,
888
911
  safeHref,
889
912
  sanitizeTitleForChat,
890
913
  saveDataEnabled,
914
+ scanHeadings,
891
915
  serializeJsonLd,
892
916
  shellLabels,
893
917
  shouldProxyImage,
918
+ slugifyHeadingBase,
919
+ slugifyHeadingText,
894
920
  sortBitesByCreatedAtDesc,
895
921
  sortTreeChildren,
922
+ splitStreamingBlocks,
896
923
  statusBadgeVariants,
897
924
  stripChatAttachmentMarkdown,
898
925
  stripFolderIndexFromPath,
926
+ stripHeadingEmojis,
899
927
  stripHtml,
900
928
  stripInlineMarkdown,
901
929
  stripSameOriginToPath,
@@ -922,6 +950,7 @@ import {
922
950
  useChatAttachments,
923
951
  useChatCardItem,
924
952
  useChatIdentity,
953
+ useChatStreamReducer,
925
954
  useChunkCatchup,
926
955
  useCloseOnNavigation,
927
956
  useCollapsible,
@@ -932,6 +961,7 @@ import {
932
961
  useEmptyStateConfig,
933
962
  useFiltersDropdown,
934
963
  useFinePointer,
964
+ useHeadingIdMap,
935
965
  useJetStreamDialogSubscription,
936
966
  useLoading,
937
967
  useMarqueeSync,
@@ -942,7 +972,6 @@ import {
942
972
  useOptionalTimeTracker,
943
973
  usePageActionsBottomPadding,
944
974
  useProxiedImageUrl,
945
- useRealtimeChunkProcessor,
946
975
  useSSE,
947
976
  useScriptedStream,
948
977
  useScrollFade,
@@ -961,7 +990,7 @@ import {
961
990
  validateEmailDomain,
962
991
  validateEmailDomainList,
963
992
  validatePhoneNumber
964
- } from "./chunk-NSL5MNS4.js";
993
+ } from "./chunk-REWRUV3K.js";
965
994
  import {
966
995
  CommandApprovalToast,
967
996
  DEFAULT_MIN_FILL_MS,
@@ -1509,8 +1538,10 @@ export {
1509
1538
  CveLink,
1510
1539
  DEFAULT_CONTENT_SUFFIXES,
1511
1540
  DEFAULT_CUSTOM_STATUS_COLOR,
1541
+ DEFAULT_DIALOG_SIDE,
1512
1542
  DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID,
1513
1543
  DEFAULT_FOLDER_INDEX_FILE,
1544
+ DEFAULT_MAX_REDUCERS,
1514
1545
  DEFAULT_MIN_FILL_MS,
1515
1546
  DEFAULT_OS_PLATFORM,
1516
1547
  DEFAULT_THEME,
@@ -1650,6 +1681,7 @@ export {
1650
1681
  GridViewIcon,
1651
1682
  GuideModeBanner,
1652
1683
  GuideWelcome,
1684
+ HEADING_EMOJI_RE,
1653
1685
  HEX_PATTERN,
1654
1686
  HONEYPOT_FIELD,
1655
1687
  HUB_HEADER_OFFSET_PX,
@@ -1719,6 +1751,7 @@ export {
1719
1751
  CheckCircleIcon2 as LucideCheckCircleIcon,
1720
1752
  XIcon2 as LucideXIcon,
1721
1753
  LumaIcon,
1754
+ MAX_PENDING_RETAIN_KEYS,
1722
1755
  MESSAGE_ROLE,
1723
1756
  MESSAGE_TYPE,
1724
1757
  MOBILE_NAV_PANEL_ID,
@@ -1727,6 +1760,7 @@ export {
1727
1760
  MacOSIcon,
1728
1761
  MarginCrisisIcon,
1729
1762
  MarkdownEditor,
1763
+ MarkdownEngine,
1730
1764
  MarqueeWall,
1731
1765
  MarqueeWallFades,
1732
1766
  MediaGalleryManager,
@@ -1748,6 +1782,7 @@ export {
1748
1782
  MenubarSubContent,
1749
1783
  MenubarSubTrigger,
1750
1784
  MenubarTrigger,
1785
+ MermaidDiagram,
1751
1786
  MessageCircleIcon,
1752
1787
  MessageSegmentAccumulator,
1753
1788
  MiamiCyberGangLogo,
@@ -1908,6 +1943,7 @@ export {
1908
1943
  RoadmapCard,
1909
1944
  RoadmapCardSkeleton,
1910
1945
  RoadmapVoteButton,
1946
+ SAFE_HTML_TAGS,
1911
1947
  SCROLL_ANCHOR,
1912
1948
  SCROLL_ANCHOR_WIRE_KEY,
1913
1949
  SECTION_HEADING_CLASS,
@@ -1923,6 +1959,7 @@ export {
1923
1959
  SSOConfigurationIcon,
1924
1960
  STICKY_HEADER_OFFSET_PX,
1925
1961
  STRIP_CELL_MAX_WIDTH,
1962
+ SVG_TAGS,
1926
1963
  SYNTHETIC_REALTIME_ID_PREFIXES,
1927
1964
  ScriptArguments,
1928
1965
  ScriptGenerationIcon,
@@ -2005,6 +2042,7 @@ export {
2005
2042
  TAG_BADGE_CLASS,
2006
2043
  TASK_TYPE_LABELS,
2007
2044
  TASK_TYPE_TEXT_COLORS,
2045
+ TEXT_SIZE_PRESETS,
2008
2046
  THEME_ATTRIBUTE,
2009
2047
  THEME_STORAGE_KEY,
2010
2048
  TICKET_STATUS_COLOR_PRESETS,
@@ -2127,14 +2165,18 @@ export {
2127
2165
  buildDefaultHref,
2128
2166
  buildDiscussAddendum,
2129
2167
  buildDocumentTree,
2168
+ buildEffectiveTagSet,
2169
+ buildHeadingIdMap,
2130
2170
  buildListUrl,
2131
2171
  buildNatsWsUrl,
2132
2172
  buildOgPlaceholderUrl,
2133
2173
  buildProductReleaseCardProps,
2174
+ buildSanitizeSchema,
2134
2175
  buildStreamFrames,
2135
2176
  buildSuggestionUrl,
2136
2177
  buttonVariants,
2137
2178
  canonicalContentRefType,
2179
+ cardAwareUrlTransform,
2138
2180
  changelogLabels,
2139
2181
  embedAuthedFetch as chatAuthedFetch,
2140
2182
  chatChipClass,
@@ -2148,16 +2190,24 @@ export {
2148
2190
  cn,
2149
2191
  coerceValue,
2150
2192
  columnFromTicketStatus,
2193
+ completeStreamingTail,
2151
2194
  computeHistoryPrepend,
2152
2195
  computeIsNewTab,
2153
2196
  configureAuthenticatedImage,
2154
2197
  configureBatchImageFetch,
2155
2198
  consumeAccessCode,
2199
+ createChatDialogStore,
2200
+ createChatStreamReducer,
2156
2201
  createColumnHelper,
2202
+ createDeltaBatcher,
2203
+ createEmptyTurnMeta,
2204
+ createFenceTracker,
2205
+ createHeadingIdDeduper,
2157
2206
  createMessageSegmentAccumulator,
2158
2207
  createSearchParams,
2159
2208
  createUTCTimestamp,
2160
2209
  decideNewTab,
2210
+ decodeHistoricalMessageData,
2161
2211
  deepClone,
2162
2212
  defaultBuildProductReleaseCardProps,
2163
2213
  defaultTableIdForDocumentType,
@@ -2172,6 +2222,7 @@ export {
2172
2222
  embedAuthedFetch,
2173
2223
  ensureBiteIds,
2174
2224
  escapeMarkdownInline,
2225
+ escapeUnknownHtmlTags,
2175
2226
  evaluateHumanitySignals,
2176
2227
  executeNavigation,
2177
2228
  executeNavigationImperative,
@@ -2183,10 +2234,11 @@ export {
2183
2234
  extractHumanitySignals,
2184
2235
  extractImageEdgeColorAsync,
2185
2236
  extractIncompleteMessageState,
2237
+ extractIncompleteTailState,
2186
2238
  extractItemId,
2187
2239
  extractItems,
2188
2240
  extractSections,
2189
- extractTextFromChunk,
2241
+ extractText,
2190
2242
  extractVariablesFromQuery,
2191
2243
  extractYouTubeId,
2192
2244
  faqItemAnchor,
@@ -2334,16 +2386,14 @@ export {
2334
2386
  introspector,
2335
2387
  isAnnouncementDismissed,
2336
2388
  isApprovalNotification,
2337
- isControlChunk,
2389
+ isBlankLine,
2338
2390
  isCrossOriginUrl,
2339
2391
  isDismissedCookieValue,
2340
- isErrorChunk,
2341
2392
  isFigmaSlidesUrl,
2342
2393
  isGenericDomain,
2343
2394
  isGenericWebsiteDomain,
2344
2395
  isHistoricalUserTurn,
2345
2396
  isInputObjectType,
2346
- isMetadataChunk,
2347
2397
  isModifierClick,
2348
2398
  isOSPlatform,
2349
2399
  isQuickActionIconSpec,
@@ -2380,7 +2430,6 @@ export {
2380
2430
  normalizeToolTypeWithFallback,
2381
2431
  orderContentRefTypes,
2382
2432
  osLabels,
2383
- parseChunkToAction,
2384
2433
  parseFaqHash,
2385
2434
  parseScrollAnchor,
2386
2435
  parseWireCommandOverride,
@@ -2395,10 +2444,12 @@ export {
2395
2444
  platformSlogans,
2396
2445
  processHistoricalMessages,
2397
2446
  processHistoricalMessagesWithErrors,
2447
+ processShortcodes,
2398
2448
  programItemToStripProfile,
2399
2449
  progressColorByVariant,
2400
2450
  ratioToCategory,
2401
2451
  readLeadingDecisionFrame,
2452
+ rehypeStripUnsafe,
2402
2453
  releaseStatusOptions,
2403
2454
  releaseTypeOptions,
2404
2455
  releaseTypeToBadgeColor,
@@ -2415,11 +2466,13 @@ export {
2415
2466
  resolveSourceIcon,
2416
2467
  resolveSourceRowCTA,
2417
2468
  resolveStatusTagProps,
2469
+ resolveTextSizeConfig,
2418
2470
  resolveTicketStatus,
2419
2471
  rgbToHex,
2420
2472
  safeHref,
2421
2473
  sanitizeTitleForChat,
2422
2474
  saveDataEnabled,
2475
+ scanHeadings,
2423
2476
  scrollElementIntoView,
2424
2477
  serializeJsonLd,
2425
2478
  setEmbedProxyAuth as setChatProxyAuth,
@@ -2431,12 +2484,16 @@ export {
2431
2484
  shouldProxyImage,
2432
2485
  showCommandApprovalToast,
2433
2486
  showToast,
2487
+ slugifyHeadingBase,
2488
+ slugifyHeadingText,
2434
2489
  sortBitesByCreatedAtDesc,
2435
2490
  sortTreeChildren,
2436
2491
  splitCsvEnv,
2492
+ splitStreamingBlocks,
2437
2493
  statusBadgeVariants,
2438
2494
  stripChatAttachmentMarkdown,
2439
2495
  stripFolderIndexFromPath,
2496
+ stripHeadingEmojis,
2440
2497
  stripHtml,
2441
2498
  stripInlineMarkdown,
2442
2499
  stripSameOriginToPath,
@@ -2472,6 +2529,7 @@ export {
2472
2529
  useChatAttachments,
2473
2530
  useChatCardItem,
2474
2531
  useChatIdentity,
2532
+ useChatStreamReducer,
2475
2533
  useChunkCatchup,
2476
2534
  useCloseOnNavigation,
2477
2535
  useCollapsible,
@@ -2490,6 +2548,7 @@ export {
2490
2548
  useFinePointer,
2491
2549
  useFocusTrap,
2492
2550
  useHeaderHeight,
2551
+ useHeadingIdMap,
2493
2552
  useHorizontalScrollbar,
2494
2553
  useHumanitySignals,
2495
2554
  useImageEdgeColor,
@@ -2518,7 +2577,6 @@ export {
2518
2577
  usePreventScroll,
2519
2578
  useProxiedImageUrl,
2520
2579
  useQueryParams,
2521
- useRealtimeChunkProcessor,
2522
2580
  useResetOnPageHidden,
2523
2581
  useSSE,
2524
2582
  useScriptedStream,
@@ -3957,6 +3957,151 @@ function buildDocumentTree(docs, mapFn, getParentPath, getPath) {
3957
3957
  return sortTreeChildren(rootNodes);
3958
3958
  }
3959
3959
 
3960
+ // src/utils/markdown-fences.ts
3961
+ var FENCE_RE = /^ {0,3}(`{3,}|~{3,})([^\n]*?)\r?$/;
3962
+ var BLANK_LINE_RE = /^[ \t\r]*$/;
3963
+ function isBlankLine(line) {
3964
+ return BLANK_LINE_RE.test(line);
3965
+ }
3966
+ function createFenceTracker() {
3967
+ let fenceChar = null;
3968
+ let fenceLength = 0;
3969
+ return {
3970
+ push(line) {
3971
+ const fence = FENCE_RE.exec(line);
3972
+ if (fence) {
3973
+ const run = fence[1];
3974
+ if (fenceChar === null) {
3975
+ fenceChar = run[0];
3976
+ fenceLength = run.length;
3977
+ return "open";
3978
+ }
3979
+ if (run[0] === fenceChar && run.length >= fenceLength && isBlankLine(fence[2])) {
3980
+ fenceChar = null;
3981
+ fenceLength = 0;
3982
+ return "close";
3983
+ }
3984
+ return "inside";
3985
+ }
3986
+ return fenceChar === null ? "text" : "inside";
3987
+ },
3988
+ openChar: () => fenceChar,
3989
+ openLength: () => fenceLength
3990
+ };
3991
+ }
3992
+
3993
+ // src/utils/markdown-heading-id.ts
3994
+ var HEADING_EMOJI_RE = /[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/gu;
3995
+ function stripHeadingEmojis(text) {
3996
+ return text.replace(HEADING_EMOJI_RE, "").trim();
3997
+ }
3998
+ function slugifyHeadingBase(text) {
3999
+ return text.trim().toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
4000
+ }
4001
+ function slugifyHeadingText(text) {
4002
+ return slugifyHeadingBase(stripHeadingEmojis(text));
4003
+ }
4004
+ var ATX_HEADING_RE = /^ {0,3}(#{1,6})[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*\r?$/;
4005
+ var ATX_EMPTY_RE = /^ {0,3}(#{1,6})[ \t]*#*[ \t]*\r?$/;
4006
+ var RAW_HEADING_RE = /<h([1-6])\b[^>]*>([\s\S]*?)(?:<\/h\1>|$)/gi;
4007
+ var CONTAINER_PREFIX_RE = /^ {0,3}(?:(?:>[ \t]?)+|(?:[-+*]|\d{1,9}[.)])[ \t]+)+/;
4008
+ var SETEXT_UNDERLINE_RE = /^ {0,3}(=+|-+)[ \t]*\r?$/;
4009
+ var THEMATIC_BREAK_RE = /^ {0,3}(\*|_){3,}[ \t]*\r?$/;
4010
+ var HTML_BLOCK_TAGS = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
4011
+ var HTML_BLOCK_OPENER_RE = new RegExp(
4012
+ `^ {0,3}(?:<(?:script|pre|style|textarea)(?:[\\s>]|$)|<!--|<\\?|<![a-zA-Z]|<!\\[CDATA\\[|</?(?:${HTML_BLOCK_TAGS})(?:[\\s/>]|$)|<[a-zA-Z][a-zA-Z0-9-]*(?:\\s[^>]*)?/?>[ \\t]*\\r?$|</[a-zA-Z][a-zA-Z0-9-]*[ \\t]*>[ \\t]*\\r?$)`,
4013
+ "i"
4014
+ );
4015
+ function scanHeadings(content, options = {}) {
4016
+ const { skipFrontmatter = true, includeRawHtml = true, skipFences = true } = options;
4017
+ const out = [];
4018
+ const lines = content.split("\n");
4019
+ const fences = skipFences ? createFenceTracker() : null;
4020
+ let start = 0;
4021
+ if (skipFrontmatter && lines[0]?.trim() === "---") {
4022
+ for (let i = 1; i < lines.length; i++) {
4023
+ if (lines[i].trim() === "---" || lines[i].trim() === "...") {
4024
+ start = i + 1;
4025
+ break;
4026
+ }
4027
+ }
4028
+ }
4029
+ let setextRun = null;
4030
+ for (let i = start; i < lines.length; i++) {
4031
+ const line = lines[i];
4032
+ if (fences) {
4033
+ const role = fences.push(line);
4034
+ if (role !== "text") {
4035
+ setextRun = null;
4036
+ continue;
4037
+ }
4038
+ }
4039
+ const prefix = CONTAINER_PREFIX_RE.exec(line)?.[0] ?? "";
4040
+ const body = prefix ? line.slice(prefix.length) : line;
4041
+ const setext = SETEXT_UNDERLINE_RE.exec(body);
4042
+ if (setext) {
4043
+ if (setextRun && !setextRun.disqualified && setextRun.prefix === prefix) {
4044
+ out.push({
4045
+ line: setextRun.line,
4046
+ level: setext[1][0] === "=" ? 1 : 2,
4047
+ text: setextRun.lines.join("\n")
4048
+ });
4049
+ }
4050
+ setextRun = null;
4051
+ continue;
4052
+ }
4053
+ const atx = ATX_HEADING_RE.exec(body) ?? ATX_EMPTY_RE.exec(body);
4054
+ if (atx) {
4055
+ out.push({ line: i + 1, level: atx[1].length, text: (atx[2] ?? "").trim() });
4056
+ setextRun = null;
4057
+ continue;
4058
+ }
4059
+ if (includeRawHtml && line.indexOf("<") !== -1) {
4060
+ RAW_HEADING_RE.lastIndex = 0;
4061
+ let raw;
4062
+ let matched = false;
4063
+ while ((raw = RAW_HEADING_RE.exec(line)) !== null) {
4064
+ matched = true;
4065
+ out.push({
4066
+ line: i + 1,
4067
+ level: Number(raw[1]),
4068
+ text: raw[2].replace(/<[^>]*>/g, "").trim()
4069
+ });
4070
+ }
4071
+ if (matched) {
4072
+ setextRun = null;
4073
+ continue;
4074
+ }
4075
+ }
4076
+ if (isBlankLine(body) || THEMATIC_BREAK_RE.test(body)) {
4077
+ setextRun = null;
4078
+ continue;
4079
+ }
4080
+ if (setextRun && setextRun.prefix === prefix) {
4081
+ setextRun.lines.push(body.trim());
4082
+ } else {
4083
+ setextRun = {
4084
+ line: i + 1,
4085
+ prefix,
4086
+ lines: [body.trim()],
4087
+ disqualified: HTML_BLOCK_OPENER_RE.test(body)
4088
+ };
4089
+ }
4090
+ }
4091
+ return out;
4092
+ }
4093
+ function createHeadingIdDeduper() {
4094
+ const counts = {};
4095
+ return (cleanId) => {
4096
+ if (counts[cleanId]) {
4097
+ counts[cleanId]++;
4098
+ return `${cleanId}-${counts[cleanId]}`;
4099
+ }
4100
+ counts[cleanId] = 1;
4101
+ return cleanId;
4102
+ };
4103
+ }
4104
+
3960
4105
  // src/utils/markdown-to-plain.ts
3961
4106
  function stripInlineMarkdown(s) {
3962
4107
  return s.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/`([^`]+)`/g, "$1");
@@ -3987,50 +4132,26 @@ var DEFAULT_OPTIONS = {
3987
4132
  function extractSections(markdown, options = {}) {
3988
4133
  const opts = { ...DEFAULT_OPTIONS, ...options };
3989
4134
  const sections = [];
3990
- const lines = markdown.split("\n");
3991
- const idCounts = {};
3992
- let inCodeBlock = false;
3993
- let inYamlBlock = false;
3994
- for (const line of lines) {
3995
- if (opts.skipCodeAndYamlBlocks) {
3996
- if (line.startsWith("```")) {
3997
- inCodeBlock = !inCodeBlock;
3998
- continue;
3999
- }
4000
- if (line === "---") {
4001
- inYamlBlock = !inYamlBlock;
4002
- continue;
4003
- }
4004
- if (inCodeBlock || inYamlBlock) continue;
4005
- }
4006
- const pattern = new RegExp(`^(#{1,${opts.maxLevel}})\\s+(.+)`);
4007
- const match = line.match(pattern);
4008
- if (!match) continue;
4009
- const level = match[1].length;
4010
- if (level > opts.maxLevel) continue;
4011
- let title = match[2].trim();
4135
+ const dedupe = createHeadingIdDeduper();
4136
+ const scanned = scanHeadings(markdown, {
4137
+ skipFrontmatter: opts.skipCodeAndYamlBlocks,
4138
+ skipFences: opts.skipCodeAndYamlBlocks
4139
+ });
4140
+ for (const heading of scanned) {
4141
+ if (heading.level > opts.maxLevel) continue;
4142
+ let title = heading.text;
4012
4143
  if (opts.stripFormattingMarkers) {
4013
4144
  title = stripInlineMarkdown(title).trim();
4014
4145
  }
4015
- let baseId = title;
4016
- if (opts.removeEmojis) {
4017
- baseId = baseId.replace(
4018
- /[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/gu,
4019
- ""
4020
- ).trim();
4021
- }
4022
- baseId = baseId.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
4146
+ const baseId = slugifyHeadingBase(
4147
+ opts.removeEmojis ? stripHeadingEmojis(title) : title
4148
+ );
4023
4149
  const cleanId = baseId || `section-${sections.length + 1}`;
4024
- let id = cleanId;
4025
- if (opts.handleDuplicateIds) {
4026
- if (idCounts[cleanId]) {
4027
- idCounts[cleanId]++;
4028
- id = `${cleanId}-${idCounts[cleanId]}`;
4029
- } else {
4030
- idCounts[cleanId] = 1;
4031
- }
4032
- }
4033
- sections.push({ id, title, level });
4150
+ sections.push({
4151
+ id: opts.handleDuplicateIds ? dedupe(cleanId) : cleanId,
4152
+ title,
4153
+ level: heading.level
4154
+ });
4034
4155
  }
4035
4156
  return sections;
4036
4157
  }
@@ -4107,6 +4228,7 @@ exports.DESIGN_PALETTE = DESIGN_PALETTE;
4107
4228
  exports.DEV_SECTION_PARAM_KEYS = DEV_SECTION_PARAM_KEYS;
4108
4229
  exports.ELAPSED_MS_FIELD = ELAPSED_MS_FIELD;
4109
4230
  exports.GENERIC_EMAIL_DOMAINS = GENERIC_EMAIL_DOMAINS;
4231
+ exports.HEADING_EMOJI_RE = HEADING_EMOJI_RE;
4110
4232
  exports.HEX_PATTERN = HEX_PATTERN;
4111
4233
  exports.HONEYPOT_FIELD = HONEYPOT_FIELD;
4112
4234
  exports.HUB_HEADER_OFFSET_PX = HUB_HEADER_OFFSET_PX;
@@ -4144,6 +4266,8 @@ exports.clearLegacyAnnouncementCache = clearLegacyAnnouncementCache;
4144
4266
  exports.clickupTaskUrl = clickupTaskUrl;
4145
4267
  exports.cn = cn;
4146
4268
  exports.consumeAccessCode = consumeAccessCode;
4269
+ exports.createFenceTracker = createFenceTracker;
4270
+ exports.createHeadingIdDeduper = createHeadingIdDeduper;
4147
4271
  exports.createUTCTimestamp = createUTCTimestamp;
4148
4272
  exports.deepClone = deepClone;
4149
4273
  exports.delay = delay;
@@ -4265,6 +4389,7 @@ exports.getTrendColors = getTrendColors;
4265
4389
  exports.hasGenericEmailDomain = hasGenericEmailDomain;
4266
4390
  exports.hexToRgb = hexToRgb2;
4267
4391
  exports.isAnnouncementDismissed = isAnnouncementDismissed;
4392
+ exports.isBlankLine = isBlankLine;
4268
4393
  exports.isCrossOriginUrl = isCrossOriginUrl;
4269
4394
  exports.isDismissedCookieValue = isDismissedCookieValue;
4270
4395
  exports.isFigmaSlidesUrl = isFigmaSlidesUrl;
@@ -4306,15 +4431,19 @@ exports.resolveContentFetchPath = resolveContentFetchPath;
4306
4431
  exports.resolveReleaseCover = resolveReleaseCover;
4307
4432
  exports.rgbToHex = rgbToHex;
4308
4433
  exports.sanitizeTitleForChat = sanitizeTitleForChat;
4434
+ exports.scanHeadings = scanHeadings;
4309
4435
  exports.scrollElementIntoView = scrollElementIntoView;
4310
4436
  exports.serializeJsonLd = serializeJsonLd;
4311
4437
  exports.setEmbedAuthAdapter = setEmbedAuthAdapter;
4312
4438
  exports.setEmbedProxyAuth = setEmbedProxyAuth;
4313
4439
  exports.shouldProxyImage = shouldProxyImage;
4440
+ exports.slugifyHeadingBase = slugifyHeadingBase;
4441
+ exports.slugifyHeadingText = slugifyHeadingText;
4314
4442
  exports.sortTreeChildren = sortTreeChildren;
4315
4443
  exports.splitCsvEnv = splitCsvEnv;
4316
4444
  exports.stripChatAttachmentMarkdown = stripChatAttachmentMarkdown;
4317
4445
  exports.stripFolderIndexFromPath = stripFolderIndexFromPath;
4446
+ exports.stripHeadingEmojis = stripHeadingEmojis;
4318
4447
  exports.stripHtml = stripHtml;
4319
4448
  exports.stripInlineMarkdown = stripInlineMarkdown;
4320
4449
  exports.toDocSlug = toDocSlug;