@marimo-team/islands 0.25.3-dev27 → 0.25.3-dev271

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 (847) hide show
  1. package/dist/{ConnectedDataExplorerComponent-DfG3PRaJ.js → ConnectedDataExplorerComponent-eLHPh6uu.js} +120 -116
  2. package/dist/{ErrorBoundary-DKAio_E4.js → ErrorBoundary-VLVnXoqP.js} +66 -71
  3. package/dist/_baseSet-BfI5FjBM.js +328 -0
  4. package/dist/{abnfDiagram-VCTEODGH-B3w-XWX8.js → abnfDiagram-VCTEODGH-hqd0IBtX.js} +2 -2
  5. package/dist/any-language-editor-DnG26QXh.js +75 -0
  6. package/dist/{architectureDiagram-5GKGNRK7-C18U9A6k.js → architectureDiagram-5GKGNRK7-BzLAFcc0.js} +1 -1
  7. package/dist/{arrays-CN1djC4k.js → arrays-DoQ-AILx.js} +15 -27
  8. package/dist/assertNever-DIU3JJbt.js +507 -0
  9. package/dist/assets/__vite-browser-external-BKBpimif.js +1 -0
  10. package/dist/assets/worker-CgoMtD-_.js +113 -0
  11. package/dist/{blockDiagram-I7D4REHJ-Cg25UrxT.js → blockDiagram-I7D4REHJ-Dkhe6_PP.js} +1 -1
  12. package/dist/{button-CvjkwdSk.js → button-0-RqY1DW.js} +229 -218
  13. package/dist/{capabilities-CQ5IjhzL.js → capabilities-B6yy_CBN.js} +2 -2
  14. package/dist/{chat-ui-DDJuqS87.js → chat-ui-BWIkve2R.js} +2071 -1780
  15. package/dist/{check-BMKBBrdc.js → check-gUSZbRsl.js} +1 -1
  16. package/dist/{chunk-IMKFNOWR-CrS5bzqW.js → chunk-IMKFNOWR-DOeVvuyE.js} +1 -1
  17. package/dist/{chunk-SHT3W25Y-StpvPvUG.js → chunk-SHT3W25Y-DZoFI8wR.js} +1 -1
  18. package/dist/{chunk-SVP7TREG-CBXjbYZC.js → chunk-SVP7TREG-CWu86PSW.js} +1 -1
  19. package/dist/{chunk-TICWLB2K-Dp6bIb-q.js → chunk-TICWLB2K-BrM0GoP3.js} +1 -1
  20. package/dist/{chunk-YOKDWASO-DPZk8vhS.js → chunk-YOKDWASO-DKplTrBY.js} +20 -20
  21. package/dist/{classDiagram-ZZMXUADV-BFYuxV5g.js → classDiagram-ZZMXUADV-DYi4V2bB.js} +2 -2
  22. package/dist/{classDiagram-v2-VYDZK3BY-D_tjXVMl.js → classDiagram-v2-VYDZK3BY-tN7FIk-m.js} +2 -2
  23. package/dist/{code-visibility-CFvLbCZJ.js → code-visibility-Dv4bHkOd.js} +43 -50
  24. package/dist/{common-1HUDUr7W.js → common-KrCVlCIg.js} +10277 -9719
  25. package/dist/config-BsPruWMR.js +636 -0
  26. package/dist/{copy-icon-BgUO8jsi.js → copy-icon-C2I8sw4h.js} +3 -3
  27. package/dist/createReducer-DdtT_7ji.js +67 -0
  28. package/dist/{cynefinDiagram-5FMLGOSQ-DSgYrHB2.js → cynefinDiagram-5FMLGOSQ-D5nCnDc-.js} +1 -1
  29. package/dist/{dagre-GXQ25YYZ-GYlruCBf.js → dagre-GXQ25YYZ-BHkd7f_i.js} +3 -3
  30. package/dist/{dagre-BGSfXNEb.js → dagre-mqiMAsFY.js} +531 -680
  31. package/dist/{data-grid-overlay-editor-ZxoN8gVB.js → data-grid-overlay-editor-BnCDQaMh.js} +5 -5
  32. package/dist/{data-grid-types-BH_r7g7l.js → data-grid-types-0PJ-9N5n.js} +1 -1
  33. package/dist/{debounce-C3jyATpc.js → debounce-DrhhziJv.js} +2 -2
  34. package/dist/{diagram-S7CK7UJ4-DRu5LX5_.js → diagram-S7CK7UJ4-D1ALppT2.js} +1 -1
  35. package/dist/{diagram-UQ7AKVKN-DD7uiejP.js → diagram-UQ7AKVKN-DLv0b83L.js} +1 -1
  36. package/dist/{diagram-VX7I27RA-ByH9KAJJ.js → diagram-VX7I27RA-7XJ7J6qg.js} +1 -1
  37. package/dist/{diagram-Z3DM3KII-BsQHPRke.js → diagram-Z3DM3KII-7M7zbHp_.js} +1 -1
  38. package/dist/{dialog-Cc479ZEH.js → dialog-DzCj1qQv.js} +26 -26
  39. package/dist/{dist-Bvs24R_E.js → dist-11T5wq3_.js} +31 -30
  40. package/dist/{dist-F8Ep36rk.js → dist-17ugwGZc.js} +59 -58
  41. package/dist/{dist-BMQf5zIS.js → dist-7cRjf--y.js} +123 -122
  42. package/dist/{dist-diIx5qJW.js → dist-B8pkfkzc.js} +31 -30
  43. package/dist/{dist-CN_BeG2I.js → dist-B9UoM_wq.js} +58 -57
  44. package/dist/{dist-CLdpGQVr.js → dist-BGuMTs1i.js} +118 -117
  45. package/dist/{dist-BK4Oj99o.js → dist-BHW11fni.js} +18 -17
  46. package/dist/dist-BLY4m1Wi.js +850 -0
  47. package/dist/{dist-PXYI_yuP.js → dist-BNlcVoxs.js} +24 -23
  48. package/dist/{dist-D6d86eNJ.js → dist-BQYe5Bju.js} +47 -46
  49. package/dist/{dist-CkTTIdBe.js → dist-BX1mn8na.js} +337 -337
  50. package/dist/{dist-DiDibOYr.js → dist-Bh0PTKUW.js} +151 -150
  51. package/dist/{dist-CSJ0MDRw.js → dist-CKaXK92p.js} +56 -55
  52. package/dist/{dist-C8fAKSH1.js → dist-CLhwfhpJ.js} +53 -52
  53. package/dist/{dist-DoE4XJBC.js → dist-CYeqK4Xw.js} +9801 -10649
  54. package/dist/{dist-BLfKmR-l.js → dist-Cxlp3WH6.js} +16 -15
  55. package/dist/{dist-D-wwqlzJ.js → dist-DSJPGj42.js} +158 -157
  56. package/dist/{dist-BorMD-uX.js → dist-DU9ICsWZ.js} +75 -74
  57. package/dist/{dist-DBtSl3sf.js → dist-DWv0ALBi.js} +47 -46
  58. package/dist/{dist-OR1OnN-y.js → dist-DiBpWEsB.js} +31 -30
  59. package/dist/{dist-CrSP_H1M.js → dist-DiLFTlnl.js} +242 -242
  60. package/dist/{dist-DpBpA_n1.js → dist-Lm-D-Vr6.js} +3 -3
  61. package/dist/{dist-CN8zI-XC.js → dist-X9CsotJl.js} +239 -239
  62. package/dist/{dist-CSbh1PNP.js → dist-cVDV5IuI.js} +23 -22
  63. package/dist/{dist-BuaRHxOc.js → dist-fRfaOoq8.js} +44 -43
  64. package/dist/{dist-Cg7gzw-a.js → dist-gTTI-9Px.js} +78 -77
  65. package/dist/dropdown-menu-CdXE15an.js +6089 -0
  66. package/dist/{ebnfDiagram-PWID7BFC-CQRK5_eT.js → ebnfDiagram-PWID7BFC-DHH1qlmV.js} +2 -2
  67. package/dist/{erDiagram-RLTQ6QDP-BKtWrDVh.js → erDiagram-RLTQ6QDP-fI_0dGef.js} +1 -1
  68. package/dist/{error-banner-CFPHFw4h.js → error-banner-DPc9eIw5.js} +87 -86
  69. package/dist/error-entries-CxN-Nq3V.js +2573 -0
  70. package/dist/{esm-AMFssoNp.js → esm-BDqqT86j.js} +329 -329
  71. package/dist/{esm-D2gTsXEV.js → esm-BgKjMvWw.js} +530 -529
  72. package/dist/feedback-button-7UVo7ro6.js +374 -0
  73. package/dist/{flowDiagram-HODETNUW-1IN-ih2E.js → flowDiagram-HODETNUW-Brg9MA6i.js} +2 -2
  74. package/dist/{formats-Buu00Z2q.js → formats-DbSvAPY-.js} +6 -6
  75. package/dist/{ganttDiagram-EL5Y4UJY-BQT16JSc.js → ganttDiagram-EL5Y4UJY-Dh_4cBJZ.js} +2 -2
  76. package/dist/{glide-data-editor-BBgCAPbk.js → glide-data-editor-DTtBwgEa.js} +6676 -2890
  77. package/dist/{glide-utils-DM9zBO4W.js → glide-utils-BSw3SSHF.js} +84 -45
  78. package/dist/{globals-DhH_o2tF.js → globals-CedpcDTN.js} +3 -3
  79. package/dist/{graphlib-BmY_CCV9.js → graphlib-nlwT3Wvy.js} +177 -220
  80. package/dist/hasIn-C20JsQ2m.js +28 -0
  81. package/dist/{highlighted-body-KPVGNVTW-zwjq21tf.js → highlighted-body-KPVGNVTW-3Ziwfz-V.js} +2 -2
  82. package/dist/{error-entries-Cz3yNs7w.js → html-to-image-Bc2AvXHG.js} +26695 -26850
  83. package/dist/{infoDiagram-27XIBGKW-CkB-zr4p.js → infoDiagram-27XIBGKW-E9e403YT.js} +1 -1
  84. package/dist/isArrayLikeObject-B-HXCsex.js +626 -0
  85. package/dist/isEmpty-CdX7MTE1.js +14 -0
  86. package/dist/{ishikawaDiagram-5VMMS53U-wlyLjBmM.js → ishikawaDiagram-5VMMS53U-C-RlYDRo.js} +1 -1
  87. package/dist/{kanban-definition-UXKFOSKX-C2usY0i-.js → kanban-definition-UXKFOSKX-CLFl_uqK.js} +1 -1
  88. package/dist/{linear-Cnaq3Tfb.js → linear-DWERh7eI.js} +121 -73
  89. package/dist/{loader-BQOfjTIJ.js → loader-BVEtQ4F3.js} +12 -12
  90. package/dist/main.js +10420 -8311
  91. package/dist/mermaid-HWGCJPDP-Du3-HPQA.js +2 -0
  92. package/dist/{mermaid-BA-Z6wGL.js → mermaid-rd09e1JL.js} +54 -54
  93. package/dist/{mindmap-definition-YA3MSWOX-nKOWS8RR.js → mindmap-definition-YA3MSWOX-BQ8TWtyB.js} +1 -1
  94. package/dist/{now-jM8-M7IR.js → now-BKZCLE5P.js} +12 -13
  95. package/dist/{number-overlay-editor-CvLhxHLb.js → number-overlay-editor-D_avDRZT.js} +3 -3
  96. package/dist/{objects-CzUgoMIF.js → objects-DCmMvZtn.js} +1 -3
  97. package/dist/{once-BtE-wKRL.js → once-NnpX_HnX.js} +1 -1
  98. package/dist/{pegDiagram-XKGWAZYB-Dac9EIKD.js → pegDiagram-XKGWAZYB-CN8UHFPi.js} +2 -2
  99. package/dist/pencil-DcT8AE0h.js +10 -0
  100. package/dist/pick-tCszMUbm.js +35 -0
  101. package/dist/{pieDiagram-E7YTZNPT-B7S-DsW_.js → pieDiagram-E7YTZNPT-DGuJ0EBd.js} +1 -1
  102. package/dist/precisionRound-DhAzeRcm.js +49 -0
  103. package/dist/{process-output-B-KBO95p.js → process-output-qecD7Dk8.js} +4 -4
  104. package/dist/{quadrantDiagram-AXDQQJYC-Ccw0xMjN.js → quadrantDiagram-AXDQQJYC-Blrm7V7_.js} +1 -1
  105. package/dist/{railroadDiagram-O6MQD6OU-Cfa5Q-hr.js → railroadDiagram-O6MQD6OU-BPDA8wy8.js} +2 -2
  106. package/dist/{react-vega-BED0DjiB.js → react-vega-C4T9Rb_w.js} +12284 -12270
  107. package/dist/{requirementDiagram-BXWQKSXE-d8zXCJIk.js → requirementDiagram-BXWQKSXE-ChzLGbGW.js} +1 -1
  108. package/dist/{reveal-component-C9BavSsS.js → reveal-component-cJ717FaI.js} +1131 -1108
  109. package/dist/schemas-CdscWNy_.js +4747 -0
  110. package/dist/select-OxgozOC8.js +1200 -0
  111. package/dist/{sequenceDiagram-WJ2MYXX4-b6pei3lJ.js → sequenceDiagram-WJ2MYXX4-DFX-bE6O.js} +1 -1
  112. package/dist/{spec-BJzgmvVa.js → spec-oJn0RhpQ.js} +41 -11
  113. package/dist/{stateDiagram-D77RDMKH-Be-xSpaZ.js → stateDiagram-D77RDMKH-BR7cI3wK.js} +4 -4
  114. package/dist/{stateDiagram-v2-MP3YSRHH-5Y-FxesJ.js → stateDiagram-v2-MP3YSRHH-oGqB5UDI.js} +2 -2
  115. package/dist/static-state-CuV6Pc3a.js +72 -0
  116. package/dist/style.css +1 -1
  117. package/dist/{swimlanes-42K2YHIH-nRRl4NU0.js → swimlanes-42K2YHIH-DwSZl1yC.js} +1 -1
  118. package/dist/{swimlanesDiagram-VR7AAH4N-BS79510V.js → swimlanesDiagram-VR7AAH4N-BHlcd-Ri.js} +2 -2
  119. package/dist/{swiper-component-DKntyn8p.js → swiper-component-Dvj-goaD.js} +2 -2
  120. package/dist/{time-BieKwdYS.js → time-BaMbJs4z.js} +18 -18
  121. package/dist/{timeline-definition-24CTP7MA-Cfzf8WPf.js → timeline-definition-24CTP7MA-DMmP-G2O.js} +1 -1
  122. package/dist/toast-DbBHmxmB.js +491 -0
  123. package/dist/{tooltip-CtBZ5q8p.js → tooltip-BfcDQd2j.js} +329 -305
  124. package/dist/use-restore-focus-CmflVLWJ.js +1672 -0
  125. package/dist/{useAsyncData-BD534XmW.js → useAsyncData-BYIAoMqn.js} +15 -14
  126. package/dist/{useDateFormatter-DkajGwwd.js → useDateFormatter-ButWkdcK.js} +2 -2
  127. package/dist/{useDeepCompareMemoize-C72_RNsu.js → useDeepCompareMemoize-Bz0c5GN6.js} +1 -1
  128. package/dist/{useIframeCapabilities-DBETvvPl.js → useIframeCapabilities-BIolGsF1.js} +1 -1
  129. package/dist/useLifecycle-JjxCC7Vu.js +112 -0
  130. package/dist/useTheme-DPLobSFs.js +339 -0
  131. package/dist/utils-EBklsC5R.js +813 -0
  132. package/dist/{vega-component-nB1kV6sb.js → vega-component-rxIxAAh9.js} +171 -170
  133. package/dist/{vega-embed-container-BNHE18G9.js → vega-embed-container--LYZqguO.js} +2 -2
  134. package/dist/{vega-loader.browser-DNST6uVf.js → vega-loader.browser-B9Pz0EGP.js} +298 -507
  135. package/dist/{vennDiagram-4TSXK5OY-CeY6Z1xZ.js → vennDiagram-4TSXK5OY-Db8GtH1G.js} +1 -1
  136. package/dist/{wardleyDiagram-VM6X3IG4-Cxs9NtVi.js → wardleyDiagram-VM6X3IG4-DmIiC3FU.js} +1 -1
  137. package/dist/{xychartDiagram-S5SC5T6Z-DNWbvPK7.js → xychartDiagram-S5SC5T6Z-DS9OPrNq.js} +2 -2
  138. package/package.json +17 -20
  139. package/src/__mocks__/document.tsx +63 -0
  140. package/src/__mocks__/executions.ts +195 -0
  141. package/src/__mocks__/notebook.ts +3 -5
  142. package/src/__mocks__/partial.ts +26 -0
  143. package/src/__mocks__/requests.ts +1 -4
  144. package/src/__tests__/CellStatus.test.tsx +19 -20
  145. package/src/__tests__/fixtures/pair-config.ts +1 -1
  146. package/src/__tests__/main.test.tsx +24 -1
  147. package/src/__tests__/module-entry.test.ts +44 -0
  148. package/src/__tests__/mount.test.ts +1 -21
  149. package/src/__tests__/{host-imports.test.ts → replica-imports.test.ts} +12 -11
  150. package/src/components/ai/__tests__/ai-model-dropdown.test.tsx +63 -0
  151. package/src/components/ai/ai-model-dropdown.tsx +11 -6
  152. package/src/components/app-config/__tests__/state.test.tsx +50 -0
  153. package/src/components/app-config/ai-config.tsx +156 -150
  154. package/src/components/app-config/app-config-button.tsx +6 -5
  155. package/src/components/app-config/app-config-form.tsx +5 -9
  156. package/src/components/app-config/common.tsx +7 -9
  157. package/src/components/app-config/data-form.tsx +112 -113
  158. package/src/components/app-config/mcp-config.tsx +30 -53
  159. package/src/components/app-config/user-config-form.css +91 -0
  160. package/src/components/app-config/user-config-form.tsx +266 -349
  161. package/src/components/chat/__tests__/capabilities-popover.test.tsx +0 -1
  162. package/src/components/chat/__tests__/chat-display.test.tsx +196 -0
  163. package/src/components/chat/__tests__/chat-markdown.test.tsx +43 -0
  164. package/src/components/chat/__tests__/chat-utils.test.ts +93 -1
  165. package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
  166. package/src/components/chat/__tests__/notebook-access-selector.test.tsx +64 -0
  167. package/src/components/chat/__tests__/turn-timing.test.ts +84 -0
  168. package/src/components/chat/__tests__/use-assistant-turn.test.ts +95 -0
  169. package/src/components/chat/__tests__/user-message.test.tsx +27 -0
  170. package/src/components/chat/acp/__tests__/agent-panel-initialization.test.tsx +1 -1
  171. package/src/components/chat/acp/__tests__/agent-panel.test.tsx +22 -17
  172. package/src/components/chat/acp/__tests__/session-tabs.test.tsx +43 -0
  173. package/src/components/chat/acp/__tests__/state.test.ts +2 -2
  174. package/src/components/chat/acp/agent-panel.tsx +6 -3
  175. package/src/components/chat/acp/blocks.tsx +13 -12
  176. package/src/components/chat/acp/common.tsx +4 -5
  177. package/src/components/chat/acp/model-selector.tsx +1 -1
  178. package/src/components/chat/acp/session-tabs.tsx +8 -3
  179. package/src/components/chat/agent-activity.tsx +132 -0
  180. package/src/components/chat/capabilities-popover.tsx +2 -11
  181. package/src/components/chat/chat-components.tsx +9 -4
  182. package/src/components/chat/chat-display.tsx +131 -57
  183. package/src/components/chat/chat-history-popover.tsx +6 -1
  184. package/src/components/chat/chat-markdown.tsx +15 -0
  185. package/src/components/chat/chat-panel.tsx +216 -294
  186. package/src/components/chat/chat-typography.css +108 -0
  187. package/src/components/chat/chat-utils.ts +24 -35
  188. package/src/components/chat/notebook-access-selector.stories.tsx +22 -0
  189. package/src/components/chat/notebook-access-selector.tsx +100 -0
  190. package/src/components/chat/tool-call/__tests__/tool-labels.test.ts +76 -0
  191. package/src/components/chat/tool-call/__tests__/tool-step.test.tsx +57 -0
  192. package/src/components/chat/tool-call/shared.ts +6 -0
  193. package/src/components/chat/tool-call/tool-call-view.tsx +22 -76
  194. package/src/components/chat/tool-call/tool-labels.ts +172 -0
  195. package/src/components/chat/tool-call/tool-result.tsx +1 -1
  196. package/src/components/chat/tool-call/tool-step.tsx +145 -0
  197. package/src/components/chat/turn-timing.ts +73 -0
  198. package/src/components/chat/use-assistant-turn.ts +65 -0
  199. package/src/components/chat/use-chat-generation.ts +20 -0
  200. package/src/components/chat/user-message.tsx +145 -0
  201. package/src/components/data-table/TableBottomBar.tsx +4 -1
  202. package/src/components/data-table/TableTopBar.tsx +2 -0
  203. package/src/components/data-table/__tests__/chart-spec-model.test.ts +195 -195
  204. package/src/components/data-table/__tests__/column-explorer.test.tsx +27 -1
  205. package/src/components/data-table/__tests__/columns.test.tsx +105 -0
  206. package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
  207. package/src/components/data-table/__tests__/data-table.test.tsx +1 -0
  208. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  209. package/src/components/data-table/__tests__/export-actions.test.tsx +105 -0
  210. package/src/components/data-table/__tests__/keyboard-selection.test.tsx +188 -0
  211. package/src/components/data-table/__tests__/pagination.test.tsx +28 -1
  212. package/src/components/data-table/__tests__/search-highlight.test.tsx +109 -0
  213. package/src/components/data-table/__tests__/url-detector.test.tsx +74 -0
  214. package/src/components/data-table/cell-selection/feature.ts +2 -2
  215. package/src/components/data-table/cell-selection/types.ts +2 -2
  216. package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +74 -1
  217. package/src/components/data-table/charts/__tests__/spec-snapshot.test.ts +20 -20
  218. package/src/components/data-table/charts/__tests__/spec.test.ts +78 -52
  219. package/src/components/data-table/charts/__tests__/storage.test.ts +4 -1
  220. package/src/components/data-table/charts/chart-spec/spec.ts +68 -43
  221. package/src/components/data-table/charts/charts.tsx +40 -30
  222. package/src/components/data-table/charts/storage.ts +16 -5
  223. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
  224. package/src/components/data-table/column-formatting/types.ts +1 -2
  225. package/src/components/data-table/column-summary/chart-spec-model.tsx +23 -16
  226. package/src/components/data-table/column-summary/column-summary.tsx +2 -4
  227. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  228. package/src/components/data-table/columns.tsx +45 -46
  229. package/src/components/data-table/context-menu.tsx +36 -20
  230. package/src/components/data-table/data-table.tsx +17 -1
  231. package/src/components/data-table/date-popover.tsx +6 -4
  232. package/src/components/data-table/export-actions.tsx +76 -48
  233. package/src/components/data-table/pagination.tsx +44 -33
  234. package/src/components/data-table/range-focus/atoms.ts +4 -6
  235. package/src/components/data-table/range-focus/use-cell-range-selection.ts +65 -38
  236. package/src/components/data-table/range-focus/use-scroll-into-view.ts +21 -2
  237. package/src/components/data-table/renderers.tsx +16 -7
  238. package/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx +24 -1
  239. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +4 -4
  240. package/src/components/data-table/search-highlight.tsx +79 -0
  241. package/src/components/data-table/types.ts +1 -0
  242. package/src/components/data-table/url-detector.tsx +49 -9
  243. package/src/components/datasources/__tests__/column-actions.test.tsx +97 -0
  244. package/src/components/datasources/__tests__/column-preview.test.tsx +96 -5
  245. package/src/components/datasources/__tests__/datasources-interactions.test.tsx +181 -0
  246. package/src/components/datasources/__tests__/table-list.test.tsx +118 -0
  247. package/src/components/datasources/__tests__/utils.test.ts +57 -6
  248. package/src/components/datasources/column-preview.tsx +17 -12
  249. package/src/components/datasources/datasources.tsx +56 -43
  250. package/src/components/datasources/utils.ts +32 -23
  251. package/src/components/debugger/debugger-code.tsx +5 -0
  252. package/src/components/dependency-graph/custom-node.tsx +1 -1
  253. package/src/components/dependency-graph/dependency-graph-tree.tsx +8 -8
  254. package/src/components/dependency-graph/elements.ts +24 -21
  255. package/src/components/dependency-graph/minimap-content.tsx +15 -20
  256. package/src/components/dependency-graph/panels.tsx +4 -2
  257. package/src/components/dependency-graph/utils/__tests__/layout.test.ts +18 -11
  258. package/src/components/editor/SortableCell.tsx +1 -3
  259. package/src/components/editor/__tests__/Output.test.tsx +50 -32
  260. package/src/{core/attachments/__tests__/toast.test.tsx → components/editor/__tests__/agent-toast.test.tsx} +1 -1
  261. package/src/components/editor/__tests__/data-attributes.test.tsx +28 -21
  262. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
  263. package/src/components/editor/__tests__/output-persistence.test.tsx +8 -4
  264. package/src/components/editor/__tests__/package-alert.test.tsx +22 -1
  265. package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +69 -0
  266. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +21 -40
  267. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +41 -14
  268. package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +6 -24
  269. package/src/components/editor/actions/__tests__/useCellActionButton.test.tsx +131 -0
  270. package/src/components/editor/actions/name-cell-input.tsx +4 -3
  271. package/src/components/editor/actions/pair-with-agent-commands.ts +10 -7
  272. package/src/components/editor/actions/pair-with-agent-modal.tsx +29 -30
  273. package/src/components/editor/actions/pair-with-agent.tsx +16 -39
  274. package/src/components/editor/actions/useCellActionButton.tsx +47 -35
  275. package/src/components/editor/actions/useConfigActions.tsx +3 -4
  276. package/src/components/editor/actions/useNotebookActions.tsx +25 -29
  277. package/src/components/editor/actions/useRestartKernel.tsx +1 -1
  278. package/src/components/editor/actions/useSetCodeVisibility.ts +11 -12
  279. package/src/components/editor/actions/useSetOutputsExpanded.ts +14 -19
  280. package/src/components/editor/ai/ai-completion-editor.tsx +2 -1
  281. package/src/components/editor/ai/completion-handlers.tsx +0 -37
  282. package/src/components/editor/ai/prompt-input.tsx +189 -0
  283. package/src/components/editor/alerts/__tests__/connection-notice.test.tsx +1 -1
  284. package/src/components/editor/alerts/connection-notice.tsx +1 -1
  285. package/src/components/editor/alerts/startup-logs-alert.tsx +1 -0
  286. package/src/components/editor/alerts/stdin-blocking-alert.tsx +4 -2
  287. package/src/components/editor/app-container.tsx +1 -1
  288. package/src/components/editor/boundary/__tests__/ErrorBoundary.test.tsx +1 -1
  289. package/src/components/editor/cell/CellStatus.tsx +23 -19
  290. package/src/components/editor/cell/CreateCellButton.tsx +15 -21
  291. package/src/components/editor/cell/DeleteButton.tsx +3 -2
  292. package/src/components/editor/cell/RunButton.tsx +18 -8
  293. package/src/components/editor/cell/StagedAICell.tsx +52 -137
  294. package/src/components/editor/cell/StopButton.tsx +2 -2
  295. package/src/components/editor/cell/__tests__/useRunCells.test.ts +45 -0
  296. package/src/components/editor/cell/__tests__/useShouldShowInterrupt.test.ts +39 -0
  297. package/src/components/editor/cell/cell-actions.tsx +12 -1
  298. package/src/components/editor/cell/cell-context-menu.tsx +4 -1
  299. package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +54 -0
  300. package/src/components/editor/cell/code/cell-editor.tsx +65 -169
  301. package/src/components/editor/cell/code/language-toggle.tsx +8 -7
  302. package/src/components/editor/cell/collapse.tsx +15 -4
  303. package/src/components/editor/cell/useAddCell.ts +4 -8
  304. package/src/components/editor/cell/useDeleteCell.tsx +10 -36
  305. package/src/components/editor/cell/useRunCells.ts +20 -8
  306. package/src/components/editor/cell/useShouldShowInterrupt.ts +2 -12
  307. package/src/components/editor/cell/useSplitCell.tsx +10 -6
  308. package/src/components/editor/chrome/components/__tests__/feedback-button.test.tsx +1 -1
  309. package/src/components/editor/chrome/components/feedback-button.tsx +2 -8
  310. package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +31 -2
  311. package/src/components/editor/chrome/panels/__tests__/runtime-details.test.tsx +1 -1
  312. package/src/components/editor/chrome/panels/__tests__/sandbox-recovery.test.tsx +1 -1
  313. package/src/components/editor/chrome/panels/cache-panel.tsx +1 -0
  314. package/src/components/editor/chrome/panels/dependency-graph-panel.tsx +1 -1
  315. package/src/components/editor/chrome/panels/logs-panel.tsx +2 -1
  316. package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +84 -0
  317. package/src/components/editor/chrome/panels/outline/floating-outline.tsx +39 -14
  318. package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +3 -2
  319. package/src/components/editor/chrome/panels/packages-panel.tsx +4 -7
  320. package/src/components/editor/chrome/panels/panel-header.tsx +13 -0
  321. package/src/components/editor/chrome/panels/secrets-panel.tsx +1 -0
  322. package/src/components/editor/chrome/panels/session-panel.tsx +1 -1
  323. package/src/components/editor/chrome/panels/snippets-panel.tsx +10 -12
  324. package/src/components/editor/chrome/panels/variable-panel.tsx +1 -5
  325. package/src/components/editor/chrome/types.ts +1 -1
  326. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +7 -9
  327. package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +92 -0
  328. package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +265 -37
  329. package/src/components/editor/chrome/wrapper/__tests__/useAskAiAboutCell.test.tsx +58 -0
  330. package/src/components/editor/chrome/wrapper/app-chrome.tsx +91 -74
  331. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +4 -4
  332. package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +1 -1
  333. package/src/components/editor/chrome/wrapper/footer-items/document-sync-status.tsx +54 -0
  334. package/src/components/editor/chrome/wrapper/footer-items/lsp-status.tsx +1 -1
  335. package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +1 -1
  336. package/src/components/editor/chrome/wrapper/footer-items/runtime-settings.tsx +1 -7
  337. package/src/components/editor/chrome/wrapper/footer.tsx +2 -2
  338. package/src/components/editor/chrome/wrapper/minimap-state.ts +1 -1
  339. package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +143 -72
  340. package/src/components/editor/chrome/wrapper/pending-ai-changes-badge.tsx +25 -0
  341. package/src/components/editor/chrome/wrapper/sidebar.tsx +8 -4
  342. package/src/components/editor/chrome/wrapper/storage.ts +1 -1
  343. package/src/components/editor/chrome/wrapper/useAskAiAboutCell.ts +36 -0
  344. package/src/components/editor/columns/__tests__/cell-column.test.tsx +1 -1
  345. package/src/components/editor/columns/cell-column.tsx +1 -1
  346. package/src/components/editor/columns/sortable-column.tsx +2 -2
  347. package/src/components/editor/connections/components.tsx +5 -10
  348. package/src/components/editor/controls/Controls.tsx +4 -4
  349. package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
  350. package/src/components/editor/controls/__tests__/keyboard-shortcuts.test.tsx +61 -0
  351. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +10 -4
  352. package/src/components/editor/controls/command-palette.tsx +22 -10
  353. package/src/components/editor/controls/keyboard-shortcuts.tsx +14 -5
  354. package/src/components/editor/documentation.css +34 -11
  355. package/src/components/editor/dynamic-favicon.tsx +21 -40
  356. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +25 -20
  357. package/src/components/editor/errors/auto-fix.tsx +4 -8
  358. package/src/components/editor/errors/send-error-report-button.tsx +3 -6
  359. package/src/components/editor/file-tree/__tests__/file-explorer-interactions.test.tsx +6 -0
  360. package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +47 -0
  361. package/src/components/editor/file-tree/__tests__/use-file-search.test.tsx +91 -0
  362. package/src/components/editor/file-tree/file-explorer.tsx +48 -15
  363. package/src/components/editor/file-tree/file-name-input.tsx +1 -0
  364. package/src/components/editor/file-tree/file-viewer.tsx +4 -2
  365. package/src/components/editor/file-tree/use-file-search.ts +35 -21
  366. package/src/components/editor/header/__tests__/filename-form.test.tsx +1 -4
  367. package/src/components/editor/header/__tests__/status.test.tsx +5 -3
  368. package/src/components/editor/header/app-header.tsx +1 -1
  369. package/src/components/editor/header/filename-form.tsx +1 -1
  370. package/src/components/editor/header/status.tsx +44 -22
  371. package/src/components/editor/links/__tests__/cell-link.test.tsx +148 -0
  372. package/src/components/editor/links/cell-link-list.tsx +1 -1
  373. package/src/components/editor/links/cell-link.tsx +21 -11
  374. package/src/components/editor/navigation/__tests__/clipboard.test.ts +60 -38
  375. package/src/components/editor/navigation/__tests__/navigation.test.ts +108 -85
  376. package/src/components/editor/navigation/__tests__/selection.test.ts +43 -21
  377. package/src/components/editor/navigation/clipboard.ts +17 -14
  378. package/src/components/editor/navigation/focus-utils.ts +23 -4
  379. package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +17 -33
  380. package/src/components/editor/navigation/navigation.ts +74 -72
  381. package/src/components/editor/navigation/selection.ts +30 -29
  382. package/src/components/editor/notebook-banner.tsx +1 -0
  383. package/src/components/editor/notebook-cell.tsx +114 -126
  384. package/src/components/editor/output/MarimoErrorOutput.tsx +2 -1
  385. package/src/components/editor/output/MarimoTracebackOutput.tsx +19 -17
  386. package/src/components/editor/output/Outputs.css +8 -0
  387. package/src/components/editor/output/VideoOutput.tsx +6 -0
  388. package/src/components/editor/output/__tests__/VideoOutput.test.tsx +131 -0
  389. package/src/components/editor/output/__tests__/traceback.test.tsx +27 -1
  390. package/src/components/editor/output/ansi-reduce.ts +33 -20
  391. package/src/components/editor/output/console/ConsoleOutput.tsx +19 -25
  392. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +125 -69
  393. package/src/components/editor/package-alert.tsx +14 -7
  394. package/src/components/editor/renderers/__tests__/add-cell-buttons.test.tsx +18 -0
  395. package/src/components/editor/renderers/cell-array.tsx +32 -100
  396. package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +75 -0
  397. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +34 -22
  398. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -2
  399. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +1 -1
  400. package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +4 -4
  401. package/src/components/editor/renderers/vertical-layout/sidebar/toggle.tsx +7 -1
  402. package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +1 -1
  403. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +13 -34
  404. package/src/components/editor/stdin-blocking-alert.tsx +4 -2
  405. package/src/components/home/components.tsx +17 -31
  406. package/src/components/icons/__tests__/large-spinner.test.tsx +39 -0
  407. package/src/components/icons/large-spinner.tsx +3 -14
  408. package/src/components/icons/spinner.tsx +1 -1
  409. package/src/components/markdown/markdown-renderer.tsx +39 -28
  410. package/src/components/mcp/mcp-status-indicator.tsx +18 -14
  411. package/src/components/pages/__tests__/home-page.test.tsx +116 -0
  412. package/src/components/pages/edit-page.tsx +19 -17
  413. package/src/components/pages/home-page.tsx +164 -91
  414. package/src/components/scratchpad/scratchpad.test.tsx +89 -0
  415. package/src/components/scratchpad/scratchpad.tsx +47 -33
  416. package/src/components/scratchpad/state.ts +7 -0
  417. package/src/components/slides/__tests__/minimap-actions.test.tsx +22 -29
  418. package/src/components/slides/__tests__/minimap.test.ts +38 -19
  419. package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +37 -0
  420. package/src/components/slides/minimap.tsx +21 -14
  421. package/src/components/slides/reveal-component.tsx +72 -36
  422. package/src/components/slides/reveal-slides.css +5 -4
  423. package/src/components/slides/slide-cell-view.tsx +32 -29
  424. package/src/components/slides/slide-form.tsx +1 -0
  425. package/src/components/slides/slide-scroll-hint.tsx +3 -1
  426. package/src/components/slides/slide.tsx +3 -4
  427. package/src/components/sort/SortableCellsProvider.tsx +8 -25
  428. package/src/components/tracing/tracing-keyboard.test.tsx +85 -0
  429. package/src/components/tracing/tracing.tsx +46 -42
  430. package/src/components/ui/__tests__/draggable-popover.test.tsx +24 -0
  431. package/src/components/ui/__tests__/fullscreen.test.tsx +44 -2
  432. package/src/components/ui/__tests__/range-slider.test.tsx +165 -0
  433. package/src/components/ui/alert-dialog.tsx +1 -1
  434. package/src/components/ui/draggable-popover.tsx +24 -2
  435. package/src/components/ui/fullscreen.tsx +25 -1
  436. package/src/components/ui/range-slider.tsx +22 -9
  437. package/src/components/ui/toast.tsx +1 -1
  438. package/src/core/MarimoApp.tsx +3 -1
  439. package/src/core/ai/__tests__/staged-cells.test.ts +89 -608
  440. package/src/core/ai/context/context.ts +2 -0
  441. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +8 -12
  442. package/src/core/ai/context/providers/__tests__/cell.test.ts +49 -0
  443. package/src/core/ai/context/providers/cell-output.ts +2 -2
  444. package/src/core/ai/context/providers/cell.ts +54 -0
  445. package/src/core/ai/context/providers/datasource.ts +6 -2
  446. package/src/core/ai/staged-cells.ts +56 -323
  447. package/src/core/ai/state.ts +3 -0
  448. package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +40 -88
  449. package/src/core/ai/tools/__tests__/registry.test.ts +17 -0
  450. package/src/core/ai/tools/base.ts +18 -15
  451. package/src/core/ai/tools/edit-notebook-tool.ts +86 -80
  452. package/src/core/ai/tools/registry.ts +13 -10
  453. package/src/core/ai/tools/sample-tool.ts +6 -7
  454. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +4 -426
  455. package/src/core/cells/__tests__/actions.test.ts +624 -35
  456. package/src/core/cells/__tests__/add-missing-import.test.ts +7 -8
  457. package/src/core/cells/__tests__/arrange.test.ts +432 -0
  458. package/src/core/cells/__tests__/cell.test.ts +85 -151
  459. package/src/core/cells/__tests__/cells.test.ts +269 -2667
  460. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +54 -0
  461. package/src/core/cells/__tests__/document.test.ts +164 -0
  462. package/src/core/cells/__tests__/editor.test.ts +57 -0
  463. package/src/core/cells/__tests__/flush-document.test.ts +40 -0
  464. package/src/core/cells/__tests__/harness.ts +106 -0
  465. package/src/core/cells/__tests__/layout.test.ts +177 -0
  466. package/src/core/cells/__tests__/notebook-outline.test.ts +122 -0
  467. package/src/core/cells/__tests__/outputs.test.tsx +71 -53
  468. package/src/core/cells/__tests__/pending-delete-service.test.tsx +11 -20
  469. package/src/core/cells/__tests__/session.test.ts +445 -211
  470. package/src/core/cells/__tests__/utils.test.ts +76 -347
  471. package/src/core/cells/actions.ts +678 -6
  472. package/src/core/cells/add-missing-import.ts +47 -43
  473. package/src/core/cells/arrange.ts +529 -0
  474. package/src/core/cells/cell.ts +45 -136
  475. package/src/core/cells/cells.ts +133 -1385
  476. package/src/core/cells/columns.ts +38 -0
  477. package/src/core/cells/document.ts +178 -0
  478. package/src/core/cells/edit.ts +30 -0
  479. package/src/core/cells/editor.ts +82 -0
  480. package/src/core/cells/focus.ts +27 -6
  481. package/src/core/cells/layout.ts +221 -0
  482. package/src/core/cells/outputs.ts +12 -28
  483. package/src/core/cells/pending-delete-service.ts +8 -14
  484. package/src/core/cells/scrollCellIntoView.ts +6 -0
  485. package/src/core/cells/session.ts +76 -53
  486. package/src/core/cells/types.ts +34 -41
  487. package/src/core/cells/utils.ts +46 -75
  488. package/src/core/codemirror/__tests__/format.test.ts +0 -34
  489. package/src/core/codemirror/__tests__/setup.test.ts +61 -29
  490. package/src/core/codemirror/ai/__tests__/resources.test.ts +117 -0
  491. package/src/core/codemirror/ai/resources.ts +1 -1
  492. package/src/core/codemirror/cells/__tests__/extensions.test.ts +2 -6
  493. package/src/core/codemirror/cells/extensions.ts +30 -28
  494. package/src/core/codemirror/cells/state.ts +2 -6
  495. package/src/core/codemirror/cm.ts +5 -1
  496. package/src/core/codemirror/config/types.ts +1 -1
  497. package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +6 -7
  498. package/src/core/codemirror/copilot/getCodes.ts +2 -2
  499. package/src/core/codemirror/format.ts +6 -23
  500. package/src/core/codemirror/keymaps/vim.ts +4 -8
  501. package/src/core/codemirror/language/__tests__/sql.test.ts +22 -20
  502. package/src/core/codemirror/language/__tests__/utils.test.ts +187 -15
  503. package/src/core/codemirror/language/cell-code.ts +114 -0
  504. package/src/core/codemirror/language/extension.ts +52 -35
  505. package/src/core/codemirror/language/languages/markdown.ts +8 -6
  506. package/src/core/codemirror/language/languages/python.ts +19 -13
  507. package/src/core/codemirror/language/languages/sql/sql.ts +16 -24
  508. package/src/core/codemirror/language/panel/panel.tsx +1 -0
  509. package/src/core/codemirror/language/types.ts +7 -7
  510. package/src/core/codemirror/language/utils.ts +9 -39
  511. package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +1 -2
  512. package/src/core/codemirror/lsp/notebook-lsp.ts +6 -5
  513. package/src/core/codemirror/lsp/utils.ts +1 -1
  514. package/src/core/codemirror/misc/__tests__/paste.test.ts +3 -1
  515. package/src/core/codemirror/misc/paste.ts +1 -1
  516. package/src/core/codemirror/placeholder/__tests__/extensions.test.ts +75 -0
  517. package/src/core/codemirror/placeholder/extensions.ts +80 -19
  518. package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
  519. package/src/core/codemirror/readonly/extension.ts +2 -2
  520. package/src/core/codemirror/utils.ts +1 -0
  521. package/src/core/config/__tests__/app-config.test.ts +64 -0
  522. package/src/core/config/__tests__/config-schema.test.ts +56 -6
  523. package/src/core/config/config-schema.ts +17 -4
  524. package/src/core/config/config.ts +65 -20
  525. package/src/core/config/feature-flag.tsx +0 -2
  526. package/src/core/datasets/__tests__/data-source-discovery.test.ts +5 -5
  527. package/src/core/datasets/data-source-discovery.ts +4 -6
  528. package/src/core/documentation/doc-lookup.ts +1 -1
  529. package/src/core/edit-app.tsx +22 -28
  530. package/src/core/errors/error-entries.ts +4 -1
  531. package/src/core/executions/__tests__/atoms.test.ts +99 -0
  532. package/src/core/executions/__tests__/select.test.ts +268 -0
  533. package/src/core/executions/atoms.ts +206 -0
  534. package/src/core/executions/hooks.ts +31 -0
  535. package/src/core/executions/index.ts +31 -0
  536. package/src/core/executions/select.ts +175 -0
  537. package/src/core/export/__tests__/hooks.test.ts +0 -5
  538. package/src/core/export/hooks.ts +1 -1
  539. package/src/core/export/layout.ts +2 -2
  540. package/src/core/hotkeys/actions.ts +2 -4
  541. package/src/core/hotkeys/hotkeys.ts +2 -1
  542. package/src/core/islands/__tests__/bootstrap.test.ts +69 -17
  543. package/src/core/islands/__tests__/bridge.test.ts +85 -27
  544. package/src/core/islands/bootstrap.ts +50 -54
  545. package/src/core/islands/bridge.ts +84 -25
  546. package/src/core/islands/components/__tests__/IslandControls.test.tsx +7 -5
  547. package/src/core/islands/components/output-wrapper.tsx +5 -5
  548. package/src/core/islands/components/web-components.tsx +1 -1
  549. package/src/core/islands/worker/__tests__/controller.test.ts +62 -4
  550. package/src/core/islands/worker/controller.ts +4 -10
  551. package/src/core/islands/worker/worker.tsx +33 -33
  552. package/src/core/kernel/__tests__/RuntimeState.test.ts +1 -1
  553. package/src/core/kernel/__tests__/handlers.test.ts +7 -153
  554. package/src/core/kernel/handlers.ts +17 -79
  555. package/src/core/kernel/state.ts +0 -15
  556. package/src/core/lifecycle/render-policy.ts +12 -26
  557. package/src/core/meta/__tests__/code-visibility.test.tsx +78 -70
  558. package/src/core/meta/code-visibility.ts +18 -9
  559. package/src/core/network/__tests__/connection.test.ts +1 -1
  560. package/src/core/network/__tests__/requests-lazy.test.ts +6 -8
  561. package/src/core/network/connection-notice.ts +1 -1
  562. package/src/core/network/connection.ts +1 -1
  563. package/src/core/network/requests-lazy.ts +5 -8
  564. package/src/core/network/requests-network.ts +5 -31
  565. package/src/core/network/requests-static.ts +1 -4
  566. package/src/core/network/requests-toasting.tsx +1 -4
  567. package/src/core/network/types.ts +6 -14
  568. package/src/core/network/useConnectionNotice.ts +8 -2
  569. package/src/core/notebook/__tests__/operations.test.ts +51 -0
  570. package/src/core/notebook/attachments.ts +38 -0
  571. package/src/core/notebook/document/__tests__/codemirror.test.ts +759 -0
  572. package/src/core/notebook/document/__tests__/draft.test.ts +363 -0
  573. package/src/core/notebook/document/__tests__/fixtures.ts +92 -0
  574. package/src/core/notebook/document/__tests__/hooks.test.tsx +391 -0
  575. package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +61 -0
  576. package/src/core/notebook/document/__tests__/model.test.ts +247 -0
  577. package/src/core/notebook/document/__tests__/protocol-fixtures.ts +38 -0
  578. package/src/core/notebook/document/__tests__/recovery-scenarios.test.ts +230 -0
  579. package/src/core/notebook/document/__tests__/scenario-fixture.ts +43 -0
  580. package/src/core/notebook/document/__tests__/scenarios.test.ts +205 -0
  581. package/src/core/notebook/document/__tests__/state.test.ts +459 -0
  582. package/src/core/notebook/document/__tests__/submission.test.ts +203 -0
  583. package/src/core/notebook/document/__tests__/test-host.test.ts +92 -0
  584. package/src/core/notebook/document/__tests__/test-host.ts +247 -0
  585. package/src/core/notebook/document/__tests__/test-notebook.ts +149 -0
  586. package/src/core/notebook/document/__tests__/user.ts +61 -0
  587. package/src/core/notebook/document/codemirror.ts +216 -0
  588. package/src/core/notebook/document/draft.ts +502 -0
  589. package/src/core/notebook/document/hooks.tsx +118 -0
  590. package/src/core/notebook/document/index.ts +24 -0
  591. package/src/core/notebook/document/model.ts +102 -0
  592. package/src/core/notebook/document/select.ts +41 -0
  593. package/src/core/notebook/document/state.ts +378 -0
  594. package/src/core/notebook/document/sync.ts +369 -0
  595. package/src/core/notebook/index.ts +19 -0
  596. package/src/core/notebook/operations.ts +30 -0
  597. package/src/core/notebook/replica/AGENTS.md +11 -0
  598. package/src/core/{host → notebook/replica}/__tests__/attachments.test.ts +9 -10
  599. package/src/core/{host → notebook/replica}/__tests__/document.test.ts +18 -16
  600. package/src/core/notebook/replica/__tests__/executions.test.ts +200 -0
  601. package/src/core/notebook/replica/__tests__/fixtures.ts +79 -0
  602. package/src/core/notebook/replica/__tests__/replica.test.ts +559 -0
  603. package/src/core/notebook/replica/__tests__/results.test.ts +193 -0
  604. package/src/core/notebook/replica/__tests__/runtime.test.ts +78 -0
  605. package/src/core/notebook/replica/backend.ts +19 -0
  606. package/src/core/notebook/replica/connection.ts +42 -0
  607. package/src/core/notebook/replica/index.ts +20 -0
  608. package/src/core/notebook/replica/replica.ts +336 -0
  609. package/src/core/{host → notebook/replica}/resources/attachments.ts +6 -3
  610. package/src/core/{host → notebook/replica}/resources/document.ts +3 -3
  611. package/src/core/notebook/replica/resources/executions.ts +157 -0
  612. package/src/core/notebook/replica/resources/results.ts +48 -0
  613. package/src/core/notebook/replica/resources/runtime.ts +14 -0
  614. package/src/core/packages/__tests__/useSandboxController.test.tsx +1 -1
  615. package/src/core/packages/useSandboxController.ts +1 -1
  616. package/src/core/run-app.tsx +49 -51
  617. package/src/core/runtime/__tests__/adapter.test.ts +4 -4
  618. package/src/core/runtime/__tests__/createWsUrl.test.ts +77 -7
  619. package/src/core/runtime/__tests__/runtime.test.ts +32 -74
  620. package/src/core/runtime/adapter.ts +5 -5
  621. package/src/core/runtime/config.ts +2 -2
  622. package/src/core/runtime/runtime.ts +33 -46
  623. package/src/core/runtime/types.ts +0 -2
  624. package/src/core/saving/__tests__/document.test.tsx +123 -0
  625. package/src/core/saving/__tests__/state.test.ts +111 -0
  626. package/src/core/saving/__tests__/useAutoSave.test.tsx +67 -0
  627. package/src/core/saving/document.ts +33 -0
  628. package/src/core/saving/filename.ts +1 -1
  629. package/src/core/saving/save-component.tsx +39 -60
  630. package/src/core/saving/state.ts +38 -39
  631. package/src/core/saving/useAutoSave.ts +17 -53
  632. package/src/core/session/__tests__/backend.test.ts +236 -0
  633. package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +186 -0
  634. package/src/core/{websocket → session}/__tests__/useNotebookSession.hook.test.tsx +247 -262
  635. package/src/core/session/active-notebook.ts +28 -0
  636. package/src/core/session/backend.ts +123 -0
  637. package/src/core/session/embedded.ts +7 -0
  638. package/src/core/{websocket → session}/types.ts +2 -2
  639. package/src/core/session/useNotebookReplica.ts +74 -0
  640. package/src/core/{websocket → session}/useNotebookSession.tsx +85 -67
  641. package/src/core/state/__tests__/jotai.test.tsx +108 -0
  642. package/src/core/state/jotai.ts +1 -1
  643. package/src/core/static/__tests__/files.test.ts +38 -10
  644. package/src/core/static/files.ts +2 -0
  645. package/src/core/{websocket → transports}/__tests__/connection-state.test.ts +1 -13
  646. package/src/core/transports/__tests__/server.test.ts +408 -0
  647. package/src/core/transports/__tests__/static.test.ts +306 -0
  648. package/src/core/transports/__tests__/wasm.test.ts +166 -0
  649. package/src/core/{websocket → transports}/connection-state.ts +9 -16
  650. package/src/core/transports/server.ts +152 -0
  651. package/src/core/transports/static.ts +166 -0
  652. package/src/core/transports/wasm.ts +97 -0
  653. package/src/core/vscode/__tests__/vscode-bindings.test.ts +125 -0
  654. package/src/core/vscode/vscode-bindings.ts +14 -2
  655. package/src/core/wasm/__tests__/bridge.test.ts +210 -64
  656. package/src/core/wasm/__tests__/worker.test.ts +188 -0
  657. package/src/core/wasm/bridge.ts +120 -73
  658. package/src/core/wasm/rpc.ts +15 -3
  659. package/src/core/wasm/store.ts +3 -3
  660. package/src/core/wasm/worker/bootstrap.ts +55 -51
  661. package/src/core/wasm/worker/getMarimoWheel.ts +1 -1
  662. package/src/core/wasm/worker/save-worker.ts +9 -10
  663. package/src/core/wasm/worker/types.ts +30 -18
  664. package/src/core/wasm/worker/worker.ts +118 -72
  665. package/src/css/app/Cell.css +7 -36
  666. package/src/css/app/codemirror.css +1 -1
  667. package/src/css/common.css +1 -1
  668. package/src/css/globals.css +66 -22
  669. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  670. package/src/hooks/__tests__/useDebounce.test.tsx +51 -0
  671. package/src/hooks/__tests__/useDeepCompareMemoize.test.tsx +39 -0
  672. package/src/hooks/__tests__/useDelayElapsed.test.tsx +28 -0
  673. package/src/hooks/__tests__/useInternalStateWithSync.test.tsx +20 -0
  674. package/src/hooks/__tests__/useScript.test.tsx +77 -0
  675. package/src/hooks/__tests__/useStateForKey.test.tsx +257 -0
  676. package/src/hooks/useAsyncData.ts +3 -3
  677. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  678. package/src/hooks/useDebounce.ts +6 -10
  679. package/src/hooks/useDeepCompareMemoize.ts +1 -1
  680. package/src/hooks/useDelayElapsed.ts +14 -10
  681. package/src/hooks/useElapsedTime.ts +3 -3
  682. package/src/hooks/useEventListener.ts +1 -2
  683. package/src/hooks/useInputHistory.ts +4 -7
  684. package/src/hooks/useInternalStateWithSync.ts +6 -6
  685. package/src/hooks/useResizeObserver.ts +4 -7
  686. package/src/hooks/useScript.ts +67 -70
  687. package/src/hooks/useStateForKey.ts +93 -0
  688. package/src/mount.tsx +20 -15
  689. package/src/plugins/__tests__/plugin-object-schemas.test.ts +104 -0
  690. package/src/plugins/core/RenderHTML.tsx +3 -5
  691. package/src/plugins/core/__test__/RenderHTML-copy.test.tsx +60 -0
  692. package/src/plugins/core/registerReactComponent.tsx +5 -14
  693. package/src/plugins/impl/CodeEditorPlugin.tsx +1 -1
  694. package/src/plugins/impl/DataEditorPlugin.tsx +34 -9
  695. package/src/plugins/impl/DataTablePlugin.tsx +69 -37
  696. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  697. package/src/plugins/impl/FileBrowserPlugin.tsx +4 -16
  698. package/src/plugins/impl/FormPlugin.tsx +1 -1
  699. package/src/plugins/impl/RangeSliderPlugin.tsx +16 -2
  700. package/src/plugins/impl/RefreshPlugin.tsx +1 -0
  701. package/src/plugins/impl/SliderPlugin.tsx +6 -8
  702. package/src/plugins/impl/__tests__/DataEditorPlugin.test.ts +93 -4
  703. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +387 -1
  704. package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +45 -0
  705. package/src/plugins/impl/__tests__/RangeSliderPlugin.test.tsx +109 -0
  706. package/src/plugins/impl/__tests__/SliderPlugin.test.tsx +24 -3
  707. package/src/plugins/impl/anywidget/__tests__/registry.test.ts +153 -0
  708. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
  709. package/src/plugins/impl/anywidget/model.ts +3 -1
  710. package/src/plugins/impl/anywidget/registry.ts +18 -14
  711. package/src/plugins/impl/anywidget/runtime.ts +21 -9
  712. package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
  713. package/src/plugins/impl/chat/__tests__/chat-prompts.test.tsx +93 -0
  714. package/src/plugins/impl/chat/chat-ui.tsx +17 -15
  715. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  716. package/src/plugins/impl/common/error-banner.tsx +5 -3
  717. package/src/plugins/impl/data-editor/__tests__/column-types.test.ts +37 -0
  718. package/src/plugins/impl/data-editor/__tests__/editor-state.test.ts +52 -1
  719. package/src/plugins/impl/data-editor/__tests__/glide-data-editor.test.tsx +113 -1
  720. package/src/plugins/impl/data-editor/__tests__/glide-utils.test.ts +116 -0
  721. package/src/plugins/impl/data-editor/column-types.ts +52 -0
  722. package/src/plugins/impl/data-editor/editor-state.ts +18 -2
  723. package/src/plugins/impl/data-editor/glide-data-editor.tsx +73 -12
  724. package/src/plugins/impl/data-editor/glide-utils.ts +33 -10
  725. package/src/plugins/impl/data-editor/types.ts +7 -0
  726. package/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx +1 -1
  727. package/src/plugins/impl/data-explorer/components/column-summary.tsx +4 -2
  728. package/src/plugins/impl/data-explorer/state/reducer.ts +1 -1
  729. package/src/plugins/impl/data-frames/DataFramePlugin.tsx +1 -2
  730. package/src/plugins/impl/data-frames/__tests__/sidebar.test.tsx +160 -0
  731. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +66 -66
  732. package/src/plugins/impl/data-frames/panel.tsx +44 -16
  733. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
  734. package/src/plugins/impl/panel/PanelPlugin.tsx +16 -17
  735. package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
  736. package/src/plugins/impl/panel/utils.ts +17 -0
  737. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +2 -5
  738. package/src/plugins/impl/plotly/selection.ts +25 -19
  739. package/src/plugins/impl/vega/VegaPlugin.tsx +2 -3
  740. package/src/plugins/impl/vega/make-selectable.ts +4 -7
  741. package/src/plugins/layout/DownloadPlugin.tsx +7 -11
  742. package/src/plugins/layout/RoutesPlugin.tsx +1 -1
  743. package/src/plugins/layout/__test__/DownloadPlugin.test.tsx +205 -0
  744. package/src/stories/__tests__/editor-story.test.tsx +33 -0
  745. package/src/stories/button.stories.tsx +1 -0
  746. package/src/stories/cell-status.stories.tsx +17 -10
  747. package/src/stories/cell.stories.tsx +2 -36
  748. package/src/stories/data-table.stories.tsx +31 -0
  749. package/src/stories/editor.stories.tsx +24 -17
  750. package/src/stories/form-wrapper.stories.tsx +2 -2
  751. package/src/stories/layout/vertical/one-column.stories.tsx +28 -32
  752. package/src/stories/runtime-story.tsx +23 -17
  753. package/src/stories/select.stories.tsx +2 -2
  754. package/src/stories/switchable-multi-select.stories.tsx +1 -1
  755. package/src/utils/__tests__/arrays.test.ts +35 -0
  756. package/src/utils/__tests__/batch-requests.test.ts +3 -3
  757. package/src/utils/__tests__/{createReducer.test.ts → createReducer.test.tsx} +127 -1
  758. package/src/utils/__tests__/download.test.tsx +183 -23
  759. package/src/utils/__tests__/numbers.test.ts +105 -1
  760. package/src/utils/__tests__/objects.test.ts +21 -0
  761. package/src/utils/arrays.ts +11 -2
  762. package/src/utils/blob.ts +1 -1
  763. package/src/utils/createReducer.ts +115 -79
  764. package/src/utils/download.ts +67 -6
  765. package/src/utils/maps.ts +0 -3
  766. package/src/utils/numbers.ts +79 -18
  767. package/src/utils/objects.ts +4 -9
  768. package/src/utils/time.ts +10 -0
  769. package/src/utils/tracer.ts +9 -5
  770. package/src/utils/zod-utils.ts +1 -3
  771. package/dist/_baseMerge-BiGRwuqv.js +0 -165
  772. package/dist/any-language-editor-D4q-IFcM.js +0 -76
  773. package/dist/assets/__vite-browser-external-BXYkiFsk.js +0 -1
  774. package/dist/assets/worker-HPY9fbhz.js +0 -114
  775. package/dist/dropdown-menu-DHP9P4VE.js +0 -4678
  776. package/dist/feedback-button-B2JRVQRd.js +0 -379
  777. package/dist/hasIn-o2Us0uVx.js +0 -132
  778. package/dist/html-to-image-DWTzN7q3.js +0 -3251
  779. package/dist/isArrayLikeObject-BZl-15ir.js +0 -450
  780. package/dist/isEmpty-BSZ1LaUo.js +0 -35
  781. package/dist/isSymbol-kQcfYbNX.js +0 -8
  782. package/dist/label-DoysmLMW.js +0 -281
  783. package/dist/mermaid-HWGCJPDP-ByCsZnYF.js +0 -2
  784. package/dist/pick-CJeoxYOS.js +0 -51
  785. package/dist/precisionRound-DMIVQrt2.js +0 -97
  786. package/dist/select-DemoKT4G.js +0 -1344
  787. package/dist/toDate-CJWU9dyl.js +0 -1185
  788. package/dist/toast-PkdZraM8.js +0 -1830
  789. package/dist/use-restore-focus-CKjfFjLM.js +0 -6369
  790. package/dist/useLifecycle-BGWzTwHK.js +0 -169
  791. package/dist/useTheme-BhQvec43.js +0 -904
  792. package/src/components/chat/reasoning-accordion.tsx +0 -61
  793. package/src/components/chat/tool-call/tool-error-card.tsx +0 -81
  794. package/src/components/chat/tool-call/tool-history-row.tsx +0 -174
  795. package/src/components/editor/ai/__tests__/staged-cell-submission.test.ts +0 -106
  796. package/src/components/editor/ai/add-cell-with-ai.tsx +0 -506
  797. package/src/components/editor/ai/staged-cell-submission.ts +0 -46
  798. package/src/components/editor/cell/__tests__/StagedAICell.test.tsx +0 -64
  799. package/src/components/editor/cell/code/__tests__/rtc-editor-config.test.ts +0 -50
  800. package/src/components/editor/chrome/wrapper/footer-items/rtc-status.tsx +0 -65
  801. package/src/components/editor/navigation/__tests__/state.test.ts +0 -81
  802. package/src/components/editor/navigation/state.ts +0 -65
  803. package/src/components/icons/loading-ellipsis.tsx +0 -46
  804. package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +0 -656
  805. package/src/core/ai/tools/run-cells-tool.ts +0 -303
  806. package/src/core/attachments/state.ts +0 -18
  807. package/src/core/cells/__tests__/apply-transaction.test.ts +0 -991
  808. package/src/core/cells/__tests__/document-changes.test.ts +0 -1140
  809. package/src/core/cells/__tests__/document-roundtrip.test.ts +0 -392
  810. package/src/core/cells/document-changes.ts +0 -944
  811. package/src/core/codemirror/rtc/extension.ts +0 -453
  812. package/src/core/codemirror/rtc/loro/__tests__/sync.test.ts +0 -52
  813. package/src/core/codemirror/rtc/loro/awareness.ts +0 -531
  814. package/src/core/codemirror/rtc/loro/colors.ts +0 -38
  815. package/src/core/codemirror/rtc/loro/sync.ts +0 -168
  816. package/src/core/host/AGENTS.md +0 -11
  817. package/src/core/host/__tests__/events.test.ts +0 -46
  818. package/src/core/host/__tests__/fixtures.ts +0 -39
  819. package/src/core/host/__tests__/notebook-client.test.ts +0 -433
  820. package/src/core/host/__tests__/protocol.test.ts +0 -214
  821. package/src/core/host/__tests__/stream.test.ts +0 -209
  822. package/src/core/host/connection.ts +0 -81
  823. package/src/core/host/events.ts +0 -61
  824. package/src/core/host/notebook-client.ts +0 -290
  825. package/src/core/host/protocol.ts +0 -1945
  826. package/src/core/host/resources/resource.ts +0 -47
  827. package/src/core/host/stream.ts +0 -211
  828. package/src/core/rtc/state.ts +0 -34
  829. package/src/core/state/__tests__/jotai.test.ts +0 -25
  830. package/src/core/wasm/worker/message-buffer.ts +0 -33
  831. package/src/core/websocket/__tests__/createConnectionTransport.test.ts +0 -49
  832. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +0 -170
  833. package/src/core/websocket/state.ts +0 -7
  834. package/src/core/websocket/transports/__tests__/basic.test.ts +0 -275
  835. package/src/core/websocket/transports/__tests__/sse.test.ts +0 -335
  836. package/src/core/websocket/transports/__tests__/transport.test.ts +0 -308
  837. package/src/core/websocket/transports/__tests__/ws.test.ts +0 -125
  838. package/src/core/websocket/transports/basic.ts +0 -102
  839. package/src/core/websocket/transports/create.ts +0 -31
  840. package/src/core/websocket/transports/sse.ts +0 -308
  841. package/src/core/websocket/transports/transport.ts +0 -50
  842. package/src/core/websocket/transports/ws.ts +0 -98
  843. package/src/core/websocket/useNotebookClient.ts +0 -88
  844. package/src/utils/__tests__/id-tree.test.ts +0 -2145
  845. package/src/utils/id-tree.tsx +0 -1134
  846. /package/src/{core/attachments/toast.ts → components/editor/agent-toast.ts} +0 -0
  847. /package/src/core/{websocket → session}/connection-utils.ts +0 -0
@@ -1,1830 +0,0 @@
1
- import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
2
- import { h as t, p as n, r } from "./button-CvjkwdSk.js";
3
- import { t as i } from "./react-sHtZdjeP.js";
4
- import { t as a } from "./compiler-runtime-CldRdSsv.js";
5
- import { m as o } from "./tooltip-CtBZ5q8p.js";
6
- import { A as s, k as c } from "./select-DemoKT4G.js";
7
- import { t as l } from "./react-dom-DUmH0GXv.js";
8
- import { t as u } from "./jsx-runtime-3BD1kT0s.js";
9
- import { Ct as d, Dt as f, Et as p, Ot as ee, St as te, Tt as m, _t as ne, bt as h, ht as g, wt as re, yt as ie } from "./use-restore-focus-CKjfFjLM.js";
10
- //#region ../node_modules/.pnpm/@radix-ui+react-toast@1.2.23_@types+react-dom@19.3.0_@types+react@19.3.0__@types+react@_69693a0157877c6dbc61617dd22ea8ee/node_modules/@radix-ui/react-toast/dist/index.mjs
11
- var _ = /* @__PURE__ */ e(i(), 1), ae = /* @__PURE__ */ e(l(), 1), v = u(), y = Object.defineProperty, b = (e, t) => y(e, "name", {
12
- value: t,
13
- configurable: !0
14
- }), x = "ToastProvider", [oe, se, ce] = c("Toast"), [S, C] = p("Toast", [ce]), [w, T] = S(x), le = /* @__PURE__ */ b((e) => {
15
- let { __scopeToast: t, label: n = "Notification", duration: r = 5e3, swipeDirection: i = "right", swipeThreshold: a = 50, announcerContainer: o, children: s } = e, [c, l] = _.useState(null), [u, d] = _.useState(0), f = _.useRef(!1);
16
- return n.trim() || console.error(`Invalid prop \`label\` supplied to \`${x}\`. Expected non-empty \`string\`.`), /* @__PURE__ */ (0, v.jsx)(oe.Provider, {
17
- scope: t,
18
- children: /* @__PURE__ */ (0, v.jsx)(w, {
19
- scope: t,
20
- label: n,
21
- duration: r,
22
- swipeDirection: i,
23
- swipeThreshold: a,
24
- toastCount: u,
25
- viewport: c,
26
- onViewportChange: l,
27
- onToastAdd: _.useCallback(() => d((e) => e + 1), []),
28
- onToastRemove: _.useCallback(() => d((e) => e - 1), []),
29
- isClosePausedRef: f,
30
- announcerContainer: o,
31
- children: s
32
- })
33
- });
34
- }, "ToastProvider"), ue = "ToastViewport", E = ["F8"], de = "toast.viewportPause", fe = "toast.viewportResume", pe = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
35
- let { __scopeToast: r, hotkey: i = E, label: a = "Notifications ({hotkey})", ...o } = e, s = T(ue, r), c = se(r), l = _.useRef(null), u = _.useRef(null), d = _.useRef(null), p = _.useRef(null), ee = n(t, p, s.onViewportChange), te = i.join("+").replace(/Key/g, "").replace(/Digit/g, ""), m = s.toastCount > 0;
36
- _.useEffect(() => {
37
- let e = /* @__PURE__ */ b((e) => {
38
- i.length !== 0 && i.every((t) => e[t] || e.code === t) && p.current?.focus();
39
- }, "handleKeyDown");
40
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
41
- }, [i]), _.useEffect(() => {
42
- let e = l.current, t = p.current;
43
- if (m && e && t) {
44
- let n = /* @__PURE__ */ b(() => {
45
- if (!s.isClosePausedRef.current) {
46
- let e = new CustomEvent(de);
47
- t.dispatchEvent(e), s.isClosePausedRef.current = !0;
48
- }
49
- }, "handlePause"), r = /* @__PURE__ */ b(() => {
50
- if (s.isClosePausedRef.current) {
51
- let e = new CustomEvent(fe);
52
- t.dispatchEvent(e), s.isClosePausedRef.current = !1;
53
- }
54
- }, "handleResume"), i = /* @__PURE__ */ b((t) => {
55
- e.contains(t.relatedTarget) || r();
56
- }, "handleFocusOutResume"), a = /* @__PURE__ */ b(() => {
57
- e.contains(document.activeElement) || r();
58
- }, "handlePointerLeaveResume");
59
- return e.addEventListener("focusin", n), e.addEventListener("focusout", i), e.addEventListener("pointermove", n), e.addEventListener("pointerleave", a), window.addEventListener("blur", n), window.addEventListener("focus", r), () => {
60
- e.removeEventListener("focusin", n), e.removeEventListener("focusout", i), e.removeEventListener("pointermove", n), e.removeEventListener("pointerleave", a), window.removeEventListener("blur", n), window.removeEventListener("focus", r);
61
- };
62
- }
63
- }, [m, s.isClosePausedRef]);
64
- let h = _.useCallback(({ tabbingDirection: e }) => {
65
- let t = c().map((t) => {
66
- let n = t.ref.current, r = [n, ...Pe(n)];
67
- return e === "forwards" ? r : r.reverse();
68
- });
69
- return (e === "forwards" ? t.reverse() : t).flat();
70
- }, [c]);
71
- return _.useEffect(() => {
72
- let e = p.current;
73
- if (e) {
74
- let t = /* @__PURE__ */ b((t) => {
75
- let n = t.altKey || t.ctrlKey || t.metaKey;
76
- if (t.key === "Tab" && !n) {
77
- let n = document.activeElement, r = t.shiftKey;
78
- if (t.target === e && r) {
79
- u.current?.focus();
80
- return;
81
- }
82
- let i = h({ tabbingDirection: r ? "backwards" : "forwards" }), a = i.findIndex((e) => e === n);
83
- j(i.slice(a + 1)) ? t.preventDefault() : r ? u.current?.focus() : d.current?.focus();
84
- }
85
- }, "handleKeyDown");
86
- return e.addEventListener("keydown", t), () => e.removeEventListener("keydown", t);
87
- }
88
- }, [c, h]), /* @__PURE__ */ (0, v.jsxs)(ne, {
89
- ref: l,
90
- role: "region",
91
- "aria-label": a.replace("{hotkey}", te),
92
- tabIndex: -1,
93
- style: { pointerEvents: m ? void 0 : "none" },
94
- children: [
95
- m && /* @__PURE__ */ (0, v.jsx)(D, {
96
- ref: u,
97
- onFocusFromOutsideViewport: () => {
98
- j(h({ tabbingDirection: "forwards" }));
99
- }
100
- }),
101
- /* @__PURE__ */ (0, v.jsx)(oe.Slot, {
102
- scope: r,
103
- children: /* @__PURE__ */ (0, v.jsx)(f.ol, {
104
- tabIndex: -1,
105
- ...o,
106
- ref: ee
107
- })
108
- }),
109
- m && /* @__PURE__ */ (0, v.jsx)(D, {
110
- ref: d,
111
- onFocusFromOutsideViewport: () => {
112
- j(h({ tabbingDirection: "backwards" }));
113
- }
114
- })
115
- ]
116
- });
117
- }, "ToastViewport")), me = "ToastFocusProxy", D = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
118
- let { __scopeToast: n, onFocusFromOutsideViewport: r, ...i } = e, a = T(me, n);
119
- return /* @__PURE__ */ (0, v.jsx)(o, {
120
- tabIndex: 0,
121
- ...i,
122
- ref: t,
123
- style: { position: "fixed" },
124
- onFocus: (e) => {
125
- let t = e.relatedTarget;
126
- a.viewport?.contains(t) || r();
127
- }
128
- });
129
- }, "ToastFocusProxy")), O = "Toast", he = "toast.swipeStart", ge = "toast.swipeMove", _e = "toast.swipeCancel", ve = "toast.swipeEnd", k = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
130
- let { forceMount: n, open: r, defaultOpen: i, onOpenChange: a, ...o } = e, [s, c] = d({
131
- prop: r,
132
- defaultProp: i ?? !0,
133
- onChange: a,
134
- caller: O
135
- });
136
- return /* @__PURE__ */ (0, v.jsx)(te, {
137
- present: n || s,
138
- children: /* @__PURE__ */ (0, v.jsx)(xe, {
139
- open: s,
140
- ...o,
141
- ref: t,
142
- onClose: () => c(!1),
143
- onPause: h(e.onPause),
144
- onResume: h(e.onResume),
145
- onSwipeStart: m(e.onSwipeStart, (e) => {
146
- e.currentTarget.setAttribute("data-swipe", "start");
147
- }),
148
- onSwipeMove: m(e.onSwipeMove, (e) => {
149
- let { x: t, y: n } = e.detail.delta;
150
- e.currentTarget.setAttribute("data-swipe", "move"), e.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${t}px`), e.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${n}px`);
151
- }),
152
- onSwipeCancel: m(e.onSwipeCancel, (e) => {
153
- e.currentTarget.setAttribute("data-swipe", "cancel"), e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
154
- }),
155
- onSwipeEnd: m(e.onSwipeEnd, (e) => {
156
- let { x: t, y: n } = e.detail.delta;
157
- e.currentTarget.setAttribute("data-swipe", "end"), e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), e.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${t}px`), e.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${n}px`), c(!1);
158
- })
159
- })
160
- });
161
- }, "Toast")), [ye, be] = S(O, { onClose() {} }), xe = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
162
- let { __scopeToast: r, type: i = "foreground", duration: a, open: o, onClose: s, onEscapeKeyDown: c, onPause: l, onResume: u, onSwipeStart: d, onSwipeMove: p, onSwipeCancel: ee, onSwipeEnd: te, ...ne } = e, g = T(O, r), re = se(r), [y, x] = _.useState(null), ce = n(t, x), S = _.useRef(null), C = _.useRef(null), w = a || g.duration, le = _.useRef(0), ue = _.useRef(w), E = _.useRef(0), { onToastAdd: pe, onToastRemove: me } = g, D = h(() => {
163
- y?.contains(document.activeElement) && g.viewport?.focus(), s();
164
- }), k = _.useCallback((e) => {
165
- !e || e === Infinity || (window.clearTimeout(E.current), le.current = (/* @__PURE__ */ new Date()).getTime(), E.current = window.setTimeout(D, e));
166
- }, [D]);
167
- _.useEffect(() => {
168
- let e = g.viewport;
169
- if (e) {
170
- let t = /* @__PURE__ */ b(() => {
171
- k(ue.current), u?.();
172
- }, "handleResume"), n = /* @__PURE__ */ b(() => {
173
- let e = (/* @__PURE__ */ new Date()).getTime() - le.current;
174
- ue.current -= e, window.clearTimeout(E.current), l?.();
175
- }, "handlePause");
176
- return e.addEventListener(de, n), e.addEventListener(fe, t), () => {
177
- e.removeEventListener(de, n), e.removeEventListener(fe, t);
178
- };
179
- }
180
- }, [
181
- g.viewport,
182
- w,
183
- l,
184
- u,
185
- k
186
- ]), _.useEffect(() => {
187
- o && !g.isClosePausedRef.current && k(w);
188
- }, [
189
- o,
190
- w,
191
- g.isClosePausedRef,
192
- k
193
- ]), _.useEffect(() => () => {
194
- window.clearTimeout(E.current);
195
- }, []), _.useEffect(() => (pe(), () => me()), [pe, me]);
196
- let be = _.useMemo(() => y ? Ae(y) : null, [y]);
197
- return g.viewport ? /* @__PURE__ */ (0, v.jsxs)(v.Fragment, { children: [be && /* @__PURE__ */ (0, v.jsx)(Se, {
198
- __scopeToast: r,
199
- role: "status",
200
- "aria-live": i === "foreground" ? "assertive" : "polite",
201
- children: be
202
- }), /* @__PURE__ */ (0, v.jsx)(ye, {
203
- scope: r,
204
- onClose: D,
205
- children: ae.createPortal(/* @__PURE__ */ (0, v.jsx)(oe.ItemSlot, {
206
- scope: r,
207
- children: /* @__PURE__ */ (0, v.jsx)(ie, {
208
- asChild: !0,
209
- onEscapeKeyDown: m(c, (e) => {
210
- re().some((t) => t.ref.current?.contains(e.target)) || D();
211
- }),
212
- children: /* @__PURE__ */ (0, v.jsx)(f.li, {
213
- tabIndex: 0,
214
- "data-state": o ? "open" : "closed",
215
- "data-swipe-direction": g.swipeDirection,
216
- ...ne,
217
- ref: ce,
218
- style: {
219
- userSelect: "none",
220
- touchAction: "none",
221
- ...e.style
222
- },
223
- onKeyDown: m(e.onKeyDown, (e) => {
224
- e.key === "Escape" && (c?.(e.nativeEvent), e.nativeEvent.defaultPrevented || D());
225
- }),
226
- onPointerDown: m(e.onPointerDown, (e) => {
227
- e.button === 0 && (S.current = {
228
- x: e.clientX,
229
- y: e.clientY
230
- });
231
- }),
232
- onPointerMove: m(e.onPointerMove, (e) => {
233
- if (!S.current) return;
234
- let t = e.clientX - S.current.x, n = e.clientY - S.current.y, r = !!C.current, i = ["left", "right"].includes(g.swipeDirection), a = ["left", "up"].includes(g.swipeDirection) ? Math.min : Math.max, o = i ? a(0, t) : 0, s = i ? 0 : a(0, n), c = e.pointerType === "touch" ? 10 : 2, l = {
235
- x: o,
236
- y: s
237
- }, u = {
238
- originalEvent: e,
239
- delta: l
240
- };
241
- r ? (C.current = l, A(ge, p, u, { discrete: !1 })) : je(l, g.swipeDirection, c) ? (C.current = l, A(he, d, u, { discrete: !1 }), e.target.setPointerCapture(e.pointerId)) : (Math.abs(t) > c || Math.abs(n) > c) && (S.current = null);
242
- }),
243
- onPointerUp: m(e.onPointerUp, (e) => {
244
- let t = C.current, n = e.target;
245
- if (n.hasPointerCapture(e.pointerId) && n.releasePointerCapture(e.pointerId), C.current = null, S.current = null, t) {
246
- let n = e.currentTarget, r = {
247
- originalEvent: e,
248
- delta: t
249
- };
250
- je(t, g.swipeDirection, g.swipeThreshold) ? A(ve, te, r, { discrete: !0 }) : A(_e, ee, r, { discrete: !0 }), n.addEventListener("click", (e) => e.preventDefault(), { once: !0 });
251
- }
252
- })
253
- })
254
- })
255
- }), g.viewport)
256
- })] }) : null;
257
- }, "ToastImpl")), Se = /* @__PURE__ */ b((e) => {
258
- let { __scopeToast: t, children: n, ...r } = e, i = T(O, t), [a, s] = _.useState(!1), [c, l] = _.useState(!1);
259
- return Me(() => s(!0)), _.useEffect(() => {
260
- let e = window.setTimeout(() => l(!0), 1e3);
261
- return () => window.clearTimeout(e);
262
- }, []), c ? null : /* @__PURE__ */ (0, v.jsx)(g, {
263
- asChild: !0,
264
- container: i.announcerContainer || void 0,
265
- children: /* @__PURE__ */ (0, v.jsx)(o, {
266
- ...r,
267
- children: a && /* @__PURE__ */ (0, v.jsxs)(v.Fragment, { children: [
268
- i.label,
269
- " ",
270
- n
271
- ] })
272
- })
273
- });
274
- }, "ToastAnnounce"), Ce = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
275
- let { __scopeToast: n, ...r } = e;
276
- return /* @__PURE__ */ (0, v.jsx)(f.div, {
277
- ...r,
278
- ref: t
279
- });
280
- }, "ToastTitle")), we = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
281
- let { __scopeToast: n, ...r } = e;
282
- return /* @__PURE__ */ (0, v.jsx)(f.div, {
283
- ...r,
284
- ref: t
285
- });
286
- }, "ToastDescription")), Te = "ToastAction", Ee = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
287
- let { altText: n, ...r } = e;
288
- return n.trim() ? /* @__PURE__ */ (0, v.jsx)(ke, {
289
- altText: n,
290
- asChild: !0,
291
- children: /* @__PURE__ */ (0, v.jsx)(Oe, {
292
- ...r,
293
- ref: t
294
- })
295
- }) : (console.error(`Invalid prop \`altText\` supplied to \`${Te}\`. Expected non-empty \`string\`.`), null);
296
- }, "ToastAction")), De = "ToastClose", Oe = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
297
- let { __scopeToast: n, ...r } = e, i = be(De, n);
298
- return /* @__PURE__ */ (0, v.jsx)(ke, {
299
- asChild: !0,
300
- children: /* @__PURE__ */ (0, v.jsx)(f.button, {
301
- type: "button",
302
- ...r,
303
- ref: t,
304
- onClick: m(e.onClick, i.onClose)
305
- })
306
- });
307
- }, "ToastClose")), ke = /* @__PURE__ */ _.forwardRef(/* @__PURE__ */ b(function(e, t) {
308
- let { __scopeToast: n, altText: r, ...i } = e;
309
- return /* @__PURE__ */ (0, v.jsx)(f.div, {
310
- "data-radix-toast-announce-exclude": "",
311
- "data-radix-toast-announce-alt": r || void 0,
312
- ...i,
313
- ref: t
314
- });
315
- }, "ToastAnnounceExclude"));
316
- function Ae(e) {
317
- let t = [];
318
- return Array.from(e.childNodes).forEach((e) => {
319
- if (e.nodeType === e.TEXT_NODE && e.textContent && t.push(e.textContent), Ne(e)) {
320
- let n = e.ariaHidden || e.hidden || e.style.display === "none", r = e.dataset.radixToastAnnounceExclude === "";
321
- if (!n) {
322
- if (r) {
323
- let n = e.dataset.radixToastAnnounceAlt;
324
- n && t.push(n);
325
- } else t.push(...Ae(e));
326
- }
327
- }
328
- }), t;
329
- }
330
- b(Ae, "getAnnounceTextContent");
331
- function A(e, t, n, { discrete: r }) {
332
- let i = n.originalEvent.currentTarget, a = new CustomEvent(e, {
333
- bubbles: !0,
334
- cancelable: !0,
335
- detail: n
336
- });
337
- t && i.addEventListener(e, t, { once: !0 }), r ? ee(i, a) : i.dispatchEvent(a);
338
- }
339
- b(A, "handleAndDispatchCustomEvent");
340
- var je = /* @__PURE__ */ b((e, t, n = 0) => {
341
- let r = Math.abs(e.x), i = Math.abs(e.y), a = r > i;
342
- return t === "left" || t === "right" ? a && r > n : !a && i > n;
343
- }, "isDeltaInDirection");
344
- function Me(e = () => {}) {
345
- let t = h(e);
346
- re(() => {
347
- let e = 0, n = 0;
348
- return e = window.requestAnimationFrame(() => n = window.requestAnimationFrame(t)), () => {
349
- window.cancelAnimationFrame(e), window.cancelAnimationFrame(n);
350
- };
351
- }, [t]);
352
- }
353
- b(Me, "useNextFrame");
354
- function Ne(e) {
355
- return e.nodeType === e.ELEMENT_NODE;
356
- }
357
- b(Ne, "isHTMLElement");
358
- function Pe(e) {
359
- let t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: /* @__PURE__ */ b((e) => {
360
- let t = e.tagName === "INPUT" && e.type === "hidden";
361
- return e.disabled || e.hidden || t ? NodeFilter.FILTER_SKIP : e.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
362
- }, "acceptNode") });
363
- for (; n.nextNode();) t.push(n.currentNode);
364
- return t;
365
- }
366
- b(Pe, "getTabbableCandidates");
367
- function j(e) {
368
- let t = document.activeElement;
369
- return e.some((e) => e === t || (e.focus(), document.activeElement !== t));
370
- }
371
- b(j, "focusFirst");
372
- var Fe = le, Ie = pe, Le = k, Re = Ce, ze = we, Be = Ee, Ve = Oe;
373
- //#endregion
374
- //#region ../node_modules/.pnpm/marked@15.0.12/node_modules/marked/lib/marked.esm.js
375
- function He() {
376
- return {
377
- async: !1,
378
- breaks: !1,
379
- extensions: null,
380
- gfm: !0,
381
- hooks: null,
382
- pedantic: !1,
383
- renderer: null,
384
- silent: !1,
385
- tokenizer: null,
386
- walkTokens: null
387
- };
388
- }
389
- var M = He();
390
- function Ue(e) {
391
- M = e;
392
- }
393
- var N = { exec: () => null };
394
- function P(e, t = "") {
395
- let n = typeof e == "string" ? e : e.source, r = {
396
- replace: (e, t) => {
397
- let i = typeof t == "string" ? t : t.source;
398
- return i = i.replace(F.caret, "$1"), n = n.replace(e, i), r;
399
- },
400
- getRegex: () => new RegExp(n, t)
401
- };
402
- return r;
403
- }
404
- var F = {
405
- codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
406
- outputLinkReplace: /\\([\[\]])/g,
407
- indentCodeCompensation: /^(\s+)(?:```)/,
408
- beginningSpace: /^\s+/,
409
- endingHash: /#$/,
410
- startingSpaceChar: /^ /,
411
- endingSpaceChar: / $/,
412
- nonSpaceChar: /[^ ]/,
413
- newLineCharGlobal: /\n/g,
414
- tabCharGlobal: /\t/g,
415
- multipleSpaceGlobal: /\s+/g,
416
- blankLine: /^[ \t]*$/,
417
- doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
418
- blockquoteStart: /^ {0,3}>/,
419
- blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
420
- blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
421
- listReplaceTabs: /^\t+/,
422
- listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
423
- listIsTask: /^\[[ xX]\] /,
424
- listReplaceTask: /^\[[ xX]\] +/,
425
- anyLine: /\n.*\n/,
426
- hrefBrackets: /^<(.*)>$/,
427
- tableDelimiter: /[:|]/,
428
- tableAlignChars: /^\||\| *$/g,
429
- tableRowBlankLine: /\n[ \t]*$/,
430
- tableAlignRight: /^ *-+: *$/,
431
- tableAlignCenter: /^ *:-+: *$/,
432
- tableAlignLeft: /^ *:-+ *$/,
433
- startATag: /^<a /i,
434
- endATag: /^<\/a>/i,
435
- startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
436
- endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
437
- startAngleBracket: /^</,
438
- endAngleBracket: />$/,
439
- pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
440
- unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
441
- escapeTest: /[&<>"']/,
442
- escapeReplace: /[&<>"']/g,
443
- escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
444
- escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
445
- unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,
446
- caret: /(^|[^\[])\^/g,
447
- percentDecode: /%25/g,
448
- findPipe: /\|/g,
449
- splitPipe: / \|/,
450
- slashPipe: /\\\|/g,
451
- carriageReturn: /\r\n|\r/g,
452
- spaceLine: /^ +$/gm,
453
- notSpaceStart: /^\S*/,
454
- endingNewline: /\n$/,
455
- listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
456
- nextBulletRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
457
- hrRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
458
- fencesBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`),
459
- headingBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}#`),
460
- htmlBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i")
461
- }, We = /^(?:[ \t]*(?:\n|$))+/, Ge = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Ke = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, qe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, Ye = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Xe = P(Ye).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ze = P(Ye).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), L = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Qe = /^[^\n]+/, R = /(?!\s*\])(?:\\.|[^\[\]\\])+/, $e = P(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", R).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), et = P(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Je).getRegex(), z = "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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", tt = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, nt = P("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", tt).replace("tag", z).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), rt = P(L).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", z).getRegex(), it = {
462
- blockquote: P(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", rt).getRegex(),
463
- code: Ge,
464
- def: $e,
465
- fences: Ke,
466
- heading: qe,
467
- hr: I,
468
- html: nt,
469
- lheading: Xe,
470
- list: et,
471
- newline: We,
472
- paragraph: rt,
473
- table: N,
474
- text: Qe
475
- }, at = P("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", z).getRegex(), ot = {
476
- ...it,
477
- lheading: Ze,
478
- table: at,
479
- paragraph: P(L).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", at).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", z).getRegex()
480
- }, st = {
481
- ...it,
482
- html: P("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", tt).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
483
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
484
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
485
- fences: N,
486
- lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
487
- paragraph: P(L).replace("hr", I).replace("heading", " *#{1,6} *[^\n]").replace("lheading", Xe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
488
- }, ct = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, lt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ut = /^( {2,}|\\)\n(?!\s*$)/, dt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, B = /[\p{P}\p{S}]/u, ft = /[\s\p{P}\p{S}]/u, pt = /[^\s\p{P}\p{S}]/u, mt = P(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, ft).getRegex(), ht = /(?!~)[\p{P}\p{S}]/u, gt = /(?!~)[\s\p{P}\p{S}]/u, _t = /(?:[^\s\p{P}\p{S}]|~)/u, vt = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, yt = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, bt = P(yt, "u").replace(/punct/g, B).getRegex(), xt = P(yt, "u").replace(/punct/g, ht).getRegex(), St = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ct = P(St, "gu").replace(/notPunctSpace/g, pt).replace(/punctSpace/g, ft).replace(/punct/g, B).getRegex(), wt = P(St, "gu").replace(/notPunctSpace/g, _t).replace(/punctSpace/g, gt).replace(/punct/g, ht).getRegex(), Tt = P("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, pt).replace(/punctSpace/g, ft).replace(/punct/g, B).getRegex(), Et = P(/\\(punct)/, "gu").replace(/punct/g, B).getRegex(), Dt = P(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Ot = P(tt).replace("(?:-->|$)", "-->").getRegex(), kt = P("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Ot).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), V = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, At = P(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", V).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), jt = P(/^!?\[(label)\]\[(ref)\]/).replace("label", V).replace("ref", R).getRegex(), Mt = P(/^!?\[(ref)\](?:\[\])?/).replace("ref", R).getRegex(), Nt = {
489
- _backpedal: N,
490
- anyPunctuation: Et,
491
- autolink: Dt,
492
- blockSkip: vt,
493
- br: ut,
494
- code: lt,
495
- del: N,
496
- emStrongLDelim: bt,
497
- emStrongRDelimAst: Ct,
498
- emStrongRDelimUnd: Tt,
499
- escape: ct,
500
- link: At,
501
- nolink: Mt,
502
- punctuation: mt,
503
- reflink: jt,
504
- reflinkSearch: P("reflink|nolink(?!\\()", "g").replace("reflink", jt).replace("nolink", Mt).getRegex(),
505
- tag: kt,
506
- text: dt,
507
- url: N
508
- }, Pt = {
509
- ...Nt,
510
- link: P(/^!?\[(label)\]\((.*?)\)/).replace("label", V).getRegex(),
511
- reflink: P(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", V).getRegex()
512
- }, Ft = {
513
- ...Nt,
514
- emStrongRDelimAst: wt,
515
- emStrongLDelim: xt,
516
- url: P(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
517
- _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
518
- del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
519
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
520
- }, It = {
521
- ...Ft,
522
- br: P(ut).replace("{2,}", "*").getRegex(),
523
- text: P(Ft.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
524
- }, H = {
525
- normal: it,
526
- gfm: ot,
527
- pedantic: st
528
- }, U = {
529
- normal: Nt,
530
- gfm: Ft,
531
- breaks: It,
532
- pedantic: Pt
533
- }, Lt = {
534
- "&": "&amp;",
535
- "<": "&lt;",
536
- ">": "&gt;",
537
- "\"": "&quot;",
538
- "'": "&#39;"
539
- }, Rt = (e) => Lt[e];
540
- function W(e, t) {
541
- if (t) {
542
- if (F.escapeTest.test(e)) return e.replace(F.escapeReplace, Rt);
543
- } else if (F.escapeTestNoEncode.test(e)) return e.replace(F.escapeReplaceNoEncode, Rt);
544
- return e;
545
- }
546
- function zt(e) {
547
- try {
548
- e = encodeURI(e).replace(F.percentDecode, "%");
549
- } catch {
550
- return null;
551
- }
552
- return e;
553
- }
554
- function Bt(e, t) {
555
- let n = e.replace(F.findPipe, (e, t, n) => {
556
- let r = !1, i = t;
557
- for (; --i >= 0 && n[i] === "\\";) r = !r;
558
- return r ? "|" : " |";
559
- }).split(F.splitPipe), r = 0;
560
- if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) {
561
- if (n.length > t) n.splice(t);
562
- else for (; n.length < t;) n.push("");
563
- }
564
- for (; r < n.length; r++) n[r] = n[r].trim().replace(F.slashPipe, "|");
565
- return n;
566
- }
567
- function G(e, t, n) {
568
- let r = e.length;
569
- if (r === 0) return "";
570
- let i = 0;
571
- for (; i < r;) {
572
- let a = e.charAt(r - i - 1);
573
- if (a === t && !n) i++;
574
- else if (a !== t && n) i++;
575
- else break;
576
- }
577
- return e.slice(0, r - i);
578
- }
579
- function Vt(e, t) {
580
- if (e.indexOf(t[1]) === -1) return -1;
581
- let n = 0;
582
- for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
583
- else if (e[r] === t[0]) n++;
584
- else if (e[r] === t[1] && (n--, n < 0)) return r;
585
- return n > 0 ? -2 : -1;
586
- }
587
- function Ht(e, t, n, r, i) {
588
- let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
589
- r.state.inLink = !0;
590
- let c = {
591
- type: e[0].charAt(0) === "!" ? "image" : "link",
592
- raw: n,
593
- href: a,
594
- title: o,
595
- text: s,
596
- tokens: r.inlineTokens(s)
597
- };
598
- return r.state.inLink = !1, c;
599
- }
600
- function Ut(e, t, n) {
601
- let r = e.match(n.other.indentCodeCompensation);
602
- if (r === null) return t;
603
- let i = r[1];
604
- return t.split("\n").map((e) => {
605
- let t = e.match(n.other.beginningSpace);
606
- if (t === null) return e;
607
- let [r] = t;
608
- return r.length >= i.length ? e.slice(i.length) : e;
609
- }).join("\n");
610
- }
611
- var K = class {
612
- options;
613
- rules;
614
- lexer;
615
- constructor(e) {
616
- this.options = e || M;
617
- }
618
- space(e) {
619
- let t = this.rules.block.newline.exec(e);
620
- if (t && t[0].length > 0) return {
621
- type: "space",
622
- raw: t[0]
623
- };
624
- }
625
- code(e) {
626
- let t = this.rules.block.code.exec(e);
627
- if (t) {
628
- let e = t[0].replace(this.rules.other.codeRemoveIndent, "");
629
- return {
630
- type: "code",
631
- raw: t[0],
632
- codeBlockStyle: "indented",
633
- text: this.options.pedantic ? e : G(e, "\n")
634
- };
635
- }
636
- }
637
- fences(e) {
638
- let t = this.rules.block.fences.exec(e);
639
- if (t) {
640
- let e = t[0], n = Ut(e, t[3] || "", this.rules);
641
- return {
642
- type: "code",
643
- raw: e,
644
- lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
645
- text: n
646
- };
647
- }
648
- }
649
- heading(e) {
650
- let t = this.rules.block.heading.exec(e);
651
- if (t) {
652
- let e = t[2].trim();
653
- if (this.rules.other.endingHash.test(e)) {
654
- let t = G(e, "#");
655
- (this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
656
- }
657
- return {
658
- type: "heading",
659
- raw: t[0],
660
- depth: t[1].length,
661
- text: e,
662
- tokens: this.lexer.inline(e)
663
- };
664
- }
665
- }
666
- hr(e) {
667
- let t = this.rules.block.hr.exec(e);
668
- if (t) return {
669
- type: "hr",
670
- raw: G(t[0], "\n")
671
- };
672
- }
673
- blockquote(e) {
674
- let t = this.rules.block.blockquote.exec(e);
675
- if (t) {
676
- let e = G(t[0], "\n").split("\n"), n = "", r = "", i = [];
677
- for (; e.length > 0;) {
678
- let t = !1, a = [], o;
679
- for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
680
- else if (!t) a.push(e[o]);
681
- else break;
682
- e = e.slice(o);
683
- let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
684
- n = n ? `${n}
685
- ${s}` : s, r = r ? `${r}
686
- ${c}` : c;
687
- let l = this.lexer.state.top;
688
- if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
689
- let u = i.at(-1);
690
- if (u?.type === "code") break;
691
- if (u?.type === "blockquote") {
692
- let t = u, a = t.raw + "\n" + e.join("\n"), o = this.blockquote(a);
693
- i[i.length - 1] = o, n = n.substring(0, n.length - t.raw.length) + o.raw, r = r.substring(0, r.length - t.text.length) + o.text;
694
- break;
695
- }
696
- if (u?.type === "list") {
697
- let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
698
- i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
699
- continue;
700
- }
701
- }
702
- return {
703
- type: "blockquote",
704
- raw: n,
705
- tokens: i,
706
- text: r
707
- };
708
- }
709
- }
710
- list(e) {
711
- let t = this.rules.block.list.exec(e);
712
- if (t) {
713
- let n = t[1].trim(), r = n.length > 1, i = {
714
- type: "list",
715
- raw: "",
716
- ordered: r,
717
- start: r ? +n.slice(0, -1) : "",
718
- loose: !1,
719
- items: []
720
- };
721
- n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
722
- let a = this.rules.other.listItemRegex(n), o = !1;
723
- for (; e;) {
724
- let n = !1, r = "", s = "";
725
- if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
726
- r = t[0], e = e.substring(r.length);
727
- let c = t[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (e) => " ".repeat(3 * e.length)), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
728
- if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = t[2].search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
729
- let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d);
730
- for (; e;) {
731
- let f = e.split("\n", 1)[0], p;
732
- if (l = f, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, " "), p = l) : p = l.replace(this.rules.other.tabCharGlobal, " "), i.test(l) || a.test(l) || o.test(l) || t.test(l) || n.test(l)) break;
733
- if (p.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + p.slice(d);
734
- else {
735
- if (u || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
736
- s += "\n" + l;
737
- }
738
- !u && !l.trim() && (u = !0), r += f + "\n", e = e.substring(f.length + 1), c = p.slice(d);
739
- }
740
- }
741
- i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0));
742
- let f = null, p;
743
- this.options.gfm && (f = this.rules.other.listIsTask.exec(s), f && (p = f[0] !== "[ ] ", s = s.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
744
- type: "list_item",
745
- raw: r,
746
- task: !!f,
747
- checked: p,
748
- loose: !1,
749
- text: s,
750
- tokens: []
751
- }), i.raw += r;
752
- }
753
- let s = i.items.at(-1);
754
- if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
755
- else return;
756
- i.raw = i.raw.trimEnd();
757
- for (let e = 0; e < i.items.length; e++) if (this.lexer.state.top = !1, i.items[e].tokens = this.lexer.blockTokens(i.items[e].text, []), !i.loose) {
758
- let t = i.items[e].tokens.filter((e) => e.type === "space");
759
- i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
760
- }
761
- if (i.loose) for (let e = 0; e < i.items.length; e++) i.items[e].loose = !0;
762
- return i;
763
- }
764
- }
765
- html(e) {
766
- let t = this.rules.block.html.exec(e);
767
- if (t) return {
768
- type: "html",
769
- block: !0,
770
- raw: t[0],
771
- pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
772
- text: t[0]
773
- };
774
- }
775
- def(e) {
776
- let t = this.rules.block.def.exec(e);
777
- if (t) {
778
- let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
779
- return {
780
- type: "def",
781
- tag: e,
782
- raw: t[0],
783
- href: n,
784
- title: r
785
- };
786
- }
787
- }
788
- table(e) {
789
- let t = this.rules.block.table.exec(e);
790
- if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
791
- let n = Bt(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
792
- type: "table",
793
- raw: t[0],
794
- header: [],
795
- align: [],
796
- rows: []
797
- };
798
- if (n.length === r.length) {
799
- for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? a.align.push("left") : a.align.push(null);
800
- for (let e = 0; e < n.length; e++) a.header.push({
801
- text: n[e],
802
- tokens: this.lexer.inline(n[e]),
803
- header: !0,
804
- align: a.align[e]
805
- });
806
- for (let e of i) a.rows.push(Bt(e, a.header.length).map((e, t) => ({
807
- text: e,
808
- tokens: this.lexer.inline(e),
809
- header: !1,
810
- align: a.align[t]
811
- })));
812
- return a;
813
- }
814
- }
815
- lheading(e) {
816
- let t = this.rules.block.lheading.exec(e);
817
- if (t) return {
818
- type: "heading",
819
- raw: t[0],
820
- depth: t[2].charAt(0) === "=" ? 1 : 2,
821
- text: t[1],
822
- tokens: this.lexer.inline(t[1])
823
- };
824
- }
825
- paragraph(e) {
826
- let t = this.rules.block.paragraph.exec(e);
827
- if (t) {
828
- let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
829
- return {
830
- type: "paragraph",
831
- raw: t[0],
832
- text: e,
833
- tokens: this.lexer.inline(e)
834
- };
835
- }
836
- }
837
- text(e) {
838
- let t = this.rules.block.text.exec(e);
839
- if (t) return {
840
- type: "text",
841
- raw: t[0],
842
- text: t[0],
843
- tokens: this.lexer.inline(t[0])
844
- };
845
- }
846
- escape(e) {
847
- let t = this.rules.inline.escape.exec(e);
848
- if (t) return {
849
- type: "escape",
850
- raw: t[0],
851
- text: t[1]
852
- };
853
- }
854
- tag(e) {
855
- let t = this.rules.inline.tag.exec(e);
856
- if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
857
- type: "html",
858
- raw: t[0],
859
- inLink: this.lexer.state.inLink,
860
- inRawBlock: this.lexer.state.inRawBlock,
861
- block: !1,
862
- text: t[0]
863
- };
864
- }
865
- link(e) {
866
- let t = this.rules.inline.link.exec(e);
867
- if (t) {
868
- let e = t[2].trim();
869
- if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
870
- if (!this.rules.other.endAngleBracket.test(e)) return;
871
- let t = G(e.slice(0, -1), "\\");
872
- if ((e.length - t.length) % 2 == 0) return;
873
- } else {
874
- let e = Vt(t[2], "()");
875
- if (e === -2) return;
876
- if (e > -1) {
877
- let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
878
- t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
879
- }
880
- }
881
- let n = t[2], r = "";
882
- if (this.options.pedantic) {
883
- let e = this.rules.other.pedanticHrefTitle.exec(n);
884
- e && (n = e[1], r = e[3]);
885
- } else r = t[3] ? t[3].slice(1, -1) : "";
886
- return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), Ht(t, {
887
- href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
888
- title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
889
- }, t[0], this.lexer, this.rules);
890
- }
891
- }
892
- reflink(e, t) {
893
- let n;
894
- if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
895
- let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
896
- if (!e) {
897
- let e = n[0].charAt(0);
898
- return {
899
- type: "text",
900
- raw: e,
901
- text: e
902
- };
903
- }
904
- return Ht(n, e, n[0], this.lexer, this.rules);
905
- }
906
- }
907
- emStrong(e, t, n = "") {
908
- let r = this.rules.inline.emStrongLDelim.exec(e);
909
- if (r && !(r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[2]) || !n || this.rules.inline.punctuation.exec(n))) {
910
- let n = [...r[0]].length - 1, i, a, o = n, s = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
911
- for (c.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = c.exec(t)) != null;) {
912
- if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
913
- if (a = [...i].length, r[3] || r[4]) {
914
- o += a;
915
- continue;
916
- }
917
- if ((r[5] || r[6]) && n % 3 && !((n + a) % 3)) {
918
- s += a;
919
- continue;
920
- }
921
- if (o -= a, o > 0) continue;
922
- a = Math.min(a, a + o + s);
923
- let t = [...r[0]][0].length, c = e.slice(0, n + r.index + t + a);
924
- if (Math.min(n, a) % 2) {
925
- let e = c.slice(1, -1);
926
- return {
927
- type: "em",
928
- raw: c,
929
- text: e,
930
- tokens: this.lexer.inlineTokens(e)
931
- };
932
- }
933
- let l = c.slice(2, -2);
934
- return {
935
- type: "strong",
936
- raw: c,
937
- text: l,
938
- tokens: this.lexer.inlineTokens(l)
939
- };
940
- }
941
- }
942
- }
943
- codespan(e) {
944
- let t = this.rules.inline.code.exec(e);
945
- if (t) {
946
- let e = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(e), r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
947
- return n && r && (e = e.substring(1, e.length - 1)), {
948
- type: "codespan",
949
- raw: t[0],
950
- text: e
951
- };
952
- }
953
- }
954
- br(e) {
955
- let t = this.rules.inline.br.exec(e);
956
- if (t) return {
957
- type: "br",
958
- raw: t[0]
959
- };
960
- }
961
- del(e) {
962
- let t = this.rules.inline.del.exec(e);
963
- if (t) return {
964
- type: "del",
965
- raw: t[0],
966
- text: t[2],
967
- tokens: this.lexer.inlineTokens(t[2])
968
- };
969
- }
970
- autolink(e) {
971
- let t = this.rules.inline.autolink.exec(e);
972
- if (t) {
973
- let e, n;
974
- return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
975
- type: "link",
976
- raw: t[0],
977
- text: e,
978
- href: n,
979
- tokens: [{
980
- type: "text",
981
- raw: e,
982
- text: e
983
- }]
984
- };
985
- }
986
- }
987
- url(e) {
988
- let t;
989
- if (t = this.rules.inline.url.exec(e)) {
990
- let e, n;
991
- if (t[2] === "@") e = t[0], n = "mailto:" + e;
992
- else {
993
- let r;
994
- do
995
- r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
996
- while (r !== t[0]);
997
- e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
998
- }
999
- return {
1000
- type: "link",
1001
- raw: t[0],
1002
- text: e,
1003
- href: n,
1004
- tokens: [{
1005
- type: "text",
1006
- raw: e,
1007
- text: e
1008
- }]
1009
- };
1010
- }
1011
- }
1012
- inlineText(e) {
1013
- let t = this.rules.inline.text.exec(e);
1014
- if (t) {
1015
- let e = this.lexer.state.inRawBlock;
1016
- return {
1017
- type: "text",
1018
- raw: t[0],
1019
- text: t[0],
1020
- escaped: e
1021
- };
1022
- }
1023
- }
1024
- }, q = class e {
1025
- tokens;
1026
- options;
1027
- state;
1028
- tokenizer;
1029
- inlineQueue;
1030
- constructor(e) {
1031
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || M, this.options.tokenizer = this.options.tokenizer || new K(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
1032
- inLink: !1,
1033
- inRawBlock: !1,
1034
- top: !0
1035
- };
1036
- let t = {
1037
- other: F,
1038
- block: H.normal,
1039
- inline: U.normal
1040
- };
1041
- this.options.pedantic ? (t.block = H.pedantic, t.inline = U.pedantic) : this.options.gfm && (t.block = H.gfm, t.inline = this.options.breaks ? U.breaks : U.gfm), this.tokenizer.rules = t;
1042
- }
1043
- static get rules() {
1044
- return {
1045
- block: H,
1046
- inline: U
1047
- };
1048
- }
1049
- static lex(t, n) {
1050
- return new e(n).lex(t);
1051
- }
1052
- static lexInline(t, n) {
1053
- return new e(n).inlineTokens(t);
1054
- }
1055
- lex(e) {
1056
- e = e.replace(F.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
1057
- for (let e = 0; e < this.inlineQueue.length; e++) {
1058
- let t = this.inlineQueue[e];
1059
- this.inlineTokens(t.src, t.tokens);
1060
- }
1061
- return this.inlineQueue = [], this.tokens;
1062
- }
1063
- blockTokens(e, t = [], n = !1) {
1064
- for (this.options.pedantic && (e = e.replace(F.tabCharGlobal, " ").replace(F.spaceLine, "")); e;) {
1065
- let r;
1066
- if (this.options.extensions?.block?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
1067
- if (r = this.tokenizer.space(e)) {
1068
- e = e.substring(r.raw.length);
1069
- let n = t.at(-1);
1070
- r.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(r);
1071
- continue;
1072
- }
1073
- if (r = this.tokenizer.code(e)) {
1074
- e = e.substring(r.raw.length);
1075
- let n = t.at(-1);
1076
- n?.type === "paragraph" || n?.type === "text" ? (n.raw += "\n" + r.raw, n.text += "\n" + r.text, this.inlineQueue.at(-1).src = n.text) : t.push(r);
1077
- continue;
1078
- }
1079
- if (r = this.tokenizer.fences(e)) {
1080
- e = e.substring(r.raw.length), t.push(r);
1081
- continue;
1082
- }
1083
- if (r = this.tokenizer.heading(e)) {
1084
- e = e.substring(r.raw.length), t.push(r);
1085
- continue;
1086
- }
1087
- if (r = this.tokenizer.hr(e)) {
1088
- e = e.substring(r.raw.length), t.push(r);
1089
- continue;
1090
- }
1091
- if (r = this.tokenizer.blockquote(e)) {
1092
- e = e.substring(r.raw.length), t.push(r);
1093
- continue;
1094
- }
1095
- if (r = this.tokenizer.list(e)) {
1096
- e = e.substring(r.raw.length), t.push(r);
1097
- continue;
1098
- }
1099
- if (r = this.tokenizer.html(e)) {
1100
- e = e.substring(r.raw.length), t.push(r);
1101
- continue;
1102
- }
1103
- if (r = this.tokenizer.def(e)) {
1104
- e = e.substring(r.raw.length);
1105
- let n = t.at(-1);
1106
- n?.type === "paragraph" || n?.type === "text" ? (n.raw += "\n" + r.raw, n.text += "\n" + r.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
1107
- href: r.href,
1108
- title: r.title
1109
- });
1110
- continue;
1111
- }
1112
- if (r = this.tokenizer.table(e)) {
1113
- e = e.substring(r.raw.length), t.push(r);
1114
- continue;
1115
- }
1116
- if (r = this.tokenizer.lheading(e)) {
1117
- e = e.substring(r.raw.length), t.push(r);
1118
- continue;
1119
- }
1120
- let i = e;
1121
- if (this.options.extensions?.startBlock) {
1122
- let t = Infinity, n = e.slice(1), r;
1123
- this.options.extensions.startBlock.forEach((e) => {
1124
- r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
1125
- }), t < Infinity && t >= 0 && (i = e.substring(0, t + 1));
1126
- }
1127
- if (this.state.top && (r = this.tokenizer.paragraph(i))) {
1128
- let a = t.at(-1);
1129
- n && a?.type === "paragraph" ? (a.raw += "\n" + r.raw, a.text += "\n" + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
1130
- continue;
1131
- }
1132
- if (r = this.tokenizer.text(e)) {
1133
- e = e.substring(r.raw.length);
1134
- let n = t.at(-1);
1135
- n?.type === "text" ? (n.raw += "\n" + r.raw, n.text += "\n" + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(r);
1136
- continue;
1137
- }
1138
- if (e) {
1139
- let t = "Infinite loop on byte: " + e.charCodeAt(0);
1140
- if (this.options.silent) {
1141
- console.error(t);
1142
- break;
1143
- }
1144
- throw Error(t);
1145
- }
1146
- }
1147
- return this.state.top = !0, t;
1148
- }
1149
- inline(e, t = []) {
1150
- return this.inlineQueue.push({
1151
- src: e,
1152
- tokens: t
1153
- }), t;
1154
- }
1155
- inlineTokens(e, t = []) {
1156
- let n = e, r = null;
1157
- if (this.tokens.links) {
1158
- let e = Object.keys(this.tokens.links);
1159
- if (e.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null;) e.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1160
- }
1161
- for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1162
- for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null;) n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1163
- let i = !1, a = "";
1164
- for (; e;) {
1165
- i || (a = ""), i = !1;
1166
- let r;
1167
- if (this.options.extensions?.inline?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
1168
- if (r = this.tokenizer.escape(e)) {
1169
- e = e.substring(r.raw.length), t.push(r);
1170
- continue;
1171
- }
1172
- if (r = this.tokenizer.tag(e)) {
1173
- e = e.substring(r.raw.length), t.push(r);
1174
- continue;
1175
- }
1176
- if (r = this.tokenizer.link(e)) {
1177
- e = e.substring(r.raw.length), t.push(r);
1178
- continue;
1179
- }
1180
- if (r = this.tokenizer.reflink(e, this.tokens.links)) {
1181
- e = e.substring(r.raw.length);
1182
- let n = t.at(-1);
1183
- r.type === "text" && n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
1184
- continue;
1185
- }
1186
- if (r = this.tokenizer.emStrong(e, n, a)) {
1187
- e = e.substring(r.raw.length), t.push(r);
1188
- continue;
1189
- }
1190
- if (r = this.tokenizer.codespan(e)) {
1191
- e = e.substring(r.raw.length), t.push(r);
1192
- continue;
1193
- }
1194
- if (r = this.tokenizer.br(e)) {
1195
- e = e.substring(r.raw.length), t.push(r);
1196
- continue;
1197
- }
1198
- if (r = this.tokenizer.del(e)) {
1199
- e = e.substring(r.raw.length), t.push(r);
1200
- continue;
1201
- }
1202
- if (r = this.tokenizer.autolink(e)) {
1203
- e = e.substring(r.raw.length), t.push(r);
1204
- continue;
1205
- }
1206
- if (!this.state.inLink && (r = this.tokenizer.url(e))) {
1207
- e = e.substring(r.raw.length), t.push(r);
1208
- continue;
1209
- }
1210
- let o = e;
1211
- if (this.options.extensions?.startInline) {
1212
- let t = Infinity, n = e.slice(1), r;
1213
- this.options.extensions.startInline.forEach((e) => {
1214
- r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
1215
- }), t < Infinity && t >= 0 && (o = e.substring(0, t + 1));
1216
- }
1217
- if (r = this.tokenizer.inlineText(o)) {
1218
- e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (a = r.raw.slice(-1)), i = !0;
1219
- let n = t.at(-1);
1220
- n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
1221
- continue;
1222
- }
1223
- if (e) {
1224
- let t = "Infinite loop on byte: " + e.charCodeAt(0);
1225
- if (this.options.silent) {
1226
- console.error(t);
1227
- break;
1228
- }
1229
- throw Error(t);
1230
- }
1231
- }
1232
- return t;
1233
- }
1234
- }, J = class {
1235
- options;
1236
- parser;
1237
- constructor(e) {
1238
- this.options = e || M;
1239
- }
1240
- space(e) {
1241
- return "";
1242
- }
1243
- code({ text: e, lang: t, escaped: n }) {
1244
- let r = (t || "").match(F.notSpaceStart)?.[0], i = e.replace(F.endingNewline, "") + "\n";
1245
- return r ? "<pre><code class=\"language-" + W(r) + "\">" + (n ? i : W(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : W(i, !0)) + "</code></pre>\n";
1246
- }
1247
- blockquote({ tokens: e }) {
1248
- return `<blockquote>
1249
- ${this.parser.parse(e)}</blockquote>
1250
- `;
1251
- }
1252
- html({ text: e }) {
1253
- return e;
1254
- }
1255
- heading({ tokens: e, depth: t }) {
1256
- return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1257
- `;
1258
- }
1259
- hr(e) {
1260
- return "<hr>\n";
1261
- }
1262
- list(e) {
1263
- let t = e.ordered, n = e.start, r = "";
1264
- for (let t = 0; t < e.items.length; t++) {
1265
- let n = e.items[t];
1266
- r += this.listitem(n);
1267
- }
1268
- let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
1269
- return "<" + i + a + ">\n" + r + "</" + i + ">\n";
1270
- }
1271
- listitem(e) {
1272
- let t = "";
1273
- if (e.task) {
1274
- let n = this.checkbox({ checked: !!e.checked });
1275
- e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " + W(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = !0)) : e.tokens.unshift({
1276
- type: "text",
1277
- raw: n + " ",
1278
- text: n + " ",
1279
- escaped: !0
1280
- }) : t += n + " ";
1281
- }
1282
- return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
1283
- `;
1284
- }
1285
- checkbox({ checked: e }) {
1286
- return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\">";
1287
- }
1288
- paragraph({ tokens: e }) {
1289
- return `<p>${this.parser.parseInline(e)}</p>
1290
- `;
1291
- }
1292
- table(e) {
1293
- let t = "", n = "";
1294
- for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
1295
- t += this.tablerow({ text: n });
1296
- let r = "";
1297
- for (let t = 0; t < e.rows.length; t++) {
1298
- let i = e.rows[t];
1299
- n = "";
1300
- for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
1301
- r += this.tablerow({ text: n });
1302
- }
1303
- return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
1304
- }
1305
- tablerow({ text: e }) {
1306
- return `<tr>
1307
- ${e}</tr>
1308
- `;
1309
- }
1310
- tablecell(e) {
1311
- let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1312
- return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1313
- `;
1314
- }
1315
- strong({ tokens: e }) {
1316
- return `<strong>${this.parser.parseInline(e)}</strong>`;
1317
- }
1318
- em({ tokens: e }) {
1319
- return `<em>${this.parser.parseInline(e)}</em>`;
1320
- }
1321
- codespan({ text: e }) {
1322
- return `<code>${W(e, !0)}</code>`;
1323
- }
1324
- br(e) {
1325
- return "<br>";
1326
- }
1327
- del({ tokens: e }) {
1328
- return `<del>${this.parser.parseInline(e)}</del>`;
1329
- }
1330
- link({ href: e, title: t, tokens: n }) {
1331
- let r = this.parser.parseInline(n), i = zt(e);
1332
- if (i === null) return r;
1333
- e = i;
1334
- let a = "<a href=\"" + e + "\"";
1335
- return t && (a += " title=\"" + W(t) + "\""), a += ">" + r + "</a>", a;
1336
- }
1337
- image({ href: e, title: t, text: n, tokens: r }) {
1338
- r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1339
- let i = zt(e);
1340
- if (i === null) return W(n);
1341
- e = i;
1342
- let a = `<img src="${e}" alt="${n}"`;
1343
- return t && (a += ` title="${W(t)}"`), a += ">", a;
1344
- }
1345
- text(e) {
1346
- return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : W(e.text);
1347
- }
1348
- }, Wt = class {
1349
- strong({ text: e }) {
1350
- return e;
1351
- }
1352
- em({ text: e }) {
1353
- return e;
1354
- }
1355
- codespan({ text: e }) {
1356
- return e;
1357
- }
1358
- del({ text: e }) {
1359
- return e;
1360
- }
1361
- html({ text: e }) {
1362
- return e;
1363
- }
1364
- text({ text: e }) {
1365
- return e;
1366
- }
1367
- link({ text: e }) {
1368
- return "" + e;
1369
- }
1370
- image({ text: e }) {
1371
- return "" + e;
1372
- }
1373
- br() {
1374
- return "";
1375
- }
1376
- }, Y = class e {
1377
- options;
1378
- renderer;
1379
- textRenderer;
1380
- constructor(e) {
1381
- this.options = e || M, this.options.renderer = this.options.renderer || new J(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Wt();
1382
- }
1383
- static parse(t, n) {
1384
- return new e(n).parse(t);
1385
- }
1386
- static parseInline(t, n) {
1387
- return new e(n).parseInline(t);
1388
- }
1389
- parse(e, t = !0) {
1390
- let n = "";
1391
- for (let r = 0; r < e.length; r++) {
1392
- let i = e[r];
1393
- if (this.options.extensions?.renderers?.[i.type]) {
1394
- let e = i, t = this.options.extensions.renderers[e.type].call({ parser: this }, e);
1395
- if (t !== !1 || ![
1396
- "space",
1397
- "hr",
1398
- "heading",
1399
- "code",
1400
- "table",
1401
- "blockquote",
1402
- "list",
1403
- "html",
1404
- "paragraph",
1405
- "text"
1406
- ].includes(e.type)) {
1407
- n += t || "";
1408
- continue;
1409
- }
1410
- }
1411
- let a = i;
1412
- switch (a.type) {
1413
- case "space":
1414
- n += this.renderer.space(a);
1415
- continue;
1416
- case "hr":
1417
- n += this.renderer.hr(a);
1418
- continue;
1419
- case "heading":
1420
- n += this.renderer.heading(a);
1421
- continue;
1422
- case "code":
1423
- n += this.renderer.code(a);
1424
- continue;
1425
- case "table":
1426
- n += this.renderer.table(a);
1427
- continue;
1428
- case "blockquote":
1429
- n += this.renderer.blockquote(a);
1430
- continue;
1431
- case "list":
1432
- n += this.renderer.list(a);
1433
- continue;
1434
- case "html":
1435
- n += this.renderer.html(a);
1436
- continue;
1437
- case "paragraph":
1438
- n += this.renderer.paragraph(a);
1439
- continue;
1440
- case "text": {
1441
- let i = a, o = this.renderer.text(i);
1442
- for (; r + 1 < e.length && e[r + 1].type === "text";) i = e[++r], o += "\n" + this.renderer.text(i);
1443
- n += t ? this.renderer.paragraph({
1444
- type: "paragraph",
1445
- raw: o,
1446
- text: o,
1447
- tokens: [{
1448
- type: "text",
1449
- raw: o,
1450
- text: o,
1451
- escaped: !0
1452
- }]
1453
- }) : o;
1454
- continue;
1455
- }
1456
- default: {
1457
- let e = "Token with \"" + a.type + "\" type was not found.";
1458
- if (this.options.silent) return console.error(e), "";
1459
- throw Error(e);
1460
- }
1461
- }
1462
- }
1463
- return n;
1464
- }
1465
- parseInline(e, t = this.renderer) {
1466
- let n = "";
1467
- for (let r = 0; r < e.length; r++) {
1468
- let i = e[r];
1469
- if (this.options.extensions?.renderers?.[i.type]) {
1470
- let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1471
- if (e !== !1 || ![
1472
- "escape",
1473
- "html",
1474
- "link",
1475
- "image",
1476
- "strong",
1477
- "em",
1478
- "codespan",
1479
- "br",
1480
- "del",
1481
- "text"
1482
- ].includes(i.type)) {
1483
- n += e || "";
1484
- continue;
1485
- }
1486
- }
1487
- let a = i;
1488
- switch (a.type) {
1489
- case "escape":
1490
- n += t.text(a);
1491
- break;
1492
- case "html":
1493
- n += t.html(a);
1494
- break;
1495
- case "link":
1496
- n += t.link(a);
1497
- break;
1498
- case "image":
1499
- n += t.image(a);
1500
- break;
1501
- case "strong":
1502
- n += t.strong(a);
1503
- break;
1504
- case "em":
1505
- n += t.em(a);
1506
- break;
1507
- case "codespan":
1508
- n += t.codespan(a);
1509
- break;
1510
- case "br":
1511
- n += t.br(a);
1512
- break;
1513
- case "del":
1514
- n += t.del(a);
1515
- break;
1516
- case "text":
1517
- n += t.text(a);
1518
- break;
1519
- default: {
1520
- let e = "Token with \"" + a.type + "\" type was not found.";
1521
- if (this.options.silent) return console.error(e), "";
1522
- throw Error(e);
1523
- }
1524
- }
1525
- }
1526
- return n;
1527
- }
1528
- }, X = class {
1529
- options;
1530
- block;
1531
- constructor(e) {
1532
- this.options = e || M;
1533
- }
1534
- static passThroughHooks = /* @__PURE__ */ new Set([
1535
- "preprocess",
1536
- "postprocess",
1537
- "processAllTokens"
1538
- ]);
1539
- preprocess(e) {
1540
- return e;
1541
- }
1542
- postprocess(e) {
1543
- return e;
1544
- }
1545
- processAllTokens(e) {
1546
- return e;
1547
- }
1548
- provideLexer() {
1549
- return this.block ? q.lex : q.lexInline;
1550
- }
1551
- provideParser() {
1552
- return this.block ? Y.parse : Y.parseInline;
1553
- }
1554
- }, Z = new class {
1555
- defaults = He();
1556
- options = this.setOptions;
1557
- parse = this.parseMarkdown(!0);
1558
- parseInline = this.parseMarkdown(!1);
1559
- Parser = Y;
1560
- Renderer = J;
1561
- TextRenderer = Wt;
1562
- Lexer = q;
1563
- Tokenizer = K;
1564
- Hooks = X;
1565
- constructor(...e) {
1566
- this.use(...e);
1567
- }
1568
- walkTokens(e, t) {
1569
- let n = [];
1570
- for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
1571
- case "table": {
1572
- let e = r;
1573
- for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
1574
- for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
1575
- break;
1576
- }
1577
- case "list": {
1578
- let e = r;
1579
- n = n.concat(this.walkTokens(e.items, t));
1580
- break;
1581
- }
1582
- default: {
1583
- let e = r;
1584
- this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
1585
- let i = e[r].flat(Infinity);
1586
- n = n.concat(this.walkTokens(i, t));
1587
- }) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
1588
- }
1589
- }
1590
- return n;
1591
- }
1592
- use(...e) {
1593
- let t = this.defaults.extensions || {
1594
- renderers: {},
1595
- childTokens: {}
1596
- };
1597
- return e.forEach((e) => {
1598
- let n = { ...e };
1599
- if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
1600
- if (!e.name) throw Error("extension name required");
1601
- if ("renderer" in e) {
1602
- let n = t.renderers[e.name];
1603
- n ? t.renderers[e.name] = function(...t) {
1604
- let r = e.renderer.apply(this, t);
1605
- return r === !1 && (r = n.apply(this, t)), r;
1606
- } : t.renderers[e.name] = e.renderer;
1607
- }
1608
- if ("tokenizer" in e) {
1609
- if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
1610
- let n = t[e.level];
1611
- n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === "block" ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === "inline" && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]));
1612
- }
1613
- "childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
1614
- }), n.extensions = t), e.renderer) {
1615
- let t = this.defaults.renderer || new J(this.defaults);
1616
- for (let n in e.renderer) {
1617
- if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
1618
- if (["options", "parser"].includes(n)) continue;
1619
- let r = n, i = e.renderer[r], a = t[r];
1620
- t[r] = (...e) => {
1621
- let n = i.apply(t, e);
1622
- return n === !1 && (n = a.apply(t, e)), n || "";
1623
- };
1624
- }
1625
- n.renderer = t;
1626
- }
1627
- if (e.tokenizer) {
1628
- let t = this.defaults.tokenizer || new K(this.defaults);
1629
- for (let n in e.tokenizer) {
1630
- if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
1631
- if ([
1632
- "options",
1633
- "rules",
1634
- "lexer"
1635
- ].includes(n)) continue;
1636
- let r = n, i = e.tokenizer[r], a = t[r];
1637
- t[r] = (...e) => {
1638
- let n = i.apply(t, e);
1639
- return n === !1 && (n = a.apply(t, e)), n;
1640
- };
1641
- }
1642
- n.tokenizer = t;
1643
- }
1644
- if (e.hooks) {
1645
- let t = this.defaults.hooks || new X();
1646
- for (let n in e.hooks) {
1647
- if (!(n in t)) throw Error(`hook '${n}' does not exist`);
1648
- if (["options", "block"].includes(n)) continue;
1649
- let r = n, i = e.hooks[r], a = t[r];
1650
- t[r] = X.passThroughHooks.has(n) ? (e) => {
1651
- if (this.defaults.async) return Promise.resolve(i.call(t, e)).then((e) => a.call(t, e));
1652
- let n = i.call(t, e);
1653
- return a.call(t, n);
1654
- } : (...e) => {
1655
- let n = i.apply(t, e);
1656
- return n === !1 && (n = a.apply(t, e)), n;
1657
- };
1658
- }
1659
- n.hooks = t;
1660
- }
1661
- if (e.walkTokens) {
1662
- let t = this.defaults.walkTokens, r = e.walkTokens;
1663
- n.walkTokens = function(e) {
1664
- let n = [];
1665
- return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
1666
- };
1667
- }
1668
- this.defaults = {
1669
- ...this.defaults,
1670
- ...n
1671
- };
1672
- }), this;
1673
- }
1674
- setOptions(e) {
1675
- return this.defaults = {
1676
- ...this.defaults,
1677
- ...e
1678
- }, this;
1679
- }
1680
- lexer(e, t) {
1681
- return q.lex(e, t ?? this.defaults);
1682
- }
1683
- parser(e, t) {
1684
- return Y.parse(e, t ?? this.defaults);
1685
- }
1686
- parseMarkdown(e) {
1687
- return (t, n) => {
1688
- let r = { ...n }, i = {
1689
- ...this.defaults,
1690
- ...r
1691
- }, a = this.onError(!!i.silent, !!i.async);
1692
- if (this.defaults.async === !0 && r.async === !1) return a(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1693
- if (t == null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
1694
- if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
1695
- i.hooks && (i.hooks.options = i, i.hooks.block = e);
1696
- let o = i.hooks ? i.hooks.provideLexer() : e ? q.lex : q.lexInline, s = i.hooks ? i.hooks.provideParser() : e ? Y.parse : Y.parseInline;
1697
- if (i.async) return Promise.resolve(i.hooks ? i.hooks.preprocess(t) : t).then((e) => o(e, i)).then((e) => i.hooks ? i.hooks.processAllTokens(e) : e).then((e) => i.walkTokens ? Promise.all(this.walkTokens(e, i.walkTokens)).then(() => e) : e).then((e) => s(e, i)).then((e) => i.hooks ? i.hooks.postprocess(e) : e).catch(a);
1698
- try {
1699
- i.hooks && (t = i.hooks.preprocess(t));
1700
- let e = o(t, i);
1701
- i.hooks && (e = i.hooks.processAllTokens(e)), i.walkTokens && this.walkTokens(e, i.walkTokens);
1702
- let n = s(e, i);
1703
- return i.hooks && (n = i.hooks.postprocess(n)), n;
1704
- } catch (e) {
1705
- return a(e);
1706
- }
1707
- };
1708
- }
1709
- onError(e, t) {
1710
- return (n) => {
1711
- if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
1712
- let e = "<p>An error occurred:</p><pre>" + W(n.message + "", !0) + "</pre>";
1713
- return t ? Promise.resolve(e) : e;
1714
- }
1715
- if (t) return Promise.reject(n);
1716
- throw n;
1717
- };
1718
- }
1719
- }();
1720
- function Q(e, t) {
1721
- return Z.parse(e, t);
1722
- }
1723
- Q.options = Q.setOptions = function(e) {
1724
- return Z.setOptions(e), Q.defaults = Z.defaults, Ue(Q.defaults), Q;
1725
- }, Q.getDefaults = He, Q.defaults = M, Q.use = function(...e) {
1726
- return Z.use(...e), Q.defaults = Z.defaults, Ue(Q.defaults), Q;
1727
- }, Q.walkTokens = function(e, t) {
1728
- return Z.walkTokens(e, t);
1729
- }, Q.parseInline = Z.parseInline, Q.Parser = Y, Q.parser = Y.parse, Q.Renderer = J, Q.TextRenderer = Wt, Q.Lexer = q, Q.lexer = q.lex, Q.Tokenizer = K, Q.Hooks = X, Q.parse = Q, Q.options, Q.setOptions, Q.use, Q.walkTokens, Q.parseInline, Y.parse, q.lex;
1730
- //#endregion
1731
- //#region src/components/ui/toast.tsx
1732
- var $ = a(), Gt = Fe, Kt = _.forwardRef((e, n) => {
1733
- let r = (0, $.c)(9), i, a;
1734
- r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
1735
- let o;
1736
- r[3] === i ? o = r[4] : (o = t("fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:w-fit md:max-w-[420px]", "print:hidden", i), r[3] = i, r[4] = o);
1737
- let s;
1738
- return r[5] !== a || r[6] !== n || r[7] !== o ? (s = /* @__PURE__ */ (0, v.jsx)(Ie, {
1739
- ref: n,
1740
- className: o,
1741
- ...a
1742
- }), r[5] = a, r[6] = n, r[7] = o, r[8] = s) : s = r[8], s;
1743
- });
1744
- Kt.displayName = Ie.displayName;
1745
- var qt = {
1746
- default: "bg-background border forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]",
1747
- danger: "group destructive text-error border-destructive bg-(--red-1) shadow-md-solid shadow-error forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]"
1748
- }, Jt = r("data-[swipe=move]:transition-none group relative pointer-events-auto flex w-full items-start justify-between gap-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-(--radix-toast-swipe-move-x) data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-(--radix-toast-swipe-end-x) data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full forced-color-adjust-none", {
1749
- variants: { variant: qt },
1750
- defaultVariants: { variant: "default" }
1751
- });
1752
- function Yt(e) {
1753
- return typeof e == "string" && e in qt;
1754
- }
1755
- var Xt = _.forwardRef((e, n) => {
1756
- let r = (0, $.c)(11), i, a, o;
1757
- r[0] === e ? (i = r[1], a = r[2], o = r[3]) : ({className: i, variant: o, ...a} = e, r[0] = e, r[1] = i, r[2] = a, r[3] = o);
1758
- let s = Yt(o) ? o : "default", c;
1759
- r[4] !== i || r[5] !== s ? (c = t(Jt({ variant: s }), "print:hidden", i), r[4] = i, r[5] = s, r[6] = c) : c = r[6];
1760
- let l;
1761
- return r[7] !== a || r[8] !== n || r[9] !== c ? (l = /* @__PURE__ */ (0, v.jsx)(Le, {
1762
- ref: n,
1763
- className: c,
1764
- ...a
1765
- }), r[7] = a, r[8] = n, r[9] = c, r[10] = l) : l = r[10], l;
1766
- });
1767
- Xt.displayName = Le.displayName;
1768
- var Zt = _.forwardRef((e, n) => {
1769
- let r = (0, $.c)(9), i, a;
1770
- r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
1771
- let o;
1772
- r[3] === i ? o = r[4] : (o = t("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive/30 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus-visible:group-[.destructive]:ring-destructive", "forced-color-adjust-none forced-colors:border-[ButtonText] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText] forced-colors:hover:bg-[Highlight] forced-colors:hover:text-[HighlightText] forced-colors:disabled:border-[GrayText] forced-colors:disabled:text-[GrayText]", i), r[3] = i, r[4] = o);
1773
- let s;
1774
- return r[5] !== a || r[6] !== n || r[7] !== o ? (s = /* @__PURE__ */ (0, v.jsx)(Be, {
1775
- ref: n,
1776
- className: o,
1777
- ...a
1778
- }), r[5] = a, r[6] = n, r[7] = o, r[8] = s) : s = r[8], s;
1779
- });
1780
- Zt.displayName = Be.displayName;
1781
- var Qt = _.forwardRef((e, n) => {
1782
- let r = (0, $.c)(10), i, a;
1783
- r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
1784
- let o;
1785
- r[3] === i ? o = r[4] : (o = t("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-500 focus-visible:group-[.destructive]:ring-red-400 focus-visible:group-[.destructive]:ring-offset-red-600", "forced-colors:text-[CanvasText] forced-colors:hover:text-[CanvasText] forced-colors:group-[.destructive]:text-[CanvasText] forced-colors:hover:group-[.destructive]:text-[CanvasText]", i), r[3] = i, r[4] = o);
1786
- let c;
1787
- r[5] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ (0, v.jsx)(s, { className: "h-4 w-4" }), r[5] = c) : c = r[5];
1788
- let l;
1789
- return r[6] !== a || r[7] !== n || r[8] !== o ? (l = /* @__PURE__ */ (0, v.jsx)(Ve, {
1790
- ref: n,
1791
- className: o,
1792
- "toast-close": "",
1793
- ...a,
1794
- children: c
1795
- }), r[6] = a, r[7] = n, r[8] = o, r[9] = l) : l = r[9], l;
1796
- });
1797
- Qt.displayName = Ve.displayName;
1798
- var $t = _.forwardRef((e, n) => {
1799
- let r = (0, $.c)(9), i, a;
1800
- r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
1801
- let o;
1802
- r[3] === i ? o = r[4] : (o = t("text-sm font-semibold", i), r[3] = i, r[4] = o);
1803
- let s;
1804
- return r[5] !== a || r[6] !== n || r[7] !== o ? (s = /* @__PURE__ */ (0, v.jsx)(Re, {
1805
- ref: n,
1806
- className: o,
1807
- ...a
1808
- }), r[5] = a, r[6] = n, r[7] = o, r[8] = s) : s = r[8], s;
1809
- });
1810
- $t.displayName = Re.displayName;
1811
- var en = _.forwardRef((e, n) => {
1812
- let r = (0, $.c)(13), i, a, o;
1813
- r[0] === e ? (i = r[1], a = r[2], o = r[3]) : ({className: i, onPointerDown: a, ...o} = e, r[0] = e, r[1] = i, r[2] = a, r[3] = o);
1814
- let s;
1815
- r[4] === i ? s = r[5] : (s = t("max-h-48 overflow-auto text-sm opacity-90 whitespace-pre-wrap wrap-break-word select-text cursor-text", i), r[4] = i, r[5] = s);
1816
- let c;
1817
- r[6] === a ? c = r[7] : (c = (e) => {
1818
- e.stopPropagation(), a?.(e);
1819
- }, r[6] = a, r[7] = c);
1820
- let l;
1821
- return r[8] !== o || r[9] !== n || r[10] !== s || r[11] !== c ? (l = /* @__PURE__ */ (0, v.jsx)(ze, {
1822
- ref: n,
1823
- className: s,
1824
- onPointerDown: c,
1825
- ...o
1826
- }), r[8] = o, r[9] = n, r[10] = s, r[11] = c, r[12] = l) : l = r[12], l;
1827
- });
1828
- en.displayName = ze.displayName;
1829
- //#endregion
1830
- export { Gt as a, Q as c, en as i, Zt as n, $t as o, Qt as r, Kt as s, Xt as t };